Exemplo n.º 1
0
 public boolean checkDependency(KBAPI api, KBObject obj) {
   for (String propId : propertyIdChain) {
     KBObject prop = api.getProperty(propId);
     obj = api.getPropertyValue(obj, prop);
     if (obj == null) break;
   }
   if (obj == null) return false;
   if (!obj.isLiteral()) {
     if (this.operator == Operator.EQUAL && obj.getID().equals(this.desiredValue)) return true;
   } else {
     if (this.operator == Operator.EQUAL && obj.getValue().equals(this.desiredValue)) return true;
     if (this.operator == Operator.GREATER_THAN
         && Double.parseDouble(obj.getValue().toString())
             > Double.parseDouble(this.desiredValue.toString())) return true;
     if (this.operator == Operator.LESS_THAN
         && Double.parseDouble(obj.getValue().toString())
             < Double.parseDouble(this.desiredValue.toString())) return true;
   }
   return false;
 }