repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/server/JavacServer.java
JavacServer.startServer
public static int startServer(String settings, PrintStream err) { try { String portfile = Util.extractStringOption("portfile", settings); // The log file collects more javac server specific log information. String logfile = Util.extractStringOption("logfile", settings); // The stdouterr file collects all the System.out and System.err writes to disk. String stdouterrfile = Util.extractStringOption("stdouterrfile", settings); // We could perhaps use System.setOut and setErr here. // But for the moment we rely on the client to spawn a shell where stdout // and stderr are redirected already. // The pool size is a limit the number of concurrent compiler threads used. // The server might use less than these to avoid memory problems. int poolsize = Util.extractIntOption("poolsize", settings); if (poolsize <= 0) { // If not set, default to the number of cores. poolsize = Runtime.getRuntime().availableProcessors(); } // How many seconds of inactivity will the server accept before quitting? int keepalive = Util.extractIntOption("keepalive", settings); if (keepalive <= 0) { keepalive = 120; } // The port file is locked and the server port and cookie is written into it. PortFile portFile = getPortFile(portfile); JavacServer s; synchronized (portFile) { portFile.lock(); portFile.getValues(); if (portFile.containsPortInfo()) { err.println("Javac server not started because portfile exists!"); portFile.unlock(); return -1; } s = new JavacServer(poolsize, logfile); portFile.setValues(s.getPort(), s.getCookie()); portFile.unlock(); } // Run the server. Will delete the port file when shutting down. // It will shut down automatically when no new requests have come in // during the last 125 seconds. s.run(portFile, err, keepalive); // The run loop for the server has exited. return 0; } catch (Exception e) { e.printStackTrace(err); return -1; } }
java
public static int startServer(String settings, PrintStream err) { try { String portfile = Util.extractStringOption("portfile", settings); // The log file collects more javac server specific log information. String logfile = Util.extractStringOption("logfile", settings); // The stdouterr file collects all the System.out and System.err writes to disk. String stdouterrfile = Util.extractStringOption("stdouterrfile", settings); // We could perhaps use System.setOut and setErr here. // But for the moment we rely on the client to spawn a shell where stdout // and stderr are redirected already. // The pool size is a limit the number of concurrent compiler threads used. // The server might use less than these to avoid memory problems. int poolsize = Util.extractIntOption("poolsize", settings); if (poolsize <= 0) { // If not set, default to the number of cores. poolsize = Runtime.getRuntime().availableProcessors(); } // How many seconds of inactivity will the server accept before quitting? int keepalive = Util.extractIntOption("keepalive", settings); if (keepalive <= 0) { keepalive = 120; } // The port file is locked and the server port and cookie is written into it. PortFile portFile = getPortFile(portfile); JavacServer s; synchronized (portFile) { portFile.lock(); portFile.getValues(); if (portFile.containsPortInfo()) { err.println("Javac server not started because portfile exists!"); portFile.unlock(); return -1; } s = new JavacServer(poolsize, logfile); portFile.setValues(s.getPort(), s.getCookie()); portFile.unlock(); } // Run the server. Will delete the port file when shutting down. // It will shut down automatically when no new requests have come in // during the last 125 seconds. s.run(portFile, err, keepalive); // The run loop for the server has exited. return 0; } catch (Exception e) { e.printStackTrace(err); return -1; } }
[ "public", "static", "int", "startServer", "(", "String", "settings", ",", "PrintStream", "err", ")", "{", "try", "{", "String", "portfile", "=", "Util", ".", "extractStringOption", "(", "\"portfile\"", ",", "settings", ")", ";", "// The log file collects more java...
Start a server using a settings string. Typically: "--startserver:portfile=/tmp/myserver,poolsize=3" and the string "portfile=/tmp/myserver,poolsize=3" is sent as the settings parameter. Returns 0 on success, -1 on failure.
[ "Start", "a", "server", "using", "a", "settings", "string", ".", "Typically", ":", "--", "startserver", ":", "portfile", "=", "/", "tmp", "/", "myserver", "poolsize", "=", "3", "and", "the", "string", "portfile", "=", "/", "tmp", "/", "myserver", "poolsi...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java#L159-L209
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
JacksonDBCollection.ensureIndex
public void ensureIndex(final DBObject keys, final DBObject optionsIN) throws MongoException { dbCollection.ensureIndex(keys, optionsIN); }
java
public void ensureIndex(final DBObject keys, final DBObject optionsIN) throws MongoException { dbCollection.ensureIndex(keys, optionsIN); }
[ "public", "void", "ensureIndex", "(", "final", "DBObject", "keys", ",", "final", "DBObject", "optionsIN", ")", "throws", "MongoException", "{", "dbCollection", ".", "ensureIndex", "(", "keys", ",", "optionsIN", ")", ";", "}" ]
Creates an index on a set of fields, if one does not already exist. @param keys an object with a key set of the fields desired for the index @param optionsIN options for the index (name, unique, etc) @throws MongoException If an error occurred
[ "Creates", "an", "index", "on", "a", "set", "of", "fields", "if", "one", "does", "not", "already", "exist", "." ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L733-L735
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.midString
public String midString(int index, final int length) { if (index < 0) { index = 0; } if (length <= 0 || index >= size) { return StringUtils.EMPTY; } if (size <= index + length) { return new String(buffer, index, size - index); } return new String(buffer, index, length); }
java
public String midString(int index, final int length) { if (index < 0) { index = 0; } if (length <= 0 || index >= size) { return StringUtils.EMPTY; } if (size <= index + length) { return new String(buffer, index, size - index); } return new String(buffer, index, length); }
[ "public", "String", "midString", "(", "int", "index", ",", "final", "int", "length", ")", "{", "if", "(", "index", "<", "0", ")", "{", "index", "=", "0", ";", "}", "if", "(", "length", "<=", "0", "||", "index", ">=", "size", ")", "{", "return", ...
Extracts some characters from the middle of the string builder without throwing an exception. <p> This method extracts <code>length</code> characters from the builder at the specified index. If the index is negative it is treated as zero. If the index is greater than the builder size, it is treated as the builder size. If the length is negative, the empty string is returned. If insufficient characters are available in the builder, as much as possible is returned. Thus the returned string may be shorter than the length requested. @param index the index to start at, negative means zero @param length the number of characters to extract, negative returns empty string @return the new string
[ "Extracts", "some", "characters", "from", "the", "middle", "of", "the", "string", "builder", "without", "throwing", "an", "exception", ".", "<p", ">", "This", "method", "extracts", "<code", ">", "length<", "/", "code", ">", "characters", "from", "the", "buil...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2344-L2355
pravega/pravega
client/src/main/java/io/pravega/client/admin/impl/StreamCutHelper.java
StreamCutHelper.fetchHeadStreamCut
public CompletableFuture<StreamCut> fetchHeadStreamCut(final Stream stream) { //Fetch segments pointing to the current HEAD of the stream. return controller.getSegmentsAtTime(new StreamImpl(stream.getScope(), stream.getStreamName()), 0L) .thenApply( s -> new StreamCutImpl(stream, s)); }
java
public CompletableFuture<StreamCut> fetchHeadStreamCut(final Stream stream) { //Fetch segments pointing to the current HEAD of the stream. return controller.getSegmentsAtTime(new StreamImpl(stream.getScope(), stream.getStreamName()), 0L) .thenApply( s -> new StreamCutImpl(stream, s)); }
[ "public", "CompletableFuture", "<", "StreamCut", ">", "fetchHeadStreamCut", "(", "final", "Stream", "stream", ")", "{", "//Fetch segments pointing to the current HEAD of the stream.", "return", "controller", ".", "getSegmentsAtTime", "(", "new", "StreamImpl", "(", "stream",...
Obtain the {@link StreamCut} pointing to the current HEAD of the Stream. @param stream The Stream. @return {@link StreamCut} pointing to the HEAD of the Stream.
[ "Obtain", "the", "{" ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/admin/impl/StreamCutHelper.java#L51-L55
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/TaskModel.java
TaskModel.update
public void update(Record record, boolean isText) throws MPXJException { int length = record.getLength(); for (int i = 0; i < length; i++) { if (isText == true) { add(getTaskCode(record.getString(i))); } else { add(record.getInteger(i).intValue()); } } }
java
public void update(Record record, boolean isText) throws MPXJException { int length = record.getLength(); for (int i = 0; i < length; i++) { if (isText == true) { add(getTaskCode(record.getString(i))); } else { add(record.getInteger(i).intValue()); } } }
[ "public", "void", "update", "(", "Record", "record", ",", "boolean", "isText", ")", "throws", "MPXJException", "{", "int", "length", "=", "record", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", ...
This method populates the task model from data read from an MPX file. @param record data read from an MPX file @param isText flag indicating whether the textual or numeric data is being supplied
[ "This", "method", "populates", "the", "task", "model", "from", "data", "read", "from", "an", "MPX", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/TaskModel.java#L99-L114
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java
BigtableClusterUtilities.getCluster
public Cluster getCluster(String clusterId, String zoneId) { Cluster response = null; for (Cluster cluster : getClusters().getClustersList()) { if (cluster.getName().endsWith("/clusters/" + clusterId) && cluster.getLocation().endsWith("/locations/" + zoneId)) { if (response == null) { response = cluster; } else { throw new IllegalStateException( String.format("Got multiple clusters named %s in zone %z.", clusterId, zoneId)); } } } return Preconditions.checkNotNull(response, String.format("Cluster %s in zone %s was not found.", clusterId, zoneId)); }
java
public Cluster getCluster(String clusterId, String zoneId) { Cluster response = null; for (Cluster cluster : getClusters().getClustersList()) { if (cluster.getName().endsWith("/clusters/" + clusterId) && cluster.getLocation().endsWith("/locations/" + zoneId)) { if (response == null) { response = cluster; } else { throw new IllegalStateException( String.format("Got multiple clusters named %s in zone %z.", clusterId, zoneId)); } } } return Preconditions.checkNotNull(response, String.format("Cluster %s in zone %s was not found.", clusterId, zoneId)); }
[ "public", "Cluster", "getCluster", "(", "String", "clusterId", ",", "String", "zoneId", ")", "{", "Cluster", "response", "=", "null", ";", "for", "(", "Cluster", "cluster", ":", "getClusters", "(", ")", ".", "getClustersList", "(", ")", ")", "{", "if", "...
Gets the current configuration of the cluster as encapsulated by a {@link Cluster} object. @param clusterId @param zoneId @return the {@link Cluster} if it was set. If the cluster is not found, throw a {@link NullPointerException}.
[ "Gets", "the", "current", "configuration", "of", "the", "cluster", "as", "encapsulated", "by", "a", "{", "@link", "Cluster", "}", "object", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java#L293-L308
VoltDB/voltdb
src/frontend/org/voltdb/VoltProcedure.java
VoltProcedure.voltQueueSQL
public void voltQueueSQL(final SQLStmt stmt, Object... args) { m_runner.voltQueueSQL(stmt, (Expectation) null, args); }
java
public void voltQueueSQL(final SQLStmt stmt, Object... args) { m_runner.voltQueueSQL(stmt, (Expectation) null, args); }
[ "public", "void", "voltQueueSQL", "(", "final", "SQLStmt", "stmt", ",", "Object", "...", "args", ")", "{", "m_runner", ".", "voltQueueSQL", "(", "stmt", ",", "(", "Expectation", ")", "null", ",", "args", ")", ";", "}" ]
Queue the SQL {@link org.voltdb.SQLStmt statement} for execution with the specified argument list. @param stmt {@link org.voltdb.SQLStmt Statement} to queue for execution. @param args List of arguments to be bound as parameters for the {@link org.voltdb.SQLStmt statement} @see <a href="#allowable_params">List of allowable parameter types</a>
[ "Queue", "the", "SQL", "{", "@link", "org", ".", "voltdb", ".", "SQLStmt", "statement", "}", "for", "execution", "with", "the", "specified", "argument", "list", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/VoltProcedure.java#L243-L245
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ReflectionUtils.java
ReflectionUtils.hasInterface
public static boolean hasInterface(Class<?> clazz, Class<?> iface) { if (clazz == null || iface == null || clazz == iface) { return false; } return iface.isInterface() && iface.isAssignableFrom(clazz); }
java
public static boolean hasInterface(Class<?> clazz, Class<?> iface) { if (clazz == null || iface == null || clazz == iface) { return false; } return iface.isInterface() && iface.isAssignableFrom(clazz); }
[ "public", "static", "boolean", "hasInterface", "(", "Class", "<", "?", ">", "clazz", ",", "Class", "<", "?", ">", "iface", ")", "{", "if", "(", "clazz", "==", "null", "||", "iface", "==", "null", "||", "clazz", "==", "iface", ")", "{", "return", "f...
Tells if a class (or one of its super-classes) implements an interface; or an interface is a sub-interface of a super-interface. Note: <ul> <li>Sub-interface against super-interface: this method returns {@code true}.</li> <li>Class against interface: this method returns {@code true}.</li> <li>Class against super-interface: this method returns {@code true}.</li> </ul> @param clazz @param iface @return
[ "Tells", "if", "a", "class", "(", "or", "one", "of", "its", "super", "-", "classes", ")", "implements", "an", "interface", ";", "or", "an", "interface", "is", "a", "sub", "-", "interface", "of", "a", "super", "-", "interface", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ReflectionUtils.java#L146-L151
aws/aws-sdk-java
aws-java-sdk-batch/src/main/java/com/amazonaws/services/batch/model/ComputeResource.java
ComputeResource.withTags
public ComputeResource withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public ComputeResource withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "ComputeResource", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> Key-value pair tags to be applied to resources that are launched in the compute environment. For AWS Batch, these take the form of "String1": "String2", where String1 is the tag key and String2 is the tag value—for example, { "Name": "AWS Batch Instance - C4OnDemand" }. </p> @param tags Key-value pair tags to be applied to resources that are launched in the compute environment. For AWS Batch, these take the form of "String1": "String2", where String1 is the tag key and String2 is the tag value—for example, { "Name": "AWS Batch Instance - C4OnDemand" }. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Key", "-", "value", "pair", "tags", "to", "be", "applied", "to", "resources", "that", "are", "launched", "in", "the", "compute", "environment", ".", "For", "AWS", "Batch", "these", "take", "the", "form", "of", "String1", ":", "String2", "wher...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-batch/src/main/java/com/amazonaws/services/batch/model/ComputeResource.java#L786-L789
james-hu/jabb-core
src/main/java/net/sf/jabb/cache/AbstractCachedKeyValueRepositoriesNotifier.java
AbstractCachedKeyValueRepositoriesNotifier.onChange
public void onChange(String valueScope, Object key){ notifyLocalRepositories(valueScope, key); notifyRemoteRepositories(valueScope, key); }
java
public void onChange(String valueScope, Object key){ notifyLocalRepositories(valueScope, key); notifyRemoteRepositories(valueScope, key); }
[ "public", "void", "onChange", "(", "String", "valueScope", ",", "Object", "key", ")", "{", "notifyLocalRepositories", "(", "valueScope", ",", "key", ")", ";", "notifyRemoteRepositories", "(", "valueScope", ",", "key", ")", ";", "}" ]
Notify both local and remote repositories about the value change @param valueScope value scope @param key the key
[ "Notify", "both", "local", "and", "remote", "repositories", "about", "the", "value", "change" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/cache/AbstractCachedKeyValueRepositoriesNotifier.java#L31-L34
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.findOneByField
public static <T> T findOneByField(Iterable<T> collection, final String fieldName, final Object fieldValue) { return findOne(collection, new Filter<T>() { @Override public boolean accept(T t) { if (t instanceof Map) { final Map<?, ?> map = (Map<?, ?>) t; final Object value = map.get(fieldName); return ObjectUtil.equal(value, fieldValue); } // 普通Bean final Object value = ReflectUtil.getFieldValue(t, fieldName); return ObjectUtil.equal(value, fieldValue); } }); }
java
public static <T> T findOneByField(Iterable<T> collection, final String fieldName, final Object fieldValue) { return findOne(collection, new Filter<T>() { @Override public boolean accept(T t) { if (t instanceof Map) { final Map<?, ?> map = (Map<?, ?>) t; final Object value = map.get(fieldName); return ObjectUtil.equal(value, fieldValue); } // 普通Bean final Object value = ReflectUtil.getFieldValue(t, fieldName); return ObjectUtil.equal(value, fieldValue); } }); }
[ "public", "static", "<", "T", ">", "T", "findOneByField", "(", "Iterable", "<", "T", ">", "collection", ",", "final", "String", "fieldName", ",", "final", "Object", "fieldValue", ")", "{", "return", "findOne", "(", "collection", ",", "new", "Filter", "<", ...
查找第一个匹配元素对象<br> 如果集合元素是Map,则比对键和值是否相同,相同则返回<br> 如果为普通Bean,则通过反射比对元素字段名对应的字段值是否相同,相同则返回<br> 如果给定字段值参数是{@code null} 且元素对象中的字段值也为{@code null}则认为相同 @param <T> 集合元素类型 @param collection 集合,集合元素可以是Bean或者Map @param fieldName 集合元素对象的字段名或map的键 @param fieldValue 集合元素对象的字段值或map的值 @return 满足条件的第一个元素 @since 3.1.0
[ "查找第一个匹配元素对象<br", ">", "如果集合元素是Map,则比对键和值是否相同,相同则返回<br", ">", "如果为普通Bean,则通过反射比对元素字段名对应的字段值是否相同,相同则返回<br", ">", "如果给定字段值参数是", "{", "@code", "null", "}", "且元素对象中的字段值也为", "{", "@code", "null", "}", "则认为相同" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1235-L1250
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java
br_broker.force_reboot
public static br_broker force_reboot(nitro_service client, br_broker resource) throws Exception { return ((br_broker[]) resource.perform_operation(client, "force_reboot"))[0]; }
java
public static br_broker force_reboot(nitro_service client, br_broker resource) throws Exception { return ((br_broker[]) resource.perform_operation(client, "force_reboot"))[0]; }
[ "public", "static", "br_broker", "force_reboot", "(", "nitro_service", "client", ",", "br_broker", "resource", ")", "throws", "Exception", "{", "return", "(", "(", "br_broker", "[", "]", ")", "resource", ".", "perform_operation", "(", "client", ",", "\"force_reb...
Use this operation to force reboot Unified Repeater Instance.
[ "Use", "this", "operation", "to", "force", "reboot", "Unified", "Repeater", "Instance", "." ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker.java#L411-L414
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java
BigtableClusterUtilities.setClusterSize
public void setClusterSize(String clusterId, String zoneId, int newSize) throws InterruptedException { setClusterSize(instanceName.toClusterName(clusterId).getClusterName(), newSize); }
java
public void setClusterSize(String clusterId, String zoneId, int newSize) throws InterruptedException { setClusterSize(instanceName.toClusterName(clusterId).getClusterName(), newSize); }
[ "public", "void", "setClusterSize", "(", "String", "clusterId", ",", "String", "zoneId", ",", "int", "newSize", ")", "throws", "InterruptedException", "{", "setClusterSize", "(", "instanceName", ".", "toClusterName", "(", "clusterId", ")", ".", "getClusterName", "...
Sets a cluster size to a specific size. @param clusterId @param zoneId @param newSize @throws InterruptedException if the cluster is in the middle of updating, and an interrupt was received
[ "Sets", "a", "cluster", "size", "to", "a", "specific", "size", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java#L203-L206
kiegroup/drools
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNEvaluatorCompiler.java
DMNEvaluatorCompiler.variableTypeRefOrErrIfNull
private static QName variableTypeRefOrErrIfNull(DMNModelImpl model, InformationItem variable) { if ( variable.getTypeRef() != null ) { return variable.getTypeRef(); } else { MsgUtil.reportMessage( logger, DMNMessage.Severity.ERROR, variable, model, null, null, Msg.MISSING_TYPEREF_FOR_VARIABLE, variable.getName(), variable.getParentDRDElement().getIdentifierString() ); return null; } }
java
private static QName variableTypeRefOrErrIfNull(DMNModelImpl model, InformationItem variable) { if ( variable.getTypeRef() != null ) { return variable.getTypeRef(); } else { MsgUtil.reportMessage( logger, DMNMessage.Severity.ERROR, variable, model, null, null, Msg.MISSING_TYPEREF_FOR_VARIABLE, variable.getName(), variable.getParentDRDElement().getIdentifierString() ); return null; } }
[ "private", "static", "QName", "variableTypeRefOrErrIfNull", "(", "DMNModelImpl", "model", ",", "InformationItem", "variable", ")", "{", "if", "(", "variable", ".", "getTypeRef", "(", ")", "!=", "null", ")", "{", "return", "variable", ".", "getTypeRef", "(", ")...
Utility method to have a error message is reported if a DMN Variable is missing typeRef. @param model used for reporting errors @param variable the variable to extract typeRef @return the `variable.typeRef` or null in case of errors. Errors are reported with standard notification mechanism via MsgUtil.reportMessage
[ "Utility", "method", "to", "have", "a", "error", "message", "is", "reported", "if", "a", "DMN", "Variable", "is", "missing", "typeRef", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNEvaluatorCompiler.java#L740-L755
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/TypeUtil.java
TypeUtil.isDouble
public static boolean isDouble(String _str, boolean _allowNegative) { return isDouble(_str, DecimalFormatSymbols.getInstance().getDecimalSeparator(), _allowNegative); }
java
public static boolean isDouble(String _str, boolean _allowNegative) { return isDouble(_str, DecimalFormatSymbols.getInstance().getDecimalSeparator(), _allowNegative); }
[ "public", "static", "boolean", "isDouble", "(", "String", "_str", ",", "boolean", "_allowNegative", ")", "{", "return", "isDouble", "(", "_str", ",", "DecimalFormatSymbols", ".", "getInstance", "(", ")", ".", "getDecimalSeparator", "(", ")", ",", "_allowNegative...
Checks if the given string is a valid double. The used separator is based on the used system locale @param _str string to validate @param _allowNegative set to true if negative double should be allowed @return true if given string is double, false otherwise
[ "Checks", "if", "the", "given", "string", "is", "a", "valid", "double", ".", "The", "used", "separator", "is", "based", "on", "the", "used", "system", "locale" ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/TypeUtil.java#L65-L67
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java
CPOptionCategoryPersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPOptionCategory cpOptionCategory : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpOptionCategory); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPOptionCategory cpOptionCategory : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpOptionCategory); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CPOptionCategory", "cpOptionCategory", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",", "Quer...
Removes all the cp option categories where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "cp", "option", "categories", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java#L1405-L1411
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/replicator/ReplicationInternal.java
ReplicationInternal.setHeaders
@InterfaceAudience.Public public void setHeaders(Map<String, Object> requestHeadersParam) { if (requestHeadersParam != null && !requestHeaders.equals(requestHeadersParam)) { requestHeaders = requestHeadersParam; } }
java
@InterfaceAudience.Public public void setHeaders(Map<String, Object> requestHeadersParam) { if (requestHeadersParam != null && !requestHeaders.equals(requestHeadersParam)) { requestHeaders = requestHeadersParam; } }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setHeaders", "(", "Map", "<", "String", ",", "Object", ">", "requestHeadersParam", ")", "{", "if", "(", "requestHeadersParam", "!=", "null", "&&", "!", "requestHeaders", ".", "equals", "(", "requestHe...
Set Extra HTTP headers to be sent in all requests to the remote server.
[ "Set", "Extra", "HTTP", "headers", "to", "be", "sent", "in", "all", "requests", "to", "the", "remote", "server", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/ReplicationInternal.java#L799-L804
netty/netty-tcnative
openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSL.java
SSL.setTlsExtHostName
public static void setTlsExtHostName(long ssl, String hostname) { if (hostname != null && hostname.endsWith(".")) { // Strip trailing dot if included. // See https://github.com/netty/netty-tcnative/issues/400 hostname = hostname.substring(0, hostname.length() - 1); } setTlsExtHostName0(ssl, hostname); }
java
public static void setTlsExtHostName(long ssl, String hostname) { if (hostname != null && hostname.endsWith(".")) { // Strip trailing dot if included. // See https://github.com/netty/netty-tcnative/issues/400 hostname = hostname.substring(0, hostname.length() - 1); } setTlsExtHostName0(ssl, hostname); }
[ "public", "static", "void", "setTlsExtHostName", "(", "long", "ssl", ",", "String", "hostname", ")", "{", "if", "(", "hostname", "!=", "null", "&&", "hostname", ".", "endsWith", "(", "\".\"", ")", ")", "{", "// Strip trailing dot if included.", "// See https://g...
Call SSL_set_tlsext_host_name @param ssl the SSL instance (SSL *) @param hostname the hostname
[ "Call", "SSL_set_tlsext_host_name" ]
train
https://github.com/netty/netty-tcnative/blob/4a5d7330c6c36cff2bebbb465571cab1cf7a4063/openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSL.java#L564-L571
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.appLaunched
public static void appLaunched(Context context, ShowRateDialogCondition showRateDialogCondition, Options options) { appLaunched(context, showRateDialogCondition, options, null); }
java
public static void appLaunched(Context context, ShowRateDialogCondition showRateDialogCondition, Options options) { appLaunched(context, showRateDialogCondition, options, null); }
[ "public", "static", "void", "appLaunched", "(", "Context", "context", ",", "ShowRateDialogCondition", "showRateDialogCondition", ",", "Options", "options", ")", "{", "appLaunched", "(", "context", ",", "showRateDialogCondition", ",", "options", ",", "null", ")", ";"...
Tells RMP-Appirater that the app has launched. <p/> Rating dialog is shown after calling this method. @param context Context @param showRateDialogCondition Showing rate dialog condition. @param options RMP-Appirater options.
[ "Tells", "RMP", "-", "Appirater", "that", "the", "app", "has", "launched", ".", "<p", "/", ">", "Rating", "dialog", "is", "shown", "after", "calling", "this", "method", "." ]
train
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L96-L98
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateClosedListAsync
public Observable<OperationStatus> updateClosedListAsync(UUID appId, String versionId, UUID clEntityId, ClosedListModelUpdateObject closedListModelUpdateObject) { return updateClosedListWithServiceResponseAsync(appId, versionId, clEntityId, closedListModelUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updateClosedListAsync(UUID appId, String versionId, UUID clEntityId, ClosedListModelUpdateObject closedListModelUpdateObject) { return updateClosedListWithServiceResponseAsync(appId, versionId, clEntityId, closedListModelUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updateClosedListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "ClosedListModelUpdateObject", "closedListModelUpdateObject", ")", "{", "return", "updateClosedListWithServiceResp...
Updates the closed list model. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @param closedListModelUpdateObject The new entity name and words list. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Updates", "the", "closed", "list", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4339-L4346
alkacon/opencms-core
src/org/opencms/db/CmsSelectQuery.java
CmsSelectQuery.addTable
public TableAlias addTable(String table, String aliasPrefix) { String alias = makeAlias(aliasPrefix); m_tables.add(table + " " + alias); return new TableAlias(alias); }
java
public TableAlias addTable(String table, String aliasPrefix) { String alias = makeAlias(aliasPrefix); m_tables.add(table + " " + alias); return new TableAlias(alias); }
[ "public", "TableAlias", "addTable", "(", "String", "table", ",", "String", "aliasPrefix", ")", "{", "String", "alias", "=", "makeAlias", "(", "aliasPrefix", ")", ";", "m_tables", ".", "add", "(", "table", "+", "\" \"", "+", "alias", ")", ";", "return", "...
Adds a table the query's FROM clause.<p> @param table the table to add @param aliasPrefix the prefix used to generate the alias @return an alias for the table
[ "Adds", "a", "table", "the", "query", "s", "FROM", "clause", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSelectQuery.java#L185-L191
elki-project/elki
elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/VALPNormDistance.java
VALPNormDistance.getPartialMinDist
public double getPartialMinDist(int dimension, int vp) { final int qp = queryApprox.getApproximation(dimension); if(vp < qp) { return lookup[dimension][vp + 1]; } else if(vp > qp) { return lookup[dimension][vp]; } else { return 0.0; } }
java
public double getPartialMinDist(int dimension, int vp) { final int qp = queryApprox.getApproximation(dimension); if(vp < qp) { return lookup[dimension][vp + 1]; } else if(vp > qp) { return lookup[dimension][vp]; } else { return 0.0; } }
[ "public", "double", "getPartialMinDist", "(", "int", "dimension", ",", "int", "vp", ")", "{", "final", "int", "qp", "=", "queryApprox", ".", "getApproximation", "(", "dimension", ")", ";", "if", "(", "vp", "<", "qp", ")", "{", "return", "lookup", "[", ...
Get the minimum distance contribution of a single dimension. @param dimension Dimension @param vp Vector position @return Increment
[ "Get", "the", "minimum", "distance", "contribution", "of", "a", "single", "dimension", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/VALPNormDistance.java#L70-L81
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java
AlignedBox3f.setFromCenter
@Override public void setFromCenter(double centerX, double centerY, double centerZ, double cornerX, double cornerY, double cornerZ) { double dx = centerX - cornerX; double dy = centerY - cornerY; double dz = centerZ - cornerZ; setFromCorners(cornerX, cornerY, cornerZ, centerX + dx, centerY + dy, centerZ + dz); }
java
@Override public void setFromCenter(double centerX, double centerY, double centerZ, double cornerX, double cornerY, double cornerZ) { double dx = centerX - cornerX; double dy = centerY - cornerY; double dz = centerZ - cornerZ; setFromCorners(cornerX, cornerY, cornerZ, centerX + dx, centerY + dy, centerZ + dz); }
[ "@", "Override", "public", "void", "setFromCenter", "(", "double", "centerX", ",", "double", "centerY", ",", "double", "centerZ", ",", "double", "cornerX", ",", "double", "cornerY", ",", "double", "cornerZ", ")", "{", "double", "dx", "=", "centerX", "-", "...
Sets the framing box of this <code>Shape</code> based on the specified center point coordinates and corner point coordinates. The framing box is used by the subclasses of <code>BoxedShape</code> to define their geometry. @param centerX the X coordinate of the specified center point @param centerY the Y coordinate of the specified center point @param centerZ the Z coordinate of the specified center point @param cornerX the X coordinate of the specified corner point @param cornerY the Y coordinate of the specified corner point @param cornerZ the Z coordinate of the specified corner point
[ "Sets", "the", "framing", "box", "of", "this", "<code", ">", "Shape<", "/", "code", ">", "based", "on", "the", "specified", "center", "point", "coordinates", "and", "corner", "point", "coordinates", ".", "The", "framing", "box", "is", "used", "by", "the", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java#L341-L347
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java
TimeZone.getDisplayName
public String getDisplayName(boolean daylight, int style, Locale locale) { return getDisplayName(daylight, style, ULocale.forLocale(locale)); }
java
public String getDisplayName(boolean daylight, int style, Locale locale) { return getDisplayName(daylight, style, ULocale.forLocale(locale)); }
[ "public", "String", "getDisplayName", "(", "boolean", "daylight", ",", "int", "style", ",", "Locale", "locale", ")", "{", "return", "getDisplayName", "(", "daylight", ",", "style", ",", "ULocale", ".", "forLocale", "(", "locale", ")", ")", ";", "}" ]
Returns a name of this time zone suitable for presentation to the user in the specified locale. If the display name is not available for the locale, then this method returns a string in the localized GMT offset format such as <code>GMT[+-]HH:mm</code>. @param daylight if true, return the daylight savings name. @param style the output style of the display name. Valid styles are <code>SHORT</code>, <code>LONG</code>, <code>SHORT_GENERIC</code>, <code>LONG_GENERIC</code>, <code>SHORT_GMT</code>, <code>LONG_GMT</code>, <code>SHORT_COMMONLY_USED</code> or <code>GENERIC_LOCATION</code>. @param locale the locale in which to supply the display name. @return the human-readable name of this time zone in the given locale or in the default locale if the given locale is not recognized. @exception IllegalArgumentException style is invalid.
[ "Returns", "a", "name", "of", "this", "time", "zone", "suitable", "for", "presentation", "to", "the", "user", "in", "the", "specified", "locale", ".", "If", "the", "display", "name", "is", "not", "available", "for", "the", "locale", "then", "this", "method...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L440-L442
iipc/webarchive-commons
src/main/java/org/archive/io/WriterPoolMember.java
WriterPoolMember.createFile
protected String createFile() throws IOException { generateNewBasename(); String name = currentBasename + '.' + this.extension + ((settings.getCompress())? DOT_COMPRESSED_FILE_EXTENSION: "") + OCCUPIED_SUFFIX; File dir = getNextDirectory(settings.calcOutputDirs()); return createFile(new File(dir, name)); }
java
protected String createFile() throws IOException { generateNewBasename(); String name = currentBasename + '.' + this.extension + ((settings.getCompress())? DOT_COMPRESSED_FILE_EXTENSION: "") + OCCUPIED_SUFFIX; File dir = getNextDirectory(settings.calcOutputDirs()); return createFile(new File(dir, name)); }
[ "protected", "String", "createFile", "(", ")", "throws", "IOException", "{", "generateNewBasename", "(", ")", ";", "String", "name", "=", "currentBasename", "+", "'", "'", "+", "this", ".", "extension", "+", "(", "(", "settings", ".", "getCompress", "(", "...
Create a new file. Rotates off the current Writer and creates a new in its place to take subsequent writes. Usually called from {@link #checkSize()}. @return Name of file created. @throws IOException
[ "Create", "a", "new", "file", ".", "Rotates", "off", "the", "current", "Writer", "and", "creates", "a", "new", "in", "its", "place", "to", "take", "subsequent", "writes", ".", "Usually", "called", "from", "{" ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/WriterPoolMember.java#L198-L205
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLStatementCache.java
CQLStatementCache.getPreparedUpdate
public PreparedStatement getPreparedUpdate(String tableName, Update update) { synchronized (m_prepUpdateMap) { Map<Update, PreparedStatement> statementMap = m_prepUpdateMap.get(tableName); if (statementMap == null) { statementMap = new HashMap<>(); m_prepUpdateMap.put(tableName, statementMap); } PreparedStatement prepState = statementMap.get(update); if (prepState == null) { prepState = prepareUpdate(tableName, update); statementMap.put(update, prepState); } return prepState; } }
java
public PreparedStatement getPreparedUpdate(String tableName, Update update) { synchronized (m_prepUpdateMap) { Map<Update, PreparedStatement> statementMap = m_prepUpdateMap.get(tableName); if (statementMap == null) { statementMap = new HashMap<>(); m_prepUpdateMap.put(tableName, statementMap); } PreparedStatement prepState = statementMap.get(update); if (prepState == null) { prepState = prepareUpdate(tableName, update); statementMap.put(update, prepState); } return prepState; } }
[ "public", "PreparedStatement", "getPreparedUpdate", "(", "String", "tableName", ",", "Update", "update", ")", "{", "synchronized", "(", "m_prepUpdateMap", ")", "{", "Map", "<", "Update", ",", "PreparedStatement", ">", "statementMap", "=", "m_prepUpdateMap", ".", "...
Get the given prepared statement for the given table and update. Upon first invocation for a given combo, the query is parsed and cached. @param tableName Name of table to customize update for. @param update Inquiry {@link Update}. @return PreparedStatement for given combo.
[ "Get", "the", "given", "prepared", "statement", "for", "the", "given", "table", "and", "update", ".", "Upon", "first", "invocation", "for", "a", "given", "combo", "the", "query", "is", "parsed", "and", "cached", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLStatementCache.java#L115-L129
guardtime/ksi-java-sdk
ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java
ContextAwarePolicyAdapter.createKeyPolicy
public static ContextAwarePolicy createKeyPolicy(PublicationsHandler handler) { Util.notNull(handler, "Publications handler"); return new ContextAwarePolicyAdapter(new KeyBasedVerificationPolicy(), new PolicyContext(handler, null)); }
java
public static ContextAwarePolicy createKeyPolicy(PublicationsHandler handler) { Util.notNull(handler, "Publications handler"); return new ContextAwarePolicyAdapter(new KeyBasedVerificationPolicy(), new PolicyContext(handler, null)); }
[ "public", "static", "ContextAwarePolicy", "createKeyPolicy", "(", "PublicationsHandler", "handler", ")", "{", "Util", ".", "notNull", "(", "handler", ",", "\"Publications handler\"", ")", ";", "return", "new", "ContextAwarePolicyAdapter", "(", "new", "KeyBasedVerificati...
Creates context aware policy using {@link KeyBasedVerificationPolicy} for verification. @param handler Publications handler. @return Key based verification policy with suitable context.
[ "Creates", "context", "aware", "policy", "using", "{", "@link", "KeyBasedVerificationPolicy", "}", "for", "verification", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L60-L63
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.mailingList_subscribe_POST
public void mailingList_subscribe_POST(String email, String mailingList) throws IOException { String qPath = "/me/mailingList/subscribe"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "email", email); addBody(o, "mailingList", mailingList); exec(qPath, "POST", sb.toString(), o); }
java
public void mailingList_subscribe_POST(String email, String mailingList) throws IOException { String qPath = "/me/mailingList/subscribe"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "email", email); addBody(o, "mailingList", mailingList); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "mailingList_subscribe_POST", "(", "String", "email", ",", "String", "mailingList", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/mailingList/subscribe\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "Hash...
Subscribe an email to a restricted mailing list REST: POST /me/mailingList/subscribe @param email [required] Email you want to subscribe to @param mailingList [required] Mailing list
[ "Subscribe", "an", "email", "to", "a", "restricted", "mailing", "list" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L142-L149
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java
FactoryFiducialCalibration.squareGrid
public static CalibrationDetectorSquareGrid squareGrid(@Nullable ConfigSquareGrid config, ConfigGridDimen configDimen) { if( config == null ) config = new ConfigSquareGrid(); config.checkValidity(); return new CalibrationDetectorSquareGrid(config,configDimen); }
java
public static CalibrationDetectorSquareGrid squareGrid(@Nullable ConfigSquareGrid config, ConfigGridDimen configDimen) { if( config == null ) config = new ConfigSquareGrid(); config.checkValidity(); return new CalibrationDetectorSquareGrid(config,configDimen); }
[ "public", "static", "CalibrationDetectorSquareGrid", "squareGrid", "(", "@", "Nullable", "ConfigSquareGrid", "config", ",", "ConfigGridDimen", "configDimen", ")", "{", "if", "(", "config", "==", "null", ")", "config", "=", "new", "ConfigSquareGrid", "(", ")", ";",...
Detector for a grid of square targets. All squares must be entirely visible inside the image. @see boofcv.alg.fiducial.calib.grid.DetectSquareGridFiducial @param config Configuration for chessboard detector @return Square grid target detector.
[ "Detector", "for", "a", "grid", "of", "square", "targets", ".", "All", "squares", "must", "be", "entirely", "visible", "inside", "the", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java#L42-L48
groovy/groovy-core
src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
StaticTypeCheckingSupport.excessArgumentsMatchesVargsParameter
static int excessArgumentsMatchesVargsParameter(Parameter[] params, ClassNode[] args) { // we already know parameter length is bigger zero and last is a vargs // the excess arguments are all put in an array for the vargs call // so check against the component type int dist = 0; ClassNode vargsBase = params[params.length - 1].getType().getComponentType(); for (int i = params.length; i < args.length; i++) { if (!isAssignableTo(args[i],vargsBase)) return -1; else if (!args[i].equals(vargsBase)) dist+=getDistance(args[i], vargsBase); } return dist; }
java
static int excessArgumentsMatchesVargsParameter(Parameter[] params, ClassNode[] args) { // we already know parameter length is bigger zero and last is a vargs // the excess arguments are all put in an array for the vargs call // so check against the component type int dist = 0; ClassNode vargsBase = params[params.length - 1].getType().getComponentType(); for (int i = params.length; i < args.length; i++) { if (!isAssignableTo(args[i],vargsBase)) return -1; else if (!args[i].equals(vargsBase)) dist+=getDistance(args[i], vargsBase); } return dist; }
[ "static", "int", "excessArgumentsMatchesVargsParameter", "(", "Parameter", "[", "]", "params", ",", "ClassNode", "[", "]", "args", ")", "{", "// we already know parameter length is bigger zero and last is a vargs", "// the excess arguments are all put in an array for the vargs call",...
Checks that excess arguments match the vararg signature parameter. @param params @param args @return -1 if no match, 0 if all arguments matches the vararg type and >0 if one or more vararg argument is assignable to the vararg type, but still not an exact match
[ "Checks", "that", "excess", "arguments", "match", "the", "vararg", "signature", "parameter", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L276-L287
google/closure-templates
java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java
SoyNodeCompiler.calculateRangeArgs
private CompiledForeachRangeArgs calculateRangeArgs(ForNode forNode, Scope scope) { RangeArgs rangeArgs = RangeArgs.createFromNode(forNode).get(); ForNonemptyNode nonEmptyNode = (ForNonemptyNode) forNode.getChild(0); ImmutableList.Builder<Statement> initStatements = ImmutableList.builder(); Expression startExpression = computeRangeValue( SyntheticVarName.foreachLoopRangeStart(nonEmptyNode), rangeArgs.start(), 0, scope, initStatements); Expression stepExpression = computeRangeValue( SyntheticVarName.foreachLoopRangeStep(nonEmptyNode), rangeArgs.increment(), 1, scope, initStatements); Expression endExpression = computeRangeValue( SyntheticVarName.foreachLoopRangeEnd(nonEmptyNode), Optional.of(rangeArgs.limit()), Integer.MAX_VALUE, scope, initStatements); return new AutoValue_SoyNodeCompiler_CompiledForeachRangeArgs( startExpression, endExpression, stepExpression, initStatements.build()); }
java
private CompiledForeachRangeArgs calculateRangeArgs(ForNode forNode, Scope scope) { RangeArgs rangeArgs = RangeArgs.createFromNode(forNode).get(); ForNonemptyNode nonEmptyNode = (ForNonemptyNode) forNode.getChild(0); ImmutableList.Builder<Statement> initStatements = ImmutableList.builder(); Expression startExpression = computeRangeValue( SyntheticVarName.foreachLoopRangeStart(nonEmptyNode), rangeArgs.start(), 0, scope, initStatements); Expression stepExpression = computeRangeValue( SyntheticVarName.foreachLoopRangeStep(nonEmptyNode), rangeArgs.increment(), 1, scope, initStatements); Expression endExpression = computeRangeValue( SyntheticVarName.foreachLoopRangeEnd(nonEmptyNode), Optional.of(rangeArgs.limit()), Integer.MAX_VALUE, scope, initStatements); return new AutoValue_SoyNodeCompiler_CompiledForeachRangeArgs( startExpression, endExpression, stepExpression, initStatements.build()); }
[ "private", "CompiledForeachRangeArgs", "calculateRangeArgs", "(", "ForNode", "forNode", ",", "Scope", "scope", ")", "{", "RangeArgs", "rangeArgs", "=", "RangeArgs", ".", "createFromNode", "(", "forNode", ")", ".", "get", "(", ")", ";", "ForNonemptyNode", "nonEmpty...
Interprets the given expressions as the arguments of a {@code range(...)} expression in a {@code foreach} loop.
[ "Interprets", "the", "given", "expressions", "as", "the", "arguments", "of", "a", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java#L458-L486
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneWord.java
SaneWord.fromBytes
public static SaneWord fromBytes(byte[] byteValue, int offset) { Preconditions.checkArgument(offset >= 0, "offset must be positive or zero"); Preconditions.checkArgument(offset + SIZE_IN_BYTES <= byteValue.length); return new SaneWord(Arrays.copyOfRange(byteValue, offset, offset + SIZE_IN_BYTES)); }
java
public static SaneWord fromBytes(byte[] byteValue, int offset) { Preconditions.checkArgument(offset >= 0, "offset must be positive or zero"); Preconditions.checkArgument(offset + SIZE_IN_BYTES <= byteValue.length); return new SaneWord(Arrays.copyOfRange(byteValue, offset, offset + SIZE_IN_BYTES)); }
[ "public", "static", "SaneWord", "fromBytes", "(", "byte", "[", "]", "byteValue", ",", "int", "offset", ")", "{", "Preconditions", ".", "checkArgument", "(", "offset", ">=", "0", ",", "\"offset must be positive or zero\"", ")", ";", "Preconditions", ".", "checkAr...
Creates a new {@link SaneWord} from a copy of the given bytes within the array. {@code offset + SIZE_IN_BYTES} must be a valid index (i.e. there must be enough bytes in the array at the given offset), otherwise a runtime exception is thrown.
[ "Creates", "a", "new", "{" ]
train
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneWord.java#L148-L152
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.beginCreateOrUpdateById
public GenericResourceInner beginCreateOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body(); }
java
public GenericResourceInner beginCreateOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body(); }
[ "public", "GenericResourceInner", "beginCreateOrUpdateById", "(", "String", "resourceId", ",", "String", "apiVersion", ",", "GenericResourceInner", "parameters", ")", "{", "return", "beginCreateOrUpdateByIdWithServiceResponseAsync", "(", "resourceId", ",", "apiVersion", ",", ...
Create a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @param parameters Create or update resource parameters. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the GenericResourceInner object if successful.
[ "Create", "a", "resource", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L2141-L2143
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/component/JideOverlayService.java
JideOverlayService.setVisible
protected final Boolean setVisible(JComponent targetComponent, JComponent overlay, Boolean show) { Assert.notNull(targetComponent, JideOverlayService.TARGET_COMPONENT_PARAM); Assert.notNull(overlay, JideOverlayService.OVERLAY); Assert.notNull(show, "show"); // If overlay is installed... if (this.isOverlayInstalled(targetComponent, overlay)) { // Definitely show or hide overlay overlay.setVisible(show); overlay.repaint(); return Boolean.TRUE; } return Boolean.FALSE; }
java
protected final Boolean setVisible(JComponent targetComponent, JComponent overlay, Boolean show) { Assert.notNull(targetComponent, JideOverlayService.TARGET_COMPONENT_PARAM); Assert.notNull(overlay, JideOverlayService.OVERLAY); Assert.notNull(show, "show"); // If overlay is installed... if (this.isOverlayInstalled(targetComponent, overlay)) { // Definitely show or hide overlay overlay.setVisible(show); overlay.repaint(); return Boolean.TRUE; } return Boolean.FALSE; }
[ "protected", "final", "Boolean", "setVisible", "(", "JComponent", "targetComponent", ",", "JComponent", "overlay", ",", "Boolean", "show", ")", "{", "Assert", ".", "notNull", "(", "targetComponent", ",", "JideOverlayService", ".", "TARGET_COMPONENT_PARAM", ")", ";",...
Show or hide the given overlay depending on the given <code>show</code> parameter. @param targetComponent the target component. @param overlay the overlay component. @param show whether to show or hide the given overlay (<code>true</code> for showing). @return <code>true</code> if success and <code>false</code> in other case.
[ "Show", "or", "hide", "the", "given", "overlay", "depending", "on", "the", "given", "<code", ">", "show<", "/", "code", ">", "parameter", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/component/JideOverlayService.java#L252-L269
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.tileGridZoomIncrease
public static TileGrid tileGridZoomIncrease(TileGrid tileGrid, int zoomLevels) { long minX = tileGridMinZoomIncrease(tileGrid.getMinX(), zoomLevels); long maxX = tileGridMaxZoomIncrease(tileGrid.getMaxX(), zoomLevels); long minY = tileGridMinZoomIncrease(tileGrid.getMinY(), zoomLevels); long maxY = tileGridMaxZoomIncrease(tileGrid.getMaxY(), zoomLevels); TileGrid newTileGrid = new TileGrid(minX, minY, maxX, maxY); return newTileGrid; }
java
public static TileGrid tileGridZoomIncrease(TileGrid tileGrid, int zoomLevels) { long minX = tileGridMinZoomIncrease(tileGrid.getMinX(), zoomLevels); long maxX = tileGridMaxZoomIncrease(tileGrid.getMaxX(), zoomLevels); long minY = tileGridMinZoomIncrease(tileGrid.getMinY(), zoomLevels); long maxY = tileGridMaxZoomIncrease(tileGrid.getMaxY(), zoomLevels); TileGrid newTileGrid = new TileGrid(minX, minY, maxX, maxY); return newTileGrid; }
[ "public", "static", "TileGrid", "tileGridZoomIncrease", "(", "TileGrid", "tileGrid", ",", "int", "zoomLevels", ")", "{", "long", "minX", "=", "tileGridMinZoomIncrease", "(", "tileGrid", ".", "getMinX", "(", ")", ",", "zoomLevels", ")", ";", "long", "maxX", "="...
Get the tile grid starting from the tile grid and zooming in / increasing the number of levels @param tileGrid current tile grid @param zoomLevels number of zoom levels to increase by @return tile grid at new zoom level @since 2.0.1
[ "Get", "the", "tile", "grid", "starting", "from", "the", "tile", "grid", "and", "zooming", "in", "/", "increasing", "the", "number", "of", "levels" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L1295-L1303
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java
EkstaziCFT.createCoverageClassVisitor
private CoverageClassVisitor createCoverageClassVisitor(String className, ClassWriter cv, boolean isRedefined) { // We cannot change classfiles if class is being redefined. return new CoverageClassVisitor(className, cv); }
java
private CoverageClassVisitor createCoverageClassVisitor(String className, ClassWriter cv, boolean isRedefined) { // We cannot change classfiles if class is being redefined. return new CoverageClassVisitor(className, cv); }
[ "private", "CoverageClassVisitor", "createCoverageClassVisitor", "(", "String", "className", ",", "ClassWriter", "cv", ",", "boolean", "isRedefined", ")", "{", "// We cannot change classfiles if class is being redefined.", "return", "new", "CoverageClassVisitor", "(", "classNam...
Creates class visitor to instrument for coverage based on configuration options.
[ "Creates", "class", "visitor", "to", "instrument", "for", "coverage", "based", "on", "configuration", "options", "." ]
train
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java#L219-L222
nguillaumin/slick2d-maven
slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/FontFileReader.java
FontFileReader.writeTTFUShort
public final void writeTTFUShort(int pos, int val) throws IOException { if ((pos + 2) > fsize) { throw new java.io.EOFException("Reached EOF"); } final byte b1 = (byte)((val >> 8) & 0xff); final byte b2 = (byte)(val & 0xff); file[pos] = b1; file[pos + 1] = b2; }
java
public final void writeTTFUShort(int pos, int val) throws IOException { if ((pos + 2) > fsize) { throw new java.io.EOFException("Reached EOF"); } final byte b1 = (byte)((val >> 8) & 0xff); final byte b2 = (byte)(val & 0xff); file[pos] = b1; file[pos + 1] = b2; }
[ "public", "final", "void", "writeTTFUShort", "(", "int", "pos", ",", "int", "val", ")", "throws", "IOException", "{", "if", "(", "(", "pos", "+", "2", ")", ">", "fsize", ")", "{", "throw", "new", "java", ".", "io", ".", "EOFException", "(", "\"Reache...
Write a USHort at a given position. @param pos The absolute position to write to @param val The value to write @throws IOException If EOF is reached
[ "Write", "a", "USHort", "at", "a", "given", "position", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/FontFileReader.java#L226-L234
bushidowallet/bushido-java-service
bushido-service-lib/src/main/java/com/bccapi/bitlib/util/HexUtils.java
HexUtils.toHex
public static String toHex(byte[] bytes, int offset, int length, String separator) { StringBuffer result = new StringBuffer(); for (int i = 0; i < length; i++) { int unsignedByte = bytes[i + offset] & 0xff; if (unsignedByte < 16) { result.append("0"); } result.append(Integer.toHexString(unsignedByte)); if (separator != null && i + 1 < length) { result.append(separator); } } return result.toString(); }
java
public static String toHex(byte[] bytes, int offset, int length, String separator) { StringBuffer result = new StringBuffer(); for (int i = 0; i < length; i++) { int unsignedByte = bytes[i + offset] & 0xff; if (unsignedByte < 16) { result.append("0"); } result.append(Integer.toHexString(unsignedByte)); if (separator != null && i + 1 < length) { result.append(separator); } } return result.toString(); }
[ "public", "static", "String", "toHex", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ",", "String", "separator", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", ...
Encodes an array of bytes as hex symbols. @param bytes the array of bytes to encode @param offset the start offset in the array of bytes @param length the number of bytes to encode @param separator the separator to use between two bytes, can be null @return the resulting hex string
[ "Encodes", "an", "array", "of", "bytes", "as", "hex", "symbols", "." ]
train
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-service-lib/src/main/java/com/bccapi/bitlib/util/HexUtils.java#L88-L103
apache/incubator-gobblin
gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/purger/HivePurgerSource.java
HivePurgerSource.getWatermarkFromPreviousWorkUnits
protected static String getWatermarkFromPreviousWorkUnits(SourceState state, String watermark) { if (state.getPreviousWorkUnitStates().isEmpty()) { return ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK; } return state.getPreviousWorkUnitStates().get(0) .getProp(watermark, ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK); }
java
protected static String getWatermarkFromPreviousWorkUnits(SourceState state, String watermark) { if (state.getPreviousWorkUnitStates().isEmpty()) { return ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK; } return state.getPreviousWorkUnitStates().get(0) .getProp(watermark, ComplianceConfigurationKeys.NO_PREVIOUS_WATERMARK); }
[ "protected", "static", "String", "getWatermarkFromPreviousWorkUnits", "(", "SourceState", "state", ",", "String", "watermark", ")", "{", "if", "(", "state", ".", "getPreviousWorkUnitStates", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "ComplianceConfig...
Fetches the value of a watermark given its key from the previous run.
[ "Fetches", "the", "value", "of", "a", "watermark", "given", "its", "key", "from", "the", "previous", "run", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/purger/HivePurgerSource.java#L335-L341
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/StreamSet.java
StreamSet.createPersistentSubset
private ReliabilitySubset createPersistentSubset(Reliability reliability, TransactionCommon tran) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createPersistentSubset", new Object[] { reliability }); ReliabilitySubset subset = new ReliabilitySubset(reliability, initialData); subsets[getIndex(reliability)] = subset; if(reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0) { try { Transaction msTran = txManager.resolveAndEnlistMsgStoreTransaction(tran); itemStream.addItem(subset, msTran); subsetIDs[getIndex(reliability)] = subset.getID(); } catch (MessageStoreException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.gd.StreamSet.createPersistentSubset", "1:398:1.67", this); //not sure if this default is needed but better safe than sorry subsetIDs[getIndex(reliability)] = NO_ID; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exception(tc, e); SibTr.exit(tc, "createPersistentSubset", e); } } } else { subsetIDs[getIndex(reliability)] = NO_ID; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createPersistentSubset", subset); return subset; }
java
private ReliabilitySubset createPersistentSubset(Reliability reliability, TransactionCommon tran) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createPersistentSubset", new Object[] { reliability }); ReliabilitySubset subset = new ReliabilitySubset(reliability, initialData); subsets[getIndex(reliability)] = subset; if(reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0) { try { Transaction msTran = txManager.resolveAndEnlistMsgStoreTransaction(tran); itemStream.addItem(subset, msTran); subsetIDs[getIndex(reliability)] = subset.getID(); } catch (MessageStoreException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.gd.StreamSet.createPersistentSubset", "1:398:1.67", this); //not sure if this default is needed but better safe than sorry subsetIDs[getIndex(reliability)] = NO_ID; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exception(tc, e); SibTr.exit(tc, "createPersistentSubset", e); } } } else { subsetIDs[getIndex(reliability)] = NO_ID; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createPersistentSubset", subset); return subset; }
[ "private", "ReliabilitySubset", "createPersistentSubset", "(", "Reliability", "reliability", ",", "TransactionCommon", "tran", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled"...
Create a new ReliabilitySubset for the given reliability. If it is not express, store it in the message store and record the message store ID. @param reliability @throws SIResourceException @throws SIStoreException
[ "Create", "a", "new", "ReliabilitySubset", "for", "the", "given", "reliability", ".", "If", "it", "is", "not", "express", "store", "it", "in", "the", "message", "store", "and", "record", "the", "message", "store", "ID", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/StreamSet.java#L373-L415
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java
Math.multiplyExact
public static int multiplyExact(int x, int y) { long r = (long)x * (long)y; if ((int)r != r) { throw new ArithmeticException("integer overflow"); } return (int)r; }
java
public static int multiplyExact(int x, int y) { long r = (long)x * (long)y; if ((int)r != r) { throw new ArithmeticException("integer overflow"); } return (int)r; }
[ "public", "static", "int", "multiplyExact", "(", "int", "x", ",", "int", "y", ")", "{", "long", "r", "=", "(", "long", ")", "x", "*", "(", "long", ")", "y", ";", "if", "(", "(", "int", ")", "r", "!=", "r", ")", "{", "throw", "new", "Arithmeti...
Returns the product of the arguments, throwing an exception if the result overflows an {@code int}. @param x the first value @param y the second value @return the result @throws ArithmeticException if the result overflows an int @since 1.8
[ "Returns", "the", "product", "of", "the", "arguments", "throwing", "an", "exception", "if", "the", "result", "overflows", "an", "{", "@code", "int", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L869-L875
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.dropWhile
public static String dropWhile(GString self, @ClosureParams(value=SimpleType.class, options="char") Closure condition) { return dropWhile(self.toString(), condition).toString(); }
java
public static String dropWhile(GString self, @ClosureParams(value=SimpleType.class, options="char") Closure condition) { return dropWhile(self.toString(), condition).toString(); }
[ "public", "static", "String", "dropWhile", "(", "GString", "self", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"char\"", ")", "Closure", "condition", ")", "{", "return", "dropWhile", "(", "self", ".", "t...
A GString variant of the equivalent CharSequence method. @param self the original GString @param condition the closure that while continuously evaluating to true will cause us to drop elements from the front of the original GString @return the shortest suffix of the given GString such that the given closure condition evaluates to true for each element dropped from the front of the CharSequence @see #dropWhile(CharSequence, groovy.lang.Closure) @since 2.3.7
[ "A", "GString", "variant", "of", "the", "equivalent", "CharSequence", "method", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L578-L580
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java
ColumnNameHelper.minComponents
public static List<ByteBuffer> minComponents(List<ByteBuffer> minSeen, Composite candidate, CellNameType comparator) { // For a cell name, no reason to look more than the clustering prefix // (and comparing the collection element would actually crash) int size = Math.min(candidate.size(), comparator.clusteringPrefixSize()); if (minSeen.isEmpty()) return getComponents(candidate, size); // In most case maxSeen is big enough to hold the result so update it in place in those cases minSeen = maybeGrow(minSeen, size); for (int i = 0; i < size; i++) minSeen.set(i, min(minSeen.get(i), candidate.get(i), comparator.subtype(i))); return minSeen; }
java
public static List<ByteBuffer> minComponents(List<ByteBuffer> minSeen, Composite candidate, CellNameType comparator) { // For a cell name, no reason to look more than the clustering prefix // (and comparing the collection element would actually crash) int size = Math.min(candidate.size(), comparator.clusteringPrefixSize()); if (minSeen.isEmpty()) return getComponents(candidate, size); // In most case maxSeen is big enough to hold the result so update it in place in those cases minSeen = maybeGrow(minSeen, size); for (int i = 0; i < size; i++) minSeen.set(i, min(minSeen.get(i), candidate.get(i), comparator.subtype(i))); return minSeen; }
[ "public", "static", "List", "<", "ByteBuffer", ">", "minComponents", "(", "List", "<", "ByteBuffer", ">", "minSeen", ",", "Composite", "candidate", ",", "CellNameType", "comparator", ")", "{", "// For a cell name, no reason to look more than the clustering prefix", "// (a...
finds the min cell name component(s) Note that this method *can modify maxSeen*. @param minSeen the max columns seen so far @param candidate the candidate column(s) @param comparator the comparator to use @return a list with the min column(s)
[ "finds", "the", "min", "cell", "name", "component", "(", "s", ")" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java#L91-L107
arquillian/arquillian-extension-warp
impl/src/main/java/org/jboss/arquillian/warp/impl/server/execution/WarpFilter.java
WarpFilter.doFilter
@Override public void doFilter(ServletRequest req, ServletResponse resp, final FilterChain chain) throws IOException, ServletException { if (manager == null || isHttpRequest(req, resp)) { doFilterHttp((HttpServletRequest) req, (HttpServletResponse) resp, chain); } else { chain.doFilter(req, resp); } }
java
@Override public void doFilter(ServletRequest req, ServletResponse resp, final FilterChain chain) throws IOException, ServletException { if (manager == null || isHttpRequest(req, resp)) { doFilterHttp((HttpServletRequest) req, (HttpServletResponse) resp, chain); } else { chain.doFilter(req, resp); } }
[ "@", "Override", "public", "void", "doFilter", "(", "ServletRequest", "req", ",", "ServletResponse", "resp", ",", "final", "FilterChain", "chain", ")", "throws", "IOException", ",", "ServletException", "{", "if", "(", "manager", "==", "null", "||", "isHttpReques...
Detects whenever the request is HTTP request and if yes, delegates to {@link #doFilterHttp(HttpServletRequest, HttpServletResponse, FilterChain)}.
[ "Detects", "whenever", "the", "request", "is", "HTTP", "request", "and", "if", "yes", "delegates", "to", "{" ]
train
https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/server/execution/WarpFilter.java#L89-L98
tanhaichao/leopard-lang
leopard-util/src/main/java/io/leopard/util/EncryptUtil.java
EncryptUtil.encode
private static String encode(String str, String type) { try { MessageDigest alga = MessageDigest.getInstance(type); alga.update(str.getBytes()); byte digesta[] = alga.digest(); String hex = byte2hex(digesta); // String hex2 = byte2hex2(digesta); // if (!hex.equals(hex2)) { // System.out.println("str:" + str); // } return hex; } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
java
private static String encode(String str, String type) { try { MessageDigest alga = MessageDigest.getInstance(type); alga.update(str.getBytes()); byte digesta[] = alga.digest(); String hex = byte2hex(digesta); // String hex2 = byte2hex2(digesta); // if (!hex.equals(hex2)) { // System.out.println("str:" + str); // } return hex; } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
[ "private", "static", "String", "encode", "(", "String", "str", ",", "String", "type", ")", "{", "try", "{", "MessageDigest", "alga", "=", "MessageDigest", ".", "getInstance", "(", "type", ")", ";", "alga", ".", "update", "(", "str", ".", "getBytes", "(",...
按类型对字符串进行加密并转换成16进制输出</br> @param str 字符串 @param type 可加密类型md5, des , sha1 @return 加密后的字符串
[ "按类型对字符串进行加密并转换成16进制输出<", "/", "br", ">" ]
train
https://github.com/tanhaichao/leopard-lang/blob/8ab110f6ca4ea84484817a3d752253ac69ea268b/leopard-util/src/main/java/io/leopard/util/EncryptUtil.java#L41-L56
bbottema/simple-java-mail
modules/cli-module/src/main/java/org/simplejavamail/internal/clisupport/CliCommandLineConsumer.java
CliCommandLineConsumer.consumeCommandLineInput
static CliReceivedCommand consumeCommandLineInput(ParseResult providedCommand, @SuppressWarnings("SameParameterValue") Iterable<CliDeclaredOptionSpec> declaredOptions) { assumeTrue(providedCommand.hasSubcommand(), "Command was empty, expected one of: " + Arrays.toString(CliCommandType.values())); final ParseResult mailCommand = providedCommand.subcommand(); final CliCommandType matchedCommand = CliCommandType.valueOf(mailCommand.commandSpec().name()); final Map<CliDeclaredOptionSpec, OptionSpec> matchedOptionsInOrderProvision = matchProvidedOptions(declaredOptions, mailCommand.matchedOptions()); logParsedInput(matchedCommand, matchedOptionsInOrderProvision); List<CliReceivedOptionData> receivedOptions = new ArrayList<>(); for (Entry<CliDeclaredOptionSpec, OptionSpec> cliOption : matchedOptionsInOrderProvision.entrySet()) { final Method sourceMethod = cliOption.getKey().getSourceMethod(); final int mandatoryParameters = MiscUtil.countMandatoryParameters(sourceMethod); final List<String> providedStringValues = cliOption.getValue().getValue(); assumeTrue(providedStringValues.size() >= mandatoryParameters, format("provided %s arguments, but need at least %s", providedStringValues.size(), mandatoryParameters)); assumeTrue(providedStringValues.size() <= sourceMethod.getParameterTypes().length, format("provided %s arguments, but need at most %s", providedStringValues.size(), sourceMethod.getParameterTypes().length)); receivedOptions.add(new CliReceivedOptionData(cliOption.getKey(), convertProvidedOptionValues(providedStringValues, sourceMethod))); LOGGER.debug("\tconverted option values: {}", getLast(receivedOptions).getProvidedOptionValues()); } return new CliReceivedCommand(matchedCommand, receivedOptions); }
java
static CliReceivedCommand consumeCommandLineInput(ParseResult providedCommand, @SuppressWarnings("SameParameterValue") Iterable<CliDeclaredOptionSpec> declaredOptions) { assumeTrue(providedCommand.hasSubcommand(), "Command was empty, expected one of: " + Arrays.toString(CliCommandType.values())); final ParseResult mailCommand = providedCommand.subcommand(); final CliCommandType matchedCommand = CliCommandType.valueOf(mailCommand.commandSpec().name()); final Map<CliDeclaredOptionSpec, OptionSpec> matchedOptionsInOrderProvision = matchProvidedOptions(declaredOptions, mailCommand.matchedOptions()); logParsedInput(matchedCommand, matchedOptionsInOrderProvision); List<CliReceivedOptionData> receivedOptions = new ArrayList<>(); for (Entry<CliDeclaredOptionSpec, OptionSpec> cliOption : matchedOptionsInOrderProvision.entrySet()) { final Method sourceMethod = cliOption.getKey().getSourceMethod(); final int mandatoryParameters = MiscUtil.countMandatoryParameters(sourceMethod); final List<String> providedStringValues = cliOption.getValue().getValue(); assumeTrue(providedStringValues.size() >= mandatoryParameters, format("provided %s arguments, but need at least %s", providedStringValues.size(), mandatoryParameters)); assumeTrue(providedStringValues.size() <= sourceMethod.getParameterTypes().length, format("provided %s arguments, but need at most %s", providedStringValues.size(), sourceMethod.getParameterTypes().length)); receivedOptions.add(new CliReceivedOptionData(cliOption.getKey(), convertProvidedOptionValues(providedStringValues, sourceMethod))); LOGGER.debug("\tconverted option values: {}", getLast(receivedOptions).getProvidedOptionValues()); } return new CliReceivedCommand(matchedCommand, receivedOptions); }
[ "static", "CliReceivedCommand", "consumeCommandLineInput", "(", "ParseResult", "providedCommand", ",", "@", "SuppressWarnings", "(", "\"SameParameterValue\"", ")", "Iterable", "<", "CliDeclaredOptionSpec", ">", "declaredOptions", ")", "{", "assumeTrue", "(", "providedComman...
we reach here when terminal input was value and no help was requested
[ "we", "reach", "here", "when", "terminal", "input", "was", "value", "and", "no", "help", "was", "requested" ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/cli-module/src/main/java/org/simplejavamail/internal/clisupport/CliCommandLineConsumer.java#L38-L61
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/EvaluateClustering.java
EvaluateClustering.evaluateRanking
public static double evaluateRanking(ScoreEvaluation eval, Cluster<?> clus, DoubleDBIDList ranking) { return eval.evaluate(new DBIDsTest(DBIDUtil.ensureSet(clus.getIDs())), new DistanceResultAdapter(ranking.iter())); }
java
public static double evaluateRanking(ScoreEvaluation eval, Cluster<?> clus, DoubleDBIDList ranking) { return eval.evaluate(new DBIDsTest(DBIDUtil.ensureSet(clus.getIDs())), new DistanceResultAdapter(ranking.iter())); }
[ "public", "static", "double", "evaluateRanking", "(", "ScoreEvaluation", "eval", ",", "Cluster", "<", "?", ">", "clus", ",", "DoubleDBIDList", "ranking", ")", "{", "return", "eval", ".", "evaluate", "(", "new", "DBIDsTest", "(", "DBIDUtil", ".", "ensureSet", ...
Evaluate given a cluster (of positive elements) and a scoring list. @param eval Evaluation method @param clus Cluster object @param ranking Object ranking @return Score
[ "Evaluate", "given", "a", "cluster", "(", "of", "positive", "elements", ")", "and", "a", "scoring", "list", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/EvaluateClustering.java#L106-L108
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.tryToShowPrompt
public static void tryToShowPrompt(Context context, OnCompleteListener onCompleteListener) { tryToShowPrompt(context, null, null, onCompleteListener); }
java
public static void tryToShowPrompt(Context context, OnCompleteListener onCompleteListener) { tryToShowPrompt(context, null, null, onCompleteListener); }
[ "public", "static", "void", "tryToShowPrompt", "(", "Context", "context", ",", "OnCompleteListener", "onCompleteListener", ")", "{", "tryToShowPrompt", "(", "context", ",", "null", ",", "null", ",", "onCompleteListener", ")", ";", "}" ]
Show rating dialog. The dialog will be showed if the user hasn't declined to rate or hasn't rated current version. @param context Context @param onCompleteListener Listener which be called after process of review dialog finished.
[ "Show", "rating", "dialog", ".", "The", "dialog", "will", "be", "showed", "if", "the", "user", "hasn", "t", "declined", "to", "rate", "or", "hasn", "t", "rated", "current", "version", "." ]
train
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L192-L194
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/html/Page.java
Page.addTo
public void addTo(String section, Object element) { Composite s = (Composite)sections.get(section); if (s==null) add(element); else s.add(element); }
java
public void addTo(String section, Object element) { Composite s = (Composite)sections.get(section); if (s==null) add(element); else s.add(element); }
[ "public", "void", "addTo", "(", "String", "section", ",", "Object", "element", ")", "{", "Composite", "s", "=", "(", "Composite", ")", "sections", ".", "get", "(", "section", ")", ";", "if", "(", "s", "==", "null", ")", "add", "(", "element", ")", ...
Add content to a named sections. If the named section cannot. be found, the content is added to the page.
[ "Add", "content", "to", "a", "named", "sections", ".", "If", "the", "named", "section", "cannot", ".", "be", "found", "the", "content", "is", "added", "to", "the", "page", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/Page.java#L349-L356
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java
SwingBindingFactory.createBinding
public Binding createBinding(String propertyPath, String binderId, Map context) { Assert.notNull(context, "Context must not be null"); Binder binder = ((SwingBinderSelectionStrategy)getBinderSelectionStrategy()).getIdBoundBinder(binderId); Binding binding = binder.bind(getFormModel(), propertyPath, context); interceptBinding(binding); return binding; }
java
public Binding createBinding(String propertyPath, String binderId, Map context) { Assert.notNull(context, "Context must not be null"); Binder binder = ((SwingBinderSelectionStrategy)getBinderSelectionStrategy()).getIdBoundBinder(binderId); Binding binding = binder.bind(getFormModel(), propertyPath, context); interceptBinding(binding); return binding; }
[ "public", "Binding", "createBinding", "(", "String", "propertyPath", ",", "String", "binderId", ",", "Map", "context", ")", "{", "Assert", ".", "notNull", "(", "context", ",", "\"Context must not be null\"", ")", ";", "Binder", "binder", "=", "(", "(", "SwingB...
Create a binding based on a specific binder id. @param propertyPath Path to property @param binderId Id of the binder @param context Context data (can be empty map) @return Specific binding
[ "Create", "a", "binding", "based", "on", "a", "specific", "binder", "id", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java#L434-L441
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/adapter/PropertyAdapter.java
PropertyAdapter.generateExample
public static Object generateExample(Property property, MarkupDocBuilder markupDocBuilder) { if (property.getType() == null) { return "untyped"; } switch (property.getType()) { case "integer": return ExamplesUtil.generateIntegerExample(property instanceof IntegerProperty ? ((IntegerProperty) property).getEnum() : null); case "number": return 0.0; case "boolean": return true; case "string": return ExamplesUtil.generateStringExample(property.getFormat(), property instanceof StringProperty ? ((StringProperty) property).getEnum() : null); case "ref": if (property instanceof RefProperty) { if (logger.isDebugEnabled()) logger.debug("generateExample RefProperty for " + property.getName()); return markupDocBuilder.copy(false).crossReference(((RefProperty) property).getSimpleRef()).toString(); } else { if (logger.isDebugEnabled()) logger.debug("generateExample for ref not RefProperty"); } case "array": if (property instanceof ArrayProperty) { return generateArrayExample((ArrayProperty) property, markupDocBuilder); } default: return property.getType(); } }
java
public static Object generateExample(Property property, MarkupDocBuilder markupDocBuilder) { if (property.getType() == null) { return "untyped"; } switch (property.getType()) { case "integer": return ExamplesUtil.generateIntegerExample(property instanceof IntegerProperty ? ((IntegerProperty) property).getEnum() : null); case "number": return 0.0; case "boolean": return true; case "string": return ExamplesUtil.generateStringExample(property.getFormat(), property instanceof StringProperty ? ((StringProperty) property).getEnum() : null); case "ref": if (property instanceof RefProperty) { if (logger.isDebugEnabled()) logger.debug("generateExample RefProperty for " + property.getName()); return markupDocBuilder.copy(false).crossReference(((RefProperty) property).getSimpleRef()).toString(); } else { if (logger.isDebugEnabled()) logger.debug("generateExample for ref not RefProperty"); } case "array": if (property instanceof ArrayProperty) { return generateArrayExample((ArrayProperty) property, markupDocBuilder); } default: return property.getType(); } }
[ "public", "static", "Object", "generateExample", "(", "Property", "property", ",", "MarkupDocBuilder", "markupDocBuilder", ")", "{", "if", "(", "property", ".", "getType", "(", ")", "==", "null", ")", "{", "return", "\"untyped\"", ";", "}", "switch", "(", "p...
Generate a default example value for property. @param property property @param markupDocBuilder doc builder @return a generated example for the property
[ "Generate", "a", "default", "example", "value", "for", "property", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/adapter/PropertyAdapter.java#L76-L105
undera/jmeter-plugins
infra/common/src/main/java/kg/apc/charting/plotters/AbstractRowPlotter.java
AbstractRowPlotter.isChartPointValid
protected boolean isChartPointValid(int xx, int yy) { boolean ret = true; //check x if (xx < chartRect.x || xx > chartRect.x + chartRect.width) { ret = false; } else //check y bellow x axis if (yy > chartRect.y + chartRect.height) { ret = false; } return ret; }
java
protected boolean isChartPointValid(int xx, int yy) { boolean ret = true; //check x if (xx < chartRect.x || xx > chartRect.x + chartRect.width) { ret = false; } else //check y bellow x axis if (yy > chartRect.y + chartRect.height) { ret = false; } return ret; }
[ "protected", "boolean", "isChartPointValid", "(", "int", "xx", ",", "int", "yy", ")", "{", "boolean", "ret", "=", "true", ";", "//check x", "if", "(", "xx", "<", "chartRect", ".", "x", "||", "xx", ">", "chartRect", ".", "x", "+", "chartRect", ".", "w...
/* Check if the point (x,y) is contained in the chart area We check only minX, maxX, and maxY to avoid flickering. We take max(chartRect.y, y) as redering value This is done to prevent line out of range if new point is added during chart paint.
[ "/", "*", "Check", "if", "the", "point", "(", "x", "y", ")", "is", "contained", "in", "the", "chart", "area", "We", "check", "only", "minX", "maxX", "and", "maxY", "to", "avoid", "flickering", ".", "We", "take", "max", "(", "chartRect", ".", "y", "...
train
https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/infra/common/src/main/java/kg/apc/charting/plotters/AbstractRowPlotter.java#L63-L75
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java
FileUtil.isSecondNewerThanFirst
public static boolean isSecondNewerThanFirst(File first, File second) { boolean isSecondNewerThanFirst = false; // If file does not exist, it cannot be newer. if (second.exists()) { long firstLastModified = first.lastModified(); long secondLastModified = second.lastModified(); // 0L is returned if there was any error, so we check if both last // modification stamps are != 0L. if (firstLastModified != 0L && secondLastModified != 0L) { isSecondNewerThanFirst = secondLastModified > firstLastModified; } } return isSecondNewerThanFirst; }
java
public static boolean isSecondNewerThanFirst(File first, File second) { boolean isSecondNewerThanFirst = false; // If file does not exist, it cannot be newer. if (second.exists()) { long firstLastModified = first.lastModified(); long secondLastModified = second.lastModified(); // 0L is returned if there was any error, so we check if both last // modification stamps are != 0L. if (firstLastModified != 0L && secondLastModified != 0L) { isSecondNewerThanFirst = secondLastModified > firstLastModified; } } return isSecondNewerThanFirst; }
[ "public", "static", "boolean", "isSecondNewerThanFirst", "(", "File", "first", ",", "File", "second", ")", "{", "boolean", "isSecondNewerThanFirst", "=", "false", ";", "// If file does not exist, it cannot be newer.", "if", "(", "second", ".", "exists", "(", ")", ")...
Checks if tool jar is newer than JUnit jar. If tool jar is newer, return true; false otherwise.
[ "Checks", "if", "tool", "jar", "is", "newer", "than", "JUnit", "jar", ".", "If", "tool", "jar", "is", "newer", "return", "true", ";", "false", "otherwise", "." ]
train
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/util/FileUtil.java#L93-L106
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/Expression.java
Expression.wrapWith
private static String wrapWith(char wrapper, String... input) { StringBuilder escaped = new StringBuilder(); for (String i : input) { escaped.append(", "); escaped.append(wrapper).append(i).append(wrapper); } if (escaped.length() > 2) { escaped.delete(0, 2); } return escaped.toString(); }
java
private static String wrapWith(char wrapper, String... input) { StringBuilder escaped = new StringBuilder(); for (String i : input) { escaped.append(", "); escaped.append(wrapper).append(i).append(wrapper); } if (escaped.length() > 2) { escaped.delete(0, 2); } return escaped.toString(); }
[ "private", "static", "String", "wrapWith", "(", "char", "wrapper", ",", "String", "...", "input", ")", "{", "StringBuilder", "escaped", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "i", ":", "input", ")", "{", "escaped", ".", "append...
Helper method to wrap varargs with the given character. @param wrapper the wrapper character. @param input the input fields to wrap. @return a concatenated string with characters wrapped.
[ "Helper", "method", "to", "wrap", "varargs", "with", "the", "given", "character", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/Expression.java#L1886-L1896
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkProcessor.java
CmsLinkProcessor.processLinks
public String processLinks(String content) throws ParserException { m_mode = PROCESS_LINKS; return process(content, m_encoding); }
java
public String processLinks(String content) throws ParserException { m_mode = PROCESS_LINKS; return process(content, m_encoding); }
[ "public", "String", "processLinks", "(", "String", "content", ")", "throws", "ParserException", "{", "m_mode", "=", "PROCESS_LINKS", ";", "return", "process", "(", "content", ",", "m_encoding", ")", ";", "}" ]
Starts link processing for the given content in processing mode.<p> Macros are replaced by links.<p> @param content the content to process @return the processed content with replaced macros @throws ParserException if something goes wrong
[ "Starts", "link", "processing", "for", "the", "given", "content", "in", "processing", "mode", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkProcessor.java#L216-L220
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/QueryParserBase.java
QueryParserBase.getMappedFieldName
protected String getMappedFieldName(String fieldName, @Nullable Class<?> domainType) { if (domainType == null || mappingContext == null) { return fieldName; } SolrPersistentEntity entity = mappingContext.getPersistentEntity(domainType); if (entity == null) { return fieldName; } SolrPersistentProperty property = entity.getPersistentProperty(fieldName); return property != null ? property.getFieldName() : fieldName; }
java
protected String getMappedFieldName(String fieldName, @Nullable Class<?> domainType) { if (domainType == null || mappingContext == null) { return fieldName; } SolrPersistentEntity entity = mappingContext.getPersistentEntity(domainType); if (entity == null) { return fieldName; } SolrPersistentProperty property = entity.getPersistentProperty(fieldName); return property != null ? property.getFieldName() : fieldName; }
[ "protected", "String", "getMappedFieldName", "(", "String", "fieldName", ",", "@", "Nullable", "Class", "<", "?", ">", "domainType", ")", "{", "if", "(", "domainType", "==", "null", "||", "mappingContext", "==", "null", ")", "{", "return", "fieldName", ";", ...
Get the mapped field name using meta information derived from the given domain type. @param fieldName @param domainType @return @since 4.0
[ "Get", "the", "mapped", "field", "name", "using", "meta", "information", "derived", "from", "the", "given", "domain", "type", "." ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L327-L340
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/ScriptController.java
ScriptController.getScript
@RequestMapping(value = "/api/scripts/{scriptIdentifier}", method = RequestMethod.GET) public @ResponseBody Script getScript(Model model, @PathVariable String scriptIdentifier) throws Exception { return ScriptService.getInstance().getScript(Integer.parseInt(scriptIdentifier)); }
java
@RequestMapping(value = "/api/scripts/{scriptIdentifier}", method = RequestMethod.GET) public @ResponseBody Script getScript(Model model, @PathVariable String scriptIdentifier) throws Exception { return ScriptService.getInstance().getScript(Integer.parseInt(scriptIdentifier)); }
[ "@", "RequestMapping", "(", "value", "=", "\"/api/scripts/{scriptIdentifier}\"", ",", "method", "=", "RequestMethod", ".", "GET", ")", "public", "@", "ResponseBody", "Script", "getScript", "(", "Model", "model", ",", "@", "PathVariable", "String", "scriptIdentifier"...
Get a specific script @param model @param scriptIdentifier @return @throws Exception
[ "Get", "a", "specific", "script" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/ScriptController.java#L66-L71
tommyettinger/RegExodus
src/main/java/regexodus/ds/CharArrayList.java
CharArrayList.removeElements
public void removeElements(final int from, final int to) { CharArrays.ensureFromTo(size, from, to); System.arraycopy(a, to, a, from, size - to); size -= (to - from); }
java
public void removeElements(final int from, final int to) { CharArrays.ensureFromTo(size, from, to); System.arraycopy(a, to, a, from, size - to); size -= (to - from); }
[ "public", "void", "removeElements", "(", "final", "int", "from", ",", "final", "int", "to", ")", "{", "CharArrays", ".", "ensureFromTo", "(", "size", ",", "from", ",", "to", ")", ";", "System", ".", "arraycopy", "(", "a", ",", "to", ",", "a", ",", ...
Removes elements of this type-specific list using optimized system calls. @param from the start index (inclusive). @param to the end index (exclusive).
[ "Removes", "elements", "of", "this", "type", "-", "specific", "list", "using", "optimized", "system", "calls", "." ]
train
https://github.com/tommyettinger/RegExodus/blob/d4af9bb7c132c5f9d29f45b76121f93b2f89de16/src/main/java/regexodus/ds/CharArrayList.java#L481-L485
mabe02/lanterna
src/main/java/com/googlecode/lanterna/screen/ScreenBuffer.java
ScreenBuffer.copyFrom
public void copyFrom(TextImage source, int startRowIndex, int rows, int startColumnIndex, int columns, int destinationRowOffset, int destinationColumnOffset) { source.copyTo(backend, startRowIndex, rows, startColumnIndex, columns, destinationRowOffset, destinationColumnOffset); }
java
public void copyFrom(TextImage source, int startRowIndex, int rows, int startColumnIndex, int columns, int destinationRowOffset, int destinationColumnOffset) { source.copyTo(backend, startRowIndex, rows, startColumnIndex, columns, destinationRowOffset, destinationColumnOffset); }
[ "public", "void", "copyFrom", "(", "TextImage", "source", ",", "int", "startRowIndex", ",", "int", "rows", ",", "int", "startColumnIndex", ",", "int", "columns", ",", "int", "destinationRowOffset", ",", "int", "destinationColumnOffset", ")", "{", "source", ".", ...
Copies the content from a TextImage into this buffer. @param source Source to copy content from @param startRowIndex Which row in the source image to start copying from @param rows How many rows to copy @param startColumnIndex Which column in the source image to start copying from @param columns How many columns to copy @param destinationRowOffset The row offset in this buffer of where to place the copied content @param destinationColumnOffset The column offset in this buffer of where to place the copied content
[ "Copies", "the", "content", "from", "a", "TextImage", "into", "this", "buffer", "." ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/screen/ScreenBuffer.java#L139-L141
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java
RequestHandler.getResponse
protected Response getResponse(HttpServerExchange exchange) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, MangooTemplateEngineException, IOException { //execute global request filter Response response = Response.withOk(); if (this.attachment.hasRequestFilter()) { final MangooRequestFilter mangooRequestFilter = Application.getInstance(MangooRequestFilter.class); response = mangooRequestFilter.execute(this.attachment.getRequest(), response); } if (response.isEndResponse()) { return response; } //execute controller filters response = executeFilter(this.attachment.getClassAnnotations(), response); if (response.isEndResponse()) { return response; } //execute method filters response = executeFilter(this.attachment.getMethodAnnotations(), response); if (response.isEndResponse()) { return response; } return invokeController(exchange, response); }
java
protected Response getResponse(HttpServerExchange exchange) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, MangooTemplateEngineException, IOException { //execute global request filter Response response = Response.withOk(); if (this.attachment.hasRequestFilter()) { final MangooRequestFilter mangooRequestFilter = Application.getInstance(MangooRequestFilter.class); response = mangooRequestFilter.execute(this.attachment.getRequest(), response); } if (response.isEndResponse()) { return response; } //execute controller filters response = executeFilter(this.attachment.getClassAnnotations(), response); if (response.isEndResponse()) { return response; } //execute method filters response = executeFilter(this.attachment.getMethodAnnotations(), response); if (response.isEndResponse()) { return response; } return invokeController(exchange, response); }
[ "protected", "Response", "getResponse", "(", "HttpServerExchange", "exchange", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", ",", "MangooTemplateEngineException", ",", "IOException", "{", "//execute global request filter"...
Execute filters if exists in the following order: RequestFilter, ControllerFilter, MethodFilter @param exchange The Undertow HttpServerExchange @return A Response object that will be merged to the final response @throws NoSuchMethodException @throws IllegalAccessException @throws InvocationTargetException @throws TemplateException @throws IOException @throws MangooTemplateEngineException
[ "Execute", "filters", "if", "exists", "in", "the", "following", "order", ":", "RequestFilter", "ControllerFilter", "MethodFilter" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/RequestHandler.java#L95-L120
samskivert/samskivert
src/main/java/com/samskivert/util/Throttle.java
Throttle.reinit
public void reinit (int operations, long period) { _period = period; if (operations != _ops.length) { long[] ops = new long[operations]; if (operations > _ops.length) { // copy to a larger buffer, leaving zeroes at the beginning int lastOp = _lastOp + operations - _ops.length; System.arraycopy(_ops, 0, ops, 0, _lastOp); System.arraycopy(_ops, _lastOp, ops, lastOp, _ops.length - _lastOp); } else { // if we're truncating, copy the first (oldest) stamps into ops[0..] int endCount = Math.min(operations, _ops.length - _lastOp); System.arraycopy(_ops, _lastOp, ops, 0, endCount); System.arraycopy(_ops, 0, ops, endCount, operations - endCount); _lastOp = 0; } _ops = ops; } }
java
public void reinit (int operations, long period) { _period = period; if (operations != _ops.length) { long[] ops = new long[operations]; if (operations > _ops.length) { // copy to a larger buffer, leaving zeroes at the beginning int lastOp = _lastOp + operations - _ops.length; System.arraycopy(_ops, 0, ops, 0, _lastOp); System.arraycopy(_ops, _lastOp, ops, lastOp, _ops.length - _lastOp); } else { // if we're truncating, copy the first (oldest) stamps into ops[0..] int endCount = Math.min(operations, _ops.length - _lastOp); System.arraycopy(_ops, _lastOp, ops, 0, endCount); System.arraycopy(_ops, 0, ops, endCount, operations - endCount); _lastOp = 0; } _ops = ops; } }
[ "public", "void", "reinit", "(", "int", "operations", ",", "long", "period", ")", "{", "_period", "=", "period", ";", "if", "(", "operations", "!=", "_ops", ".", "length", ")", "{", "long", "[", "]", "ops", "=", "new", "long", "[", "operations", "]",...
Updates the number of operations for this throttle to a new maximum, retaining the current history of operations if the limit is being increased and truncating the oldest operations if the limit is decreased. @param operations the new maximum number of operations. @param period the new period.
[ "Updates", "the", "number", "of", "operations", "for", "this", "throttle", "to", "a", "new", "maximum", "retaining", "the", "current", "history", "of", "operations", "if", "the", "limit", "is", "being", "increased", "and", "truncating", "the", "oldest", "opera...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Throttle.java#L59-L80
amzn/ion-java
src/com/amazon/ion/Timestamp.java
Timestamp.forSqlTimestampZ
public static Timestamp forSqlTimestampZ(java.sql.Timestamp sqlTimestamp) { if (sqlTimestamp == null) return null; long millis = sqlTimestamp.getTime(); Timestamp ts = new Timestamp(millis, UTC_OFFSET); int nanos = sqlTimestamp.getNanos(); BigDecimal frac = BigDecimal.valueOf(nanos).movePointLeft(9); ts._fraction = frac; return ts; }
java
public static Timestamp forSqlTimestampZ(java.sql.Timestamp sqlTimestamp) { if (sqlTimestamp == null) return null; long millis = sqlTimestamp.getTime(); Timestamp ts = new Timestamp(millis, UTC_OFFSET); int nanos = sqlTimestamp.getNanos(); BigDecimal frac = BigDecimal.valueOf(nanos).movePointLeft(9); ts._fraction = frac; return ts; }
[ "public", "static", "Timestamp", "forSqlTimestampZ", "(", "java", ".", "sql", ".", "Timestamp", "sqlTimestamp", ")", "{", "if", "(", "sqlTimestamp", "==", "null", ")", "return", "null", ";", "long", "millis", "=", "sqlTimestamp", ".", "getTime", "(", ")", ...
Converts a {@link java.sql.Timestamp} to a Timestamp in UTC representing the same point in time. <p> The resulting Timestamp will be precise to the nanosecond. @param sqlTimestamp assumed to have nanoseconds precision @return a new Timestamp instance, in UTC, precise to the nanosecond {@code null} if {@code sqlTimestamp} is {@code null}
[ "Converts", "a", "{", "@link", "java", ".", "sql", ".", "Timestamp", "}", "to", "a", "Timestamp", "in", "UTC", "representing", "the", "same", "point", "in", "time", ".", "<p", ">", "The", "resulting", "Timestamp", "will", "be", "precise", "to", "the", ...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L1438-L1448
liferay/com-liferay-commerce
commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java
CommerceWishListItemPersistenceImpl.findAll
@Override public List<CommerceWishListItem> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceWishListItem> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceWishListItem", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce wish list items. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWishListItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce wish list items @param end the upper bound of the range of commerce wish list items (not inclusive) @return the range of commerce wish list items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "wish", "list", "items", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListItemPersistenceImpl.java#L3850-L3853
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatioTemporal/paths/Pose.java
Pose.interpolate
public Pose interpolate(Pose p2, double ratio) { double newX = lerp(getX(),p2.getX(),ratio); double newY = lerp(getY(),p2.getY(),ratio); if (Double.isNaN(this.z)) { double newTheta = lerpDegrees(getTheta(),p2.getTheta(),ratio); return new Pose(newX,newY,newTheta); } double newZ = lerp(getZ(),p2.getZ(),ratio); double newRoll = lerpDegrees(getRoll(),p2.getRoll(),ratio); double newPitch = lerpDegrees(getPitch(),p2.getPitch(),ratio); double newYaw = lerpDegrees(getYaw(),p2.getYaw(),ratio); return new Pose(newX,newY,newZ,newRoll,newPitch,newYaw); }
java
public Pose interpolate(Pose p2, double ratio) { double newX = lerp(getX(),p2.getX(),ratio); double newY = lerp(getY(),p2.getY(),ratio); if (Double.isNaN(this.z)) { double newTheta = lerpDegrees(getTheta(),p2.getTheta(),ratio); return new Pose(newX,newY,newTheta); } double newZ = lerp(getZ(),p2.getZ(),ratio); double newRoll = lerpDegrees(getRoll(),p2.getRoll(),ratio); double newPitch = lerpDegrees(getPitch(),p2.getPitch(),ratio); double newYaw = lerpDegrees(getYaw(),p2.getYaw(),ratio); return new Pose(newX,newY,newZ,newRoll,newPitch,newYaw); }
[ "public", "Pose", "interpolate", "(", "Pose", "p2", ",", "double", "ratio", ")", "{", "double", "newX", "=", "lerp", "(", "getX", "(", ")", ",", "p2", ".", "getX", "(", ")", ",", "ratio", ")", ";", "double", "newY", "=", "lerp", "(", "getY", "(",...
Computes the {@link Pose} between this {@link Pose} and a given {@link Pose} via bilinear interpolation. @param p2 The second {@link Pose} used for interpolation. @param ratio Parameter in [0,1] used for bilinear interpolation. @return The {@link Pose} between this {@link Pose} and a given {@link Pose} via bilinear interpolation.
[ "Computes", "the", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/Pose.java#L152-L164
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/view/ViewDeclarationLanguageBase.java
ViewDeclarationLanguageBase.createView
public UIViewRoot createView(FacesContext context, String viewId) { checkNull(context, "context"); //checkNull(viewId, "viewId"); try { viewId = calculateViewId(context, viewId); Application application = context.getApplication(); // Create a new UIViewRoot object instance using Application.createComponent(UIViewRoot.COMPONENT_TYPE). UIViewRoot newViewRoot = (UIViewRoot) application.createComponent( context, UIViewRoot.COMPONENT_TYPE, null); UIViewRoot oldViewRoot = context.getViewRoot(); if (oldViewRoot == null) { // If not, this method must call calculateLocale() and calculateRenderKitId(), and store the results // as the values of the locale and renderKitId, proeprties, respectively, of the newly created // UIViewRoot. ViewHandler handler = application.getViewHandler(); newViewRoot.setLocale(handler.calculateLocale(context)); newViewRoot.setRenderKitId(handler.calculateRenderKitId(context)); } else { // If there is an existing UIViewRoot available on the FacesContext, this method must copy its locale // and renderKitId to this new view root newViewRoot.setLocale(oldViewRoot.getLocale()); newViewRoot.setRenderKitId(oldViewRoot.getRenderKitId()); } // TODO: VALIDATE - The spec is silent on the following line, but I feel bad if I don't set it newViewRoot.setViewId(viewId); return newViewRoot; } catch (InvalidViewIdException e) { // If no viewId could be identified, or the viewId is exactly equal to the servlet mapping, // send the response error code SC_NOT_FOUND with a suitable message to the client. sendSourceNotFound(context, e.getMessage()); // TODO: VALIDATE - Spec is silent on the return value when an error was sent return null; } }
java
public UIViewRoot createView(FacesContext context, String viewId) { checkNull(context, "context"); //checkNull(viewId, "viewId"); try { viewId = calculateViewId(context, viewId); Application application = context.getApplication(); // Create a new UIViewRoot object instance using Application.createComponent(UIViewRoot.COMPONENT_TYPE). UIViewRoot newViewRoot = (UIViewRoot) application.createComponent( context, UIViewRoot.COMPONENT_TYPE, null); UIViewRoot oldViewRoot = context.getViewRoot(); if (oldViewRoot == null) { // If not, this method must call calculateLocale() and calculateRenderKitId(), and store the results // as the values of the locale and renderKitId, proeprties, respectively, of the newly created // UIViewRoot. ViewHandler handler = application.getViewHandler(); newViewRoot.setLocale(handler.calculateLocale(context)); newViewRoot.setRenderKitId(handler.calculateRenderKitId(context)); } else { // If there is an existing UIViewRoot available on the FacesContext, this method must copy its locale // and renderKitId to this new view root newViewRoot.setLocale(oldViewRoot.getLocale()); newViewRoot.setRenderKitId(oldViewRoot.getRenderKitId()); } // TODO: VALIDATE - The spec is silent on the following line, but I feel bad if I don't set it newViewRoot.setViewId(viewId); return newViewRoot; } catch (InvalidViewIdException e) { // If no viewId could be identified, or the viewId is exactly equal to the servlet mapping, // send the response error code SC_NOT_FOUND with a suitable message to the client. sendSourceNotFound(context, e.getMessage()); // TODO: VALIDATE - Spec is silent on the return value when an error was sent return null; } }
[ "public", "UIViewRoot", "createView", "(", "FacesContext", "context", ",", "String", "viewId", ")", "{", "checkNull", "(", "context", ",", "\"context\"", ")", ";", "//checkNull(viewId, \"viewId\");", "try", "{", "viewId", "=", "calculateViewId", "(", "context", ",...
Process the specification required algorithm that is generic to all PDL. @param context @param viewId
[ "Process", "the", "specification", "required", "algorithm", "that", "is", "generic", "to", "all", "PDL", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/view/ViewDeclarationLanguageBase.java#L41-L87
meertensinstituut/mtas
src/main/java/mtas/solr/handler/component/util/MtasSolrCollectionResult.java
MtasSolrCollectionResult.setPost
public void setPost(long now, SimpleOrderedMap<Object> status) throws IOException { if (action.equals(ComponentCollection.ACTION_POST)) { this.now = now; this.status = status; } else { throw new IOException("not allowed with action '" + action + "'"); } }
java
public void setPost(long now, SimpleOrderedMap<Object> status) throws IOException { if (action.equals(ComponentCollection.ACTION_POST)) { this.now = now; this.status = status; } else { throw new IOException("not allowed with action '" + action + "'"); } }
[ "public", "void", "setPost", "(", "long", "now", ",", "SimpleOrderedMap", "<", "Object", ">", "status", ")", "throws", "IOException", "{", "if", "(", "action", ".", "equals", "(", "ComponentCollection", ".", "ACTION_POST", ")", ")", "{", "this", ".", "now"...
Sets the post. @param now the now @param status the status @throws IOException Signals that an I/O exception has occurred.
[ "Sets", "the", "post", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/component/util/MtasSolrCollectionResult.java#L147-L155
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.escapeXml10
public static void escapeXml10(final String text, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level) throws IOException { escapeXml(text, writer, XmlEscapeSymbols.XML10_SYMBOLS, type, level); }
java
public static void escapeXml10(final String text, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level) throws IOException { escapeXml(text, writer, XmlEscapeSymbols.XML10_SYMBOLS, type, level); }
[ "public", "static", "void", "escapeXml10", "(", "final", "String", "text", ",", "final", "Writer", "writer", ",", "final", "XmlEscapeType", "type", ",", "final", "XmlEscapeLevel", "level", ")", "throws", "IOException", "{", "escapeXml", "(", "text", ",", "writ...
<p> Perform a (configurable) XML 1.0 <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.xml.XmlEscapeType} and {@link org.unbescape.xml.XmlEscapeLevel} argument values. </p> <p> All other <tt>String</tt>/<tt>Writer</tt>-based <tt>escapeXml10*(...)</tt> methods call this one with preconfigured <tt>type</tt> and <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param type the type of escape operation to be performed, see {@link org.unbescape.xml.XmlEscapeType}. @param level the escape level to be applied, see {@link org.unbescape.xml.XmlEscapeLevel}. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "(", "configurable", ")", "XML", "1", ".", "0", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1055-L1058
albfernandez/itext2
src/main/java/com/lowagie/text/Document.java
Document.addCreationDate
public boolean addCreationDate() { try { /* bugfix by 'taqua' (Thomas) */ final SimpleDateFormat sdf = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy"); return add(new Meta(Element.CREATIONDATE, sdf.format(new Date()))); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
java
public boolean addCreationDate() { try { /* bugfix by 'taqua' (Thomas) */ final SimpleDateFormat sdf = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy"); return add(new Meta(Element.CREATIONDATE, sdf.format(new Date()))); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
[ "public", "boolean", "addCreationDate", "(", ")", "{", "try", "{", "/* bugfix by 'taqua' (Thomas) */", "final", "SimpleDateFormat", "sdf", "=", "new", "SimpleDateFormat", "(", "\"EEE MMM dd HH:mm:ss zzz yyyy\"", ")", ";", "return", "add", "(", "new", "Meta", "(", "E...
Adds the current date and time to a Document. @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
[ "Adds", "the", "current", "date", "and", "time", "to", "a", "Document", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Document.java#L620-L629
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/ContentMergePlugin.java
ContentMergePlugin.findMatchedElementIn
protected XmlElement findMatchedElementIn(Document document, org.dom4j.Element element) { org.dom4j.Attribute id = element.attribute("id"); String idName = id.getName(); String idValue = id.getValue(); for (Element me : document.getRootElement().getElements()) { if (me instanceof XmlElement) { XmlElement xe = (XmlElement) me; for (Attribute ab : xe.getAttributes()) { if (StringUtils.equals(idName, ab.getName()) && StringUtils.equals(idValue, ab.getValue())) { return xe; } } } } return null; }
java
protected XmlElement findMatchedElementIn(Document document, org.dom4j.Element element) { org.dom4j.Attribute id = element.attribute("id"); String idName = id.getName(); String idValue = id.getValue(); for (Element me : document.getRootElement().getElements()) { if (me instanceof XmlElement) { XmlElement xe = (XmlElement) me; for (Attribute ab : xe.getAttributes()) { if (StringUtils.equals(idName, ab.getName()) && StringUtils.equals(idValue, ab.getValue())) { return xe; } } } } return null; }
[ "protected", "XmlElement", "findMatchedElementIn", "(", "Document", "document", ",", "org", ".", "dom4j", ".", "Element", "element", ")", "{", "org", ".", "dom4j", ".", "Attribute", "id", "=", "element", ".", "attribute", "(", "\"id\"", ")", ";", "String", ...
从MBG生成的DOM文档结构中找到与element代表同一节点的元素对象 @param document generate xml dom tree @param element The dom4j element @return The xml element correspond to dom4j element
[ "从MBG生成的DOM文档结构中找到与element代表同一节点的元素对象" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/ContentMergePlugin.java#L244-L259
petergeneric/stdlib
guice/common/src/main/java/com/peterphi/std/guice/common/serviceprops/jaxbref/JAXBNamedResourceFactory.java
JAXBNamedResourceFactory.loadResourceValue
private T loadResourceValue(final URL resource) { try (final InputStream is = resource.openStream()) { cached = null; // Prevent the old value from being used return setCached(clazz.cast(factory.getInstance(clazz).deserialise(is))); } catch (IOException e) { throw new RuntimeException("Error loading JAXB resource " + name + " " + clazz + " from " + resource, e); } }
java
private T loadResourceValue(final URL resource) { try (final InputStream is = resource.openStream()) { cached = null; // Prevent the old value from being used return setCached(clazz.cast(factory.getInstance(clazz).deserialise(is))); } catch (IOException e) { throw new RuntimeException("Error loading JAXB resource " + name + " " + clazz + " from " + resource, e); } }
[ "private", "T", "loadResourceValue", "(", "final", "URL", "resource", ")", "{", "try", "(", "final", "InputStream", "is", "=", "resource", ".", "openStream", "(", ")", ")", "{", "cached", "=", "null", ";", "// Prevent the old value from being used", "return", ...
Load from a classpath resource; reloads every time @param resource @return
[ "Load", "from", "a", "classpath", "resource", ";", "reloads", "every", "time" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/common/src/main/java/com/peterphi/std/guice/common/serviceprops/jaxbref/JAXBNamedResourceFactory.java#L227-L239
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setScheduledExecutorConfigs
public Config setScheduledExecutorConfigs(Map<String, ScheduledExecutorConfig> scheduledExecutorConfigs) { this.scheduledExecutorConfigs.clear(); this.scheduledExecutorConfigs.putAll(scheduledExecutorConfigs); for (Entry<String, ScheduledExecutorConfig> entry : scheduledExecutorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public Config setScheduledExecutorConfigs(Map<String, ScheduledExecutorConfig> scheduledExecutorConfigs) { this.scheduledExecutorConfigs.clear(); this.scheduledExecutorConfigs.putAll(scheduledExecutorConfigs); for (Entry<String, ScheduledExecutorConfig> entry : scheduledExecutorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "Config", "setScheduledExecutorConfigs", "(", "Map", "<", "String", ",", "ScheduledExecutorConfig", ">", "scheduledExecutorConfigs", ")", "{", "this", ".", "scheduledExecutorConfigs", ".", "clear", "(", ")", ";", "this", ".", "scheduledExecutorConfigs", ".",...
Sets the map of scheduled executor configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param scheduledExecutorConfigs the scheduled executor configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "scheduled", "executor", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", "." ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2210-L2217
structr/structr
structr-core/src/main/java/org/structr/schema/action/Function.java
Function.logParameterError
protected void logParameterError(final Object caller, final Object[] parameters, final String message, final boolean inJavaScriptContext) { logger.warn("{}: {} '{}'. Parameters: {}. {}", new Object[] { getReplacement(), message, caller, getParametersAsString(parameters), usage(inJavaScriptContext) }); }
java
protected void logParameterError(final Object caller, final Object[] parameters, final String message, final boolean inJavaScriptContext) { logger.warn("{}: {} '{}'. Parameters: {}. {}", new Object[] { getReplacement(), message, caller, getParametersAsString(parameters), usage(inJavaScriptContext) }); }
[ "protected", "void", "logParameterError", "(", "final", "Object", "caller", ",", "final", "Object", "[", "]", "parameters", ",", "final", "String", "message", ",", "final", "boolean", "inJavaScriptContext", ")", "{", "logger", ".", "warn", "(", "\"{}: {} '{}'. P...
Basic logging for functions called with wrong parameter count @param caller The element that caused the error @param parameters The function parameters @param inJavaScriptContext Has the function been called from a JavaScript context?
[ "Basic", "logging", "for", "functions", "called", "with", "wrong", "parameter", "count" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/action/Function.java#L87-L89
mangstadt/biweekly
src/main/java/biweekly/io/ICalTimeZone.java
ICalTimeZone.getObservanceBoundary
public Boundary getObservanceBoundary(Date date) { utcCalendar.setTime(date); int year = utcCalendar.get(Calendar.YEAR); int month = utcCalendar.get(Calendar.MONTH) + 1; int day = utcCalendar.get(Calendar.DATE); int hour = utcCalendar.get(Calendar.HOUR); int minute = utcCalendar.get(Calendar.MINUTE); int second = utcCalendar.get(Calendar.SECOND); return getObservanceBoundary(year, month, day, hour, minute, second); }
java
public Boundary getObservanceBoundary(Date date) { utcCalendar.setTime(date); int year = utcCalendar.get(Calendar.YEAR); int month = utcCalendar.get(Calendar.MONTH) + 1; int day = utcCalendar.get(Calendar.DATE); int hour = utcCalendar.get(Calendar.HOUR); int minute = utcCalendar.get(Calendar.MINUTE); int second = utcCalendar.get(Calendar.SECOND); return getObservanceBoundary(year, month, day, hour, minute, second); }
[ "public", "Boundary", "getObservanceBoundary", "(", "Date", "date", ")", "{", "utcCalendar", ".", "setTime", "(", "date", ")", ";", "int", "year", "=", "utcCalendar", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "month", "=", "utcCalendar", ...
Gets the timezone information of a date. @param date the date @return the timezone information
[ "Gets", "the", "timezone", "information", "of", "a", "date", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/ICalTimeZone.java#L263-L273
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.instrument.serialfilter.premain/src/com/ibm/ws/kernel/instrument/serialfilter/agent/PreMain.java
PreMain.premain
public static void premain(String args, Instrumentation instrumentation) { if (!PreMainUtil.isBeta() && !PreMainUtil.isEnableAgentPropertySet()) { // if it's not beta, do nothing. // this implementation should be changed when this will be in the production code. return; } ObjectInputStreamTransformer transform = null; if (ObjectInputStreamClassInjector.injectionNeeded()) { // Install the transformer to modify ObjectInputStream. if (PreMainUtil.isDebugEnabled()) { System.out.println("Using class file transformer to modify ObjectInputStream."); } transform = new ObjectInputStreamTransformer(); instrumentation.addTransformer(transform); } try { initialiseObjectInputStream(); } finally { // Uninstall the class transformer. if (transform != null) { if (PreMainUtil.isDebugEnabled()) { System.out.println("Removing class file transformer."); } instrumentation.removeTransformer(transform); } } AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { return System.setProperty(PreMainUtil.KEY_SERIALFILTER_AGENT_ACTIVE, "true"); } }); }
java
public static void premain(String args, Instrumentation instrumentation) { if (!PreMainUtil.isBeta() && !PreMainUtil.isEnableAgentPropertySet()) { // if it's not beta, do nothing. // this implementation should be changed when this will be in the production code. return; } ObjectInputStreamTransformer transform = null; if (ObjectInputStreamClassInjector.injectionNeeded()) { // Install the transformer to modify ObjectInputStream. if (PreMainUtil.isDebugEnabled()) { System.out.println("Using class file transformer to modify ObjectInputStream."); } transform = new ObjectInputStreamTransformer(); instrumentation.addTransformer(transform); } try { initialiseObjectInputStream(); } finally { // Uninstall the class transformer. if (transform != null) { if (PreMainUtil.isDebugEnabled()) { System.out.println("Removing class file transformer."); } instrumentation.removeTransformer(transform); } } AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { return System.setProperty(PreMainUtil.KEY_SERIALFILTER_AGENT_ACTIVE, "true"); } }); }
[ "public", "static", "void", "premain", "(", "String", "args", ",", "Instrumentation", "instrumentation", ")", "{", "if", "(", "!", "PreMainUtil", ".", "isBeta", "(", ")", "&&", "!", "PreMainUtil", ".", "isEnableAgentPropertySet", "(", ")", ")", "{", "// if i...
Note: this property name corresponds with code in some IBM JDKs. It must NEVER be changed.
[ "Note", ":", "this", "property", "name", "corresponds", "with", "code", "in", "some", "IBM", "JDKs", ".", "It", "must", "NEVER", "be", "changed", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.instrument.serialfilter.premain/src/com/ibm/ws/kernel/instrument/serialfilter/agent/PreMain.java#L42-L74
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.resetWithShared
public void resetWithShared(char[] buf, int start, int len) { // Let's first mark things we need about input buffer mInputBuffer = buf; mInputStart = start; mInputLen = len; // Then clear intermediate values, if any: mResultString = null; mResultArray = null; // And then reset internal input buffers, if necessary: if (mHasSegments) { clearSegments(); } }
java
public void resetWithShared(char[] buf, int start, int len) { // Let's first mark things we need about input buffer mInputBuffer = buf; mInputStart = start; mInputLen = len; // Then clear intermediate values, if any: mResultString = null; mResultArray = null; // And then reset internal input buffers, if necessary: if (mHasSegments) { clearSegments(); } }
[ "public", "void", "resetWithShared", "(", "char", "[", "]", "buf", ",", "int", "start", ",", "int", "len", ")", "{", "// Let's first mark things we need about input buffer", "mInputBuffer", "=", "buf", ";", "mInputStart", "=", "start", ";", "mInputLen", "=", "le...
Method called to initialize the buffer with a shared copy of data; this means that buffer will just have pointers to actual data. It also means that if anything is to be appended to the buffer, it will first have to unshare it (make a local copy).
[ "Method", "called", "to", "initialize", "the", "buffer", "with", "a", "shared", "copy", "of", "data", ";", "this", "means", "that", "buffer", "will", "just", "have", "pointers", "to", "actual", "data", ".", "It", "also", "means", "that", "if", "anything", ...
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L256-L271
arquillian/arquillian-extension-warp
spi/src/main/java/org/jboss/arquillian/warp/spi/LifecycleManager.java
LifecycleManager.bindTo
public final <T> void bindTo(Class<T> clazz, T object) throws ObjectAlreadyAssociatedException { LifecycleManagerStore.getCurrentStore().bind(this, clazz, object); }
java
public final <T> void bindTo(Class<T> clazz, T object) throws ObjectAlreadyAssociatedException { LifecycleManagerStore.getCurrentStore().bind(this, clazz, object); }
[ "public", "final", "<", "T", ">", "void", "bindTo", "(", "Class", "<", "T", ">", "clazz", ",", "T", "object", ")", "throws", "ObjectAlreadyAssociatedException", "{", "LifecycleManagerStore", ".", "getCurrentStore", "(", ")", ".", "bind", "(", "this", ",", ...
Binds the current {@link LifecycleManager} with given object of given class. @param clazz the class to be bound @param object the object to be bound @throws ObjectAlreadyAssociatedException when there is already object bound with {@link LifecycleManager} for given class.
[ "Binds", "the", "current", "{", "@link", "LifecycleManager", "}", "with", "given", "object", "of", "given", "class", "." ]
train
https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/spi/src/main/java/org/jboss/arquillian/warp/spi/LifecycleManager.java#L137-L139
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/util/DebugUtil.java
DebugUtil.createStackTrace
public static StringBuilder createStackTrace(StringBuilder s, Throwable t, boolean includeCause) { s.append(t.getClass().getName()); s.append(": "); s.append(t.getMessage()); createStackTrace(s, t.getStackTrace()); if (includeCause) { Throwable cause = t.getCause(); if (cause != null && cause != t) { s.append("\nCaused by: "); createStackTrace(s, cause, true); } } return s; }
java
public static StringBuilder createStackTrace(StringBuilder s, Throwable t, boolean includeCause) { s.append(t.getClass().getName()); s.append(": "); s.append(t.getMessage()); createStackTrace(s, t.getStackTrace()); if (includeCause) { Throwable cause = t.getCause(); if (cause != null && cause != t) { s.append("\nCaused by: "); createStackTrace(s, cause, true); } } return s; }
[ "public", "static", "StringBuilder", "createStackTrace", "(", "StringBuilder", "s", ",", "Throwable", "t", ",", "boolean", "includeCause", ")", "{", "s", ".", "append", "(", "t", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "s", ".", ...
Append a stack trace of the given Throwable to the StringBuilder.
[ "Append", "a", "stack", "trace", "of", "the", "given", "Throwable", "to", "the", "StringBuilder", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/DebugUtil.java#L20-L33
craftercms/core
src/main/java/org/craftercms/core/util/xml/marshalling/xstream/CrafterXStreamMarshaller.java
CrafterXStreamMarshaller.marshalWriter
@Override public void marshalWriter(Object graph, Writer writer, DataHolder dataHolder) throws XmlMappingException, IOException { if (graph instanceof Document) { OutputFormat outputFormat = OutputFormat.createCompactFormat(); outputFormat.setSuppressDeclaration(suppressXmlDeclaration); XMLWriter xmlWriter = new XMLWriter(writer, outputFormat); try { xmlWriter.write((Document)graph); } finally { try { xmlWriter.flush(); } catch (Exception ex) { logger.debug("Could not flush XMLWriter", ex); } } } else { if (!suppressXmlDeclaration) { writer.write(XML_DECLARATION); } HierarchicalStreamWriter streamWriter = new EscapingCompactWriter(writer); try { getXStream().marshal(graph, streamWriter, dataHolder); } catch (Exception ex) { throw convertXStreamException(ex, true); } finally { try { streamWriter.flush(); } catch (Exception ex) { logger.debug("Could not flush HierarchicalStreamWriter", ex); } } } }
java
@Override public void marshalWriter(Object graph, Writer writer, DataHolder dataHolder) throws XmlMappingException, IOException { if (graph instanceof Document) { OutputFormat outputFormat = OutputFormat.createCompactFormat(); outputFormat.setSuppressDeclaration(suppressXmlDeclaration); XMLWriter xmlWriter = new XMLWriter(writer, outputFormat); try { xmlWriter.write((Document)graph); } finally { try { xmlWriter.flush(); } catch (Exception ex) { logger.debug("Could not flush XMLWriter", ex); } } } else { if (!suppressXmlDeclaration) { writer.write(XML_DECLARATION); } HierarchicalStreamWriter streamWriter = new EscapingCompactWriter(writer); try { getXStream().marshal(graph, streamWriter, dataHolder); } catch (Exception ex) { throw convertXStreamException(ex, true); } finally { try { streamWriter.flush(); } catch (Exception ex) { logger.debug("Could not flush HierarchicalStreamWriter", ex); } } } }
[ "@", "Override", "public", "void", "marshalWriter", "(", "Object", "graph", ",", "Writer", "writer", ",", "DataHolder", "dataHolder", ")", "throws", "XmlMappingException", ",", "IOException", "{", "if", "(", "graph", "instanceof", "Document", ")", "{", "OutputFo...
Just as super(), but instead of a {@link com.thoughtworks.xstream.io.xml.CompactWriter} creates a {@link EscapingCompactWriter}. Also if the object graph is a Dom4j document, the document is written directly instead of using XStream.
[ "Just", "as", "super", "()", "but", "instead", "of", "a", "{" ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/xml/marshalling/xstream/CrafterXStreamMarshaller.java#L107-L142
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.markInvoiceSuccessful
public Invoice markInvoiceSuccessful(final String invoiceId) { return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_successful", null, Invoice.class); }
java
public Invoice markInvoiceSuccessful(final String invoiceId) { return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_successful", null, Invoice.class); }
[ "public", "Invoice", "markInvoiceSuccessful", "(", "final", "String", "invoiceId", ")", "{", "return", "doPUT", "(", "Invoices", ".", "INVOICES_RESOURCE", "+", "\"/\"", "+", "invoiceId", "+", "\"/mark_successful\"", ",", "null", ",", "Invoice", ".", "class", ")"...
Mark an invoice as paid successfully - Recurly Enterprise Feature @param invoiceId String Recurly Invoice ID
[ "Mark", "an", "invoice", "as", "paid", "successfully", "-", "Recurly", "Enterprise", "Feature" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1280-L1282
ag-gipp/MathMLTools
mathml-core/src/main/java/com/formulasearchengine/mathmltools/helper/XMLHelper.java
XMLHelper.getElementsB
public static NodeList getElementsB(Node node, XPathExpression xPath) throws XPathExpressionException { return (NodeList) xPath.evaluate(node, XPathConstants.NODESET); }
java
public static NodeList getElementsB(Node node, XPathExpression xPath) throws XPathExpressionException { return (NodeList) xPath.evaluate(node, XPathConstants.NODESET); }
[ "public", "static", "NodeList", "getElementsB", "(", "Node", "node", ",", "XPathExpression", "xPath", ")", "throws", "XPathExpressionException", "{", "return", "(", "NodeList", ")", "xPath", ".", "evaluate", "(", "node", ",", "XPathConstants", ".", "NODESET", ")...
Helper program: Extracts the specified XPATH expression from an XML-String. @param node the node @param xPath the x path @return NodeList @throws XPathExpressionException the x path expression exception
[ "Helper", "program", ":", "Extracts", "the", "specified", "XPATH", "expression", "from", "an", "XML", "-", "String", "." ]
train
https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-core/src/main/java/com/formulasearchengine/mathmltools/helper/XMLHelper.java#L167-L170
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PeopleApi.java
PeopleApi.getInfo
public Person getInfo(String userId, boolean sign) throws JinxException { JinxUtils.validateParams(userId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.people.getInfo"); params.put("user_id", userId); return jinx.flickrGet(params, Person.class, sign); }
java
public Person getInfo(String userId, boolean sign) throws JinxException { JinxUtils.validateParams(userId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.people.getInfo"); params.put("user_id", userId); return jinx.flickrGet(params, Person.class, sign); }
[ "public", "Person", "getInfo", "(", "String", "userId", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "userId", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>...
Get information about a user. <br> This method does not require authentication. @param userId (Required) The user id of the user to fetch information about. @param sign if true, the request will be signed. @return object with information about the user. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.people.getInfo.html">flickr.people.getInfo</a>
[ "Get", "information", "about", "a", "user", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PeopleApi.java#L125-L131
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java
Agg.percentRankBy
public static <T, U extends Comparable<? super U>> Collector<T, ?, Optional<Double>> percentRankBy(U value, Function<? super T, ? extends U> function) { return percentRankBy(value, function, naturalOrder()); }
java
public static <T, U extends Comparable<? super U>> Collector<T, ?, Optional<Double>> percentRankBy(U value, Function<? super T, ? extends U> function) { return percentRankBy(value, function, naturalOrder()); }
[ "public", "static", "<", "T", ",", "U", "extends", "Comparable", "<", "?", "super", "U", ">", ">", "Collector", "<", "T", ",", "?", ",", "Optional", "<", "Double", ">", ">", "percentRankBy", "(", "U", "value", ",", "Function", "<", "?", "super", "T...
Get a {@link Collector} that calculates the derived <code>PERCENT_RANK()</code> function given natural ordering.
[ "Get", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L761-L763
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java
DataLakeStoreAccountsInner.getAsync
public Observable<DataLakeStoreAccountInformationInner> getAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName) { return getWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).map(new Func1<ServiceResponse<DataLakeStoreAccountInformationInner>, DataLakeStoreAccountInformationInner>() { @Override public DataLakeStoreAccountInformationInner call(ServiceResponse<DataLakeStoreAccountInformationInner> response) { return response.body(); } }); }
java
public Observable<DataLakeStoreAccountInformationInner> getAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName) { return getWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).map(new Func1<ServiceResponse<DataLakeStoreAccountInformationInner>, DataLakeStoreAccountInformationInner>() { @Override public DataLakeStoreAccountInformationInner call(ServiceResponse<DataLakeStoreAccountInformationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataLakeStoreAccountInformationInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "dataLakeStoreAccountName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",...
Gets the specified Data Lake Store account details in the specified Data Lake Analytics account. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @param dataLakeStoreAccountName The name of the Data Lake Store account to retrieve @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataLakeStoreAccountInformationInner object
[ "Gets", "the", "specified", "Data", "Lake", "Store", "account", "details", "in", "the", "specified", "Data", "Lake", "Analytics", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/DataLakeStoreAccountsInner.java#L583-L590
rythmengine/rythmengine
src/main/java/org/rythmengine/utils/S.java
S.formatCurrency
@Transformer(requireTemplate = true) public static String formatCurrency(Object data) { return formatCurrency(null, data, null, null); }
java
@Transformer(requireTemplate = true) public static String formatCurrency(Object data) { return formatCurrency(null, data, null, null); }
[ "@", "Transformer", "(", "requireTemplate", "=", "true", ")", "public", "static", "String", "formatCurrency", "(", "Object", "data", ")", "{", "return", "formatCurrency", "(", "null", ",", "data", ",", "null", ",", "null", ")", ";", "}" ]
Transformer method. Format given data into currency @param data @return the currency See {@link #formatCurrency(org.rythmengine.template.ITemplate,Object,String,java.util.Locale)}
[ "Transformer", "method", ".", "Format", "given", "data", "into", "currency" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/S.java#L1445-L1448
jMetal/jMetal
jmetal-core/src/main/java/org/uma/jmetal/solution/util/RepairDoubleSolutionAtRandom.java
RepairDoubleSolutionAtRandom.repairSolutionVariableValue
public double repairSolutionVariableValue(double value, double lowerBound, double upperBound) { if (lowerBound > upperBound) { throw new JMetalException("The lower bound (" + lowerBound + ") is greater than the " + "upper bound (" + upperBound+")") ; } double result = value ; if (value < lowerBound) { result = randomGenerator.getRandomValue(lowerBound, upperBound) ; } if (value > upperBound) { result = randomGenerator.getRandomValue(lowerBound, upperBound) ; } return result ; }
java
public double repairSolutionVariableValue(double value, double lowerBound, double upperBound) { if (lowerBound > upperBound) { throw new JMetalException("The lower bound (" + lowerBound + ") is greater than the " + "upper bound (" + upperBound+")") ; } double result = value ; if (value < lowerBound) { result = randomGenerator.getRandomValue(lowerBound, upperBound) ; } if (value > upperBound) { result = randomGenerator.getRandomValue(lowerBound, upperBound) ; } return result ; }
[ "public", "double", "repairSolutionVariableValue", "(", "double", "value", ",", "double", "lowerBound", ",", "double", "upperBound", ")", "{", "if", "(", "lowerBound", ">", "upperBound", ")", "{", "throw", "new", "JMetalException", "(", "\"The lower bound (\"", "+...
Checks if the value is between its bounds; if not, a random value between the limits is returned @param value The value to be checked @param lowerBound @param upperBound @return The same value if it is between the limits or a repaired value otherwise
[ "Checks", "if", "the", "value", "is", "between", "its", "bounds", ";", "if", "not", "a", "random", "value", "between", "the", "limits", "is", "returned" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/solution/util/RepairDoubleSolutionAtRandom.java#L35-L49
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.optionalDoubleAttribute
public static double optionalDoubleAttribute( final XMLStreamReader reader, final String localName, final double defaultValue) { return optionalDoubleAttribute(reader, null, localName, defaultValue); }
java
public static double optionalDoubleAttribute( final XMLStreamReader reader, final String localName, final double defaultValue) { return optionalDoubleAttribute(reader, null, localName, defaultValue); }
[ "public", "static", "double", "optionalDoubleAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ",", "final", "double", "defaultValue", ")", "{", "return", "optionalDoubleAttribute", "(", "reader", ",", "null", ",", "localNam...
Returns the value of an attribute as a double. If the attribute is empty, this method returns the default value provided. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @param defaultValue default value @return value of attribute, or the default value if the attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "double", ".", "If", "the", "attribute", "is", "empty", "this", "method", "returns", "the", "default", "value", "provided", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L707-L712
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/render/R.java
R.renderChildren
public static void renderChildren(FacesContext fc, UIComponent component) throws IOException { for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) { UIComponent child = (UIComponent) iterator.next(); renderChild(fc, child); } }
java
public static void renderChildren(FacesContext fc, UIComponent component) throws IOException { for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) { UIComponent child = (UIComponent) iterator.next(); renderChild(fc, child); } }
[ "public", "static", "void", "renderChildren", "(", "FacesContext", "fc", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "for", "(", "Iterator", "<", "UIComponent", ">", "iterator", "=", "component", ".", "getChildren", "(", ")", ".", "iter...
Renders the Childrens of a Component @param fc @param component @throws IOException
[ "Renders", "the", "Childrens", "of", "a", "Component" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L332-L337
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cart_cartId_GET
public OvhCart cart_cartId_GET(String cartId) throws IOException { String qPath = "/order/cart/{cartId}"; StringBuilder sb = path(qPath, cartId); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCart.class); }
java
public OvhCart cart_cartId_GET(String cartId) throws IOException { String qPath = "/order/cart/{cartId}"; StringBuilder sb = path(qPath, cartId); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCart.class); }
[ "public", "OvhCart", "cart_cartId_GET", "(", "String", "cartId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cart/{cartId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "cartId", ")", ";", "String", "resp", "=", "exec...
Retrieve information about a specific cart REST: GET /order/cart/{cartId} @param cartId [required] Cart identifier
[ "Retrieve", "information", "about", "a", "specific", "cart" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L8841-L8846
cdk/cdk
legacy/src/main/java/org/openscience/cdk/math/qm/OneElectronJob.java
OneElectronJob.calculateT
private Matrix calculateT(IBasis basis) { int size = basis.getSize(); Matrix J = new Matrix(size, size); int i, j; for (i = 0; i < size; i++) for (j = 0; j < size; j++) // (1/2) * -<d^2/dx^2 chi_i | chi_j> J.matrix[i][j] = basis.calcJ(j, i) / 2; // Attention indicies are exchanged return J; }
java
private Matrix calculateT(IBasis basis) { int size = basis.getSize(); Matrix J = new Matrix(size, size); int i, j; for (i = 0; i < size; i++) for (j = 0; j < size; j++) // (1/2) * -<d^2/dx^2 chi_i | chi_j> J.matrix[i][j] = basis.calcJ(j, i) / 2; // Attention indicies are exchanged return J; }
[ "private", "Matrix", "calculateT", "(", "IBasis", "basis", ")", "{", "int", "size", "=", "basis", ".", "getSize", "(", ")", ";", "Matrix", "J", "=", "new", "Matrix", "(", "size", ",", "size", ")", ";", "int", "i", ",", "j", ";", "for", "(", "i", ...
Calculates the matrix for the kinetic energy T_i,j = (1/2) * -<d^2/dx^2 chi_i | chi_j>
[ "Calculates", "the", "matrix", "for", "the", "kinetic", "energy" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/math/qm/OneElectronJob.java#L102-L112
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java
SqlBuilderHelper.generateLogForContentValuesContentProvider
public static void generateLogForContentValuesContentProvider(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { methodBuilder.addCode("\n// log for content values -- BEGIN\n"); methodBuilder.addStatement("Object _contentValue"); methodBuilder.beginControlFlow("for (String _contentKey:_contentValues.values().keySet())"); methodBuilder.addStatement("_contentValue=_contentValues.values().get(_contentKey)"); methodBuilder.beginControlFlow("if (_contentValue==null)"); methodBuilder.addStatement("$T.info(\"==> :%s = <null>\", _contentKey)", Logger.class); methodBuilder.nextControlFlow("else"); methodBuilder.addStatement("$T.info(\"==> :%s = '%s' (%s)\", _contentKey, $T.checkSize(_contentValue), _contentValue.getClass().getCanonicalName())", Logger.class, StringUtils.class); methodBuilder.endControlFlow(); methodBuilder.endControlFlow(); methodBuilder.addCode("// log for content values -- END\n"); }
java
public static void generateLogForContentValuesContentProvider(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { methodBuilder.addCode("\n// log for content values -- BEGIN\n"); methodBuilder.addStatement("Object _contentValue"); methodBuilder.beginControlFlow("for (String _contentKey:_contentValues.values().keySet())"); methodBuilder.addStatement("_contentValue=_contentValues.values().get(_contentKey)"); methodBuilder.beginControlFlow("if (_contentValue==null)"); methodBuilder.addStatement("$T.info(\"==> :%s = <null>\", _contentKey)", Logger.class); methodBuilder.nextControlFlow("else"); methodBuilder.addStatement("$T.info(\"==> :%s = '%s' (%s)\", _contentKey, $T.checkSize(_contentValue), _contentValue.getClass().getCanonicalName())", Logger.class, StringUtils.class); methodBuilder.endControlFlow(); methodBuilder.endControlFlow(); methodBuilder.addCode("// log for content values -- END\n"); }
[ "public", "static", "void", "generateLogForContentValuesContentProvider", "(", "SQLiteModelMethod", "method", ",", "MethodSpec", ".", "Builder", "methodBuilder", ")", "{", "methodBuilder", ".", "addCode", "(", "\"\\n// log for content values -- BEGIN\\n\"", ")", ";", "metho...
Generate log for content values content provider. @param method the method @param methodBuilder the method builder
[ "Generate", "log", "for", "content", "values", "content", "provider", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java#L753-L766
hawkular/hawkular-bus
hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java
MessageProcessor.setHeaders
protected void setHeaders(BasicMessage basicMessage, Map<String, String> headers, Message destination) throws JMSException { log.infof("Setting [%s] = [%s] on a message of type [%s]", MessageProcessor.HEADER_BASIC_MESSAGE_CLASS, basicMessage.getClass().getName(), destination.getClass().getName()); destination.setStringProperty(MessageProcessor.HEADER_BASIC_MESSAGE_CLASS, basicMessage.getClass().getName()); // if the basicMessage has headers, use those first Map<String, String> basicMessageHeaders = basicMessage.getHeaders(); if (basicMessageHeaders != null) { for (Map.Entry<String, String> entry : basicMessageHeaders.entrySet()) { destination.setStringProperty(entry.getKey(), entry.getValue()); } } // If we were given headers separately, add those now. // Notice these will override same-named headers that were found in the basic message itself. if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { destination.setStringProperty(entry.getKey(), entry.getValue()); } } }
java
protected void setHeaders(BasicMessage basicMessage, Map<String, String> headers, Message destination) throws JMSException { log.infof("Setting [%s] = [%s] on a message of type [%s]", MessageProcessor.HEADER_BASIC_MESSAGE_CLASS, basicMessage.getClass().getName(), destination.getClass().getName()); destination.setStringProperty(MessageProcessor.HEADER_BASIC_MESSAGE_CLASS, basicMessage.getClass().getName()); // if the basicMessage has headers, use those first Map<String, String> basicMessageHeaders = basicMessage.getHeaders(); if (basicMessageHeaders != null) { for (Map.Entry<String, String> entry : basicMessageHeaders.entrySet()) { destination.setStringProperty(entry.getKey(), entry.getValue()); } } // If we were given headers separately, add those now. // Notice these will override same-named headers that were found in the basic message itself. if (headers != null) { for (Map.Entry<String, String> entry : headers.entrySet()) { destination.setStringProperty(entry.getKey(), entry.getValue()); } } }
[ "protected", "void", "setHeaders", "(", "BasicMessage", "basicMessage", ",", "Map", "<", "String", ",", "String", ">", "headers", ",", "Message", "destination", ")", "throws", "JMSException", "{", "log", ".", "infof", "(", "\"Setting [%s] = [%s] on a message of type...
First sets the {@link MessageProcessor#HEADER_BASIC_MESSAGE_CLASS} string property of {@code destination} to {@code basicMessage.getClass().getName()}, then copies all headers from {@code basicMessage.getHeaders()} to {@code destination} using {@link Message#setStringProperty(String, String)} and then does the same thing with the supplied {@code headers}. @param basicMessage the {@link BasicMessage} to copy headers from @param headers the headers to copy to {@code destination} @param destination the {@link Message} to copy the headers to @throws JMSException
[ "First", "sets", "the", "{", "@link", "MessageProcessor#HEADER_BASIC_MESSAGE_CLASS", "}", "string", "property", "of", "{", "@code", "destination", "}", "to", "{", "@code", "basicMessage", ".", "getClass", "()", ".", "getName", "()", "}", "then", "copies", "all",...
train
https://github.com/hawkular/hawkular-bus/blob/28d6b58bec81a50f8344d39f309b6971271ae627/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L392-L413
JodaOrg/joda-money
src/main/java/org/joda/money/Money.java
Money.convertedTo
public Money convertedTo(CurrencyUnit currency, BigDecimal conversionMultipler, RoundingMode roundingMode) { return with(money.convertedTo(currency, conversionMultipler).withCurrencyScale(roundingMode)); }
java
public Money convertedTo(CurrencyUnit currency, BigDecimal conversionMultipler, RoundingMode roundingMode) { return with(money.convertedTo(currency, conversionMultipler).withCurrencyScale(roundingMode)); }
[ "public", "Money", "convertedTo", "(", "CurrencyUnit", "currency", ",", "BigDecimal", "conversionMultipler", ",", "RoundingMode", "roundingMode", ")", "{", "return", "with", "(", "money", ".", "convertedTo", "(", "currency", ",", "conversionMultipler", ")", ".", "...
Returns a copy of this monetary value converted into another currency using the specified conversion rate, with a rounding mode used to adjust the decimal places in the result. <p> This instance is immutable and unaffected by this method. @param currency the new currency, not null @param conversionMultipler the conversion factor between the currencies, not null @param roundingMode the rounding mode to use to bring the decimal places back in line, not null @return the new multiplied instance, never null @throws IllegalArgumentException if the currency is the same as this currency @throws IllegalArgumentException if the conversion multiplier is negative @throws ArithmeticException if the rounding fails
[ "Returns", "a", "copy", "of", "this", "monetary", "value", "converted", "into", "another", "currency", "using", "the", "specified", "conversion", "rate", "with", "a", "rounding", "mode", "used", "to", "adjust", "the", "decimal", "places", "in", "the", "result"...
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L1185-L1187
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addDescription
protected void addDescription(ModuleElement mdle, Content dlTree, SearchIndexItem si) { String moduleName = utils.getFullyQualifiedName(mdle); Content link = getModuleLink(mdle, new StringContent(moduleName)); si.setLabel(moduleName); si.setCategory(resources.getText("doclet.Modules")); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(contents.module_); dt.addContent(" " + moduleName); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(mdle, dd); dlTree.addContent(dd); }
java
protected void addDescription(ModuleElement mdle, Content dlTree, SearchIndexItem si) { String moduleName = utils.getFullyQualifiedName(mdle); Content link = getModuleLink(mdle, new StringContent(moduleName)); si.setLabel(moduleName); si.setCategory(resources.getText("doclet.Modules")); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(contents.module_); dt.addContent(" " + moduleName); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(mdle, dd); dlTree.addContent(dd); }
[ "protected", "void", "addDescription", "(", "ModuleElement", "mdle", ",", "Content", "dlTree", ",", "SearchIndexItem", "si", ")", "{", "String", "moduleName", "=", "utils", ".", "getFullyQualifiedName", "(", "mdle", ")", ";", "Content", "link", "=", "getModuleLi...
Add one line summary comment for the module. @param mdle the module to be documented @param dlTree the content tree to which the description will be added
[ "Add", "one", "line", "summary", "comment", "for", "the", "module", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L226-L239
jenkinsci/jenkins
core/src/main/java/hudson/model/Descriptor.java
Descriptor.findByClassName
private static @CheckForNull <T extends Descriptor> T findByClassName(Collection<? extends T> list, String className) { for (T d : list) { if(d.getClass().getName().equals(className)) return d; } return null; }
java
private static @CheckForNull <T extends Descriptor> T findByClassName(Collection<? extends T> list, String className) { for (T d : list) { if(d.getClass().getName().equals(className)) return d; } return null; }
[ "private", "static", "@", "CheckForNull", "<", "T", "extends", "Descriptor", ">", "T", "findByClassName", "(", "Collection", "<", "?", "extends", "T", ">", "list", ",", "String", "className", ")", "{", "for", "(", "T", "d", ":", "list", ")", "{", "if",...
Finds a descriptor from a collection by the class name of the {@link Descriptor}. This is useless as of the introduction of {@link #getId} and so only very old compatibility code needs it.
[ "Finds", "a", "descriptor", "from", "a", "collection", "by", "the", "class", "name", "of", "the", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L1086-L1092
lviggiano/owner
owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java
PropertiesFileCreator.parseMethods
private Group[] parseMethods(Class clazz) { List<Group> groups = new ArrayList(); Group unknownGroup = new Group(); groups.add(unknownGroup); String[] groupsOrder = new String[0]; for (Method method : clazz.getMethods()) { Property prop = new Property(); prop.deprecated = method.isAnnotationPresent(Deprecated.class); if (method.isAnnotationPresent(Key.class)) { Key val = method.getAnnotation(Key.class); prop.name = val.value(); } else { prop.name = method.getName(); } if (method.isAnnotationPresent(DefaultValue.class)) { DefaultValue val = method.getAnnotation(DefaultValue.class); prop.defaultValue = val.value(); } unknownGroup.properties.add(prop); } return orderGroup(groups, groupsOrder); }
java
private Group[] parseMethods(Class clazz) { List<Group> groups = new ArrayList(); Group unknownGroup = new Group(); groups.add(unknownGroup); String[] groupsOrder = new String[0]; for (Method method : clazz.getMethods()) { Property prop = new Property(); prop.deprecated = method.isAnnotationPresent(Deprecated.class); if (method.isAnnotationPresent(Key.class)) { Key val = method.getAnnotation(Key.class); prop.name = val.value(); } else { prop.name = method.getName(); } if (method.isAnnotationPresent(DefaultValue.class)) { DefaultValue val = method.getAnnotation(DefaultValue.class); prop.defaultValue = val.value(); } unknownGroup.properties.add(prop); } return orderGroup(groups, groupsOrder); }
[ "private", "Group", "[", "]", "parseMethods", "(", "Class", "clazz", ")", "{", "List", "<", "Group", ">", "groups", "=", "new", "ArrayList", "(", ")", ";", "Group", "unknownGroup", "=", "new", "Group", "(", ")", ";", "groups", ".", "add", "(", "unkno...
Method to get group array with subgroups and properties. @param clazz class to parse @return array of groups
[ "Method", "to", "get", "group", "array", "with", "subgroups", "and", "properties", "." ]
train
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java#L65-L92
lets-blade/blade
src/main/java/com/blade/kit/DateKit.java
DateKit.toUnix
public static int toUnix(String time, String pattern) { LocalDateTime formatted = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern)); return (int) formatted.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond(); }
java
public static int toUnix(String time, String pattern) { LocalDateTime formatted = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern)); return (int) formatted.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond(); }
[ "public", "static", "int", "toUnix", "(", "String", "time", ",", "String", "pattern", ")", "{", "LocalDateTime", "formatted", "=", "LocalDateTime", ".", "parse", "(", "time", ",", "DateTimeFormatter", ".", "ofPattern", "(", "pattern", ")", ")", ";", "return"...
format string time to unix time @param time string date @param pattern date format pattern @return return unix time
[ "format", "string", "time", "to", "unix", "time" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/DateKit.java#L98-L101
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java
AbstractCreator.methodCallParametersCode
private CodeBlock methodCallParametersCode( CodeBlock.Builder builder, List<CodeBlock> parameters ) { if ( parameters.isEmpty() ) { return builder.add( "()" ).build(); } builder.add( "(" ); Iterator<CodeBlock> iterator = parameters.iterator(); builder.add( iterator.next() ); while ( iterator.hasNext() ) { builder.add( ", " ); builder.add( iterator.next() ); } builder.add( ")" ); return builder.build(); }
java
private CodeBlock methodCallParametersCode( CodeBlock.Builder builder, List<CodeBlock> parameters ) { if ( parameters.isEmpty() ) { return builder.add( "()" ).build(); } builder.add( "(" ); Iterator<CodeBlock> iterator = parameters.iterator(); builder.add( iterator.next() ); while ( iterator.hasNext() ) { builder.add( ", " ); builder.add( iterator.next() ); } builder.add( ")" ); return builder.build(); }
[ "private", "CodeBlock", "methodCallParametersCode", "(", "CodeBlock", ".", "Builder", "builder", ",", "List", "<", "CodeBlock", ">", "parameters", ")", "{", "if", "(", "parameters", ".", "isEmpty", "(", ")", ")", "{", "return", "builder", ".", "add", "(", ...
Build the code for the parameters of a method call. @param builder the code builder @param parameters the parameters @return the code
[ "Build", "the", "code", "for", "the", "parameters", "of", "a", "method", "call", "." ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java#L969-L986
restfb/restfb
src/main/java/com/restfb/util/ReflectionUtils.java
ReflectionUtils.findMethodsWithAnnotation
public static <T extends Annotation> List<Method> findMethodsWithAnnotation(Class<?> type, Class<T> annotationType) { ClassAnnotationCacheKey cacheKey = new ClassAnnotationCacheKey(type, annotationType); List<Method> cachedResults = METHODS_WITH_ANNOTATION_CACHE.get(cacheKey); if (cachedResults != null) { return cachedResults; } List<Method> methodsWithAnnotation = new ArrayList<>(); // Walk all superclasses looking for annotated methods until we hit Object while (!Object.class.equals(type)) { for (Method method : type.getDeclaredMethods()) { T annotation = method.getAnnotation(annotationType); if (annotation != null) { methodsWithAnnotation.add(method); } } type = type.getSuperclass(); } methodsWithAnnotation = unmodifiableList(methodsWithAnnotation); METHODS_WITH_ANNOTATION_CACHE.put(cacheKey, methodsWithAnnotation); return methodsWithAnnotation; }
java
public static <T extends Annotation> List<Method> findMethodsWithAnnotation(Class<?> type, Class<T> annotationType) { ClassAnnotationCacheKey cacheKey = new ClassAnnotationCacheKey(type, annotationType); List<Method> cachedResults = METHODS_WITH_ANNOTATION_CACHE.get(cacheKey); if (cachedResults != null) { return cachedResults; } List<Method> methodsWithAnnotation = new ArrayList<>(); // Walk all superclasses looking for annotated methods until we hit Object while (!Object.class.equals(type)) { for (Method method : type.getDeclaredMethods()) { T annotation = method.getAnnotation(annotationType); if (annotation != null) { methodsWithAnnotation.add(method); } } type = type.getSuperclass(); } methodsWithAnnotation = unmodifiableList(methodsWithAnnotation); METHODS_WITH_ANNOTATION_CACHE.put(cacheKey, methodsWithAnnotation); return methodsWithAnnotation; }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "List", "<", "Method", ">", "findMethodsWithAnnotation", "(", "Class", "<", "?", ">", "type", ",", "Class", "<", "T", ">", "annotationType", ")", "{", "ClassAnnotationCacheKey", "cacheKey", "=", "ne...
Finds methods on the given {@code type} and all of its superclasses annotated with annotations of type {@code annotationType}. <p> These results are cached to mitigate performance overhead. @param <T> The annotation type. @param type The target type token. @param annotationType The annotation type token. @return A list of methods with the given annotation. @since 1.6.11
[ "Finds", "methods", "on", "the", "given", "{", "@code", "type", "}", "and", "all", "of", "its", "superclasses", "annotated", "with", "annotations", "of", "type", "{", "@code", "annotationType", "}", ".", "<p", ">", "These", "results", "are", "cached", "to"...
train
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/ReflectionUtils.java#L143-L169
languagetool-org/languagetool
languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java
Tools.openDirectoryDialog
static File openDirectoryDialog(Frame frame, File initialDir) { return openFileDialog(frame, null, initialDir, JFileChooser.DIRECTORIES_ONLY); }
java
static File openDirectoryDialog(Frame frame, File initialDir) { return openFileDialog(frame, null, initialDir, JFileChooser.DIRECTORIES_ONLY); }
[ "static", "File", "openDirectoryDialog", "(", "Frame", "frame", ",", "File", "initialDir", ")", "{", "return", "openFileDialog", "(", "frame", ",", "null", ",", "initialDir", ",", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "}" ]
Show a directory chooser dialog, starting with a specified directory @param frame Owner frame @param initialDir The initial directory @return the selected file @since 3.0
[ "Show", "a", "directory", "chooser", "dialog", "starting", "with", "a", "specified", "directory" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-gui-commons/src/main/java/org/languagetool/gui/Tools.java#L80-L82
graknlabs/grakn
server/src/server/exception/TransactionException.java
TransactionException.immutableProperty
public static TransactionException immutableProperty(Object oldValue, Object newValue, Enum vertexProperty) { return create(ErrorMessage.IMMUTABLE_VALUE.getMessage(oldValue, newValue, vertexProperty.name())); }
java
public static TransactionException immutableProperty(Object oldValue, Object newValue, Enum vertexProperty) { return create(ErrorMessage.IMMUTABLE_VALUE.getMessage(oldValue, newValue, vertexProperty.name())); }
[ "public", "static", "TransactionException", "immutableProperty", "(", "Object", "oldValue", ",", "Object", "newValue", ",", "Enum", "vertexProperty", ")", "{", "return", "create", "(", "ErrorMessage", ".", "IMMUTABLE_VALUE", ".", "getMessage", "(", "oldValue", ",", ...
Thrown when attempting to mutate a property which is immutable
[ "Thrown", "when", "attempting", "to", "mutate", "a", "property", "which", "is", "immutable" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L173-L175