/* Research Project: Graphical Database for Category Theory J. Bradbury, Dr. R. Rosebrugh, I. Rutherford Mount Allison University 2001 File: IsoFrame.java Description: This class implements a frame which allows the user to run the category tool "Isomorphism" on the current category. */ import java.awt.*; import java.awt.event.*; import borland.jbcl.layout.*; import borland.jbcl.control.*; public class IsoFrame extends Frame { Panel panel1 = new Panel(); XYLayout xYLayout1 = new XYLayout(); Button iso = new Button(); Button close = new Button(); TextArea viewbox = new TextArea("", 10, 10, TextArea.SCROLLBARS_VERTICAL_ONLY); Choice choice1 = new Choice(); Choice choice2 = new Choice(); MainWindow ed; CheckboxControl checkbox1 = new CheckboxControl(); CheckboxControl checkbox2 = new CheckboxControl(); TextField path2 = new TextField(); TextField path1 = new TextField(); int maxpaths = 50; boolean includeid = true, endopassed = false; public IsoFrame(MainWindow edit) { ed = edit; edit.enableMenus(false); try { jbInit(); } catch (Exception e) { e.printStackTrace(); } add(panel1); pack(); } private void jbInit() throws Exception { this.setTitle("GDCT: Isomorphism"); this.setBackground(new Color(192,192,192)); xYLayout1.setWidth(403); xYLayout1.setHeight(187); iso.setLabel("Iso?"); close.setLabel("Close"); checkbox1.setLabel("Specify first path"); checkbox1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { checkbox1_itemStateChanged(e); } }); checkbox2.setLabel("Specify second path"); checkbox2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { checkbox2_itemStateChanged(e); } }); //this.addWindowListener(new IsoFrame_this_windowAdapter(this)); panel1.setLayout(xYLayout1); panel1.add(iso, new XYConstraints(7, 152, 66, 25)); panel1.add(close, new XYConstraints(81, 152, 61, 25)); panel1.add(viewbox, new XYConstraints(152, 9, 242, 169)); panel1.add(choice1, new XYConstraints(7, 65, 134, -1)); panel1.add(choice2, new XYConstraints(7, 104, 135, -1)); panel1.add(checkbox1, new XYConstraints(8, 9, 132, 20)); panel1.add(checkbox2, new XYConstraints(8, 32, 131, 18)); panel1.add(path1, new XYConstraints(7, 65, 134, 21)); panel1.add(path2, new XYConstraints(7, 104, 134, 21)); viewbox.setEditable(false); viewbox.setBackground(Color.white); iso.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { iso_actionPerformed(e); } }); close.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { close_actionPerformed(e); } }); choice1.addItem("Check all objects"); choice2.addItem("Check all objects"); for (int i=0; i= maxloop) { endopassed = true; } else if (pathlen < ed.ini.getMAXWORD()-1 && (!tree.containsPath(path) || pathlen == 0)) { // now check all paths from here, recursively if (pathlen != 0) tree.addPath(path); int arrows[] = new int[ed.cat.numarr]; for (i = ed.cat.all_arr(obj1, arrows)-1; i>=0; i--) { // add the new arrow to the path, and the new object to the object list for (j=pathlen; j>=0; j--) path[j+1] = path[j]; path[0] = arrows[i]; numpaths = get_all_paths(path, paths, ed.cat.arr[arrows[i]][1], obj2, maxloop, numpaths, tree); // now remove the arrow and object from the path and object list for (j=0; j<=pathlen; j++) path[j] = path[j+1]; } // if we're at the second object, then add the path to the list, unless // it's already in there if (pathlen > 0 && ed.cat.arr[path[0]][1] == obj2) { if (paths.addPath(path)) { numpaths++; numnewpaths++; } } } return numpaths; } // Close the window void close_actionPerformed(ActionEvent e) { ed.enableMenus(true); hide(); dispose(); } void this_windowClosing(WindowEvent e) { ed.enableMenus(true); hide(); dispose(); } void checkbox1_itemStateChanged(ItemEvent e) { if (checkbox1.isChecked()) { choice1.setVisible(false); path1.setVisible(true); checkbox2.setEnabled(true); choice2.setVisible(false); path2.setVisible(false); if (checkbox2.isChecked()) path2.setVisible(true); else path2.setVisible(false); } else { checkbox2.setEnabled(false); choice1.setVisible(true); path1.setVisible(false); choice2.setVisible(true); path2.setVisible(false); } } void checkbox2_itemStateChanged(ItemEvent e) { if (checkbox2.isChecked()) { path2.setVisible(true); } else { path2.setVisible(false); } } }