@Override public boolean equals(Object o) { if (this == o) return true; if (o instanceof ConceptName) { ConceptName cn = (ConceptName) o; return this.name.equals(cn.getName()); } return false; }
@Override public int compare(ConceptName o1, ConceptName o2) { if (o1.isPreferred() && !o2.isPreferred()) return -1; else if (!o1.isPreferred() && o2.isPreferred()) return 1; else return o1.getName().compareTo(o2.getName()); }
@Override public void actionPerformed(ActionEvent e) { this.setVisible(false); name.setPreferred(box.isSelected()); } }
public static BerkeleyConceptName convert(ConceptName old) { long sid = old.getSID(); BerkeleyConceptName nu = new BerkeleyConceptName(sid, old.getOwnerId(), old.getName(), old.isPreferred()); return nu; }
existing.put(cn.getName(), cn.isPreferred()); concept.getConceptName(name).setPreferred(names.get(name));
boolean found = false; for (ConceptName cn : c.getConceptNames()) { if (cn.getName().equals(name)) { found = true; cn.setPreferred(true); } else cn.setPreferred(false);
@Override protected ConceptName retrievePreferredConceptName() { for (ConceptName cn : retrieveConceptNameAll()) { if (cn.isPreferred()) { ((Updatable) cn).setUpdateListener(this); return cn; } } return null; }
new ConceptName[0]); for (ConceptName cn : array) { String oldname = cn.getName(); boolean preferred = cn.isPreferred(); c.getConceptName(name).setPreferred(preferred); } else { c.createConceptName(name, preferred);
/** * Modify given concept name * * @param name * ConceptName to modify */ public ConceptNamePopup(ConceptName name) { this.name = name; // editor panel BoxLayout layout = new BoxLayout(this, BoxLayout.LINE_AXIS); this.setLayout(layout); // check box for preferred box = new JCheckBox("Is a preferred concept name?"); box.setSelected(name.isPreferred()); this.add(box); // button to close popup JButton close = new JButton("close"); close.addActionListener(this); this.add(close); }
private String getShortestPreferredConceptName(Set<ConceptName> conames) { String shortest_coname=" "; int length= 100000; for(ConceptName coname : conames) { if((coname.isPreferred()) && (coname.getName() != null)) { // if((coname.getName().trim().length() >= 3) && (coname.getName().trim().length() <= 6)) { if(coname.getName().trim().length() <= length) { shortest_coname= coname.getName().trim(); // use this preferred concept name instead. length= shortest_coname.length(); } } } return shortest_coname; }
String name = cn.getName(); cn.setPreferred(false); ConceptName oldCN = conceptNames.get(name); if (cn.isPreferred()) oldCN.setPreferred(true); } else { conceptNames.put(name, cn); newConcept.createConceptName(cn.getName(), cn.isPreferred());
/** * Creates a name on concept only if it does not already exists * * @param target * - relation * @param newName * - attribute to create * @throws AccessDeniedException * @throws EmptyStringException * @throws NullValueException */ public static void addNewName(ONDEXConcept target, ConceptName newName) throws NullValueException, EmptyStringException, AccessDeniedException { if (target.getConceptName(newName.getName()) == null) target.createConceptName(newName.getName(), false); }
private String getShortestPreferredConceptName(Set<ConceptName> conames) { String shortest_coname=" "; int length= 100000; for(ConceptName coname : conames) { if((coname.isPreferred()) && (coname.getName() != null)) { // if((coname.getName().trim().length() >= 3) && (coname.getName().trim().length() <= 6)) { if(coname.getName().trim().length() <= length) { shortest_coname= coname.getName().trim(); // use this preferred concept name instead. length= shortest_coname.length(); } } } return shortest_coname; }
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { // which concept we are working on concept = (ONDEXConcept) table.getValueAt(row, 0); // check for concept name values if (value instanceof ConceptName) { name = (ConceptName) value; value = name.getName(); } else { name = null; } // use default text field editor return super.getTableCellEditorComponent(table, value, isSelected, row, column); }
private String getShortestPreferredConceptName(Set<ConceptName> conames) { String shortest_coname=" "; int length= 100000; for(ConceptName coname : conames) { // System.out.println("\t coname: "+ coname.getName().trim() +", isPreferred: "+ coname.isPreferred()); if((coname.isPreferred()) && (coname.getName() != null)) { // if((coname.getName().trim().length() >= 3) && (coname.getName().trim().length() <= 6)) { if(coname.getName().trim().length() <= length) { shortest_coname= coname.getName().trim(); // use this preferred concept name instead. length= shortest_coname.length(); } } } // System.out.println("\t shortest_coname: "+ shortest_coname); return shortest_coname; }
/** * helper method to extract a usable concept name. * * @param c * a concept. * @return a usable name. */ private String extractName(ONDEXConcept c) { String str = ""; if (c.getConceptName() != null) str = c.getConceptName().getName(); if (str.trim().length() == 0) str = c.getPID(); if (str.trim().length() == 0) str = c.getId() + ""; return str; }
private String getShortestPreferredConceptName(Set<ConceptName> conames) { String shortest_coname=" "; int length= 100000; for(ConceptName coname : conames) { // System.out.println("\t coname: "+ coname.getName().trim() +", isPreferred: "+ coname.isPreferred()); if((coname.isPreferred()) && (coname.getName() != null)) { // if((coname.getName().trim().length() >= 3) && (coname.getName().trim().length() <= 6)) { if(coname.getName().trim().length() <= length) { shortest_coname= coname.getName().trim(); // use this preferred concept name instead. length= shortest_coname.length(); } } } // System.out.println("\t shortest_coname: "+ shortest_coname); return shortest_coname; }
public void filter(Set<ONDEXConcept> ov) throws NullValueException, EmptyStringException, AccessDeniedException{ for(ONDEXConcept c : ov){ boolean addToset = true; for(ConceptAttributeChecker chk :conditions.values()){ if(!chk.check(c)){ addToset = false; break; } } System.err.println("Deleted: "+c.getConceptName().getName()); if(addToset)graph.deleteConcept(c.getId()); } } }
/** * Generate metadata for Concept Name. * @param coname * A Concept Name (from the Ondex API). * @return JSONObject * JSONObject containing information about the Concept Name. */ private JSONObject buildConceptName(ConceptName coname) { JSONObject conameJson= new JSONObject(); conameJson.put(JSONAttributeNames.NAME, coname.getName()); conameJson.put(JSONAttributeNames.ISPREFERRED, String.valueOf(coname.isPreferred())); return conameJson; }