public class PartialOrder { private Category cat; public PartialOrder(Category newCat) { cat = newCat; } //PARTIAL ORDER/INITIAL/TERMINAL OBJECT FUNCTIONS public boolean check_partial(int path[], int domain, int objects[], int object_array[][], String orig) /* Parameters: path: array of integers containing the path of arrows followed so far domain: integer representing the domain of the current arrow in the path objects:array of integers containing the objects visited along the current path object_array: uses the integers representing the objects as subscripts and stores paths to each object as the elements of the array orig: string containing the name of the object being tested for an initial object Purpose: A recursive function to determine if object domain is initial. Design: Traces all paths from object domain. If a path is the first path with its codomain, the path is stored in object_array. Otherwise, the path is compared to the path stored for the object which is the codomain; if it is not equal to the stored path, the object is not initial, a message is displayed, and the function returns false. Otherwise, the function returns true. */ { int i, j, number, current_arrow, codomain; boolean done; int arrow_array[] = new int [cat.ini.getMAXARR()]; int first[] = new int [cat.ini.getMAXWORD()]; int second[] = new int [cat.ini.getMAXWORD()]; // check for a looped path done = false; // for every object in the current path for (i=0; i 1) done = true; } } if (!done) { // make sure the current path is ok if (object_array[domain][0] == -1) { // this object has not been reached yet first = cat.copy_path(path); first = cat.reduce(first); object_array[domain] = cat.copy_path(first); } else { // make sure the current path equals the already-stored path first = cat.copy_path(path); second = cat.copy_path(object_array[domain]); first = cat.reduce(first); second = cat.reduce(second); if (!cat.equals(first, second)) { return false; } } // check all arrows from this object number = cat.all_arr(domain, arrow_array); for (i=0; i=0; j--) { path[j+1] = path[j]; } path[0] = current_arrow; objects[cat.path_len(objects)+1] = -1; objects[cat.path_len(objects)] = codomain; // now recurse by checking from the next object if (!check_partial(path, codomain, objects, object_array, orig)) return false; // presuming the last call returned true, then we remove the last object from the path // and the last arrow for (j=0; j