br.usp.ime.klava.segmentit.structures
Class HierarchyEdge

java.lang.Object
  extended by br.usp.ime.klava.segmentit.structures.HierarchyEdge
All Implemented Interfaces:
java.lang.Comparable<HierarchyEdge>

public class HierarchyEdge
extends java.lang.Object
implements java.lang.Comparable<HierarchyEdge>

Represents an edge linking nodes in hierarchical structures.

Author:
Bruno Klava

Constructor Summary
HierarchyEdge(int weight, HierarchyNode node1, HierarchyNode node2, EdgeType type)
          Creates an edge linking node1 and node2.
 
Method Summary
 int compareTo(HierarchyEdge otherEdge)
          Used for ordering Edges.
 EdgeType getEdgeType()
          Getter for the type property.
 HierarchyNode getNode1()
          Getter for the node1.
 HierarchyNode getNode2()
          Getter for the node2.
 int getWeight()
          Getter for the weight.
 void setEdgeType(EdgeType type)
          Setter for the type property.
 void setWeight(int weight)
          Setter for the weight.
 java.lang.String toString()
          Returns a description of this Edge, if the following format: (node1.getLabel(), node2.getLabel()): weight type
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HierarchyEdge

public HierarchyEdge(int weight,
                     HierarchyNode node1,
                     HierarchyNode node2,
                     EdgeType type)
Creates an edge linking node1 and node2.

Parameters:
weight - the weight given to this edge
node1 - a HierarchyNode adjacent to node2
node2 - a HierarchyNode adjacent to node1
type - the type of this edge
Method Detail

getNode1

public HierarchyNode getNode1()
Getter for the node1.

Returns:
node1

getNode2

public HierarchyNode getNode2()
Getter for the node2.

Returns:
node2

getWeight

public int getWeight()
Getter for the weight.

Returns:
weight

setWeight

public void setWeight(int weight)
Setter for the weight.

Parameters:
weight - the new weight

getEdgeType

public EdgeType getEdgeType()
Getter for the type property.

Returns:
the type of this edge

setEdgeType

public void setEdgeType(EdgeType type)
Setter for the type property.

Parameters:
type - the new value of type

compareTo

public int compareTo(HierarchyEdge otherEdge)
Used for ordering Edges. It orders first the DEFAULT edges, then the INTERNAL_LIMITED_REGION edges and finally the EXTERNAL edges in order to guarantee a determined structure in the TreeOfCriticalLakes.

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

toString

public java.lang.String toString()
Returns a description of this Edge, if the following format:

(node1.getLabel(), node2.getLabel()): weight type

Overrides:
toString in class java.lang.Object