public ArrayList<Integer> Solve(int[] A, int k) { ArrayList<Integer> res = new ArrayList<Integer>(); LinkedList<Element> list = new LinkedList<Element>(); list.offer(new Element(A[0], 0)); for (int i = 1; i < k; i++) { while (A[i] > list.peekLast().val) { list.pollLast(); if (list.size() == 0) break; } list.offer(new Element(A[i], i)); } for (int i = k; i < A.length; i++) { res.add(list.peek().val); if (i - list.peek().index == k) { list.poll(); } while (A[i] > list.peekLast().val) { list.pollLast(); if (list.size() == 0) break; } list.offer(new Element(A[i], i)); } res.add(list.peek().val); return res; }
/** To be discussed in Section 27.7 */ public Tree bfs(int v) { List<Integer> searchOrders = new ArrayList<Integer>(); int[] parent = new int[vertices.size()]; for (int i = 0; i < parent.length; i++) parent[i] = -1; // Initialize parent[i] to -1 java.util.LinkedList<Integer> queue = new java.util.LinkedList<Integer>(); // list used as a queue boolean[] isVisited = new boolean[vertices.size()]; queue.offer(v); // Enqueue v isVisited[v] = true; // Mark it visited while (!queue.isEmpty()) { int u = queue.poll(); // Dequeue to u searchOrders.add(u); // u searched for (int w : neighbors.get(u)) { if (!isVisited[w]) { queue.offer(w); // Enqueue w parent[w] = u; // The parent of w is u isVisited[w] = true; // Mark it visited } } } return new Tree(v, parent, searchOrders); }
@Override /** Starting bfs search from vertex v */ /** To be discussed in Section 28.7 */ public Tree bfs(int v) { List<Integer> searchOrder = new ArrayList<>(); int[] parent = new int[vertices.size()]; for (int i = 0; i < parent.length; i++) parent[i] = -1; // Initialize parent[i] to -1 java.util.LinkedList<Integer> queue = new java.util.LinkedList<>(); // list used as a queue boolean[] isVisited = new boolean[vertices.size()]; queue.offer(v); // Enqueue v isVisited[v] = true; // Mark it visited while (!queue.isEmpty()) { int u = queue.poll(); // Dequeue to u searchOrder.add(u); // u searched for (Edge e : neighbors.get(u)) { if (!isVisited[e.v]) { queue.offer(e.v); // Enqueue w parent[e.v] = u; // The parent of w is u isVisited[e.v] = true; // Mark it visited } } } return new Tree(v, parent, searchOrder); }
public void raiseTerrain() { boolean[][] prevContour = new boolean[m_width][m_height]; boolean[][] curContour = new boolean[m_width][m_height]; for (int x = 0; x < m_width; x++) { for (int y = 0; y < m_height; y++) { curContour[x][y] = (m_random.nextInt(100) <= 48); } } for (int count = 0; count < 4; count++) { System.arraycopy(curContour, 0, prevContour, 0, curContour.length); for (int x = 0; x < m_width; x++) { for (int y = 0; y < m_width; y++) { curContour[x][y] = simulateCell(prevContour, x, y); } } } int x = 0; int y = 0; boolean[][] visited = new boolean[m_width][m_height]; while (y < m_height) { LinkedList<Position> path = new LinkedList<Position>(); if (curContour[x][y]) { Position pos = new Position(x, y, 0); path.offer(pos); } else { m_contour[x][y] = -3; } int height = m_random.nextInt(6); PATH: while (path.size() > 0) { Position cur = path.remove(); if (visited[cur.getX()][cur.getY()]) continue PATH; if (!curContour[cur.getX()][cur.getY()]) continue PATH; visited[cur.getX()][cur.getY()] = true; m_contour[cur.getX()][cur.getY()] = height; if (cur.getX() > 0 && cur.getX() < m_width - 1) { path.offer(new Position(cur.getX() - 1, cur.getY(), 0)); path.offer(new Position(cur.getX() + 1, cur.getY(), 0)); } if (cur.getY() > 0 && cur.getY() < m_width - 1) { path.offer(new Position(cur.getX(), cur.getY() - 1, 0)); path.offer(new Position(cur.getX(), cur.getY() + 1, 0)); } } x++; if (x == m_height) { x = 0; y++; } } for (x = 0; x < m_width; x++) { for (y = 0; y < m_height; y++) { if (curContour[x][y]) averageArea(x, y, 2); } } }
/** * This method will find all reachable states that will be used when computing the value function. * This method will not do anything if all reachable states from the input state have been * discovered from previous calls to this method. * * @param si the source state from which all reachable states will be found * @return true if a reachability analysis had never been performed from this state; false * otherwise. */ public boolean performReachabilityFrom(State si) { HashableState sih = this.stateHash(si); // if this is not a new state and we are not required to perform a new reachability analysis, // then this method does not need to do anything. if (valueFunction.containsKey(sih)) { return false; // no need for additional reachability testing } DPrint.cl(this.debugCode, "Starting reachability analysis"); // add to the open list LinkedList<HashableState> openList = new LinkedList<HashableState>(); Set<HashableState> openedSet = new HashSet<HashableState>(); openList.offer(sih); openedSet.add(sih); while (!openList.isEmpty()) { HashableState sh = openList.poll(); // skip this if it's already been expanded if (valueFunction.containsKey(sh)) { continue; } // do not need to expand from terminal states if (model.terminal(sh.s())) { continue; } valueFunction.put(sh, this.valueInitializer.value(sh.s())); List<Action> actions = this.applicableActions(sh.s()); for (Action a : actions) { List<TransitionProb> tps = ((FullModel) model).transitions(sh.s(), a); for (TransitionProb tp : tps) { HashableState tsh = this.stateHash(tp.eo.op); if (!openedSet.contains(tsh) && !valueFunction.containsKey(tsh)) { openedSet.add(tsh); openList.offer(tsh); } } } } DPrint.cl(this.debugCode, "Finished reachability analysis; # states: " + valueFunction.size()); return true; }
private FileInfo putFileInfo(Long ledger, byte masterKey[], File lf, boolean createdNewFile) throws IOException { FileInfo fi = new FileInfo(lf, masterKey); FileInfo oldFi = fileInfoCache.putIfAbsent(ledger, fi); if (null != oldFi) { // Some other thread won the race. We should delete our file if we created // a new one and the paths are different. if (createdNewFile && !oldFi.isSameFile(lf)) { fi.delete(); } fi = oldFi; } else { if (createdNewFile) { // Else, we won and the active ledger manager should know about this. LOG.debug("New ledger index file created for ledgerId: {}", ledger); activeLedgers.put(ledger, true); } // Evict cached items from the file info cache if necessary evictFileInfoIfNecessary(); synchronized (openLedgers) { openLedgers.offer(ledger); } } return fi; }
/** * computes a hash-backed policy for every state visited along the greedy path of the UCT tree. */ public void computePolicyFromTree() { policy = new HashMap<StateHashTuple, GroundedAction>(); if (this.planner.getRoot() == null) { return; } // define policy for all states that are expanded along the greedy path of the UCT tree LinkedList<UCTStateNode> queue = new LinkedList<UCTStateNode>(); queue.add(planner.getRoot()); while (queue.size() > 0) { UCTStateNode snode = queue.poll(); if (!planner.containsActionPreference(snode)) { System.out.println( "UCT tree does not contain action preferences of the state queried by the UCTTreeWalkPolicy. Consider replanning with planFromState"); break; // policy ill defined } UCTActionNode choice = this.getQGreedyNode(snode); if (choice != null) { policy.put(snode.state, choice.action); // set the policy List<UCTStateNode> successors = choice.getAllSuccessors(); // queue up all possible successors of this action for (UCTStateNode suc : successors) { queue.offer(suc); } } } }
public static void main(String[] args) { LinkedList books = new LinkedList(); // 将字符串元素加入队列的尾部 books.offer("疯狂Java讲义"); // 将一个字符串元素加入栈的顶部 books.push("轻量级Java EE企业应用实战"); // 将字符串元素添加到队列的头部(相当于栈的顶部) books.offerFirst("疯狂Android讲义"); // 以List的方式(按索引访问的方式)来遍历集合元素 for (int i = 0; i < books.size(); i++) { System.out.println("遍历中:" + books.get(i)); } // 访问、并不删除栈顶的元素 System.out.println(books.peekFirst()); // 访问、并不删除队列的最后一个元素 System.out.println(books.peekLast()); // 将栈顶的元素弹出“栈” System.out.println(books.pop()); // 下面输出将看到队列中第一个元素被删除 System.out.println(books); // 访问、并删除队列的最后一个元素 System.out.println(books.pollLast()); // 下面输出:[轻量级Java EE企业应用实战] System.out.println(books); }
public void call(ServiceCallback callback) { if (notify != null) { callback.run(notify); } else { callbacks.offer(callback); } }
private boolean nearTrunk(World var1, int var2, int var3, int var4) { Loc var5 = new Loc(var2, var3, var4); LinkedList var6 = new LinkedList(); ArrayList var7 = new ArrayList(); var6.offer(new Loc(var2, var3, var4)); int var8 = this.blockID; while (!var6.isEmpty()) { Loc var9 = (Loc) var6.poll(); if (!var7.contains(var9)) { if (var9.distSimple(var5) <= 4) { int var10 = var9.getBlock(var1); var9.getMeta(var1); if (var10 == AetherBlocks.AetherLog.blockID) { return true; } if (var10 == var8) { var6.addAll(Arrays.asList(var9.adjacent())); } } var7.add(var9); } } return false; }
public static final void test() { Random r = new Random(); String msg = ""; while (true) { ToolsArrayQueue<Integer> taq = new ToolsArrayQueue<Integer>(); LinkedList<Integer> ll = new LinkedList<Integer>(); for (int i = 0; i < 2000000; i++) { msg = ""; try { msg += assertequal("Size difference: LL = %d, TAQ = %d; ", ll.size(), taq.size()); msg += assertequal("Emptiness difference: LL = %d, TAQ = %d; ", ll.isEmpty(), taq.isEmpty()); Object llv, taqv; switch (r.nextInt(4)) { case 0: case 3: int rnd = r.nextInt(); llv = ll.offer(rnd); taqv = taq.offer(rnd); msg += assertequal("Offer: LL = %s, TAQ = %s; ", llv, taqv); break; case 1: llv = ll.peek(); taqv = taq.peek(); msg += assertequal("Peek: LL = %s, TAQ = %s; ", llv, taqv); break; case 2: llv = ll.poll(); taqv = taq.poll(); msg += assertequal("Poll: LL = %s, TAQ = %s; ", llv, taqv); break; } } catch (Exception e) { msg += "EXCEPTION [[" + e.toString() + "]]; "; e.printStackTrace(); } if (!msg.equals("") || (i % 100000 == 0)) System.out.println(String.format("%d: %s", i, msg)); } int size = taq.size(); System.out.println("size: " + size); Integer[] fromArr = (Integer[]) taq.toArray(new Integer[size]); Integer[] fromIt = new Integer[size]; int idx = 0; for (Integer ii : taq) { fromIt[idx++] = ii; } System.out.print(assertequal("fromIt size: expected %d got %d\n", size, idx)); for (int i = 0; i < size; i++) { msg = ""; msg += assertequal("arr/it: arr = %s, it = %s; ", fromArr[i], fromIt[i]); msg += assertequal("arr/Q: arr = %s, Q = %s; ", fromArr[i], taq.poll()); if (!msg.equals("")) System.out.println(String.format("%d: %s", i, msg)); } System.out.print(assertequal("size: expected %d got %d\n", 0, taq.size())); System.out.println("equality check done"); } }
public void execute(final Runnable paramRunnable) { try { a.offer(new Runnable() { public void run() { try { paramRunnable.run(); return; } finally { a(); } } }); if (b == null) { a(); } return; } finally { paramRunnable = finally; throw paramRunnable; } }
/** 测试LinkedList以队列的形式(先进先出FIFO)形式使用的方法、 */ private static void testLinkedListASQueue() { System.out.println("Test methods: add(e), offer(e), remove(), poll(), element(), peek()"); LinkedList<String> queue = new LinkedList<String>(); // add(e) 与方法off(e)等效 queue.add("a"); queue.add("b"); queue.add("c"); queue.offer("d"); queue.offer("e"); printList(queue); // 他移除的是队列最前端的元素、最先进去的元素 printStr(queue.remove()); printStr(queue.poll()); /* * 下面两个方法都是查看第一个元素、区别就是当queue中没有元素时、queue.element()抛异常、queue.peek()返回null */ printStr(queue.element()); printList(queue); printStr(queue.peek()); printList(queue); queue.clear(); printList(queue); printStr("the result of peek : " + queue.peek()); // result: the result of peek : null printStr( "the result of element : " + queue.element()); // result: java.util.NoSuchElementException }
@Override public void writeBytes(byte[] message) throws IOException { lock.lock(); try { // Network buffers are not unlimited (and are often smaller than some messages we may wish to // send), and // thus we have to buffer outbound messages sometimes. To do this, we use a queue of // ByteBuffers and just // append to it when we want to send a message. We then let tryWriteBytes() either send the // message or // register our SelectionKey to wakeup when we have free outbound buffer space available. if (bytesToWriteRemaining + message.length > OUTBOUND_BUFFER_BYTE_COUNT) throw new IOException("Outbound buffer overflowed"); // Just dump the message onto the write buffer and call tryWriteBytes // TODO: Kill the needless message duplication when the write completes right away bytesToWrite.offer(ByteBuffer.wrap(Arrays.copyOf(message, message.length))); bytesToWriteRemaining += message.length; setWriteOps(); } catch (IOException e) { lock.unlock(); log.error("Error writing message to connection, closing connection", e); closeConnection(); throw e; } catch (CancelledKeyException e) { lock.unlock(); log.error("Error writing message to connection, closing connection", e); closeConnection(); throw new IOException(e); } lock.unlock(); }
public Collection<PrizeNode> getSuccessors() { Collection<PrizeNode> result = new ArrayList<>(); if (this.getTardiness() == 0) { PrizeNode c = new PrizeNode(); @SuppressWarnings("unchecked") LinkedList<Attendance> a = (LinkedList<Attendance>) this.records_.clone(); if (a.size() >= 2) { a.poll(); } a.offer(Attendance.Late); c.setRecords(a); c.setTardiness(1); result.add(c); } { PrizeNode c = new PrizeNode(); @SuppressWarnings("unchecked") LinkedList<Attendance> a = (LinkedList<Attendance>) this.records_.clone(); if (a.size() >= 2) { a.poll(); } a.offer(Attendance.OnTime); c.setRecords(a); c.setTardiness(this.tardiness_); result.add(c); } boolean isAbsentOk = (this.records_.size() < 2); isAbsentOk = isAbsentOk || (this.records_.peekFirst() != Attendance.Absent); isAbsentOk = isAbsentOk || (this.records_.peekLast() != Attendance.Absent); if (isAbsentOk) { PrizeNode c = new PrizeNode(); @SuppressWarnings("unchecked") LinkedList<Attendance> a = (LinkedList<Attendance>) this.records_.clone(); if (a.size() >= 2) { a.poll(); } a.offer(Attendance.Absent); c.setRecords(a); c.setTardiness(this.tardiness_); result.add(c); } return result; }
/** Wind up off screen, so we can animate in. */ private void throwOnTable(final View photo) { mOnTable.offer(photo); log("start offscreen"); photo.setRotation(mThrowRotation); photo.setX(-mLongSide); photo.setY(-mLongSide); dropOnTable(photo, mThrowInterpolator); }
protected void findImages(boolean internal, int howMany, LinkedList<ImageData> foundImages) { Uri uri = internal ? MediaStore.Images.Media.INTERNAL_CONTENT_URI : MediaStore.Images.Media.EXTERNAL_CONTENT_URI; String[] projection = { MediaStore.Images.Media.DATA, MediaStore.Images.Media.ORIENTATION, MediaStore.Images.Media.BUCKET_ID, MediaStore.Images.Media.BUCKET_DISPLAY_NAME }; String selection = ""; for (String id : getFoundAlbums()) { if (isInternalId(id) == internal && mSettings.isAlbumEnabled(id)) { String[] parts = id.split(":"); if (parts.length > 1) { if (selection.length() > 0) { selection += " OR "; } selection += MediaStore.Images.Media.BUCKET_ID + " = '" + parts[1] + "'"; } } } if (selection.isEmpty()) { return; } Cursor cursor = mResolver.query(uri, projection, selection, null, null); if (cursor != null) { int dataIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA); if (cursor.getCount() > howMany && mLastPosition == INVALID) { mLastPosition = pickRandomStart(cursor.getCount(), howMany); } cursor.moveToPosition(mLastPosition); if (dataIndex < 0) { log(TAG, "can't find the DATA column!"); } else { while (foundImages.size() < howMany && cursor.moveToNext()) { ImageData data = unpackImageData(cursor, null); data.uri = uri; foundImages.offer(data); mLastPosition = cursor.getPosition(); } if (cursor.isAfterLast()) { mLastPosition = -1; } if (cursor.isBeforeFirst()) { mLastPosition = INVALID; } } cursor.close(); } }
private void loadGraphNodeMemory() { Node refNode = GraphDB.getReferenceNode(); LinkedList<Node> queue = new LinkedList<Node>(); queue.offer(refNode); int key = (Integer) refNode.getProperty("id"); GNode gNode = new GNode(refNode, null, null); graphNodesMemomry.put(key, gNode); System.out.println(key + " " + gNode.getNode().getProperty("name")); while (!queue.isEmpty()) { Node node = queue.poll(); GNode gSourceNode = graphNodesMemomry.get(node.getProperty("id")); for (Relationship rel : node.getRelationships(Direction.OUTGOING)) { Node endNode = rel.getEndNode(); queue.offer(endNode); GNode gEndNode = new GNode(endNode, null, rel.getType()); key = (Integer) endNode.getProperty("id"); if (graphNodesMemomry.get(key) == null) { gNode = new GNode(endNode, null, null); graphNodesMemomry.put(key, gNode); } while (gSourceNode.getConnectedTo() != null) { gSourceNode = gSourceNode.getConnectedTo(); } gSourceNode.setConnectedTo(gEndNode); System.out.println( node.getProperty("name") + " " + rel.getType() + " " + endNode.getProperty("name")); } } }
/** Visually on top, and also freshest, for the purposes of timeouts. */ public void moveToTopOfPile(View photo) { // make this photo the last to be removed. if (isInBackground(photo)) { mBackground.bringChildToFront(photo); } else { bringChildToFront(photo); } invalidate(); mOnTable.remove(photo); mOnTable.offer(photo); }
// FIXME public static LinkedList<Float> deserializeManyFloat(byte[] buf) { ByteArrayInputStream stream = new ByteArrayInputStream(buf); DataInputStream dis = new DataInputStream(stream); LinkedList<Float> list = new LinkedList<Float>(); try { while (list.offer(dis.readFloat())) ; } catch (IOException e) { // TODO Auto-generated catch block // e.printStackTrace(); } return list; }
public static void main(String args[]) { Scanner in = new Scanner(System.in); while (true) { int n = in.nextInt(); if (n == 0) { break; } if (n == 1) { System.out.println("1"); continue; } boolean used[] = new boolean[n]; LinkedList<Number> queue = new LinkedList<Number>(); used[1] = true; queue.offer(new Number("1", 1)); while (true) { Number head = queue.poll(); int nextRemainder0 = (head.remainder * 10) % n; if (nextRemainder0 == 0) { System.out.println(head.represent + "0"); break; } if (!used[nextRemainder0]) { used[nextRemainder0] = true; queue.offer(new Number(head.represent + "0", nextRemainder0)); } int nextRemainder1 = (head.remainder * 10 + 1) % n; if (nextRemainder1 == 0) { System.out.println(head.represent + "1"); break; } if (!used[nextRemainder1]) { used[nextRemainder1] = true; queue.offer(new Number(head.represent + "1", nextRemainder1)); } } } }
public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) { if (node == null) return null; UndirectedGraphNode res = new UndirectedGraphNode(node.label); LinkedList<UndirectedGraphNode> queue = new LinkedList<UndirectedGraphNode>(); queue.offer(node); HashMap<UndirectedGraphNode, UndirectedGraphNode> map = new HashMap<UndirectedGraphNode, UndirectedGraphNode>(); map.put(node, res); while (!queue.isEmpty()) { UndirectedGraphNode cur = queue.poll(); for (UndirectedGraphNode n : cur.neighbors) { if (!map.containsKey(n)) { queue.offer(n); UndirectedGraphNode copy = new UndirectedGraphNode(n.label); map.put(n, copy); map.get(cur).neighbors.add(copy); } else { map.get(cur).neighbors.add(map.get(n)); } } } return res; }
public List<List<Integer>> levelOrder(TreeNode root) { ArrayList<List<Integer>> result = new ArrayList<List<Integer>>(); if (root == null) return result; ArrayList<Integer> level = new ArrayList<Integer>(); LinkedList<TreeNode> cur = new LinkedList<TreeNode>(); LinkedList<TreeNode> next = new LinkedList<TreeNode>(); cur.offer(root); TreeNode temp = null; while (!cur.isEmpty()) { temp = cur.poll(); level.add(temp.val); if (temp.left != null) next.offer(temp.left); if (temp.right != null) next.offer(temp.right); if (cur.isEmpty()) { result.add(level); level = new ArrayList<Integer>(); cur = next; next = new LinkedList<TreeNode>(); } } return result; }
/** * Insert a line in the buffer * * @param line line to insert in the buffer */ public void insert(final String line) { lock.lock(); try { while (buffer.size() == maxSize) { space.await(); } buffer.offer(line); System.out.printf("%s: Inserted Line: %d\n", Thread.currentThread().getName(), buffer.size()); lines.signalAll(); } catch (InterruptedException e) { e.printStackTrace(); } finally { lock.unlock(); } }
private void maybeLoadMore() { if (!mBitmapLoaders.isEmpty()) { for (ListIterator<PhotoLoadTask> i = mBitmapLoaders.listIterator(0); i.hasNext(); ) { PhotoLoadTask loader = i.next(); if (loader.getStatus() == AsyncTask.Status.FINISHED) { i.remove(); } } } if ((mBitmapLoaders.size() + mBitmapQueue.size()) < mBitmapQueueLimit) { PhotoLoadTask task = new PhotoLoadTask(); mBitmapLoaders.offer(task); task.execute(); } }
/** similar to recursive fill, but uses no system stack */ void floodFillQue(int start[]) { // int start_state = grid.getState(start[0], start[1], start[2] ); LinkedList<int[]> que = new LinkedList<int[]>(); que.add(start); mask.set(start[0], start[1], start[2], 1); while (!que.isEmpty()) { int vc[] = que.remove(); int i = vc[0]; int j = vc[1]; int k = vc[2]; if (compareState(grid, i, j, k, state)) { if (m_component != null) m_component.add(i, j, k); updateBounds(i, j, k); m_volume++; // test adjacent voxels for (int n1 = -1; n1 < 2; n1++) { for (int n2 = -1; n2 < 2; n2++) { for (int n3 = -1; n3 < 2; n3++) { if (n1 == 0 && n2 == 0 && n3 == 0) continue; int ni = i + n1; int nj = j + n2; int nk = k + n3; if (mask.get(ni, nj, nk) == 0) { if (!compareState(grid, ni, nj, nk, state)) continue; que.offer(new int[] {ni, nj, nk}); mask.set(ni, nj, nk, 1); // printf("que: %d (%d,%d,%d)\n",que.size(),ni,nj,nk); } } } } } } }
public static void main(String a[]) { LinkedList<String> arrl = new LinkedList<String>(); arrl.add("First"); arrl.add("Second"); arrl.add("Third"); arrl.add("Random"); System.out.println(arrl); System.out.println("Adding element at last position..."); arrl.addLast("I am last"); System.out.println(arrl); System.out.println("Adding element at last position..."); arrl.offerLast("I am last - 1"); System.out.println(arrl); System.out.println("Adding element at last position..."); arrl.offer("I am last - 2"); System.out.println(arrl); }
@Override public String toString() { if (root == null) return "NULL"; StringBuilder sb = new StringBuilder(); LinkedList<BTNode> queue = new LinkedList<BTNode>(); queue.push(root); BTNode tem = null; while ((tem = queue.poll()) != null) { for (BTNode node : tem.children) { if (!node.isNull()) queue.offer(node); } sb.append(tem.toString() + "\n"); } return sb.toString(); }
/** * Paints the transcoded SVG image on the specified graphics context. * * @param g Graphics context. */ private void paint(Graphics2D g) { Shape shape = null; float origAlpha = 1.0f; java.util.LinkedList<AffineTransform> transformations = new java.util.LinkedList<AffineTransform>(); // transformations.offer(g.getTransform()); g.transform(new AffineTransform(1.0666667f, 0, 0, 1.0666667f, 0, 0)); // _0 // _0_0 // _0_0_0 shape = new GeneralPath(); ((GeneralPath) shape).moveTo(44.85476, 13.658783); ((GeneralPath) shape).lineTo(39.8797, 18.833183); ((GeneralPath) shape).lineTo(62.034473, 24.087093); ((GeneralPath) shape).lineTo(56.182423, 2.2196937); ((GeneralPath) shape).lineTo(51.25553, 7.156234); ((GeneralPath) shape).curveTo(23.11004, -15.968987, -18.852411, 21.698124, 9.346271, 53.566833); ((GeneralPath) shape).curveTo(34.37855, 75.45358, 62.938217, 55.468464, 62.84925, 31.573273); ((GeneralPath) shape).lineTo(53.94392, 31.646673); ((GeneralPath) shape).curveTo(53.04116, 50.485714, 32.096634, 60.792103, 16.790325, 48.184963); ((GeneralPath) shape) .curveTo(-3.4530144, 28.782303, 21.423546, -2.7391064, 44.85476, 13.658743); ((GeneralPath) shape).closePath(); g.setPaint(color); g.fill(shape); g.setTransform(transformations.poll()); // _0 }
/** * Return the given {@link CheckableImageView} into our internal pool for possible recycling * during another pass. */ private synchronized void releaseView(View view) { mActionPool.offer(view); mActionRecycled++; }