org.apache.commons.lang3.mutable.Mutable Java Examples
The following examples show how to use
org.apache.commons.lang3.mutable.Mutable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntroduceIndexingRule.java From vxquery with Apache License 2.0 | 6 votes |
@Override public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { VXQueryOptimizationContext vxqueryContext = (VXQueryOptimizationContext) context; String args[] = getFunctionalArguments(opRef, VXQueryCommons.indexingFunctions); if (args != null) { String collection = args[0]; // Build the new operator and update the query plan. int collectionId = vxqueryContext.newCollectionId(); VXQueryIndexingDataSource ids = VXQueryIndexingDataSource.create(collectionId, collection, SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR), functionCall.getFunctionIdentifier().getName()); if (ids != null) { ids.setTotalDataSources(vxqueryContext.getTotalDataSources()); // Known to be true because of collection name. return setDataSourceScan(ids, opRef); } } return false; }
Example #2
Source File: InMemoryNodeModel.java From commons-configuration with Apache License 2.0 | 6 votes |
/** * Allows tracking all nodes selected by a key. This method evaluates the * specified key on the current nodes structure. For all selected nodes * corresponding {@code NodeSelector} objects are created, and they are * tracked. The returned collection of {@code NodeSelector} objects can be * used for interacting with the selected nodes. * * @param key the key for selecting the nodes to track * @param resolver the {@code NodeKeyResolver} * @return a collection with the {@code NodeSelector} objects for the new * tracked nodes */ public Collection<NodeSelector> selectAndTrackNodes(final String key, final NodeKeyResolver<ImmutableNode> resolver) { final Mutable<Collection<NodeSelector>> refSelectors = new MutableObject<>(); boolean done; do { final TreeData current = structure.get(); final List<ImmutableNode> nodes = resolver.resolveNodeKey(current.getRootNode(), key, current); if (nodes.isEmpty()) { return Collections.emptyList(); } done = structure.compareAndSet( current, createSelectorsForTrackedNodes(refSelectors, nodes, current, resolver)); } while (!done); return refSelectors.getValue(); }
Example #3
Source File: PushAggregateIntoGroupbyRule.java From vxquery with Apache License 2.0 | 6 votes |
private void rewriteGroupByAggregate(LogicalVariable oldAggVar, GroupByOperator gbyOp, AggregateFunctionCallExpression aggFun, LogicalVariable newAggVar, IOptimizationContext context) throws AlgebricksException { for (int j = 0; j < gbyOp.getNestedPlans().size(); j++) { AggregateOperator aggOp = (AggregateOperator) gbyOp.getNestedPlans().get(j).getRoots().get(0).getValue(); int n = aggOp.getVariables().size(); for (int i = 0; i < n; i++) { LogicalVariable v = aggOp.getVariables().get(i); if (v.equals(oldAggVar)) { AbstractFunctionCallExpression oldAggExpr = (AbstractFunctionCallExpression) aggOp.getExpressions() .get(i).getValue(); AggregateFunctionCallExpression newAggFun = new AggregateFunctionCallExpression( aggFun.getFunctionInfo(), false, new ArrayList<Mutable<ILogicalExpression>>()); for (Mutable<ILogicalExpression> arg : oldAggExpr.getArguments()) { ILogicalExpression cloned = ((AbstractLogicalExpression) arg.getValue()).cloneExpression(); newAggFun.getArguments().add(new MutableObject<ILogicalExpression>(cloned)); } aggOp.getVariables().add(newAggVar); aggOp.getExpressions().add(new MutableObject<ILogicalExpression>(newAggFun)); context.computeAndSetTypeEnvironmentForOperator(aggOp); break; } } } }
Example #4
Source File: PushIndexingIntoDatascanRule.java From vxquery with Apache License 2.0 | 6 votes |
public void findChildren(VXQueryIndexingDataSource ids, Mutable<ILogicalExpression> expression) { List<Mutable<ILogicalExpression>> children = new ArrayList<>(); List<Mutable<ILogicalExpression>> valueEqch = new ArrayList<>(); ExpressionToolbox.findAllFunctionExpressions(expression, BuiltinOperators.GENERAL_EQ.getFunctionIdentifier(), valueEqch); if (valueEqch.isEmpty()) { ExpressionToolbox.findAllFunctionExpressions(expression, AlgebricksBuiltinFunctions.EQ, valueEqch); if (valueEqch.isEmpty()) { return; } } ExpressionToolbox.findAllFunctionExpressions(valueEqch.get(valueEqch.size() - 1), BuiltinOperators.CHILD.getFunctionIdentifier(), children); for (int i = children.size(); i > 0; --i) { int typeId = ExpressionToolbox.getTypeExpressionTypeArgument(children.get(i - 1)); if (typeId > 0) { ElementType it = (ElementType) dCtx.lookupSequenceType(typeId).getItemType(); ElementType et = ElementType.ANYELEMENT; if (it.getContentType().equals(et.getContentType())) { ids.addIndexChildSeq(typeId); } } } findAttributes(ids, valueEqch.get(valueEqch.size() - 1)); }
Example #5
Source File: PushGroupByThroughProduct.java From vxquery with Apache License 2.0 | 6 votes |
private void push(Mutable<ILogicalOperator> opRefGby, Mutable<ILogicalOperator> opRefJoin, int branch, List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> decorToPush, List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> decorNotToPush, IOptimizationContext context) throws AlgebricksException { GroupByOperator gby = (GroupByOperator) opRefGby.getValue(); AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) opRefJoin.getValue(); gby.getDecorList().clear(); gby.getDecorList().addAll(decorToPush); for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : decorNotToPush) { LogicalVariable v1 = p.first; if (v1 != null) { VariableReferenceExpression varRef = (VariableReferenceExpression) p.second.getValue(); LogicalVariable v2 = varRef.getVariableReference(); OperatorManipulationUtil.substituteVarRec(join, v2, v1, true, context); } } Mutable<ILogicalOperator> branchRef = join.getInputs().get(branch); ILogicalOperator opBranch = branchRef.getValue(); opRefJoin.setValue(opBranch); branchRef.setValue(gby); opRefGby.setValue(join); }
Example #6
Source File: InMemoryNodeModel.java From commons-configuration with Apache License 2.0 | 6 votes |
/** * Creates tracked node entries for the specified nodes and creates the * corresponding selectors. * * @param refSelectors the reference where to store the selectors * @param nodes the nodes to be tracked * @param current the current {@code TreeData} object * @param resolver the {@code NodeKeyResolver} * @return the updated {@code TreeData} object */ private static TreeData createSelectorsForTrackedNodes( final Mutable<Collection<NodeSelector>> refSelectors, final List<ImmutableNode> nodes, final TreeData current, final NodeKeyResolver<ImmutableNode> resolver) { final List<NodeSelector> selectors = new ArrayList<>(nodes.size()); final Map<ImmutableNode, String> cache = new HashMap<>(); for (final ImmutableNode node : nodes) { selectors.add(new NodeSelector(resolver.nodeKey(node, cache, current))); } refSelectors.setValue(selectors); final NodeTracker newTracker = current.getNodeTracker().trackNodes(selectors, nodes); return current.updateNodeTracker(newTracker); }
Example #7
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 6 votes |
public static Mutable<ILogicalExpression> findVariableExpression(Mutable<ILogicalExpression> mutableLe, LogicalVariable lv) { ILogicalExpression le = mutableLe.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.VARIABLE) { VariableReferenceExpression vre = (VariableReferenceExpression) le; if (vre.getVariableReference() == lv) { return mutableLe; } } else if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; for (Mutable<ILogicalExpression> argExp : afce.getArguments()) { Mutable<ILogicalExpression> resultLe = findVariableExpression(argExp, lv); if (resultLe != null) { return resultLe; } } } return null; }
Example #8
Source File: OperatorToolbox.java From vxquery with Apache License 2.0 | 6 votes |
public static Mutable<ILogicalExpression> getExpressionOf(Mutable<ILogicalOperator> opRef, LogicalVariable lv) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); switch (op.getOperatorTag()) { case AGGREGATE: case ASSIGN: case RUNNINGAGGREGATE: AbstractAssignOperator aao = (AbstractAssignOperator) op; if (!aao.getVariables().contains(lv)) { return null; } return aao.getExpressions().get(aao.getVariables().indexOf(lv)); case UNNEST: case UNNEST_MAP: AbstractUnnestOperator ano = (AbstractUnnestOperator) op; return ano.getExpressionRef(); default: // TODO Not yet implemented. break; } return null; }
Example #9
Source File: PushChildIntoDataScanRule.java From vxquery with Apache License 2.0 | 6 votes |
@Override boolean updateDataSource(IVXQueryDataSource datasource, Mutable<ILogicalExpression> expression) { List<Mutable<ILogicalExpression>> finds = new ArrayList<Mutable<ILogicalExpression>>(); boolean added = false; ExpressionToolbox.findAllFunctionExpressions(expression, BuiltinOperators.CHILD.getFunctionIdentifier(), finds); for (int i = finds.size(); i > 0; --i) { int typeId = ExpressionToolbox.getTypeExpressionTypeArgument(finds.get(i - 1)); if (typeId > 0) { ElementType it = (ElementType) dCtx.lookupSequenceType(typeId).getItemType(); ElementType et = ElementType.ANYELEMENT; if (it.getContentType().equals(et.getContentType())) { datasource.addChildSeq(typeId); added = true; } } } return added; }
Example #10
Source File: AbstractUsedVariablesProcessingRule.java From vxquery with Apache License 2.0 | 6 votes |
@Override public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { if (hasRun && !firstOpRef.equals(opRef)) { return false; } else { firstOpRef = opRef; } boolean modified = false; boolean modified_last_pass; do { usedVariables.clear(); modified_last_pass = rewritePreTrackingUsedVariables(opRef, context); if (modified_last_pass) { modified = modified_last_pass; } } while (modified_last_pass); hasRun = true; return modified; }
Example #11
Source File: ConvertToAlgebricksExpressionsRule.java From vxquery with Apache License 2.0 | 6 votes |
public boolean convertFunctionToAlgebricksExpression(Mutable<ILogicalExpression> searchM, AbstractFunctionCallExpression functionCall, IOptimizationContext context, Map<FunctionIdentifier, FunctionIdentifier> map) { if (map.containsKey(functionCall.getFunctionIdentifier())) { IExpressionAnnotation annotate = new ExpressionAnnotationNoCopyImpl(); annotate.setObject(functionCall.getFunctionIdentifier()); FunctionIdentifier algebricksFid = map.get(functionCall.getFunctionIdentifier()); IFunctionInfo algebricksFunction = context.getMetadataProvider().lookupFunction(algebricksFid); functionCall.setFunctionInfo(algebricksFunction); functionCall.getAnnotations().put(ALGEBRICKS_CONVERSION_ANNOTATION, annotate); searchM.setValue(functionCall); return true; } return false; }
Example #12
Source File: MethodUtilsTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testGetAccessibleInterfaceMethodFromDescription() throws Exception { Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null }; for (Class<?>[] element : p) { Method accessibleMethod = MethodUtils.getAccessibleMethod( TestMutable.class, "getValue", element); assertSame(Mutable.class, accessibleMethod.getDeclaringClass()); } }
Example #13
Source File: PushFunctionsOntoEqJoinBranches.java From vxquery with Apache License 2.0 | 5 votes |
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); } }
Example #14
Source File: PushKeysOrMembersIntoDatascanRule.java From vxquery with Apache License 2.0 | 5 votes |
@Override boolean updateDataSource(IVXQueryDataSource datasource, Mutable<ILogicalExpression> expression) { AbstractVXQueryDataSource ds = (AbstractVXQueryDataSource) datasource; boolean added = false; BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable(); List<Mutable<ILogicalExpression>> findkeys = new ArrayList<Mutable<ILogicalExpression>>(); ExpressionToolbox.findAllFunctionExpressions(expression, BuiltinOperators.KEYS_OR_MEMBERS.getFunctionIdentifier(), findkeys); for (int i = findkeys.size(); i > 0; --i) { XDMConstants.setTrue(bp); ds.addValueSeq(ArrayUtils.toObject(bp.getByteArray())); added = true; } return added; }
Example #15
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 5 votes |
/** * Finds all functions for a given expression. * * @param mutableLe * Search logical expression * @param finds * Logical expressions found */ public static void findAllFunctionExpressions(Mutable<ILogicalExpression> mutableLe, List<Mutable<ILogicalExpression>> finds) { ILogicalExpression le = mutableLe.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; finds.add(mutableLe); for (Mutable<ILogicalExpression> argExp : afce.getArguments()) { findAllFunctionExpressions(argExp, finds); } } }
Example #16
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 5 votes |
public static List<ILogicalExpression> getFullArguments(Mutable<ILogicalExpression> searchM) { AbstractFunctionCallExpression searchFunction = (AbstractFunctionCallExpression) searchM.getValue(); ArrayList<ILogicalExpression> args = new ArrayList<ILogicalExpression>(); for (int i = 0; i < searchFunction.getArguments().size(); i++) { args.add(searchFunction.getArguments().get(i).getValue()); } return args; }
Example #17
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 5 votes |
/** * Finds all functions for a given expression and function identifier. * * @param mutableLe * Search logical expression * @param fi * Function indentifier * @param finds * Logical expressions found */ public static void findAllFunctionExpressions(Mutable<ILogicalExpression> mutableLe, FunctionIdentifier fi, List<Mutable<ILogicalExpression>> finds) { ILogicalExpression le = mutableLe.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; if (afce.getFunctionIdentifier().equals(fi)) { finds.add(mutableLe); } for (Mutable<ILogicalExpression> argExp : afce.getArguments()) { findAllFunctionExpressions(argExp, fi, finds); } } }
Example #18
Source File: PushValueIntoDatascanRule.java From vxquery with Apache License 2.0 | 5 votes |
@Override boolean updateDataSource(IVXQueryDataSource datasource, Mutable<ILogicalExpression> expression) { if (datasource.usingIndex()) { return false; } VXQueryCollectionDataSource ds = (VXQueryCollectionDataSource) datasource; boolean added = false; List<Mutable<ILogicalExpression>> finds = new ArrayList<Mutable<ILogicalExpression>>(); ILogicalExpression le = expression.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; if (afce.getFunctionIdentifier().equals(BuiltinFunctions.FN_ZERO_OR_ONE_1.getFunctionIdentifier())) { return false; } } ExpressionToolbox.findAllFunctionExpressions(expression, BuiltinOperators.VALUE.getFunctionIdentifier(), finds); for (int i = finds.size(); i > 0; --i) { Byte[] value = null; List<ILogicalExpression> values = ExpressionToolbox.getFullArguments(finds.get(i - 1)); if (values.size() > 1) { value = ExpressionToolbox.getConstantArgument(finds.get(i - 1), 1); ds.addValueSeq(value); added = true; } } return added; }
Example #19
Source File: ConvertAssignSortDistinctNodesToOperatorsRule.java From vxquery with Apache License 2.0 | 5 votes |
private UnnestOperator getUnnestOperator(LogicalVariable inputVariable, LogicalVariable unnestVariable) { VariableReferenceExpression inputVre = new VariableReferenceExpression(inputVariable); List<Mutable<ILogicalExpression>> iterateArgs = new ArrayList<Mutable<ILogicalExpression>>(); iterateArgs.add(new MutableObject<ILogicalExpression>(inputVre)); ILogicalExpression unnestExp = new UnnestingFunctionCallExpression(BuiltinOperators.ITERATE, iterateArgs); Mutable<ILogicalExpression> unnestExpRef = new MutableObject<ILogicalExpression>(unnestExp); return new UnnestOperator(unnestVariable, unnestExpRef); }
Example #20
Source File: AbstractCollectionRule.java From vxquery with Apache License 2.0 | 5 votes |
private String getArgument(AbstractFunctionCallExpression functionCall, Mutable<ILogicalOperator> opRef, int pos) { VXQueryConstantValue constantValue; ILogicalExpression logicalExpression2 = functionCall.getArguments().get(pos).getValue(); if (logicalExpression2.getExpressionTag() != LogicalExpressionTag.VARIABLE) { return null; } else if (logicalExpression2 == null) { return null; } VariableReferenceExpression vre = (VariableReferenceExpression) logicalExpression2; Mutable<ILogicalOperator> opRef3 = OperatorToolbox.findProducerOf(opRef, vre.getVariableReference()); // Get the string assigned to the collection function. AbstractLogicalOperator op3 = (AbstractLogicalOperator) opRef3.getValue(); if (op3.getOperatorTag() == LogicalOperatorTag.ASSIGN) { AssignOperator assign2 = (AssignOperator) op3; // Check to see if the expression is a constant expression and type string. ILogicalExpression logicalExpression3 = assign2.getExpressions().get(0).getValue(); if (logicalExpression3.getExpressionTag() != LogicalExpressionTag.CONSTANT) { return null; } ConstantExpression constantExpression = (ConstantExpression) logicalExpression3; constantValue = (VXQueryConstantValue) constantExpression.getValue(); if (constantValue.getType() != SequenceType.create(BuiltinTypeRegistry.XS_STRING, Quantifier.QUANT_ONE)) { return null; } } else { return null; } // Constant value is now in a TaggedValuePointable. Convert the value into a java String. tvp.set(constantValue.getValue(), 0, constantValue.getValue().length); if (tvp.getTag() == ValueTag.XS_STRING_TAG) { tvp.getValue(stringp); return stringp.toString(); } return null; }
Example #21
Source File: ConvertFromAlgebricksExpressionsRule.java From vxquery with Apache License 2.0 | 5 votes |
@Override public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { boolean modified = false; List<Mutable<ILogicalExpression>> expressions = OperatorToolbox.getExpressions(opRef); for (Mutable<ILogicalExpression> expression : expressions) { if (processExpression(opRef, expression)) { modified = true; } } context.computeAndSetTypeEnvironmentForOperator(opRef.getValue()); return modified; }
Example #22
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 5 votes |
public static void findVariableExpressions(Mutable<ILogicalExpression> mutableLe, List<Mutable<ILogicalExpression>> finds) { ILogicalExpression le = mutableLe.getValue(); if (le.getExpressionTag() == LogicalExpressionTag.VARIABLE) { finds.add(mutableLe); } else if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) { AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le; for (Mutable<ILogicalExpression> argExp : afce.getArguments()) { findVariableExpressions(argExp, finds); } } }
Example #23
Source File: PushAggregateIntoGroupbyRule.java From vxquery with Apache License 2.0 | 5 votes |
@Override public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { Map<LogicalVariable, Integer> gbyAggVars = new HashMap<LogicalVariable, Integer>(); Map<LogicalVariable, Integer> gbyAggVarToPlanIndex = new HashMap<LogicalVariable, Integer>(); Map<LogicalVariable, GroupByOperator> gbyWithAgg = new HashMap<LogicalVariable, GroupByOperator>(); Map<ILogicalExpression, ILogicalExpression> aggExprToVarExpr = new HashMap<ILogicalExpression, ILogicalExpression>(); // first collect vars. referring to listified sequences boolean changed = collectVarsBottomUp(opRef, context, gbyAggVars, gbyWithAgg, gbyAggVarToPlanIndex, aggExprToVarExpr); if (changed) { removeRedundantListifies(opRef, context, gbyAggVars, gbyWithAgg, gbyAggVarToPlanIndex); } return changed; }
Example #24
Source File: MethodUtilsTest.java From astor with GNU General Public License v2.0 | 5 votes |
public void testGetAccessibleInterfaceMethod() throws Exception { Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null }; for (int i = 0; i < p.length; i++) { Method method = TestMutable.class.getMethod("getValue", p[i]); Method accessibleMethod = MethodUtils.getAccessibleMethod(method); assertNotSame(accessibleMethod, method); assertSame(Mutable.class, accessibleMethod.getDeclaringClass()); } }
Example #25
Source File: OperatorToolbox.java From vxquery with Apache License 2.0 | 5 votes |
public static List<Mutable<ILogicalExpression>> getExpressions(Mutable<ILogicalOperator> opRef) { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); List<Mutable<ILogicalExpression>> result = new ArrayList<Mutable<ILogicalExpression>>(); switch (op.getOperatorTag()) { case AGGREGATE: case ASSIGN: case RUNNINGAGGREGATE: AbstractAssignOperator aao = (AbstractAssignOperator) op; result.addAll(aao.getExpressions()); break; case INNERJOIN: case LEFTOUTERJOIN: AbstractBinaryJoinOperator abjo = (AbstractBinaryJoinOperator) op; result.add(abjo.getCondition()); break; case SELECT: SelectOperator so = (SelectOperator) op; result.add(so.getCondition()); break; case UNNEST: case UNNEST_MAP: AbstractUnnestOperator auo = (AbstractUnnestOperator) op; result.add(auo.getExpressionRef()); break; default: // TODO Not yet implemented. break; } return result; }
Example #26
Source File: ConvertFromAlgebricksExpressionsRule.java From vxquery with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private boolean convertAlgebricksExpression(Mutable<ILogicalExpression> searchM, IFunctionInfo funcInfo, boolean isBoolean) { AbstractFunctionCallExpression searchFunction = (AbstractFunctionCallExpression) searchM.getValue(); searchFunction.setFunctionInfo(funcInfo); if (isBoolean) { ScalarFunctionCallExpression functionCallExp = new ScalarFunctionCallExpression( BuiltinFunctions.FN_BOOLEAN_1, new MutableObject<ILogicalExpression>(searchM.getValue())); searchM.setValue(functionCallExp); } return true; }
Example #27
Source File: ConvertFromAlgebricksExpressionsRule.java From vxquery with Apache License 2.0 | 5 votes |
private boolean processExpression(Mutable<ILogicalOperator> opRef, Mutable<ILogicalExpression> search) { boolean modified = false; functionList.clear(); ExpressionToolbox.findAllFunctionExpressions(search, functionList); for (Mutable<ILogicalExpression> searchM : functionList) { searchFunction = (AbstractFunctionCallExpression) searchM.getValue(); if (ALGEBRICKS_MAP.containsKey(searchFunction.getFunctionIdentifier())) { FunctionIdentifier fid = searchFunction.getFunctionIdentifier(); if (ALGEBRICKS_MAP.get(fid).first == null) { modified = convertAlgebricksExpression(searchM, ALGEBRICKS_MAP.get(fid).second, false); } else if (ALGEBRICKS_MAP.get(fid).second == null) { modified = convertAlgebricksExpression(searchM, ALGEBRICKS_MAP.get(fid).first, true); } else { IExpressionAnnotation annotate = searchFunction.getAnnotations().get( ALGEBRICKS_CONVERSION_ANNOTATION); if (((FunctionIdentifier) annotate.getObject()).equals(ALGEBRICKS_MAP.get(fid).first .getFunctionIdentifier())) { modified = convertAlgebricksExpression(searchM, ALGEBRICKS_MAP.get(fid).first, true); } else if (((FunctionIdentifier) annotate.getObject()).equals(ALGEBRICKS_MAP.get(fid).second .getFunctionIdentifier())) { modified = convertAlgebricksExpression(searchM, ALGEBRICKS_MAP.get(fid).second, false); } } } } return modified; }
Example #28
Source File: ConfigValues.java From SkyblockAddons with MIT License | 5 votes |
private <N extends Number> void deserializeNumber(Mutable<Number> number, String path, Class<N> numberClass) { try { if (settingsConfig.has(path)) { number.setValue(getNumber(settingsConfig.get(path), numberClass)); } } catch (Exception ex) { SkyblockAddons.getInstance().getLogger().error("Failed to deserialize path: "+ path); ex.printStackTrace(); } }
Example #29
Source File: ExpressionToolbox.java From vxquery with Apache License 2.0 | 5 votes |
public static boolean isFunctionExpression(Mutable<ILogicalExpression> mutableLe, AbstractFunctionCallExpression afce) { ILogicalExpression le = mutableLe.getValue(); if (le.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) { return false; } AbstractFunctionCallExpression fc = (AbstractFunctionCallExpression) le; if (!fc.getFunctionIdentifier().equals(afce)) { return false; } return true; }
Example #30
Source File: MethodUtilsTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testGetAccessibleInterfaceMethodFromDescription() throws Exception { Class<?>[][] p = { ArrayUtils.EMPTY_CLASS_ARRAY, null }; for (Class<?>[] element : p) { Method accessibleMethod = MethodUtils.getAccessibleMethod( TestMutable.class, "getValue", element); assertSame(Mutable.class, accessibleMethod.getDeclaringClass()); } }