public final class Tuple
extends java.lang.Object
implements java.io.Serializable, jfun.util.Sizeable
Modifier and Type | Method and Description |
---|---|
Tuple |
addMap(java.util.Map m)
Creates a new tuple by adding the key-pair values with the key-pair value of this tuple.
|
Tuple |
addStrictFunction(java.lang.Object name,
Function f)
Add a strict function to this tuple as a member.
|
Tuple |
addValue(java.lang.Object v)
Add a value to this tuple as a member.
|
Tuple |
addValue(java.lang.Object name,
java.lang.Object v)
Add a value to this tuple as a member.
|
boolean |
containsKey(java.lang.Object key)
Determines if the tuple contains the provided key.
|
Tuple |
copy()
Create a deep copy of the Tuple.
|
boolean |
equals(java.lang.Object other) |
java.lang.Object |
eval(java.lang.Object name)
Evaluate a tuple member identified by name.
|
static Tuple |
extendsTuple(Tuple t1,
Tuple t2)
Same as t1 `extends` t2.
|
java.lang.Class |
getFamilyClass()
Get the java class represented by this tuple.
|
TupleMember |
getMember(java.lang.Object name)
Get the tuple member identified by name.
|
java.lang.Object |
getThis()
Get the java object represented by this tuple.
|
int |
hashCode() |
Tuple |
importClass(java.lang.Class type)
Import a java class and its public static nested classes
as a tuple under the class name.
|
Tuple |
importClass(java.lang.String fullname,
java.lang.Class type)
Import a java class and its public static nested classes
as a tuple.
|
Tuple |
importClassHierarchy(java.lang.Class type)
Import a java class and its public static nested classes
into the evaluation context.
|
Tuple |
importMember(java.lang.String fullname,
TupleMember tm)
Import a tuple member into this tuple.
|
static Tuple |
includesTuple(Tuple t1,
Tuple t2)
Same as t1 `includes` t2.
|
static Tuple |
instance()
To create an empty Tuple instance.
|
boolean |
isEmpty()
To determine if the tuple is empty.
|
java.lang.Object[] |
keys()
Get the keys of the Tuple.
|
java.lang.Object[] |
keys(java.lang.Object[] arr)
Get the keys of the Tuple and store them in the provided array.
|
TupleMember[] |
members()
Get the tuple members.
|
Tuple |
put(java.lang.Object name,
TupleMember v)
create a new Tuple object with the new TupleMember.
|
Tuple |
puts(java.lang.Object[] keys,
TupleMember[] mbrs)
Add tuple members under given names.
|
Tuple |
remove(java.lang.Object key)
Create a new Tuple by removing one member identified by a key.
|
Tuple |
removes(java.lang.Object[] keys)
Create a new Tuple by removing members identified by the array of keys.
|
int |
size()
Get the number of members in the tuple.
|
Tuple |
subtuple(java.lang.Object[] arr_flds)
Create a slice of this tuple.
|
java.lang.String |
toString()
If the tuple contains toString member, this member is evaluated.
|
static TupleMember |
valueMember(java.lang.Object v)
Create a TupleMember object that represents a value.
|
public java.lang.Class getFamilyClass()
public java.lang.Object getThis()
public Tuple copy()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public Tuple addMap(java.util.Map m)
m
- the map object.public static TupleMember valueMember(java.lang.Object v)
v
- the value.public Tuple puts(java.lang.Object[] keys, TupleMember[] mbrs)
keys
- the names of the members.mbrs
- the tuple member objects.public Tuple remove(java.lang.Object key)
key
- the key.public Tuple removes(java.lang.Object[] keys)
keys
- the keys.public java.lang.Object[] keys()
public java.lang.Object[] keys(java.lang.Object[] arr)
public TupleMember[] members()
public int size()
size
in interface jfun.util.Sizeable
public boolean isEmpty()
isEmpty
in interface jfun.util.Sizeable
public TupleMember getMember(java.lang.Object name)
name
- the member name.public boolean containsKey(java.lang.Object key)
key
- the key.public java.lang.Object eval(java.lang.Object name)
name
- the tuple name.public Tuple put(java.lang.Object name, TupleMember v)
name
- the name of the member.
If a member with this name already exists, it is overridden.v
- the tuple member.public Tuple addValue(java.lang.Object name, java.lang.Object v)
name
- the member name.v
- the value.public Tuple addValue(java.lang.Object v)
v
- the value.public Tuple addStrictFunction(java.lang.Object name, Function f)
name
- the member name.f
- the strict function.public Tuple importClass(java.lang.Class type)
type
- the java class.public Tuple importClass(java.lang.String fullname, java.lang.Class type)
fullname
- the fullname of the tuple.type
- the java class.public Tuple importClassHierarchy(java.lang.Class type)
type
- the java class.public Tuple importMember(java.lang.String fullname, TupleMember tm)
fullname
- the fully qualified name for this member.tm
- the tuple member.public java.lang.String toString()
toString
in class java.lang.Object
public static Tuple instance()
public static Tuple extendsTuple(Tuple t1, Tuple t2)
t1
- the 1st tuple.t2
- the 2nd tuple.public static Tuple includesTuple(Tuple t1, Tuple t2)
t1
- the 1st tuple.t2
- the 2nd tuple.public Tuple subtuple(java.lang.Object[] arr_flds)
arr_flds
- the fields to select.