Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.graph.impl
Class Vertex  view Vertex download Vertex.java

java.lang.Object
  extended bycom.port80.util.attr.AttrTable
      extended bycom.port80.graph.impl.GraphElement
          extended bycom.port80.graph.impl.Vertex
All Implemented Interfaces:
com.port80.util.attr.IAttrTable, com.port80.graph.IGraphElement, com.port80.graph.IVertex

public class Vertex
extends GraphElement
implements com.port80.graph.IVertex

Basic graph vertex implementation.


Nested Class Summary
static class Vertex.NameComparator
           
static class Vertex.Port
           
 
Field Summary
private static java.lang.String CLASSNAME
           
private static boolean DEBUG
           
private  com.port80.graph.IEdge[] ins
           
protected  int inSize
           
private static java.lang.String NAME
           
private  com.port80.graph.IEdge[] outs
           
protected  int outSize
           
private static java.lang.String PACKAGENAME
           
protected  com.port80.graph.IGraph parent
           
protected  Vertex.Port[] ports
           
private static int VERSION
           
private static java.lang.String VERSIONNAME
           
 
Fields inherited from class com.port80.graph.impl.GraphElement
fData, fName
 
Fields inherited from class com.port80.util.attr.AttrTable
parentAttrTable
 
Constructor Summary
Vertex(java.lang.String name, java.lang.String port, java.lang.Object data, com.port80.graph.IGraph parent)
           
 
Method Summary
 void addIn(com.port80.graph.IEdge e)
           
 void addIn(com.port80.graph.IEdge e, int n)
           
 void addOut(com.port80.graph.IEdge e)
           
 void addOut(com.port80.graph.IEdge e, int n)
           
 void addPort(java.lang.String portname)
           
 void clearEdges()
           
 void clearLayout()
           
 com.port80.graph.IEdge[] edges()
          The set of all edges.
 boolean equals(java.lang.Object a)
          Determine whether this Object is semantically equal to another Object.
 java.util.List findEdgesFrom(com.port80.graph.IVertex v, java.util.List ret)
           
 java.util.List findEdgesFrom(com.port80.graph.IVertex v, java.lang.String attrname, java.util.List ret)
           
 java.util.List findEdgesTo(com.port80.graph.IVertex v, java.util.List ret)
           
 java.util.List findEdgesTo(com.port80.graph.IVertex v, java.lang.String attrname, java.util.List ret)
           
 java.util.List findIns(java.lang.String attrname, java.util.List ret)
          Find edge with the given attribute.
 java.util.List findOuts(java.lang.String attrname, java.util.List ret)
           
 java.lang.String getElementTypeName()
           
 com.port80.graph.IGraph getParent()
           
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 com.port80.graph.IEdge[] ins()
           
 int inSize()
           
 boolean isReachable(com.port80.graph.IVertex target)
           
 java.util.Set neighbours()
          Set of directly conected vertex.
 com.port80.graph.IEdge[] outs()
           
 int outSize()
           
 void pack()
           
 java.util.Set reachable()
           
 boolean removeIn(com.port80.graph.IEdge e)
           
 com.port80.graph.IEdge removeIn(int n)
           
 int removeInsFrom(com.port80.graph.IVertex v)
          Remove all edges coming from given vertex.
 boolean removeOut(com.port80.graph.IEdge e)
           
 com.port80.graph.IEdge removeOut(int n)
           
 int removeOutsTo(com.port80.graph.IVertex v)
          Remove all edges to given vertex.
 void setParent(com.port80.graph.IGraph g)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class com.port80.graph.impl.GraphElement
getData, getName, setData, setName
 
Methods inherited from class com.port80.util.attr.AttrTable
attrKeySet, clearAttrs, getAttr, getAttrAsString, getAttrBool, getAttrBool, getAttrCached, getAttrDouble, getAttrDouble, getAttrFloat, getAttrFloat, getAttrInt, getAttrInt, getAttrLong, getAttrLong, getAttrRegistry, getAttrString, hasAttr, initAttr, initAttr, initAttr, initAttr, initAttr, initAttr, initAttr, initAttr, removeAttr, removeUnregisteredAttrs, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttrFromString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.port80.graph.IGraphElement
getData, getName, setData, setName
 
Methods inherited from interface com.port80.util.attr.IAttrTable
attrKeySet, clearAttrs, getAttr, getAttrAsString, getAttrBool, getAttrBool, getAttrCached, getAttrDouble, getAttrDouble, getAttrFloat, getAttrFloat, getAttrInt, getAttrInt, getAttrLong, getAttrLong, getAttrRegistry, getAttrString, hasAttr, removeAttr, removeUnregisteredAttrs, setAttr, setAttr, setAttr, setAttr, setAttr, setAttr, setAttrFromString
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

PACKAGENAME

private static final java.lang.String PACKAGENAME
See Also:
Constant Field Values

CLASSNAME

private static final java.lang.String CLASSNAME
See Also:
Constant Field Values

VERSION

private static final int VERSION
See Also:
Constant Field Values

VERSIONNAME

private static final java.lang.String VERSIONNAME
See Also:
Constant Field Values

DEBUG

private static boolean DEBUG

parent

protected com.port80.graph.IGraph parent

ports

protected Vertex.Port[] ports

inSize

protected int inSize

outSize

protected int outSize

ins

private com.port80.graph.IEdge[] ins

outs

private com.port80.graph.IEdge[] outs
Constructor Detail

Vertex

