edu.mit.sketch.ddg
Class LinePropertyConstraint

java.lang.Object
  |
  +--edu.mit.sketch.ddg.Constraint
        |
        +--edu.mit.sketch.ddg.LinePropertyConstraint

public class LinePropertyConstraint
extends Constraint

This class represents properties of line primitives (like "horizontal"). If the property holds, the primitive will have a self loop in the constraint graph - the constraint holds between the primitive and itself. The ObjectDescription will store several instances of this class representing different properties, depending on what constraint name is passed to the constructor. For example, to record all the horizontal constraints, instantiate this class passing the user strokes and the name HORIZONTAL to the constructor. According to the name an appropriate function will be used to figure out which lines are horizontal. (An alternative way to implement this would be to create a separate subclass of Constraint for each property. I may change to the latter implementation)

LinePropertyConstraint.java Created: Sat Nov 21 18:26:00 2001


Field Summary
static int HORIZONTAL
          Possible constraint names
protected  int m_name
          Name of the constraint
static int NEGATIVE_SLOPE
           
static int NUM_CONSTRAINTS
          Total number of possible constraints (to allow iterating over the names)
static int POSITIVE_SLOPE
           
static int VERTICAL
           
 
Fields inherited from class edu.mit.sketch.ddg.Constraint
m_constraintGraph
 
Constructor Summary
LinePropertyConstraint()
          Constructs an empty constraint graph.
LinePropertyConstraint(HashMap primToGeomParts, Object name)
          Constructs the constraint graph from and example drawn by the user.
 
Method Summary
 void inferConstraints(HashMap primToGeomParts)
          Infer the constraints from the users stroke geom parts and record the constraint graph into the hashtable.
 String name()
          Name of the constraint type.
 
Methods inherited from class edu.mit.sketch.ddg.Constraint
addHoldsBetween, confidence, constraintGraph, edgeList, holdsBetween, holdsBetween, print, relevance, removeHoldsBetween, removeLowConfidence, removeUncertain, setConfidence, setRelevance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_name

protected int m_name
Name of the constraint

HORIZONTAL

public static final int HORIZONTAL
Possible constraint names

VERTICAL

public static final int VERTICAL

POSITIVE_SLOPE

public static final int POSITIVE_SLOPE

NEGATIVE_SLOPE

public static final int NEGATIVE_SLOPE

NUM_CONSTRAINTS

public static final int NUM_CONSTRAINTS
Total number of possible constraints (to allow iterating over the names)
Constructor Detail

LinePropertyConstraint

public LinePropertyConstraint()
Constructs an empty constraint graph.

LinePropertyConstraint

public LinePropertyConstraint(HashMap primToGeomParts,
                              Object name)
Constructs the constraint graph from and example drawn by the user. The constraint is specified by the name. HashMap: type of key: Primitive, type of value: GeometricObject
Method Detail

inferConstraints

public void inferConstraints(HashMap primToGeomParts)
Infer the constraints from the users stroke geom parts and record the constraint graph into the hashtable. HashMap: type of key: Primitive, type of value: GeometricObject
Overrides:
inferConstraints in class Constraint

name

public String name()
Name of the constraint type.
Overrides:
name in class Constraint