Java Code Examples for com.orientechnologies.orient.core.metadata.schema.OClass#equals()
The following examples show how to use
com.orientechnologies.orient.core.metadata.schema.OClass#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OSchemaUtils.java From wicket-orientdb with Apache License 2.0 | 5 votes |
/** * Returns common {@link OClass} for a set of documents * @param it {@link Iterator} over {@link ODocument}s * @return common {@link OClass} or null */ public static OClass getCommonOClass(Iterator<ODocument> it) { Set<OClass> candidates = null; OClass ret = null; while(it.hasNext() && (candidates==null || !candidates.isEmpty())) { ODocument doc = it.next(); OClass thisOClass = doc.getSchemaClass(); if(candidates==null){ candidates = new HashSet<OClass>(); candidates.add(thisOClass); candidates.addAll(thisOClass.getAllSuperClasses()); ret = thisOClass; } else { if(ret!=null && (ret.equals(thisOClass) || ret.isSuperClassOf(thisOClass))) continue; else if(ret!=null && thisOClass.isSuperClassOf(ret)) { ret = thisOClass; candidates.clear(); candidates.add(ret); candidates.addAll(ret.getAllSuperClasses()); } else { ret = null; candidates.retainAll(thisOClass.getAllSuperClasses()); } } } if(ret==null && candidates!=null && !candidates.isEmpty()) { ret = getDeepestOClass(candidates); } return ret; }
Example 2
Source File: OSchemaUtils.java From wicket-orientdb with Apache License 2.0 | 5 votes |
/** * Find the most deep {@link OClass} in a collection of classes * @param classes {@link Iterable} with {@link OClass}es to handle * @return deepest {@link OClass} or null */ public static OClass getDeepestOClass(Iterable<OClass> classes) { if(classes==null) return null; OClass ret=null; for(OClass oClass: classes) { if(ret==null) ret = oClass; else { if(!ret.equals(oClass) && oClass.isSubClassOf(ret)) ret = oClass; } } return ret; }
Example 3
Source File: DefaultDashboardManager.java From Orienteer with Apache License 2.0 | 5 votes |
private Integer isSuperClass(OClass superOClass, OClass oClass) { if(superOClass.equals(oClass)) return 0; Integer ret = null; for(OClass subClass : superOClass.getSubclasses()) { Integer thisRet = isSuperClass(subClass, oClass); if(thisRet!=null) { if(ret==null || ret > thisRet) ret = thisRet+1; } } return ret; }