public Vertex(java.lang.String name,
              java.lang.String port,
              java.lang.Object data,
              com.port80.graph.IGraph parent)
Method Detail

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getParent

public com.port80.graph.IGraph getParent()
Specified by:
getParent in interface com.port80.graph.IVertex

setParent

public void setParent(com.port80.graph.IGraph g)
Specified by:
setParent in interface com.port80.graph.IVertex

addPort

public void addPort(java.lang.String portname)
Specified by:
addPort in interface com.port80.graph.IVertex

addIn

public void addIn(com.port80.graph.IEdge e)
Specified by:
addIn in interface com.port80.graph.IVertex

addIn

public void addIn(com.port80.graph.IEdge e,
                  int n)
Specified by:
addIn in interface com.port80.graph.IVertex

addOut

public void addOut(com.port80.graph.IEdge e)
Specified by:
addOut in interface com.port80.graph.IVertex

addOut

public void addOut(com.port80.graph.IEdge e,
                   int n)
Specified by:
addOut in interface com.port80.graph.IVertex

removeIn

public com.port80.graph.IEdge removeIn(int n)
Specified by:
removeIn in interface com.port80.graph.IVertex

removeIn

public boolean removeIn(com.port80.graph.IEdge e)
Specified by:
removeIn in interface com.port80.graph.IVertex

removeInsFrom

public int removeInsFrom(com.port80.graph.IVertex v)
Remove all edges coming from given vertex.

Specified by:
removeInsFrom in interface com.port80.graph.IVertex

removeOut

public com.port80.graph.IEdge removeOut(int n)
Specified by:
removeOut in interface com.port80.graph.IVertex

removeOut

public boolean removeOut(com.port80.graph.IEdge e)
Specified by:
removeOut in interface com.port80.graph.IVertex

removeOutsTo

public int removeOutsTo(com.port80.graph.IVertex v)
Remove all edges to given vertex.

Specified by:
removeOutsTo in interface com.port80.graph.IVertex

inSize

public int inSize()
Specified by:
inSize in interface com.port80.graph.IVertex

outSize

public int outSize()
Specified by:
outSize in interface com.port80.graph.IVertex

ins

public com.port80.graph.IEdge[] ins()
Specified by:
ins in interface com.port80.graph.IVertex

outs

public com.port80.graph.IEdge[] outs()
Specified by:
outs in interface com.port80.graph.IVertex

edges

public com.port80.graph.IEdge[] edges()
The set of all edges. NOTE: The set returned should be considered read only. Add or remove of edges should use method provided by the Edge class.

Specified by:
edges in interface com.port80.graph.IVertex

findIns

public java.util.List findIns(java.lang.String attrname,
                              java.util.List ret)
Description copied from interface: com.port80.graph.IVertex
Find edge with the given attribute.

Specified by:
findIns in interface com.port80.graph.IVertex

findOuts

public java.util.List findOuts(java.lang.String attrname,
                               java.util.List ret)
Specified by:
findOuts in interface com.port80.graph.IVertex

findEdgesTo

public java.util.List findEdgesTo(com.port80.graph.IVertex v,
                                  java.util.List ret)
Specified by:
findEdgesTo in interface com.port80.graph.IVertex

findEdgesFrom

public java.util.List findEdgesFrom(com.port80.graph.IVertex v,
                                    java.util.List ret)
Specified by:
findEdgesFrom in interface com.port80.graph.IVertex

findEdgesTo

public java.util.List findEdgesTo(com.port80.graph.IVertex v,
                                  java.lang.String attrname,
                                  java.util.List ret)
Specified by:
findEdgesTo in interface com.port80.graph.IVertex

findEdgesFrom

public java.util.List findEdgesFrom(com.port80.graph.IVertex v,
                                    java.lang.String attrname,
                                    java.util.List ret)
Specified by:
findEdgesFrom in interface com.port80.graph.IVertex

clearEdges

public void clearEdges()
Specified by:
clearEdges in interface com.port80.graph.IVertex

clearLayout

public void clearLayout()
Specified by:
clearLayout in interface com.port80.graph.IVertex

pack

public void pack()

neighbours

public java.util.Set neighbours()
Set of directly conected vertex. NOTE: The set returned should be considered read only. Add or remove of neighours should be done by add/remove edges.

Specified by:
neighbours in interface com.port80.graph.IVertex

reachable

public java.util.Set reachable()
Specified by:
reachable in interface com.port80.graph.IVertex

isReachable

public boolean isReachable(com.port80.graph.IVertex target)
Specified by:
isReachable in interface com.port80.graph.IVertex

getElementTypeName

public java.lang.String getElementTypeName()
Specified by:
getElementTypeName in interface com.port80.graph.IGraphElement
Overrides:
getElementTypeName in class GraphElement

hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


equals

public boolean equals(java.lang.Object a)
Description copied from class: java.lang.Object
Determine whether this Object is semantically equal to another Object.

There are some fairly strict requirements on this method which subclasses must follow:

  • It must be transitive. If a.equals(b) and b.equals(c), then a.equals(c) must be true as well.
  • It must be symmetric. a.equals(b) and b.equals(a) must have the same value.
  • It must be reflexive. a.equals(a) must always be true.
  • It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
  • a.equals(null) must be false.
  • It must be consistent with hashCode(). That is, a.equals(b) must imply a.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.

This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for a.equals(b) to be true even though a.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.

In general, the Collections API (java.util) use the equals method rather than the == operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.

The default implementation returns this == o.