123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- package classes;
- import java.util.ArrayList;
- import java.util.HashMap;
- public class CpsUpperNode extends AbstractCpsObject {
- private ArrayList<AbstractCpsObject> nodes;
- private ArrayList<CpsEdge> nodeEdges;
- private ArrayList<CpsEdge> oldEdges;
- private HashMap<Integer, Integer> nodesIdx;
- public CpsUpperNode(String nodeName) {
- super(nodeName);
- this.setConnections(new ArrayList<CpsEdge>());
- this.setImage("/Images/upper_node.png");
- this.setSav("CVS");
- this.setId(IdCounter.nextId());
- this.setNodes(new ArrayList<AbstractCpsObject>());
- this.setNodeEdges(new ArrayList<CpsEdge>());
- this.setOldEdges(new ArrayList<CpsEdge>());
- this.setNodesIdx(new HashMap<Integer, Integer>());
- // TODO Auto-generated constructor stub
- }
- /**
- * @return the nodes
- */
- public ArrayList<AbstractCpsObject> getNodes() {
- return nodes;
- }
- /**
- * @param nodes
- * the nodes to set
- */
- public void setNodes(ArrayList<AbstractCpsObject> nodes) {
- this.nodes = nodes;
- }
- /**
- * @return the nodeEdges
- */
- public ArrayList<CpsEdge> getNodeEdges() {
- return nodeEdges;
- }
- /**
- * @param nodeEdges
- * the nodeEdges to set
- */
- public void setNodeEdges(ArrayList<CpsEdge> nodeEdges) {
- this.nodeEdges = nodeEdges;
- }
- /**
- * @return the oldEdges
- */
- public ArrayList<CpsEdge> getOldEdges() {
- return oldEdges;
- }
- /**
- * @param oldEdges
- * the oldEdges to set
- */
- public void setOldEdges(ArrayList<CpsEdge> oldEdges) {
- this.oldEdges = oldEdges;
- }
- /**
- * @return the nodesIdx
- */
- public HashMap<Integer, Integer> getNodesIdx() {
- return nodesIdx;
- }
- /**
- * @param nodesIdx
- * the nodesIdx to set
- */
- public void setNodesIdx(HashMap<Integer, Integer> nodesIdx) {
- this.nodesIdx = nodesIdx;
- }
- public ArrayList<HolonObject> getNumHolonObj() {
- ArrayList<HolonObject> onlyHolonObj = new ArrayList<HolonObject>();
- for (AbstractCpsObject temp : getNodes()) {
- if (temp instanceof HolonObject) {
- onlyHolonObj.add((HolonObject) temp);
- }
- }
- return onlyHolonObj;
- }
- public ArrayList<HolonSwitch> getNumSwitches() {
- ArrayList<HolonSwitch> onlySwitsches = new ArrayList<HolonSwitch>();
- for (AbstractCpsObject temp : getNodes()) {
- if (temp instanceof HolonSwitch) {
- onlySwitsches.add((HolonSwitch) temp);
- }
- }
- return onlySwitsches;
- }
- public ArrayList<CpsUpperNode> getNumUpperNodes() {
- ArrayList<CpsUpperNode> onlyUpperNodes = new ArrayList<CpsUpperNode>();
- for (AbstractCpsObject temp : getNodes()) {
- if (temp instanceof CpsUpperNode) {
- onlyUpperNodes.add((CpsUpperNode) temp);
- }
- }
- return onlyUpperNodes;
- }
- public AbstractCpsObject searchObj(int ID) {
- AbstractCpsObject result = null;
- for (AbstractCpsObject obj : getNodes()) {
- if (obj.getId() == ID) {
- result = obj;
- break;
- }
- }
- return result;
- }
- }
|