public String toString() { StringBuffer b = new StringBuffer(); b.append("ID:" + id); b.append("\tName:" + name); b.append("\tSex:" + sex + "\n"); b.append("\tAffected:" + affection + "\n"); if (mother == null) { b.append("\tMother: null"); } else { b.append("\tMother:" + mother.id); } if (father == null) { b.append("\tFather: null"); } else { b.append("\tFather:" + father.id); } b.append("\tChildren:"); Vector<PelicanPerson> children = getChildren(); if (children.size() > 0) { Iterator<PelicanPerson> it = children.iterator(); while (it.hasNext()) { PelicanPerson p = it.next(); b.append(p.id + ","); } b.deleteCharAt(b.length() - 1); } else { b.append("none"); } b.append("\n"); return b.toString(); }
private Vector getChildren(Keyword keyword, Vector allKids) { allKids.addElement(keyword); // System.out.println("Addtoallkids " + keyword + " " + allKids ); Vector children = keyword.getChildren(); if (children != null) { Iterator i = children.iterator(); while (i.hasNext()) { Keyword child = (Keyword) i.next(); getChildren(child, allKids); } } return allKids; }
public static Vector extractKeywordFromText(String text) { // see if there are any existing keywords represented // in this text // Get all keywords Vector extractedKeywords = new Vector(); Iterator keywords = allKeywords.iterator(); while (keywords.hasNext()) { Keyword keyword = (Keyword) keywords.next(); if (text != null && keyword.toString() != null && text.toLowerCase().indexOf(keyword.toString().toLowerCase()) > -1) { extractedKeywords.addElement(keyword); } } return extractedKeywords; }
// Construct GUI for a set of parameters public static void makeControls( Container controls, GridBagLayout controlLayout, GridBagConstraints controlCon, Vector dpList, Vector optList, String title) { Container spec = new Container(); controlLayout.setConstraints(spec, controlCon); controls.add(spec); GridBagLayout layout = new GridBagLayout(); GridBagConstraints con = new GridBagConstraints(); spec.setLayout(layout); Iterator i = dpList.iterator(); while (i.hasNext()) { DoubleParameter dp = (DoubleParameter) (i.next()); // Make slider and text field JSlider val = new JSlider(JSlider.HORIZONTAL); JTextField tval = new JTextField(5); dp.register(val); dp.register(tval); // Lay out label, slider, text field con.fill = GridBagConstraints.NONE; con.weightx = 0.0; con.weighty = 0.0; con.gridwidth = 1; JLabel name = new JLabel(dp.name); layout.setConstraints(name, con); spec.add(name); con.fill = GridBagConstraints.HORIZONTAL; con.weightx = 0.8; layout.setConstraints(val, con); spec.add(val); con.weightx = 0.2; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(tval, con); spec.add(tval); } // Label column on bottom con.fill = GridBagConstraints.VERTICAL; con.anchor = GridBagConstraints.SOUTH; con.weightx = 0.0; con.weighty = 1.0; con.gridwidth = GridBagConstraints.REMAINDER; JLabel ltitle = new JLabel(title); layout.setConstraints(ltitle, con); spec.add(ltitle); // Display options con.anchor = GridBagConstraints.WEST; i = optList.iterator(); while (i.hasNext()) { BooleanParameter bp = (BooleanParameter) (i.next()); JCheckBox ck = new JCheckBox(bp.name); bp.register(ck); layout.setConstraints(ck, con); spec.add(ck); } }
public Iterator getChildrenIterator() { return (children.iterator()); }