Node.java 779 B

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