public boolean containsRelationId(int relationId) { for (ONDEXEntity entity : entitiesInPositionOrder) if (entity instanceof ONDEXRelation && entity.getId() == relationId) return true; return false; }
public boolean containsConceptId(int conceptId) { for (ONDEXEntity entity : entitiesInPositionOrder) if (entity instanceof ONDEXConcept && entity.getId() == conceptId) return true; return false; }
@Override public String getValue(ONDEXEntity cOrr) throws NullValueException, AccessDeniedException, InvalidOndexEntityException { return Integer.toString(cOrr.getId()); }
/** * Converts a collection of concepts to an array of their ids * * @param concepts * @return an array of integer ids */ public static Integer[] entitesToIds(Collection<ONDEXConcept> concepts) { Integer[] result = new Integer[concepts.size()]; int i = 0; for (ONDEXEntity c : concepts) { result[i] = c.getId(); i++; } return result; }
/** * Gets the sparse bit set from the view. The view is used up and closed * when this method is called. * * @param view * ondex view * @return sparse bit set of ids */ public static BitSet viewToBitSet(Set<ONDEXEntity> view) { BitSet set = new BitSet(); for (ONDEXEntity oe : view) { set.set(oe.getId()); } return set; }
public String toString() { StringBuilder sb = new StringBuilder(); for (ONDEXEntity entity : entitiesInPositionOrder) { sb.append(entity.getId() + "(" + entity.getClass().getSimpleName() + ")"); } return sb.toString() + smcInPositionOrder.toString(); }
/** * Retrieve the score of a given ONDEXEntity * * @param entity * a ONDEX graph entity (e.g ONDEXConcept) * @return the score for this entity */ public float getScoreOnEntity(E entity) { int id; if (entity instanceof ONDEXConcept) { id = entity.getId(); } else if (entity instanceof ONDEXRelation) { id = entity.getId(); } else { throw new RuntimeException(entity.getClass() + " is incompatible with these Hits."); } if (scoresForHits.containsKey(id)) return scoresForHits.get(id); return -1; // problem if not in scores? }
public boolean containsEntityId(int id, Class<? extends ONDEXEntity> entityType) { if (entityType.isInstance(entity) && entity.getId() == id) { return true; } else if (previous != null && previous.containsEntityId(id, entityType)) { return true; } return false; }
/** * returns false if the element is not contained in the view or if the * user has no permission to view the element. * * @throws net.sourceforge.ondex.exception.type.AccessDeniedException * if the object parameter does not provide read permission. */ @Override public boolean contains(Object o) { if (o != null && getDataType().isAssignableFrom(o.getClass())) { if (o instanceof ONDEXEntity) { ONDEXEntity e = (ONDEXEntity) o; return set.get(e.getId()); } } return false; }