Example usage for org.apache.commons.lang3.mutable Mutable getValue

List of usage examples for org.apache.commons.lang3.mutable Mutable getValue

Introduction

In this page you can find the example usage for org.apache.commons.lang3.mutable Mutable getValue.

Prototype

T getValue();

Source Link

Document

Gets the value of this mutable.

Usage

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.PlanPrettyPrinter.java

public static void printPlan(ILogicalPlan plan, StringBuilder out, LogicalOperatorPrettyPrintVisitor pvisitor,
        int indent) throws AlgebricksException {
    for (Mutable<ILogicalOperator> root : plan.getRoots()) {
        printOperator((AbstractLogicalOperator) root.getValue(), out, pvisitor, indent);
    }// w  w w  .  j a v a 2 s . c o  m
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities.java

public static void getUsedVariablesInDescendantsAndSelf(ILogicalOperator op, Collection<LogicalVariable> vars)
        throws AlgebricksException {
    // DFS traversal
    VariableUtilities.getUsedVariables(op, vars);
    for (Mutable<ILogicalOperator> c : op.getInputs()) {
        getUsedVariablesInDescendantsAndSelf(c.getValue(), vars);
    }//from   w w  w  . j  a  v a  2  s.  co  m
}

From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.ComplexJoinInferenceRule.java

/** clean up joins that have one input branch that is empty tuple source */
private static void cleanupJoins(Mutable<ILogicalOperator> opRef) {
    if (opRef.getValue() instanceof AbstractBinaryJoinOperator) {
        for (Mutable<ILogicalOperator> inputRef : opRef.getValue().getInputs()) {
            if (inputRef.getValue().getOperatorTag() == LogicalOperatorTag.EMPTYTUPLESOURCE) {
                opRef.getValue().getInputs().remove(inputRef);
                opRef.setValue(opRef.getValue().getInputs().get(0).getValue());
                break;
            }//  w w w.j  a  v  a2  s.c o  m
        }
    }
    for (Mutable<ILogicalOperator> inputRef : opRef.getValue().getInputs()) {
        cleanupJoins(inputRef);
    }
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities.java

public static void getProducedVariablesInDescendantsAndSelf(ILogicalOperator op,
        Collection<LogicalVariable> vars) throws AlgebricksException {
    // DFS traversal
    VariableUtilities.getProducedVariables(op, vars);
    for (Mutable<ILogicalOperator> c : op.getInputs()) {
        getProducedVariablesInDescendantsAndSelf(c.getValue(), vars);
    }//from ww w. ja  v a 2  s .c om
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.PlanPrettyPrinter.java

public static void printPhysicalOps(ILogicalPlan plan, StringBuilder out, int indent) {
    for (Mutable<ILogicalOperator> root : plan.getRoots()) {
        printPhysicalOperator((AbstractLogicalOperator) root.getValue(), indent, out);
    }/*ww  w  . j  a  v a  2  s .c  o m*/
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.PlanPrettyPrinter.java

public static void printOperator(AbstractLogicalOperator op, StringBuilder out,
        LogicalOperatorPrettyPrintVisitor pvisitor, int indent) throws AlgebricksException {
    out.append(op.accept(pvisitor, indent));
    IPhysicalOperator pOp = op.getPhysicalOperator();

    if (pOp != null) {
        out.append("\n");
        pad(out, indent);/* ww w .j  a  v a2  s . co  m*/
        appendln(out, "-- " + pOp.toString() + "  |" + op.getExecutionMode() + "|");
    } else {
        appendln(out, " -- |" + op.getExecutionMode() + "|");
    }

    for (Mutable<ILogicalOperator> i : op.getInputs()) {
        printOperator((AbstractLogicalOperator) i.getValue(), out, pvisitor, indent + 2);
    }

}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities.java

public static void substituteVariablesInDescendantsAndSelf(ILogicalOperator op, LogicalVariable v1,
        LogicalVariable v2, ITypingContext ctx) throws AlgebricksException {
    for (Mutable<ILogicalOperator> childOp : op.getInputs()) {
        substituteVariablesInDescendantsAndSelf(childOp.getValue(), v1, v2, ctx);
    }//from  w ww.  j av a  2s.co m
    substituteVariables(op, v1, v2, true, ctx);
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.PlanPrettyPrinter.java

public static void printPhysicalOperator(AbstractLogicalOperator op, int indent, StringBuilder out) {
    IPhysicalOperator pOp = op.getPhysicalOperator();
    pad(out, indent);//from w w w . j ava 2 s .c o m
    appendln(out, "-- " + pOp.toString() + "  |" + op.getExecutionMode() + "|");
    if (op.hasNestedPlans()) {
        AbstractOperatorWithNestedPlans opNest = (AbstractOperatorWithNestedPlans) op;
        for (ILogicalPlan p : opNest.getNestedPlans()) {
            pad(out, indent + 8);
            appendln(out, "{");
            printPhysicalOps(p, out, indent + 10);
            pad(out, indent + 8);
            appendln(out, "}");
        }
    }

    for (Mutable<ILogicalOperator> i : op.getInputs()) {
        printPhysicalOperator((AbstractLogicalOperator) i.getValue(), indent + 2, out);
    }

}

From source file:edu.uci.ics.hyracks.algebricks.rewriter.util.PhysicalOptimizationsUtil.java

private static void computeFDsAndEqClassesWithVisitorRec(AbstractLogicalOperator op, IOptimizationContext ctx,
        FDsAndEquivClassesVisitor visitor, Set<ILogicalOperator> visitSet) throws AlgebricksException {
    visitSet.add(op);//from w  ww  .  j a v  a  2 s . co  m
    for (Mutable<ILogicalOperator> i : op.getInputs()) {
        computeFDsAndEqClassesWithVisitorRec((AbstractLogicalOperator) i.getValue(), ctx, visitor, visitSet);
    }
    if (op.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);
    if (AlgebricksConfig.DEBUG) {
        AlgebricksConfig.ALGEBRICKS_LOGGER
                .fine("--> op. type = " + op.getOperatorTag() + "\n" + "    equiv. classes = "
                        + ctx.getEquivalenceClassMap(op) + "\n" + "    FDs = " + ctx.getFDList(op) + "\n");
    }
}

From source file:edu.uci.ics.asterix.om.typecomputer.base.TypeComputerUtilities.java

public static boolean inputInferednullableType(ILogicalExpression expression, IVariableTypeEnvironment env)
        throws AlgebricksException {
    AbstractFunctionCallExpression func = (AbstractFunctionCallExpression) expression;
    if (!(func instanceof ScalarFunctionCallExpression)) {
        return true;
    }/*from w ww  . j a va  2 s.  co m*/
    List<Mutable<ILogicalExpression>> args = func.getArguments();
    for (Mutable<ILogicalExpression> arg : args) {
        IAType type = (IAType) env.getType(arg.getValue());
        if (type.getTypeTag() == ATypeTag.UNION || type.getTypeTag() == ATypeTag.NULL
                || type.getTypeTag() == ATypeTag.ANY) {
            return true;
        }
        if (type.getTypeTag() == ATypeTag.RECORD || type.getTypeTag() == ATypeTag.UNORDEREDLIST
                || type.getTypeTag() == ATypeTag.ORDEREDLIST) {
            if (nullableCompositeType(type)) {
                return true;
            }
        }
    }
    return false;
}