torero.model
Class AttributeAssingnment

java.lang.Object
  |
  +--torero.model.AttributeAssingnment
All Implemented Interfaces:
ObjectInputValidation, Serializable

public class AttributeAssingnment
extends Object
implements Serializable, ObjectInputValidation

The AttributeAssingnment Class represents connections between (different) Attributes in a certain Production. There is always a destination and one or more sources. The scope of an AttributeAssingnment is bounded to a Production it belongs to.

See Also:
Production, Serialized Form

Inner Class Summary
 class AttributeAssingnment.AttribKey
          The inner AttribKey class is used to represent the the elements that can be assigned to each other.
 
Field Summary
static int INVALID_ASSIGNMENT
           
static int NO_ASSIGNMENT
           
static String SEPBegin
           
static String SEPEnd
           
static int VALID_ASSIGNMENT
           
 
Constructor Summary
AttributeAssingnment(Production belongsTo, Production.ListElement le, Attribute anAttribute)
          Creates a new AttributeAssingnment for the given Production with the given ListElement and Attribute as Destination.
 
Method Summary
 void addSource(Production.ListElement le, Attribute anAttribute)
          Adds a new Source with the given ListElement and Attribute to this Assingnment.
 String attribKeyString(AttributeAssingnment.AttribKey ak)
          Returns the Ox Representation for a given AttribKey Object.
 String attribKeyString(String ak)
          Returns the Ox Representation for a given Internal String Representation of an AttribKey.
 String convert2Internal(String in)
          Builds an internal Representation of a Function Description from the ox-like Representation.
 String convert2User(String in)
          Builds an ox-like Representation of a Function Description from the internal Representation.
 AttributeAssingnment.AttribKey getDestination()
          Returns the Destination AttribKey.
 String getFuncDesc()
          Returns this Assignments Function Code.
 int getSourceCount()
          Returns the Number of Sources this Assignment has.
 Object[] getSourceList()
          Returns all Sources of this Assignment as Array of Objects.
 Iterator getSources()
          Returns all Sources of this Assignment as Iterator.
 int getState()
          Returns this Assignments State.
 void removeSource(AttributeAssingnment.AttribKey ak)
          Removes the given AttribKey from this Assingnments list of Sources.
 void removeSource(Production.ListElement sourcele, Attribute sourceAttr)
          Removes the AttribKey with the given ListElement and Attribute from this Assingnments list of Sources.
 Iterator setFuncDesc(String functioncode)
          Gives the AttributeAssingnment a new Function Description.
 StringBuffer toOx(StringBuffer sb)
          Support for Ox File generation.
 StringBuffer toOx(StringBuffer sb, int indent)
          Support for Ox File generation.
 String toString()
           
 Object[] uses(Symbol s, Attribute a)
          Returns all AttribKeys of this Assignment built from the given Symbol and Attribute (all AttribKeys depending on the existence of the given Symbol and Attribute).
 void validateObject()
          This Method is needed for proper Serialisation of AttributeAssingnments.It's called at the Java Serialisation Process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPBegin

public static final String SEPBegin

SEPEnd

public static final String SEPEnd

NO_ASSIGNMENT

public static final int NO_ASSIGNMENT

INVALID_ASSIGNMENT

public static final int INVALID_ASSIGNMENT

VALID_ASSIGNMENT

public static final int VALID_ASSIGNMENT
Constructor Detail

AttributeAssingnment

public AttributeAssingnment(Production belongsTo,
                            Production.ListElement le,
                            Attribute anAttribute)
Creates a new AttributeAssingnment for the given Production with the given ListElement and Attribute as Destination.
Method Detail

validateObject

public void validateObject()
This Method is needed for proper Serialisation of AttributeAssingnments.It's called at the Java Serialisation Process. Do not use it.
Specified by:
validateObject in interface ObjectInputValidation

addSource

public void addSource(Production.ListElement le,
                      Attribute anAttribute)
               throws AssignLoopException,
                      AssignException
Adds a new Source with the given ListElement and Attribute to this Assingnment.

removeSource

public void removeSource(AttributeAssingnment.AttribKey ak)
Removes the given AttribKey from this Assingnments list of Sources.

removeSource

public void removeSource(Production.ListElement sourcele,
                         Attribute sourceAttr)
Removes the AttribKey with the given ListElement and Attribute from this Assingnments list of Sources.

getSourceList

public Object[] getSourceList()
Returns all Sources of this Assignment as Array of Objects.
Returns:
returns all Sources of this Assignment as Array of Objects

getSources

public Iterator getSources()
Returns all Sources of this Assignment as Iterator.
Returns:
returns all Sources of this Assignment as Iterator

getSourceCount

public int getSourceCount()
Returns the Number of Sources this Assignment has.
Returns:
returns the Number of Sources this Assignment has

getDestination

public AttributeAssingnment.AttribKey getDestination()
Returns the Destination AttribKey.
Returns:
returns the Destination AttribKey

setFuncDesc

public Iterator setFuncDesc(String functioncode)
Gives the AttributeAssingnment a new Function Description. This Method performs some checks on the given functioncode. It checks if the new description contains all AttribKeys of the assignment. All missing Keys are returned as Iterator. If everything goes well the State of the Assingnment is set to VALID_ASSIGNMENT - otherwise to INVALID_ASSIGNMENT.

getFuncDesc

public String getFuncDesc()
Returns this Assignments Function Code.
Returns:
returns this Assignments Function Code

getState

public int getState()
Returns this Assignments State.
Returns:
returns this Assignments State. Possible values are VALID_ASSIGNMENT, INVALID_ASSIGNMENT or NO_ASSIGNMENT.

toString

public String toString()
Overrides:
toString in class Object

toOx

public StringBuffer toOx(StringBuffer sb)
Support for Ox File generation.

toOx

public StringBuffer toOx(StringBuffer sb,
                         int indent)
Support for Ox File generation.

attribKeyString

public String attribKeyString(String ak)
Returns the Ox Representation for a given Internal String Representation of an AttribKey.

attribKeyString

public String attribKeyString(AttributeAssingnment.AttribKey ak)
Returns the Ox Representation for a given AttribKey Object.

uses

public Object[] uses(Symbol s,
                     Attribute a)
Returns all AttribKeys of this Assignment built from the given Symbol and Attribute (all AttribKeys depending on the existence of the given Symbol and Attribute).

convert2Internal

public String convert2Internal(String in)
                        throws ModelException
Builds an internal Representation of a Function Description from the ox-like Representation.

convert2User

public String convert2User(String in)
Builds an ox-like Representation of a Function Description from the internal Representation.