public void removeLast() { //TODO: add specific test for synchronization of this block (it is tested by InvocationContainerImplTest at the moment) synchronized (invocations) { if (! invocations.isEmpty()) { invocations.removeLast(); } } }
/** * Ensures that the MRU list will have a MaxSize. */ protected void setMaxSize(int maxSize) { if (maxSize < _mruFileList.size()) { for (int i = 0; i < _mruFileList.size() - maxSize; i++) { _mruFileList.removeLast(); } } _maxSize = maxSize; } //--------------------------------------------------------------------------
public void outAMultiArgList(AMultiArgList node) { List<Value> l = (List<Value>) mProductions.removeLast(); l.add(0, (Value) mProductions.removeLast()); mProductions.addLast(l); }
private static void addToReversePostOrderListIterative(DirectNode root, List<DirectNode> lst) { LinkedList<DirectNode> stackNode = new LinkedList<>(); LinkedList<Integer> stackIndex = new LinkedList<>(); HashSet<DirectNode> setVisited = new HashSet<>(); stackNode.add(root); stackIndex.add(0); while (!stackNode.isEmpty()) { DirectNode node = stackNode.getLast(); int index = stackIndex.removeLast(); setVisited.add(node); for (; index < node.succs.size(); index++) { DirectNode succ = node.succs.get(index); if (!setVisited.contains(succ)) { stackIndex.add(index + 1); stackNode.add(succ); stackIndex.add(0); break; } } if (index == node.succs.size()) { lst.add(0, node); stackNode.removeLast(); } } }
public void add(T t, float score, T source) { int j = add(t,score); if(j>=k) return; evidences.add(j,source); if(evidences.size()>k) evidences.removeLast(); }
boolean addedBe = false; boolean addedSuffix = false; if (body.size() > 1 && !"PRP".equals(body.get(0).tag())) { for (int i = 2; i < body.size(); ++i) { CoreLabel tokI = body.get(i); if (tokI.tag() != null && i += 1; body.add(i, suffix.get(0)); addedSuffix = true; body.add(prepNum.get(0)); body.add(WORD_IN); body.add(prepNum.get(1)); if (beIter.hasNext() && body.getLast() == beIter.next()) { body.removeLast(); body.addLast(WORD_MISSING);
while (!preTerms.isEmpty() && isPunc(preTerms.getFirst())) { newChildren.add(preTerms.getFirst()); preTerms.removeFirst(); LinkedList<Tree> temp = new LinkedList<>(); if (newChild.children().length > 0) { newChildren.add(newChild); while (!preTerms.isEmpty() && isPunc(preTerms.getLast())) { temp.addFirst(preTerms.getLast()); preTerms.removeLast(); while (!newChildren.isEmpty() && isPunc(newChildren.getFirst())) { newChildren.removeFirst(); while (!newChildren.isEmpty() && isPunc(newChildren.getLast())) { newChildren.removeLast();
/** * 转换LIST * @param val */ private void convertList(List<?> val){ if(paths.size() <= 0){ paths.add("[]"); }else{ paths.addLast(paths.removeLast() + "[]"); } for(int i = 0; i < val.size(); i++){ arrayIndex.addLast(i); each(val.get(i)); arrayIndex.removeLast(); } }
void openedFile(File f) { // Verify and remove if the same file is already in the list: recentFiles.remove(f); // Now, add: recentFiles.addFirst(f); // Remove the least recently used file from list: if(recentFiles.size() == 11) { // store only 10 recent files! recentFiles.removeLast(); } }
public void outABaseNonvoidType(ABaseNonvoidType node) { Type t = (Type) mProductions.removeLast(); int dim = node.getArrayBrackets().size(); if (dim > 0) { t = ArrayType.v(t, dim); } mProductions.addLast(t); }
public RegionPath(String pathName) { regionPath = pathName; String[] regions = pathName.split(Region.SEPARATOR); LinkedList<String> regionsNames = new LinkedList<>(); for (String region : regions) { if (!region.isEmpty()) { regionsNames.add(region); } } regionName = regionsNames.removeLast(); StringBuilder parentPathBuilder = new StringBuilder(); while (!regionsNames.isEmpty()) { parentPathBuilder.append(Region.SEPARATOR).append(regionsNames.removeFirst()); } regionParentPath = parentPathBuilder.length() != 0 ? parentPathBuilder.toString() : null; }
public static List<SimpleEntry<Integer, String>> encode_direct(List<String> list) { LinkedList<SimpleEntry<Integer, String>> result = new LinkedList<>(); String lastElem = null; for (String elem : list) { if (Objects.equals(lastElem, elem)) { SimpleEntry<Integer, String> last = result.removeLast(); result.add(new SimpleEntry<>(last.getKey() + 1, elem)); } else { result.add(new SimpleEntry<>(1, elem)); lastElem = elem; } } return result; }
ll.addLast(o2); ll.removeFirst(); ll.removeLast(); ll.add(o1); ll.remove(0); ll.addLast(o2); ll.removeFirst(); ll.removeLast(); ll.add(o1); ll.remove(0); ll.addLast(o2); ll.removeFirst(); ll.removeLast(); ll.add(o1); ll.remove(0);
private void closeExpression(QueryTranslatorImpl q, String lcToken) { if ( booleanTests.removeLast() ) { //it was a boolean expression if ( booleanTests.size() > 0 ) { // the next one up must also be booleanTests.removeLast(); booleanTests.addLast( Boolean.TRUE ); } // Add any joins appendToken( q, ( joins.removeLast() ).toString() ); } else { StringBuilder join = joins.removeLast(); joins.getLast().append( join.toString() ); } if ( nots.removeLast() ) { negated = !negated; } if ( !")".equals( lcToken ) ) { appendToken( q, ")" ); } }
if ( pathElements.isEmpty() ) pathElements.removeLast(); pathElements.addLast( token ); while ( !pathElements.isEmpty() ) if ( !pathElements.isEmpty() )
if ( totalWriteCount == 0 && waitingThreadList.size() > 0 ) LockRequest lockRequest = waitingThreadList.removeLast(); lockRequest.waitingThread.interrupt(); if ( lockRequest.lockType == LockType.WRITE ) while ( !waitingThreadList.isEmpty() );
Edge last = partialPath.getLast(); partialPath.add(outEdge); work(partialPath); partialPath.removeLast();
if ( !waitingThreadList.isEmpty() ) LockRequest lockRequest = waitingThreadList.getLast(); waitingThreadList.removeLast(); lockRequest.waitingThread.interrupt(); waitingThreadList.removeLast(); lockRequest.waitingThread.interrupt();
public void popImplicitThis() { implicitThisStack.removeLast(); this.implicitThis = implicitThisStack.getLast(); }