ePOST API

rice.visualization
Class Ring

java.lang.Object
  extended by rice.visualization.Ring

public class Ring
extends java.lang.Object

Author:
Jeff Hoye

Field Summary
 double angle
           
 int childNum
          0 is the global ring a numbered coordinate sets a degree offset based on the total number of rings
protected  java.util.Hashtable clients
          DistNodeHandle -> VisualizationClient
static double DISTANCE_BUFFER
           
 java.lang.String name
          The ring name
protected  java.security.KeyPair pair
           
 Ring parent
           
static double[] RENDER_RADIUS
           
 int renderSize
           
 double unitX
           
 double unitY
           
protected  Visualization visualization
           
 
Constructor Summary
Ring(java.lang.String name, java.security.KeyPair pair, DistNodeHandle handle)
           
Ring(java.lang.String name, java.security.KeyPair pair, DistNodeHandle handle, Ring parent)
           
 
Method Summary
 int addChild(Ring r)
           
 Node addNode(DistNodeHandle handle)
           
 void addNode(Node node)
           
 void buildAssociations(Node n)
          Checks self and all child rings.
protected  java.util.Vector cloneNodes()
           
 boolean contains(int x, int y)
           
 java.awt.Point getCenter()
           
 java.awt.Point getCenterBasedOnParent()
          Calculates your center as an offset of your parent's center.
 java.security.KeyPair getKeyPair()
           
 Node getNode(int x, int y)
          Attempts to select a node in own ring, then children's rings.
 Node[] getNodes()
           
 double getRadius()
           
 Ring getRing(int x, int y)
           
 int getState(DistNodeHandle node)
           
 java.awt.Point getTextLocation(java.awt.Point idDim)
           
 java.awt.Point idToLocation(Id id, java.awt.Point center, int radius)
           
protected  boolean isHighlighted(Node node)
           
protected  boolean isSelected(Node node)
           
 int numChildren()
           
protected  void paintConnections(java.awt.Graphics g)
           
protected  void paintConnections(java.awt.Graphics g, Node node, boolean selected)
           
protected  void paintNodeCircle(java.awt.Graphics g, java.awt.Color color, int x, int y)
           
 void paintSelf(java.awt.Graphics g)
           
 void paintTree(java.awt.Graphics g, int w, int h)
           
 void prepNodes(java.awt.Graphics g, java.awt.Point center, int radius)
           
 void select()
           
 void setVisualization(Visualization v)
           
 void stopTouchingNodes()
           
 java.lang.String toString()
           
 void touchAllNodes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

clients

protected java.util.Hashtable clients
DistNodeHandle -> VisualizationClient


visualization

protected Visualization visualization

name

public java.lang.String name
The ring name


pair

protected java.security.KeyPair pair

RENDER_RADIUS

public static final double[] RENDER_RADIUS

DISTANCE_BUFFER

public static final double DISTANCE_BUFFER
See Also:
Constant Field Values

parent

public Ring parent

childNum

public int childNum
0 is the global ring a numbered coordinate sets a degree offset based on the total number of rings


angle

public double angle

unitX

public double unitX

unitY

public double unitY

renderSize

public int renderSize
Constructor Detail

Ring

public Ring(java.lang.String name,
            java.security.KeyPair pair,
            DistNodeHandle handle)

Ring

public Ring(java.lang.String name,
            java.security.KeyPair pair,
            DistNodeHandle handle,
            Ring parent)
Method Detail

getKeyPair

public java.security.KeyPair getKeyPair()

setVisualization

public void setVisualization(Visualization v)

addNode

public void addNode(Node node)

cloneNodes

protected java.util.Vector cloneNodes()

addNode

public Node addNode(DistNodeHandle handle)

buildAssociations

public void buildAssociations(Node n)
Checks self and all child rings.


getNodes

public Node[] getNodes()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getState

public int getState(DistNodeHandle node)

getNode

public Node getNode(int x,
                    int y)
Attempts to select a node in own ring, then children's rings.


getRing

public Ring getRing(int x,
                    int y)

contains

public boolean contains(int x,
                        int y)

paintTree

public void paintTree(java.awt.Graphics g,
                      int w,
                      int h)

paintSelf

public void paintSelf(java.awt.Graphics g)

paintConnections

protected void paintConnections(java.awt.Graphics g)

paintConnections

protected void paintConnections(java.awt.Graphics g,
                                Node node,
                                boolean selected)

prepNodes

public void prepNodes(java.awt.Graphics g,
                      java.awt.Point center,
                      int radius)

getTextLocation

public java.awt.Point getTextLocation(java.awt.Point idDim)

isSelected

protected boolean isSelected(Node node)

isHighlighted

protected boolean isHighlighted(Node node)

idToLocation

public java.awt.Point idToLocation(Id id,
                                   java.awt.Point center,
                                   int radius)

paintNodeCircle

protected void paintNodeCircle(java.awt.Graphics g,
                               java.awt.Color color,
                               int x,
                               int y)

getCenter

public java.awt.Point getCenter()

getCenterBasedOnParent

public java.awt.Point getCenterBasedOnParent()
Calculates your center as an offset of your parent's center.

Returns:
the point that is your center.

select

public void select()

getRadius

public double getRadius()

numChildren

public int numChildren()

addChild

public int addChild(Ring r)

stopTouchingNodes

public void stopTouchingNodes()

touchAllNodes

public void touchAllNodes()

ePOST API

Copyright © 2001-2005 - Rice Pastry.