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

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

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

Represents an edge linking PrimitiveCatchmentBasins in PrimitiveCatchmentBasinsGraphs.

Author:
Bruno Klava

Constructor Summary
Edge(int weight, Pixel generatorPixel1, Pixel generatorPixel2, PrimitiveCatchmentBasin basin1, PrimitiveCatchmentBasin basin2)
          Creates an edge linking basin1 and basin2.
 
Method Summary
 int compareTo(Edge otherEdge)
          Used for ordering Edges.
 PrimitiveCatchmentBasin getBasin1()
          Getter for the basin1.
 PrimitiveCatchmentBasin getBasin2()
          Getter for the basin2.
 Pixel getGeneratorPixel1()
          Getter for the generatorPixel1.
 Pixel getGeneratorPixel2()
          Getter for the generatorPixel2.
 int getWeight()
          Getter for the weight.
 void setGeneratorPixel1(Pixel pixel)
          Setter for the generatorPixel1.
 void setGeneratorPixel2(Pixel pixel)
          Setter for the generatorPixel2.
 void setWeight(int weight)
          Setter for the weight.
 java.lang.String toString()
          Returns a description of this Edge, if the following format: (basin1.getLabel(), basin2.getLabel()): weight
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Edge

public Edge(int weight,
            Pixel generatorPixel1,
            Pixel generatorPixel2,
            PrimitiveCatchmentBasin basin1,
            PrimitiveCatchmentBasin basin2)
Creates an edge linking basin1 and basin2.

Parameters:
weight - the weight given to this edge
generatorPixel1 - a Pixel of basins1 that minimized the calculated weight
generatorPixel2 - a Pixel of basins2 that minimized the calculated weight
basin1 - a PrimitiveCatchmentBasin adjacent to basin2
basin2 - a PrimitiveCatchmentBasin adjacent to basin1
Method Detail

getBasin1

public PrimitiveCatchmentBasin getBasin1()
Getter for the basin1.

Returns:
basin1

getBasin2

public PrimitiveCatchmentBasin getBasin2()
Getter for the basin2.

Returns:
basin2

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

getGeneratorPixel1

public Pixel getGeneratorPixel1()
Getter for the generatorPixel1.

Returns:
generatorPixel1

setGeneratorPixel1

public void setGeneratorPixel1(Pixel pixel)
Setter for the generatorPixel1.

Parameters:
pixel - the new generatorPixel1

getGeneratorPixel2

public Pixel getGeneratorPixel2()
Getter for the generatorPixel2.

Returns:
generatorPixel2

setGeneratorPixel2

public void setGeneratorPixel2(Pixel pixel)
Setter for the generatorPixel2.

Parameters:
pixel - the new generatorPixel2

compareTo

public int compareTo(Edge otherEdge)
Used for ordering Edges.

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

toString

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

(basin1.getLabel(), basin2.getLabel()): weight

Overrides:
toString in class java.lang.Object