|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.mit.sketch.ddg.Constraint
This abstract class represents the constraints on primitives. It contains a data structure that stores all the pairs of primitives between which a constraint holds. It provides methods dealing with this data structure that apply to any kinds of constraints - like query whether a constraint is true or not. Subclasses should implement the methods that apply to particular constraints.
If the constraint represents a property instead of a relationship, the primitive will have a self loop in the constraint graph - the constraint holds between the primitive and itself.
Constraint.java Created: Sat Nov 21 18:26:00 2001
| Field Summary | |
protected ConstraintGraph |
m_constraintGraph
ConstraintGraph is a hashtable. |
| Constructor Summary | |
Constraint()
Constructs an empty constraint graph. |
|
Constraint(HashMap primToGeomParts,
Object o)
Constructs the constraint graph from and example drawn by the user. |
|
| Method Summary | |
void |
addHoldsBetween(Primitive p1,
Primitive p2,
double confidence,
double relevance)
Add an edge to the constraint graph |
double |
confidence(Primitive p1,
Primitive p2)
Return the confidence of the constraint Returns 0 if the edge is not present. |
ConstraintGraph |
constraintGraph()
Returns the constraint graph |
Vector |
edgeList()
Return the list primitive pairs for which this constraint holds. |
boolean |
holdsBetween(Primitive p1,
Primitive p2)
Returns true if the constraint holds between the given primitives. |
boolean |
holdsBetween(Primitive p1,
Primitive p2,
double confidenceThreshold)
Returns true if the constraint holds between the given primitives with a given threshold on confidence |
abstract void |
inferConstraints(HashMap primToGeomParts)
Infer the constraints from the users stroke geom parts and record the constraint graph. |
abstract String |
name()
Name of the constraint type (for example "intersects"). |
void |
print()
Print constraint graph |
double |
relevance(Primitive p1,
Primitive p2)
Return the relevance of the constraint. |
void |
removeHoldsBetween(Primitive p1,
Primitive p2)
Remove an edge from the constraint graph |
void |
removeLowConfidence()
Remove constraints that are below the LOW_CONFIDENCE_THRESHOLD in confidence |
void |
removeUncertain()
Remove constraints that are below the UNCERTAIN_THRESHOLD in combined confidence and relevance |
void |
setConfidence(Primitive p1,
Primitive p2,
double confidence)
Change the confidence of the constraint |
void |
setRelevance(Primitive p1,
Primitive p2,
double relevance)
Change the relevance of the constraint |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected ConstraintGraph m_constraintGraph
| Constructor Detail |
public Constraint()
public Constraint(HashMap primToGeomParts,
Object o)
| Method Detail |
public abstract void inferConstraints(HashMap primToGeomParts)
public abstract String name()
public boolean holdsBetween(Primitive p1,
Primitive p2)
public boolean holdsBetween(Primitive p1,
Primitive p2,
double confidenceThreshold)
public ConstraintGraph constraintGraph()
public void print()
public void removeUncertain()
public void removeLowConfidence()
public void removeHoldsBetween(Primitive p1,
Primitive p2)
public void addHoldsBetween(Primitive p1,
Primitive p2,
double confidence,
double relevance)
public double relevance(Primitive p1,
Primitive p2)
public double confidence(Primitive p1,
Primitive p2)
public void setRelevance(Primitive p1,
Primitive p2,
double relevance)
public void setConfidence(Primitive p1,
Primitive p2,
double confidence)
public Vector edgeList()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||