appilog.common.system.types.vectors
Class ObjectStateHolderVector

java.lang.Object
  extended by BaseVector
      extended by appilog.common.system.types.vectors.ObjectStateHolderVector
All Implemented Interfaces:
java.io.Serializable

public class ObjectStateHolderVector
extends BaseVector
implements java.io.Serializable

The ObjectStateHolderVector class implements a growable array of elements of type ObjectStateHolder.
In the Jython script, this class is used as the results format. Usually, all you have to do is to create an empty vector and add all the relevant objects to it. For example, Jython code returning a host conneced to an IP:

 
 // Init the CIs
 hostOSH =...
 ipOSH =...
 link =...
 
// Add them to the vector vec.add(hostOSH) vec.add(ipOSH) vec.add(link)
return vec

See Also:
ObjectStateHolder

Constructor Summary
ObjectStateHolderVector()
          Default constructor
ObjectStateHolderVector(Element element)
          Constructor
 
Method Summary
 void add(int index, ObjectStateHolder element)
          Inserts the specified element at the specified position in this vector.
 void add(ObjectStateHolder element)
          Appends the specified element to the end of this vector.
 void addAll(ObjectStateHolderVector elements)
          Appends a vector of elements to the end of this vector.
 boolean contains(java.lang.Object objectID)
           
 boolean contains(ObjectStateHolder element)
          Checks if the specified object is contained in this vector.
 java.lang.Object deepClone()
          Returns a clone of this vector.
 ObjectStateHolder get(int index)
          Returns the element at the specified position in this vector.
 CmdbObjectIds getCmdbObjectIds()
          Returns the vector of object IDs.
 CmdbIdsVector getIdVector()
          Returns the vector of object IDs.
 ObjectStateHolderVector getSubVector(int from, int to)
          Returns a vector comprising the elements in this vector between the specified indexes (inclusive).
 int indexOf(ObjectStateHolder element)
          Returns the position of the first occurence of the specified argument.
static ObjectStateHolderVector parseXml(byte[] xmlBuffer)
           
static ObjectStateHolderVector parseXml(java.io.InputStream xmlStream)
           
static ObjectStateHolderVector parseXml(java.io.InputStream xmlStream, boolean isZipped)
           
static ObjectStateHolderVector parseXml(java.lang.String xmlString)
           
static ObjectStateHolderVector parseXml(java.lang.String xmlString, boolean isZipped)
           
 ObjectStateHolder remove(int index)
          Removes the element at the specified position in this vector.
 boolean remove(ObjectStateHolder element)
          Removes the first occurrence of the specified element in this vector.
 ObjectStateHolder set(int index, ObjectStateHolder element)
          Replaces the element at the specified position in this vector with the specified element.
 void sort(java.util.Comparator comparator)
          Sorts the specified vector according to the order defined by the specified comparator.
 void sort(java.lang.String attrName)
           
 void sort(StringVector attrs, boolean ascendent)
          Sorts the specified vector.
 ObjectStateHolderVector subList(int indexFrom, int indexTo)
           
 Element toXml()
           
 java.lang.String toXmlString()
           
 java.lang.String toXmlString(boolean withEncoding)
           
 java.lang.StringBuffer toXmlString(java.lang.StringBuffer xml, boolean withEncoding)
           
 byte[] toZip()
           
 byte[] toZipBySerialization()
           
 java.lang.String toZipString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectStateHolderVector

public ObjectStateHolderVector()
Default constructor


ObjectStateHolderVector

public ObjectStateHolderVector(Element element)
                        throws AppilogIllegalParameterException
Constructor

Throws:
AppilogIllegalParameterException
Method Detail

parseXml

public static ObjectStateHolderVector parseXml(java.io.InputStream xmlStream,
                                               boolean isZipped)
                                        throws AppilogIllegalParameterException
Throws:
AppilogIllegalParameterException

parseXml

public static ObjectStateHolderVector parseXml(java.io.InputStream xmlStream)
                                        throws AppilogIllegalParameterException
Throws:
AppilogIllegalParameterException

parseXml

public static ObjectStateHolderVector parseXml(java.lang.String xmlString,
                                               boolean isZipped)
                                        throws AppilogIllegalParameterException
Throws:
AppilogIllegalParameterException

parseXml

public static ObjectStateHolderVector parseXml(java.lang.String xmlString)
                                        throws AppilogIllegalParameterException
Throws:
AppilogIllegalParameterException

parseXml

public static ObjectStateHolderVector parseXml(byte[] xmlBuffer)
                                        throws AppilogIllegalParameterException
Throws:
AppilogIllegalParameterException

deepClone

public java.lang.Object deepClone()
Returns a clone of this vector.

Returns:
A clone of this instance

add

