Package com.microstrategy.utils
Class SimpleListObj
- java.lang.Object
 - 
- com.microstrategy.utils.SimpleListObj
 
 
- 
- All Implemented Interfaces:
 SimpleList
public class SimpleListObj extends java.lang.Object implements SimpleList
This class will allow the user to add, remove, and examine the objects in the given collection.- Since:
 - MicroStrategy Web 7.3.1 or earlier
 
 
- 
- 
Constructor Summary
Constructors Constructor Description SimpleListObj()SimpleListObj(java.lang.Class objectAllowed) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.Object element)Adds the given object to the collection.voidaddAll(SimpleList simpleList)Adds all elements in anotherSimpleListinto this list.voidclear()Clears all items from the collection.java.util.Collectioncollection()booleancontains(java.lang.Object item)Returns whether a specific object is contained in the collection.java.util.Enumerationelements()Return the enumeration of the items inside this list.java.lang.ClassgetObjectTypeAllowed()Returns the object type allowed in the collection.booleanisEmpty()Returns true if the collection is empty, false otherwise.booleanisReadOnly()Returns true if the collection is read-only, false if it can be modified.java.lang.Objectitem(int index)Returns the item in the list with the given index.voidremove(int index)Removes the item with the given index from the list.booleanremove(java.lang.Object obj)Removes the specified object from the collection.voidsetObjectTypeAllowed(java.lang.Class _typeAllowed)Sets the object type allowed in the collection.voidsetReadOnly(boolean isReadOnly)Sets the collection as read-only.intsize()Returns the current size of the list.voidsort(java.util.Comparator c)Sorts the collection using the specifiedComparator.java.util.ArrayListtoArrayList()Return the list as an array list.java.lang.StringtoString() 
 - 
 
- 
- 
Method Detail
- 
add
public void add(java.lang.Object element) throws java.lang.UnsupportedOperationException, java.lang.ClassCastExceptionAdds the given object to the collection. It will be added to the end of the list. Note that this could fail either because the object is read-only, or because the creating object has constrained the list to only hold a certain type of object.- Specified by:
 addin interfaceSimpleList- Parameters:
 element- The object to add to the collection.- Throws:
 java.lang.UnsupportedOperationException- Thrown if the list is read-only.java.lang.ClassCastException- Thrown if the object given is of an inappropriate type.
 
- 
addAll
public void addAll(SimpleList simpleList)
Adds all elements in anotherSimpleListinto this list.- Specified by:
 addAllin interfaceSimpleList- Parameters:
 simpleList- The list whose elements will be added into this list.- Since:
 - MicroStrategy Web 7.5.1
 
 
- 
clear
public void clear() throws java.lang.UnsupportedOperationExceptionClears all items from the collection. Throws an UnsupportedOperationException if the object is read-only.- Specified by:
 clearin interfaceSimpleList- Throws:
 java.lang.UnsupportedOperationException- Thrown if the list is read-only.
 
- 
size
public int size()
Returns the current size of the list.- Specified by:
 sizein interfaceSimpleList- Returns:
 - The number of items in the list.
 
 
- 
item
public java.lang.Object item(int index) throws java.lang.IndexOutOfBoundsExceptionReturns the item in the list with the given index.- Specified by:
 itemin interfaceSimpleList- Parameters:
 index- The index of the item in the collection to return.- Returns:
 - The object which is at the given index in the collection.
 - Throws:
 java.lang.IndexOutOfBoundsException- Thrown if no item in the collection has the given index.
 
- 
remove
public void remove(int index) throws java.lang.UnsupportedOperationException, java.lang.IndexOutOfBoundsExceptionRemoves the item with the given index from the list. This will cause a shifting of indices of items in the list which are after the removed item.- Specified by:
 removein interfaceSimpleList- Parameters:
 index- The index of the item in the collection to remove.- Throws:
 java.lang.IndexOutOfBoundsException- Thrown if no item in the collection has the given index.java.lang.UnsupportedOperationException- Thrown if the list is designated as read-only.
 
- 
elements
public java.util.Enumeration elements()
Return the enumeration of the items inside this list.- Specified by:
 elementsin interfaceSimpleList- Returns:
 - An enumeration of the items inside this list.
 
 
- 
collection
public java.util.Collection collection()
- Since:
 - MicroStrategy Web 9.0.0
 
 
- 
setReadOnly
public void setReadOnly(boolean isReadOnly)
Sets the collection as read-only.- Parameters:
 isReadOnly- whether the collection will be read only or not.
 
- 
isReadOnly
public boolean isReadOnly()
Returns true if the collection is read-only, false if it can be modified.- Specified by:
 isReadOnlyin interfaceSimpleList- Returns:
 - Whether the collection is read-only.
 
 
- 
isEmpty
public boolean isEmpty()
Returns true if the collection is empty, false otherwise.- Specified by:
 isEmptyin interfaceSimpleList- Returns:
 - Whether the collection is empty.
 
 
- 
setObjectTypeAllowed
public void setObjectTypeAllowed(java.lang.Class _typeAllowed)
Sets the object type allowed in the collection.- Parameters:
 _typeAllowed- the object type allowed in the collection.
 
- 
getObjectTypeAllowed
public java.lang.Class getObjectTypeAllowed()
Returns the object type allowed in the collection.- Returns:
 - The object type allowed in the collection.
 
 
- 
contains
public boolean contains(java.lang.Object item)
Returns whether a specific object is contained in the collection.- Specified by:
 containsin interfaceSimpleList- Parameters:
 item- The object we want to search in the collection.- Returns:
 truewhen theitemis contained in the collection. Otherwise,falsewill be returned.
 
- 
sort
public void sort(java.util.Comparator c)
Sorts the collection using the specifiedComparator.- Specified by:
 sortin interfaceSimpleList- Parameters:
 c- TheComparatorto be used in sorting.- Since:
 - MicroStrategy Web 7.5.1
 
 
- 
remove
public boolean remove(java.lang.Object obj) throws java.lang.UnsupportedOperationExceptionRemoves the specified object from the collection.- Specified by:
 removein interfaceSimpleList- Parameters:
 obj- The object to be removed.- Returns:
 trueif the object has been successfully removed. Otherwise,falsewill be returned.- Throws:
 java.lang.UnsupportedOperationException- Thrown when this collection is read-only.- Since:
 - MicroStrategy Web 7.5.2
 
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object- Since:
 - MicroStrategy Web 8.0.0
 
 
- 
toArrayList
public java.util.ArrayList toArrayList()
Description copied from interface:SimpleListReturn the list as an array list.- Specified by:
 toArrayListin interfaceSimpleList
 
 - 
 
 -