diva.sketch.parser2d
Class DistanceRelation

java.lang.Object
  |
  +--diva.sketch.parser2d.DistanceRelation

public class DistanceRelation
extends java.lang.Object
implements Relation

Calculate the euclidean distance between given sites on pairs of input rectangles.

Version:
$Revision: 1.1 $

Constructor Summary
DistanceRelation()
          Calculate the euclidean distance between the CENTER sites on two input rectangles.
DistanceRelation(int site1, int site2)
          Calculate the euclidean distance between the given sites on two input rectangles.
 
Method Summary
 double apply(java.awt.geom.Rectangle2D r1, java.awt.geom.Rectangle2D r2)
          Return the distance between the constructor-specified sites on r1 and r2, respectively.
static void debug(java.lang.String s)
          Debugging output.
 java.lang.String getName()
          The name of this relation.
 int getSite1()
          Get the site for the first rectangle.
 int getSite2()
          Get the site for the second rectangle.
 void setSite1(int site1)
          Set the site for the first rectangle.
 void setSite2(int site2)
          Set the site for the second rectangle.
 java.lang.String toString()
          Print out the contents of this relation.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DistanceRelation

public DistanceRelation()
Calculate the euclidean distance between the CENTER sites on two input rectangles.

DistanceRelation

public DistanceRelation(int site1,
                        int site2)
Calculate the euclidean distance between the given sites on two input rectangles. The sites should be one of CENTER, NORTH_WEST, NORTH, etc.
Method Detail

apply

public double apply(java.awt.geom.Rectangle2D r1,
                    java.awt.geom.Rectangle2D r2)
Return the distance between the constructor-specified sites on r1 and r2, respectively.
Specified by:
apply in interface Relation

debug

public static void debug(java.lang.String s)
Debugging output.

getName

public java.lang.String getName()
The name of this relation.
Specified by:
getName in interface Relation

getSite1

public int getSite1()
Get the site for the first rectangle.

getSite2

public int getSite2()
Get the site for the second rectangle.

setSite1

public void setSite1(int site1)
Set the site for the first rectangle.

setSite2

public void setSite2(int site2)
Set the site for the second rectangle.

toString

public java.lang.String toString()
Print out the contents of this relation.
Overrides:
toString in class java.lang.Object