package foam.core;

import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

public class ClassInfo {
  private List<Object> axioms;
  private String id;

  public ClassInfo() {
    axioms = new ArrayList<Object>();
  }

  public ClassInfo setId(String id) {
    this.id = id;
    return this;
  }

  public ClassInfo addProperty(PropertyInfo p) {
    axioms.add(p);
    return this;
  }

  public List<Object> getAxioms() {
    return axioms;
  }

  public String getId() {
    return id;
  }

  private HashMap axiomMap_ = new HashMap();

  public List getAxiomsByClass(Class cls) {
    if ( axiomMap_.containsKey(cls) ) {
      return (List)axiomMap_.get(cls);
    }

    ArrayList ret = new ArrayList();
    Iterator i = axioms.iterator();
    while ( i.hasNext() ) {
      Object axiom = i.next();
      if ( cls.isInstance(axiom) ) {
        ret.add(axiom);
      }
    }

    axiomMap_.put(cls, ret);
    return ret;
  }
}

@@ -347,148 +347,350 @@
 %0A  p
-ublic ClassInfo addProperty(PropertyInfo p) %7B%0A    axioms.add(p);%0A    return this;%0A  %7D%0A%0A  public List%3CObject%3E getAxioms() %7B%0A    return axioms
+rivate HashMap axiomsByName_ = new HashMap();%0A%0A  public ClassInfo addProperty(PropertyInfo p) %7B%0A    p.setClassInfo(this);%0A    axioms.add(p);%0A    axiomsByName_.put(p.getName(), p);%0A    return this;%0A  %7D%0A%0A  public List%3CObject%3E getAxioms() %7B%0A    return axioms;%0A  %7D%0A%0A  public Object getAxiomByName(String name) %7B%0A    return axiomsByName_.get(name)
 ;%0A  

Add getAxiomByName to ClassInfo