/* Research Project: Graphical Database for Category Theory J. Bradbury, Dr. R. Rosebrugh, I. Rutherford M. Graves, J. Tweedle Mount Allison University 2001 Updated: May 8th, 2003 File: MakeConfluent.java Description: This file contains the algorithms to make a given category confluent. It is used by the MakeConfluentFrame class. */ public class MakeConfluent { private Category cat; private String newRelations; //Array to store relations that needed to be //added to current category in order to make it confluent. private String output; public MakeConfluent(Category newCat) { cat = newCat; newRelations = ""; output = ""; } public int overlap(int path1[], int path2[]) /* Parameters: path1, path2: arrays of integers representing two paths of arrows. Purpose: To determine if there is an overlap between the two paths and to return its length; if there is no overlap, returns -1. Design: Compare the beginning of path1 to the end of path2. If they are the same, return the size of the overlap; otherwise return -1. */ { int i, k; //the length of the smaller of path1 and path2 int size =0; //temporary variables to store portions of path1 and path2 int temp1[] = new int [cat.ini.getMAXWORD()]; int temp2[] = new int [cat.ini.getMAXWORD()]; if(cat.path_len(path1) > cat.path_len(path2)) { size = cat.path_len(path2); } else { size = cat.path_len(path1); } for(i=0;i