import java.util.*; public class Operator{ int internalNumber; /* each operator has a private internal number this is for the case, if one operator is several times in the same application. the old way I used (comparing the father, does not work, if on operator holds 2 times the same child operator */ int id; int app; Operator father; ArrayList operators; ArrayList objects; double w = 1.1; double delta = 1.3; boolean isMapped; ArrayList procs; double meanComm; /* has to be given the value, when the father is mapped, by calling the function initMeanCommForChildren */ double meanCommFather; /* has to be given the value, when the children are mapped, by calling the function initMeanCommForFather */ MyArrayList newChildren; /* is needed for BottomUpBFS */ public Operator(int app) { this.internalNumber = -1; id = -1; this.app = app; this.father = null; operators = new ArrayList(); objects = new ArrayList(); meanComm = (-1.0); meanCommFather = (-1.0); procs = new ArrayList(); newChildren = new MyArrayList(); } /* constructor for generalOps */ public Operator(int internalNumber, int id, int app) { this.internalNumber = internalNumber; this.id = id; this.app = app; this.father = null; operators = new ArrayList(); objects = new ArrayList(); meanComm = (-1.0); meanCommFather = (-1.0); procs = new ArrayList(); newChildren = new MyArrayList(); } /* constructor for the creation of the operator list. */ public Operator(int internalNumber, int id) { this.internalNumber = internalNumber; this.id = id; this.app = 0; this.father = null; operators = new ArrayList(); objects = new ArrayList(); meanComm = (-1.0); meanCommFather = (-1.0); procs = new ArrayList(); newChildren = new MyArrayList(); } public Operator(int internalNumber, int id, int app, Operator father) { this.internalNumber = internalNumber; this.id = id; this.app = app; this.father = father; operators = new ArrayList(); objects = new ArrayList(); meanComm = (-1.0); meanCommFather = (-1.0); procs = new ArrayList(); newChildren = new MyArrayList(); } /* this is the function which will only compare the id */ public boolean equals(Object op) { //System.out.println("equals: other: "+((Operator)op).id+", this: "+this.id); if(((Operator)op).id == this.id) { return true; } return false; } /* this is the function which will comparer the id and the application */ public boolean equalInApp(Operator op) { if(op.id == this.id && op.app == this.app) { return true; } return false; } /* this is the function which will comparer the id and the father id */ public boolean equalFather(Operator op) { if(op.id == this.id && op.father.id == this.father.id) { return true; } return false; } /* this is the function which will comparer the id and the application and the internalNumber */ public boolean equal100(Operator op) { if(op.id == this.id && op.app == this.app && op.internalNumber == this.internalNumber) { return true; } return false; } public String toString() { return "op"+this.id+"_("+this.internalNumber+")"; } public String toStringParams() { return "op"+this.id+"_("+this.internalNumber+"), app "+this.app+", w: "+this.w+", delta: "+this.delta; } public String toStringLong() { String s = ("op"+this.id+"_("+this.internalNumber+"):\n"); for(Operator op : this.operators) { s += (op + ", "); } for(BasicObject obj : this.objects) { s += (obj + ", "); } return s; } // public Operator(int id, int app, Operator father, Operator... children, BasicObject... basicObjects) { // this.id = id; // this.father = father; // for(Operator actOp : children) { // operators.add(actOp); // } // for(BasicObject actOb : basicObjects) { // objects.add(actOb); // } // } }