Configuration Platform SDK 7.6 API Reference

com.genesyslab.platform.commons.collections
Interface KVList.PairList

All Superinterfaces:
java.lang.Cloneable
Enclosing interface:
KVList

public static interface KVList.PairList
extends java.lang.Cloneable

A list of key-value pairs. Used as an abstraction of pairs storage. Usage of this list for other purposes is not expected. There are no public implementation of this interface, so if you are going to subclass KVList or its subclasses you will have to create own implementation.


Method Summary
 void add(Pair pair)
          Add pair to the storage
 boolean addAfter(Pair pair, Pair where)
          Add pair just after another pair
 boolean addBefore(Pair pair, Pair where)
          Add pair just before another pair
 java.util.Collection asCollection()
          Return this list as a collection of Pairs.
 void clear()
          Clear the storage
 java.lang.Object clone()
          Clones the storage.
 Pair findPair(java.lang.Object key)
          Find pair in the storage by key.
 Pair get(int index)
          Gets pair from the storage by index.
 java.util.Enumeration getEnumeration()
          Returns an Enumeration through the storage.
 java.util.Enumeration getPairEnumeration(java.lang.Object key)
          Returns an Enumeration of pairs with specified key.
 void insert(Pair pair, int index)
          Inserts pair to the storage at specified index.
 boolean isEmpty()
          Checks if the storage is empty (doesn't contain any pair)
 int length()
          Return the number of elements in this storage
 Pair remove(int index)
          Remove pair from the storage by index.
 Pair remove(java.lang.Object key)
          Remove pair from the storage by key.
 

Method Detail

add

public void add(Pair pair)
Add pair to the storage

Parameters:
pair - Pair to add

findPair

public Pair findPair(java.lang.Object key)
Find pair in the storage by key.

Parameters:
key - Key of the pair to find
Returns:
First pair with specified key or null if pair is not found.

remove

public Pair remove(java.lang.Object key)
Remove pair from the storage by key.

Parameters:
key - Key of the pair to remove
Returns:
Removed pair or null if pair is not found.

remove

public Pair remove(int index)
Remove pair from the storage by index. Warning: This method can be inefficient (implementation not required to support access by index)

Parameters:
index - Index of the pair to remove
Returns:
Removed pair or null if pair is not found.

clear

public void clear()
Clear the storage


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones the storage. The storage returned should be completely independent of this storage. In other words changing this storage shouldn't affect the clone in any way and vise versa.

Returns:
Clone of this storage.
Throws:
java.lang.CloneNotSupportedException - if this storage can't be cloned

getEnumeration

public java.util.Enumeration getEnumeration()
Returns an Enumeration through the storage. Type of elements in this storage depends on list implementation.

Returns:
Enumeration for the storage

getPairEnumeration

public java.util.Enumeration getPairEnumeration(java.lang.Object key)
Returns an Enumeration of pairs with specified key. Type of elements in this storage depends on list implementation.

Returns:
Enumeration for the storage

addAfter

public boolean addAfter(Pair pair,
                        Pair where)
Add pair just after another pair

Parameters:
pair - Pair to add
where - Pair to add after
Returns:
true if pair is added, false otherwise

addBefore

public boolean addBefore(Pair pair,
                         Pair where)
Add pair just before another pair

Parameters:
pair - Pair to add
where - Pair to add before
Returns:
true if pair is added, false otherwise

length

public int length()
Return the number of elements in this storage

Returns:
the number of elements in the storage

isEmpty

public boolean isEmpty()
Checks if the storage is empty (doesn't contain any pair)

Returns:
true - if storage is empty and false otherwise

insert

public void insert(Pair pair,
                   int index)
Inserts pair to the storage at specified index. Warning: This method can be inefficient (implementation is not required to support access by index)

Parameters:
pair - Pair to insert
index - The position to insert pair at.

get

public Pair get(int index)
Gets pair from the storage by index. Warning: This method can be inefficient (implementation is not required to support access by index)

Parameters:
index - The position to insert pair at.

asCollection

public java.util.Collection asCollection()
Return this list as a collection of Pairs.

Returns:
Collection of Pairs

Configuration Platform SDK 7.6 API Reference

Send comments on this topic.
Copyright © 2006–2008 Genesys Telecommunication Laboratories, Inc. All rights reserved.