com.xinapse.util
Class InfoList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<com.xinapse.util.InfoItem>
              extended by com.xinapse.util.InfoList
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<com.xinapse.util.InfoItem>, java.util.Collection<com.xinapse.util.InfoItem>, java.util.List<com.xinapse.util.InfoItem>, java.util.RandomAccess

public class InfoList
extends java.util.ArrayList<com.xinapse.util.InfoItem>

Representation of a list of information to be associated either with an image as a whole, or with a particular element of a particular dimension of an image.

For example, a 3-D multi-slice image may have different information for each slice. Thus, the information will be different for each element (slice) of dimension 0.

Always use the appropriate methods in the image class to retrieve and manipulate the info fields for an image.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
InfoList()
          Construct an empty InfoList.
InfoList(java.io.DataInputStream s)
          Creates a InfoList Object by reading it from a DataInputStream.
InfoList(java.lang.String HTMLList)
          Creates an InfoList from an HTML description of that list.
 
Method Summary
 void append(InfoList extraInfo)
          Sticks an InfoList onto the end of an existing one.
 java.lang.Object clone()
          Makes a copy of this InfoList.
 java.lang.String getInfo(java.lang.String name)
          An InfoList is a list of Strings of the form "name=value".
 void putInfo(java.lang.String name, java.util.Date date)
          Adds "name=value" to the InfoList.
 void putInfo(java.lang.String name, double value)
          Adds "name=value" to the InfoList.
 void putInfo(java.lang.String name, float value)
          Adds "name=value" to the InfoList.
 void putInfo(java.lang.String name, int value)
          Adds "name=value" to the InfoList.
 void putInfo(java.lang.String name, long value)
          Adds "name=value" to the InfoList.
 void putInfo(java.lang.String name, java.lang.String value)
          Adds "name=value" to the InfoList.
 void removeInfo(java.lang.String name)
          Removes "name=value" from the InfoList.
static InfoList sortInfo(InfoList[] sliceInfo)
          Sort info from each slice into general and slice-specific info.
 java.lang.String toHTML()
          Creates a description of this InfoList in HTML format.
 java.lang.String toString()
          Creates a description of this InfoList.
 void write(java.io.DataOutputStream s)
          Write an InfoList to a DataOutPutStream.
 void write(java.io.RandomAccessFile f)
          Write an InfoList to a RandomAccessFile.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

InfoList

public InfoList()
Construct an empty InfoList.


InfoList

public InfoList(java.io.DataInputStream s)
         throws java.io.IOException
Creates a InfoList Object by reading it from a DataInputStream.

Parameters:
s - the DataInputStream that will supply the InfoList.
Throws:
java.io.IOException - if the InfoList cannot be read completely from the stream.

InfoList

public InfoList(java.lang.String HTMLList)
         throws com.xinapse.util.InfoListException
Creates an InfoList from an HTML description of that list. The HTML description will its self have been returned by InfoList.toHTML().

Parameters:
HTMLList - a String of HTML that was its self created by InfoList.toHTML().
Throws:
com.xinapse.util.InfoListException
Method Detail

write

public void write(java.io.DataOutputStream s)
           throws java.io.IOException
Write an InfoList to a DataOutPutStream.

Parameters:
s - the DataOutputStream to which the InfoList will be written.
Throws:
java.io.IOException

write

public void write(java.io.RandomAccessFile f)
           throws java.io.IOException
Write an InfoList to a RandomAccessFile. The file pointer must be positioned at the right point in the file before this call.

Parameters:
f - the RandomAccessFile to which the InfoList will be written.
Throws:
java.io.IOException

getInfo

public java.lang.String getInfo(java.lang.String name)
                         throws InfoNotFoundException
An InfoList is a list of Strings of the form "name=value". This method returns the value for a given name.

Parameters:
name - the name of the information item.
Returns:
the value of the information item.
Throws:
InfoNotFoundException - if the name is null, or the information item cannot be found.

putInfo

public void putInfo(java.lang.String name,
                    java.lang.String value)
Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If either name or value is null, then this method does nothing.

Parameters:
name - the name of the information item.
value - the value of the information item.

putInfo

public void putInfo(java.lang.String name,
                    int value)
Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.

Parameters:
name - the name of the information item.
value - the value of the information item.

putInfo

public void putInfo(java.lang.String name,
                    long value)
Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.

Parameters:
name - the name of the information item.
value - the value of the information item.

putInfo

public void putInfo(java.lang.String name,
                    float value)
Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.

Parameters:
name - the name of the information item.
value - the value of the information item.

putInfo

public void putInfo(java.lang.String name,
                    double value)
Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.

Parameters:
name - the name of the information item.
value - the value of the information item.

putInfo

public void putInfo(java.lang.String name,
                    java.util.Date date)
Adds "name=value" to the InfoList. Replaces the existing value if the name is already present. If name is null, this method does nothing.

Parameters:
name - the name of the information item.
date - the value of the information item.

removeInfo

public void removeInfo(java.lang.String name)
Removes "name=value" from the InfoList.

Parameters:
name - the name of the information item to remove.

append

public void append(InfoList extraInfo)
Sticks an InfoList onto the end of an existing one.

Parameters:
extraInfo - the InfoList of extra information items to append.

toString

public java.lang.String toString()
Creates a description of this InfoList.

Overrides:
toString in class java.util.AbstractCollection<com.xinapse.util.InfoItem>
Returns:
a String description of this InfoList.

toHTML

public java.lang.String toHTML()
Creates a description of this InfoList in HTML format.

Returns:
a String description of this InfoList in HTML format.

sortInfo

public static InfoList sortInfo(InfoList[] sliceInfo)
Sort info from each slice into general and slice-specific info.

Parameters:
sliceInfo - an array of InfoLists that contain all the information items for each of the image slices. On return, all the information items that are common to all images slices will have been removed from these InfoLists.
Returns:
an InfoList that contains all the information items that are common to all the elements in the sliceInfo array.

clone

public java.lang.Object clone()
Makes a copy of this InfoList.

Overrides:
clone in class java.util.ArrayList<com.xinapse.util.InfoItem>
Returns:
a copy of this InfoList cast to Object.


Copyright 2006-2008 Xinapse Systems Limited. All Rights Reserved.