Package com.core.collection
Class SList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<java.util.LinkedHashMap<java.lang.String,java.lang.Object>>
-
- com.core.collection.SList
-
- All Implemented Interfaces:
SoloProtocol
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<java.util.LinkedHashMap<java.lang.String,java.lang.Object>>
,java.util.Collection<java.util.LinkedHashMap<java.lang.String,java.lang.Object>>
,java.util.List<java.util.LinkedHashMap<java.lang.String,java.lang.Object>>
,java.util.RandomAccess
public class SList extends java.util.ArrayList<java.util.LinkedHashMap<java.lang.String,java.lang.Object>> implements SoloProtocol
- Author:
- Sokkheang.huo
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String key, java.lang.Object value)
Set the value of the object type in the corresponding key value.void
addSList(SList Solo)
void
addSListNoClone(SList Solo)
void
addSolo(Solo Solo)
void
addSoloNoClone(Solo data)
boolean
containsKey(int index, java.lang.Object key)
Check if key existsboolean
containsKey(java.lang.Object key)
Check if key existsjava.lang.Object
get(int keyIndex, int index)
Return the value corresponding to the keyIndex and index to the object.java.util.List<Solo>
get(java.lang.Object key)
java.lang.Object
get(java.lang.Object key, int index)
Return the value corresponding to the key and index in the form of an object.java.math.BigDecimal
getBigDecimal(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in BegDecimal format.java.math.BigDecimal
getBigDecimal(java.lang.Object key, int index)
Return the value corresponding to the key and index in the BegDecimal format.boolean
getBoolean(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in boolean form.boolean
getBoolean(java.lang.Object key, int index)
Return the value corresponding to the key and index in boolean form.int
getDataCount()
int
getDataCount(java.lang.Object key)
Returns the size (total number of rows) corresponding to the key present in the SList.double
getDouble(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in double.double
getDouble(java.lang.Object key, int index)
Return the value corresponding to the key and index in double.float
getFloat(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in float.float
getFloat(java.lang.Object key, int index)
Return the value corresponding to the key and index in float form.int
getInt(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in int form.int
getInt(java.lang.Object key, int index)
Return the value corresponding to the key and index in int.int
getKeyCount()
This method returns the number of keys that make up the SList.java.lang.Object[]
getKeys()
java.lang.Object
getKeyWithIndex(int keyIndex)
java.lang.Object
getKeyWithIndex(int keyIndex, int index)
Returns the key object corresponding to the index.long
getLong(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in long format.long
getLong(java.lang.Object key, int index)
Return the value corresponding to the key and index in long format.short
getShort(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in a short format.short
getShort(java.lang.Object key, int index)
Return the value corresponding to the key and index in a short form.Solo
getSolo(int key)
java.lang.String
getString(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in String format.java.lang.String
getString(java.lang.Object key, int index)
Return the value corresponding to the key and index in String format.boolean
isNullToInitialize()
void
modify(java.lang.String key, int index, java.lang.Object replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.void
modifyBigDecimal(java.lang.String key, int index, java.math.BigDecimal replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.void
modifyBoolean(java.lang.String key, int index, boolean replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.void
modifyDouble(java.lang.String key, int index, double replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.void
modifyFloat(java.lang.String key, int index, float replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.void
modifyInt(java.lang.String key, int index, int replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.void
modifyLong(java.lang.String key, int index, long replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.void
modifyShort(java.lang.String key, int index, short replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.void
modifyString(java.lang.String key, int index, java.lang.String replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.void
put(java.lang.Object key, java.util.List l)
void
putAll(java.util.List m)
void
removeColumn(java.lang.String key)
Delete the data (column) for a given key.void
removeRow(int keyIndex)
Delete the data (row) for a given key.void
setNullToInitialize(boolean nullToInitialize)
java.util.List<Solo>
toListSolo()
-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Method Detail
-
isNullToInitialize
public boolean isNullToInitialize()
-
setNullToInitialize
public void setNullToInitialize(boolean nullToInitialize)
-
getKeys
public java.lang.Object[] getKeys()
-
put
public void put(java.lang.Object key, java.util.List l)
-
putAll
public void putAll(java.util.List m)
-
removeColumn
public void removeColumn(java.lang.String key)
Delete the data (column) for a given key.- Parameters:
key
- Key in column to delete- See Also:
removeColumn(String)
-
removeRow
public void removeRow(int keyIndex)
Delete the data (row) for a given key.- Parameters:
key
- Key in row to delete- See Also:
removeRow(int)
-
getKeyWithIndex
public java.lang.Object getKeyWithIndex(int keyIndex)
-
getKeyWithIndex
public java.lang.Object getKeyWithIndex(int keyIndex, int index)
Returns the key object corresponding to the index.- Parameters:
keyIndex
-- Returns:
- int
-
get
public java.util.List<Solo> get(java.lang.Object key)
-
toListSolo
public java.util.List<Solo> toListSolo()
-
addSolo
public void addSolo(Solo Solo)
-
modify
public void modify(java.lang.String key, int index, java.lang.Object replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.- Parameters:
key
- Stringindex
- intreplaceValue
- Object
-
modifyBoolean
public void modifyBoolean(java.lang.String key, int index, boolean replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.- Parameters:
key
- Stringindex
- intreplaceValue
- boolean
-
modifyString
public void modifyString(java.lang.String key, int index, java.lang.String replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.- Parameters:
key
- Stringindex
- intreplaceValue
- String
-
modifyInt
public void modifyInt(java.lang.String key, int index, int replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.- Parameters:
key
- Stringindex
- intreplaceValue
- int
-
modifyDouble
public void modifyDouble(java.lang.String key, int index, double replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.- Parameters:
key
- Stringindex
- intreplaceValue
- double
-
modifyFloat
public void modifyFloat(java.lang.String key, int index, float replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.- Parameters:
key
- Stringindex
- intreplaceValue
- float
-
modifyLong
public void modifyLong(java.lang.String key, int index, long replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.- Parameters:
key
- Stringindex
- intreplaceValue
- long
-
modifyShort
public void modifyShort(java.lang.String key, int index, short replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.- Parameters:
key
- Stringindex
- intreplaceValue
- short
-
modifyBigDecimal
public void modifyBigDecimal(java.lang.String key, int index, java.math.BigDecimal replaceValue)
Replace the value at the index end corresponding to the corresponding key value with the value passed to the parameter.- Parameters:
key
- Stringindex
- intreplaceValue
- BigDecimal
-
add
public void add(java.lang.String key, java.lang.Object value)
Set the value of the object type in the corresponding key value.- Parameters:
key
- Objectvalue
- Object
-
get
public java.lang.Object get(java.lang.Object key, int index)
Return the value corresponding to the key and index in the form of an object. Returns a null or empty string (if value is null and isNullToInitialise() is true) if the key or value does not exist.- Parameters:
key
- Objectindex
- int- Returns:
- Object
-
get
public java.lang.Object get(int keyIndex, int index)
Return the value corresponding to the keyIndex and index to the object. Return a null or empty string (if value is null and isNullToInitialise () is true) if the key or value does not exist.- Parameters:
keyIndex
- intindex
- int- Returns:
- Object
- See Also:
getKeyWithIndex(int)
,get(Object, int)
-
getString
public java.lang.String getString(java.lang.Object key, int index)
Return the value corresponding to the key and index in String format. Returns a null or empty string (if value is null and isNullToInitialise() is true) if the key or value does not exist.- Parameters:
key
- Stringindex
- int- Returns:
- String
-
getString
public java.lang.String getString(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in String format. Returns a null or empty string (if value is null and isNullToInitialise() is true) if the key or value does not exist.- Parameters:
keyIndex
- intindex
- int- Returns:
- String
- See Also:
getKeyWithIndex(int)
,getString(Object, int)
-
getBoolean
public boolean getBoolean(java.lang.Object key, int index)
Return the value corresponding to the key and index in boolean form. Returns LRuntimeException or 0 (if value is null and isNullToInitialise() is true) if key or value does not exist.
If value exists, type-casting will occur only if value is Boolean or String, otherwise MRuntimeException will occur.- Parameters:
key
- Objectindex
- int- Returns:
- boolean
-
getBoolean
public boolean getBoolean(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in boolean form. Returns LRuntimeException or 0 (if value is null and isNullToInitialise() is true) if key or value does not exist.
If value exists, type-casting occurs only if value is Boolean or String, otherwise MRuntimeException will occur.- Parameters:
keyIndex
- intindex
- int- Returns:
- boolean
- See Also:
getKeyWithIndex(int)
,getBoolean(Object, int)
-
getInt
public int getInt(java.lang.Object key, int index)
Return the value corresponding to the key and index in int. Returns MRuntimeException or 0 (if value is null and isNullToInitialise() is true) if key or value does not exist.
If value exists, type-casting will occur only if value is Number or String, otherwise MRuntimeException will occur.- Parameters:
key
- Objectindex
- int- Returns:
- int
-
getInt
public int getInt(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in int form. Returns LRuntimeException or 0 (if value is null and isNullToInitialise() is true) if key or value does not exist.
If value exists, type-casting will occur only if value is Number or String, otherwise MRuntimeException will occur.- Parameters:
keyIndex
- intindex
- int- Returns:
- int
- See Also:
getKeyWithIndex(int)
,getInt(Object, int)
-
getDouble
public double getDouble(java.lang.Object key, int index)
Return the value corresponding to the key and index in double. Returns MRuntimeException or 0.0D (if value is null and isNullToInitialise() is true) if key or value does not exist.
If value exists, type-casting occurs only if value is Number or String, otherwise MRuntimeException will occur.- Parameters:
key
- Objectindex
- int- Returns:
- double
-
getDouble
public double getDouble(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in double. Returns MRuntimeException or 0.0D (value is null and isNullToInitialise() is true.) if the key or value does not exist
If value exists, type-casting will occur only if value is Number or String, otherwise MRuntimeException will occur.- Parameters:
keyIndex
- intindex
- int- Returns:
- double
- See Also:
getKeyWithIndex(int)
,getDouble(Object, int)
-
getFloat
public float getFloat(java.lang.Object key, int index)
Return the value corresponding to the key and index in float form. Returns MRuntimeException or 0.0F (if value is null and isNullToInitialize() is true) if key or value does not exist.
If value exists, type-casting occurs only if value is Number or String, otherwise MRuntimeException will occur.- Parameters:
key
- Objectindex
- int- Returns:
- float
-
getFloat
public float getFloat(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in float. Return MRuntimeException or 0.0F (if value is null and isNullToInitialise() is true). if no key or value exists
If value exists, type-casting occurs only if value is Number or String, otherwise LRuntimeException will occur.- Parameters:
keyIndex
- intindex
- int- Returns:
- float
- See Also:
getKeyWithIndex(int)
,getFloat(Object, int)
-
getLong
public long getLong(java.lang.Object key, int index)
Return the value corresponding to the key and index in long format. Returns MRuntimeException or 0L (if value is null and isNullToInitialise() is true) if key or value does not exist.
If value exists, type-casting occurs only if value is Number or String, otherwise MRuntimeException will occur.- Parameters:
key
- Objectindex
- int- Returns:
- long
-
getLong
public long getLong(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in long format. Returns MRuntimeException or 0L (if value is null and isNullToInitialise() is true) if key or value does not exist.
If value exists, type-casting occurs only if value is Number or String, otherwise MRuntimeException will occur.- Parameters:
keyIndex
- intindex
- int- Returns:
- long
- See Also:
getKeyWithIndex(int)
,getLong(Object, int)
-
getShort
public short getShort(java.lang.Object key, int index)
Return the value corresponding to the key and index in a short form. Returns MRuntimeException or 0 (if value is null and isNullToInitialise() is true) if key or value does not exist.
If value exists, type-casting will occur only briefly if value is Number or String, otherwise MRuntimeException will occur.- Parameters:
key
- Objectindex
- int- Returns:
- short
-
getShort
public short getShort(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in a short format. Returns MRuntimeException or 0 (if value is null and isNullToInitialise() is true) if key or value does not exist.
If value exists, type-casting will occur only if value is Number or String, otherwise MRuntimeException will occur.- Parameters:
keyIndex
- intindex
- int- Returns:
- short
- See Also:
getKeyWithIndex(int)
,getShort(Object, int)
-
getBigDecimal
public java.math.BigDecimal getBigDecimal(java.lang.Object key, int index)
Return the value corresponding to the key and index in the BegDecimal format. If the key or value does not exist, then MRuntimeException or BigDecimal (0) (if value is null and isNullToInitialize() is true).< br > If value is present, type-casting will occur only if value is BigDecimal, otherwise MRuntimeException will occur.- Parameters:
key
- Objectindex
- int- Returns:
- BigDecimal
-
getBigDecimal
public java.math.BigDecimal getBigDecimal(int keyIndex, int index)
Return the value corresponding to the keyIndex and index in BegDecimal format. If the key or value does not exist, then MRuntimeException or BigDecimal(0) (if value is null and isNullToInitialize () is true).< br > If value is present, type-casting will occur only if value is BigDecimal, otherwise MRuntimeException will occur.- Parameters:
keyIndex
- intindex
- int- Returns:
- BigDecimal
- See Also:
getKeyWithIndex(int)
,getBigDecimal(Object, int)
-
getDataCount
public int getDataCount()
-
getSolo
public Solo getSolo(int key)
-
addSList
public void addSList(SList Solo)
-
addSListNoClone
public void addSListNoClone(SList Solo)
-
addSoloNoClone
public void addSoloNoClone(Solo data)
-
getKeyCount
public int getKeyCount()
This method returns the number of keys that make up the SList.- Returns:
- int
-
getDataCount
public int getDataCount(java.lang.Object key)
Returns the size (total number of rows) corresponding to the key present in the SList. If the key does not exist, it returns 0. SList key size(row)- Returns:
- int
- See Also:
getDataCount()
-
containsKey
public boolean containsKey(java.lang.Object key)
Check if key exists- Parameters:
key
- target key- Returns:
- true - exist false - not exist
-
containsKey
public boolean containsKey(int index, java.lang.Object key)
Check if key exists- Parameters:
index
- indexkey
- target key- Returns:
- true - exist false - not exist
-
-