@Override protected CollectionActionDispatcher<Positionable> _adapt( Pair<Vector3D, CollectionActionDispatcher<Positionable>> value) throws UnsupportedOperationException { return value.getValue(); }
List<Expression> getArgs(List<Pair<String, Expression>> args) { if (args == null) { return null; } List<Expression> ret = new ArrayList<Expression>(args.size()); for (Pair<String, Expression> p : args) { ret.add(p.getValue()); } return ret; }
@Override public Void call() throws Exception { for(Pair<Vector3D,CollectionActionDispatcher<Positionable>> relevancePair:relevancePairs){ Collection<Positionable> newCube = newCube(); newCube.addAll(relevancePair.getValue()); pairBuffer.put(relevancePair.getKey(),newCube); }//end for(relevanceCubes) return null; }}).get();}catch(Exception e){e.printStackTrace();} //Process non-everywhere cubes
@Override public boolean remove(Object o) { final Pair<KEY,E> pair = pairs.get(o); if(pair == null) if(!pairs.containsKey(o)) throw new ElementNotFoundException("Cannot remove `+o+`; was not present."); else assert false:"pair for "+o+" unexpectedly null!"; final E value = pair.getValue(); assert value != null; value .removePropertyChangeListener(elementPCL); pairs .remove(o); delegate.remove(pair); return true; }//end remove(...)
@Override public boolean add(Pair<KEY,E> e) { cache.add(e); if(!map.containsKey(e.getKey())){ final CollectionActionDispatcher<E> newCollection = new CollectionActionDispatcher<E>(new ArrayList<E>()); final Pair<KEY,CollectionActionDispatcher<E>> newPair = new Pair<KEY,CollectionActionDispatcher<E>>(e.getKey(),newCollection); map.put(e.getKey(),newPair); delegate.add(newPair); }//end (create new entry) return map.get(e.getKey()).getValue().add(e.getValue()); }//end add()
@Override public boolean remove(Object o) { if(! (o instanceof Pair)) return false; //if(!cache.remove(o)) // return false; Pair<KEY,CollectionActionDispatcher<E>> element = (Pair<KEY,CollectionActionDispatcher<E>>)o; final KEY key = element.getKey(); final Pair<KEY,CollectionActionDispatcher<E>> target = map.get(key); final CollectionActionDispatcher<E> targetCollection = target.getValue(); final CollectionActionDispatcher<E> dispatcher = element.getValue(); final boolean removeResult = dispatcher.removeTarget(targetCollection, true); assert removeResult; if(targetCollection.isEmpty()){ map.remove(key); final boolean result = delegate.remove(target); cache.remove(target); assert result; } return true; }//end remove(...)
@Override public boolean remove(Object o) { if(! (o instanceof Pair)) return false; if(!cache.remove(o)) return false; Pair<KEY,E> element = (Pair<KEY,E>)o; final KEY key = element.getKey(); final Pair<KEY,CollectionActionDispatcher<E>> target = map.get(key); final CollectionActionDispatcher<E> targetCollection = target.getValue(); final E value = element.getValue(); final boolean removeResult = targetCollection.remove(value); assert removeResult; if(targetCollection.isEmpty()){ map.remove(key); final boolean result = delegate.remove(target); assert result; } return true; }//end remove(...)
@Override public boolean add(Pair<KEY,CollectionActionDispatcher<E>> e) { if(!map.containsKey(e.getKey())){ final CollectionActionDispatcher<E> newCollection = new CollectionActionDispatcher<E>(new ArrayList<E>()); final Pair<KEY,CollectionActionDispatcher<E>> newPair = new Pair<KEY,CollectionActionDispatcher<E>>(e.getKey(),newCollection); map.put(e.getKey(),newPair); delegate.add(newPair); cache.add(newPair); }//end (create new entry) return e.getValue().addTarget(map.get(e.getKey()).getValue(), true); }//end add()
void replaceMalloc(TypeRef pointedType, Element toReplace, Expression sizeExpression) { // TODO handle casts and sizeof expressions ! Pair<TypeRef, Expression> typeAndSize = recognizeSizeOfMult(sizeExpression); if (typeAndSize != null && (pointedType == null || pointedType.equals(typeAndSize.getFirst()))) { String tStr = String.valueOf(typeAndSize.getFirst()); try { JavaPrim prim = JavaPrim.getJavaPrim(tStr); if (prim != null && prim.isPrimitive) { String cap = StringUtils.capitalize(tStr); toReplace.replaceBy(staticPtrMethod("allocate" + cap + "s", typeAndSize.getValue())); return; } } catch (Throwable th) { // Do nothing } } toReplace.replaceBy(staticPtrMethod("allocateBytes", sizeExpression)); }
for (Pair<OptionDef, List<String>> parsedArg : config.parsedArgs) { OptionDef opt = parsedArg.getKey(); List<String> switches = parsedArg.getValue(); switch (opt) { case OutputMode:
JavaPrim prim = result.typeConverter.getPrimitive(converted.getValue()); if ((prim == null || converted.getValue() == null) && signalErrors) { if (result.config.limitComments) { return null; } else if (prim != JavaPrim.Void && converted.getValue() != null) { TypeRef tr = converted.getValue(); Expression value = converted.getFirst(); if (result.config.castConstants && !alreadyConverted) {
for (Function alt : e.getValue().getValue()) { out.println(alt);
Expression.FunctionCall fc = (Expression.FunctionCall) x; if ("sizeof".equals(String.valueOf(fc.getFunction())) && fc.getArguments().size() == 1) { Expression.TypeRefExpression typeEx = SyntaxUtils.as(fc.getArguments().get(0).getValue(), Expression.TypeRefExpression.class); if (typeEx != null) { res = typed(sizeofToJava(typeEx.getType(), libraryClassName), typeRef(Integer.TYPE));
for (Pair<String, String> p : pair.getValue()) { if (p.getFirst() != null) { commentBits.add(p.getFirst()); nameBits.add(p.getValue()); for (Pair<String, String> p : pair.getValue()) { assignmentExpr = new Expression.AssignmentOp(memberRef(thisRef(), MemberRefStyle.Dot, ident(p.getValue())), AssignmentOperator.Equal, assignmentExpr);