rails.algorithms
Class NetworkEdge

java.lang.Object
  extended by rails.algorithms.NetworkEdge
All Implemented Interfaces:
java.lang.Comparable<NetworkEdge>

public final class NetworkEdge
extends java.lang.Object
implements java.lang.Comparable<NetworkEdge>


Nested Class Summary
static class NetworkEdge.CostOrder
          Ordering based on routecosts
(package private) static class NetworkEdge.MergeResult
           
 
Field Summary
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
NetworkEdge(NetworkVertex source, NetworkVertex target, boolean greedy)
           
NetworkEdge(NetworkVertex source, NetworkVertex target, boolean greedy, int distance, java.util.List<NetworkVertex> hiddenVertexes)
           
 
Method Summary
 int compareTo(NetworkEdge otherEdge)
          Natural order based on the ordering of the connected vertices
(package private)  NetworkVertex getCommonVertex(NetworkEdge otherEdge)
          gets common vertex, if both source and target are common, returns source of this edge
 java.lang.String getConnection()
           
 int getDistance()
           
static java.awt.Shape getEdgeShape(HexMap map, NetworkEdge edge)
           
 java.util.List<NetworkVertex> getHiddenVertices()
           
 java.lang.String getOrderedConnection()
           
(package private)  NetworkVertex getOtherVertex(NetworkVertex vertex)
          returns the other vertex, if given vertex is not source/target of vertex, returns null
(package private)  int getRouteCosts()
           
 NetworkVertex getSource()
           
 NetworkVertex getTarget()
           
 java.util.List<NetworkVertex> getVertexPath()
          all vertices from source to target, including hidden vertices
 boolean isGreedy()
           
static NetworkEdge.MergeResult mergeEdges(NetworkEdge edgeA, NetworkEdge edgeB)
           
static boolean mergeEdgesInGraph(org.jgrapht.Graph<NetworkVertex,NetworkEdge> graph, NetworkEdge edgeA, NetworkEdge edgeB)
           
static NetworkEdge replaceVertex(NetworkEdge edge, NetworkVertex oldVertex, NetworkVertex newVertex)
          for a given edge it replaces one of the vertices by a different one otherwise copies all edge attributes
 void setGreedy(boolean greedy)
           
(package private)  void setRouteCosts(int routeCosts)
           
 java.lang.String toFullInfoString()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log
Constructor Detail

NetworkEdge

public NetworkEdge(NetworkVertex source,
                   NetworkVertex target,
                   boolean greedy)

NetworkEdge

public NetworkEdge(NetworkVertex source,
                   NetworkVertex target,
                   boolean greedy,
                   int distance,
                   java.util.List<NetworkVertex> hiddenVertexes)
Method Detail

getSource

public NetworkVertex getSource()

getTarget

public NetworkVertex getTarget()

getOtherVertex

NetworkVertex getOtherVertex(NetworkVertex vertex)
returns the other vertex, if given vertex is not source/target of vertex, returns null


getCommonVertex

NetworkVertex getCommonVertex(NetworkEdge otherEdge)
gets common vertex, if both source and target are common, returns source of this edge


isGreedy

public boolean isGreedy()

setGreedy

public void setGreedy(boolean greedy)

getDistance

public int getDistance()

getRouteCosts

int getRouteCosts()

setRouteCosts

void setRouteCosts(int routeCosts)

getHiddenVertices

public java.util.List<NetworkVertex> getHiddenVertices()

getVertexPath

public java.util.List<NetworkVertex> getVertexPath()
all vertices from source to target, including hidden vertices


toFullInfoString

public java.lang.String toFullInfoString()

getOrderedConnection

public java.lang.String getOrderedConnection()

getConnection

public java.lang.String getConnection()

toString

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

compareTo

public int compareTo(NetworkEdge otherEdge)
Natural order based on the ordering of the connected vertices

Specified by:
compareTo in interface java.lang.Comparable<NetworkEdge>

mergeEdges

public static NetworkEdge.MergeResult mergeEdges(NetworkEdge edgeA,
                                                 NetworkEdge edgeB)

mergeEdgesInGraph

public static boolean mergeEdgesInGraph(org.jgrapht.Graph<NetworkVertex,NetworkEdge> graph,
                                        NetworkEdge edgeA,
                                        NetworkEdge edgeB)

replaceVertex

public static NetworkEdge replaceVertex(NetworkEdge edge,
                                        NetworkVertex oldVertex,
                                        NetworkVertex newVertex)
for a given edge it replaces one of the vertices by a different one otherwise copies all edge attributes

Returns:
copied edge with replaced vertex, null if oldVertex is neither source, nor target

getEdgeShape

public static java.awt.Shape getEdgeShape(HexMap map,
                                          NetworkEdge edge)