Class ListExp
Exp
.
The bin expression argument in these methods can be a reference to a bin or the result of another expression. Expressions that modify bin values are only used for temporary expression evaluation and are not permanently applied to the bin.
List modify expressions return the bin's value. This value will be a list except when the list is nested within a map. In that case, a map is returned for the list modify expression.
List expressions support negative indexing. If the index is negative, the resolved index starts backwards from end of list. If an index is out of bounds, a parameter error will be returned. If a range is partially out of bounds, the valid part of the range will be returned. Index/Range examples:
- Index 0: First item in list.
- Index 4: Fifth item in list.
- Index -1: Last item in list.
- Index -3: Third to last item in list.
- Index 1 Count 2: Second and third items in list.
- Index -3 Count 3: Last three items in list.
- Index -5 Count 4: Range between fifth to last item to second to last item inclusive.
Nested expressions are supported by optional CTX context arguments. Example:
- bin = [[7,9,5],[1,2,3],[6,5,4,1]]
- Get size of last list.
- ListExp.size(Exp.listBin("bin"), CTX.listIndex(-1))
- result = 4
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Exp
append
(ListPolicy policy, Exp value, Exp bin, CTX... ctx) Create expression that appends value to end of list.static Exp
appendItems
(ListPolicy policy, Exp list, Exp bin, CTX... ctx) Create expression that appends list items to end of list.static Exp
Create expression that removes all items in list.static Exp
getByIndex
(int returnType, Exp.Type valueType, Exp index, Exp bin, CTX... ctx) Create expression that selects list item identified by index and returns selected data specified by returnType.static Exp
getByIndexRange
(int returnType, Exp index, Exp bin, CTX... ctx) Create expression that selects list items starting at specified index to the end of list and returns selected data specified by returnType (SeeListReturnType
).static Exp
getByIndexRange
(int returnType, Exp index, Exp count, Exp bin, CTX... ctx) Create expression that selects "count" list items starting at specified index and returns selected data specified by returnType (SeeListReturnType
).static Exp
Create expression that selects list item identified by rank and returns selected data specified by returnType.static Exp
getByRankRange
(int returnType, Exp rank, Exp bin, CTX... ctx) Create expression that selects list items starting at specified rank to the last ranked item and returns selected data specified by returnType (SeeListReturnType
).static Exp
getByRankRange
(int returnType, Exp rank, Exp count, Exp bin, CTX... ctx) Create expression that selects "count" list items starting at specified rank and returns selected data specified by returnType (SeeListReturnType
).static Exp
getByValue
(int returnType, Exp value, Exp bin, CTX... ctx) Create expression that selects list items identified by value and returns selected data specified by returnType.static Exp
getByValueList
(int returnType, Exp values, Exp bin, CTX... ctx) Create expression that selects list items identified by values and returns selected data specified by returnType.static Exp
getByValueRange
(int returnType, Exp valueBegin, Exp valueEnd, Exp bin, CTX... ctx) Create expression that selects list items identified by value range and returns selected data specified by returnType.static Exp
getByValueRelativeRankRange
(int returnType, Exp value, Exp rank, Exp bin, CTX... ctx) Create expression that selects list items nearest to value and greater by relative rank and returns selected data specified by returnType (SeeListReturnType
).static Exp
Create expression that selects list items nearest to value and greater by relative rank with a count limit and returns selected data specified by returnType (SeeListReturnType
).static Exp
Create expression that increments list[index] by value.static Exp
Create expression that inserts value to specified index of list.static Exp
insertItems
(ListPolicy policy, Exp index, Exp list, Exp bin, CTX... ctx) Create expression that inserts each input list item starting at specified index of list.static Exp
removeByIndex
(Exp index, Exp bin, CTX... ctx) Create expression that removes list item identified by index.static Exp
removeByIndexRange
(int returnType, Exp index, Exp bin, CTX... ctx) Create expression that removes list items starting at specified index to the end of list.static Exp
removeByIndexRange
(int returnType, Exp index, Exp count, Exp bin, CTX... ctx) Create expression that removes "count" list items starting at specified index.static Exp
removeByRank
(Exp rank, Exp bin, CTX... ctx) Create expression that removes list item identified by rank.static Exp
removeByRankRange
(int returnType, Exp rank, Exp bin, CTX... ctx) Create expression that removes list items starting at specified rank to the last ranked item.static Exp
removeByRankRange
(int returnType, Exp rank, Exp count, Exp bin, CTX... ctx) Create expression that removes "count" list items starting at specified rank.static Exp
removeByValue
(int returnType, Exp value, Exp bin, CTX... ctx) Create expression that removes list items identified by value.static Exp
removeByValueList
(int returnType, Exp values, Exp bin, CTX... ctx) Create expression that removes list items identified by values.static Exp
removeByValueRange
(int returnType, Exp valueBegin, Exp valueEnd, Exp bin, CTX... ctx) Create expression that removes list items identified by value range (valueBegin inclusive, valueEnd exclusive).static Exp
removeByValueRelativeRankRange
(int returnType, Exp value, Exp rank, Exp bin, CTX... ctx) Create expression that removes list items nearest to value and greater by relative rank.static Exp
Create expression that removes list items nearest to value and greater by relative rank with a count limit.static Exp
Create expression that sets item value at specified index in list.static Exp
Create expression that returns list size.static Exp
Create expression that sorts list according to sortFlags.
-
Constructor Details
-
ListExp
public ListExp()
-
-
Method Details
-
append
Create expression that appends value to end of list. -
appendItems
Create expression that appends list items to end of list. -
insert
Create expression that inserts value to specified index of list. -
insertItems
Create expression that inserts each input list item starting at specified index of list. -
increment
Create expression that increments list[index] by value. Value expression should resolve to a number. -
set
Create expression that sets item value at specified index in list. -
clear
Create expression that removes all items in list. -
sort
Create expression that sorts list according to sortFlags.- Parameters:
sortFlags
- sort flags. SeeListSortFlags
.bin
- bin or list value expressionctx
- optional context path for nested CDT
-
removeByValue
Create expression that removes list items identified by value. Valid returnType values areListReturnType.NONE
orListReturnType.INVERTED
. -
removeByValueList
Create expression that removes list items identified by values. Valid returnType values areListReturnType.NONE
orListReturnType.INVERTED
. -
removeByValueRange
public static Exp removeByValueRange(int returnType, Exp valueBegin, Exp valueEnd, Exp bin, CTX... ctx) Create expression that removes list items identified by value range (valueBegin inclusive, valueEnd exclusive). If valueBegin is null, the range is less than valueEnd. If valueEnd is null, the range is greater than equal to valueBegin. Valid returnType values areListReturnType.NONE
orListReturnType.INVERTED
. -
removeByValueRelativeRankRange
public static Exp removeByValueRelativeRankRange(int returnType, Exp value, Exp rank, Exp bin, CTX... ctx) Create expression that removes list items nearest to value and greater by relative rank. Valid returnType values areListReturnType.NONE
orListReturnType.INVERTED
.Examples for ordered list [0,4,5,9,11,15]:
- (value,rank) = [removed items]
- (5,0) = [5,9,11,15]
- (5,1) = [9,11,15]
- (5,-1) = [4,5,9,11,15]
- (3,0) = [4,5,9,11,15]
- (3,3) = [11,15]
- (3,-3) = [0,4,5,9,11,15]
-
removeByValueRelativeRankRange
public static Exp removeByValueRelativeRankRange(int returnType, Exp value, Exp rank, Exp count, Exp bin, CTX... ctx) Create expression that removes list items nearest to value and greater by relative rank with a count limit. Valid returnType values areListReturnType.NONE
orListReturnType.INVERTED
.Examples for ordered list [0,4,5,9,11,15]:
- (value,rank,count) = [removed items]
- (5,0,2) = [5,9]
- (5,1,1) = [9]
- (5,-1,2) = [4,5]
- (3,0,1) = [4]
- (3,3,7) = [11,15]
- (3,-3,2) = []
-
removeByIndex
Create expression that removes list item identified by index. -
removeByIndexRange
Create expression that removes list items starting at specified index to the end of list. Valid returnType values areListReturnType.NONE
orListReturnType.INVERTED
. -
removeByIndexRange
Create expression that removes "count" list items starting at specified index. Valid returnType values areListReturnType.NONE
orListReturnType.INVERTED
. -
removeByRank
Create expression that removes list item identified by rank. -
removeByRankRange
Create expression that removes list items starting at specified rank to the last ranked item. Valid returnType values areListReturnType.NONE
orListReturnType.INVERTED
. -
removeByRankRange
Create expression that removes "count" list items starting at specified rank. Valid returnType values areListReturnType.NONE
orListReturnType.INVERTED
. -
size
Create expression that returns list size.// List bin "a" size > 7 Exp.gt(ListExp.size(Exp.listBin("a")), Exp.val(7))
-
getByValue
Create expression that selects list items identified by value and returns selected data specified by returnType.// List bin "a" contains at least one item == "abc" ListExp.getByValue(ListReturnType.EXISTS, Exp.val("abc"), Exp.listBin("a"))
- Parameters:
returnType
- metadata attributes to return. SeeListReturnType
value
- search expressionbin
- list bin or list value expressionctx
- optional context path for nested CDT
-
getByValueRange
public static Exp getByValueRange(int returnType, Exp valueBegin, Exp valueEnd, Exp bin, CTX... ctx) Create expression that selects list items identified by value range and returns selected data specified by returnType.// List bin "a" items >= 10 && items < 20 ListExp.getByValueRange(ListReturnType.VALUE, Exp.val(10), Exp.val(20), Exp.listBin("a"))
- Parameters:
returnType
- metadata attributes to return. SeeListReturnType
valueBegin
- begin expression inclusive. If null, range is less than valueEnd.valueEnd
- end expression exclusive. If null, range is greater than equal to valueBegin.bin
- bin or list value expressionctx
- optional context path for nested CDT
-
getByValueList
Create expression that selects list items identified by values and returns selected data specified by returnType. -
getByValueRelativeRankRange
public static Exp getByValueRelativeRankRange(int returnType, Exp value, Exp rank, Exp bin, CTX... ctx) Create expression that selects list items nearest to value and greater by relative rank and returns selected data specified by returnType (SeeListReturnType
).Examples for ordered list [0,4,5,9,11,15]:
- (value,rank) = [selected items]
- (5,0) = [5,9,11,15]
- (5,1) = [9,11,15]
- (5,-1) = [4,5,9,11,15]
- (3,0) = [4,5,9,11,15]
- (3,3) = [11,15]
- (3,-3) = [0,4,5,9,11,15]
-
getByValueRelativeRankRange
public static Exp getByValueRelativeRankRange(int returnType, Exp value, Exp rank, Exp count, Exp bin, CTX... ctx) Create expression that selects list items nearest to value and greater by relative rank with a count limit and returns selected data specified by returnType (SeeListReturnType
).Examples for ordered list [0,4,5,9,11,15]:
- (value,rank,count) = [selected items]
- (5,0,2) = [5,9]
- (5,1,1) = [9]
- (5,-1,2) = [4,5]
- (3,0,1) = [4]
- (3,3,7) = [11,15]
- (3,-3,2) = []
-
getByIndex
Create expression that selects list item identified by index and returns selected data specified by returnType.// a[3] == 5 Exp.eq( ListExp.getByIndex(ListReturnType.VALUE, Exp.Type.INT, Exp.val(3), Exp.listBin("a")), Exp.val(5));
- Parameters:
returnType
- metadata attributes to return. SeeListReturnType
valueType
- expected type of return valueindex
- list index expressionbin
- list bin or list value expressionctx
- optional context path for nested CDT
-
getByIndexRange
Create expression that selects list items starting at specified index to the end of list and returns selected data specified by returnType (SeeListReturnType
). -
getByIndexRange
Create expression that selects "count" list items starting at specified index and returns selected data specified by returnType (SeeListReturnType
). -
getByRank
Create expression that selects list item identified by rank and returns selected data specified by returnType.// Player with lowest score. ListExp.getByRank(ListReturnType.VALUE, Type.STRING, Exp.val(0), Exp.listBin("a"))
- Parameters:
returnType
- metadata attributes to return. SeeListReturnType
valueType
- expected type of return valuerank
- rank expressionbin
- list bin or list value expressionctx
- optional context path for nested CDT
-
getByRankRange
Create expression that selects list items starting at specified rank to the last ranked item and returns selected data specified by returnType (SeeListReturnType
). -
getByRankRange
Create expression that selects "count" list items starting at specified rank and returns selected data specified by returnType (SeeListReturnType
).
-