Class Node

java.lang.Object
edu.cnu.mdi.sim.demo.network.Node

public class Node extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Node category.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    Force on the node
    double
    Force on the node
    final int
    Unique node id within the model.
    Node type (server or client).
    double
    World velocity in world-units per step.
    double
    World velocity in world-units per step.
    double
    Approximate icon radius in world units.
    double
    World position in the unit square.
    double
    World position in the unit square.
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • id

      public final int id
      Unique node id within the model.
    • type

      public final Node.NodeType type
      Node type (server or client).
    • x

      public double x
      World position in the unit square.
    • y

      public double y
      World position in the unit square.
    • vx

      public double vx
      World velocity in world-units per step.
    • vy

      public double vy
      World velocity in world-units per step.
    • fx

      public double fx
      Force on the node
    • fy

      public double fy
      Force on the node
    • worldRadius

      public volatile double worldRadius
      Approximate 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 volatile because 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 the volatile guarantee ensures the simulation thread will see the updated value on the immediately following read without requiring an explicit lock or memory barrier.