com.sas.util.selectors
Class ArraySelector

java.lang.Object
  |
  +--com.sas.Component
        |
        +--com.sas.util.selectors.BaseSelector
              |
              +--com.sas.util.selectors.IntegerIndexedSelector
                    |
                    +--com.sas.util.selectors.ArraySelector
All Implemented Interfaces:
ComponentInterface, ContentsChangedListener, LinkPropertiesInterface, ModelInterface, MultipleValueEventSourceInterface, com.sas.beans.PropertyChangeSource, SelectorInterface, VetoableChangeSource, ViewInterface

public class ArraySelector
extends com.sas.util.selectors.IntegerIndexedSelector

A selector for array collections and integer valued keys. An ArraySelector selects the indexed value array[integerKey] from an array array. The key must be an integer. The selected item is array[integerKey()]. If the array type is a primitive type, the value property is a java.lang wrapper, such as Integer

See Also:
Serialized Form

Field Summary
static String RB_KEY
           
 
Fields inherited from class com.sas.util.selectors.BaseSelector
lastKey, lastValue
 
Constructor Summary
ArraySelector()
          default constructor
ArraySelector(Object array, Object key)
          Construct an ArraySelector for an array and integer key.
 
Method Summary
static int computeIntegerKey(Object key)
          Convert a key/value into an integer.
static ExtendedBeanInfo getExtendedBeanInfo()
           
 Object getKey(Object value)
          Return the key that corresponds to a value
protected  Object getValue(int index)
          Get the value form the array collection, based on an integer index
 Object getValue(Object key)
          Return the value that corresponds to a key
protected  int keyAsInteger(Object object)
          Return the integer key for a value
 
Methods inherited from class com.sas.util.selectors.BaseSelector
contentsChanged, firePropertyChange, forgetKey, forgetValue, getCollection, getKey, getValue, isFound, listen, maybeFireKey, maybeFireValue, propertyChange, setCollection, setFound, setKey, setValue, unlisten, update
 
Methods inherited from class com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, clone, detachModel, detachView, dumpComponent, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getLinkInfo, getModelInterface, getRequiredInterfaces, getResources, getStringResource, getViewInterfaceSupportInfo, initialize, initializeComponent, isDesignTime, isLinked, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setDefaultValues, setLinkInfo, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RB_KEY

public static final String RB_KEY
Constructor Detail

ArraySelector

public ArraySelector()
default constructor

ArraySelector

public ArraySelector(Object array,
                     Object key)
Construct an ArraySelector for an array and integer key.
Parameters:
array - The array from which elements are selected
key - The key, which should be an Integer or some value from which an integer can be selected
Method Detail

getExtendedBeanInfo

public static ExtendedBeanInfo getExtendedBeanInfo()

getValue

protected Object getValue(int index)
Get the value form the array collection, based on an integer index
Overrides:
getValue in class com.sas.util.selectors.IntegerIndexedSelector
Parameters:
index - the index into the array
Returns:
the value at array[index]. For primitive types, the value is wrapped in the corresponding wrapper class from java.lang, such as Double

keyAsInteger

protected int keyAsInteger(Object object)
Return the integer key for a value
Overrides:
keyAsInteger in class com.sas.util.selectors.IntegerIndexedSelector
Parameters:
object - a value which resides in the array.
Returns:
The index at which the object is found,
Throws:
NoSuchElementException - if the object is not found in the array

getKey

public Object getKey(Object value)
Return the key that corresponds to a value
Overrides:
getKey in class BaseSelector
Following copied from class: com.sas.util.selectors.BaseSelector
Returns:
the selection key.

getValue

public Object getValue(Object key)
Return the value that corresponds to a key
Overrides:
getValue in class BaseSelector
Following copied from class: com.sas.util.selectors.BaseSelector
Parameters:
key - a key
Returns:
the selected item. This is functionally equivalent to getCollection().get(getKey())

computeIntegerKey

public static int computeIntegerKey(Object key)
Convert a key/value into an integer.
Parameters:
key - some value
Returns:
int the integer value of the key.
Throws:
IllegalArgumentException - if the key cannot be interpreted as an integer.




Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Thu, 16 Feb 2006 02:31:41