Link.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package de.tu_darmstadt.tk.SmartHomeNetworkSim.core;
  2. import java.util.Collection;
  3. /**
  4. * Physical Link medium for SmartDevices, which connects two or more devices and
  5. * allows communication between them
  6. *
  7. * @author Andreas T. Meyer-Berg
  8. */
  9. public interface Link {
  10. /**
  11. * @return the name
  12. */
  13. public String getName();
  14. /**
  15. * @param name
  16. * the name to set
  17. */
  18. public void setName(String name);
  19. /**
  20. * @return the devices
  21. */
  22. public Collection<SmartDevice> getDevices();
  23. /**
  24. * @param device
  25. * the devices to add
  26. */
  27. public void addDevice(SmartDevice device);
  28. /**
  29. * @param device
  30. * the devices to remove
  31. */
  32. public void removeDevice(SmartDevice device);
  33. /**
  34. * @return the connections
  35. */
  36. public Collection<Connection> getConnections();
  37. /**
  38. * @param connection
  39. * the connection to add
  40. */
  41. public void addConnection(Connection connection);
  42. /**
  43. * @param connection
  44. * the connection to remove
  45. */
  46. public void removeConnection(Connection connection);
  47. /**
  48. * Simulates an interval starting at startTime for a given duration
  49. *
  50. * @param startTime
  51. * Time the simulation interval starts in
  52. * System.currentTimeMillis() time
  53. * @param duration
  54. * Duration of the simulation interval in milliseconds
  55. */
  56. public void simulateTimeInterval(long startTime, long duration);
  57. /**
  58. * Returns all packets which where sent during the last Simulation time step
  59. *
  60. * @return packets, which were sent during the last time step
  61. */
  62. public Collection<Packet> getPackets();
  63. /**
  64. * Returns true if one or more connections have changed, and the Panel might have to be repainted
  65. * @return true if changed
  66. */
  67. public boolean getStatusChanged();
  68. /**
  69. * Returns the Transmission delay between the two given devices
  70. * @param from SmartDevice which starts transmission
  71. * @param to SmartDevices which receives transmission
  72. * @return delay of the transmission, infinite if to is unreachable or the Packets is lost.
  73. */
  74. public long getTransmissionDelayFrom(SmartDevice from, SmartDevice to);
  75. /**
  76. * Adds Packets to the internal data structure
  77. * @param packets Packets, which should be added
  78. */
  79. public void addPackets(Collection<Packet> packets);
  80. }