edu.umd.cs.jazz.util
Class ZNullList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--edu.umd.cs.jazz.util.ZListImpl
                    |
                    +--edu.umd.cs.jazz.util.ZNullList
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable, ZList, ZList.ZBoundsList, ZList.ZCameraList, ZList.ZLayerGroupList, ZList.ZNodeList, ZList.ZPropertyList, ZList.ZVisualComponentList

public class ZNullList
extends ZListImpl
implements ZList.ZPropertyList, ZList.ZNodeList, ZList.ZVisualComponentList, ZList.ZLayerGroupList, ZList.ZBoundsList, ZList.ZCameraList

This class provides a stand in for ZLists that have no elements. Instead of setting an empty ZList to null we set it to the static instance of ZNullList that is located in ZListImpl. Doing this enables us to avoid == null checks everytime we need to use a ZList.

Author:
Jesse Grosjean
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class edu.umd.cs.jazz.util.ZListImpl
ZListImpl.ZBoundsListImpl, ZListImpl.ZCameraListImpl, ZListImpl.ZLayerGroupListImpl, ZListImpl.ZNodeListImpl, ZListImpl.ZObjectListImpl, ZListImpl.ZPropertyListImpl, ZListImpl.ZSceneGraphObjectListImpl, ZListImpl.ZTransformableListImpl, ZListImpl.ZVisualComponentListImpl
 
Nested classes inherited from class edu.umd.cs.jazz.util.ZList
ZList.ZBoundsList, ZList.ZCameraList, ZList.ZLayerGroupList, ZList.ZNodeList, ZList.ZPropertyList, ZList.ZSceneGraphObjectList, ZList.ZTransformableList, ZList.ZVisualComponentList
 
Field Summary
 
Fields inherited from class edu.umd.cs.jazz.util.ZListImpl
NullList, size
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ZNullList()
           
 
Method Summary
 void clear()
           
 ZBounds collectiveBoundsReference(ZBounds bounds)
           
 boolean collectiveHasVolatileBounds()
           
 ZSceneGraphObject collectivePick(java.awt.geom.Rectangle2D rect, ZSceneGraphPath path)
           
 void collectiveRender(ZRenderContext renderContext, ZBounds visibleBounds)
           
 void collectiveRepaint(ZBounds bounds)
           
 java.lang.Object[] createElementData(int capacity)
           
 ZBounds[] getBoundsReference()
           
 ZCamera[] getCamerasReference()
           
 java.lang.Object[] getElementData()
           
 ZLayerGroup[] getLayersReference()
           
 java.lang.Object getMatchingProperty(java.lang.Object key)
           
 ZNode[] getNodesReference()
           
 ZProperty[] getPropertiesReference()
           
 ZVisualComponent[] getVisualComponentsReference()
           
 int indexOfPropertyWithKey(java.lang.Object key)
           
 boolean isNull()
           
 void setElementData(java.lang.Object[] data)
           
 int size()
           
 java.lang.Object[] toArray()
           
 void trimToSize()
           
 void writeObject(ZObjectOutputStream out)
           
 
Methods inherited from class edu.umd.cs.jazz.util.ZListImpl
add, add, addAll, addAll, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, moveElementToIndex, pop, pop, remove, removeRange, replaceWith, set, setSize, toArray, writeObject, writeObjectd
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.umd.cs.jazz.util.ZList
clone, moveElementToIndex, pop, pop, replaceWith, setSize, writeObject
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray
 

Constructor Detail

ZNullList

public ZNullList()
Method Detail

clear

public void clear()
Specified by:
clear in interface java.util.List
Overrides:
clear in class ZListImpl

collectiveBoundsReference

public ZBounds collectiveBoundsReference(ZBounds bounds)
Specified by:
collectiveBoundsReference in interface ZList.ZNodeList

collectiveHasVolatileBounds

public boolean collectiveHasVolatileBounds()
Specified by:
collectiveHasVolatileBounds in interface ZList.ZNodeList

collectivePick

public ZSceneGraphObject collectivePick(java.awt.geom.Rectangle2D rect,
                                        ZSceneGraphPath path)
Specified by:
collectivePick in interface ZList.ZNodeList

collectiveRender

public void collectiveRender(ZRenderContext renderContext,
                             ZBounds visibleBounds)
Specified by:
collectiveRender in interface ZList.ZNodeList

collectiveRepaint

public void collectiveRepaint(ZBounds bounds)
Specified by:
collectiveRepaint in interface ZList.ZNodeList

createElementData

public java.lang.Object[] createElementData(int capacity)
Specified by:
createElementData in class ZListImpl

getBoundsReference

public ZBounds[] getBoundsReference()
Specified by:
getBoundsReference in interface ZList.ZBoundsList

getElementData

public java.lang.Object[] getElementData()
Specified by:
getElementData in interface ZList
Specified by:
getElementData in class ZListImpl

getLayersReference

public ZLayerGroup[] getLayersReference()
Specified by:
getLayersReference in interface ZList.ZLayerGroupList

getMatchingProperty

public java.lang.Object getMatchingProperty(java.lang.Object key)
Specified by:
getMatchingProperty in interface ZList.ZPropertyList

getNodesReference

public ZNode[] getNodesReference()
Specified by:
getNodesReference in interface ZList.ZNodeList

getPropertiesReference

public ZProperty[] getPropertiesReference()
Specified by:
getPropertiesReference in interface ZList.ZPropertyList

getVisualComponentsReference

public ZVisualComponent[] getVisualComponentsReference()
Specified by:
getVisualComponentsReference in interface ZList.ZVisualComponentList

indexOfPropertyWithKey

public int indexOfPropertyWithKey(java.lang.Object key)
Specified by:
indexOfPropertyWithKey in interface ZList.ZPropertyList

isNull

public boolean isNull()
Specified by:
isNull in interface ZList
Overrides:
isNull in class ZListImpl

setElementData

public void setElementData(java.lang.Object[] data)
Specified by:
setElementData in class ZListImpl

size

public int size()
Specified by:
size in interface java.util.List
Overrides:
size in class ZListImpl

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.List
Overrides:
toArray in class ZListImpl

trimToSize

public void trimToSize()
Specified by:
trimToSize in interface ZList
Overrides:
trimToSize in class ZListImpl

writeObject

public void writeObject(ZObjectOutputStream out)
                 throws java.io.IOException
java.io.IOException

getCamerasReference

public ZCamera[] getCamerasReference()
Specified by:
getCamerasReference in interface ZList.ZCameraList


Copyright 2003 by University of Maryland, College Park, MD 20742, USA All rights reserved.