NeighborhoodMsg.java 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package classes.holonControlUnit.messages;
  2. import java.util.ArrayList;
  3. import classes.Holon;
  4. public class NeighborhoodMsg {
  5. public enum Type {
  6. NEW_VIRTUAL_NEIGHBOR, REMOVE_VIRTUAL_NEIGHBOR,
  7. NEW_PHYSICAL_NEIGHBOR, REMOVE_PHYSICAL_NEIGHBOR, SEARCH_PHYSICAL_NEIGHBOR_REQ, SEARCH_PHYSICAL_NEIGHBOR_ANS }
  8. private Type type;
  9. private ArrayList<String> neighbors;
  10. private int layer;
  11. private String id;
  12. public NeighborhoodMsg(Type type, ArrayList<String> newVirtualNeighbor) {
  13. super();
  14. this.type = type;
  15. this.neighbors = newVirtualNeighbor;
  16. }
  17. public NeighborhoodMsg(Type type, int layer) {
  18. super();
  19. this.type = type;
  20. this.layer = layer;
  21. }
  22. public NeighborhoodMsg(Type type, String id) {
  23. super();
  24. this.type = type;
  25. this.id = id;
  26. }
  27. @Override
  28. public String toString() {
  29. return "NeighborhoodMsg [type=" + type + ", neighbors=" + neighbors + ", layer=" + layer + ", id=" + id + "]";
  30. }
  31. public ArrayList<String> getNeighbors() {
  32. return neighbors;
  33. }
  34. public Type getType() {
  35. return type;
  36. }
  37. public int getLayer() {
  38. return layer;
  39. }
  40. public String getId() {
  41. return id;
  42. }
  43. }