sugr
Class Factory

java.lang.Object
  extended bysugr.Factory

public class Factory
extends java.lang.Object

Get Instances of classes in an easy way.

Version:
1.0 (04.02.2002
2.0 (17.06.2003)
delete the constants for the type because they are now represented as Class objects.
Author:
Thomas Laebe

Field Summary
private static java.lang.Class[] relationclasses
           
private static java.lang.String[] relationnames
           
 
Constructor Summary
Factory()
           
 
Method Summary
static Entity getEntity(Vector v, Matrix cov, java.lang.Class classid)
          Initialize an Entity with given entities and class ID.
static Entity getEntity(Vector v, Matrix cov, java.lang.String classname)
          Initialize an Entity with given entities and class name.
static java.lang.Object getInstance(java.lang.Object e1, java.lang.Object e2, java.lang.String classname)
          Initialize an object with 2 given parameters and class name.
static java.lang.Object getInstance(java.lang.Object e1, java.lang.Object e2, java.lang.String classname_param1, java.lang.String classname_param2, java.lang.String classname)
          Initialize an object with 2 given parameters and their tpyes and class name.
static Relation getRelation(Entity e1, Entity e2, java.lang.Class relationID)
          Initialize a relation class with given entities and class ID.
static Relation getRelation(Entity e1, Entity e2, java.lang.String relationclassname)
          Initialize a relation class with given entities and class name.
static Relation getRelationByName(Entity e1, Entity e2, java.lang.String relation)
          Initialize a relation class with given entities and class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

relationnames

private static final java.lang.String[] relationnames

relationclasses

private static final java.lang.Class[] relationclasses
Constructor Detail

Factory

public Factory()
Method Detail

getEntity

public static Entity getEntity(Vector v,
                               Matrix cov,
                               java.lang.String classname)
                        throws java.lang.IllegalArgumentException,
                               java.lang.RuntimeException
Initialize an Entity with given entities and class name. A Matrix and a Vector as initial values should be given.

Parameters:
classname - one of an Entity which exists in sugr.
Throws:
java.lang.IllegalArgumentException - if construction not possible
java.lang.RuntimeException - if an Exceptioin while creating the object

getEntity

public static Entity getEntity(Vector v,
                               Matrix cov,
                               java.lang.Class classid)
                        throws java.lang.IllegalArgumentException,
                               java.lang.RuntimeException
Initialize an Entity with given entities and class ID. A Matrix and a Vector as initial values should be given.

Parameters:
classid - one of POINT_2D,LINE_2D,POINT_3D,LINE_3D PLANE_3D
Throws:
java.lang.IllegalArgumentException - if construction not possible
java.lang.RuntimeException - if an Exceptioin while creating the object

getRelationByName

public static Relation getRelationByName(Entity e1,
                                         Entity e2,
                                         java.lang.String relation)
                                  throws java.lang.IllegalArgumentException,
                                         java.lang.RuntimeException
Initialize a relation class with given entities and class name.

Parameters:
relation - name of the relation: "Incidence", "Identity", "Parallelity", "Orthogonality", "Distance"
Throws:
java.lang.IllegalArgumentException - if Relation not possible
java.lang.RuntimeException - if an Exceptioin while creating the Relation occurs

getRelation

public static Relation getRelation(Entity e1,
                                   Entity e2,
                                   java.lang.Class relationID)
Initialize a relation class with given entities and class ID.

Parameters:
relationID - name of the relation class: Orthogonal, Equal, Incident, Parallel
Throws:
java.lang.IllegalArgumentException - if Relation not possible
java.lang.RuntimeException - if an Exceptioin while creating the Relation occurs

getRelation

public static Relation getRelation(Entity e1,
                                   Entity e2,
                                   java.lang.String relationclassname)
                            throws java.lang.ClassNotFoundException
Initialize a relation class with given entities and class name.

Parameters:
relationclassname - name of the relation class: Orthogonal, Equal, Incident, Parallel, Distance
Throws:
java.lang.IllegalArgumentException - if Relation not possible
java.lang.RuntimeException - if an Exceptioin while creating the Relation occurs
java.lang.ClassNotFoundException

getInstance

public static java.lang.Object getInstance(java.lang.Object e1,
                                           java.lang.Object e2,
                                           java.lang.String classname)
                                    throws java.lang.IllegalArgumentException,
                                           java.lang.RuntimeException
Initialize an object with 2 given parameters and class name.

Parameters:
classname - name of the class. Should be a class available in sugr.
Throws:
java.lang.IllegalArgumentException - if Construction is not possible
java.lang.RuntimeException - if an Exception while creating the object occurs

getInstance

public static java.lang.Object getInstance(java.lang.Object e1,
                                           java.lang.Object e2,
                                           java.lang.String classname_param1,
                                           java.lang.String classname_param2,
                                           java.lang.String classname)
                                    throws java.lang.IllegalArgumentException,
                                           java.lang.RuntimeException
Initialize an object with 2 given parameters and their tpyes and class name. The type names are neccessary if the real type ob the object is a subclass of the parameters of the defined constructor.

Parameters:
classname - name of the class. Should be a class available in sugr.
Throws:
java.lang.IllegalArgumentException - if Construction is not possible
java.lang.RuntimeException - if an Exception while creating the object occurs