Node.java 838 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package classes;
  2. import java.util.ArrayList;
  3. import classes.IdCounter.CounterType;
  4. /**
  5. * The class "CpsNode" represents empty Objects in the system. They are just
  6. * nodes between Objects
  7. *
  8. * @author Gruppe14
  9. *
  10. */
  11. public class Node extends AbstractCanvasObject {
  12. /**
  13. * Create a new node in the system with an user-defined name.
  14. *
  15. * @param objName
  16. * String
  17. */
  18. public Node(String objName) {
  19. super(objName);
  20. this.setConnections(new ArrayList<Edge>());
  21. this.setImage("/Images/node.png");
  22. this.setSav("CVS");
  23. this.setId(IdCounter.nextId(CounterType.Object));
  24. }
  25. public Node(Node node){
  26. super(node);
  27. }
  28. public String toString(){
  29. return "Node ID:" + super.id;
  30. }
  31. @Override
  32. public AbstractCanvasObject makeCopy() {
  33. return new Node(this);
  34. }
  35. }