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; }
// 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; }
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; }
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; }
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; }
public boolean addType(NddlType type) { assert (DebugMsg.debugMsg("NddlName:addType", name + ".addType(" + type + ")")); if (containsType(type.getName())) return false; types.add(type); return true; }
public void redefineType(NddlType type) { assert (DebugMsg.debugMsg("NddlName:redefineType", name + ".redefineType(" + type + ")")); types.remove(getType(type.getName())); types.add(type); }