- addAll(
vec
)
-
Adds all data in the vector.
Parameter
| vec | Vector | Y | WebSquare vector containing the data to add |
Sample
var vec = new WebSquare.collection.Vector();
vec.addElement("Seoul");
var vec1 = new WebSquare.collection.Vector();
vec1.addElement("Busan");
vec.addAll( vec1 );
alert( vec.toString() );
Result:
- addElement(
data
)
-
Adds new data to the vector.
Supported data types include vector, Hashtable, XML document, XML string (well-formed XML-type string), and string. Other data types are converted into string before being added.
Parameter
| data | Object | Y | Data to add |
Sample
var vec = new WebSquare.collection.Vector();
vec.addElement("Seoul");
alert(vec.toString());
Result:
- containsKey(
key
)
-
Checks whether the Hashtable contains a key.
Parameter
| key | Object | Y | Key to check |
Return
| Boolean | If the Hashtable contains the key, "true" will be returned. Otherwise, "false" will be returned. |
Sample
var hash = new WebSquare.collection.Hashtable();
hash.put("location" , "Seoul");
var exist = hash.containsKey("location")
exist : true
- elementAt(
i
)
-
Returns the data of the corresponding index. If no data exists in the specified index, null data will be returned.
Return
| Object | Data of the corresponding index. Null when no data exists. |
Sample
var vec = new WebSquare.collection.Vector();
vec.addElement("Seoul");
vec.addElement("Busan");
var result = vec.elementAt( 1 );
result : Busan
- elements(
)
-
Returns the data contained in the Hashtable as an array.
Return
| Array | Hashtable data Array |
Sample
var hash = new WebSquare.collection.Hashtable();
hash.put("location" , "Seoul");
hash.put("date" , "20120101");
var arr = hash.elements();
arr[0] is 20120101, and arr[1] is Seoul.
- fastRemove(
i
)
-
Removes the value of the corresponding index.
Sample
vec.fastRemove( 0 );
- get(
key
)
-
Gets the value matching with the key in the Hashtable.
Parameter
| key | Object | Y | Key to check |
Return
| Object | The matching value will be returned. If there is no matching value, null will be returned. |
Sample
var hash = new WebSquare.collection.Hashtable();
hash.put("location", "Seoul");
alert(hash.get("location"));
Result : Seoul
- getAction(
)
-
Returns the action of the vector.
Supported on the Inswave framework.
Return
| String | Value of the action |
Sample
var action = vec.getAction();
- getAction(
)
-
Returns the action of the Hashtable.
Supported on the Inswave framework.
Return
| String | Value of the action |
Sample
var action = hash.getAction();
- getAttribute(
name
)
-
Gets the attribute of the vector. When converted into XML, vector attributes are in the highest node.
Parameter
| name | String | Y | Name of the attribute |
Return
| String | Value of the attribute |
Sample
var vec = new WebSquare.collection.Vector();
vec.setAttribute( "task", "com.inswave.system.task.TMSTask" );
alert(vec.getAttribute("task"));
Result: com.inswave.system.task.TMSTask
- getAttribute(
name
)
-
Gets the attributes of the Hashtable.
When converted to XML, Hashtable attributes are in the highest node.
Parameter
| name | String | Y | Name of the attribute |
Return
| Object | Value of the attribute |
Sample
var hash = new WebSquare.collection.Hashtable();
hash.setAttribute( "task", "com.inswave.system.task.TMSTask" );
alert(hash.getAttribute("task"));
Result: com.inswave.system.task.TMSTask
- getTask(
)
-
Gets the task of the Vector.
Supported on the Inswave framework.
Return
| String | Value of the task |
Sample
var action = vec.getTask();
- getTask(
)
-
Gets the task of the Hashtable.
Supported on the Inswave framework.
Return
| String | Value of the task |
Sample
var task = hash.getTask();
- insertElementAt(
data
,
i
)
-
Inserts data to the specified position. Not functions when the index is smaller than 0 or larger than the vector length.
Parameter
| data | Object | Y | Supported data types include vector, Hashtable, XML document, XML string (well-formed XML-type string), and string. Other data types are converted into string before being inserted. |
| i | String | Y | Index |
Sample
var vec = new WebSquare.collection.Vector();
vec.addElement("Seoul");
vec.insertElementAt("", 0 );
alert( vec.toString() );
Result :
- keys(
)
-
Gets the list of the keys stored on the Hashtable as an array.
Sample
var hash = new WebSquare.collection.Hashtable();
hash.put("location" , "Seoul");
hash.put("date" , "20120101");
var arr = hash.keys();
arr[0] is date, and arr[1] is location.
- put(
key
,
data
)
-
Puts the data with the specified key in the Hashtable. Returns the value of the corresponding key.
Supported data types include vector, Hashtable, XML document, XML string (well-formed XML-type string), and string. Other data types are converted into string before being added.
Parameter
| key | String | Y | Value of the key |
| data | Object | Y | Value to be matched with the key |
Return
| Object | The matching value will be returned. If there is no matching value, null will be returned. |
Sample
var hash = new WebSquare.collection.Hashtable();
hash.put("location", "Seoul");
alert(hash.toString());
Result :
- remove(
i
)
-
Removes the data of the specified location from the vector, and returns the removed data.
Return
| Object | Data removed from index i |
Sample
var vec = new WebSquare.collection.Vector();
vec.addElement("Seoul");
var removedElement = vec.remove( 0 );
removedElement : Seoul
- remove(
key
)
-
Removes the data of the corresponding key from the Hashtable. Returns the removed key.
Parameter
| key | String | Y | Key of the data to remove |
Return
| Object | Data of the specified key will be returned. If no data exists, null data will be returned. |
Sample
var hash = new WebSquare.collection.Hashtable();
hash.put("location" , "Seoul");
hash.remove("location");
alert(hash.toString());
Result :
- set(
i
,
data
)
-
Sets the data in the specified index with the new data.
Parameter
| i | String | Y | Index to set the data |
| data | Object | Y | Data to set. Supported data types include vector, Hashtable, XML document, XML string (well-formed XML-type string), and string. Other data types are converted into string before being inserted. |
Sample
var vec = new WebSquare.collection.Vector();
vec.addElement("Seoul");
vec.set( 0, "Busan" );
alert(vec.toString());
Result :
- setAction(
value
)
-
Sets the action property in the Vector.
Supported on the Inswave framework.
Parameter
| value | String | Y | Name of the action |
Sample
vec.setAction("selectList");
- setAction(
value
)
-
Sets the action property in the Hashtable.
Supported on the Inswave framework.
Parameter
| value | String | Y | Name of the action |
Sample
hash.setAction( "selectList" );
- setAttribute(
name
,
value
)
-
Sets the attributes of the Vector. When converted into XML, vector attributes are in the highest node.
Parameter
| name | String | Y | Name of the attribute |
| value | Object | Y | Value of the attribute |
Sample
var vec = new WebSquare.collection.Vector();
vec.setAttribute( "task", "com.inswave.system.task.TMSTask" );
alert(vec.toString());
Result:
- setAttribute(
name
,
value
)
-
Sets the attributes of the Hashtable.
When converted to XML, Hashtable attributes are in the highest node.
Parameter
| name | String | Y | Name of the attribute |
| value | Object | Y | Value of the attribute |
Sample
var hash = new WebSquare.collection.Hashtable();
hash.setAttribute( "task", "com.inswave.system.task.TMSTask" );
alert(hash.toString());
Result :
- setDebug(
value
)
-
Sets the debugging attributes in the vector.
Debugging-related attribute is debug, and the value is true or false.
If debug is "true", additional debugging information will be displayed by the server that supports debugging.
Supported on the Inswave framework.
Parameter
| value | Boolean | Y | Debug Flag(true/false) |
Sample
vec.setDebug( true );
- setDebug(
value
)
-
Sets the debugging attributes in the Hashtable.
If debug is "true", additional debugging information will be displayed by the server that supports debugging.
Supported on the Inswave framework.
Parameter
| value | Boolean | Y | Value of the debugging attribute |
Return
| Boolean | value Debug Flag(true/false) |
Sample
hash.setDebug( true );
- setDocument(
doc
)
-
Initializes the existing data in XML format in the Vector.
Parameter
| doc | Document | Y | XML document containing new data |
Sample
var vec = new WebSquare.collection.Vector();
var doc = WebSquare.xml.parse( "" );
vec.setDocument( doc );
alert(vec.toString());
Result:
- setDocument(
doc
)
-
Initializes the existing data in XML format in the Hashtable.
Parameter
| doc | Document | Y | XML document containing new data |
Sample
var hash = new WebSquare.collection.Hashtable();
var doc = WebSquare.xml.parse( "" );
hash.setDocument( doc );
alert(hash.toString());
Result :
- setTask(
value
)
-
Sets the task attribute in the Vector.
Supported on the Inswave framework.
Parameter
| value | String | Y | Name of the task |
Sample
vec.setTask("com.inswave.system.task.TMSTask");
- setTask(
value
)
-
Sets the task attribute in the Hashtable.
Supported on the Inswave framework.
Parameter
| value | String | Y | Name of the task |
Sample
hash.setTask( "com.inswave.system.task.TMSTask" );
- size(
)
-
Returns the data count in the vector.
Return
| Number | Size of the vector |
Sample
var vec = new WebSquare.collection.Vector();
vec.addElement("Seoul");
var vecSize = vec.size();
vecSize : 1
- toDocument(
)
-
Converts the Vector into an XML document.
Return
| Document | XML document of the vector |
Sample
var doc = vec.toDocument();
- toDocument(
)
-
Converts the Hashtable into XML document.
Return
| Document | XML Document of the Hashtable |
Sample
var doc = hash.toDocument();
- toHashtable(
doc
)
-
Convert the XML (String/Document) into a Hashtable object. (Does not reference the value.)
Parameter
| doc | Object | Y | XML String/Document to Convert |
Return
| Object | WebSquare.collection.Hashtable object |
Sample
var vector = WebSquare.collection.toHashtable( doc );
- toString(
)
-
Converts the Vector into an XML string.
Return
| String | XML string of the vector |
Sample
var doc = vec.toString();
- toString(
)
-
Converts the Hashtable into an XML string.
Return
| String | XML string of the Hashtable |
Sample
var hashStr = hash.toString();
- toVector(
doc
)
-
Converts the XML (string/document) into a vector object. (Does not reference the value.)
Parameter
| doc | Object | Y | XML String/Document to Convert |
Return
| Object | WebSquare.collection.Vector object |
Sample
var vector = WebSquare.collection.toVector( doc );
- WebSquare.collection.Hashtable(
)
-
Creates a Hashtable.
Sample
var hash = new WebSquare.collection.Hashtable();
- WebSquare.collection.Vector(
)
-
Creates a Vector.
Sample
var vec = new WebSquare.collection.Vector();