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 voidadd(java.lang.String key, java.lang.Object value)Set the value of the object type in the corresponding key value.voidaddSList(SList Solo)voidaddSListNoClone(SList Solo)voidaddSolo(Solo Solo)voidaddSoloNoClone(Solo data)booleancontainsKey(int index, java.lang.Object key)Check if key existsbooleancontainsKey(java.lang.Object key)Check if key existsjava.lang.Objectget(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.Objectget(java.lang.Object key, int index)Return the value corresponding to the key and index in the form of an object.java.math.BigDecimalgetBigDecimal(int keyIndex, int index)Return the value corresponding to the keyIndex and index in BegDecimal format.java.math.BigDecimalgetBigDecimal(java.lang.Object key, int index)Return the value corresponding to the key and index in the BegDecimal format.booleangetBoolean(int keyIndex, int index)Return the value corresponding to the keyIndex and index in boolean form.booleangetBoolean(java.lang.Object key, int index)Return the value corresponding to the key and index in boolean form.intgetDataCount()intgetDataCount(java.lang.Object key)Returns the size (total number of rows) corresponding to the key present in the SList.doublegetDouble(int keyIndex, int index)Return the value corresponding to the keyIndex and index in double.doublegetDouble(java.lang.Object key, int index)Return the value corresponding to the key and index in double.floatgetFloat(int keyIndex, int index)Return the value corresponding to the keyIndex and index in float.floatgetFloat(java.lang.Object key, int index)Return the value corresponding to the key and index in float form.intgetInt(int keyIndex, int index)Return the value corresponding to the keyIndex and index in int form.intgetInt(java.lang.Object key, int index)Return the value corresponding to the key and index in int.intgetKeyCount()This method returns the number of keys that make up the SList.java.lang.Object[]getKeys()java.lang.ObjectgetKeyWithIndex(int keyIndex)java.lang.ObjectgetKeyWithIndex(int keyIndex, int index)Returns the key object corresponding to the index.longgetLong(int keyIndex, int index)Return the value corresponding to the keyIndex and index in long format.longgetLong(java.lang.Object key, int index)Return the value corresponding to the key and index in long format.shortgetShort(int keyIndex, int index)Return the value corresponding to the keyIndex and index in a short format.shortgetShort(java.lang.Object key, int index)Return the value corresponding to the key and index in a short form.SologetSolo(int key)java.lang.StringgetString(int keyIndex, int index)Return the value corresponding to the keyIndex and index in String format.java.lang.StringgetString(java.lang.Object key, int index)Return the value corresponding to the key and index in String format.booleanisNullToInitialize()voidmodify(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.voidmodifyBigDecimal(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.voidmodifyBoolean(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.voidmodifyDouble(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.voidmodifyFloat(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.voidmodifyInt(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.voidmodifyLong(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.voidmodifyShort(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.voidmodifyString(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.voidput(java.lang.Object key, java.util.List l)voidputAll(java.util.List m)voidremoveColumn(java.lang.String key)Delete the data (column) for a given key.voidremoveRow(int keyIndex)Delete the data (row) for a given key.voidsetNullToInitialize(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
-
-