|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.sketch.parser2d.AbstractRule
public abstract class AbstractRule
A parse rule implementation that matches the RHS of a production and generates the LHS. Subclasses fill in the match() method to impose the constraints of the rule.
Field Summary | |
---|---|
static int |
CENTER
The center direction constant. |
static int |
EAST
The east direction constant. |
static double |
NO_MAX
|
static double |
NO_MIN
|
static int |
NORTH
The north direction constant. |
static int |
NORTH_EAST
The north-east direction constant. |
static int |
NORTH_WEST
The north-west direction constant. |
static int |
SOUTH
The south direction constant. |
static int |
SOUTH_EAST
The south-east direction constant. |
static int |
SOUTH_WEST
The south-west direction constant. |
static int |
WEST
The west direction constant. |
Constructor Summary | |
---|---|
AbstractRule(String lhsType,
String rhsNames,
String rhsTypes)
A utility constructor which simply takes strings with single words separated by whitespace, separates these strings into arrays, and calls the standard array constructor. |
|
AbstractRule(Type lhsType,
String[] rhsNames,
Type[] rhsTypes)
Construct a new basic rule with the given LHS and RHS structure. |
Method Summary | |
---|---|
protected static double |
angle(SceneElement from,
int fromSite,
SceneElement to,
int toSite)
Return the angle between the constructor-specified sites on r1 and r2, respectively. |
static double |
areaRatio(SceneElement num,
SceneElement denom)
Calculate the ratio of areas with the constructor-specified rectangle as the numerator for the calculation. |
static double |
calcProb(List children)
Return a probability calculation of an aggregate based on the probabilities of the children. |
protected static double |
distance(SceneElement from,
int fromSite,
SceneElement to,
int toSite)
Return the distance between the constructor-specified sites on r1 and r2, respectively. |
Type |
getLHSType()
Return the LHS type of the rule. |
String[] |
getRHSNames()
Return the RHS names of the rule. |
Type[] |
getRHSTypes()
Return the RHS types of the rule. |
static double |
heightRatio(SceneElement num,
SceneElement denom)
Calculate the height ratio of the bounding boxes of the two given scene elements. |
abstract CompositeElement |
match(CompositeElement[] rhs,
Scene db)
Match the given scene elements and return a resulting element, or return null if there is no match. |
static double |
overlap(SceneElement which,
SceneElement other)
Calculate the ratio of the area of the intersection of the bounding boxes of the two given scene elements to the area of the bounding box of the "which" argument. |
static double |
siteX(SceneElement e,
int site)
Return the X coordinate of the given site for the given rectangle. |
static double |
siteY(SceneElement e,
int site)
Return the Y coordinate of the given site for the given rectangle. |
static double |
widthRatio(SceneElement num,
SceneElement denom)
Calculate the width ratio of the bounding boxes of the two given scene elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double NO_MIN
public static final double NO_MAX
public static final int NORTH_EAST
public static final int NORTH
public static final int NORTH_WEST
public static final int WEST
public static final int SOUTH_WEST
public static final int SOUTH
public static final int SOUTH_EAST
public static final int EAST
public static final int CENTER
Constructor Detail |
---|
public AbstractRule(String lhsType, String rhsNames, String rhsTypes)
public AbstractRule(Type lhsType, String[] rhsNames, Type[] rhsTypes)
Method Detail |
---|
public Type getLHSType()
getLHSType
in interface Rule
public Type[] getRHSTypes()
getRHSTypes
in interface Rule
public String[] getRHSNames()
getRHSNames
in interface Rule
public abstract CompositeElement match(CompositeElement[] rhs, Scene db)
match
in interface Rule
public static final double siteX(SceneElement e, int site)
public static final double siteY(SceneElement e, int site)
protected static final double angle(SceneElement from, int fromSite, SceneElement to, int toSite)
public static final double areaRatio(SceneElement num, SceneElement denom)
protected static final double distance(SceneElement from, int fromSite, SceneElement to, int toSite)
public static final double heightRatio(SceneElement num, SceneElement denom)
public static final double widthRatio(SceneElement num, SceneElement denom)
public static final double overlap(SceneElement which, SceneElement other)
public static final double calcProb(List children)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |