repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_shippingAddresses_GET
public ArrayList<OvhShippingAddress> packName_shippingAddresses_GET(String packName, OvhShippingAddressContextEnum context) throws IOException { String qPath = "/pack/xdsl/{packName}/shippingAddresses"; StringBuilder sb = path(qPath, packName); query(sb, "context", context); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
java
public ArrayList<OvhShippingAddress> packName_shippingAddresses_GET(String packName, OvhShippingAddressContextEnum context) throws IOException { String qPath = "/pack/xdsl/{packName}/shippingAddresses"; StringBuilder sb = path(qPath, packName); query(sb, "context", context); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
[ "public", "ArrayList", "<", "OvhShippingAddress", ">", "packName_shippingAddresses_GET", "(", "String", "packName", ",", "OvhShippingAddressContextEnum", "context", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}/shippingAddresses\"", ";", ...
Allowed shipping addresses given a context REST: GET /pack/xdsl/{packName}/shippingAddresses @param context [required] Context @param packName [required] The internal name of your pack
[ "Allowed", "shipping", "addresses", "given", "a", "context" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L984-L990
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_allowedNetwork_networkAccessId_GET
public OvhAllowedNetwork serviceName_allowedNetwork_networkAccessId_GET(String serviceName, Long networkAccessId) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/allowedNetwork/{networkAccessId}"; StringBuilder sb = path(qPath, serviceName, networkAccessId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAllowedNetwork.class); }
java
public OvhAllowedNetwork serviceName_allowedNetwork_networkAccessId_GET(String serviceName, Long networkAccessId) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/allowedNetwork/{networkAccessId}"; StringBuilder sb = path(qPath, serviceName, networkAccessId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAllowedNetwork.class); }
[ "public", "OvhAllowedNetwork", "serviceName_allowedNetwork_networkAccessId_GET", "(", "String", "serviceName", ",", "Long", "networkAccessId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/{serviceName}/allowedNetwork/{networkAccessId}\"", ";", "St...
Get this object properties REST: GET /dedicatedCloud/{serviceName}/allowedNetwork/{networkAccessId} @param serviceName [required] Domain of the service @param networkAccessId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L307-L312
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.minArrayLike
public PactDslJsonArray minArrayLike(Integer size, PactDslJsonRootValue value) { return minArrayLike(size, value, size); }
java
public PactDslJsonArray minArrayLike(Integer size, PactDslJsonRootValue value) { return minArrayLike(size, value, size); }
[ "public", "PactDslJsonArray", "minArrayLike", "(", "Integer", "size", ",", "PactDslJsonRootValue", "value", ")", "{", "return", "minArrayLike", "(", "size", ",", "value", ",", "size", ")", ";", "}" ]
Array of values with a minimum size that are not objects where each item must match the provided example @param size minimum size of the array @param value Value to use to match each item
[ "Array", "of", "values", "with", "a", "minimum", "size", "that", "are", "not", "objects", "where", "each", "item", "must", "match", "the", "provided", "example" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L1052-L1054
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java
TileSystem.getY01FromLatitude
public double getY01FromLatitude(double latitude, boolean wrapEnabled) { latitude = wrapEnabled ? Clip(latitude, getMinLatitude(), getMaxLatitude()) : latitude; final double result = getY01FromLatitude(latitude); return wrapEnabled ? Clip(result, 0, 1) : result; }
java
public double getY01FromLatitude(double latitude, boolean wrapEnabled) { latitude = wrapEnabled ? Clip(latitude, getMinLatitude(), getMaxLatitude()) : latitude; final double result = getY01FromLatitude(latitude); return wrapEnabled ? Clip(result, 0, 1) : result; }
[ "public", "double", "getY01FromLatitude", "(", "double", "latitude", ",", "boolean", "wrapEnabled", ")", "{", "latitude", "=", "wrapEnabled", "?", "Clip", "(", "latitude", ",", "getMinLatitude", "(", ")", ",", "getMaxLatitude", "(", ")", ")", ":", "latitude", ...
Converts a latitude to its "Y01" value, id est a double between 0 and 1 for the whole latitude range @since 6.0.0
[ "Converts", "a", "latitude", "to", "its", "Y01", "value", "id", "est", "a", "double", "between", "0", "and", "1", "for", "the", "whole", "latitude", "range" ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java#L230-L234
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.readExcel2Objects
public <T> List<T> readExcel2Objects(InputStream is, Class<T> clazz) throws Excel4JException, IOException, InvalidFormatException { return readExcel2Objects(is, clazz, 0, Integer.MAX_VALUE, 0); }
java
public <T> List<T> readExcel2Objects(InputStream is, Class<T> clazz) throws Excel4JException, IOException, InvalidFormatException { return readExcel2Objects(is, clazz, 0, Integer.MAX_VALUE, 0); }
[ "public", "<", "T", ">", "List", "<", "T", ">", "readExcel2Objects", "(", "InputStream", "is", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "Excel4JException", ",", "IOException", ",", "InvalidFormatException", "{", "return", "readExcel2Objects", "(", ...
读取Excel操作基于注解映射成绑定的java对象 @param is 待导出Excel的数据流 @param clazz 待绑定的类(绑定属性注解{@link com.github.crab2died.annotation.ExcelField}) @param <T> 绑定的数据类 @return 返回转换为设置绑定的java对象集合 @throws Excel4JException 异常 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died
[ "读取Excel操作基于注解映射成绑定的java对象" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L243-L246
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.retainTop
public static <E> void retainTop(Counter<E> c, int num) { int numToPurge = c.size() - num; if (numToPurge <= 0) { return; } List<E> l = Counters.toSortedList(c); Collections.reverse(l); for (int i = 0; i < numToPurge; i++) { c.remove(l.get(i)); } }
java
public static <E> void retainTop(Counter<E> c, int num) { int numToPurge = c.size() - num; if (numToPurge <= 0) { return; } List<E> l = Counters.toSortedList(c); Collections.reverse(l); for (int i = 0; i < numToPurge; i++) { c.remove(l.get(i)); } }
[ "public", "static", "<", "E", ">", "void", "retainTop", "(", "Counter", "<", "E", ">", "c", ",", "int", "num", ")", "{", "int", "numToPurge", "=", "c", ".", "size", "(", ")", "-", "num", ";", "if", "(", "numToPurge", "<=", "0", ")", "{", "retur...
Removes all entries from c except for the top <code>num</code>
[ "Removes", "all", "entries", "from", "c", "except", "for", "the", "top", "<code", ">", "num<", "/", "code", ">" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L512-L523
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/VpTree.java
VpTree.searchNearest
private boolean searchNearest(final double[] target, double maxDistance, NnData<double[]> result) { if (root == null) { return false; } double tau = maxDistance; final FastQueue<Node> nodes = new FastQueue<Node>(20, Node.class, false); nodes.add(root); result.distance = Double.POSITIVE_INFINITY; boolean found = false; while (nodes.size() > 0) { final Node node = nodes.getTail(); nodes.removeTail(); final double dist = distance(items[node.index], target); if (dist <= tau && dist < result.distance) { result.distance = dist; result.index = indexes.data[node.index]; result.point = items[node.index]; tau = dist; found = true; } if (node.left != null && dist - tau <= node.threshold) { nodes.add(node.left); } if (node.right != null && dist + tau >= node.threshold) { nodes.add(node.right); } } return found; }
java
private boolean searchNearest(final double[] target, double maxDistance, NnData<double[]> result) { if (root == null) { return false; } double tau = maxDistance; final FastQueue<Node> nodes = new FastQueue<Node>(20, Node.class, false); nodes.add(root); result.distance = Double.POSITIVE_INFINITY; boolean found = false; while (nodes.size() > 0) { final Node node = nodes.getTail(); nodes.removeTail(); final double dist = distance(items[node.index], target); if (dist <= tau && dist < result.distance) { result.distance = dist; result.index = indexes.data[node.index]; result.point = items[node.index]; tau = dist; found = true; } if (node.left != null && dist - tau <= node.threshold) { nodes.add(node.left); } if (node.right != null && dist + tau >= node.threshold) { nodes.add(node.right); } } return found; }
[ "private", "boolean", "searchNearest", "(", "final", "double", "[", "]", "target", ",", "double", "maxDistance", ",", "NnData", "<", "double", "[", "]", ">", "result", ")", "{", "if", "(", "root", "==", "null", ")", "{", "return", "false", ";", "}", ...
Equivalent to the above search method to find one nearest neighbor. It is faster as it does not need to allocate and use the heap data structure. @param target target point @param maxDistance maximum distance @param result information about the nearest point (output parameter) @return true if a nearest point was found within maxDistance
[ "Equivalent", "to", "the", "above", "search", "method", "to", "find", "one", "nearest", "neighbor", ".", "It", "is", "faster", "as", "it", "does", "not", "need", "to", "allocate", "and", "use", "the", "heap", "data", "structure", "." ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L256-L290
twitter/hraven
hraven-etl/src/main/java/com/twitter/hraven/etl/JobFilePartitioner.java
JobFilePartitioner.parseArgs
private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); // Input Option o = new Option("i", "input", true, "input directory as hdfs path, or local as file://"); o.setArgName("input-path"); o.setRequired(true); options.addOption(o); // Input o = new Option("o", "output", true, "output directory"); o.setArgName("input-path"); o.setRequired(true); options.addOption(o); // Whether to skip existing files or not. o = new Option("s", "skipExisting", false, "skip existing files. Cannot be used together with m for move."); o.setRequired(false); options.addOption(o); // Maximum number of files to retain in the specified input directory. o = new Option( "x", "maXretention", true, "The maximum number of the most recent files to retain in the input directory after processing." + " Can be used by HDFS input paths only. Mutually exclusive with s (move)," + " but can be used in combination with s (skipExisting)"); o.setRequired(false); options.addOption(o); // Whether files need to be moved o = new Option("m", "move", false, "move all files rather than copying." + "Delete source if target already exists." + " Can be used with HDFS input paths only. " + " Mutually exlusive with s (skipExisting)"); o.setRequired(false); options.addOption(o); // Debugging options.addOption("d", "debug", false, "switch on DEBUG log level"); o.setRequired(false); options.addOption(o); CommandLineParser parser = new PosixParser(); CommandLine commandLine = null; try { commandLine = parser.parse(options, args); } catch (Exception e) { System.err.println("ERROR: " + e.getMessage() + "\n"); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(NAME + " ", options, true); System.exit(-1); } return commandLine; }
java
private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); // Input Option o = new Option("i", "input", true, "input directory as hdfs path, or local as file://"); o.setArgName("input-path"); o.setRequired(true); options.addOption(o); // Input o = new Option("o", "output", true, "output directory"); o.setArgName("input-path"); o.setRequired(true); options.addOption(o); // Whether to skip existing files or not. o = new Option("s", "skipExisting", false, "skip existing files. Cannot be used together with m for move."); o.setRequired(false); options.addOption(o); // Maximum number of files to retain in the specified input directory. o = new Option( "x", "maXretention", true, "The maximum number of the most recent files to retain in the input directory after processing." + " Can be used by HDFS input paths only. Mutually exclusive with s (move)," + " but can be used in combination with s (skipExisting)"); o.setRequired(false); options.addOption(o); // Whether files need to be moved o = new Option("m", "move", false, "move all files rather than copying." + "Delete source if target already exists." + " Can be used with HDFS input paths only. " + " Mutually exlusive with s (skipExisting)"); o.setRequired(false); options.addOption(o); // Debugging options.addOption("d", "debug", false, "switch on DEBUG log level"); o.setRequired(false); options.addOption(o); CommandLineParser parser = new PosixParser(); CommandLine commandLine = null; try { commandLine = parser.parse(options, args); } catch (Exception e) { System.err.println("ERROR: " + e.getMessage() + "\n"); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(NAME + " ", options, true); System.exit(-1); } return commandLine; }
[ "private", "static", "CommandLine", "parseArgs", "(", "String", "[", "]", "args", ")", "throws", "ParseException", "{", "Options", "options", "=", "new", "Options", "(", ")", ";", "// Input", "Option", "o", "=", "new", "Option", "(", "\"i\"", ",", "\"input...
Parse command-line arguments. @param args command line arguments passed to program. @return parsed command line. @throws ParseException
[ "Parse", "command", "-", "line", "arguments", "." ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/JobFilePartitioner.java#L124-L182
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/AbstractDataStore.java
AbstractDataStore.readData
protected static final Data readData(@Nonnull final DataReader reader, @Nonnull final URL url, @Nonnull final Charset charset) { Check.notNull(reader, "reader"); Check.notNull(url, "url"); Check.notNull(charset, "charset"); return reader.read(url, charset); }
java
protected static final Data readData(@Nonnull final DataReader reader, @Nonnull final URL url, @Nonnull final Charset charset) { Check.notNull(reader, "reader"); Check.notNull(url, "url"); Check.notNull(charset, "charset"); return reader.read(url, charset); }
[ "protected", "static", "final", "Data", "readData", "(", "@", "Nonnull", "final", "DataReader", "reader", ",", "@", "Nonnull", "final", "URL", "url", ",", "@", "Nonnull", "final", "Charset", "charset", ")", "{", "Check", ".", "notNull", "(", "reader", ",",...
This method reads the given {@link URL} by using an {@link DataReader}. The new created instance of {@link Data} will be returned. @param reader data reader to read the given {@code dataUrl} @param url URL to <em>UAS data</em> @param charset the character set in which the data should be read @return an instance of {@code Data} or {@link Data#EMPTY} if an error occurred, but never {@code null} @throws net.sf.qualitycheck.exception.IllegalNullArgumentException if the given argument is {@code null}
[ "This", "method", "reads", "the", "given", "{", "@link", "URL", "}", "by", "using", "an", "{", "@link", "DataReader", "}", ".", "The", "new", "created", "instance", "of", "{", "@link", "Data", "}", "will", "be", "returned", "." ]
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/AbstractDataStore.java#L67-L73
google/closure-compiler
src/com/google/javascript/jscomp/deps/PathUtil.java
PathUtil.makeRelative
public static String makeRelative(String basePath, String targetPath) { // Ensure the paths are both absolute or both relative. if (isAbsolute(basePath) != isAbsolute(targetPath)) { throw new IllegalArgumentException( "Paths must both be relative or both absolute.\n" + " basePath: " + basePath + "\n" + " targetPath: " + targetPath); } basePath = collapseDots(basePath); targetPath = collapseDots(targetPath); String[] baseFragments = basePath.split("/"); String[] targetFragments = targetPath.split("/"); int i = -1; do { i += 1; if (i == baseFragments.length && i == targetFragments.length) { // Eg) base: /java/com/google // target: /java/com/google // result: . <-- . is better than "" since "" + "/path" = "/path" return "."; } else if (i == baseFragments.length) { // Eg) base: /java/com/google // target: /java/com/google/c/ui // result: c/ui return Joiner.on("/").join( Lists.newArrayList( Arrays.asList(targetFragments).listIterator(i))); } else if (i == targetFragments.length) { // Eg) base: /java/com/google/c/ui // target: /java/com/google // result: ../.. return Strings.repeat("../", baseFragments.length - i - 1) + ".."; } } while (baseFragments[i].equals(targetFragments[i])); // Eg) base: /java/com/google/c // target: /java/com/google/common/base // result: ../common/base return Strings.repeat("../", baseFragments.length - i) + Joiner.on("/").join( Lists.newArrayList(Arrays.asList(targetFragments).listIterator(i))); }
java
public static String makeRelative(String basePath, String targetPath) { // Ensure the paths are both absolute or both relative. if (isAbsolute(basePath) != isAbsolute(targetPath)) { throw new IllegalArgumentException( "Paths must both be relative or both absolute.\n" + " basePath: " + basePath + "\n" + " targetPath: " + targetPath); } basePath = collapseDots(basePath); targetPath = collapseDots(targetPath); String[] baseFragments = basePath.split("/"); String[] targetFragments = targetPath.split("/"); int i = -1; do { i += 1; if (i == baseFragments.length && i == targetFragments.length) { // Eg) base: /java/com/google // target: /java/com/google // result: . <-- . is better than "" since "" + "/path" = "/path" return "."; } else if (i == baseFragments.length) { // Eg) base: /java/com/google // target: /java/com/google/c/ui // result: c/ui return Joiner.on("/").join( Lists.newArrayList( Arrays.asList(targetFragments).listIterator(i))); } else if (i == targetFragments.length) { // Eg) base: /java/com/google/c/ui // target: /java/com/google // result: ../.. return Strings.repeat("../", baseFragments.length - i - 1) + ".."; } } while (baseFragments[i].equals(targetFragments[i])); // Eg) base: /java/com/google/c // target: /java/com/google/common/base // result: ../common/base return Strings.repeat("../", baseFragments.length - i) + Joiner.on("/").join( Lists.newArrayList(Arrays.asList(targetFragments).listIterator(i))); }
[ "public", "static", "String", "makeRelative", "(", "String", "basePath", ",", "String", "targetPath", ")", "{", "// Ensure the paths are both absolute or both relative.", "if", "(", "isAbsolute", "(", "basePath", ")", "!=", "isAbsolute", "(", "targetPath", ")", ")", ...
Returns targetPath relative to basePath. <p>basePath and targetPath must either both be relative, or both be absolute paths.</p> <p>This function is different from makeRelative in that it is able to add in ../ components and collapse existing ones as well.</p> Examples: base="some/relative/path" target="some/relative/path/foo" return="foo" base="some/relative/path" target="some/relative" return=".." base="some/relative/path" target="foo/bar" return="../../../foo/bar" base="/some/abs/path" target="/foo/bar" return="../../../foo/bar" @param basePath The path to make targetPath relative to. @param targetPath The path to make relative. @return A path relative to targetPath. The returned value will never start with a slash.
[ "Returns", "targetPath", "relative", "to", "basePath", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/PathUtil.java#L165-L210
Azure/azure-sdk-for-java
locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java
ManagementLocksInner.getByResourceGroupAsync
public Observable<ManagementLockObjectInner> getByResourceGroupAsync(String resourceGroupName, String lockName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, lockName).map(new Func1<ServiceResponse<ManagementLockObjectInner>, ManagementLockObjectInner>() { @Override public ManagementLockObjectInner call(ServiceResponse<ManagementLockObjectInner> response) { return response.body(); } }); }
java
public Observable<ManagementLockObjectInner> getByResourceGroupAsync(String resourceGroupName, String lockName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, lockName).map(new Func1<ServiceResponse<ManagementLockObjectInner>, ManagementLockObjectInner>() { @Override public ManagementLockObjectInner call(ServiceResponse<ManagementLockObjectInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagementLockObjectInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "lockName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "lockName", ")", ".", ...
Gets a management lock at the resource group level. @param resourceGroupName The name of the locked resource group. @param lockName The name of the lock to get. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagementLockObjectInner object
[ "Gets", "a", "management", "lock", "at", "the", "resource", "group", "level", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L364-L371
glookast/commons-timecode
src/main/java/com/glookast/commons/timecode/MutableTimecodeDuration.java
MutableTimecodeDuration.valueOf
public static MutableTimecodeDuration valueOf(String timecode, int timecodeBase) throws IllegalArgumentException { return valueOf(timecode, timecodeBase, StringType.NORMAL); }
java
public static MutableTimecodeDuration valueOf(String timecode, int timecodeBase) throws IllegalArgumentException { return valueOf(timecode, timecodeBase, StringType.NORMAL); }
[ "public", "static", "MutableTimecodeDuration", "valueOf", "(", "String", "timecode", ",", "int", "timecodeBase", ")", "throws", "IllegalArgumentException", "{", "return", "valueOf", "(", "timecode", ",", "timecodeBase", ",", "StringType", ".", "NORMAL", ")", ";", ...
Returns a TimecodeDuration instance for given timecode string and timecode base. Acceptable inputs are the normal representation HH:MM:SS:FF for non drop frame and HH:MM:SS:FF for drop frame @param timecode @param timecodeBase @return the TimecodeDuration @throws IllegalArgumentException
[ "Returns", "a", "TimecodeDuration", "instance", "for", "given", "timecode", "string", "and", "timecode", "base", ".", "Acceptable", "inputs", "are", "the", "normal", "representation", "HH", ":", "MM", ":", "SS", ":", "FF", "for", "non", "drop", "frame", "and...
train
https://github.com/glookast/commons-timecode/blob/ec2f682a51d1cc435d0b42d80de48ff15adb4ee8/src/main/java/com/glookast/commons/timecode/MutableTimecodeDuration.java#L75-L78
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataIntersectionOfImpl_CustomFieldSerializer.java
OWLDataIntersectionOfImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataIntersectionOfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataIntersectionOfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLDataIntersectionOfImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataIntersectionOfImpl_CustomFieldSerializer.java#L69-L72
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMedia.java
AbstractMedia.viewLocationDidChange
public void viewLocationDidChange (int dx, int dy) { if (_renderOrder >= HUD_LAYER) { setLocation(_bounds.x + dx, _bounds.y + dy); } }
java
public void viewLocationDidChange (int dx, int dy) { if (_renderOrder >= HUD_LAYER) { setLocation(_bounds.x + dx, _bounds.y + dy); } }
[ "public", "void", "viewLocationDidChange", "(", "int", "dx", ",", "int", "dy", ")", "{", "if", "(", "_renderOrder", ">=", "HUD_LAYER", ")", "{", "setLocation", "(", "_bounds", ".", "x", "+", "dx", ",", "_bounds", ".", "y", "+", "dy", ")", ";", "}", ...
Called by the {@link AbstractMediaManager} when we are in a {@link VirtualMediaPanel} that just scrolled.
[ "Called", "by", "the", "{" ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMedia.java#L220-L225
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DeprecationStatus.java
DeprecationStatus.of
public static <T extends ResourceId> DeprecationStatus<T> of(Status status, T replacement) { return newBuilder(status, replacement).build(); }
java
public static <T extends ResourceId> DeprecationStatus<T> of(Status status, T replacement) { return newBuilder(status, replacement).build(); }
[ "public", "static", "<", "T", "extends", "ResourceId", ">", "DeprecationStatus", "<", "T", ">", "of", "(", "Status", "status", ",", "T", "replacement", ")", "{", "return", "newBuilder", "(", "status", ",", "replacement", ")", ".", "build", "(", ")", ";",...
Returns a {@code DeprecationStatus} object given the status and replacement's identity.
[ "Returns", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DeprecationStatus.java#L333-L335
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.removeAllIterable
public static <T> boolean removeAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection) { if (iterable == null) { throw new NullPointerException(); } if (iterable instanceof Collection<?>) { return targetCollection.removeAll((Collection<T>) iterable); } int oldSize = targetCollection.size(); Iterate.forEachWith(iterable, Procedures2.<T>removeFromCollection(), targetCollection); return targetCollection.size() != oldSize; }
java
public static <T> boolean removeAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection) { if (iterable == null) { throw new NullPointerException(); } if (iterable instanceof Collection<?>) { return targetCollection.removeAll((Collection<T>) iterable); } int oldSize = targetCollection.size(); Iterate.forEachWith(iterable, Procedures2.<T>removeFromCollection(), targetCollection); return targetCollection.size() != oldSize; }
[ "public", "static", "<", "T", ">", "boolean", "removeAllIterable", "(", "Iterable", "<", "?", "extends", "T", ">", "iterable", ",", "Collection", "<", "T", ">", "targetCollection", ")", "{", "if", "(", "iterable", "==", "null", ")", "{", "throw", "new", ...
Remove all elements present in Iterable from the target collection, returns true if any element was removed.
[ "Remove", "all", "elements", "present", "in", "Iterable", "from", "the", "target", "collection", "returns", "true", "if", "any", "element", "was", "removed", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L1151-L1164
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java
CouchDatabaseBase.saveAttachment
public Response saveAttachment(InputStream in, String name, String contentType) { return saveAttachment(in, name, contentType, null, null); }
java
public Response saveAttachment(InputStream in, String name, String contentType) { return saveAttachment(in, name, contentType, null, null); }
[ "public", "Response", "saveAttachment", "(", "InputStream", "in", ",", "String", "name", ",", "String", "contentType", ")", "{", "return", "saveAttachment", "(", "in", ",", "name", ",", "contentType", ",", "null", ",", "null", ")", ";", "}" ]
Saves an attachment to a new document with a generated <tt>UUID</tt> as the document id. <p>To retrieve an attachment, see {@link #find(String)}. @param in The {@link InputStream} holding the binary data. @param name The attachment name. @param contentType The attachment "Content-Type". @return {@link Response}
[ "Saves", "an", "attachment", "to", "a", "new", "document", "with", "a", "generated", "<tt", ">", "UUID<", "/", "tt", ">", "as", "the", "document", "id", ".", "<p", ">", "To", "retrieve", "an", "attachment", "see", "{", "@link", "#find", "(", "String", ...
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java#L342-L344
elki-project/elki
elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/NonFlatRStarTree.java
NonFlatRStarTree.createRoot
private N createRoot(N root, List<E> objects) { // insert data for(E entry : objects) { if (entry instanceof LeafEntry) { root.addLeafEntry(entry); } else { root.addDirectoryEntry(entry); } } // set root mbr ((SpatialDirectoryEntry) getRootEntry()).setMBR(root.computeMBR()); // write to file writeNode(root); if(getLogger().isDebuggingFiner()) { StringBuilder msg = new StringBuilder(); msg.append("pageNo ").append(root.getPageID()); getLogger().debugFiner(msg.toString()); } return root; }
java
private N createRoot(N root, List<E> objects) { // insert data for(E entry : objects) { if (entry instanceof LeafEntry) { root.addLeafEntry(entry); } else { root.addDirectoryEntry(entry); } } // set root mbr ((SpatialDirectoryEntry) getRootEntry()).setMBR(root.computeMBR()); // write to file writeNode(root); if(getLogger().isDebuggingFiner()) { StringBuilder msg = new StringBuilder(); msg.append("pageNo ").append(root.getPageID()); getLogger().debugFiner(msg.toString()); } return root; }
[ "private", "N", "createRoot", "(", "N", "root", ",", "List", "<", "E", ">", "objects", ")", "{", "// insert data", "for", "(", "E", "entry", ":", "objects", ")", "{", "if", "(", "entry", "instanceof", "LeafEntry", ")", "{", "root", ".", "addLeafEntry",...
Returns a root node for bulk load. If the objects are data objects a leaf node will be returned, if the objects are nodes a directory node will be returned. @param root the new root node @param objects the spatial objects to be inserted @return the root node
[ "Returns", "a", "root", "node", "for", "bulk", "load", ".", "If", "the", "objects", "are", "data", "objects", "a", "leaf", "node", "will", "be", "returned", "if", "the", "objects", "are", "nodes", "a", "directory", "node", "will", "be", "returned", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/NonFlatRStarTree.java#L214-L237
alkacon/opencms-core
src/org/opencms/importexport/CmsImportVersion10.java
CmsImportVersion10.addResourceAceRules
protected void addResourceAceRules(Digester digester, String xpath) { String xp_ace = xpath + N_ACCESSCONTROL_ENTRIES + "/" + N_ACCESSCONTROL_ENTRY; digester.addCallMethod(xp_ace, "addAccessControlEntry"); digester.addCallMethod(xp_ace + "/" + N_ACCESSCONTROL_PRINCIPAL, "setAcePrincipalId", 0); digester.addCallMethod(xp_ace + "/" + N_FLAGS, "setAceFlags", 0); String xp_perms = xp_ace + "/" + N_ACCESSCONTROL_PERMISSIONSET + "/"; digester.addCallMethod(xp_perms + N_ACCESSCONTROL_ALLOWEDPERMISSIONS, "setAcePermissionsAllowed", 0); digester.addCallMethod(xp_perms + N_ACCESSCONTROL_DENIEDPERMISSIONS, "setAcePermissionsDenied", 0); }
java
protected void addResourceAceRules(Digester digester, String xpath) { String xp_ace = xpath + N_ACCESSCONTROL_ENTRIES + "/" + N_ACCESSCONTROL_ENTRY; digester.addCallMethod(xp_ace, "addAccessControlEntry"); digester.addCallMethod(xp_ace + "/" + N_ACCESSCONTROL_PRINCIPAL, "setAcePrincipalId", 0); digester.addCallMethod(xp_ace + "/" + N_FLAGS, "setAceFlags", 0); String xp_perms = xp_ace + "/" + N_ACCESSCONTROL_PERMISSIONSET + "/"; digester.addCallMethod(xp_perms + N_ACCESSCONTROL_ALLOWEDPERMISSIONS, "setAcePermissionsAllowed", 0); digester.addCallMethod(xp_perms + N_ACCESSCONTROL_DENIEDPERMISSIONS, "setAcePermissionsDenied", 0); }
[ "protected", "void", "addResourceAceRules", "(", "Digester", "digester", ",", "String", "xpath", ")", "{", "String", "xp_ace", "=", "xpath", "+", "N_ACCESSCONTROL_ENTRIES", "+", "\"/\"", "+", "N_ACCESSCONTROL_ENTRY", ";", "digester", ".", "addCallMethod", "(", "xp...
Adds the XML digester rules for resource access control entries.<p> @param digester the digester to add the rules to @param xpath the base xpath for the rules
[ "Adds", "the", "XML", "digester", "rules", "for", "resource", "access", "control", "entries", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion10.java#L3278-L3287
nakamura5akihito/six-util
src/main/java/jp/go/aist/six/util/core/xml/spring327/AbstractMarshaller.java
AbstractMarshaller.marshalStaxResult
protected void marshalStaxResult(Object graph, Result staxResult) throws XmlMappingException { XMLStreamWriter streamWriter = StaxUtils.getXMLStreamWriter(staxResult); if (streamWriter != null) { marshalXmlStreamWriter(graph, streamWriter); } else { XMLEventWriter eventWriter = StaxUtils.getXMLEventWriter(staxResult); if (eventWriter != null) { marshalXmlEventWriter(graph, eventWriter); } else { throw new IllegalArgumentException("StaxResult contains neither XMLStreamWriter nor XMLEventConsumer"); } } }
java
protected void marshalStaxResult(Object graph, Result staxResult) throws XmlMappingException { XMLStreamWriter streamWriter = StaxUtils.getXMLStreamWriter(staxResult); if (streamWriter != null) { marshalXmlStreamWriter(graph, streamWriter); } else { XMLEventWriter eventWriter = StaxUtils.getXMLEventWriter(staxResult); if (eventWriter != null) { marshalXmlEventWriter(graph, eventWriter); } else { throw new IllegalArgumentException("StaxResult contains neither XMLStreamWriter nor XMLEventConsumer"); } } }
[ "protected", "void", "marshalStaxResult", "(", "Object", "graph", ",", "Result", "staxResult", ")", "throws", "XmlMappingException", "{", "XMLStreamWriter", "streamWriter", "=", "StaxUtils", ".", "getXMLStreamWriter", "(", "staxResult", ")", ";", "if", "(", "streamW...
Template method for handling {@code StaxResult}s. <p>This implementation delegates to {@code marshalXMLSteamWriter} or {@code marshalXMLEventConsumer}, depending on what is contained in the {@code StaxResult}. @param graph the root of the object graph to marshal @param staxResult a Spring {@link org.springframework.util.xml.StaxSource} or JAXP 1.4 {@link StAXSource} @throws XmlMappingException if the given object cannot be marshalled to the result @throws IllegalArgumentException if the {@code domResult} is empty @see #marshalDomNode(Object, org.w3c.dom.Node)
[ "Template", "method", "for", "handling", "{" ]
train
https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/core/xml/spring327/AbstractMarshaller.java#L223-L237
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.firstIndex
public SDVariable firstIndex(String name, SDVariable in, Condition condition, int... dimensions) { return firstIndex(name, in, condition, false, dimensions); }
java
public SDVariable firstIndex(String name, SDVariable in, Condition condition, int... dimensions) { return firstIndex(name, in, condition, false, dimensions); }
[ "public", "SDVariable", "firstIndex", "(", "String", "name", ",", "SDVariable", "in", ",", "Condition", "condition", ",", "int", "...", "dimensions", ")", "{", "return", "firstIndex", "(", "name", ",", "in", ",", "condition", ",", "false", ",", "dimensions",...
First index reduction operation.<br> Returns a variable that contains the index of the first element that matches the specified condition (for each slice along the specified dimensions) @param name Name of the output variable @param in Input variable @param condition Condition to check on input variable @param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed @return Reduced array of rank (input rank - num dimensions)
[ "First", "index", "reduction", "operation", ".", "<br", ">", "Returns", "a", "variable", "that", "contains", "the", "index", "of", "the", "first", "element", "that", "matches", "the", "specified", "condition", "(", "for", "each", "slice", "along", "the", "sp...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1115-L1117
apache/incubator-heron
heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java
NIOLooper.removeInterest
private void removeInterest(SelectableChannel channel, int operation) { SelectionKey key = channel.keyFor(selector); // Exception would be thrown if key is null or key is inValid // We do not need double check it ahead key.interestOps(key.interestOps() & (~operation)); }
java
private void removeInterest(SelectableChannel channel, int operation) { SelectionKey key = channel.keyFor(selector); // Exception would be thrown if key is null or key is inValid // We do not need double check it ahead key.interestOps(key.interestOps() & (~operation)); }
[ "private", "void", "removeInterest", "(", "SelectableChannel", "channel", ",", "int", "operation", ")", "{", "SelectionKey", "key", "=", "channel", ".", "keyFor", "(", "selector", ")", ";", "// Exception would be thrown if key is null or key is inValid", "// We do not nee...
Remove one operation interest on a SelectableChannel. The SelectableChannel has to be registered with Selector ahead. Otherwise, NullPointerExceptions would throw The key for SelectableChannel has to be valid. Otherwise, InvalidValid Exception would throw. @param channel the SelectableChannel to remove operation interest @param operation the interest to remove
[ "Remove", "one", "operation", "interest", "on", "a", "SelectableChannel", ".", "The", "SelectableChannel", "has", "to", "be", "registered", "with", "Selector", "ahead", ".", "Otherwise", "NullPointerExceptions", "would", "throw", "The", "key", "for", "SelectableChan...
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java#L254-L260
JM-Lab/utils-java8
src/main/java/kr/jm/utils/datastructure/JMCollections.java
JMCollections.ifNotNullOrEmptyConsume
public static <T, C extends Collection<T>> void ifNotNullOrEmptyConsume(C collection, Consumer<C> consumer) { JMOptional.getOptional(collection).ifPresent(consumer); }
java
public static <T, C extends Collection<T>> void ifNotNullOrEmptyConsume(C collection, Consumer<C> consumer) { JMOptional.getOptional(collection).ifPresent(consumer); }
[ "public", "static", "<", "T", ",", "C", "extends", "Collection", "<", "T", ">", ">", "void", "ifNotNullOrEmptyConsume", "(", "C", "collection", ",", "Consumer", "<", "C", ">", "consumer", ")", "{", "JMOptional", ".", "getOptional", "(", "collection", ")", ...
If not null or empty consume. @param <T> the type parameter @param <C> the type parameter @param collection the collection @param consumer the consumer
[ "If", "not", "null", "or", "empty", "consume", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/datastructure/JMCollections.java#L31-L34
milaboratory/milib
src/main/java/com/milaboratory/primitivio/PrimitivIO.java
PrimitivIO.dummySerializer
public static <T> Serializer<T> dummySerializer() { return new Serializer<T>() { @Override public void write(PrimitivO output, T object) { throw new RuntimeException("Dummy serializer."); } @Override public T read(PrimitivI input) { throw new RuntimeException("Dummy serializer."); } @Override public boolean isReference() { return true; } @Override public boolean handlesReference() { return false; } }; }
java
public static <T> Serializer<T> dummySerializer() { return new Serializer<T>() { @Override public void write(PrimitivO output, T object) { throw new RuntimeException("Dummy serializer."); } @Override public T read(PrimitivI input) { throw new RuntimeException("Dummy serializer."); } @Override public boolean isReference() { return true; } @Override public boolean handlesReference() { return false; } }; }
[ "public", "static", "<", "T", ">", "Serializer", "<", "T", ">", "dummySerializer", "(", ")", "{", "return", "new", "Serializer", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "void", "write", "(", "PrimitivO", "output", ",", "T", "object", ...
Serializer that throws exception for any serialization. Use for known objects.
[ "Serializer", "that", "throws", "exception", "for", "any", "serialization", ".", "Use", "for", "known", "objects", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/primitivio/PrimitivIO.java#L25-L47
kiegroup/jbpm
jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/persistence/TaskSummaryQueryCriteriaUtil.java
TaskSummaryQueryCriteriaUtil.addUserRolesLimitCriteria
private void addUserRolesLimitCriteria( QueryWhere queryWhere, String userId, List<String> groupIds ) { List<QueryCriteria> newBaseCriteriaList = new ArrayList<QueryCriteria>(2); // user role limiting criteria QueryCriteria userRolesLimitingCriteria = new QueryCriteria( QueryParameterIdentifiers.TASK_USER_ROLES_LIMIT_LIST, false, QueryCriteriaType.NORMAL, 2); userRolesLimitingCriteria.setFirst(true); userRolesLimitingCriteria.getValues().add(userId); userRolesLimitingCriteria.getValues().add(groupIds); newBaseCriteriaList.add(userRolesLimitingCriteria); // original criteria list in a new group if( ! queryWhere.getCriteria().isEmpty() ) { QueryCriteria originalBaseCriteriaGroup = new QueryCriteria(false); originalBaseCriteriaGroup.setCriteria(queryWhere.getCriteria()); newBaseCriteriaList.add(originalBaseCriteriaGroup); } queryWhere.setCriteria(newBaseCriteriaList); }
java
private void addUserRolesLimitCriteria( QueryWhere queryWhere, String userId, List<String> groupIds ) { List<QueryCriteria> newBaseCriteriaList = new ArrayList<QueryCriteria>(2); // user role limiting criteria QueryCriteria userRolesLimitingCriteria = new QueryCriteria( QueryParameterIdentifiers.TASK_USER_ROLES_LIMIT_LIST, false, QueryCriteriaType.NORMAL, 2); userRolesLimitingCriteria.setFirst(true); userRolesLimitingCriteria.getValues().add(userId); userRolesLimitingCriteria.getValues().add(groupIds); newBaseCriteriaList.add(userRolesLimitingCriteria); // original criteria list in a new group if( ! queryWhere.getCriteria().isEmpty() ) { QueryCriteria originalBaseCriteriaGroup = new QueryCriteria(false); originalBaseCriteriaGroup.setCriteria(queryWhere.getCriteria()); newBaseCriteriaList.add(originalBaseCriteriaGroup); } queryWhere.setCriteria(newBaseCriteriaList); }
[ "private", "void", "addUserRolesLimitCriteria", "(", "QueryWhere", "queryWhere", ",", "String", "userId", ",", "List", "<", "String", ">", "groupIds", ")", "{", "List", "<", "QueryCriteria", ">", "newBaseCriteriaList", "=", "new", "ArrayList", "<", "QueryCriteria"...
Adds an (intersecting) {@link QueryCriteria} that limits the results to results that the user is allowed to see @param queryWhere The {@link QueryWhere} instance that defines the query criteria @param userId The user id @param groupIds The user's group ids
[ "Adds", "an", "(", "intersecting", ")", "{", "@link", "QueryCriteria", "}", "that", "limits", "the", "results", "to", "results", "that", "the", "user", "is", "allowed", "to", "see" ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/persistence/TaskSummaryQueryCriteriaUtil.java#L358-L380
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointDataPropertiesAxiomImpl_CustomFieldSerializer.java
OWLDisjointDataPropertiesAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDisjointDataPropertiesAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDisjointDataPropertiesAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLDisjointDataPropertiesAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", ...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointDataPropertiesAxiomImpl_CustomFieldSerializer.java#L95-L98
schallee/alib4j
core/src/main/java/net/darkmist/alib/io/Serializer.java
Serializer.deserializeFromStream
public static <T extends Serializable> T deserializeFromStream(InputStream in, Class<T> type) throws ClassNotFoundException, IOException { ObjectInputStream objIn; T obj; if(in instanceof ObjectInputStream) objIn = (ObjectInputStream)in; else objIn = new ObjectInputStream(in); obj = type.cast(objIn.readObject()); // to close or not to close... That is the question... // we close... It doesn't make too much sense to have a stream with more afterwards...There would be two // stream headers... objIn.close(); return obj; }
java
public static <T extends Serializable> T deserializeFromStream(InputStream in, Class<T> type) throws ClassNotFoundException, IOException { ObjectInputStream objIn; T obj; if(in instanceof ObjectInputStream) objIn = (ObjectInputStream)in; else objIn = new ObjectInputStream(in); obj = type.cast(objIn.readObject()); // to close or not to close... That is the question... // we close... It doesn't make too much sense to have a stream with more afterwards...There would be two // stream headers... objIn.close(); return obj; }
[ "public", "static", "<", "T", "extends", "Serializable", ">", "T", "deserializeFromStream", "(", "InputStream", "in", ",", "Class", "<", "T", ">", "type", ")", "throws", "ClassNotFoundException", ",", "IOException", "{", "ObjectInputStream", "objIn", ";", "T", ...
Read one serialized object from a input stream. @param in InputStream to read from. This will be closed! @param type The type that is to be read. @return The serialized object cast as type.
[ "Read", "one", "serialized", "object", "from", "a", "input", "stream", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/io/Serializer.java#L48-L64
andkulikov/Transitions-Everywhere
library(1.x)/src/main/java/com/transitionseverywhere/Transition.java
Transition.getTransitionValues
@Nullable public TransitionValues getTransitionValues(@NonNull View view, boolean start) { if (mParent != null) { return mParent.getTransitionValues(view, start); } TransitionValuesMaps valuesMaps = start ? mStartValues : mEndValues; return valuesMaps.viewValues.get(view); }
java
@Nullable public TransitionValues getTransitionValues(@NonNull View view, boolean start) { if (mParent != null) { return mParent.getTransitionValues(view, start); } TransitionValuesMaps valuesMaps = start ? mStartValues : mEndValues; return valuesMaps.viewValues.get(view); }
[ "@", "Nullable", "public", "TransitionValues", "getTransitionValues", "(", "@", "NonNull", "View", "view", ",", "boolean", "start", ")", "{", "if", "(", "mParent", "!=", "null", ")", "{", "return", "mParent", ".", "getTransitionValues", "(", "view", ",", "st...
This method can be called by transitions to get the TransitionValues for any particular view during the transition-playing process. This might be necessary, for example, to query the before/after state of related views for a given transition.
[ "This", "method", "can", "be", "called", "by", "transitions", "to", "get", "the", "TransitionValues", "for", "any", "particular", "view", "during", "the", "transition", "-", "playing", "process", ".", "This", "might", "be", "necessary", "for", "example", "to",...
train
https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/Transition.java#L1659-L1666
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/UserProperties.java
UserProperties.setProperties
public void setProperties(Map<String, Object> properties) { Record recUserRegistration = this.getUserRegistration(); ((PropertiesField)recUserRegistration.getField(UserRegistrationModel.PROPERTIES)).setProperties(properties); }
java
public void setProperties(Map<String, Object> properties) { Record recUserRegistration = this.getUserRegistration(); ((PropertiesField)recUserRegistration.getField(UserRegistrationModel.PROPERTIES)).setProperties(properties); }
[ "public", "void", "setProperties", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "Record", "recUserRegistration", "=", "this", ".", "getUserRegistration", "(", ")", ";", "(", "(", "PropertiesField", ")", "recUserRegistration", ".", "ge...
Set the properties. @param strProperties The properties to set.
[ "Set", "the", "properties", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/UserProperties.java#L197-L201
camunda/camunda-spin
core/src/main/java/org/camunda/spin/Spin.java
Spin.S
public static <T extends Spin<?>> T S(Object input, DataFormat<T> format) { return SpinFactory.INSTANCE.createSpin(input, format); }
java
public static <T extends Spin<?>> T S(Object input, DataFormat<T> format) { return SpinFactory.INSTANCE.createSpin(input, format); }
[ "public", "static", "<", "T", "extends", "Spin", "<", "?", ">", ">", "T", "S", "(", "Object", "input", ",", "DataFormat", "<", "T", ">", "format", ")", "{", "return", "SpinFactory", ".", "INSTANCE", ".", "createSpin", "(", "input", ",", "format", ")"...
Creates a spin wrapper for a data input of a given data format. @param input the input to wrap @param format the data format of the input @return the spin wrapper for the input @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null')
[ "Creates", "a", "spin", "wrapper", "for", "a", "data", "input", "of", "a", "given", "data", "format", "." ]
train
https://github.com/camunda/camunda-spin/blob/cfe65161eb97fd5023a945cb97c47fbfe69e9fdd/core/src/main/java/org/camunda/spin/Spin.java#L41-L43
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/context/CounterContext.java
CounterContext.createGlobal
public ByteBuffer createGlobal(CounterId id, long clock, long count) { ContextState state = ContextState.allocate(1, 0, 0); state.writeGlobal(id, clock, count); return state.context; }
java
public ByteBuffer createGlobal(CounterId id, long clock, long count) { ContextState state = ContextState.allocate(1, 0, 0); state.writeGlobal(id, clock, count); return state.context; }
[ "public", "ByteBuffer", "createGlobal", "(", "CounterId", "id", ",", "long", "clock", ",", "long", "count", ")", "{", "ContextState", "state", "=", "ContextState", ".", "allocate", "(", "1", ",", "0", ",", "0", ")", ";", "state", ".", "writeGlobal", "(",...
Creates a counter context with a single global, 2.1+ shard (a result of increment).
[ "Creates", "a", "counter", "context", "with", "a", "single", "global", "2", ".", "1", "+", "shard", "(", "a", "result", "of", "increment", ")", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/context/CounterContext.java#L105-L110
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java
DefaultElementProducer.loadTiff
@Override public void loadTiff(InputStream tiff, ImageProcessor imageProcessor, int... pages) throws VectorPrintException { File f = null; try { f = File.createTempFile("tiff.", "tiff"); f.deleteOnExit(); IOHelper.load(tiff, new FileOutputStream(f), ReportConstants.DEFAULTBUFFERSIZE, true); loadTiff(f, imageProcessor, pages); } catch (IOException ex) { throw new VectorPrintException(String.format("unable to load tiff"), ex); } finally { if (f != null) { f.delete(); } } }
java
@Override public void loadTiff(InputStream tiff, ImageProcessor imageProcessor, int... pages) throws VectorPrintException { File f = null; try { f = File.createTempFile("tiff.", "tiff"); f.deleteOnExit(); IOHelper.load(tiff, new FileOutputStream(f), ReportConstants.DEFAULTBUFFERSIZE, true); loadTiff(f, imageProcessor, pages); } catch (IOException ex) { throw new VectorPrintException(String.format("unable to load tiff"), ex); } finally { if (f != null) { f.delete(); } } }
[ "@", "Override", "public", "void", "loadTiff", "(", "InputStream", "tiff", ",", "ImageProcessor", "imageProcessor", ",", "int", "...", "pages", ")", "throws", "VectorPrintException", "{", "File", "f", "=", "null", ";", "try", "{", "f", "=", "File", ".", "c...
Creates tempfile and calls {@link loadTiff(File, ImageProcessor, int...) } @param tiff @param imageProcessor @param pages @throws VectorPrintException
[ "Creates", "tempfile", "and", "calls", "{", "@link", "loadTiff", "(", "File", "ImageProcessor", "int", "...", ")", "}" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L690-L705
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
ClassDocImpl.classToString
static String classToString(DocEnv env, ClassSymbol c, boolean full) { StringBuilder s = new StringBuilder(); if (!c.isInner()) { // if c is not an inner class s.append(getClassName(c, full)); } else { // c is an inner class, so include type params of outer. ClassSymbol encl = c.owner.enclClass(); s.append(classToString(env, encl, full)) .append('.') .append(c.name); } s.append(TypeMaker.typeParametersString(env, c, full)); return s.toString(); }
java
static String classToString(DocEnv env, ClassSymbol c, boolean full) { StringBuilder s = new StringBuilder(); if (!c.isInner()) { // if c is not an inner class s.append(getClassName(c, full)); } else { // c is an inner class, so include type params of outer. ClassSymbol encl = c.owner.enclClass(); s.append(classToString(env, encl, full)) .append('.') .append(c.name); } s.append(TypeMaker.typeParametersString(env, c, full)); return s.toString(); }
[ "static", "String", "classToString", "(", "DocEnv", "env", ",", "ClassSymbol", "c", ",", "boolean", "full", ")", "{", "StringBuilder", "s", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "!", "c", ".", "isInner", "(", ")", ")", "{", "// if c is...
Return the class name with any type parameters as a string. Each parameter is a type variable with optional bounds. If "full" is true all names are qualified, otherwise they are qualified by their enclosing class(es) only.
[ "Return", "the", "class", "name", "with", "any", "type", "parameters", "as", "a", "string", ".", "Each", "parameter", "is", "a", "type", "variable", "with", "optional", "bounds", ".", "If", "full", "is", "true", "all", "names", "are", "qualified", "otherwi...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L434-L447
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/WrapperBucket.java
WrapperBucket.removeByKey
public Element removeByKey(Object key, boolean dropRef) { Element element = (ivWrappers != null) ? ivWrappers.get(key) : null; if (element != null) { // Objects must either be unpinned, or pinned only once // (presumably by the caller) if ((!dropRef && element.pinned > 0) || (dropRef && element.pinned > 1)) { throw new IllegalOperationException(key, element.pinned); } remove(key); } return element; }
java
public Element removeByKey(Object key, boolean dropRef) { Element element = (ivWrappers != null) ? ivWrappers.get(key) : null; if (element != null) { // Objects must either be unpinned, or pinned only once // (presumably by the caller) if ((!dropRef && element.pinned > 0) || (dropRef && element.pinned > 1)) { throw new IllegalOperationException(key, element.pinned); } remove(key); } return element; }
[ "public", "Element", "removeByKey", "(", "Object", "key", ",", "boolean", "dropRef", ")", "{", "Element", "element", "=", "(", "ivWrappers", "!=", "null", ")", "?", "ivWrappers", ".", "get", "(", "key", ")", ":", "null", ";", "if", "(", "element", "!="...
Remove the object associated with the specified key from the bucket. Returns the Element holding the removed object. Optionally drops a reference on the object before removing it @param key key of the object element to be removed. @param dropRef true indicates a reference should be dropped @return the Element holding the removed object.
[ "Remove", "the", "object", "associated", "with", "the", "specified", "key", "from", "the", "bucket", ".", "Returns", "the", "Element", "holding", "the", "removed", "object", ".", "Optionally", "drops", "a", "reference", "on", "the", "object", "before", "removi...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/WrapperBucket.java#L210-L226
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/DateGroovyMethods.java
DateGroovyMethods.plus
public static Date plus(Date self, int days) { Calendar calendar = (Calendar) Calendar.getInstance().clone(); calendar.setTime(self); calendar.add(Calendar.DAY_OF_YEAR, days); return calendar.getTime(); }
java
public static Date plus(Date self, int days) { Calendar calendar = (Calendar) Calendar.getInstance().clone(); calendar.setTime(self); calendar.add(Calendar.DAY_OF_YEAR, days); return calendar.getTime(); }
[ "public", "static", "Date", "plus", "(", "Date", "self", ",", "int", "days", ")", "{", "Calendar", "calendar", "=", "(", "Calendar", ")", "Calendar", ".", "getInstance", "(", ")", ".", "clone", "(", ")", ";", "calendar", ".", "setTime", "(", "self", ...
Add a number of days to this date and returns the new date. @param self a Date @param days the number of days to increase @return the new date @since 1.0
[ "Add", "a", "number", "of", "days", "to", "this", "date", "and", "returns", "the", "new", "date", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DateGroovyMethods.java#L377-L382
javagl/CommonUI
src/main/java/de/javagl/common/ui/GuiUtils.java
GuiUtils.wrapTitled
public static JPanel wrapTitled(String title, JComponent component) { JPanel p = new JPanel(new GridLayout(1,1)); p.setBorder(BorderFactory.createTitledBorder(title)); p.add(component); return p; }
java
public static JPanel wrapTitled(String title, JComponent component) { JPanel p = new JPanel(new GridLayout(1,1)); p.setBorder(BorderFactory.createTitledBorder(title)); p.add(component); return p; }
[ "public", "static", "JPanel", "wrapTitled", "(", "String", "title", ",", "JComponent", "component", ")", "{", "JPanel", "p", "=", "new", "JPanel", "(", "new", "GridLayout", "(", "1", ",", "1", ")", ")", ";", "p", ".", "setBorder", "(", "BorderFactory", ...
Wrap the given component into a panel with a titled border with the given title @param title The title @param component The component @return The panel
[ "Wrap", "the", "given", "component", "into", "a", "panel", "with", "a", "titled", "border", "with", "the", "given", "title" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/GuiUtils.java#L72-L78
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ComponentAPI.java
ComponentAPI.api_get_authorizer_list
public static ApiGetAuthorizerListResult api_get_authorizer_list(String component_access_token, String component_appid, String offset, String count) { String postJsonData = String.format("{\"component_appid\":\"%1$s\",\"offset\":\"%2$s\",\"count\":\"%3$s\"}", component_appid, offset, count); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/cgi-bin/component/api_get_authorizer_list") .addParameter("component_access_token", API.componentAccessToken(component_access_token)) .setEntity(new StringEntity(postJsonData, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, ApiGetAuthorizerListResult.class); }
java
public static ApiGetAuthorizerListResult api_get_authorizer_list(String component_access_token, String component_appid, String offset, String count) { String postJsonData = String.format("{\"component_appid\":\"%1$s\",\"offset\":\"%2$s\",\"count\":\"%3$s\"}", component_appid, offset, count); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/cgi-bin/component/api_get_authorizer_list") .addParameter("component_access_token", API.componentAccessToken(component_access_token)) .setEntity(new StringEntity(postJsonData, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, ApiGetAuthorizerListResult.class); }
[ "public", "static", "ApiGetAuthorizerListResult", "api_get_authorizer_list", "(", "String", "component_access_token", ",", "String", "component_appid", ",", "String", "offset", ",", "String", "count", ")", "{", "String", "postJsonData", "=", "String", ".", "format", "...
拉取当前所有已授权的帐号基本信息 @param component_access_token component_access_token @param component_appid 第三方平台APPID @param offset 偏移位置/起始位置 @param count 拉取数量,最大为500 @return ApiGetAuthorizerListResult
[ "拉取当前所有已授权的帐号基本信息" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ComponentAPI.java#L293-L305
threerings/nenya
core/src/main/java/com/threerings/media/VirtualMediaPanel.java
VirtualMediaPanel.viewLocationDidChange
protected void viewLocationDidChange (int dx, int dy) { // inform our view trackers for (int ii = 0, ll = _trackers.size(); ii < ll; ii++) { _trackers.get(ii).viewLocationDidChange(dx, dy); } // pass the word on to our sprite/anim managers via the meta manager _metamgr.viewLocationDidChange(dx, dy); }
java
protected void viewLocationDidChange (int dx, int dy) { // inform our view trackers for (int ii = 0, ll = _trackers.size(); ii < ll; ii++) { _trackers.get(ii).viewLocationDidChange(dx, dy); } // pass the word on to our sprite/anim managers via the meta manager _metamgr.viewLocationDidChange(dx, dy); }
[ "protected", "void", "viewLocationDidChange", "(", "int", "dx", ",", "int", "dy", ")", "{", "// inform our view trackers", "for", "(", "int", "ii", "=", "0", ",", "ll", "=", "_trackers", ".", "size", "(", ")", ";", "ii", "<", "ll", ";", "ii", "++", "...
Called during our tick when we have adjusted the view location. The {@link #_vbounds} will already have been updated to reflect our new view coordinates. @param dx the delta scrolled in the x direction (in pixels). @param dy the delta scrolled in the y direction (in pixels).
[ "Called", "during", "our", "tick", "when", "we", "have", "adjusted", "the", "view", "location", ".", "The", "{", "@link", "#_vbounds", "}", "will", "already", "have", "been", "updated", "to", "reflect", "our", "new", "view", "coordinates", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/VirtualMediaPanel.java#L294-L303
UrielCh/ovh-java-sdk
ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java
ApiOvhHorizonView.serviceName_accessPoint_accessPointId_disableTwoFA_POST
public OvhTask serviceName_accessPoint_accessPointId_disableTwoFA_POST(String serviceName, Long accessPointId) throws IOException { String qPath = "/horizonView/{serviceName}/accessPoint/{accessPointId}/disableTwoFA"; StringBuilder sb = path(qPath, serviceName, accessPointId); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_accessPoint_accessPointId_disableTwoFA_POST(String serviceName, Long accessPointId) throws IOException { String qPath = "/horizonView/{serviceName}/accessPoint/{accessPointId}/disableTwoFA"; StringBuilder sb = path(qPath, serviceName, accessPointId); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_accessPoint_accessPointId_disableTwoFA_POST", "(", "String", "serviceName", ",", "Long", "accessPointId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/horizonView/{serviceName}/accessPoint/{accessPointId}/disableTwoFA\"", ";", "...
Disable two factor authentication on your pool REST: POST /horizonView/{serviceName}/accessPoint/{accessPointId}/disableTwoFA @param serviceName [required] Domain of the service @param accessPointId [required] Pool id
[ "Disable", "two", "factor", "authentication", "on", "your", "pool" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L74-L79
kiswanij/jk-util
src/main/java/com/jk/util/JKFormatUtil.java
JKFormatUtil.formatDate
public synchronized static String formatDate(final java.util.Date object, String pattern) { if (pattern == null || pattern.equals("")) { pattern = JKFormatUtil.DEFAULT_DATE_PATTERN; } return JKFormatUtil.getDateFormatter(pattern).format(object); }
java
public synchronized static String formatDate(final java.util.Date object, String pattern) { if (pattern == null || pattern.equals("")) { pattern = JKFormatUtil.DEFAULT_DATE_PATTERN; } return JKFormatUtil.getDateFormatter(pattern).format(object); }
[ "public", "synchronized", "static", "String", "formatDate", "(", "final", "java", ".", "util", ".", "Date", "object", ",", "String", "pattern", ")", "{", "if", "(", "pattern", "==", "null", "||", "pattern", ".", "equals", "(", "\"\"", ")", ")", "{", "p...
Format date. @param object the object @param pattern the pattern @return the string
[ "Format", "date", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKFormatUtil.java#L96-L101
ontop/ontop
core/model/src/main/java/it/unibz/inf/ontop/substitution/impl/IndempotentVar2VarSubstitutionImpl.java
IndempotentVar2VarSubstitutionImpl.isIndempotent
public static boolean isIndempotent(Map<Variable, Variable> substitutionMap) { if (substitutionMap.isEmpty()) return true; Set<Variable> valueSet = new HashSet<>(substitutionMap.values()); valueSet.retainAll(substitutionMap.entrySet()); return valueSet.isEmpty(); }
java
public static boolean isIndempotent(Map<Variable, Variable> substitutionMap) { if (substitutionMap.isEmpty()) return true; Set<Variable> valueSet = new HashSet<>(substitutionMap.values()); valueSet.retainAll(substitutionMap.entrySet()); return valueSet.isEmpty(); }
[ "public", "static", "boolean", "isIndempotent", "(", "Map", "<", "Variable", ",", "Variable", ">", "substitutionMap", ")", "{", "if", "(", "substitutionMap", ".", "isEmpty", "(", ")", ")", "return", "true", ";", "Set", "<", "Variable", ">", "valueSet", "="...
Returns true if there is common variables in the domain and the range of the substitution map.
[ "Returns", "true", "if", "there", "is", "common", "variables", "in", "the", "domain", "and", "the", "range", "of", "the", "substitution", "map", "." ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/substitution/impl/IndempotentVar2VarSubstitutionImpl.java#L29-L37
uber/AutoDispose
lifecycle/autodispose-lifecycle/src/main/java/com/uber/autodispose/lifecycle/LifecycleScopes.java
LifecycleScopes.resolveScopeFromLifecycle
public static <E> CompletableSource resolveScopeFromLifecycle( final LifecycleScopeProvider<E> provider) throws OutsideScopeException { return resolveScopeFromLifecycle(provider, true); }
java
public static <E> CompletableSource resolveScopeFromLifecycle( final LifecycleScopeProvider<E> provider) throws OutsideScopeException { return resolveScopeFromLifecycle(provider, true); }
[ "public", "static", "<", "E", ">", "CompletableSource", "resolveScopeFromLifecycle", "(", "final", "LifecycleScopeProvider", "<", "E", ">", "provider", ")", "throws", "OutsideScopeException", "{", "return", "resolveScopeFromLifecycle", "(", "provider", ",", "true", ")...
Overload for resolving lifecycle providers that defaults to checking start and end boundaries of lifecycles. That is, they will ensure that the lifecycle has both started and not ended. <p><em>Note:</em> This resolves the scope immediately, so consider deferring execution as needed, such as using {@link Completable#defer(Callable) defer}. @param provider the {@link LifecycleScopeProvider} to resolve. @param <E> the lifecycle event type @return a resolved {@link CompletableSource} representation of a given provider @throws OutsideScopeException if the {@link LifecycleScopeProvider#correspondingEvents()} throws an {@link OutsideScopeException} during resolution.
[ "Overload", "for", "resolving", "lifecycle", "providers", "that", "defaults", "to", "checking", "start", "and", "end", "boundaries", "of", "lifecycles", ".", "That", "is", "they", "will", "ensure", "that", "the", "lifecycle", "has", "both", "started", "and", "...
train
https://github.com/uber/AutoDispose/blob/1115b0274f7960354289bb3ae7ba75b0c5a47457/lifecycle/autodispose-lifecycle/src/main/java/com/uber/autodispose/lifecycle/LifecycleScopes.java#L54-L57
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/locking/AbstractTxLockingInterceptor.java
AbstractTxLockingInterceptor.lockAllOrRegisterBackupLock
final KeyAwareLockPromise lockAllOrRegisterBackupLock(TxInvocationContext<?> ctx, Collection<?> keys, long lockTimeout) throws InterruptedException { if (keys.isEmpty()) { return KeyAwareLockPromise.NO_OP; } final Log log = getLog(); Collection<Object> keysToLock = new ArrayList<>(keys.size()); LocalizedCacheTopology cacheTopology = cdl.getCacheTopology(); for (Object key : keys) { switch (cacheTopology.getDistribution(key).writeOwnership()) { case PRIMARY: if (trace) { log.tracef("Acquiring locks on %s.", toStr(key)); } keysToLock.add(key); break; case BACKUP: if (trace) { log.tracef("Acquiring backup locks on %s.", toStr(key)); } ctx.getCacheTransaction().addBackupLockForKey(key); break; default: break; } } if (keysToLock.isEmpty()) { return KeyAwareLockPromise.NO_OP; } return checkPendingAndLockAllKeys(ctx, keysToLock, lockTimeout); }
java
final KeyAwareLockPromise lockAllOrRegisterBackupLock(TxInvocationContext<?> ctx, Collection<?> keys, long lockTimeout) throws InterruptedException { if (keys.isEmpty()) { return KeyAwareLockPromise.NO_OP; } final Log log = getLog(); Collection<Object> keysToLock = new ArrayList<>(keys.size()); LocalizedCacheTopology cacheTopology = cdl.getCacheTopology(); for (Object key : keys) { switch (cacheTopology.getDistribution(key).writeOwnership()) { case PRIMARY: if (trace) { log.tracef("Acquiring locks on %s.", toStr(key)); } keysToLock.add(key); break; case BACKUP: if (trace) { log.tracef("Acquiring backup locks on %s.", toStr(key)); } ctx.getCacheTransaction().addBackupLockForKey(key); break; default: break; } } if (keysToLock.isEmpty()) { return KeyAwareLockPromise.NO_OP; } return checkPendingAndLockAllKeys(ctx, keysToLock, lockTimeout); }
[ "final", "KeyAwareLockPromise", "lockAllOrRegisterBackupLock", "(", "TxInvocationContext", "<", "?", ">", "ctx", ",", "Collection", "<", "?", ">", "keys", ",", "long", "lockTimeout", ")", "throws", "InterruptedException", "{", "if", "(", "keys", ".", "isEmpty", ...
Same as {@link #lockOrRegisterBackupLock(TxInvocationContext, Object, long)} @return a collection with the keys locked.
[ "Same", "as", "{", "@link", "#lockOrRegisterBackupLock", "(", "TxInvocationContext", "Object", "long", ")", "}" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/locking/AbstractTxLockingInterceptor.java#L89-L123
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.verifyAsync
public ServiceFuture<KeyVerifyResult> verifyAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeySignatureAlgorithm algorithm, byte[] digest, byte[] signature, final ServiceCallback<KeyVerifyResult> serviceCallback) { return ServiceFuture.fromResponse(verifyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, digest, signature), serviceCallback); }
java
public ServiceFuture<KeyVerifyResult> verifyAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeySignatureAlgorithm algorithm, byte[] digest, byte[] signature, final ServiceCallback<KeyVerifyResult> serviceCallback) { return ServiceFuture.fromResponse(verifyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, digest, signature), serviceCallback); }
[ "public", "ServiceFuture", "<", "KeyVerifyResult", ">", "verifyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ",", "JsonWebKeySignatureAlgorithm", "algorithm", ",", "byte", "[", "]", "digest", ",", "byte", "[", "]", ...
Verifies a signature using a specified key. The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly necessary for asymmetric keys stored in Azure Key Vault since signature verification can be performed using the public portion of the key but this operation is supported as a convenience for callers that only have a key-reference and not the public portion of the key. This operation requires the keys/verify permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the key. @param keyVersion The version of the key. @param algorithm The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' @param digest The digest used for signing. @param signature The signature to be verified. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Verifies", "a", "signature", "using", "a", "specified", "key", ".", "The", "VERIFY", "operation", "is", "applicable", "to", "symmetric", "keys", "stored", "in", "Azure", "Key", "Vault", ".", "VERIFY", "is", "not", "strictly", "necessary", "for", "asymmetric",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2501-L2503
looly/hutool
hutool-aop/src/main/java/cn/hutool/aop/proxy/ProxyFactory.java
ProxyFactory.createProxy
public static <T> T createProxy(T target, Aspect aspect) { return create().proxy(target, aspect); }
java
public static <T> T createProxy(T target, Aspect aspect) { return create().proxy(target, aspect); }
[ "public", "static", "<", "T", ">", "T", "createProxy", "(", "T", "target", ",", "Aspect", "aspect", ")", "{", "return", "create", "(", ")", ".", "proxy", "(", "target", ",", "aspect", ")", ";", "}" ]
根据用户引入Cglib与否自动创建代理对象 @param <T> 切面对象类型 @param target 被代理对象 @param aspect 切面实现 @return 代理对象
[ "根据用户引入Cglib与否自动创建代理对象" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-aop/src/main/java/cn/hutool/aop/proxy/ProxyFactory.java#L44-L46
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/math/interpolation/splines/ControlCurve.java
ControlCurve.selectPoint
public int selectPoint( double x, double y ) { double mind = Double.POSITIVE_INFINITY; selection = -1; for( int i = 0; i < pts.size(); i++ ) { Coordinate coordinate = pts.get(i); double d = sqr(coordinate.x - x) + sqr(coordinate.y - y); if (d < mind && d < EPSILON) { mind = d; selection = i; } } return selection; }
java
public int selectPoint( double x, double y ) { double mind = Double.POSITIVE_INFINITY; selection = -1; for( int i = 0; i < pts.size(); i++ ) { Coordinate coordinate = pts.get(i); double d = sqr(coordinate.x - x) + sqr(coordinate.y - y); if (d < mind && d < EPSILON) { mind = d; selection = i; } } return selection; }
[ "public", "int", "selectPoint", "(", "double", "x", ",", "double", "y", ")", "{", "double", "mind", "=", "Double", ".", "POSITIVE_INFINITY", ";", "selection", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pts", ".", "size", ...
return index of control point near to (x,y) or -1 if nothing near
[ "return", "index", "of", "control", "point", "near", "to", "(", "x", "y", ")", "or", "-", "1", "if", "nothing", "near" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/math/interpolation/splines/ControlCurve.java#L44-L57
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.createView
public JenkinsServer createView(String viewName, String viewXml) throws IOException { return createView(null, viewName, viewXml, false); }
java
public JenkinsServer createView(String viewName, String viewXml) throws IOException { return createView(null, viewName, viewXml, false); }
[ "public", "JenkinsServer", "createView", "(", "String", "viewName", ",", "String", "viewXml", ")", "throws", "IOException", "{", "return", "createView", "(", "null", ",", "viewName", ",", "viewXml", ",", "false", ")", ";", "}" ]
Create a view on the server using the provided xml @param viewName name of the view to be created. @param viewXml The configuration for the view. @throws IOException in case of an error.
[ "Create", "a", "view", "on", "the", "server", "using", "the", "provided", "xml" ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L401-L403
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Block.java
Block.addTransaction
void addTransaction(Transaction t, boolean runSanityChecks) { unCacheTransactions(); if (transactions == null) { transactions = new ArrayList<>(); } t.setParent(this); if (runSanityChecks && transactions.size() == 0 && !t.isCoinBase()) throw new RuntimeException("Attempted to add a non-coinbase transaction as the first transaction: " + t); else if (runSanityChecks && transactions.size() > 0 && t.isCoinBase()) throw new RuntimeException("Attempted to add a coinbase transaction when there already is one: " + t); transactions.add(t); adjustLength(transactions.size(), t.length); // Force a recalculation next time the values are needed. merkleRoot = null; hash = null; }
java
void addTransaction(Transaction t, boolean runSanityChecks) { unCacheTransactions(); if (transactions == null) { transactions = new ArrayList<>(); } t.setParent(this); if (runSanityChecks && transactions.size() == 0 && !t.isCoinBase()) throw new RuntimeException("Attempted to add a non-coinbase transaction as the first transaction: " + t); else if (runSanityChecks && transactions.size() > 0 && t.isCoinBase()) throw new RuntimeException("Attempted to add a coinbase transaction when there already is one: " + t); transactions.add(t); adjustLength(transactions.size(), t.length); // Force a recalculation next time the values are needed. merkleRoot = null; hash = null; }
[ "void", "addTransaction", "(", "Transaction", "t", ",", "boolean", "runSanityChecks", ")", "{", "unCacheTransactions", "(", ")", ";", "if", "(", "transactions", "==", "null", ")", "{", "transactions", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "t",...
Adds a transaction to this block, with or without checking the sanity of doing so
[ "Adds", "a", "transaction", "to", "this", "block", "with", "or", "without", "checking", "the", "sanity", "of", "doing", "so" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Block.java#L803-L818
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readAssignment
private void readAssignment(Resource resource, Assignment assignment) { Task task = m_activityMap.get(assignment.getActivity()); if (task != null) { task.addResourceAssignment(resource); } }
java
private void readAssignment(Resource resource, Assignment assignment) { Task task = m_activityMap.get(assignment.getActivity()); if (task != null) { task.addResourceAssignment(resource); } }
[ "private", "void", "readAssignment", "(", "Resource", "resource", ",", "Assignment", "assignment", ")", "{", "Task", "task", "=", "m_activityMap", ".", "get", "(", "assignment", ".", "getActivity", "(", ")", ")", ";", "if", "(", "task", "!=", "null", ")", ...
Read a single resource assignment. @param resource MPXJ resource @param assignment Phoenix assignment
[ "Read", "a", "single", "resource", "assignment", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L645-L652
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/SimpleScheduleBuilder.java
SimpleScheduleBuilder.repeatSecondlyForTotalCount
@Nonnull public static SimpleScheduleBuilder repeatSecondlyForTotalCount (final int nCount, final int nSeconds) { ValueEnforcer.isGT0 (nCount, "Count"); return simpleSchedule ().withIntervalInSeconds (nSeconds).withRepeatCount (nCount - 1); }
java
@Nonnull public static SimpleScheduleBuilder repeatSecondlyForTotalCount (final int nCount, final int nSeconds) { ValueEnforcer.isGT0 (nCount, "Count"); return simpleSchedule ().withIntervalInSeconds (nSeconds).withRepeatCount (nCount - 1); }
[ "@", "Nonnull", "public", "static", "SimpleScheduleBuilder", "repeatSecondlyForTotalCount", "(", "final", "int", "nCount", ",", "final", "int", "nSeconds", ")", "{", "ValueEnforcer", ".", "isGT0", "(", "nCount", ",", "\"Count\"", ")", ";", "return", "simpleSchedul...
Create a SimpleScheduleBuilder set to repeat the given number of times - 1 with an interval of the given number of seconds. <p> Note: Total count = 1 (at start time) + repeat count </p> @return the new SimpleScheduleBuilder
[ "Create", "a", "SimpleScheduleBuilder", "set", "to", "repeat", "the", "given", "number", "of", "times", "-", "1", "with", "an", "interval", "of", "the", "given", "number", "of", "seconds", ".", "<p", ">", "Note", ":", "Total", "count", "=", "1", "(", "...
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/SimpleScheduleBuilder.java#L204-L209
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/complex/CmsDataViewClientWidget.java
CmsDataViewClientWidget.handleResult
public static void handleResult(String json) { JSONObject jsonObj = JSONParser.parseLenient(json).isObject(); JSONArray results = jsonObj.get(CmsDataViewConstants.KEY_RESULT).isArray(); String accessorId = jsonObj.get(CmsDataViewConstants.ACCESSOR).isString().stringValue(); CmsDataViewValueAccessor accessor = accessors.get(accessorId); List<CmsDataViewValue> values = Lists.newArrayList(); for (int i = 0; i < results.size(); i++) { JSONObject singleResult = results.get(i).isObject(); String id = singleResult.get(CmsDataViewConstants.FIELD_ID).isString().stringValue(); String title = singleResult.get(CmsDataViewConstants.FIELD_TITLE).isString().stringValue(); String description = singleResult.get(CmsDataViewConstants.FIELD_DESCRIPTION).isString().stringValue(); String data = singleResult.get(CmsDataViewConstants.FIELD_DATA).isString().stringValue(); CmsDataViewValue value = new CmsDataViewValue(id, title, description, data); values.add(value); } accessor.replaceValue(values); }
java
public static void handleResult(String json) { JSONObject jsonObj = JSONParser.parseLenient(json).isObject(); JSONArray results = jsonObj.get(CmsDataViewConstants.KEY_RESULT).isArray(); String accessorId = jsonObj.get(CmsDataViewConstants.ACCESSOR).isString().stringValue(); CmsDataViewValueAccessor accessor = accessors.get(accessorId); List<CmsDataViewValue> values = Lists.newArrayList(); for (int i = 0; i < results.size(); i++) { JSONObject singleResult = results.get(i).isObject(); String id = singleResult.get(CmsDataViewConstants.FIELD_ID).isString().stringValue(); String title = singleResult.get(CmsDataViewConstants.FIELD_TITLE).isString().stringValue(); String description = singleResult.get(CmsDataViewConstants.FIELD_DESCRIPTION).isString().stringValue(); String data = singleResult.get(CmsDataViewConstants.FIELD_DATA).isString().stringValue(); CmsDataViewValue value = new CmsDataViewValue(id, title, description, data); values.add(value); } accessor.replaceValue(values); }
[ "public", "static", "void", "handleResult", "(", "String", "json", ")", "{", "JSONObject", "jsonObj", "=", "JSONParser", ".", "parseLenient", "(", "json", ")", ".", "isObject", "(", ")", ";", "JSONArray", "results", "=", "jsonObj", ".", "get", "(", "CmsDat...
Handles the JSON results returned by the embedded Vaadin dialog.<p> @param json the JSON results
[ "Handles", "the", "JSON", "results", "returned", "by", "the", "embedded", "Vaadin", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/complex/CmsDataViewClientWidget.java#L148-L165
vakinge/jeesuite-libs
jeesuite-common/src/main/java/com/jeesuite/common/util/DateUtils.java
DateUtils.parseDate
public static Date parseDate(String dateStr, String pattern) { try { SimpleDateFormat format = null; if (StringUtils.isBlank(dateStr)) return null; if (StringUtils.isNotBlank(pattern)) { format = new SimpleDateFormat(pattern); return format.parse(dateStr); } return parseDate(dateStr); } catch (Exception e) { throw new RuntimeException("无法解析日期字符[" + dateStr + "]"); } }
java
public static Date parseDate(String dateStr, String pattern) { try { SimpleDateFormat format = null; if (StringUtils.isBlank(dateStr)) return null; if (StringUtils.isNotBlank(pattern)) { format = new SimpleDateFormat(pattern); return format.parse(dateStr); } return parseDate(dateStr); } catch (Exception e) { throw new RuntimeException("无法解析日期字符[" + dateStr + "]"); } }
[ "public", "static", "Date", "parseDate", "(", "String", "dateStr", ",", "String", "pattern", ")", "{", "try", "{", "SimpleDateFormat", "format", "=", "null", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "dateStr", ")", ")", "return", "null", ";", ...
解析日期字符串转化成日期格式<br> generate by: vakin jiang at 2012-3-1 @param dateStr @param pattern @return
[ "解析日期字符串转化成日期格式<br", ">", "generate", "by", ":", "vakin", "jiang", "at", "2012", "-", "3", "-", "1" ]
train
https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-common/src/main/java/com/jeesuite/common/util/DateUtils.java#L81-L94
berkesa/datatree
src/main/java/io/datatree/Tree.java
Tree.putObject
public Tree putObject(String path, Object value) { return putObjectInternal(path, getNodeValue(value), false); }
java
public Tree putObject(String path, Object value) { return putObjectInternal(path, getNodeValue(value), false); }
[ "public", "Tree", "putObject", "(", "String", "path", ",", "Object", "value", ")", "{", "return", "putObjectInternal", "(", "path", ",", "getNodeValue", "(", "value", ")", ",", "false", ")", ";", "}" ]
Puts a node with the specified value into the specified path. @param path path (e.g. "path.to.node[0]") @param value the new value @return container node
[ "Puts", "a", "node", "with", "the", "specified", "value", "into", "the", "specified", "path", "." ]
train
https://github.com/berkesa/datatree/blob/79aea9b45c7b46ab28af0a09310bc01c421c6b3a/src/main/java/io/datatree/Tree.java#L2140-L2142
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java
OLAPService.getDuplicateIDs
public SearchResultList getDuplicateIDs(ApplicationDefinition appDef, String table, String range) { checkServiceState(); return m_olap.getDuplicateIDs(appDef, table, range); }
java
public SearchResultList getDuplicateIDs(ApplicationDefinition appDef, String table, String range) { checkServiceState(); return m_olap.getDuplicateIDs(appDef, table, range); }
[ "public", "SearchResultList", "getDuplicateIDs", "(", "ApplicationDefinition", "appDef", ",", "String", "table", ",", "String", "range", ")", "{", "checkServiceState", "(", ")", ";", "return", "m_olap", ".", "getDuplicateIDs", "(", "appDef", ",", "table", ",", "...
Search for and return duplicate object IDs for the given OLAP application and table across the given shard range. The given shard range must be in the form of: <pre> <i>from-shard</i>[,<i>to-shard</i>] </pre> All shards whose name is greater than or equal to <i>from-shard</i> are searched. If <i>to-shard</i> is given, shard searched will also be only those whose name is less than or equal to it. @param application OLAP application name. @param table Table name belonging to application. @param range From shard name, optionally followed by to shard name. @return List of object IDs in more than one shard within the given range, returned as a {@link SearchResultList}.
[ "Search", "for", "and", "return", "duplicate", "object", "IDs", "for", "the", "given", "OLAP", "application", "and", "table", "across", "the", "given", "shard", "range", ".", "The", "given", "shard", "range", "must", "be", "in", "the", "form", "of", ":", ...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L381-L384
kirgor/enklib
common/src/main/java/com/kirgor/enklib/common/ConfigUtils.java
ConfigUtils.loadFromXMLStream
public static <T> T loadFromXMLStream(Class<T> configClass, InputStream inputStream) throws Exception { Persister persister = new Persister(); return persister.read(configClass, inputStream); }
java
public static <T> T loadFromXMLStream(Class<T> configClass, InputStream inputStream) throws Exception { Persister persister = new Persister(); return persister.read(configClass, inputStream); }
[ "public", "static", "<", "T", ">", "T", "loadFromXMLStream", "(", "Class", "<", "T", ">", "configClass", ",", "InputStream", "inputStream", ")", "throws", "Exception", "{", "Persister", "persister", "=", "new", "Persister", "(", ")", ";", "return", "persiste...
Loads config values from {@link InputStream}, which is supposed to be XML stream, maps them to configuration class fields and returns the result instance. @param configClass Class, which fields will be mapped to config values. @param inputStream Where to load the config from. @param <T> Generic type of configClass @return Instance of configClass with field values loaded from config file. @throws Exception
[ "Loads", "config", "values", "from", "{", "@link", "InputStream", "}", "which", "is", "supposed", "to", "be", "XML", "stream", "maps", "them", "to", "configuration", "class", "fields", "and", "returns", "the", "result", "instance", "." ]
train
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/common/src/main/java/com/kirgor/enklib/common/ConfigUtils.java#L86-L89
helun/Ektorp
org.ektorp/src/main/java/org/ektorp/PurgeResult.java
PurgeResult.setAnonymous
@JsonAnySetter public void setAnonymous(String key, Object value) { anonymous().put(key, value); }
java
@JsonAnySetter public void setAnonymous(String key, Object value) { anonymous().put(key, value); }
[ "@", "JsonAnySetter", "public", "void", "setAnonymous", "(", "String", "key", ",", "Object", "value", ")", "{", "anonymous", "(", ")", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Exists in order to future proof this class. @param key @param value
[ "Exists", "in", "order", "to", "future", "proof", "this", "class", "." ]
train
https://github.com/helun/Ektorp/blob/b822c0d656aefb90a5e0cb5ec2de3daa969e3eaa/org.ektorp/src/main/java/org/ektorp/PurgeResult.java#L44-L47
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.addHierarchicalEntity
public UUID addHierarchicalEntity(UUID appId, String versionId, HierarchicalEntityModel hierarchicalModelCreateObject) { return addHierarchicalEntityWithServiceResponseAsync(appId, versionId, hierarchicalModelCreateObject).toBlocking().single().body(); }
java
public UUID addHierarchicalEntity(UUID appId, String versionId, HierarchicalEntityModel hierarchicalModelCreateObject) { return addHierarchicalEntityWithServiceResponseAsync(appId, versionId, hierarchicalModelCreateObject).toBlocking().single().body(); }
[ "public", "UUID", "addHierarchicalEntity", "(", "UUID", "appId", ",", "String", "versionId", ",", "HierarchicalEntityModel", "hierarchicalModelCreateObject", ")", "{", "return", "addHierarchicalEntityWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "hierarchi...
Adds a hierarchical entity extractor to the application version. @param appId The application ID. @param versionId The version ID. @param hierarchicalModelCreateObject A model containing the name and children of the new entity extractor. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the UUID object if successful.
[ "Adds", "a", "hierarchical", "entity", "extractor", "to", "the", "application", "version", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1280-L1282
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setListConfigs
public Config setListConfigs(Map<String, ListConfig> listConfigs) { this.listConfigs.clear(); this.listConfigs.putAll(listConfigs); for (Entry<String, ListConfig> entry : listConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public Config setListConfigs(Map<String, ListConfig> listConfigs) { this.listConfigs.clear(); this.listConfigs.putAll(listConfigs); for (Entry<String, ListConfig> entry : listConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "Config", "setListConfigs", "(", "Map", "<", "String", ",", "ListConfig", ">", "listConfigs", ")", "{", "this", ".", "listConfigs", ".", "clear", "(", ")", ";", "this", ".", "listConfigs", ".", "putAll", "(", "listConfigs", ")", ";", "for", "("...
Sets the map of {@link com.hazelcast.core.IList} configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param listConfigs the list configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "IList", "}", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "wi...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L902-L909
Nexmo/nexmo-java
src/main/java/com/nexmo/client/auth/AuthCollection.java
AuthCollection.getAcceptableAuthMethod
public AuthMethod getAcceptableAuthMethod(Set<Class> acceptableAuthMethodClasses) throws NexmoUnacceptableAuthException { for (AuthMethod availableAuthMethod : this.authList) { if (acceptableAuthMethodClasses.contains(availableAuthMethod.getClass())) { return availableAuthMethod; } } throw new NexmoUnacceptableAuthException(this.authList, acceptableAuthMethodClasses); }
java
public AuthMethod getAcceptableAuthMethod(Set<Class> acceptableAuthMethodClasses) throws NexmoUnacceptableAuthException { for (AuthMethod availableAuthMethod : this.authList) { if (acceptableAuthMethodClasses.contains(availableAuthMethod.getClass())) { return availableAuthMethod; } } throw new NexmoUnacceptableAuthException(this.authList, acceptableAuthMethodClasses); }
[ "public", "AuthMethod", "getAcceptableAuthMethod", "(", "Set", "<", "Class", ">", "acceptableAuthMethodClasses", ")", "throws", "NexmoUnacceptableAuthException", "{", "for", "(", "AuthMethod", "availableAuthMethod", ":", "this", ".", "authList", ")", "{", "if", "(", ...
Obtain an {@link AuthMethod} instance for a set of acceptable AuthMethod classes. @param acceptableAuthMethodClasses A Set of AuthMethod classes which are suitable for the target REST endpoint. @return the preferred AuthMethod from the provided set of acceptable AuthMethod classes @throws NexmoUnacceptableAuthException if no appropriate AuthMethod is held by this AuthCollection
[ "Obtain", "an", "{", "@link", "AuthMethod", "}", "instance", "for", "a", "set", "of", "acceptable", "AuthMethod", "classes", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/auth/AuthCollection.java#L90-L97
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/util/Utils.java
Utils.containsBuildCase
public static boolean containsBuildCase(final Annotation anno, final BuildCase buildCase) { Objects.requireNonNull(anno); Objects.requireNonNull(buildCase); final Optional<BuildCase[]> attrCases = getAnnotationAttribute(anno, "cases", BuildCase[].class); if(attrCases.isPresent()) { final BuildCase[] casesValue = attrCases.get(); if(casesValue.length == 0) { // 値が空の配列の場合 return true; } for(BuildCase value : casesValue) { if(value == buildCase) { return true; } } return false; } // 属性を持たない場合 return true; }
java
public static boolean containsBuildCase(final Annotation anno, final BuildCase buildCase) { Objects.requireNonNull(anno); Objects.requireNonNull(buildCase); final Optional<BuildCase[]> attrCases = getAnnotationAttribute(anno, "cases", BuildCase[].class); if(attrCases.isPresent()) { final BuildCase[] casesValue = attrCases.get(); if(casesValue.length == 0) { // 値が空の配列の場合 return true; } for(BuildCase value : casesValue) { if(value == buildCase) { return true; } } return false; } // 属性を持たない場合 return true; }
[ "public", "static", "boolean", "containsBuildCase", "(", "final", "Annotation", "anno", ",", "final", "BuildCase", "buildCase", ")", "{", "Objects", ".", "requireNonNull", "(", "anno", ")", ";", "Objects", ".", "requireNonNull", "(", "buildCase", ")", ";", "fi...
アノテーションの属性「cases」を持つ場合、指定した種類を持つか判定する。 <p>属性「buildCase」を持たない場合、または、空の配列の場合は、必ずtrueを返します。</p> @param anno 判定対象のアノテーション。 @param buildCase 組み立てる種類。 @return trueの場合、指定した種類を含みます。 @throws NullPointerException anno or buildCase is null.
[ "アノテーションの属性「cases」を持つ場合、指定した種類を持つか判定する。", "<p", ">", "属性「buildCase」を持たない場合、または、空の配列の場合は、必ずtrueを返します。<", "/", "p", ">" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/util/Utils.java#L180-L204
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/document/json/JsonObject.java
JsonObject.putAndEncrypt
public JsonObject putAndEncrypt(String name, int value, String providerName) { addValueEncryptionInfo(name, providerName, true); content.put(name, value); return this; }
java
public JsonObject putAndEncrypt(String name, int value, String providerName) { addValueEncryptionInfo(name, providerName, true); content.put(name, value); return this; }
[ "public", "JsonObject", "putAndEncrypt", "(", "String", "name", ",", "int", "value", ",", "String", "providerName", ")", "{", "addValueEncryptionInfo", "(", "name", ",", "providerName", ",", "true", ")", ";", "content", ".", "put", "(", "name", ",", "value",...
Stores a {@link Integer} value as encrypted identified by the field name. Note: Use of the Field Level Encryption functionality provided in the com.couchbase.client.encryption namespace provided by Couchbase is subject to the Couchbase Inc. Enterprise Subscription License Agreement at https://www.couchbase.com/ESLA-11132015. @param name the name of the JSON field. @param value the value of the JSON field. @param providerName Crypto provider name for encryption. @return the {@link JsonObject}.
[ "Stores", "a", "{", "@link", "Integer", "}", "value", "as", "encrypted", "identified", "by", "the", "field", "name", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L409-L413
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java
ArrayHelper.getLast
@Nullable @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE getLast (@Nullable final ELEMENTTYPE... aArray) { return getLast (aArray, null); }
java
@Nullable @SafeVarargs public static <ELEMENTTYPE> ELEMENTTYPE getLast (@Nullable final ELEMENTTYPE... aArray) { return getLast (aArray, null); }
[ "@", "Nullable", "@", "SafeVarargs", "public", "static", "<", "ELEMENTTYPE", ">", "ELEMENTTYPE", "getLast", "(", "@", "Nullable", "final", "ELEMENTTYPE", "...", "aArray", ")", "{", "return", "getLast", "(", "aArray", ",", "null", ")", ";", "}" ]
Get the last element of the array or <code>null</code> if the passed array is empty. @param <ELEMENTTYPE> Array element type @param aArray The array who's last element is to be retrieved. May be <code>null</code> or empty. @return <code>null</code> if the passed array is <code>null</code> or empty - the last element otherwise (may also be <code>null</code>).
[ "Get", "the", "last", "element", "of", "the", "array", "or", "<code", ">", "null<", "/", "code", ">", "if", "the", "passed", "array", "is", "empty", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java#L1264-L1269
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/EmptyIfStatement.java
EmptyIfStatement.matchEmptyStatement
@Override public Description matchEmptyStatement(EmptyStatementTree tree, VisitorState state) { boolean matches = false; Tree parent = state.getPath().getParentPath().getLeaf(); if (parent.getKind() == IF) { IfTree parentAsIf = (IfTree) parent; matches = (parentAsIf.getThenStatement() instanceof EmptyStatementTree) && (parentAsIf.getElseStatement() == null); } if (!matches) { return Description.NO_MATCH; } /* * We suggest different fixes depending on what follows the parent if statement. * If there is no statement following the if, then suggest deleting the whole * if statement. If the next statement is a block, then suggest deleting the * empty then part of the if. If the next statement is not a block, then also * suggest deleting the empty then part of the if. */ boolean nextStmtIsNull = parentNode(nextStatement(Matchers.<StatementTree>isSame(null))).matches(tree, state); assert (state.getPath().getParentPath().getLeaf().getKind() == IF); IfTree ifParent = (IfTree) state.getPath().getParentPath().getLeaf(); if (nextStmtIsNull) { // No following statements. Delete whole if. return describeMatch(parent, SuggestedFix.delete(parent)); } else { // There are more statements. Delete the empty then part of the if. return describeMatch( ifParent.getThenStatement(), SuggestedFix.delete(ifParent.getThenStatement())); } }
java
@Override public Description matchEmptyStatement(EmptyStatementTree tree, VisitorState state) { boolean matches = false; Tree parent = state.getPath().getParentPath().getLeaf(); if (parent.getKind() == IF) { IfTree parentAsIf = (IfTree) parent; matches = (parentAsIf.getThenStatement() instanceof EmptyStatementTree) && (parentAsIf.getElseStatement() == null); } if (!matches) { return Description.NO_MATCH; } /* * We suggest different fixes depending on what follows the parent if statement. * If there is no statement following the if, then suggest deleting the whole * if statement. If the next statement is a block, then suggest deleting the * empty then part of the if. If the next statement is not a block, then also * suggest deleting the empty then part of the if. */ boolean nextStmtIsNull = parentNode(nextStatement(Matchers.<StatementTree>isSame(null))).matches(tree, state); assert (state.getPath().getParentPath().getLeaf().getKind() == IF); IfTree ifParent = (IfTree) state.getPath().getParentPath().getLeaf(); if (nextStmtIsNull) { // No following statements. Delete whole if. return describeMatch(parent, SuggestedFix.delete(parent)); } else { // There are more statements. Delete the empty then part of the if. return describeMatch( ifParent.getThenStatement(), SuggestedFix.delete(ifParent.getThenStatement())); } }
[ "@", "Override", "public", "Description", "matchEmptyStatement", "(", "EmptyStatementTree", "tree", ",", "VisitorState", "state", ")", "{", "boolean", "matches", "=", "false", ";", "Tree", "parent", "=", "state", ".", "getPath", "(", ")", ".", "getParentPath", ...
Match empty statement if: - Parent statement is an if - The then part of the parent if is an empty statement, and - The else part of the parent if does not exist
[ "Match", "empty", "statement", "if", ":", "-", "Parent", "statement", "is", "an", "if", "-", "The", "then", "part", "of", "the", "parent", "if", "is", "an", "empty", "statement", "and", "-", "The", "else", "part", "of", "the", "parent", "if", "does", ...
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/EmptyIfStatement.java#L57-L91
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/QuantityFormatter.java
QuantityFormatter.selectPlural
public static StandardPlural selectPlural(double number, NumberFormat numberFormat, PluralRules rules) { String pluralKeyword; if (numberFormat instanceof DecimalFormat) { pluralKeyword = rules.select(((DecimalFormat) numberFormat).getFixedDecimal(number)); } else { pluralKeyword = rules.select(number); } return StandardPlural.orOtherFromString(pluralKeyword); }
java
public static StandardPlural selectPlural(double number, NumberFormat numberFormat, PluralRules rules) { String pluralKeyword; if (numberFormat instanceof DecimalFormat) { pluralKeyword = rules.select(((DecimalFormat) numberFormat).getFixedDecimal(number)); } else { pluralKeyword = rules.select(number); } return StandardPlural.orOtherFromString(pluralKeyword); }
[ "public", "static", "StandardPlural", "selectPlural", "(", "double", "number", ",", "NumberFormat", "numberFormat", ",", "PluralRules", "rules", ")", "{", "String", "pluralKeyword", ";", "if", "(", "numberFormat", "instanceof", "DecimalFormat", ")", "{", "pluralKeyw...
Selects the standard plural form for the number/formatter/rules.
[ "Selects", "the", "standard", "plural", "form", "for", "the", "number", "/", "formatter", "/", "rules", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/QuantityFormatter.java#L95-L103
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/UriEscaper.java
UriEscaper.isIllegal
private boolean isIllegal(final char c, final State state) { switch (state) { case FRAGMENT: return (strict ? STRICT_ILLEGAL_IN_FRAGMENT : ILLEGAL_IN_FRAGMENT).matches(c); case QUERY: return (strict ? STRICT_ILLEGAL_IN_QUERY : ILLEGAL_IN_QUERY).matches(c); case QUERY_PARAM: return (strict ? STRICT_ILLEGAL_IN_QUERY_PARAM : ILLEGAL_IN_QUERY_PARAM).matches(c); case PATH: return (strict ? STRICT_ILLEGAL_IN_PATH : ILLEGAL_IN_PATH).matches(c); case HOST: return ILLEGAL_IN_HOST.matches(c); default: throw new AssertionError(state); } }
java
private boolean isIllegal(final char c, final State state) { switch (state) { case FRAGMENT: return (strict ? STRICT_ILLEGAL_IN_FRAGMENT : ILLEGAL_IN_FRAGMENT).matches(c); case QUERY: return (strict ? STRICT_ILLEGAL_IN_QUERY : ILLEGAL_IN_QUERY).matches(c); case QUERY_PARAM: return (strict ? STRICT_ILLEGAL_IN_QUERY_PARAM : ILLEGAL_IN_QUERY_PARAM).matches(c); case PATH: return (strict ? STRICT_ILLEGAL_IN_PATH : ILLEGAL_IN_PATH).matches(c); case HOST: return ILLEGAL_IN_HOST.matches(c); default: throw new AssertionError(state); } }
[ "private", "boolean", "isIllegal", "(", "final", "char", "c", ",", "final", "State", "state", ")", "{", "switch", "(", "state", ")", "{", "case", "FRAGMENT", ":", "return", "(", "strict", "?", "STRICT_ILLEGAL_IN_FRAGMENT", ":", "ILLEGAL_IN_FRAGMENT", ")", "....
Returns whether or not this character is illegal in the given state
[ "Returns", "whether", "or", "not", "this", "character", "is", "illegal", "in", "the", "given", "state" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/UriEscaper.java#L151-L166
pf4j/pf4j
pf4j/src/main/java/org/pf4j/util/FileUtils.java
FileUtils.findWithEnding
public static Path findWithEnding(Path basePath, String... endings) { for (String ending : endings) { Path newPath = basePath.resolveSibling(basePath.getFileName() + ending); if (Files.exists(newPath)) { return newPath; } } return null; }
java
public static Path findWithEnding(Path basePath, String... endings) { for (String ending : endings) { Path newPath = basePath.resolveSibling(basePath.getFileName() + ending); if (Files.exists(newPath)) { return newPath; } } return null; }
[ "public", "static", "Path", "findWithEnding", "(", "Path", "basePath", ",", "String", "...", "endings", ")", "{", "for", "(", "String", "ending", ":", "endings", ")", "{", "Path", "newPath", "=", "basePath", ".", "resolveSibling", "(", "basePath", ".", "ge...
Finds a path with various endings or null if not found. @param basePath the base name @param endings a list of endings to search for @return new path or null if not found
[ "Finds", "a", "path", "with", "various", "endings", "or", "null", "if", "not", "found", "." ]
train
https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/FileUtils.java#L133-L142
knowm/XChange
xchange-core/src/main/java/org/knowm/xchange/currency/Currency.java
Currency.getCodeCurrency
public Currency getCodeCurrency(String code) { if (code.equals(this.code)) return this; Currency currency = getInstance(code); if (currency.equals(this)) return currency; if (!attributes.codes.contains(code)) throw new IllegalArgumentException("Code not listed for this currency"); return new Currency(code, attributes); }
java
public Currency getCodeCurrency(String code) { if (code.equals(this.code)) return this; Currency currency = getInstance(code); if (currency.equals(this)) return currency; if (!attributes.codes.contains(code)) throw new IllegalArgumentException("Code not listed for this currency"); return new Currency(code, attributes); }
[ "public", "Currency", "getCodeCurrency", "(", "String", "code", ")", "{", "if", "(", "code", ".", "equals", "(", "this", ".", "code", ")", ")", "return", "this", ";", "Currency", "currency", "=", "getInstance", "(", "code", ")", ";", "if", "(", "curren...
Gets the equivalent object with the passed code. <p>This is useful in case some currencies share codes, such that {@link #getInstance(String)} may return the wrong currency. @param code The code the returned object will evaluate to @return A Currency representing the same currency but having the passed currency code @throws IllegalArgumentException if the passed code is not listed for this currency
[ "Gets", "the", "equivalent", "object", "with", "the", "passed", "code", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/currency/Currency.java#L395-L406
wg/lettuce
src/main/java/com/lambdaworks/redis/protocol/Command.java
Command.writeInt
protected static void writeInt(ChannelBuffer buf, int value) { if (value < 10) { buf.writeByte('0' + value); return; } StringBuilder sb = new StringBuilder(8); while (value > 0) { int digit = value % 10; sb.append((char) ('0' + digit)); value /= 10; } for (int i = sb.length() - 1; i >= 0; i--) { buf.writeByte(sb.charAt(i)); } }
java
protected static void writeInt(ChannelBuffer buf, int value) { if (value < 10) { buf.writeByte('0' + value); return; } StringBuilder sb = new StringBuilder(8); while (value > 0) { int digit = value % 10; sb.append((char) ('0' + digit)); value /= 10; } for (int i = sb.length() - 1; i >= 0; i--) { buf.writeByte(sb.charAt(i)); } }
[ "protected", "static", "void", "writeInt", "(", "ChannelBuffer", "buf", ",", "int", "value", ")", "{", "if", "(", "value", "<", "10", ")", "{", "buf", ".", "writeByte", "(", "'", "'", "+", "value", ")", ";", "return", ";", "}", "StringBuilder", "sb",...
Write the textual value of a positive integer to the supplied buffer. @param buf Buffer to write to. @param value Value to write.
[ "Write", "the", "textual", "value", "of", "a", "positive", "integer", "to", "the", "supplied", "buffer", "." ]
train
https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/protocol/Command.java#L178-L194
morimekta/utils
diff-util/src/main/java/net/morimekta/diff/DiffBase.java
DiffBase.lineMode
private LinkedList<Change> lineMode(String text1, String text2) { // Scan the text on a line-by-line basis first. LinesToCharsResult b = linesToChars(text1, text2); text1 = b.chars1; text2 = b.chars2; List<String> linearray = b.lineArray; LinkedList<Change> diffs = main(text1, text2, false); // Convert the diff back to original text. charsToLines(diffs, linearray); // Eliminate freak matches (e.g. blank lines) cleanupSemantic(diffs); // Rediff any replacement blocks, this time character-by-character. // Add a dummy entry at the end. diffs.add(new Change(Operation.EQUAL, "")); int count_delete = 0; int count_insert = 0; String text_delete = ""; String text_insert = ""; ListIterator<Change> pointer = diffs.listIterator(); Change thisDiff = pointer.next(); while (thisDiff != null) { switch (thisDiff.operation) { case INSERT: count_insert++; text_insert += thisDiff.text; break; case DELETE: count_delete++; text_delete += thisDiff.text; break; case EQUAL: // Upon reaching an equality, check for prior redundancies. if (count_delete >= 1 && count_insert >= 1) { // Delete the offending records and add the merged ones. pointer.previous(); for (int j = 0; j < count_delete + count_insert; j++) { pointer.previous(); pointer.remove(); } main(text_delete, text_insert, false).forEach(pointer::add); } count_insert = 0; count_delete = 0; text_delete = ""; text_insert = ""; break; } thisDiff = pointer.hasNext() ? pointer.next() : null; } diffs.removeLast(); // Remove the dummy entry at the end. return diffs; }
java
private LinkedList<Change> lineMode(String text1, String text2) { // Scan the text on a line-by-line basis first. LinesToCharsResult b = linesToChars(text1, text2); text1 = b.chars1; text2 = b.chars2; List<String> linearray = b.lineArray; LinkedList<Change> diffs = main(text1, text2, false); // Convert the diff back to original text. charsToLines(diffs, linearray); // Eliminate freak matches (e.g. blank lines) cleanupSemantic(diffs); // Rediff any replacement blocks, this time character-by-character. // Add a dummy entry at the end. diffs.add(new Change(Operation.EQUAL, "")); int count_delete = 0; int count_insert = 0; String text_delete = ""; String text_insert = ""; ListIterator<Change> pointer = diffs.listIterator(); Change thisDiff = pointer.next(); while (thisDiff != null) { switch (thisDiff.operation) { case INSERT: count_insert++; text_insert += thisDiff.text; break; case DELETE: count_delete++; text_delete += thisDiff.text; break; case EQUAL: // Upon reaching an equality, check for prior redundancies. if (count_delete >= 1 && count_insert >= 1) { // Delete the offending records and add the merged ones. pointer.previous(); for (int j = 0; j < count_delete + count_insert; j++) { pointer.previous(); pointer.remove(); } main(text_delete, text_insert, false).forEach(pointer::add); } count_insert = 0; count_delete = 0; text_delete = ""; text_insert = ""; break; } thisDiff = pointer.hasNext() ? pointer.next() : null; } diffs.removeLast(); // Remove the dummy entry at the end. return diffs; }
[ "private", "LinkedList", "<", "Change", ">", "lineMode", "(", "String", "text1", ",", "String", "text2", ")", "{", "// Scan the text on a line-by-line basis first.", "LinesToCharsResult", "b", "=", "linesToChars", "(", "text1", ",", "text2", ")", ";", "text1", "="...
Do a quick line-level diff on both strings, then rediff the parts for greater accuracy. This speedup can produce non-minimal diffs. @param text1 Old string to be diffed. @param text2 New string to be diffed. @return Linked List of DiffBase objects.
[ "Do", "a", "quick", "line", "-", "level", "diff", "on", "both", "strings", "then", "rediff", "the", "parts", "for", "greater", "accuracy", ".", "This", "speedup", "can", "produce", "non", "-", "minimal", "diffs", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/diff-util/src/main/java/net/morimekta/diff/DiffBase.java#L446-L501
OpenTSDB/opentsdb
src/tools/OpenTSDBMain.java
OpenTSDBMain.setLogbackExternal
protected static void setLogbackExternal(final String fileName) { try { final ObjectName logbackObjectName = new ObjectName("ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator"); ManagementFactory.getPlatformMBeanServer().invoke(logbackObjectName, "reloadByFileName", new Object[]{fileName}, new String[]{String.class.getName()}); log.info("Set external logback config to [{}]", fileName); } catch (Exception ex) { log.warn("Failed to set external logback config to [{}]", fileName, ex); } }
java
protected static void setLogbackExternal(final String fileName) { try { final ObjectName logbackObjectName = new ObjectName("ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator"); ManagementFactory.getPlatformMBeanServer().invoke(logbackObjectName, "reloadByFileName", new Object[]{fileName}, new String[]{String.class.getName()}); log.info("Set external logback config to [{}]", fileName); } catch (Exception ex) { log.warn("Failed to set external logback config to [{}]", fileName, ex); } }
[ "protected", "static", "void", "setLogbackExternal", "(", "final", "String", "fileName", ")", "{", "try", "{", "final", "ObjectName", "logbackObjectName", "=", "new", "ObjectName", "(", "\"ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator\"", ...
Reloads the logback configuration to an external file @param fileName The logback configuration file
[ "Reloads", "the", "logback", "configuration", "to", "an", "external", "file" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/OpenTSDBMain.java#L537-L545
kiswanij/jk-util
src/main/java/com/jk/util/UserPreferences.java
UserPreferences.getBoolean
public static boolean getBoolean(final String key, final boolean def) { try { return systemRoot.getBoolean(fixKey(key), def); } catch (final Exception e) { // just eat the exception to avoid any system crash on system issues return def; } }
java
public static boolean getBoolean(final String key, final boolean def) { try { return systemRoot.getBoolean(fixKey(key), def); } catch (final Exception e) { // just eat the exception to avoid any system crash on system issues return def; } }
[ "public", "static", "boolean", "getBoolean", "(", "final", "String", "key", ",", "final", "boolean", "def", ")", "{", "try", "{", "return", "systemRoot", ".", "getBoolean", "(", "fixKey", "(", "key", ")", ",", "def", ")", ";", "}", "catch", "(", "final...
Gets the boolean. @param key the key @param def the def @return the boolean @see java.util.prefs.Preferences#getBoolean(java.lang.String, boolean)
[ "Gets", "the", "boolean", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/UserPreferences.java#L91-L98
huahin/huahin-core
src/main/java/org/huahinframework/core/SimpleJob.java
SimpleJob.setCombiner
public SimpleJob setCombiner(Class<? extends Reducer<Key, Value, Key, Value>> clazz) throws IllegalStateException { return setCombiner(clazz, DEFAULT_COMBAIN_CACHE); }
java
public SimpleJob setCombiner(Class<? extends Reducer<Key, Value, Key, Value>> clazz) throws IllegalStateException { return setCombiner(clazz, DEFAULT_COMBAIN_CACHE); }
[ "public", "SimpleJob", "setCombiner", "(", "Class", "<", "?", "extends", "Reducer", "<", "Key", ",", "Value", ",", "Key", ",", "Value", ">", ">", "clazz", ")", "throws", "IllegalStateException", "{", "return", "setCombiner", "(", "clazz", ",", "DEFAULT_COMBA...
Job Conbiner class setting. @param clazz {@link Summarizer} class @return this
[ "Job", "Conbiner", "class", "setting", "." ]
train
https://github.com/huahin/huahin-core/blob/a87921b5a12be92a822f753c075ab2431036e6f5/src/main/java/org/huahinframework/core/SimpleJob.java#L198-L201
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/UnsavedRevision.java
UnsavedRevision.setAttachment
@InterfaceAudience.Public public void setAttachment(String name, String contentType, InputStream contentStream) { Attachment attachment = new Attachment(contentStream, contentType); addAttachment(attachment, name); }
java
@InterfaceAudience.Public public void setAttachment(String name, String contentType, InputStream contentStream) { Attachment attachment = new Attachment(contentStream, contentType); addAttachment(attachment, name); }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setAttachment", "(", "String", "name", ",", "String", "contentType", ",", "InputStream", "contentStream", ")", "{", "Attachment", "attachment", "=", "new", "Attachment", "(", "contentStream", ",", "conten...
Sets the attachment with the given name. The Attachment data will be written to the Database when the Revision is saved. @param name The name of the Attachment to set. @param contentType The content-type of the Attachment. @param contentStream The Attachment content. The InputStream will be closed after it is no longer needed.
[ "Sets", "the", "attachment", "with", "the", "given", "name", ".", "The", "Attachment", "data", "will", "be", "written", "to", "the", "Database", "when", "the", "Revision", "is", "saved", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/UnsavedRevision.java#L169-L173
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/collection/MapConverter.java
MapConverter.getFloat
public Float getFloat(Map<String, Object> data, String name) { return get(data, name, Float.class); }
java
public Float getFloat(Map<String, Object> data, String name) { return get(data, name, Float.class); }
[ "public", "Float", "getFloat", "(", "Map", "<", "String", ",", "Object", ">", "data", ",", "String", "name", ")", "{", "return", "get", "(", "data", ",", "name", ",", "Float", ".", "class", ")", ";", "}" ]
<p> getFloat. </p> @param data a {@link java.util.Map} object. @param name a {@link java.lang.String} object. @return a {@link java.lang.Float} object.
[ "<p", ">", "getFloat", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/MapConverter.java#L244-L246
aoindustries/ao-taglib
src/main/java/com/aoindustries/taglib/AutoEncodingBufferedTag.java
AutoEncodingBufferedTag.newBufferWriter
public static BufferWriter newBufferWriter(TempFileContext tempFileContext, long tempFileThreshold) { //return new SegmentedWriter(); BufferWriter bufferWriter = new CharArrayBufferWriter(); if(tempFileThreshold != Long.MAX_VALUE) { bufferWriter = new AutoTempFileWriter( bufferWriter, tempFileContext, tempFileThreshold ); } return bufferWriter; }
java
public static BufferWriter newBufferWriter(TempFileContext tempFileContext, long tempFileThreshold) { //return new SegmentedWriter(); BufferWriter bufferWriter = new CharArrayBufferWriter(); if(tempFileThreshold != Long.MAX_VALUE) { bufferWriter = new AutoTempFileWriter( bufferWriter, tempFileContext, tempFileThreshold ); } return bufferWriter; }
[ "public", "static", "BufferWriter", "newBufferWriter", "(", "TempFileContext", "tempFileContext", ",", "long", "tempFileThreshold", ")", "{", "//return new SegmentedWriter();", "BufferWriter", "bufferWriter", "=", "new", "CharArrayBufferWriter", "(", ")", ";", "if", "(", ...
Creates an instance of the currently preferred {@link BufferWriter}. Buffering strategies may change over time as technology develops and options become available. @see TempFileContext @see AutoTempFileWriter
[ "Creates", "an", "instance", "of", "the", "currently", "preferred", "{", "@link", "BufferWriter", "}", ".", "Buffering", "strategies", "may", "change", "over", "time", "as", "technology", "develops", "and", "options", "become", "available", "." ]
train
https://github.com/aoindustries/ao-taglib/blob/5670eba8485196bd42d31d3ff09a42deacb025f8/src/main/java/com/aoindustries/taglib/AutoEncodingBufferedTag.java#L113-L124
tango-controls/JTango
client/src/main/java/org/tango/client/database/cache/NoCacheDatabase.java
NoCacheDatabase.setAttributeProperties
@Override public void setAttributeProperties(final String deviceName, final String attributeName, final Map<String, String[]> properties) throws DevFailed { final DeviceData argin = new DeviceData(); final List<String> args = new ArrayList<String>(); args.add(deviceName); args.add(Integer.toString(1)); // attribute number args.add(attributeName); args.add(Integer.toString(properties.size())); // property number for (final Map.Entry<String, String[]> entry : properties.entrySet()) { args.add(entry.getKey()); final String[] propValues = entry.getValue(); args.add(Integer.toString(propValues.length)); for (final String propValue : propValues) { args.add(propValue); } } argin.insert(args.toArray(new String[args.size()])); database.command_inout("DbPutDeviceAttributeProperty2", argin); }
java
@Override public void setAttributeProperties(final String deviceName, final String attributeName, final Map<String, String[]> properties) throws DevFailed { final DeviceData argin = new DeviceData(); final List<String> args = new ArrayList<String>(); args.add(deviceName); args.add(Integer.toString(1)); // attribute number args.add(attributeName); args.add(Integer.toString(properties.size())); // property number for (final Map.Entry<String, String[]> entry : properties.entrySet()) { args.add(entry.getKey()); final String[] propValues = entry.getValue(); args.add(Integer.toString(propValues.length)); for (final String propValue : propValues) { args.add(propValue); } } argin.insert(args.toArray(new String[args.size()])); database.command_inout("DbPutDeviceAttributeProperty2", argin); }
[ "@", "Override", "public", "void", "setAttributeProperties", "(", "final", "String", "deviceName", ",", "final", "String", "attributeName", ",", "final", "Map", "<", "String", ",", "String", "[", "]", ">", "properties", ")", "throws", "DevFailed", "{", "final"...
Set some attribute properties. (execute DbPutDeviceAttributeProperty2 on DB device) @param deviceName The device name @param attributeName The attribute name @param properties The properties names and values. @throws DevFailed
[ "Set", "some", "attribute", "properties", ".", "(", "execute", "DbPutDeviceAttributeProperty2", "on", "DB", "device", ")" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/cache/NoCacheDatabase.java#L240-L259
konmik/solid
streams/src/main/java/solid/stream/Stream.java
Stream.every
public boolean every(Func1<? super T, Boolean> predicate) { for (T item : this) { if (!predicate.call(item)) return false; } return true; }
java
public boolean every(Func1<? super T, Boolean> predicate) { for (T item : this) { if (!predicate.call(item)) return false; } return true; }
[ "public", "boolean", "every", "(", "Func1", "<", "?", "super", "T", ",", "Boolean", ">", "predicate", ")", "{", "for", "(", "T", "item", ":", "this", ")", "{", "if", "(", "!", "predicate", ".", "call", "(", "item", ")", ")", "return", "false", ";...
Returns true if all of stream items satisfy a given condition. @param predicate a condition to test. @return true if all of stream items satisfy a given condition.
[ "Returns", "true", "if", "all", "of", "stream", "items", "satisfy", "a", "given", "condition", "." ]
train
https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L550-L556
feroult/yawp
yawp-core/src/main/java/io/yawp/commons/utils/json/gson/CustomTypeAdapterFactory.java
CustomTypeAdapterFactory.write
protected void write(JsonWriter out, T value, TypeAdapter<JsonElement> elementAdapter, TypeAdapter<T> delegate) throws IOException { JsonElement tree = delegate.toJsonTree(value); beforeWrite(value, tree); elementAdapter.write(out, tree); }
java
protected void write(JsonWriter out, T value, TypeAdapter<JsonElement> elementAdapter, TypeAdapter<T> delegate) throws IOException { JsonElement tree = delegate.toJsonTree(value); beforeWrite(value, tree); elementAdapter.write(out, tree); }
[ "protected", "void", "write", "(", "JsonWriter", "out", ",", "T", "value", ",", "TypeAdapter", "<", "JsonElement", ">", "elementAdapter", ",", "TypeAdapter", "<", "T", ">", "delegate", ")", "throws", "IOException", "{", "JsonElement", "tree", "=", "delegate", ...
Override this to define how this is serialized in {@code toSerialize} to the outgoing JSON stream.
[ "Override", "this", "to", "define", "how", "this", "is", "serialized", "in", "{" ]
train
https://github.com/feroult/yawp/blob/b90deb905edd3fdb3009a5525e310cd17ead7f3d/yawp-core/src/main/java/io/yawp/commons/utils/json/gson/CustomTypeAdapterFactory.java#L48-L52
alkacon/opencms-core
src/org/opencms/util/CmsRequestUtil.java
CmsRequestUtil.createParameterMap
public static Map<String, String[]> createParameterMap(String query) { return createParameterMap(query, false, null); }
java
public static Map<String, String[]> createParameterMap(String query) { return createParameterMap(query, false, null); }
[ "public", "static", "Map", "<", "String", ",", "String", "[", "]", ">", "createParameterMap", "(", "String", "query", ")", "{", "return", "createParameterMap", "(", "query", ",", "false", ",", "null", ")", ";", "}" ]
Parses the parameters of the given request query part and creates a parameter map out of them.<p> Please note: This does not parse a full request URI/URL, only the query part that starts after the "?". For example, in the URI <code>/system/index.html?a=b&amp;c=d</code>, the query part is <code>a=b&amp;c=d</code>.<p> If the given String is empty, an empty map is returned.<p> @param query the query to parse @return the parameter map created from the query
[ "Parses", "the", "parameters", "of", "the", "given", "request", "query", "part", "and", "creates", "a", "parameter", "map", "out", "of", "them", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L309-L312
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.projectiveToFundamental
public static DMatrixRMaj projectiveToFundamental( DMatrixRMaj P1 , DMatrixRMaj P2 , @Nullable DMatrixRMaj F21 ) { if( F21 == null ) F21 = new DMatrixRMaj(3,3); ProjectiveToIdentity p2i = new ProjectiveToIdentity(); if( !p2i.process(P1) ) throw new RuntimeException("Failed!"); DMatrixRMaj P1inv = p2i.getPseudoInvP(); DMatrixRMaj U = p2i.getU(); DMatrixRMaj e = new DMatrixRMaj(3,1); CommonOps_DDRM.mult(P2,U,e); DMatrixRMaj tmp = new DMatrixRMaj(3,4); DMatrixRMaj e_skew = new DMatrixRMaj(3,3); GeometryMath_F64.crossMatrix(e.data[0],e.data[1],e.data[2],e_skew); CommonOps_DDRM.mult(e_skew,P2,tmp); CommonOps_DDRM.mult(tmp,P1inv,F21); return F21; }
java
public static DMatrixRMaj projectiveToFundamental( DMatrixRMaj P1 , DMatrixRMaj P2 , @Nullable DMatrixRMaj F21 ) { if( F21 == null ) F21 = new DMatrixRMaj(3,3); ProjectiveToIdentity p2i = new ProjectiveToIdentity(); if( !p2i.process(P1) ) throw new RuntimeException("Failed!"); DMatrixRMaj P1inv = p2i.getPseudoInvP(); DMatrixRMaj U = p2i.getU(); DMatrixRMaj e = new DMatrixRMaj(3,1); CommonOps_DDRM.mult(P2,U,e); DMatrixRMaj tmp = new DMatrixRMaj(3,4); DMatrixRMaj e_skew = new DMatrixRMaj(3,3); GeometryMath_F64.crossMatrix(e.data[0],e.data[1],e.data[2],e_skew); CommonOps_DDRM.mult(e_skew,P2,tmp); CommonOps_DDRM.mult(tmp,P1inv,F21); return F21; }
[ "public", "static", "DMatrixRMaj", "projectiveToFundamental", "(", "DMatrixRMaj", "P1", ",", "DMatrixRMaj", "P2", ",", "@", "Nullable", "DMatrixRMaj", "F21", ")", "{", "if", "(", "F21", "==", "null", ")", "F21", "=", "new", "DMatrixRMaj", "(", "3", ",", "3...
<p>Given two general camera matrices compute fundamental matrix.</p> {@code F= [e']_x P2*P1+, where P1+ is the pseudo inverse of P1, and e' = P2*C, with P*C=0} @param P1 (Input) camera matrix for view 1 @param P2 (Input) camera matrix for view 2 @param F21 (Output) Fundamental matrix from view 1 to 2 @return Fundamental matrix.
[ "<p", ">", "Given", "two", "general", "camera", "matrices", "compute", "fundamental", "matrix", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L894-L916
jenkinsci/jenkins
core/src/main/java/hudson/diagnosis/OldDataMonitor.java
OldDataMonitor.report
public static void report(UnmarshallingContext context, String version) { RobustReflectionConverter.addErrorInContext(context, new ReportException(version)); }
java
public static void report(UnmarshallingContext context, String version) { RobustReflectionConverter.addErrorInContext(context, new ReportException(version)); }
[ "public", "static", "void", "report", "(", "UnmarshallingContext", "context", ",", "String", "version", ")", "{", "RobustReflectionConverter", ".", "addErrorInContext", "(", "context", ",", "new", "ReportException", "(", "version", ")", ")", ";", "}" ]
Inform monitor that some data in a deprecated format has been loaded, during XStream unmarshalling when the Saveable containing this object is not available. @param context XStream unmarshalling context @param version Hudson release when the data structure changed.
[ "Inform", "monitor", "that", "some", "data", "in", "a", "deprecated", "format", "has", "been", "loaded", "during", "XStream", "unmarshalling", "when", "the", "Saveable", "containing", "this", "object", "is", "not", "available", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/diagnosis/OldDataMonitor.java#L191-L193
Alluxio/alluxio
core/common/src/main/java/alluxio/util/io/ByteIOUtils.java
ByteIOUtils.readShort
public static short readShort(byte[] buf, int pos) { checkBoundary(buf, pos, 2); return (short) (((short) (buf[pos] & 0xff) << 8) | ((short) (buf[pos + 1] & 0xff))); }
java
public static short readShort(byte[] buf, int pos) { checkBoundary(buf, pos, 2); return (short) (((short) (buf[pos] & 0xff) << 8) | ((short) (buf[pos + 1] & 0xff))); }
[ "public", "static", "short", "readShort", "(", "byte", "[", "]", "buf", ",", "int", "pos", ")", "{", "checkBoundary", "(", "buf", ",", "pos", ",", "2", ")", ";", "return", "(", "short", ")", "(", "(", "(", "short", ")", "(", "buf", "[", "pos", ...
Reads a specific short byte value (2 bytes) from the input byte array at the given offset. @param buf input byte buffer @param pos offset into the byte buffer to read @return the short value read
[ "Reads", "a", "specific", "short", "byte", "value", "(", "2", "bytes", ")", "from", "the", "input", "byte", "array", "at", "the", "given", "offset", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/ByteIOUtils.java#L58-L61
jbundle/jbundle
base/model/src/main/java/org/jbundle/base/model/Utility.java
Utility.propertiesToURL
public static String propertiesToURL(String strURL, Map<String,Object> properties) { if (properties != null) { for (String strKey : properties.keySet()) { Object strValue = properties.get(strKey); strURL = Utility.addURLParam(strURL, strKey.toString(), strValue.toString()); } } return strURL; }
java
public static String propertiesToURL(String strURL, Map<String,Object> properties) { if (properties != null) { for (String strKey : properties.keySet()) { Object strValue = properties.get(strKey); strURL = Utility.addURLParam(strURL, strKey.toString(), strValue.toString()); } } return strURL; }
[ "public", "static", "String", "propertiesToURL", "(", "String", "strURL", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "for", "(", "String", "strKey", ":", "properties", ".", "key...
Add to this URL using all the properties in this property list. @param strURL The original URL string. @param properties The properties to add (key/value pairs). @return The new URL string.
[ "Add", "to", "this", "URL", "using", "all", "the", "properties", "in", "this", "property", "list", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L90-L101
dasein-cloud/dasein-cloud-azure
src/main/java/org/dasein/cloud/azure/network/AzureIpAddressSupport.java
AzureIpAddressSupport.listRulesForServer
@Override public @Nonnull Iterable<IpForwardingRule> listRulesForServer(@Nonnull String serverId) throws InternalException, CloudException { if(serverId == null) throw new InternalException("Parameter serverId cannot be null"); PersistentVMRoleModel persistentVMRoleModel = getVMRole(serverId); if(persistentVMRoleModel == null) throw new InternalException("Cannot find Azure virtual machine with id: " + serverId); ArrayList<IpForwardingRule> rules = new ArrayList<IpForwardingRule>(); if(persistentVMRoleModel.getConfigurationSets().get(0).getInputEndpoints() != null) { for (PersistentVMRoleModel.InputEndpoint endpoint : persistentVMRoleModel.getConfigurationSets().get(0).getInputEndpoints()) { IpForwardingRule rule = new IpForwardingRule(); rule.setProviderRuleId(new AzureRuleIdParts(serverId, endpoint.getProtocol(), endpoint.getLocalPort()).toProviderId()); rule.setPublicPort(Integer.parseInt(endpoint.getPort())); rule.setPrivatePort(Integer.parseInt(endpoint.getLocalPort())); rule.setServerId(serverId); rule.setProtocol(Protocol.valueOf(endpoint.getProtocol().toUpperCase())); rules.add(rule); } } return rules; }
java
@Override public @Nonnull Iterable<IpForwardingRule> listRulesForServer(@Nonnull String serverId) throws InternalException, CloudException { if(serverId == null) throw new InternalException("Parameter serverId cannot be null"); PersistentVMRoleModel persistentVMRoleModel = getVMRole(serverId); if(persistentVMRoleModel == null) throw new InternalException("Cannot find Azure virtual machine with id: " + serverId); ArrayList<IpForwardingRule> rules = new ArrayList<IpForwardingRule>(); if(persistentVMRoleModel.getConfigurationSets().get(0).getInputEndpoints() != null) { for (PersistentVMRoleModel.InputEndpoint endpoint : persistentVMRoleModel.getConfigurationSets().get(0).getInputEndpoints()) { IpForwardingRule rule = new IpForwardingRule(); rule.setProviderRuleId(new AzureRuleIdParts(serverId, endpoint.getProtocol(), endpoint.getLocalPort()).toProviderId()); rule.setPublicPort(Integer.parseInt(endpoint.getPort())); rule.setPrivatePort(Integer.parseInt(endpoint.getLocalPort())); rule.setServerId(serverId); rule.setProtocol(Protocol.valueOf(endpoint.getProtocol().toUpperCase())); rules.add(rule); } } return rules; }
[ "@", "Override", "public", "@", "Nonnull", "Iterable", "<", "IpForwardingRule", ">", "listRulesForServer", "(", "@", "Nonnull", "String", "serverId", ")", "throws", "InternalException", ",", "CloudException", "{", "if", "(", "serverId", "==", "null", ")", "throw...
Lists the IP forwarding rules associated with the specified public IP address. This method is safe to call even when requested on a private IP address or when IP forwarding is not supported. In those situations, {@link java.util.Collections#emptyList()} will be returned. @param serverId the unique ID of the virtual machine whose forwarding rules will be sought @return all IP forwarding rules for the specified IP address @throws org.dasein.cloud.InternalException an internal error occurred inside the Dasein Cloud implementation @throws org.dasein.cloud.CloudException an error occurred processing the request in the cloud
[ "Lists", "the", "IP", "forwarding", "rules", "associated", "with", "the", "specified", "public", "IP", "address", ".", "This", "method", "is", "safe", "to", "call", "even", "when", "requested", "on", "a", "private", "IP", "address", "or", "when", "IP", "fo...
train
https://github.com/dasein-cloud/dasein-cloud-azure/blob/e2abb775c0f23f0d0f2509fba31128c7b2027d7c/src/main/java/org/dasein/cloud/azure/network/AzureIpAddressSupport.java#L404-L430
OpenLiberty/open-liberty
dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java
LifecycleCallbackHelper.invokeMethod
@SuppressWarnings({ "rawtypes", "unchecked" }) public void invokeMethod(final Class clazz, final String methodName, final Object instance) { // instance can be null for the static application main method AccessController.doPrivileged(new PrivilegedAction() { @Override public Object run() { try { final Method m = clazz.getDeclaredMethod(methodName); if (!m.isAccessible()) { m.setAccessible(true); m.invoke(instance); m.setAccessible(false); return m; } else { m.invoke(instance); return m; } } catch (Exception e) { if (tc.isDebugEnabled()) { Tr.debug(tc, e.getMessage()); } return null; } } }); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public void invokeMethod(final Class clazz, final String methodName, final Object instance) { // instance can be null for the static application main method AccessController.doPrivileged(new PrivilegedAction() { @Override public Object run() { try { final Method m = clazz.getDeclaredMethod(methodName); if (!m.isAccessible()) { m.setAccessible(true); m.invoke(instance); m.setAccessible(false); return m; } else { m.invoke(instance); return m; } } catch (Exception e) { if (tc.isDebugEnabled()) { Tr.debug(tc, e.getMessage()); } return null; } } }); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "invokeMethod", "(", "final", "Class", "clazz", ",", "final", "String", "methodName", ",", "final", "Object", "instance", ")", "{", "// instance can be null for th...
Invokes the class method. The object instance can be null for the application main class. @param clazz the Class object @param methodName the Method name @param instance the instance object of the class. It can be null if the class is the application Main.
[ "Invokes", "the", "class", "method", ".", "The", "object", "instance", "can", "be", "null", "for", "the", "application", "main", "class", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L186-L211
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java
PersonGroupsImpl.listWithServiceResponseAsync
public Observable<ServiceResponse<List<PersonGroup>>> listWithServiceResponseAsync(ListPersonGroupsOptionalParameter listOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } final String start = listOptionalParameter != null ? listOptionalParameter.start() : null; final Integer top = listOptionalParameter != null ? listOptionalParameter.top() : null; return listWithServiceResponseAsync(start, top); }
java
public Observable<ServiceResponse<List<PersonGroup>>> listWithServiceResponseAsync(ListPersonGroupsOptionalParameter listOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } final String start = listOptionalParameter != null ? listOptionalParameter.start() : null; final Integer top = listOptionalParameter != null ? listOptionalParameter.top() : null; return listWithServiceResponseAsync(start, top); }
[ "public", "Observable", "<", "ServiceResponse", "<", "List", "<", "PersonGroup", ">", ">", ">", "listWithServiceResponseAsync", "(", "ListPersonGroupsOptionalParameter", "listOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "azureRegion", "(", ")...
List person groups and their information. @param listOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;PersonGroup&gt; object
[ "List", "person", "groups", "and", "their", "information", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java#L701-L709
deephacks/confit
provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBaseBeanManager.java
HBaseBeanManager.delete
@Override public Collection<Bean> delete(String schemaName, Collection<String> instanceIds) throws AbortRuntimeException { init(); Map<BeanId, Bean> deleted = list(schemaName, instanceIds); Set<HBeanRow> rows = new HashSet<>(); for (String id : instanceIds) { rows.add(new HBeanRow(BeanId.create(id, schemaName), uids)); } try { rows = table.getEager(rows).getRows(); ArrayList<BeanId> predecessors = new ArrayList<>(); for (HBeanRow row : rows) { for (BeanId id : row.getPredecessorsBeanIds()) { predecessors.add(id); } } if (predecessors.size() > 0) { throw Events.CFG302_CANNOT_DELETE_BEAN(predecessors); } } catch (HBeanNotFoundException e) { throw Events.CFG304_BEAN_DOESNT_EXIST(e.getNotFound().iterator().next()); } table.delete(rows); return deleted.values(); }
java
@Override public Collection<Bean> delete(String schemaName, Collection<String> instanceIds) throws AbortRuntimeException { init(); Map<BeanId, Bean> deleted = list(schemaName, instanceIds); Set<HBeanRow> rows = new HashSet<>(); for (String id : instanceIds) { rows.add(new HBeanRow(BeanId.create(id, schemaName), uids)); } try { rows = table.getEager(rows).getRows(); ArrayList<BeanId> predecessors = new ArrayList<>(); for (HBeanRow row : rows) { for (BeanId id : row.getPredecessorsBeanIds()) { predecessors.add(id); } } if (predecessors.size() > 0) { throw Events.CFG302_CANNOT_DELETE_BEAN(predecessors); } } catch (HBeanNotFoundException e) { throw Events.CFG304_BEAN_DOESNT_EXIST(e.getNotFound().iterator().next()); } table.delete(rows); return deleted.values(); }
[ "@", "Override", "public", "Collection", "<", "Bean", ">", "delete", "(", "String", "schemaName", ",", "Collection", "<", "String", ">", "instanceIds", ")", "throws", "AbortRuntimeException", "{", "init", "(", ")", ";", "Map", "<", "BeanId", ",", "Bean", "...
This operation must validate the following things. 1) CFG302: No parents reference these beans.
[ "This", "operation", "must", "validate", "the", "following", "things", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBaseBeanManager.java#L400-L425
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.deleteHybridConnectionAsync
public Observable<Void> deleteHybridConnectionAsync(String resourceGroupName, String name, String namespaceName, String relayName) { return deleteHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deleteHybridConnectionAsync(String resourceGroupName, String name, String namespaceName, String relayName) { return deleteHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteHybridConnectionAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "namespaceName", ",", "String", "relayName", ")", "{", "return", "deleteHybridConnectionWithServiceResponseAsync", "(", "re...
Delete a Hybrid Connection in use in an App Service plan. Delete a Hybrid Connection in use in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param namespaceName Name of the Service Bus namespace. @param relayName Name of the Service Bus relay. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Delete", "a", "Hybrid", "Connection", "in", "use", "in", "an", "App", "Service", "plan", ".", "Delete", "a", "Hybrid", "Connection", "in", "use", "in", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1269-L1276
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/IncidentUtil.java
IncidentUtil.generateIncidentV2WithException
public static Throwable generateIncidentV2WithException(SFSession session, Throwable exc, String jobId, String requestId) { new Incident(session, exc, jobId, requestId).trigger(); return exc; }
java
public static Throwable generateIncidentV2WithException(SFSession session, Throwable exc, String jobId, String requestId) { new Incident(session, exc, jobId, requestId).trigger(); return exc; }
[ "public", "static", "Throwable", "generateIncidentV2WithException", "(", "SFSession", "session", ",", "Throwable", "exc", ",", "String", "jobId", ",", "String", "requestId", ")", "{", "new", "Incident", "(", "session", ",", "exc", ",", "jobId", ",", "requestId",...
Makes a V2 incident object and triggers ir, effectively reporting the given exception to GS and possibly to crashmanager @param session SFSession object to talk to GS through @param exc the Throwable we should report @param jobId jobId that failed @param requestId requestId that failed @return the given Throwable object
[ "Makes", "a", "V2", "incident", "object", "and", "triggers", "ir", "effectively", "reporting", "the", "given", "exception", "to", "GS", "and", "possibly", "to", "crashmanager" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/IncidentUtil.java#L279-L286
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/matchers/DefaultBondMatcher.java
DefaultBondMatcher.matches
@Override public boolean matches(IAtomContainer targetContainer, IBond targetBond) { if (this.smartQueryBond != null && queryBond == null) { return smartQueryBond.matches(targetBond); } else { if (!isBondMatchFlag()) { return true; } if (isBondMatchFlag() && isBondTypeMatch(targetBond)) { return true; } if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetContainer, targetBond)) { return true; } } return false; }
java
@Override public boolean matches(IAtomContainer targetContainer, IBond targetBond) { if (this.smartQueryBond != null && queryBond == null) { return smartQueryBond.matches(targetBond); } else { if (!isBondMatchFlag()) { return true; } if (isBondMatchFlag() && isBondTypeMatch(targetBond)) { return true; } if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetContainer, targetBond)) { return true; } } return false; }
[ "@", "Override", "public", "boolean", "matches", "(", "IAtomContainer", "targetContainer", ",", "IBond", "targetBond", ")", "{", "if", "(", "this", ".", "smartQueryBond", "!=", "null", "&&", "queryBond", "==", "null", ")", "{", "return", "smartQueryBond", ".",...
{@inheritDoc} @param targetContainer target container @param targetBond target bond @return true if bonds match
[ "{", "@inheritDoc", "}" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/matchers/DefaultBondMatcher.java#L111-L127
openengsb/openengsb
components/services/src/main/java/org/openengsb/core/services/internal/TransformationHandler.java
TransformationHandler.findTargetMethod
protected static Method findTargetMethod(final Method sourceMethod, Class<?> target) throws NoSuchElementException { return Iterables.find(Arrays.asList(target.getMethods()), new Predicate<Method>() { @Override public boolean apply(Method element) { if (!sourceMethod.getName().equals(element.getName())) { return false; } if (sourceMethod.getParameterTypes().length != element.getParameterTypes().length) { return false; } return true; } }); }
java
protected static Method findTargetMethod(final Method sourceMethod, Class<?> target) throws NoSuchElementException { return Iterables.find(Arrays.asList(target.getMethods()), new Predicate<Method>() { @Override public boolean apply(Method element) { if (!sourceMethod.getName().equals(element.getName())) { return false; } if (sourceMethod.getParameterTypes().length != element.getParameterTypes().length) { return false; } return true; } }); }
[ "protected", "static", "Method", "findTargetMethod", "(", "final", "Method", "sourceMethod", ",", "Class", "<", "?", ">", "target", ")", "throws", "NoSuchElementException", "{", "return", "Iterables", ".", "find", "(", "Arrays", ".", "asList", "(", "target", "...
tries to find a method that method in the class {@code target} with the same name and the same number of arguments. It's assumed that the arguments can then be transformed. @throws java.util.NoSuchElementException if no matching method can be found
[ "tries", "to", "find", "a", "method", "that", "method", "in", "the", "class", "{", "@code", "target", "}", "with", "the", "same", "name", "and", "the", "same", "number", "of", "arguments", ".", "It", "s", "assumed", "that", "the", "arguments", "can", "...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/services/src/main/java/org/openengsb/core/services/internal/TransformationHandler.java#L69-L82
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/listener/jms/ExternalEventMessageListener.java
ExternalEventMessageListener.onMessage
@Override public void onMessage(Message message, Session session) throws JMSException { StandardLogger logger = LoggerUtil.getStandardLogger(); try { String txt = ((TextMessage) message).getText(); if (logger.isDebugEnabled()) { logger.debug("JMS Spring ExternalEvent Listener receives request: " + txt); } String resp; ListenerHelper helper = new ListenerHelper(); Map<String, String> metaInfo = new HashMap<String, String>(); metaInfo.put(Listener.METAINFO_PROTOCOL, Listener.METAINFO_PROTOCOL_JMS); metaInfo.put(Listener.METAINFO_REQUEST_PATH, ((Queue)message.getJMSDestination()).getQueueName()); metaInfo.put(Listener.METAINFO_SERVICE_CLASS, this.getClass().getName()); metaInfo.put(Listener.METAINFO_REQUEST_ID, message.getJMSMessageID()); metaInfo.put(Listener.METAINFO_CORRELATION_ID, message.getJMSCorrelationID()); if (message.getJMSReplyTo() != null) metaInfo.put("ReplyTo", message.getJMSReplyTo().toString()); resp = helper.processEvent(txt, metaInfo); String correlId = message.getJMSCorrelationID(); Queue respQueue = (Queue) message.getJMSReplyTo(); if (resp != null && respQueue != null) { mdwMessageProducer.sendMessage(resp, respQueue, correlId); if (logger.isDebugEnabled()) { logger.debug("JMS Listener sends response (corr id='" + correlId + "'): " + resp); } } } catch (Throwable ex) { logger.severeException(ex.getMessage(), ex); } }
java
@Override public void onMessage(Message message, Session session) throws JMSException { StandardLogger logger = LoggerUtil.getStandardLogger(); try { String txt = ((TextMessage) message).getText(); if (logger.isDebugEnabled()) { logger.debug("JMS Spring ExternalEvent Listener receives request: " + txt); } String resp; ListenerHelper helper = new ListenerHelper(); Map<String, String> metaInfo = new HashMap<String, String>(); metaInfo.put(Listener.METAINFO_PROTOCOL, Listener.METAINFO_PROTOCOL_JMS); metaInfo.put(Listener.METAINFO_REQUEST_PATH, ((Queue)message.getJMSDestination()).getQueueName()); metaInfo.put(Listener.METAINFO_SERVICE_CLASS, this.getClass().getName()); metaInfo.put(Listener.METAINFO_REQUEST_ID, message.getJMSMessageID()); metaInfo.put(Listener.METAINFO_CORRELATION_ID, message.getJMSCorrelationID()); if (message.getJMSReplyTo() != null) metaInfo.put("ReplyTo", message.getJMSReplyTo().toString()); resp = helper.processEvent(txt, metaInfo); String correlId = message.getJMSCorrelationID(); Queue respQueue = (Queue) message.getJMSReplyTo(); if (resp != null && respQueue != null) { mdwMessageProducer.sendMessage(resp, respQueue, correlId); if (logger.isDebugEnabled()) { logger.debug("JMS Listener sends response (corr id='" + correlId + "'): " + resp); } } } catch (Throwable ex) { logger.severeException(ex.getMessage(), ex); } }
[ "@", "Override", "public", "void", "onMessage", "(", "Message", "message", ",", "Session", "session", ")", "throws", "JMSException", "{", "StandardLogger", "logger", "=", "LoggerUtil", ".", "getStandardLogger", "(", ")", ";", "try", "{", "String", "txt", "=", ...
/* <p> Calls the ListenerHelper to process the event and sends back a message to the reply queue </p> @see org.springframework.jms.listener.SessionAwareMessageListener#onMessage (javax.jms.Message, javax.jms.Session)
[ "/", "*", "<p", ">", "Calls", "the", "ListenerHelper", "to", "process", "the", "event", "and", "sends", "back", "a", "message", "to", "the", "reply", "queue", "<", "/", "p", ">" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/listener/jms/ExternalEventMessageListener.java#L65-L103
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java
AtomPositionMap.getLength
public int getLength(ResidueNumber start, ResidueNumber end) { if( ! start.getChainName().equals(end.getChainName())) { throw new IllegalArgumentException(String.format( "Chains differ between %s and %s. Unable to calculate length.", start,end)); } Integer startPos = getPosition(start); Integer endPos = getPosition(end); if(startPos == null) { throw new IllegalArgumentException("Residue "+start+" was not found."); } if(endPos == null) { throw new IllegalArgumentException("Residue "+start+" was not found."); } return getLength(startPos, endPos, start.getChainName()); }
java
public int getLength(ResidueNumber start, ResidueNumber end) { if( ! start.getChainName().equals(end.getChainName())) { throw new IllegalArgumentException(String.format( "Chains differ between %s and %s. Unable to calculate length.", start,end)); } Integer startPos = getPosition(start); Integer endPos = getPosition(end); if(startPos == null) { throw new IllegalArgumentException("Residue "+start+" was not found."); } if(endPos == null) { throw new IllegalArgumentException("Residue "+start+" was not found."); } return getLength(startPos, endPos, start.getChainName()); }
[ "public", "int", "getLength", "(", "ResidueNumber", "start", ",", "ResidueNumber", "end", ")", "{", "if", "(", "!", "start", ".", "getChainName", "(", ")", ".", "equals", "(", "end", ".", "getChainName", "(", ")", ")", ")", "{", "throw", "new", "Illega...
Calculates the number of atoms between two ResidueNumbers, inclusive. Both residues must belong to the same chain. @param start First residue @param end Last residue @return The number of atoms from A to B inclusive @throws IllegalArgumentException if start and end are on different chains, or if either of the residues doesn't exist
[ "Calculates", "the", "number", "of", "atoms", "between", "two", "ResidueNumbers", "inclusive", ".", "Both", "residues", "must", "belong", "to", "the", "same", "chain", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java#L238-L253
zaproxy/zaproxy
src/org/zaproxy/zap/extension/brk/BreakpointMessageHandler2.java
BreakpointMessageHandler2.handleMessageReceivedFromServer
public boolean handleMessageReceivedFromServer(Message aMessage, boolean onlyIfInScope) { if (! isBreakpoint(aMessage, false, onlyIfInScope)) { return true; } // Do this outside of the semaphore loop so that the 'continue' button can apply to all queued break points // but be reset when the next break point is hit breakMgmt.breakpointHit(); BreakEventPublisher.getPublisher().publishHitEvent(aMessage); synchronized(SEMAPHORE) { if (breakMgmt.isHoldMessage(aMessage)) { BreakEventPublisher.getPublisher().publishActiveEvent(aMessage); setBreakDisplay(aMessage, false); waitUntilContinue(aMessage, false); BreakEventPublisher.getPublisher().publishInactiveEvent(aMessage); } } breakMgmt.clearAndDisableResponse(); return ! breakMgmt.isToBeDropped(); }
java
public boolean handleMessageReceivedFromServer(Message aMessage, boolean onlyIfInScope) { if (! isBreakpoint(aMessage, false, onlyIfInScope)) { return true; } // Do this outside of the semaphore loop so that the 'continue' button can apply to all queued break points // but be reset when the next break point is hit breakMgmt.breakpointHit(); BreakEventPublisher.getPublisher().publishHitEvent(aMessage); synchronized(SEMAPHORE) { if (breakMgmt.isHoldMessage(aMessage)) { BreakEventPublisher.getPublisher().publishActiveEvent(aMessage); setBreakDisplay(aMessage, false); waitUntilContinue(aMessage, false); BreakEventPublisher.getPublisher().publishInactiveEvent(aMessage); } } breakMgmt.clearAndDisableResponse(); return ! breakMgmt.isToBeDropped(); }
[ "public", "boolean", "handleMessageReceivedFromServer", "(", "Message", "aMessage", ",", "boolean", "onlyIfInScope", ")", "{", "if", "(", "!", "isBreakpoint", "(", "aMessage", ",", "false", ",", "onlyIfInScope", ")", ")", "{", "return", "true", ";", "}", "// D...
Do not call if in {@link Mode#safe}. @param aMessage @param onlyIfInScope @return False if message should be dropped.
[ "Do", "not", "call", "if", "in", "{", "@link", "Mode#safe", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/brk/BreakpointMessageHandler2.java#L94-L114
akquinet/needle
src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java
ReflectionUtil.setFieldValue
public static void setFieldValue(final Object object, final String fieldName, final Object value) { final boolean success = new DerivedClassIterator(object.getClass()) { @Override protected boolean handleClass(final Class<?> clazz) { try { setFieldValue(object, clazz, fieldName, value); return true; } catch (final NoSuchFieldException e) { LOG.debug("could not set field " + fieldName + " value " + value, e); } return false; } }.iterate(); if (!success) { LOG.warn("could not set field " + fieldName + " value " + value); } }
java
public static void setFieldValue(final Object object, final String fieldName, final Object value) { final boolean success = new DerivedClassIterator(object.getClass()) { @Override protected boolean handleClass(final Class<?> clazz) { try { setFieldValue(object, clazz, fieldName, value); return true; } catch (final NoSuchFieldException e) { LOG.debug("could not set field " + fieldName + " value " + value, e); } return false; } }.iterate(); if (!success) { LOG.warn("could not set field " + fieldName + " value " + value); } }
[ "public", "static", "void", "setFieldValue", "(", "final", "Object", "object", ",", "final", "String", "fieldName", ",", "final", "Object", "value", ")", "{", "final", "boolean", "success", "=", "new", "DerivedClassIterator", "(", "object", ".", "getClass", "(...
Changing the value of a given field. @param object -- target object of injection @param fieldName -- name of field whose value is to be set @param value -- object that is injected
[ "Changing", "the", "value", "of", "a", "given", "field", "." ]
train
https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java#L201-L221
opentelecoms-org/jsmpp
jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java
AbstractSession.ensureTransmittable
protected void ensureTransmittable(String activityName, boolean only) throws IOException { // TODO uudashr: do we have to use another exception for this checking? SessionState currentState = getSessionState(); if (!currentState.isTransmittable() || (only && currentState.isReceivable())) { throw new IOException("Cannot " + activityName + " while session " + sessionId + " in state " + currentState); } }
java
protected void ensureTransmittable(String activityName, boolean only) throws IOException { // TODO uudashr: do we have to use another exception for this checking? SessionState currentState = getSessionState(); if (!currentState.isTransmittable() || (only && currentState.isReceivable())) { throw new IOException("Cannot " + activityName + " while session " + sessionId + " in state " + currentState); } }
[ "protected", "void", "ensureTransmittable", "(", "String", "activityName", ",", "boolean", "only", ")", "throws", "IOException", "{", "// TODO uudashr: do we have to use another exception for this checking?", "SessionState", "currentState", "=", "getSessionState", "(", ")", "...
Ensure the session is transmittable. If the session not transmittable then an exception thrown. @param activityName is the activity name. @param only set to <tt>true</tt> if you want to ensure transmittable only (transceive will not pass), otherwise set to <tt>false</tt>. @throws IOException if the session not transmittable (by considering the <code>only</code> parameter).
[ "Ensure", "the", "session", "is", "transmittable", ".", "If", "the", "session", "not", "transmittable", "then", "an", "exception", "thrown", "." ]
train
https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java#L439-L445
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java
PathUtils.getPathWithoutSchemeAndAuthority
public static Path getPathWithoutSchemeAndAuthority(Path path) { return new Path(null, null, path.toUri().getPath()); }
java
public static Path getPathWithoutSchemeAndAuthority(Path path) { return new Path(null, null, path.toUri().getPath()); }
[ "public", "static", "Path", "getPathWithoutSchemeAndAuthority", "(", "Path", "path", ")", "{", "return", "new", "Path", "(", "null", ",", "null", ",", "path", ".", "toUri", "(", ")", ".", "getPath", "(", ")", ")", ";", "}" ]
Removes the Scheme and Authority from a Path. @see Path @see URI
[ "Removes", "the", "Scheme", "and", "Authority", "from", "a", "Path", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java#L67-L69
defei/codelogger-utils
src/main/java/org/codelogger/utils/StringUtils.java
StringUtils.containsWordIgnoreCase
public static boolean containsWordIgnoreCase(final String text, final String word) { if (text == null || word == null) { return false; } return containsWord(text.toLowerCase(), word.toLowerCase()); }
java
public static boolean containsWordIgnoreCase(final String text, final String word) { if (text == null || word == null) { return false; } return containsWord(text.toLowerCase(), word.toLowerCase()); }
[ "public", "static", "boolean", "containsWordIgnoreCase", "(", "final", "String", "text", ",", "final", "String", "word", ")", "{", "if", "(", "text", "==", "null", "||", "word", "==", "null", ")", "{", "return", "false", ";", "}", "return", "containsWord",...
Returns true if given text contains given word ignore case; false otherwise. @param text string text to be tested. @param word string word to be tested. @return true if given text contains given word ignore case; false otherwise.
[ "Returns", "true", "if", "given", "text", "contains", "given", "word", "ignore", "case", ";", "false", "otherwise", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/StringUtils.java#L280-L286
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.selectSingleNode
public static Node selectSingleNode(Node node, String xpathQuery, Map<String, String> namespaceUris) { XPath xpath = DocumentHelper.createXPath(xpathQuery); xpath.setNamespaceURIs(namespaceUris); return xpath.selectSingleNode(node); }
java
public static Node selectSingleNode(Node node, String xpathQuery, Map<String, String> namespaceUris) { XPath xpath = DocumentHelper.createXPath(xpathQuery); xpath.setNamespaceURIs(namespaceUris); return xpath.selectSingleNode(node); }
[ "public", "static", "Node", "selectSingleNode", "(", "Node", "node", ",", "String", "xpathQuery", ",", "Map", "<", "String", ",", "String", ">", "namespaceUris", ")", "{", "XPath", "xpath", "=", "DocumentHelper", ".", "createXPath", "(", "xpathQuery", ")", "...
Executes the specified namespace aware XPath query as a single node query, returning the resulting single node.
[ "Executes", "the", "specified", "namespace", "aware", "XPath", "query", "as", "a", "single", "node", "query", "returning", "the", "resulting", "single", "node", "." ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L105-L110
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Request.java
Request.newUploadStagingResourceWithImageRequest
public static Request newUploadStagingResourceWithImageRequest(Session session, Bitmap image, Callback callback) { Bundle parameters = new Bundle(1); parameters.putParcelable(STAGING_PARAM, image); return new Request(session, MY_STAGING_RESOURCES, parameters, HttpMethod.POST, callback); }
java
public static Request newUploadStagingResourceWithImageRequest(Session session, Bitmap image, Callback callback) { Bundle parameters = new Bundle(1); parameters.putParcelable(STAGING_PARAM, image); return new Request(session, MY_STAGING_RESOURCES, parameters, HttpMethod.POST, callback); }
[ "public", "static", "Request", "newUploadStagingResourceWithImageRequest", "(", "Session", "session", ",", "Bitmap", "image", ",", "Callback", "callback", ")", "{", "Bundle", "parameters", "=", "new", "Bundle", "(", "1", ")", ";", "parameters", ".", "putParcelable...
Creates a new Request configured to upload an image to create a staging resource. Staging resources allow you to post binary data such as images, in preparation for a post of an Open Graph object or action which references the image. The URI returned when uploading a staging resource may be passed as the image property for an Open Graph object or action. @param session the Session to use, or null; if non-null, the session must be in an opened state @param image the image to upload @param callback a callback that will be called when the request is completed to handle success or error conditions @return a Request that is ready to execute
[ "Creates", "a", "new", "Request", "configured", "to", "upload", "an", "image", "to", "create", "a", "staging", "resource", ".", "Staging", "resources", "allow", "you", "to", "post", "binary", "data", "such", "as", "images", "in", "preparation", "for", "a", ...
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L637-L643