Package edu.cnu.mdi.sim.demo.network
Class Node
java.lang.Object
edu.cnu.mdi.sim.demo.network.Node
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleForce on the nodedoubleForce on the nodefinal intUnique node id within the model.final Node.NodeTypeNode type (server or client).doubleWorld velocity in world-units per step.doubleWorld velocity in world-units per step.doubleApproximate icon radius in world units.doubleWorld position in the unit square.doubleWorld position in the unit square. -
Method Summary
-
Field Details
-
id
public final int idUnique node id within the model. -
type
Node type (server or client). -
x
public double xWorld position in the unit square. -
y
public double yWorld position in the unit square. -
vx
public double vxWorld velocity in world-units per step. -
vy
public double vyWorld velocity in world-units per step. -
fx
public double fxForce on the node -
fy
public double fyForce on the node -
worldRadius
public volatile double worldRadiusApproximate icon radius in world units.Set by the view after construction and again whenever the viewport zoom or size changes. The simulation reads this field on the simulation thread to compute overlap-aware repulsion and to clamp positions so icons remain fully visible inside the unit square.
Declared
volatilebecause the view writes it on the EDT while the simulation thread reads it concurrently. A stale value following a just-completed zoom is harmless — it affects at most one simulation step — but thevolatileguarantee ensures the simulation thread will see the updated value on the immediately following read without requiring an explicit lock or memory barrier.
-