Issue: Define Core Network Interfaces and Statistics Hierarchy
Description
Establish the foundational contracts for the simulation by defining the core interfaces for network nodes and their statistics. This architecture enables polymorphism, allowing the simulation engine to interact with any node type (Router, Terminal) through a unified API.
Technical Requirements
- Location: All interfaces should be placed in the
ar.edu.unc.david.routersimulator.model.nodes package (or a .stats sub-package for metrics).
- Interface Composition:
PacketReceiver: Functional interface for objects that can accept packets.
Tickable: Interface for entities synchronized with the simulation clock.
Node: A composite interface extending both PacketReceiver and Tickable.
- Statistics Strategy:
- Use a base
NodeStats interface for common metrics.
- Implement specialized
Record objects for TerminalStats and RouterStats to ensure immutability and thread-safety.
Tasks
Acceptance Criteria
Architecture Preview
public interface Node extends PacketReceiver, Tickable {
IpAddress ip();
NodeStats getStats();
}
Issue: Define Core Network Interfaces and Statistics Hierarchy
Description
Establish the foundational contracts for the simulation by defining the core interfaces for network nodes and their statistics. This architecture enables polymorphism, allowing the simulation engine to interact with any node type (Router, Terminal) through a unified API.
Technical Requirements
ar.edu.unc.david.routersimulator.model.nodespackage (or a.statssub-package for metrics).PacketReceiver: Functional interface for objects that can accept packets.Tickable: Interface for entities synchronized with the simulation clock.Node: A composite interface extending bothPacketReceiverandTickable.NodeStatsinterface for common metrics.Recordobjects forTerminalStatsandRouterStatsto ensure immutability and thread-safety.Tasks
PacketReceiver.javawithvoid receive(Packet p).Tickable.javawithvoid tick(long currentTick).Node.javaextending both, addingIpAddress ip()andNodeStats getStats().NodeStats.java(Interface) with common getters:ip(),packetsSent(),packetsReceived(),packetsDropped().TerminalStats.java(Record) implementingNodeStatswith additional fields:pagesCompleted,pagesTimedOut.RouterStats.java(Record) implementingNodeStatswith additional fields:packetsRouted,bufferUtilization.Acceptance Criteria
ip()instead ofgetIp()).TerminalandRouter.Architecture Preview