// Autor: Stephan Bazalka // Matr.Nr.: 0225725 // Bsp: 4100 (Token-Ring-Netzwerk) package netzwerk; import java.util.*; public class Packet { String source=""; String destination=""; String content=""; short time; Node currentNode; Node origin; boolean stored=false; boolean printed=false; boolean deleted=false; boolean stopped=false; // Konstruktor public Packet(String[] inputPacket, short time) { source=inputPacket[0]; destination=inputPacket[1]; content=inputPacket[2]; this.time=time; } // Wo ist das Packet/Was ist mit ihm geschehen? public String tellState() { if (printed || stored) { return "FINISHED"; } if (deleted) { return "INVALID"; } return currentNode.tellName(); } // Funktionen, die Infos über das Paket ausgeben public boolean isStopped () { return stopped; } public boolean isStored() { return stored; } public boolean isPrinted() { return printed; } public boolean isDeleted() { return deleted; } public Node tellCurrentNode() { return currentNode; } public String tellSource () { return source; } public String tellDestination () { return destination; } public String tellContent () { return content; } // Funktionen, die verarbeiten können/Infos setzen public void printPacket(boolean value) { printed=value; stopped=value; } public void storePacket(boolean value) { stored=value; stopped=value; } public void deletePacket(boolean value) { deleted=value; stopped=value; } public void setCurrentNode(Node node) { currentNode=node; } }