LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.data
Class LyValueSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<LyValue>
              extended by leon.data.LyValueSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<LyValue>, java.util.Collection<LyValue>, java.util.List<LyValue>, java.util.RandomAccess

public class LyValueSet
extends java.util.Vector<LyValue>

This class is used to hold a list of values (LyValue).

It allows to give a list of 'values' when creating or modifying an object, or to get a list of values from an object.

See Also:
LyValue, Serialized Form

Field Summary
static java.lang.String __VERSION
          File version
 
Constructor Summary
LyValueSet()
          Constructs an empty values set.
LyValueSet(boolean checkFields)
          Constructs an empty values set.
LyValueSet(LyClass valuesClass)
          Constructs a value set for a given class.
LyValueSet(LyValueSet values)
          Constructs a values set from an existing one.
 
Method Summary
 void addValue(LyField field, java.lang.Object value)
          Adds a new pair (field, value) in the values set.
 void addValue(LyValue value)
          Adds a new field value in the set.
 void addValues(LyValueSet values)
          Adds a set of values in this set.
 boolean contains(LyField field)
          Checks if a field value corresponding to the given field is present in this values set.
 boolean contains(LyFieldInfo fieldInfo, boolean allowAccessByType)
          Checks if a field value corresponding to the given field is present in this values set.
 void enableCheckField()
          Enable the check state during the addition of values
 LyApplication getApplication()
          Retrieves application of the class info of this object.
 LyValue getFieldValue(int index)
          Retrieves a field value (LyValue) in this values set at the given index.
 LyValue getFieldValue(LyField field)
          Retrieves a field value (LyValue) in this values set for a given field.
 LyValue getFieldValue(LyFieldInfo fieldInfo, boolean allowAccessByType)
          Retrieves a field value (LyValue) in this values set for a given field.
 LyValue getFieldValue(java.lang.String id)
          Retrieves a field value (LyValue) in this values set for a given field.
 java.util.Map<LyField,LyValue> getMap()
          Gets a map containing pairs of (field, value) of this values set.
 int getSize()
          Gets the number of field values in the values set.
 boolean hasMark(int mark)
          Checks if the value set contains at least one field value corresponding to the given field info that has the specified mark.
 boolean hasMarks(java.util.BitSet marks, boolean matchAll)
          Checks if the value set contains at least one field value corresponding to the given field info that has the specified marks.
 LyValue removeValue(LyField field)
          Removes the first field value corresponding to a given field from the set.
 java.lang.String toString()
          Dumps content of this value set in a string.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version

See Also:
Constant Field Values
Constructor Detail

LyValueSet

public LyValueSet()
Constructs an empty values set.


LyValueSet

public LyValueSet(boolean checkFields)
Constructs an empty values set.

Parameters:
checkFields - value of the checkfield properties

LyValueSet

public LyValueSet(LyClass valuesClass)
Constructs a value set for a given class.

Parameters:
valuesClass - a LyClass

LyValueSet

public LyValueSet(LyValueSet values)
Constructs a values set from an existing one.

Parameters:
values - a list of values
Method Detail

getFieldValue

public LyValue getFieldValue(LyField field)
Retrieves a field value (LyValue) in this values set for a given field.

Parameters:
field - Field for which a field value in searched in this values set.
Returns:
The field value corresponding to the given field if it's found, null otherwise.

getFieldValue

public LyValue getFieldValue(LyFieldInfo fieldInfo,
                             boolean allowAccessByType)
Retrieves a field value (LyValue) in this values set for a given field.

Parameters:
fieldInfo - Field info for which a field value in searched in this values set.
allowAccessByType - Allow access by type. If true, value may be retrieved from a template field of given field info.
Returns:
The field value corresponding to the given field if it's found, null otherwise.

getFieldValue

public LyValue getFieldValue(java.lang.String id)
Retrieves a field value (LyValue) in this values set for a given field.

Parameters:
id - Field id for which a field value in searched in this values set.
Returns:
The field value corresponding to the given field if it's found, null otherwise.

getFieldValue

public LyValue getFieldValue(int index)
Retrieves a field value (LyValue) in this values set at the given index.

Parameters:
index - Index of the searched field value.
Returns:
Field value at the specified index.
Throws:
java.lang.ArrayIndexOutOfBoundsException - If the given index is negative.
java.lang.ArrayIndexOutOfBoundsException - If the given index is greater or equals to the number of values of the set.

getSize

public int getSize()
Gets the number of field values in the values set.

Returns:
Number of field values.

addValue

public void addValue(LyValue value)
Adds a new field value in the set. If a field value with the same field already exists in this values set the value of this field value is overriden with the given value. Otherwise, a new field value is built (using buildFieldValue method of LyField) and added to the values set.

Parameters:
value - Field value to add to this values set.

addValue

public void addValue(LyField field,
                     java.lang.Object value)
Adds a new pair (field, value) in the values set.

Parameters:
field - Field for which a field value is added.
value - Value assigned to the given field.

addValues

public void addValues(LyValueSet values)
Adds a set of values in this set.

Parameters:
values - Set of values added in this set.

removeValue

public LyValue removeValue(LyField field)
Removes the first field value corresponding to a given field from the set.

Parameters:
field - Field for which a field value has to be removed.
Returns:
The removed field value if one corresponding to the given field was found, null otherwise.

contains

public boolean contains(LyField field)
Checks if a field value corresponding to the given field is present in this values set.

Parameters:
field - Field for which an existing field value is searched.
Returns:
True if a field value for the given field was found, false otherwise.

contains

public boolean contains(LyFieldInfo fieldInfo,
                        boolean allowAccessByType)
Checks if a field value corresponding to the given field is present in this values set.

Parameters:
fieldInfo - Field for which an existing field value is searched.
allowAccessByType - Allow access by type.
Returns:
True if a field value for the given field was found, false otherwise.

hasMark

public boolean hasMark(int mark)
Checks if the value set contains at least one field value corresponding to the given field info that has the specified mark. This method does only make sense if the values set contains logical values (LyFieldInfoValue).

Parameters:
mark - Searched mark.
Returns:
True if a field value was found, false otherwise.

hasMarks

public boolean hasMarks(java.util.BitSet marks,
                        boolean matchAll)
Checks if the value set contains at least one field value corresponding to the given field info that has the specified marks. This method does only make sense if the values set contains logical values (LyFieldInfoValue).

Parameters:
marks - Searched marks.
matchAll - Specifies if this instance have to match all specified marks or only one.
Returns:
True if a field value was found, false otherwise.

toString

public java.lang.String toString()
Dumps content of this value set in a string.

Overrides:
toString in class java.util.Vector<LyValue>
Returns:
a string

getMap

public java.util.Map<LyField,LyValue> getMap()
Gets a map containing pairs of (field, value) of this values set.

Returns:
a map

enableCheckField

public void enableCheckField()
Enable the check state during the addition of values


getApplication

public final LyApplication getApplication()
Retrieves application of the class info of this object.

Returns:
Application of the class info of this object.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com