public class

SimpleListObj

extends Object
implements SimpleList
java.lang.Object
   ↳ com.microstrategy.utils.SimpleListObj

Class Overview

This class will allow the user to add, remove, and examine the objects in the given collection.

Summary

Public Constructors
SimpleListObj()
SimpleListObj(Class objectAllowed)
Public Methods
void add(Object element)
Adds the given object to the collection.
void addAll(SimpleList simpleList)
Adds all elements in another SimpleList into this list.
void clear()
Clears all items from the collection.
Collection collection()
boolean contains(Object item)
Returns whether a specific object is contained in the collection.
Enumeration elements()
Return the enumeration of the items inside this list.
Class getObjectTypeAllowed()
Returns the object type allowed in the collection.
boolean isEmpty()
Returns true if the collection is empty, false otherwise.
boolean isReadOnly()
Returns true if the collection is read-only, false if it can be modified.
Object item(int index)
Returns the item in the list with the given index.
void remove(int index)
Removes the item with the given index from the list.
boolean remove(Object obj)
Removes the specified object from the collection.
void setObjectTypeAllowed(Class _typeAllowed)
Sets the object type allowed in the collection.
void setReadOnly(boolean isReadOnly)
Sets the collection as read-only.
int size()
Returns the current size of the list.
void sort(Comparator c)
Sorts the collection using the specified Comparator.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.microstrategy.web.objects.SimpleList

Public Constructors

public SimpleListObj ()

public SimpleListObj (Class objectAllowed)

Public Methods

public void add (Object element)

Adds 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.

Parameters
element The object to add to the collection.
Throws
UnsupportedOperationException Thrown if the list is read-only.
ClassCastException Thrown if the object given is of an inappropriate type.

public void addAll (SimpleList simpleList)

Adds all elements in another SimpleList into this list.

Parameters
simpleList The list whose elements will be added into this list.

public void clear ()

Clears all items from the collection. Throws an UnsupportedOperationException if the object is read-only.

Throws
UnsupportedOperationException Thrown if the list is read-only.

public Collection collection ()

public boolean contains (Object item)

Returns whether a specific object is contained in the collection.

Parameters
item The object we want to search in the collection.
Returns
  • true when the item is contained in the collection. Otherwise, false will be returned.

public Enumeration elements ()

Return the enumeration of the items inside this list.

Returns
  • An enumeration of the items inside this list.

public Class getObjectTypeAllowed ()

Returns the object type allowed in the collection.

Returns
  • The object type allowed in the collection.

public boolean isEmpty ()

Returns true if the collection is empty, false otherwise.

Returns
  • Whether the collection is empty.

public boolean isReadOnly ()

Returns true if the collection is read-only, false if it can be modified.

Returns
  • Whether the collection is read-only.

public Object item (int index)

Returns the item in the list with the given index.

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
IndexOutOfBoundsException Thrown if no item in the collection has the given index.

public void remove (int index)

Removes 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.

Parameters
index The index of the item in the collection to remove.
Throws
IndexOutOfBoundsException Thrown if no item in the collection has the given index.
UnsupportedOperationException Thrown if the list is designated as read-only.

public boolean remove (Object obj)

Removes the specified object from the collection.

Parameters
obj The object to be removed.
Returns
  • true if the object has been successfully removed. Otherwise, false will be returned.
Throws
UnsupportedOperationException Thrown when this collection is read-only.

public void setObjectTypeAllowed (Class _typeAllowed)

Sets the object type allowed in the collection.

Parameters
_typeAllowed the object type allowed in the collection.

public void setReadOnly (boolean isReadOnly)

Sets the collection as read-only.

Parameters
isReadOnly whether the collection will be read only or not.

public int size ()

Returns the current size of the list.

Returns
  • The number of items in the list.

public void sort (Comparator c)

Sorts the collection using the specified Comparator.

Parameters
c The Comparator to be used in sorting.

public String toString ()