Skip to content

Instantly share code, notes, and snippets.

@Jingbang-liu-lix
Jingbang-liu-lix / EvalTree.java
Created November 7, 2019 18:07
Tree Implementation
public class EvalTree<T> implements AbstractEvalTree<T> {
/**
* All nodes in the evaluation tree. Root node is the first element of the array with 0th index.
*\
*/
AbstractEvalNode[] _nodes;
/**
* Length of list of children of a node in {@link #_nodes}.
* <code>_childCounts[i]</code> corresponds to number of children of <code>_nodes[i]</code>
@Jingbang-liu-lix
Jingbang-liu-lix / Specification.json
Created October 1, 2019 17:29
Specification Example
{
"operations" :[{
"grammarId" : "interface-locale",
"description" : "Implementation of <code>interface-locale</code> operation of Lix DSL",
"externalDoc" : "The interface-locale field is a UI setting chosen by each member which controls which language the LinkedIn user interface renders in. Members can change it any time. NOTE: There is another selector, locale, which is the property set at the time of registration and user can never change it. See go/lixfaq more details.",
"category" : "member-profile",
"predefinedValueResourceName" : "locales",
"predefinedImplementation" : {
"com.linkedin.lix.dsl.v2.grammar.data.UserAndEntityContextsReadOperationData" : {
"userCtxPropertyName" : "interface-locale",
@Jingbang-liu-lix
Jingbang-liu-lix / EvalNode.java
Created October 1, 2019 01:32
Evaluation Node Example
class EvalNode<RETURN_TYPE> {
List<EvalNode> children = new ArrayList<>();
RETURN_TYPE compute(DslExecutionContext context, AbstractEvalTree tree, int thisNodePosition);
}
@Jingbang-liu-lix
Jingbang-liu-lix / AbstractEvalNode.java
Created October 1, 2019 01:31
Evaluation Tree Node
public interface AbstractEvalNode<RETURN_TYPE> {
RETURN_TYPE compute(DslExecutionContext context, AbstractEvalTree tree, int thisNodePosition);
}
@Jingbang-liu-lix
Jingbang-liu-lix / AbstractEvalTree.java
Last active January 3, 2020 23:05
Evaluation Tree Example
public interface AbstractEvalTree {
int size();
Object computeNode(int nodePosition, DslExecutionContext context);
AbstractEvalNode getRoot();
AbstractEvalNode getNode(int nodePosition);
IntList getChildPositions(int parentNodePosition);
int getChildListOffset(int nodeId);
int getChildCount(int nodePosition);