jimmc.util
Class Items

java.lang.Object
  |
  +--jimmc.util.Items

public class Items
extends java.lang.Object

An order list of named items.


Field Summary
protected  java.util.Vector items
          Our list of Item objects.
 
Constructor Summary
Items()
          Create an empty Items list.
 
Method Summary
 void addItem(Item item)
          Add an item to our list.
 void addItem(java.lang.String name, java.lang.Object value)
          Add an item to our list.
 Item getItem(int n)
          Get the Nth item.
 Item getItem(java.lang.String name)
          Get the named item, or null of no item of that name.
 java.lang.String getName(int n)
          Get the name of the Nth item.
 java.lang.String[] getNames()
          Get all names.
 java.lang.Object getValue(int n)
          Get the value of the Nth item.
 java.lang.Object getValue(java.lang.String name)
          Get the value of the named item, or null if not found.
static Items parseItems(java.lang.String s)
          Parse a string such as produced by toString() into an Items object.
 void setValue(int n, java.lang.Object value)
          Set the value of the Nth item.
 void setValue(java.lang.String name, java.lang.Object value)
          Set the value of the named item, or add it if not found.
 void setValues(Items items)
          Set the values of all items by name that we find in the given items.
 int size()
          Get the number of items in our list.
 java.lang.String toString()
          Generate a string such as {name1=value1,name2=value2}
 void toString(java.lang.StringBuffer sb, java.lang.String sep)
          Convert to a string using the specified separator.
 java.lang.String toStringNoBraces()
          Generate a string like toString, but without the enclosing braces.
 void toStringNoBraces(java.lang.StringBuffer sb)
          Convert to a string without the enclosing braces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

items

protected java.util.Vector items
Our list of Item objects.
Constructor Detail

Items

public Items()
Create an empty Items list.
Method Detail

addItem

public void addItem(Item item)
Add an item to our list.
Parameters:
item - The item to add to our list. We just put a pointer to this item into our list, we do not make a copy.

addItem

public void addItem(java.lang.String name,
                    java.lang.Object value)
Add an item to our list.
Parameters:
name - The name of the item.
value - The value of the item. We put a pointer to this value in the Item, but do not make a copy of the value.

size

public int size()
Get the number of items in our list.

setValues

public void setValues(Items items)
Set the values of all items by name that we find in the given items.

setValue

public void setValue(int n,
                     java.lang.Object value)
Set the value of the Nth item.

setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
Set the value of the named item, or add it if not found.

getItem

public Item getItem(int n)
Get the Nth item.

getItem

public Item getItem(java.lang.String name)
Get the named item, or null of no item of that name.

getNames

public java.lang.String[] getNames()
Get all names.

getName

public java.lang.String getName(int n)
Get the name of the Nth item.

getValue

public java.lang.Object getValue(int n)
Get the value of the Nth item.

getValue

public java.lang.Object getValue(java.lang.String name)
Get the value of the named item, or null if not found.

toString

public java.lang.String toString()
Generate a string such as {name1=value1,name2=value2}
Overrides:
toString in class java.lang.Object

toStringNoBraces

public java.lang.String toStringNoBraces()
Generate a string like toString, but without the enclosing braces.

toStringNoBraces

public void toStringNoBraces(java.lang.StringBuffer sb)
Convert to a string without the enclosing braces.

toString

public void toString(java.lang.StringBuffer sb,
                     java.lang.String sep)
Convert to a string using the specified separator. No braces.

parseItems

public static Items parseItems(java.lang.String s)
Parse a string such as produced by toString() into an Items object.