Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jdaemon.util
Class AttributeList  view AttributeList download AttributeList.java

java.lang.Object
  extended byorg.jdaemon.util.AttributeList

public class AttributeList
extends java.lang.Object

Simple class for dynamically created list of Name/Value pairs. This class is optimised for fast creation rather than fast searches; Currently implemented using QuickList. However note that, like QuickList, adding an entry to an AttributeList does not change the original list, but rather returns a new list which has the additional element added.

Version:
0.1

Nested Class Summary
static class AttributeList.Entry
          Class for an entry in an AttributeList; Basically just a name/value pair
 
Field Summary
private  QuickList attributes
          Underlying store of Entry objects
static AttributeList EMPTY
           
protected static java.util.Comparator NAME_COMPARATOR
          Comparator for Entry objects that works on the name part only
 
Constructor Summary
private AttributeList()
           
protected AttributeList(QuickList attributes)
          Protected constructor that allows an AttributeList to be created from a QuickList of Entry objects.
 
Method Summary
 AttributeList addAttribute(java.lang.String name, java.lang.Object value)
          Add an attribute (name,value) pair to an existing attribute list.
 java.lang.Object get(java.lang.String name)
          Find a value for a given name in this attribute list.
 AttributeList.Entry head()
          get topmost (last added) entry in attribute list.
 boolean isEmpty()
           
 AttributeList tail()
          Get this attribute list less the topmost entry.
 java.lang.String toString()
          Convert this list to a string.
protected static void ValidateName(java.lang.String name)
          Utility function - checks that name is a valid name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_COMPARATOR

protected static final java.util.Comparator NAME_COMPARATOR
Comparator for Entry objects that works on the name part only


EMPTY

public static final AttributeList EMPTY

attributes

private QuickList attributes
Underlying store of Entry objects

Constructor Detail

AttributeList

protected AttributeList(QuickList attributes)
Protected constructor that allows an AttributeList to be created from a QuickList of Entry objects. *


AttributeList

private AttributeList()
Method Detail

ValidateName

protected static void ValidateName(java.lang.String name)
Utility function - checks that name is a valid name


addAttribute

public AttributeList addAttribute(java.lang.String name,
                                  java.lang.Object value)
Add an attribute (name,value) pair to an existing attribute list.


get

public java.lang.Object get(java.lang.String name)
Find a value for a given name in this attribute list.


toString

public java.lang.String toString()
Convert this list to a string.


head

public AttributeList.Entry head()
get topmost (last added) entry in attribute list.


tail

public AttributeList tail()
Get this attribute list less the topmost entry.


isEmpty

public boolean isEmpty()