edu.mit.sketch.ddg
Class Primitive

java.lang.Object
  |
  +--edu.mit.sketch.ddg.Primitive

public class Primitive
extends Object

An abstract geometric primitive that is part of an object description

Primitive.java Created: Sat Nov 20 21:36:00 2001


Field Summary
static int ARC
           
static int LINE
           
static int OVAL
           
static int POINT
           
static int UNKNOWN
           
 
Constructor Summary
Primitive(int type, String name)
          Constructs the primitive of the type and name
 
Method Summary
static Primitive convertFrom(GeometricObject o, int index)
          Constructs a primitive from a give object with index in the name.
 boolean equals(Object p)
          The two primitives are the same if their name and type are the same.
 int hashCode()
          The hashcode of a primitive is a hash code of it's name.
 String name()
          Name of the primitive (like "l2" in "line l2")
 void print()
          Print the description of the primitive (like "line l2") on a separate line
 String toString()
          String description of the primitive (like "line l2") - includes both type and name
 int type()
          Type of the primitive (like "line" in "line l2")
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN

POINT

public static final int POINT

LINE

public static final int LINE

OVAL

public static final int OVAL

ARC

public static final int ARC
Constructor Detail

Primitive

public Primitive(int type,
                 String name)
Constructs the primitive of the type and name
Method Detail

convertFrom

public static Primitive convertFrom(GeometricObject o,
                                    int index)
Constructs a primitive from a give object with index in the name. Example: if index is 4 and the object is a line the primitive will be "line l4".

toString

public String toString()
String description of the primitive (like "line l2") - includes both type and name
Overrides:
toString in class Object

print

public void print()
Print the description of the primitive (like "line l2") on a separate line

equals

public boolean equals(Object p)
The two primitives are the same if their name and type are the same. For use in hashtable representing the constraint graph
Overrides:
equals in class Object

hashCode

public int hashCode()
The hashcode of a primitive is a hash code of it's name. For use in hashtable representing the constraint graph
Overrides:
hashCode in class Object

name

public String name()
Name of the primitive (like "l2" in "line l2")

type

public int type()
Type of the primitive (like "line" in "line l2")