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
154,900
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMLambda.java
JMLambda.runByBoolean
public static void runByBoolean(boolean bool, Runnable trueBlock, Runnable falseBlock) { if (bool) trueBlock.run(); else falseBlock.run(); }
java
public static void runByBoolean(boolean bool, Runnable trueBlock, Runnable falseBlock) { if (bool) trueBlock.run(); else falseBlock.run(); }
[ "public", "static", "void", "runByBoolean", "(", "boolean", "bool", ",", "Runnable", "trueBlock", ",", "Runnable", "falseBlock", ")", "{", "if", "(", "bool", ")", "trueBlock", ".", "run", "(", ")", ";", "else", "falseBlock", ".", "run", "(", ")", ";", "}" ]
Run by boolean. @param bool the bool @param trueBlock the true block @param falseBlock the false block
[ "Run", "by", "boolean", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMLambda.java#L398-L404
154,901
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMLambda.java
JMLambda.consumeAndGetSelf
public static <T> T consumeAndGetSelf(T target, Consumer<T> targetConsumer) { targetConsumer.accept(target); return target; }
java
public static <T> T consumeAndGetSelf(T target, Consumer<T> targetConsumer) { targetConsumer.accept(target); return target; }
[ "public", "static", "<", "T", ">", "T", "consumeAndGetSelf", "(", "T", "target", ",", "Consumer", "<", "T", ">", "targetConsumer", ")", "{", "targetConsumer", ".", "accept", "(", "target", ")", ";", "return", "target", ";", "}" ]
Consume and get self t. @param <T> the type parameter @param target the target @param targetConsumer the target consumer @return the t
[ "Consume", "and", "get", "self", "t", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMLambda.java#L435-L439
154,902
james-hu/jabb-core
src/main/java/net/sf/jabb/util/web/WebApplicationConfiguration.java
WebApplicationConfiguration.cleanUpMenuTree
protected void cleanUpMenuTree(WebMenuItem root, String menuName){ List<WebMenuItem> subMenu = root.getSubMenu(); List<WebMenuItem> rootBreadcrumbs = root.getBreadcrumbs(); if (subMenu != null && subMenu.size() > 0){ Collections.sort(subMenu); for (int i = 0; i < subMenu.size(); i++){ WebMenuItem item = subMenu.get(i); if (item instanceof MenuItemExt){ MenuItemExt itemExt = (MenuItemExt)item; item = itemExt.toWebMenuItem(); subMenu.set(i, item); menuItemPaths.get(menuName).put(itemExt.path, item); } item.breadcrumbs = new ArrayList<WebMenuItem>(); if (rootBreadcrumbs != null){ item.breadcrumbs.addAll(rootBreadcrumbs); } item.breadcrumbs.add(item); cleanUpMenuTree(item, menuName); } } }
java
protected void cleanUpMenuTree(WebMenuItem root, String menuName){ List<WebMenuItem> subMenu = root.getSubMenu(); List<WebMenuItem> rootBreadcrumbs = root.getBreadcrumbs(); if (subMenu != null && subMenu.size() > 0){ Collections.sort(subMenu); for (int i = 0; i < subMenu.size(); i++){ WebMenuItem item = subMenu.get(i); if (item instanceof MenuItemExt){ MenuItemExt itemExt = (MenuItemExt)item; item = itemExt.toWebMenuItem(); subMenu.set(i, item); menuItemPaths.get(menuName).put(itemExt.path, item); } item.breadcrumbs = new ArrayList<WebMenuItem>(); if (rootBreadcrumbs != null){ item.breadcrumbs.addAll(rootBreadcrumbs); } item.breadcrumbs.add(item); cleanUpMenuTree(item, menuName); } } }
[ "protected", "void", "cleanUpMenuTree", "(", "WebMenuItem", "root", ",", "String", "menuName", ")", "{", "List", "<", "WebMenuItem", ">", "subMenu", "=", "root", ".", "getSubMenu", "(", ")", ";", "List", "<", "WebMenuItem", ">", "rootBreadcrumbs", "=", "root", ".", "getBreadcrumbs", "(", ")", ";", "if", "(", "subMenu", "!=", "null", "&&", "subMenu", ".", "size", "(", ")", ">", "0", ")", "{", "Collections", ".", "sort", "(", "subMenu", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "subMenu", ".", "size", "(", ")", ";", "i", "++", ")", "{", "WebMenuItem", "item", "=", "subMenu", ".", "get", "(", "i", ")", ";", "if", "(", "item", "instanceof", "MenuItemExt", ")", "{", "MenuItemExt", "itemExt", "=", "(", "MenuItemExt", ")", "item", ";", "item", "=", "itemExt", ".", "toWebMenuItem", "(", ")", ";", "subMenu", ".", "set", "(", "i", ",", "item", ")", ";", "menuItemPaths", ".", "get", "(", "menuName", ")", ".", "put", "(", "itemExt", ".", "path", ",", "item", ")", ";", "}", "item", ".", "breadcrumbs", "=", "new", "ArrayList", "<", "WebMenuItem", ">", "(", ")", ";", "if", "(", "rootBreadcrumbs", "!=", "null", ")", "{", "item", ".", "breadcrumbs", ".", "addAll", "(", "rootBreadcrumbs", ")", ";", "}", "item", ".", "breadcrumbs", ".", "add", "(", "item", ")", ";", "cleanUpMenuTree", "(", "item", ",", "menuName", ")", ";", "}", "}", "}" ]
Convert MenuItemExt to WebMenuItem, and clean up all data @param root
[ "Convert", "MenuItemExt", "to", "WebMenuItem", "and", "clean", "up", "all", "data" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/web/WebApplicationConfiguration.java#L165-L186
154,903
james-hu/jabb-core
src/main/java/net/sf/jabb/util/web/WebApplicationConfiguration.java
WebApplicationConfiguration.getMenuItem
public WebMenuItem getMenuItem(String menuName, String path){ try{ return menuItemPaths.get(menuName).get(path); }catch(Exception e){ log.error("Error when getting menu item for: menuName='" + menuName + "', path='" + path + "'", e); return null; } }
java
public WebMenuItem getMenuItem(String menuName, String path){ try{ return menuItemPaths.get(menuName).get(path); }catch(Exception e){ log.error("Error when getting menu item for: menuName='" + menuName + "', path='" + path + "'", e); return null; } }
[ "public", "WebMenuItem", "getMenuItem", "(", "String", "menuName", ",", "String", "path", ")", "{", "try", "{", "return", "menuItemPaths", ".", "get", "(", "menuName", ")", ".", "get", "(", "path", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Error when getting menu item for: menuName='\"", "+", "menuName", "+", "\"', path='\"", "+", "path", "+", "\"'\"", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Get the menu item by menu and path @param menuName @param path @return the menu item within the specified menu tree with the matching path/name
[ "Get", "the", "menu", "item", "by", "menu", "and", "path" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/web/WebApplicationConfiguration.java#L211-L218
154,904
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java
BitInputStream.read
public Bits read(final int bits) throws IOException { final int additionalBitsNeeded = bits - this.remainder.bitLength; final int additionalBytesNeeded = (int) Math.ceil(additionalBitsNeeded / 8.); if (additionalBytesNeeded > 0) this.readAhead(additionalBytesNeeded); final Bits readBits = this.remainder.range(0, bits); this.remainder = this.remainder.range(bits); return readBits; }
java
public Bits read(final int bits) throws IOException { final int additionalBitsNeeded = bits - this.remainder.bitLength; final int additionalBytesNeeded = (int) Math.ceil(additionalBitsNeeded / 8.); if (additionalBytesNeeded > 0) this.readAhead(additionalBytesNeeded); final Bits readBits = this.remainder.range(0, bits); this.remainder = this.remainder.range(bits); return readBits; }
[ "public", "Bits", "read", "(", "final", "int", "bits", ")", "throws", "IOException", "{", "final", "int", "additionalBitsNeeded", "=", "bits", "-", "this", ".", "remainder", ".", "bitLength", ";", "final", "int", "additionalBytesNeeded", "=", "(", "int", ")", "Math", ".", "ceil", "(", "additionalBitsNeeded", "/", "8.", ")", ";", "if", "(", "additionalBytesNeeded", ">", "0", ")", "this", ".", "readAhead", "(", "additionalBytesNeeded", ")", ";", "final", "Bits", "readBits", "=", "this", ".", "remainder", ".", "range", "(", "0", ",", "bits", ")", ";", "this", ".", "remainder", "=", "this", ".", "remainder", ".", "range", "(", "bits", ")", ";", "return", "readBits", ";", "}" ]
Read bits. @param bits the bits @return the bits @throws IOException the io exception
[ "Read", "bits", "." ]
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java#L110-L117
154,905
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java
BitInputStream.peek
public Bits peek(final int bits) throws IOException { final int additionalBitsNeeded = bits - this.remainder.bitLength; final int additionalBytesNeeded = (int) Math.ceil(additionalBitsNeeded / 8.); if (additionalBytesNeeded > 0) this.readAhead(additionalBytesNeeded); return this.remainder.range(0, Math.min(bits, this.remainder.bitLength)); }
java
public Bits peek(final int bits) throws IOException { final int additionalBitsNeeded = bits - this.remainder.bitLength; final int additionalBytesNeeded = (int) Math.ceil(additionalBitsNeeded / 8.); if (additionalBytesNeeded > 0) this.readAhead(additionalBytesNeeded); return this.remainder.range(0, Math.min(bits, this.remainder.bitLength)); }
[ "public", "Bits", "peek", "(", "final", "int", "bits", ")", "throws", "IOException", "{", "final", "int", "additionalBitsNeeded", "=", "bits", "-", "this", ".", "remainder", ".", "bitLength", ";", "final", "int", "additionalBytesNeeded", "=", "(", "int", ")", "Math", ".", "ceil", "(", "additionalBitsNeeded", "/", "8.", ")", ";", "if", "(", "additionalBytesNeeded", ">", "0", ")", "this", ".", "readAhead", "(", "additionalBytesNeeded", ")", ";", "return", "this", ".", "remainder", ".", "range", "(", "0", ",", "Math", ".", "min", "(", "bits", ",", "this", ".", "remainder", ".", "bitLength", ")", ")", ";", "}" ]
Peek bits. @param bits the bits @return the bits @throws IOException the io exception
[ "Peek", "bits", "." ]
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java#L126-L131
154,906
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java
BitInputStream.readAhead
public Bits readAhead(final int bytes) throws IOException { assert (0 < bytes); if (0 < bytes) { final byte[] buffer = new byte[bytes]; int bytesRead = this.inner.read(buffer); if (bytesRead > 0) { this.remainder = this.remainder.concatenate(new Bits(Arrays.copyOf(buffer, bytesRead))); } } return this.remainder; }
java
public Bits readAhead(final int bytes) throws IOException { assert (0 < bytes); if (0 < bytes) { final byte[] buffer = new byte[bytes]; int bytesRead = this.inner.read(buffer); if (bytesRead > 0) { this.remainder = this.remainder.concatenate(new Bits(Arrays.copyOf(buffer, bytesRead))); } } return this.remainder; }
[ "public", "Bits", "readAhead", "(", "final", "int", "bytes", ")", "throws", "IOException", "{", "assert", "(", "0", "<", "bytes", ")", ";", "if", "(", "0", "<", "bytes", ")", "{", "final", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "bytes", "]", ";", "int", "bytesRead", "=", "this", ".", "inner", ".", "read", "(", "buffer", ")", ";", "if", "(", "bytesRead", ">", "0", ")", "{", "this", ".", "remainder", "=", "this", ".", "remainder", ".", "concatenate", "(", "new", "Bits", "(", "Arrays", ".", "copyOf", "(", "buffer", ",", "bytesRead", ")", ")", ")", ";", "}", "}", "return", "this", ".", "remainder", ";", "}" ]
Read ahead bits. @param bytes the bytes @return the bits @throws IOException the io exception
[ "Read", "ahead", "bits", "." ]
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java#L150-L160
154,907
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java
BitInputStream.readVarLong
public long readVarLong() throws IOException { final int type = (int) this.read(2).toLong(); return this.read(BitOutputStream.varLongDepths[type]).toLong(); }
java
public long readVarLong() throws IOException { final int type = (int) this.read(2).toLong(); return this.read(BitOutputStream.varLongDepths[type]).toLong(); }
[ "public", "long", "readVarLong", "(", ")", "throws", "IOException", "{", "final", "int", "type", "=", "(", "int", ")", "this", ".", "read", "(", "2", ")", ".", "toLong", "(", ")", ";", "return", "this", ".", "read", "(", "BitOutputStream", ".", "varLongDepths", "[", "type", "]", ")", ".", "toLong", "(", ")", ";", "}" ]
Read var long long. @return the long @throws IOException the io exception
[ "Read", "var", "long", "long", "." ]
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java#L190-L193
154,908
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java
BitInputStream.peekLongCoord
public long peekLongCoord(long max) throws IOException { if (1 >= max) return 0; int bits = 1 + (int) Math.ceil(Math.log(max) / Math.log(2)); Bits peek = this.peek(bits); double divisor = 1 << peek.bitLength; long value = (int) (peek.toLong() * ((double) max) / divisor); assert (0 <= value); assert (max >= value); return value; }
java
public long peekLongCoord(long max) throws IOException { if (1 >= max) return 0; int bits = 1 + (int) Math.ceil(Math.log(max) / Math.log(2)); Bits peek = this.peek(bits); double divisor = 1 << peek.bitLength; long value = (int) (peek.toLong() * ((double) max) / divisor); assert (0 <= value); assert (max >= value); return value; }
[ "public", "long", "peekLongCoord", "(", "long", "max", ")", "throws", "IOException", "{", "if", "(", "1", ">=", "max", ")", "return", "0", ";", "int", "bits", "=", "1", "+", "(", "int", ")", "Math", ".", "ceil", "(", "Math", ".", "log", "(", "max", ")", "/", "Math", ".", "log", "(", "2", ")", ")", ";", "Bits", "peek", "=", "this", ".", "peek", "(", "bits", ")", ";", "double", "divisor", "=", "1", "<<", "peek", ".", "bitLength", ";", "long", "value", "=", "(", "int", ")", "(", "peek", ".", "toLong", "(", ")", "*", "(", "(", "double", ")", "max", ")", "/", "divisor", ")", ";", "assert", "(", "0", "<=", "value", ")", ";", "assert", "(", "max", ">=", "value", ")", ";", "return", "value", ";", "}" ]
Peek long coord long. @param max the max @return the long @throws IOException the io exception
[ "Peek", "long", "coord", "long", "." ]
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java#L202-L211
154,909
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java
BitInputStream.readVarShort
public short readVarShort(int optimal) throws IOException { int[] varShortDepths = {optimal, 16}; final int type = (int) this.read(1).toLong(); return (short) this.read(varShortDepths[type]).toLong(); }
java
public short readVarShort(int optimal) throws IOException { int[] varShortDepths = {optimal, 16}; final int type = (int) this.read(1).toLong(); return (short) this.read(varShortDepths[type]).toLong(); }
[ "public", "short", "readVarShort", "(", "int", "optimal", ")", "throws", "IOException", "{", "int", "[", "]", "varShortDepths", "=", "{", "optimal", ",", "16", "}", ";", "final", "int", "type", "=", "(", "int", ")", "this", ".", "read", "(", "1", ")", ".", "toLong", "(", ")", ";", "return", "(", "short", ")", "this", ".", "read", "(", "varShortDepths", "[", "type", "]", ")", ".", "toLong", "(", ")", ";", "}" ]
Read var short short. @param optimal the optimal @return the short @throws IOException the io exception
[ "Read", "var", "short", "short", "." ]
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/BitInputStream.java#L248-L252
154,910
PureSolTechnologies/genesis
commons.cassandra/src/main/java/com/puresoltechnologies/genesis/commons/cassandra/CassandraUtils.java
CassandraUtils.connectCluster
public static Cluster connectCluster(String host, int port) { Builder clusterBuilder = Cluster.builder(); // Socket Options SocketOptions socketOptions = new SocketOptions(); socketOptions.setConnectTimeoutMillis(60000); socketOptions.setKeepAlive(true); socketOptions.setReadTimeoutMillis(30000); return clusterBuilder.addContactPoint(host) .withSocketOptions(socketOptions).withPort(port).build(); }
java
public static Cluster connectCluster(String host, int port) { Builder clusterBuilder = Cluster.builder(); // Socket Options SocketOptions socketOptions = new SocketOptions(); socketOptions.setConnectTimeoutMillis(60000); socketOptions.setKeepAlive(true); socketOptions.setReadTimeoutMillis(30000); return clusterBuilder.addContactPoint(host) .withSocketOptions(socketOptions).withPort(port).build(); }
[ "public", "static", "Cluster", "connectCluster", "(", "String", "host", ",", "int", "port", ")", "{", "Builder", "clusterBuilder", "=", "Cluster", ".", "builder", "(", ")", ";", "// Socket Options", "SocketOptions", "socketOptions", "=", "new", "SocketOptions", "(", ")", ";", "socketOptions", ".", "setConnectTimeoutMillis", "(", "60000", ")", ";", "socketOptions", ".", "setKeepAlive", "(", "true", ")", ";", "socketOptions", ".", "setReadTimeoutMillis", "(", "30000", ")", ";", "return", "clusterBuilder", ".", "addContactPoint", "(", "host", ")", ".", "withSocketOptions", "(", "socketOptions", ")", ".", "withPort", "(", "port", ")", ".", "build", "(", ")", ";", "}" ]
Connects to the specified host and port. @param host is the host name to connect to. @param port if the port to connect to. @return A {@link Cluster} object is returned.
[ "Connects", "to", "the", "specified", "host", "and", "port", "." ]
1031027c5edcfeaad670896802058f78a2f7b159
https://github.com/PureSolTechnologies/genesis/blob/1031027c5edcfeaad670896802058f78a2f7b159/commons.cassandra/src/main/java/com/puresoltechnologies/genesis/commons/cassandra/CassandraUtils.java#L50-L59
154,911
grails/grails-gdoc-engine
src/main/java/org/radeox/filter/FilterPipe.java
FilterPipe.addFilter
public void addFilter(Filter filter) { filter.setInitialContext(initialContext); int minIndex = Integer.MAX_VALUE; String[] before = filter.before(); for (int i = 0; i < before.length; i++) { String s = before[i]; int index = index(activeFilters, s); if (index < minIndex) { minIndex = index; } } if (minIndex == Integer.MAX_VALUE) { // -1 is more usable for not-found than MAX_VALUE minIndex = -1; } if (contains(filter.before(), FIRST_IN_PIPE)) { activeFilters.add(0, filter); } else if (minIndex != -1) { activeFilters.add(minIndex, filter); } else { activeFilters.add(filter); } }
java
public void addFilter(Filter filter) { filter.setInitialContext(initialContext); int minIndex = Integer.MAX_VALUE; String[] before = filter.before(); for (int i = 0; i < before.length; i++) { String s = before[i]; int index = index(activeFilters, s); if (index < minIndex) { minIndex = index; } } if (minIndex == Integer.MAX_VALUE) { // -1 is more usable for not-found than MAX_VALUE minIndex = -1; } if (contains(filter.before(), FIRST_IN_PIPE)) { activeFilters.add(0, filter); } else if (minIndex != -1) { activeFilters.add(minIndex, filter); } else { activeFilters.add(filter); } }
[ "public", "void", "addFilter", "(", "Filter", "filter", ")", "{", "filter", ".", "setInitialContext", "(", "initialContext", ")", ";", "int", "minIndex", "=", "Integer", ".", "MAX_VALUE", ";", "String", "[", "]", "before", "=", "filter", ".", "before", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "before", ".", "length", ";", "i", "++", ")", "{", "String", "s", "=", "before", "[", "i", "]", ";", "int", "index", "=", "index", "(", "activeFilters", ",", "s", ")", ";", "if", "(", "index", "<", "minIndex", ")", "{", "minIndex", "=", "index", ";", "}", "}", "if", "(", "minIndex", "==", "Integer", ".", "MAX_VALUE", ")", "{", "// -1 is more usable for not-found than MAX_VALUE", "minIndex", "=", "-", "1", ";", "}", "if", "(", "contains", "(", "filter", ".", "before", "(", ")", ",", "FIRST_IN_PIPE", ")", ")", "{", "activeFilters", ".", "add", "(", "0", ",", "filter", ")", ";", "}", "else", "if", "(", "minIndex", "!=", "-", "1", ")", "{", "activeFilters", ".", "add", "(", "minIndex", ",", "filter", ")", ";", "}", "else", "{", "activeFilters", ".", "add", "(", "filter", ")", ";", "}", "}" ]
Add a filter to the active pipe @param filter Filter to add
[ "Add", "a", "filter", "to", "the", "active", "pipe" ]
e52aa09eaa61510dc48b27603bd9ea116cd6531a
https://github.com/grails/grails-gdoc-engine/blob/e52aa09eaa61510dc48b27603bd9ea116cd6531a/src/main/java/org/radeox/filter/FilterPipe.java#L121-L145
154,912
grails/grails-gdoc-engine
src/main/java/org/radeox/filter/FilterPipe.java
FilterPipe.filter
public String filter(String input, FilterContext context) { //Logger.debug("FilterPipe.filter: context = "+context); String output = input; Iterator filterIterator = activeFilters.iterator(); RenderContext renderContext = context.getRenderContext(); // Apply every filter in activeFilters to input string while (filterIterator.hasNext()) { Filter f = (Filter) filterIterator.next(); if (! inactiveFilters.contains(f)) { try { // assume all filters non cacheable if (f instanceof CacheFilter) { renderContext.setCacheable(true); } else { renderContext.setCacheable(false); } String tmp = f.filter(output, context); if (output.equals(tmp)) { renderContext.setCacheable(true); } if (null == tmp) { log.warn("FilterPipe.filter: error while filtering: " + f); } else { output = tmp; } renderContext.commitCache(); } catch (Exception e) { log.warn("Filtering exception: " + f, e); } } } return output; }
java
public String filter(String input, FilterContext context) { //Logger.debug("FilterPipe.filter: context = "+context); String output = input; Iterator filterIterator = activeFilters.iterator(); RenderContext renderContext = context.getRenderContext(); // Apply every filter in activeFilters to input string while (filterIterator.hasNext()) { Filter f = (Filter) filterIterator.next(); if (! inactiveFilters.contains(f)) { try { // assume all filters non cacheable if (f instanceof CacheFilter) { renderContext.setCacheable(true); } else { renderContext.setCacheable(false); } String tmp = f.filter(output, context); if (output.equals(tmp)) { renderContext.setCacheable(true); } if (null == tmp) { log.warn("FilterPipe.filter: error while filtering: " + f); } else { output = tmp; } renderContext.commitCache(); } catch (Exception e) { log.warn("Filtering exception: " + f, e); } } } return output; }
[ "public", "String", "filter", "(", "String", "input", ",", "FilterContext", "context", ")", "{", "//Logger.debug(\"FilterPipe.filter: context = \"+context);", "String", "output", "=", "input", ";", "Iterator", "filterIterator", "=", "activeFilters", ".", "iterator", "(", ")", ";", "RenderContext", "renderContext", "=", "context", ".", "getRenderContext", "(", ")", ";", "// Apply every filter in activeFilters to input string", "while", "(", "filterIterator", ".", "hasNext", "(", ")", ")", "{", "Filter", "f", "=", "(", "Filter", ")", "filterIterator", ".", "next", "(", ")", ";", "if", "(", "!", "inactiveFilters", ".", "contains", "(", "f", ")", ")", "{", "try", "{", "// assume all filters non cacheable", "if", "(", "f", "instanceof", "CacheFilter", ")", "{", "renderContext", ".", "setCacheable", "(", "true", ")", ";", "}", "else", "{", "renderContext", ".", "setCacheable", "(", "false", ")", ";", "}", "String", "tmp", "=", "f", ".", "filter", "(", "output", ",", "context", ")", ";", "if", "(", "output", ".", "equals", "(", "tmp", ")", ")", "{", "renderContext", ".", "setCacheable", "(", "true", ")", ";", "}", "if", "(", "null", "==", "tmp", ")", "{", "log", ".", "warn", "(", "\"FilterPipe.filter: error while filtering: \"", "+", "f", ")", ";", "}", "else", "{", "output", "=", "tmp", ";", "}", "renderContext", ".", "commitCache", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "warn", "(", "\"Filtering exception: \"", "+", "f", ",", "e", ")", ";", "}", "}", "}", "return", "output", ";", "}" ]
Filter some input and generate ouput. FilterPipe pipes the string input through every filter in the pipe and returns the resulting string. @param input Input string which should be transformed @param context FilterContext with information about the enviroment @return result Filtered output
[ "Filter", "some", "input", "and", "generate", "ouput", ".", "FilterPipe", "pipes", "the", "string", "input", "through", "every", "filter", "in", "the", "pipe", "and", "returns", "the", "resulting", "string", "." ]
e52aa09eaa61510dc48b27603bd9ea116cd6531a
https://github.com/grails/grails-gdoc-engine/blob/e52aa09eaa61510dc48b27603bd9ea116cd6531a/src/main/java/org/radeox/filter/FilterPipe.java#L173-L206
154,913
konvergeio/cofoja
src/main/java/com/google/java/contract/core/apt/AbstractTypeBuilder.java
AbstractTypeBuilder.visitAnnotation
@Requires({ "parent != null", "annotation != null", "owner != null", "p != null" }) protected void visitAnnotation( Element parent, AnnotationMirror annotation, boolean primary, ClassName owner, ElementModel p) { if (utils.isContractAnnotation(annotation)) { ContractAnnotationModel model = createContractModel(parent, annotation, primary, owner); if (model != null) { p.addEnclosedElement(model); } } }
java
@Requires({ "parent != null", "annotation != null", "owner != null", "p != null" }) protected void visitAnnotation( Element parent, AnnotationMirror annotation, boolean primary, ClassName owner, ElementModel p) { if (utils.isContractAnnotation(annotation)) { ContractAnnotationModel model = createContractModel(parent, annotation, primary, owner); if (model != null) { p.addEnclosedElement(model); } } }
[ "@", "Requires", "(", "{", "\"parent != null\"", ",", "\"annotation != null\"", ",", "\"owner != null\"", ",", "\"p != null\"", "}", ")", "protected", "void", "visitAnnotation", "(", "Element", "parent", ",", "AnnotationMirror", "annotation", ",", "boolean", "primary", ",", "ClassName", "owner", ",", "ElementModel", "p", ")", "{", "if", "(", "utils", ".", "isContractAnnotation", "(", "annotation", ")", ")", "{", "ContractAnnotationModel", "model", "=", "createContractModel", "(", "parent", ",", "annotation", ",", "primary", ",", "owner", ")", ";", "if", "(", "model", "!=", "null", ")", "{", "p", ".", "addEnclosedElement", "(", "model", ")", ";", "}", "}", "}" ]
Visits an annotation and adds a corresponding node to the specified Element. Despite the name, this method is not inherited through any visitor interface. It is not intended for external calls. @param parent the target of the annotation @param annotation the annotation @param primary whether this is a primary contract annotation @param owner the owner of this annotation @param p the element to add the created annotation to @see ContractAnnotationModel
[ "Visits", "an", "annotation", "and", "adds", "a", "corresponding", "node", "to", "the", "specified", "Element", "." ]
6ded58fa05eb5bf85f16353c8dd4c70bee59121a
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/apt/AbstractTypeBuilder.java#L205-L221
154,914
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/s3/S3ClientRequest.java
S3ClientRequest.initAuthenticationHeader
protected void initAuthenticationHeader() { if (isAuthenticated()) { // Calculate the v2 signature // http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html // #ConstructingTheAuthenticationHeader // Date should look like Thu, 17 Nov 2005 18:49:58 GMT, and must be // within 15 min. of S3 server time. contentMd5 and type are optional // We can't risk letting our date get clobbered and being inconsistent final String xamzdate = new SimpleDateFormat(DATE_FORMAT, Locale.US).format(new Date()); final StringJoiner signedHeaders = new StringJoiner(EOL, "", EOL); final StringBuilder toSign = new StringBuilder(); final String key = myKey.charAt(0) == '?' ? "" : myKey; headers().add("X-Amz-Date", xamzdate); signedHeaders.add("x-amz-date:" + xamzdate); if (!StringUtils.isEmpty(mySessionToken)) { headers().add("X-Amz-Security-Token", mySessionToken); signedHeaders.add("x-amz-security-token:" + mySessionToken); } toSign.append(myMethod).append(EOL).append(myContentMd5).append(EOL).append(myContentType).append(EOL) .append(EOL).append(signedHeaders).append(PATH_SEP).append(myBucket).append(PATH_SEP).append(key); try { final String signature = b64SignHmacSha1(mySecretKey, toSign.toString()); final String authorization = "AWS" + " " + myAccessKey + ":" + signature; headers().add("Authorization", authorization); } catch (InvalidKeyException | NoSuchAlgorithmException details) { LOGGER.error("Failed to sign S3 request due to {}", details); } } }
java
protected void initAuthenticationHeader() { if (isAuthenticated()) { // Calculate the v2 signature // http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html // #ConstructingTheAuthenticationHeader // Date should look like Thu, 17 Nov 2005 18:49:58 GMT, and must be // within 15 min. of S3 server time. contentMd5 and type are optional // We can't risk letting our date get clobbered and being inconsistent final String xamzdate = new SimpleDateFormat(DATE_FORMAT, Locale.US).format(new Date()); final StringJoiner signedHeaders = new StringJoiner(EOL, "", EOL); final StringBuilder toSign = new StringBuilder(); final String key = myKey.charAt(0) == '?' ? "" : myKey; headers().add("X-Amz-Date", xamzdate); signedHeaders.add("x-amz-date:" + xamzdate); if (!StringUtils.isEmpty(mySessionToken)) { headers().add("X-Amz-Security-Token", mySessionToken); signedHeaders.add("x-amz-security-token:" + mySessionToken); } toSign.append(myMethod).append(EOL).append(myContentMd5).append(EOL).append(myContentType).append(EOL) .append(EOL).append(signedHeaders).append(PATH_SEP).append(myBucket).append(PATH_SEP).append(key); try { final String signature = b64SignHmacSha1(mySecretKey, toSign.toString()); final String authorization = "AWS" + " " + myAccessKey + ":" + signature; headers().add("Authorization", authorization); } catch (InvalidKeyException | NoSuchAlgorithmException details) { LOGGER.error("Failed to sign S3 request due to {}", details); } } }
[ "protected", "void", "initAuthenticationHeader", "(", ")", "{", "if", "(", "isAuthenticated", "(", ")", ")", "{", "// Calculate the v2 signature", "// http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html", "// #ConstructingTheAuthenticationHeader", "// Date should look like Thu, 17 Nov 2005 18:49:58 GMT, and must be", "// within 15 min. of S3 server time. contentMd5 and type are optional", "// We can't risk letting our date get clobbered and being inconsistent", "final", "String", "xamzdate", "=", "new", "SimpleDateFormat", "(", "DATE_FORMAT", ",", "Locale", ".", "US", ")", ".", "format", "(", "new", "Date", "(", ")", ")", ";", "final", "StringJoiner", "signedHeaders", "=", "new", "StringJoiner", "(", "EOL", ",", "\"\"", ",", "EOL", ")", ";", "final", "StringBuilder", "toSign", "=", "new", "StringBuilder", "(", ")", ";", "final", "String", "key", "=", "myKey", ".", "charAt", "(", "0", ")", "==", "'", "'", "?", "\"\"", ":", "myKey", ";", "headers", "(", ")", ".", "add", "(", "\"X-Amz-Date\"", ",", "xamzdate", ")", ";", "signedHeaders", ".", "add", "(", "\"x-amz-date:\"", "+", "xamzdate", ")", ";", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "mySessionToken", ")", ")", "{", "headers", "(", ")", ".", "add", "(", "\"X-Amz-Security-Token\"", ",", "mySessionToken", ")", ";", "signedHeaders", ".", "add", "(", "\"x-amz-security-token:\"", "+", "mySessionToken", ")", ";", "}", "toSign", ".", "append", "(", "myMethod", ")", ".", "append", "(", "EOL", ")", ".", "append", "(", "myContentMd5", ")", ".", "append", "(", "EOL", ")", ".", "append", "(", "myContentType", ")", ".", "append", "(", "EOL", ")", ".", "append", "(", "EOL", ")", ".", "append", "(", "signedHeaders", ")", ".", "append", "(", "PATH_SEP", ")", ".", "append", "(", "myBucket", ")", ".", "append", "(", "PATH_SEP", ")", ".", "append", "(", "key", ")", ";", "try", "{", "final", "String", "signature", "=", "b64SignHmacSha1", "(", "mySecretKey", ",", "toSign", ".", "toString", "(", ")", ")", ";", "final", "String", "authorization", "=", "\"AWS\"", "+", "\" \"", "+", "myAccessKey", "+", "\":\"", "+", "signature", ";", "headers", "(", ")", ".", "add", "(", "\"Authorization\"", ",", "authorization", ")", ";", "}", "catch", "(", "InvalidKeyException", "|", "NoSuchAlgorithmException", "details", ")", "{", "LOGGER", ".", "error", "(", "\"Failed to sign S3 request due to {}\"", ",", "details", ")", ";", "}", "}", "}" ]
Adds the authentication header.
[ "Adds", "the", "authentication", "header", "." ]
b2ea1e32057e5df262e9265540d346a732b718df
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/s3/S3ClientRequest.java#L316-L351
154,915
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/s3/S3ClientRequest.java
S3ClientRequest.b64SignHmacSha1
private static String b64SignHmacSha1(final String aAwsSecretKey, final String aCanonicalString) throws NoSuchAlgorithmException, InvalidKeyException { final SecretKeySpec signingKey = new SecretKeySpec(aAwsSecretKey.getBytes(), HASH_CODE); final Mac mac = Mac.getInstance(HASH_CODE); mac.init(signingKey); return new String(Base64.getEncoder().encode(mac.doFinal(aCanonicalString.getBytes()))); }
java
private static String b64SignHmacSha1(final String aAwsSecretKey, final String aCanonicalString) throws NoSuchAlgorithmException, InvalidKeyException { final SecretKeySpec signingKey = new SecretKeySpec(aAwsSecretKey.getBytes(), HASH_CODE); final Mac mac = Mac.getInstance(HASH_CODE); mac.init(signingKey); return new String(Base64.getEncoder().encode(mac.doFinal(aCanonicalString.getBytes()))); }
[ "private", "static", "String", "b64SignHmacSha1", "(", "final", "String", "aAwsSecretKey", ",", "final", "String", "aCanonicalString", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyException", "{", "final", "SecretKeySpec", "signingKey", "=", "new", "SecretKeySpec", "(", "aAwsSecretKey", ".", "getBytes", "(", ")", ",", "HASH_CODE", ")", ";", "final", "Mac", "mac", "=", "Mac", ".", "getInstance", "(", "HASH_CODE", ")", ";", "mac", ".", "init", "(", "signingKey", ")", ";", "return", "new", "String", "(", "Base64", ".", "getEncoder", "(", ")", ".", "encode", "(", "mac", ".", "doFinal", "(", "aCanonicalString", ".", "getBytes", "(", ")", ")", ")", ")", ";", "}" ]
Returns a Base64 HmacSha1 signature. @param aAwsSecretKey An AWS secret key @param aCanonicalString A canonical string to encode @return A Base64 HmacSha1 signature @throws NoSuchAlgorithmException If the system doesn't support the encoding algorithm @throws InvalidKeyException If the supplied AWS secret key is invalid
[ "Returns", "a", "Base64", "HmacSha1", "signature", "." ]
b2ea1e32057e5df262e9265540d346a732b718df
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/s3/S3ClientRequest.java#L434-L442
154,916
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValue.java
AnyValue.setAsObject
public void setAsObject(Object value) { if (value instanceof AnyValue) _value = ((AnyValue) value)._value; else _value = value; }
java
public void setAsObject(Object value) { if (value instanceof AnyValue) _value = ((AnyValue) value)._value; else _value = value; }
[ "public", "void", "setAsObject", "(", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "AnyValue", ")", "_value", "=", "(", "(", "AnyValue", ")", "value", ")", ".", "_value", ";", "else", "_value", "=", "value", ";", "}" ]
Sets a new value for this object @param value the new object value.
[ "Sets", "a", "new", "value", "for", "this", "object" ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValue.java#L85-L90
154,917
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValue.java
AnyValue.getAsNullableType
@JsonIgnore public <T> T getAsNullableType(Class<T> type) { return TypeConverter.toNullableType(type, _value); }
java
@JsonIgnore public <T> T getAsNullableType(Class<T> type) { return TypeConverter.toNullableType(type, _value); }
[ "@", "JsonIgnore", "public", "<", "T", ">", "T", "getAsNullableType", "(", "Class", "<", "T", ">", "type", ")", "{", "return", "TypeConverter", ".", "toNullableType", "(", "type", ",", "_value", ")", ";", "}" ]
Converts object value into a value defined by specied typecode. If conversion is not possible it returns null. @param type the Class type that defined the type of the result @return value defined by the typecode or null if conversion is not supported. @see TypeConverter#toNullableType(Class, Object)
[ "Converts", "object", "value", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "null", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValue.java#L410-L413
154,918
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValue.java
AnyValue.getAsType
@JsonIgnore public <T> T getAsType(Class<T> type) { return getAsTypeWithDefault(type, null); }
java
@JsonIgnore public <T> T getAsType(Class<T> type) { return getAsTypeWithDefault(type, null); }
[ "@", "JsonIgnore", "public", "<", "T", ">", "T", "getAsType", "(", "Class", "<", "T", ">", "type", ")", "{", "return", "getAsTypeWithDefault", "(", "type", ",", "null", ")", ";", "}" ]
Converts object value into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. @param type the Class type that defined the type of the result @return value defined by the typecode or type default value if conversion is not supported. @see #getAsTypeWithDefault(Class, Object)
[ "Converts", "object", "value", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "default", "value", "for", "the", "specified", "type", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValue.java#L425-L428
154,919
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValue.java
AnyValue.getAsTypeWithDefault
@JsonIgnore public <T> T getAsTypeWithDefault(Class<T> type, T defaultValue) { return TypeConverter.toTypeWithDefault(type, _value, defaultValue); }
java
@JsonIgnore public <T> T getAsTypeWithDefault(Class<T> type, T defaultValue) { return TypeConverter.toTypeWithDefault(type, _value, defaultValue); }
[ "@", "JsonIgnore", "public", "<", "T", ">", "T", "getAsTypeWithDefault", "(", "Class", "<", "T", ">", "type", ",", "T", "defaultValue", ")", "{", "return", "TypeConverter", ".", "toTypeWithDefault", "(", "type", ",", "_value", ",", "defaultValue", ")", ";", "}" ]
Converts object value into a value defined by specied typecode. If conversion is not possible it returns default value. @param type the Class type that defined the type of the result @param defaultValue the default value @return value defined by the typecode or type default value if conversion is not supported. @see TypeConverter#toTypeWithDefault(Class, Object, Object)
[ "Converts", "object", "value", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "default", "value", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValue.java#L441-L444
154,920
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValue.java
AnyValue.equalsAs
public <T> boolean equalsAs(Class<T> type, Object obj) { if (obj == null && _value == null) return true; if (obj == null || _value == null) return false; if (obj instanceof AnyValue) obj = ((AnyValue) obj)._value; T typedThisValue = TypeConverter.toType(type, _value); T typedValue = TypeConverter.toType(type, obj); if (typedThisValue == null && typedValue == null) return true; if (typedThisValue == null || typedValue == null) return false; return typedThisValue.equals(typedValue); }
java
public <T> boolean equalsAs(Class<T> type, Object obj) { if (obj == null && _value == null) return true; if (obj == null || _value == null) return false; if (obj instanceof AnyValue) obj = ((AnyValue) obj)._value; T typedThisValue = TypeConverter.toType(type, _value); T typedValue = TypeConverter.toType(type, obj); if (typedThisValue == null && typedValue == null) return true; if (typedThisValue == null || typedValue == null) return false; return typedThisValue.equals(typedValue); }
[ "public", "<", "T", ">", "boolean", "equalsAs", "(", "Class", "<", "T", ">", "type", ",", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", "&&", "_value", "==", "null", ")", "return", "true", ";", "if", "(", "obj", "==", "null", "||", "_value", "==", "null", ")", "return", "false", ";", "if", "(", "obj", "instanceof", "AnyValue", ")", "obj", "=", "(", "(", "AnyValue", ")", "obj", ")", ".", "_value", ";", "T", "typedThisValue", "=", "TypeConverter", ".", "toType", "(", "type", ",", "_value", ")", ";", "T", "typedValue", "=", "TypeConverter", ".", "toType", "(", "type", ",", "obj", ")", ";", "if", "(", "typedThisValue", "==", "null", "&&", "typedValue", "==", "null", ")", "return", "true", ";", "if", "(", "typedThisValue", "==", "null", "||", "typedValue", "==", "null", ")", "return", "false", ";", "return", "typedThisValue", ".", "equals", "(", "typedValue", ")", ";", "}" ]
Compares this object value to specified specified value. When direct comparison gives negative results it converts values to type specified by type code and compare them again. @param type the Class type that defined the type of the result @param obj the value to be compared with. @return true when objects are equal and false otherwise. @see TypeConverter#toType(Class, Object)
[ "Compares", "this", "object", "value", "to", "specified", "specified", "value", ".", "When", "direct", "comparison", "gives", "negative", "results", "it", "converts", "values", "to", "type", "specified", "by", "type", "code", "and", "compare", "them", "again", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValue.java#L507-L524
154,921
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/ServiceDirectory.java
ServiceDirectory.setUser
public static void setUser(String userName, String password){ getImpl().getDirectoryServiceClient().setUser(userName, password); }
java
public static void setUser(String userName, String password){ getImpl().getDirectoryServiceClient().setUser(userName, password); }
[ "public", "static", "void", "setUser", "(", "String", "userName", ",", "String", "password", ")", "{", "getImpl", "(", ")", ".", "getDirectoryServiceClient", "(", ")", ".", "setUser", "(", "userName", ",", "password", ")", ";", "}" ]
Set the Directory User. @param userName the user name. @param password the password of the user. @throws ServiceException
[ "Set", "the", "Directory", "User", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/ServiceDirectory.java#L124-L126
154,922
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/codes/Gaussian.java
Gaussian.fromBinomial
public static Gaussian fromBinomial(final double probability, final long totalPopulation) { if (0. >= totalPopulation) { throw new IllegalArgumentException(); } if (0. >= probability) { throw new IllegalArgumentException(); } if (1. <= probability) { throw new IllegalArgumentException(); } if (Double.isNaN(probability)) { throw new IllegalArgumentException(); } if (Double.isInfinite(probability)) { throw new IllegalArgumentException(); } return new Gaussian( probability * totalPopulation, Math.sqrt(totalPopulation * probability * (1 - probability))); }
java
public static Gaussian fromBinomial(final double probability, final long totalPopulation) { if (0. >= totalPopulation) { throw new IllegalArgumentException(); } if (0. >= probability) { throw new IllegalArgumentException(); } if (1. <= probability) { throw new IllegalArgumentException(); } if (Double.isNaN(probability)) { throw new IllegalArgumentException(); } if (Double.isInfinite(probability)) { throw new IllegalArgumentException(); } return new Gaussian( probability * totalPopulation, Math.sqrt(totalPopulation * probability * (1 - probability))); }
[ "public", "static", "Gaussian", "fromBinomial", "(", "final", "double", "probability", ",", "final", "long", "totalPopulation", ")", "{", "if", "(", "0.", ">=", "totalPopulation", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "0.", ">=", "probability", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "1.", "<=", "probability", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "Double", ".", "isNaN", "(", "probability", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "Double", ".", "isInfinite", "(", "probability", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "new", "Gaussian", "(", "probability", "*", "totalPopulation", ",", "Math", ".", "sqrt", "(", "totalPopulation", "*", "probability", "*", "(", "1", "-", "probability", ")", ")", ")", ";", "}" ]
From binomial gaussian. @param probability the probability @param totalPopulation the total population @return the gaussian
[ "From", "binomial", "gaussian", "." ]
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/codes/Gaussian.java#L79-L99
154,923
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/codes/Gaussian.java
Gaussian.decode
public long decode(final BitInputStream in, final long max) throws IOException { if (0 == max) { return 0; } int bits = (int) (Math.round(log2(2 * this.stdDev)) - 1); if (0 > bits) { bits = 0; } final long centralWindow = 1l << bits; if (centralWindow >= (max + 1) / 2.) { return in.readBoundedLong(max + 1); } long stdDevWindowStart = (long) (this.mean - centralWindow / 2); long stdDevWindowEnd = stdDevWindowStart + centralWindow; if (stdDevWindowStart < 0) { stdDevWindowEnd += -stdDevWindowStart; stdDevWindowStart += -stdDevWindowStart; } else { final long delta = stdDevWindowEnd - (max + 1); if (delta > 0) { stdDevWindowStart -= delta; stdDevWindowEnd -= delta; } } if (in.readBool()) { return in.readBoundedLong(centralWindow) + stdDevWindowStart; } else { boolean side; if (stdDevWindowStart <= 0) { side = true; } else if (stdDevWindowEnd > max) { side = false; } else { side = in.readBool(); } if (side) { return stdDevWindowEnd + in.readBoundedLong(1 + max - stdDevWindowEnd); } else { return in.readBoundedLong(stdDevWindowStart); } } }
java
public long decode(final BitInputStream in, final long max) throws IOException { if (0 == max) { return 0; } int bits = (int) (Math.round(log2(2 * this.stdDev)) - 1); if (0 > bits) { bits = 0; } final long centralWindow = 1l << bits; if (centralWindow >= (max + 1) / 2.) { return in.readBoundedLong(max + 1); } long stdDevWindowStart = (long) (this.mean - centralWindow / 2); long stdDevWindowEnd = stdDevWindowStart + centralWindow; if (stdDevWindowStart < 0) { stdDevWindowEnd += -stdDevWindowStart; stdDevWindowStart += -stdDevWindowStart; } else { final long delta = stdDevWindowEnd - (max + 1); if (delta > 0) { stdDevWindowStart -= delta; stdDevWindowEnd -= delta; } } if (in.readBool()) { return in.readBoundedLong(centralWindow) + stdDevWindowStart; } else { boolean side; if (stdDevWindowStart <= 0) { side = true; } else if (stdDevWindowEnd > max) { side = false; } else { side = in.readBool(); } if (side) { return stdDevWindowEnd + in.readBoundedLong(1 + max - stdDevWindowEnd); } else { return in.readBoundedLong(stdDevWindowStart); } } }
[ "public", "long", "decode", "(", "final", "BitInputStream", "in", ",", "final", "long", "max", ")", "throws", "IOException", "{", "if", "(", "0", "==", "max", ")", "{", "return", "0", ";", "}", "int", "bits", "=", "(", "int", ")", "(", "Math", ".", "round", "(", "log2", "(", "2", "*", "this", ".", "stdDev", ")", ")", "-", "1", ")", ";", "if", "(", "0", ">", "bits", ")", "{", "bits", "=", "0", ";", "}", "final", "long", "centralWindow", "=", "1l", "<<", "bits", ";", "if", "(", "centralWindow", ">=", "(", "max", "+", "1", ")", "/", "2.", ")", "{", "return", "in", ".", "readBoundedLong", "(", "max", "+", "1", ")", ";", "}", "long", "stdDevWindowStart", "=", "(", "long", ")", "(", "this", ".", "mean", "-", "centralWindow", "/", "2", ")", ";", "long", "stdDevWindowEnd", "=", "stdDevWindowStart", "+", "centralWindow", ";", "if", "(", "stdDevWindowStart", "<", "0", ")", "{", "stdDevWindowEnd", "+=", "-", "stdDevWindowStart", ";", "stdDevWindowStart", "+=", "-", "stdDevWindowStart", ";", "}", "else", "{", "final", "long", "delta", "=", "stdDevWindowEnd", "-", "(", "max", "+", "1", ")", ";", "if", "(", "delta", ">", "0", ")", "{", "stdDevWindowStart", "-=", "delta", ";", "stdDevWindowEnd", "-=", "delta", ";", "}", "}", "if", "(", "in", ".", "readBool", "(", ")", ")", "{", "return", "in", ".", "readBoundedLong", "(", "centralWindow", ")", "+", "stdDevWindowStart", ";", "}", "else", "{", "boolean", "side", ";", "if", "(", "stdDevWindowStart", "<=", "0", ")", "{", "side", "=", "true", ";", "}", "else", "if", "(", "stdDevWindowEnd", ">", "max", ")", "{", "side", "=", "false", ";", "}", "else", "{", "side", "=", "in", ".", "readBool", "(", ")", ";", "}", "if", "(", "side", ")", "{", "return", "stdDevWindowEnd", "+", "in", ".", "readBoundedLong", "(", "1", "+", "max", "-", "stdDevWindowEnd", ")", ";", "}", "else", "{", "return", "in", ".", "readBoundedLong", "(", "stdDevWindowStart", ")", ";", "}", "}", "}" ]
Decode long. @param in the in @param max the max @return the long @throws IOException the io exception
[ "Decode", "long", "." ]
b5a5e73449aae57de7dbfca2ed7a074432c5b17e
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/codes/Gaussian.java#L119-L166
154,924
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/run/Notifier.java
Notifier.notifyOne
public static void notifyOne(String correlationId, Object component, Parameters args) throws ApplicationException { if (component instanceof INotifiable) ((INotifiable) component).notify(correlationId, args); }
java
public static void notifyOne(String correlationId, Object component, Parameters args) throws ApplicationException { if (component instanceof INotifiable) ((INotifiable) component).notify(correlationId, args); }
[ "public", "static", "void", "notifyOne", "(", "String", "correlationId", ",", "Object", "component", ",", "Parameters", "args", ")", "throws", "ApplicationException", "{", "if", "(", "component", "instanceof", "INotifiable", ")", "(", "(", "INotifiable", ")", "component", ")", ".", "notify", "(", "correlationId", ",", "args", ")", ";", "}" ]
Notifies specific component. To be notiied components must implement INotifiable interface. If they don't the call to this method has no effect. @param correlationId (optional) transaction id to trace execution through call chain. @param component the component that is to be notified. @param args notifiation arguments. @throws ApplicationException when errors occured. @see INotifiable
[ "Notifies", "specific", "component", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/run/Notifier.java#L25-L29
154,925
morimekta/utils
io-util/src/main/java/net/morimekta/util/concurrent/ProcessExecutor.java
ProcessExecutor.handleOutput
protected void handleOutput(InputStream stdout) throws IOException { byte[] buffer = new byte[4 * 1024]; int b; while ((b = stdout.read(buffer)) > 0) { out.write(buffer, 0, b); } }
java
protected void handleOutput(InputStream stdout) throws IOException { byte[] buffer = new byte[4 * 1024]; int b; while ((b = stdout.read(buffer)) > 0) { out.write(buffer, 0, b); } }
[ "protected", "void", "handleOutput", "(", "InputStream", "stdout", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "4", "*", "1024", "]", ";", "int", "b", ";", "while", "(", "(", "b", "=", "stdout", ".", "read", "(", "buffer", ")", ")", ">", "0", ")", "{", "out", ".", "write", "(", "buffer", ",", "0", ",", "b", ")", ";", "}", "}" ]
Handles the process' standard output stream. @param stdout The output stream reader. @throws IOException If reading stdout failed.
[ "Handles", "the", "process", "standard", "output", "stream", "." ]
dc987485902f1a7d58169c89c61db97425a6226d
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/concurrent/ProcessExecutor.java#L176-L182
154,926
morimekta/utils
io-util/src/main/java/net/morimekta/util/concurrent/ProcessExecutor.java
ProcessExecutor.handleError
protected void handleError(InputStream stderr) throws IOException { byte[] buffer = new byte[4 * 1024]; int b; while ((b = stderr.read(buffer)) > 0) { err.write(buffer, 0, b); } }
java
protected void handleError(InputStream stderr) throws IOException { byte[] buffer = new byte[4 * 1024]; int b; while ((b = stderr.read(buffer)) > 0) { err.write(buffer, 0, b); } }
[ "protected", "void", "handleError", "(", "InputStream", "stderr", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "4", "*", "1024", "]", ";", "int", "b", ";", "while", "(", "(", "b", "=", "stderr", ".", "read", "(", "buffer", ")", ")", ">", "0", ")", "{", "err", ".", "write", "(", "buffer", ",", "0", ",", "b", ")", ";", "}", "}" ]
Handles the process' standard error stream. @param stderr The error stream reader. @throws IOException If reading stderr failed.
[ "Handles", "the", "process", "standard", "error", "stream", "." ]
dc987485902f1a7d58169c89c61db97425a6226d
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/concurrent/ProcessExecutor.java#L190-L196
154,927
morimekta/utils
io-util/src/main/java/net/morimekta/util/concurrent/ProcessExecutor.java
ProcessExecutor.handleProcessTimeout
protected void handleProcessTimeout(String[] cmd) throws IOException { StringBuilder bld = new StringBuilder(); boolean first = true; for (String c : cmd) { if (first) { first = false; } else { bld.append(" "); } String esc = Strings.escape(c); // Quote where escaping is needed, OR the argument // contains a literal space. if (!c.equals(esc) || c.contains(" ")) { bld.append('\"') .append(esc) .append('\"'); } else { bld.append(c); } } throw new IOException("Process took too long: " + bld.toString()); }
java
protected void handleProcessTimeout(String[] cmd) throws IOException { StringBuilder bld = new StringBuilder(); boolean first = true; for (String c : cmd) { if (first) { first = false; } else { bld.append(" "); } String esc = Strings.escape(c); // Quote where escaping is needed, OR the argument // contains a literal space. if (!c.equals(esc) || c.contains(" ")) { bld.append('\"') .append(esc) .append('\"'); } else { bld.append(c); } } throw new IOException("Process took too long: " + bld.toString()); }
[ "protected", "void", "handleProcessTimeout", "(", "String", "[", "]", "cmd", ")", "throws", "IOException", "{", "StringBuilder", "bld", "=", "new", "StringBuilder", "(", ")", ";", "boolean", "first", "=", "true", ";", "for", "(", "String", "c", ":", "cmd", ")", "{", "if", "(", "first", ")", "{", "first", "=", "false", ";", "}", "else", "{", "bld", ".", "append", "(", "\" \"", ")", ";", "}", "String", "esc", "=", "Strings", ".", "escape", "(", "c", ")", ";", "// Quote where escaping is needed, OR the argument", "// contains a literal space.", "if", "(", "!", "c", ".", "equals", "(", "esc", ")", "||", "c", ".", "contains", "(", "\" \"", ")", ")", "{", "bld", ".", "append", "(", "'", "'", ")", ".", "append", "(", "esc", ")", ".", "append", "(", "'", "'", ")", ";", "}", "else", "{", "bld", ".", "append", "(", "c", ")", ";", "}", "}", "throw", "new", "IOException", "(", "\"Process took too long: \"", "+", "bld", ".", "toString", "(", ")", ")", ";", "}" ]
Handle timeout on the process finishing. @param cmd The command that was run. @throws IOException If not handled otherwise.
[ "Handle", "timeout", "on", "the", "process", "finishing", "." ]
dc987485902f1a7d58169c89c61db97425a6226d
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/concurrent/ProcessExecutor.java#L204-L228
154,928
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.getPercentileValue
public static Number getPercentileValue(int targetPercentile, List<Number> unorderedNumberList) { return getPercentileValueWithSorted(targetPercentile, sortedDoubleList(unorderedNumberList)); }
java
public static Number getPercentileValue(int targetPercentile, List<Number> unorderedNumberList) { return getPercentileValueWithSorted(targetPercentile, sortedDoubleList(unorderedNumberList)); }
[ "public", "static", "Number", "getPercentileValue", "(", "int", "targetPercentile", ",", "List", "<", "Number", ">", "unorderedNumberList", ")", "{", "return", "getPercentileValueWithSorted", "(", "targetPercentile", ",", "sortedDoubleList", "(", "unorderedNumberList", ")", ")", ";", "}" ]
Gets percentile value. @param targetPercentile the target percentile @param unorderedNumberList the unordered number list @return the percentile value
[ "Gets", "percentile", "value", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L98-L102
154,929
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.getPercentileValueMap
public static Map<Integer, Number> getPercentileValueMap( List<Integer> targetPercentileList, List<Number> numberList) { List<Double> sortedDoubleList = sortedDoubleList(numberList); return targetPercentileList.stream() .collect(toMap(percentile -> percentile, percentile -> getPercentileValueWithSorted(percentile, sortedDoubleList))); }
java
public static Map<Integer, Number> getPercentileValueMap( List<Integer> targetPercentileList, List<Number> numberList) { List<Double> sortedDoubleList = sortedDoubleList(numberList); return targetPercentileList.stream() .collect(toMap(percentile -> percentile, percentile -> getPercentileValueWithSorted(percentile, sortedDoubleList))); }
[ "public", "static", "Map", "<", "Integer", ",", "Number", ">", "getPercentileValueMap", "(", "List", "<", "Integer", ">", "targetPercentileList", ",", "List", "<", "Number", ">", "numberList", ")", "{", "List", "<", "Double", ">", "sortedDoubleList", "=", "sortedDoubleList", "(", "numberList", ")", ";", "return", "targetPercentileList", ".", "stream", "(", ")", ".", "collect", "(", "toMap", "(", "percentile", "->", "percentile", ",", "percentile", "->", "getPercentileValueWithSorted", "(", "percentile", ",", "sortedDoubleList", ")", ")", ")", ";", "}" ]
Gets percentile value map. @param targetPercentileList the target percentile list @param numberList the number list @return the percentile value map
[ "Gets", "percentile", "value", "map", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L117-L124
154,930
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.min
public static <N extends Number> Number min(List<N> numberList) { return cal(numberList, DoubleStream::min); }
java
public static <N extends Number> Number min(List<N> numberList) { return cal(numberList, DoubleStream::min); }
[ "public", "static", "<", "N", "extends", "Number", ">", "Number", "min", "(", "List", "<", "N", ">", "numberList", ")", "{", "return", "cal", "(", "numberList", ",", "DoubleStream", "::", "min", ")", ";", "}" ]
Min number. @param <N> the type parameter @param numberList the number list @return the number
[ "Min", "number", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L149-L151
154,931
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.cal
public static <N extends Number> double cal(List<N> numberList, Function<DoubleStream, OptionalDouble> calFunction) { return JMCollections.isNullOrEmpty(numberList) ? 0 : calFunction .apply(numberList.stream().mapToDouble(Number::doubleValue)) .orElse(0); }
java
public static <N extends Number> double cal(List<N> numberList, Function<DoubleStream, OptionalDouble> calFunction) { return JMCollections.isNullOrEmpty(numberList) ? 0 : calFunction .apply(numberList.stream().mapToDouble(Number::doubleValue)) .orElse(0); }
[ "public", "static", "<", "N", "extends", "Number", ">", "double", "cal", "(", "List", "<", "N", ">", "numberList", ",", "Function", "<", "DoubleStream", ",", "OptionalDouble", ">", "calFunction", ")", "{", "return", "JMCollections", ".", "isNullOrEmpty", "(", "numberList", ")", "?", "0", ":", "calFunction", ".", "apply", "(", "numberList", ".", "stream", "(", ")", ".", "mapToDouble", "(", "Number", "::", "doubleValue", ")", ")", ".", "orElse", "(", "0", ")", ";", "}" ]
Cal double. @param <N> the type parameter @param numberList the number list @param calFunction the cal function @return the double
[ "Cal", "double", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L161-L166
154,932
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.max
public static <N extends Number> Number max(List<N> numberList) { return cal(numberList, DoubleStream::max); }
java
public static <N extends Number> Number max(List<N> numberList) { return cal(numberList, DoubleStream::max); }
[ "public", "static", "<", "N", "extends", "Number", ">", "Number", "max", "(", "List", "<", "N", ">", "numberList", ")", "{", "return", "cal", "(", "numberList", ",", "DoubleStream", "::", "max", ")", ";", "}" ]
Max number. @param <N> the type parameter @param numberList the number list @return the number
[ "Max", "number", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L175-L177
154,933
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.sum
public static <N extends Number> Number sum(List<N> numberList) { return cal(numberList, doubleStream -> OptionalDouble.of(doubleStream.sum())); }
java
public static <N extends Number> Number sum(List<N> numberList) { return cal(numberList, doubleStream -> OptionalDouble.of(doubleStream.sum())); }
[ "public", "static", "<", "N", "extends", "Number", ">", "Number", "sum", "(", "List", "<", "N", ">", "numberList", ")", "{", "return", "cal", "(", "numberList", ",", "doubleStream", "->", "OptionalDouble", ".", "of", "(", "doubleStream", ".", "sum", "(", ")", ")", ")", ";", "}" ]
Sum number. @param <N> the type parameter @param numberList the number list @return the number
[ "Sum", "number", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L196-L199
154,934
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.average
public static <N extends Number> Number average(List<N> numberList) { return cal(numberList, DoubleStream::average); }
java
public static <N extends Number> Number average(List<N> numberList) { return cal(numberList, DoubleStream::average); }
[ "public", "static", "<", "N", "extends", "Number", ">", "Number", "average", "(", "List", "<", "N", ">", "numberList", ")", "{", "return", "cal", "(", "numberList", ",", "DoubleStream", "::", "average", ")", ";", "}" ]
Average number. @param <N> the type parameter @param numberList the number list @return the number
[ "Average", "number", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L208-L210
154,935
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.calPercentPrecisely
public static double calPercentPrecisely(Number target, Number total) { double targetD = target.doubleValue(); double totalD = total.doubleValue(); return targetD == totalD ? 100d : targetD / totalD * 100; }
java
public static double calPercentPrecisely(Number target, Number total) { double targetD = target.doubleValue(); double totalD = total.doubleValue(); return targetD == totalD ? 100d : targetD / totalD * 100; }
[ "public", "static", "double", "calPercentPrecisely", "(", "Number", "target", ",", "Number", "total", ")", "{", "double", "targetD", "=", "target", ".", "doubleValue", "(", ")", ";", "double", "totalD", "=", "total", ".", "doubleValue", "(", ")", ";", "return", "targetD", "==", "totalD", "?", "100d", ":", "targetD", "/", "totalD", "*", "100", ";", "}" ]
Cal percent precisely double. @param target the target @param total the total @return the double
[ "Cal", "percent", "precisely", "double", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L230-L234
154,936
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.calPercent
public static String calPercent(Number target, Number total, int digit) { return JMString.roundedNumberFormat(calPercentPrecisely(target, total), digit); }
java
public static String calPercent(Number target, Number total, int digit) { return JMString.roundedNumberFormat(calPercentPrecisely(target, total), digit); }
[ "public", "static", "String", "calPercent", "(", "Number", "target", ",", "Number", "total", ",", "int", "digit", ")", "{", "return", "JMString", ".", "roundedNumberFormat", "(", "calPercentPrecisely", "(", "target", ",", "total", ")", ",", "digit", ")", ";", "}" ]
Cal percent string. @param target the target @param total the total @param digit the digit @return the string
[ "Cal", "percent", "string", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L244-L247
154,937
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.roundWithDecimalPlace
public static double roundWithDecimalPlace(double doubleNumber, int decimalPlace) { double pow = pow(10, decimalPlace); return Math.round(doubleNumber * pow) / pow; }
java
public static double roundWithDecimalPlace(double doubleNumber, int decimalPlace) { double pow = pow(10, decimalPlace); return Math.round(doubleNumber * pow) / pow; }
[ "public", "static", "double", "roundWithDecimalPlace", "(", "double", "doubleNumber", ",", "int", "decimalPlace", ")", "{", "double", "pow", "=", "pow", "(", "10", ",", "decimalPlace", ")", ";", "return", "Math", ".", "round", "(", "doubleNumber", "*", "pow", ")", "/", "pow", ";", "}" ]
Round with decimal place double. @param doubleNumber the double number @param decimalPlace the decimal place @return the double
[ "Round", "with", "decimal", "place", "double", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L256-L260
154,938
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.roundWithPlace
public static double roundWithPlace(double doubleNumber, int place) { double pow = pow(10, place); return Math.round(doubleNumber / pow) * pow; }
java
public static double roundWithPlace(double doubleNumber, int place) { double pow = pow(10, place); return Math.round(doubleNumber / pow) * pow; }
[ "public", "static", "double", "roundWithPlace", "(", "double", "doubleNumber", ",", "int", "place", ")", "{", "double", "pow", "=", "pow", "(", "10", ",", "place", ")", ";", "return", "Math", ".", "round", "(", "doubleNumber", "/", "pow", ")", "*", "pow", ";", "}" ]
Round with place double. @param doubleNumber the double number @param place the place @return the double
[ "Round", "with", "place", "double", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L269-L273
154,939
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.pow
public static double pow(Number baseNumber, int exponent) { return exponent < 1 ? 1 : exponent > 1 ? baseNumber.doubleValue() * pow(baseNumber, exponent - 1) : baseNumber.doubleValue(); }
java
public static double pow(Number baseNumber, int exponent) { return exponent < 1 ? 1 : exponent > 1 ? baseNumber.doubleValue() * pow(baseNumber, exponent - 1) : baseNumber.doubleValue(); }
[ "public", "static", "double", "pow", "(", "Number", "baseNumber", ",", "int", "exponent", ")", "{", "return", "exponent", "<", "1", "?", "1", ":", "exponent", ">", "1", "?", "baseNumber", ".", "doubleValue", "(", ")", "*", "pow", "(", "baseNumber", ",", "exponent", "-", "1", ")", ":", "baseNumber", ".", "doubleValue", "(", ")", ";", "}" ]
Pow double. @param baseNumber the base number @param exponent the exponent @return the double
[ "Pow", "double", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L282-L288
154,940
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.calSumOfSquares
public static double calSumOfSquares(List<? extends Number> numberList) { return calSumOfSquares( numberList.stream().mapToDouble(Number::doubleValue)); }
java
public static double calSumOfSquares(List<? extends Number> numberList) { return calSumOfSquares( numberList.stream().mapToDouble(Number::doubleValue)); }
[ "public", "static", "double", "calSumOfSquares", "(", "List", "<", "?", "extends", "Number", ">", "numberList", ")", "{", "return", "calSumOfSquares", "(", "numberList", ".", "stream", "(", ")", ".", "mapToDouble", "(", "Number", "::", "doubleValue", ")", ")", ";", "}" ]
Cal sum of squares double. @param numberList the number list @return the double
[ "Cal", "sum", "of", "squares", "double", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L366-L369
154,941
foundation-runtime/service-directory
1.1/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/ServiceInstanceUtils.java
ServiceInstanceUtils.validateMetadata
public static void validateMetadata(Map<String, String> metadata) throws ServiceException { for ( String key : metadata.keySet()){ if (!validateRequiredField(key, metaKeyRegEx)){ throw new ServiceException( ErrorCode.SERVICE_INSTANCE_METAKEY_FORMAT_ERROR, ErrorCode.SERVICE_INSTANCE_METAKEY_FORMAT_ERROR.getMessageTemplate(),key ); } } }
java
public static void validateMetadata(Map<String, String> metadata) throws ServiceException { for ( String key : metadata.keySet()){ if (!validateRequiredField(key, metaKeyRegEx)){ throw new ServiceException( ErrorCode.SERVICE_INSTANCE_METAKEY_FORMAT_ERROR, ErrorCode.SERVICE_INSTANCE_METAKEY_FORMAT_ERROR.getMessageTemplate(),key ); } } }
[ "public", "static", "void", "validateMetadata", "(", "Map", "<", "String", ",", "String", ">", "metadata", ")", "throws", "ServiceException", "{", "for", "(", "String", "key", ":", "metadata", ".", "keySet", "(", ")", ")", "{", "if", "(", "!", "validateRequiredField", "(", "key", ",", "metaKeyRegEx", ")", ")", "{", "throw", "new", "ServiceException", "(", "ErrorCode", ".", "SERVICE_INSTANCE_METAKEY_FORMAT_ERROR", ",", "ErrorCode", ".", "SERVICE_INSTANCE_METAKEY_FORMAT_ERROR", ".", "getMessageTemplate", "(", ")", ",", "key", ")", ";", "}", "}", "}" ]
Validate the ServiceInstance Metadata. @param metadata the service instance metadata map. @throws ServiceException
[ "Validate", "the", "ServiceInstance", "Metadata", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.1/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/ServiceInstanceUtils.java#L194-L204
154,942
foundation-runtime/service-directory
1.1/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/ServiceInstanceUtils.java
ServiceInstanceUtils.isValidBrace
private static boolean isValidBrace(String url) { if (null == url || url.trim().length() == 0) { return false; } boolean isInsideVariable = false; StringTokenizer tokenizer = new StringTokenizer(url, "{}", true); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (token.equals("{")) { // { is not allowed inside of a variable specification if (isInsideVariable) { return false; } isInsideVariable = true; } else if (token.equals("}")) { // } must be preceded by {; if (!isInsideVariable) { return false; } isInsideVariable = false; } } return true; }
java
private static boolean isValidBrace(String url) { if (null == url || url.trim().length() == 0) { return false; } boolean isInsideVariable = false; StringTokenizer tokenizer = new StringTokenizer(url, "{}", true); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (token.equals("{")) { // { is not allowed inside of a variable specification if (isInsideVariable) { return false; } isInsideVariable = true; } else if (token.equals("}")) { // } must be preceded by {; if (!isInsideVariable) { return false; } isInsideVariable = false; } } return true; }
[ "private", "static", "boolean", "isValidBrace", "(", "String", "url", ")", "{", "if", "(", "null", "==", "url", "||", "url", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "return", "false", ";", "}", "boolean", "isInsideVariable", "=", "false", ";", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "url", ",", "\"{}\"", ",", "true", ")", ";", "while", "(", "tokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "token", "=", "tokenizer", ".", "nextToken", "(", ")", ";", "if", "(", "token", ".", "equals", "(", "\"{\"", ")", ")", "{", "// { is not allowed inside of a variable specification", "if", "(", "isInsideVariable", ")", "{", "return", "false", ";", "}", "isInsideVariable", "=", "true", ";", "}", "else", "if", "(", "token", ".", "equals", "(", "\"}\"", ")", ")", "{", "// } must be preceded by {;", "if", "(", "!", "isInsideVariable", ")", "{", "return", "false", ";", "}", "isInsideVariable", "=", "false", ";", "}", "}", "return", "true", ";", "}" ]
Validate the url of the Instance. @param url the URL String. @return false if brace is invalid or URL is empty.
[ "Validate", "the", "url", "of", "the", "Instance", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.1/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/ServiceInstanceUtils.java#L256-L280
154,943
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.numberRangeClosed
public static IntStream numberRangeClosed(int startInclusive, int endInclusive, int interval) { return numberRange(startInclusive, endInclusive, interval, n -> n <= endInclusive); }
java
public static IntStream numberRangeClosed(int startInclusive, int endInclusive, int interval) { return numberRange(startInclusive, endInclusive, interval, n -> n <= endInclusive); }
[ "public", "static", "IntStream", "numberRangeClosed", "(", "int", "startInclusive", ",", "int", "endInclusive", ",", "int", "interval", ")", "{", "return", "numberRange", "(", "startInclusive", ",", "endInclusive", ",", "interval", ",", "n", "->", "n", "<=", "endInclusive", ")", ";", "}" ]
Number range closed int stream. @param startInclusive the start inclusive @param endInclusive the end inclusive @param interval the interval @return the int stream
[ "Number", "range", "closed", "int", "stream", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L37-L41
154,944
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.numberRangeWithCount
public static IntStream numberRangeWithCount(int start, int interval, int count) { return IntStream.iterate(start, n -> n + interval).limit(count); }
java
public static IntStream numberRangeWithCount(int start, int interval, int count) { return IntStream.iterate(start, n -> n + interval).limit(count); }
[ "public", "static", "IntStream", "numberRangeWithCount", "(", "int", "start", ",", "int", "interval", ",", "int", "count", ")", "{", "return", "IntStream", ".", "iterate", "(", "start", ",", "n", "->", "n", "+", "interval", ")", ".", "limit", "(", "count", ")", ";", "}" ]
Number range with count int stream. @param start the start @param interval the interval @param count the count @return the int stream
[ "Number", "range", "with", "count", "int", "stream", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L66-L69
154,945
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.buildIntStream
public static <N extends Number> IntStream buildIntStream(Collection<N> numberCollection) { return numberCollection.stream().mapToInt(Number::intValue); }
java
public static <N extends Number> IntStream buildIntStream(Collection<N> numberCollection) { return numberCollection.stream().mapToInt(Number::intValue); }
[ "public", "static", "<", "N", "extends", "Number", ">", "IntStream", "buildIntStream", "(", "Collection", "<", "N", ">", "numberCollection", ")", "{", "return", "numberCollection", ".", "stream", "(", ")", ".", "mapToInt", "(", "Number", "::", "intValue", ")", ";", "}" ]
Build int stream int stream. @param <N> the type parameter @param numberCollection the number collection @return the int stream
[ "Build", "int", "stream", "int", "stream", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L89-L92
154,946
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.buildLongStream
public static <N extends Number> LongStream buildLongStream(Collection<N> numberCollection) { return numberCollection.stream().mapToLong(Number::longValue); }
java
public static <N extends Number> LongStream buildLongStream(Collection<N> numberCollection) { return numberCollection.stream().mapToLong(Number::longValue); }
[ "public", "static", "<", "N", "extends", "Number", ">", "LongStream", "buildLongStream", "(", "Collection", "<", "N", ">", "numberCollection", ")", "{", "return", "numberCollection", ".", "stream", "(", ")", ".", "mapToLong", "(", "Number", "::", "longValue", ")", ";", "}" ]
Build long stream long stream. @param <N> the type parameter @param numberCollection the number collection @return the long stream
[ "Build", "long", "stream", "long", "stream", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L101-L104
154,947
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.buildDoubleStream
public static <N extends Number> DoubleStream buildDoubleStream(Collection<N> numberCollection) { return numberCollection.stream().mapToDouble(Number::doubleValue); }
java
public static <N extends Number> DoubleStream buildDoubleStream(Collection<N> numberCollection) { return numberCollection.stream().mapToDouble(Number::doubleValue); }
[ "public", "static", "<", "N", "extends", "Number", ">", "DoubleStream", "buildDoubleStream", "(", "Collection", "<", "N", ">", "numberCollection", ")", "{", "return", "numberCollection", ".", "stream", "(", ")", ".", "mapToDouble", "(", "Number", "::", "doubleValue", ")", ";", "}" ]
Build double stream double stream. @param <N> the type parameter @param numberCollection the number collection @return the double stream
[ "Build", "double", "stream", "double", "stream", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L113-L116
154,948
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.buildReversedStream
public static <T> Stream<T> buildReversedStream(Collection<T> collection) { return JMCollections.getReversed(collection).stream(); }
java
public static <T> Stream<T> buildReversedStream(Collection<T> collection) { return JMCollections.getReversed(collection).stream(); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "buildReversedStream", "(", "Collection", "<", "T", ">", "collection", ")", "{", "return", "JMCollections", ".", "getReversed", "(", "collection", ")", ".", "stream", "(", ")", ";", "}" ]
Build reversed stream stream. @param <T> the type parameter @param collection the collection @return the stream
[ "Build", "reversed", "stream", "stream", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L125-L127
154,949
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.buildTokenStream
public static Stream<String> buildTokenStream(String text, String delimiter) { return JMStream.buildStream(delimiter == null ? new StringTokenizer( text) : new StringTokenizer(text, delimiter)) .map(o -> (String) o); }
java
public static Stream<String> buildTokenStream(String text, String delimiter) { return JMStream.buildStream(delimiter == null ? new StringTokenizer( text) : new StringTokenizer(text, delimiter)) .map(o -> (String) o); }
[ "public", "static", "Stream", "<", "String", ">", "buildTokenStream", "(", "String", "text", ",", "String", "delimiter", ")", "{", "return", "JMStream", ".", "buildStream", "(", "delimiter", "==", "null", "?", "new", "StringTokenizer", "(", "text", ")", ":", "new", "StringTokenizer", "(", "text", ",", "delimiter", ")", ")", ".", "map", "(", "o", "->", "(", "String", ")", "o", ")", ";", "}" ]
Build token stream stream. @param text the text @param delimiter the delimiter @return the stream
[ "Build", "token", "stream", "stream", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L192-L197
154,950
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.buildConcatStream
public static <T> Stream<T> buildConcatStream(List<T> sample1, List<T> sample2) { return Stream.concat(sample1.stream(), sample2.stream()); }
java
public static <T> Stream<T> buildConcatStream(List<T> sample1, List<T> sample2) { return Stream.concat(sample1.stream(), sample2.stream()); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "buildConcatStream", "(", "List", "<", "T", ">", "sample1", ",", "List", "<", "T", ">", "sample2", ")", "{", "return", "Stream", ".", "concat", "(", "sample1", ".", "stream", "(", ")", ",", "sample2", ".", "stream", "(", ")", ")", ";", "}" ]
Build concat stream stream. @param <T> the type parameter @param sample1 the sample 1 @param sample2 the sample 2 @return the stream
[ "Build", "concat", "stream", "stream", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L230-L233
154,951
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.buildRandomNumberStream
public static DoubleStream buildRandomNumberStream(int count) { return IntStream.range(0, count).mapToDouble(i -> Math.random()); }
java
public static DoubleStream buildRandomNumberStream(int count) { return IntStream.range(0, count).mapToDouble(i -> Math.random()); }
[ "public", "static", "DoubleStream", "buildRandomNumberStream", "(", "int", "count", ")", "{", "return", "IntStream", ".", "range", "(", "0", ",", "count", ")", ".", "mapToDouble", "(", "i", "->", "Math", ".", "random", "(", ")", ")", ";", "}" ]
Build random number stream double stream. @param count the count @return the double stream
[ "Build", "random", "number", "stream", "double", "stream", "." ]
9e407b3f28a7990418a1e877229fa8344f4d78a5
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L241-L243
154,952
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.getAllByHql
public List< T> getAllByHql(String secondHalfOfHql, Object paramValue, Type paramType) { return getAllByHql(secondHalfOfHql, new Object[] {paramValue}, new Type[]{paramType}, null, null); }
java
public List< T> getAllByHql(String secondHalfOfHql, Object paramValue, Type paramType) { return getAllByHql(secondHalfOfHql, new Object[] {paramValue}, new Type[]{paramType}, null, null); }
[ "public", "List", "<", "T", ">", "getAllByHql", "(", "String", "secondHalfOfHql", ",", "Object", "paramValue", ",", "Type", "paramType", ")", "{", "return", "getAllByHql", "(", "secondHalfOfHql", ",", "new", "Object", "[", "]", "{", "paramValue", "}", ",", "new", "Type", "[", "]", "{", "paramType", "}", ",", "null", ",", "null", ")", ";", "}" ]
Get all by HQL with one pair of parameterType-value @param secondHalfOfHql @param paramValue @param paramType @return the query result
[ "Get", "all", "by", "HQL", "with", "one", "pair", "of", "parameterType", "-", "value" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L155-L157
154,953
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.getAllByHql
public List< T> getAllByHql(String secondHalfOfHql, Object paramValue1, Type paramType1, Object paramValue2, Type paramType2) { return getAllByHql(secondHalfOfHql, new Object[] {paramValue1, paramValue2}, new Type[]{paramType2, paramType2}, null, null); }
java
public List< T> getAllByHql(String secondHalfOfHql, Object paramValue1, Type paramType1, Object paramValue2, Type paramType2) { return getAllByHql(secondHalfOfHql, new Object[] {paramValue1, paramValue2}, new Type[]{paramType2, paramType2}, null, null); }
[ "public", "List", "<", "T", ">", "getAllByHql", "(", "String", "secondHalfOfHql", ",", "Object", "paramValue1", ",", "Type", "paramType1", ",", "Object", "paramValue2", ",", "Type", "paramType2", ")", "{", "return", "getAllByHql", "(", "secondHalfOfHql", ",", "new", "Object", "[", "]", "{", "paramValue1", ",", "paramValue2", "}", ",", "new", "Type", "[", "]", "{", "paramType2", ",", "paramType2", "}", ",", "null", ",", "null", ")", ";", "}" ]
Get all by HQL with two pairs of parameterType-value @param secondHalfOfHql @param paramValue1 @param paramType1 @param paramValue2 @param paramType2 @return the query result
[ "Get", "all", "by", "HQL", "with", "two", "pairs", "of", "parameterType", "-", "value" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L168-L170
154,954
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.getAllBySql
public List< T> getAllBySql(String fullSql, Integer offset, Integer limit) { return getAllBySql(fullSql, null, null, offset, limit); }
java
public List< T> getAllBySql(String fullSql, Integer offset, Integer limit) { return getAllBySql(fullSql, null, null, offset, limit); }
[ "public", "List", "<", "T", ">", "getAllBySql", "(", "String", "fullSql", ",", "Integer", "offset", ",", "Integer", "limit", ")", "{", "return", "getAllBySql", "(", "fullSql", ",", "null", ",", "null", ",", "offset", ",", "limit", ")", ";", "}" ]
Get all by SQL with specific offset and limit @param fullSql @param offset the number of first record in the whole query result to be returned, records numbers start from 0 @param limit the maximum number of records to return @return the query result
[ "Get", "all", "by", "SQL", "with", "specific", "offset", "and", "limit" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L232-L234
154,955
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.getAllBySql
public List< T> getAllBySql(String fullSql, Object[] paramValues, Type[] paramTypes) { return getAllBySql(fullSql, paramValues, paramTypes, null, null); }
java
public List< T> getAllBySql(String fullSql, Object[] paramValues, Type[] paramTypes) { return getAllBySql(fullSql, paramValues, paramTypes, null, null); }
[ "public", "List", "<", "T", ">", "getAllBySql", "(", "String", "fullSql", ",", "Object", "[", "]", "paramValues", ",", "Type", "[", "]", "paramTypes", ")", "{", "return", "getAllBySql", "(", "fullSql", ",", "paramValues", ",", "paramTypes", ",", "null", ",", "null", ")", ";", "}" ]
Get all by SQL with pairs of parameterType-value @param fullSql @param paramValues @param paramTypes @return the query result
[ "Get", "all", "by", "SQL", "with", "pairs", "of", "parameterType", "-", "value" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L243-L245
154,956
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.getAllBySql
public List< T> getAllBySql(String fullSql, Object paramValue, Type paramType) { return getAllBySql(fullSql, new Object[]{paramValue}, new Type[]{paramType}, null, null); }
java
public List< T> getAllBySql(String fullSql, Object paramValue, Type paramType) { return getAllBySql(fullSql, new Object[]{paramValue}, new Type[]{paramType}, null, null); }
[ "public", "List", "<", "T", ">", "getAllBySql", "(", "String", "fullSql", ",", "Object", "paramValue", ",", "Type", "paramType", ")", "{", "return", "getAllBySql", "(", "fullSql", ",", "new", "Object", "[", "]", "{", "paramValue", "}", ",", "new", "Type", "[", "]", "{", "paramType", "}", ",", "null", ",", "null", ")", ";", "}" ]
Get all by SQL with one pair of parameterType-value @param fullSql @param paramValue @param paramType @return the query result
[ "Get", "all", "by", "SQL", "with", "one", "pair", "of", "parameterType", "-", "value" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L254-L256
154,957
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.getAllBySql
public List< T> getAllBySql(String fullSql, Object paramValue1, Type paramType1, Object paramValue2, Type paramType2, Object paramValue3, Type paramType3) { return getAllBySql(fullSql, new Object[]{paramValue1, paramValue2, paramValue3}, new Type[]{paramType1, paramType2, paramType3}, null, null); }
java
public List< T> getAllBySql(String fullSql, Object paramValue1, Type paramType1, Object paramValue2, Type paramType2, Object paramValue3, Type paramType3) { return getAllBySql(fullSql, new Object[]{paramValue1, paramValue2, paramValue3}, new Type[]{paramType1, paramType2, paramType3}, null, null); }
[ "public", "List", "<", "T", ">", "getAllBySql", "(", "String", "fullSql", ",", "Object", "paramValue1", ",", "Type", "paramType1", ",", "Object", "paramValue2", ",", "Type", "paramType2", ",", "Object", "paramValue3", ",", "Type", "paramType3", ")", "{", "return", "getAllBySql", "(", "fullSql", ",", "new", "Object", "[", "]", "{", "paramValue1", ",", "paramValue2", ",", "paramValue3", "}", ",", "new", "Type", "[", "]", "{", "paramType1", ",", "paramType2", ",", "paramType3", "}", ",", "null", ",", "null", ")", ";", "}" ]
Get all by SQL with three pairs of parameterType-value @param fullSql @param paramValue1 @param paramType1 @param paramValue2 @param paramType2 @param paramValue3 @param paramType3 @return the query result
[ "Get", "all", "by", "SQL", "with", "three", "pairs", "of", "parameterType", "-", "value" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L282-L284
154,958
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.setupQuery
private void setupQuery(Query query, Object[] paramValues, Type[] paramTypes, Integer offset, Integer limit){ if (paramValues != null && paramTypes != null){ query.setParameters(paramValues, paramTypes); } if (offset != null){ query.setFirstResult(offset); } if (limit != null){ query.setMaxResults(limit); } }
java
private void setupQuery(Query query, Object[] paramValues, Type[] paramTypes, Integer offset, Integer limit){ if (paramValues != null && paramTypes != null){ query.setParameters(paramValues, paramTypes); } if (offset != null){ query.setFirstResult(offset); } if (limit != null){ query.setMaxResults(limit); } }
[ "private", "void", "setupQuery", "(", "Query", "query", ",", "Object", "[", "]", "paramValues", ",", "Type", "[", "]", "paramTypes", ",", "Integer", "offset", ",", "Integer", "limit", ")", "{", "if", "(", "paramValues", "!=", "null", "&&", "paramTypes", "!=", "null", ")", "{", "query", ".", "setParameters", "(", "paramValues", ",", "paramTypes", ")", ";", "}", "if", "(", "offset", "!=", "null", ")", "{", "query", ".", "setFirstResult", "(", "offset", ")", ";", "}", "if", "(", "limit", "!=", "null", ")", "{", "query", ".", "setMaxResults", "(", "limit", ")", ";", "}", "}" ]
Setup a query with parameters and other configurations. @param query @param paramValues @param paramTypes @param offset @param limit
[ "Setup", "a", "query", "with", "parameters", "and", "other", "configurations", "." ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L377-L387
154,959
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.updateByHql
public int updateByHql(String secondHalfOfHql, Object[] paramValues, Type[] paramTypes){ StringBuilder queryStr = new StringBuilder(); queryStr.append("update ") .append(this.clazz.getName()) .append(" "); if (secondHalfOfHql != null){ queryStr.append(secondHalfOfHql); } Session session = this.getCurrentSession(); Query query = session.createQuery(queryStr.toString()); setupQuery(query, paramValues, paramTypes, null, null); return query.executeUpdate(); }
java
public int updateByHql(String secondHalfOfHql, Object[] paramValues, Type[] paramTypes){ StringBuilder queryStr = new StringBuilder(); queryStr.append("update ") .append(this.clazz.getName()) .append(" "); if (secondHalfOfHql != null){ queryStr.append(secondHalfOfHql); } Session session = this.getCurrentSession(); Query query = session.createQuery(queryStr.toString()); setupQuery(query, paramValues, paramTypes, null, null); return query.executeUpdate(); }
[ "public", "int", "updateByHql", "(", "String", "secondHalfOfHql", ",", "Object", "[", "]", "paramValues", ",", "Type", "[", "]", "paramTypes", ")", "{", "StringBuilder", "queryStr", "=", "new", "StringBuilder", "(", ")", ";", "queryStr", ".", "append", "(", "\"update \"", ")", ".", "append", "(", "this", ".", "clazz", ".", "getName", "(", ")", ")", ".", "append", "(", "\" \"", ")", ";", "if", "(", "secondHalfOfHql", "!=", "null", ")", "{", "queryStr", ".", "append", "(", "secondHalfOfHql", ")", ";", "}", "Session", "session", "=", "this", ".", "getCurrentSession", "(", ")", ";", "Query", "query", "=", "session", ".", "createQuery", "(", "queryStr", ".", "toString", "(", ")", ")", ";", "setupQuery", "(", "query", ",", "paramValues", ",", "paramTypes", ",", "null", ",", "null", ")", ";", "return", "query", ".", "executeUpdate", "(", ")", ";", "}" ]
Update by criteria specified as HQL @param secondHalfOfHql @param paramValues @param paramTypes @return the number of records updated
[ "Update", "by", "criteria", "specified", "as", "HQL" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L455-L468
154,960
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.firstInList
public static <E> E firstInList(List<E> list){ if (list == null || list.size() == 0){ return null; }else{ return list.get(0); } }
java
public static <E> E firstInList(List<E> list){ if (list == null || list.size() == 0){ return null; }else{ return list.get(0); } }
[ "public", "static", "<", "E", ">", "E", "firstInList", "(", "List", "<", "E", ">", "list", ")", "{", "if", "(", "list", "==", "null", "||", "list", ".", "size", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "else", "{", "return", "list", ".", "get", "(", "0", ")", ";", "}", "}" ]
Get the first element in the list @param list @return null if the list is null or is empty, otherwise the first element of the list
[ "Get", "the", "first", "element", "in", "the", "list" ]
bceed441595c5e5195a7418795f03b69fa7b61e4
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L486-L492
154,961
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsObject
public Object getAsObject() { Map<String, Object> result = new HashMap<String, Object>(); for (Map.Entry<String, Object> entry : this.entrySet()) result.put(entry.getKey(), entry.getValue()); return result; }
java
public Object getAsObject() { Map<String, Object> result = new HashMap<String, Object>(); for (Map.Entry<String, Object> entry : this.entrySet()) result.put(entry.getKey(), entry.getValue()); return result; }
[ "public", "Object", "getAsObject", "(", ")", "{", "Map", "<", "String", ",", "Object", ">", "result", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "this", ".", "entrySet", "(", ")", ")", "result", ".", "put", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "return", "result", ";", "}" ]
Gets the value stored in this map element without any conversions @return the value of the map element.
[ "Gets", "the", "value", "stored", "in", "this", "map", "element", "without", "any", "conversions" ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L83-L88
154,962
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.setAsObject
public void setAsObject(Object value) { clear(); Map<String, Object> values = MapConverter.toMap(value); append(values); }
java
public void setAsObject(Object value) { clear(); Map<String, Object> values = MapConverter.toMap(value); append(values); }
[ "public", "void", "setAsObject", "(", "Object", "value", ")", "{", "clear", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "values", "=", "MapConverter", ".", "toMap", "(", "value", ")", ";", "append", "(", "values", ")", ";", "}" ]
Sets a new value for this array element @param value the new object value.
[ "Sets", "a", "new", "value", "for", "this", "array", "element" ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L95-L99
154,963
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableString
public String getAsNullableString(String key) { Object value = getAsObject(key); return StringConverter.toNullableString(value); }
java
public String getAsNullableString(String key) { Object value = getAsObject(key); return StringConverter.toNullableString(value); }
[ "public", "String", "getAsNullableString", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "StringConverter", ".", "toNullableString", "(", "value", ")", ";", "}" ]
Converts map element into a string or returns null if conversion is not possible. @param key a key of element to get. @return string value of the element or null if conversion is not supported. @see StringConverter#toNullableString(Object)
[ "Converts", "map", "element", "into", "a", "string", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L133-L136
154,964
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsStringWithDefault
public String getAsStringWithDefault(String key, String defaultValue) { Object value = getAsObject(key); return StringConverter.toStringWithDefault(value, defaultValue); }
java
public String getAsStringWithDefault(String key, String defaultValue) { Object value = getAsObject(key); return StringConverter.toStringWithDefault(value, defaultValue); }
[ "public", "String", "getAsStringWithDefault", "(", "String", "key", ",", "String", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "StringConverter", ".", "toStringWithDefault", "(", "value", ",", "defaultValue", ")", ";", "}" ]
Converts map element into a string or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return string value of the element or default value if conversion is not supported. @see StringConverter#toStringWithDefault(Object, String)
[ "Converts", "map", "element", "into", "a", "string", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L162-L165
154,965
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableBoolean
public Boolean getAsNullableBoolean(String key) { Object value = getAsObject(key); return BooleanConverter.toNullableBoolean(value); }
java
public Boolean getAsNullableBoolean(String key) { Object value = getAsObject(key); return BooleanConverter.toNullableBoolean(value); }
[ "public", "Boolean", "getAsNullableBoolean", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "BooleanConverter", ".", "toNullableBoolean", "(", "value", ")", ";", "}" ]
Converts map element into a boolean or returns null if conversion is not possible. @param key a key of element to get. @return boolean value of the element or null if conversion is not supported. @see BooleanConverter#toNullableBoolean(Object)
[ "Converts", "map", "element", "into", "a", "boolean", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L176-L179
154,966
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsBooleanWithDefault
public boolean getAsBooleanWithDefault(String key, boolean defaultValue) { Object value = getAsObject(key); return BooleanConverter.toBooleanWithDefault(value, defaultValue); }
java
public boolean getAsBooleanWithDefault(String key, boolean defaultValue) { Object value = getAsObject(key); return BooleanConverter.toBooleanWithDefault(value, defaultValue); }
[ "public", "boolean", "getAsBooleanWithDefault", "(", "String", "key", ",", "boolean", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "BooleanConverter", ".", "toBooleanWithDefault", "(", "value", ",", "defaultValue", ")", ";", "}" ]
Converts map element into a boolean or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return boolean value of the element or default value if conversion is not supported. @see BooleanConverter#toBooleanWithDefault(Object, boolean)
[ "Converts", "map", "element", "into", "a", "boolean", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L205-L208
154,967
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableInteger
public Integer getAsNullableInteger(String key) { Object value = getAsObject(key); return IntegerConverter.toNullableInteger(value); }
java
public Integer getAsNullableInteger(String key) { Object value = getAsObject(key); return IntegerConverter.toNullableInteger(value); }
[ "public", "Integer", "getAsNullableInteger", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "IntegerConverter", ".", "toNullableInteger", "(", "value", ")", ";", "}" ]
Converts map element into an integer or returns null if conversion is not possible. @param key a key of element to get. @return integer value of the element or null if conversion is not supported. @see IntegerConverter#toNullableInteger(Object)
[ "Converts", "map", "element", "into", "an", "integer", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L219-L222
154,968
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsIntegerWithDefault
public int getAsIntegerWithDefault(String key, int defaultValue) { Object value = getAsObject(key); return IntegerConverter.toIntegerWithDefault(value, defaultValue); }
java
public int getAsIntegerWithDefault(String key, int defaultValue) { Object value = getAsObject(key); return IntegerConverter.toIntegerWithDefault(value, defaultValue); }
[ "public", "int", "getAsIntegerWithDefault", "(", "String", "key", ",", "int", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "IntegerConverter", ".", "toIntegerWithDefault", "(", "value", ",", "defaultValue", ")", ";", "}" ]
Converts map element into an integer or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return integer value of the element or default value if conversion is not supported. @see IntegerConverter#toIntegerWithDefault(Object, int)
[ "Converts", "map", "element", "into", "an", "integer", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L248-L251
154,969
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableLong
public Long getAsNullableLong(String key) { Object value = getAsObject(key); return LongConverter.toNullableLong(value); }
java
public Long getAsNullableLong(String key) { Object value = getAsObject(key); return LongConverter.toNullableLong(value); }
[ "public", "Long", "getAsNullableLong", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "LongConverter", ".", "toNullableLong", "(", "value", ")", ";", "}" ]
Converts map element into a long or returns null if conversion is not possible. @param key a key of element to get. @return long value of the element or null if conversion is not supported. @see LongConverter#toNullableLong(Object)
[ "Converts", "map", "element", "into", "a", "long", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L262-L265
154,970
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsLongWithDefault
public long getAsLongWithDefault(String key, long defaultValue) { Object value = getAsObject(key); return LongConverter.toLongWithDefault(value, defaultValue); }
java
public long getAsLongWithDefault(String key, long defaultValue) { Object value = getAsObject(key); return LongConverter.toLongWithDefault(value, defaultValue); }
[ "public", "long", "getAsLongWithDefault", "(", "String", "key", ",", "long", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "LongConverter", ".", "toLongWithDefault", "(", "value", ",", "defaultValue", ")", ";", "}" ]
Converts map element into a long or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return long value of the element or default value if conversion is not supported. @see LongConverter#toLongWithDefault(Object, long)
[ "Converts", "map", "element", "into", "a", "long", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L290-L293
154,971
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableFloat
public Float getAsNullableFloat(String key) { Object value = getAsObject(key); return FloatConverter.toNullableFloat(value); }
java
public Float getAsNullableFloat(String key) { Object value = getAsObject(key); return FloatConverter.toNullableFloat(value); }
[ "public", "Float", "getAsNullableFloat", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "FloatConverter", ".", "toNullableFloat", "(", "value", ")", ";", "}" ]
Converts map element into a float or returns null if conversion is not possible. @param key a key of element to get. @return float value of the element or null if conversion is not supported. @see FloatConverter#toNullableFloat(Object)
[ "Converts", "map", "element", "into", "a", "float", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L304-L307
154,972
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsFloatWithDefault
public float getAsFloatWithDefault(String key, float defaultValue) { Object value = getAsObject(key); return FloatConverter.toFloatWithDefault(value, defaultValue); }
java
public float getAsFloatWithDefault(String key, float defaultValue) { Object value = getAsObject(key); return FloatConverter.toFloatWithDefault(value, defaultValue); }
[ "public", "float", "getAsFloatWithDefault", "(", "String", "key", ",", "float", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "FloatConverter", ".", "toFloatWithDefault", "(", "value", ",", "defaultValue", ")", ";", "}" ]
Converts map element into a flot or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return flot value of the element or default value if conversion is not supported. @see FloatConverter#toFloatWithDefault(Object, float)
[ "Converts", "map", "element", "into", "a", "flot", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L332-L335
154,973
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableDouble
public Double getAsNullableDouble(String key) { Object value = getAsObject(key); return DoubleConverter.toNullableDouble(value); }
java
public Double getAsNullableDouble(String key) { Object value = getAsObject(key); return DoubleConverter.toNullableDouble(value); }
[ "public", "Double", "getAsNullableDouble", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "DoubleConverter", ".", "toNullableDouble", "(", "value", ")", ";", "}" ]
Converts map element into a double or returns null if conversion is not possible. @param key a key of element to get. @return double value of the element or null if conversion is not supported. @see DoubleConverter#toNullableDouble(Object)
[ "Converts", "map", "element", "into", "a", "double", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L346-L349
154,974
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsDoubleWithDefault
public double getAsDoubleWithDefault(String key, double defaultValue) { Object value = getAsObject(key); return DoubleConverter.toDoubleWithDefault(value, defaultValue); }
java
public double getAsDoubleWithDefault(String key, double defaultValue) { Object value = getAsObject(key); return DoubleConverter.toDoubleWithDefault(value, defaultValue); }
[ "public", "double", "getAsDoubleWithDefault", "(", "String", "key", ",", "double", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "DoubleConverter", ".", "toDoubleWithDefault", "(", "value", ",", "defaultValue", ")", ";", "}" ]
Converts map element into a double or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return double value of the element or default value if conversion is not supported. @see DoubleConverter#toDoubleWithDefault(Object, double)
[ "Converts", "map", "element", "into", "a", "double", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L375-L378
154,975
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableDateTime
public ZonedDateTime getAsNullableDateTime(String key) { Object value = getAsObject(key); return DateTimeConverter.toNullableDateTime(value); }
java
public ZonedDateTime getAsNullableDateTime(String key) { Object value = getAsObject(key); return DateTimeConverter.toNullableDateTime(value); }
[ "public", "ZonedDateTime", "getAsNullableDateTime", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "DateTimeConverter", ".", "toNullableDateTime", "(", "value", ")", ";", "}" ]
Converts map element into a Date or returns null if conversion is not possible. @param key a key of element to get. @return ZonedDateTime value of the element or null if conversion is not supported. @see DateTimeConverter#toNullableDateTime(Object)
[ "Converts", "map", "element", "into", "a", "Date", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L389-L392
154,976
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsDateTimeWithDefault
public ZonedDateTime getAsDateTimeWithDefault(String key, ZonedDateTime defaultValue) { Object value = getAsObject(key); return DateTimeConverter.toDateTimeWithDefault(value, defaultValue); }
java
public ZonedDateTime getAsDateTimeWithDefault(String key, ZonedDateTime defaultValue) { Object value = getAsObject(key); return DateTimeConverter.toDateTimeWithDefault(value, defaultValue); }
[ "public", "ZonedDateTime", "getAsDateTimeWithDefault", "(", "String", "key", ",", "ZonedDateTime", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "DateTimeConverter", ".", "toDateTimeWithDefault", "(", "value", ",", "defaultValue", ")", ";", "}" ]
Converts map element into a Date or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return ZonedDateTime value of the element or default value if conversion is not supported. @see DateTimeConverter#toDateTimeWithDefault(Object, ZonedDateTime)
[ "Converts", "map", "element", "into", "a", "Date", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L419-L422
154,977
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableType
public <T> T getAsNullableType(Class<T> type, String key) { Object value = getAsObject(key); return TypeConverter.toNullableType(type, value); }
java
public <T> T getAsNullableType(Class<T> type, String key) { Object value = getAsObject(key); return TypeConverter.toNullableType(type, value); }
[ "public", "<", "T", ">", "T", "getAsNullableType", "(", "Class", "<", "T", ">", "type", ",", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "TypeConverter", ".", "toNullableType", "(", "type", ",", "value", ")", ";", "}" ]
Converts map element into a value defined by specied typecode. If conversion is not possible it returns null. @param type the Class type that defined the type of the result @param key a key of element to get. @return element value defined by the typecode or null if conversion is not supported. @see TypeConverter#toNullableType(Class, Object)
[ "Converts", "map", "element", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "null", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L463-L466
154,978
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsType
public <T> T getAsType(Class<T> type, String key) { return getAsTypeWithDefault(type, key, null); }
java
public <T> T getAsType(Class<T> type, String key) { return getAsTypeWithDefault(type, key, null); }
[ "public", "<", "T", ">", "T", "getAsType", "(", "Class", "<", "T", ">", "type", ",", "String", "key", ")", "{", "return", "getAsTypeWithDefault", "(", "type", ",", "key", ",", "null", ")", ";", "}" ]
Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. @param type the Class type that defined the type of the result @param key a key of element to get. @return element value defined by the typecode or default if conversion is not supported. @see #getAsTypeWithDefault(Class, String, Object)
[ "Converts", "map", "element", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "default", "value", "for", "the", "specified", "type", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L479-L481
154,979
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsTypeWithDefault
public <T> T getAsTypeWithDefault(Class<T> type, String key, T defaultValue) { Object value = getAsObject(key); return TypeConverter.toTypeWithDefault(type, value, defaultValue); }
java
public <T> T getAsTypeWithDefault(Class<T> type, String key, T defaultValue) { Object value = getAsObject(key); return TypeConverter.toTypeWithDefault(type, value, defaultValue); }
[ "public", "<", "T", ">", "T", "getAsTypeWithDefault", "(", "Class", "<", "T", ">", "type", ",", "String", "key", ",", "T", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "TypeConverter", ".", "toTypeWithDefault", "(", "type", ",", "value", ",", "defaultValue", ")", ";", "}" ]
Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value. @param type the Class type that defined the type of the result @param key a key of element to get. @param defaultValue the default value @return element value defined by the typecode or default value if conversion is not supported. @see TypeConverter#toTypeWithDefault(Class, Object, Object)
[ "Converts", "map", "element", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "default", "value", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L495-L498
154,980
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsValue
public AnyValue getAsValue(String key) { Object value = getAsObject(key); return new AnyValue(value); }
java
public AnyValue getAsValue(String key) { Object value = getAsObject(key); return new AnyValue(value); }
[ "public", "AnyValue", "getAsValue", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "new", "AnyValue", "(", "value", ")", ";", "}" ]
Converts map element into an AnyValue or returns an empty AnyValue if conversion is not possible. @param key a key of element to get. @return AnyValue value of the element or empty AnyValue if conversion is not supported. @see AnyValue @see AnyValue#AnyValue(Object)
[ "Converts", "map", "element", "into", "an", "AnyValue", "or", "returns", "an", "empty", "AnyValue", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L511-L514
154,981
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableArray
public AnyValueArray getAsNullableArray(String key) { Object value = getAsObject(key); return value != null ? AnyValueArray.fromValue(value) : null; }
java
public AnyValueArray getAsNullableArray(String key) { Object value = getAsObject(key); return value != null ? AnyValueArray.fromValue(value) : null; }
[ "public", "AnyValueArray", "getAsNullableArray", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "value", "!=", "null", "?", "AnyValueArray", ".", "fromValue", "(", "value", ")", ":", "null", ";", "}" ]
Converts map element into an AnyValueArray or returns null if conversion is not possible. @param key a key of element to get. @return AnyValueArray value of the element or null if conversion is not supported. @see AnyValueArray @see AnyValueArray#fromValue(Object)
[ "Converts", "map", "element", "into", "an", "AnyValueArray", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L527-L530
154,982
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsArray
public AnyValueArray getAsArray(String key) { Object value = getAsObject(key); return AnyValueArray.fromValue(value); }
java
public AnyValueArray getAsArray(String key) { Object value = getAsObject(key); return AnyValueArray.fromValue(value); }
[ "public", "AnyValueArray", "getAsArray", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "AnyValueArray", ".", "fromValue", "(", "value", ")", ";", "}" ]
Converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible. @param key a key of element to get. @return AnyValueArray value of the element or empty AnyValueArray if conversion is not supported. @see AnyValueArray @see AnyValueArray#fromValue(Object)
[ "Converts", "map", "element", "into", "an", "AnyValueArray", "or", "returns", "empty", "AnyValueArray", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L543-L546
154,983
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsArrayWithDefault
public AnyValueArray getAsArrayWithDefault(String key, AnyValueArray defaultValue) { AnyValueArray result = getAsNullableArray(key); return result != null ? result : defaultValue; }
java
public AnyValueArray getAsArrayWithDefault(String key, AnyValueArray defaultValue) { AnyValueArray result = getAsNullableArray(key); return result != null ? result : defaultValue; }
[ "public", "AnyValueArray", "getAsArrayWithDefault", "(", "String", "key", ",", "AnyValueArray", "defaultValue", ")", "{", "AnyValueArray", "result", "=", "getAsNullableArray", "(", "key", ")", ";", "return", "result", "!=", "null", "?", "result", ":", "defaultValue", ";", "}" ]
Converts map element into an AnyValueArray or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return AnyValueArray value of the element or default value if conversion is not supported. @see AnyValueArray @see #getAsNullableArray(String)
[ "Converts", "map", "element", "into", "an", "AnyValueArray", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L560-L563
154,984
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableMap
public AnyValueMap getAsNullableMap(String key) { Object value = getAsObject(key); return value != null ? AnyValueMap.fromValue(value) : null; }
java
public AnyValueMap getAsNullableMap(String key) { Object value = getAsObject(key); return value != null ? AnyValueMap.fromValue(value) : null; }
[ "public", "AnyValueMap", "getAsNullableMap", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "value", "!=", "null", "?", "AnyValueMap", ".", "fromValue", "(", "value", ")", ":", "null", ";", "}" ]
Converts map element into an AnyValueMap or returns null if conversion is not possible. @param key a key of element to get. @return AnyValueMap value of the element or null if conversion is not supported. @see #fromValue(Object)
[ "Converts", "map", "element", "into", "an", "AnyValueMap", "or", "returns", "null", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L575-L578
154,985
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsMap
public AnyValueMap getAsMap(String key) { Object value = getAsObject(key); return AnyValueMap.fromValue(value); }
java
public AnyValueMap getAsMap(String key) { Object value = getAsObject(key); return AnyValueMap.fromValue(value); }
[ "public", "AnyValueMap", "getAsMap", "(", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "AnyValueMap", ".", "fromValue", "(", "value", ")", ";", "}" ]
Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. @param key a key of element to get. @return AnyValueMap value of the element or empty AnyValueMap if conversion is not supported. @see #fromValue(Object)
[ "Converts", "map", "element", "into", "an", "AnyValueMap", "or", "returns", "empty", "AnyValueMap", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L590-L593
154,986
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsMapWithDefault
public AnyValueMap getAsMapWithDefault(String key, AnyValueMap defaultValue) { AnyValueMap result = getAsNullableMap(key); return result != null ? result : defaultValue; }
java
public AnyValueMap getAsMapWithDefault(String key, AnyValueMap defaultValue) { AnyValueMap result = getAsNullableMap(key); return result != null ? result : defaultValue; }
[ "public", "AnyValueMap", "getAsMapWithDefault", "(", "String", "key", ",", "AnyValueMap", "defaultValue", ")", "{", "AnyValueMap", "result", "=", "getAsNullableMap", "(", "key", ")", ";", "return", "result", "!=", "null", "?", "result", ":", "defaultValue", ";", "}" ]
Converts map element into an AnyValueMap or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return AnyValueMap value of the element or default value if conversion is not supported. @see #getAsNullableMap(String)
[ "Converts", "map", "element", "into", "an", "AnyValueMap", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L606-L609
154,987
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.fromValue
public static AnyValueMap fromValue(Object value) { AnyValueMap result = new AnyValueMap(); result.setAsObject(value); return result; }
java
public static AnyValueMap fromValue(Object value) { AnyValueMap result = new AnyValueMap(); result.setAsObject(value); return result; }
[ "public", "static", "AnyValueMap", "fromValue", "(", "Object", "value", ")", "{", "AnyValueMap", "result", "=", "new", "AnyValueMap", "(", ")", ";", "result", ".", "setAsObject", "(", "value", ")", ";", "return", "result", ";", "}" ]
Converts specified value into AnyValueMap. @param value value to be converted @return a newly created AnyValueMap. @see #setAsObject(Object)
[ "Converts", "specified", "value", "into", "AnyValueMap", "." ]
a8a0c3e5ec58f0663c295aa855c6b3afad2af86a
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L652-L656
154,988
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java
DirectoryRegistrationService.registerService
public void registerService(ProvidedServiceInstance serviceInstance) { getServiceDirectoryClient().registerServiceInstance(serviceInstance); getCacheServiceInstances().put(new ServiceInstanceToken(serviceInstance.getServiceName(), serviceInstance.getProviderId()), new InstanceHealthPair(null)); }
java
public void registerService(ProvidedServiceInstance serviceInstance) { getServiceDirectoryClient().registerServiceInstance(serviceInstance); getCacheServiceInstances().put(new ServiceInstanceToken(serviceInstance.getServiceName(), serviceInstance.getProviderId()), new InstanceHealthPair(null)); }
[ "public", "void", "registerService", "(", "ProvidedServiceInstance", "serviceInstance", ")", "{", "getServiceDirectoryClient", "(", ")", ".", "registerServiceInstance", "(", "serviceInstance", ")", ";", "getCacheServiceInstances", "(", ")", ".", "put", "(", "new", "ServiceInstanceToken", "(", "serviceInstance", ".", "getServiceName", "(", ")", ",", "serviceInstance", ".", "getProviderId", "(", ")", ")", ",", "new", "InstanceHealthPair", "(", "null", ")", ")", ";", "}" ]
Register a ProvidedServiceInstance. @param serviceInstance the ProvidedServiceInstance.
[ "Register", "a", "ProvidedServiceInstance", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L115-L118
154,989
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java
DirectoryRegistrationService.registerService
public void registerService(ProvidedServiceInstance serviceInstance, ServiceInstanceHealth registryHealth) { registerService(serviceInstance); getCacheServiceInstances().put(new ServiceInstanceToken(serviceInstance.getServiceName(), serviceInstance.getProviderId()), new InstanceHealthPair(registryHealth)); }
java
public void registerService(ProvidedServiceInstance serviceInstance, ServiceInstanceHealth registryHealth) { registerService(serviceInstance); getCacheServiceInstances().put(new ServiceInstanceToken(serviceInstance.getServiceName(), serviceInstance.getProviderId()), new InstanceHealthPair(registryHealth)); }
[ "public", "void", "registerService", "(", "ProvidedServiceInstance", "serviceInstance", ",", "ServiceInstanceHealth", "registryHealth", ")", "{", "registerService", "(", "serviceInstance", ")", ";", "getCacheServiceInstances", "(", ")", ".", "put", "(", "new", "ServiceInstanceToken", "(", "serviceInstance", ".", "getServiceName", "(", ")", ",", "serviceInstance", ".", "getProviderId", "(", ")", ")", ",", "new", "InstanceHealthPair", "(", "registryHealth", ")", ")", ";", "}" ]
Register a ProvidedServiceInstance with the OperationalStatus and the ServiceInstanceHealth callback. @param serviceInstance the ProvidedServiceInstance. @param registryHealth the ServiceInstanceHealth callback.
[ "Register", "a", "ProvidedServiceInstance", "with", "the", "OperationalStatus", "and", "the", "ServiceInstanceHealth", "callback", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L128-L132
154,990
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java
DirectoryRegistrationService.updateServiceUri
public void updateServiceUri(String serviceName, String providerId, String uri) { getServiceDirectoryClient().updateServiceInstanceUri(serviceName, providerId, uri); }
java
public void updateServiceUri(String serviceName, String providerId, String uri) { getServiceDirectoryClient().updateServiceInstanceUri(serviceName, providerId, uri); }
[ "public", "void", "updateServiceUri", "(", "String", "serviceName", ",", "String", "providerId", ",", "String", "uri", ")", "{", "getServiceDirectoryClient", "(", ")", ".", "updateServiceInstanceUri", "(", "serviceName", ",", "providerId", ",", "uri", ")", ";", "}" ]
Update the uri of the ProvidedServiceInstance by serviceName and providerId. @param serviceName the serviceName of the ProvidedServiceInstance. @param providerId the providerId of the ProvidedServiceInstance. @param uri the new uri.
[ "Update", "the", "uri", "of", "the", "ProvidedServiceInstance", "by", "serviceName", "and", "providerId", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L144-L147
154,991
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java
DirectoryRegistrationService.updateServiceOperationalStatus
public void updateServiceOperationalStatus(String serviceName, String providerId, OperationalStatus status) { getServiceDirectoryClient().updateServiceInstanceStatus(serviceName, providerId, status); }
java
public void updateServiceOperationalStatus(String serviceName, String providerId, OperationalStatus status) { getServiceDirectoryClient().updateServiceInstanceStatus(serviceName, providerId, status); }
[ "public", "void", "updateServiceOperationalStatus", "(", "String", "serviceName", ",", "String", "providerId", ",", "OperationalStatus", "status", ")", "{", "getServiceDirectoryClient", "(", ")", ".", "updateServiceInstanceStatus", "(", "serviceName", ",", "providerId", ",", "status", ")", ";", "}" ]
Update the OperationalStatus of the ProvidedServiceInstance by serviceName and providerId. @param serviceName the serviceName of the ProvidedServiceInstance. @param providerId the providerId of the ProvidedServiceInstance. @param status the new OperationalStatus of the ProvidedServiceInstance.
[ "Update", "the", "OperationalStatus", "of", "the", "ProvidedServiceInstance", "by", "serviceName", "and", "providerId", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L159-L163
154,992
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java
DirectoryRegistrationService.unregisterService
public void unregisterService(String serviceName, String providerId) { getServiceDirectoryClient().unregisterServiceInstance(serviceName, providerId); getCacheServiceInstances().remove(new ServiceInstanceToken(serviceName, providerId)); }
java
public void unregisterService(String serviceName, String providerId) { getServiceDirectoryClient().unregisterServiceInstance(serviceName, providerId); getCacheServiceInstances().remove(new ServiceInstanceToken(serviceName, providerId)); }
[ "public", "void", "unregisterService", "(", "String", "serviceName", ",", "String", "providerId", ")", "{", "getServiceDirectoryClient", "(", ")", ".", "unregisterServiceInstance", "(", "serviceName", ",", "providerId", ")", ";", "getCacheServiceInstances", "(", ")", ".", "remove", "(", "new", "ServiceInstanceToken", "(", "serviceName", ",", "providerId", ")", ")", ";", "}" ]
Unregister a ProvidedServiceInstance by serviceName and providerId. @param serviceName the serviceName of ProvidedServiceInstance. @param providerId the provierId of ProvidedServiceInstance.
[ "Unregister", "a", "ProvidedServiceInstance", "by", "serviceName", "and", "providerId", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L184-L187
154,993
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java
DirectoryRegistrationService.getUserPermission
public List<Permission> getUserPermission(String userName) { ACL acl = getServiceDirectoryClient().getACL(AuthScheme.DIRECTORY, userName); int permissionId = 0; if(acl != null){ permissionId = acl.getPermission(); } return PermissionUtil.id2Permissions(permissionId); }
java
public List<Permission> getUserPermission(String userName) { ACL acl = getServiceDirectoryClient().getACL(AuthScheme.DIRECTORY, userName); int permissionId = 0; if(acl != null){ permissionId = acl.getPermission(); } return PermissionUtil.id2Permissions(permissionId); }
[ "public", "List", "<", "Permission", ">", "getUserPermission", "(", "String", "userName", ")", "{", "ACL", "acl", "=", "getServiceDirectoryClient", "(", ")", ".", "getACL", "(", "AuthScheme", ".", "DIRECTORY", ",", "userName", ")", ";", "int", "permissionId", "=", "0", ";", "if", "(", "acl", "!=", "null", ")", "{", "permissionId", "=", "acl", ".", "getPermission", "(", ")", ";", "}", "return", "PermissionUtil", ".", "id2Permissions", "(", "permissionId", ")", ";", "}" ]
Get the user permission. @param userName user name. @return the permission list.
[ "Get", "the", "user", "permission", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L280-L288
154,994
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java
DirectoryRegistrationService.getCacheServiceInstances
private Map<ServiceInstanceToken, InstanceHealthPair> getCacheServiceInstances() { if (instanceCache == null) { synchronized (this) { if (instanceCache == null) { instanceCache = new ConcurrentHashMap<ServiceInstanceToken, InstanceHealthPair>(); initJobTasks(); } } } return instanceCache; }
java
private Map<ServiceInstanceToken, InstanceHealthPair> getCacheServiceInstances() { if (instanceCache == null) { synchronized (this) { if (instanceCache == null) { instanceCache = new ConcurrentHashMap<ServiceInstanceToken, InstanceHealthPair>(); initJobTasks(); } } } return instanceCache; }
[ "private", "Map", "<", "ServiceInstanceToken", ",", "InstanceHealthPair", ">", "getCacheServiceInstances", "(", ")", "{", "if", "(", "instanceCache", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "instanceCache", "==", "null", ")", "{", "instanceCache", "=", "new", "ConcurrentHashMap", "<", "ServiceInstanceToken", ",", "InstanceHealthPair", ">", "(", ")", ";", "initJobTasks", "(", ")", ";", "}", "}", "}", "return", "instanceCache", ";", "}" ]
Get the CachedProviderServiceInstance Set. It is lazy initialized and thread safe. @return the CachedProviderServiceInstance Set.
[ "Get", "the", "CachedProviderServiceInstance", "Set", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L318-L328
154,995
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java
DirectoryRegistrationService.initJobTasks
private void initJobTasks() { healthJob = Executors .newSingleThreadScheduledExecutor(new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("SD API RegistryHealth Check"); t.setDaemon(true); return t; } }); int rhDelay = Configurations.getInt( SD_API_REGISTRY_HEALTH_CHECK_DELAY_PROPERTY, SD_API_REGISTRY_HEALTH_CHECK_DELAY_DEFAULT); int rhInterval = Configurations.getInt( SD_API_REGISTRY_HEALTH_CHECK_INTERVAL_PROPERTY, SD_API_REGISTRY_HEALTH_CHECK_INTERVAL_DEFAULT); LOGGER.info("Start the SD API RegistryHealth Task scheduler, delay=" + rhDelay + ", interval=" + rhInterval); healthJob.scheduleAtFixedRate(new HealthCheckTask(), rhDelay, rhInterval, TimeUnit.SECONDS); }
java
private void initJobTasks() { healthJob = Executors .newSingleThreadScheduledExecutor(new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("SD API RegistryHealth Check"); t.setDaemon(true); return t; } }); int rhDelay = Configurations.getInt( SD_API_REGISTRY_HEALTH_CHECK_DELAY_PROPERTY, SD_API_REGISTRY_HEALTH_CHECK_DELAY_DEFAULT); int rhInterval = Configurations.getInt( SD_API_REGISTRY_HEALTH_CHECK_INTERVAL_PROPERTY, SD_API_REGISTRY_HEALTH_CHECK_INTERVAL_DEFAULT); LOGGER.info("Start the SD API RegistryHealth Task scheduler, delay=" + rhDelay + ", interval=" + rhInterval); healthJob.scheduleAtFixedRate(new HealthCheckTask(), rhDelay, rhInterval, TimeUnit.SECONDS); }
[ "private", "void", "initJobTasks", "(", ")", "{", "healthJob", "=", "Executors", ".", "newSingleThreadScheduledExecutor", "(", "new", "ThreadFactory", "(", ")", "{", "public", "Thread", "newThread", "(", "Runnable", "r", ")", "{", "Thread", "t", "=", "new", "Thread", "(", "r", ")", ";", "t", ".", "setName", "(", "\"SD API RegistryHealth Check\"", ")", ";", "t", ".", "setDaemon", "(", "true", ")", ";", "return", "t", ";", "}", "}", ")", ";", "int", "rhDelay", "=", "Configurations", ".", "getInt", "(", "SD_API_REGISTRY_HEALTH_CHECK_DELAY_PROPERTY", ",", "SD_API_REGISTRY_HEALTH_CHECK_DELAY_DEFAULT", ")", ";", "int", "rhInterval", "=", "Configurations", ".", "getInt", "(", "SD_API_REGISTRY_HEALTH_CHECK_INTERVAL_PROPERTY", ",", "SD_API_REGISTRY_HEALTH_CHECK_INTERVAL_DEFAULT", ")", ";", "LOGGER", ".", "info", "(", "\"Start the SD API RegistryHealth Task scheduler, delay=\"", "+", "rhDelay", "+", "\", interval=\"", "+", "rhInterval", ")", ";", "healthJob", ".", "scheduleAtFixedRate", "(", "new", "HealthCheckTask", "(", ")", ",", "rhDelay", ",", "rhInterval", ",", "TimeUnit", ".", "SECONDS", ")", ";", "}" ]
initialize the Heartbeat task and Health Check task. It invoked in the getCacheServiceInstances method which is thread safe, no synchronized needed.
[ "initialize", "the", "Heartbeat", "task", "and", "Health", "Check", "task", ".", "It", "invoked", "in", "the", "getCacheServiceInstances", "method", "which", "is", "thread", "safe", "no", "synchronized", "needed", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L344-L364
154,996
PureSolTechnologies/commons
money/src/main/java/com/puresoltechnologies/commons/money/MoneyMath.java
MoneyMath.allocate
public static long[] allocate(long amount, int... ratios) { if ((ratios == null) || (ratios.length == 0)) { throw new IllegalArgumentException( "At least one ratio value needs to be provided."); } int total = 0; for (int i = 0; i < ratios.length; i++) total += ratios[i]; if (total <= 0) { throw new IllegalArgumentException( "The sum of all ratios need to be greater than zero!"); } long remainder = amount; long[] results = new long[ratios.length]; for (int i = 0; i < results.length; i++) { results[i] = amount * ratios[i] / total; remainder -= results[i]; } for (int i = 0; i < remainder; i++) { results[i]++; } return results; }
java
public static long[] allocate(long amount, int... ratios) { if ((ratios == null) || (ratios.length == 0)) { throw new IllegalArgumentException( "At least one ratio value needs to be provided."); } int total = 0; for (int i = 0; i < ratios.length; i++) total += ratios[i]; if (total <= 0) { throw new IllegalArgumentException( "The sum of all ratios need to be greater than zero!"); } long remainder = amount; long[] results = new long[ratios.length]; for (int i = 0; i < results.length; i++) { results[i] = amount * ratios[i] / total; remainder -= results[i]; } for (int i = 0; i < remainder; i++) { results[i]++; } return results; }
[ "public", "static", "long", "[", "]", "allocate", "(", "long", "amount", ",", "int", "...", "ratios", ")", "{", "if", "(", "(", "ratios", "==", "null", ")", "||", "(", "ratios", ".", "length", "==", "0", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"At least one ratio value needs to be provided.\"", ")", ";", "}", "int", "total", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ratios", ".", "length", ";", "i", "++", ")", "total", "+=", "ratios", "[", "i", "]", ";", "if", "(", "total", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The sum of all ratios need to be greater than zero!\"", ")", ";", "}", "long", "remainder", "=", "amount", ";", "long", "[", "]", "results", "=", "new", "long", "[", "ratios", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "results", ".", "length", ";", "i", "++", ")", "{", "results", "[", "i", "]", "=", "amount", "*", "ratios", "[", "i", "]", "/", "total", ";", "remainder", "-=", "results", "[", "i", "]", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "remainder", ";", "i", "++", ")", "{", "results", "[", "i", "]", "++", ";", "}", "return", "results", ";", "}" ]
Splits a long value into an array of long values which sum up to the original value, but are splitted into amounts given by ratios. @param amount is the total amount to be splitted. @param ratios are the ratios for all shares. @return An array of long is returned containing the splitted amounts.
[ "Splits", "a", "long", "value", "into", "an", "array", "of", "long", "values", "which", "sum", "up", "to", "the", "original", "value", "but", "are", "splitted", "into", "amounts", "given", "by", "ratios", "." ]
f98c23d8841a1ff61632ff17fe7d24f99dbc1d44
https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/money/src/main/java/com/puresoltechnologies/commons/money/MoneyMath.java#L51-L75
154,997
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/stats/PacketLatency.java
PacketLatency.queuePacket
public static void queuePacket(Packet packet){ if(isEnabled){ if(LOGGER.isDebugEnabled()){ LOGGER.debug("queue packet latency = " + (System.currentTimeMillis() - packet.getCreateTime())); } } }
java
public static void queuePacket(Packet packet){ if(isEnabled){ if(LOGGER.isDebugEnabled()){ LOGGER.debug("queue packet latency = " + (System.currentTimeMillis() - packet.getCreateTime())); } } }
[ "public", "static", "void", "queuePacket", "(", "Packet", "packet", ")", "{", "if", "(", "isEnabled", ")", "{", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"queue packet latency = \"", "+", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "packet", ".", "getCreateTime", "(", ")", ")", ")", ";", "}", "}", "}" ]
Collect the queue Packet latency. @param packet the Packet.
[ "Collect", "the", "queue", "Packet", "latency", "." ]
a7bdefe173dc99e75eff4a24e07e6407e62f2ed4
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/stats/PacketLatency.java#L64-L70
154,998
gnagy/webhejj-commons
src/main/java/hu/webhejj/commons/files/FileUtils.java
FileUtils.deleteRecursive
public static boolean deleteRecursive(File file) { if(!file.exists()) { return false; } if(file.isDirectory()) { for(File child: file.listFiles()) { deleteRecursive(child); } } return file.delete(); }
java
public static boolean deleteRecursive(File file) { if(!file.exists()) { return false; } if(file.isDirectory()) { for(File child: file.listFiles()) { deleteRecursive(child); } } return file.delete(); }
[ "public", "static", "boolean", "deleteRecursive", "(", "File", "file", ")", "{", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "for", "(", "File", "child", ":", "file", ".", "listFiles", "(", ")", ")", "{", "deleteRecursive", "(", "child", ")", ";", "}", "}", "return", "file", ".", "delete", "(", ")", ";", "}" ]
Deletes specified file from the file system, recursively if directory @param file file or directory to delete @return true if file existed and was deleted, false if file did not exist
[ "Deletes", "specified", "file", "from", "the", "file", "system", "recursively", "if", "directory" ]
270bc6f111ec5761af31d39bd38c40fd914d2eba
https://github.com/gnagy/webhejj-commons/blob/270bc6f111ec5761af31d39bd38c40fd914d2eba/src/main/java/hu/webhejj/commons/files/FileUtils.java#L92-L104
154,999
gnagy/webhejj-commons
src/main/java/hu/webhejj/commons/files/FileUtils.java
FileUtils.copy
public static void copy(InputStream is, File file) throws IOException { Asserts.notNullParameter("is", is); Asserts.notNullParameter("file", file); FileOutputStream os = null; os = new FileOutputStream(file); copy(is, os); }
java
public static void copy(InputStream is, File file) throws IOException { Asserts.notNullParameter("is", is); Asserts.notNullParameter("file", file); FileOutputStream os = null; os = new FileOutputStream(file); copy(is, os); }
[ "public", "static", "void", "copy", "(", "InputStream", "is", ",", "File", "file", ")", "throws", "IOException", "{", "Asserts", ".", "notNullParameter", "(", "\"is\"", ",", "is", ")", ";", "Asserts", ".", "notNullParameter", "(", "\"file\"", ",", "file", ")", ";", "FileOutputStream", "os", "=", "null", ";", "os", "=", "new", "FileOutputStream", "(", "file", ")", ";", "copy", "(", "is", ",", "os", ")", ";", "}" ]
save data from the specified input stream to file
[ "save", "data", "from", "the", "specified", "input", "stream", "to", "file" ]
270bc6f111ec5761af31d39bd38c40fd914d2eba
https://github.com/gnagy/webhejj-commons/blob/270bc6f111ec5761af31d39bd38c40fd914d2eba/src/main/java/hu/webhejj/commons/files/FileUtils.java#L107-L115