step.typedef
Class Attribute

java.lang.Object
  |
  +--step.typedef.Attribute
All Implemented Interfaces:
StepDef

public class Attribute
extends Object
implements StepDef

Abstraction of a STEP attribute.

Attribute values may contain arbitrary string values, however, the generally contain a comma separated list of items. Each attribute is assigned to a particular group, which indicates its applicability.


Constructor Summary
Attribute(String group, String value)
          Create a new attribute for the given group, with the given value.
 
Method Summary
 boolean equals(Object o)
          Compare this attribute to another for equality.
 String getGroup()
          Get the group for this attribute.
 String getValue()
          Get the value of this attribute.
 int hashCode()
          Get the hash code for this attribute.
static List merge(List lowList, List highList)
          Combine two attribute lists, based on priority.
 String toStepDL()
          Get this attribute as STEP-DL text.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Attribute

public Attribute(String group,
                 String value)
Create a new attribute for the given group, with the given value.

Method Detail

getGroup

public String getGroup()
Get the group for this attribute.


getValue

public String getValue()
Get the value of this attribute.


toStepDL

public String toStepDL()
Get this attribute as STEP-DL text.

Specified by:
toStepDL in interface StepDef

equals

public boolean equals(Object o)
Compare this attribute to another for equality.

Overrides:
equals in class Object

hashCode

public int hashCode()
Get the hash code for this attribute.

Overrides:
hashCode in class Object

merge

public static List merge(List lowList,
                         List highList)
Combine two attribute lists, based on priority.

Algorithm:

 while low[i] == high[i]
   add low[i]

 add remaining low

 add remaining high
 

This algorithm follows the general property that items in an attribute list are processed from first (lowest priority) to last (highest priority).

Parameters:
lowList - the list of lower priority attributes
highList - the list of higher priority attributes
Returns:
a new list that is the "merge" of the two input lists.