|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.beadsproject.beads.core.Bead
net.beadsproject.beads.data.DataBead
public class DataBead
A bead that stores properties as key/value pairs. Keys must be Strings, and values may be any Object. Implements the Map interface.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
properties
|
Constructor Summary | |
---|---|
DataBead()
Creates a DataBead instance with no defined properties. |
|
DataBead(java.util.Map<java.lang.String,java.lang.Object> ht)
Creates a DataBead instance that uses a Map (a Hashtable, for example) for its properties. |
|
DataBead(java.lang.Object... objects)
Creates a new DataBead from an interleaved series of key-value pairs, which must be in the form (String, Object, String, Object...), etc. |
|
DataBead(java.lang.String[] proparr,
java.lang.Object[] valarr)
Creates a DataBead instance with properties specified by a String array that are set to corresponding values specified by an Object array. |
|
DataBead(java.lang.String key,
java.lang.Object val)
Creates a DataBead with one property defined by the specified key and value. |
Method Summary | |
---|---|
void |
clear()
|
DataBead |
clone()
Returns a new DataBead with a shallow copy of the the original DataBead's properties. |
static DataBead |
combine(DataBead a,
DataBead b)
Creates a new DataBead that combines properties from both input DataBeads. |
void |
configureObject(java.lang.Object o)
Uses the parameters stored by this DataBead, this method configures the given object by using reflection to discover appropriate setter methods. |
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
float |
getFloat(java.lang.String key,
float defaultVal)
Gets a float representation of the specified property; returns the specified default value if that property doesn't exist or cannot be cast as a float. |
float[] |
getFloatArray(java.lang.String key)
Gets a float array from the value stored with the specified key. |
java.lang.Float |
getFloatObject(java.lang.String key)
Gets a Float representation of the specified property; returns null if that property doesn't exist or cannot be cast as a
Float. |
UGen |
getUGen(java.lang.String key)
Returns the UGen value for the specified key. |
UGen[] |
getUGenArray(java.lang.String key)
Gets an array of UGens from the value stored with the specified key. |
boolean |
isEmpty()
|
java.util.Set<java.lang.String> |
keySet()
|
void |
messageReceived(Bead message)
If the input message is a DataBead, this adds the properties from the message Bead to this one. |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
|
void |
putAll(DataBead db)
Adds the properties from the input DataBead to this one. |
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
|
void |
putAll(java.lang.Object... objects)
Adds an interleaved series of key-value pairs to the DataBead, which must be in the form (String, Object, String, Object...), etc. |
java.lang.Object |
remove(java.lang.Object key)
|
int |
size()
|
java.lang.String |
toString()
Returns a String specifying the Bead's class and it's name. |
java.util.Collection<java.lang.Object> |
values()
|
Methods inherited from class net.beadsproject.beads.core.Bead |
---|
getKillListener, getName, isDeleted, isPaused, kill, message, pause, setKillListener, setName, start |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Field Detail |
---|
public java.util.Map<java.lang.String,java.lang.Object> properties
Constructor Detail |
---|
public DataBead()
put()
.
public DataBead(java.lang.String key, java.lang.Object val)
put()
.
key
- The property name.val
- The property value.public DataBead(java.lang.String[] proparr, java.lang.Object[] valarr)
put()
.
proparr
- The array of property names.valarr
- The array of Object values.public DataBead(java.util.Map<java.lang.String,java.lang.Object> ht)
put()
.
ht
- The input Map.public DataBead(java.lang.Object... objects)
objects
- interleaved series of key-value pairs.Method Detail |
---|
public void messageReceived(Bead message)
putAll(DataBead)
.)
messageReceived
in class Bead
message
- the messagepublic void putAll(DataBead db)
db
- The input DataBead.public void putAll(java.lang.Object... objects)
objects
- an interleaved series of key-value pairs.public void configureObject(java.lang.Object o)
setX(float f)
then
the key-value pair Be aware that this may not work as expected with all objects. Use with care...
o
- the Object to configure.public float getFloat(java.lang.String key, float defaultVal)
This method is a useful way to update float
parameters in a
class:
float param = startval;
...
param = databead.getFloat("paramKey", param);
key
- The property key.defaultVal
- The value to return if the property does not contain a
float-convertible value.
public java.lang.Float getFloatObject(java.lang.String key)
null
if that property doesn't exist or cannot be cast as a
Float.
key
- The property key.
public UGen getUGen(java.lang.String key)
null
.
key
- The key.
public float[] getFloatArray(java.lang.String key)
float[]
, the method returns
that object. In the event that the stored value is an array of numbers of
some other type, the method will return a new float array filled with
values converted to float; an array of doubles, for instance, will be
recast as floats. Single numbers will be returned as a one-element float
array. If no array can be formed from the stored value, or if there is no
stored value, the method returns null
.
key
- The key.
public UGen[] getUGenArray(java.lang.String key)
null
.
key
- The key.
public DataBead clone()
clone
in class java.lang.Object
public static DataBead combine(DataBead a, DataBead b)
a
- The first input DataBead.b
- The second input DataBead.
public java.lang.String toString()
Bead
toString
in class Bead
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object put(java.lang.String key, java.lang.Object value)
put
in interface java.util.Map<java.lang.String,java.lang.Object>
public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
putAll
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,java.lang.Object>
public int size()
size
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Collection<java.lang.Object> values()
values
in interface java.util.Map<java.lang.String,java.lang.Object>
public void clear()
clear
in interface java.util.Map<java.lang.String,java.lang.Object>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |