JBoss Managed Parent POM 2.1.1.SP2

org.jboss.metatype.api.values
Class TableValueSupport

java.lang.Object
  extended by org.jboss.metatype.api.values.AbstractMetaValue
      extended by org.jboss.metatype.api.values.TableValueSupport
All Implemented Interfaces:
Serializable, Cloneable, MetaValue, TableValue

public class TableValueSupport
extends AbstractMetaValue
implements TableValue

TableValueSupport.

Version:
$Revision: 1.1 $
Author:
Adrian Brock
See Also:
Serialized Form

Constructor Summary
TableValueSupport(TableMetaType tableType)
          Construct Table Value with an initial capacity of 101 and a load factor of 0.75
TableValueSupport(TableMetaType tableType, int initialCapacity, float loadFactor)
          Construct Table value
 
Method Summary
 MetaValue[] calculateIndex(CompositeValue value)
          Calculate the index for the value passed if it were added to the table value.
 void clear()
          Removes all CompositeValues from the Table value
 TableValueSupport clone()
          Clone the meta value
 boolean containsKey(MetaValue[] key)
          Determine whether the table value contains the passed value as a row.
 boolean containsValue(CompositeValue value)
          Determine whether the table value contains the passed value.
 boolean equals(Object obj)
           
 CompositeValue get(MetaValue[] key)
          Retrieve the composite value for the passed index.
 TableMetaType getMetaType()
          Get the metatype for this value
 int hashCode()
           
 boolean isEmpty()
          Determine whether the table value is empty.
 Set<List<MetaValue>> keySet()
          Returns a set view of the index values.
 void put(CompositeValue value)
          Add a value to the table value.
 void putAll(CompositeValue[] values)
          Add all the passed values.
 CompositeValue remove(MetaValue[] key)
          Removes the value for the passed and returns the removed value, or null if the key was not present.
 int size()
          Retrieve the number of rows in the table value.
 String toString()
           
 Collection<CompositeValue> values()
          Returns a set view of the row values.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableValueSupport

public TableValueSupport(TableMetaType tableType)
Construct Table Value with an initial capacity of 101 and a load factor of 0.75

Parameters:
tableType - the table type of the data
Throws:
IllegalArgumentException - for a null argument

TableValueSupport

public TableValueSupport(TableMetaType tableType,
                         int initialCapacity,
                         float loadFactor)
Construct Table value

Parameters:
tableType - the table type
initialCapacity - the initial capacity of the map
loadFactor - the load factory of the map
Throws:
IllegalArgumentException - for a null argument
Method Detail

getMetaType

public TableMetaType getMetaType()
Description copied from interface: MetaValue
Get the metatype for this value

Specified by:
getMetaType in interface MetaValue
Specified by:
getMetaType in interface TableValue
Returns:
the metatype

calculateIndex

public MetaValue[] calculateIndex(CompositeValue value)
Description copied from interface: TableValue
Calculate the index for the value passed if it were added to the table value. The validity of the passed value is checked. But the table value isn't checked to see whether the index is already used.

Specified by:
calculateIndex in interface TableValue
Parameters:
value - the value for which the index is calculated.
Returns:
the calculated index

clear

public void clear()
Description copied from interface: TableValue
Removes all CompositeValues from the Table value

Specified by:
clear in interface TableValue

containsKey

public boolean containsKey(MetaValue[] key)
Description copied from interface: TableValue
Determine whether the table value contains the passed value as a row. If the passed value is null or invalid, false is returned.

Specified by:
containsKey in interface TableValue
Parameters:
key - the value to check
Returns:
true when the value is a row index, false otherwise

containsValue

public boolean containsValue(CompositeValue value)
Description copied from interface: TableValue
Determine whether the table value contains the passed value. If the passed value is null or invalid, false is returned.

Specified by:
containsValue in interface TableValue
Parameters:
value - the value to check
Returns:
true when the value is a row index, false otherwise

get

public CompositeValue get(MetaValue[] key)
Description copied from interface: TableValue
Retrieve the composite value for the passed index.

Specified by:
get in interface TableValue
Parameters:
key - the index to retrieve
Returns:
the composite value

isEmpty

public boolean isEmpty()
Description copied from interface: TableValue
Determine whether the table value is empty.

Specified by:
isEmpty in interface TableValue
Returns:
true when there are no rows, false otherwise

keySet

public Set<List<MetaValue>> keySet()
Description copied from interface: TableValue
Returns a set view of the index values.

Specified by:
keySet in interface TableValue
Returns:
the set of index values.

put

public void put(CompositeValue value)
Description copied from interface: TableValue
Add a value to the table value. The value must have the same CompositeMetaType has the table value and there is no value already occupying the index for the value.

Specified by:
put in interface TableValue
Parameters:
value - the value to add

putAll

public void putAll(CompositeValue[] values)
Description copied from interface: TableValue
Add all the passed values. All the values are checked before addition including any duplicates that might be added. Either all or no value is added.

Specified by:
putAll in interface TableValue
Parameters:
values - the values to add

remove

public CompositeValue remove(MetaValue[] key)
Description copied from interface: TableValue
Removes the value for the passed and returns the removed value, or null if the key was not present.

Specified by:
remove in interface TableValue
Parameters:
key - the index of the value to remove
Returns:
the removed value

size

public int size()
Description copied from interface: TableValue
Retrieve the number of rows in the table value.

Specified by:
size in interface TableValue
Returns:
the number of rows.

values

public Collection<CompositeValue> values()
Description copied from interface: TableValue
Returns a set view of the row values.

Specified by:
values in interface TableValue
Returns:
the set of row values.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

clone

public TableValueSupport clone()
Description copied from interface: MetaValue
Clone the meta value

Specified by:
clone in interface MetaValue
Overrides:
clone in class AbstractMetaValue
Returns:
the cloned meta value

JBoss Managed Parent POM 2.1.1.SP2

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.