public void add(ObjectStateHolder element)
Appends the specified element to the end of this vector.

Parameters:
element - element to be appended to this vector.

addAll

public void addAll(ObjectStateHolderVector elements)
Appends a vector of elements to the end of this vector.

Parameters:
elements - element to be appended to this vector.

add

public void add(int index,
                ObjectStateHolder element)
Inserts the specified element at the specified position in this vector. Shifts the element currently at that position and all subsequent elements to the right (adds one to their indexes).

Parameters:
index - The position at which the element is to be inserted
element - The element to be inserted
Throws:
java.lang.ArrayIndexOutOfBoundsException - index is out of range (index < 0 || index > size()).

set

public ObjectStateHolder set(int index,
                             ObjectStateHolder element)
Replaces the element at the specified position in this vector with the specified element.

Parameters:
index - The index of element to replace
element - The element to be stored at the specified position
Returns:
The element previously stored at the specified position
Throws:
java.lang.ArrayIndexOutOfBoundsException - index out of range (index < 0 || index >= size()).
java.lang.IllegalArgumentException - fromIndex > toIndex.

remove

public ObjectStateHolder remove(int index)
Removes the element at the specified position in this vector. Shifts any subsequent elements to the left (subtracts one from their indexes).

Parameters:
index - the index of the element to removed.
Returns:
The element that was removed from the vector
Throws:
java.lang.ArrayIndexOutOfBoundsException - index out of range (index < 0 || index >= size()).

remove

public boolean remove(ObjectStateHolder element)
Removes the first occurrence of the specified element in this vector. If the vector does not contain the element, the vector is unchanged. More formally, removes the element with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))),if such an element exists.

Parameters:
element - The element to be removed from this vector, if present
Returns:
true if the vector contained the specified element

contains

public boolean contains(ObjectStateHolder element)
Checks if the specified object is contained in this vector. The check uses the equals method.

Parameters:
element - an ObjectStateHolder to be tested
Returns:
true if the specified object is the same as an element in this vector, otherwise false.

contains

public boolean contains(java.lang.Object objectID)

indexOf

public int indexOf(ObjectStateHolder element)
Returns the position of the first occurence of the specified argument. The check uses the equals method.

Parameters:
element - An ObjectStateHolder
Returns:
The index of the first occurrence of the argument in this vector, that is, the smallest value k such that elem.equals(elementData[k]) is true; returns -1 if the object is not found.
See Also:
Object.equals(Object)

get

public ObjectStateHolder get(int index)
Returns the element at the specified position in this vector.

Parameters:
index - The index of the element to return
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is out of range

getSubVector

public ObjectStateHolderVector getSubVector(int from,
                                            int to)
Returns a vector comprising the elements in this vector between the specified indexes (inclusive).


getIdVector

public CmdbIdsVector getIdVector()
Returns the vector of object IDs.


getCmdbObjectIds

public CmdbObjectIds getCmdbObjectIds()
Returns the vector of object IDs.


toXml

public Element toXml()

toZip

public byte[] toZip()
             throws AppilogIllegalParameterException,
                    java.io.IOException
Throws:
AppilogIllegalParameterException
java.io.IOException

toZipBySerialization

public byte[] toZipBySerialization()
                            throws java.io.IOException
Throws:
java.io.IOException

toZipString

public java.lang.String toZipString()
                             throws AppilogIllegalParameterException,
                                    java.io.IOException
Throws:
AppilogIllegalParameterException
java.io.IOException

sort

public void sort(java.util.Comparator comparator)
Sorts the specified vector according to the order defined by the specified comparator. All elements in the vector must be mutually comparable using the specified comparator, that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the list.
This sort is stable, that is, equal elements are not reordered.
The sorting algorithm is a modified mergesort in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist. This algorithm gives n log(n) performance, and can approach linear performance on nearly sorted lists.

Parameters:
comparator - The comparator to determine the order of the list. A null value indicates that the elements' natural ordering should be used.
Throws:
java.lang.ClassCastException - if the list contains elements that are not mutually comparable using the specified comparator.
java.lang.UnsupportedOperationException - if the specified list's list-iterator does not support the set operation.

sort

public void sort(StringVector attrs,
                 boolean ascendent)
Sorts the specified vector.

Parameters:
ascendent - true for ascending sort. false for descending sort.
attrs - the vector to sort

sort

public void sort(java.lang.String attrName)

subList

public ObjectStateHolderVector subList(int indexFrom,
                                       int indexTo)

toXmlString

public java.lang.String toXmlString()

toXmlString

public java.lang.String toXmlString(boolean withEncoding)

toXmlString

public java.lang.StringBuffer toXmlString(java.lang.StringBuffer xml,
                                          boolean withEncoding)


© Copyright 2010 Hewlett-Packard Development Company, L.P.