Exemplo n.º 1
0
 public NddlType getType(String qualified) {
   for (Iterator i = types.iterator(); i.hasNext(); ) {
     NddlType curr = (NddlType) i.next();
     if (qualified.equals(curr.getName())) return curr;
   }
   return null;
 }
Exemplo n.º 2
0
 // given a context, returns the enum which belongs to that context.
 public NddlType getEnum(String qualified) {
   for (Iterator i = enumsContaining.iterator(); i.hasNext(); ) {
     NddlType curr = (NddlType) i.next();
     if (qualified.equals(NddlUtil.nonull(NddlUtil.butLast(curr.getName())))) ;
     return curr;
   }
   return null;
 }
Exemplo n.º 3
0
 public boolean addPredicate(NddlType pred) throws ClassCastException {
   assert (DebugMsg.debugMsg("NddlName:addPredicate", name + ".addPredicate(" + pred + ")"));
   if (!pred.isPredicate()) throw new ClassCastException();
   if (containsPredicate(pred.getName())) return false;
   assert (DebugMsg.debugMsg("NddlName:addPredicate", "Performing ACTUAL add"));
   predicates.add(pred);
   return true;
 }
Exemplo n.º 4
0
 public boolean containedByEnum(NddlType enumeration) throws ClassCastException {
   assert (DebugMsg.debugMsg(
       "NddlName:containedByEnum", name + ".containedByEnum(" + enumeration + ")"));
   if (!enumeration.isSymbol()) throw new ClassCastException();
   if (!enumeration.getEnumDomain().contains(name)) throw new ClassCastException();
   enumsContaining.add(enumeration);
   return true;
 }
Exemplo n.º 5
0
 public NddlType getPredicate(String qualified) {
   assert (DebugMsg.debugMsg("NddlName:getPredicate", "looking for " + qualified));
   for (Iterator i = predicates.iterator(); i.hasNext(); ) {
     NddlType curr = (NddlType) i.next();
     if (qualified.equals(curr.getName())) {
       assert (DebugMsg.debugMsg("NddlName:getPredicate", "  -> " + curr));
       return curr;
     }
   }
   assert (DebugMsg.debugMsg("NddlName:getPredicate", "  -> not found"));
   return null;
 }
Exemplo n.º 6
0
 public boolean addType(NddlType type) {
   assert (DebugMsg.debugMsg("NddlName:addType", name + ".addType(" + type + ")"));
   if (containsType(type.getName())) return false;
   types.add(type);
   return true;
 }
Exemplo n.º 7
0
 public void redefineType(NddlType type) {
   assert (DebugMsg.debugMsg("NddlName:redefineType", name + ".redefineType(" + type + ")"));
   types.remove(getType(type.getName()));
   types.add(type);
 }