diva.sketch.parser2d
Class AreaRatioRelation

java.lang.Object
  |
  +--diva.sketch.parser2d.DirectedRelation
        |
        +--diva.sketch.parser2d.AreaRatioRelation

public class AreaRatioRelation
extends DirectedRelation

Calculate the ratio of areas of the input rectangles.

Version:
$Revision: 1.1 $

Fields inherited from class diva.sketch.parser2d.DirectedRelation
FIRST_RECT, SECOND_RECT
 
Constructor Summary
AreaRatioRelation(int whichNumerator)
          Calculate the ratio of areas with the given rectangle (FIRST_RECT or SECOND_RECT from DirectedRelation) as the numerator for the calculation.
 
Method Summary
 double apply(java.awt.geom.Rectangle2D r1, java.awt.geom.Rectangle2D r2)
          Calculate the ratio of areas with the constructor-specified rectangle as the numerator for the calculation.
 java.lang.String getName()
          The name of this relation.
 java.lang.String toString()
          Print out the contents of this relation.
 
Methods inherited from class diva.sketch.parser2d.DirectedRelation
getWhich, parseWhich, printWhich, setWhich
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AreaRatioRelation

public AreaRatioRelation(int whichNumerator)
Calculate the ratio of areas with the given rectangle (FIRST_RECT or SECOND_RECT from DirectedRelation) as the numerator for the calculation.
Method Detail

apply

public double apply(java.awt.geom.Rectangle2D r1,
                    java.awt.geom.Rectangle2D r2)
Calculate the ratio of areas with the constructor-specified rectangle as the numerator for the calculation.
Overrides:
apply in class DirectedRelation

getName

public java.lang.String getName()
The name of this relation.
Overrides:
getName in class DirectedRelation

toString

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