MCPcopy Create free account
hub / github.com/e2wugui/zeze / poll

Method poll

ZezeJava/ZezeJava/src/main/java/Zeze/Collections/Queue.java:254–278  ·  view source on GitHub ↗

删除并返回头节点中的首个值 @return 头节点的首个值,null if empty

()

Source from the content-addressed store, hash-verified

252 * @return 头节点的首个值,null if empty
253 */
254 public V poll() {
255 var root = getRoot();
256 if (root == null)
257 return null;
258
259 var headKey = root.getHeadNodeKey();
260 if (headKey.getNodeId() == 0)
261 return null;
262
263 var head = getNode(headKey);
264 if (head == null)
265 return null;
266
267 var nodeValues = head.getValues();
268 var nodeValue = nodeValues.remove(0);
269 root.setCount(root.getCount() - 1);
270 if (nodeValues.isEmpty()) {
271 root.setHeadNodeKey(head.getNextNodeKey());
272 module._tQueueNodes.remove(headKey);
273 }
274
275 @SuppressWarnings("unchecked")
276 var value = (V)nodeValue.getValue().getBean();
277 return value;
278 }
279
280 /**
281 * @return 头节点的首个值,null if empty

Callers 15

popMethod · 0.95
testFileMethod · 0.45
clearMethod · 0.45
reliableNotifySyncMethod · 0.45
tryPollLruQueueMethod · 0.45
cleanNowMethod · 0.45
tryPushMessageMethod · 0.45
tryPollLruQueueMethod · 0.45
cleanNowMethod · 0.45
pollTaskMethod · 0.45
runMethod · 0.45
checkNowMethod · 0.45

Calls 13

getRootMethod · 0.95
getNodeMethod · 0.95
setHeadNodeKeyMethod · 0.80
getHeadNodeKeyMethod · 0.65
getNodeIdMethod · 0.65
removeMethod · 0.65
getCountMethod · 0.65
isEmptyMethod · 0.65
getNextNodeKeyMethod · 0.65
getBeanMethod · 0.65
getValueMethod · 0.65
getValuesMethod · 0.45

Tested by 2

testFileMethod · 0.36
clearMethod · 0.36