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
106,600
ggrandes/kvstore
src/main/java/org/javastack/kvstore/io/FileStreamStore.java
FileStreamStore.flushBuffer
private final void flushBuffer() throws IOException { if (bufOutput.position() > 0) { bufOutput.flip(); fcOutput.write(bufOutput); bufOutput.clear(); // log.debug("offsetOutputUncommited=" + offsetOutputUncommited + " offsetOutputCommited=" + // offsetOutputCommited + " fcOutput.position()=" + fcOutput...
java
private final void flushBuffer() throws IOException { if (bufOutput.position() > 0) { bufOutput.flip(); fcOutput.write(bufOutput); bufOutput.clear(); // log.debug("offsetOutputUncommited=" + offsetOutputUncommited + " offsetOutputCommited=" + // offsetOutputCommited + " fcOutput.position()=" + fcOutput...
[ "private", "final", "void", "flushBuffer", "(", ")", "throws", "IOException", "{", "if", "(", "bufOutput", ".", "position", "(", ")", ">", "0", ")", "{", "bufOutput", ".", "flip", "(", ")", ";", "fcOutput", ".", "write", "(", "bufOutput", ")", ";", "...
Write uncommited data to disk @throws IOException
[ "Write", "uncommited", "data", "to", "disk" ]
c79277f79f4604e0fec8349a98519838e3de38f0
https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/io/FileStreamStore.java#L593-L608
106,601
ggrandes/kvstore
src/main/java/org/javastack/kvstore/structures/btree/InternalNode.java
InternalNode.checkUnderflowWithRight
private final boolean checkUnderflowWithRight(final int slot) { final Node<K, V> nodeLeft = tree.getNode(childs[slot]); if (nodeLeft.isUnderFlow()) { final Node<K, V> nodeRight = tree.getNode(childs[slot + 1]); if (nodeLeft.canMerge(nodeRight)) { nodeLeft.merge(this, slot, nodeRight); childs[slot] = n...
java
private final boolean checkUnderflowWithRight(final int slot) { final Node<K, V> nodeLeft = tree.getNode(childs[slot]); if (nodeLeft.isUnderFlow()) { final Node<K, V> nodeRight = tree.getNode(childs[slot + 1]); if (nodeLeft.canMerge(nodeRight)) { nodeLeft.merge(this, slot, nodeRight); childs[slot] = n...
[ "private", "final", "boolean", "checkUnderflowWithRight", "(", "final", "int", "slot", ")", "{", "final", "Node", "<", "K", ",", "V", ">", "nodeLeft", "=", "tree", ".", "getNode", "(", "childs", "[", "slot", "]", ")", ";", "if", "(", "nodeLeft", ".", ...
Check if underflow ocurred in child of slot @param nodeParent @param slot the index of a child in nodeParent
[ "Check", "if", "underflow", "ocurred", "in", "child", "of", "slot" ]
c79277f79f4604e0fec8349a98519838e3de38f0
https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/structures/btree/InternalNode.java#L302-L320
106,602
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/request/SsdpDiscovery.java
SsdpDiscovery.getDatagram
public static DatagramPacket getDatagram(String serviceType) { StringBuilder sb = new StringBuilder("M-SEARCH * HTTP/1.1\r\n"); sb.append("HOST: " + SsdpParams.getSsdpMulticastAddress().getHostAddress() + ":" + SsdpParams.getSsdpMulticastPort() + "\r\n"); sb.append("MAN: \"ssdp:discover\"\r\n"); sb.appe...
java
public static DatagramPacket getDatagram(String serviceType) { StringBuilder sb = new StringBuilder("M-SEARCH * HTTP/1.1\r\n"); sb.append("HOST: " + SsdpParams.getSsdpMulticastAddress().getHostAddress() + ":" + SsdpParams.getSsdpMulticastPort() + "\r\n"); sb.append("MAN: \"ssdp:discover\"\r\n"); sb.appe...
[ "public", "static", "DatagramPacket", "getDatagram", "(", "String", "serviceType", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"M-SEARCH * HTTP/1.1\\r\\n\"", ")", ";", "sb", ".", "append", "(", "\"HOST: \"", "+", "SsdpParams", ".", "getSsd...
Get Datagram from serviceType. @param serviceType the serviceType @return the DatagramPacket matching the search request
[ "Get", "Datagram", "from", "serviceType", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/request/SsdpDiscovery.java#L22-L31
106,603
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/util/Utils.java
Utils.selectAppropriateInterface
public static void selectAppropriateInterface(MulticastSocket socket) throws SocketException { Enumeration e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { NetworkInterface n = (NetworkInterface) e.nextElement(); Enumeration ee = n.getInetAddresses(); while (ee.hasMor...
java
public static void selectAppropriateInterface(MulticastSocket socket) throws SocketException { Enumeration e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { NetworkInterface n = (NetworkInterface) e.nextElement(); Enumeration ee = n.getInetAddresses(); while (ee.hasMor...
[ "public", "static", "void", "selectAppropriateInterface", "(", "MulticastSocket", "socket", ")", "throws", "SocketException", "{", "Enumeration", "e", "=", "NetworkInterface", ".", "getNetworkInterfaces", "(", ")", ";", "while", "(", "e", ".", "hasMoreElements", "("...
Selects the appropriate interface to use Multicast. This prevents computers with multiple interfaces to select the wrong one by default. @param socket the socket on which we want to bind the specific interface. @throws SocketException if something bad happens
[ "Selects", "the", "appropriate", "interface", "to", "use", "Multicast", ".", "This", "prevents", "computers", "with", "multiple", "interfaces", "to", "select", "the", "wrong", "one", "by", "default", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/util/Utils.java#L23-L36
106,604
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/parser/ResponseParser.java
ResponseParser.parse
public static SsdpResponse parse(DatagramPacket packet) { Map<String, String> headers = new HashMap<String, String>(); byte[] body = null; SsdpResponse.Type type = null; byte[] data = packet.getData(); // Find position of the last header data int endOfHeaders = findEndOfHeaders(data); if (...
java
public static SsdpResponse parse(DatagramPacket packet) { Map<String, String> headers = new HashMap<String, String>(); byte[] body = null; SsdpResponse.Type type = null; byte[] data = packet.getData(); // Find position of the last header data int endOfHeaders = findEndOfHeaders(data); if (...
[ "public", "static", "SsdpResponse", "parse", "(", "DatagramPacket", "packet", ")", "{", "Map", "<", "String", ",", "String", ">", "headers", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "byte", "[", "]", "body", "=", "null",...
Parse incoming Datagram into SsdpResponse. @param packet the incoming datagram. @return the parsed SsdpResponse if it worked, null otherwise
[ "Parse", "incoming", "Datagram", "into", "SsdpResponse", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/parser/ResponseParser.java#L39-L84
106,605
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/parser/ResponseParser.java
ResponseParser.parseCacheHeader
private static long parseCacheHeader(Map<String, String> headers) { if (headers.get("CACHE-CONTROL") != null) { String cacheControlHeader = headers.get("CACHE-CONTROL"); Matcher m = CACHE_CONTROL_PATTERN.matcher(cacheControlHeader); if (m.matches()) { return new Date().getTime() + Long.par...
java
private static long parseCacheHeader(Map<String, String> headers) { if (headers.get("CACHE-CONTROL") != null) { String cacheControlHeader = headers.get("CACHE-CONTROL"); Matcher m = CACHE_CONTROL_PATTERN.matcher(cacheControlHeader); if (m.matches()) { return new Date().getTime() + Long.par...
[ "private", "static", "long", "parseCacheHeader", "(", "Map", "<", "String", ",", "String", ">", "headers", ")", "{", "if", "(", "headers", ".", "get", "(", "\"CACHE-CONTROL\"", ")", "!=", "null", ")", "{", "String", "cacheControlHeader", "=", "headers", "....
Parse both Cache-Control and Expires headers to determine if there is any caching strategy requested by service. @param headers the headers. @return 0 if no strategy, or the timestamp matching the future expiration in milliseconds otherwise.
[ "Parse", "both", "Cache", "-", "Control", "and", "Expires", "headers", "to", "determine", "if", "there", "is", "any", "caching", "strategy", "requested", "by", "service", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/parser/ResponseParser.java#L92-L108
106,606
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/parser/ResponseParser.java
ResponseParser.findEndOfHeaders
private static int findEndOfHeaders(byte[] data) { for (int i = 0; i < data.length - 3; i++) { if (data[i] != CRLF[0] || data[i + 1] != CRLF[1] || data[i + 2] != CRLF[0] || data[i + 3] != CRLF[1]) { continue; } // Headers finish here return i; } return -1; }
java
private static int findEndOfHeaders(byte[] data) { for (int i = 0; i < data.length - 3; i++) { if (data[i] != CRLF[0] || data[i + 1] != CRLF[1] || data[i + 2] != CRLF[0] || data[i + 3] != CRLF[1]) { continue; } // Headers finish here return i; } return -1; }
[ "private", "static", "int", "findEndOfHeaders", "(", "byte", "[", "]", "data", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "data", ".", "length", "-", "3", ";", "i", "++", ")", "{", "if", "(", "data", "[", "i", "]", "!=", "CRLF...
Find the index matching the end of the header data. @param data the request data @return the index if found, -1 otherwise
[ "Find", "the", "index", "matching", "the", "end", "of", "the", "header", "data", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/parser/ResponseParser.java#L116-L125
106,607
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java
SsdpClientImpl.reset
private void reset(DiscoveryRequest req, DiscoveryListener callback) { this.callback = callback; this.state = State.ACTIVE; this.requests = new ArrayList<DiscoveryRequest>(); if (req != null) { requests.add(req); } // Lazily Remove expired entries for (Map.Entry<String, SsdpService> e ...
java
private void reset(DiscoveryRequest req, DiscoveryListener callback) { this.callback = callback; this.state = State.ACTIVE; this.requests = new ArrayList<DiscoveryRequest>(); if (req != null) { requests.add(req); } // Lazily Remove expired entries for (Map.Entry<String, SsdpService> e ...
[ "private", "void", "reset", "(", "DiscoveryRequest", "req", ",", "DiscoveryListener", "callback", ")", "{", "this", ".", "callback", "=", "callback", ";", "this", ".", "state", "=", "State", ".", "ACTIVE", ";", "this", ".", "requests", "=", "new", "ArrayLi...
Reset all stateful attributes. @param req the new discovery request @param callback the callback
[ "Reset", "all", "stateful", "attributes", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java#L58-L74
106,608
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java
SsdpClientImpl.handleIncomingPacket
private void handleIncomingPacket(DatagramPacket packet) { SsdpResponse response = new ResponseParser().parse(packet); if (response == null) { // Unknown to protocol return; } if (response.getType().equals(SsdpResponse.Type.DISCOVERY_RESPONSE)) { handleDiscoveryResponse(response); ...
java
private void handleIncomingPacket(DatagramPacket packet) { SsdpResponse response = new ResponseParser().parse(packet); if (response == null) { // Unknown to protocol return; } if (response.getType().equals(SsdpResponse.Type.DISCOVERY_RESPONSE)) { handleDiscoveryResponse(response); ...
[ "private", "void", "handleIncomingPacket", "(", "DatagramPacket", "packet", ")", "{", "SsdpResponse", "response", "=", "new", "ResponseParser", "(", ")", ".", "parse", "(", "packet", ")", ";", "if", "(", "response", "==", "null", ")", "{", "// Unknown to proto...
Thid handler handles incoming SSDP packets. @param packet the received datagram
[ "Thid", "handler", "handles", "incoming", "SSDP", "packets", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java#L122-L133
106,609
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java
SsdpClientImpl.sendDiscoveryRequest
private void sendDiscoveryRequest() { try { if (requests.isEmpty()) { // Do nothing if no request has been set return; } for (DiscoveryRequest req : requests) { if (req.getServiceTypes() == null || req.getServiceTypes().isEmpty()) { clientSocket.send(SsdpDiscovery...
java
private void sendDiscoveryRequest() { try { if (requests.isEmpty()) { // Do nothing if no request has been set return; } for (DiscoveryRequest req : requests) { if (req.getServiceTypes() == null || req.getServiceTypes().isEmpty()) { clientSocket.send(SsdpDiscovery...
[ "private", "void", "sendDiscoveryRequest", "(", ")", "{", "try", "{", "if", "(", "requests", ".", "isEmpty", "(", ")", ")", "{", "// Do nothing if no request has been set", "return", ";", "}", "for", "(", "DiscoveryRequest", "req", ":", "requests", ")", "{", ...
Send discovery Multicast request.
[ "Send", "discovery", "Multicast", "request", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java#L138-L160
106,610
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java
SsdpClientImpl.openAndBindSocket
private void openAndBindSocket() { try { this.clientSocket = new MulticastSocket(); Utils.selectAppropriateInterface(clientSocket); this.clientSocket.joinGroup(SsdpParams.getSsdpMulticastAddress()); } catch (IOException e) { callback.onFailed(e); } }
java
private void openAndBindSocket() { try { this.clientSocket = new MulticastSocket(); Utils.selectAppropriateInterface(clientSocket); this.clientSocket.joinGroup(SsdpParams.getSsdpMulticastAddress()); } catch (IOException e) { callback.onFailed(e); } }
[ "private", "void", "openAndBindSocket", "(", ")", "{", "try", "{", "this", ".", "clientSocket", "=", "new", "MulticastSocket", "(", ")", ";", "Utils", ".", "selectAppropriateInterface", "(", "clientSocket", ")", ";", "this", ".", "clientSocket", ".", "joinGrou...
Open MulticastSocket and bind to Ssdp port.
[ "Open", "MulticastSocket", "and", "bind", "to", "Ssdp", "port", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java#L165-L173
106,611
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java
SsdpClientImpl.handlePresenceAnnouncement
private void handlePresenceAnnouncement(SsdpResponse response) { SsdpServiceAnnouncement ssdpServiceAnnouncement = response.toServiceAnnouncement(); if (ssdpServiceAnnouncement.getSerialNumber() == null) { callback.onFailed(new NoSerialNumberException()); return; } if (cache.containsKey(ssdp...
java
private void handlePresenceAnnouncement(SsdpResponse response) { SsdpServiceAnnouncement ssdpServiceAnnouncement = response.toServiceAnnouncement(); if (ssdpServiceAnnouncement.getSerialNumber() == null) { callback.onFailed(new NoSerialNumberException()); return; } if (cache.containsKey(ssdp...
[ "private", "void", "handlePresenceAnnouncement", "(", "SsdpResponse", "response", ")", "{", "SsdpServiceAnnouncement", "ssdpServiceAnnouncement", "=", "response", ".", "toServiceAnnouncement", "(", ")", ";", "if", "(", "ssdpServiceAnnouncement", ".", "getSerialNumber", "(...
Handle presence announcement Datagrams. @param response the incoming announcement
[ "Handle", "presence", "announcement", "Datagrams", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java#L181-L192
106,612
resourcepool/ssdp-client
src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java
SsdpClientImpl.handleDiscoveryResponse
private void handleDiscoveryResponse(SsdpResponse response) { SsdpService ssdpService = response.toService(); if (ssdpService.getSerialNumber() == null) { callback.onFailed(new NoSerialNumberException()); return; } if (!cache.containsKey(ssdpService.getSerialNumber())) { callback.onSer...
java
private void handleDiscoveryResponse(SsdpResponse response) { SsdpService ssdpService = response.toService(); if (ssdpService.getSerialNumber() == null) { callback.onFailed(new NoSerialNumberException()); return; } if (!cache.containsKey(ssdpService.getSerialNumber())) { callback.onSer...
[ "private", "void", "handleDiscoveryResponse", "(", "SsdpResponse", "response", ")", "{", "SsdpService", "ssdpService", "=", "response", ".", "toService", "(", ")", ";", "if", "(", "ssdpService", ".", "getSerialNumber", "(", ")", "==", "null", ")", "{", "callba...
Handle discovery response Datagrams. @param response the incoming response
[ "Handle", "discovery", "response", "Datagrams", "." ]
5c44131c159189e53dfed712bc10b8b3444776b6
https://github.com/resourcepool/ssdp-client/blob/5c44131c159189e53dfed712bc10b8b3444776b6/src/main/java/io/resourcepool/ssdp/client/impl/SsdpClientImpl.java#L199-L209
106,613
bramp/unsafe
unsafe-collection/src/main/java/net/bramp/unsafe/UnsafeArrayList.java
UnsafeArrayList.get
public T get(T dest, int index) { checkBounds(index); // We would rather do // UnsafeHelper.copyMemory(null, offset(index), dest, firstFieldOffset, elementSize); // but this is unsupported by the Unsafe class copier.copy(dest, offset(index)); return dest; }
java
public T get(T dest, int index) { checkBounds(index); // We would rather do // UnsafeHelper.copyMemory(null, offset(index), dest, firstFieldOffset, elementSize); // but this is unsupported by the Unsafe class copier.copy(dest, offset(index)); return dest; }
[ "public", "T", "get", "(", "T", "dest", ",", "int", "index", ")", "{", "checkBounds", "(", "index", ")", ";", "// We would rather do", "// UnsafeHelper.copyMemory(null, offset(index), dest, firstFieldOffset, elementSize);", "// but this is unsupported by the Unsafe class", "c...
Copies the element at index into dest @param dest The destination object @param index The index of the object to get @return The fetched object
[ "Copies", "the", "element", "at", "index", "into", "dest" ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-collection/src/main/java/net/bramp/unsafe/UnsafeArrayList.java#L122-L129
106,614
bramp/unsafe
unsafe-collection/src/main/java/net/bramp/unsafe/UnsafeArrayList.java
UnsafeArrayList.swap
public void swap(int i, int j) { checkBounds(i); checkBounds(j); if (i == j) return; copier.copy(tmp, offset(i)); unsafe.copyMemory(null, offset(j), null, offset(i), elementSpacing); unsafe.copyMemory(tmp, firstFieldOffset, null, offset(j), elementSize); }
java
public void swap(int i, int j) { checkBounds(i); checkBounds(j); if (i == j) return; copier.copy(tmp, offset(i)); unsafe.copyMemory(null, offset(j), null, offset(i), elementSpacing); unsafe.copyMemory(tmp, firstFieldOffset, null, offset(j), elementSize); }
[ "public", "void", "swap", "(", "int", "i", ",", "int", "j", ")", "{", "checkBounds", "(", "i", ")", ";", "checkBounds", "(", "j", ")", ";", "if", "(", "i", "==", "j", ")", "return", ";", "copier", ".", "copy", "(", "tmp", ",", "offset", "(", ...
Swaps two elements @param i Index of first element @param j Index of second element
[ "Swaps", "two", "elements" ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-collection/src/main/java/net/bramp/unsafe/UnsafeArrayList.java#L153-L163
106,615
bramp/unsafe
unsafe-unroller/src/main/java/net/bramp/unsafe/UnrolledUnsafeCopierBuilder.java
UnrolledUnsafeCopierBuilder.build
public UnsafeCopier build(Unsafe unsafe) throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException { checkArgument(offset >= 0, "Offset must be set"); checkArgument(length >= 0, "Length must be set"); checkNotNull(unsafe); Class<?> dynamicType ...
java
public UnsafeCopier build(Unsafe unsafe) throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException { checkArgument(offset >= 0, "Offset must be set"); checkArgument(length >= 0, "Length must be set"); checkNotNull(unsafe); Class<?> dynamicType ...
[ "public", "UnsafeCopier", "build", "(", "Unsafe", "unsafe", ")", "throws", "IllegalAccessException", ",", "InstantiationException", ",", "NoSuchMethodException", ",", "InvocationTargetException", "{", "checkArgument", "(", "offset", ">=", "0", ",", "\"Offset must be set\"...
Constructs a new Copier using the passed in Unsafe instance @param unsafe The sun.misc.Unsafe instance this copier uses @return The new UnsageCopier built with the specific parameters @throws IllegalAccessException @throws InstantiationException @throws NoSuchMethodException @throws InvocationTargetException @throws I...
[ "Constructs", "a", "new", "Copier", "using", "the", "passed", "in", "Unsafe", "instance" ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-unroller/src/main/java/net/bramp/unsafe/UnrolledUnsafeCopierBuilder.java#L76-L92
106,616
bramp/unsafe
unsafe-benchmark/src/main/java/net/bramp/unsafe/sort/QuickSort.java
QuickSort.recursiveQuickSort
public static <E extends Comparable<E>> void recursiveQuickSort(List<E> array, int startIdx, int endIdx) { int idx = partition(array, startIdx, endIdx); // Recursively call quicksort with left part of the partitioned array if (startIdx < idx - 1) { recursiveQuickSort(array, startIdx, idx - 1);...
java
public static <E extends Comparable<E>> void recursiveQuickSort(List<E> array, int startIdx, int endIdx) { int idx = partition(array, startIdx, endIdx); // Recursively call quicksort with left part of the partitioned array if (startIdx < idx - 1) { recursiveQuickSort(array, startIdx, idx - 1);...
[ "public", "static", "<", "E", "extends", "Comparable", "<", "E", ">", ">", "void", "recursiveQuickSort", "(", "List", "<", "E", ">", "array", ",", "int", "startIdx", ",", "int", "endIdx", ")", "{", "int", "idx", "=", "partition", "(", "array", ",", "...
Recursive quicksort logic. @param array input array @param startIdx start index of the array @param endIdx end index of the array @param <E> generic type of list
[ "Recursive", "quicksort", "logic", "." ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-benchmark/src/main/java/net/bramp/unsafe/sort/QuickSort.java#L40-L54
106,617
bramp/unsafe
unsafe-benchmark/src/main/java/net/bramp/unsafe/Main.java
Main.printMemoryLayout2
public static void printMemoryLayout2() { Object o1 = new Object(); Object o2 = new Object(); Byte b1 = new Byte((byte) 0x12); Byte b2 = new Byte((byte) 0x34); Byte b3 = new Byte((byte) 0x56); Long l = new Long(0x0123456789ABCDEFL); Person p = new Person("Bob", 406425600000L, 'M'); Sy...
java
public static void printMemoryLayout2() { Object o1 = new Object(); Object o2 = new Object(); Byte b1 = new Byte((byte) 0x12); Byte b2 = new Byte((byte) 0x34); Byte b3 = new Byte((byte) 0x56); Long l = new Long(0x0123456789ABCDEFL); Person p = new Person("Bob", 406425600000L, 'M'); Sy...
[ "public", "static", "void", "printMemoryLayout2", "(", ")", "{", "Object", "o1", "=", "new", "Object", "(", ")", ";", "Object", "o2", "=", "new", "Object", "(", ")", ";", "Byte", "b1", "=", "new", "Byte", "(", "(", "byte", ")", "0x12", ")", ";", ...
Prints the memory layout of various test classes.
[ "Prints", "the", "memory", "layout", "of", "various", "test", "classes", "." ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-benchmark/src/main/java/net/bramp/unsafe/Main.java#L17-L64
106,618
bramp/unsafe
unsafe-benchmark/src/main/java/net/bramp/unsafe/collection/ArrayListBenchmark.java
ArrayListBenchmark.setup
@Setup(Level.Trial) public void setup() throws Exception { test = benchmarks.get(list + "-" + type); if (test == null) { throw new RuntimeException("Can't find requested test " + list + " " + type); } test.setSize(size); test.setRandomSeed(size); // TODO Use iteration some how test.setu...
java
@Setup(Level.Trial) public void setup() throws Exception { test = benchmarks.get(list + "-" + type); if (test == null) { throw new RuntimeException("Can't find requested test " + list + " " + type); } test.setSize(size); test.setRandomSeed(size); // TODO Use iteration some how test.setu...
[ "@", "Setup", "(", "Level", ".", "Trial", ")", "public", "void", "setup", "(", ")", "throws", "Exception", "{", "test", "=", "benchmarks", ".", "get", "(", "list", "+", "\"-\"", "+", "type", ")", ";", "if", "(", "test", "==", "null", ")", "{", "t...
Sets up the benchmark. @throws Exception if the setup fails
[ "Sets", "up", "the", "benchmark", "." ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-benchmark/src/main/java/net/bramp/unsafe/collection/ArrayListBenchmark.java#L51-L60
106,619
bramp/unsafe
unsafe-benchmark/src/main/java/net/bramp/unsafe/collection/ArrayListBenchmark.java
ArrayListBenchmark.main
public static void main(String[] args) throws RunnerException { for (String benchmark : benchmarks.keySet()) { String[] parts = benchmark.split("-"); Options opt = new OptionsBuilder() .include(ArrayListBenchmark.class.getSimpleName()) // Warmup, and then run test iterations ...
java
public static void main(String[] args) throws RunnerException { for (String benchmark : benchmarks.keySet()) { String[] parts = benchmark.split("-"); Options opt = new OptionsBuilder() .include(ArrayListBenchmark.class.getSimpleName()) // Warmup, and then run test iterations ...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "RunnerException", "{", "for", "(", "String", "benchmark", ":", "benchmarks", ".", "keySet", "(", ")", ")", "{", "String", "[", "]", "parts", "=", "benchmark", ".", "sp...
Runs the ArrayListBenchmarks. @param args command line arguments @throws RunnerException if the Benchmark Runner fails
[ "Runs", "the", "ArrayListBenchmarks", "." ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-benchmark/src/main/java/net/bramp/unsafe/collection/ArrayListBenchmark.java#L92-L121
106,620
bramp/unsafe
unsafe-benchmark/src/main/java/net/bramp/unsafe/MemoryUtils.java
MemoryUtils.memoryUsage
public static String memoryUsage() { final Runtime runtime = Runtime.getRuntime(); runtime.gc(); final long max = runtime.maxMemory(); final long total = runtime.totalMemory(); final long free = runtime.freeMemory(); final long used = total - free; return String.format("%d\t%d\t%d\t%d", m...
java
public static String memoryUsage() { final Runtime runtime = Runtime.getRuntime(); runtime.gc(); final long max = runtime.maxMemory(); final long total = runtime.totalMemory(); final long free = runtime.freeMemory(); final long used = total - free; return String.format("%d\t%d\t%d\t%d", m...
[ "public", "static", "String", "memoryUsage", "(", ")", "{", "final", "Runtime", "runtime", "=", "Runtime", ".", "getRuntime", "(", ")", ";", "runtime", ".", "gc", "(", ")", ";", "final", "long", "max", "=", "runtime", ".", "maxMemory", "(", ")", ";", ...
Calculates the memory usage according to Runtime. @return max, total, free and used memory (in bytes)
[ "Calculates", "the", "memory", "usage", "according", "to", "Runtime", "." ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-benchmark/src/main/java/net/bramp/unsafe/MemoryUtils.java#L24-L35
106,621
bramp/unsafe
unsafe-benchmark/src/main/java/net/bramp/unsafe/MemoryUtils.java
MemoryUtils.getPid
public static int getPid() throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); Field jvm = runtime.getClass().getDeclaredField("jvm"); jvm.setAccessible(true); VMManagement mgmt...
java
public static int getPid() throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); Field jvm = runtime.getClass().getDeclaredField("jvm"); jvm.setAccessible(true); VMManagement mgmt...
[ "public", "static", "int", "getPid", "(", ")", "throws", "NoSuchFieldException", ",", "IllegalAccessException", ",", "NoSuchMethodException", ",", "InvocationTargetException", "{", "RuntimeMXBean", "runtime", "=", "ManagementFactory", ".", "getRuntimeMXBean", "(", ")", ...
Returns the pid of the current process. This fails on systems without process identifiers. @return the processes pid @throws NoSuchFieldException if the JVM does not support the VMManagement class @throws IllegalAccessException if the JVM does not support the VMManagement class @throws NoSuchMethodException if the JVM...
[ "Returns", "the", "pid", "of", "the", "current", "process", ".", "This", "fails", "on", "systems", "without", "process", "identifiers", "." ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-benchmark/src/main/java/net/bramp/unsafe/MemoryUtils.java#L63-L75
106,622
bramp/unsafe
unsafe-benchmark/src/main/java/net/bramp/unsafe/MemoryUtils.java
MemoryUtils.pidMemoryUsage
public static String pidMemoryUsage(int pid) throws IOException { Process process = new ProcessBuilder().command("ps", "-o", "pid,rss,vsz", "-p", Long.toString(pid)).start(); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); reader.readLine(); // Skip hea...
java
public static String pidMemoryUsage(int pid) throws IOException { Process process = new ProcessBuilder().command("ps", "-o", "pid,rss,vsz", "-p", Long.toString(pid)).start(); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); reader.readLine(); // Skip hea...
[ "public", "static", "String", "pidMemoryUsage", "(", "int", "pid", ")", "throws", "IOException", "{", "Process", "process", "=", "new", "ProcessBuilder", "(", ")", ".", "command", "(", "\"ps\"", ",", "\"-o\"", ",", "\"pid,rss,vsz\"", ",", "\"-p\"", ",", "Lon...
Calculates the memory usage according to ps for a given pid. @param pid the pid of the process @return the pid, rss, and vsz for the process @throws IOException if executing ps fails
[ "Calculates", "the", "memory", "usage", "according", "to", "ps", "for", "a", "given", "pid", "." ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-benchmark/src/main/java/net/bramp/unsafe/MemoryUtils.java#L84-L105
106,623
bramp/unsafe
unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java
UnsafeHelper.toAddress
public static long toAddress(Object obj) { Object[] array = new Object[] {obj}; long baseOffset = unsafe.arrayBaseOffset(Object[].class); return normalize(unsafe.getInt(array, baseOffset)); }
java
public static long toAddress(Object obj) { Object[] array = new Object[] {obj}; long baseOffset = unsafe.arrayBaseOffset(Object[].class); return normalize(unsafe.getInt(array, baseOffset)); }
[ "public", "static", "long", "toAddress", "(", "Object", "obj", ")", "{", "Object", "[", "]", "array", "=", "new", "Object", "[", "]", "{", "obj", "}", ";", "long", "baseOffset", "=", "unsafe", ".", "arrayBaseOffset", "(", "Object", "[", "]", ".", "cl...
Returns the address the object is located at <p>WARNING: This does not return a pointer, so be warned pointer arithmetic will not work. @param obj The object @return the address of the object
[ "Returns", "the", "address", "the", "object", "is", "located", "at" ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java#L55-L59
106,624
bramp/unsafe
unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java
UnsafeHelper.copyMemory
public static void copyMemory(final Object src, long srcOffset, final Object dest, final long destOffset, final long len) { // TODO make this work if destOffset is not STRIDE aligned Preconditions.checkNotNull(src); Preconditions.checkArgument(len % COPY_STRIDE != 0, "Length (%d) is not a multiple of...
java
public static void copyMemory(final Object src, long srcOffset, final Object dest, final long destOffset, final long len) { // TODO make this work if destOffset is not STRIDE aligned Preconditions.checkNotNull(src); Preconditions.checkArgument(len % COPY_STRIDE != 0, "Length (%d) is not a multiple of...
[ "public", "static", "void", "copyMemory", "(", "final", "Object", "src", ",", "long", "srcOffset", ",", "final", "Object", "dest", ",", "final", "long", "destOffset", ",", "final", "long", "len", ")", "{", "// TODO make this work if destOffset is not STRIDE aligned"...
Copies the memory from srcAddress into dest <p>This is our own implementation because Unsafe.copyMemory(Object src, .. Object dest, ...) only works if <a href="https://goo.gl/pBVlJv">dest in an array</a>, so we wrote our only implementations.
[ "Copies", "the", "memory", "from", "srcAddress", "into", "dest" ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java#L85-L101
106,625
bramp/unsafe
unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java
UnsafeHelper.copyMemoryFieldByField
public static void copyMemoryFieldByField(long srcAddress, Object dest) { Class clazz = dest.getClass(); while (clazz != Object.class) { for (Field f : clazz.getDeclaredFields()) { if ((f.getModifiers() & Modifier.STATIC) == 0) { final Class type = f.getType(); // TODO maybe ...
java
public static void copyMemoryFieldByField(long srcAddress, Object dest) { Class clazz = dest.getClass(); while (clazz != Object.class) { for (Field f : clazz.getDeclaredFields()) { if ((f.getModifiers() & Modifier.STATIC) == 0) { final Class type = f.getType(); // TODO maybe ...
[ "public", "static", "void", "copyMemoryFieldByField", "(", "long", "srcAddress", ",", "Object", "dest", ")", "{", "Class", "clazz", "=", "dest", ".", "getClass", "(", ")", ";", "while", "(", "clazz", "!=", "Object", ".", "class", ")", "{", "for", "(", ...
Copies from srcAddress to dest one field at a time. @param srcAddress @param dest
[ "Copies", "from", "srcAddress", "to", "dest", "one", "field", "at", "a", "time", "." ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java#L109-L136
106,626
bramp/unsafe
unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java
UnsafeHelper.toByteArray
public static byte[] toByteArray(Object obj) { int len = (int) sizeOf(obj); byte[] bytes = new byte[len]; unsafe.copyMemory(obj, 0, bytes, Unsafe.ARRAY_BYTE_BASE_OFFSET, bytes.length); return bytes; }
java
public static byte[] toByteArray(Object obj) { int len = (int) sizeOf(obj); byte[] bytes = new byte[len]; unsafe.copyMemory(obj, 0, bytes, Unsafe.ARRAY_BYTE_BASE_OFFSET, bytes.length); return bytes; }
[ "public", "static", "byte", "[", "]", "toByteArray", "(", "Object", "obj", ")", "{", "int", "len", "=", "(", "int", ")", "sizeOf", "(", "obj", ")", ";", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "len", "]", ";", "unsafe", ".", "copyMemo...
Returns the object as a byte array, including header, padding and all fields. @param obj @return
[ "Returns", "the", "object", "as", "a", "byte", "array", "including", "header", "padding", "and", "all", "fields", "." ]
805f54e2a8aee905003329556135b6c4059b4418
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java#L280-L285
106,627
sarxos/win-registry
src/main/java/com/github/sarxos/winreg/internal/WindowsPreferencesBuilder.java
WindowsPreferencesBuilder.stringToByteArray
private static byte[] stringToByteArray(String str) { byte[] result = new byte[str.length() + 1]; for (int i = 0; i < str.length(); i++) { result[i] = (byte) str.charAt(i); } result[str.length()] = 0; return result; }
java
private static byte[] stringToByteArray(String str) { byte[] result = new byte[str.length() + 1]; for (int i = 0; i < str.length(); i++) { result[i] = (byte) str.charAt(i); } result[str.length()] = 0; return result; }
[ "private", "static", "byte", "[", "]", "stringToByteArray", "(", "String", "str", ")", "{", "byte", "[", "]", "result", "=", "new", "byte", "[", "str", ".", "length", "(", ")", "+", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<"...
Returns this java string as a null-terminated byte array
[ "Returns", "this", "java", "string", "as", "a", "null", "-", "terminated", "byte", "array" ]
5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437
https://github.com/sarxos/win-registry/blob/5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437/src/main/java/com/github/sarxos/winreg/internal/WindowsPreferencesBuilder.java#L68-L75
106,628
sarxos/win-registry
src/main/java/com/github/sarxos/winreg/WindowsRegistry.java
WindowsRegistry.createKey
public void createKey(HKey hk, String key) throws RegistryException { int[] ret; try { ret = ReflectedMethods.createKey(hk.root(), hk.hex(), key); } catch (Exception e) { throw new RegistryException("Cannot create key " + key, e); } if (ret.length == 0) { throw new RegistryException("Cannot c...
java
public void createKey(HKey hk, String key) throws RegistryException { int[] ret; try { ret = ReflectedMethods.createKey(hk.root(), hk.hex(), key); } catch (Exception e) { throw new RegistryException("Cannot create key " + key, e); } if (ret.length == 0) { throw new RegistryException("Cannot c...
[ "public", "void", "createKey", "(", "HKey", "hk", ",", "String", "key", ")", "throws", "RegistryException", "{", "int", "[", "]", "ret", ";", "try", "{", "ret", "=", "ReflectedMethods", ".", "createKey", "(", "hk", ".", "root", "(", ")", ",", "hk", "...
Create key in registry. @param hk the HKEY @param key the key @throws RegistryException when something is not right
[ "Create", "key", "in", "registry", "." ]
5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437
https://github.com/sarxos/win-registry/blob/5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437/src/main/java/com/github/sarxos/winreg/WindowsRegistry.java#L132-L145
106,629
sarxos/win-registry
src/main/java/com/github/sarxos/winreg/WindowsRegistry.java
WindowsRegistry.deleteKey
public void deleteKey(HKey hk, String key) throws RegistryException { int rc = -1; try { rc = ReflectedMethods.deleteKey(hk.root(), hk.hex(), key); } catch (Exception e) { throw new RegistryException("Cannot delete key " + key, e); } if (rc != RC.SUCCESS) { throw new RegistryException("Cannot...
java
public void deleteKey(HKey hk, String key) throws RegistryException { int rc = -1; try { rc = ReflectedMethods.deleteKey(hk.root(), hk.hex(), key); } catch (Exception e) { throw new RegistryException("Cannot delete key " + key, e); } if (rc != RC.SUCCESS) { throw new RegistryException("Cannot...
[ "public", "void", "deleteKey", "(", "HKey", "hk", ",", "String", "key", ")", "throws", "RegistryException", "{", "int", "rc", "=", "-", "1", ";", "try", "{", "rc", "=", "ReflectedMethods", ".", "deleteKey", "(", "hk", ".", "root", "(", ")", ",", "hk"...
Delete given key from registry. @param hk the HKEY @param key the key to be deleted @throws RegistryException when something is not right
[ "Delete", "given", "key", "from", "registry", "." ]
5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437
https://github.com/sarxos/win-registry/blob/5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437/src/main/java/com/github/sarxos/winreg/WindowsRegistry.java#L171-L181
106,630
biezhi/webp-io
src/main/java/io/github/biezhi/webp/WebpIO.java
WebpIO.close
public void close() { File tmp = new File(webpTmpDir); if (tmp.exists() && tmp.isDirectory()) { File[] files = tmp.listFiles(); for (File file : Objects.requireNonNull(files)) { file.delete(); } tmp.delete(); } }
java
public void close() { File tmp = new File(webpTmpDir); if (tmp.exists() && tmp.isDirectory()) { File[] files = tmp.listFiles(); for (File file : Objects.requireNonNull(files)) { file.delete(); } tmp.delete(); } }
[ "public", "void", "close", "(", ")", "{", "File", "tmp", "=", "new", "File", "(", "webpTmpDir", ")", ";", "if", "(", "tmp", ".", "exists", "(", ")", "&&", "tmp", ".", "isDirectory", "(", ")", ")", "{", "File", "[", "]", "files", "=", "tmp", "."...
delete temp dir and commands
[ "delete", "temp", "dir", "and", "commands" ]
8eefe535087b3abccacff76de2b6e27bb7301bcc
https://github.com/biezhi/webp-io/blob/8eefe535087b3abccacff76de2b6e27bb7301bcc/src/main/java/io/github/biezhi/webp/WebpIO.java#L147-L156
106,631
biezhi/webp-io
src/main/java/io/github/biezhi/webp/WebpIO.java
WebpIO.getOsName
private String getOsName() { // windows if (OS_NAME.contains("win")) { boolean is64bit = (System.getenv("ProgramFiles(x86)") != null); return "windows_" + (is64bit ? "x86_64" : "x86"); } else if (OS_NAME.contains("mac")) { // mac osx return "mac_" ...
java
private String getOsName() { // windows if (OS_NAME.contains("win")) { boolean is64bit = (System.getenv("ProgramFiles(x86)") != null); return "windows_" + (is64bit ? "x86_64" : "x86"); } else if (OS_NAME.contains("mac")) { // mac osx return "mac_" ...
[ "private", "String", "getOsName", "(", ")", "{", "// windows", "if", "(", "OS_NAME", ".", "contains", "(", "\"win\"", ")", ")", "{", "boolean", "is64bit", "=", "(", "System", ".", "getenv", "(", "\"ProgramFiles(x86)\"", ")", "!=", "null", ")", ";", "retu...
get os name and arch @return
[ "get", "os", "name", "and", "arch" ]
8eefe535087b3abccacff76de2b6e27bb7301bcc
https://github.com/biezhi/webp-io/blob/8eefe535087b3abccacff76de2b6e27bb7301bcc/src/main/java/io/github/biezhi/webp/WebpIO.java#L176-L190
106,632
biezhi/webp-io
src/main/java/io/github/biezhi/webp/WebpIO.java
WebpIO.getExtensionByOs
private String getExtensionByOs(String os) { if (os == null || os.isEmpty()) return ""; else if (os.contains("win")) return ".exe"; return ""; }
java
private String getExtensionByOs(String os) { if (os == null || os.isEmpty()) return ""; else if (os.contains("win")) return ".exe"; return ""; }
[ "private", "String", "getExtensionByOs", "(", "String", "os", ")", "{", "if", "(", "os", "==", "null", "||", "os", ".", "isEmpty", "(", ")", ")", "return", "\"\"", ";", "else", "if", "(", "os", ".", "contains", "(", "\"win\"", ")", ")", "return", "...
Return the Os specific extension @param os: operating system name
[ "Return", "the", "Os", "specific", "extension" ]
8eefe535087b3abccacff76de2b6e27bb7301bcc
https://github.com/biezhi/webp-io/blob/8eefe535087b3abccacff76de2b6e27bb7301bcc/src/main/java/io/github/biezhi/webp/WebpIO.java#L197-L201
106,633
meltmedia/jgroups-aws
src/main/java/com/meltmedia/jgroups/aws/TagsUtils.java
TagsUtils.getInstanceTags
public List<Tag> getInstanceTags() { final DescribeInstancesResult response = ec2 .describeInstances(new DescribeInstancesRequest() .withInstanceIds(Collections.singletonList(instanceIdentity.instanceId))); return response.getReservations().stream() .flatMap(reservation -> reservati...
java
public List<Tag> getInstanceTags() { final DescribeInstancesResult response = ec2 .describeInstances(new DescribeInstancesRequest() .withInstanceIds(Collections.singletonList(instanceIdentity.instanceId))); return response.getReservations().stream() .flatMap(reservation -> reservati...
[ "public", "List", "<", "Tag", ">", "getInstanceTags", "(", ")", "{", "final", "DescribeInstancesResult", "response", "=", "ec2", ".", "describeInstances", "(", "new", "DescribeInstancesRequest", "(", ")", ".", "withInstanceIds", "(", "Collections", ".", "singleton...
Returns all of the tags defined on the EC2 current instance instanceId. @return a list of the Tag objects that were found on the instance.
[ "Returns", "all", "of", "the", "tags", "defined", "on", "the", "EC2", "current", "instance", "instanceId", "." ]
b5e861a6809677e317dc624f981c983ed109fed6
https://github.com/meltmedia/jgroups-aws/blob/b5e861a6809677e317dc624f981c983ed109fed6/src/main/java/com/meltmedia/jgroups/aws/TagsUtils.java#L43-L53
106,634
meltmedia/jgroups-aws
src/main/java/com/meltmedia/jgroups/aws/TagsUtils.java
TagsUtils.validateTags
public TagsUtils validateTags() { final List<String> instanceTags = getInstanceTags().stream() .map(Tag::getKey) .collect(Collectors.toList()); final List<String> missingTags = getAwsTagNames().map(List::stream).orElse(Stream.empty()) .filter(configuredTag -> !instanceTags.contains(conf...
java
public TagsUtils validateTags() { final List<String> instanceTags = getInstanceTags().stream() .map(Tag::getKey) .collect(Collectors.toList()); final List<String> missingTags = getAwsTagNames().map(List::stream).orElse(Stream.empty()) .filter(configuredTag -> !instanceTags.contains(conf...
[ "public", "TagsUtils", "validateTags", "(", ")", "{", "final", "List", "<", "String", ">", "instanceTags", "=", "getInstanceTags", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "Tag", "::", "getKey", ")", ".", "collect", "(", "Collectors", ".", "...
Configured tags will be validated against the instance tags. If one or more tags are missing on the instance, an exception will be thrown. @throws IllegalStateException
[ "Configured", "tags", "will", "be", "validated", "against", "the", "instance", "tags", ".", "If", "one", "or", "more", "tags", "are", "missing", "on", "the", "instance", "an", "exception", "will", "be", "thrown", "." ]
b5e861a6809677e317dc624f981c983ed109fed6
https://github.com/meltmedia/jgroups-aws/blob/b5e861a6809677e317dc624f981c983ed109fed6/src/main/java/com/meltmedia/jgroups/aws/TagsUtils.java#L61-L75
106,635
meltmedia/jgroups-aws
src/main/java/com/meltmedia/jgroups/aws/TagsUtils.java
TagsUtils.parseTagNames
private static List<String> parseTagNames(String tagNames) { return Arrays.stream(tagNames.split("\\s*,\\s*")) .map(String::trim) .collect(Collectors.toList()); }
java
private static List<String> parseTagNames(String tagNames) { return Arrays.stream(tagNames.split("\\s*,\\s*")) .map(String::trim) .collect(Collectors.toList()); }
[ "private", "static", "List", "<", "String", ">", "parseTagNames", "(", "String", "tagNames", ")", "{", "return", "Arrays", ".", "stream", "(", "tagNames", ".", "split", "(", "\"\\\\s*,\\\\s*\"", ")", ")", ".", "map", "(", "String", "::", "trim", ")", "."...
Parses a comma separated list of tag names. @param tagNames a comma separated list of tag names. @return the list of tag names.
[ "Parses", "a", "comma", "separated", "list", "of", "tag", "names", "." ]
b5e861a6809677e317dc624f981c983ed109fed6
https://github.com/meltmedia/jgroups-aws/blob/b5e861a6809677e317dc624f981c983ed109fed6/src/main/java/com/meltmedia/jgroups/aws/TagsUtils.java#L83-L87
106,636
meltmedia/jgroups-aws
src/main/java/com/meltmedia/jgroups/aws/InstanceIdentity.java
InstanceIdentity.getIdentityDocument
private static String getIdentityDocument(final HttpClient client) throws IOException { try { final HttpGet getInstance = new HttpGet(); getInstance.setURI(INSTANCE_IDENTITY_URI); final HttpResponse response = client.execute(getInstance); if (response.getStatusLine().getStatusCode() != HttpS...
java
private static String getIdentityDocument(final HttpClient client) throws IOException { try { final HttpGet getInstance = new HttpGet(); getInstance.setURI(INSTANCE_IDENTITY_URI); final HttpResponse response = client.execute(getInstance); if (response.getStatusLine().getStatusCode() != HttpS...
[ "private", "static", "String", "getIdentityDocument", "(", "final", "HttpClient", "client", ")", "throws", "IOException", "{", "try", "{", "final", "HttpGet", "getInstance", "=", "new", "HttpGet", "(", ")", ";", "getInstance", ".", "setURI", "(", "INSTANCE_IDENT...
Gets the body of the content returned from a GET request to uri. @param client @return the body of the message returned from the GET request. @throws IOException if there is an error encountered while getting the content.
[ "Gets", "the", "body", "of", "the", "content", "returned", "from", "a", "GET", "request", "to", "uri", "." ]
b5e861a6809677e317dc624f981c983ed109fed6
https://github.com/meltmedia/jgroups-aws/blob/b5e861a6809677e317dc624f981c983ed109fed6/src/main/java/com/meltmedia/jgroups/aws/InstanceIdentity.java#L67-L79
106,637
meltmedia/jgroups-aws
src/main/java/com/meltmedia/jgroups/aws/EC2Factory.java
EC2Factory.setupAWSExceptionLogging
private static void setupAWSExceptionLogging(AmazonEC2 ec2) { boolean accessible = false; Field exceptionUnmarshallersField = null; try { exceptionUnmarshallersField = AmazonEC2Client.class.getDeclaredField("exceptionUnmarshallers"); accessible = exceptionUnmarshallersField.isAccessible(); ...
java
private static void setupAWSExceptionLogging(AmazonEC2 ec2) { boolean accessible = false; Field exceptionUnmarshallersField = null; try { exceptionUnmarshallersField = AmazonEC2Client.class.getDeclaredField("exceptionUnmarshallers"); accessible = exceptionUnmarshallersField.isAccessible(); ...
[ "private", "static", "void", "setupAWSExceptionLogging", "(", "AmazonEC2", "ec2", ")", "{", "boolean", "accessible", "=", "false", ";", "Field", "exceptionUnmarshallersField", "=", "null", ";", "try", "{", "exceptionUnmarshallersField", "=", "AmazonEC2Client", ".", ...
Sets up the AmazonEC2Client to log soap faults from the AWS EC2 api server.
[ "Sets", "up", "the", "AmazonEC2Client", "to", "log", "soap", "faults", "from", "the", "AWS", "EC2", "api", "server", "." ]
b5e861a6809677e317dc624f981c983ed109fed6
https://github.com/meltmedia/jgroups-aws/blob/b5e861a6809677e317dc624f981c983ed109fed6/src/main/java/com/meltmedia/jgroups/aws/EC2Factory.java#L66-L87
106,638
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/banking/KidnummerValidator.java
KidnummerValidator.isValid
public static boolean isValid(String kidnummer) { try { KidnummerValidator.getKidnummer(kidnummer); return true; } catch (IllegalArgumentException e) { return false; } }
java
public static boolean isValid(String kidnummer) { try { KidnummerValidator.getKidnummer(kidnummer); return true; } catch (IllegalArgumentException e) { return false; } }
[ "public", "static", "boolean", "isValid", "(", "String", "kidnummer", ")", "{", "try", "{", "KidnummerValidator", ".", "getKidnummer", "(", "kidnummer", ")", ";", "return", "true", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "return", ...
Return true if the provided String is a valid KID-nummmer. @param kidnummer A String containing a Kidnummer @return true or false
[ "Return", "true", "if", "the", "provided", "String", "is", "a", "valid", "KID", "-", "nummmer", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/banking/KidnummerValidator.java#L25-L32
106,639
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/banking/KidnummerValidator.java
KidnummerValidator.getKidnummer
public static Kidnummer getKidnummer(String kidnummer) throws IllegalArgumentException { validateSyntax(kidnummer); validateChecksum(kidnummer); return new Kidnummer(kidnummer); }
java
public static Kidnummer getKidnummer(String kidnummer) throws IllegalArgumentException { validateSyntax(kidnummer); validateChecksum(kidnummer); return new Kidnummer(kidnummer); }
[ "public", "static", "Kidnummer", "getKidnummer", "(", "String", "kidnummer", ")", "throws", "IllegalArgumentException", "{", "validateSyntax", "(", "kidnummer", ")", ";", "validateChecksum", "(", "kidnummer", ")", ";", "return", "new", "Kidnummer", "(", "kidnummer",...
Returns an object that represents a Kidnummer. @param kidnummer A String containing a Kidnummer @return A Kidnummer instance @throws IllegalArgumentException thrown if String contains an invalid Kidnummer
[ "Returns", "an", "object", "that", "represents", "a", "Kidnummer", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/banking/KidnummerValidator.java#L41-L45
106,640
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerCalculator.java
OrganisasjonsnummerCalculator.getOrganisasjonsnummerList
public static List<Organisasjonsnummer> getOrganisasjonsnummerList(int length) { List<Organisasjonsnummer> result = new ArrayList<Organisasjonsnummer>(); int numAddedToList = 0; while (numAddedToList < length) { StringBuilder orgnrBuffer = new StringBuilder(LENGTH); for (int i = 0; i < LENGTH; i++) { ...
java
public static List<Organisasjonsnummer> getOrganisasjonsnummerList(int length) { List<Organisasjonsnummer> result = new ArrayList<Organisasjonsnummer>(); int numAddedToList = 0; while (numAddedToList < length) { StringBuilder orgnrBuffer = new StringBuilder(LENGTH); for (int i = 0; i < LENGTH; i++) { ...
[ "public", "static", "List", "<", "Organisasjonsnummer", ">", "getOrganisasjonsnummerList", "(", "int", "length", ")", "{", "List", "<", "Organisasjonsnummer", ">", "result", "=", "new", "ArrayList", "<", "Organisasjonsnummer", ">", "(", ")", ";", "int", "numAdde...
Returns a List with completely random but syntactically valid Organisasjonsnummer instances. @param length Specifies the number of Organisasjonsnummer instances to create in the returned List @return A List with random valid Organisasjonsnummer instances
[ "Returns", "a", "List", "with", "completely", "random", "but", "syntactically", "valid", "Organisasjonsnummer", "instances", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerCalculator.java#L27-L46
106,641
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/WorkflowDemo.java
WorkflowDemo.main
public static void main(String[] args) throws Exception { // Instantiate the CLAVIN GeoParser GeoParser parser = GeoParserFactory.getDefault("./IndexDirectory"); // Unstructured text file about Somalia to be geoparsed File inputFile = new File("src/test/resources/sample...
java
public static void main(String[] args) throws Exception { // Instantiate the CLAVIN GeoParser GeoParser parser = GeoParserFactory.getDefault("./IndexDirectory"); // Unstructured text file about Somalia to be geoparsed File inputFile = new File("src/test/resources/sample...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "// Instantiate the CLAVIN GeoParser", "GeoParser", "parser", "=", "GeoParserFactory", ".", "getDefault", "(", "\"./IndexDirectory\"", ")", ";", "// Unstructured text...
Run this after installing & configuring CLAVIN to get a sense of how to use it. @param args not used @throws Exception
[ "Run", "this", "after", "installing", "&", "configuring", "CLAVIN", "to", "get", "a", "sense", "of", "how", "to", "use", "it", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/WorkflowDemo.java#L50-L70
106,642
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/person/FodselsnummerValidator.java
FodselsnummerValidator.getFodselsnummer
public static no.bekk.bekkopen.person.Fodselsnummer getFodselsnummer(String fodselsnummer) throws IllegalArgumentException { validateSyntax(fodselsnummer); validateIndividnummer(fodselsnummer); validateDate(fodselsnummer); validateChecksums(fodselsnummer); return new no.bekk.bekkopen.person.Fodselsnummer(fods...
java
public static no.bekk.bekkopen.person.Fodselsnummer getFodselsnummer(String fodselsnummer) throws IllegalArgumentException { validateSyntax(fodselsnummer); validateIndividnummer(fodselsnummer); validateDate(fodselsnummer); validateChecksums(fodselsnummer); return new no.bekk.bekkopen.person.Fodselsnummer(fods...
[ "public", "static", "no", ".", "bekk", ".", "bekkopen", ".", "person", ".", "Fodselsnummer", "getFodselsnummer", "(", "String", "fodselsnummer", ")", "throws", "IllegalArgumentException", "{", "validateSyntax", "(", "fodselsnummer", ")", ";", "validateIndividnummer", ...
Returns an object that represents a Fodselsnummer. @param fodselsnummer A String containing a Fodselsnummer @return A Fodselsnummer instance @throws IllegalArgumentException thrown if String contains an invalid Fodselsnummer
[ "Returns", "an", "object", "that", "represents", "a", "Fodselsnummer", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/person/FodselsnummerValidator.java#L40-L46
106,643
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/person/FodselsnummerValidator.java
FodselsnummerValidator.isValid
public static boolean isValid(String fodselsnummer) { try { FodselsnummerValidator.getFodselsnummer(fodselsnummer); return true; } catch (IllegalArgumentException e) { return false; } }
java
public static boolean isValid(String fodselsnummer) { try { FodselsnummerValidator.getFodselsnummer(fodselsnummer); return true; } catch (IllegalArgumentException e) { return false; } }
[ "public", "static", "boolean", "isValid", "(", "String", "fodselsnummer", ")", "{", "try", "{", "FodselsnummerValidator", ".", "getFodselsnummer", "(", "fodselsnummer", ")", ";", "return", "true", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{"...
Return true if the provided String is a valid Fodselsnummer. @param fodselsnummer A String containing a Fodselsnummer @return true or false
[ "Return", "true", "if", "the", "provided", "String", "is", "a", "valid", "Fodselsnummer", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/person/FodselsnummerValidator.java#L55-L62
106,644
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerValidator.java
OrganisasjonsnummerValidator.isValid
public static boolean isValid(String organisasjonsnummer) { try { OrganisasjonsnummerValidator.getOrganisasjonsnummer(organisasjonsnummer); return true; } catch (IllegalArgumentException e) { return false; } }
java
public static boolean isValid(String organisasjonsnummer) { try { OrganisasjonsnummerValidator.getOrganisasjonsnummer(organisasjonsnummer); return true; } catch (IllegalArgumentException e) { return false; } }
[ "public", "static", "boolean", "isValid", "(", "String", "organisasjonsnummer", ")", "{", "try", "{", "OrganisasjonsnummerValidator", ".", "getOrganisasjonsnummer", "(", "organisasjonsnummer", ")", ";", "return", "true", ";", "}", "catch", "(", "IllegalArgumentExcepti...
Return true if the provided String is a valid Organisasjonsnummer. @param organisasjonsnummer A String containing a Organisasjonsnummer @return true or false
[ "Return", "true", "if", "the", "provided", "String", "is", "a", "valid", "Organisasjonsnummer", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerValidator.java#L28-L35
106,645
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerValidator.java
OrganisasjonsnummerValidator.getOrganisasjonsnummer
public static Organisasjonsnummer getOrganisasjonsnummer(String organisasjonsnummer) throws IllegalArgumentException { validateSyntax(organisasjonsnummer); validateChecksum(organisasjonsnummer); return new Organisasjonsnummer(organisasjonsnummer); }
java
public static Organisasjonsnummer getOrganisasjonsnummer(String organisasjonsnummer) throws IllegalArgumentException { validateSyntax(organisasjonsnummer); validateChecksum(organisasjonsnummer); return new Organisasjonsnummer(organisasjonsnummer); }
[ "public", "static", "Organisasjonsnummer", "getOrganisasjonsnummer", "(", "String", "organisasjonsnummer", ")", "throws", "IllegalArgumentException", "{", "validateSyntax", "(", "organisasjonsnummer", ")", ";", "validateChecksum", "(", "organisasjonsnummer", ")", ";", "retu...
Returns an object that represents an Organisasjonsnummer. @param organisasjonsnummer A String containing an Organisasjonsnummer @return An Organisasjonsnummer instance @throws IllegalArgumentException thrown if String contains an invalid Organisasjonsnummer
[ "Returns", "an", "object", "that", "represents", "an", "Organisasjonsnummer", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerValidator.java#L46-L51
106,646
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerValidator.java
OrganisasjonsnummerValidator.getAndForceValidOrganisasjonsnummer
public static Organisasjonsnummer getAndForceValidOrganisasjonsnummer(String organisasjonsnummer) { validateSyntax(organisasjonsnummer); try { validateChecksum(organisasjonsnummer); } catch (IllegalArgumentException iae) { Organisasjonsnummer onr = new Organisasjonsnummer(organisasjonsnummer); int checks...
java
public static Organisasjonsnummer getAndForceValidOrganisasjonsnummer(String organisasjonsnummer) { validateSyntax(organisasjonsnummer); try { validateChecksum(organisasjonsnummer); } catch (IllegalArgumentException iae) { Organisasjonsnummer onr = new Organisasjonsnummer(organisasjonsnummer); int checks...
[ "public", "static", "Organisasjonsnummer", "getAndForceValidOrganisasjonsnummer", "(", "String", "organisasjonsnummer", ")", "{", "validateSyntax", "(", "organisasjonsnummer", ")", ";", "try", "{", "validateChecksum", "(", "organisasjonsnummer", ")", ";", "}", "catch", ...
Returns an object that represents a Organisasjonsnummer. The checksum of the supplied organisasjonsnummer is changed to a valid checksum if the original organisasjonsnummer has an invalid checksum. @param organisasjonsnummer A String containing a Organisasjonsnummer @return A Organisasjonsnummer instance @throws Illeg...
[ "Returns", "an", "object", "that", "represents", "a", "Organisasjonsnummer", ".", "The", "checksum", "of", "the", "supplied", "organisasjonsnummer", "is", "changed", "to", "a", "valid", "checksum", "if", "the", "original", "organisasjonsnummer", "has", "an", "inva...
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/org/OrganisasjonsnummerValidator.java#L65-L75
106,647
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.getHolidays
public static Date[] getHolidays(int year) { Set<Date> days = getHolidaySet(year); Date[] dates = days.toArray(new Date[days.size()]); Arrays.sort(dates); return dates; }
java
public static Date[] getHolidays(int year) { Set<Date> days = getHolidaySet(year); Date[] dates = days.toArray(new Date[days.size()]); Arrays.sort(dates); return dates; }
[ "public", "static", "Date", "[", "]", "getHolidays", "(", "int", "year", ")", "{", "Set", "<", "Date", ">", "days", "=", "getHolidaySet", "(", "year", ")", ";", "Date", "[", "]", "dates", "=", "days", ".", "toArray", "(", "new", "Date", "[", "days"...
Return a sorted array of holidays for a given year. @param year The year to get holidays for. @return The array of holidays, sorted by date.
[ "Return", "a", "sorted", "array", "of", "holidays", "for", "a", "given", "year", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L82-L87
106,648
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.getHolidaySet
private static Set<Date> getHolidaySet(int year) { if (holidays == null) { holidays = new HashMap<Integer, Set<Date>>(); } if (!holidays.containsKey(year)) { Set<Date> yearSet = new HashSet<Date>(); // Add set holidays. yearSet.add(getDate(1, Calendar.JANUARY, year)); yearSet.add(getDate(1, Calend...
java
private static Set<Date> getHolidaySet(int year) { if (holidays == null) { holidays = new HashMap<Integer, Set<Date>>(); } if (!holidays.containsKey(year)) { Set<Date> yearSet = new HashSet<Date>(); // Add set holidays. yearSet.add(getDate(1, Calendar.JANUARY, year)); yearSet.add(getDate(1, Calend...
[ "private", "static", "Set", "<", "Date", ">", "getHolidaySet", "(", "int", "year", ")", "{", "if", "(", "holidays", "==", "null", ")", "{", "holidays", "=", "new", "HashMap", "<", "Integer", ",", "Set", "<", "Date", ">", ">", "(", ")", ";", "}", ...
Get a set of holidays for a given year. @param year The year to get holidays for. @return The set of dates.
[ "Get", "a", "set", "of", "holidays", "for", "a", "given", "year", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L96-L140
106,649
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.isWorkingDay
private static boolean isWorkingDay(Calendar cal) { return cal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY && !isHoliday(cal); }
java
private static boolean isWorkingDay(Calendar cal) { return cal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY && !isHoliday(cal); }
[ "private", "static", "boolean", "isWorkingDay", "(", "Calendar", "cal", ")", "{", "return", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", "!=", "Calendar", ".", "SATURDAY", "&&", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", ...
Will check if the given date is a working day. That is check if the given date is a weekend day or a national holiday. @param cal The Calendar object representing the date. @return true if the given date is a working day, false otherwise.
[ "Will", "check", "if", "the", "given", "date", "is", "a", "working", "day", ".", "That", "is", "check", "if", "the", "given", "date", "is", "a", "weekend", "day", "or", "a", "national", "holiday", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L150-L153
106,650
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.isHoliday
private static boolean isHoliday(Calendar cal) { int year = cal.get(Calendar.YEAR); Set<?> yearSet = getHolidaySet(year); for (Object aYearSet : yearSet) { Date date = (Date) aYearSet; if (checkDate(cal, dateToCalendar(date))) { return true; } } return false; }
java
private static boolean isHoliday(Calendar cal) { int year = cal.get(Calendar.YEAR); Set<?> yearSet = getHolidaySet(year); for (Object aYearSet : yearSet) { Date date = (Date) aYearSet; if (checkDate(cal, dateToCalendar(date))) { return true; } } return false; }
[ "private", "static", "boolean", "isHoliday", "(", "Calendar", "cal", ")", "{", "int", "year", "=", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "Set", "<", "?", ">", "yearSet", "=", "getHolidaySet", "(", "year", ")", ";", "for", "(", ...
Check if given Calendar object represents a holiday. @param cal The Calendar to check. @return true if holiday, false otherwise.
[ "Check", "if", "given", "Calendar", "object", "represents", "a", "holiday", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L162-L172
106,651
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.checkDate
private static boolean checkDate(Calendar cal, Calendar other) { return checkDate(cal, other.get(Calendar.DATE), other.get(Calendar.MONTH)); }
java
private static boolean checkDate(Calendar cal, Calendar other) { return checkDate(cal, other.get(Calendar.DATE), other.get(Calendar.MONTH)); }
[ "private", "static", "boolean", "checkDate", "(", "Calendar", "cal", ",", "Calendar", "other", ")", "{", "return", "checkDate", "(", "cal", ",", "other", ".", "get", "(", "Calendar", ".", "DATE", ")", ",", "other", ".", "get", "(", "Calendar", ".", "MO...
Check if the given dates match on day and month. @param cal The Calendar representing the first date. @param other The Calendar representing the second date. @return true if they match, false otherwise.
[ "Check", "if", "the", "given", "dates", "match", "on", "day", "and", "month", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L216-L218
106,652
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.checkDate
private static boolean checkDate(Calendar cal, int date, int month) { return cal.get(Calendar.DATE) == date && cal.get(Calendar.MONTH) == month; }
java
private static boolean checkDate(Calendar cal, int date, int month) { return cal.get(Calendar.DATE) == date && cal.get(Calendar.MONTH) == month; }
[ "private", "static", "boolean", "checkDate", "(", "Calendar", "cal", ",", "int", "date", ",", "int", "month", ")", "{", "return", "cal", ".", "get", "(", "Calendar", ".", "DATE", ")", "==", "date", "&&", "cal", ".", "get", "(", "Calendar", ".", "MONT...
Check if the given date represents the given date and month. @param cal The Calendar object representing date to check. @param date The date. @param month The month. @return true if they match, false otherwise.
[ "Check", "if", "the", "given", "date", "represents", "the", "given", "date", "and", "month", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L231-L233
106,653
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.dateToCalendar
private static Calendar dateToCalendar(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal; }
java
private static Calendar dateToCalendar(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal; }
[ "private", "static", "Calendar", "dateToCalendar", "(", "Date", "date", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "date", ")", ";", "return", "cal", ";", "}" ]
Convert the given Date object to a Calendar instance. @param date The Date object. @return The Calendar instance.
[ "Convert", "the", "given", "Date", "object", "to", "a", "Calendar", "instance", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L242-L246
106,654
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.rollGetDate
private static Date rollGetDate(Calendar calendar, int days) { Calendar easterSunday = (Calendar) calendar.clone(); easterSunday.add(Calendar.DATE, days); return easterSunday.getTime(); }
java
private static Date rollGetDate(Calendar calendar, int days) { Calendar easterSunday = (Calendar) calendar.clone(); easterSunday.add(Calendar.DATE, days); return easterSunday.getTime(); }
[ "private", "static", "Date", "rollGetDate", "(", "Calendar", "calendar", ",", "int", "days", ")", "{", "Calendar", "easterSunday", "=", "(", "Calendar", ")", "calendar", ".", "clone", "(", ")", ";", "easterSunday", ".", "add", "(", "Calendar", ".", "DATE",...
Add the given number of days to the calendar and convert to Date. @param calendar The calendar to add to. @param days The number of days to add. @return The date object given by the modified calendar.
[ "Add", "the", "given", "number", "of", "days", "to", "the", "calendar", "and", "convert", "to", "Date", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L257-L261
106,655
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.getDate
private static Date getDate(int day, int month, int year) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DATE, day); return cal.getTime(); }
java
private static Date getDate(int day, int month, int year) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DATE, day); return cal.getTime(); }
[ "private", "static", "Date", "getDate", "(", "int", "day", ",", "int", "month", ",", "int", "year", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "YEAR", ",", "year", ")", ...
Get the date for the given values. @param day The day. @param month The month. @param year The year. @return The date represented by the given values.
[ "Get", "the", "date", "for", "the", "given", "values", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L274-L280
106,656
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/banking/Kontonummer.java
Kontonummer.getGroupedValue
public String getGroupedValue() { StringBuilder sb = new StringBuilder(); sb.append(getRegisternummer()).append(Constants.DOT); sb.append(getAccountType()).append(Constants.DOT); sb.append(getPartAfterAccountType()); return sb.toString(); }
java
public String getGroupedValue() { StringBuilder sb = new StringBuilder(); sb.append(getRegisternummer()).append(Constants.DOT); sb.append(getAccountType()).append(Constants.DOT); sb.append(getPartAfterAccountType()); return sb.toString(); }
[ "public", "String", "getGroupedValue", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "getRegisternummer", "(", ")", ")", ".", "append", "(", "Constants", ".", "DOT", ")", ";", "sb", ".", "ap...
Returns the Kontonummer as a String, formatted with '.''s separating the Registernummer, AccountType and end part. @return The formatted Kontonummer
[ "Returns", "the", "Kontonummer", "as", "a", "String", "formatted", "with", ".", "s", "separating", "the", "Registernummer", "AccountType", "and", "end", "part", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/banking/Kontonummer.java#L52-L58
106,657
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java
FodselsnummerCalculator.getFodselsnummerForDateAndGender
public static List<Fodselsnummer> getFodselsnummerForDateAndGender(Date date, KJONN kjonn) { List<Fodselsnummer> result = getManyFodselsnummerForDate(date); splitByGender(kjonn, result); return result; }
java
public static List<Fodselsnummer> getFodselsnummerForDateAndGender(Date date, KJONN kjonn) { List<Fodselsnummer> result = getManyFodselsnummerForDate(date); splitByGender(kjonn, result); return result; }
[ "public", "static", "List", "<", "Fodselsnummer", ">", "getFodselsnummerForDateAndGender", "(", "Date", "date", ",", "KJONN", "kjonn", ")", "{", "List", "<", "Fodselsnummer", ">", "result", "=", "getManyFodselsnummerForDate", "(", "date", ")", ";", "splitByGender"...
Returns a List with valid Fodselsnummer instances for a given Date and gender.
[ "Returns", "a", "List", "with", "valid", "Fodselsnummer", "instances", "for", "a", "given", "Date", "and", "gender", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java#L19-L23
106,658
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java
FodselsnummerCalculator.getFodselsnummerForDate
public static Fodselsnummer getFodselsnummerForDate(Date date){ List<Fodselsnummer> fodselsnummerList = getManyFodselsnummerForDate(date); Collections.shuffle(fodselsnummerList); return fodselsnummerList.get(0); }
java
public static Fodselsnummer getFodselsnummerForDate(Date date){ List<Fodselsnummer> fodselsnummerList = getManyFodselsnummerForDate(date); Collections.shuffle(fodselsnummerList); return fodselsnummerList.get(0); }
[ "public", "static", "Fodselsnummer", "getFodselsnummerForDate", "(", "Date", "date", ")", "{", "List", "<", "Fodselsnummer", ">", "fodselsnummerList", "=", "getManyFodselsnummerForDate", "(", "date", ")", ";", "Collections", ".", "shuffle", "(", "fodselsnummerList", ...
Return one random valid fodselsnummer on a given date
[ "Return", "one", "random", "valid", "fodselsnummer", "on", "a", "given", "date" ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java#L28-L32
106,659
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java
FodselsnummerCalculator.getManyDNumberFodselsnummerForDate
public static List<Fodselsnummer> getManyDNumberFodselsnummerForDate(Date date) { if (date == null) { throw new IllegalArgumentException(); } DateFormat df = new SimpleDateFormat("ddMMyy"); String centuryString = getCentury(date); String dateString = df.format(date); dateString = new StringBuilder() ...
java
public static List<Fodselsnummer> getManyDNumberFodselsnummerForDate(Date date) { if (date == null) { throw new IllegalArgumentException(); } DateFormat df = new SimpleDateFormat("ddMMyy"); String centuryString = getCentury(date); String dateString = df.format(date); dateString = new StringBuilder() ...
[ "public", "static", "List", "<", "Fodselsnummer", ">", "getManyDNumberFodselsnummerForDate", "(", "Date", "date", ")", "{", "if", "(", "date", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "DateFormat", "df", "=", "n...
Returns a List with with VALID DNumber Fodselsnummer instances for a given Date. @param date The Date instance @return A List with Fodelsnummer instances
[ "Returns", "a", "List", "with", "with", "VALID", "DNumber", "Fodselsnummer", "instances", "for", "a", "given", "Date", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java#L41-L53
106,660
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java
FodselsnummerCalculator.getManyFodselsnummerForDate
public static List<Fodselsnummer> getManyFodselsnummerForDate(Date date) { if (date == null) { throw new IllegalArgumentException(); } DateFormat df = new SimpleDateFormat("ddMMyy"); String centuryString = getCentury(date); String dateString = df.format(date); return generateFodselsnummerForDate(dateStri...
java
public static List<Fodselsnummer> getManyFodselsnummerForDate(Date date) { if (date == null) { throw new IllegalArgumentException(); } DateFormat df = new SimpleDateFormat("ddMMyy"); String centuryString = getCentury(date); String dateString = df.format(date); return generateFodselsnummerForDate(dateStri...
[ "public", "static", "List", "<", "Fodselsnummer", ">", "getManyFodselsnummerForDate", "(", "Date", "date", ")", "{", "if", "(", "date", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "DateFormat", "df", "=", "new", ...
Returns a List with with VALID Fodselsnummer instances for a given Date. @param date The Date instance @return A List with Fodelsnummer instances
[ "Returns", "a", "List", "with", "with", "VALID", "Fodselsnummer", "instances", "for", "a", "given", "Date", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/person/FodselsnummerCalculator.java#L62-L70
106,661
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/GeoParserFactory.java
GeoParserFactory.getDefault
public static GeoParser getDefault(String pathToLuceneIndex, int maxHitDepth, int maxContentWindow) throws ClavinException { return getDefault(pathToLuceneIndex, maxHitDepth, maxContentWindow, false); }
java
public static GeoParser getDefault(String pathToLuceneIndex, int maxHitDepth, int maxContentWindow) throws ClavinException { return getDefault(pathToLuceneIndex, maxHitDepth, maxContentWindow, false); }
[ "public", "static", "GeoParser", "getDefault", "(", "String", "pathToLuceneIndex", ",", "int", "maxHitDepth", ",", "int", "maxContentWindow", ")", "throws", "ClavinException", "{", "return", "getDefault", "(", "pathToLuceneIndex", ",", "maxHitDepth", ",", "maxContentW...
Get a GeoParser with defined values for maxHitDepth and maxContentWindow. @param pathToLuceneIndex Path to the local Lucene index. @param maxHitDepth Number of candidate matches to consider @param maxContentWindow How much context to consider when resolving @return GeoParser @th...
[ "Get", "a", "GeoParser", "with", "defined", "values", "for", "maxHitDepth", "and", "maxContentWindow", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/GeoParserFactory.java#L79-L81
106,662
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/GeoParserFactory.java
GeoParserFactory.getDefault
public static GeoParser getDefault(String pathToLuceneIndex, int maxHitDepth, int maxContentWindow, boolean fuzzy) throws ClavinException { try { // instantiate default LocationExtractor LocationExtractor extractor = new ApacheExtractor(); return getDefaul...
java
public static GeoParser getDefault(String pathToLuceneIndex, int maxHitDepth, int maxContentWindow, boolean fuzzy) throws ClavinException { try { // instantiate default LocationExtractor LocationExtractor extractor = new ApacheExtractor(); return getDefaul...
[ "public", "static", "GeoParser", "getDefault", "(", "String", "pathToLuceneIndex", ",", "int", "maxHitDepth", ",", "int", "maxContentWindow", ",", "boolean", "fuzzy", ")", "throws", "ClavinException", "{", "try", "{", "// instantiate default LocationExtractor", "Locatio...
Get a GeoParser with defined values for maxHitDepth and maxContentWindow, and fuzzy matching explicitly turned on or off. @param pathToLuceneIndex Path to the local Lucene index. @param maxHitDepth Number of candidate matches to consider @param maxContentWindow How much context to consider when reso...
[ "Get", "a", "GeoParser", "with", "defined", "values", "for", "maxHitDepth", "and", "maxContentWindow", "and", "fuzzy", "matching", "explicitly", "turned", "on", "or", "off", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/GeoParserFactory.java#L94-L103
106,663
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/GeoParserFactory.java
GeoParserFactory.getDefault
public static GeoParser getDefault(String pathToLuceneIndex, LocationExtractor extractor, int maxHitDepth, int maxContentWindow, boolean fuzzy) throws ClavinException { // instantiate new LuceneGazetteer Gazetteer gazetteer = new LuceneGazetteer(new File(pathToLuceneIndex)); return n...
java
public static GeoParser getDefault(String pathToLuceneIndex, LocationExtractor extractor, int maxHitDepth, int maxContentWindow, boolean fuzzy) throws ClavinException { // instantiate new LuceneGazetteer Gazetteer gazetteer = new LuceneGazetteer(new File(pathToLuceneIndex)); return n...
[ "public", "static", "GeoParser", "getDefault", "(", "String", "pathToLuceneIndex", ",", "LocationExtractor", "extractor", ",", "int", "maxHitDepth", ",", "int", "maxContentWindow", ",", "boolean", "fuzzy", ")", "throws", "ClavinException", "{", "// instantiate new Lucen...
Get a GeoParser with defined values for maxHitDepth and maxContentWindow, fuzzy matching explicitly turned on or off, and a specific LocationExtractor to use. @param pathToLuceneIndex Path to the local Lucene index. @param extractor A specific implementation of LocationExtractor to be used @param maxHi...
[ "Get", "a", "GeoParser", "with", "defined", "values", "for", "maxHitDepth", "and", "maxContentWindow", "fuzzy", "matching", "explicitly", "turned", "on", "or", "off", "and", "a", "specific", "LocationExtractor", "to", "use", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/GeoParserFactory.java#L118-L123
106,664
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/banking/Kidnummer.java
Kidnummer.mod10Kid
public static Kidnummer mod10Kid(String baseNumber, int targetLength) { if (baseNumber.length() >= targetLength) throw new IllegalArgumentException("baseNumber too long"); String padded = String.format("%0" + (targetLength-1) + "d", new BigInteger(baseNumber)); Kidnummer k = new ...
java
public static Kidnummer mod10Kid(String baseNumber, int targetLength) { if (baseNumber.length() >= targetLength) throw new IllegalArgumentException("baseNumber too long"); String padded = String.format("%0" + (targetLength-1) + "d", new BigInteger(baseNumber)); Kidnummer k = new ...
[ "public", "static", "Kidnummer", "mod10Kid", "(", "String", "baseNumber", ",", "int", "targetLength", ")", "{", "if", "(", "baseNumber", ".", "length", "(", ")", ">=", "targetLength", ")", "throw", "new", "IllegalArgumentException", "(", "\"baseNumber too long\"",...
Create a valid KID numer of the wanted length, using MOD10. Input is padded with leading zeros to reach wanted target length @param baseNumber base number to calculate checksum digit for @param targetLength wanted length, 0-padded. Between 2-25 @return Kidnummer
[ "Create", "a", "valid", "KID", "numer", "of", "the", "wanted", "length", "using", "MOD10", ".", "Input", "is", "padded", "with", "leading", "zeros", "to", "reach", "wanted", "target", "length" ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/banking/Kidnummer.java#L36-L42
106,665
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/banking/Kidnummer.java
Kidnummer.mod11Kid
public static Kidnummer mod11Kid(String baseNumber, int targetLength) { if (baseNumber.length() >= targetLength) throw new IllegalArgumentException("baseNumber too long"); String padded = String.format("%0" + (targetLength-1) + "d", new BigInteger(baseNumber)); Kidnummer k = new ...
java
public static Kidnummer mod11Kid(String baseNumber, int targetLength) { if (baseNumber.length() >= targetLength) throw new IllegalArgumentException("baseNumber too long"); String padded = String.format("%0" + (targetLength-1) + "d", new BigInteger(baseNumber)); Kidnummer k = new ...
[ "public", "static", "Kidnummer", "mod11Kid", "(", "String", "baseNumber", ",", "int", "targetLength", ")", "{", "if", "(", "baseNumber", ".", "length", "(", ")", ">=", "targetLength", ")", "throw", "new", "IllegalArgumentException", "(", "\"baseNumber too long\"",...
Create a valid KID numer of the wanted length, using MOD11. Input is padded with leading zeros to reach wanted target length @param baseNumber base number to calculate checksum digit for @param targetLength wanted length, 0-padded. Between 2-25 @return Kidnummer
[ "Create", "a", "valid", "KID", "numer", "of", "the", "wanted", "length", "using", "MOD11", ".", "Input", "is", "padded", "with", "leading", "zeros", "to", "reach", "wanted", "target", "length" ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/banking/Kidnummer.java#L60-L66
106,666
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/gazetteer/query/LuceneGazetteer.java
LuceneGazetteer.sanitizeQueryText
private String sanitizeQueryText(final GazetteerQuery query) { String sanitized = ""; if (query != null && query.getOccurrence() != null) { String text = query.getOccurrence().getText(); if (text != null) { sanitized = escape(text.trim().toLowerCase()); ...
java
private String sanitizeQueryText(final GazetteerQuery query) { String sanitized = ""; if (query != null && query.getOccurrence() != null) { String text = query.getOccurrence().getText(); if (text != null) { sanitized = escape(text.trim().toLowerCase()); ...
[ "private", "String", "sanitizeQueryText", "(", "final", "GazetteerQuery", "query", ")", "{", "String", "sanitized", "=", "\"\"", ";", "if", "(", "query", "!=", "null", "&&", "query", ".", "getOccurrence", "(", ")", "!=", "null", ")", "{", "String", "text",...
Sanitizes the text of the LocationOccurrence in the query parameters for use in a Lucene query, returning an empty string if no text is found. @param query the query configuration @return the santitized query text or the empty string if there is no query text
[ "Sanitizes", "the", "text", "of", "the", "LocationOccurrence", "in", "the", "query", "parameters", "for", "use", "in", "a", "Lucene", "query", "returning", "an", "empty", "string", "if", "no", "text", "is", "found", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/query/LuceneGazetteer.java#L332-L341
106,667
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/gazetteer/query/LuceneGazetteer.java
LuceneGazetteer.buildFilter
private Filter buildFilter(final GazetteerQuery params) { List<Query> queryParts = new ArrayList<Query>(); // create the historical locations restriction if we are not including historical locations if (!params.isIncludeHistorical()) { int val = IndexField.getBooleanIndexValue(false...
java
private Filter buildFilter(final GazetteerQuery params) { List<Query> queryParts = new ArrayList<Query>(); // create the historical locations restriction if we are not including historical locations if (!params.isIncludeHistorical()) { int val = IndexField.getBooleanIndexValue(false...
[ "private", "Filter", "buildFilter", "(", "final", "GazetteerQuery", "params", ")", "{", "List", "<", "Query", ">", "queryParts", "=", "new", "ArrayList", "<", "Query", ">", "(", ")", ";", "// create the historical locations restriction if we are not including historical...
Builds a Lucene search filter based on the provided parameters. @param params the query configuration parameters @return a Lucene search filter that will restrict the returned documents to the criteria provided or <code>null</code> if no filtering is necessary
[ "Builds", "a", "Lucene", "search", "filter", "based", "on", "the", "provided", "parameters", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/query/LuceneGazetteer.java#L349-L389
106,668
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/gazetteer/query/LuceneGazetteer.java
LuceneGazetteer.resolveParents
private void resolveParents(final Map<Integer, Set<GeoName>> childMap) throws IOException { Map<Integer, GeoName> parentMap = new HashMap<Integer, GeoName>(); Map<Integer, Set<GeoName>> grandParentMap = new HashMap<Integer, Set<GeoName>>(); for (Integer parentId : childMap.keySet()) { ...
java
private void resolveParents(final Map<Integer, Set<GeoName>> childMap) throws IOException { Map<Integer, GeoName> parentMap = new HashMap<Integer, GeoName>(); Map<Integer, Set<GeoName>> grandParentMap = new HashMap<Integer, Set<GeoName>>(); for (Integer parentId : childMap.keySet()) { ...
[ "private", "void", "resolveParents", "(", "final", "Map", "<", "Integer", ",", "Set", "<", "GeoName", ">", ">", "childMap", ")", "throws", "IOException", "{", "Map", "<", "Integer", ",", "GeoName", ">", "parentMap", "=", "new", "HashMap", "<", "Integer", ...
Retrieves and sets the parents of the provided children. @param childMap the map of parent geonameID to the set of children that belong to it @throws IOException if an error occurs during parent resolution
[ "Retrieves", "and", "sets", "the", "parents", "of", "the", "provided", "children", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/query/LuceneGazetteer.java#L396-L439
106,669
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/index/WhitespaceLowerCaseAnalyzer.java
WhitespaceLowerCaseAnalyzer.createComponents
@Override protected TokenStreamComponents createComponents(final String fieldName, final Reader reader) { return new TokenStreamComponents(new WhitespaceLowerCaseTokenizer(matchVersion, reader)); }
java
@Override protected TokenStreamComponents createComponents(final String fieldName, final Reader reader) { return new TokenStreamComponents(new WhitespaceLowerCaseTokenizer(matchVersion, reader)); }
[ "@", "Override", "protected", "TokenStreamComponents", "createComponents", "(", "final", "String", "fieldName", ",", "final", "Reader", "reader", ")", "{", "return", "new", "TokenStreamComponents", "(", "new", "WhitespaceLowerCaseTokenizer", "(", "matchVersion", ",", ...
Provides tokenizer access for the analyzer. @param fieldName field to be tokenized @param reader
[ "Provides", "tokenizer", "access", "for", "the", "analyzer", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/index/WhitespaceLowerCaseAnalyzer.java#L60-L63
106,670
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/index/IndexDirectoryBuilder.java
IndexDirectoryBuilder.main
public static void main(String[] args) throws IOException { Options options = getOptions(); CommandLine cmd = null; CommandLineParser parser = new GnuParser(); try { cmd = parser.parse(options, args); } catch (ParseException pe) { LOG.error(pe.getMessage()...
java
public static void main(String[] args) throws IOException { Options options = getOptions(); CommandLine cmd = null; CommandLineParser parser = new GnuParser(); try { cmd = parser.parse(options, args); } catch (ParseException pe) { LOG.error(pe.getMessage()...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "Options", "options", "=", "getOptions", "(", ")", ";", "CommandLine", "cmd", "=", "null", ";", "CommandLineParser", "parser", "=", "new", "GnuParser", ...
Turns a GeoNames gazetteer file into a Lucene index, and adds some supplementary gazetteer records at the end. @param args not used @throws IOException
[ "Turns", "a", "GeoNames", "gazetteer", "file", "into", "a", "Lucene", "index", "and", "adds", "some", "supplementary", "gazetteer", "records", "at", "the", "end", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/index/IndexDirectoryBuilder.java#L504-L564
106,671
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/banking/KontonummerValidator.java
KontonummerValidator.isValid
public static boolean isValid(String kontonummer) { try { KontonummerValidator.getKontonummer(kontonummer); return true; } catch (IllegalArgumentException e) { return false; } }
java
public static boolean isValid(String kontonummer) { try { KontonummerValidator.getKontonummer(kontonummer); return true; } catch (IllegalArgumentException e) { return false; } }
[ "public", "static", "boolean", "isValid", "(", "String", "kontonummer", ")", "{", "try", "{", "KontonummerValidator", ".", "getKontonummer", "(", "kontonummer", ")", ";", "return", "true", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "ret...
Return true if the provided String is a valid Kontonummmer. @param kontonummer A String containing a Kontonummer @return true or false
[ "Return", "true", "if", "the", "provided", "String", "is", "a", "valid", "Kontonummmer", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/banking/KontonummerValidator.java#L34-L41
106,672
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/banking/KontonummerValidator.java
KontonummerValidator.getKontonummer
public static Kontonummer getKontonummer(String kontonummer) throws IllegalArgumentException { validateSyntax(kontonummer); validateChecksum(kontonummer); return new Kontonummer(kontonummer); }
java
public static Kontonummer getKontonummer(String kontonummer) throws IllegalArgumentException { validateSyntax(kontonummer); validateChecksum(kontonummer); return new Kontonummer(kontonummer); }
[ "public", "static", "Kontonummer", "getKontonummer", "(", "String", "kontonummer", ")", "throws", "IllegalArgumentException", "{", "validateSyntax", "(", "kontonummer", ")", ";", "validateChecksum", "(", "kontonummer", ")", ";", "return", "new", "Kontonummer", "(", ...
Returns an object that represents a Kontonummer. @param kontonummer A String containing a Kontonummer @return A Kontonummer instance @throws IllegalArgumentException thrown if String contains an invalid Kontonummer
[ "Returns", "an", "object", "that", "represents", "a", "Kontonummer", "." ]
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/banking/KontonummerValidator.java#L50-L54
106,673
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/banking/KontonummerValidator.java
KontonummerValidator.getAndForceValidKontonummer
public static Kontonummer getAndForceValidKontonummer(String kontonummer) { validateSyntax(kontonummer); try { validateChecksum(kontonummer); } catch (IllegalArgumentException iae) { Kontonummer k = new Kontonummer(kontonummer); int checksum = calculateMod11Ch...
java
public static Kontonummer getAndForceValidKontonummer(String kontonummer) { validateSyntax(kontonummer); try { validateChecksum(kontonummer); } catch (IllegalArgumentException iae) { Kontonummer k = new Kontonummer(kontonummer); int checksum = calculateMod11Ch...
[ "public", "static", "Kontonummer", "getAndForceValidKontonummer", "(", "String", "kontonummer", ")", "{", "validateSyntax", "(", "kontonummer", ")", ";", "try", "{", "validateChecksum", "(", "kontonummer", ")", ";", "}", "catch", "(", "IllegalArgumentException", "ia...
Returns an object that represents a Kontonummer. The checksum of the supplied kontonummer is changed to a valid checksum if the original kontonummer has an invalid checksum. @param kontonummer A String containing a Kontonummer @return A Kontonummer instance @throws IllegalArgumentException thrown if String contains an...
[ "Returns", "an", "object", "that", "represents", "a", "Kontonummer", ".", "The", "checksum", "of", "the", "supplied", "kontonummer", "is", "changed", "to", "a", "valid", "checksum", "if", "the", "original", "kontonummer", "has", "an", "invalid", "checksum", "....
5a576696390cecaac111fa97fde581e0c1afb9b8
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/banking/KontonummerValidator.java#L66-L76
106,674
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/resolver/ClavinLocationResolver.java
ClavinLocationResolver.pickBestCandidates
private List<ResolvedLocation> pickBestCandidates(final List<List<ResolvedLocation>> allCandidates) { // initialize return object List<ResolvedLocation> bestCandidates = new ArrayList<ResolvedLocation>(); // variables used in heuristic matching Set<CountryCode> countries; Set<St...
java
private List<ResolvedLocation> pickBestCandidates(final List<List<ResolvedLocation>> allCandidates) { // initialize return object List<ResolvedLocation> bestCandidates = new ArrayList<ResolvedLocation>(); // variables used in heuristic matching Set<CountryCode> countries; Set<St...
[ "private", "List", "<", "ResolvedLocation", ">", "pickBestCandidates", "(", "final", "List", "<", "List", "<", "ResolvedLocation", ">", ">", "allCandidates", ")", "{", "// initialize return object", "List", "<", "ResolvedLocation", ">", "bestCandidates", "=", "new",...
Uses heuristics to select the best match for each location name extracted from a document, choosing from among a list of lists of candidate matches. Although not guaranteeing an optimal solution (enumerating & evaluating each possible combination is too costly), it does a decent job of cracking the "Springfield Proble...
[ "Uses", "heuristics", "to", "select", "the", "best", "match", "for", "each", "location", "name", "extracted", "from", "a", "document", "choosing", "from", "among", "a", "list", "of", "lists", "of", "candidate", "matches", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/resolver/ClavinLocationResolver.java#L264-L332
106,675
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java
QueryBuilder.build
public GazetteerQuery build() { return new GazetteerQuery(location, maxResults, fuzzyMode, ancestryMode, includeHistorical, filterDupes, parentIds, featureCodes); }
java
public GazetteerQuery build() { return new GazetteerQuery(location, maxResults, fuzzyMode, ancestryMode, includeHistorical, filterDupes, parentIds, featureCodes); }
[ "public", "GazetteerQuery", "build", "(", ")", "{", "return", "new", "GazetteerQuery", "(", "location", ",", "maxResults", ",", "fuzzyMode", ",", "ancestryMode", ",", "includeHistorical", ",", "filterDupes", ",", "parentIds", ",", "featureCodes", ")", ";", "}" ]
Constructs a query from the current configuration of this Builder. @return a {@link GazetteerQuery} configuration object
[ "Constructs", "a", "query", "from", "the", "current", "configuration", "of", "this", "Builder", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/query/QueryBuilder.java#L124-L126
106,676
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/util/DamerauLevenshtein.java
DamerauLevenshtein.isEditDistance1
public static boolean isEditDistance1(String str1, String str2) { // one or both strings is empty or null if ((str1 == null) || str1.isEmpty()) { if ((str2 == null) || str2.isEmpty()) { return true; } else { return (str2.length() <= 1); ...
java
public static boolean isEditDistance1(String str1, String str2) { // one or both strings is empty or null if ((str1 == null) || str1.isEmpty()) { if ((str2 == null) || str2.isEmpty()) { return true; } else { return (str2.length() <= 1); ...
[ "public", "static", "boolean", "isEditDistance1", "(", "String", "str1", ",", "String", "str2", ")", "{", "// one or both strings is empty or null", "if", "(", "(", "str1", "==", "null", ")", "||", "str1", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "("...
Fast method for determining whether the Damerau-Levenshtein edit distance between two strings is less than 2. Returns as quick as possibly by stopping once multiple edits are found. Significantly faster than {@link #damerauLevenshteinDistance(String str1, String str2)} which explores every path between every string to...
[ "Fast", "method", "for", "determining", "whether", "the", "Damerau", "-", "Levenshtein", "edit", "distance", "between", "two", "strings", "is", "less", "than", "2", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/util/DamerauLevenshtein.java#L143-L185
106,677
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/util/DamerauLevenshtein.java
InfiniteCharArray.remainder
protected String remainder(int index) { if (index > this.array.length) return ""; else return new String(Arrays.copyOfRange(this.array, index, this.array.length)); }
java
protected String remainder(int index) { if (index > this.array.length) return ""; else return new String(Arrays.copyOfRange(this.array, index, this.array.length)); }
[ "protected", "String", "remainder", "(", "int", "index", ")", "{", "if", "(", "index", ">", "this", ".", "array", ".", "length", ")", "return", "\"\"", ";", "else", "return", "new", "String", "(", "Arrays", ".", "copyOfRange", "(", "this", ".", "array"...
Get the contents of the char array to the right of the given index, and return it as a String. @param index left bound of the string we're pulling from the char array @return a string representing everything to the right of the index
[ "Get", "the", "contents", "of", "the", "char", "array", "to", "the", "right", "of", "the", "given", "index", "and", "return", "it", "as", "a", "String", "." ]
f73c741f33a01b91aa5b06e71860bc354ef3010d
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/util/DamerauLevenshtein.java#L230-L234
106,678
psjava/psjava
src/main/java/org/psjava/algo/PermutationWithRepetitionIterable.java
PermutationWithRepetitionIterable.create
public static <T> Iterable<PSArray<T>> create(Iterable<T> items, final Comparator<T> comparator) { MutableArray<T> initial = MutableArrayFromIterable.create(items); GoodSortingAlgorithm.getInstance().sort(initial, comparator); return IterableUsingStatusUpdater.create(initial, new Updater<PSArray...
java
public static <T> Iterable<PSArray<T>> create(Iterable<T> items, final Comparator<T> comparator) { MutableArray<T> initial = MutableArrayFromIterable.create(items); GoodSortingAlgorithm.getInstance().sort(initial, comparator); return IterableUsingStatusUpdater.create(initial, new Updater<PSArray...
[ "public", "static", "<", "T", ">", "Iterable", "<", "PSArray", "<", "T", ">", ">", "create", "(", "Iterable", "<", "T", ">", "items", ",", "final", "Comparator", "<", "T", ">", "comparator", ")", "{", "MutableArray", "<", "T", ">", "initial", "=", ...
SRM464-1-250 is a good problem to solve using this.
[ "SRM464", "-", "1", "-", "250", "is", "a", "good", "problem", "to", "solve", "using", "this", "." ]
6a160e385fad340109eca00e3a9042071b1eea1e
https://github.com/psjava/psjava/blob/6a160e385fad340109eca00e3a9042071b1eea1e/src/main/java/org/psjava/algo/PermutationWithRepetitionIterable.java#L17-L28
106,679
psjava/psjava
src/main/java/org/psjava/algo/graph/dfs/AllSourceDFS.java
AllSourceDFS.traverse
public static <V, E extends DirectedEdge<V>> void traverse(Graph<V, E> graph, DFSVisitor<V, E> visitor) { MultiSourceDFS.traverse(graph, graph.getVertices(), visitor); }
java
public static <V, E extends DirectedEdge<V>> void traverse(Graph<V, E> graph, DFSVisitor<V, E> visitor) { MultiSourceDFS.traverse(graph, graph.getVertices(), visitor); }
[ "public", "static", "<", "V", ",", "E", "extends", "DirectedEdge", "<", "V", ">", ">", "void", "traverse", "(", "Graph", "<", "V", ",", "E", ">", "graph", ",", "DFSVisitor", "<", "V", ",", "E", ">", "visitor", ")", "{", "MultiSourceDFS", ".", "trav...
Remember that visiting order is not ordered.
[ "Remember", "that", "visiting", "order", "is", "not", "ordered", "." ]
6a160e385fad340109eca00e3a9042071b1eea1e
https://github.com/psjava/psjava/blob/6a160e385fad340109eca00e3a9042071b1eea1e/src/main/java/org/psjava/algo/graph/dfs/AllSourceDFS.java#L11-L13
106,680
psjava/psjava
src/main/java/org/psjava/algo/geometry/convexhull/DivideAndConquerConvexHull.java
DivideAndConquerConvexHull.findBridgeIndexes
private static <T> IntPair findBridgeIndexes(PSArray<Point2D<T>> earlyHull, PSArray<Point2D<T>> laterHull, int earlyStart, int laterStart, MultipliableNumberSystem<T> ns) { int early = earlyStart; int later = laterStart; while (true) { int nextEarly = getPreIndex(early, earlyHull.siz...
java
private static <T> IntPair findBridgeIndexes(PSArray<Point2D<T>> earlyHull, PSArray<Point2D<T>> laterHull, int earlyStart, int laterStart, MultipliableNumberSystem<T> ns) { int early = earlyStart; int later = laterStart; while (true) { int nextEarly = getPreIndex(early, earlyHull.siz...
[ "private", "static", "<", "T", ">", "IntPair", "findBridgeIndexes", "(", "PSArray", "<", "Point2D", "<", "T", ">", ">", "earlyHull", ",", "PSArray", "<", "Point2D", "<", "T", ">", ">", "laterHull", ",", "int", "earlyStart", ",", "int", "laterStart", ",",...
early, later are ordered by ccw order.
[ "early", "later", "are", "ordered", "by", "ccw", "order", "." ]
6a160e385fad340109eca00e3a9042071b1eea1e
https://github.com/psjava/psjava/blob/6a160e385fad340109eca00e3a9042071b1eea1e/src/main/java/org/psjava/algo/geometry/convexhull/DivideAndConquerConvexHull.java#L75-L89
106,681
psjava/psjava
src/main/java/org/psjava/ds/tree/trie/TrieNodeFactoryForBooleanKey.java
TrieNodeFactoryForBooleanKey.getInstance
public static TrieNodeFactory<Boolean> getInstance() { return new TrieNodeFactory<Boolean>() { @Override public TrieNode<Boolean> create() { return new BooleanTrieNode(); } }; }
java
public static TrieNodeFactory<Boolean> getInstance() { return new TrieNodeFactory<Boolean>() { @Override public TrieNode<Boolean> create() { return new BooleanTrieNode(); } }; }
[ "public", "static", "TrieNodeFactory", "<", "Boolean", ">", "getInstance", "(", ")", "{", "return", "new", "TrieNodeFactory", "<", "Boolean", ">", "(", ")", "{", "@", "Override", "public", "TrieNode", "<", "Boolean", ">", "create", "(", ")", "{", "return",...
specialized in speed for boolean keyed nodes.
[ "specialized", "in", "speed", "for", "boolean", "keyed", "nodes", "." ]
6a160e385fad340109eca00e3a9042071b1eea1e
https://github.com/psjava/psjava/blob/6a160e385fad340109eca00e3a9042071b1eea1e/src/main/java/org/psjava/ds/tree/trie/TrieNodeFactoryForBooleanKey.java#L10-L17
106,682
greenlaw110/play-excel
src/play/modules/excel/Excel.java
Excel.renderTemplateAsExcel
public static void renderTemplateAsExcel(String templateName, Object... args) { // Template datas Scope.RenderArgs templateBinding = Scope.RenderArgs.current(); for (Object o : args) { List<String> names = LocalvariablesNamesEnhancer.LocalVariablesNamesTracer .getAllLocalVariableNames(o); for (String ...
java
public static void renderTemplateAsExcel(String templateName, Object... args) { // Template datas Scope.RenderArgs templateBinding = Scope.RenderArgs.current(); for (Object o : args) { List<String> names = LocalvariablesNamesEnhancer.LocalVariablesNamesTracer .getAllLocalVariableNames(o); for (String ...
[ "public", "static", "void", "renderTemplateAsExcel", "(", "String", "templateName", ",", "Object", "...", "args", ")", "{", "// Template datas", "Scope", ".", "RenderArgs", "templateBinding", "=", "Scope", ".", "RenderArgs", ".", "current", "(", ")", ";", "for",...
Render a specific template @param templateName The template name @param args The template data
[ "Render", "a", "specific", "template" ]
6bf18419a52213d06787308c52cb70bfebcac3ab
https://github.com/greenlaw110/play-excel/blob/6bf18419a52213d06787308c52cb70bfebcac3ab/src/play/modules/excel/Excel.java#L48-L88
106,683
greenlaw110/play-excel
src/play/modules/excel/Excel.java
Excel.renderExcel
public static void renderExcel(Object... args) { String templateName = null; final Http.Request request = Http.Request.current(); if (args.length > 0 && args[0] instanceof String && LocalvariablesNamesEnhancer.LocalVariablesNamesTracer .getAllLocalVariableNames(args[0]).isEmpty()) { templateName...
java
public static void renderExcel(Object... args) { String templateName = null; final Http.Request request = Http.Request.current(); if (args.length > 0 && args[0] instanceof String && LocalvariablesNamesEnhancer.LocalVariablesNamesTracer .getAllLocalVariableNames(args[0]).isEmpty()) { templateName...
[ "public", "static", "void", "renderExcel", "(", "Object", "...", "args", ")", "{", "String", "templateName", "=", "null", ";", "final", "Http", ".", "Request", "request", "=", "Http", ".", "Request", ".", "current", "(", ")", ";", "if", "(", "args", "....
Render the corresponding template @param args The template data
[ "Render", "the", "corresponding", "template" ]
6bf18419a52213d06787308c52cb70bfebcac3ab
https://github.com/greenlaw110/play-excel/blob/6bf18419a52213d06787308c52cb70bfebcac3ab/src/play/modules/excel/Excel.java#L96-L116
106,684
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/numbers/NumberFormattingUtils.java
NumberFormattingUtils.setup
public static BigDecimal setup( BigDecimal n, // number to be formatted NumberRoundMode roundMode, // rounding mode NumberFormatMode formatMode, // formatting mode (significant digits, etc) int minIntDigits, // maximum integer digits to emit ...
java
public static BigDecimal setup( BigDecimal n, // number to be formatted NumberRoundMode roundMode, // rounding mode NumberFormatMode formatMode, // formatting mode (significant digits, etc) int minIntDigits, // maximum integer digits to emit ...
[ "public", "static", "BigDecimal", "setup", "(", "BigDecimal", "n", ",", "// number to be formatted", "NumberRoundMode", "roundMode", ",", "// rounding mode", "NumberFormatMode", "formatMode", ",", "// formatting mode (significant digits, etc)", "int", "minIntDigits", ",", "//...
Calculates the number of integer and fractional digits to emit, returning them in a 2-element array, and updates the operands. In one of the two significant digit modes, SIGNIFICANT and SIGNIFICANT_MAXFRAC, a min/max number significant digits will be emitted. This is useful for formatting compact formats where the wid...
[ "Calculates", "the", "number", "of", "integer", "and", "fractional", "digits", "to", "emit", "returning", "them", "in", "a", "2", "-", "element", "array", "and", "updates", "the", "operands", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/NumberFormattingUtils.java#L34-L89
106,685
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/numbers/NumberFormattingUtils.java
NumberFormattingUtils.format
public static void format( BigDecimal n, DigitBuffer buf, NumberFormatterParams params, boolean currencyMode, boolean grouping, int minIntDigits, int primaryGroupingSize, int secondaryGroupingSize) { // Setup integer digit grouping. if (secondaryGroupingSize <= 0...
java
public static void format( BigDecimal n, DigitBuffer buf, NumberFormatterParams params, boolean currencyMode, boolean grouping, int minIntDigits, int primaryGroupingSize, int secondaryGroupingSize) { // Setup integer digit grouping. if (secondaryGroupingSize <= 0...
[ "public", "static", "void", "format", "(", "BigDecimal", "n", ",", "DigitBuffer", "buf", ",", "NumberFormatterParams", "params", ",", "boolean", "currencyMode", ",", "boolean", "grouping", ",", "int", "minIntDigits", ",", "int", "primaryGroupingSize", ",", "int", ...
Formats the number into the digit buffer.
[ "Formats", "the", "number", "into", "the", "digit", "buffer", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/numbers/NumberFormattingUtils.java#L94-L199
106,686
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/DistanceTable.java
DistanceTable.distance
public int distance(CLDR.Locale desired, CLDR.Locale supported) { return distance(desired, supported, DEFAULT_THRESHOLD); }
java
public int distance(CLDR.Locale desired, CLDR.Locale supported) { return distance(desired, supported, DEFAULT_THRESHOLD); }
[ "public", "int", "distance", "(", "CLDR", ".", "Locale", "desired", ",", "CLDR", ".", "Locale", "supported", ")", "{", "return", "distance", "(", "desired", ",", "supported", ",", "DEFAULT_THRESHOLD", ")", ";", "}" ]
Returns the distance between the desired and supported locale, using the default distance threshold.
[ "Returns", "the", "distance", "between", "the", "desired", "and", "supported", "locale", "using", "the", "default", "distance", "threshold", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/DistanceTable.java#L86-L88
106,687
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/DistanceTable.java
DistanceTable.distance
public int distance(CLDR.Locale desired, CLDR.Locale supported, int threshold) { // Query the top level LANGUAGE boolean langEquals = desired.language().equals(supported.language()); Node node = distanceMap.get(desired.language(), supported.language()); if (node == null) { node = distanceMap.get(A...
java
public int distance(CLDR.Locale desired, CLDR.Locale supported, int threshold) { // Query the top level LANGUAGE boolean langEquals = desired.language().equals(supported.language()); Node node = distanceMap.get(desired.language(), supported.language()); if (node == null) { node = distanceMap.get(A...
[ "public", "int", "distance", "(", "CLDR", ".", "Locale", "desired", ",", "CLDR", ".", "Locale", "supported", ",", "int", "threshold", ")", "{", "// Query the top level LANGUAGE", "boolean", "langEquals", "=", "desired", ".", "language", "(", ")", ".", "equals"...
Returns the distance between the desired and supported locale, using the given distance threshold. Any distance equal to or greater than the threshold will return the maximum distance.
[ "Returns", "the", "distance", "between", "the", "desired", "and", "supported", "locale", "using", "the", "given", "distance", "threshold", ".", "Any", "distance", "equal", "to", "or", "greater", "than", "the", "threshold", "will", "return", "the", "maximum", "...
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/DistanceTable.java#L95-L166
106,688
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/DistanceTable.java
DistanceTable.scanTerritory
private Node scanTerritory(DistanceMap map, String desired, String supported) { Node node; for (String partition : PARTITION_TABLE.getRegionPartition(desired)) { node = map.get(partition, supported); if (node != null) { return node; } } for (String partition : PARTITION_TA...
java
private Node scanTerritory(DistanceMap map, String desired, String supported) { Node node; for (String partition : PARTITION_TABLE.getRegionPartition(desired)) { node = map.get(partition, supported); if (node != null) { return node; } } for (String partition : PARTITION_TA...
[ "private", "Node", "scanTerritory", "(", "DistanceMap", "map", ",", "String", "desired", ",", "String", "supported", ")", "{", "Node", "node", ";", "for", "(", "String", "partition", ":", "PARTITION_TABLE", ".", "getRegionPartition", "(", "desired", ")", ")", ...
Scan the desired region against the supported partitions and vice versa. Return the first matching node.
[ "Scan", "the", "desired", "region", "against", "the", "supported", "partitions", "and", "vice", "versa", ".", "Return", "the", "first", "matching", "node", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/DistanceTable.java#L172-L189
106,689
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/MetaZone.java
MetaZone.applies
public String applies(ZonedDateTime d) { long epoch = d.toEpochSecond(); for (int i = 0; i < size; i++) { Entry entry = entries[i]; if (entry.from == -1) { if (entry.to == -1 || epoch < entry.to) { return entry.metazoneId; } } else if (entry.to == -1) { if (en...
java
public String applies(ZonedDateTime d) { long epoch = d.toEpochSecond(); for (int i = 0; i < size; i++) { Entry entry = entries[i]; if (entry.from == -1) { if (entry.to == -1 || epoch < entry.to) { return entry.metazoneId; } } else if (entry.to == -1) { if (en...
[ "public", "String", "applies", "(", "ZonedDateTime", "d", ")", "{", "long", "epoch", "=", "d", ".", "toEpochSecond", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "Entry", "entry", "=", "entries...
Find the metazone that applies for a given timestamp.
[ "Find", "the", "metazone", "that", "applies", "for", "a", "given", "timestamp", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/MetaZone.java#L30-L47
106,690
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/LanguageMatcher.java
LanguageMatcher.match
public Match match(List<String> desired, int threshold) { return matchImpl(parse(desired), threshold); }
java
public Match match(List<String> desired, int threshold) { return matchImpl(parse(desired), threshold); }
[ "public", "Match", "match", "(", "List", "<", "String", ">", "desired", ",", "int", "threshold", ")", "{", "return", "matchImpl", "(", "parse", "(", "desired", ")", ",", "threshold", ")", ";", "}" ]
Return the best match that exceeds the threshold. If the default is returned its distance is set to MAX_DISTANCE.
[ "Return", "the", "best", "match", "that", "exceeds", "the", "threshold", ".", "If", "the", "default", "is", "returned", "its", "distance", "is", "set", "to", "MAX_DISTANCE", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/LanguageMatcher.java#L117-L119
106,691
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/LanguageMatcher.java
LanguageMatcher.matches
public List<Match> matches(List<String> desired) { return matchesImpl(parse(desired), DEFAULT_THRESHOLD); }
java
public List<Match> matches(List<String> desired) { return matchesImpl(parse(desired), DEFAULT_THRESHOLD); }
[ "public", "List", "<", "Match", ">", "matches", "(", "List", "<", "String", ">", "desired", ")", "{", "return", "matchesImpl", "(", "parse", "(", "desired", ")", ",", "DEFAULT_THRESHOLD", ")", ";", "}" ]
Return all matches and their distances, if they exceed the default threshold. If no match exceeds the threshold this returns an empty list.
[ "Return", "all", "matches", "and", "their", "distances", "if", "they", "exceed", "the", "default", "threshold", ".", "If", "no", "match", "exceeds", "the", "threshold", "this", "returns", "an", "empty", "list", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/LanguageMatcher.java#L141-L143
106,692
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/LanguageMatcher.java
LanguageMatcher.matchImpl
private Match matchImpl(List<Entry> desiredLocales, int threshold) { int bestDistance = MAX_DISTANCE; Entry bestMatch = null; for (Entry desired : desiredLocales) { List<String> exact = exactMatch.get(desired.locale); if (exact != null) { return new Match(exact.get(0), 0); } ...
java
private Match matchImpl(List<Entry> desiredLocales, int threshold) { int bestDistance = MAX_DISTANCE; Entry bestMatch = null; for (Entry desired : desiredLocales) { List<String> exact = exactMatch.get(desired.locale); if (exact != null) { return new Match(exact.get(0), 0); } ...
[ "private", "Match", "matchImpl", "(", "List", "<", "Entry", ">", "desiredLocales", ",", "int", "threshold", ")", "{", "int", "bestDistance", "=", "MAX_DISTANCE", ";", "Entry", "bestMatch", "=", "null", ";", "for", "(", "Entry", "desired", ":", "desiredLocale...
Return the best match that exceeds the threshold, or the default. If the default is returned its distance is set to MAX_DISTANCE. An exact match has distance of 0.
[ "Return", "the", "best", "match", "that", "exceeds", "the", "threshold", "or", "the", "default", ".", "If", "the", "default", "is", "returned", "its", "distance", "is", "set", "to", "MAX_DISTANCE", ".", "An", "exact", "match", "has", "distance", "of", "0",...
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/LanguageMatcher.java#L158-L177
106,693
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java
PluralCodeGenerator.generate
public void generate(Path outputDir, DataReader reader) throws IOException { String className = "_PluralRules"; TypeSpec.Builder type = TypeSpec.classBuilder(className) .addModifiers(PUBLIC) .superclass(TYPE_BASE); Map<String, FieldSpec> fieldMap = buildConditionFields(reader.cardinals(), r...
java
public void generate(Path outputDir, DataReader reader) throws IOException { String className = "_PluralRules"; TypeSpec.Builder type = TypeSpec.classBuilder(className) .addModifiers(PUBLIC) .superclass(TYPE_BASE); Map<String, FieldSpec> fieldMap = buildConditionFields(reader.cardinals(), r...
[ "public", "void", "generate", "(", "Path", "outputDir", ",", "DataReader", "reader", ")", "throws", "IOException", "{", "String", "className", "=", "\"_PluralRules\"", ";", "TypeSpec", ".", "Builder", "type", "=", "TypeSpec", ".", "classBuilder", "(", "className...
Generate a class for plural rule evaluation. This will build several Condition fields which evaluate specific AND conditions, and methods which call these AND conditions joined by an OR operator.
[ "Generate", "a", "class", "for", "plural", "rule", "evaluation", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java#L55-L70
106,694
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java
PluralCodeGenerator.buildRuleMethod
private MethodSpec buildRuleMethod(String methodName, PluralData data, Map<String, FieldSpec> fieldMap) { MethodSpec.Builder method = MethodSpec.methodBuilder(methodName) .addModifiers(PRIVATE, STATIC) .addParameter(NUMBER_OPERANDS, "o") .returns(PLURAL_CATEGORY); for (Map.Entry<String,...
java
private MethodSpec buildRuleMethod(String methodName, PluralData data, Map<String, FieldSpec> fieldMap) { MethodSpec.Builder method = MethodSpec.methodBuilder(methodName) .addModifiers(PRIVATE, STATIC) .addParameter(NUMBER_OPERANDS, "o") .returns(PLURAL_CATEGORY); for (Map.Entry<String,...
[ "private", "MethodSpec", "buildRuleMethod", "(", "String", "methodName", ",", "PluralData", "data", ",", "Map", "<", "String", ",", "FieldSpec", ">", "fieldMap", ")", "{", "MethodSpec", ".", "Builder", "method", "=", "MethodSpec", ".", "methodBuilder", "(", "m...
Builds a method that when called evaluates the rule and returns a PluralCategory.
[ "Builds", "a", "method", "that", "when", "called", "evaluates", "the", "rule", "and", "returns", "a", "PluralCategory", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java#L110-L165
106,695
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java
PluralCodeGenerator.buildConditionFields
@SafeVarargs private final Map<String, FieldSpec> buildConditionFields(Map<String, PluralData>... pluralMaps) { Map<String, FieldSpec> index = new LinkedHashMap<>(); int seq = 0; for (Map<String, PluralData> pluralMap : pluralMaps) { for (Map.Entry<String, PluralData> entry : pluralMap.entrySet()) ...
java
@SafeVarargs private final Map<String, FieldSpec> buildConditionFields(Map<String, PluralData>... pluralMaps) { Map<String, FieldSpec> index = new LinkedHashMap<>(); int seq = 0; for (Map<String, PluralData> pluralMap : pluralMaps) { for (Map.Entry<String, PluralData> entry : pluralMap.entrySet()) ...
[ "@", "SafeVarargs", "private", "final", "Map", "<", "String", ",", "FieldSpec", ">", "buildConditionFields", "(", "Map", "<", "String", ",", "PluralData", ">", "...", "pluralMaps", ")", "{", "Map", "<", "String", ",", "FieldSpec", ">", "index", "=", "new",...
Maps an integer to each AND condition's canonical representation.
[ "Maps", "an", "integer", "to", "each", "AND", "condition", "s", "canonical", "representation", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java#L170-L205
106,696
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java
PluralCodeGenerator.buildConditionField
public FieldSpec buildConditionField(int index, Struct<PluralType> branch) { String fieldDoc = PluralRulePrinter.print(branch); String name = String.format("COND_%d", index); FieldSpec.Builder field = FieldSpec.builder(PLURAL_CONDITION, name, PRIVATE, STATIC, FINAL) .addJavadoc(fieldDoc + "\n"); ...
java
public FieldSpec buildConditionField(int index, Struct<PluralType> branch) { String fieldDoc = PluralRulePrinter.print(branch); String name = String.format("COND_%d", index); FieldSpec.Builder field = FieldSpec.builder(PLURAL_CONDITION, name, PRIVATE, STATIC, FINAL) .addJavadoc(fieldDoc + "\n"); ...
[ "public", "FieldSpec", "buildConditionField", "(", "int", "index", ",", "Struct", "<", "PluralType", ">", "branch", ")", "{", "String", "fieldDoc", "=", "PluralRulePrinter", ".", "print", "(", "branch", ")", ";", "String", "name", "=", "String", ".", "format...
Constructs a lambda Condition field that represents a chain of AND conditions, that together is a single branch in an OR condition.
[ "Constructs", "a", "lambda", "Condition", "field", "that", "represents", "a", "chain", "of", "AND", "conditions", "that", "together", "is", "a", "single", "branch", "in", "an", "OR", "condition", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java#L211-L231
106,697
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java
PluralCodeGenerator.renderExpr
private static void renderExpr(boolean first, CodeBlock.Builder code, Node<PluralType> expr) { Iterator<Node<PluralType>> iter = expr.asStruct().nodes().iterator(); // Parse out the two forms of operand expressions we support: // // n = <rangelist> // n % m = <rangelist> // Atom<Plura...
java
private static void renderExpr(boolean first, CodeBlock.Builder code, Node<PluralType> expr) { Iterator<Node<PluralType>> iter = expr.asStruct().nodes().iterator(); // Parse out the two forms of operand expressions we support: // // n = <rangelist> // n % m = <rangelist> // Atom<Plura...
[ "private", "static", "void", "renderExpr", "(", "boolean", "first", ",", "CodeBlock", ".", "Builder", "code", ",", "Node", "<", "PluralType", ">", "expr", ")", "{", "Iterator", "<", "Node", "<", "PluralType", ">>", "iter", "=", "expr", ".", "asStruct", "...
Render the header of a branch method.
[ "Render", "the", "header", "of", "a", "branch", "method", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java#L236-L281
106,698
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java
PluralCodeGenerator.renderExpr
private static void renderExpr( CodeBlock.Builder code, List<Node<PluralType>> rangeList, boolean equal, boolean decimalsZero) { int size = rangeList.size(); String r = ""; // Join the range list expressions with the OR operator. for (int i = 0; i < size; i++) { if (i > 0) { r ...
java
private static void renderExpr( CodeBlock.Builder code, List<Node<PluralType>> rangeList, boolean equal, boolean decimalsZero) { int size = rangeList.size(); String r = ""; // Join the range list expressions with the OR operator. for (int i = 0; i < size; i++) { if (i > 0) { r ...
[ "private", "static", "void", "renderExpr", "(", "CodeBlock", ".", "Builder", "code", ",", "List", "<", "Node", "<", "PluralType", ">", ">", "rangeList", ",", "boolean", "equal", ",", "boolean", "decimalsZero", ")", "{", "int", "size", "=", "rangeList", "."...
Render the expression body of a branch method.
[ "Render", "the", "expression", "body", "of", "a", "branch", "method", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java#L286-L318
106,699
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java
PluralCodeGenerator.renderRange
private static String renderRange(String name, Node<PluralType> node) { if (node.type() == PluralType.RANGE) { Struct<PluralType> range = node.asStruct(); int start = (Integer) range.nodes().get(0).asAtom().value(); int end = (Integer) range.nodes().get(1).asAtom().value(); return String.f...
java
private static String renderRange(String name, Node<PluralType> node) { if (node.type() == PluralType.RANGE) { Struct<PluralType> range = node.asStruct(); int start = (Integer) range.nodes().get(0).asAtom().value(); int end = (Integer) range.nodes().get(1).asAtom().value(); return String.f...
[ "private", "static", "String", "renderRange", "(", "String", "name", ",", "Node", "<", "PluralType", ">", "node", ")", "{", "if", "(", "node", ".", "type", "(", ")", "==", "PluralType", ".", "RANGE", ")", "{", "Struct", "<", "PluralType", ">", "range",...
Render a the range segment of an expression.
[ "Render", "a", "the", "range", "segment", "of", "an", "expression", "." ]
54b752d4ec2457df56e98461618f9c0eec41e1e1
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/PluralCodeGenerator.java#L323-L331