util/ Collections.js

General collection objects modeled after java.util.  Gives a Set, List, and Map object

Copyright

2004 Rob Rohan robr.nosp@m.ohan@gmai.nosp@m.l.com All rights reserved

Summary
General collection objects modeled after java.util.
the current version
Base object for the collections objects List and Set
gets the size of this map object
Removes all of the elements from this list optional operation.
Returns an array containing all of the elements in this list in proper sequence.
Returns true if this list contains the specified element.
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
Returns true if this list contains no elements.
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
Returns the element at the specified position in this list.
Removes the first occurrence in this list of the specified element (optional operation).
Removes the element at the specified position in this list (optional operation).
Replaces the element at the specified position in this list with the specified element (optional operation).
Show the collection contents
A list of elements.
Appends the specified element to the end of this list (optional operation).
Turns this List (array backed) into a string list, or “thin list” using sep as the separator
creates a list from a “thin list” list using separator sep
Show the list contents
This is kind of weak and not very expandable, but its only used when this object is supposed to go to a web service and it requires the gateway
Set keeps a unique list of elements and wont allow nulls or undefined values.
Adds the specified element to this set if it is not already present optional operation.
Simple Map object with a lame seaching algorithm.
adds a name value pair
gets all the keys from this map as an array
Gets a value from a key
Removes the first occurrence in this map of the specified key
see if keyname is already in this map lame algorithm
see if keyname is already in this map ignoring case
Returns the index the key or -1 if this map does not contain the key
Removes the element at the specified position in this list (optional operation).
gets the size of this map object
Put this whole map, including sub maps, into a xml fragment to send to the web service
the ol’toString

Variables

COLLECTIONS_VERSION

var COLLECTIONS_VERSION

the current version

Collection

Base object for the collections objects List and Set

Summary
gets the size of this map object
Removes all of the elements from this list optional operation.
Returns an array containing all of the elements in this list in proper sequence.
Returns true if this list contains the specified element.
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
Returns true if this list contains no elements.
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
Returns the element at the specified position in this list.
Removes the first occurrence in this list of the specified element (optional operation).
Removes the element at the specified position in this list (optional operation).
Replaces the element at the specified position in this list with the specified element (optional operation).
Show the collection contents

Functions

Collection.size

gets the size of this map object

Return

int the size of the collection

Collection. clear

Removes all of the elements from this list optional operation.

Collection. toArray

Returns an array containing all of the elements in this list in proper sequence.

Return: Object[]

Collection. contains

Returns true if this list contains the specified element.

Parameters

  • - the object to test for

Return

boolean if the collection has the object o

Collection. indexOf

Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.

Parameters

  • - the object whoms index you would like to know

Return

int the position of o in this collection

Collection. isEmpty

Returns true if this list contains no elements.

Return

boolean

Collection. lastIndexOf

Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.

Parameter

  • - the object to find

Return

int the position of the object

Collection.get

Returns the element at the specified position in this list.

Parameters

indexthe index of the object you wish

Returns

Object

Collection. remove

Removes the first occurrence in this list of the specified element (optional operation).

Parameter

  • - the object to remove

Returns

boolean

Collection. removeByIndex

Removes the element at the specified position in this list (optional operation).

Parameters

indexthe items index to remove

Returns

Object

Collection.set

Replaces the element at the specified position in this list with the specified element (optional operation).

Parameters

indexwhich element to set
elementthe object put in the selected index

Collection. toString

Show the collection contents

Returns

this collection object in a printable string

List

A list of elements.  More or less an array with search functions An ordered collection (also known as a sequence).  The user of this object has precise control over where in the list each element is inserted.  The user can access elements by their integer index (position in the list), and search for elements in the list.  Extends Collection

See Also

Collection

Summary
Appends the specified element to the end of this list (optional operation).
Turns this List (array backed) into a string list, or “thin list” using sep as the separator
creates a list from a “thin list” list using separator sep
Show the list contents
This is kind of weak and not very expandable, but its only used when this object is supposed to go to a web service and it requires the gateway

Functions

List.add

Appends the specified element to the end of this list (optional operation).

Parameters

  • - the object to add

Returns

boolean

List. toThinList

Turns this List (array backed) into a string list, or “thin list” using sep as the separator

Parameters

sepwhat to use as the separator

Returns

a string in thin list format

List. fromThinList

creates a list from a “thin list” list using separator sep

Parameters

listthe thin list object
sepwhat is used as the separator in the thin list

List. toString

Show the list contents

Returns

this list object in a printable string

List. toWSArray

This is kind of weak and not very expandable, but its only used when this object is supposed to go to a web service and it requires the gateway

Parameters

varname type

Returns

an xml fragment in a string

Set

Set keeps a unique list of elements and wont allow nulls or undefined values.  Extends Collection

See Also

Collection

Summary
Adds the specified element to this set if it is not already present optional operation.

Functions

Set.add

Adds the specified element to this set if it is not already present optional operation.

Returns

boolean

Map

Simple Map object with a lame seaching algorithm.

Summary
adds a name value pair
gets all the keys from this map as an array
Gets a value from a key
Removes the first occurrence in this map of the specified key
see if keyname is already in this map lame algorithm
see if keyname is already in this map ignoring case
Returns the index the key or -1 if this map does not contain the key
Removes the element at the specified position in this list (optional operation).
gets the size of this map object
Put this whole map, including sub maps, into a xml fragment to send to the web service
the ol’toString

Functions

Map.put

adds a name value pair

Parameters

nkeythe object to use as the key
nvaluethe object to use as the value

Map. getKeysAsArray

gets all the keys from this map as an array

Returns

an array of the keys

Map.get

Gets a value from a key

Parameters

keynamethe key for the object to get

Returns

the value or null if not found

Map. remove

Removes the first occurrence in this map of the specified key

Parameter

keythe key to remove

Map. contains

see if keyname is already in this map lame algorithm

Parameters

keynamethe key to check for

Returns

true if this map as the key

Map. containsNoCase

see if keyname is already in this map ignoring case

Parameters

keynamethe key to check for

Returns

true if this map as the key

Map. indexOf

Returns the index the key or -1 if this map does not contain the key

Parameters

keythe key to look for

Returns

the position or -1 if not found

Map. removeByIndex

Removes the element at the specified position in this list (optional operation).

Map.size

gets the size of this map object

Returns

The size of this map (number of name value pairs)

Map. toWSStruct

Put this whole map, including sub maps, into a xml fragment to send to the web service

Parameters

varname id depth

Returns

xml fragment

Map. toString

the ol’toString

Returns

this map as a printable string

var COLLECTIONS_VERSION
the current version
Base object for the collections objects List and Set