/** * TODO: this seems to not work properly needs testing * * @param jclass * @param inherit Include inherited classes * @return * @throws JEVisException */ public List <JEVisObject> GetChildren(JEVisClass jclass, bool inherit) { List <JEVisObject> filterList = new List <JEVisObject>(); foreach (JEVisObject obj in GetChildren()) { try { JEVisClass oClass = obj.GetJEVisClass(); if (oClass != null && oClass.Equals(jclass)) { filterList.Add(obj); } else if (oClass != null) { HashSet <JEVisClass> inheritanceClasses = GetInheritanceClasses(new HashSet <JEVisClass>(), oClass); foreach (JEVisClass curClass in inheritanceClasses) { if (curClass.Equals(jclass)) { filterList.Add(obj); break; } } } } catch (Exception ex) { logger.Error(ex); } } logger.Debug(string.Format("[{0}] getChildren: \n{1}\n", GetId(), filterList)); return(filterList); }
public JEVisClass GetOtherClass(JEVisClass jclass) { if (GetStart().Equals(jclass)) { return(GetEnd()); } else { return(GetStart()); } }
public int CompareTo(JEVisClass o) { try { return GetName().CompareTo(o.GetName()); } catch (JEVisException ex) { return 1; } }
public JEVisObject BuildObject(String name, JEVisClass jevisClass) { logger.Debug(string.Format("buildObject: {0} {1}", name, jevisClass.GetName())); JsonObject newJson = new JsonObject(); newJson.SetName(name); newJson.SetJEVisClass(jevisClass.GetName()); newJson.SetParent(GetId()); return(new JEVisObjectWS(this.ds, newJson)); }
public bool IsAllowedUnder(JEVisClass jevisClass) { List<JEVisClass> valid = GetValidParents(); foreach (JEVisClass pClass in valid) { if (pClass.GetName().Equals(jevisClass.GetName())) { return true; } } return false; }
public JEVisClassRelationship BuildRelationship(JEVisClass jclass, int type, int direction) { JEVisClassRelationship rel; if (direction == JEVisConstants.Direction.FORWARD) {//this to otherClass rel = ds.buildClassRelationship(this.GetName(), jclass.GetName(), type); } else { rel = ds.buildClassRelationship(jclass.GetName(), this.GetName(), type); } return rel; }
private HashSet <JEVisClass> GetInheritanceClasses(HashSet <JEVisClass> hashSet, JEVisClass obj) { try { JEVisClass inheritance = obj.GetInheritance(); if (inheritance == null) { return(hashSet); } else { hashSet.Add(inheritance); return(GetInheritanceClasses(hashSet, inheritance)); } } catch (JEVisException ex) { logger.Error(ex); } return(hashSet); }
override public bool Equals(Object o) { try { /** * cast needs to be removed */ if (o.GetType() is JEVisClass) { JEVisClass obj = (JEVisClass)o; if (obj.GetName().Equals(GetName())) { return true; } } } catch (Exception ex) { logger.Info("error, cannot compare objects"); return false; } return false; }