repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/PointerHierarchyRepresentationBuilder.java
PointerHierarchyRepresentationBuilder.setSize
public void setSize(DBIDRef id, int size) { if(csize == null) { csize = DataStoreUtil.makeIntegerStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, 1); } csize.putInt(id, size); }
java
public void setSize(DBIDRef id, int size) { if(csize == null) { csize = DataStoreUtil.makeIntegerStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, 1); } csize.putInt(id, size); }
[ "public", "void", "setSize", "(", "DBIDRef", "id", ",", "int", "size", ")", "{", "if", "(", "csize", "==", "null", ")", "{", "csize", "=", "DataStoreUtil", ".", "makeIntegerStorage", "(", "ids", ",", "DataStoreFactory", ".", "HINT_HOT", "|", "DataStoreFact...
Set the cluster size of an object. @param id Object to set @param size Cluster size
[ "Set", "the", "cluster", "size", "of", "an", "object", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/PointerHierarchyRepresentationBuilder.java#L186-L191
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.deleteFromTaskAsync
public Observable<Void> deleteFromTaskAsync(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions) { return deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath, recursive, fileDeleteFromTaskOptions).map(new Func1<ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders> response) { return response.body(); } }); }
java
public Observable<Void> deleteFromTaskAsync(String jobId, String taskId, String filePath, Boolean recursive, FileDeleteFromTaskOptions fileDeleteFromTaskOptions) { return deleteFromTaskWithServiceResponseAsync(jobId, taskId, filePath, recursive, fileDeleteFromTaskOptions).map(new Func1<ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, FileDeleteFromTaskHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteFromTaskAsync", "(", "String", "jobId", ",", "String", "taskId", ",", "String", "filePath", ",", "Boolean", "recursive", ",", "FileDeleteFromTaskOptions", "fileDeleteFromTaskOptions", ")", "{", "return", "deleteFromTask...
Deletes the specified task file from the compute node where the task ran. @param jobId The ID of the job that contains the task. @param taskId The ID of the task whose file you want to delete. @param filePath The path to the task file or directory that you want to delete. @param recursive Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. @param fileDeleteFromTaskOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Deletes", "the", "specified", "task", "file", "from", "the", "compute", "node", "where", "the", "task", "ran", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L274-L281
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/Utils.java
Utils.loadDottedClassAsBytes
public static byte[] loadDottedClassAsBytes(ClassLoader loader, String dottedclassname) { if (GlobalConfiguration.assertsMode) { if (dottedclassname.endsWith(".class")) { throw new IllegalStateException(".class suffixed name should not be passed:" + dottedclassname); } if (dottedclassname.indexOf('/') != -1) { throw new IllegalStateException("Should be a dotted name, no slashes:" + dottedclassname); } } InputStream is = loader.getResourceAsStream(dottedclassname.replace('.', '/') + ".class"); if (is == null) { throw new UnableToLoadClassException(dottedclassname); } return Utils.loadBytesFromStream(is); }
java
public static byte[] loadDottedClassAsBytes(ClassLoader loader, String dottedclassname) { if (GlobalConfiguration.assertsMode) { if (dottedclassname.endsWith(".class")) { throw new IllegalStateException(".class suffixed name should not be passed:" + dottedclassname); } if (dottedclassname.indexOf('/') != -1) { throw new IllegalStateException("Should be a dotted name, no slashes:" + dottedclassname); } } InputStream is = loader.getResourceAsStream(dottedclassname.replace('.', '/') + ".class"); if (is == null) { throw new UnableToLoadClassException(dottedclassname); } return Utils.loadBytesFromStream(is); }
[ "public", "static", "byte", "[", "]", "loadDottedClassAsBytes", "(", "ClassLoader", "loader", ",", "String", "dottedclassname", ")", "{", "if", "(", "GlobalConfiguration", ".", "assertsMode", ")", "{", "if", "(", "dottedclassname", ".", "endsWith", "(", "\".clas...
Access the specified class as a resource accessible through the specified loader and return the bytes. The classname should be 'dot' separated (eg. com.foo.Bar) and not suffixed .class @param loader the classloader against which getResourceAsStream() will be invoked @param dottedclassname the dot separated classname without .class suffix @return the byte data defining that class
[ "Access", "the", "specified", "class", "as", "a", "resource", "accessible", "through", "the", "specified", "loader", "and", "return", "the", "bytes", ".", "The", "classname", "should", "be", "dot", "separated", "(", "eg", ".", "com", ".", "foo", ".", "Bar"...
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L770-L784
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FeatureLaplacePyramid.java
FeatureLaplacePyramid.checkMax
private boolean checkMax(T image, double adj, double bestScore, int c_x, int c_y) { sparseLaplace.setImage(image); boolean isMax = true; beginLoop: for (int i = c_y - 1; i <= c_y + 1; i++) { for (int j = c_x - 1; j <= c_x + 1; j++) { double value = adj*sparseLaplace.compute(j, i); if (value >= bestScore) { isMax = false; break beginLoop; } } } return isMax; }
java
private boolean checkMax(T image, double adj, double bestScore, int c_x, int c_y) { sparseLaplace.setImage(image); boolean isMax = true; beginLoop: for (int i = c_y - 1; i <= c_y + 1; i++) { for (int j = c_x - 1; j <= c_x + 1; j++) { double value = adj*sparseLaplace.compute(j, i); if (value >= bestScore) { isMax = false; break beginLoop; } } } return isMax; }
[ "private", "boolean", "checkMax", "(", "T", "image", ",", "double", "adj", ",", "double", "bestScore", ",", "int", "c_x", ",", "int", "c_y", ")", "{", "sparseLaplace", ".", "setImage", "(", "image", ")", ";", "boolean", "isMax", "=", "true", ";", "begi...
See if the best score is better than the local adjusted scores at this scale
[ "See", "if", "the", "best", "score", "is", "better", "than", "the", "local", "adjusted", "scores", "at", "this", "scale" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FeatureLaplacePyramid.java#L244-L258
messagebird/java-rest-api
api/src/main/java/com/messagebird/objects/Message.java
Message.createBinarySMS
static public Message createBinarySMS(String originator, String header, String body, String recipients) { Message msg = new Message(originator, body, recipients); final Map<String, Object> binarySMS = new LinkedHashMap<String, Object>(4); binarySMS.put("udh", header); msg.setTypeDetails(binarySMS); msg.setType(MsgType.binary); return msg; }
java
static public Message createBinarySMS(String originator, String header, String body, String recipients) { Message msg = new Message(originator, body, recipients); final Map<String, Object> binarySMS = new LinkedHashMap<String, Object>(4); binarySMS.put("udh", header); msg.setTypeDetails(binarySMS); msg.setType(MsgType.binary); return msg; }
[ "static", "public", "Message", "createBinarySMS", "(", "String", "originator", ",", "String", "header", ",", "String", "body", ",", "String", "recipients", ")", "{", "Message", "msg", "=", "new", "Message", "(", "originator", ",", "body", ",", "recipients", ...
Factory to create Binary SMS message @param originator @param header @param body @param recipients @return
[ "Factory", "to", "create", "Binary", "SMS", "message" ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/objects/Message.java#L70-L77
ysc/word
src/main/java/org/apdplat/word/util/AutoDetector.java
AutoDetector.loadAndWatchDir
private static List<String> loadAndWatchDir(Path path, ResourceLoader resourceLoader, String resourcePaths) { final List<String> result = new ArrayList<>(); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { result.addAll(load(file.toAbsolutePath().toString())); return FileVisitResult.CONTINUE; } }); } catch (IOException ex) { LOGGER.error("加载资源失败:"+path, ex); } DirectoryWatcher.WatcherCallback watcherCallback = new DirectoryWatcher.WatcherCallback(){ private long lastExecute = System.currentTimeMillis(); @Override public void execute(WatchEvent.Kind<?> kind, String path) { //一秒内发生的多个相同事件认定为一次,防止短时间内多次加载资源 if(System.currentTimeMillis() - lastExecute > 1000){ lastExecute = System.currentTimeMillis(); LOGGER.info("事件:"+kind.name()+" ,路径:"+path); synchronized(AutoDetector.class){ DirectoryWatcher dw = WATCHER_CALLBACKS.get(this); String paths = RESOURCES.get(dw); ResourceLoader loader = RESOURCE_LOADERS.get(dw); LOGGER.info("重新加载数据"); loadAndWatch(loader, paths); } } } }; DirectoryWatcher directoryWatcher = DirectoryWatcher.getDirectoryWatcher(watcherCallback, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE); directoryWatcher.watchDirectoryTree(path); WATCHER_CALLBACKS.put(watcherCallback, directoryWatcher); RESOURCES.put(directoryWatcher, resourcePaths); RESOURCE_LOADERS.put(directoryWatcher, resourceLoader); return result; }
java
private static List<String> loadAndWatchDir(Path path, ResourceLoader resourceLoader, String resourcePaths) { final List<String> result = new ArrayList<>(); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { result.addAll(load(file.toAbsolutePath().toString())); return FileVisitResult.CONTINUE; } }); } catch (IOException ex) { LOGGER.error("加载资源失败:"+path, ex); } DirectoryWatcher.WatcherCallback watcherCallback = new DirectoryWatcher.WatcherCallback(){ private long lastExecute = System.currentTimeMillis(); @Override public void execute(WatchEvent.Kind<?> kind, String path) { //一秒内发生的多个相同事件认定为一次,防止短时间内多次加载资源 if(System.currentTimeMillis() - lastExecute > 1000){ lastExecute = System.currentTimeMillis(); LOGGER.info("事件:"+kind.name()+" ,路径:"+path); synchronized(AutoDetector.class){ DirectoryWatcher dw = WATCHER_CALLBACKS.get(this); String paths = RESOURCES.get(dw); ResourceLoader loader = RESOURCE_LOADERS.get(dw); LOGGER.info("重新加载数据"); loadAndWatch(loader, paths); } } } }; DirectoryWatcher directoryWatcher = DirectoryWatcher.getDirectoryWatcher(watcherCallback, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE); directoryWatcher.watchDirectoryTree(path); WATCHER_CALLBACKS.put(watcherCallback, directoryWatcher); RESOURCES.put(directoryWatcher, resourcePaths); RESOURCE_LOADERS.put(directoryWatcher, resourceLoader); return result; }
[ "private", "static", "List", "<", "String", ">", "loadAndWatchDir", "(", "Path", "path", ",", "ResourceLoader", "resourceLoader", ",", "String", "resourcePaths", ")", "{", "final", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")"...
递归加载目录下面的所有资源 并监控目录变化 @param path 目录路径 @param resourceLoader 资源自定义加载逻辑 @param resourcePaths 资源的所有路径,用于资源监控 @return 目录所有资源内容
[ "递归加载目录下面的所有资源", "并监控目录变化" ]
train
https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/util/AutoDetector.java#L286-L331
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRImporter.java
LRImporter.getObtainJSONData
public LRResult getObtainJSONData(String requestID, Boolean byResourceID, Boolean byDocID, Boolean idsOnly) throws LRException { return getObtainJSONData(requestID, byResourceID, byDocID, idsOnly, null); }
java
public LRResult getObtainJSONData(String requestID, Boolean byResourceID, Boolean byDocID, Boolean idsOnly) throws LRException { return getObtainJSONData(requestID, byResourceID, byDocID, idsOnly, null); }
[ "public", "LRResult", "getObtainJSONData", "(", "String", "requestID", ",", "Boolean", "byResourceID", ",", "Boolean", "byDocID", ",", "Boolean", "idsOnly", ")", "throws", "LRException", "{", "return", "getObtainJSONData", "(", "requestID", ",", "byResourceID", ",",...
Get a result from an obtain request @param requestID the "request_id" value to use for this request @param byResourceID the "by_resource_id" value to use for this request @param byDocID the "by_doc_id" value to use for this request @param idsOnly the "ids_only" value to use for this request @return the result from this request
[ "Get", "a", "result", "from", "an", "obtain", "request" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRImporter.java#L231-L234
graphql-java/graphql-java
src/main/java/graphql/schema/GraphQLSchema.java
GraphQLSchema.isPossibleType
public boolean isPossibleType(GraphQLType abstractType, GraphQLObjectType concreteType) { if (abstractType instanceof GraphQLInterfaceType) { return getImplementations((GraphQLInterfaceType) abstractType).stream() .map(GraphQLType::getName) .anyMatch(name -> concreteType.getName().equals(name)); } else if (abstractType instanceof GraphQLUnionType) { return ((GraphQLUnionType) abstractType).getTypes().stream() .map(GraphQLType::getName) .anyMatch(name -> concreteType.getName().equals(name)); } return assertShouldNeverHappen("Unsupported abstract type %s. Abstract types supported are Union and Interface.", abstractType.getName()); }
java
public boolean isPossibleType(GraphQLType abstractType, GraphQLObjectType concreteType) { if (abstractType instanceof GraphQLInterfaceType) { return getImplementations((GraphQLInterfaceType) abstractType).stream() .map(GraphQLType::getName) .anyMatch(name -> concreteType.getName().equals(name)); } else if (abstractType instanceof GraphQLUnionType) { return ((GraphQLUnionType) abstractType).getTypes().stream() .map(GraphQLType::getName) .anyMatch(name -> concreteType.getName().equals(name)); } return assertShouldNeverHappen("Unsupported abstract type %s. Abstract types supported are Union and Interface.", abstractType.getName()); }
[ "public", "boolean", "isPossibleType", "(", "GraphQLType", "abstractType", ",", "GraphQLObjectType", "concreteType", ")", "{", "if", "(", "abstractType", "instanceof", "GraphQLInterfaceType", ")", "{", "return", "getImplementations", "(", "(", "GraphQLInterfaceType", ")...
Returns true if a specified concrete type is a possible type of a provided abstract type. If the provided abstract type is: - an interface, it checks whether the concrete type is one of its implementations. - a union, it checks whether the concrete type is one of its possible types. @param abstractType abstract type either interface or union @param concreteType concrete type @return true if possible type, false otherwise.
[ "Returns", "true", "if", "a", "specified", "concrete", "type", "is", "a", "possible", "type", "of", "a", "provided", "abstract", "type", ".", "If", "the", "provided", "abstract", "type", "is", ":", "-", "an", "interface", "it", "checks", "whether", "the", ...
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/GraphQLSchema.java#L187-L199
networknt/light-4j
cluster/src/main/java/com/networknt/cluster/LightCluster.java
LightCluster.serviceToUrl
@Override public String serviceToUrl(String protocol, String serviceId, String tag, String requestKey) { URL url = loadBalance.select(discovery(protocol, serviceId, tag), requestKey); if(logger.isDebugEnabled()) logger.debug("final url after load balance = " + url); // construct a url in string return protocol + "://" + url.getHost() + ":" + url.getPort(); }
java
@Override public String serviceToUrl(String protocol, String serviceId, String tag, String requestKey) { URL url = loadBalance.select(discovery(protocol, serviceId, tag), requestKey); if(logger.isDebugEnabled()) logger.debug("final url after load balance = " + url); // construct a url in string return protocol + "://" + url.getHost() + ":" + url.getPort(); }
[ "@", "Override", "public", "String", "serviceToUrl", "(", "String", "protocol", ",", "String", "serviceId", ",", "String", "tag", ",", "String", "requestKey", ")", "{", "URL", "url", "=", "loadBalance", ".", "select", "(", "discovery", "(", "protocol", ",", ...
Implement serviceToUrl with client side service discovery. @param protocol String @param serviceId String @param requestKey String @return String
[ "Implement", "serviceToUrl", "with", "client", "side", "service", "discovery", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/cluster/src/main/java/com/networknt/cluster/LightCluster.java#L62-L68
rundeck/rundeck
core/src/main/java/com/dtolabs/launcher/Preferences.java
Preferences.parseNonReqOptionsAsProperties
public static void parseNonReqOptionsAsProperties(final Properties defaultProperties, final String[] args) throws Exception { // loop thru each argument on cmdline for (final String argProp : args) { //System.out.println("parseNonReqOptionsAsProperties(), argProp: " + argProp); // ignore anything that does not start with -- if (!argProp.startsWith("--")) { continue; } final String propName = convert2PropName(argProp); // get the desired property value from cmdline that we want to reset this property with // this value is the rhs of the = sign final int equalsAt = argProp.indexOf('='); final String propValue = argProp.substring(equalsAt + 1); if (null == propValue || "".equals(propValue)) { throw new Exception("argument: " + argProp + " not valid"); } defaultProperties.setProperty(propName, propValue); } }
java
public static void parseNonReqOptionsAsProperties(final Properties defaultProperties, final String[] args) throws Exception { // loop thru each argument on cmdline for (final String argProp : args) { //System.out.println("parseNonReqOptionsAsProperties(), argProp: " + argProp); // ignore anything that does not start with -- if (!argProp.startsWith("--")) { continue; } final String propName = convert2PropName(argProp); // get the desired property value from cmdline that we want to reset this property with // this value is the rhs of the = sign final int equalsAt = argProp.indexOf('='); final String propValue = argProp.substring(equalsAt + 1); if (null == propValue || "".equals(propValue)) { throw new Exception("argument: " + argProp + " not valid"); } defaultProperties.setProperty(propName, propValue); } }
[ "public", "static", "void", "parseNonReqOptionsAsProperties", "(", "final", "Properties", "defaultProperties", ",", "final", "String", "[", "]", "args", ")", "throws", "Exception", "{", "// loop thru each argument on cmdline", "for", "(", "final", "String", "argProp", ...
Parse arguments that match "--key=value" and populate the Properties with the values. @param defaultProperties the properties @param args the arguments @throws Exception if an error occurs
[ "Parse", "arguments", "that", "match", "--", "key", "=", "value", "and", "populate", "the", "Properties", "with", "the", "values", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/launcher/Preferences.java#L192-L218
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderFormat.java
GenericGenbankHeaderFormat._write_multi_line
private String _write_multi_line(String tag, String text) { if (text == null) { text = ""; } int max_len = MAX_WIDTH - HEADER_WIDTH; ArrayList<String> lines = _split_multi_line(text, max_len); String output = _write_single_line(tag, lines.get(0)); for (int i = 1; i < lines.size(); i++) { output += _write_single_line("", lines.get(i)); } return output; }
java
private String _write_multi_line(String tag, String text) { if (text == null) { text = ""; } int max_len = MAX_WIDTH - HEADER_WIDTH; ArrayList<String> lines = _split_multi_line(text, max_len); String output = _write_single_line(tag, lines.get(0)); for (int i = 1; i < lines.size(); i++) { output += _write_single_line("", lines.get(i)); } return output; }
[ "private", "String", "_write_multi_line", "(", "String", "tag", ",", "String", "text", ")", "{", "if", "(", "text", "==", "null", ")", "{", "text", "=", "\"\"", ";", "}", "int", "max_len", "=", "MAX_WIDTH", "-", "HEADER_WIDTH", ";", "ArrayList", "<", "...
Used in the the 'header' of each GenBank record. @param tag @param text
[ "Used", "in", "the", "the", "header", "of", "each", "GenBank", "record", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderFormat.java#L67-L78
netty/netty
transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java
AbstractEpollStreamChannel.spliceTo
public final ChannelFuture spliceTo(final FileDescriptor ch, final int offset, final int len, final ChannelPromise promise) { checkPositiveOrZero(len, "len"); checkPositiveOrZero(offset, "offser"); if (config().getEpollMode() != EpollMode.LEVEL_TRIGGERED) { throw new IllegalStateException("spliceTo() supported only when using " + EpollMode.LEVEL_TRIGGERED); } checkNotNull(promise, "promise"); if (!isOpen()) { promise.tryFailure(SPLICE_TO_CLOSED_CHANNEL_EXCEPTION); } else { addToSpliceQueue(new SpliceFdTask(ch, offset, len, promise)); failSpliceIfClosed(promise); } return promise; }
java
public final ChannelFuture spliceTo(final FileDescriptor ch, final int offset, final int len, final ChannelPromise promise) { checkPositiveOrZero(len, "len"); checkPositiveOrZero(offset, "offser"); if (config().getEpollMode() != EpollMode.LEVEL_TRIGGERED) { throw new IllegalStateException("spliceTo() supported only when using " + EpollMode.LEVEL_TRIGGERED); } checkNotNull(promise, "promise"); if (!isOpen()) { promise.tryFailure(SPLICE_TO_CLOSED_CHANNEL_EXCEPTION); } else { addToSpliceQueue(new SpliceFdTask(ch, offset, len, promise)); failSpliceIfClosed(promise); } return promise; }
[ "public", "final", "ChannelFuture", "spliceTo", "(", "final", "FileDescriptor", "ch", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "ChannelPromise", "promise", ")", "{", "checkPositiveOrZero", "(", "len", ",", "\"len\"", ")", ";", ...
Splice from this {@link AbstractEpollStreamChannel} to another {@link FileDescriptor}. The {@code offset} is the offset for the {@link FileDescriptor} and {@code len} is the number of bytes to splice. If using {@link Integer#MAX_VALUE} it will splice until the {@link ChannelFuture} was canceled or it was failed. Please note: <ul> <li>{@link EpollChannelConfig#getEpollMode()} must be {@link EpollMode#LEVEL_TRIGGERED} for this {@link AbstractEpollStreamChannel}</li> <li>the {@link FileDescriptor} will not be closed after the {@link ChannelPromise} is notified</li> <li>this channel must be registered to an event loop or {@link IllegalStateException} will be thrown.</li> </ul>
[ "Splice", "from", "this", "{", "@link", "AbstractEpollStreamChannel", "}", "to", "another", "{", "@link", "FileDescriptor", "}", ".", "The", "{", "@code", "offset", "}", "is", "the", "offset", "for", "the", "{", "@link", "FileDescriptor", "}", "and", "{", ...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L214-L229
gocd/gocd
common/src/main/java/com/thoughtworks/go/util/URLService.java
URLService.getUploadUrlOfAgent
public String getUploadUrlOfAgent(JobIdentifier jobIdentifier, String filePath, int attempt) { return format("%s/%s/%s/%s?attempt=%d&buildId=%d", baseRemotingURL, "remoting", "files", jobIdentifier.artifactLocator(filePath), attempt, jobIdentifier.getBuildId()); }
java
public String getUploadUrlOfAgent(JobIdentifier jobIdentifier, String filePath, int attempt) { return format("%s/%s/%s/%s?attempt=%d&buildId=%d", baseRemotingURL, "remoting", "files", jobIdentifier.artifactLocator(filePath), attempt, jobIdentifier.getBuildId()); }
[ "public", "String", "getUploadUrlOfAgent", "(", "JobIdentifier", "jobIdentifier", ",", "String", "filePath", ",", "int", "attempt", ")", "{", "return", "format", "(", "\"%s/%s/%s/%s?attempt=%d&buildId=%d\"", ",", "baseRemotingURL", ",", "\"remoting\"", ",", "\"files\"",...
and therefore cannot locate job correctly when it is rescheduled
[ "and", "therefore", "cannot", "locate", "job", "correctly", "when", "it", "is", "rescheduled" ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/common/src/main/java/com/thoughtworks/go/util/URLService.java#L70-L72
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java
TopElementBuilderFragment.generateMember
protected List<StringConcatenationClient> generateMember(CodeElementExtractor.ElementDescription memberDescription, TopElementDescription topElementDescription, boolean forInterface, boolean forAppender, boolean namedMember) { if (namedMember) { return generateNamedMember(memberDescription, topElementDescription, forInterface, forAppender); } return generateUnnamedMember(memberDescription, topElementDescription, forInterface, forAppender); }
java
protected List<StringConcatenationClient> generateMember(CodeElementExtractor.ElementDescription memberDescription, TopElementDescription topElementDescription, boolean forInterface, boolean forAppender, boolean namedMember) { if (namedMember) { return generateNamedMember(memberDescription, topElementDescription, forInterface, forAppender); } return generateUnnamedMember(memberDescription, topElementDescription, forInterface, forAppender); }
[ "protected", "List", "<", "StringConcatenationClient", ">", "generateMember", "(", "CodeElementExtractor", ".", "ElementDescription", "memberDescription", ",", "TopElementDescription", "topElementDescription", ",", "boolean", "forInterface", ",", "boolean", "forAppender", ","...
Generate a member from the grammar. @param memberDescription the description of the member. @param topElementDescription the description of the top element. @param forInterface indicates if the generated code is for interfaces. @param forAppender <code>true</code> if the generation is for the ISourceAppender. @param namedMember <code>true</code> if the member has name. @return the member functions.
[ "Generate", "a", "member", "from", "the", "grammar", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java#L459-L465
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/CFFFontSubset.java
CFFFontSubset.ReconstructPrivateDict
void ReconstructPrivateDict(int Font,OffsetItem[] fdPrivate,IndexBaseItem[] fdPrivateBase, OffsetItem[] fdSubrs) { // For each fdarray private dict check if that FD is used. // if is used build a new one by changing the subrs offset // Else do nothing for (int i=0;i<fonts[Font].fdprivateOffsets.length;i++) { if (FDArrayUsed.containsKey(Integer.valueOf(i))) { // Mark beginning OutputList.addLast(new MarkerItem(fdPrivate[i])); fdPrivateBase[i] = new IndexBaseItem(); OutputList.addLast(fdPrivateBase[i]); // Goto beginning of objects seek(fonts[Font].fdprivateOffsets[i]); while (getPosition() < fonts[Font].fdprivateOffsets[i]+fonts[Font].fdprivateLengths[i]) { int p1 = getPosition(); getDictItem(); int p2 = getPosition(); // If the dictItem is the "Subrs" then, // use marker for offset and write operator number if (key=="Subrs") { fdSubrs[i] = new DictOffsetItem(); OutputList.addLast(fdSubrs[i]); OutputList.addLast(new UInt8Item((char)19)); // Subrs } // Else copy the entire range else OutputList.addLast(new RangeItem(buf,p1,p2-p1)); } } } }
java
void ReconstructPrivateDict(int Font,OffsetItem[] fdPrivate,IndexBaseItem[] fdPrivateBase, OffsetItem[] fdSubrs) { // For each fdarray private dict check if that FD is used. // if is used build a new one by changing the subrs offset // Else do nothing for (int i=0;i<fonts[Font].fdprivateOffsets.length;i++) { if (FDArrayUsed.containsKey(Integer.valueOf(i))) { // Mark beginning OutputList.addLast(new MarkerItem(fdPrivate[i])); fdPrivateBase[i] = new IndexBaseItem(); OutputList.addLast(fdPrivateBase[i]); // Goto beginning of objects seek(fonts[Font].fdprivateOffsets[i]); while (getPosition() < fonts[Font].fdprivateOffsets[i]+fonts[Font].fdprivateLengths[i]) { int p1 = getPosition(); getDictItem(); int p2 = getPosition(); // If the dictItem is the "Subrs" then, // use marker for offset and write operator number if (key=="Subrs") { fdSubrs[i] = new DictOffsetItem(); OutputList.addLast(fdSubrs[i]); OutputList.addLast(new UInt8Item((char)19)); // Subrs } // Else copy the entire range else OutputList.addLast(new RangeItem(buf,p1,p2-p1)); } } } }
[ "void", "ReconstructPrivateDict", "(", "int", "Font", ",", "OffsetItem", "[", "]", "fdPrivate", ",", "IndexBaseItem", "[", "]", "fdPrivateBase", ",", "OffsetItem", "[", "]", "fdSubrs", ")", "{", "// For each fdarray private dict check if that FD is used.", "// if is use...
Function Adds the new private dicts (only for the FDs used) to the list @param Font the font @param fdPrivate OffsetItem array one element for each private @param fdPrivateBase IndexBaseItem array one element for each private @param fdSubrs OffsetItem array one element for each private
[ "Function", "Adds", "the", "new", "private", "dicts", "(", "only", "for", "the", "FDs", "used", ")", "to", "the", "list" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/CFFFontSubset.java#L1488-L1523
alkacon/opencms-core
src/org/opencms/pdftools/CmsPdfResourceHandler.java
CmsPdfResourceHandler.logXhtmlOutput
protected void logXhtmlOutput(CmsResource formatter, CmsResource content, byte[] xhtmlData) { try { String xhtmlString = new String(xhtmlData, "UTF-8"); LOG.debug( "(PDF generation) The formatter " + formatter.getRootPath() + " generated the following XHTML source from " + content.getRootPath() + ":"); LOG.debug(xhtmlString); } catch (Exception e) { LOG.debug(e.getLocalizedMessage(), e); } }
java
protected void logXhtmlOutput(CmsResource formatter, CmsResource content, byte[] xhtmlData) { try { String xhtmlString = new String(xhtmlData, "UTF-8"); LOG.debug( "(PDF generation) The formatter " + formatter.getRootPath() + " generated the following XHTML source from " + content.getRootPath() + ":"); LOG.debug(xhtmlString); } catch (Exception e) { LOG.debug(e.getLocalizedMessage(), e); } }
[ "protected", "void", "logXhtmlOutput", "(", "CmsResource", "formatter", ",", "CmsResource", "content", ",", "byte", "[", "]", "xhtmlData", ")", "{", "try", "{", "String", "xhtmlString", "=", "new", "String", "(", "xhtmlData", ",", "\"UTF-8\"", ")", ";", "LOG...
Logs the XHTML output.<p> @param formatter the formatter @param content the content resource @param xhtmlData the XHTML data
[ "Logs", "the", "XHTML", "output", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/pdftools/CmsPdfResourceHandler.java#L221-L235
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CriteriaReader.java
CriteriaReader.getValue
private Object getValue(FieldType field, byte[] block) { Object result = null; switch (block[0]) { case 0x07: // Field { result = getFieldType(block); break; } case 0x01: // Constant value { result = getConstantValue(field, block); break; } case 0x00: // Prompt { result = getPromptValue(field, block); break; } } return result; }
java
private Object getValue(FieldType field, byte[] block) { Object result = null; switch (block[0]) { case 0x07: // Field { result = getFieldType(block); break; } case 0x01: // Constant value { result = getConstantValue(field, block); break; } case 0x00: // Prompt { result = getPromptValue(field, block); break; } } return result; }
[ "private", "Object", "getValue", "(", "FieldType", "field", ",", "byte", "[", "]", "block", ")", "{", "Object", "result", "=", "null", ";", "switch", "(", "block", "[", "0", "]", ")", "{", "case", "0x07", ":", "// Field", "{", "result", "=", "getFiel...
Retrieves the value component of a criteria expression. @param field field type @param block block data @return field value
[ "Retrieves", "the", "value", "component", "of", "a", "criteria", "expression", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L305-L331
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java
AnnotationTypeBuilder.getInstance
public static AnnotationTypeBuilder getInstance(Context context, TypeElement annotationTypeDoc, AnnotationTypeWriter writer) { return new AnnotationTypeBuilder(context, annotationTypeDoc, writer); }
java
public static AnnotationTypeBuilder getInstance(Context context, TypeElement annotationTypeDoc, AnnotationTypeWriter writer) { return new AnnotationTypeBuilder(context, annotationTypeDoc, writer); }
[ "public", "static", "AnnotationTypeBuilder", "getInstance", "(", "Context", "context", ",", "TypeElement", "annotationTypeDoc", ",", "AnnotationTypeWriter", "writer", ")", "{", "return", "new", "AnnotationTypeBuilder", "(", "context", ",", "annotationTypeDoc", ",", "wri...
Construct a new AnnotationTypeBuilder. @param context the build context. @param annotationTypeDoc the class being documented. @param writer the doclet specific writer. @return an AnnotationTypeBuilder
[ "Construct", "a", "new", "AnnotationTypeBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java#L92-L96
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java
OrmLiteCursorAdapter.bindView
@Override public final void bindView(View itemView, Context context, Cursor cursor) { doBindView(itemView, context, cursor); }
java
@Override public final void bindView(View itemView, Context context, Cursor cursor) { doBindView(itemView, context, cursor); }
[ "@", "Override", "public", "final", "void", "bindView", "(", "View", "itemView", ",", "Context", "context", ",", "Cursor", "cursor", ")", "{", "doBindView", "(", "itemView", ",", "context", ",", "cursor", ")", ";", "}" ]
Final to prevent subclasses from accidentally overriding. Intentional overriding can be accomplished by overriding {@link #doBindView(View, Context, Cursor)}. @see CursorAdapter#bindView(View, Context, Cursor)
[ "Final", "to", "prevent", "subclasses", "from", "accidentally", "overriding", ".", "Intentional", "overriding", "can", "be", "accomplished", "by", "overriding", "{", "@link", "#doBindView", "(", "View", "Context", "Cursor", ")", "}", "." ]
train
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java#L37-L40
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getTileGridFromWGS84
public static TileGrid getTileGridFromWGS84(Point point, int zoom) { Projection projection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); return getTileGrid(point, zoom, projection); }
java
public static TileGrid getTileGridFromWGS84(Point point, int zoom) { Projection projection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); return getTileGrid(point, zoom, projection); }
[ "public", "static", "TileGrid", "getTileGridFromWGS84", "(", "Point", "point", ",", "int", "zoom", ")", "{", "Projection", "projection", "=", "ProjectionFactory", ".", "getProjection", "(", "ProjectionConstants", ".", "EPSG_WORLD_GEODETIC_SYSTEM", ")", ";", "return", ...
Get the tile grid for the location specified as WGS84 @param point point @param zoom zoom level @return tile grid @since 1.1.0
[ "Get", "the", "tile", "grid", "for", "the", "location", "specified", "as", "WGS84" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L556-L560
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/SimpleAttributeDefinition.java
SimpleAttributeDefinition.marshallAsAttribute
public void marshallAsAttribute(final ModelNode resourceModel, final XMLStreamWriter writer) throws XMLStreamException { marshallAsAttribute(resourceModel, true, writer); }
java
public void marshallAsAttribute(final ModelNode resourceModel, final XMLStreamWriter writer) throws XMLStreamException { marshallAsAttribute(resourceModel, true, writer); }
[ "public", "void", "marshallAsAttribute", "(", "final", "ModelNode", "resourceModel", ",", "final", "XMLStreamWriter", "writer", ")", "throws", "XMLStreamException", "{", "marshallAsAttribute", "(", "resourceModel", ",", "true", ",", "writer", ")", ";", "}" ]
Marshalls the value from the given {@code resourceModel} as an xml attribute, if it {@link #isMarshallable(org.jboss.dmr.ModelNode, boolean) is marshallable}. <p> Invoking this method is the same as calling {@code marshallAsAttribute(resourceModel, true, writer)} </p> @param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}. @param writer stream writer to use for writing the attribute @throws javax.xml.stream.XMLStreamException if {@code writer} throws an exception
[ "Marshalls", "the", "value", "from", "the", "given", "{", "@code", "resourceModel", "}", "as", "an", "xml", "attribute", "if", "it", "{", "@link", "#isMarshallable", "(", "org", ".", "jboss", ".", "dmr", ".", "ModelNode", "boolean", ")", "is", "marshallabl...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/SimpleAttributeDefinition.java#L132-L134
Erudika/para
para-client/src/main/java/com/erudika/para/client/ParaClient.java
ParaClient.getChildren
@SuppressWarnings("unchecked") public <P extends ParaObject> List<P> getChildren(ParaObject obj, String type2, Pager... pager) { if (obj == null || obj.getId() == null || type2 == null) { return Collections.emptyList(); } MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); params.putSingle("childrenonly", "true"); params.putAll(pagerToParams(pager)); String url = Utils.formatMessage("{0}/links/{1}", obj.getObjectURI(), type2); return getItems((Map<String, Object>) getEntity(invokeGet(url, params), Map.class), pager); }
java
@SuppressWarnings("unchecked") public <P extends ParaObject> List<P> getChildren(ParaObject obj, String type2, Pager... pager) { if (obj == null || obj.getId() == null || type2 == null) { return Collections.emptyList(); } MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); params.putSingle("childrenonly", "true"); params.putAll(pagerToParams(pager)); String url = Utils.formatMessage("{0}/links/{1}", obj.getObjectURI(), type2); return getItems((Map<String, Object>) getEntity(invokeGet(url, params), Map.class), pager); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "P", "extends", "ParaObject", ">", "List", "<", "P", ">", "getChildren", "(", "ParaObject", "obj", ",", "String", "type2", ",", "Pager", "...", "pager", ")", "{", "if", "(", "obj", "==", ...
Returns all child objects linked to this object. @param <P> the type of children @param type2 the type of children to look for @param obj the object to execute this method on @param pager a {@link com.erudika.para.utils.Pager} @return a list of {@link ParaObject} in a one-to-many relationship with this object
[ "Returns", "all", "child", "objects", "linked", "to", "this", "object", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L1093-L1103
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/PriorityQueue.java
PriorityQueue.insert
public boolean insert(T element){ if (size < maxSize){ put(element); return true; } else if (size > 0 && !lessThan(element, top())){ heap[1] = element; adjustTop(); return true; } else return false; }
java
public boolean insert(T element){ if (size < maxSize){ put(element); return true; } else if (size > 0 && !lessThan(element, top())){ heap[1] = element; adjustTop(); return true; } else return false; }
[ "public", "boolean", "insert", "(", "T", "element", ")", "{", "if", "(", "size", "<", "maxSize", ")", "{", "put", "(", "element", ")", ";", "return", "true", ";", "}", "else", "if", "(", "size", ">", "0", "&&", "!", "lessThan", "(", "element", ",...
Adds element to the PriorityQueue in log(size) time if either the PriorityQueue is not full, or not lessThan(element, top()). @param element @return true if element is added, false otherwise.
[ "Adds", "element", "to", "the", "PriorityQueue", "in", "log", "(", "size", ")", "time", "if", "either", "the", "PriorityQueue", "is", "not", "full", "or", "not", "lessThan", "(", "element", "top", "()", ")", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/PriorityQueue.java#L61-L73
xwiki/xwiki-rendering
xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/parser/XDOMBuilder.java
XDOMBuilder.addBlock
public void addBlock(Block block) { try { this.stack.getFirst().add(block); } catch (NoSuchElementException e) { throw new IllegalStateException("All container blocks are closed, too many calls to endBlockList()."); } }
java
public void addBlock(Block block) { try { this.stack.getFirst().add(block); } catch (NoSuchElementException e) { throw new IllegalStateException("All container blocks are closed, too many calls to endBlockList()."); } }
[ "public", "void", "addBlock", "(", "Block", "block", ")", "{", "try", "{", "this", ".", "stack", ".", "getFirst", "(", ")", ".", "add", "(", "block", ")", ";", "}", "catch", "(", "NoSuchElementException", "e", ")", "{", "throw", "new", "IllegalStateExc...
Add a block to the current block container. @param block the block to be added.
[ "Add", "a", "block", "to", "the", "current", "block", "container", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/parser/XDOMBuilder.java#L97-L104
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/ConfigurationReader.java
ConfigurationReader.parseSQLConfig
private void parseSQLConfig(final Node node, final ConfigSettings config) { String name, value; Node nnode; NodeList list = node.getChildNodes(); int length = list.getLength(); for (int i = 0; i < length; i++) { nnode = list.item(i); name = nnode.getNodeName().toUpperCase(); if (name.equals(KEY_HOST)) { value = nnode.getChildNodes().item(0).getNodeValue(); config.setConfigParameter(ConfigurationKeys.SQL_HOST, value); } else if (name.equals(KEY_DATABASE)) { value = nnode.getChildNodes().item(0).getNodeValue(); config.setConfigParameter(ConfigurationKeys.SQL_DATABASE, value); } else if (name.equals(KEY_USER)) { value = nnode.getChildNodes().item(0).getNodeValue(); config.setConfigParameter(ConfigurationKeys.SQL_USERNAME, value); } else if (name.equals(KEY_PASSWORD)) { value = nnode.getChildNodes().item(0).getNodeValue(); config.setConfigParameter(ConfigurationKeys.SQL_PASSWORD, value); } } }
java
private void parseSQLConfig(final Node node, final ConfigSettings config) { String name, value; Node nnode; NodeList list = node.getChildNodes(); int length = list.getLength(); for (int i = 0; i < length; i++) { nnode = list.item(i); name = nnode.getNodeName().toUpperCase(); if (name.equals(KEY_HOST)) { value = nnode.getChildNodes().item(0).getNodeValue(); config.setConfigParameter(ConfigurationKeys.SQL_HOST, value); } else if (name.equals(KEY_DATABASE)) { value = nnode.getChildNodes().item(0).getNodeValue(); config.setConfigParameter(ConfigurationKeys.SQL_DATABASE, value); } else if (name.equals(KEY_USER)) { value = nnode.getChildNodes().item(0).getNodeValue(); config.setConfigParameter(ConfigurationKeys.SQL_USERNAME, value); } else if (name.equals(KEY_PASSWORD)) { value = nnode.getChildNodes().item(0).getNodeValue(); config.setConfigParameter(ConfigurationKeys.SQL_PASSWORD, value); } } }
[ "private", "void", "parseSQLConfig", "(", "final", "Node", "node", ",", "final", "ConfigSettings", "config", ")", "{", "String", "name", ",", "value", ";", "Node", "nnode", ";", "NodeList", "list", "=", "node", ".", "getChildNodes", "(", ")", ";", "int", ...
Parses the sql parameter section. @param node Reference to the current used xml node @param config Reference to the ConfigSettings
[ "Parses", "the", "sql", "parameter", "section", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/ConfigurationReader.java#L589-L625
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContactSet.java
GroupContactSet.getContact
public GroupContact getContact(Group group1, Group group2) { return contacts.get( new Pair<ResidueNumber>(group1.getResidueNumber(),group2.getResidueNumber())); }
java
public GroupContact getContact(Group group1, Group group2) { return contacts.get( new Pair<ResidueNumber>(group1.getResidueNumber(),group2.getResidueNumber())); }
[ "public", "GroupContact", "getContact", "(", "Group", "group1", ",", "Group", "group2", ")", "{", "return", "contacts", ".", "get", "(", "new", "Pair", "<", "ResidueNumber", ">", "(", "group1", ".", "getResidueNumber", "(", ")", ",", "group2", ".", "getRes...
Returns the corresponding GroupContact or null if no contact exists between the 2 given groups @param group1 @param group2 @return
[ "Returns", "the", "corresponding", "GroupContact", "or", "null", "if", "no", "contact", "exists", "between", "the", "2", "given", "groups" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContactSet.java#L140-L143
EdwardRaff/JSAT
JSAT/src/jsat/utils/GridDataGenerator.java
GridDataGenerator.addSamples
private void addSamples(int[] curClass, int curDim, int samples, List<DataPoint> dataPoints, int[] dim) { if(curDim < dimensions.length-1) for(int i = 0; i < dimensions[curDim+1]; i++ ) { int[] nextDim = Arrays.copyOf(dim, dim.length); nextDim[curDim+1] = i; addSamples(curClass, curDim+1, samples, dataPoints, nextDim); } else//Add data points! { for(int i = 0; i < samples; i++) { DenseVector dv = new DenseVector(dim.length); for(int j = 0; j < dim.length; j++) dv.set(j, dim[j]+noiseSource.invCdf(rand.nextDouble())); dataPoints.add(new DataPoint(dv, new int[]{ curClass[0] }, catDataInfo)); } curClass[0]++; } }
java
private void addSamples(int[] curClass, int curDim, int samples, List<DataPoint> dataPoints, int[] dim) { if(curDim < dimensions.length-1) for(int i = 0; i < dimensions[curDim+1]; i++ ) { int[] nextDim = Arrays.copyOf(dim, dim.length); nextDim[curDim+1] = i; addSamples(curClass, curDim+1, samples, dataPoints, nextDim); } else//Add data points! { for(int i = 0; i < samples; i++) { DenseVector dv = new DenseVector(dim.length); for(int j = 0; j < dim.length; j++) dv.set(j, dim[j]+noiseSource.invCdf(rand.nextDouble())); dataPoints.add(new DataPoint(dv, new int[]{ curClass[0] }, catDataInfo)); } curClass[0]++; } }
[ "private", "void", "addSamples", "(", "int", "[", "]", "curClass", ",", "int", "curDim", ",", "int", "samples", ",", "List", "<", "DataPoint", ">", "dataPoints", ",", "int", "[", "]", "dim", ")", "{", "if", "(", "curDim", "<", "dimensions", ".", "len...
Helper function @param curClass used as a pointer to an integer so that we dont have to add class tracking logic @param curDim the current dimension to split on. If we are at the last dimension, we add data points instead. @param samples the number of samples to take for each class @param dataPoints the location to put the data points in @param dim the array specifying the current point we are working from.
[ "Helper", "function" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/GridDataGenerator.java#L90-L110
rhuss/jolokia
agent/jmx/src/main/java/org/jolokia/jmx/JolokiaMBeanServer.java
JolokiaMBeanServer.fromJson
Object fromJson(String type, String json) { return converters.getToObjectConverter().convertFromString(type,json); }
java
Object fromJson(String type, String json) { return converters.getToObjectConverter().convertFromString(type,json); }
[ "Object", "fromJson", "(", "String", "type", ",", "String", "json", ")", "{", "return", "converters", ".", "getToObjectConverter", "(", ")", ".", "convertFromString", "(", "type", ",", "json", ")", ";", "}" ]
Convert from a JSON or other string representation to real object. Used when preparing operation argument. If the JSON structure cannot be converted, an {@link IllegalArgumentException} is thrown. @param type type to convert to @param json string to deserialize @return the deserialized object
[ "Convert", "from", "a", "JSON", "or", "other", "string", "representation", "to", "real", "object", ".", "Used", "when", "preparing", "operation", "argument", ".", "If", "the", "JSON", "structure", "cannot", "be", "converted", "an", "{", "@link", "IllegalArgume...
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jmx/src/main/java/org/jolokia/jmx/JolokiaMBeanServer.java#L167-L169
joniles/mpxj
src/main/java/net/sf/mpxj/ganttproject/GanttProjectReader.java
GanttProjectReader.setExceptions
private void setExceptions(ProjectCalendar mpxjCalendar, Calendars gpCalendar) { List<net.sf.mpxj.ganttproject.schema.Date> dates = gpCalendar.getDate(); for (net.sf.mpxj.ganttproject.schema.Date date : dates) { addException(mpxjCalendar, date); } }
java
private void setExceptions(ProjectCalendar mpxjCalendar, Calendars gpCalendar) { List<net.sf.mpxj.ganttproject.schema.Date> dates = gpCalendar.getDate(); for (net.sf.mpxj.ganttproject.schema.Date date : dates) { addException(mpxjCalendar, date); } }
[ "private", "void", "setExceptions", "(", "ProjectCalendar", "mpxjCalendar", ",", "Calendars", "gpCalendar", ")", "{", "List", "<", "net", ".", "sf", ".", "mpxj", ".", "ganttproject", ".", "schema", ".", "Date", ">", "dates", "=", "gpCalendar", ".", "getDate"...
Add exceptions to the calendar. @param mpxjCalendar MPXJ calendar @param gpCalendar GanttProject calendar
[ "Add", "exceptions", "to", "the", "calendar", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttproject/GanttProjectReader.java#L292-L299
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java
ApiOvhHostingprivateDatabase.serviceName_whitelist_GET
public ArrayList<String> serviceName_whitelist_GET(String serviceName, String ip, Boolean service, Boolean sftp) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/whitelist"; StringBuilder sb = path(qPath, serviceName); query(sb, "ip", ip); query(sb, "service", service); query(sb, "sftp", sftp); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> serviceName_whitelist_GET(String serviceName, String ip, Boolean service, Boolean sftp) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/whitelist"; StringBuilder sb = path(qPath, serviceName); query(sb, "ip", ip); query(sb, "service", service); query(sb, "sftp", sftp); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "serviceName_whitelist_GET", "(", "String", "serviceName", ",", "String", "ip", ",", "Boolean", "service", ",", "Boolean", "sftp", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/privateDatabase/{serv...
Whitelist allowed on your privatesql REST: GET /hosting/privateDatabase/{serviceName}/whitelist @param ip [required] Filter the value of ip property (contains or equals) @param service [required] Filter the value of service property (=) @param sftp [required] Filter the value of sftp property (=) @param serviceName [required] The internal name of your private database
[ "Whitelist", "allowed", "on", "your", "privatesql" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L848-L856
EasyinnovaSL/Tiff-Library-4J
src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java
BaselineProfile.CheckRGBImage
private void CheckRGBImage(IfdTags metadata, int n) { // Samples per Pixel long samples = metadata.get(TiffTags.getTagId("SamplesPerPixel")).getFirstNumericValue(); if (samples < 3) validation.addError("Invalid Samples per Pixel", "IFD" + n, samples); // Compression long comp = metadata.get(TiffTags.getTagId("Compression")).getFirstNumericValue(); // if (comp != 1 && comp != 32773) if (comp < 1) validation.addError("Invalid Compression", "IFD" + n, comp); }
java
private void CheckRGBImage(IfdTags metadata, int n) { // Samples per Pixel long samples = metadata.get(TiffTags.getTagId("SamplesPerPixel")).getFirstNumericValue(); if (samples < 3) validation.addError("Invalid Samples per Pixel", "IFD" + n, samples); // Compression long comp = metadata.get(TiffTags.getTagId("Compression")).getFirstNumericValue(); // if (comp != 1 && comp != 32773) if (comp < 1) validation.addError("Invalid Compression", "IFD" + n, comp); }
[ "private", "void", "CheckRGBImage", "(", "IfdTags", "metadata", ",", "int", "n", ")", "{", "// Samples per Pixel", "long", "samples", "=", "metadata", ".", "get", "(", "TiffTags", ".", "getTagId", "(", "\"SamplesPerPixel\"", ")", ")", ".", "getFirstNumericValue"...
Check RGB Image. @param metadata the metadata @param n the IFD number
[ "Check", "RGB", "Image", "." ]
train
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java#L431-L442
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java
ServicePoolBuilder.withHostDiscovery
public ServicePoolBuilder<S> withHostDiscovery(final HostDiscovery hostDiscovery) { checkNotNull(hostDiscovery); HostDiscoverySource hostDiscoverySource = new HostDiscoverySource() { @Override public HostDiscovery forService(String serviceName) { return hostDiscovery; } }; return withHostDiscovery(hostDiscoverySource, false); }
java
public ServicePoolBuilder<S> withHostDiscovery(final HostDiscovery hostDiscovery) { checkNotNull(hostDiscovery); HostDiscoverySource hostDiscoverySource = new HostDiscoverySource() { @Override public HostDiscovery forService(String serviceName) { return hostDiscovery; } }; return withHostDiscovery(hostDiscoverySource, false); }
[ "public", "ServicePoolBuilder", "<", "S", ">", "withHostDiscovery", "(", "final", "HostDiscovery", "hostDiscovery", ")", "{", "checkNotNull", "(", "hostDiscovery", ")", ";", "HostDiscoverySource", "hostDiscoverySource", "=", "new", "HostDiscoverySource", "(", ")", "{"...
Adds a {@link HostDiscovery} instance to the builder. The service pool will use this {@code HostDiscovery} instance unless a preceding {@link HostDiscoverySource} provides a non-null instance of {@code HostDiscovery} for a given service name. <p> Once this method is called, any subsequent calls to host discovery-related methods on this builder instance are ignored (because this non-null discovery will always be returned). <p> Note that callers of this method are responsible for calling {@link HostDiscovery#close} on the passed instance. @param hostDiscovery the host discovery instance to use in the built {@link ServicePool} @return this
[ "Adds", "a", "{", "@link", "HostDiscovery", "}", "instance", "to", "the", "builder", ".", "The", "service", "pool", "will", "use", "this", "{", "@code", "HostDiscovery", "}", "instance", "unless", "a", "preceding", "{", "@link", "HostDiscoverySource", "}", "...
train
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java#L93-L102
samskivert/samskivert
src/main/java/com/samskivert/util/PropertiesUtil.java
PropertiesUtil.getFilteredProperties
public static Properties getFilteredProperties (final Properties source, String prefix) { final String dprefix = prefix + "."; return new Properties() { @Override public String getProperty (String key) { return getProperty(key, null); } @Override public String getProperty (String key, String defaultValue) { return source.getProperty(dprefix + key, source.getProperty(key, defaultValue)); } @Override public Enumeration<?> propertyNames () { return new Enumeration<Object>() { public boolean hasMoreElements () { return next != null; } public Object nextElement () { Object onext = next; next = findNext(); return onext; } protected Object findNext () { while (senum.hasMoreElements()) { String name = (String)senum.nextElement(); if (!name.startsWith(dprefix)) { return name; } name = name.substring(dprefix.length()); if (!source.containsKey(name)) { return name; } } return null; } protected Enumeration<?> senum = source.propertyNames(); protected Object next = findNext(); }; } }; }
java
public static Properties getFilteredProperties (final Properties source, String prefix) { final String dprefix = prefix + "."; return new Properties() { @Override public String getProperty (String key) { return getProperty(key, null); } @Override public String getProperty (String key, String defaultValue) { return source.getProperty(dprefix + key, source.getProperty(key, defaultValue)); } @Override public Enumeration<?> propertyNames () { return new Enumeration<Object>() { public boolean hasMoreElements () { return next != null; } public Object nextElement () { Object onext = next; next = findNext(); return onext; } protected Object findNext () { while (senum.hasMoreElements()) { String name = (String)senum.nextElement(); if (!name.startsWith(dprefix)) { return name; } name = name.substring(dprefix.length()); if (!source.containsKey(name)) { return name; } } return null; } protected Enumeration<?> senum = source.propertyNames(); protected Object next = findNext(); }; } }; }
[ "public", "static", "Properties", "getFilteredProperties", "(", "final", "Properties", "source", ",", "String", "prefix", ")", "{", "final", "String", "dprefix", "=", "prefix", "+", "\".\"", ";", "return", "new", "Properties", "(", ")", "{", "@", "Override", ...
Returns a filtered version of the specified properties that first looks for a property starting with the given prefix, then looks for a property without the prefix. For example, passing the prefix "alt" and using the following properties: <pre> alt.texture = sand.png lighting = off </pre> ...would return "sand.png" for the property "texture" and "off" for the property "lighting". Unlike {@link #getSubProperties}, the object returned by this method references, rather than copies, the underlying properties. Only the {@link Properties#getProperty} methods are guaranteed to work correctly on the returned object.
[ "Returns", "a", "filtered", "version", "of", "the", "specified", "properties", "that", "first", "looks", "for", "a", "property", "starting", "with", "the", "given", "prefix", "then", "looks", "for", "a", "property", "without", "the", "prefix", ".", "For", "e...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PropertiesUtil.java#L94-L132
aalmiray/Json-lib
src/main/java/net/sf/json/JsonConfig.java
JsonConfig.unregisterPropertyExclusion
public void unregisterPropertyExclusion( Class target, String propertyName ) { if( target != null && propertyName != null ) { Set set = (Set) exclusionMap.get( target ); if( set == null ) { set = new HashSet(); exclusionMap.put( target, set ); } set.remove( propertyName ); } }
java
public void unregisterPropertyExclusion( Class target, String propertyName ) { if( target != null && propertyName != null ) { Set set = (Set) exclusionMap.get( target ); if( set == null ) { set = new HashSet(); exclusionMap.put( target, set ); } set.remove( propertyName ); } }
[ "public", "void", "unregisterPropertyExclusion", "(", "Class", "target", ",", "String", "propertyName", ")", "{", "if", "(", "target", "!=", "null", "&&", "propertyName", "!=", "null", ")", "{", "Set", "set", "=", "(", "Set", ")", "exclusionMap", ".", "get...
Removes a property exclusion assigned to the target class.<br> [Java -&gt; JSON] @param target a class used for searching property exclusions. @param propertyName the name of the property to be removed from the exclusion list.
[ "Removes", "a", "property", "exclusion", "assigned", "to", "the", "target", "class", ".", "<br", ">", "[", "Java", "-", "&gt", ";", "JSON", "]" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L1403-L1412
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAPooledEntityManager.java
JPAPooledEntityManager.getEMInvocationInfo
@Override EntityManager getEMInvocationInfo(boolean requireTx, LockModeType mode) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) { Tr.entry(tc, "getEMInvocationInfo : " + requireTx + " : " + ((mode == null) ? "null" : mode)); } if (requireTx || (mode != null && !LockModeType.NONE.equals(mode))) { throw new UnsupportedOperationException("This entity manager cannot perform operations that require a transactional context"); } if (!ivEnlisted) { UOWCoordinator uowCoord = ivAbstractJPAComponent.getUOWCurrent().getUOWCoord(); // Enlist in either the global tran or LTC if (uowCoord.isGlobal()) { // Register invocation object to transaction manager for clean up registerEmInvocation(uowCoord, this); //d638095.2 } else { // Register invocation object to LTC for clean up LocalTransactionCoordinator ltCoord = (LocalTransactionCoordinator) uowCoord; ltCoord.enlistSynchronization(this); } // Mark this em as enlisted for clean up ivEnlisted = true; } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getEMInvocationInfo : " + ivEm); return ivEm; }
java
@Override EntityManager getEMInvocationInfo(boolean requireTx, LockModeType mode) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) { Tr.entry(tc, "getEMInvocationInfo : " + requireTx + " : " + ((mode == null) ? "null" : mode)); } if (requireTx || (mode != null && !LockModeType.NONE.equals(mode))) { throw new UnsupportedOperationException("This entity manager cannot perform operations that require a transactional context"); } if (!ivEnlisted) { UOWCoordinator uowCoord = ivAbstractJPAComponent.getUOWCurrent().getUOWCoord(); // Enlist in either the global tran or LTC if (uowCoord.isGlobal()) { // Register invocation object to transaction manager for clean up registerEmInvocation(uowCoord, this); //d638095.2 } else { // Register invocation object to LTC for clean up LocalTransactionCoordinator ltCoord = (LocalTransactionCoordinator) uowCoord; ltCoord.enlistSynchronization(this); } // Mark this em as enlisted for clean up ivEnlisted = true; } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getEMInvocationInfo : " + ivEm); return ivEm; }
[ "@", "Override", "EntityManager", "getEMInvocationInfo", "(", "boolean", "requireTx", ",", "LockModeType", "mode", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", "....
(non-Javadoc) Verifies that the intent of the invocation is read-only, enlists in the global or LTC and returns the pooled entity manager.
[ "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAPooledEntityManager.java#L59-L96
google/closure-compiler
src/com/google/javascript/jscomp/graph/Graph.java
Graph.connectIfNotFound
public final void connectIfNotFound(N n1, E edge, N n2) { if (!isConnected(n1, edge, n2)) { connect(n1, edge, n2); } }
java
public final void connectIfNotFound(N n1, E edge, N n2) { if (!isConnected(n1, edge, n2)) { connect(n1, edge, n2); } }
[ "public", "final", "void", "connectIfNotFound", "(", "N", "n1", ",", "E", "edge", ",", "N", "n2", ")", "{", "if", "(", "!", "isConnected", "(", "n1", ",", "edge", ",", "n2", ")", ")", "{", "connect", "(", "n1", ",", "edge", ",", "n2", ")", ";",...
Connects two nodes in the graph with an edge if such edge does not already exists between the nodes. @param n1 First node. @param edge The edge. @param n2 Second node.
[ "Connects", "two", "nodes", "in", "the", "graph", "with", "an", "edge", "if", "such", "edge", "does", "not", "already", "exists", "between", "the", "nodes", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/Graph.java#L118-L122
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.vpnDeviceConfigurationScriptAsync
public Observable<String> vpnDeviceConfigurationScriptAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, VpnDeviceScriptParameters parameters) { return vpnDeviceConfigurationScriptWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).map(new Func1<ServiceResponse<String>, String>() { @Override public String call(ServiceResponse<String> response) { return response.body(); } }); }
java
public Observable<String> vpnDeviceConfigurationScriptAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, VpnDeviceScriptParameters parameters) { return vpnDeviceConfigurationScriptWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).map(new Func1<ServiceResponse<String>, String>() { @Override public String call(ServiceResponse<String> response) { return response.body(); } }); }
[ "public", "Observable", "<", "String", ">", "vpnDeviceConfigurationScriptAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "VpnDeviceScriptParameters", "parameters", ")", "{", "return", "vpnDeviceConfigurationScriptWithServiceR...
Gets a xml format representation for vpn device configuration script. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection for which the configuration script is generated. @param parameters Parameters supplied to the generate vpn device script operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the String object
[ "Gets", "a", "xml", "format", "representation", "for", "vpn", "device", "configuration", "script", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L3005-L3012
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java
StagingArea.put
public synchronized void put(final CacheKey key, final EncodedImage encodedImage) { Preconditions.checkNotNull(key); Preconditions.checkArgument(EncodedImage.isValid(encodedImage)); // we're making a 'copy' of this reference - so duplicate it final EncodedImage oldEntry = mMap.put(key, EncodedImage.cloneOrNull(encodedImage)); EncodedImage.closeSafely(oldEntry); logStats(); }
java
public synchronized void put(final CacheKey key, final EncodedImage encodedImage) { Preconditions.checkNotNull(key); Preconditions.checkArgument(EncodedImage.isValid(encodedImage)); // we're making a 'copy' of this reference - so duplicate it final EncodedImage oldEntry = mMap.put(key, EncodedImage.cloneOrNull(encodedImage)); EncodedImage.closeSafely(oldEntry); logStats(); }
[ "public", "synchronized", "void", "put", "(", "final", "CacheKey", "key", ",", "final", "EncodedImage", "encodedImage", ")", "{", "Preconditions", ".", "checkNotNull", "(", "key", ")", ";", "Preconditions", ".", "checkArgument", "(", "EncodedImage", ".", "isVali...
Stores key-value in this StagingArea. This call overrides previous value of stored reference if @param key @param encodedImage EncodedImage to be associated with key
[ "Stores", "key", "-", "value", "in", "this", "StagingArea", ".", "This", "call", "overrides", "previous", "value", "of", "stored", "reference", "if" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java#L48-L56
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.moveFieldToThis
public int moveFieldToThis(FieldInfo field, boolean bDisplayOption, int iMoveMode) { // Copy a field to this if (this.isSameType(field)) { // Same type, just move the info Object data = field.getData(); return this.setData(data, bDisplayOption, iMoveMode); } else { // Different type... convert to text first String tempString = field.getString(); return this.setString(tempString, bDisplayOption, iMoveMode); } }
java
public int moveFieldToThis(FieldInfo field, boolean bDisplayOption, int iMoveMode) { // Copy a field to this if (this.isSameType(field)) { // Same type, just move the info Object data = field.getData(); return this.setData(data, bDisplayOption, iMoveMode); } else { // Different type... convert to text first String tempString = field.getString(); return this.setString(tempString, bDisplayOption, iMoveMode); } }
[ "public", "int", "moveFieldToThis", "(", "FieldInfo", "field", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "// Copy a field to this", "if", "(", "this", ".", "isSameType", "(", "field", ")", ")", "{", "// Same type, just move the info", "O...
Move data to this field from another field. If the data types are the same data is moved, otherwise a string conversion is done. @param field The source field. @param bDisplayOption If true, display changes. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "Move", "data", "to", "this", "field", "from", "another", "field", ".", "If", "the", "data", "types", "are", "the", "same", "data", "is", "moved", "otherwise", "a", "string", "conversion", "is", "done", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1008-L1020
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/BeatFinder.java
BeatFinder.deliverFaderStartCommand
private void deliverFaderStartCommand(Set<Integer> playersToStart, Set<Integer> playersToStop) { for (final FaderStartListener listener : getFaderStartListeners()) { try { listener.fadersChanged(playersToStart, playersToStop); } catch (Throwable t) { logger.warn("Problem delivering fader start command to listener", t); } } }
java
private void deliverFaderStartCommand(Set<Integer> playersToStart, Set<Integer> playersToStop) { for (final FaderStartListener listener : getFaderStartListeners()) { try { listener.fadersChanged(playersToStart, playersToStop); } catch (Throwable t) { logger.warn("Problem delivering fader start command to listener", t); } } }
[ "private", "void", "deliverFaderStartCommand", "(", "Set", "<", "Integer", ">", "playersToStart", ",", "Set", "<", "Integer", ">", "playersToStop", ")", "{", "for", "(", "final", "FaderStartListener", "listener", ":", "getFaderStartListeners", "(", ")", ")", "{"...
Send a fader start command to all registered listeners. @param playersToStart contains the device numbers of all players that should start playing @param playersToStop contains the device numbers of all players that should stop playing
[ "Send", "a", "fader", "start", "command", "to", "all", "registered", "listeners", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/BeatFinder.java#L572-L580
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java
DocumentFactory.newArray
public static EditableArray newArray( Object... values ) { BasicArray array = new BasicArray(); for (Object value : values) { array.addValue(value); } return new ArrayEditor(array, DEFAULT_FACTORY); }
java
public static EditableArray newArray( Object... values ) { BasicArray array = new BasicArray(); for (Object value : values) { array.addValue(value); } return new ArrayEditor(array, DEFAULT_FACTORY); }
[ "public", "static", "EditableArray", "newArray", "(", "Object", "...", "values", ")", "{", "BasicArray", "array", "=", "new", "BasicArray", "(", ")", ";", "for", "(", "Object", "value", ":", "values", ")", "{", "array", ".", "addValue", "(", "value", ")"...
Create a new editable array that can be used as a new array value in other documents. @param values the initial values for the array @return the editable array; never null
[ "Create", "a", "new", "editable", "array", "that", "can", "be", "used", "as", "a", "new", "array", "value", "in", "other", "documents", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/DocumentFactory.java#L183-L189
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseSkipCookiePathQuotes
private void parseSkipCookiePathQuotes(Map<?, ?> props) { //738893 - Skip adding the quotes to the cookie path attribute String value = (String) props.get(HttpConfigConstants.PROPNAME_SKIP_PATH_QUOTE); if (null != value) { this.skipCookiePathQuotes = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: SkipCookiePathQuotes is " + shouldSkipCookiePathQuotes()); } } }
java
private void parseSkipCookiePathQuotes(Map<?, ?> props) { //738893 - Skip adding the quotes to the cookie path attribute String value = (String) props.get(HttpConfigConstants.PROPNAME_SKIP_PATH_QUOTE); if (null != value) { this.skipCookiePathQuotes = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: SkipCookiePathQuotes is " + shouldSkipCookiePathQuotes()); } } }
[ "private", "void", "parseSkipCookiePathQuotes", "(", "Map", "<", "?", ",", "?", ">", "props", ")", "{", "//738893 - Skip adding the quotes to the cookie path attribute", "String", "value", "=", "(", "String", ")", "props", ".", "get", "(", "HttpConfigConstants", "."...
Check the configuration map for if we should skip adding the quote to the cookie path attribute @ param props
[ "Check", "the", "configuration", "map", "for", "if", "we", "should", "skip", "adding", "the", "quote", "to", "the", "cookie", "path", "attribute" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1229-L1238
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.loadIncludes
private Properties loadIncludes(File baseDir, Properties properties) throws IOException { return loadProperties(baseDir, properties, "include", false); }
java
private Properties loadIncludes(File baseDir, Properties properties) throws IOException { return loadProperties(baseDir, properties, "include", false); }
[ "private", "Properties", "loadIncludes", "(", "File", "baseDir", ",", "Properties", "properties", ")", "throws", "IOException", "{", "return", "loadProperties", "(", "baseDir", ",", "properties", ",", "\"include\"", ",", "false", ")", ";", "}" ]
Recursively read "include" properties files. <p> "Include" properties are the base properties which are overwritten by the provided properties. </p> @param baseDir @param properties @return the merged properties @throws IOException
[ "Recursively", "read", "include", "properties", "files", ".", "<p", ">", "Include", "properties", "are", "the", "base", "properties", "which", "are", "overwritten", "by", "the", "provided", "properties", ".", "<", "/", "p", ">" ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L272-L274
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/util/Utils.java
Utils.getFormattedDateTime
static public String getFormattedDateTime(long dt, TimeZone tz, String format) { SimpleDateFormat df = new SimpleDateFormat(format); if(tz != null) df.setTimeZone(tz); return df.format(new Date(dt)); }
java
static public String getFormattedDateTime(long dt, TimeZone tz, String format) { SimpleDateFormat df = new SimpleDateFormat(format); if(tz != null) df.setTimeZone(tz); return df.format(new Date(dt)); }
[ "static", "public", "String", "getFormattedDateTime", "(", "long", "dt", ",", "TimeZone", "tz", ",", "String", "format", ")", "{", "SimpleDateFormat", "df", "=", "new", "SimpleDateFormat", "(", "format", ")", ";", "if", "(", "tz", "!=", "null", ")", "df", ...
Returns the given date time formatted using the given format and timezone. @param dt The date to format (in milliseconds) @param tz The timezone for the date (or null) @param format The format to use for the date @return The formatted date
[ "Returns", "the", "given", "date", "time", "formatted", "using", "the", "given", "format", "and", "timezone", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/util/Utils.java#L59-L65
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java
JDBC4PreparedStatement.setBigDecimal
@Override public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { checkParameterBounds(parameterIndex); this.parameters[parameterIndex-1] = x == null ? VoltType.NULL_DECIMAL : x; }
java
@Override public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { checkParameterBounds(parameterIndex); this.parameters[parameterIndex-1] = x == null ? VoltType.NULL_DECIMAL : x; }
[ "@", "Override", "public", "void", "setBigDecimal", "(", "int", "parameterIndex", ",", "BigDecimal", "x", ")", "throws", "SQLException", "{", "checkParameterBounds", "(", "parameterIndex", ")", ";", "this", ".", "parameters", "[", "parameterIndex", "-", "1", "]"...
Sets the designated parameter to the given java.math.BigDecimal value.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "java", ".", "math", ".", "BigDecimal", "value", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L190-L195
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/io/BufferUtils.java
BufferUtils.toBuffer
public static ByteBuffer toBuffer(byte array[], int offset, int length) { if (array == null) return EMPTY_BUFFER; return ByteBuffer.wrap(array, offset, length); }
java
public static ByteBuffer toBuffer(byte array[], int offset, int length) { if (array == null) return EMPTY_BUFFER; return ByteBuffer.wrap(array, offset, length); }
[ "public", "static", "ByteBuffer", "toBuffer", "(", "byte", "array", "[", "]", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "array", "==", "null", ")", "return", "EMPTY_BUFFER", ";", "return", "ByteBuffer", ".", "wrap", "(", "array", ...
Create a new ByteBuffer using the provided byte array. @param array the byte array to use. @param offset the offset within the byte array to use from @param length the length in bytes of the array to use @return ByteBuffer with provided byte array, in flush mode
[ "Create", "a", "new", "ByteBuffer", "using", "the", "provided", "byte", "array", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/io/BufferUtils.java#L809-L813
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.findMessages
public static Map<Long, Message> findMessages( final Document document, final XPath xPath, final Map<String, Type> typeByNameMap) throws Exception { final Map<Long, Message> messageByIdMap = new HashMap<>(); final ObjectHashSet<String> distinctNames = new ObjectHashSet<>(); forEach((NodeList)xPath.compile(MESSAGE_XPATH_EXPR).evaluate(document, XPathConstants.NODESET), (node) -> addMessageWithIdCheck(distinctNames, messageByIdMap, new Message(node, typeByNameMap), node)); return messageByIdMap; }
java
public static Map<Long, Message> findMessages( final Document document, final XPath xPath, final Map<String, Type> typeByNameMap) throws Exception { final Map<Long, Message> messageByIdMap = new HashMap<>(); final ObjectHashSet<String> distinctNames = new ObjectHashSet<>(); forEach((NodeList)xPath.compile(MESSAGE_XPATH_EXPR).evaluate(document, XPathConstants.NODESET), (node) -> addMessageWithIdCheck(distinctNames, messageByIdMap, new Message(node, typeByNameMap), node)); return messageByIdMap; }
[ "public", "static", "Map", "<", "Long", ",", "Message", ">", "findMessages", "(", "final", "Document", "document", ",", "final", "XPath", "xPath", ",", "final", "Map", "<", "String", ",", "Type", ">", "typeByNameMap", ")", "throws", "Exception", "{", "fina...
Scan XML for all message definitions and save in map @param document for the XML parsing @param xPath for XPath expression reuse @param typeByNameMap to use for Type objects @return {@link java.util.Map} of schemaId to Message @throws Exception on parsing error.
[ "Scan", "XML", "for", "all", "message", "definitions", "and", "save", "in", "map" ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L220-L230
cdapio/tigon
tigon-yarn/src/main/java/co/cask/tigon/internal/io/FieldAccessorGenerator.java
FieldAccessorGenerator.directGetter
private void directGetter(Field field) { GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, getMethod(Object.class, "get", Object.class), getterSignature(), new Type[0], classWriter); // Simply access by field // return ((classType)object).fieldName; mg.loadArg(0); mg.checkCast(Type.getType(field.getDeclaringClass())); mg.getField(Type.getType(field.getDeclaringClass()), field.getName(), Type.getType(field.getType())); if (field.getType().isPrimitive()) { mg.valueOf(Type.getType(field.getType())); } mg.returnValue(); mg.endMethod(); }
java
private void directGetter(Field field) { GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, getMethod(Object.class, "get", Object.class), getterSignature(), new Type[0], classWriter); // Simply access by field // return ((classType)object).fieldName; mg.loadArg(0); mg.checkCast(Type.getType(field.getDeclaringClass())); mg.getField(Type.getType(field.getDeclaringClass()), field.getName(), Type.getType(field.getType())); if (field.getType().isPrimitive()) { mg.valueOf(Type.getType(field.getType())); } mg.returnValue(); mg.endMethod(); }
[ "private", "void", "directGetter", "(", "Field", "field", ")", "{", "GeneratorAdapter", "mg", "=", "new", "GeneratorAdapter", "(", "Opcodes", ".", "ACC_PUBLIC", ",", "getMethod", "(", "Object", ".", "class", ",", "\"get\"", ",", "Object", ".", "class", ")", ...
Generates a getter that get the value by directly accessing the class field. @param field The reflection field object.
[ "Generates", "a", "getter", "that", "get", "the", "value", "by", "directly", "accessing", "the", "class", "field", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/internal/io/FieldAccessorGenerator.java#L228-L241
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectHasSelfImpl_CustomFieldSerializer.java
OWLObjectHasSelfImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectHasSelfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectHasSelfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectHasSelfImpl", "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/OWLObjectHasSelfImpl_CustomFieldSerializer.java#L69-L72
JodaOrg/joda-time
src/main/java/org/joda/time/YearMonthDay.java
YearMonthDay.withFieldAdded
public YearMonthDay withFieldAdded(DurationFieldType fieldType, int amount) { int index = indexOfSupported(fieldType); if (amount == 0) { return this; } int[] newValues = getValues(); newValues = getField(index).add(this, index, newValues, amount); return new YearMonthDay(this, newValues); }
java
public YearMonthDay withFieldAdded(DurationFieldType fieldType, int amount) { int index = indexOfSupported(fieldType); if (amount == 0) { return this; } int[] newValues = getValues(); newValues = getField(index).add(this, index, newValues, amount); return new YearMonthDay(this, newValues); }
[ "public", "YearMonthDay", "withFieldAdded", "(", "DurationFieldType", "fieldType", ",", "int", "amount", ")", "{", "int", "index", "=", "indexOfSupported", "(", "fieldType", ")", ";", "if", "(", "amount", "==", "0", ")", "{", "return", "this", ";", "}", "i...
Returns a copy of this date with the value of the specified field increased. <p> If the addition is zero, then <code>this</code> is returned. <p> These three lines are equivalent: <pre> YearMonthDay added = ymd.withFieldAdded(DurationFieldType.days(), 6); YearMonthDay added = ymd.plusDays(6); YearMonthDay added = ymd.dayOfMonth().addToCopy(6); </pre> @param fieldType the field type to add to, not null @param amount the amount to add @return a copy of this instance with the field updated @throws IllegalArgumentException if the value is null or invalid @throws ArithmeticException if the new datetime exceeds the capacity
[ "Returns", "a", "copy", "of", "this", "date", "with", "the", "value", "of", "the", "specified", "field", "increased", ".", "<p", ">", "If", "the", "addition", "is", "zero", "then", "<code", ">", "this<", "/", "code", ">", "is", "returned", ".", "<p", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/YearMonthDay.java#L438-L446
centic9/commons-dost
src/main/java/org/dstadler/commons/net/UrlUtils.java
UrlUtils.prepareConnection
private static void prepareConnection(URLConnection connection, int timeout, SSLSocketFactory sslFactory) { if (timeout == 0) { throw new IllegalArgumentException("Zero (infinite) timeouts not permitted"); } connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); connection.setDoInput(true); // whether we want to read from the connection connection.setDoOutput(false); // whether we want to write to the connection if(connection instanceof HttpsURLConnection && sslFactory != null) { ((HttpsURLConnection)connection).setSSLSocketFactory(sslFactory); } }
java
private static void prepareConnection(URLConnection connection, int timeout, SSLSocketFactory sslFactory) { if (timeout == 0) { throw new IllegalArgumentException("Zero (infinite) timeouts not permitted"); } connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); connection.setDoInput(true); // whether we want to read from the connection connection.setDoOutput(false); // whether we want to write to the connection if(connection instanceof HttpsURLConnection && sslFactory != null) { ((HttpsURLConnection)connection).setSSLSocketFactory(sslFactory); } }
[ "private", "static", "void", "prepareConnection", "(", "URLConnection", "connection", ",", "int", "timeout", ",", "SSLSocketFactory", "sslFactory", ")", "{", "if", "(", "timeout", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Zero (infin...
/* Prepare connection by setting connectTimeout and readTimeout to timeout, doOutput to false and doInput to true. Throws IllegalArgumentException on zero (infinite) timeout.
[ "/", "*", "Prepare", "connection", "by", "setting", "connectTimeout", "and", "readTimeout", "to", "timeout", "doOutput", "to", "false", "and", "doInput", "to", "true", "." ]
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/net/UrlUtils.java#L285-L297
elki-project/elki
elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java
FastMultidimensionalScalingTransform.findEigenVectors
protected void findEigenVectors(double[][] imat, double[][] evs, double[] lambda) { final int size = imat.length; Random rnd = random.getSingleThreadedRandom(); double[] tmp = new double[size]; FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Learning projections", tdim, LOG) : null; for(int d = 0; d < tdim;) { final double[] cur = evs[d]; randomInitialization(cur, rnd); double l = multiply(imat, cur, tmp); for(int iter = 0; iter < 100; iter++) { // This will scale "tmp" to unit length, and copy it to cur: double delta = updateEigenvector(tmp, cur, l); if(delta < 1e-10) { break; } l = multiply(imat, cur, tmp); } lambda[d++] = l = estimateEigenvalue(imat, cur); LOG.incrementProcessed(prog); if(d == tdim) { break; } // Update matrix updateMatrix(imat, cur, l); } LOG.ensureCompleted(prog); }
java
protected void findEigenVectors(double[][] imat, double[][] evs, double[] lambda) { final int size = imat.length; Random rnd = random.getSingleThreadedRandom(); double[] tmp = new double[size]; FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Learning projections", tdim, LOG) : null; for(int d = 0; d < tdim;) { final double[] cur = evs[d]; randomInitialization(cur, rnd); double l = multiply(imat, cur, tmp); for(int iter = 0; iter < 100; iter++) { // This will scale "tmp" to unit length, and copy it to cur: double delta = updateEigenvector(tmp, cur, l); if(delta < 1e-10) { break; } l = multiply(imat, cur, tmp); } lambda[d++] = l = estimateEigenvalue(imat, cur); LOG.incrementProcessed(prog); if(d == tdim) { break; } // Update matrix updateMatrix(imat, cur, l); } LOG.ensureCompleted(prog); }
[ "protected", "void", "findEigenVectors", "(", "double", "[", "]", "[", "]", "imat", ",", "double", "[", "]", "[", "]", "evs", ",", "double", "[", "]", "lambda", ")", "{", "final", "int", "size", "=", "imat", ".", "length", ";", "Random", "rnd", "="...
Find the first eigenvectors and eigenvalues using power iterations. @param imat Matrix (will be modified!) @param evs Eigenvectors output @param lambda Eigenvalues output
[ "Find", "the", "first", "eigenvectors", "and", "eigenvalues", "using", "power", "iterations", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java#L178-L204
apache/groovy
src/main/groovy/groovy/lang/ExpandoMetaClass.java
ExpandoMetaClass.registerInstanceMethod
public void registerInstanceMethod(final MetaMethod metaMethod) { final boolean inited = this.initCalled; performOperationOnMetaClass(new Callable() { public void call() { String methodName = metaMethod.getName(); checkIfGroovyObjectMethod(metaMethod); MethodKey key = new DefaultCachedMethodKey(theClass, methodName, metaMethod.getParameterTypes(), false); if (isInitialized()) { throw new RuntimeException("Already initialized, cannot add new method: " + metaMethod); } // we always adds meta methods to class itself addMetaMethodToIndex(metaMethod, metaMethodIndex.getHeader(theClass)); dropMethodCache(methodName); expandoMethods.put(key, metaMethod); if (inited && isGetter(methodName, metaMethod.getParameterTypes())) { String propertyName = getPropertyForGetter(methodName); registerBeanPropertyForMethod(metaMethod, propertyName, true, false); } else if (inited && isSetter(methodName, metaMethod.getParameterTypes())) { String propertyName = getPropertyForSetter(methodName); registerBeanPropertyForMethod(metaMethod, propertyName, false, false); } performRegistryCallbacks(); } }); }
java
public void registerInstanceMethod(final MetaMethod metaMethod) { final boolean inited = this.initCalled; performOperationOnMetaClass(new Callable() { public void call() { String methodName = metaMethod.getName(); checkIfGroovyObjectMethod(metaMethod); MethodKey key = new DefaultCachedMethodKey(theClass, methodName, metaMethod.getParameterTypes(), false); if (isInitialized()) { throw new RuntimeException("Already initialized, cannot add new method: " + metaMethod); } // we always adds meta methods to class itself addMetaMethodToIndex(metaMethod, metaMethodIndex.getHeader(theClass)); dropMethodCache(methodName); expandoMethods.put(key, metaMethod); if (inited && isGetter(methodName, metaMethod.getParameterTypes())) { String propertyName = getPropertyForGetter(methodName); registerBeanPropertyForMethod(metaMethod, propertyName, true, false); } else if (inited && isSetter(methodName, metaMethod.getParameterTypes())) { String propertyName = getPropertyForSetter(methodName); registerBeanPropertyForMethod(metaMethod, propertyName, false, false); } performRegistryCallbacks(); } }); }
[ "public", "void", "registerInstanceMethod", "(", "final", "MetaMethod", "metaMethod", ")", "{", "final", "boolean", "inited", "=", "this", ".", "initCalled", ";", "performOperationOnMetaClass", "(", "new", "Callable", "(", ")", "{", "public", "void", "call", "("...
Registers a new instance method for the given method name and closure on this MetaClass @param metaMethod
[ "Registers", "a", "new", "instance", "method", "for", "the", "given", "method", "name", "and", "closure", "on", "this", "MetaClass" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ExpandoMetaClass.java#L875-L904
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java
FrequentlyUsedPolicy.onMiss
private void onMiss(long key) { FrequencyNode freq1 = (freq0.next.count == 1) ? freq0.next : new FrequencyNode(1, freq0); Node node = new Node(key, freq1); policyStats.recordMiss(); data.put(key, node); node.append(); evict(node); }
java
private void onMiss(long key) { FrequencyNode freq1 = (freq0.next.count == 1) ? freq0.next : new FrequencyNode(1, freq0); Node node = new Node(key, freq1); policyStats.recordMiss(); data.put(key, node); node.append(); evict(node); }
[ "private", "void", "onMiss", "(", "long", "key", ")", "{", "FrequencyNode", "freq1", "=", "(", "freq0", ".", "next", ".", "count", "==", "1", ")", "?", "freq0", ".", "next", ":", "new", "FrequencyNode", "(", "1", ",", "freq0", ")", ";", "Node", "no...
Adds the entry, creating an initial frequency list of 1 if necessary, and evicts if needed.
[ "Adds", "the", "entry", "creating", "an", "initial", "frequency", "list", "of", "1", "if", "necessary", "and", "evicts", "if", "needed", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java#L103-L112
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyRegistry.java
ProxyRegistry.getService
private RemoteService getService(NodeEngineImpl nodeEngine, String serviceName) { try { return nodeEngine.getService(serviceName); } catch (HazelcastException e) { if (!nodeEngine.isRunning()) { throw new HazelcastInstanceNotActiveException(e.getMessage()); } else { throw e; } } }
java
private RemoteService getService(NodeEngineImpl nodeEngine, String serviceName) { try { return nodeEngine.getService(serviceName); } catch (HazelcastException e) { if (!nodeEngine.isRunning()) { throw new HazelcastInstanceNotActiveException(e.getMessage()); } else { throw e; } } }
[ "private", "RemoteService", "getService", "(", "NodeEngineImpl", "nodeEngine", ",", "String", "serviceName", ")", "{", "try", "{", "return", "nodeEngine", ".", "getService", "(", "serviceName", ")", ";", "}", "catch", "(", "HazelcastException", "e", ")", "{", ...
Returns the service for the given {@code serviceName} or throws an exception. This method never returns {@code null}. @param nodeEngine the node engine @param serviceName the remote service name @return the service instance @throws HazelcastException if there is no service with the given name @throws HazelcastInstanceNotActiveException if this instance is shutting down
[ "Returns", "the", "service", "for", "the", "given", "{", "@code", "serviceName", "}", "or", "throws", "an", "exception", ".", "This", "method", "never", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyRegistry.java#L68-L78
gosu-lang/gosu-lang
gosu-lab/src/main/java/editor/plugin/typeloader/java/JavaDocument.java
JavaDocument.commentLinesBefore
private boolean commentLinesBefore( String content, int line ) { int offset = _root.getElement( line ).getStartOffset(); // Start of comment not found, nothing to do int startDelimiter = lastIndexOf( content, getStartDelimiter(), offset - 2 ); if( startDelimiter < 0 ) { return false; } // Matching start/end of comment found, nothing to do int endDelimiter = indexOf( content, getEndDelimiter(), startDelimiter ); if( endDelimiter < offset & endDelimiter != -1 ) { return false; } // End of comment not found, highlight the lines setCharacterAttributes( startDelimiter, offset - startDelimiter + 1, _comment, false ); return true; }
java
private boolean commentLinesBefore( String content, int line ) { int offset = _root.getElement( line ).getStartOffset(); // Start of comment not found, nothing to do int startDelimiter = lastIndexOf( content, getStartDelimiter(), offset - 2 ); if( startDelimiter < 0 ) { return false; } // Matching start/end of comment found, nothing to do int endDelimiter = indexOf( content, getEndDelimiter(), startDelimiter ); if( endDelimiter < offset & endDelimiter != -1 ) { return false; } // End of comment not found, highlight the lines setCharacterAttributes( startDelimiter, offset - startDelimiter + 1, _comment, false ); return true; }
[ "private", "boolean", "commentLinesBefore", "(", "String", "content", ",", "int", "line", ")", "{", "int", "offset", "=", "_root", ".", "getElement", "(", "line", ")", ".", "getStartOffset", "(", ")", ";", "// Start of comment not found, nothing to do", "int", "...
/* Highlight lines when a multi line comment is still 'open' (ie. matching end delimiter has not yet been encountered)
[ "/", "*", "Highlight", "lines", "when", "a", "multi", "line", "comment", "is", "still", "open", "(", "ie", ".", "matching", "end", "delimiter", "has", "not", "yet", "been", "encountered", ")" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/plugin/typeloader/java/JavaDocument.java#L179-L197
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java
MerkleTreeUtil.isLeaf
static boolean isLeaf(int nodeOrder, int depth) { checkTrue(depth > 0, "Invalid depth: " + depth); int leafLevel = depth - 1; int numberOfNodes = getNumberOfNodes(depth); int maxNodeOrder = numberOfNodes - 1; checkTrue(nodeOrder >= 0 && nodeOrder <= maxNodeOrder, "Invalid nodeOrder: " + nodeOrder + " in a tree with depth " + depth); int leftMostLeafOrder = MerkleTreeUtil.getLeftMostNodeOrderOnLevel(leafLevel); return nodeOrder >= leftMostLeafOrder; }
java
static boolean isLeaf(int nodeOrder, int depth) { checkTrue(depth > 0, "Invalid depth: " + depth); int leafLevel = depth - 1; int numberOfNodes = getNumberOfNodes(depth); int maxNodeOrder = numberOfNodes - 1; checkTrue(nodeOrder >= 0 && nodeOrder <= maxNodeOrder, "Invalid nodeOrder: " + nodeOrder + " in a tree with depth " + depth); int leftMostLeafOrder = MerkleTreeUtil.getLeftMostNodeOrderOnLevel(leafLevel); return nodeOrder >= leftMostLeafOrder; }
[ "static", "boolean", "isLeaf", "(", "int", "nodeOrder", ",", "int", "depth", ")", "{", "checkTrue", "(", "depth", ">", "0", ",", "\"Invalid depth: \"", "+", "depth", ")", ";", "int", "leafLevel", "=", "depth", "-", "1", ";", "int", "numberOfNodes", "=", ...
Returns true if the node with {@code nodeOrder} is a leaf in a tree with {@code depth} levels @param nodeOrder The order of the node to test @param depth The depth of the tree @return true if the node is leaf, false otherwise
[ "Returns", "true", "if", "the", "node", "with", "{", "@code", "nodeOrder", "}", "is", "a", "leaf", "in", "a", "tree", "with", "{", "@code", "depth", "}", "levels" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java#L250-L259
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemWithParam.java
ElemWithParam.getValue
public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException { XObject var; XPathContext xctxt = transformer.getXPathContext(); xctxt.pushCurrentNode(sourceNode); try { if (null != m_selectPattern) { var = m_selectPattern.execute(xctxt, sourceNode, this); var.allowDetachToRelease(false); } else if (null == getFirstChildElem()) { var = XString.EMPTYSTRING; } else { // Use result tree fragment int df = transformer.transformToRTF(this); var = new XRTreeFrag(df, xctxt, this); } } finally { xctxt.popCurrentNode(); } return var; }
java
public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException { XObject var; XPathContext xctxt = transformer.getXPathContext(); xctxt.pushCurrentNode(sourceNode); try { if (null != m_selectPattern) { var = m_selectPattern.execute(xctxt, sourceNode, this); var.allowDetachToRelease(false); } else if (null == getFirstChildElem()) { var = XString.EMPTYSTRING; } else { // Use result tree fragment int df = transformer.transformToRTF(this); var = new XRTreeFrag(df, xctxt, this); } } finally { xctxt.popCurrentNode(); } return var; }
[ "public", "XObject", "getValue", "(", "TransformerImpl", "transformer", ",", "int", "sourceNode", ")", "throws", "TransformerException", "{", "XObject", "var", ";", "XPathContext", "xctxt", "=", "transformer", ".", "getXPathContext", "(", ")", ";", "xctxt", ".", ...
Get the XObject representation of the variable. @param transformer non-null reference to the the current transform-time state. @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>. @return the XObject representation of the variable. @throws TransformerException
[ "Get", "the", "XObject", "representation", "of", "the", "variable", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemWithParam.java#L190-L226
molgenis/molgenis
molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java
OntologyTermRepository.findOntologyTerms
public List<OntologyTerm> findOntologyTerms( List<String> ontologyIds, Set<String> terms, int pageSize) { List<QueryRule> rules = new ArrayList<>(); for (String term : terms) { if (!rules.isEmpty()) { rules.add(new QueryRule(Operator.OR)); } rules.add( new QueryRule(OntologyTermMetadata.ONTOLOGY_TERM_SYNONYM, Operator.FUZZY_MATCH, term)); } rules = Arrays.asList( new QueryRule(ONTOLOGY, Operator.IN, ontologyIds), new QueryRule(Operator.AND), new QueryRule(rules)); final List<QueryRule> finalRules = rules; Iterable<Entity> termEntities = () -> dataService .findAll(ONTOLOGY_TERM, new QueryImpl<>(finalRules).pageSize(pageSize)) .iterator(); return Lists.newArrayList( Iterables.transform(termEntities, OntologyTermRepository::toOntologyTerm)); }
java
public List<OntologyTerm> findOntologyTerms( List<String> ontologyIds, Set<String> terms, int pageSize) { List<QueryRule> rules = new ArrayList<>(); for (String term : terms) { if (!rules.isEmpty()) { rules.add(new QueryRule(Operator.OR)); } rules.add( new QueryRule(OntologyTermMetadata.ONTOLOGY_TERM_SYNONYM, Operator.FUZZY_MATCH, term)); } rules = Arrays.asList( new QueryRule(ONTOLOGY, Operator.IN, ontologyIds), new QueryRule(Operator.AND), new QueryRule(rules)); final List<QueryRule> finalRules = rules; Iterable<Entity> termEntities = () -> dataService .findAll(ONTOLOGY_TERM, new QueryImpl<>(finalRules).pageSize(pageSize)) .iterator(); return Lists.newArrayList( Iterables.transform(termEntities, OntologyTermRepository::toOntologyTerm)); }
[ "public", "List", "<", "OntologyTerm", ">", "findOntologyTerms", "(", "List", "<", "String", ">", "ontologyIds", ",", "Set", "<", "String", ">", "terms", ",", "int", "pageSize", ")", "{", "List", "<", "QueryRule", ">", "rules", "=", "new", "ArrayList", "...
Finds {@link OntologyTerm}s within {@link Ontology}s. @param ontologyIds IDs of the {@link Ontology}s to search in @param terms {@link List} of search terms. the {@link OntologyTerm} must match at least one of these terms @param pageSize max number of results @return {@link List} of {@link OntologyTerm}s
[ "Finds", "{", "@link", "OntologyTerm", "}", "s", "within", "{", "@link", "Ontology", "}", "s", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyTermRepository.java#L95-L120
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.readUtf8Lines
public static void readUtf8Lines(File file, LineHandler lineHandler) throws IORuntimeException { readLines(file, CharsetUtil.CHARSET_UTF_8, lineHandler); }
java
public static void readUtf8Lines(File file, LineHandler lineHandler) throws IORuntimeException { readLines(file, CharsetUtil.CHARSET_UTF_8, lineHandler); }
[ "public", "static", "void", "readUtf8Lines", "(", "File", "file", ",", "LineHandler", "lineHandler", ")", "throws", "IORuntimeException", "{", "readLines", "(", "file", ",", "CharsetUtil", ".", "CHARSET_UTF_8", ",", "lineHandler", ")", ";", "}" ]
按行处理文件内容,编码为UTF-8 @param file 文件 @param lineHandler {@link LineHandler}行处理器 @throws IORuntimeException IO异常
[ "按行处理文件内容,编码为UTF", "-", "8" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2403-L2405
trajano/caliper
caliper/src/main/java/com/google/caliper/util/InterleavedReader.java
InterleavedReader.findPossibleMarker
int findPossibleMarker(char[] chars, int limit) { search: for (int i = 0; true; i++) { for (int m = 0; m < marker.length() && i + m < limit; m++) { if (chars[i + m] != marker.charAt(m)) { continue search; } } return i; } }
java
int findPossibleMarker(char[] chars, int limit) { search: for (int i = 0; true; i++) { for (int m = 0; m < marker.length() && i + m < limit; m++) { if (chars[i + m] != marker.charAt(m)) { continue search; } } return i; } }
[ "int", "findPossibleMarker", "(", "char", "[", "]", "chars", ",", "int", "limit", ")", "{", "search", ":", "for", "(", "int", "i", "=", "0", ";", "true", ";", "i", "++", ")", "{", "for", "(", "int", "m", "=", "0", ";", "m", "<", "marker", "."...
Returns the index of marker in {@code chars}, stopping at {@code limit}. Should the chars end with a prefix of marker, the offset of that prefix is returned.
[ "Returns", "the", "index", "of", "marker", "in", "{" ]
train
https://github.com/trajano/caliper/blob/a8bcfd84fa9d7b893b3edfadc3b13240ae5cd658/caliper/src/main/java/com/google/caliper/util/InterleavedReader.java#L117-L127
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java
AbstractParser.attributeAsString
protected String attributeAsString(XMLStreamReader reader, String attributeName, Map<String, String> expressions) throws XMLStreamException { String attributeString = rawAttributeText(reader, attributeName); if (attributeName != null && expressions != null && attributeString != null && attributeString.indexOf("${") != -1) expressions.put(attributeName, attributeString); return getSubstitutionValue(attributeString); }
java
protected String attributeAsString(XMLStreamReader reader, String attributeName, Map<String, String> expressions) throws XMLStreamException { String attributeString = rawAttributeText(reader, attributeName); if (attributeName != null && expressions != null && attributeString != null && attributeString.indexOf("${") != -1) expressions.put(attributeName, attributeString); return getSubstitutionValue(attributeString); }
[ "protected", "String", "attributeAsString", "(", "XMLStreamReader", "reader", ",", "String", "attributeName", ",", "Map", "<", "String", ",", "String", ">", "expressions", ")", "throws", "XMLStreamException", "{", "String", "attributeString", "=", "rawAttributeText", ...
convert an xml element in String value @param reader the StAX reader @param attributeName the name of the attribute @param expressions The expressions @return the string representing element @throws XMLStreamException StAX exception
[ "convert", "an", "xml", "element", "in", "String", "value" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java#L196-L206
forge/furnace
container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java
Annotations.getAnnotation
public static <A extends Annotation> A getAnnotation(final Method m, final Class<A> type) { A result = m.getAnnotation(type); if (result == null) { for (Annotation a : m.getAnnotations()) { result = getAnnotation(a, type); if (result != null) { break; } } } if (result == null) { result = getAnnotation(m.getDeclaringClass(), type); } return result; }
java
public static <A extends Annotation> A getAnnotation(final Method m, final Class<A> type) { A result = m.getAnnotation(type); if (result == null) { for (Annotation a : m.getAnnotations()) { result = getAnnotation(a, type); if (result != null) { break; } } } if (result == null) { result = getAnnotation(m.getDeclaringClass(), type); } return result; }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "getAnnotation", "(", "final", "Method", "m", ",", "final", "Class", "<", "A", ">", "type", ")", "{", "A", "result", "=", "m", ".", "getAnnotation", "(", "type", ")", ";", "if", "(", ...
Inspect method <b>m</b> for a specific <b>type</b> of annotation. This also discovers annotations defined through a @ {@link Stereotype}. @param m The method to inspect. @param type The targeted annotation class @return The annotation instance found on this method or enclosing class, or null if no matching annotation was found.
[ "Inspect", "method", "<b", ">", "m<", "/", "b", ">", "for", "a", "specific", "<b", ">", "type<", "/", "b", ">", "of", "annotation", ".", "This", "also", "discovers", "annotations", "defined", "through", "a", "@", "{", "@link", "Stereotype", "}", "." ]
train
https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java#L100-L120
aws/aws-sdk-java
aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/CreateBranchRequest.java
CreateBranchRequest.withTags
public CreateBranchRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public CreateBranchRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateBranchRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> Tag for the branch. </p> @param tags Tag for the branch. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Tag", "for", "the", "branch", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/CreateBranchRequest.java#L621-L624
google/flogger
api/src/main/java/com/google/common/flogger/util/CallerFinder.java
CallerFinder.findCallerOf
@Nullable public static StackTraceElement findCallerOf(Class<?> target, Throwable throwable, int skip) { checkNotNull(target, "target"); checkNotNull(throwable, "throwable"); if (skip < 0) { throw new IllegalArgumentException("skip count cannot be negative: " + skip); } // Getting the full stack trace is expensive, so avoid it where possible. StackTraceElement[] stack = (stackGetter != null) ? null : throwable.getStackTrace(); // Note: To avoid having to reflect the getStackTraceDepth() method as well, we assume that we // will find the caller on the stack and simply catch an exception if we fail (which should // hardly ever happen). boolean foundCaller = false; try { for (int index = skip; ; index++) { StackTraceElement element = (stackGetter != null) ? stackGetter.getStackTraceElement(throwable, index) : stack[index]; if (target.getName().equals(element.getClassName())) { foundCaller = true; } else if (foundCaller) { return element; } } } catch (Exception e) { // This should only happen is the caller was not found on the stack (getting exceptions from // the stack trace method should never happen) and it should only be an // IndexOutOfBoundsException, however we don't want _anything_ to be thrown from here. // TODO(dbeaumont): Change to only catch IndexOutOfBoundsException and test _everything_. return null; } }
java
@Nullable public static StackTraceElement findCallerOf(Class<?> target, Throwable throwable, int skip) { checkNotNull(target, "target"); checkNotNull(throwable, "throwable"); if (skip < 0) { throw new IllegalArgumentException("skip count cannot be negative: " + skip); } // Getting the full stack trace is expensive, so avoid it where possible. StackTraceElement[] stack = (stackGetter != null) ? null : throwable.getStackTrace(); // Note: To avoid having to reflect the getStackTraceDepth() method as well, we assume that we // will find the caller on the stack and simply catch an exception if we fail (which should // hardly ever happen). boolean foundCaller = false; try { for (int index = skip; ; index++) { StackTraceElement element = (stackGetter != null) ? stackGetter.getStackTraceElement(throwable, index) : stack[index]; if (target.getName().equals(element.getClassName())) { foundCaller = true; } else if (foundCaller) { return element; } } } catch (Exception e) { // This should only happen is the caller was not found on the stack (getting exceptions from // the stack trace method should never happen) and it should only be an // IndexOutOfBoundsException, however we don't want _anything_ to be thrown from here. // TODO(dbeaumont): Change to only catch IndexOutOfBoundsException and test _everything_. return null; } }
[ "@", "Nullable", "public", "static", "StackTraceElement", "findCallerOf", "(", "Class", "<", "?", ">", "target", ",", "Throwable", "throwable", ",", "int", "skip", ")", "{", "checkNotNull", "(", "target", ",", "\"target\"", ")", ";", "checkNotNull", "(", "th...
Returns the stack trace element of the immediate caller of the specified class. @param target the target class whose callers we are looking for. @param throwable a new Throwable made at a known point in the call hierarchy. @param skip the minimum number of calls known to have occurred between the first call to the target class and the point at which the specified throwable was created. If in doubt, specify zero here to avoid accidentally skipping past the caller. This is particularly important for code which might be used in Android, since you cannot know whether a tool such as Proguard has merged methods or classes and reduced the number of intermediate stack frames. @return the stack trace element representing the immediate caller of the specified class, or null if no caller was found (due to incorrect target, wrong skip count or use of JNI).
[ "Returns", "the", "stack", "trace", "element", "of", "the", "immediate", "caller", "of", "the", "specified", "class", "." ]
train
https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/util/CallerFinder.java#L43-L76
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.L2_L4
@Pure public static Point2d L2_L4(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_4_N, LAMBERT_4_C, LAMBERT_4_XS, LAMBERT_4_YS); }
java
@Pure public static Point2d L2_L4(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_4_N, LAMBERT_4_C, LAMBERT_4_XS, LAMBERT_4_YS); }
[ "@", "Pure", "public", "static", "Point2d", "L2_L4", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_2_N", ",", "LAMBERT_2_C", ",", "LAMBERT_2_XS", ",", ...
This function convert France Lambert II coordinate to France Lambert IV coordinate. @param x is the coordinate in France Lambert II @param y is the coordinate in France Lambert II @return the France Lambert IV coordinate.
[ "This", "function", "convert", "France", "Lambert", "II", "coordinate", "to", "France", "Lambert", "IV", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L496-L509
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java
PhotosApi.addTags
public AddTags addTags(String photoId, List<String> tags) throws JinxException { JinxUtils.validateParams(photoId, tags); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.addTags"); params.put("photo_id", photoId); StringBuilder sb = new StringBuilder(); for (String tag : tags) { if (tag.contains(" ")) { sb.append('"').append(tag).append('"'); } else { sb.append(tag); } sb.append(' '); } sb.deleteCharAt(sb.length() - 1); params.put("tags", sb.toString()); return this.jinx.flickrPost(params, AddTags.class); }
java
public AddTags addTags(String photoId, List<String> tags) throws JinxException { JinxUtils.validateParams(photoId, tags); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.addTags"); params.put("photo_id", photoId); StringBuilder sb = new StringBuilder(); for (String tag : tags) { if (tag.contains(" ")) { sb.append('"').append(tag).append('"'); } else { sb.append(tag); } sb.append(' '); } sb.deleteCharAt(sb.length() - 1); params.put("tags", sb.toString()); return this.jinx.flickrPost(params, AddTags.class); }
[ "public", "AddTags", "addTags", "(", "String", "photoId", ",", "List", "<", "String", ">", "tags", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photoId", ",", "tags", ")", ";", "Map", "<", "String", ",", "String", ">", "...
Add tags to a photo. <br> This method requires authentication with 'write' permission. <br> Each tag in the list will be treated as a single tag. This method will automatically add quotation marks as needed so that multi-word tags will be treated correctly by Flickr. This method can also be used to add machine tags. @param photoId the id of the photo to add tags to. @param tags tags to add to the photo. @return response with the result of the operation. @throws JinxException if parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.addTags.html">flickr.photos.addTags</a>
[ "Add", "tags", "to", "a", "photo", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "write", "permission", ".", "<br", ">", "Each", "tag", "in", "the", "list", "will", "be", "treated", "as", "a", "single", "tag", ".", "This", "m...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L77-L94
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java
DefaultJsonQueryLogEntryCreator.writeDataSourceNameEntry
protected void writeDataSourceNameEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { String name = execInfo.getDataSourceName(); sb.append("\"name\":\""); sb.append(name == null ? "" : escapeSpecialCharacter(name)); sb.append("\", "); }
java
protected void writeDataSourceNameEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { String name = execInfo.getDataSourceName(); sb.append("\"name\":\""); sb.append(name == null ? "" : escapeSpecialCharacter(name)); sb.append("\", "); }
[ "protected", "void", "writeDataSourceNameEntry", "(", "StringBuilder", "sb", ",", "ExecutionInfo", "execInfo", ",", "List", "<", "QueryInfo", ">", "queryInfoList", ")", "{", "String", "name", "=", "execInfo", ".", "getDataSourceName", "(", ")", ";", "sb", ".", ...
Write datasource name when enabled as json. <p>default: "name":"myDS", @param sb StringBuilder to write @param execInfo execution info @param queryInfoList query info list
[ "Write", "datasource", "name", "when", "enabled", "as", "json", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java#L70-L75
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java
ImageModerationsImpl.oCRFileInputAsync
public Observable<OCR> oCRFileInputAsync(String language, byte[] imageStream, OCRFileInputOptionalParameter oCRFileInputOptionalParameter) { return oCRFileInputWithServiceResponseAsync(language, imageStream, oCRFileInputOptionalParameter).map(new Func1<ServiceResponse<OCR>, OCR>() { @Override public OCR call(ServiceResponse<OCR> response) { return response.body(); } }); }
java
public Observable<OCR> oCRFileInputAsync(String language, byte[] imageStream, OCRFileInputOptionalParameter oCRFileInputOptionalParameter) { return oCRFileInputWithServiceResponseAsync(language, imageStream, oCRFileInputOptionalParameter).map(new Func1<ServiceResponse<OCR>, OCR>() { @Override public OCR call(ServiceResponse<OCR> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OCR", ">", "oCRFileInputAsync", "(", "String", "language", ",", "byte", "[", "]", "imageStream", ",", "OCRFileInputOptionalParameter", "oCRFileInputOptionalParameter", ")", "{", "return", "oCRFileInputWithServiceResponseAsync", "(", "language...
Returns any text found in the image for the language specified. If no language is specified in input then the detection defaults to English. @param language Language of the terms. @param imageStream The image file. @param oCRFileInputOptionalParameter 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 OCR object
[ "Returns", "any", "text", "found", "in", "the", "image", "for", "the", "language", "specified", ".", "If", "no", "language", "is", "specified", "in", "input", "then", "the", "detection", "defaults", "to", "English", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1273-L1280
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java
PermissionAwareCrudService.removeAndSaveUserPermissions
public void removeAndSaveUserPermissions(E entity, User user, Permission... permissions) { if (entity == null) { LOG.error("Could not remove permissions: The passed entity is NULL."); return; } // create a set from the passed array final HashSet<Permission> permissionsSet = new HashSet<Permission>(Arrays.asList(permissions)); if (permissionsSet == null || permissionsSet.isEmpty()) { LOG.error("Could not remove permissions: No permissions have been passed."); return; } // get the existing permission PermissionCollection userPermissionCollection = entity.getUserPermissions().get(user); if (userPermissionCollection == null) { LOG.error("Could not remove permissions as there is no attached permission collection."); return; } Set<Permission> userPermissions = userPermissionCollection.getPermissions(); int originalNrOfPermissions = userPermissions.size(); // remove the passed permissions from the the existing permission collection userPermissions.removeAll(permissionsSet); int newNrOfPermissions = userPermissions.size(); if (newNrOfPermissions == 0) { LOG.debug("The permission collection is empty and will thereby be deleted now."); // remove entity.getUserPermissions().remove(user); this.saveOrUpdate(entity); permissionCollectionService.delete(userPermissionCollection); return; } // only persist if we have "really" removed something if (newNrOfPermissions < originalNrOfPermissions) { LOG.debug("Removed the following permissions from an existing permission collection: " + permissionsSet); // persist the permission collection permissionCollectionService.saveOrUpdate(userPermissionCollection); LOG.debug("Persisted a permission collection"); } }
java
public void removeAndSaveUserPermissions(E entity, User user, Permission... permissions) { if (entity == null) { LOG.error("Could not remove permissions: The passed entity is NULL."); return; } // create a set from the passed array final HashSet<Permission> permissionsSet = new HashSet<Permission>(Arrays.asList(permissions)); if (permissionsSet == null || permissionsSet.isEmpty()) { LOG.error("Could not remove permissions: No permissions have been passed."); return; } // get the existing permission PermissionCollection userPermissionCollection = entity.getUserPermissions().get(user); if (userPermissionCollection == null) { LOG.error("Could not remove permissions as there is no attached permission collection."); return; } Set<Permission> userPermissions = userPermissionCollection.getPermissions(); int originalNrOfPermissions = userPermissions.size(); // remove the passed permissions from the the existing permission collection userPermissions.removeAll(permissionsSet); int newNrOfPermissions = userPermissions.size(); if (newNrOfPermissions == 0) { LOG.debug("The permission collection is empty and will thereby be deleted now."); // remove entity.getUserPermissions().remove(user); this.saveOrUpdate(entity); permissionCollectionService.delete(userPermissionCollection); return; } // only persist if we have "really" removed something if (newNrOfPermissions < originalNrOfPermissions) { LOG.debug("Removed the following permissions from an existing permission collection: " + permissionsSet); // persist the permission collection permissionCollectionService.saveOrUpdate(userPermissionCollection); LOG.debug("Persisted a permission collection"); } }
[ "public", "void", "removeAndSaveUserPermissions", "(", "E", "entity", ",", "User", "user", ",", "Permission", "...", "permissions", ")", "{", "if", "(", "entity", "==", "null", ")", "{", "LOG", ".", "error", "(", "\"Could not remove permissions: The passed entity ...
This method removes (user) permissions from the passed entity and persists (!) the permission collection! @param entity The secured entity @param user The user from which the permissions for the entity will be removed @param permissions The permissions to remove
[ "This", "method", "removes", "(", "user", ")", "permissions", "from", "the", "passed", "entity", "and", "persists", "(", "!", ")", "the", "permission", "collection!" ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java#L145-L196
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasLSTM.java
KerasLSTM.getGateActivationFromConfig
public IActivation getGateActivationFromConfig(Map<String, Object> layerConfig) throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException { Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf); if (!innerConfig.containsKey(conf.getLAYER_FIELD_INNER_ACTIVATION())) throw new InvalidKerasConfigurationException( "Keras LSTM layer config missing " + conf.getLAYER_FIELD_INNER_ACTIVATION() + " field"); return mapToIActivation((String) innerConfig.get(conf.getLAYER_FIELD_INNER_ACTIVATION()), conf); }
java
public IActivation getGateActivationFromConfig(Map<String, Object> layerConfig) throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException { Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf); if (!innerConfig.containsKey(conf.getLAYER_FIELD_INNER_ACTIVATION())) throw new InvalidKerasConfigurationException( "Keras LSTM layer config missing " + conf.getLAYER_FIELD_INNER_ACTIVATION() + " field"); return mapToIActivation((String) innerConfig.get(conf.getLAYER_FIELD_INNER_ACTIVATION()), conf); }
[ "public", "IActivation", "getGateActivationFromConfig", "(", "Map", "<", "String", ",", "Object", ">", "layerConfig", ")", "throws", "InvalidKerasConfigurationException", ",", "UnsupportedKerasConfigurationException", "{", "Map", "<", "String", ",", "Object", ">", "inne...
Get LSTM gate activation function from Keras layer configuration. @param layerConfig dictionary containing Keras layer configuration @return LSTM inner activation function @throws InvalidKerasConfigurationException Invalid Keras config
[ "Get", "LSTM", "gate", "activation", "function", "from", "Keras", "layer", "configuration", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasLSTM.java#L463-L470
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedExacStatsCalculator.java
VariantAggregatedExacStatsCalculator.addHeterozygousGenotypes
private static void addHeterozygousGenotypes(Variant variant, int numAllele, String[] alternateAlleles, VariantStats stats, String[] hetCounts) { if (hetCounts.length == alternateAlleles.length * (alternateAlleles.length + 1) / 2) { for (int i = 0; i < hetCounts.length; i++) { Integer alleles[] = new Integer[2]; getHeterozygousGenotype(i, alternateAlleles.length, alleles); String gt = VariantVcfFactory.mapToMultiallelicIndex(alleles[0], numAllele) + "/" + VariantVcfFactory.mapToMultiallelicIndex(alleles[1], numAllele); Genotype genotype = new Genotype(gt, variant.getReference(), alternateAlleles[numAllele]); stats.addGenotype(genotype, Integer.parseInt(hetCounts[i])); } } }
java
private static void addHeterozygousGenotypes(Variant variant, int numAllele, String[] alternateAlleles, VariantStats stats, String[] hetCounts) { if (hetCounts.length == alternateAlleles.length * (alternateAlleles.length + 1) / 2) { for (int i = 0; i < hetCounts.length; i++) { Integer alleles[] = new Integer[2]; getHeterozygousGenotype(i, alternateAlleles.length, alleles); String gt = VariantVcfFactory.mapToMultiallelicIndex(alleles[0], numAllele) + "/" + VariantVcfFactory.mapToMultiallelicIndex(alleles[1], numAllele); Genotype genotype = new Genotype(gt, variant.getReference(), alternateAlleles[numAllele]); stats.addGenotype(genotype, Integer.parseInt(hetCounts[i])); } } }
[ "private", "static", "void", "addHeterozygousGenotypes", "(", "Variant", "variant", ",", "int", "numAllele", ",", "String", "[", "]", "alternateAlleles", ",", "VariantStats", "stats", ",", "String", "[", "]", "hetCounts", ")", "{", "if", "(", "hetCounts", ".",...
Adds the heterozygous genotypes to a variant stats. Those are (in this order): 0/1, 0/2, 0/3, 0/4... 1/2, 1/3, 1/4... 2/3, 2/4... 3/4... for a given amount n of alleles, the number of combinations is (latex): \sum_{i=1}^n( \sum_{j=i}^n( 1 ) ), which resolved is n*(n+1)/2 @param variant to retrieve the alleles to construct the genotype @param numAllele @param alternateAlleles @param stats where to add the genotypes count @param hetCounts parsed string
[ "Adds", "the", "heterozygous", "genotypes", "to", "a", "variant", "stats", ".", "Those", "are", "(", "in", "this", "order", ")", ":", "0", "/", "1", "0", "/", "2", "0", "/", "3", "0", "/", "4", "...", "1", "/", "2", "1", "/", "3", "1", "/", ...
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedExacStatsCalculator.java#L214-L225
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.getDouble
private double getDouble( int idx, double defaultValue, CssFormatter formatter ) { if( parameters.size() <= idx ) { return defaultValue; } return parameters.get( idx ).doubleValue( formatter ); }
java
private double getDouble( int idx, double defaultValue, CssFormatter formatter ) { if( parameters.size() <= idx ) { return defaultValue; } return parameters.get( idx ).doubleValue( formatter ); }
[ "private", "double", "getDouble", "(", "int", "idx", ",", "double", "defaultValue", ",", "CssFormatter", "formatter", ")", "{", "if", "(", "parameters", ".", "size", "(", ")", "<=", "idx", ")", "{", "return", "defaultValue", ";", "}", "return", "parameters...
Get the idx parameter from the parameter list as double. @param idx the index starting with 0 @param defaultValue the result if such a parameter idx does not exists. @param formatter current formatter @return the expression
[ "Get", "the", "idx", "parameter", "from", "the", "parameter", "list", "as", "double", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L1038-L1043
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/core/Application.java
Application.methodExists
private static boolean methodExists(String controllerMethod, Class<?> controllerClass) { Objects.requireNonNull(controllerMethod, Required.CONTROLLER_METHOD.toString()); Objects.requireNonNull(controllerClass, Required.CONTROLLER_CLASS.toString()); return Arrays.stream(controllerClass.getMethods()).anyMatch(method -> method.getName().equals(controllerMethod)); }
java
private static boolean methodExists(String controllerMethod, Class<?> controllerClass) { Objects.requireNonNull(controllerMethod, Required.CONTROLLER_METHOD.toString()); Objects.requireNonNull(controllerClass, Required.CONTROLLER_CLASS.toString()); return Arrays.stream(controllerClass.getMethods()).anyMatch(method -> method.getName().equals(controllerMethod)); }
[ "private", "static", "boolean", "methodExists", "(", "String", "controllerMethod", ",", "Class", "<", "?", ">", "controllerClass", ")", "{", "Objects", ".", "requireNonNull", "(", "controllerMethod", ",", "Required", ".", "CONTROLLER_METHOD", ".", "toString", "(",...
Checks if a given method exists in a given class @param controllerMethod The method to check @param controllerClass The class to check @return True if the method exists, false otherwise
[ "Checks", "if", "a", "given", "method", "exists", "in", "a", "given", "class", "@param", "controllerMethod", "The", "method", "to", "check", "@param", "controllerClass", "The", "class", "to", "check" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/core/Application.java#L415-L420
forge/core
javaee/scaffold-faces/src/main/java/org/jboss/forge/addon/scaffold/faces/FacesScaffoldProvider.java
FacesScaffoldProvider.parseIndent
protected int parseIndent(final String template, final String indentOf) { int indent = 0; int indexOf = template.indexOf(indentOf); while ((indexOf >= 0) && (template.charAt(indexOf) != '\n')) { if (template.charAt(indexOf) == '\t') { indent++; } indexOf--; } return indent; }
java
protected int parseIndent(final String template, final String indentOf) { int indent = 0; int indexOf = template.indexOf(indentOf); while ((indexOf >= 0) && (template.charAt(indexOf) != '\n')) { if (template.charAt(indexOf) == '\t') { indent++; } indexOf--; } return indent; }
[ "protected", "int", "parseIndent", "(", "final", "String", "template", ",", "final", "String", "indentOf", ")", "{", "int", "indent", "=", "0", ";", "int", "indexOf", "=", "template", ".", "indexOf", "(", "indentOf", ")", ";", "while", "(", "(", "indexOf...
Parses the given XML and determines the indent of the given String namespaces that Metawidget introduces.
[ "Parses", "the", "given", "XML", "and", "determines", "the", "indent", "of", "the", "given", "String", "namespaces", "that", "Metawidget", "introduces", "." ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/scaffold-faces/src/main/java/org/jboss/forge/addon/scaffold/faces/FacesScaffoldProvider.java#L680-L696
GoogleCloudPlatform/app-gradle-plugin
src/main/java/com/google/cloud/tools/gradle/appengine/core/ShowConfigurationTask.java
ShowConfigurationTask.getFieldData
private static String getFieldData(Field root, Object instance, int depth) throws IllegalAccessException { StringBuilder result = new StringBuilder(""); root.setAccessible(true); result .append(spaces(depth)) .append("(") .append(root.getType().getSimpleName()) .append(getGenericTypeData(root.getGenericType())) .append(") ") .append(root.getName()) .append(" = ") .append(root.get(instance)) .append("\n"); return result.toString(); }
java
private static String getFieldData(Field root, Object instance, int depth) throws IllegalAccessException { StringBuilder result = new StringBuilder(""); root.setAccessible(true); result .append(spaces(depth)) .append("(") .append(root.getType().getSimpleName()) .append(getGenericTypeData(root.getGenericType())) .append(") ") .append(root.getName()) .append(" = ") .append(root.get(instance)) .append("\n"); return result.toString(); }
[ "private", "static", "String", "getFieldData", "(", "Field", "root", ",", "Object", "instance", ",", "int", "depth", ")", "throws", "IllegalAccessException", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", "\"\"", ")", ";", "root", ".", "setA...
Extract the type (and generic type parameters) and value for a given field.
[ "Extract", "the", "type", "(", "and", "generic", "type", "parameters", ")", "and", "value", "for", "a", "given", "field", "." ]
train
https://github.com/GoogleCloudPlatform/app-gradle-plugin/blob/86d44fe0668e28f55eee9e002d5e19f0041efa3c/src/main/java/com/google/cloud/tools/gradle/appengine/core/ShowConfigurationTask.java#L101-L116
jfinal/jfinal
src/main/java/com/jfinal/core/converter/TypeConverter.java
TypeConverter.convert
public final Object convert(Class<?> type, String s) throws ParseException { // mysql type: varchar, char, enum, set, text, tinytext, mediumtext, longtext if (type == String.class) { return ("".equals(s) ? null : s); // 用户在表单域中没有输入内容时将提交过来 "", 因为没有输入,所以要转成 null. } s = s.trim(); if ("".equals(s)) { // 前面的 String跳过以后,所有的空字符串全都转成 null, 这是合理的 return null; } // 以上两种情况无需转换,直接返回, 注意, 本方法不接受null为 s 参数(经测试永远不可能传来null, 因为无输入传来的也是"") //String.class提前处理 // -------- IConverter<?> converter = converterMap.get(type); if (converter != null) { return converter.convert(s); } if (JFinal.me().getConstants().getDevMode()) { throw new RuntimeException("Please add code in " + TypeConverter.class + ". The type can't be converted: " + type.getName()); } else { throw new RuntimeException(type.getName() + " can not be converted, please use other type of attributes in your model!"); } }
java
public final Object convert(Class<?> type, String s) throws ParseException { // mysql type: varchar, char, enum, set, text, tinytext, mediumtext, longtext if (type == String.class) { return ("".equals(s) ? null : s); // 用户在表单域中没有输入内容时将提交过来 "", 因为没有输入,所以要转成 null. } s = s.trim(); if ("".equals(s)) { // 前面的 String跳过以后,所有的空字符串全都转成 null, 这是合理的 return null; } // 以上两种情况无需转换,直接返回, 注意, 本方法不接受null为 s 参数(经测试永远不可能传来null, 因为无输入传来的也是"") //String.class提前处理 // -------- IConverter<?> converter = converterMap.get(type); if (converter != null) { return converter.convert(s); } if (JFinal.me().getConstants().getDevMode()) { throw new RuntimeException("Please add code in " + TypeConverter.class + ". The type can't be converted: " + type.getName()); } else { throw new RuntimeException(type.getName() + " can not be converted, please use other type of attributes in your model!"); } }
[ "public", "final", "Object", "convert", "(", "Class", "<", "?", ">", "type", ",", "String", "s", ")", "throws", "ParseException", "{", "// mysql type: varchar, char, enum, set, text, tinytext, mediumtext, longtext", "if", "(", "type", "==", "String", ".", "class", "...
将 String 数据转换为指定的类型 @param type 需要转换成为的数据类型 @param s 被转换的 String 类型数据,注意: s 参数不接受 null 值,否则会抛出异常 @return 转换成功的数据
[ "将", "String", "数据转换为指定的类型" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/core/converter/TypeConverter.java#L107-L129
synchronoss/cpo-api
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
CassandraCpoAdapter.getInstance
public static CassandraCpoAdapter getInstance(CassandraCpoMetaDescriptor metaDescriptor, DataSourceInfo<ClusterDataSource> cdsiTrx) throws CpoException { String adapterKey = metaDescriptor + ":" + cdsiTrx.getDataSourceName(); CassandraCpoAdapter adapter = (CassandraCpoAdapter) findCpoAdapter(adapterKey); if (adapter == null) { adapter = new CassandraCpoAdapter(metaDescriptor, cdsiTrx); addCpoAdapter(adapterKey, adapter); } return adapter; }
java
public static CassandraCpoAdapter getInstance(CassandraCpoMetaDescriptor metaDescriptor, DataSourceInfo<ClusterDataSource> cdsiTrx) throws CpoException { String adapterKey = metaDescriptor + ":" + cdsiTrx.getDataSourceName(); CassandraCpoAdapter adapter = (CassandraCpoAdapter) findCpoAdapter(adapterKey); if (adapter == null) { adapter = new CassandraCpoAdapter(metaDescriptor, cdsiTrx); addCpoAdapter(adapterKey, adapter); } return adapter; }
[ "public", "static", "CassandraCpoAdapter", "getInstance", "(", "CassandraCpoMetaDescriptor", "metaDescriptor", ",", "DataSourceInfo", "<", "ClusterDataSource", ">", "cdsiTrx", ")", "throws", "CpoException", "{", "String", "adapterKey", "=", "metaDescriptor", "+", "\":\"",...
Creates a CassandraCpoAdapter. @param metaDescriptor This datasource that identifies the cpo metadata datasource @param cdsiTrx The datasource that identifies the transaction database for read and write transactions. @throws org.synchronoss.cpo.CpoException exception
[ "Creates", "a", "CassandraCpoAdapter", "." ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L93-L101
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java
POIUtils.getCell
public static Cell getCell(final Sheet sheet, final Point address) { ArgUtils.notNull(sheet, "sheet"); ArgUtils.notNull(address, "address"); return getCell(sheet, address.x, address.y); }
java
public static Cell getCell(final Sheet sheet, final Point address) { ArgUtils.notNull(sheet, "sheet"); ArgUtils.notNull(address, "address"); return getCell(sheet, address.x, address.y); }
[ "public", "static", "Cell", "getCell", "(", "final", "Sheet", "sheet", ",", "final", "Point", "address", ")", "{", "ArgUtils", ".", "notNull", "(", "sheet", ",", "\"sheet\"", ")", ";", "ArgUtils", ".", "notNull", "(", "address", ",", "\"address\"", ")", ...
シートから任意アドレスのセルを取得する。 @since 0.5 @param sheet シートオブジェクト @param address アドレス(Point.x=column, Point.y=row) @return セル @throws IllegalArgumentException {@literal sheet == null or address == null.}
[ "シートから任意アドレスのセルを取得する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java#L138-L142
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.setSelectedUI
public static void setSelectedUI(ComponentUI uix, boolean selected, boolean focused, boolean enabled, boolean rollover) { selectedUI = uix; selectedUIState = 0; if (selected) { selectedUIState = SynthConstants.SELECTED; if (focused) { selectedUIState |= SynthConstants.FOCUSED; } } else if (rollover && enabled) { selectedUIState |= SynthConstants.MOUSE_OVER | SynthConstants.ENABLED; if (focused) { selectedUIState |= SynthConstants.FOCUSED; } } else { if (enabled) { selectedUIState |= SynthConstants.ENABLED; selectedUIState = SynthConstants.FOCUSED; } else { selectedUIState |= SynthConstants.DISABLED; } } }
java
public static void setSelectedUI(ComponentUI uix, boolean selected, boolean focused, boolean enabled, boolean rollover) { selectedUI = uix; selectedUIState = 0; if (selected) { selectedUIState = SynthConstants.SELECTED; if (focused) { selectedUIState |= SynthConstants.FOCUSED; } } else if (rollover && enabled) { selectedUIState |= SynthConstants.MOUSE_OVER | SynthConstants.ENABLED; if (focused) { selectedUIState |= SynthConstants.FOCUSED; } } else { if (enabled) { selectedUIState |= SynthConstants.ENABLED; selectedUIState = SynthConstants.FOCUSED; } else { selectedUIState |= SynthConstants.DISABLED; } } }
[ "public", "static", "void", "setSelectedUI", "(", "ComponentUI", "uix", ",", "boolean", "selected", ",", "boolean", "focused", ",", "boolean", "enabled", ",", "boolean", "rollover", ")", "{", "selectedUI", "=", "uix", ";", "selectedUIState", "=", "0", ";", "...
Used by the renderers. For the most part the renderers are implemented as Labels, which is problematic in so far as they are never selected. To accomodate this SeaGlassLabelUI checks if the current UI matches that of <code>selectedUI</code> (which this methods sets), if it does, then a state as set by this method is set in the field {@code selectedUIState}. This provides a way for labels to have a state other than selected. @param uix a UI delegate. @param selected is the component selected? @param focused is the component focused? @param enabled is the component enabled? @param rollover is the component's rollover state enabled?
[ "Used", "by", "the", "renderers", ".", "For", "the", "most", "part", "the", "renderers", "are", "implemented", "as", "Labels", "which", "is", "problematic", "in", "so", "far", "as", "they", "are", "never", "selected", ".", "To", "accomodate", "this", "SeaG...
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2908-L2933
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableDictionary.java
MutableDictionary.setBlob
@NonNull @Override public MutableDictionary setBlob(@NonNull String key, Blob value) { return setValue(key, value); }
java
@NonNull @Override public MutableDictionary setBlob(@NonNull String key, Blob value) { return setValue(key, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableDictionary", "setBlob", "(", "@", "NonNull", "String", "key", ",", "Blob", "value", ")", "{", "return", "setValue", "(", "key", ",", "value", ")", ";", "}" ]
Set a Blob object for the given key. @param key The key @param value The Blob object. @return The self object.
[ "Set", "a", "Blob", "object", "for", "the", "given", "key", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDictionary.java#L208-L212
Azure/azure-sdk-for-java
applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java
EventsImpl.getByTypeAsync
public Observable<EventsResults> getByTypeAsync(String appId, EventType eventType) { return getByTypeWithServiceResponseAsync(appId, eventType).map(new Func1<ServiceResponse<EventsResults>, EventsResults>() { @Override public EventsResults call(ServiceResponse<EventsResults> response) { return response.body(); } }); }
java
public Observable<EventsResults> getByTypeAsync(String appId, EventType eventType) { return getByTypeWithServiceResponseAsync(appId, eventType).map(new Func1<ServiceResponse<EventsResults>, EventsResults>() { @Override public EventsResults call(ServiceResponse<EventsResults> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EventsResults", ">", "getByTypeAsync", "(", "String", "appId", ",", "EventType", "eventType", ")", "{", "return", "getByTypeWithServiceResponseAsync", "(", "appId", ",", "eventType", ")", ".", "map", "(", "new", "Func1", "<", "Servi...
Execute OData query. Executes an OData query for events. @param appId ID of the application. This is Application ID from the API Access settings blade in the Azure portal. @param eventType The type of events to query; either a standard event type (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or `$all` to query across all event types. Possible values include: '$all', 'traces', 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', 'availabilityResults', 'performanceCounters', 'customMetrics' @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventsResults object
[ "Execute", "OData", "query", ".", "Executes", "an", "OData", "query", "for", "events", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/EventsImpl.java#L105-L112
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxFolder.java
BoxFolder.createFromIdAndName
public static BoxFolder createFromIdAndName(String folderId, String name) { JsonObject object = new JsonObject(); object.add(BoxItem.FIELD_ID, folderId); object.add(BoxItem.FIELD_TYPE, BoxFolder.TYPE); if (!TextUtils.isEmpty(name)) { object.add(BoxItem.FIELD_NAME, name); } return new BoxFolder(object); }
java
public static BoxFolder createFromIdAndName(String folderId, String name) { JsonObject object = new JsonObject(); object.add(BoxItem.FIELD_ID, folderId); object.add(BoxItem.FIELD_TYPE, BoxFolder.TYPE); if (!TextUtils.isEmpty(name)) { object.add(BoxItem.FIELD_NAME, name); } return new BoxFolder(object); }
[ "public", "static", "BoxFolder", "createFromIdAndName", "(", "String", "folderId", ",", "String", "name", ")", "{", "JsonObject", "object", "=", "new", "JsonObject", "(", ")", ";", "object", ".", "add", "(", "BoxItem", ".", "FIELD_ID", ",", "folderId", ")", ...
A convenience method to create an empty folder with just the id and type fields set. This allows the ability to interact with the content sdk in a more descriptive and type safe manner @param folderId the id of folder to create @param name the name of the folder to create @return an empty BoxFolder object that only contains id and type information
[ "A", "convenience", "method", "to", "create", "an", "empty", "folder", "with", "just", "the", "id", "and", "type", "fields", "set", ".", "This", "allows", "the", "ability", "to", "interact", "with", "the", "content", "sdk", "in", "a", "more", "descriptive"...
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxFolder.java#L107-L115
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.findRRset
public boolean findRRset(Name name, int type, int section) { if (sections[section] == null) return false; for (int i = 0; i < sections[section].size(); i++) { Record r = (Record) sections[section].get(i); if (r.getType() == type && name.equals(r.getName())) return true; } return false; }
java
public boolean findRRset(Name name, int type, int section) { if (sections[section] == null) return false; for (int i = 0; i < sections[section].size(); i++) { Record r = (Record) sections[section].get(i); if (r.getType() == type && name.equals(r.getName())) return true; } return false; }
[ "public", "boolean", "findRRset", "(", "Name", "name", ",", "int", "type", ",", "int", "section", ")", "{", "if", "(", "sections", "[", "section", "]", "==", "null", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s...
Determines if an RRset with the given name and type is already present in the given section. @see RRset @see Section
[ "Determines", "if", "an", "RRset", "with", "the", "given", "name", "and", "type", "is", "already", "present", "in", "the", "given", "section", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L234-L244
apache/incubator-gobblin
gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java
AzkabanClient.executeFlowWithOptions
public AzkabanExecuteFlowStatus executeFlowWithOptions(String projectName, String flowName, Map<String, String> flowOptions, Map<String, String> flowParameters) throws AzkabanClientException { AzkabanMultiCallables.ExecuteFlowCallable callable = AzkabanMultiCallables.ExecuteFlowCallable.builder() .client(this) .projectName(projectName) .flowName(flowName) .flowOptions(flowOptions) .flowParameters(flowParameters) .build(); return runWithRetry(callable, AzkabanExecuteFlowStatus.class); }
java
public AzkabanExecuteFlowStatus executeFlowWithOptions(String projectName, String flowName, Map<String, String> flowOptions, Map<String, String> flowParameters) throws AzkabanClientException { AzkabanMultiCallables.ExecuteFlowCallable callable = AzkabanMultiCallables.ExecuteFlowCallable.builder() .client(this) .projectName(projectName) .flowName(flowName) .flowOptions(flowOptions) .flowParameters(flowParameters) .build(); return runWithRetry(callable, AzkabanExecuteFlowStatus.class); }
[ "public", "AzkabanExecuteFlowStatus", "executeFlowWithOptions", "(", "String", "projectName", ",", "String", "flowName", ",", "Map", "<", "String", ",", "String", ">", "flowOptions", ",", "Map", "<", "String", ",", "String", ">", "flowParameters", ")", "throws", ...
Execute a flow by providing flow parameters and options. The project and flow should be created first. @param projectName project name @param flowName flow name @param flowOptions flow options @param flowParameters flow parameters @return The status object which contains success status and execution id.
[ "Execute", "a", "flow", "by", "providing", "flow", "parameters", "and", "options", ".", "The", "project", "and", "flow", "should", "be", "created", "first", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java#L341-L355
beders/Resty
src/main/java/us/monoid/web/Resty.java
Resty.bytes
public BinaryResource bytes(URI anUri, AbstractContent someContent) throws IOException { return doPOSTOrPUT(anUri, someContent, createBinaryResource()); }
java
public BinaryResource bytes(URI anUri, AbstractContent someContent) throws IOException { return doPOSTOrPUT(anUri, someContent, createBinaryResource()); }
[ "public", "BinaryResource", "bytes", "(", "URI", "anUri", ",", "AbstractContent", "someContent", ")", "throws", "IOException", "{", "return", "doPOSTOrPUT", "(", "anUri", ",", "someContent", ",", "createBinaryResource", "(", ")", ")", ";", "}" ]
POST to the URI and get the resource as binary resource. @param uri the uri to follow @return @throws IOException
[ "POST", "to", "the", "URI", "and", "get", "the", "resource", "as", "binary", "resource", "." ]
train
https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L379-L381
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/ActionContext.java
ActionContext.getParameterAsBoolean
public boolean getParameterAsBoolean(String name, Boolean defaultValue) { return defaultValue(stringToBoolean(getParameter(name)), defaultValue); }
java
public boolean getParameterAsBoolean(String name, Boolean defaultValue) { return defaultValue(stringToBoolean(getParameter(name)), defaultValue); }
[ "public", "boolean", "getParameterAsBoolean", "(", "String", "name", ",", "Boolean", "defaultValue", ")", "{", "return", "defaultValue", "(", "stringToBoolean", "(", "getParameter", "(", "name", ")", ")", ",", "defaultValue", ")", ";", "}" ]
Get request parameter as a Boolean. @param name Parameter name @param defaultValue Parameter default value
[ "Get", "request", "parameter", "as", "a", "Boolean", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/ActionContext.java#L145-L147
kuujo/vertigo
core/src/main/java/net/kuujo/vertigo/util/Args.java
Args.checkNotNull
public static void checkNotNull(Object value, String message, Object... args) { if (value == null) { throw new NullPointerException(String.format(message, args)); } }
java
public static void checkNotNull(Object value, String message, Object... args) { if (value == null) { throw new NullPointerException(String.format(message, args)); } }
[ "public", "static", "void", "checkNotNull", "(", "Object", "value", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "String", ".", "format", "(", "...
Validates that an argument is not null. @param value The value to check. @param message An exception message. @param args Exception message arguments.
[ "Validates", "that", "an", "argument", "is", "not", "null", "." ]
train
https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Args.java#L70-L74
lucee/Lucee
core/src/main/java/lucee/commons/lang/ClassUtil.java
ClassUtil.loadClass
public static Class loadClass(String className, String bundleName, String bundleVersion, Identification id) throws ClassException, BundleException { if (StringUtil.isEmpty(bundleName)) return loadClass(className); return loadClassByBundle(className, bundleName, bundleVersion, id); }
java
public static Class loadClass(String className, String bundleName, String bundleVersion, Identification id) throws ClassException, BundleException { if (StringUtil.isEmpty(bundleName)) return loadClass(className); return loadClassByBundle(className, bundleName, bundleVersion, id); }
[ "public", "static", "Class", "loadClass", "(", "String", "className", ",", "String", "bundleName", ",", "String", "bundleVersion", ",", "Identification", "id", ")", "throws", "ClassException", ",", "BundleException", "{", "if", "(", "StringUtil", ".", "isEmpty", ...
if no bundle is defined it is loaded the old way @param className @param bundleName @param bundleVersion @param id @return @throws ClassException @throws BundleException
[ "if", "no", "bundle", "is", "defined", "it", "is", "loaded", "the", "old", "way" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L799-L802
beckchr/juel
modules/api/src/main/java/javax/el/CompositeELResolver.java
CompositeELResolver.isReadOnly
@Override public boolean isReadOnly(ELContext context, Object base, Object property) { context.setPropertyResolved(false); for (int i = 0, l = resolvers.size(); i < l; i++) { boolean readOnly = resolvers.get(i).isReadOnly(context, base, property); if (context.isPropertyResolved()) { return readOnly; } } return false; }
java
@Override public boolean isReadOnly(ELContext context, Object base, Object property) { context.setPropertyResolved(false); for (int i = 0, l = resolvers.size(); i < l; i++) { boolean readOnly = resolvers.get(i).isReadOnly(context, base, property); if (context.isPropertyResolved()) { return readOnly; } } return false; }
[ "@", "Override", "public", "boolean", "isReadOnly", "(", "ELContext", "context", ",", "Object", "base", ",", "Object", "property", ")", "{", "context", ".", "setPropertyResolved", "(", "false", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", ...
For a given base and property, attempts to determine whether a call to {@link #setValue(ELContext, Object, Object, Object)} will always fail. The result is obtained by querying all component resolvers. If this resolver handles the given (base, property) pair, the propertyResolved property of the ELContext object must be set to true by the resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value. First, propertyResolved is set to false on the provided ELContext. Next, for each component resolver in this composite: <ol> <li>The isReadOnly() method is called, passing in the provided context, base and property.</li> <li>If the ELContext's propertyResolved flag is false then iteration continues.</li> <li>Otherwise, iteration stops and no more component resolvers are considered. The value returned by isReadOnly() is returned by this method.</li> </ol> If none of the component resolvers were able to perform this operation, the value false is returned and the propertyResolved flag remains set to false. Any exception thrown by component resolvers during the iteration is propagated to the caller of this method. @param context The context of this evaluation. @param base The base object to return the most general property type for, or null to enumerate the set of top-level variables that this resolver can evaluate. @param property The property or variable to return the acceptable type for. @return If the propertyResolved property of ELContext was set to true, then true if the property is read-only or false if not; otherwise undefined. @throws NullPointerException if context is null @throws PropertyNotFoundException if base is not null and the specified property does not exist or is not readable. @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
[ "For", "a", "given", "base", "and", "property", "attempts", "to", "determine", "whether", "a", "call", "to", "{", "@link", "#setValue", "(", "ELContext", "Object", "Object", "Object", ")", "}", "will", "always", "fail", ".", "The", "result", "is", "obtaine...
train
https://github.com/beckchr/juel/blob/1a8fb366b7349ddae81f806dee1ab2de11b672c7/modules/api/src/main/java/javax/el/CompositeELResolver.java#L275-L285
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyNodeImpl.java
PolicyNodeImpl.getPolicyNodes
private void getPolicyNodes(int depth, Set<PolicyNodeImpl> set) { // if we've reached the desired depth, then return ourself if (mDepth == depth) { set.add(this); } else { for (PolicyNodeImpl node : mChildren) { node.getPolicyNodes(depth, set); } } }
java
private void getPolicyNodes(int depth, Set<PolicyNodeImpl> set) { // if we've reached the desired depth, then return ourself if (mDepth == depth) { set.add(this); } else { for (PolicyNodeImpl node : mChildren) { node.getPolicyNodes(depth, set); } } }
[ "private", "void", "getPolicyNodes", "(", "int", "depth", ",", "Set", "<", "PolicyNodeImpl", ">", "set", ")", "{", "// if we've reached the desired depth, then return ourself", "if", "(", "mDepth", "==", "depth", ")", "{", "set", ".", "add", "(", "this", ")", ...
Add all nodes at depth depth to set and return the Set. Internal recursion helper.
[ "Add", "all", "nodes", "at", "depth", "depth", "to", "set", "and", "return", "the", "Set", ".", "Internal", "recursion", "helper", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyNodeImpl.java#L312-L321
ThreeTen/threetenbp
src/main/java/org/threeten/bp/ZonedDateTime.java
ZonedDateTime.ofInstant
public static ZonedDateTime ofInstant(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) { Jdk8Methods.requireNonNull(localDateTime, "localDateTime"); Jdk8Methods.requireNonNull(offset, "offset"); Jdk8Methods.requireNonNull(zone, "zone"); return create(localDateTime.toEpochSecond(offset), localDateTime.getNano(), zone); }
java
public static ZonedDateTime ofInstant(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) { Jdk8Methods.requireNonNull(localDateTime, "localDateTime"); Jdk8Methods.requireNonNull(offset, "offset"); Jdk8Methods.requireNonNull(zone, "zone"); return create(localDateTime.toEpochSecond(offset), localDateTime.getNano(), zone); }
[ "public", "static", "ZonedDateTime", "ofInstant", "(", "LocalDateTime", "localDateTime", ",", "ZoneOffset", "offset", ",", "ZoneId", "zone", ")", "{", "Jdk8Methods", ".", "requireNonNull", "(", "localDateTime", ",", "\"localDateTime\"", ")", ";", "Jdk8Methods", ".",...
Obtains an instance of {@code ZonedDateTime} from the instant formed by combining the local date-time and offset. <p> This creates a zoned date-time by {@link LocalDateTime#toInstant(ZoneOffset) combining} the {@code LocalDateTime} and {@code ZoneOffset}. This combination uniquely specifies an instant without ambiguity. <p> Converting an instant to a zoned date-time is simple as there is only one valid offset for each instant. If the valid offset is different to the offset specified, the the date-time and offset of the zoned date-time will differ from those specified. <p> If the {@code ZoneId} to be used is a {@code ZoneOffset}, this method is equivalent to {@link #of(LocalDateTime, ZoneId)}. @param localDateTime the local date-time, not null @param offset the zone offset, not null @param zone the time-zone, not null @return the zoned date-time, not null
[ "Obtains", "an", "instance", "of", "{", "@code", "ZonedDateTime", "}", "from", "the", "instant", "formed", "by", "combining", "the", "local", "date", "-", "time", "and", "offset", ".", "<p", ">", "This", "creates", "a", "zoned", "date", "-", "time", "by"...
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/ZonedDateTime.java#L401-L406
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java
ProvFactory.newWasStartedBy
public WasStartedBy newWasStartedBy(QualifiedName id, QualifiedName activity, QualifiedName trigger, QualifiedName starter) { WasStartedBy res=newWasStartedBy(id,activity,trigger); res.setStarter(starter); return res; }
java
public WasStartedBy newWasStartedBy(QualifiedName id, QualifiedName activity, QualifiedName trigger, QualifiedName starter) { WasStartedBy res=newWasStartedBy(id,activity,trigger); res.setStarter(starter); return res; }
[ "public", "WasStartedBy", "newWasStartedBy", "(", "QualifiedName", "id", ",", "QualifiedName", "activity", ",", "QualifiedName", "trigger", ",", "QualifiedName", "starter", ")", "{", "WasStartedBy", "res", "=", "newWasStartedBy", "(", "id", ",", "activity", ",", "...
A factory method to create an instance of a start {@link WasStartedBy} @param id @param activity an identifier for the started <a href="http://www.w3.org/TR/prov-dm/#start.activity">activity</a> @param trigger an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#start.trigger">entity triggering</a> the activity @param starter an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#start.starter">activity</a> that generated the (possibly unspecified) entity @return an instance of {@link WasStartedBy}
[ "A", "factory", "method", "to", "create", "an", "instance", "of", "a", "start", "{" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L1517-L1521
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/HubVirtualNetworkConnectionsInner.java
HubVirtualNetworkConnectionsInner.get
public HubVirtualNetworkConnectionInner get(String resourceGroupName, String virtualHubName, String connectionName) { return getWithServiceResponseAsync(resourceGroupName, virtualHubName, connectionName).toBlocking().single().body(); }
java
public HubVirtualNetworkConnectionInner get(String resourceGroupName, String virtualHubName, String connectionName) { return getWithServiceResponseAsync(resourceGroupName, virtualHubName, connectionName).toBlocking().single().body(); }
[ "public", "HubVirtualNetworkConnectionInner", "get", "(", "String", "resourceGroupName", ",", "String", "virtualHubName", ",", "String", "connectionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualHubName", ",", "connectionNam...
Retrieves the details of a HubVirtualNetworkConnection. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @param connectionName The name of the vpn connection. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the HubVirtualNetworkConnectionInner object if successful.
[ "Retrieves", "the", "details", "of", "a", "HubVirtualNetworkConnection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/HubVirtualNetworkConnectionsInner.java#L85-L87
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.indexOf
public int indexOf(byte[] bytes, int offset) { // make sure we're not checking against any byte arrays of length 0 if (bytes.length == 0 || size() == 0) { // a match is not possible return -1; } // make sure the offset won't cause us to read past the end of the byte[] if (offset < 0 || offset >= size()) { throw new IllegalArgumentException("Offset must be a value between 0 and " + size() + " (current buffer size)"); } int length = size()-bytes.length; for (int i = offset; i <= length; i++) { int j = 0; // continue search loop while the next bytes match while (j < bytes.length && getUnchecked(i+j) == bytes[j]) { j++; } // if we found it, then j will equal the length of the search bytes if (j == bytes.length) { return i; } } // if we get here then we didn't find it return -1; }
java
public int indexOf(byte[] bytes, int offset) { // make sure we're not checking against any byte arrays of length 0 if (bytes.length == 0 || size() == 0) { // a match is not possible return -1; } // make sure the offset won't cause us to read past the end of the byte[] if (offset < 0 || offset >= size()) { throw new IllegalArgumentException("Offset must be a value between 0 and " + size() + " (current buffer size)"); } int length = size()-bytes.length; for (int i = offset; i <= length; i++) { int j = 0; // continue search loop while the next bytes match while (j < bytes.length && getUnchecked(i+j) == bytes[j]) { j++; } // if we found it, then j will equal the length of the search bytes if (j == bytes.length) { return i; } } // if we get here then we didn't find it return -1; }
[ "public", "int", "indexOf", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "// make sure we're not checking against any byte arrays of length 0", "if", "(", "bytes", ".", "length", "==", "0", "||", "size", "(", ")", "==", "0", ")", "{", "// ...
Returns the index within this buffer of the first occurrence of the specified bytes after the offset. The bytes to search for must have a size lower than or equal to the current buffer size. This method will return -1 if the bytes are not contained within this byte buffer. @param bytes The byte array to search for @param offset The offset within the buffer to search from @return The index where the bytes start to match within the buffer.
[ "Returns", "the", "index", "within", "this", "buffer", "of", "the", "first", "occurrence", "of", "the", "specified", "bytes", "after", "the", "offset", ".", "The", "bytes", "to", "search", "for", "must", "have", "a", "size", "lower", "than", "or", "equal",...
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L921-L948
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.multTransAB
public static void multTransAB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( a.numCols >= EjmlParameters.CMULT_TRANAB_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multTransAB_aux(a, b, c, null); } else { MatrixMatrixMult_ZDRM.multTransAB(a, b, c); } }
java
public static void multTransAB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( a.numCols >= EjmlParameters.CMULT_TRANAB_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multTransAB_aux(a, b, c, null); } else { MatrixMatrixMult_ZDRM.multTransAB(a, b, c); } }
[ "public", "static", "void", "multTransAB", "(", "ZMatrixRMaj", "a", ",", "ZMatrixRMaj", "b", ",", "ZMatrixRMaj", "c", ")", "{", "if", "(", "a", ".", "numCols", ">=", "EjmlParameters", ".", "CMULT_TRANAB_COLUMN_SWITCH", ")", "{", "MatrixMatrixMult_ZDRM", ".", "...
<p> Performs the following operation:<br> <br> c = a<sup>T</sup> * b<sup>T</sup><br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>jk</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "a<sup", ">", "T<", "/", "sup", ">", "*", "b<sup", ">", "T<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&sum", ";", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L538-L545
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.setPassword
public void setPassword(String username, String oldPassword, String newPassword) throws CmsException { m_securityManager.resetPassword(m_context, username, oldPassword, newPassword); }
java
public void setPassword(String username, String oldPassword, String newPassword) throws CmsException { m_securityManager.resetPassword(m_context, username, oldPassword, newPassword); }
[ "public", "void", "setPassword", "(", "String", "username", ",", "String", "oldPassword", ",", "String", "newPassword", ")", "throws", "CmsException", "{", "m_securityManager", ".", "resetPassword", "(", "m_context", ",", "username", ",", "oldPassword", ",", "newP...
Sets the password for a specified user.<p> @param username the name of the user @param oldPassword the old password @param newPassword the new password @throws CmsException if the user data could not be read from the database
[ "Sets", "the", "password", "for", "a", "specified", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3854-L3857
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java
FactoryFiducialCalibration.circleHexagonalGrid
public static CalibrationDetectorCircleHexagonalGrid circleHexagonalGrid( @Nullable ConfigCircleHexagonalGrid config , ConfigGridDimen configGrid ) { if( config == null ) config = new ConfigCircleHexagonalGrid(); config.checkValidity(); return new CalibrationDetectorCircleHexagonalGrid(config,configGrid); }
java
public static CalibrationDetectorCircleHexagonalGrid circleHexagonalGrid( @Nullable ConfigCircleHexagonalGrid config , ConfigGridDimen configGrid ) { if( config == null ) config = new ConfigCircleHexagonalGrid(); config.checkValidity(); return new CalibrationDetectorCircleHexagonalGrid(config,configGrid); }
[ "public", "static", "CalibrationDetectorCircleHexagonalGrid", "circleHexagonalGrid", "(", "@", "Nullable", "ConfigCircleHexagonalGrid", "config", ",", "ConfigGridDimen", "configGrid", ")", "{", "if", "(", "config", "==", "null", ")", "config", "=", "new", "ConfigCircleH...
Detector for hexagonal grid of circles. All circles must be entirely inside of the image. @param config Configuration for target @return The detector
[ "Detector", "for", "hexagonal", "grid", "of", "circles", ".", "All", "circles", "must", "be", "entirely", "inside", "of", "the", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java#L107-L114
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/capacity/CapacityFactory.java
CapacityFactory.loadExtension
private static Object loadExtension(Extension extension, ClassLoaderPlugin classLoaderPlugin) { try { Class<?> c = classLoaderPlugin.loadClass(extension.getClassName(), extension.getModuleName(), extension.getModuleSlot()); return c.newInstance(); } catch (Throwable t) { log.tracef("Throwable while loading %s using own classloader: %s", extension.getClassName(), t.getMessage()); } return null; }
java
private static Object loadExtension(Extension extension, ClassLoaderPlugin classLoaderPlugin) { try { Class<?> c = classLoaderPlugin.loadClass(extension.getClassName(), extension.getModuleName(), extension.getModuleSlot()); return c.newInstance(); } catch (Throwable t) { log.tracef("Throwable while loading %s using own classloader: %s", extension.getClassName(), t.getMessage()); } return null; }
[ "private", "static", "Object", "loadExtension", "(", "Extension", "extension", ",", "ClassLoaderPlugin", "classLoaderPlugin", ")", "{", "try", "{", "Class", "<", "?", ">", "c", "=", "classLoaderPlugin", ".", "loadClass", "(", "extension", ".", "getClassName", "(...
Load the class @param extension The extension metadata to load as class instance @param classLoaderPlugin class loader plugin to use to load class @return The object
[ "Load", "the", "class" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/capacity/CapacityFactory.java#L189-L203
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.createOrUpdateAsync
public Observable<VirtualMachineInner> createOrUpdateAsync(String resourceGroupName, String vmName, VirtualMachineInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineInner> createOrUpdateAsync(String resourceGroupName, String vmName, VirtualMachineInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "VirtualMachineInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ","...
The operation to create or update a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Create Virtual Machine operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "The", "operation", "to", "create", "or", "update", "a", "virtual", "machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L577-L584