/* Research Project: Graphical Database for Category Theory J. Bradbury, Dr. R. Rosebrugh, I. Rutherford Mount Allison University 2001 File: FunctorNode.java Description: This class contains the information about a functor that is later stored in a linked list. */ import java.io.*; public class FunctorNode //class FunctorNode definition { CatFunctor f; FunctorNode next; Category A; Category B; Category diagram; int functor_type; int saved; File file_; public FunctorNode() //Default constructor for FunctorNode class { f = new CatFunctor(); next = null; A = new Category(); B = new Category(); diagram = new Category(); functor_type = 0; file_ = null; } public FunctorNode(Category newA, Category newB, Category newDiagram, CatFunctor newf) //Alternate constructor that is applicable when category A and B //along with the cat_functor are included as parameters { A = newA; B = newB; diagram = newDiagram; f = newf; next = null; file_ = null; } public boolean check_domain(int path[], int arrow) /* Parameters: path: the path in B that the arrow goes to under the functor arrow: the arrow of A that goes to the path under the functor f: a category functor A: the category that the functor goes from B: the category that the functor goes to Purpose: To check that the object which is the domain of the arrow in A goes to the object which is the domain of the path in B that the arrow goes to under the functor Design: Returns true if the domains match up, false otherwise */ { if(f.obj[A.arr[arrow][0]] != B.arr[path[B.path_len(path)-1]][0]) {return false;} return true; } public boolean check_codomain(int path[], int arrow) //This function checks that the object which is the codomain of the arrow in //A goes to the object which is the codomain of the path in B that the arrow goes //to under the functor. It returns true if the codomains match up, false otherwise { if(f.obj[A.arr[arrow][1]] != B.arr[path[0]][1]) {return(false);} return true; } public void updateDiagramCategory() /* This ftion creates a new diagram based on the categories A and B, and creates a new random graph for it */ { // the diagram will be a copy of category A: //diagram = new Category(); diagram.copyCategory(A); // but the names of each object and arrow will be taken from category B: int i, j; for (i=0; i