本文整理汇总了Java中org.apache.commons.lang3.mutable.Mutable.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Mutable.getValue方法的具体用法?Java Mutable.getValue怎么用?Java Mutable.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.mutable.Mutable
的用法示例。
在下文中一共展示了Mutable.getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: substituteVarRec
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
public static void substituteVarRec(AbstractLogicalOperator op, LogicalVariable v1, LogicalVariable v2,
boolean goThroughNts, ITypingContext ctx) throws AlgebricksException {
VariableUtilities.substituteVariables(op, v1, v2, goThroughNts, ctx);
for (Mutable<ILogicalOperator> opRef2 : op.getInputs()) {
substituteVarRec((AbstractLogicalOperator) opRef2.getValue(), v1, v2, goThroughNts, ctx);
}
if (op.getOperatorTag() == LogicalOperatorTag.NESTEDTUPLESOURCE && goThroughNts) {
NestedTupleSourceOperator nts = (NestedTupleSourceOperator) op;
if (nts.getDataSourceReference() != null) {
AbstractLogicalOperator op2 = (AbstractLogicalOperator) nts.getDataSourceReference().getValue()
.getInputs().get(0).getValue();
substituteVarRec(op2, v1, v2, goThroughNts, ctx);
}
}
if (op.hasNestedPlans()) {
AbstractOperatorWithNestedPlans aonp = (AbstractOperatorWithNestedPlans) op;
for (ILogicalPlan p : aonp.getNestedPlans()) {
for (Mutable<ILogicalOperator> ref : p.getRoots()) {
AbstractLogicalOperator aop = (AbstractLogicalOperator) ref.getValue();
substituteVarRec(aop, v1, v2, goThroughNts, ctx);
}
}
}
}
示例2: computeDeliveredProperties
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
List<ILocalStructuralProperty> propsLocal = new LinkedList<ILocalStructuralProperty>();
GroupByOperator gOp = (GroupByOperator) op;
Set<LogicalVariable> columnSet = new ListSet<LogicalVariable>();
List<OrderColumn> ocs = new ArrayList<OrderColumn>();
if (!columnSet.isEmpty()) {
propsLocal.add(new LocalGroupingProperty(columnSet));
}
for (OrderColumn oc : orderColumns) {
ocs.add(oc);
}
propsLocal.add(new LocalOrderProperty(ocs));
for (ILogicalPlan p : gOp.getNestedPlans()) {
for (Mutable<ILogicalOperator> r : p.getRoots()) {
ILogicalOperator rOp = r.getValue();
propsLocal.addAll(rOp.getDeliveredPhysicalProperties().getLocalProperties());
}
}
ILogicalOperator op2 = op.getInputs().get(0).getValue();
IPhysicalPropertiesVector childProp = op2.getDeliveredPhysicalProperties();
deliveredProperties = new StructuralPropertiesVector(childProp.getPartitioningProperty(), propsLocal);
}
示例3: computeDeliveredProperties
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
IPhysicalPropertiesVector childsProperties = op2.getPhysicalOperator().getDeliveredProperties();
List<ILocalStructuralProperty> propsLocal = new ArrayList<ILocalStructuralProperty>();
if (childsProperties.getLocalProperties() != null) {
propsLocal.addAll(childsProperties.getLocalProperties());
}
// ... get local properties for newly created variables...
SubplanOperator subplan = (SubplanOperator) op;
for (ILogicalPlan plan : subplan.getNestedPlans()) {
for (Mutable<ILogicalOperator> r : plan.getRoots()) {
AbstractLogicalOperator rOp = (AbstractLogicalOperator) r.getValue();
propsLocal.addAll(rOp.getPhysicalOperator().getDeliveredProperties().getLocalProperties());
}
}
deliveredProperties = new StructuralPropertiesVector(childsProperties.getPartitioningProperty(), propsLocal);
}
示例4: findLastFunctionExpression
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
public static Mutable<ILogicalExpression> findLastFunctionExpression(Mutable<ILogicalExpression> mutableLe) {
ILogicalExpression le = mutableLe.getValue();
if (le.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
return null;
} else if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le;
for (Mutable<ILogicalExpression> argExp : afce.getArguments()) {
if (argExp.getValue().getExpressionTag() == LogicalExpressionTag.VARIABLE) {
return mutableLe;
}
Mutable<ILogicalExpression> resultLe = findLastFunctionExpression(argExp);
if (resultLe != null) {
return resultLe;
}
}
}
return null;
}
示例5: rewritePre
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
/**
* Eliminate Subplan above ETS
* and Subplan that has only ops. with one input and no free vars.
*/
@Override
public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
throws AlgebricksException {
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
if (op.getOperatorTag() != LogicalOperatorTag.SUBPLAN) {
return false;
}
SubplanOperator subplan = (SubplanOperator) op;
Mutable<ILogicalOperator> outerRef = subplan.getInputs().get(0);
AbstractLogicalOperator outerRefOp = (AbstractLogicalOperator) outerRef.getValue();
if (outerRefOp.getOperatorTag() == LogicalOperatorTag.EMPTYTUPLESOURCE) {
elimSubplanOverEts(opRef, context);
return true;
}
if (subplan.getNestedPlans().size() == 1 && subplan.getNestedPlans().get(0).getRoots().size() == 1
&& !OperatorPropertiesUtil.hasFreeVariables(subplan)) {
if (elimOneSubplanWithNoFreeVars(opRef)) {
return true;
}
}
return false;
}
示例6: computeFDsAndEqClassesWithVisitorRec
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
private static <R> void computeFDsAndEqClassesWithVisitorRec(ILogicalOperator op, IOptimizationContext ctx,
ILogicalOperatorVisitor<R, IOptimizationContext> visitor, Set<ILogicalOperator> visitSet)
throws AlgebricksException {
visitSet.add(op);
for (Mutable<ILogicalOperator> i : op.getInputs()) {
computeFDsAndEqClassesWithVisitorRec((AbstractLogicalOperator) i.getValue(), ctx, visitor, visitSet);
}
AbstractLogicalOperator aop = (AbstractLogicalOperator) op;
if (aop.hasNestedPlans()) {
for (ILogicalPlan p : ((AbstractOperatorWithNestedPlans) op).getNestedPlans()) {
for (Mutable<ILogicalOperator> r : p.getRoots()) {
AbstractLogicalOperator rootOp = (AbstractLogicalOperator) r.getValue();
computeFDsAndEqClassesWithVisitorRec(rootOp, ctx, visitor, visitSet);
}
}
}
if (op.getOperatorTag() == LogicalOperatorTag.NESTEDTUPLESOURCE) {
NestedTupleSourceOperator nts = (NestedTupleSourceOperator) op;
ILogicalOperator source = nts.getDataSourceReference().getValue().getInputs().get(0).getValue();
if (!visitSet.contains(source)) {
computeFDsAndEqClassesWithVisitorRec((AbstractLogicalOperator) source, ctx, visitor, visitSet);
}
}
op.accept(visitor, ctx);
}
示例7: getVariable
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public Object getVariable(String name) {
try {
Mutable<Object> variable = doGetVariable(name);
if (variable == null) {
throw new SpongeException("Variable '" + name + "' not found in any of the scripts");
}
return variable.getValue();
} catch (Throwable e) {
throw SpongeUtils.wrapException("getVariable", e);
}
}
示例8: getInputOperator
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
private Mutable<ILogicalOperator> getInputOperator(Mutable<ILogicalOperator> opRef) {
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
switch (op.getOperatorTag()) {
case SUBPLAN:
SubplanOperator subplan = (SubplanOperator) op;
return getInputOperator(subplan.getNestedPlans().get(0).getRoots().get(0));
case NESTEDTUPLESOURCE:
NestedTupleSourceOperator nts = (NestedTupleSourceOperator) op;
return getInputOperator(nts.getDataSourceReference());
default:
return opRef;
}
}
示例9: rewritePost
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
throws AlgebricksException {
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
if (op.getOperatorTag() != LogicalOperatorTag.ASSIGN) {
return false;
}
AssignOperator assignOp = (AssignOperator) op;
// Find a join operator below this assign.
Mutable<ILogicalOperator> joinOpRef = findJoinOp(assignOp.getInputs().get(0));
if (joinOpRef == null) {
return false;
}
AbstractBinaryJoinOperator joinOp = (AbstractBinaryJoinOperator) joinOpRef.getValue();
// Check if the assign uses a function that we wish to push below the join if possible.
funcExprs.clear();
gatherFunctionCalls(assignOp, funcExprs);
if (funcExprs.isEmpty()) {
return false;
}
// Try to push the functions down the input branches of the join.
boolean modified = false;
if (pushDownFunctions(joinOp, 0, funcExprs, context)) {
modified = true;
}
if (pushDownFunctions(joinOp, 1, funcExprs, context)) {
modified = true;
}
if (modified) {
context.computeAndSetTypeEnvironmentForOperator(joinOp);
}
return modified;
}
示例10: rewritePost
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) {
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
boolean changed = OperatorManipulationUtil.setOperatorMode(op);
if (op.getExecutionMode() == AbstractLogicalOperator.ExecutionMode.UNPARTITIONED
|| op.getExecutionMode() == AbstractLogicalOperator.ExecutionMode.LOCAL) {
return changed;
}
switch (op.getOperatorTag()) {
// case DISTINCT:
// case AGGREGATE:
// case GROUP:
// case ORDER:
// case INNERJOIN:
// case LEFTOUTERJOIN: {
// op.setExecutionMode(ExecutionMode.GLOBAL);
// return true;
// }
case PARTITIONINGSPLIT: {
throw new NotImplementedException();
}
default: {
return changed;
}
}
}
示例11: setNewOp
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
private void setNewOp(Mutable<ILogicalOperator> opRef, AbstractLogicalOperator newOp, IOptimizationContext context)
throws AlgebricksException {
ILogicalOperator oldOp = opRef.getValue();
opRef.setValue(newOp);
newOp.getInputs().add(new MutableObject<ILogicalOperator>(oldOp));
newOp.recomputeSchema();
newOp.computeDeliveredPhysicalProperties(context);
context.computeAndSetTypeEnvironmentForOperator(newOp);
AlgebricksConfig.ALGEBRICKS_LOGGER.finest(">>>> Structural properties for " + newOp.getPhysicalOperator() + ": "
+ newOp.getDeliveredPhysicalProperties() + "\n");
PhysicalOptimizationsUtil.computeFDsAndEquivalenceClasses(newOp, context);
}
示例12: worthMaterialization
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
protected boolean worthMaterialization(Mutable<ILogicalOperator> candidate) {
AbstractLogicalOperator aop = (AbstractLogicalOperator) candidate.getValue();
if (aop.getPhysicalOperator().expensiveThanMaterialization()) {
return true;
}
List<Mutable<ILogicalOperator>> inputs = candidate.getValue().getInputs();
for (Mutable<ILogicalOperator> inputRef : inputs) {
if (worthMaterialization(inputRef)) {
return true;
}
}
return false;
}
示例13: rewritePost
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
throws AlgebricksException {
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
if (op.getOperatorTag() != LogicalOperatorTag.INNERJOIN
&& op.getOperatorTag() != LogicalOperatorTag.LEFTOUTERJOIN) {
return false;
}
AbstractBinaryJoinOperator joinOp = (AbstractBinaryJoinOperator) op;
ILogicalExpression expr = joinOp.getCondition().getValue();
return assignFunctionExpressions(joinOp, expr, context);
}
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:16,代码来源:ExtractFunctionsFromJoinConditionRule.java
示例14: buildEventTree
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
/**
* Continues building the event tree for the incoming event starting at the specified node.
*
* @param node event tree node.
* @param event incoming event.
*/
protected void buildEventTree(TreeNode<NodeValue> node, Event event) {
// Check if this event is the first event that starts the rule instance.
boolean isFirstNode = (node == null);
// Create a new node for the incoming event and add to the event tree. This node may be removed later when the event doesn't match.
TreeNode<NodeValue> newNode = new TreeNode<>(new NodeValue(event));
if (isFirstNode) { // First event that starts the rule.
node = newNode;
// Add the new node to the event tree as root.
eventTree.setRoot(node);
} else {
// Recursively try to continue building the event tree, but only for modes FIRST, LAST and ALL.
node.getChildren().forEach(child -> {
// NONE events are processed in shouldAddToEventTreeForNMode(), not here.
if (adapter.getEventMode(getEventIndex(child)) != EventMode.NONE) {
buildEventTree(child, event);
}
});
// Return if reached the last level.
if (node.getLevel() + 1 >= adapter.getEventCount()) {
return;
}
// Add the new node to the event tree.
node.addChild(newNode);
}
boolean rememberEvent = false; // Should this event be added to the event tree in this place.
EventMode eventMode = getEventMode(newNode);
if (eventMode != null) {
switch (eventMode) {
case FIRST:
case LAST:
case ALL:
rememberEvent = shouldAddToEventTreeForFlaModes(newNode, event);
break;
case NONE:
Mutable<TreeNode<NodeValue>> newNodeHolder = new MutableObject<>(newNode);
rememberEvent = shouldAddToEventTreeForNMode(node, newNodeHolder, event);
newNode = newNodeHolder.getValue(); // shouldAddToEventTreeForNMode() may change newNode.
break;
default:
throw new SpongeException("Unsupported value: " + eventMode);
}
}
// Remove the node for the incoming event if the event doesn't match.
if (!rememberEvent) {
if (isFirstNode) {
eventTree.setRoot(null);
} else {
node.removeChild(newNode);
}
}
}
示例15: transform
import org.apache.commons.lang3.mutable.Mutable; //导入方法依赖的package包/类
@Override
public boolean transform(Mutable<ILogicalExpression> exprRef) throws AlgebricksException {
ILogicalExpression e = exprRef.getValue();
switch (((AbstractLogicalExpression) e).getExpressionTag()) {
case VARIABLE: {
LogicalVariable var = ((VariableReferenceExpression) e).getVariableReference();
// Restrict replacement to targetVar if it has been set.
if (targetVar != null && var != targetVar) {
return false;
}
// Make sure has not been excluded from inlining.
if (context.shouldNotBeInlined(var)) {
return false;
}
ILogicalExpression rhs = varAssignRhs.get(var);
if (rhs == null) {
// Variable was not produced by an assign.
return false;
}
// Make sure used variables from rhs are live.
if (liveVars.isEmpty()) {
VariableUtilities.getLiveVariables(op, liveVars);
}
rhsUsedVars.clear();
rhs.getUsedVariables(rhsUsedVars);
for (LogicalVariable rhsUsedVar : rhsUsedVars) {
if (!liveVars.contains(rhsUsedVar)) {
return false;
}
}
// Replace variable reference with a clone of the rhs expr.
exprRef.setValue(rhs.cloneExpression());
return true;
}
case FUNCTION_CALL: {
AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) e;
boolean modified = false;
for (Mutable<ILogicalExpression> arg : fce.getArguments()) {
if (transform(arg)) {
modified = true;
}
}
return modified;
}
default: {
return false;
}
}
}