ilog.views.maps.attribute
Class IlvAttributeArray

java.lang.Object
  extended by ilog.views.maps.IlvFeatureAttribute
      extended by ilog.views.maps.attribute.IlvAttributeArray
All Implemented Interfaces:
IlvPersistentObject

public class IlvAttributeArray
extends IlvFeatureAttribute

This feature attribute is itself an array of feature attributes.

Since:
ILOG JViews 3.0

Constructor Summary
IlvAttributeArray()
          Creates an instance of IlvAttributeArray.
IlvAttributeArray(IlvAttributeArray source)
          Copies this feature attribute and the attribute values.
IlvAttributeArray(IlvInputStream stream)
          Reads an IlvAttributeArray from an IlvInputStream.
 
Method Summary
 IlvFeatureAttribute copy()
          Returns a copy of the object.
 IlvFeatureAttribute getAttribute(int i)
          Returns the attribute of the specified index.
 Class getCommonClass()
          Returns the current class of element stored in this array.
 int getSize()
          Returns the number of elements of this array
 void removeAll()
          Empties the array.
 void setAttribute(int i, IlvFeatureAttribute attribute)
          Sets the attribute of the specified index.
 void setCommonClass(Class commonClass)
          Sets the common class for the attributes of this attribute array.
 void setSize(int newSize)
          Sets the size of this array.
 String toString()
          Converts the attribute array into a string.
 void unsafeSetAttribute(int i, IlvFeatureAttribute attribute)
          Sets the value of the attribute specified by the index i to value, without checking.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvAttributeArray

public IlvAttributeArray()
Creates an instance of IlvAttributeArray.


IlvAttributeArray

public IlvAttributeArray(IlvInputStream stream)
                  throws IlvReadFileException
Reads an IlvAttributeArray from an IlvInputStream.

Parameters:
stream - the input stream.
Throws:
IlvReadFileException - if the format is not correct.

IlvAttributeArray

public IlvAttributeArray(IlvAttributeArray source)
Copies this feature attribute and the attribute values.

Parameters:
source - the object to be copied.
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvFeatureAttribute
Parameters:
stream - the output stream.
Throws:
IOException - if an error occurs.

getAttribute

public IlvFeatureAttribute getAttribute(int i)
Returns the attribute of the specified index.

Parameters:
i - the index.
Throws:
ArrayIndexOutOfBoundsException - if an invalid index was given.

setAttribute

public void setAttribute(int i,
                         IlvFeatureAttribute attribute)
Sets the attribute of the specified index.

Parameters:
i - the index.
attribute - the attribute to set.
Throws:
ArrayIndexOutOfBoundsException - if an invalid index was given.
IllegalArgumentException - if the attribute is not assignable to the common class.
See Also:
setCommonClass(java.lang.Class)

unsafeSetAttribute

public void unsafeSetAttribute(int i,
                               IlvFeatureAttribute attribute)
Sets the value of the attribute specified by the index i to value, without checking. This method must be used with care. If the class of the attribute can't be assigned to the common class of this array, the class will be left in an inconsistent state.

Parameters:
i - the index of the attribute to be set.
attribute - the value to which the specified attribute will be set.
Throws:
ArrayIndexOutOfBoundsException - if an invalid index was given.

getCommonClass

public Class getCommonClass()
Returns the current class of element stored in this array.

Returns:
the class of this array.

setCommonClass

public void setCommonClass(Class commonClass)
Sets the common class for the attributes of this attribute array. By default, the common class is IlvFeatureAttribute, intended for any type of data. Providing a precise common class determines for the application the type of the attribute array.

Parameters:
commonClass - the common class.
Throws:
IllegalArgumentException - if the array contains attributes that are not assignable to the specified class.

getSize

public int getSize()
Returns the number of elements of this array


setSize

public void setSize(int newSize)
Sets the size of this array. If the new size is greater than the current size, new null items are added to the end of the array. If the new size is less than the current size, all components at index newSize and greater are just ignored.

Parameters:
newSize - the new size of this array.

removeAll

public void removeAll()
Empties the array.


toString

public String toString()
Converts the attribute array into a string.

Overrides:
toString in class Object

copy

public IlvFeatureAttribute copy()
Returns a copy of the object.

Specified by:
copy in class IlvFeatureAttribute
Returns:
a copy of this IlvFeatureAttribute.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.