package modules.region;

import utils.*;
import simulator.*;
import java.util.*;

public class Region {
  RegionMembershipTest rmt;
  Object parent;
  Object id, type;
  Vector children=new Vector(2);
  boolean dead=false;
  public Region(Region parent,Object id,Object type,RegionMembershipTest rmt) {
    this.id=id; this.type=type; this.rmt=rmt;
    if(parent!=null) {
      this.parent=parent.id; 
      parent.children.add(id);
    }
  }

  // this function produces a clone suitable for export via the neighborset
  public Region commit() {
    Region r = new Region(null,id,type,rmt); // don't link for parent
    r.parent=parent;
    r.dead=dead;
    r.children=(Vector)children.clone();
    return r;
  }
  public String toString() {
    return "("+id+", "+id+", "+type+", "+rmt+", "+parent+", "+
      children+", "+dead+")";
  }
}

