/** * Note: Based on the KEY component of Pair<KEY,VALUE> * Different VALUEs have no effect. */ @Override public boolean contains(Object o) { if(! (o instanceof Pair)) return false; final Pair<KEY,CollectionActionDispatcher<E>> pair = (Pair<KEY,CollectionActionDispatcher<E>>)o; return map.containsKey(pair.getKey()); //return cache.contains(o); }
@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()
@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 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) { 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 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 evaluate( Pair<Vector3D, CollectionActionDispatcher<Positionable>> object) { final Vector3D cubePosition = object.getKey(); if(cubePosition.equals(World.RELEVANT_EVERYWHERE)) return true; //Rollover distance final double rolloverDistance = Math.sqrt( Math.pow(cubeRolloverDistance(cubePosition.getX()-centerCube.getX()),2)+ Math.pow(cubeRolloverDistance(cubePosition.getZ()-centerCube.getZ()),2)); return rolloverDistance < getRelevanceRadiusCubes(); }//end evaluate() }//end VisibilityPredicate
lines.add("// Generated by JNAerator (" + JNAERATOR_URL + ")"); for (Pair<OptionDef, List<String>> parsedArg : config.parsedArgs) { OptionDef opt = parsedArg.getKey(); List<String> switches = parsedArg.getValue(); switch (opt) {
PrintWriter out = newFileOverwriter(result.config.choicesOutFile); for (Map.Entry<String, Pair<Function, List<Function>>> e : result.declarationsConverter.functionAlternativesByNativeSignature.entrySet()) { Function f = e.getValue().getKey(); String ff = f.getElementFile(); if (ff != null) {
Element e = kv.getKey();