id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
130,300
vipshop/vjtools
vjmxcli/src/main/java/com/vip/vjtools/jmx/Client.java
Client.execute
protected Object[] execute(final String hostportOrPid, final String login, final String password, final String beanname, String[] command, final boolean oneBeanOnly) throws Exception { JMXConnector jmxc = connect(hostportOrPid, login, password); Object[] result = null; try { MBeanServerConnection mbsc = jm...
java
protected Object[] execute(final String hostportOrPid, final String login, final String password, final String beanname, String[] command, final boolean oneBeanOnly) throws Exception { JMXConnector jmxc = connect(hostportOrPid, login, password); Object[] result = null; try { MBeanServerConnection mbsc = jm...
[ "protected", "Object", "[", "]", "execute", "(", "final", "String", "hostportOrPid", ",", "final", "String", "login", ",", "final", "String", "password", ",", "final", "String", "beanname", ",", "String", "[", "]", "command", ",", "final", "boolean", "oneBea...
Execute command against remote JMX agent. @param hostportOrPid 'host:port' combination. @param login RMI login to use. @param password RMI password to use. @param beanname Name of remote bean to run command against. @param command Array of commands to run. @param oneBeanOnly Set true if passed <code>beanname</code> is ...
[ "Execute", "command", "against", "remote", "JMX", "agent", "." ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjmxcli/src/main/java/com/vip/vjtools/jmx/Client.java#L331-L343
130,301
vipshop/vjtools
vjstar/src/main/java/com/vip/vjstar/window/TimeSlidingWindow.java
TimeSlidingWindow.clear
private void clear(long time) { if (time < lastTime.get() + size) { return; } int index = (int) (time % size); for (int i = 0; i < size; i++) { if (i != index) { counts.set(i, 0); } } }
java
private void clear(long time) { if (time < lastTime.get() + size) { return; } int index = (int) (time % size); for (int i = 0; i < size; i++) { if (i != index) { counts.set(i, 0); } } }
[ "private", "void", "clear", "(", "long", "time", ")", "{", "if", "(", "time", "<", "lastTime", ".", "get", "(", ")", "+", "size", ")", "{", "return", ";", "}", "int", "index", "=", "(", "int", ")", "(", "time", "%", "size", ")", ";", "for", "...
clear prev data
[ "clear", "prev", "data" ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjstar/src/main/java/com/vip/vjstar/window/TimeSlidingWindow.java#L52-L62
130,302
vipshop/vjtools
vjtop/src/main/java/com/vip/vjtools/vjtop/util/Formats.java
Formats.rightStr
public static String rightStr(String str, int length) { return str.substring(Math.max(0, str.length() - length)); }
java
public static String rightStr(String str, int length) { return str.substring(Math.max(0, str.length() - length)); }
[ "public", "static", "String", "rightStr", "(", "String", "str", ",", "int", "length", ")", "{", "return", "str", ".", "substring", "(", "Math", ".", "max", "(", "0", ",", "str", ".", "length", "(", ")", "-", "length", ")", ")", ";", "}" ]
Returns a substring of the given string, representing the 'length' most-right characters
[ "Returns", "a", "substring", "of", "the", "given", "string", "representing", "the", "length", "most", "-", "right", "characters" ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjtop/src/main/java/com/vip/vjtools/vjtop/util/Formats.java#L185-L187
130,303
vipshop/vjtools
vjtop/src/main/java/com/vip/vjtools/vjtop/util/Formats.java
Formats.leftStr
public static String leftStr(String str, int length) { return str.substring(0, Math.min(str.length(), length)); }
java
public static String leftStr(String str, int length) { return str.substring(0, Math.min(str.length(), length)); }
[ "public", "static", "String", "leftStr", "(", "String", "str", ",", "int", "length", ")", "{", "return", "str", ".", "substring", "(", "0", ",", "Math", ".", "min", "(", "str", ".", "length", "(", ")", ",", "length", ")", ")", ";", "}" ]
Returns a substring of the given string, representing the 'length' most-left characters
[ "Returns", "a", "substring", "of", "the", "given", "string", "representing", "the", "length", "most", "-", "left", "characters" ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjtop/src/main/java/com/vip/vjtools/vjtop/util/Formats.java#L192-L194
130,304
vipshop/vjtools
vjtop/src/main/java/com/vip/vjtools/vjtop/util/Formats.java
Formats.join
public static String join(List<String> list, String delim) { StringBuilder sb = new StringBuilder(); String loopDelim = ""; for (String s : list) { sb.append(loopDelim); sb.append(s); loopDelim = delim; } return sb.toString(); }
java
public static String join(List<String> list, String delim) { StringBuilder sb = new StringBuilder(); String loopDelim = ""; for (String s : list) { sb.append(loopDelim); sb.append(s); loopDelim = delim; } return sb.toString(); }
[ "public", "static", "String", "join", "(", "List", "<", "String", ">", "list", ",", "String", "delim", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "String", "loopDelim", "=", "\"\"", ";", "for", "(", "String", "s", ":",...
Joins the given list of strings using the given delimiter delim
[ "Joins", "the", "given", "list", "of", "strings", "using", "the", "given", "delimiter", "delim" ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjtop/src/main/java/com/vip/vjtools/vjtop/util/Formats.java#L213-L228
130,305
vipshop/vjtools
vjtop/src/main/java/com/vip/vjtools/vjtop/VMInfo.java
VMInfo.createDeadVM
public static VMInfo createDeadVM(String pid, VMInfoState state) { VMInfo vmInfo = new VMInfo(); vmInfo.state = state; vmInfo.pid = pid; return vmInfo; }
java
public static VMInfo createDeadVM(String pid, VMInfoState state) { VMInfo vmInfo = new VMInfo(); vmInfo.state = state; vmInfo.pid = pid; return vmInfo; }
[ "public", "static", "VMInfo", "createDeadVM", "(", "String", "pid", ",", "VMInfoState", "state", ")", "{", "VMInfo", "vmInfo", "=", "new", "VMInfo", "(", ")", ";", "vmInfo", ".", "state", "=", "state", ";", "vmInfo", ".", "pid", "=", "pid", ";", "retur...
Creates a dead VMInfo, representing a jvm in a given state which cannot be attached or other monitoring issues occurred.
[ "Creates", "a", "dead", "VMInfo", "representing", "a", "jvm", "in", "a", "given", "state", "which", "cannot", "be", "attached", "or", "other", "monitoring", "issues", "occurred", "." ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjtop/src/main/java/com/vip/vjtools/vjtop/VMInfo.java#L151-L156
130,306
vipshop/vjtools
vjtop/src/main/java/com/vip/vjtools/vjtop/VMInfo.java
VMInfo.update
public void update(boolean needJvmInfo) { if (state == VMInfoState.ERROR_DURING_ATTACH || state == VMInfoState.DETACHED) { return; } try { int lastJmxErrorCount = jmxUpdateErrorCount; // 将UPDTATE_ERROR重置开始新一轮循环 state = VMInfoState.ATTACHED; // 清空JMX内部缓存 jmxClient.flush(); updateUpTime(); ...
java
public void update(boolean needJvmInfo) { if (state == VMInfoState.ERROR_DURING_ATTACH || state == VMInfoState.DETACHED) { return; } try { int lastJmxErrorCount = jmxUpdateErrorCount; // 将UPDTATE_ERROR重置开始新一轮循环 state = VMInfoState.ATTACHED; // 清空JMX内部缓存 jmxClient.flush(); updateUpTime(); ...
[ "public", "void", "update", "(", "boolean", "needJvmInfo", ")", "{", "if", "(", "state", "==", "VMInfoState", ".", "ERROR_DURING_ATTACH", "||", "state", "==", "VMInfoState", ".", "DETACHED", ")", "{", "return", ";", "}", "try", "{", "int", "lastJmxErrorCount...
Updates all jvm metrics to the most recent remote values
[ "Updates", "all", "jvm", "metrics", "to", "the", "most", "recent", "remote", "values" ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjtop/src/main/java/com/vip/vjtools/vjtop/VMInfo.java#L206-L245
130,307
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/collection/ArrayUtil.java
ArrayUtil.swap
private static void swap(Object[] arr, int i, int j) { Object tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; }
java
private static void swap(Object[] arr, int i, int j) { Object tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; }
[ "private", "static", "void", "swap", "(", "Object", "[", "]", "arr", ",", "int", "i", ",", "int", "j", ")", "{", "Object", "tmp", "=", "arr", "[", "i", "]", ";", "arr", "[", "i", "]", "=", "arr", "[", "j", "]", ";", "arr", "[", "j", "]", ...
Swaps the two specified elements in the specified array.
[ "Swaps", "the", "two", "specified", "elements", "in", "the", "specified", "array", "." ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/collection/ArrayUtil.java#L55-L59
130,308
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/SortedArrayList.java
SortedArrayList.compare
@SuppressWarnings({ "unchecked" }) protected int compare(E k1, E k2) { if (comparator == null) { return ((Comparable) k1).compareTo(k2); } return comparator.compare(k1, k2); }
java
@SuppressWarnings({ "unchecked" }) protected int compare(E k1, E k2) { if (comparator == null) { return ((Comparable) k1).compareTo(k2); } return comparator.compare(k1, k2); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "protected", "int", "compare", "(", "E", "k1", ",", "E", "k2", ")", "{", "if", "(", "comparator", "==", "null", ")", "{", "return", "(", "(", "Comparable", ")", "k1", ")", ".", "compareTo"...
Compares two keys using the correct comparison method for this collection.
[ "Compares", "two", "keys", "using", "the", "correct", "comparison", "method", "for", "this", "collection", "." ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/SortedArrayList.java#L161-L167
130,309
vipshop/vjtools
vjmap/src/main/java/com/vip/vjtools/vjmap/VJMap.java
VJMap.triggerGc
private static void triggerGc(Integer pid) { VirtualMachine vm = null; try { vm = VirtualMachine.attach(String.valueOf(pid)); HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm; try (InputStream in = hvm.executeJCmd("GC.run");) { byte b[] = new byte[256]; int n; do { n = in.read(b); ...
java
private static void triggerGc(Integer pid) { VirtualMachine vm = null; try { vm = VirtualMachine.attach(String.valueOf(pid)); HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm; try (InputStream in = hvm.executeJCmd("GC.run");) { byte b[] = new byte[256]; int n; do { n = in.read(b); ...
[ "private", "static", "void", "triggerGc", "(", "Integer", "pid", ")", "{", "VirtualMachine", "vm", "=", "null", ";", "try", "{", "vm", "=", "VirtualMachine", ".", "attach", "(", "String", ".", "valueOf", "(", "pid", ")", ")", ";", "HotSpotVirtualMachine", ...
Trigger a remote gc using HotSpotVirtualMachine, inspired by jcmd's source code. @param pid
[ "Trigger", "a", "remote", "gc", "using", "HotSpotVirtualMachine", "inspired", "by", "jcmd", "s", "source", "code", "." ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjmap/src/main/java/com/vip/vjtools/vjmap/VJMap.java#L243-L271
130,310
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/primitive/IntObjectHashMap.java
IntObjectHashMap.indexOf
private int indexOf(int key) { int startIndex = hashIndex(key); int index = startIndex; for (;;) { if (values[index] == null) { // It's available, so no chance that this value exists anywhere in the map. return -1; } if (key == keys[index]) { return index; } // Conflict, keep probing ...
java
private int indexOf(int key) { int startIndex = hashIndex(key); int index = startIndex; for (;;) { if (values[index] == null) { // It's available, so no chance that this value exists anywhere in the map. return -1; } if (key == keys[index]) { return index; } // Conflict, keep probing ...
[ "private", "int", "indexOf", "(", "int", "key", ")", "{", "int", "startIndex", "=", "hashIndex", "(", "key", ")", ";", "int", "index", "=", "startIndex", ";", "for", "(", ";", ";", ")", "{", "if", "(", "values", "[", "index", "]", "==", "null", "...
Locates the index for the given key. This method probes using double hashing. @param key the key for an entry in the map. @return the index where the key was found, or {@code -1} if no entry is found for that key.
[ "Locates", "the", "index", "for", "the", "given", "key", ".", "This", "method", "probes", "using", "double", "hashing", "." ]
60c743da35913d72f37f2d79afa90ad2bf73cb89
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/collection/type/primitive/IntObjectHashMap.java#L342-L360
130,311
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/skins/ValidationPane.java
ValidationPane.updateErrorContainerSize
private void updateErrorContainerSize(double w, double errorContainerHeight) { errorContainerClip.setWidth(w); errorContainerClip.setHeight(errorContainerHeight); resize(w, errorContainerHeight); }
java
private void updateErrorContainerSize(double w, double errorContainerHeight) { errorContainerClip.setWidth(w); errorContainerClip.setHeight(errorContainerHeight); resize(w, errorContainerHeight); }
[ "private", "void", "updateErrorContainerSize", "(", "double", "w", ",", "double", "errorContainerHeight", ")", "{", "errorContainerClip", ".", "setWidth", "(", "w", ")", ";", "errorContainerClip", ".", "setHeight", "(", "errorContainerHeight", ")", ";", "resize", ...
update the size of error container and its clip @param w @param errorContainerHeight
[ "update", "the", "size", "of", "error", "container", "and", "its", "clip" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/skins/ValidationPane.java#L205-L209
130,312
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/skins/ValidationPane.java
ValidationPane.createSmallerScaleFrame
private KeyFrame createSmallerScaleFrame(double errorContainerHeight) { return new KeyFrame(Duration.millis(100), new KeyValue(errorClipScale.yProperty(), errorContainerHeight / getHeight(), Interpolator.EASE_BOTH)); }
java
private KeyFrame createSmallerScaleFrame(double errorContainerHeight) { return new KeyFrame(Duration.millis(100), new KeyValue(errorClipScale.yProperty(), errorContainerHeight / getHeight(), Interpolator.EASE_BOTH)); }
[ "private", "KeyFrame", "createSmallerScaleFrame", "(", "double", "errorContainerHeight", ")", "{", "return", "new", "KeyFrame", "(", "Duration", ".", "millis", "(", "100", ")", ",", "new", "KeyValue", "(", "errorClipScale", ".", "yProperty", "(", ")", ",", "er...
creates error animation frames when moving from large -> small error container @param errorContainerHeight @return
[ "creates", "error", "animation", "frames", "when", "moving", "from", "large", "-", ">", "small", "error", "container" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/skins/ValidationPane.java#L217-L222
130,313
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/skins/ValidationPane.java
ValidationPane.createScaleToOneFrames
private KeyFrame createScaleToOneFrames() { return new KeyFrame(Duration.millis(100), new KeyValue(errorClipScale.yProperty(), 1, Interpolator.EASE_BOTH)); }
java
private KeyFrame createScaleToOneFrames() { return new KeyFrame(Duration.millis(100), new KeyValue(errorClipScale.yProperty(), 1, Interpolator.EASE_BOTH)); }
[ "private", "KeyFrame", "createScaleToOneFrames", "(", ")", "{", "return", "new", "KeyFrame", "(", "Duration", ".", "millis", "(", "100", ")", ",", "new", "KeyValue", "(", "errorClipScale", ".", "yProperty", "(", ")", ",", "1", ",", "Interpolator", ".", "EA...
creates error animation frames when moving from small -> large error container @return
[ "creates", "error", "animation", "frames", "when", "moving", "from", "small", "-", ">", "large", "error", "container" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/skins/ValidationPane.java#L229-L232
130,314
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXDialog.java
JFXDialog.setContent
public void setContent(Region content) { if (content != null) { this.content = content; this.content.setPickOnBounds(false); contentHolder.getChildren().setAll(content); } }
java
public void setContent(Region content) { if (content != null) { this.content = content; this.content.setPickOnBounds(false); contentHolder.getChildren().setAll(content); } }
[ "public", "void", "setContent", "(", "Region", "content", ")", "{", "if", "(", "content", "!=", "null", ")", "{", "this", ".", "content", "=", "content", ";", "this", ".", "content", ".", "setPickOnBounds", "(", "false", ")", ";", "contentHolder", ".", ...
set the content of the dialog @param content
[ "set", "the", "content", "of", "the", "dialog" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXDialog.java#L225-L231
130,315
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXDialog.java
JFXDialog.close
public void close() { if (animation != null) { animation.setRate(-1); animation.play(); animation.setOnFinished(e -> { closeDialog(); }); } else { setOpacity(0); setVisible(false); closeDialog(); ...
java
public void close() { if (animation != null) { animation.setRate(-1); animation.play(); animation.setOnFinished(e -> { closeDialog(); }); } else { setOpacity(0); setVisible(false); closeDialog(); ...
[ "public", "void", "close", "(", ")", "{", "if", "(", "animation", "!=", "null", ")", "{", "animation", ".", "setRate", "(", "-", "1", ")", ";", "animation", ".", "play", "(", ")", ";", "animation", ".", "setOnFinished", "(", "e", "->", "{", "closeD...
close the dialog
[ "close", "the", "dialog" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXDialog.java#L327-L340
130,316
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/skins/JFXChipViewSkin.java
JFXChipViewSkin.createChip
private void createChip(T item) { JFXChip<T> chip = null; try { if (getSkinnable().getChipFactory() != null) { chip = getSkinnable().getChipFactory().apply(getSkinnable(), item); } else { chip = new JFXDefaultChip<T>(getSkinnable(), item); ...
java
private void createChip(T item) { JFXChip<T> chip = null; try { if (getSkinnable().getChipFactory() != null) { chip = getSkinnable().getChipFactory().apply(getSkinnable(), item); } else { chip = new JFXDefaultChip<T>(getSkinnable(), item); ...
[ "private", "void", "createChip", "(", "T", "item", ")", "{", "JFXChip", "<", "T", ">", "chip", "=", "null", ";", "try", "{", "if", "(", "getSkinnable", "(", ")", ".", "getChipFactory", "(", ")", "!=", "null", ")", "{", "chip", "=", "getSkinnable", ...
these methods are called inside the chips items change listener
[ "these", "methods", "are", "called", "inside", "the", "chips", "items", "change", "listener" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/skins/JFXChipViewSkin.java#L256-L270
130,317
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/transitions/CacheMemento.java
CacheMemento.cache
public void cache() { if (!isCached.getAndSet(true)) { this.cache = node.isCache(); this.cacheHint = node.getCacheHint(); node.setCache(true); node.setCacheHint(CacheHint.SPEED); if (node instanceof Region) { this.cacheShape = ((Region)...
java
public void cache() { if (!isCached.getAndSet(true)) { this.cache = node.isCache(); this.cacheHint = node.getCacheHint(); node.setCache(true); node.setCacheHint(CacheHint.SPEED); if (node instanceof Region) { this.cacheShape = ((Region)...
[ "public", "void", "cache", "(", ")", "{", "if", "(", "!", "isCached", ".", "getAndSet", "(", "true", ")", ")", "{", "this", ".", "cache", "=", "node", ".", "isCache", "(", ")", ";", "this", ".", "cacheHint", "=", "node", ".", "getCacheHint", "(", ...
this method will cache the node only if it wasn't cached before
[ "this", "method", "will", "cache", "the", "node", "only", "if", "it", "wasn", "t", "cached", "before" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/transitions/CacheMemento.java#L43-L56
130,318
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/transitions/CachedTransition.java
CachedTransition.starting
protected void starting() { if (mementos != null) { for (int i = 0; i < mementos.length; i++) { mementos[i].cache(); } } }
java
protected void starting() { if (mementos != null) { for (int i = 0; i < mementos.length; i++) { mementos[i].cache(); } } }
[ "protected", "void", "starting", "(", ")", "{", "if", "(", "mementos", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mementos", ".", "length", ";", "i", "++", ")", "{", "mementos", "[", "i", "]", ".", "cache", "(", ...
Called when the animation is starting
[ "Called", "when", "the", "animation", "is", "starting" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/transitions/CachedTransition.java#L80-L86
130,319
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/transitions/CachedTransition.java
CachedTransition.stopping
protected void stopping() { if (mementos != null) { for (int i = 0; i < mementos.length; i++) { mementos[i].restore(); } } }
java
protected void stopping() { if (mementos != null) { for (int i = 0; i < mementos.length; i++) { mementos[i].restore(); } } }
[ "protected", "void", "stopping", "(", ")", "{", "if", "(", "mementos", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mementos", ".", "length", ";", "i", "++", ")", "{", "mementos", "[", "i", "]", ".", "restore", "(",...
Called when the animation is stopping
[ "Called", "when", "the", "animation", "is", "stopping" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/transitions/CachedTransition.java#L91-L97
130,320
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/validation/base/ValidatorBase.java
ValidatorBase.onEval
protected void onEval() { Node control = getSrcControl(); if (hasErrors.get()) { control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, true); if (control instanceof Control) { Tooltip controlTooltip = ((Control) control).getTooltip(); if (controlToo...
java
protected void onEval() { Node control = getSrcControl(); if (hasErrors.get()) { control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, true); if (control instanceof Control) { Tooltip controlTooltip = ((Control) control).getTooltip(); if (controlToo...
[ "protected", "void", "onEval", "(", ")", "{", "Node", "control", "=", "getSrcControl", "(", ")", ";", "if", "(", "hasErrors", ".", "get", "(", ")", ")", "{", "control", ".", "pseudoClassStateChanged", "(", "PSEUDO_CLASS_ERROR", ",", "true", ")", ";", "if...
this method will update the source control after evaluating the validation condition
[ "this", "method", "will", "update", "the", "source", "control", "after", "evaluating", "the", "validation", "condition" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/validation/base/ValidatorBase.java#L93-L117
130,321
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/responsive/JFXResponsiveHandler.java
JFXResponsiveHandler.scanAllNodes
private void scanAllNodes(Parent parent, PseudoClass pseudoClass) { parent.getChildrenUnmodifiable().addListener(new ListChangeListener<Node>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Node> c) { while (c.next()) { ...
java
private void scanAllNodes(Parent parent, PseudoClass pseudoClass) { parent.getChildrenUnmodifiable().addListener(new ListChangeListener<Node>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Node> c) { while (c.next()) { ...
[ "private", "void", "scanAllNodes", "(", "Parent", "parent", ",", "PseudoClass", "pseudoClass", ")", "{", "parent", ".", "getChildrenUnmodifiable", "(", ")", ".", "addListener", "(", "new", "ListChangeListener", "<", "Node", ">", "(", ")", "{", "@", "Override",...
scans all nodes in the scene and apply the css pseduoClass to them. @param parent stage parent node @param pseudoClass css class for certain device
[ "scans", "all", "nodes", "in", "the", "scene", "and", "apply", "the", "css", "pseduoClass", "to", "them", "." ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/responsive/JFXResponsiveHandler.java#L73-L124
130,322
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/skins/JFXColorPalette.java
JFXColorPalette.updateSelection
public void updateSelection(Color color) { setFocusedSquare(null); for (ColorSquare c : colorPickerGrid.getSquares()) { if (c.rectangle.getFill().equals(color)) { setFocusedSquare(c); return; } } // check custom colors for ...
java
public void updateSelection(Color color) { setFocusedSquare(null); for (ColorSquare c : colorPickerGrid.getSquares()) { if (c.rectangle.getFill().equals(color)) { setFocusedSquare(c); return; } } // check custom colors for ...
[ "public", "void", "updateSelection", "(", "Color", "color", ")", "{", "setFocusedSquare", "(", "null", ")", ";", "for", "(", "ColorSquare", "c", ":", "colorPickerGrid", ".", "getSquares", "(", ")", ")", "{", "if", "(", "c", ".", "rectangle", ".", "getFil...
The skin can update selection if colorpicker value changes..
[ "The", "skin", "can", "update", "selection", "if", "colorpicker", "value", "changes", ".." ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/skins/JFXColorPalette.java#L303-L320
130,323
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXAlert.java
JFXAlert.getCurrentAnimation
private JFXAlertAnimation getCurrentAnimation() { JFXAlertAnimation usedAnimation = getAnimation(); usedAnimation = usedAnimation == null ? JFXAlertAnimation.NO_ANIMATION : usedAnimation; return usedAnimation; }
java
private JFXAlertAnimation getCurrentAnimation() { JFXAlertAnimation usedAnimation = getAnimation(); usedAnimation = usedAnimation == null ? JFXAlertAnimation.NO_ANIMATION : usedAnimation; return usedAnimation; }
[ "private", "JFXAlertAnimation", "getCurrentAnimation", "(", ")", "{", "JFXAlertAnimation", "usedAnimation", "=", "getAnimation", "(", ")", ";", "usedAnimation", "=", "usedAnimation", "==", "null", "?", "JFXAlertAnimation", ".", "NO_ANIMATION", ":", "usedAnimation", ";...
this method ensure not null value for current animation
[ "this", "method", "ensure", "not", "null", "value", "for", "current", "animation" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXAlert.java#L210-L214
130,324
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXAlert.java
JFXAlert.hideWithAnimation
public void hideWithAnimation() { if (transition == null || transition.getStatus().equals(Animation.Status.STOPPED)) { JFXAlertAnimation currentAnimation = getCurrentAnimation(); Animation animation = currentAnimation.createHidingAnimation(getDialogPane().getContent(), getDialogPane()); ...
java
public void hideWithAnimation() { if (transition == null || transition.getStatus().equals(Animation.Status.STOPPED)) { JFXAlertAnimation currentAnimation = getCurrentAnimation(); Animation animation = currentAnimation.createHidingAnimation(getDialogPane().getContent(), getDialogPane()); ...
[ "public", "void", "hideWithAnimation", "(", ")", "{", "if", "(", "transition", "==", "null", "||", "transition", ".", "getStatus", "(", ")", ".", "equals", "(", "Animation", ".", "Status", ".", "STOPPED", ")", ")", "{", "JFXAlertAnimation", "currentAnimation...
play the hide animation for the dialog, as the java hide method is set to final so it can not be overridden
[ "play", "the", "hide", "animation", "for", "the", "dialog", "as", "the", "java", "hide", "method", "is", "set", "to", "final", "so", "it", "can", "not", "be", "overridden" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXAlert.java#L273-L291
130,325
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/cells/editors/base/JFXTreeTableCell.java
JFXTreeTableCell.getDisclosureNode
public final Node getDisclosureNode() { if (disclosureNode.get() == null) { final StackPane disclosureNode = new StackPane(); disclosureNode.getStyleClass().setAll("tree-disclosure-node"); disclosureNode.setMouseTransparent(true); final StackPane disclosureNodeAr...
java
public final Node getDisclosureNode() { if (disclosureNode.get() == null) { final StackPane disclosureNode = new StackPane(); disclosureNode.getStyleClass().setAll("tree-disclosure-node"); disclosureNode.setMouseTransparent(true); final StackPane disclosureNodeAr...
[ "public", "final", "Node", "getDisclosureNode", "(", ")", "{", "if", "(", "disclosureNode", ".", "get", "(", ")", "==", "null", ")", "{", "final", "StackPane", "disclosureNode", "=", "new", "StackPane", "(", ")", ";", "disclosureNode", ".", "getStyleClass", ...
Returns the current disclosure node set in this cell.
[ "Returns", "the", "current", "disclosure", "node", "set", "in", "this", "cell", "." ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/cells/editors/base/JFXTreeTableCell.java#L48-L60
130,326
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java
JFXRippler.positionControl
protected void positionControl(Node control) { if(this.position.get() == RipplerPos.BACK){ getChildren().add(control); }else{ getChildren().add(0, control); } }
java
protected void positionControl(Node control) { if(this.position.get() == RipplerPos.BACK){ getChildren().add(control); }else{ getChildren().add(0, control); } }
[ "protected", "void", "positionControl", "(", "Node", "control", ")", "{", "if", "(", "this", ".", "position", ".", "get", "(", ")", "==", "RipplerPos", ".", "BACK", ")", "{", "getChildren", "(", ")", ".", "add", "(", "control", ")", ";", "}", "else",...
Override this method to create JFXRippler for a control outside the ripple
[ "Override", "this", "method", "to", "create", "JFXRippler", "for", "a", "control", "outside", "the", "ripple" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java#L174-L180
130,327
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java
JFXRippler.getMask
protected Node getMask() { double borderWidth = ripplerPane.getBorder() != null ? ripplerPane.getBorder().getInsets().getTop() : 0; Bounds bounds = control.getBoundsInParent(); double width = control.getLayoutBounds().getWidth(); double height = control.getLayoutBounds().getHeight(); ...
java
protected Node getMask() { double borderWidth = ripplerPane.getBorder() != null ? ripplerPane.getBorder().getInsets().getTop() : 0; Bounds bounds = control.getBoundsInParent(); double width = control.getLayoutBounds().getWidth(); double height = control.getLayoutBounds().getHeight(); ...
[ "protected", "Node", "getMask", "(", ")", "{", "double", "borderWidth", "=", "ripplerPane", ".", "getBorder", "(", ")", "!=", "null", "?", "ripplerPane", ".", "getBorder", "(", ")", ".", "getInsets", "(", ")", ".", "getTop", "(", ")", ":", "0", ";", ...
generate the clipping mask @return the mask node
[ "generate", "the", "clipping", "mask" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java#L204-L247
130,328
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java
JFXRippler.computeRippleRadius
protected double computeRippleRadius() { double width2 = control.getLayoutBounds().getWidth() * control.getLayoutBounds().getWidth(); double height2 = control.getLayoutBounds().getHeight() * control.getLayoutBounds().getHeight(); return Math.min(Math.sqrt(width2 + height2), RIPPLE_MAX_RADIUS) * ...
java
protected double computeRippleRadius() { double width2 = control.getLayoutBounds().getWidth() * control.getLayoutBounds().getWidth(); double height2 = control.getLayoutBounds().getHeight() * control.getLayoutBounds().getHeight(); return Math.min(Math.sqrt(width2 + height2), RIPPLE_MAX_RADIUS) * ...
[ "protected", "double", "computeRippleRadius", "(", ")", "{", "double", "width2", "=", "control", ".", "getLayoutBounds", "(", ")", ".", "getWidth", "(", ")", "*", "control", ".", "getLayoutBounds", "(", ")", ".", "getWidth", "(", ")", ";", "double", "heigh...
compute the ripple radius @return the ripple radius size
[ "compute", "the", "ripple", "radius" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java#L253-L257
130,329
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java
JFXRippler.initControlListeners
protected void initControlListeners() { // if the control got resized the overlay rect must be rest control.layoutBoundsProperty().addListener(observable -> resetRippler()); if(getChildren().contains(control)) control.boundsInParentProperty().addListener(observable -> resetRippler())...
java
protected void initControlListeners() { // if the control got resized the overlay rect must be rest control.layoutBoundsProperty().addListener(observable -> resetRippler()); if(getChildren().contains(control)) control.boundsInParentProperty().addListener(observable -> resetRippler())...
[ "protected", "void", "initControlListeners", "(", ")", "{", "// if the control got resized the overlay rect must be rest", "control", ".", "layoutBoundsProperty", "(", ")", ".", "addListener", "(", "observable", "->", "resetRippler", "(", ")", ")", ";", "if", "(", "ge...
init mouse listeners on the control
[ "init", "mouse", "listeners", "on", "the", "control" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java#L267-L276
130,330
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java
JFXRippler.createRipple
protected void createRipple(double x, double y) { if(!isRipplerDisabled()) { rippler.setGeneratorCenterX(x); rippler.setGeneratorCenterY(y); rippler.createRipple(); } }
java
protected void createRipple(double x, double y) { if(!isRipplerDisabled()) { rippler.setGeneratorCenterX(x); rippler.setGeneratorCenterY(y); rippler.createRipple(); } }
[ "protected", "void", "createRipple", "(", "double", "x", ",", "double", "y", ")", "{", "if", "(", "!", "isRipplerDisabled", "(", ")", ")", "{", "rippler", ".", "setGeneratorCenterX", "(", "x", ")", ";", "rippler", ".", "setGeneratorCenterY", "(", "y", ")...
creates Ripple effect
[ "creates", "Ripple", "effect" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java#L281-L287
130,331
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java
JFXRippler.createManualRipple
public Runnable createManualRipple() { if(!isRipplerDisabled()) { rippler.setGeneratorCenterX(control.getLayoutBounds().getWidth() / 2); rippler.setGeneratorCenterY(control.getLayoutBounds().getHeight() / 2); rippler.createRipple(); return () -> { ...
java
public Runnable createManualRipple() { if(!isRipplerDisabled()) { rippler.setGeneratorCenterX(control.getLayoutBounds().getWidth() / 2); rippler.setGeneratorCenterY(control.getLayoutBounds().getHeight() / 2); rippler.createRipple(); return () -> { ...
[ "public", "Runnable", "createManualRipple", "(", ")", "{", "if", "(", "!", "isRipplerDisabled", "(", ")", ")", "{", "rippler", ".", "setGeneratorCenterX", "(", "control", ".", "getLayoutBounds", "(", ")", ".", "getWidth", "(", ")", "/", "2", ")", ";", "r...
creates Ripple effect in the center of the control @return a runnable to release the ripple when needed
[ "creates", "Ripple", "effect", "in", "the", "center", "of", "the", "control" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXRippler.java#L297-L308
130,332
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/transitions/JFXAnimationTimer.java
JFXAnimationTimer.reverseAndContinue
public void reverseAndContinue() { if (isRunning()) { super.stop(); for (AnimationHandler handler : animationHandlers) { handler.reverse(totalElapsedMilliseconds); } startTime = -1; super.start(); } else { start(); ...
java
public void reverseAndContinue() { if (isRunning()) { super.stop(); for (AnimationHandler handler : animationHandlers) { handler.reverse(totalElapsedMilliseconds); } startTime = -1; super.start(); } else { start(); ...
[ "public", "void", "reverseAndContinue", "(", ")", "{", "if", "(", "isRunning", "(", ")", ")", "{", "super", ".", "stop", "(", ")", ";", "for", "(", "AnimationHandler", "handler", ":", "animationHandlers", ")", "{", "handler", ".", "reverse", "(", "totalE...
this method will pause the timer and reverse the animation if the timer already started otherwise it will start the animation.
[ "this", "method", "will", "pause", "the", "timer", "and", "reverse", "the", "animation", "if", "the", "timer", "already", "started", "otherwise", "it", "will", "start", "the", "animation", "." ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/transitions/JFXAnimationTimer.java#L119-L130
130,333
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/skins/JFXNestedTableColumnHeader.java
JFXNestedTableColumnHeader.createTableColumnHeader
protected TableColumnHeader createTableColumnHeader(TableColumnBase col) { return col.getColumns().isEmpty() ? new JFXTableColumnHeader(getTableViewSkin(), col) : new NestedTableColumnHeader(getTableViewSkin(), col); }
java
protected TableColumnHeader createTableColumnHeader(TableColumnBase col) { return col.getColumns().isEmpty() ? new JFXTableColumnHeader(getTableViewSkin(), col) : new NestedTableColumnHeader(getTableViewSkin(), col); }
[ "protected", "TableColumnHeader", "createTableColumnHeader", "(", "TableColumnBase", "col", ")", "{", "return", "col", ".", "getColumns", "(", ")", ".", "isEmpty", "(", ")", "?", "new", "JFXTableColumnHeader", "(", "getTableViewSkin", "(", ")", ",", "col", ")", ...
protected to allow subclasses to customise the column header types
[ "protected", "to", "allow", "subclasses", "to", "customise", "the", "column", "header", "types" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/skins/JFXNestedTableColumnHeader.java#L38-L42
130,334
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXPopup.java
JFXPopup.show
public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign) { this.show(node, vAlign, hAlign, 0, 0); }
java
public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign) { this.show(node, vAlign, hAlign, 0, 0); }
[ "public", "void", "show", "(", "Node", "node", ",", "PopupVPosition", "vAlign", ",", "PopupHPosition", "hAlign", ")", "{", "this", ".", "show", "(", "node", ",", "vAlign", ",", "hAlign", ",", "0", ",", "0", ")", ";", "}" ]
show the popup according to the specified position @param vAlign can be TOP/BOTTOM @param hAlign can be LEFT/RIGHT
[ "show", "the", "popup", "according", "to", "the", "specified", "position" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXPopup.java#L123-L125
130,335
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXPopup.java
JFXPopup.show
public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) { if (!isShowing()) { if (node.getScene() == null || node.getScene().getWindow() == null) { throw new IllegalStateException("Can not show popup. The node must be attached...
java
public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) { if (!isShowing()) { if (node.getScene() == null || node.getScene().getWindow() == null) { throw new IllegalStateException("Can not show popup. The node must be attached...
[ "public", "void", "show", "(", "Node", "node", ",", "PopupVPosition", "vAlign", ",", "PopupHPosition", "hAlign", ",", "double", "initOffsetX", ",", "double", "initOffsetY", ")", "{", "if", "(", "!", "isShowing", "(", ")", ")", "{", "if", "(", "node", "."...
show the popup according to the specified position with a certain offset @param vAlign can be TOP/BOTTOM @param hAlign can be LEFT/RIGHT @param initOffsetX on the x axis @param initOffsetY on the y axis
[ "show", "the", "popup", "according", "to", "the", "specified", "position", "with", "a", "certain", "offset" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXPopup.java#L135-L151
130,336
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java
JFXTreeTableView.group
public void group(TreeTableColumn<S, ?>... treeTableColumns) { try { lock.lock(); // init groups map if (groupOrder.size() == 0) { groups = new HashMap<>(); } try { if (originalRoot == null) { origina...
java
public void group(TreeTableColumn<S, ?>... treeTableColumns) { try { lock.lock(); // init groups map if (groupOrder.size() == 0) { groups = new HashMap<>(); } try { if (originalRoot == null) { origina...
[ "public", "void", "group", "(", "TreeTableColumn", "<", "S", ",", "?", ">", "...", "treeTableColumns", ")", "{", "try", "{", "lock", ".", "lock", "(", ")", ";", "// init groups map", "if", "(", "groupOrder", ".", "size", "(", ")", "==", "0", ")", "{"...
this is a blocking method so it should not be called from the ui thread, it will regroup the tree table view @param treeTableColumns
[ "this", "is", "a", "blocking", "method", "so", "it", "should", "not", "be", "called", "from", "the", "ui", "thread", "it", "will", "regroup", "the", "tree", "table", "view" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java#L202-L228
130,337
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java
JFXTreeTableView.unGroup
public void unGroup(TreeTableColumn<S, ?>... treeTableColumns) { try { lock.lock(); if (groupOrder.size() > 0) { groupOrder.removeAll(treeTableColumns); List<TreeTableColumn<S, ?>> grouped = new ArrayList<>(); grouped.addAll(groupOrder); ...
java
public void unGroup(TreeTableColumn<S, ?>... treeTableColumns) { try { lock.lock(); if (groupOrder.size() > 0) { groupOrder.removeAll(treeTableColumns); List<TreeTableColumn<S, ?>> grouped = new ArrayList<>(); grouped.addAll(groupOrder); ...
[ "public", "void", "unGroup", "(", "TreeTableColumn", "<", "S", ",", "?", ">", "...", "treeTableColumns", ")", "{", "try", "{", "lock", ".", "lock", "(", ")", ";", "if", "(", "groupOrder", ".", "size", "(", ")", ">", "0", ")", "{", "groupOrder", "."...
this is a blocking method so it should not be called from the ui thread, it will ungroup the tree table view @param treeTableColumns
[ "this", "is", "a", "blocking", "method", "so", "it", "should", "not", "be", "called", "from", "the", "ui", "thread", "it", "will", "ungroup", "the", "tree", "table", "view" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java#L246-L275
130,338
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java
JFXTreeTableView.filter
private void filter(Predicate<TreeItem<S>> predicate) { if (task != null) { task.cancel(false); } task = threadPool.schedule(filterRunnable, 200, TimeUnit.MILLISECONDS); }
java
private void filter(Predicate<TreeItem<S>> predicate) { if (task != null) { task.cancel(false); } task = threadPool.schedule(filterRunnable, 200, TimeUnit.MILLISECONDS); }
[ "private", "void", "filter", "(", "Predicate", "<", "TreeItem", "<", "S", ">", ">", "predicate", ")", "{", "if", "(", "task", "!=", "null", ")", "{", "task", ".", "cancel", "(", "false", ")", ";", "}", "task", "=", "threadPool", ".", "schedule", "(...
this method will filter the tree table
[ "this", "method", "will", "filter", "the", "tree", "table" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java#L394-L399
130,339
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/utils/JFXUtilities.java
JFXUtilities.runInFX
public static void runInFX(Runnable doRun) { if (Platform.isFxApplicationThread()) { doRun.run(); return; } Platform.runLater(doRun); }
java
public static void runInFX(Runnable doRun) { if (Platform.isFxApplicationThread()) { doRun.run(); return; } Platform.runLater(doRun); }
[ "public", "static", "void", "runInFX", "(", "Runnable", "doRun", ")", "{", "if", "(", "Platform", ".", "isFxApplicationThread", "(", ")", ")", "{", "doRun", ".", "run", "(", ")", ";", "return", ";", "}", "Platform", ".", "runLater", "(", "doRun", ")", ...
This method is used to run a specified Runnable in the FX Application thread, it returns before the task finished execution @param doRun This is the sepcifed task to be excuted by the FX Application thread @return Nothing
[ "This", "method", "is", "used", "to", "run", "a", "specified", "Runnable", "in", "the", "FX", "Application", "thread", "it", "returns", "before", "the", "task", "finished", "execution" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/utils/JFXUtilities.java#L48-L54
130,340
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/utils/JFXUtilities.java
JFXUtilities.runInFXAndWait
public static void runInFXAndWait(Runnable doRun) { if (Platform.isFxApplicationThread()) { doRun.run(); return; } final CountDownLatch doneLatch = new CountDownLatch(1); Platform.runLater(() -> { try { doRun.run(); } finall...
java
public static void runInFXAndWait(Runnable doRun) { if (Platform.isFxApplicationThread()) { doRun.run(); return; } final CountDownLatch doneLatch = new CountDownLatch(1); Platform.runLater(() -> { try { doRun.run(); } finall...
[ "public", "static", "void", "runInFXAndWait", "(", "Runnable", "doRun", ")", "{", "if", "(", "Platform", ".", "isFxApplicationThread", "(", ")", ")", "{", "doRun", ".", "run", "(", ")", ";", "return", ";", "}", "final", "CountDownLatch", "doneLatch", "=", ...
This method is used to run a specified Runnable in the FX Application thread, it waits for the task to finish before returning to the main thread. @param doRun This is the sepcifed task to be excuted by the FX Application thread @return Nothing
[ "This", "method", "is", "used", "to", "run", "a", "specified", "Runnable", "in", "the", "FX", "Application", "thread", "it", "waits", "for", "the", "task", "to", "finish", "before", "returning", "to", "the", "main", "thread", "." ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/utils/JFXUtilities.java#L63-L81
130,341
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/svg/SVGGlyph.java
SVGGlyph.setSize
public void setSize(double width, double height) { this.setMinSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE); this.setPrefSize(width, height); this.setMaxSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE); }
java
public void setSize(double width, double height) { this.setMinSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE); this.setPrefSize(width, height); this.setMaxSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE); }
[ "public", "void", "setSize", "(", "double", "width", ",", "double", "height", ")", "{", "this", ".", "setMinSize", "(", "StackPane", ".", "USE_PREF_SIZE", ",", "StackPane", ".", "USE_PREF_SIZE", ")", ";", "this", ".", "setPrefSize", "(", "width", ",", "hei...
resize the svg to a certain width and height @param width @param height
[ "resize", "the", "svg", "to", "a", "certain", "width", "and", "height" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/svg/SVGGlyph.java#L145-L149
130,342
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/utils/JFXHighlighter.java
JFXHighlighter.highlight
public synchronized void highlight(Parent pane, String query) { if (this.parent != null && !boxes.isEmpty()) { clear(); } if(query == null || query.isEmpty()) return; this.parent = pane; Set<Node> nodes = getTextNodes(pane); ArrayList<Rectangle> allRectangl...
java
public synchronized void highlight(Parent pane, String query) { if (this.parent != null && !boxes.isEmpty()) { clear(); } if(query == null || query.isEmpty()) return; this.parent = pane; Set<Node> nodes = getTextNodes(pane); ArrayList<Rectangle> allRectangl...
[ "public", "synchronized", "void", "highlight", "(", "Parent", "pane", ",", "String", "query", ")", "{", "if", "(", "this", ".", "parent", "!=", "null", "&&", "!", "boxes", ".", "isEmpty", "(", ")", ")", "{", "clear", "(", ")", ";", "}", "if", "(", ...
highlights the matching text in the specified pane @param pane node to search into its text @param query search text
[ "highlights", "the", "matching", "text", "in", "the", "specified", "pane" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/utils/JFXHighlighter.java#L80-L117
130,343
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/svg/SVGGlyphLoader.java
SVGGlyphLoader.getIcoMoonGlyph
public static SVGGlyph getIcoMoonGlyph(String glyphName) throws Exception{ SVGGlyphBuilder builder = glyphsMap.get(glyphName); if(builder == null) throw new Exception("Glyph '" + glyphName + "' not found!"); SVGGlyph glyph = builder.build(); // we need to apply transformation to correct ...
java
public static SVGGlyph getIcoMoonGlyph(String glyphName) throws Exception{ SVGGlyphBuilder builder = glyphsMap.get(glyphName); if(builder == null) throw new Exception("Glyph '" + glyphName + "' not found!"); SVGGlyph glyph = builder.build(); // we need to apply transformation to correct ...
[ "public", "static", "SVGGlyph", "getIcoMoonGlyph", "(", "String", "glyphName", ")", "throws", "Exception", "{", "SVGGlyphBuilder", "builder", "=", "glyphsMap", ".", "get", "(", "glyphName", ")", ";", "if", "(", "builder", "==", "null", ")", "throw", "new", "...
will retrieve icons from the glyphs map for a certain glyphName @param glyphName the glyph name @return SVGGlyph node
[ "will", "retrieve", "icons", "from", "the", "glyphs", "map", "for", "a", "certain", "glyphName" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/svg/SVGGlyphLoader.java#L65-L76
130,344
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/svg/SVGGlyphLoader.java
SVGGlyphLoader.loadGlyphsFont
public static void loadGlyphsFont(InputStream stream, String keyPrefix) throws IOException { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); docBuilder.setEntityResolver((publicId, ...
java
public static void loadGlyphsFont(InputStream stream, String keyPrefix) throws IOException { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); docBuilder.setEntityResolver((publicId, ...
[ "public", "static", "void", "loadGlyphsFont", "(", "InputStream", "stream", ",", "String", "keyPrefix", ")", "throws", "IOException", "{", "try", "{", "DocumentBuilderFactory", "docFactory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "Document...
will load SVG icons from input stream @param stream input stream of svg font file @param keyPrefix will be used as a prefix when storing SVG icons in the map @throws IOException
[ "will", "load", "SVG", "icons", "from", "input", "stream" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/svg/SVGGlyphLoader.java#L133-L167
130,345
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/svg/SVGGlyphLoader.java
SVGGlyphLoader.loadGlyph
public static SVGGlyph loadGlyph(URL url) throws IOException { String urlString = url.toString(); String filename = urlString.substring(urlString.lastIndexOf('/') + 1); int startPos = 0; int endPos = 0; while (endPos < filename.length() && filename.charAt(endPos) != '-') { ...
java
public static SVGGlyph loadGlyph(URL url) throws IOException { String urlString = url.toString(); String filename = urlString.substring(urlString.lastIndexOf('/') + 1); int startPos = 0; int endPos = 0; while (endPos < filename.length() && filename.charAt(endPos) != '-') { ...
[ "public", "static", "SVGGlyph", "loadGlyph", "(", "URL", "url", ")", "throws", "IOException", "{", "String", "urlString", "=", "url", ".", "toString", "(", ")", ";", "String", "filename", "=", "urlString", ".", "substring", "(", "urlString", ".", "lastIndexO...
load a single svg icon from a file @param url of the svg icon @return SVGGLyph node @throws IOException
[ "load", "a", "single", "svg", "icon", "from", "a", "file" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/svg/SVGGlyphLoader.java#L176-L194
130,346
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/cells/editors/base/GenericEditableTreeTableCell.java
GenericEditableTreeTableCell.checkGroupedColumn
private boolean checkGroupedColumn() { boolean allowEdit = true; if (getTreeTableRow().getTreeItem() != null) { Object rowObject = getTreeTableRow().getTreeItem().getValue(); if (rowObject instanceof RecursiveTreeObject && rowObject.getClass() == RecursiveTreeObject.class) { ...
java
private boolean checkGroupedColumn() { boolean allowEdit = true; if (getTreeTableRow().getTreeItem() != null) { Object rowObject = getTreeTableRow().getTreeItem().getValue(); if (rowObject instanceof RecursiveTreeObject && rowObject.getClass() == RecursiveTreeObject.class) { ...
[ "private", "boolean", "checkGroupedColumn", "(", ")", "{", "boolean", "allowEdit", "=", "true", ";", "if", "(", "getTreeTableRow", "(", ")", ".", "getTreeItem", "(", ")", "!=", "null", ")", "{", "Object", "rowObject", "=", "getTreeTableRow", "(", ")", ".",...
only allows editing for items that are not grouped @return whether the item is grouped or not
[ "only", "allows", "editing", "for", "items", "that", "are", "not", "grouped" ]
53235b5f561da4a515ef716059b8a8df5239ffa1
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/cells/editors/base/GenericEditableTreeTableCell.java#L148-L166
130,347
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JmxRegistration.java
JmxRegistration.registerMXBean
public static void registerMXBean(Cache<?, ?> cache, Object mxbean, MBeanType type) { ObjectName objectName = getObjectName(cache, type); register(objectName, mxbean); }
java
public static void registerMXBean(Cache<?, ?> cache, Object mxbean, MBeanType type) { ObjectName objectName = getObjectName(cache, type); register(objectName, mxbean); }
[ "public", "static", "void", "registerMXBean", "(", "Cache", "<", "?", ",", "?", ">", "cache", ",", "Object", "mxbean", ",", "MBeanType", "type", ")", "{", "ObjectName", "objectName", "=", "getObjectName", "(", "cache", ",", "type", ")", ";", "register", ...
Registers the JMX management bean for the cache. @param cache the cache to register @param mxbean the management bean @param type the mxbean type
[ "Registers", "the", "JMX", "management", "bean", "for", "the", "cache", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JmxRegistration.java#L49-L52
130,348
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JmxRegistration.java
JmxRegistration.unregisterMXBean
public static void unregisterMXBean(CacheProxy<?, ?> cache, MBeanType type) { ObjectName objectName = getObjectName(cache, type); unregister(objectName); }
java
public static void unregisterMXBean(CacheProxy<?, ?> cache, MBeanType type) { ObjectName objectName = getObjectName(cache, type); unregister(objectName); }
[ "public", "static", "void", "unregisterMXBean", "(", "CacheProxy", "<", "?", ",", "?", ">", "cache", ",", "MBeanType", "type", ")", "{", "ObjectName", "objectName", "=", "getObjectName", "(", "cache", ",", "type", ")", ";", "unregister", "(", "objectName", ...
Unregisters the JMX management bean for the cache. @param cache the cache to unregister @param type the mxbean type
[ "Unregisters", "the", "JMX", "management", "bean", "for", "the", "cache", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JmxRegistration.java#L60-L63
130,349
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JmxRegistration.java
JmxRegistration.register
private static void register(ObjectName objectName, Object mbean) { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); try { if (!server.isRegistered(objectName)) { server.registerMBean(mbean, objectName); } } catch (InstanceAlreadyExistsException | MBeanRegistratio...
java
private static void register(ObjectName objectName, Object mbean) { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); try { if (!server.isRegistered(objectName)) { server.registerMBean(mbean, objectName); } } catch (InstanceAlreadyExistsException | MBeanRegistratio...
[ "private", "static", "void", "register", "(", "ObjectName", "objectName", ",", "Object", "mbean", ")", "{", "MBeanServer", "server", "=", "ManagementFactory", ".", "getPlatformMBeanServer", "(", ")", ";", "try", "{", "if", "(", "!", "server", ".", "isRegistere...
Registers the management bean with the given object name.
[ "Registers", "the", "management", "bean", "with", "the", "given", "object", "name", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JmxRegistration.java#L66-L76
130,350
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JmxRegistration.java
JmxRegistration.getObjectName
private static ObjectName getObjectName(Cache<?, ?> cache, MBeanType type) { String cacheManagerName = sanitize(cache.getCacheManager().getURI().toString()); String cacheName = sanitize(cache.getName()); try { String name = String.format("javax.cache:type=Cache%s,CacheManager=%s,Cache=%s", ...
java
private static ObjectName getObjectName(Cache<?, ?> cache, MBeanType type) { String cacheManagerName = sanitize(cache.getCacheManager().getURI().toString()); String cacheName = sanitize(cache.getName()); try { String name = String.format("javax.cache:type=Cache%s,CacheManager=%s,Cache=%s", ...
[ "private", "static", "ObjectName", "getObjectName", "(", "Cache", "<", "?", ",", "?", ">", "cache", ",", "MBeanType", "type", ")", "{", "String", "cacheManagerName", "=", "sanitize", "(", "cache", ".", "getCacheManager", "(", ")", ".", "getURI", "(", ")", ...
Returns the object name of the management bean.
[ "Returns", "the", "object", "name", "of", "the", "management", "bean", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JmxRegistration.java#L91-L104
130,351
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java
LocalAsyncLoadingCache.canBulkLoad
private static boolean canBulkLoad(AsyncCacheLoader<?, ?> loader) { try { Class<?> defaultLoaderClass = AsyncCacheLoader.class; if (loader instanceof CacheLoader<?, ?>) { defaultLoaderClass = CacheLoader.class; Method classLoadAll = loader.getClass().getMethod("loadAll", Iterable.class)...
java
private static boolean canBulkLoad(AsyncCacheLoader<?, ?> loader) { try { Class<?> defaultLoaderClass = AsyncCacheLoader.class; if (loader instanceof CacheLoader<?, ?>) { defaultLoaderClass = CacheLoader.class; Method classLoadAll = loader.getClass().getMethod("loadAll", Iterable.class)...
[ "private", "static", "boolean", "canBulkLoad", "(", "AsyncCacheLoader", "<", "?", ",", "?", ">", "loader", ")", "{", "try", "{", "Class", "<", "?", ">", "defaultLoaderClass", "=", "AsyncCacheLoader", ".", "class", ";", "if", "(", "loader", "instanceof", "C...
Returns whether the supplied cache loader has bulk load functionality.
[ "Returns", "whether", "the", "supplied", "cache", "loader", "has", "bulk", "load", "functionality", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java#L55-L77
130,352
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/SingleConsumerQueue.java
SingleConsumerQueue.index
static int index() { int probe = UnsafeAccess.UNSAFE.getInt(Thread.currentThread(), PROBE); if (probe == 0) { ThreadLocalRandom.current(); // force initialization probe = UnsafeAccess.UNSAFE.getInt(Thread.currentThread(), PROBE); } return (probe & ARENA_MASK); }
java
static int index() { int probe = UnsafeAccess.UNSAFE.getInt(Thread.currentThread(), PROBE); if (probe == 0) { ThreadLocalRandom.current(); // force initialization probe = UnsafeAccess.UNSAFE.getInt(Thread.currentThread(), PROBE); } return (probe & ARENA_MASK); }
[ "static", "int", "index", "(", ")", "{", "int", "probe", "=", "UnsafeAccess", ".", "UNSAFE", ".", "getInt", "(", "Thread", ".", "currentThread", "(", ")", ",", "PROBE", ")", ";", "if", "(", "probe", "==", "0", ")", "{", "ThreadLocalRandom", ".", "cur...
Returns the arena index for the current thread.
[ "Returns", "the", "arena", "index", "for", "the", "current", "thread", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/SingleConsumerQueue.java#L363-L370
130,353
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/WindowTinyLfuPolicy.java
WindowTinyLfuPolicy.onWindowHit
private void onWindowHit(Node node) { admittor.record(node.key); node.moveToTail(headWindow); }
java
private void onWindowHit(Node node) { admittor.record(node.key); node.moveToTail(headWindow); }
[ "private", "void", "onWindowHit", "(", "Node", "node", ")", "{", "admittor", ".", "record", "(", "node", ".", "key", ")", ";", "node", ".", "moveToTail", "(", "headWindow", ")", ";", "}" ]
Moves the entry to the MRU position in the admission window.
[ "Moves", "the", "entry", "to", "the", "MRU", "position", "in", "the", "admission", "window", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/WindowTinyLfuPolicy.java#L129-L132
130,354
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/WindowTinyLfuPolicy.java
WindowTinyLfuPolicy.onProtectedHit
private void onProtectedHit(Node node) { admittor.record(node.key); node.moveToTail(headProtected); }
java
private void onProtectedHit(Node node) { admittor.record(node.key); node.moveToTail(headProtected); }
[ "private", "void", "onProtectedHit", "(", "Node", "node", ")", "{", "admittor", ".", "record", "(", "node", ".", "key", ")", ";", "node", ".", "moveToTail", "(", "headProtected", ")", ";", "}" ]
Moves the entry to the MRU position, if it falls outside of the fast-path threshold.
[ "Moves", "the", "entry", "to", "the", "MRU", "position", "if", "it", "falls", "outside", "of", "the", "fast", "-", "path", "threshold", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/WindowTinyLfuPolicy.java#L153-L156
130,355
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/NodeRule.java
NodeRule.newGetRef
protected final MethodSpec newGetRef(String varName) { MethodSpec.Builder getter = MethodSpec.methodBuilder("get" + capitalize(varName) + "Reference") .addModifiers(context.publicFinalModifiers()) .returns(Object.class); getter.addStatement("return $T.UNSAFE.getObject(this, $N)", UNSAFE_...
java
protected final MethodSpec newGetRef(String varName) { MethodSpec.Builder getter = MethodSpec.methodBuilder("get" + capitalize(varName) + "Reference") .addModifiers(context.publicFinalModifiers()) .returns(Object.class); getter.addStatement("return $T.UNSAFE.getObject(this, $N)", UNSAFE_...
[ "protected", "final", "MethodSpec", "newGetRef", "(", "String", "varName", ")", "{", "MethodSpec", ".", "Builder", "getter", "=", "MethodSpec", ".", "methodBuilder", "(", "\"get\"", "+", "capitalize", "(", "varName", ")", "+", "\"Reference\"", ")", ".", "addMo...
Creates an accessor that returns the reference.
[ "Creates", "an", "accessor", "that", "returns", "the", "reference", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/NodeRule.java#L98-L105
130,356
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/NodeRule.java
NodeRule.newGetter
protected final MethodSpec newGetter(Strength strength, TypeName varType, String varName, Visibility visibility) { MethodSpec.Builder getter = MethodSpec.methodBuilder("get" + capitalize(varName)) .addModifiers(context.publicFinalModifiers()) .returns(varType); String type; if (varType...
java
protected final MethodSpec newGetter(Strength strength, TypeName varType, String varName, Visibility visibility) { MethodSpec.Builder getter = MethodSpec.methodBuilder("get" + capitalize(varName)) .addModifiers(context.publicFinalModifiers()) .returns(varType); String type; if (varType...
[ "protected", "final", "MethodSpec", "newGetter", "(", "Strength", "strength", ",", "TypeName", "varType", ",", "String", "varName", ",", "Visibility", "visibility", ")", "{", "MethodSpec", ".", "Builder", "getter", "=", "MethodSpec", ".", "methodBuilder", "(", "...
Creates an accessor that returns the unwrapped variable.
[ "Creates", "an", "accessor", "that", "returns", "the", "unwrapped", "variable", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/NodeRule.java#L108-L140
130,357
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/NodeRule.java
NodeRule.newSetter
protected final MethodSpec newSetter(TypeName varType, String varName, Visibility visibility) { String methodName = "set" + Character.toUpperCase(varName.charAt(0)) + varName.substring(1); String type; if (varType.isPrimitive()) { type = varType.equals(TypeName.INT) ? "Int" : "Long"; } else { ...
java
protected final MethodSpec newSetter(TypeName varType, String varName, Visibility visibility) { String methodName = "set" + Character.toUpperCase(varName.charAt(0)) + varName.substring(1); String type; if (varType.isPrimitive()) { type = varType.equals(TypeName.INT) ? "Int" : "Long"; } else { ...
[ "protected", "final", "MethodSpec", "newSetter", "(", "TypeName", "varType", ",", "String", "varName", ",", "Visibility", "visibility", ")", "{", "String", "methodName", "=", "\"set\"", "+", "Character", ".", "toUpperCase", "(", "varName", ".", "charAt", "(", ...
Creates a mutator to the variable.
[ "Creates", "a", "mutator", "to", "the", "variable", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/NodeRule.java#L143-L162
130,358
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java
ClockProPolicy.add
private void add(Node node) { evict(); if (handHot == null) { handHot = handCold = handTest = node; node.next = node.prev = node; } else { node.prev = handHot; node.next = handHot.next; handHot.next.prev = node; handHot.next = node; } if (handCold == handHot) { ...
java
private void add(Node node) { evict(); if (handHot == null) { handHot = handCold = handTest = node; node.next = node.prev = node; } else { node.prev = handHot; node.next = handHot.next; handHot.next.prev = node; handHot.next = node; } if (handCold == handHot) { ...
[ "private", "void", "add", "(", "Node", "node", ")", "{", "evict", "(", ")", ";", "if", "(", "handHot", "==", "null", ")", "{", "handHot", "=", "handCold", "=", "handTest", "=", "node", ";", "node", ".", "next", "=", "node", ".", "prev", "=", "nod...
Add meta data after hand hot, evict data if required, and update hands accordingly.
[ "Add", "meta", "data", "after", "hand", "hot", "evict", "data", "if", "required", "and", "update", "hands", "accordingly", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java#L152-L171
130,359
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java
ClockProPolicy.delete
private void delete(Node node) { if (handHot == node) { handHot = node.next; } if (handCold == node) { handCold = node.next; } if (handTest == node) { handTest = node.next; } node.remove(); }
java
private void delete(Node node) { if (handHot == node) { handHot = node.next; } if (handCold == node) { handCold = node.next; } if (handTest == node) { handTest = node.next; } node.remove(); }
[ "private", "void", "delete", "(", "Node", "node", ")", "{", "if", "(", "handHot", "==", "node", ")", "{", "handHot", "=", "node", ".", "next", ";", "}", "if", "(", "handCold", "==", "node", ")", "{", "handCold", "=", "node", ".", "next", ";", "}"...
Delete meta data data, update hands accordingly.
[ "Delete", "meta", "data", "data", "update", "hands", "accordingly", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java#L174-L185
130,360
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java
ClockProPolicy.scanHot
private void scanHot() { // As mentioned above, what triggers the movement of handHot is that a cold page is found to // have been accessed in its test period and thus turns into a hot page, which maybe accordingly // turns the hot page with the largest recency into a cold page. If the reference bit of the ...
java
private void scanHot() { // As mentioned above, what triggers the movement of handHot is that a cold page is found to // have been accessed in its test period and thus turns into a hot page, which maybe accordingly // turns the hot page with the largest recency into a cold page. If the reference bit of the ...
[ "private", "void", "scanHot", "(", ")", "{", "// As mentioned above, what triggers the movement of handHot is that a cold page is found to", "// have been accessed in its test period and thus turns into a hot page, which maybe accordingly", "// turns the hot page with the largest recency into a cold...
Moves the hot hand forward.
[ "Moves", "the", "hot", "hand", "forward", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java#L205-L235
130,361
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/base/UnsafeAccess.java
UnsafeAccess.objectFieldOffset
public static long objectFieldOffset(Class<?> clazz, String fieldName) { try { return UNSAFE.objectFieldOffset(clazz.getDeclaredField(fieldName)); } catch (NoSuchFieldException | SecurityException e) { throw new Error(e); } }
java
public static long objectFieldOffset(Class<?> clazz, String fieldName) { try { return UNSAFE.objectFieldOffset(clazz.getDeclaredField(fieldName)); } catch (NoSuchFieldException | SecurityException e) { throw new Error(e); } }
[ "public", "static", "long", "objectFieldOffset", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fieldName", ")", "{", "try", "{", "return", "UNSAFE", ".", "objectFieldOffset", "(", "clazz", ".", "getDeclaredField", "(", "fieldName", ")", ")", ";", "...
Returns the location of a given static field. @param clazz the class containing the field @param fieldName the name of the field @return the address offset of the field
[ "Returns", "the", "location", "of", "a", "given", "static", "field", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/base/UnsafeAccess.java#L55-L61
130,362
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java
CountMin4.regularIncrement
void regularIncrement(long e) { int hash = spread(Long.hashCode(e)); int start = (hash & 3) << 2; // Loop unrolling improves throughput by 5m ops/s int index0 = indexOf(hash, 0); int index1 = indexOf(hash, 1); int index2 = indexOf(hash, 2); int index3 = indexOf(hash, 3); boolean added ...
java
void regularIncrement(long e) { int hash = spread(Long.hashCode(e)); int start = (hash & 3) << 2; // Loop unrolling improves throughput by 5m ops/s int index0 = indexOf(hash, 0); int index1 = indexOf(hash, 1); int index2 = indexOf(hash, 2); int index3 = indexOf(hash, 3); boolean added ...
[ "void", "regularIncrement", "(", "long", "e", ")", "{", "int", "hash", "=", "spread", "(", "Long", ".", "hashCode", "(", "e", ")", ")", ";", "int", "start", "=", "(", "hash", "&", "3", ")", "<<", "2", ";", "// Loop unrolling improves throughput by 5m ops...
Increments all of the associated counters.
[ "Increments", "all", "of", "the", "associated", "counters", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java#L110-L126
130,363
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java
CountMin4.conservativeIncrement
void conservativeIncrement(long e) { int hash = spread(Long.hashCode(e)); int start = (hash & 3) << 2; int[] index = new int[4]; int[] count = new int[4]; int min = Integer.MAX_VALUE; for (int i = 0; i < 4; i++) { index[i] = indexOf(hash, i); count[i] = (int) ((table[index[i]] >>> (...
java
void conservativeIncrement(long e) { int hash = spread(Long.hashCode(e)); int start = (hash & 3) << 2; int[] index = new int[4]; int[] count = new int[4]; int min = Integer.MAX_VALUE; for (int i = 0; i < 4; i++) { index[i] = indexOf(hash, i); count[i] = (int) ((table[index[i]] >>> (...
[ "void", "conservativeIncrement", "(", "long", "e", ")", "{", "int", "hash", "=", "spread", "(", "Long", ".", "hashCode", "(", "e", ")", ")", ";", "int", "start", "=", "(", "hash", "&", "3", ")", "<<", "2", ";", "int", "[", "]", "index", "=", "n...
Increments the associated counters that are at the observed minimum.
[ "Increments", "the", "associated", "counters", "that", "are", "at", "the", "observed", "minimum", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java#L129-L153
130,364
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java
CountMin4.spread
int spread(int x) { x = ((x >>> 16) ^ x) * 0x45d9f3b; x = ((x >>> 16) ^ x) * 0x45d9f3b; return (x >>> 16) ^ x; }
java
int spread(int x) { x = ((x >>> 16) ^ x) * 0x45d9f3b; x = ((x >>> 16) ^ x) * 0x45d9f3b; return (x >>> 16) ^ x; }
[ "int", "spread", "(", "int", "x", ")", "{", "x", "=", "(", "(", "x", ">>>", "16", ")", "^", "x", ")", "*", "0x45d9f3b", ";", "x", "=", "(", "(", "x", ">>>", "16", ")", "^", "x", ")", "*", "0x45d9f3b", ";", "return", "(", "x", ">>>", "16",...
Applies a supplemental hash function to a given hashCode, which defends against poor quality hash functions.
[ "Applies", "a", "supplemental", "hash", "function", "to", "a", "given", "hashCode", "which", "defends", "against", "poor", "quality", "hash", "functions", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/CountMin4.java#L195-L199
130,365
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.getAndFilterExpiredEntries
protected Map<K, Expirable<V>> getAndFilterExpiredEntries( Set<? extends K> keys, boolean updateAccessTime) { Map<K, Expirable<V>> result = new HashMap<>(cache.getAllPresent(keys)); int[] expired = { 0 }; long[] millis = { 0L }; result.entrySet().removeIf(entry -> { if (!entry.getValue().is...
java
protected Map<K, Expirable<V>> getAndFilterExpiredEntries( Set<? extends K> keys, boolean updateAccessTime) { Map<K, Expirable<V>> result = new HashMap<>(cache.getAllPresent(keys)); int[] expired = { 0 }; long[] millis = { 0L }; result.entrySet().removeIf(entry -> { if (!entry.getValue().is...
[ "protected", "Map", "<", "K", ",", "Expirable", "<", "V", ">", ">", "getAndFilterExpiredEntries", "(", "Set", "<", "?", "extends", "K", ">", "keys", ",", "boolean", "updateAccessTime", ")", "{", "Map", "<", "K", ",", "Expirable", "<", "V", ">", ">", ...
Returns all of the mappings present, expiring as required, and optionally updates their access expiry time.
[ "Returns", "all", "of", "the", "mappings", "present", "expiring", "as", "required", "and", "optionally", "updates", "their", "access", "expiry", "time", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L206-L237
130,366
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.loadAllAndReplaceExisting
private void loadAllAndReplaceExisting(Set<? extends K> keys) { int[] ignored = { 0 }; Map<K, V> loaded = cacheLoader.get().loadAll(keys); for (Map.Entry<? extends K, ? extends V> entry : loaded.entrySet()) { putNoCopyOrAwait(entry.getKey(), entry.getValue(), /* publishToWriter */ false, ignored); ...
java
private void loadAllAndReplaceExisting(Set<? extends K> keys) { int[] ignored = { 0 }; Map<K, V> loaded = cacheLoader.get().loadAll(keys); for (Map.Entry<? extends K, ? extends V> entry : loaded.entrySet()) { putNoCopyOrAwait(entry.getKey(), entry.getValue(), /* publishToWriter */ false, ignored); ...
[ "private", "void", "loadAllAndReplaceExisting", "(", "Set", "<", "?", "extends", "K", ">", "keys", ")", "{", "int", "[", "]", "ignored", "=", "{", "0", "}", ";", "Map", "<", "K", ",", "V", ">", "loaded", "=", "cacheLoader", ".", "get", "(", ")", ...
Performs the bulk load where the existing entries are replace.
[ "Performs", "the", "bulk", "load", "where", "the", "existing", "entries", "are", "replace", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L271-L277
130,367
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.loadAllAndKeepExisting
private void loadAllAndKeepExisting(Set<? extends K> keys) { List<K> keysToLoad = keys.stream() .filter(key -> !cache.asMap().containsKey(key)) .collect(toList()); Map<K, V> result = cacheLoader.get().loadAll(keysToLoad); for (Map.Entry<K, V> entry : result.entrySet()) { if ((entry.get...
java
private void loadAllAndKeepExisting(Set<? extends K> keys) { List<K> keysToLoad = keys.stream() .filter(key -> !cache.asMap().containsKey(key)) .collect(toList()); Map<K, V> result = cacheLoader.get().loadAll(keysToLoad); for (Map.Entry<K, V> entry : result.entrySet()) { if ((entry.get...
[ "private", "void", "loadAllAndKeepExisting", "(", "Set", "<", "?", "extends", "K", ">", "keys", ")", "{", "List", "<", "K", ">", "keysToLoad", "=", "keys", ".", "stream", "(", ")", ".", "filter", "(", "key", "->", "!", "cache", ".", "asMap", "(", "...
Performs the bulk load where the existing entries are retained.
[ "Performs", "the", "bulk", "load", "where", "the", "existing", "entries", "are", "retained", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L280-L290
130,368
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.putNoCopyOrAwait
protected V putNoCopyOrAwait(K key, V value, boolean publishToWriter, int[] puts) { requireNonNull(key); requireNonNull(value); @SuppressWarnings("unchecked") V[] replaced = (V[]) new Object[1]; cache.asMap().compute(copyOf(key), (k, expirable) -> { V newValue = copyOf(value); if (publi...
java
protected V putNoCopyOrAwait(K key, V value, boolean publishToWriter, int[] puts) { requireNonNull(key); requireNonNull(value); @SuppressWarnings("unchecked") V[] replaced = (V[]) new Object[1]; cache.asMap().compute(copyOf(key), (k, expirable) -> { V newValue = copyOf(value); if (publi...
[ "protected", "V", "putNoCopyOrAwait", "(", "K", "key", ",", "V", "value", ",", "boolean", "publishToWriter", ",", "int", "[", "]", "puts", ")", "{", "requireNonNull", "(", "key", ")", ";", "requireNonNull", "(", "value", ")", ";", "@", "SuppressWarnings", ...
Associates the specified value with the specified key in the cache. @param key key with which the specified value is to be associated @param value value to be associated with the specified key @param publishToWriter if the writer should be notified @param puts the accumulator for additions and updates @return the old ...
[ "Associates", "the", "specified", "value", "with", "the", "specified", "key", "in", "the", "cache", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L342-L376
130,369
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.putIfAbsentNoAwait
private boolean putIfAbsentNoAwait(K key, V value, boolean publishToWriter) { boolean[] absent = { false }; cache.asMap().compute(copyOf(key), (k, expirable) -> { if ((expirable != null) && !expirable.isEternal() && expirable.hasExpired(currentTimeMillis())) { dispatcher.publishExpired(t...
java
private boolean putIfAbsentNoAwait(K key, V value, boolean publishToWriter) { boolean[] absent = { false }; cache.asMap().compute(copyOf(key), (k, expirable) -> { if ((expirable != null) && !expirable.isEternal() && expirable.hasExpired(currentTimeMillis())) { dispatcher.publishExpired(t...
[ "private", "boolean", "putIfAbsentNoAwait", "(", "K", "key", ",", "V", "value", ",", "boolean", "publishToWriter", ")", "{", "boolean", "[", "]", "absent", "=", "{", "false", "}", ";", "cache", ".", "asMap", "(", ")", ".", "compute", "(", "copyOf", "("...
Associates the specified value with the specified key in the cache if there is no existing mapping. @param key key with which the specified value is to be associated @param value value to be associated with the specified key @param publishToWriter if the writer should be notified @return if the mapping was successful
[ "Associates", "the", "specified", "value", "with", "the", "specified", "key", "in", "the", "cache", "if", "there", "is", "no", "existing", "mapping", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L435-L461
130,370
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.removeNoCopyOrAwait
private V removeNoCopyOrAwait(K key) { @SuppressWarnings("unchecked") V[] removed = (V[]) new Object[1]; cache.asMap().computeIfPresent(key, (k, expirable) -> { if (!expirable.isEternal() && expirable.hasExpired(currentTimeMillis())) { dispatcher.publishExpired(this, key, expirable.get()); ...
java
private V removeNoCopyOrAwait(K key) { @SuppressWarnings("unchecked") V[] removed = (V[]) new Object[1]; cache.asMap().computeIfPresent(key, (k, expirable) -> { if (!expirable.isEternal() && expirable.hasExpired(currentTimeMillis())) { dispatcher.publishExpired(this, key, expirable.get()); ...
[ "private", "V", "removeNoCopyOrAwait", "(", "K", "key", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "V", "[", "]", "removed", "=", "(", "V", "[", "]", ")", "new", "Object", "[", "1", "]", ";", "cache", ".", "asMap", "(", ")", ".",...
Removes the mapping from the cache without store-by-value copying nor waiting for synchronous listeners to complete. @param key key whose mapping is to be removed from the cache @return the old value
[ "Removes", "the", "mapping", "from", "the", "cache", "without", "store", "-", "by", "-", "value", "copying", "nor", "waiting", "for", "synchronous", "listeners", "to", "complete", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L491-L506
130,371
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.replaceNoCopyOrAwait
private V replaceNoCopyOrAwait(K key, V value) { requireNonNull(value); V copy = copyOf(value); @SuppressWarnings("unchecked") V[] replaced = (V[]) new Object[1]; cache.asMap().computeIfPresent(key, (k, expirable) -> { if (!expirable.isEternal() && expirable.hasExpired(currentTimeMillis())) { ...
java
private V replaceNoCopyOrAwait(K key, V value) { requireNonNull(value); V copy = copyOf(value); @SuppressWarnings("unchecked") V[] replaced = (V[]) new Object[1]; cache.asMap().computeIfPresent(key, (k, expirable) -> { if (!expirable.isEternal() && expirable.hasExpired(currentTimeMillis())) { ...
[ "private", "V", "replaceNoCopyOrAwait", "(", "K", "key", ",", "V", "value", ")", "{", "requireNonNull", "(", "value", ")", ";", "V", "copy", "=", "copyOf", "(", "value", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "V", "[", "]", "repl...
Replaces the entry for the specified key only if it is currently mapped to some value. The entry is not store-by-value copied nor does the method wait for synchronous listeners to complete. @param key key with which the specified value is associated @param value value to be associated with the specified key @return th...
[ "Replaces", "the", "entry", "for", "the", "specified", "key", "only", "if", "it", "is", "currently", "mapped", "to", "some", "value", ".", "The", "entry", "is", "not", "store", "-", "by", "-", "value", "copied", "nor", "does", "the", "method", "wait", ...
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L681-L703
130,372
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.postProcess
@SuppressWarnings({"fallthrough", "PMD.MissingBreakInSwitch", "PMD.SwitchStmtsShouldHaveDefault", "NullAway"}) private @Nullable Expirable<V> postProcess(Expirable<V> expirable, EntryProcessorEntry<K, V> entry, long currentTimeMS) { switch (entry.getAction()) { case NONE: if (expirable == ...
java
@SuppressWarnings({"fallthrough", "PMD.MissingBreakInSwitch", "PMD.SwitchStmtsShouldHaveDefault", "NullAway"}) private @Nullable Expirable<V> postProcess(Expirable<V> expirable, EntryProcessorEntry<K, V> entry, long currentTimeMS) { switch (entry.getAction()) { case NONE: if (expirable == ...
[ "@", "SuppressWarnings", "(", "{", "\"fallthrough\"", ",", "\"PMD.MissingBreakInSwitch\"", ",", "\"PMD.SwitchStmtsShouldHaveDefault\"", ",", "\"NullAway\"", "}", ")", "private", "@", "Nullable", "Expirable", "<", "V", ">", "postProcess", "(", "Expirable", "<", "V", ...
Returns the updated expirable value after performing the post processing actions.
[ "Returns", "the", "updated", "expirable", "value", "after", "performing", "the", "post", "processing", "actions", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L798-L846
130,373
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.enableManagement
void enableManagement(boolean enabled) { requireNotClosed(); synchronized (configuration) { if (enabled) { JmxRegistration.registerMXBean(this, cacheMXBean, MBeanType.Configuration); } else { JmxRegistration.unregisterMXBean(this, MBeanType.Configuration); } configuratio...
java
void enableManagement(boolean enabled) { requireNotClosed(); synchronized (configuration) { if (enabled) { JmxRegistration.registerMXBean(this, cacheMXBean, MBeanType.Configuration); } else { JmxRegistration.unregisterMXBean(this, MBeanType.Configuration); } configuratio...
[ "void", "enableManagement", "(", "boolean", "enabled", ")", "{", "requireNotClosed", "(", ")", ";", "synchronized", "(", "configuration", ")", "{", "if", "(", "enabled", ")", "{", "JmxRegistration", ".", "registerMXBean", "(", "this", ",", "cacheMXBean", ",", ...
Enables or disables the configuration management JMX bean.
[ "Enables", "or", "disables", "the", "configuration", "management", "JMX", "bean", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L965-L976
130,374
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.enableStatistics
void enableStatistics(boolean enabled) { requireNotClosed(); synchronized (configuration) { if (enabled) { JmxRegistration.registerMXBean(this, statistics, MBeanType.Statistics); } else { JmxRegistration.unregisterMXBean(this, MBeanType.Statistics); } statistics.enable(e...
java
void enableStatistics(boolean enabled) { requireNotClosed(); synchronized (configuration) { if (enabled) { JmxRegistration.registerMXBean(this, statistics, MBeanType.Statistics); } else { JmxRegistration.unregisterMXBean(this, MBeanType.Statistics); } statistics.enable(e...
[ "void", "enableStatistics", "(", "boolean", "enabled", ")", "{", "requireNotClosed", "(", ")", ";", "synchronized", "(", "configuration", ")", "{", "if", "(", "enabled", ")", "{", "JmxRegistration", ".", "registerMXBean", "(", "this", ",", "statistics", ",", ...
Enables or disables the statistics JMX bean.
[ "Enables", "or", "disables", "the", "statistics", "JMX", "bean", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L979-L991
130,375
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.publishToCacheWriter
private <T> void publishToCacheWriter(Consumer<T> action, Supplier<T> data) { if (!configuration.isWriteThrough()) { return; } try { action.accept(data.get()); } catch (CacheWriterException e) { throw e; } catch (RuntimeException e) { throw new CacheWriterException("Exception...
java
private <T> void publishToCacheWriter(Consumer<T> action, Supplier<T> data) { if (!configuration.isWriteThrough()) { return; } try { action.accept(data.get()); } catch (CacheWriterException e) { throw e; } catch (RuntimeException e) { throw new CacheWriterException("Exception...
[ "private", "<", "T", ">", "void", "publishToCacheWriter", "(", "Consumer", "<", "T", ">", "action", ",", "Supplier", "<", "T", ">", "data", ")", "{", "if", "(", "!", "configuration", ".", "isWriteThrough", "(", ")", ")", "{", "return", ";", "}", "try...
Performs the action with the cache writer if write-through is enabled.
[ "Performs", "the", "action", "with", "the", "cache", "writer", "if", "write", "-", "through", "is", "enabled", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L994-L1005
130,376
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.writeAllToCacheWriter
private @Nullable CacheWriterException writeAllToCacheWriter(Map<? extends K, ? extends V> map) { if (!configuration.isWriteThrough() || map.isEmpty()) { return null; } List<Cache.Entry<? extends K, ? extends V>> entries = map.entrySet().stream() .map(entry -> new EntryProxy<>(entry.getKey(), ...
java
private @Nullable CacheWriterException writeAllToCacheWriter(Map<? extends K, ? extends V> map) { if (!configuration.isWriteThrough() || map.isEmpty()) { return null; } List<Cache.Entry<? extends K, ? extends V>> entries = map.entrySet().stream() .map(entry -> new EntryProxy<>(entry.getKey(), ...
[ "private", "@", "Nullable", "CacheWriterException", "writeAllToCacheWriter", "(", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "map", ")", "{", "if", "(", "!", "configuration", ".", "isWriteThrough", "(", ")", "||", "map", ".", "isEmpty"...
Writes all of the entries to the cache writer if write-through is enabled.
[ "Writes", "all", "of", "the", "entries", "to", "the", "cache", "writer", "if", "write", "-", "through", "is", "enabled", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L1008-L1029
130,377
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.deleteAllToCacheWriter
private @Nullable CacheWriterException deleteAllToCacheWriter(Set<? extends K> keys) { if (!configuration.isWriteThrough() || keys.isEmpty()) { return null; } List<K> keysToDelete = new ArrayList<>(keys); try { writer.deleteAll(keysToDelete); return null; } catch (CacheWriterExcept...
java
private @Nullable CacheWriterException deleteAllToCacheWriter(Set<? extends K> keys) { if (!configuration.isWriteThrough() || keys.isEmpty()) { return null; } List<K> keysToDelete = new ArrayList<>(keys); try { writer.deleteAll(keysToDelete); return null; } catch (CacheWriterExcept...
[ "private", "@", "Nullable", "CacheWriterException", "deleteAllToCacheWriter", "(", "Set", "<", "?", "extends", "K", ">", "keys", ")", "{", "if", "(", "!", "configuration", ".", "isWriteThrough", "(", ")", "||", "keys", ".", "isEmpty", "(", ")", ")", "{", ...
Deletes all of the entries using the cache writer, retaining only the keys that succeeded.
[ "Deletes", "all", "of", "the", "entries", "using", "the", "cache", "writer", "retaining", "only", "the", "keys", "that", "succeeded", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L1032-L1047
130,378
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.copyMap
protected final Map<K, V> copyMap(Map<K, Expirable<V>> map) { ClassLoader classLoader = cacheManager.getClassLoader(); return map.entrySet().stream().collect(toMap( entry -> copier.copy(entry.getKey(), classLoader), entry -> copier.copy(entry.getValue().get(), classLoader))); }
java
protected final Map<K, V> copyMap(Map<K, Expirable<V>> map) { ClassLoader classLoader = cacheManager.getClassLoader(); return map.entrySet().stream().collect(toMap( entry -> copier.copy(entry.getKey(), classLoader), entry -> copier.copy(entry.getValue().get(), classLoader))); }
[ "protected", "final", "Map", "<", "K", ",", "V", ">", "copyMap", "(", "Map", "<", "K", ",", "Expirable", "<", "V", ">", ">", "map", ")", "{", "ClassLoader", "classLoader", "=", "cacheManager", ".", "getClassLoader", "(", ")", ";", "return", "map", "....
Returns a deep copy of the map if value-based caching is enabled. @param map the mapping of keys to expirable values @return a deep or shallow copy of the mappings depending on the store by value setting
[ "Returns", "a", "deep", "copy", "of", "the", "map", "if", "value", "-", "based", "caching", "is", "enabled", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L1092-L1097
130,379
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.setAccessExpirationTime
protected final void setAccessExpirationTime(Expirable<?> expirable, long currentTimeMS) { try { Duration duration = expiry.getExpiryForAccess(); if (duration == null) { return; } else if (duration.isZero()) { expirable.setExpireTimeMS(0L); } else if (duration.isEternal()) { ...
java
protected final void setAccessExpirationTime(Expirable<?> expirable, long currentTimeMS) { try { Duration duration = expiry.getExpiryForAccess(); if (duration == null) { return; } else if (duration.isZero()) { expirable.setExpireTimeMS(0L); } else if (duration.isEternal()) { ...
[ "protected", "final", "void", "setAccessExpirationTime", "(", "Expirable", "<", "?", ">", "expirable", ",", "long", "currentTimeMS", ")", "{", "try", "{", "Duration", "duration", "=", "expiry", ".", "getExpiryForAccess", "(", ")", ";", "if", "(", "duration", ...
Sets the access expiration time. @param expirable the entry that was operated on @param currentTimeMS the current time, or 0 if not read yet
[ "Sets", "the", "access", "expiration", "time", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L1115-L1134
130,380
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.getWriteExpireTimeMS
protected final long getWriteExpireTimeMS(boolean created) { try { Duration duration = created ? expiry.getExpiryForCreation() : expiry.getExpiryForUpdate(); if (duration == null) { return Long.MIN_VALUE; } else if (duration.isZero()) { return 0L; } else if (duration.isEterna...
java
protected final long getWriteExpireTimeMS(boolean created) { try { Duration duration = created ? expiry.getExpiryForCreation() : expiry.getExpiryForUpdate(); if (duration == null) { return Long.MIN_VALUE; } else if (duration.isZero()) { return 0L; } else if (duration.isEterna...
[ "protected", "final", "long", "getWriteExpireTimeMS", "(", "boolean", "created", ")", "{", "try", "{", "Duration", "duration", "=", "created", "?", "expiry", ".", "getExpiryForCreation", "(", ")", ":", "expiry", ".", "getExpiryForUpdate", "(", ")", ";", "if", ...
Returns the time when the entry will expire. @param created if the write is an insert or update @return the time when the entry will expire, zero if it should expire immediately, Long.MIN_VALUE if it should not be changed, or Long.MAX_VALUE if eternal
[ "Returns", "the", "time", "when", "the", "entry", "will", "expire", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L1143-L1158
130,381
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddValue.java
AddValue.makeSetValue
private MethodSpec makeSetValue() { MethodSpec.Builder setter = MethodSpec.methodBuilder("setValue") .addModifiers(context.publicFinalModifiers()) .addParameter(vTypeVar, "value") .addParameter(vRefQueueType, "referenceQueue"); if (isStrongValues()) { setter.addStatement("$T.UNSAF...
java
private MethodSpec makeSetValue() { MethodSpec.Builder setter = MethodSpec.methodBuilder("setValue") .addModifiers(context.publicFinalModifiers()) .addParameter(vTypeVar, "value") .addParameter(vRefQueueType, "referenceQueue"); if (isStrongValues()) { setter.addStatement("$T.UNSAF...
[ "private", "MethodSpec", "makeSetValue", "(", ")", "{", "MethodSpec", ".", "Builder", "setter", "=", "MethodSpec", ".", "methodBuilder", "(", "\"setValue\"", ")", ".", "addModifiers", "(", "context", ".", "publicFinalModifiers", "(", ")", ")", ".", "addParameter...
Creates the setValue method.
[ "Creates", "the", "setValue", "method", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddValue.java#L64-L80
130,382
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/AbstractCopier.java
AbstractCopier.roundtrip
protected <T> T roundtrip(T object, ClassLoader classLoader) { A data = serialize(object); @SuppressWarnings("unchecked") T copy = (T) deserialize(data, classLoader); return copy; }
java
protected <T> T roundtrip(T object, ClassLoader classLoader) { A data = serialize(object); @SuppressWarnings("unchecked") T copy = (T) deserialize(data, classLoader); return copy; }
[ "protected", "<", "T", ">", "T", "roundtrip", "(", "T", "object", ",", "ClassLoader", "classLoader", ")", "{", "A", "data", "=", "serialize", "(", "object", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "copy", "=", "(", "T", ")", ...
Performs the serialization and deserialization, returning the copied object. @param object the object to serialize @param classLoader the classloader to create the instance with @param <T> the type of object being copied @return the deserialized object
[ "Performs", "the", "serialization", "and", "deserialization", "returning", "the", "copied", "object", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/AbstractCopier.java#L159-L164
130,383
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/TableReporter.java
TableReporter.assemble
@Override @SuppressWarnings("PMD.AvoidDuplicateLiterals") protected String assemble(List<PolicyStats> results) { String[][] data = new String[results.size()][headers().length]; for (int i = 0; i < results.size(); i++) { PolicyStats policyStats = results.get(i); data[i] = new String[] { ...
java
@Override @SuppressWarnings("PMD.AvoidDuplicateLiterals") protected String assemble(List<PolicyStats> results) { String[][] data = new String[results.size()][headers().length]; for (int i = 0; i < results.size(); i++) { PolicyStats policyStats = results.get(i); data[i] = new String[] { ...
[ "@", "Override", "@", "SuppressWarnings", "(", "\"PMD.AvoidDuplicateLiterals\"", ")", "protected", "String", "assemble", "(", "List", "<", "PolicyStats", ">", "results", ")", "{", "String", "[", "]", "[", "]", "data", "=", "new", "String", "[", "results", "....
Assembles an aggregated report.
[ "Assembles", "an", "aggregated", "report", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/TableReporter.java#L36-L55
130,384
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/local/AddKeyValueStrength.java
AddKeyValueStrength.addStrength
private void addStrength(String collectName, String queueName, TypeName type) { context.cache.addMethod(MethodSpec.methodBuilder(queueName) .addModifiers(context.protectedFinalModifiers()) .returns(type) .addStatement("return $N", queueName) .build()); context.cache.addField(Fiel...
java
private void addStrength(String collectName, String queueName, TypeName type) { context.cache.addMethod(MethodSpec.methodBuilder(queueName) .addModifiers(context.protectedFinalModifiers()) .returns(type) .addStatement("return $N", queueName) .build()); context.cache.addField(Fiel...
[ "private", "void", "addStrength", "(", "String", "collectName", ",", "String", "queueName", ",", "TypeName", "type", ")", "{", "context", ".", "cache", ".", "addMethod", "(", "MethodSpec", ".", "methodBuilder", "(", "queueName", ")", ".", "addModifiers", "(", ...
Adds the reference strength methods for the key or value.
[ "Adds", "the", "reference", "strength", "methods", "for", "the", "key", "or", "value", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/local/AddKeyValueStrength.java#L57-L71
130,385
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/AbstractTraceReader.java
AbstractTraceReader.readFiles
protected InputStream readFiles() throws IOException { BufferedInputStream input = new BufferedInputStream(openFile(), BUFFER_SIZE); input.mark(100); try { return new XZInputStream(input); } catch (IOException e) { input.reset(); } try { return new CompressorStreamFactory().cre...
java
protected InputStream readFiles() throws IOException { BufferedInputStream input = new BufferedInputStream(openFile(), BUFFER_SIZE); input.mark(100); try { return new XZInputStream(input); } catch (IOException e) { input.reset(); } try { return new CompressorStreamFactory().cre...
[ "protected", "InputStream", "readFiles", "(", ")", "throws", "IOException", "{", "BufferedInputStream", "input", "=", "new", "BufferedInputStream", "(", "openFile", "(", ")", ",", "BUFFER_SIZE", ")", ";", "input", ".", "mark", "(", "100", ")", ";", "try", "{...
Returns the input stream of the trace data.
[ "Returns", "the", "input", "stream", "of", "the", "trace", "data", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/AbstractTraceReader.java#L48-L67
130,386
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/AbstractTraceReader.java
AbstractTraceReader.openFile
private InputStream openFile() throws IOException { Path file = Paths.get(filePath); if (Files.exists(file)) { return Files.newInputStream(file); } InputStream input = getClass().getResourceAsStream(filePath); checkArgument(input != null, "Could not find file: " + filePath); return input; ...
java
private InputStream openFile() throws IOException { Path file = Paths.get(filePath); if (Files.exists(file)) { return Files.newInputStream(file); } InputStream input = getClass().getResourceAsStream(filePath); checkArgument(input != null, "Could not find file: " + filePath); return input; ...
[ "private", "InputStream", "openFile", "(", ")", "throws", "IOException", "{", "Path", "file", "=", "Paths", ".", "get", "(", "filePath", ")", ";", "if", "(", "Files", ".", "exists", "(", "file", ")", ")", "{", "return", "Files", ".", "newInputStream", ...
Returns the input stream for the raw file.
[ "Returns", "the", "input", "stream", "for", "the", "raw", "file", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/AbstractTraceReader.java#L70-L78
130,387
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.register
public void register(CacheEntryListenerConfiguration<K, V> configuration) { if (configuration.getCacheEntryListenerFactory() == null) { return; } EventTypeAwareListener<K, V> listener = new EventTypeAwareListener<>( configuration.getCacheEntryListenerFactory().create()); CacheEntryEventFi...
java
public void register(CacheEntryListenerConfiguration<K, V> configuration) { if (configuration.getCacheEntryListenerFactory() == null) { return; } EventTypeAwareListener<K, V> listener = new EventTypeAwareListener<>( configuration.getCacheEntryListenerFactory().create()); CacheEntryEventFi...
[ "public", "void", "register", "(", "CacheEntryListenerConfiguration", "<", "K", ",", "V", ">", "configuration", ")", "{", "if", "(", "configuration", ".", "getCacheEntryListenerFactory", "(", ")", "==", "null", ")", "{", "return", ";", "}", "EventTypeAwareListen...
Registers a cache entry listener based on the supplied configuration. @param configuration the listener's configuration.
[ "Registers", "a", "cache", "entry", "listener", "based", "on", "the", "supplied", "configuration", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L78-L93
130,388
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.deregister
public void deregister(CacheEntryListenerConfiguration<K, V> configuration) { requireNonNull(configuration); dispatchQueues.keySet().removeIf(registration -> configuration.equals(registration.getConfiguration())); }
java
public void deregister(CacheEntryListenerConfiguration<K, V> configuration) { requireNonNull(configuration); dispatchQueues.keySet().removeIf(registration -> configuration.equals(registration.getConfiguration())); }
[ "public", "void", "deregister", "(", "CacheEntryListenerConfiguration", "<", "K", ",", "V", ">", "configuration", ")", "{", "requireNonNull", "(", "configuration", ")", ";", "dispatchQueues", ".", "keySet", "(", ")", ".", "removeIf", "(", "registration", "->", ...
Deregisters a cache entry listener based on the supplied configuration. @param configuration the listener's configuration.
[ "Deregisters", "a", "cache", "entry", "listener", "based", "on", "the", "supplied", "configuration", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L100-L104
130,389
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.publishCreated
public void publishCreated(Cache<K, V> cache, K key, V value) { publish(cache, EventType.CREATED, key, /* newValue */ null, value, /* quiet */ false); }
java
public void publishCreated(Cache<K, V> cache, K key, V value) { publish(cache, EventType.CREATED, key, /* newValue */ null, value, /* quiet */ false); }
[ "public", "void", "publishCreated", "(", "Cache", "<", "K", ",", "V", ">", "cache", ",", "K", "key", ",", "V", "value", ")", "{", "publish", "(", "cache", ",", "EventType", ".", "CREATED", ",", "key", ",", "/* newValue */", "null", ",", "value", ",",...
Publishes a creation event for the entry to all of the interested listeners. @param cache the cache where the entry was created @param key the entry's key @param value the entry's value
[ "Publishes", "a", "creation", "event", "for", "the", "entry", "to", "all", "of", "the", "interested", "listeners", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L113-L115
130,390
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.publishUpdated
public void publishUpdated(Cache<K, V> cache, K key, V oldValue, V newValue) { publish(cache, EventType.UPDATED, key, oldValue, newValue, /* quiet */ false); }
java
public void publishUpdated(Cache<K, V> cache, K key, V oldValue, V newValue) { publish(cache, EventType.UPDATED, key, oldValue, newValue, /* quiet */ false); }
[ "public", "void", "publishUpdated", "(", "Cache", "<", "K", ",", "V", ">", "cache", ",", "K", "key", ",", "V", "oldValue", ",", "V", "newValue", ")", "{", "publish", "(", "cache", ",", "EventType", ".", "UPDATED", ",", "key", ",", "oldValue", ",", ...
Publishes a update event for the entry to all of the interested listeners. @param cache the cache where the entry was updated @param key the entry's key @param oldValue the entry's old value @param newValue the entry's new value
[ "Publishes", "a", "update", "event", "for", "the", "entry", "to", "all", "of", "the", "interested", "listeners", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L125-L127
130,391
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.publishRemoved
public void publishRemoved(Cache<K, V> cache, K key, V value) { publish(cache, EventType.REMOVED, key, /* oldValue */ null, value, /* quiet */ false); }
java
public void publishRemoved(Cache<K, V> cache, K key, V value) { publish(cache, EventType.REMOVED, key, /* oldValue */ null, value, /* quiet */ false); }
[ "public", "void", "publishRemoved", "(", "Cache", "<", "K", ",", "V", ">", "cache", ",", "K", "key", ",", "V", "value", ")", "{", "publish", "(", "cache", ",", "EventType", ".", "REMOVED", ",", "key", ",", "/* oldValue */", "null", ",", "value", ",",...
Publishes a remove event for the entry to all of the interested listeners. @param cache the cache where the entry was removed @param key the entry's key @param value the entry's value
[ "Publishes", "a", "remove", "event", "for", "the", "entry", "to", "all", "of", "the", "interested", "listeners", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L136-L138
130,392
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.publishExpired
public void publishExpired(Cache<K, V> cache, K key, V value) { publish(cache, EventType.EXPIRED, key, value, /* newValue */ null, /* quiet */ false); }
java
public void publishExpired(Cache<K, V> cache, K key, V value) { publish(cache, EventType.EXPIRED, key, value, /* newValue */ null, /* quiet */ false); }
[ "public", "void", "publishExpired", "(", "Cache", "<", "K", ",", "V", ">", "cache", ",", "K", "key", ",", "V", "value", ")", "{", "publish", "(", "cache", ",", "EventType", ".", "EXPIRED", ",", "key", ",", "value", ",", "/* newValue */", "null", ",",...
Publishes a expire event for the entry to all of the interested listeners. @param cache the cache where the entry expired @param key the entry's key @param value the entry's value
[ "Publishes", "a", "expire", "event", "for", "the", "entry", "to", "all", "of", "the", "interested", "listeners", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L159-L161
130,393
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.awaitSynchronous
public void awaitSynchronous() { List<CompletableFuture<Void>> futures = pending.get(); if (futures.isEmpty()) { return; } try { CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[0])).join(); } catch (CompletionException e) { logger.log(Level.WARNING, null, e); }...
java
public void awaitSynchronous() { List<CompletableFuture<Void>> futures = pending.get(); if (futures.isEmpty()) { return; } try { CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[0])).join(); } catch (CompletionException e) { logger.log(Level.WARNING, null, e); }...
[ "public", "void", "awaitSynchronous", "(", ")", "{", "List", "<", "CompletableFuture", "<", "Void", ">>", "futures", "=", "pending", ".", "get", "(", ")", ";", "if", "(", "futures", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "try", "{", ...
Blocks until all of the synchronous listeners have finished processing the events this thread published.
[ "Blocks", "until", "all", "of", "the", "synchronous", "listeners", "have", "finished", "processing", "the", "events", "this", "thread", "published", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L179-L191
130,394
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java
BloomFilter.setAt
@SuppressWarnings("PMD.LinguisticNaming") boolean setAt(int item, int seedIndex) { int hash = seeded(item, seedIndex); int index = hash >>> tableShift; long previous = table[index]; table[index] |= bitmask(hash); return (table[index] != previous); }
java
@SuppressWarnings("PMD.LinguisticNaming") boolean setAt(int item, int seedIndex) { int hash = seeded(item, seedIndex); int index = hash >>> tableShift; long previous = table[index]; table[index] |= bitmask(hash); return (table[index] != previous); }
[ "@", "SuppressWarnings", "(", "\"PMD.LinguisticNaming\"", ")", "boolean", "setAt", "(", "int", "item", ",", "int", "seedIndex", ")", "{", "int", "hash", "=", "seeded", "(", "item", ",", "seedIndex", ")", ";", "int", "index", "=", "hash", ">>>", "tableShift...
Sets the membership flag for the computed bit location. @param item the element's hash @param seedIndex the hash seed index @return if the membership changed as a result of this operation
[ "Sets", "the", "membership", "flag", "for", "the", "computed", "bit", "location", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java#L114-L121
130,395
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java
BloomFilter.seeded
static int seeded(int item, int i) { long hash = SEED[i] * item; hash += hash >>> 32; return (int) hash; }
java
static int seeded(int item, int i) { long hash = SEED[i] * item; hash += hash >>> 32; return (int) hash; }
[ "static", "int", "seeded", "(", "int", "item", ",", "int", "i", ")", "{", "long", "hash", "=", "SEED", "[", "i", "]", "*", "item", ";", "hash", "+=", "hash", ">>>", "32", ";", "return", "(", "int", ")", "hash", ";", "}" ]
Applies the independent hash function for the given seed index. @param item the element's hash @param i the hash seed index @return the table index
[ "Applies", "the", "independent", "hash", "function", "for", "the", "given", "seed", "index", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java#L140-L144
130,396
ben-manes/caffeine
caffeine/src/jmh/java/com/github/benmanes/caffeine/profiler/CacheProfiler.java
CacheProfiler.reads
private void reads() { int index = random.nextInt(); for (;;) { Integer key = ints[index++ & MASK]; cache.get(key); calls.increment(); } }
java
private void reads() { int index = random.nextInt(); for (;;) { Integer key = ints[index++ & MASK]; cache.get(key); calls.increment(); } }
[ "private", "void", "reads", "(", ")", "{", "int", "index", "=", "random", ".", "nextInt", "(", ")", ";", "for", "(", ";", ";", ")", "{", "Integer", "key", "=", "ints", "[", "index", "++", "&", "MASK", "]", ";", "cache", ".", "get", "(", "key", ...
Spins forever reading from the cache.
[ "Spins", "forever", "reading", "from", "the", "cache", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/jmh/java/com/github/benmanes/caffeine/profiler/CacheProfiler.java#L71-L78
130,397
ben-manes/caffeine
caffeine/src/jmh/java/com/github/benmanes/caffeine/profiler/CacheProfiler.java
CacheProfiler.writes
private void writes() { int index = random.nextInt(); for (;;) { Integer key = ints[index++ & MASK]; cache.put(key, Boolean.TRUE); calls.increment(); } }
java
private void writes() { int index = random.nextInt(); for (;;) { Integer key = ints[index++ & MASK]; cache.put(key, Boolean.TRUE); calls.increment(); } }
[ "private", "void", "writes", "(", ")", "{", "int", "index", "=", "random", ".", "nextInt", "(", ")", ";", "for", "(", ";", ";", ")", "{", "Integer", "key", "=", "ints", "[", "index", "++", "&", "MASK", "]", ";", "cache", ".", "put", "(", "key",...
Spins forever writing into the cache.
[ "Spins", "forever", "writing", "into", "the", "cache", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/jmh/java/com/github/benmanes/caffeine/profiler/CacheProfiler.java#L81-L88
130,398
ben-manes/caffeine
caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/ConcurrentHashMapV7.java
ConcurrentHashMapV7.segmentForHash
@SuppressWarnings("unchecked") private Segment<K,V> segmentForHash(int h) { long u = (((h >>> segmentShift) & segmentMask) << SSHIFT) + SBASE; return (Segment<K,V>) UNSAFE.getObjectVolatile(segments, u); }
java
@SuppressWarnings("unchecked") private Segment<K,V> segmentForHash(int h) { long u = (((h >>> segmentShift) & segmentMask) << SSHIFT) + SBASE; return (Segment<K,V>) UNSAFE.getObjectVolatile(segments, u); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "Segment", "<", "K", ",", "V", ">", "segmentForHash", "(", "int", "h", ")", "{", "long", "u", "=", "(", "(", "(", "h", ">>>", "segmentShift", ")", "&", "segmentMask", ")", "<<", "SSHIFT", ...
Get the segment for the given hash
[ "Get", "the", "segment", "for", "the", "given", "hash" ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/ConcurrentHashMapV7.java#L802-L806
130,399
ben-manes/caffeine
caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/ConcurrentHashMapV7.java
ConcurrentHashMapV7.entryForHash
@SuppressWarnings("unchecked") static final <K,V> HashEntry<K,V> entryForHash(Segment<K,V> seg, int h) { HashEntry<K,V>[] tab; return (seg == null || (tab = seg.table) == null) ? null : (HashEntry<K,V>) UNSAFE.getObjectVolatile (tab, ((long)(((tab.length - 1) & h)) << TSHIFT)...
java
@SuppressWarnings("unchecked") static final <K,V> HashEntry<K,V> entryForHash(Segment<K,V> seg, int h) { HashEntry<K,V>[] tab; return (seg == null || (tab = seg.table) == null) ? null : (HashEntry<K,V>) UNSAFE.getObjectVolatile (tab, ((long)(((tab.length - 1) & h)) << TSHIFT)...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "final", "<", "K", ",", "V", ">", "HashEntry", "<", "K", ",", "V", ">", "entryForHash", "(", "Segment", "<", "K", ",", "V", ">", "seg", ",", "int", "h", ")", "{", "HashEntry", "<", "K", ...
Gets the table entry for the given segment and hash
[ "Gets", "the", "table", "entry", "for", "the", "given", "segment", "and", "hash" ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/ConcurrentHashMapV7.java#L811-L817