Package urban.model

Examples of urban.model.Site


    }
  }

  private void addToSite(Site s) {
    String key = s.getQualifiedName();
    Site tmp = sites.get(key);
   
    if (tmp == null)
      sites.put(key, s);
    else {
      sites.put(key, mergeSite(tmp,s));
View Full Code Here


    HashMap<String, Site> b = new HashMap<String, Site>();
   
    for (Agent a : agents){
      for (Site s : a.getSites()){
        if (s.getBindingMark() != null){
          final Site s1 = b.get(s.getBindingMark());
          if (s1 != null){
            if (s.getQualifiedName().compareTo(s1.getQualifiedName()) <= 0)
              addBinding(s.getQualifiedName(), s1);
            else
              addBinding(s1.getQualifiedName(), s);
          } else {
            b.put(s.getBindingMark(), s);
          }
        }
      }
View Full Code Here

    RuleGraph result = null;
    {
      Agent aL = null;
      Agent bondA = null;
      Agent bondB = null;
      Site siteA = null;
      Site siteB = null;
     
      Iterator<Agent> rhsIt = data.rhs.iterator();
      Iterator<Agent> lhsIt = data.lhs.iterator();
      boolean reverse=false;
      while(lhsIt.hasNext() && rhsIt.hasNext()) {
        Agent a = lhsIt.next();
        Agent b = rhsIt.next();

        Iterator<Site> asIt = a.getSites().iterator();
        Iterator<Site> bsIt = b.getSites().iterator();
        while(asIt.hasNext() && bsIt.hasNext()){
          Site s = asIt.next();
          Site bs = bsIt.next();
         
          String m = s.getBindingMark();
          String n = bs.getBindingMark();
          if (m != null && !"?".equals(m) && !"_".equals(m)){
            if (data.first.containsKey(m))
              data.second.put(m, a);
            else
              data.first.put(m, a);
          }
          if ((m == null && n != null) || (n == null && m != null)){
            if (bondA != null){
              if(bondB != null)
                throw new IllegalArgumentException("Rule not supported: More than one bond formation dissallowed.");
              bondB = a;
              siteB = bs;
              if (m != null){
                data.first.remove(m);
                data.second.remove(m);
                reverse = true;
              }
            } else {
              bondA = a;
              siteA = bs;
            }
          }
         
          if (s.getState() != null && !s.getState().equals(bs.getState())){
            if (aL != null)
              throw new IllegalArgumentException("Rule not supported: More than one flip dissallowed.");
            aL = a;
          }
        } 
View Full Code Here

  private static Set<Agent> A(Site... all) {
    return Collections.singleton(new Agent("A",Arrays.asList(all)));
  }

  private static Site f(String string) {
    return new Site("A","f",string,null);
  }
View Full Code Here

  private static Site f(String string) {
    return new Site("A","f",string,null);
  }
 
  private static final Site x(String string){
    return new Site("A","x",null,string);
  }
View Full Code Here

public class RateCalculatorTest {
  private static final Shape S1 = new Shape(A_f("0"));

  private static Set<Agent> A_f(String string) {
    return Collections.singleton(new Agent("A",Collections.singleton(new Site("A","f",string,null))));
  }
View Full Code Here

    super(a1.getName());
   
    Iterator<Site> i1 = a1.getSites().iterator();
    Iterator<Site> i2 = a2.getSites().iterator();
    while (i1.hasNext() && i2.hasNext()) {
      Site s1 = i1.next();
      Site s2 = i2.next();
     
      if (s1.getState() != null && !s1.getState().equals(s2.getState())){
        this.siteName = s1.getName();
        this.left = s1.getState();
        this.right = s2.getState();
        addToMap(a1);
        return;
      }
    }
    throw new IllegalArgumentException("Agents should differ by one state");
View Full Code Here

  }
  /**
   * @return the site that with appropriate state for the left hand side of the rule
   */
  public Site getLeft() {
    return new Site(getName(), siteName, left, null);
  }
View Full Code Here

  }
  /**
   * @return the site that with appropriate state for the right hand side of the rule
   */
  public Site getRight() {
    return new Site(getName(), siteName, right, null);
  }
View Full Code Here

TOP

Related Classes of urban.model.Site

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.