MCPcopy Create free account
hub / github.com/antlr/codebuff / add

Method add

output/java_guava/1.4.18/TreeMultiset.java:256–276  ·  view source on GitHub ↗
(@Nullable E element, int occurrences)

Source from the content-addressed store, hash-verified

254 }
255
256 @CanIgnoreReturnValue
257 @Override
258 public int add(@Nullable E element, int occurrences) {
259 checkNonnegative(occurrences, "occurrences");
260 if (occurrences == 0) {
261 return count(element);
262 }
263 checkArgument(range.contains(element));
264 AvlNode<E> root = rootReference.get();
265 if (root == null) {
266 comparator().compare(element, element);
267 AvlNode<E> newRoot = new AvlNode<E>(element, occurrences);
268 successor(header, newRoot, header);
269 rootReference.checkAndSet(root, newRoot);
270 return 0;
271 }
272 int[] result = new int[1]; // used as a mutable int reference to hold result
273 AvlNode<E> newRoot = root.add(comparator(), element, occurrences, result);
274 rootReference.checkAndSet(root, newRoot);
275 return result[0];
276 }
277
278 @CanIgnoreReturnValue
279 @Override

Callers 1

setCountMethod · 0.95

Calls 10

countMethod · 0.95
successorMethod · 0.95
containsMethod · 0.65
getMethod · 0.65
comparatorMethod · 0.65
addMethod · 0.65
checkNonnegativeMethod · 0.45
checkArgumentMethod · 0.45
compareMethod · 0.45
checkAndSetMethod · 0.45

Tested by

no test coverage detected