repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
threerings/nenya
core/src/main/java/com/threerings/miso/util/MisoUtil.java
MisoUtil.getMultiTilePolygon
public static Polygon getMultiTilePolygon (MisoSceneMetrics metrics, Point sp1, Point sp2) { """ Return a screen-coordinates polygon framing the two specified tile-coordinate points. """ int x = Math.min(sp1.x, sp2.x), y = Math.min(sp1.y, sp2.y); int width = Math.abs(sp1.x-sp2.x)+1, height = Math.abs(sp1.y-sp2.y)+1; return getFootprintPolygon(metrics, x, y, width, height); }
java
public static Polygon getMultiTilePolygon (MisoSceneMetrics metrics, Point sp1, Point sp2) { int x = Math.min(sp1.x, sp2.x), y = Math.min(sp1.y, sp2.y); int width = Math.abs(sp1.x-sp2.x)+1, height = Math.abs(sp1.y-sp2.y)+1; return getFootprintPolygon(metrics, x, y, width, height); }
[ "public", "static", "Polygon", "getMultiTilePolygon", "(", "MisoSceneMetrics", "metrics", ",", "Point", "sp1", ",", "Point", "sp2", ")", "{", "int", "x", "=", "Math", ".", "min", "(", "sp1", ".", "x", ",", "sp2", ".", "x", ")", ",", "y", "=", "Math", ".", "min", "(", "sp1", ".", "y", ",", "sp2", ".", "y", ")", ";", "int", "width", "=", "Math", ".", "abs", "(", "sp1", ".", "x", "-", "sp2", ".", "x", ")", "+", "1", ",", "height", "=", "Math", ".", "abs", "(", "sp1", ".", "y", "-", "sp2", ".", "y", ")", "+", "1", ";", "return", "getFootprintPolygon", "(", "metrics", ",", "x", ",", "y", ",", "width", ",", "height", ")", ";", "}" ]
Return a screen-coordinates polygon framing the two specified tile-coordinate points.
[ "Return", "a", "screen", "-", "coordinates", "polygon", "framing", "the", "two", "specified", "tile", "-", "coordinate", "points", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/util/MisoUtil.java#L417-L423
jbundle/jbundle
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseGridScreen.java
HBaseGridScreen.printStartRecordGridData
public void printStartRecordGridData(PrintWriter out, int iPrintOptions) { """ Display the start grid in input format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception. """ if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN) { out.println("<tr>\n<td colspan=\"20\">"); } out.println("<table border=\"1\">"); }
java
public void printStartRecordGridData(PrintWriter out, int iPrintOptions) { if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN) { out.println("<tr>\n<td colspan=\"20\">"); } out.println("<table border=\"1\">"); }
[ "public", "void", "printStartRecordGridData", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "if", "(", "(", "iPrintOptions", "&", "HtmlConstants", ".", "DETAIL_SCREEN", ")", "==", "HtmlConstants", ".", "DETAIL_SCREEN", ")", "{", "out", ".", "println", "(", "\"<tr>\\n<td colspan=\\\"20\\\">\"", ")", ";", "}", "out", ".", "println", "(", "\"<table border=\\\"1\\\">\"", ")", ";", "}" ]
Display the start grid in input format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception.
[ "Display", "the", "start", "grid", "in", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseGridScreen.java#L161-L168
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/version/Application.java
Application.getApplicationFromJarFile
public static Application getApplicationFromJarFile(final File _jarFile, final List<String> _classpath) throws InstallationException { """ Returns the application read from given JAR file <code>_jarFile</code>. @param _jarFile JAR file with the application to install @param _classpath class path (required to compile) @return application instance @throws InstallationException if application could not be fetched from the JAR file or the version XML file could not be parsed """ try { final URL url = new URL("jar", null, 0, _jarFile.toURI().toURL().toString() + "!/"); final URL url2 = new URL(url, "/META-INF/efaps/install.xml"); return Application.getApplication(url2, new URL(url2, "../../../"), _classpath); } catch (final IOException e) { throw new InstallationException("URL could not be parsed", e); } }
java
public static Application getApplicationFromJarFile(final File _jarFile, final List<String> _classpath) throws InstallationException { try { final URL url = new URL("jar", null, 0, _jarFile.toURI().toURL().toString() + "!/"); final URL url2 = new URL(url, "/META-INF/efaps/install.xml"); return Application.getApplication(url2, new URL(url2, "../../../"), _classpath); } catch (final IOException e) { throw new InstallationException("URL could not be parsed", e); } }
[ "public", "static", "Application", "getApplicationFromJarFile", "(", "final", "File", "_jarFile", ",", "final", "List", "<", "String", ">", "_classpath", ")", "throws", "InstallationException", "{", "try", "{", "final", "URL", "url", "=", "new", "URL", "(", "\"jar\"", ",", "null", ",", "0", ",", "_jarFile", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ".", "toString", "(", ")", "+", "\"!/\"", ")", ";", "final", "URL", "url2", "=", "new", "URL", "(", "url", ",", "\"/META-INF/efaps/install.xml\"", ")", ";", "return", "Application", ".", "getApplication", "(", "url2", ",", "new", "URL", "(", "url2", ",", "\"../../../\"", ")", ",", "_classpath", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "InstallationException", "(", "\"URL could not be parsed\"", ",", "e", ")", ";", "}", "}" ]
Returns the application read from given JAR file <code>_jarFile</code>. @param _jarFile JAR file with the application to install @param _classpath class path (required to compile) @return application instance @throws InstallationException if application could not be fetched from the JAR file or the version XML file could not be parsed
[ "Returns", "the", "application", "read", "from", "given", "JAR", "file", "<code", ">", "_jarFile<", "/", "code", ">", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/version/Application.java#L421-L432
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.get
public static Call get(final String callId) throws Exception { """ Factory method for Call, returns information about an active or completed call. @param callId call id @return the call @throws IOException unexpected error. """ final BandwidthClient client = BandwidthClient.getInstance(); return get(client, callId); }
java
public static Call get(final String callId) throws Exception { final BandwidthClient client = BandwidthClient.getInstance(); return get(client, callId); }
[ "public", "static", "Call", "get", "(", "final", "String", "callId", ")", "throws", "Exception", "{", "final", "BandwidthClient", "client", "=", "BandwidthClient", ".", "getInstance", "(", ")", ";", "return", "get", "(", "client", ",", "callId", ")", ";", "}" ]
Factory method for Call, returns information about an active or completed call. @param callId call id @return the call @throws IOException unexpected error.
[ "Factory", "method", "for", "Call", "returns", "information", "about", "an", "active", "or", "completed", "call", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L30-L35
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/system/SystemProperties.java
SystemProperties.setPropertyValue
@Nonnull public static EChange setPropertyValue (@Nonnull final String sKey, final int nValue) { """ Set a system property value under consideration of an eventually present {@link SecurityManager}. @param sKey The key of the system property. May not be <code>null</code>. @param nValue The value of the system property. @since 8.5.7 @return {@link EChange} """ return setPropertyValue (sKey, Integer.toString (nValue)); }
java
@Nonnull public static EChange setPropertyValue (@Nonnull final String sKey, final int nValue) { return setPropertyValue (sKey, Integer.toString (nValue)); }
[ "@", "Nonnull", "public", "static", "EChange", "setPropertyValue", "(", "@", "Nonnull", "final", "String", "sKey", ",", "final", "int", "nValue", ")", "{", "return", "setPropertyValue", "(", "sKey", ",", "Integer", ".", "toString", "(", "nValue", ")", ")", ";", "}" ]
Set a system property value under consideration of an eventually present {@link SecurityManager}. @param sKey The key of the system property. May not be <code>null</code>. @param nValue The value of the system property. @since 8.5.7 @return {@link EChange}
[ "Set", "a", "system", "property", "value", "under", "consideration", "of", "an", "eventually", "present", "{", "@link", "SecurityManager", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/system/SystemProperties.java#L162-L166
logic-ng/LogicNG
src/main/java/org/logicng/collections/LNGVector.java
LNGVector.selectionSort
private void selectionSort(final T[] array, int start, int end, Comparator<T> lt) { """ Selection sort implementation for a given array. @param array the array @param start the start index for sorting @param end the end index for sorting @param lt the comparator for elements of the array """ int i; int j; int bestI; T tmp; for (i = start; i < end; i++) { bestI = i; for (j = i + 1; j < end; j++) { if (lt.compare(array[j], array[bestI]) < 0) bestI = j; } tmp = array[i]; array[i] = array[bestI]; array[bestI] = tmp; } }
java
private void selectionSort(final T[] array, int start, int end, Comparator<T> lt) { int i; int j; int bestI; T tmp; for (i = start; i < end; i++) { bestI = i; for (j = i + 1; j < end; j++) { if (lt.compare(array[j], array[bestI]) < 0) bestI = j; } tmp = array[i]; array[i] = array[bestI]; array[bestI] = tmp; } }
[ "private", "void", "selectionSort", "(", "final", "T", "[", "]", "array", ",", "int", "start", ",", "int", "end", ",", "Comparator", "<", "T", ">", "lt", ")", "{", "int", "i", ";", "int", "j", ";", "int", "bestI", ";", "T", "tmp", ";", "for", "(", "i", "=", "start", ";", "i", "<", "end", ";", "i", "++", ")", "{", "bestI", "=", "i", ";", "for", "(", "j", "=", "i", "+", "1", ";", "j", "<", "end", ";", "j", "++", ")", "{", "if", "(", "lt", ".", "compare", "(", "array", "[", "j", "]", ",", "array", "[", "bestI", "]", ")", "<", "0", ")", "bestI", "=", "j", ";", "}", "tmp", "=", "array", "[", "i", "]", ";", "array", "[", "i", "]", "=", "array", "[", "bestI", "]", ";", "array", "[", "bestI", "]", "=", "tmp", ";", "}", "}" ]
Selection sort implementation for a given array. @param array the array @param start the start index for sorting @param end the end index for sorting @param lt the comparator for elements of the array
[ "Selection", "sort", "implementation", "for", "a", "given", "array", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/LNGVector.java#L288-L303
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java
WebConfigParamUtils.getLongInitParameter
public static long getLongInitParameter(ExternalContext context, String name, long defaultValue) { """ Gets the long init parameter value from the specified context. If the parameter was not specified, the default value is used instead. @param context the application's external context @param name the init parameter's name @param deprecatedName the init parameter's deprecated name. @param defaultValue the default value to return in case the parameter was not set @return the init parameter value as a long @throws NullPointerException if context or name is <code>null</code> """ if (name == null) { throw new NullPointerException(); } String param = getStringInitParameter(context, name); if (param == null) { return defaultValue; } else { return Long.parseLong(param.toLowerCase()); } }
java
public static long getLongInitParameter(ExternalContext context, String name, long defaultValue) { if (name == null) { throw new NullPointerException(); } String param = getStringInitParameter(context, name); if (param == null) { return defaultValue; } else { return Long.parseLong(param.toLowerCase()); } }
[ "public", "static", "long", "getLongInitParameter", "(", "ExternalContext", "context", ",", "String", "name", ",", "long", "defaultValue", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "String", "param", "=", "getStringInitParameter", "(", "context", ",", "name", ")", ";", "if", "(", "param", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "else", "{", "return", "Long", ".", "parseLong", "(", "param", ".", "toLowerCase", "(", ")", ")", ";", "}", "}" ]
Gets the long init parameter value from the specified context. If the parameter was not specified, the default value is used instead. @param context the application's external context @param name the init parameter's name @param deprecatedName the init parameter's deprecated name. @param defaultValue the default value to return in case the parameter was not set @return the init parameter value as a long @throws NullPointerException if context or name is <code>null</code>
[ "Gets", "the", "long", "init", "parameter", "value", "from", "the", "specified", "context", ".", "If", "the", "parameter", "was", "not", "specified", "the", "default", "value", "is", "used", "instead", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L583-L599
arquillian/arquillian-cube
core/src/main/java/org/arquillian/cube/impl/util/ConfigUtil.java
ConfigUtil.getStringProperty
public static String getStringProperty(String name, String alternativeName, Map<String, String> map, String defaultValue) { """ Gets a property from system, environment or an external map. This method supports also passing an alternative name. The reason for supporting multiple names, is to support multiple keys for the same property (e.g. adding a new and deprecating the old). The lookup order is system[name] > env[name] > map[name] > system[alternativeName] > env[alternativeName] > map[alternativeName] > defaultValue. @param name The name of the property. @param alternativeName An alternate name to use. @param map The external map. @param defaultValue The value that should be used if property is not found. """ return getStringProperty(name, map, getStringProperty(alternativeName, map, defaultValue)); }
java
public static String getStringProperty(String name, String alternativeName, Map<String, String> map, String defaultValue) { return getStringProperty(name, map, getStringProperty(alternativeName, map, defaultValue)); }
[ "public", "static", "String", "getStringProperty", "(", "String", "name", ",", "String", "alternativeName", ",", "Map", "<", "String", ",", "String", ">", "map", ",", "String", "defaultValue", ")", "{", "return", "getStringProperty", "(", "name", ",", "map", ",", "getStringProperty", "(", "alternativeName", ",", "map", ",", "defaultValue", ")", ")", ";", "}" ]
Gets a property from system, environment or an external map. This method supports also passing an alternative name. The reason for supporting multiple names, is to support multiple keys for the same property (e.g. adding a new and deprecating the old). The lookup order is system[name] > env[name] > map[name] > system[alternativeName] > env[alternativeName] > map[alternativeName] > defaultValue. @param name The name of the property. @param alternativeName An alternate name to use. @param map The external map. @param defaultValue The value that should be used if property is not found.
[ "Gets", "a", "property", "from", "system", "environment", "or", "an", "external", "map", ".", "This", "method", "supports", "also", "passing", "an", "alternative", "name", ".", "The", "reason", "for", "supporting", "multiple", "names", "is", "to", "support", "multiple", "keys", "for", "the", "same", "property", "(", "e", ".", "g", ".", "adding", "a", "new", "and", "deprecating", "the", "old", ")", ".", "The", "lookup", "order", "is", "system", "[", "name", "]", ">", "env", "[", "name", "]", ">", "map", "[", "name", "]", ">", "system", "[", "alternativeName", "]", ">", "env", "[", "alternativeName", "]", ">", "map", "[", "alternativeName", "]", ">", "defaultValue", "." ]
train
https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/core/src/main/java/org/arquillian/cube/impl/util/ConfigUtil.java#L49-L52
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java
BoofConcurrency.loopBlocks
public static void loopBlocks(int start , int endExclusive , IntRangeConsumer consumer ) { """ Splits the range of values up into blocks. It's assumed the cost to process a block is small so more can be created. @param start First index, inclusive @param endExclusive Last index, exclusive @param consumer The consumer """ final ForkJoinPool pool = BoofConcurrency.pool; int numThreads = pool.getParallelism(); int range = endExclusive-start; if( range == 0 ) // nothing to do here! return; if( range < 0 ) throw new IllegalArgumentException("end must be more than start. "+start+" -> "+endExclusive); // Did some experimentation here. Gave it more threads than were needed or exactly what was needed // exactly seemed to do better in the test cases int blockSize = Math.max(1,range/numThreads); try { pool.submit(new IntRangeTask(start,endExclusive,blockSize,consumer)).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }
java
public static void loopBlocks(int start , int endExclusive , IntRangeConsumer consumer ) { final ForkJoinPool pool = BoofConcurrency.pool; int numThreads = pool.getParallelism(); int range = endExclusive-start; if( range == 0 ) // nothing to do here! return; if( range < 0 ) throw new IllegalArgumentException("end must be more than start. "+start+" -> "+endExclusive); // Did some experimentation here. Gave it more threads than were needed or exactly what was needed // exactly seemed to do better in the test cases int blockSize = Math.max(1,range/numThreads); try { pool.submit(new IntRangeTask(start,endExclusive,blockSize,consumer)).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "loopBlocks", "(", "int", "start", ",", "int", "endExclusive", ",", "IntRangeConsumer", "consumer", ")", "{", "final", "ForkJoinPool", "pool", "=", "BoofConcurrency", ".", "pool", ";", "int", "numThreads", "=", "pool", ".", "getParallelism", "(", ")", ";", "int", "range", "=", "endExclusive", "-", "start", ";", "if", "(", "range", "==", "0", ")", "// nothing to do here!", "return", ";", "if", "(", "range", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"end must be more than start. \"", "+", "start", "+", "\" -> \"", "+", "endExclusive", ")", ";", "// Did some experimentation here. Gave it more threads than were needed or exactly what was needed", "// exactly seemed to do better in the test cases", "int", "blockSize", "=", "Math", ".", "max", "(", "1", ",", "range", "/", "numThreads", ")", ";", "try", "{", "pool", ".", "submit", "(", "new", "IntRangeTask", "(", "start", ",", "endExclusive", ",", "blockSize", ",", "consumer", ")", ")", ".", "get", "(", ")", ";", "}", "catch", "(", "InterruptedException", "|", "ExecutionException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Splits the range of values up into blocks. It's assumed the cost to process a block is small so more can be created. @param start First index, inclusive @param endExclusive Last index, exclusive @param consumer The consumer
[ "Splits", "the", "range", "of", "values", "up", "into", "blocks", ".", "It", "s", "assumed", "the", "cost", "to", "process", "a", "block", "is", "small", "so", "more", "can", "be", "created", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java#L136-L155
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GroupApi.java
GroupApi.addMember
public Member addMember(Object groupIdOrPath, Integer userId, Integer accessLevel, Date expiresAt) throws GitLabApiException { """ Adds a user to the list of group members. <pre><code>GitLab Endpoint: POST /groups/:id/members</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required @param userId the user ID of the member to add, required @param accessLevel the access level for the new member, required @param expiresAt the date the membership in the group will expire, optional @return a Member instance for the added user @throws GitLabApiException if any exception occurs """ GitLabApiForm formData = new GitLabApiForm() .withParam("user_id", userId, true) .withParam("access_level", accessLevel, true) .withParam("expires_at", expiresAt, false); Response response = post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "members"); return (response.readEntity(Member.class)); }
java
public Member addMember(Object groupIdOrPath, Integer userId, Integer accessLevel, Date expiresAt) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("user_id", userId, true) .withParam("access_level", accessLevel, true) .withParam("expires_at", expiresAt, false); Response response = post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "members"); return (response.readEntity(Member.class)); }
[ "public", "Member", "addMember", "(", "Object", "groupIdOrPath", ",", "Integer", "userId", ",", "Integer", "accessLevel", ",", "Date", "expiresAt", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"user_id\"", ",", "userId", ",", "true", ")", ".", "withParam", "(", "\"access_level\"", ",", "accessLevel", ",", "true", ")", ".", "withParam", "(", "\"expires_at\"", ",", "expiresAt", ",", "false", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"groups\"", ",", "getGroupIdOrPath", "(", "groupIdOrPath", ")", ",", "\"members\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Member", ".", "class", ")", ")", ";", "}" ]
Adds a user to the list of group members. <pre><code>GitLab Endpoint: POST /groups/:id/members</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required @param userId the user ID of the member to add, required @param accessLevel the access level for the new member, required @param expiresAt the date the membership in the group will expire, optional @return a Member instance for the added user @throws GitLabApiException if any exception occurs
[ "Adds", "a", "user", "to", "the", "list", "of", "group", "members", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GroupApi.java#L811-L819
lucee/Lucee
core/src/main/java/lucee/runtime/converter/JSONConverter.java
JSONConverter._serializeDateTime
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) { """ serialize a DateTime @param dateTime DateTime to serialize @param sb @throws ConverterException """ sb.append(StringUtil.escapeJS(JSONDateFormat.format(dateTime, null), '"', charsetEncoder)); /* * try { sb.append(goIn()); sb.append("createDateTime("); * sb.append(DateFormat.call(null,dateTime,"yyyy,m,d")); sb.append(' '); * sb.append(TimeFormat.call(null,dateTime,"HH:mm:ss")); sb.append(')'); } catch (PageException e) { * throw new ConverterException(e); } */ // Januar, 01 2000 01:01:01 }
java
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) { sb.append(StringUtil.escapeJS(JSONDateFormat.format(dateTime, null), '"', charsetEncoder)); /* * try { sb.append(goIn()); sb.append("createDateTime("); * sb.append(DateFormat.call(null,dateTime,"yyyy,m,d")); sb.append(' '); * sb.append(TimeFormat.call(null,dateTime,"HH:mm:ss")); sb.append(')'); } catch (PageException e) { * throw new ConverterException(e); } */ // Januar, 01 2000 01:01:01 }
[ "private", "void", "_serializeDateTime", "(", "DateTime", "dateTime", ",", "StringBuilder", "sb", ")", "{", "sb", ".", "append", "(", "StringUtil", ".", "escapeJS", "(", "JSONDateFormat", ".", "format", "(", "dateTime", ",", "null", ")", ",", "'", "'", ",", "charsetEncoder", ")", ")", ";", "/*\n\t * try { sb.append(goIn()); sb.append(\"createDateTime(\");\n\t * sb.append(DateFormat.call(null,dateTime,\"yyyy,m,d\")); sb.append(' ');\n\t * sb.append(TimeFormat.call(null,dateTime,\"HH:mm:ss\")); sb.append(')'); } catch (PageException e) {\n\t * throw new ConverterException(e); }\n\t */", "// Januar, 01 2000 01:01:01", "}" ]
serialize a DateTime @param dateTime DateTime to serialize @param sb @throws ConverterException
[ "serialize", "a", "DateTime" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/JSONConverter.java#L179-L190
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/StatsOptions.java
StatsOptions.addField
public FieldStatsOptions addField(Field field) { """ Adds a field to the statistics to be requested. @param field @return """ Assert.notNull(field, "Field for statistics must not be 'null'."); state.fields.add(field); return new FieldStatsOptions(field, state); }
java
public FieldStatsOptions addField(Field field) { Assert.notNull(field, "Field for statistics must not be 'null'."); state.fields.add(field); return new FieldStatsOptions(field, state); }
[ "public", "FieldStatsOptions", "addField", "(", "Field", "field", ")", "{", "Assert", ".", "notNull", "(", "field", ",", "\"Field for statistics must not be 'null'.\"", ")", ";", "state", ".", "fields", ".", "add", "(", "field", ")", ";", "return", "new", "FieldStatsOptions", "(", "field", ",", "state", ")", ";", "}" ]
Adds a field to the statistics to be requested. @param field @return
[ "Adds", "a", "field", "to", "the", "statistics", "to", "be", "requested", "." ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/StatsOptions.java#L53-L59
wildfly-extras/wildfly-camel
subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java
CamelEndpointDeployerService.deploy
public void deploy(URI uri, EndpointHttpHandler endpointHttpHandler) { """ Exposes an HTTP endpoint defined by the given {@link EndpointHttpHandler} under the given {@link URI}'s path. @param uri determines the path and protocol under which the HTTP endpoint should be exposed @param endpointHttpHandler an {@link EndpointHttpHandler} to use for handling HTTP requests sent to the given {@link URI}'s path """ doDeploy( uri, servletInstance -> servletInstance.setEndpointHttpHandler(endpointHttpHandler), // plug the endpointHttpHandler into the servlet deploymentInfo -> {}, // no need to customize the deploymentInfo deployment -> {} // no need to customize the deployment ); }
java
public void deploy(URI uri, EndpointHttpHandler endpointHttpHandler) { doDeploy( uri, servletInstance -> servletInstance.setEndpointHttpHandler(endpointHttpHandler), // plug the endpointHttpHandler into the servlet deploymentInfo -> {}, // no need to customize the deploymentInfo deployment -> {} // no need to customize the deployment ); }
[ "public", "void", "deploy", "(", "URI", "uri", ",", "EndpointHttpHandler", "endpointHttpHandler", ")", "{", "doDeploy", "(", "uri", ",", "servletInstance", "->", "servletInstance", ".", "setEndpointHttpHandler", "(", "endpointHttpHandler", ")", ",", "// plug the endpointHttpHandler into the servlet", "deploymentInfo", "->", "{", "}", ",", "// no need to customize the deploymentInfo", "deployment", "->", "{", "}", "// no need to customize the deployment", ")", ";", "}" ]
Exposes an HTTP endpoint defined by the given {@link EndpointHttpHandler} under the given {@link URI}'s path. @param uri determines the path and protocol under which the HTTP endpoint should be exposed @param endpointHttpHandler an {@link EndpointHttpHandler} to use for handling HTTP requests sent to the given {@link URI}'s path
[ "Exposes", "an", "HTTP", "endpoint", "defined", "by", "the", "given", "{", "@link", "EndpointHttpHandler", "}", "under", "the", "given", "{", "@link", "URI", "}", "s", "path", "." ]
train
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java#L424-L431
looly/hutool
hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java
MongoDS.createCredentail
private MongoCredential createCredentail(String userName, String database, String password) { """ 创建{@link MongoCredential},用于服务端验证 @param userName 用户名 @param database 数据库名 @param password 密码 @return {@link MongoCredential} @since 4.1.20 """ if (StrUtil.hasEmpty(userName, database, database)) { return null; } return MongoCredential.createCredential(userName, database, password.toCharArray()); }
java
private MongoCredential createCredentail(String userName, String database, String password) { if (StrUtil.hasEmpty(userName, database, database)) { return null; } return MongoCredential.createCredential(userName, database, password.toCharArray()); }
[ "private", "MongoCredential", "createCredentail", "(", "String", "userName", ",", "String", "database", ",", "String", "password", ")", "{", "if", "(", "StrUtil", ".", "hasEmpty", "(", "userName", ",", "database", ",", "database", ")", ")", "{", "return", "null", ";", "}", "return", "MongoCredential", ".", "createCredential", "(", "userName", ",", "database", ",", "password", ".", "toCharArray", "(", ")", ")", ";", "}" ]
创建{@link MongoCredential},用于服务端验证 @param userName 用户名 @param database 数据库名 @param password 密码 @return {@link MongoCredential} @since 4.1.20
[ "创建", "{", "@link", "MongoCredential", "}", ",用于服务端验证" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java#L315-L320
UrielCh/ovh-java-sdk
ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java
ApiOvhEmailpro.service_PUT
public void service_PUT(String service, OvhService body) throws IOException { """ Alter this object properties REST: PUT /email/pro/{service} @param body [required] New object properties @param service [required] The internal name of your pro organization API beta """ String qPath = "/email/pro/{service}"; StringBuilder sb = path(qPath, service); exec(qPath, "PUT", sb.toString(), body); }
java
public void service_PUT(String service, OvhService body) throws IOException { String qPath = "/email/pro/{service}"; StringBuilder sb = path(qPath, service); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "service_PUT", "(", "String", "service", ",", "OvhService", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/pro/{service}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "service", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /email/pro/{service} @param body [required] New object properties @param service [required] The internal name of your pro organization API beta
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L222-L226
zaproxy/zaproxy
src/org/zaproxy/zap/extension/users/ExtensionUserManagement.java
ExtensionUserManagement.addSharedContextUser
public void addSharedContextUser(Context sharedContext, User user) { """ Add a new user shown in the UI (for the Users context panel) that corresponds to a particular shared Context. @param sharedContext the shared context @param user the user """ this.getContextPanel(sharedContext.getIndex()).getUsersTableModel().addUser(user); }
java
public void addSharedContextUser(Context sharedContext, User user) { this.getContextPanel(sharedContext.getIndex()).getUsersTableModel().addUser(user); }
[ "public", "void", "addSharedContextUser", "(", "Context", "sharedContext", ",", "User", "user", ")", "{", "this", ".", "getContextPanel", "(", "sharedContext", ".", "getIndex", "(", ")", ")", ".", "getUsersTableModel", "(", ")", ".", "addUser", "(", "user", ")", ";", "}" ]
Add a new user shown in the UI (for the Users context panel) that corresponds to a particular shared Context. @param sharedContext the shared context @param user the user
[ "Add", "a", "new", "user", "shown", "in", "the", "UI", "(", "for", "the", "Users", "context", "panel", ")", "that", "corresponds", "to", "a", "particular", "shared", "Context", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/users/ExtensionUserManagement.java#L296-L298
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/internal/specification/PropertyFieldExtractor.java
PropertyFieldExtractor.getStringValue
private String getStringValue(Object instance, Field field) throws IllegalAccessException { """ Gets the value of the field in the given instance as String. Currently only allows primitive types, boxed types, String and Enum. """ Class<?> fieldType = field.getType(); // Only support primitive type, boxed type, String and Enum Preconditions.checkArgument( fieldType.isPrimitive() || Primitives.isWrapperType(fieldType) || String.class.equals(fieldType) || fieldType.isEnum(), "Unsupported property type %s of field %s in class %s.", fieldType.getName(), field.getName(), field.getDeclaringClass().getName() ); if (!field.isAccessible()) { field.setAccessible(true); } Object value = field.get(instance); if (value == null) { return null; } // Key name is "className.fieldName". return fieldType.isEnum() ? ((Enum<?>) value).name() : value.toString(); }
java
private String getStringValue(Object instance, Field field) throws IllegalAccessException { Class<?> fieldType = field.getType(); // Only support primitive type, boxed type, String and Enum Preconditions.checkArgument( fieldType.isPrimitive() || Primitives.isWrapperType(fieldType) || String.class.equals(fieldType) || fieldType.isEnum(), "Unsupported property type %s of field %s in class %s.", fieldType.getName(), field.getName(), field.getDeclaringClass().getName() ); if (!field.isAccessible()) { field.setAccessible(true); } Object value = field.get(instance); if (value == null) { return null; } // Key name is "className.fieldName". return fieldType.isEnum() ? ((Enum<?>) value).name() : value.toString(); }
[ "private", "String", "getStringValue", "(", "Object", "instance", ",", "Field", "field", ")", "throws", "IllegalAccessException", "{", "Class", "<", "?", ">", "fieldType", "=", "field", ".", "getType", "(", ")", ";", "// Only support primitive type, boxed type, String and Enum", "Preconditions", ".", "checkArgument", "(", "fieldType", ".", "isPrimitive", "(", ")", "||", "Primitives", ".", "isWrapperType", "(", "fieldType", ")", "||", "String", ".", "class", ".", "equals", "(", "fieldType", ")", "||", "fieldType", ".", "isEnum", "(", ")", ",", "\"Unsupported property type %s of field %s in class %s.\"", ",", "fieldType", ".", "getName", "(", ")", ",", "field", ".", "getName", "(", ")", ",", "field", ".", "getDeclaringClass", "(", ")", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "field", ".", "isAccessible", "(", ")", ")", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "}", "Object", "value", "=", "field", ".", "get", "(", "instance", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "// Key name is \"className.fieldName\".", "return", "fieldType", ".", "isEnum", "(", ")", "?", "(", "(", "Enum", "<", "?", ">", ")", "value", ")", ".", "name", "(", ")", ":", "value", ".", "toString", "(", ")", ";", "}" ]
Gets the value of the field in the given instance as String. Currently only allows primitive types, boxed types, String and Enum.
[ "Gets", "the", "value", "of", "the", "field", "in", "the", "given", "instance", "as", "String", ".", "Currently", "only", "allows", "primitive", "types", "boxed", "types", "String", "and", "Enum", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/specification/PropertyFieldExtractor.java#L64-L85
nicoulaj/commons-dbcp-jmx
jdbc4/src/main/java/org/apache/commons/dbcp/ManagedBasicDataSourceFactory.java
ManagedBasicDataSourceFactory.getProperties
private static Properties getProperties(String propText) throws Exception { """ Parse properties from the string. Format of the string must be [propertyName=property;]* @param propText @return Properties @throws Exception """ Properties p = new Properties(); if (propText != null) { p.load(new ByteArrayInputStream(propText.replace(';', '\n').getBytes())); } return p; }
java
private static Properties getProperties(String propText) throws Exception { Properties p = new Properties(); if (propText != null) { p.load(new ByteArrayInputStream(propText.replace(';', '\n').getBytes())); } return p; }
[ "private", "static", "Properties", "getProperties", "(", "String", "propText", ")", "throws", "Exception", "{", "Properties", "p", "=", "new", "Properties", "(", ")", ";", "if", "(", "propText", "!=", "null", ")", "{", "p", ".", "load", "(", "new", "ByteArrayInputStream", "(", "propText", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "getBytes", "(", ")", ")", ")", ";", "}", "return", "p", ";", "}" ]
Parse properties from the string. Format of the string must be [propertyName=property;]* @param propText @return Properties @throws Exception
[ "Parse", "properties", "from", "the", "string", ".", "Format", "of", "the", "string", "must", "be", "[", "propertyName", "=", "property", ";", "]", "*" ]
train
https://github.com/nicoulaj/commons-dbcp-jmx/blob/be8716526698da2f6dac817c95343b539ac5e3d9/jdbc4/src/main/java/org/apache/commons/dbcp/ManagedBasicDataSourceFactory.java#L469-L475
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.getPainter
private SeaGlassPainter getPainter(TreeMap<String, Object> defaults, String key) { """ Determine the painter given the defaults and a key. @param defaults the defaults. @param key the key. @return the painter, if any can be found, {@code null} otherwise. """ Object p = defaults.get(key); if (p instanceof UIDefaults.LazyValue) { p = ((UIDefaults.LazyValue) p).createValue(UIManager.getDefaults()); } return (p instanceof SeaGlassPainter ? (SeaGlassPainter) p : null); }
java
private SeaGlassPainter getPainter(TreeMap<String, Object> defaults, String key) { Object p = defaults.get(key); if (p instanceof UIDefaults.LazyValue) { p = ((UIDefaults.LazyValue) p).createValue(UIManager.getDefaults()); } return (p instanceof SeaGlassPainter ? (SeaGlassPainter) p : null); }
[ "private", "SeaGlassPainter", "getPainter", "(", "TreeMap", "<", "String", ",", "Object", ">", "defaults", ",", "String", "key", ")", "{", "Object", "p", "=", "defaults", ".", "get", "(", "key", ")", ";", "if", "(", "p", "instanceof", "UIDefaults", ".", "LazyValue", ")", "{", "p", "=", "(", "(", "UIDefaults", ".", "LazyValue", ")", "p", ")", ".", "createValue", "(", "UIManager", ".", "getDefaults", "(", ")", ")", ";", "}", "return", "(", "p", "instanceof", "SeaGlassPainter", "?", "(", "SeaGlassPainter", ")", "p", ":", "null", ")", ";", "}" ]
Determine the painter given the defaults and a key. @param defaults the defaults. @param key the key. @return the painter, if any can be found, {@code null} otherwise.
[ "Determine", "the", "painter", "given", "the", "defaults", "and", "a", "key", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L755-L763
nohana/Amalgam
amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java
DialogFragmentUtils.dismissOnLoaderCallback
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void dismissOnLoaderCallback(final android.app.FragmentManager manager, final String tag) { """ Dismiss {@link android.app.DialogFragment} for the tag on the loader callbacks. @param manager the manager. @param tag the tag string that is related to the {@link android.app.DialogFragment}. """ dismissOnLoaderCallback(HandlerUtils.getMainHandler(), manager, tag); }
java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void dismissOnLoaderCallback(final android.app.FragmentManager manager, final String tag) { dismissOnLoaderCallback(HandlerUtils.getMainHandler(), manager, tag); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "public", "static", "void", "dismissOnLoaderCallback", "(", "final", "android", ".", "app", ".", "FragmentManager", "manager", ",", "final", "String", "tag", ")", "{", "dismissOnLoaderCallback", "(", "HandlerUtils", ".", "getMainHandler", "(", ")", ",", "manager", ",", "tag", ")", ";", "}" ]
Dismiss {@link android.app.DialogFragment} for the tag on the loader callbacks. @param manager the manager. @param tag the tag string that is related to the {@link android.app.DialogFragment}.
[ "Dismiss", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java#L64-L67
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/util/BridgeMethodResolver.java
BridgeMethodResolver.searchForMatch
private static Method searchForMatch(Class<?> type, Method bridgeMethod) { """ If the supplied {@link Class} has a declared {@link Method} whose signature matches that of the supplied {@link Method}, then this matching {@link Method} is returned, otherwise {@code null} is returned. """ return ReflectionUtils.findMethod(type, bridgeMethod.getName(), bridgeMethod.getParameterTypes()); }
java
private static Method searchForMatch(Class<?> type, Method bridgeMethod) { return ReflectionUtils.findMethod(type, bridgeMethod.getName(), bridgeMethod.getParameterTypes()); }
[ "private", "static", "Method", "searchForMatch", "(", "Class", "<", "?", ">", "type", ",", "Method", "bridgeMethod", ")", "{", "return", "ReflectionUtils", ".", "findMethod", "(", "type", ",", "bridgeMethod", ".", "getName", "(", ")", ",", "bridgeMethod", ".", "getParameterTypes", "(", ")", ")", ";", "}" ]
If the supplied {@link Class} has a declared {@link Method} whose signature matches that of the supplied {@link Method}, then this matching {@link Method} is returned, otherwise {@code null} is returned.
[ "If", "the", "supplied", "{" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/util/BridgeMethodResolver.java#L198-L200
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GitLabApiForm.java
GitLabApiForm.withParam
public GitLabApiForm withParam(String name, Map<String, ?> variables, boolean required) throws IllegalArgumentException { """ Fluent method for adding an array of hash type query and form parameters to a get() or post() call. @param name the name of the field/attribute to add @param variables a Map containing array of hashes @param required the field is required flag @return this GitLabAPiForm instance @throws IllegalArgumentException if a required parameter is null or empty """ if (variables == null || variables.isEmpty()) { if (required) { throw new IllegalArgumentException(name + " cannot be empty or null"); } return (this); } for (Entry<String, ?> variable : variables.entrySet()) { Object value = variable.getValue(); if (value != null) { this.param(name + "[][key]", variable.getKey()); this.param(name + "[][value]", value.toString()); } } return (this); }
java
public GitLabApiForm withParam(String name, Map<String, ?> variables, boolean required) throws IllegalArgumentException { if (variables == null || variables.isEmpty()) { if (required) { throw new IllegalArgumentException(name + " cannot be empty or null"); } return (this); } for (Entry<String, ?> variable : variables.entrySet()) { Object value = variable.getValue(); if (value != null) { this.param(name + "[][key]", variable.getKey()); this.param(name + "[][value]", value.toString()); } } return (this); }
[ "public", "GitLabApiForm", "withParam", "(", "String", "name", ",", "Map", "<", "String", ",", "?", ">", "variables", ",", "boolean", "required", ")", "throws", "IllegalArgumentException", "{", "if", "(", "variables", "==", "null", "||", "variables", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "required", ")", "{", "throw", "new", "IllegalArgumentException", "(", "name", "+", "\" cannot be empty or null\"", ")", ";", "}", "return", "(", "this", ")", ";", "}", "for", "(", "Entry", "<", "String", ",", "?", ">", "variable", ":", "variables", ".", "entrySet", "(", ")", ")", "{", "Object", "value", "=", "variable", ".", "getValue", "(", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "this", ".", "param", "(", "name", "+", "\"[][key]\"", ",", "variable", ".", "getKey", "(", ")", ")", ";", "this", ".", "param", "(", "name", "+", "\"[][value]\"", ",", "value", ".", "toString", "(", ")", ")", ";", "}", "}", "return", "(", "this", ")", ";", "}" ]
Fluent method for adding an array of hash type query and form parameters to a get() or post() call. @param name the name of the field/attribute to add @param variables a Map containing array of hashes @param required the field is required flag @return this GitLabAPiForm instance @throws IllegalArgumentException if a required parameter is null or empty
[ "Fluent", "method", "for", "adding", "an", "array", "of", "hash", "type", "query", "and", "form", "parameters", "to", "a", "get", "()", "or", "post", "()", "call", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApiForm.java#L148-L167
davidmarquis/fluent-interface-proxy
src/main/java/com/fluentinterface/beans/reflect/Property.java
Property.findAccessorField
private static Field findAccessorField(Class<?> type, String name, Class<?> requiredType) { """ Internal: Gets a {@link Field} with any valid modifier, evaluating its hierarchy. @param type the class from where to search, cannot be null @param name the name of the field to search, cannot be null @param requiredType the required type to match, cannot be null @return the field, if found, else {@code null} """ Class<?> current = type; while (current != null) { for (Field field : current.getDeclaredFields()) { if (field.getName().equals(name) && field.getType().equals(requiredType) && !isStatic(field) && !field.isSynthetic() && (!isPrivate(field) || field.getDeclaringClass() == type)) { return field; } } current = current.getSuperclass(); } return null; }
java
private static Field findAccessorField(Class<?> type, String name, Class<?> requiredType) { Class<?> current = type; while (current != null) { for (Field field : current.getDeclaredFields()) { if (field.getName().equals(name) && field.getType().equals(requiredType) && !isStatic(field) && !field.isSynthetic() && (!isPrivate(field) || field.getDeclaringClass() == type)) { return field; } } current = current.getSuperclass(); } return null; }
[ "private", "static", "Field", "findAccessorField", "(", "Class", "<", "?", ">", "type", ",", "String", "name", ",", "Class", "<", "?", ">", "requiredType", ")", "{", "Class", "<", "?", ">", "current", "=", "type", ";", "while", "(", "current", "!=", "null", ")", "{", "for", "(", "Field", "field", ":", "current", ".", "getDeclaredFields", "(", ")", ")", "{", "if", "(", "field", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", "&&", "field", ".", "getType", "(", ")", ".", "equals", "(", "requiredType", ")", "&&", "!", "isStatic", "(", "field", ")", "&&", "!", "field", ".", "isSynthetic", "(", ")", "&&", "(", "!", "isPrivate", "(", "field", ")", "||", "field", ".", "getDeclaringClass", "(", ")", "==", "type", ")", ")", "{", "return", "field", ";", "}", "}", "current", "=", "current", ".", "getSuperclass", "(", ")", ";", "}", "return", "null", ";", "}" ]
Internal: Gets a {@link Field} with any valid modifier, evaluating its hierarchy. @param type the class from where to search, cannot be null @param name the name of the field to search, cannot be null @param requiredType the required type to match, cannot be null @return the field, if found, else {@code null}
[ "Internal", ":", "Gets", "a", "{", "@link", "Field", "}", "with", "any", "valid", "modifier", "evaluating", "its", "hierarchy", "." ]
train
https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/reflect/Property.java#L488-L506
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java
AttributeDefinition.getAttributeDeprecatedDescription
public String getAttributeDeprecatedDescription(final ResourceBundle bundle, final String prefix) { """ Gets localized deprecation text from the given {@link java.util.ResourceBundle} for the attribute. @param bundle the resource bundle. Cannot be {@code null} @param prefix a prefix to dot-prepend to the attribute name to form a key to resolve in the bundle @return the resolved text """ String bundleKey = prefix == null ? name : (prefix + "." + name); bundleKey += "." + ModelDescriptionConstants.DEPRECATED; return bundle.getString(bundleKey); }
java
public String getAttributeDeprecatedDescription(final ResourceBundle bundle, final String prefix) { String bundleKey = prefix == null ? name : (prefix + "." + name); bundleKey += "." + ModelDescriptionConstants.DEPRECATED; return bundle.getString(bundleKey); }
[ "public", "String", "getAttributeDeprecatedDescription", "(", "final", "ResourceBundle", "bundle", ",", "final", "String", "prefix", ")", "{", "String", "bundleKey", "=", "prefix", "==", "null", "?", "name", ":", "(", "prefix", "+", "\".\"", "+", "name", ")", ";", "bundleKey", "+=", "\".\"", "+", "ModelDescriptionConstants", ".", "DEPRECATED", ";", "return", "bundle", ".", "getString", "(", "bundleKey", ")", ";", "}" ]
Gets localized deprecation text from the given {@link java.util.ResourceBundle} for the attribute. @param bundle the resource bundle. Cannot be {@code null} @param prefix a prefix to dot-prepend to the attribute name to form a key to resolve in the bundle @return the resolved text
[ "Gets", "localized", "deprecation", "text", "from", "the", "given", "{", "@link", "java", ".", "util", ".", "ResourceBundle", "}", "for", "the", "attribute", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L924-L928
apigee/usergrid-java-sdk
src/main/java/org/usergrid/java/client/Client.java
Client.postUserActivity
public ApiResponse postUserActivity(String userId, Activity activity) { """ Posts an activity to a user. Activity must already be created. @param userId @param activity @return """ return apiRequest(HttpMethod.POST, null, activity, organizationId, applicationId, "users", userId, "activities"); }
java
public ApiResponse postUserActivity(String userId, Activity activity) { return apiRequest(HttpMethod.POST, null, activity, organizationId, applicationId, "users", userId, "activities"); }
[ "public", "ApiResponse", "postUserActivity", "(", "String", "userId", ",", "Activity", "activity", ")", "{", "return", "apiRequest", "(", "HttpMethod", ".", "POST", ",", "null", ",", "activity", ",", "organizationId", ",", "applicationId", ",", "\"users\"", ",", "userId", ",", "\"activities\"", ")", ";", "}" ]
Posts an activity to a user. Activity must already be created. @param userId @param activity @return
[ "Posts", "an", "activity", "to", "a", "user", ".", "Activity", "must", "already", "be", "created", "." ]
train
https://github.com/apigee/usergrid-java-sdk/blob/6202745f184754defff13962dfc3d830bc7d8c63/src/main/java/org/usergrid/java/client/Client.java#L674-L677
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/quotes/OrderItemUrl.java
OrderItemUrl.updateQuoteItemUrl
public static MozuUrl updateQuoteItemUrl(String quoteId, String quoteItemId, String responseFields) { """ Get Resource Url for UpdateQuoteItem @param quoteId @param quoteItemId @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/quotes/{quoteId}/items/{quoteItemId}?responseFields={responseFields}"); formatter.formatUrl("quoteId", quoteId); formatter.formatUrl("quoteItemId", quoteItemId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateQuoteItemUrl(String quoteId, String quoteItemId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/quotes/{quoteId}/items/{quoteItemId}?responseFields={responseFields}"); formatter.formatUrl("quoteId", quoteId); formatter.formatUrl("quoteItemId", quoteItemId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateQuoteItemUrl", "(", "String", "quoteId", ",", "String", "quoteItemId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/quotes/{quoteId}/items/{quoteItemId}?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"quoteId\"", ",", "quoteId", ")", ";", "formatter", ".", "formatUrl", "(", "\"quoteItemId\"", ",", "quoteItemId", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for UpdateQuoteItem @param quoteId @param quoteItemId @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateQuoteItem" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/quotes/OrderItemUrl.java#L99-L106
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRBitmapImage.java
GVRBitmapImage.setBuffer
public void setBuffer(final int width, final int height, final int format, final int type, final Buffer pixels) { """ Copy a new texture from a {@link Buffer} to the GPU texture. This one is also safe even in a non-GL thread. An updateGPU request on a non-GL thread will be forwarded to the GL thread and be executed before main rendering happens. Creating a new {@link GVRImage} is pretty cheap, but it's still not a totally trivial operation: it does involve some memory management and some GL hardware handshaking. Reusing the texture reduces this overhead (primarily by delaying garbage collection). Do be aware that updating a texture will affect any and all {@linkplain GVRMaterial materials} (and/or post effects that use the texture! @param width Texture width, in texels @param height Texture height, in texels @param format Texture format @param type Texture type @param pixels A NIO Buffer with the texture """ NativeBitmapImage.updateFromBuffer(getNative(), 0, 0, width, height, format, type, pixels); }
java
public void setBuffer(final int width, final int height, final int format, final int type, final Buffer pixels) { NativeBitmapImage.updateFromBuffer(getNative(), 0, 0, width, height, format, type, pixels); }
[ "public", "void", "setBuffer", "(", "final", "int", "width", ",", "final", "int", "height", ",", "final", "int", "format", ",", "final", "int", "type", ",", "final", "Buffer", "pixels", ")", "{", "NativeBitmapImage", ".", "updateFromBuffer", "(", "getNative", "(", ")", ",", "0", ",", "0", ",", "width", ",", "height", ",", "format", ",", "type", ",", "pixels", ")", ";", "}" ]
Copy a new texture from a {@link Buffer} to the GPU texture. This one is also safe even in a non-GL thread. An updateGPU request on a non-GL thread will be forwarded to the GL thread and be executed before main rendering happens. Creating a new {@link GVRImage} is pretty cheap, but it's still not a totally trivial operation: it does involve some memory management and some GL hardware handshaking. Reusing the texture reduces this overhead (primarily by delaying garbage collection). Do be aware that updating a texture will affect any and all {@linkplain GVRMaterial materials} (and/or post effects that use the texture! @param width Texture width, in texels @param height Texture height, in texels @param format Texture format @param type Texture type @param pixels A NIO Buffer with the texture
[ "Copy", "a", "new", "texture", "from", "a", "{", "@link", "Buffer", "}", "to", "the", "GPU", "texture", ".", "This", "one", "is", "also", "safe", "even", "in", "a", "non", "-", "GL", "thread", ".", "An", "updateGPU", "request", "on", "a", "non", "-", "GL", "thread", "will", "be", "forwarded", "to", "the", "GL", "thread", "and", "be", "executed", "before", "main", "rendering", "happens", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRBitmapImage.java#L176-L179
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/ui/groupeditor/A_CmsGroupEditor.java
A_CmsGroupEditor.updateBackupElements
public void updateBackupElements(Map<String, CmsContainerElementData> updateElements) { """ Updates the backup elements.<p> @param updateElements the updated element data """ ArrayList<CmsContainerPageElementPanel> updatedList = new ArrayList<CmsContainerPageElementPanel>(); String containerId = m_groupContainer.getContainerId(); for (CmsContainerPageElementPanel element : m_backUpElements) { if (updateElements.containsKey(element.getId()) && CmsStringUtil.isNotEmptyOrWhitespaceOnly( updateElements.get(element.getId()).getContents().get(containerId))) { CmsContainerElementData elementData = updateElements.get(element.getId()); try { CmsContainerPageElementPanel replacer = m_controller.getContainerpageUtil().createElement( elementData, m_groupContainer, false); if (element.getInheritanceInfo() != null) { // in case of inheritance container editing, keep the inheritance info replacer.setInheritanceInfo(element.getInheritanceInfo()); } updatedList.add(replacer); } catch (Exception e) { // in this case keep the old version updatedList.add(element); } } else { updatedList.add(element); } } m_backUpElements = updatedList; }
java
public void updateBackupElements(Map<String, CmsContainerElementData> updateElements) { ArrayList<CmsContainerPageElementPanel> updatedList = new ArrayList<CmsContainerPageElementPanel>(); String containerId = m_groupContainer.getContainerId(); for (CmsContainerPageElementPanel element : m_backUpElements) { if (updateElements.containsKey(element.getId()) && CmsStringUtil.isNotEmptyOrWhitespaceOnly( updateElements.get(element.getId()).getContents().get(containerId))) { CmsContainerElementData elementData = updateElements.get(element.getId()); try { CmsContainerPageElementPanel replacer = m_controller.getContainerpageUtil().createElement( elementData, m_groupContainer, false); if (element.getInheritanceInfo() != null) { // in case of inheritance container editing, keep the inheritance info replacer.setInheritanceInfo(element.getInheritanceInfo()); } updatedList.add(replacer); } catch (Exception e) { // in this case keep the old version updatedList.add(element); } } else { updatedList.add(element); } } m_backUpElements = updatedList; }
[ "public", "void", "updateBackupElements", "(", "Map", "<", "String", ",", "CmsContainerElementData", ">", "updateElements", ")", "{", "ArrayList", "<", "CmsContainerPageElementPanel", ">", "updatedList", "=", "new", "ArrayList", "<", "CmsContainerPageElementPanel", ">", "(", ")", ";", "String", "containerId", "=", "m_groupContainer", ".", "getContainerId", "(", ")", ";", "for", "(", "CmsContainerPageElementPanel", "element", ":", "m_backUpElements", ")", "{", "if", "(", "updateElements", ".", "containsKey", "(", "element", ".", "getId", "(", ")", ")", "&&", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "updateElements", ".", "get", "(", "element", ".", "getId", "(", ")", ")", ".", "getContents", "(", ")", ".", "get", "(", "containerId", ")", ")", ")", "{", "CmsContainerElementData", "elementData", "=", "updateElements", ".", "get", "(", "element", ".", "getId", "(", ")", ")", ";", "try", "{", "CmsContainerPageElementPanel", "replacer", "=", "m_controller", ".", "getContainerpageUtil", "(", ")", ".", "createElement", "(", "elementData", ",", "m_groupContainer", ",", "false", ")", ";", "if", "(", "element", ".", "getInheritanceInfo", "(", ")", "!=", "null", ")", "{", "// in case of inheritance container editing, keep the inheritance info", "replacer", ".", "setInheritanceInfo", "(", "element", ".", "getInheritanceInfo", "(", ")", ")", ";", "}", "updatedList", ".", "add", "(", "replacer", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// in this case keep the old version", "updatedList", ".", "add", "(", "element", ")", ";", "}", "}", "else", "{", "updatedList", ".", "add", "(", "element", ")", ";", "}", "}", "m_backUpElements", "=", "updatedList", ";", "}" ]
Updates the backup elements.<p> @param updateElements the updated element data
[ "Updates", "the", "backup", "elements", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/groupeditor/A_CmsGroupEditor.java#L268-L297
vanilladb/vanillacore
src/main/java/org/vanilladb/core/sql/Schema.java
Schema.addField
public void addField(String fldName, Type type) { """ Adds a field to this schema having a specified name and type. @param fldName the name of the field @param type the type of the field, according to the constants in {@link Type} """ fields.put(fldName, type); if (myFieldSet != null) myFieldSet.add(fldName); }
java
public void addField(String fldName, Type type) { fields.put(fldName, type); if (myFieldSet != null) myFieldSet.add(fldName); }
[ "public", "void", "addField", "(", "String", "fldName", ",", "Type", "type", ")", "{", "fields", ".", "put", "(", "fldName", ",", "type", ")", ";", "if", "(", "myFieldSet", "!=", "null", ")", "myFieldSet", ".", "add", "(", "fldName", ")", ";", "}" ]
Adds a field to this schema having a specified name and type. @param fldName the name of the field @param type the type of the field, according to the constants in {@link Type}
[ "Adds", "a", "field", "to", "this", "schema", "having", "a", "specified", "name", "and", "type", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/Schema.java#L55-L59
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.removeItemFromList
public StatusCode removeItemFromList(String sessionId, String listId, Integer mediaId) throws MovieDbException { """ This method lets users remove items from a list that they created. A valid session id is required. @param sessionId sessionId @param listId listId @param mediaId mediaId @return true if the movie is on the list @throws MovieDbException exception """ return tmdbList.removeItem(sessionId, listId, mediaId); }
java
public StatusCode removeItemFromList(String sessionId, String listId, Integer mediaId) throws MovieDbException { return tmdbList.removeItem(sessionId, listId, mediaId); }
[ "public", "StatusCode", "removeItemFromList", "(", "String", "sessionId", ",", "String", "listId", ",", "Integer", "mediaId", ")", "throws", "MovieDbException", "{", "return", "tmdbList", ".", "removeItem", "(", "sessionId", ",", "listId", ",", "mediaId", ")", ";", "}" ]
This method lets users remove items from a list that they created. A valid session id is required. @param sessionId sessionId @param listId listId @param mediaId mediaId @return true if the movie is on the list @throws MovieDbException exception
[ "This", "method", "lets", "users", "remove", "items", "from", "a", "list", "that", "they", "created", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L830-L832
alkacon/opencms-core
src/org/opencms/i18n/CmsEncoder.java
CmsEncoder.lookupEncoding
public static String lookupEncoding(String encoding, String fallback) { """ Checks if a given encoding name is actually supported, and if so resolves it to it's canonical name, if not it returns the given fallback value.<p> Charsets have a set of aliases. For example, valid aliases for "UTF-8" are "UTF8", "utf-8" or "utf8". This method resolves any given valid charset name to it's "canonical" form, so that simple String comparison can be used when checking charset names internally later.<p> Please see <a href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a> for a list of valid charset alias names.<p> @param encoding the encoding to check and resolve @param fallback the fallback encoding scheme @return the resolved encoding name, or the fallback value """ String result = m_encodingCache.get(encoding); if (result != null) { return result; } try { result = Charset.forName(encoding).name(); m_encodingCache.put(encoding, result); return result; } catch (Throwable t) { // we will use the default value as fallback } return fallback; }
java
public static String lookupEncoding(String encoding, String fallback) { String result = m_encodingCache.get(encoding); if (result != null) { return result; } try { result = Charset.forName(encoding).name(); m_encodingCache.put(encoding, result); return result; } catch (Throwable t) { // we will use the default value as fallback } return fallback; }
[ "public", "static", "String", "lookupEncoding", "(", "String", "encoding", ",", "String", "fallback", ")", "{", "String", "result", "=", "m_encodingCache", ".", "get", "(", "encoding", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "try", "{", "result", "=", "Charset", ".", "forName", "(", "encoding", ")", ".", "name", "(", ")", ";", "m_encodingCache", ".", "put", "(", "encoding", ",", "result", ")", ";", "return", "result", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// we will use the default value as fallback", "}", "return", "fallback", ";", "}" ]
Checks if a given encoding name is actually supported, and if so resolves it to it's canonical name, if not it returns the given fallback value.<p> Charsets have a set of aliases. For example, valid aliases for "UTF-8" are "UTF8", "utf-8" or "utf8". This method resolves any given valid charset name to it's "canonical" form, so that simple String comparison can be used when checking charset names internally later.<p> Please see <a href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a> for a list of valid charset alias names.<p> @param encoding the encoding to check and resolve @param fallback the fallback encoding scheme @return the resolved encoding name, or the fallback value
[ "Checks", "if", "a", "given", "encoding", "name", "is", "actually", "supported", "and", "if", "so", "resolves", "it", "to", "it", "s", "canonical", "name", "if", "not", "it", "returns", "the", "given", "fallback", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L821-L837
landawn/AbacusUtil
src/com/landawn/abacus/util/Primitives.java
Primitives.box
@SafeVarargs public static Boolean[] box(final boolean... a) { """ <p> Converts an array of primitive booleans to objects. </p> <p> This method returns {@code null} for a {@code null} input array. </p> @param a a {@code boolean} array @return a {@code Boolean} array, {@code null} if null array input """ if (a == null) { return null; } return box(a, 0, a.length); }
java
@SafeVarargs public static Boolean[] box(final boolean... a) { if (a == null) { return null; } return box(a, 0, a.length); }
[ "@", "SafeVarargs", "public", "static", "Boolean", "[", "]", "box", "(", "final", "boolean", "...", "a", ")", "{", "if", "(", "a", "==", "null", ")", "{", "return", "null", ";", "}", "return", "box", "(", "a", ",", "0", ",", "a", ".", "length", ")", ";", "}" ]
<p> Converts an array of primitive booleans to objects. </p> <p> This method returns {@code null} for a {@code null} input array. </p> @param a a {@code boolean} array @return a {@code Boolean} array, {@code null} if null array input
[ "<p", ">", "Converts", "an", "array", "of", "primitive", "booleans", "to", "objects", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Primitives.java#L123-L130
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsFailedToUpgradeFrom
public FessMessages addErrorsFailedToUpgradeFrom(String property, String arg0, String arg1) { """ Add the created action message for the key 'errors.failed_to_upgrade_from' with parameters. <pre> message: Failed to upgrade from {0}: {1} </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @param arg1 The parameter arg1 for message. (NotNull) @return this. (NotNull) """ assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_failed_to_upgrade_from, arg0, arg1)); return this; }
java
public FessMessages addErrorsFailedToUpgradeFrom(String property, String arg0, String arg1) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_failed_to_upgrade_from, arg0, arg1)); return this; }
[ "public", "FessMessages", "addErrorsFailedToUpgradeFrom", "(", "String", "property", ",", "String", "arg0", ",", "String", "arg1", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_failed_to_upgrade_from", ",", "arg0", ",", "arg1", ")", ")", ";", "return", "this", ";", "}" ]
Add the created action message for the key 'errors.failed_to_upgrade_from' with parameters. <pre> message: Failed to upgrade from {0}: {1} </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @param arg1 The parameter arg1 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "failed_to_upgrade_from", "with", "parameters", ".", "<pre", ">", "message", ":", "Failed", "to", "upgrade", "from", "{", "0", "}", ":", "{", "1", "}", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1919-L1923
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/DefaultBeanContext.java
DefaultBeanContext.getBeansOfType
protected @Nonnull <T> Collection<T> getBeansOfType(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType) { """ Get all beans of the given type. @param resolutionContext The bean resolution context @param beanType The bean type @param <T> The bean type parameter @return The found beans """ return getBeansOfTypeInternal(resolutionContext, beanType, null); }
java
protected @Nonnull <T> Collection<T> getBeansOfType(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType) { return getBeansOfTypeInternal(resolutionContext, beanType, null); }
[ "protected", "@", "Nonnull", "<", "T", ">", "Collection", "<", "T", ">", "getBeansOfType", "(", "@", "Nullable", "BeanResolutionContext", "resolutionContext", ",", "@", "Nonnull", "Class", "<", "T", ">", "beanType", ")", "{", "return", "getBeansOfTypeInternal", "(", "resolutionContext", ",", "beanType", ",", "null", ")", ";", "}" ]
Get all beans of the given type. @param resolutionContext The bean resolution context @param beanType The bean type @param <T> The bean type parameter @return The found beans
[ "Get", "all", "beans", "of", "the", "given", "type", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L853-L855
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java
VpnSitesInner.getByResourceGroupAsync
public Observable<VpnSiteInner> getByResourceGroupAsync(String resourceGroupName, String vpnSiteName) { """ Retrieves the details of a VPNsite. @param resourceGroupName The resource group name of the VpnSite. @param vpnSiteName The name of the VpnSite being retrieved. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VpnSiteInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vpnSiteName).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() { @Override public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) { return response.body(); } }); }
java
public Observable<VpnSiteInner> getByResourceGroupAsync(String resourceGroupName, String vpnSiteName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vpnSiteName).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() { @Override public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnSiteInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "vpnSiteName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "vpnSiteName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VpnSiteInner", ">", ",", "VpnSiteInner", ">", "(", ")", "{", "@", "Override", "public", "VpnSiteInner", "call", "(", "ServiceResponse", "<", "VpnSiteInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieves the details of a VPNsite. @param resourceGroupName The resource group name of the VpnSite. @param vpnSiteName The name of the VpnSite being retrieved. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VpnSiteInner object
[ "Retrieves", "the", "details", "of", "a", "VPNsite", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java#L151-L158
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java
Validator.validateNull
public void validateNull(Object object, String name) { """ Validates a given object to be null @param object The object to check @param name The name of the field to display the error message """ validateNull(object, name, messages.get(Validation.NULL_KEY.name(), name)); }
java
public void validateNull(Object object, String name) { validateNull(object, name, messages.get(Validation.NULL_KEY.name(), name)); }
[ "public", "void", "validateNull", "(", "Object", "object", ",", "String", "name", ")", "{", "validateNull", "(", "object", ",", "name", ",", "messages", ".", "get", "(", "Validation", ".", "NULL_KEY", ".", "name", "(", ")", ",", "name", ")", ")", ";", "}" ]
Validates a given object to be null @param object The object to check @param name The name of the field to display the error message
[ "Validates", "a", "given", "object", "to", "be", "null" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L511-L513
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
GrailsDomainBinder.linkBidirectionalOneToMany
protected void linkBidirectionalOneToMany(Collection collection, PersistentClass associatedClass, DependantValue key, PersistentProperty otherSide) { """ Links a bidirectional one-to-many, configuring the inverse side and using a column copy to perform the link @param collection The collection one-to-many @param associatedClass The associated class @param key The key @param otherSide The other side of the relationship """ collection.setInverse(true); // Iterator mappedByColumns = associatedClass.getProperty(otherSide.getName()).getValue().getColumnIterator(); Iterator<?> mappedByColumns = getProperty(associatedClass, otherSide.getName()).getValue().getColumnIterator(); while (mappedByColumns.hasNext()) { Column column = (Column) mappedByColumns.next(); linkValueUsingAColumnCopy(otherSide, column, key); } }
java
protected void linkBidirectionalOneToMany(Collection collection, PersistentClass associatedClass, DependantValue key, PersistentProperty otherSide) { collection.setInverse(true); // Iterator mappedByColumns = associatedClass.getProperty(otherSide.getName()).getValue().getColumnIterator(); Iterator<?> mappedByColumns = getProperty(associatedClass, otherSide.getName()).getValue().getColumnIterator(); while (mappedByColumns.hasNext()) { Column column = (Column) mappedByColumns.next(); linkValueUsingAColumnCopy(otherSide, column, key); } }
[ "protected", "void", "linkBidirectionalOneToMany", "(", "Collection", "collection", ",", "PersistentClass", "associatedClass", ",", "DependantValue", "key", ",", "PersistentProperty", "otherSide", ")", "{", "collection", ".", "setInverse", "(", "true", ")", ";", "// Iterator mappedByColumns = associatedClass.getProperty(otherSide.getName()).getValue().getColumnIterator();", "Iterator", "<", "?", ">", "mappedByColumns", "=", "getProperty", "(", "associatedClass", ",", "otherSide", ".", "getName", "(", ")", ")", ".", "getValue", "(", ")", ".", "getColumnIterator", "(", ")", ";", "while", "(", "mappedByColumns", ".", "hasNext", "(", ")", ")", "{", "Column", "column", "=", "(", "Column", ")", "mappedByColumns", ".", "next", "(", ")", ";", "linkValueUsingAColumnCopy", "(", "otherSide", ",", "column", ",", "key", ")", ";", "}", "}" ]
Links a bidirectional one-to-many, configuring the inverse side and using a column copy to perform the link @param collection The collection one-to-many @param associatedClass The associated class @param key The key @param otherSide The other side of the relationship
[ "Links", "a", "bidirectional", "one", "-", "to", "-", "many", "configuring", "the", "inverse", "side", "and", "using", "a", "column", "copy", "to", "perform", "the", "link" ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L964-L973
VoltDB/voltdb
src/frontend/org/voltdb/OpsAgent.java
OpsAgent.sendOpsResponse
private void sendOpsResponse(VoltTable[] results, JSONObject obj, byte payloadType) throws Exception { """ Return the results of distributed work to the original requesting agent. Used by subclasses to respond after they've done their local work. """ long requestId = obj.getLong("requestId"); long returnAddress = obj.getLong("returnAddress"); // Send a response with no data since the stats is not supported or not yet available if (results == null) { ByteBuffer responseBuffer = ByteBuffer.allocate(8); responseBuffer.putLong(requestId); byte responseBytes[] = CompressionService.compressBytes(responseBuffer.array()); BinaryPayloadMessage bpm = new BinaryPayloadMessage( new byte[] {payloadType}, responseBytes); m_mailbox.send(returnAddress, bpm); return; } ByteBuffer[] bufs = new ByteBuffer[results.length]; int statbytes = 0; for (int i = 0; i < results.length; i++) { bufs[i] = results[i].getBuffer(); bufs[i].position(0); statbytes += bufs[i].remaining(); } ByteBuffer responseBuffer = ByteBuffer.allocate( 8 + // requestId 4 * results.length + // length prefix for each stats table + statbytes); responseBuffer.putLong(requestId); for (ByteBuffer buf : bufs) { responseBuffer.putInt(buf.remaining()); responseBuffer.put(buf); } byte responseBytes[] = CompressionService.compressBytes(responseBuffer.array()); BinaryPayloadMessage bpm = new BinaryPayloadMessage( new byte[] {payloadType}, responseBytes); m_mailbox.send(returnAddress, bpm); }
java
private void sendOpsResponse(VoltTable[] results, JSONObject obj, byte payloadType) throws Exception { long requestId = obj.getLong("requestId"); long returnAddress = obj.getLong("returnAddress"); // Send a response with no data since the stats is not supported or not yet available if (results == null) { ByteBuffer responseBuffer = ByteBuffer.allocate(8); responseBuffer.putLong(requestId); byte responseBytes[] = CompressionService.compressBytes(responseBuffer.array()); BinaryPayloadMessage bpm = new BinaryPayloadMessage( new byte[] {payloadType}, responseBytes); m_mailbox.send(returnAddress, bpm); return; } ByteBuffer[] bufs = new ByteBuffer[results.length]; int statbytes = 0; for (int i = 0; i < results.length; i++) { bufs[i] = results[i].getBuffer(); bufs[i].position(0); statbytes += bufs[i].remaining(); } ByteBuffer responseBuffer = ByteBuffer.allocate( 8 + // requestId 4 * results.length + // length prefix for each stats table + statbytes); responseBuffer.putLong(requestId); for (ByteBuffer buf : bufs) { responseBuffer.putInt(buf.remaining()); responseBuffer.put(buf); } byte responseBytes[] = CompressionService.compressBytes(responseBuffer.array()); BinaryPayloadMessage bpm = new BinaryPayloadMessage( new byte[] {payloadType}, responseBytes); m_mailbox.send(returnAddress, bpm); }
[ "private", "void", "sendOpsResponse", "(", "VoltTable", "[", "]", "results", ",", "JSONObject", "obj", ",", "byte", "payloadType", ")", "throws", "Exception", "{", "long", "requestId", "=", "obj", ".", "getLong", "(", "\"requestId\"", ")", ";", "long", "returnAddress", "=", "obj", ".", "getLong", "(", "\"returnAddress\"", ")", ";", "// Send a response with no data since the stats is not supported or not yet available", "if", "(", "results", "==", "null", ")", "{", "ByteBuffer", "responseBuffer", "=", "ByteBuffer", ".", "allocate", "(", "8", ")", ";", "responseBuffer", ".", "putLong", "(", "requestId", ")", ";", "byte", "responseBytes", "[", "]", "=", "CompressionService", ".", "compressBytes", "(", "responseBuffer", ".", "array", "(", ")", ")", ";", "BinaryPayloadMessage", "bpm", "=", "new", "BinaryPayloadMessage", "(", "new", "byte", "[", "]", "{", "payloadType", "}", ",", "responseBytes", ")", ";", "m_mailbox", ".", "send", "(", "returnAddress", ",", "bpm", ")", ";", "return", ";", "}", "ByteBuffer", "[", "]", "bufs", "=", "new", "ByteBuffer", "[", "results", ".", "length", "]", ";", "int", "statbytes", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "results", ".", "length", ";", "i", "++", ")", "{", "bufs", "[", "i", "]", "=", "results", "[", "i", "]", ".", "getBuffer", "(", ")", ";", "bufs", "[", "i", "]", ".", "position", "(", "0", ")", ";", "statbytes", "+=", "bufs", "[", "i", "]", ".", "remaining", "(", ")", ";", "}", "ByteBuffer", "responseBuffer", "=", "ByteBuffer", ".", "allocate", "(", "8", "+", "// requestId", "4", "*", "results", ".", "length", "+", "// length prefix for each stats table", "+", "statbytes", ")", ";", "responseBuffer", ".", "putLong", "(", "requestId", ")", ";", "for", "(", "ByteBuffer", "buf", ":", "bufs", ")", "{", "responseBuffer", ".", "putInt", "(", "buf", ".", "remaining", "(", ")", ")", ";", "responseBuffer", ".", "put", "(", "buf", ")", ";", "}", "byte", "responseBytes", "[", "]", "=", "CompressionService", ".", "compressBytes", "(", "responseBuffer", ".", "array", "(", ")", ")", ";", "BinaryPayloadMessage", "bpm", "=", "new", "BinaryPayloadMessage", "(", "new", "byte", "[", "]", "{", "payloadType", "}", ",", "responseBytes", ")", ";", "m_mailbox", ".", "send", "(", "returnAddress", ",", "bpm", ")", ";", "}" ]
Return the results of distributed work to the original requesting agent. Used by subclasses to respond after they've done their local work.
[ "Return", "the", "results", "of", "distributed", "work", "to", "the", "original", "requesting", "agent", ".", "Used", "by", "subclasses", "to", "respond", "after", "they", "ve", "done", "their", "local", "work", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/OpsAgent.java#L414-L449
tvesalainen/util
util/src/main/java/d3/env/TSAGeoMag.java
TSAGeoMag.getHorizontalIntensity
public double getHorizontalIntensity( double dlat, double dlong, double year, double altitude ) { """ Returns the horizontal magnetic field intensity from the Department of Defense geomagnetic model and data in nano Tesla. @param dlat Latitude in decimal degrees. @param dlong Longitude in decimal degrees. @param year Date of the calculation in decimal years. @param altitude Altitude of the calculation in kilometers. @return The horizontal magnetic field strength in nano Tesla. """ calcGeoMag( dlat, dlong, year, altitude ); return bh; }
java
public double getHorizontalIntensity( double dlat, double dlong, double year, double altitude ) { calcGeoMag( dlat, dlong, year, altitude ); return bh; }
[ "public", "double", "getHorizontalIntensity", "(", "double", "dlat", ",", "double", "dlong", ",", "double", "year", ",", "double", "altitude", ")", "{", "calcGeoMag", "(", "dlat", ",", "dlong", ",", "year", ",", "altitude", ")", ";", "return", "bh", ";", "}" ]
Returns the horizontal magnetic field intensity from the Department of Defense geomagnetic model and data in nano Tesla. @param dlat Latitude in decimal degrees. @param dlong Longitude in decimal degrees. @param year Date of the calculation in decimal years. @param altitude Altitude of the calculation in kilometers. @return The horizontal magnetic field strength in nano Tesla.
[ "Returns", "the", "horizontal", "magnetic", "field", "intensity", "from", "the", "Department", "of", "Defense", "geomagnetic", "model", "and", "data", "in", "nano", "Tesla", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1003-L1007
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vod/VodClient.java
VodClient.listMediaResourcesByMarker
public ListMediaResourceByMarkerResponse listMediaResourcesByMarker(ListMediaResourceByMarkerRequest request) { """ List the properties of all media resource managed by VOD service. <p> The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair. @param request The request wrapper object containing all options. @return The properties of all specific media resources """ InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, PATH_MEDIA); internalRequest.addParameter(PARAM_MAX_SIZE, String.valueOf(request.getMaxSize())); if (request.getMarker() != null) { internalRequest.addParameter(PARAM_MARKER, String.valueOf(request.getMarker())); } if (request.getStatus() != null) { internalRequest.addParameter(PARA_STATUS, request.getStatus()); } if (request.getBegin() != null) { internalRequest.addParameter(PARA_BEGIN, DateUtils.formatAlternateIso8601Date(request.getBegin())); } if (request.getEnd() != null) { internalRequest.addParameter(PARA_END, DateUtils.formatAlternateIso8601Date(request.getEnd())); } if (request.getTitle() != null) { internalRequest.addParameter(PARA_TITLE, request.getTitle()); } return invokeHttpClient(internalRequest, ListMediaResourceByMarkerResponse.class); }
java
public ListMediaResourceByMarkerResponse listMediaResourcesByMarker(ListMediaResourceByMarkerRequest request) { InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, PATH_MEDIA); internalRequest.addParameter(PARAM_MAX_SIZE, String.valueOf(request.getMaxSize())); if (request.getMarker() != null) { internalRequest.addParameter(PARAM_MARKER, String.valueOf(request.getMarker())); } if (request.getStatus() != null) { internalRequest.addParameter(PARA_STATUS, request.getStatus()); } if (request.getBegin() != null) { internalRequest.addParameter(PARA_BEGIN, DateUtils.formatAlternateIso8601Date(request.getBegin())); } if (request.getEnd() != null) { internalRequest.addParameter(PARA_END, DateUtils.formatAlternateIso8601Date(request.getEnd())); } if (request.getTitle() != null) { internalRequest.addParameter(PARA_TITLE, request.getTitle()); } return invokeHttpClient(internalRequest, ListMediaResourceByMarkerResponse.class); }
[ "public", "ListMediaResourceByMarkerResponse", "listMediaResourcesByMarker", "(", "ListMediaResourceByMarkerRequest", "request", ")", "{", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET", ",", "request", ",", "PATH_MEDIA", ")", ";", "internalRequest", ".", "addParameter", "(", "PARAM_MAX_SIZE", ",", "String", ".", "valueOf", "(", "request", ".", "getMaxSize", "(", ")", ")", ")", ";", "if", "(", "request", ".", "getMarker", "(", ")", "!=", "null", ")", "{", "internalRequest", ".", "addParameter", "(", "PARAM_MARKER", ",", "String", ".", "valueOf", "(", "request", ".", "getMarker", "(", ")", ")", ")", ";", "}", "if", "(", "request", ".", "getStatus", "(", ")", "!=", "null", ")", "{", "internalRequest", ".", "addParameter", "(", "PARA_STATUS", ",", "request", ".", "getStatus", "(", ")", ")", ";", "}", "if", "(", "request", ".", "getBegin", "(", ")", "!=", "null", ")", "{", "internalRequest", ".", "addParameter", "(", "PARA_BEGIN", ",", "DateUtils", ".", "formatAlternateIso8601Date", "(", "request", ".", "getBegin", "(", ")", ")", ")", ";", "}", "if", "(", "request", ".", "getEnd", "(", ")", "!=", "null", ")", "{", "internalRequest", ".", "addParameter", "(", "PARA_END", ",", "DateUtils", ".", "formatAlternateIso8601Date", "(", "request", ".", "getEnd", "(", ")", ")", ")", ";", "}", "if", "(", "request", ".", "getTitle", "(", ")", "!=", "null", ")", "{", "internalRequest", ".", "addParameter", "(", "PARA_TITLE", ",", "request", ".", "getTitle", "(", ")", ")", ";", "}", "return", "invokeHttpClient", "(", "internalRequest", ",", "ListMediaResourceByMarkerResponse", ".", "class", ")", ";", "}" ]
List the properties of all media resource managed by VOD service. <p> The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair. @param request The request wrapper object containing all options. @return The properties of all specific media resources
[ "List", "the", "properties", "of", "all", "media", "resource", "managed", "by", "VOD", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L598-L619
geomajas/geomajas-project-client-gwt2
common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/Dom.java
Dom.createElement
public static Element createElement(String tagName, String id) { """ Creates an HTML element with the given id. @param tagName the HTML tag of the element to be created @return the newly-created element """ return IMPL.createElement(tagName, id); }
java
public static Element createElement(String tagName, String id) { return IMPL.createElement(tagName, id); }
[ "public", "static", "Element", "createElement", "(", "String", "tagName", ",", "String", "id", ")", "{", "return", "IMPL", ".", "createElement", "(", "tagName", ",", "id", ")", ";", "}" ]
Creates an HTML element with the given id. @param tagName the HTML tag of the element to be created @return the newly-created element
[ "Creates", "an", "HTML", "element", "with", "the", "given", "id", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/Dom.java#L126-L128
PeachTech/peachweb-peachproxy-java
src/main/java/com/peachfuzzer/web/api/PeachProxy.java
PeachProxy.sessionTeardown
public void sessionTeardown() throws PeachApiException { """ Stop testing job and destroy proxy. This will stop the current testing job and destroy the proxy. @throws PeachApiException """ stashUnirestProxy(); if(_debug) System.out.println(">>sessionTeardown"); try { HttpResponse<String> ret = null; try { ret = Unirest .delete(String.format("%s/api/sessions/%s", _api, _jobid)) .header(_token_header, _api_token) .asString(); } catch (UnirestException ex) { Logger.getLogger(PeachProxy.class.getName()).log(Level.SEVERE, "Error contacting Peach API", ex); throw new PeachApiException( String.format("Error, exception contacting Peach API: %s", ex.getMessage()), ex); } if(ret == null) { throw new PeachApiException("Error, in Proxy.sessionTearDown: ret was null", null); } if(ret.getStatus() != 200) { String errorMsg = String.format("Error, DELETE /api/sessions/{jobid} returned status code of %s: %s", ret.getStatus(), ret.getStatusText()); throw new PeachApiException(errorMsg, null); } } finally { revertUnirestProxy(); } }
java
public void sessionTeardown() throws PeachApiException { stashUnirestProxy(); if(_debug) System.out.println(">>sessionTeardown"); try { HttpResponse<String> ret = null; try { ret = Unirest .delete(String.format("%s/api/sessions/%s", _api, _jobid)) .header(_token_header, _api_token) .asString(); } catch (UnirestException ex) { Logger.getLogger(PeachProxy.class.getName()).log(Level.SEVERE, "Error contacting Peach API", ex); throw new PeachApiException( String.format("Error, exception contacting Peach API: %s", ex.getMessage()), ex); } if(ret == null) { throw new PeachApiException("Error, in Proxy.sessionTearDown: ret was null", null); } if(ret.getStatus() != 200) { String errorMsg = String.format("Error, DELETE /api/sessions/{jobid} returned status code of %s: %s", ret.getStatus(), ret.getStatusText()); throw new PeachApiException(errorMsg, null); } } finally { revertUnirestProxy(); } }
[ "public", "void", "sessionTeardown", "(", ")", "throws", "PeachApiException", "{", "stashUnirestProxy", "(", ")", ";", "if", "(", "_debug", ")", "System", ".", "out", ".", "println", "(", "\">>sessionTeardown\"", ")", ";", "try", "{", "HttpResponse", "<", "String", ">", "ret", "=", "null", ";", "try", "{", "ret", "=", "Unirest", ".", "delete", "(", "String", ".", "format", "(", "\"%s/api/sessions/%s\"", ",", "_api", ",", "_jobid", ")", ")", ".", "header", "(", "_token_header", ",", "_api_token", ")", ".", "asString", "(", ")", ";", "}", "catch", "(", "UnirestException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "PeachProxy", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Error contacting Peach API\"", ",", "ex", ")", ";", "throw", "new", "PeachApiException", "(", "String", ".", "format", "(", "\"Error, exception contacting Peach API: %s\"", ",", "ex", ".", "getMessage", "(", ")", ")", ",", "ex", ")", ";", "}", "if", "(", "ret", "==", "null", ")", "{", "throw", "new", "PeachApiException", "(", "\"Error, in Proxy.sessionTearDown: ret was null\"", ",", "null", ")", ";", "}", "if", "(", "ret", ".", "getStatus", "(", ")", "!=", "200", ")", "{", "String", "errorMsg", "=", "String", ".", "format", "(", "\"Error, DELETE /api/sessions/{jobid} returned status code of %s: %s\"", ",", "ret", ".", "getStatus", "(", ")", ",", "ret", ".", "getStatusText", "(", ")", ")", ";", "throw", "new", "PeachApiException", "(", "errorMsg", ",", "null", ")", ";", "}", "}", "finally", "{", "revertUnirestProxy", "(", ")", ";", "}", "}" ]
Stop testing job and destroy proxy. This will stop the current testing job and destroy the proxy. @throws PeachApiException
[ "Stop", "testing", "job", "and", "destroy", "proxy", "." ]
train
https://github.com/PeachTech/peachweb-peachproxy-java/blob/0ca274b0d1668fb4be0fed7e247394438374de58/src/main/java/com/peachfuzzer/web/api/PeachProxy.java#L373-L411
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/AppGameContainer.java
AppGameContainer.setFullscreen
public void setFullscreen(boolean fullscreen) throws SlickException { """ Indicate whether we want to be in fullscreen mode. Note that the current display mode must be valid as a fullscreen mode for this to work @param fullscreen True if we want to be in fullscreen mode @throws SlickException Indicates we failed to change the display mode """ if (isFullscreen() == fullscreen) { return; } if (!fullscreen) { try { Display.setFullscreen(fullscreen); } catch (LWJGLException e) { throw new SlickException("Unable to set fullscreen="+fullscreen, e); } } else { setDisplayMode(width, height, fullscreen); } getDelta(); }
java
public void setFullscreen(boolean fullscreen) throws SlickException { if (isFullscreen() == fullscreen) { return; } if (!fullscreen) { try { Display.setFullscreen(fullscreen); } catch (LWJGLException e) { throw new SlickException("Unable to set fullscreen="+fullscreen, e); } } else { setDisplayMode(width, height, fullscreen); } getDelta(); }
[ "public", "void", "setFullscreen", "(", "boolean", "fullscreen", ")", "throws", "SlickException", "{", "if", "(", "isFullscreen", "(", ")", "==", "fullscreen", ")", "{", "return", ";", "}", "if", "(", "!", "fullscreen", ")", "{", "try", "{", "Display", ".", "setFullscreen", "(", "fullscreen", ")", ";", "}", "catch", "(", "LWJGLException", "e", ")", "{", "throw", "new", "SlickException", "(", "\"Unable to set fullscreen=\"", "+", "fullscreen", ",", "e", ")", ";", "}", "}", "else", "{", "setDisplayMode", "(", "width", ",", "height", ",", "fullscreen", ")", ";", "}", "getDelta", "(", ")", ";", "}" ]
Indicate whether we want to be in fullscreen mode. Note that the current display mode must be valid as a fullscreen mode for this to work @param fullscreen True if we want to be in fullscreen mode @throws SlickException Indicates we failed to change the display mode
[ "Indicate", "whether", "we", "want", "to", "be", "in", "fullscreen", "mode", ".", "Note", "that", "the", "current", "display", "mode", "must", "be", "valid", "as", "a", "fullscreen", "mode", "for", "this", "to", "work" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/AppGameContainer.java#L186-L201
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_federation_activeDirectory_activeDirectoryId_GET
public OvhFederationAccessNetwork serviceName_federation_activeDirectory_activeDirectoryId_GET(String serviceName, Long activeDirectoryId) throws IOException { """ Get this object properties REST: GET /dedicatedCloud/{serviceName}/federation/activeDirectory/{activeDirectoryId} @param serviceName [required] Domain of the service @param activeDirectoryId [required] Id of the Active Directory """ String qPath = "/dedicatedCloud/{serviceName}/federation/activeDirectory/{activeDirectoryId}"; StringBuilder sb = path(qPath, serviceName, activeDirectoryId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhFederationAccessNetwork.class); }
java
public OvhFederationAccessNetwork serviceName_federation_activeDirectory_activeDirectoryId_GET(String serviceName, Long activeDirectoryId) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/federation/activeDirectory/{activeDirectoryId}"; StringBuilder sb = path(qPath, serviceName, activeDirectoryId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhFederationAccessNetwork.class); }
[ "public", "OvhFederationAccessNetwork", "serviceName_federation_activeDirectory_activeDirectoryId_GET", "(", "String", "serviceName", ",", "Long", "activeDirectoryId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/{serviceName}/federation/activeDirectory/{activeDirectoryId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "activeDirectoryId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhFederationAccessNetwork", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /dedicatedCloud/{serviceName}/federation/activeDirectory/{activeDirectoryId} @param serviceName [required] Domain of the service @param activeDirectoryId [required] Id of the Active Directory
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1136-L1141
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/BitmapUtil.java
BitmapUtil.splitVertically
public static Pair<Bitmap, Bitmap> splitVertically(@NonNull final Bitmap bitmap) { """ Splits a specific bitmap vertically at half. @param bitmap The bitmap, which should be split, as an instance of the class {@link Bitmap}. The bitmap may not be null @return A pair, which contains the two bitmaps, the original bitmap has been split into, as an instance of the class Pair """ return splitVertically(bitmap, bitmap.getWidth() / 2); }
java
public static Pair<Bitmap, Bitmap> splitVertically(@NonNull final Bitmap bitmap) { return splitVertically(bitmap, bitmap.getWidth() / 2); }
[ "public", "static", "Pair", "<", "Bitmap", ",", "Bitmap", ">", "splitVertically", "(", "@", "NonNull", "final", "Bitmap", "bitmap", ")", "{", "return", "splitVertically", "(", "bitmap", ",", "bitmap", ".", "getWidth", "(", ")", "/", "2", ")", ";", "}" ]
Splits a specific bitmap vertically at half. @param bitmap The bitmap, which should be split, as an instance of the class {@link Bitmap}. The bitmap may not be null @return A pair, which contains the two bitmaps, the original bitmap has been split into, as an instance of the class Pair
[ "Splits", "a", "specific", "bitmap", "vertically", "at", "half", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/BitmapUtil.java#L407-L409
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java
X500Name.getRFC2253Name
public String getRFC2253Name(Map<String, String> oidMap) { """ Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 2253. Attribute type keywords defined in RFC 2253 are emitted, as well as additional keywords contained in the OID/keyword map. """ /* check for and return cached name */ if (oidMap.isEmpty()) { if (rfc2253Dn != null) { return rfc2253Dn; } else { rfc2253Dn = generateRFC2253DN(oidMap); return rfc2253Dn; } } return generateRFC2253DN(oidMap); }
java
public String getRFC2253Name(Map<String, String> oidMap) { /* check for and return cached name */ if (oidMap.isEmpty()) { if (rfc2253Dn != null) { return rfc2253Dn; } else { rfc2253Dn = generateRFC2253DN(oidMap); return rfc2253Dn; } } return generateRFC2253DN(oidMap); }
[ "public", "String", "getRFC2253Name", "(", "Map", "<", "String", ",", "String", ">", "oidMap", ")", "{", "/* check for and return cached name */", "if", "(", "oidMap", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "rfc2253Dn", "!=", "null", ")", "{", "return", "rfc2253Dn", ";", "}", "else", "{", "rfc2253Dn", "=", "generateRFC2253DN", "(", "oidMap", ")", ";", "return", "rfc2253Dn", ";", "}", "}", "return", "generateRFC2253DN", "(", "oidMap", ")", ";", "}" ]
Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 2253. Attribute type keywords defined in RFC 2253 are emitted, as well as additional keywords contained in the OID/keyword map.
[ "Returns", "a", "string", "form", "of", "the", "X", ".", "500", "distinguished", "name", "using", "the", "algorithm", "defined", "in", "RFC", "2253", ".", "Attribute", "type", "keywords", "defined", "in", "RFC", "2253", "are", "emitted", "as", "well", "as", "additional", "keywords", "contained", "in", "the", "OID", "/", "keyword", "map", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java#L665-L676
landawn/AbacusUtil
src/com/landawn/abacus/util/Sheet.java
Sheet.swapColumns
public void swapColumns(Object columnKeyA, Object columnKeyB) { """ Swap the positions of the two specified columns. @param columnKeyA @param columnKeyB """ checkFrozen(); final int columnIndexA = this.getColumnIndex(columnKeyA); final int columnIndexB = this.getColumnIndex(columnKeyB); final List<C> tmp = new ArrayList<>(rowLength()); tmp.addAll(_columnKeySet); final C tmpColumnKeyA = tmp.get(columnIndexA); tmp.set(columnIndexA, tmp.get(columnIndexB)); tmp.set(columnIndexB, tmpColumnKeyA); _columnKeySet.clear(); _columnKeySet.addAll(tmp); _columnKeyIndexMap.forcePut(tmp.get(columnIndexA), columnIndexA); _columnKeyIndexMap.forcePut(tmp.get(columnIndexB), columnIndexB); if (_initialized && _columnList.size() > 0) { final List<E> tmpColumnA = _columnList.get(columnIndexA); _columnList.set(columnIndexA, _columnList.get(columnIndexB)); _columnList.set(columnIndexB, tmpColumnA); } }
java
public void swapColumns(Object columnKeyA, Object columnKeyB) { checkFrozen(); final int columnIndexA = this.getColumnIndex(columnKeyA); final int columnIndexB = this.getColumnIndex(columnKeyB); final List<C> tmp = new ArrayList<>(rowLength()); tmp.addAll(_columnKeySet); final C tmpColumnKeyA = tmp.get(columnIndexA); tmp.set(columnIndexA, tmp.get(columnIndexB)); tmp.set(columnIndexB, tmpColumnKeyA); _columnKeySet.clear(); _columnKeySet.addAll(tmp); _columnKeyIndexMap.forcePut(tmp.get(columnIndexA), columnIndexA); _columnKeyIndexMap.forcePut(tmp.get(columnIndexB), columnIndexB); if (_initialized && _columnList.size() > 0) { final List<E> tmpColumnA = _columnList.get(columnIndexA); _columnList.set(columnIndexA, _columnList.get(columnIndexB)); _columnList.set(columnIndexB, tmpColumnA); } }
[ "public", "void", "swapColumns", "(", "Object", "columnKeyA", ",", "Object", "columnKeyB", ")", "{", "checkFrozen", "(", ")", ";", "final", "int", "columnIndexA", "=", "this", ".", "getColumnIndex", "(", "columnKeyA", ")", ";", "final", "int", "columnIndexB", "=", "this", ".", "getColumnIndex", "(", "columnKeyB", ")", ";", "final", "List", "<", "C", ">", "tmp", "=", "new", "ArrayList", "<>", "(", "rowLength", "(", ")", ")", ";", "tmp", ".", "addAll", "(", "_columnKeySet", ")", ";", "final", "C", "tmpColumnKeyA", "=", "tmp", ".", "get", "(", "columnIndexA", ")", ";", "tmp", ".", "set", "(", "columnIndexA", ",", "tmp", ".", "get", "(", "columnIndexB", ")", ")", ";", "tmp", ".", "set", "(", "columnIndexB", ",", "tmpColumnKeyA", ")", ";", "_columnKeySet", ".", "clear", "(", ")", ";", "_columnKeySet", ".", "addAll", "(", "tmp", ")", ";", "_columnKeyIndexMap", ".", "forcePut", "(", "tmp", ".", "get", "(", "columnIndexA", ")", ",", "columnIndexA", ")", ";", "_columnKeyIndexMap", ".", "forcePut", "(", "tmp", ".", "get", "(", "columnIndexB", ")", ",", "columnIndexB", ")", ";", "if", "(", "_initialized", "&&", "_columnList", ".", "size", "(", ")", ">", "0", ")", "{", "final", "List", "<", "E", ">", "tmpColumnA", "=", "_columnList", ".", "get", "(", "columnIndexA", ")", ";", "_columnList", ".", "set", "(", "columnIndexA", ",", "_columnList", ".", "get", "(", "columnIndexB", ")", ")", ";", "_columnList", ".", "set", "(", "columnIndexB", ",", "tmpColumnA", ")", ";", "}", "}" ]
Swap the positions of the two specified columns. @param columnKeyA @param columnKeyB
[ "Swap", "the", "positions", "of", "the", "two", "specified", "columns", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Sheet.java#L849-L873
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/impl/StdScheduler.java
StdScheduler.scheduleJob
public Date scheduleJob (final IJobDetail jobDetail, final ITrigger trigger) throws SchedulerException { """ <p> Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>. </p> """ return m_aSched.scheduleJob (jobDetail, trigger); }
java
public Date scheduleJob (final IJobDetail jobDetail, final ITrigger trigger) throws SchedulerException { return m_aSched.scheduleJob (jobDetail, trigger); }
[ "public", "Date", "scheduleJob", "(", "final", "IJobDetail", "jobDetail", ",", "final", "ITrigger", "trigger", ")", "throws", "SchedulerException", "{", "return", "m_aSched", ".", "scheduleJob", "(", "jobDetail", ",", "trigger", ")", ";", "}" ]
<p> Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>. </p>
[ "<p", ">", "Calls", "the", "equivalent", "method", "on", "the", "proxied", "<code", ">", "QuartzScheduler<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/StdScheduler.java#L249-L252
DataArt/CalculationEngine
calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java
DependencyExtractors.createDataModelFromCell
static IDataModel createDataModelFromCell(Sheet sheet, FormulaParsingWorkbook workbook, IA1Address address) { """ Based on given cell address creates new {@link IDataModel} with all parsed cell dependencies. """ IDataModel dm = new DataModel(randomUUID().toString()); resolveCellDependencies(address, sheet, workbook).forEach(cell -> ConverterUtils.copyCell(new CellAddress(dm.getDataModelId(), cell), sheet, dm)); return dm; }
java
static IDataModel createDataModelFromCell(Sheet sheet, FormulaParsingWorkbook workbook, IA1Address address) { IDataModel dm = new DataModel(randomUUID().toString()); resolveCellDependencies(address, sheet, workbook).forEach(cell -> ConverterUtils.copyCell(new CellAddress(dm.getDataModelId(), cell), sheet, dm)); return dm; }
[ "static", "IDataModel", "createDataModelFromCell", "(", "Sheet", "sheet", ",", "FormulaParsingWorkbook", "workbook", ",", "IA1Address", "address", ")", "{", "IDataModel", "dm", "=", "new", "DataModel", "(", "randomUUID", "(", ")", ".", "toString", "(", ")", ")", ";", "resolveCellDependencies", "(", "address", ",", "sheet", ",", "workbook", ")", ".", "forEach", "(", "cell", "->", "ConverterUtils", ".", "copyCell", "(", "new", "CellAddress", "(", "dm", ".", "getDataModelId", "(", ")", ",", "cell", ")", ",", "sheet", ",", "dm", ")", ")", ";", "return", "dm", ";", "}" ]
Based on given cell address creates new {@link IDataModel} with all parsed cell dependencies.
[ "Based", "on", "given", "cell", "address", "creates", "new", "{" ]
train
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java#L169-L173
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/CursorLoader.java
CursorLoader.getCursor
public Cursor getCursor(ByteBuffer buf,int x,int y,int width,int height) throws IOException, LWJGLException { """ Get a cursor based on a set of image data @param buf The image data (stored in RGBA) to load the cursor from @param x The x-coordinate of the cursor hotspot (left -> right) @param y The y-coordinate of the cursor hotspot (bottom -> top) @param width The width of the image data provided @param height The height of the image data provided @return The create cursor @throws IOException Indicates a failure to load the image @throws LWJGLException Indicates a failure to create the hardware cursor """ for (int i=0;i<buf.limit();i+=4) { byte red = buf.get(i); byte green = buf.get(i+1); byte blue = buf.get(i+2); byte alpha = buf.get(i+3); buf.put(i+2, red); buf.put(i+1, green); buf.put(i, blue); buf.put(i+3, alpha); } try { int yspot = height - y - 1; if (yspot < 0) { yspot = 0; } return new Cursor(width,height, x, yspot, 1, buf.asIntBuffer(), null); } catch (Throwable e) { Log.info("Chances are you cursor is too small for this platform"); throw new LWJGLException(e); } }
java
public Cursor getCursor(ByteBuffer buf,int x,int y,int width,int height) throws IOException, LWJGLException { for (int i=0;i<buf.limit();i+=4) { byte red = buf.get(i); byte green = buf.get(i+1); byte blue = buf.get(i+2); byte alpha = buf.get(i+3); buf.put(i+2, red); buf.put(i+1, green); buf.put(i, blue); buf.put(i+3, alpha); } try { int yspot = height - y - 1; if (yspot < 0) { yspot = 0; } return new Cursor(width,height, x, yspot, 1, buf.asIntBuffer(), null); } catch (Throwable e) { Log.info("Chances are you cursor is too small for this platform"); throw new LWJGLException(e); } }
[ "public", "Cursor", "getCursor", "(", "ByteBuffer", "buf", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "throws", "IOException", ",", "LWJGLException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buf", ".", "limit", "(", ")", ";", "i", "+=", "4", ")", "{", "byte", "red", "=", "buf", ".", "get", "(", "i", ")", ";", "byte", "green", "=", "buf", ".", "get", "(", "i", "+", "1", ")", ";", "byte", "blue", "=", "buf", ".", "get", "(", "i", "+", "2", ")", ";", "byte", "alpha", "=", "buf", ".", "get", "(", "i", "+", "3", ")", ";", "buf", ".", "put", "(", "i", "+", "2", ",", "red", ")", ";", "buf", ".", "put", "(", "i", "+", "1", ",", "green", ")", ";", "buf", ".", "put", "(", "i", ",", "blue", ")", ";", "buf", ".", "put", "(", "i", "+", "3", ",", "alpha", ")", ";", "}", "try", "{", "int", "yspot", "=", "height", "-", "y", "-", "1", ";", "if", "(", "yspot", "<", "0", ")", "{", "yspot", "=", "0", ";", "}", "return", "new", "Cursor", "(", "width", ",", "height", ",", "x", ",", "yspot", ",", "1", ",", "buf", ".", "asIntBuffer", "(", ")", ",", "null", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "Log", ".", "info", "(", "\"Chances are you cursor is too small for this platform\"", ")", ";", "throw", "new", "LWJGLException", "(", "e", ")", ";", "}", "}" ]
Get a cursor based on a set of image data @param buf The image data (stored in RGBA) to load the cursor from @param x The x-coordinate of the cursor hotspot (left -> right) @param y The y-coordinate of the cursor hotspot (bottom -> top) @param width The width of the image data provided @param height The height of the image data provided @return The create cursor @throws IOException Indicates a failure to load the image @throws LWJGLException Indicates a failure to create the hardware cursor
[ "Get", "a", "cursor", "based", "on", "a", "set", "of", "image", "data" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/CursorLoader.java#L94-L117
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java
NominatimSearchRequest.setViewBox
public void setViewBox(final int westE6, final int northE6, final int eastE6, final int southE6) { """ Sets the preferred area to find search results; @param westE6 the west bound @param northE6 the north bound @param eastE6 the east bound @param southE6 the south bound """ this.viewBox = new BoundingBox(); this.viewBox.setWestE6(westE6); this.viewBox.setNorthE6(northE6); this.viewBox.setEastE6(eastE6); this.viewBox.setSouthE6(southE6); }
java
public void setViewBox(final int westE6, final int northE6, final int eastE6, final int southE6) { this.viewBox = new BoundingBox(); this.viewBox.setWestE6(westE6); this.viewBox.setNorthE6(northE6); this.viewBox.setEastE6(eastE6); this.viewBox.setSouthE6(southE6); }
[ "public", "void", "setViewBox", "(", "final", "int", "westE6", ",", "final", "int", "northE6", ",", "final", "int", "eastE6", ",", "final", "int", "southE6", ")", "{", "this", ".", "viewBox", "=", "new", "BoundingBox", "(", ")", ";", "this", ".", "viewBox", ".", "setWestE6", "(", "westE6", ")", ";", "this", ".", "viewBox", ".", "setNorthE6", "(", "northE6", ")", ";", "this", ".", "viewBox", ".", "setEastE6", "(", "eastE6", ")", ";", "this", ".", "viewBox", ".", "setSouthE6", "(", "southE6", ")", ";", "}" ]
Sets the preferred area to find search results; @param westE6 the west bound @param northE6 the north bound @param eastE6 the east bound @param southE6 the south bound
[ "Sets", "the", "preferred", "area", "to", "find", "search", "results", ";" ]
train
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java#L235-L241
google/closure-compiler
src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java
DevirtualizePrototypeMethods.isEligibleDefinitionSite
private boolean isEligibleDefinitionSite(String name, Node definitionSite) { """ Determines if a method definition site is eligible for rewrite as a global. <p>In order to be eligible for rewrite, the definition site must: <ul> <li>Not be exported <li>Be for a prototype method </ul> """ switch (definitionSite.getToken()) { case GETPROP: case MEMBER_FUNCTION_DEF: case STRING_KEY: break; default: // No other node types are supported. throw new IllegalArgumentException(definitionSite.toString()); } // Exporting a method prevents rewrite. CodingConvention codingConvention = compiler.getCodingConvention(); if (codingConvention.isExported(name)) { return false; } if (!isPrototypeMethodDefinition(definitionSite)) { return false; } return true; }
java
private boolean isEligibleDefinitionSite(String name, Node definitionSite) { switch (definitionSite.getToken()) { case GETPROP: case MEMBER_FUNCTION_DEF: case STRING_KEY: break; default: // No other node types are supported. throw new IllegalArgumentException(definitionSite.toString()); } // Exporting a method prevents rewrite. CodingConvention codingConvention = compiler.getCodingConvention(); if (codingConvention.isExported(name)) { return false; } if (!isPrototypeMethodDefinition(definitionSite)) { return false; } return true; }
[ "private", "boolean", "isEligibleDefinitionSite", "(", "String", "name", ",", "Node", "definitionSite", ")", "{", "switch", "(", "definitionSite", ".", "getToken", "(", ")", ")", "{", "case", "GETPROP", ":", "case", "MEMBER_FUNCTION_DEF", ":", "case", "STRING_KEY", ":", "break", ";", "default", ":", "// No other node types are supported.", "throw", "new", "IllegalArgumentException", "(", "definitionSite", ".", "toString", "(", ")", ")", ";", "}", "// Exporting a method prevents rewrite.", "CodingConvention", "codingConvention", "=", "compiler", ".", "getCodingConvention", "(", ")", ";", "if", "(", "codingConvention", ".", "isExported", "(", "name", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "isPrototypeMethodDefinition", "(", "definitionSite", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Determines if a method definition site is eligible for rewrite as a global. <p>In order to be eligible for rewrite, the definition site must: <ul> <li>Not be exported <li>Be for a prototype method </ul>
[ "Determines", "if", "a", "method", "definition", "site", "is", "eligible", "for", "rewrite", "as", "a", "global", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java#L215-L238
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/render/R.java
R.addClass2FacetComponent
public static void addClass2FacetComponent(UIComponent f, String cname, String aclass) { """ Adds a CSS class to a component within a facet. @param f the facet @param cname the class name of the component to be manipulated. @param aclass the CSS class to be added """ // If the facet contains only one component, getChildCount()=0 and the // Facet is the UIComponent if (f.getClass().getName().endsWith(cname)) { addClass2Component(f, aclass); } else { if (f.getChildCount() > 0) { for (UIComponent c : f.getChildren()) { if (c.getClass().getName().endsWith(cname)) { addClass2Component(c, aclass); } } } } }
java
public static void addClass2FacetComponent(UIComponent f, String cname, String aclass) { // If the facet contains only one component, getChildCount()=0 and the // Facet is the UIComponent if (f.getClass().getName().endsWith(cname)) { addClass2Component(f, aclass); } else { if (f.getChildCount() > 0) { for (UIComponent c : f.getChildren()) { if (c.getClass().getName().endsWith(cname)) { addClass2Component(c, aclass); } } } } }
[ "public", "static", "void", "addClass2FacetComponent", "(", "UIComponent", "f", ",", "String", "cname", ",", "String", "aclass", ")", "{", "// If the facet contains only one component, getChildCount()=0 and the", "// Facet is the UIComponent", "if", "(", "f", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "endsWith", "(", "cname", ")", ")", "{", "addClass2Component", "(", "f", ",", "aclass", ")", ";", "}", "else", "{", "if", "(", "f", ".", "getChildCount", "(", ")", ">", "0", ")", "{", "for", "(", "UIComponent", "c", ":", "f", ".", "getChildren", "(", ")", ")", "{", "if", "(", "c", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "endsWith", "(", "cname", ")", ")", "{", "addClass2Component", "(", "c", ",", "aclass", ")", ";", "}", "}", "}", "}", "}" ]
Adds a CSS class to a component within a facet. @param f the facet @param cname the class name of the component to be manipulated. @param aclass the CSS class to be added
[ "Adds", "a", "CSS", "class", "to", "a", "component", "within", "a", "facet", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L171-L185
lucee/Lucee
core/src/main/java/lucee/runtime/registry/RegistryQuery.java
RegistryQuery.getValue
public static RegistryEntry getValue(String branch, String entry, short type) throws RegistryException, IOException, InterruptedException { """ gets a single value form the registry @param branch brach to get value from @param entry entry to get @param type type of the registry entry to get @return registry entry or null of not exist @throws RegistryException @throws IOException @throws InterruptedException """ String[] cmd = new String[] { "reg", "query", cleanBrunch(branch), "/v", entry }; RegistryEntry[] rst = filter(executeQuery(cmd), branch, type); if (rst.length == 1) { return rst[0]; // if(type==RegistryEntry.TYPE_ANY || type==r.getType()) return r; } return null; }
java
public static RegistryEntry getValue(String branch, String entry, short type) throws RegistryException, IOException, InterruptedException { String[] cmd = new String[] { "reg", "query", cleanBrunch(branch), "/v", entry }; RegistryEntry[] rst = filter(executeQuery(cmd), branch, type); if (rst.length == 1) { return rst[0]; // if(type==RegistryEntry.TYPE_ANY || type==r.getType()) return r; } return null; }
[ "public", "static", "RegistryEntry", "getValue", "(", "String", "branch", ",", "String", "entry", ",", "short", "type", ")", "throws", "RegistryException", ",", "IOException", ",", "InterruptedException", "{", "String", "[", "]", "cmd", "=", "new", "String", "[", "]", "{", "\"reg\"", ",", "\"query\"", ",", "cleanBrunch", "(", "branch", ")", ",", "\"/v\"", ",", "entry", "}", ";", "RegistryEntry", "[", "]", "rst", "=", "filter", "(", "executeQuery", "(", "cmd", ")", ",", "branch", ",", "type", ")", ";", "if", "(", "rst", ".", "length", "==", "1", ")", "{", "return", "rst", "[", "0", "]", ";", "// if(type==RegistryEntry.TYPE_ANY || type==r.getType()) return r;", "}", "return", "null", ";", "}" ]
gets a single value form the registry @param branch brach to get value from @param entry entry to get @param type type of the registry entry to get @return registry entry or null of not exist @throws RegistryException @throws IOException @throws InterruptedException
[ "gets", "a", "single", "value", "form", "the", "registry" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/registry/RegistryQuery.java#L65-L73
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.indexOfIgnoreCase
public static int indexOfIgnoreCase(String[] arr, String value) { """ return index of given value in Array or -1 @param arr @param value @return index of position in array """ for (int i = 0; i < arr.length; i++) { if (arr[i].equalsIgnoreCase(value)) return i; } return -1; }
java
public static int indexOfIgnoreCase(String[] arr, String value) { for (int i = 0; i < arr.length; i++) { if (arr[i].equalsIgnoreCase(value)) return i; } return -1; }
[ "public", "static", "int", "indexOfIgnoreCase", "(", "String", "[", "]", "arr", ",", "String", "value", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "if", "(", "arr", "[", "i", "]", ".", "equalsIgnoreCase", "(", "value", ")", ")", "return", "i", ";", "}", "return", "-", "1", ";", "}" ]
return index of given value in Array or -1 @param arr @param value @return index of position in array
[ "return", "index", "of", "given", "value", "in", "Array", "or", "-", "1" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L320-L325
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/simple/SimpleMatrix.java
SimpleMatrix.randomNormal
public static SimpleMatrix randomNormal( SimpleMatrix covariance , Random random ) { """ <p> Creates a new vector which is drawn from a multivariate normal distribution with zero mean and the provided covariance. </p> @see CovarianceRandomDraw_DDRM @param covariance Covariance of the multivariate normal distribution @return Vector randomly drawn from the distribution """ SimpleMatrix found = new SimpleMatrix(covariance.numRows(), 1,covariance.getType()); switch( found.getType() ) { case DDRM:{ CovarianceRandomDraw_DDRM draw = new CovarianceRandomDraw_DDRM(random, (DMatrixRMaj)covariance.getMatrix()); draw.next((DMatrixRMaj)found.getMatrix()); }break; case FDRM:{ CovarianceRandomDraw_FDRM draw = new CovarianceRandomDraw_FDRM(random, (FMatrixRMaj)covariance.getMatrix()); draw.next((FMatrixRMaj)found.getMatrix()); }break; default: throw new IllegalArgumentException("Matrix type is currently not supported"); } return found; }
java
public static SimpleMatrix randomNormal( SimpleMatrix covariance , Random random ) { SimpleMatrix found = new SimpleMatrix(covariance.numRows(), 1,covariance.getType()); switch( found.getType() ) { case DDRM:{ CovarianceRandomDraw_DDRM draw = new CovarianceRandomDraw_DDRM(random, (DMatrixRMaj)covariance.getMatrix()); draw.next((DMatrixRMaj)found.getMatrix()); }break; case FDRM:{ CovarianceRandomDraw_FDRM draw = new CovarianceRandomDraw_FDRM(random, (FMatrixRMaj)covariance.getMatrix()); draw.next((FMatrixRMaj)found.getMatrix()); }break; default: throw new IllegalArgumentException("Matrix type is currently not supported"); } return found; }
[ "public", "static", "SimpleMatrix", "randomNormal", "(", "SimpleMatrix", "covariance", ",", "Random", "random", ")", "{", "SimpleMatrix", "found", "=", "new", "SimpleMatrix", "(", "covariance", ".", "numRows", "(", ")", ",", "1", ",", "covariance", ".", "getType", "(", ")", ")", ";", "switch", "(", "found", ".", "getType", "(", ")", ")", "{", "case", "DDRM", ":", "{", "CovarianceRandomDraw_DDRM", "draw", "=", "new", "CovarianceRandomDraw_DDRM", "(", "random", ",", "(", "DMatrixRMaj", ")", "covariance", ".", "getMatrix", "(", ")", ")", ";", "draw", ".", "next", "(", "(", "DMatrixRMaj", ")", "found", ".", "getMatrix", "(", ")", ")", ";", "}", "break", ";", "case", "FDRM", ":", "{", "CovarianceRandomDraw_FDRM", "draw", "=", "new", "CovarianceRandomDraw_FDRM", "(", "random", ",", "(", "FMatrixRMaj", ")", "covariance", ".", "getMatrix", "(", ")", ")", ";", "draw", ".", "next", "(", "(", "FMatrixRMaj", ")", "found", ".", "getMatrix", "(", ")", ")", ";", "}", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Matrix type is currently not supported\"", ")", ";", "}", "return", "found", ";", "}" ]
<p> Creates a new vector which is drawn from a multivariate normal distribution with zero mean and the provided covariance. </p> @see CovarianceRandomDraw_DDRM @param covariance Covariance of the multivariate normal distribution @return Vector randomly drawn from the distribution
[ "<p", ">", "Creates", "a", "new", "vector", "which", "is", "drawn", "from", "a", "multivariate", "normal", "distribution", "with", "zero", "mean", "and", "the", "provided", "covariance", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleMatrix.java#L313-L335
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java
GVRAssetLoader.loadModel
public void loadModel(final GVRSceneObject model, final GVRResourceVolume volume, final EnumSet<GVRImportSettings> settings, final GVRScene scene) { """ Loads a hierarchy of scene objects {@link GVRSceneObject} asymchronously from a 3D model on the volume provided and adds it to the specified scene. <p> and will return before the model is loaded. IAssetEvents are emitted to event listeners attached to the context. The resource volume may reference res/raw in which case all textures and other referenced assets must also come from res/raw. The asset loader cannot load textures from the drawable directory. @param model A GVRSceneObject to become the root of the loaded model. @param volume A GVRResourceVolume based on the asset path to load. This volume will be used as the base for loading textures and other models contained within the model. You can subclass GVRResourceVolume to provide custom IO. @param settings Import settings controlling how assets are imported @param scene If present, this asset loader will wait until all of the textures have been loaded and then it will add the model to the scene. @see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) @see #loadScene(GVRSceneObject, GVRResourceVolume, EnumSet, GVRScene, IAssetEvents) """ Threads.spawn(new Runnable() { public void run() { String filePath = volume.getFileName(); AssetRequest assetRequest = new AssetRequest(model, volume, scene, null, false); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(settings); try { if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } } catch (IOException ex) { // onModelError is generated in this case. } } }); }
java
public void loadModel(final GVRSceneObject model, final GVRResourceVolume volume, final EnumSet<GVRImportSettings> settings, final GVRScene scene) { Threads.spawn(new Runnable() { public void run() { String filePath = volume.getFileName(); AssetRequest assetRequest = new AssetRequest(model, volume, scene, null, false); String ext = filePath.substring(filePath.length() - 3).toLowerCase(); model.setName(assetRequest.getBaseName()); assetRequest.setImportSettings(settings); try { if (ext.equals("x3d")) { loadX3DModel(assetRequest, model); } else { loadJassimpModel(assetRequest, model); } } catch (IOException ex) { // onModelError is generated in this case. } } }); }
[ "public", "void", "loadModel", "(", "final", "GVRSceneObject", "model", ",", "final", "GVRResourceVolume", "volume", ",", "final", "EnumSet", "<", "GVRImportSettings", ">", "settings", ",", "final", "GVRScene", "scene", ")", "{", "Threads", ".", "spawn", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "String", "filePath", "=", "volume", ".", "getFileName", "(", ")", ";", "AssetRequest", "assetRequest", "=", "new", "AssetRequest", "(", "model", ",", "volume", ",", "scene", ",", "null", ",", "false", ")", ";", "String", "ext", "=", "filePath", ".", "substring", "(", "filePath", ".", "length", "(", ")", "-", "3", ")", ".", "toLowerCase", "(", ")", ";", "model", ".", "setName", "(", "assetRequest", ".", "getBaseName", "(", ")", ")", ";", "assetRequest", ".", "setImportSettings", "(", "settings", ")", ";", "try", "{", "if", "(", "ext", ".", "equals", "(", "\"x3d\"", ")", ")", "{", "loadX3DModel", "(", "assetRequest", ",", "model", ")", ";", "}", "else", "{", "loadJassimpModel", "(", "assetRequest", ",", "model", ")", ";", "}", "}", "catch", "(", "IOException", "ex", ")", "{", "// onModelError is generated in this case.", "}", "}", "}", ")", ";", "}" ]
Loads a hierarchy of scene objects {@link GVRSceneObject} asymchronously from a 3D model on the volume provided and adds it to the specified scene. <p> and will return before the model is loaded. IAssetEvents are emitted to event listeners attached to the context. The resource volume may reference res/raw in which case all textures and other referenced assets must also come from res/raw. The asset loader cannot load textures from the drawable directory. @param model A GVRSceneObject to become the root of the loaded model. @param volume A GVRResourceVolume based on the asset path to load. This volume will be used as the base for loading textures and other models contained within the model. You can subclass GVRResourceVolume to provide custom IO. @param settings Import settings controlling how assets are imported @param scene If present, this asset loader will wait until all of the textures have been loaded and then it will add the model to the scene. @see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int) @see #loadScene(GVRSceneObject, GVRResourceVolume, EnumSet, GVRScene, IAssetEvents)
[ "Loads", "a", "hierarchy", "of", "scene", "objects", "{", "@link", "GVRSceneObject", "}", "asymchronously", "from", "a", "3D", "model", "on", "the", "volume", "provided", "and", "adds", "it", "to", "the", "specified", "scene", ".", "<p", ">", "and", "will", "return", "before", "the", "model", "is", "loaded", ".", "IAssetEvents", "are", "emitted", "to", "event", "listeners", "attached", "to", "the", "context", ".", "The", "resource", "volume", "may", "reference", "res", "/", "raw", "in", "which", "case", "all", "textures", "and", "other", "referenced", "assets", "must", "also", "come", "from", "res", "/", "raw", ".", "The", "asset", "loader", "cannot", "load", "textures", "from", "the", "drawable", "directory", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java#L1343-L1372
Azure/azure-sdk-for-java
keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java
VaultsInner.createOrUpdate
public VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultCreateOrUpdateParameters parameters) { """ Create or update a key vault in the specified subscription. @param resourceGroupName The name of the Resource Group to which the server belongs. @param vaultName Name of the vault @param parameters Parameters to create or update the vault @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 VaultInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).toBlocking().single().body(); }
java
public VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).toBlocking().single().body(); }
[ "public", "VaultInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "vaultName", ",", "VaultCreateOrUpdateParameters", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "vaultName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or update a key vault in the specified subscription. @param resourceGroupName The name of the Resource Group to which the server belongs. @param vaultName Name of the vault @param parameters Parameters to create or update the vault @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 VaultInner object if successful.
[ "Create", "or", "update", "a", "key", "vault", "in", "the", "specified", "subscription", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java#L155-L157
alkacon/opencms-core
src/org/opencms/gwt/CmsBrokenLinkRenderer.java
CmsBrokenLinkRenderer.renderBrokenLink
public List<CmsBrokenLinkBean> renderBrokenLink(CmsResource target, CmsResource source) throws CmsException { """ Renders the source of a broken link as a list of CmsBrokenLinkBean instances.<p> @param target the broken link target @param source the broken link source @return the list of broken link beans to display to the user @throws CmsException if something goes wrong """ I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(source); String typeName = resType.getTypeName(); if (typeName.equals(CmsResourceTypeXmlContainerPage.INHERIT_CONTAINER_CONFIG_TYPE_NAME)) { return renderBrokenLinkInheritanceGroup(target, source); } else if (CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME.equals(typeName)) { return renderBrokenLinkGroupContainer(target, source); } else { return renderBrokenLinkDefault(target, source); } }
java
public List<CmsBrokenLinkBean> renderBrokenLink(CmsResource target, CmsResource source) throws CmsException { I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(source); String typeName = resType.getTypeName(); if (typeName.equals(CmsResourceTypeXmlContainerPage.INHERIT_CONTAINER_CONFIG_TYPE_NAME)) { return renderBrokenLinkInheritanceGroup(target, source); } else if (CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME.equals(typeName)) { return renderBrokenLinkGroupContainer(target, source); } else { return renderBrokenLinkDefault(target, source); } }
[ "public", "List", "<", "CmsBrokenLinkBean", ">", "renderBrokenLink", "(", "CmsResource", "target", ",", "CmsResource", "source", ")", "throws", "CmsException", "{", "I_CmsResourceType", "resType", "=", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "source", ")", ";", "String", "typeName", "=", "resType", ".", "getTypeName", "(", ")", ";", "if", "(", "typeName", ".", "equals", "(", "CmsResourceTypeXmlContainerPage", ".", "INHERIT_CONTAINER_CONFIG_TYPE_NAME", ")", ")", "{", "return", "renderBrokenLinkInheritanceGroup", "(", "target", ",", "source", ")", ";", "}", "else", "if", "(", "CmsResourceTypeXmlContainerPage", ".", "GROUP_CONTAINER_TYPE_NAME", ".", "equals", "(", "typeName", ")", ")", "{", "return", "renderBrokenLinkGroupContainer", "(", "target", ",", "source", ")", ";", "}", "else", "{", "return", "renderBrokenLinkDefault", "(", "target", ",", "source", ")", ";", "}", "}" ]
Renders the source of a broken link as a list of CmsBrokenLinkBean instances.<p> @param target the broken link target @param source the broken link source @return the list of broken link beans to display to the user @throws CmsException if something goes wrong
[ "Renders", "the", "source", "of", "a", "broken", "link", "as", "a", "list", "of", "CmsBrokenLinkBean", "instances", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsBrokenLinkRenderer.java#L84-L95
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.unexpandLine
public static String unexpandLine(CharSequence self, int tabStop) { """ Replaces sequences of whitespaces with tabs within a line. @param self A line to unexpand @param tabStop The number of spaces a tab represents @return an unexpanded String @since 1.8.2 """ StringBuilder builder = new StringBuilder(self.toString()); int index = 0; while (index + tabStop < builder.length()) { // cut original string in tabstop-length pieces String piece = builder.substring(index, index + tabStop); // count trailing whitespace characters int count = 0; while ((count < tabStop) && (Character.isWhitespace(piece.charAt(tabStop - (count + 1))))) count++; // replace if whitespace was found if (count > 0) { piece = piece.substring(0, tabStop - count) + '\t'; builder.replace(index, index + tabStop, piece); index = index + tabStop - (count - 1); } else index = index + tabStop; } return builder.toString(); }
java
public static String unexpandLine(CharSequence self, int tabStop) { StringBuilder builder = new StringBuilder(self.toString()); int index = 0; while (index + tabStop < builder.length()) { // cut original string in tabstop-length pieces String piece = builder.substring(index, index + tabStop); // count trailing whitespace characters int count = 0; while ((count < tabStop) && (Character.isWhitespace(piece.charAt(tabStop - (count + 1))))) count++; // replace if whitespace was found if (count > 0) { piece = piece.substring(0, tabStop - count) + '\t'; builder.replace(index, index + tabStop, piece); index = index + tabStop - (count - 1); } else index = index + tabStop; } return builder.toString(); }
[ "public", "static", "String", "unexpandLine", "(", "CharSequence", "self", ",", "int", "tabStop", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "self", ".", "toString", "(", ")", ")", ";", "int", "index", "=", "0", ";", "while", "(", "index", "+", "tabStop", "<", "builder", ".", "length", "(", ")", ")", "{", "// cut original string in tabstop-length pieces", "String", "piece", "=", "builder", ".", "substring", "(", "index", ",", "index", "+", "tabStop", ")", ";", "// count trailing whitespace characters", "int", "count", "=", "0", ";", "while", "(", "(", "count", "<", "tabStop", ")", "&&", "(", "Character", ".", "isWhitespace", "(", "piece", ".", "charAt", "(", "tabStop", "-", "(", "count", "+", "1", ")", ")", ")", ")", ")", "count", "++", ";", "// replace if whitespace was found", "if", "(", "count", ">", "0", ")", "{", "piece", "=", "piece", ".", "substring", "(", "0", ",", "tabStop", "-", "count", ")", "+", "'", "'", ";", "builder", ".", "replace", "(", "index", ",", "index", "+", "tabStop", ",", "piece", ")", ";", "index", "=", "index", "+", "tabStop", "-", "(", "count", "-", "1", ")", ";", "}", "else", "index", "=", "index", "+", "tabStop", ";", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Replaces sequences of whitespaces with tabs within a line. @param self A line to unexpand @param tabStop The number of spaces a tab represents @return an unexpanded String @since 1.8.2
[ "Replaces", "sequences", "of", "whitespaces", "with", "tabs", "within", "a", "line", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L3626-L3645
mozilla/rhino
toolsrc/org/mozilla/javascript/tools/debugger/Main.java
Main.mainEmbedded
public static Main mainEmbedded(ContextFactory factory, ScopeProvider scopeProvider, String title) { """ Entry point for embedded applications. This method attaches to the given {@link ContextFactory} with the given scope. No I/O redirection is performed as with {@link #main(String[])}. """ return mainEmbeddedImpl(factory, scopeProvider, title); }
java
public static Main mainEmbedded(ContextFactory factory, ScopeProvider scopeProvider, String title) { return mainEmbeddedImpl(factory, scopeProvider, title); }
[ "public", "static", "Main", "mainEmbedded", "(", "ContextFactory", "factory", ",", "ScopeProvider", "scopeProvider", ",", "String", "title", ")", "{", "return", "mainEmbeddedImpl", "(", "factory", ",", "scopeProvider", ",", "title", ")", ";", "}" ]
Entry point for embedded applications. This method attaches to the given {@link ContextFactory} with the given scope. No I/O redirection is performed as with {@link #main(String[])}.
[ "Entry", "point", "for", "embedded", "applications", ".", "This", "method", "attaches", "to", "the", "given", "{" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/debugger/Main.java#L262-L266
jmrozanec/cron-utils
src/main/java/com/cronutils/model/time/SingleExecutionTime.java
SingleExecutionTime.nextClosestMatch
private ZonedDateTime nextClosestMatch(final ZonedDateTime date) throws NoSuchValueException { """ If date is not match, will return next closest match. If date is match, will return this date. @param date - reference ZonedDateTime instance - never null; @return ZonedDateTime instance, never null. Value obeys logic specified above. @throws NoSuchValueException if there is no potential next year """ ExecutionTimeResult result = new ExecutionTimeResult(date, false); for (int i = 0; i < MAX_ITERATIONS; i++) { result = potentialNextClosestMatch(result.getTime()); if (result.isMatch()) { return result.getTime(); } if (result.getTime().getYear() - date.getYear() > 100) { throw new NoSuchValueException(); } } throw new NoSuchValueException(); }
java
private ZonedDateTime nextClosestMatch(final ZonedDateTime date) throws NoSuchValueException { ExecutionTimeResult result = new ExecutionTimeResult(date, false); for (int i = 0; i < MAX_ITERATIONS; i++) { result = potentialNextClosestMatch(result.getTime()); if (result.isMatch()) { return result.getTime(); } if (result.getTime().getYear() - date.getYear() > 100) { throw new NoSuchValueException(); } } throw new NoSuchValueException(); }
[ "private", "ZonedDateTime", "nextClosestMatch", "(", "final", "ZonedDateTime", "date", ")", "throws", "NoSuchValueException", "{", "ExecutionTimeResult", "result", "=", "new", "ExecutionTimeResult", "(", "date", ",", "false", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "MAX_ITERATIONS", ";", "i", "++", ")", "{", "result", "=", "potentialNextClosestMatch", "(", "result", ".", "getTime", "(", ")", ")", ";", "if", "(", "result", ".", "isMatch", "(", ")", ")", "{", "return", "result", ".", "getTime", "(", ")", ";", "}", "if", "(", "result", ".", "getTime", "(", ")", ".", "getYear", "(", ")", "-", "date", ".", "getYear", "(", ")", ">", "100", ")", "{", "throw", "new", "NoSuchValueException", "(", ")", ";", "}", "}", "throw", "new", "NoSuchValueException", "(", ")", ";", "}" ]
If date is not match, will return next closest match. If date is match, will return this date. @param date - reference ZonedDateTime instance - never null; @return ZonedDateTime instance, never null. Value obeys logic specified above. @throws NoSuchValueException if there is no potential next year
[ "If", "date", "is", "not", "match", "will", "return", "next", "closest", "match", ".", "If", "date", "is", "match", "will", "return", "this", "date", "." ]
train
https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/model/time/SingleExecutionTime.java#L122-L135
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRange.java
ResidueRange.multiIterator
public static Iterator<ResidueNumber> multiIterator(AtomPositionMap map, List<? extends ResidueRange> rrs) { """ Returns a new Iterator over every {@link ResidueNumber} in the list of ResidueRanges. Stores the contents of {@code map} until the iterator is finished, so calling code should set the iterator to {@code null} if it did not finish. """ ResidueRange[] ranges = new ResidueRange[rrs.size()]; for (int i = 0; i < rrs.size(); i++) { ranges[i] = rrs.get(i); } return multiIterator(map, ranges); }
java
public static Iterator<ResidueNumber> multiIterator(AtomPositionMap map, List<? extends ResidueRange> rrs) { ResidueRange[] ranges = new ResidueRange[rrs.size()]; for (int i = 0; i < rrs.size(); i++) { ranges[i] = rrs.get(i); } return multiIterator(map, ranges); }
[ "public", "static", "Iterator", "<", "ResidueNumber", ">", "multiIterator", "(", "AtomPositionMap", "map", ",", "List", "<", "?", "extends", "ResidueRange", ">", "rrs", ")", "{", "ResidueRange", "[", "]", "ranges", "=", "new", "ResidueRange", "[", "rrs", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rrs", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ranges", "[", "i", "]", "=", "rrs", ".", "get", "(", "i", ")", ";", "}", "return", "multiIterator", "(", "map", ",", "ranges", ")", ";", "}" ]
Returns a new Iterator over every {@link ResidueNumber} in the list of ResidueRanges. Stores the contents of {@code map} until the iterator is finished, so calling code should set the iterator to {@code null} if it did not finish.
[ "Returns", "a", "new", "Iterator", "over", "every", "{" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRange.java#L346-L352
classgraph/classgraph
src/main/java/io/github/classgraph/Classfile.java
Classfile.constantPoolStringEquals
private boolean constantPoolStringEquals(final int cpIdx, final String asciiString) throws ClassfileFormatException, IOException { """ Compare a string in the constant pool with a given ASCII string, without constructing the constant pool String object. @param cpIdx the constant pool index @param asciiString the ASCII string to compare to @return true, if successful @throws ClassfileFormatException If a problem occurs. @throws IOException If an IO exception occurs. """ final int strOffset = getConstantPoolStringOffset(cpIdx, /* subFieldIdx = */ 0); if (strOffset == 0) { return asciiString == null; } else if (asciiString == null) { return false; } final int strLen = inputStreamOrByteBuffer.readUnsignedShort(strOffset); final int otherLen = asciiString.length(); if (strLen != otherLen) { return false; } final int strStart = strOffset + 2; for (int i = 0; i < strLen; i++) { if ((char) (inputStreamOrByteBuffer.buf[strStart + i] & 0xff) != asciiString.charAt(i)) { return false; } } return true; }
java
private boolean constantPoolStringEquals(final int cpIdx, final String asciiString) throws ClassfileFormatException, IOException { final int strOffset = getConstantPoolStringOffset(cpIdx, /* subFieldIdx = */ 0); if (strOffset == 0) { return asciiString == null; } else if (asciiString == null) { return false; } final int strLen = inputStreamOrByteBuffer.readUnsignedShort(strOffset); final int otherLen = asciiString.length(); if (strLen != otherLen) { return false; } final int strStart = strOffset + 2; for (int i = 0; i < strLen; i++) { if ((char) (inputStreamOrByteBuffer.buf[strStart + i] & 0xff) != asciiString.charAt(i)) { return false; } } return true; }
[ "private", "boolean", "constantPoolStringEquals", "(", "final", "int", "cpIdx", ",", "final", "String", "asciiString", ")", "throws", "ClassfileFormatException", ",", "IOException", "{", "final", "int", "strOffset", "=", "getConstantPoolStringOffset", "(", "cpIdx", ",", "/* subFieldIdx = */", "0", ")", ";", "if", "(", "strOffset", "==", "0", ")", "{", "return", "asciiString", "==", "null", ";", "}", "else", "if", "(", "asciiString", "==", "null", ")", "{", "return", "false", ";", "}", "final", "int", "strLen", "=", "inputStreamOrByteBuffer", ".", "readUnsignedShort", "(", "strOffset", ")", ";", "final", "int", "otherLen", "=", "asciiString", ".", "length", "(", ")", ";", "if", "(", "strLen", "!=", "otherLen", ")", "{", "return", "false", ";", "}", "final", "int", "strStart", "=", "strOffset", "+", "2", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strLen", ";", "i", "++", ")", "{", "if", "(", "(", "char", ")", "(", "inputStreamOrByteBuffer", ".", "buf", "[", "strStart", "+", "i", "]", "&", "0xff", ")", "!=", "asciiString", ".", "charAt", "(", "i", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Compare a string in the constant pool with a given ASCII string, without constructing the constant pool String object. @param cpIdx the constant pool index @param asciiString the ASCII string to compare to @return true, if successful @throws ClassfileFormatException If a problem occurs. @throws IOException If an IO exception occurs.
[ "Compare", "a", "string", "in", "the", "constant", "pool", "with", "a", "given", "ASCII", "string", "without", "constructing", "the", "constant", "pool", "String", "object", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/Classfile.java#L661-L681
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/MethodUtils.java
MethodUtils.invokeMethod
public static Object invokeMethod(Object object, String methodName, Object[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { """ <p>Invoke a named method whose parameter type matches the object type.</p> <p>The behaviour of this method is less deterministic than {@link #invokeExactMethod(Object object,String methodName,Object[] args)}. It loops through all methods with names that match and then executes the first it finds with compatible parameters.</p> <p>This method supports calls to methods taking primitive parameters via passing in wrapping classes. So, for example, a {@code Boolean} class would match a {@code boolean} primitive.</p> <p> This is a convenient wrapper for {@link #invokeMethod(Object object,String methodName,Object[] args,Class[] paramTypes)}. </p> @param object invoke method on this object @param methodName get method with this name @param args use these arguments - treat null as empty array @return the value returned by the invoked method @throws NoSuchMethodException if there is no such accessible method @throws InvocationTargetException wraps an exception thrown by the method invoked @throws IllegalAccessException if the requested method is not accessible via reflection """ Class<?>[] paramTypes; if (args == null) { args = EMPTY_OBJECT_ARRAY; paramTypes = EMPTY_CLASS_PARAMETERS; } else { int arguments = args.length; if (arguments == 0) { paramTypes = EMPTY_CLASS_PARAMETERS; } else { paramTypes = new Class<?>[arguments]; for (int i = 0; i < arguments; i++) { if (args[i] != null) { paramTypes[i] = args[i].getClass(); } } } } return invokeMethod(object, methodName, args, paramTypes); }
java
public static Object invokeMethod(Object object, String methodName, Object[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Class<?>[] paramTypes; if (args == null) { args = EMPTY_OBJECT_ARRAY; paramTypes = EMPTY_CLASS_PARAMETERS; } else { int arguments = args.length; if (arguments == 0) { paramTypes = EMPTY_CLASS_PARAMETERS; } else { paramTypes = new Class<?>[arguments]; for (int i = 0; i < arguments; i++) { if (args[i] != null) { paramTypes[i] = args[i].getClass(); } } } } return invokeMethod(object, methodName, args, paramTypes); }
[ "public", "static", "Object", "invokeMethod", "(", "Object", "object", ",", "String", "methodName", ",", "Object", "[", "]", "args", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "Class", "<", "?", ">", "[", "]", "paramTypes", ";", "if", "(", "args", "==", "null", ")", "{", "args", "=", "EMPTY_OBJECT_ARRAY", ";", "paramTypes", "=", "EMPTY_CLASS_PARAMETERS", ";", "}", "else", "{", "int", "arguments", "=", "args", ".", "length", ";", "if", "(", "arguments", "==", "0", ")", "{", "paramTypes", "=", "EMPTY_CLASS_PARAMETERS", ";", "}", "else", "{", "paramTypes", "=", "new", "Class", "<", "?", ">", "[", "arguments", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arguments", ";", "i", "++", ")", "{", "if", "(", "args", "[", "i", "]", "!=", "null", ")", "{", "paramTypes", "[", "i", "]", "=", "args", "[", "i", "]", ".", "getClass", "(", ")", ";", "}", "}", "}", "}", "return", "invokeMethod", "(", "object", ",", "methodName", ",", "args", ",", "paramTypes", ")", ";", "}" ]
<p>Invoke a named method whose parameter type matches the object type.</p> <p>The behaviour of this method is less deterministic than {@link #invokeExactMethod(Object object,String methodName,Object[] args)}. It loops through all methods with names that match and then executes the first it finds with compatible parameters.</p> <p>This method supports calls to methods taking primitive parameters via passing in wrapping classes. So, for example, a {@code Boolean} class would match a {@code boolean} primitive.</p> <p> This is a convenient wrapper for {@link #invokeMethod(Object object,String methodName,Object[] args,Class[] paramTypes)}. </p> @param object invoke method on this object @param methodName get method with this name @param args use these arguments - treat null as empty array @return the value returned by the invoked method @throws NoSuchMethodException if there is no such accessible method @throws InvocationTargetException wraps an exception thrown by the method invoked @throws IllegalAccessException if the requested method is not accessible via reflection
[ "<p", ">", "Invoke", "a", "named", "method", "whose", "parameter", "type", "matches", "the", "object", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L211-L233
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java
SimulatedTaskRunner.addTipToFinish
protected void addTipToFinish(TaskInProgress tip, TaskUmbilicalProtocol umbilicalProtocol) { """ Add the specified TaskInProgress to the priority queue of tasks to finish. @param tip @param umbilicalProtocol """ long currentTime = System.currentTimeMillis(); long finishTime = currentTime + Math.abs(rand.nextLong()) % timeToFinishTask; LOG.info("Adding TIP " + tip.getTask().getTaskID() + " to finishing queue with start time " + currentTime + " and finish time " + finishTime + " (" + ((finishTime - currentTime) / 1000.0) + " sec) to thread " + getName()); TipToFinish ttf = new TipToFinish(tip, finishTime, umbilicalProtocol); tipQueue.put(ttf); // Interrupt the waiting thread. We could put in additional logic to only // interrupt when necessary, but probably not worth the complexity. this.interrupt(); }
java
protected void addTipToFinish(TaskInProgress tip, TaskUmbilicalProtocol umbilicalProtocol) { long currentTime = System.currentTimeMillis(); long finishTime = currentTime + Math.abs(rand.nextLong()) % timeToFinishTask; LOG.info("Adding TIP " + tip.getTask().getTaskID() + " to finishing queue with start time " + currentTime + " and finish time " + finishTime + " (" + ((finishTime - currentTime) / 1000.0) + " sec) to thread " + getName()); TipToFinish ttf = new TipToFinish(tip, finishTime, umbilicalProtocol); tipQueue.put(ttf); // Interrupt the waiting thread. We could put in additional logic to only // interrupt when necessary, but probably not worth the complexity. this.interrupt(); }
[ "protected", "void", "addTipToFinish", "(", "TaskInProgress", "tip", ",", "TaskUmbilicalProtocol", "umbilicalProtocol", ")", "{", "long", "currentTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "finishTime", "=", "currentTime", "+", "Math", ".", "abs", "(", "rand", ".", "nextLong", "(", ")", ")", "%", "timeToFinishTask", ";", "LOG", ".", "info", "(", "\"Adding TIP \"", "+", "tip", ".", "getTask", "(", ")", ".", "getTaskID", "(", ")", "+", "\" to finishing queue with start time \"", "+", "currentTime", "+", "\" and finish time \"", "+", "finishTime", "+", "\" (\"", "+", "(", "(", "finishTime", "-", "currentTime", ")", "/", "1000.0", ")", "+", "\" sec) to thread \"", "+", "getName", "(", ")", ")", ";", "TipToFinish", "ttf", "=", "new", "TipToFinish", "(", "tip", ",", "finishTime", ",", "umbilicalProtocol", ")", ";", "tipQueue", ".", "put", "(", "ttf", ")", ";", "// Interrupt the waiting thread. We could put in additional logic to only", "// interrupt when necessary, but probably not worth the complexity.", "this", ".", "interrupt", "(", ")", ";", "}" ]
Add the specified TaskInProgress to the priority queue of tasks to finish. @param tip @param umbilicalProtocol
[ "Add", "the", "specified", "TaskInProgress", "to", "the", "priority", "queue", "of", "tasks", "to", "finish", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SimulatedTaskRunner.java#L169-L184
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java
StringBuilders.appendDqValue
public static StringBuilder appendDqValue(final StringBuilder sb, final Object value) { """ Appends in the following format: double quoted value. @param sb a string builder @param value a value @return {@code "value"} """ return sb.append(Chars.DQUOTE).append(value).append(Chars.DQUOTE); }
java
public static StringBuilder appendDqValue(final StringBuilder sb, final Object value) { return sb.append(Chars.DQUOTE).append(value).append(Chars.DQUOTE); }
[ "public", "static", "StringBuilder", "appendDqValue", "(", "final", "StringBuilder", "sb", ",", "final", "Object", "value", ")", "{", "return", "sb", ".", "append", "(", "Chars", ".", "DQUOTE", ")", ".", "append", "(", "value", ")", ".", "append", "(", "Chars", ".", "DQUOTE", ")", ";", "}" ]
Appends in the following format: double quoted value. @param sb a string builder @param value a value @return {@code "value"}
[ "Appends", "in", "the", "following", "format", ":", "double", "quoted", "value", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java#L37-L39
mapsforge/mapsforge
mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/GeoUtils.java
GeoUtils.deltaLat
private static double deltaLat(double deltaPixel, double lat, byte zoom, int tileSize) { """ Computes the amount of latitude degrees for a given distance in pixel at a given zoom level. """ long mapSize = MercatorProjection.getMapSize(zoom, tileSize); double pixelY = MercatorProjection.latitudeToPixelY(lat, mapSize); double lat2 = MercatorProjection.pixelYToLatitude(pixelY + deltaPixel, mapSize); return Math.abs(lat2 - lat); }
java
private static double deltaLat(double deltaPixel, double lat, byte zoom, int tileSize) { long mapSize = MercatorProjection.getMapSize(zoom, tileSize); double pixelY = MercatorProjection.latitudeToPixelY(lat, mapSize); double lat2 = MercatorProjection.pixelYToLatitude(pixelY + deltaPixel, mapSize); return Math.abs(lat2 - lat); }
[ "private", "static", "double", "deltaLat", "(", "double", "deltaPixel", ",", "double", "lat", ",", "byte", "zoom", ",", "int", "tileSize", ")", "{", "long", "mapSize", "=", "MercatorProjection", ".", "getMapSize", "(", "zoom", ",", "tileSize", ")", ";", "double", "pixelY", "=", "MercatorProjection", ".", "latitudeToPixelY", "(", "lat", ",", "mapSize", ")", ";", "double", "lat2", "=", "MercatorProjection", ".", "pixelYToLatitude", "(", "pixelY", "+", "deltaPixel", ",", "mapSize", ")", ";", "return", "Math", ".", "abs", "(", "lat2", "-", "lat", ")", ";", "}" ]
Computes the amount of latitude degrees for a given distance in pixel at a given zoom level.
[ "Computes", "the", "amount", "of", "latitude", "degrees", "for", "a", "given", "distance", "in", "pixel", "at", "a", "given", "zoom", "level", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/GeoUtils.java#L437-L443
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplFloat_CustomFieldSerializer.java
OWLLiteralImplFloat_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLLiteralImplFloat instance) throws SerializationException { """ Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful """ deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLLiteralImplFloat instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLLiteralImplFloat", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplFloat_CustomFieldSerializer.java#L86-L89
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.exportAllResources
public void exportAllResources(String exportFile, boolean isReducedExportMode) throws Exception { """ Exports all resources from the current site root to a ZIP file.<p> @param exportFile the name (absolute path) of the ZIP file to export to @param isReducedExportMode flag, indicating if the reduced export mode should be used @throws Exception if something goes wrong """ List<String> exportPaths = new ArrayList<String>(1); exportPaths.add("/"); CmsVfsImportExportHandler vfsExportHandler = new CmsVfsImportExportHandler(); CmsExportParameters params = new CmsExportParameters( exportFile, null, true, false, false, exportPaths, true, true, 0, true, false, isReducedExportMode ? ExportMode.REDUCED : ExportMode.DEFAULT); vfsExportHandler.setExportParams(params); OpenCms.getImportExportManager().exportData( m_cms, vfsExportHandler, new CmsShellReport(m_cms.getRequestContext().getLocale())); }
java
public void exportAllResources(String exportFile, boolean isReducedExportMode) throws Exception { List<String> exportPaths = new ArrayList<String>(1); exportPaths.add("/"); CmsVfsImportExportHandler vfsExportHandler = new CmsVfsImportExportHandler(); CmsExportParameters params = new CmsExportParameters( exportFile, null, true, false, false, exportPaths, true, true, 0, true, false, isReducedExportMode ? ExportMode.REDUCED : ExportMode.DEFAULT); vfsExportHandler.setExportParams(params); OpenCms.getImportExportManager().exportData( m_cms, vfsExportHandler, new CmsShellReport(m_cms.getRequestContext().getLocale())); }
[ "public", "void", "exportAllResources", "(", "String", "exportFile", ",", "boolean", "isReducedExportMode", ")", "throws", "Exception", "{", "List", "<", "String", ">", "exportPaths", "=", "new", "ArrayList", "<", "String", ">", "(", "1", ")", ";", "exportPaths", ".", "add", "(", "\"/\"", ")", ";", "CmsVfsImportExportHandler", "vfsExportHandler", "=", "new", "CmsVfsImportExportHandler", "(", ")", ";", "CmsExportParameters", "params", "=", "new", "CmsExportParameters", "(", "exportFile", ",", "null", ",", "true", ",", "false", ",", "false", ",", "exportPaths", ",", "true", ",", "true", ",", "0", ",", "true", ",", "false", ",", "isReducedExportMode", "?", "ExportMode", ".", "REDUCED", ":", "ExportMode", ".", "DEFAULT", ")", ";", "vfsExportHandler", ".", "setExportParams", "(", "params", ")", ";", "OpenCms", ".", "getImportExportManager", "(", ")", ".", "exportData", "(", "m_cms", ",", "vfsExportHandler", ",", "new", "CmsShellReport", "(", "m_cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ")", ";", "}" ]
Exports all resources from the current site root to a ZIP file.<p> @param exportFile the name (absolute path) of the ZIP file to export to @param isReducedExportMode flag, indicating if the reduced export mode should be used @throws Exception if something goes wrong
[ "Exports", "all", "resources", "from", "the", "current", "site", "root", "to", "a", "ZIP", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L585-L610
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java
ProxyDataSourceBuilder.logSlowQueryByJUL
public ProxyDataSourceBuilder logSlowQueryByJUL(long thresholdTime, TimeUnit timeUnit, String loggerName) { """ Register {@link JULSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @param loggerName JUL logger name @return builder @since 1.4.1 """ return logSlowQueryByJUL(thresholdTime, timeUnit, null, loggerName); }
java
public ProxyDataSourceBuilder logSlowQueryByJUL(long thresholdTime, TimeUnit timeUnit, String loggerName) { return logSlowQueryByJUL(thresholdTime, timeUnit, null, loggerName); }
[ "public", "ProxyDataSourceBuilder", "logSlowQueryByJUL", "(", "long", "thresholdTime", ",", "TimeUnit", "timeUnit", ",", "String", "loggerName", ")", "{", "return", "logSlowQueryByJUL", "(", "thresholdTime", ",", "timeUnit", ",", "null", ",", "loggerName", ")", ";", "}" ]
Register {@link JULSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @param loggerName JUL logger name @return builder @since 1.4.1
[ "Register", "{", "@link", "JULSlowQueryListener", "}", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L465-L467
ThreeTen/threetenbp
src/main/java/org/threeten/bp/zone/ZoneOffsetTransitionRule.java
ZoneOffsetTransitionRule.createTransition
public ZoneOffsetTransition createTransition(int year) { """ Creates a transition instance for the specified year. <p> Calculations are performed using the ISO-8601 chronology. @param year the year to create a transition for, not null @return the transition instance, not null """ LocalDate date; if (dom < 0) { date = LocalDate.of(year, month, month.length(IsoChronology.INSTANCE.isLeapYear(year)) + 1 + dom); if (dow != null) { date = date.with(previousOrSame(dow)); } } else { date = LocalDate.of(year, month, dom); if (dow != null) { date = date.with(nextOrSame(dow)); } } LocalDateTime localDT = LocalDateTime.of(date.plusDays(adjustDays), time); LocalDateTime transition = timeDefinition.createDateTime(localDT, standardOffset, offsetBefore); return new ZoneOffsetTransition(transition, offsetBefore, offsetAfter); }
java
public ZoneOffsetTransition createTransition(int year) { LocalDate date; if (dom < 0) { date = LocalDate.of(year, month, month.length(IsoChronology.INSTANCE.isLeapYear(year)) + 1 + dom); if (dow != null) { date = date.with(previousOrSame(dow)); } } else { date = LocalDate.of(year, month, dom); if (dow != null) { date = date.with(nextOrSame(dow)); } } LocalDateTime localDT = LocalDateTime.of(date.plusDays(adjustDays), time); LocalDateTime transition = timeDefinition.createDateTime(localDT, standardOffset, offsetBefore); return new ZoneOffsetTransition(transition, offsetBefore, offsetAfter); }
[ "public", "ZoneOffsetTransition", "createTransition", "(", "int", "year", ")", "{", "LocalDate", "date", ";", "if", "(", "dom", "<", "0", ")", "{", "date", "=", "LocalDate", ".", "of", "(", "year", ",", "month", ",", "month", ".", "length", "(", "IsoChronology", ".", "INSTANCE", ".", "isLeapYear", "(", "year", ")", ")", "+", "1", "+", "dom", ")", ";", "if", "(", "dow", "!=", "null", ")", "{", "date", "=", "date", ".", "with", "(", "previousOrSame", "(", "dow", ")", ")", ";", "}", "}", "else", "{", "date", "=", "LocalDate", ".", "of", "(", "year", ",", "month", ",", "dom", ")", ";", "if", "(", "dow", "!=", "null", ")", "{", "date", "=", "date", ".", "with", "(", "nextOrSame", "(", "dow", ")", ")", ";", "}", "}", "LocalDateTime", "localDT", "=", "LocalDateTime", ".", "of", "(", "date", ".", "plusDays", "(", "adjustDays", ")", ",", "time", ")", ";", "LocalDateTime", "transition", "=", "timeDefinition", ".", "createDateTime", "(", "localDT", ",", "standardOffset", ",", "offsetBefore", ")", ";", "return", "new", "ZoneOffsetTransition", "(", "transition", ",", "offsetBefore", ",", "offsetAfter", ")", ";", "}" ]
Creates a transition instance for the specified year. <p> Calculations are performed using the ISO-8601 chronology. @param year the year to create a transition for, not null @return the transition instance, not null
[ "Creates", "a", "transition", "instance", "for", "the", "specified", "year", ".", "<p", ">", "Calculations", "are", "performed", "using", "the", "ISO", "-", "8601", "chronology", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/zone/ZoneOffsetTransitionRule.java#L410-L426
jnr/jnr-x86asm
src/main/java/jnr/x86asm/Asm.java
Asm.tword_ptr_abs
public static final Mem tword_ptr_abs(long target, long disp, SEGMENT segmentPrefix) { """ Create tword (10 Bytes) pointer operand (used for 80 bit floating points). """ return _ptr_build_abs(target, disp, segmentPrefix, SIZE_TWORD); }
java
public static final Mem tword_ptr_abs(long target, long disp, SEGMENT segmentPrefix) { return _ptr_build_abs(target, disp, segmentPrefix, SIZE_TWORD); }
[ "public", "static", "final", "Mem", "tword_ptr_abs", "(", "long", "target", ",", "long", "disp", ",", "SEGMENT", "segmentPrefix", ")", "{", "return", "_ptr_build_abs", "(", "target", ",", "disp", ",", "segmentPrefix", ",", "SIZE_TWORD", ")", ";", "}" ]
Create tword (10 Bytes) pointer operand (used for 80 bit floating points).
[ "Create", "tword", "(", "10", "Bytes", ")", "pointer", "operand", "(", "used", "for", "80", "bit", "floating", "points", ")", "." ]
train
https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/Asm.java#L421-L423
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Popups.java
Popups.infoOn
public static InfoPopup infoOn (String message, Widget target) { """ Displays an info message centered horizontally on the page and centered vertically on the specified target widget. """ return centerOn(new InfoPopup(message), target); }
java
public static InfoPopup infoOn (String message, Widget target) { return centerOn(new InfoPopup(message), target); }
[ "public", "static", "InfoPopup", "infoOn", "(", "String", "message", ",", "Widget", "target", ")", "{", "return", "centerOn", "(", "new", "InfoPopup", "(", "message", ")", ",", "target", ")", ";", "}" ]
Displays an info message centered horizontally on the page and centered vertically on the specified target widget.
[ "Displays", "an", "info", "message", "centered", "horizontally", "on", "the", "page", "and", "centered", "vertically", "on", "the", "specified", "target", "widget", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Popups.java#L93-L96
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/AbstractMemberExpansionTransformer.java
AbstractMemberExpansionTransformer.compileExpansionDirectlyToArray
protected IRExpression compileExpansionDirectlyToArray( IType rootType, IType rootComponentType, IType resultType, IType resultCompType ) { """ If this method is being called, it means we're expanding a one-dimensional array or collection, with a right hand side that evaluates to a property that's not an array or collection. In that case, we build up an array and simply store values directly into it. We also null-short-circuit in the event that the root is null. The member expansion portion ends up as a composite that looks like: temp_array = new Foo[temp_root.length] for (a in temp_root index i) { temp_array[i] = a.Bar } temp_array And the overall expression looks like: temp_root = root ( temp_root == null ? (Bar[]) null : (Bar[]) member_expansion ) """ // Evaluate the root and assign it to a temp variable IRSymbol tempRoot = _cc().makeAndIndexTempSymbol( getDescriptor( rootType ) ); IRStatement tempRootAssignment = buildAssignment( tempRoot, ExpressionTransformer.compile( _expr().getRootExpression(), _cc() ) ); // Create the result array and assign it to a temp variable IRSymbol resultArray = _cc().makeAndIndexTempSymbol( getDescriptor( resultType ) ); IRStatement arrayCreation = buildAssignment( resultArray, makeArray( resultCompType, createArrayLengthExpression( rootType, tempRoot ) ) ); // Create the loop that populates the array IRForEachStatement forLoop = createArrayStoreLoop(rootType, rootComponentType, resultCompType, tempRoot, resultArray); // Build the expansion out of the array creation, for loop, and identifier IRExpression expansion = buildComposite( arrayCreation, forLoop, identifier( resultArray ) ); // Short-circuit if we're not dealing with primitive types if (!rootComponentType.isPrimitive() && !resultCompType.isPrimitive()) { return buildComposite( tempRootAssignment, buildNullCheckTernary( identifier( tempRoot ), checkCast( _expr().getType(), makeArray(resultCompType, numericLiteral(0)) ), checkCast( _expr().getType(), expansion ) ) ); } else { return buildComposite( tempRootAssignment, checkCast( _expr().getType(), expansion ) ); } }
java
protected IRExpression compileExpansionDirectlyToArray( IType rootType, IType rootComponentType, IType resultType, IType resultCompType ) { // Evaluate the root and assign it to a temp variable IRSymbol tempRoot = _cc().makeAndIndexTempSymbol( getDescriptor( rootType ) ); IRStatement tempRootAssignment = buildAssignment( tempRoot, ExpressionTransformer.compile( _expr().getRootExpression(), _cc() ) ); // Create the result array and assign it to a temp variable IRSymbol resultArray = _cc().makeAndIndexTempSymbol( getDescriptor( resultType ) ); IRStatement arrayCreation = buildAssignment( resultArray, makeArray( resultCompType, createArrayLengthExpression( rootType, tempRoot ) ) ); // Create the loop that populates the array IRForEachStatement forLoop = createArrayStoreLoop(rootType, rootComponentType, resultCompType, tempRoot, resultArray); // Build the expansion out of the array creation, for loop, and identifier IRExpression expansion = buildComposite( arrayCreation, forLoop, identifier( resultArray ) ); // Short-circuit if we're not dealing with primitive types if (!rootComponentType.isPrimitive() && !resultCompType.isPrimitive()) { return buildComposite( tempRootAssignment, buildNullCheckTernary( identifier( tempRoot ), checkCast( _expr().getType(), makeArray(resultCompType, numericLiteral(0)) ), checkCast( _expr().getType(), expansion ) ) ); } else { return buildComposite( tempRootAssignment, checkCast( _expr().getType(), expansion ) ); } }
[ "protected", "IRExpression", "compileExpansionDirectlyToArray", "(", "IType", "rootType", ",", "IType", "rootComponentType", ",", "IType", "resultType", ",", "IType", "resultCompType", ")", "{", "// Evaluate the root and assign it to a temp variable", "IRSymbol", "tempRoot", "=", "_cc", "(", ")", ".", "makeAndIndexTempSymbol", "(", "getDescriptor", "(", "rootType", ")", ")", ";", "IRStatement", "tempRootAssignment", "=", "buildAssignment", "(", "tempRoot", ",", "ExpressionTransformer", ".", "compile", "(", "_expr", "(", ")", ".", "getRootExpression", "(", ")", ",", "_cc", "(", ")", ")", ")", ";", "// Create the result array and assign it to a temp variable", "IRSymbol", "resultArray", "=", "_cc", "(", ")", ".", "makeAndIndexTempSymbol", "(", "getDescriptor", "(", "resultType", ")", ")", ";", "IRStatement", "arrayCreation", "=", "buildAssignment", "(", "resultArray", ",", "makeArray", "(", "resultCompType", ",", "createArrayLengthExpression", "(", "rootType", ",", "tempRoot", ")", ")", ")", ";", "// Create the loop that populates the array", "IRForEachStatement", "forLoop", "=", "createArrayStoreLoop", "(", "rootType", ",", "rootComponentType", ",", "resultCompType", ",", "tempRoot", ",", "resultArray", ")", ";", "// Build the expansion out of the array creation, for loop, and identifier", "IRExpression", "expansion", "=", "buildComposite", "(", "arrayCreation", ",", "forLoop", ",", "identifier", "(", "resultArray", ")", ")", ";", "// Short-circuit if we're not dealing with primitive types", "if", "(", "!", "rootComponentType", ".", "isPrimitive", "(", ")", "&&", "!", "resultCompType", ".", "isPrimitive", "(", ")", ")", "{", "return", "buildComposite", "(", "tempRootAssignment", ",", "buildNullCheckTernary", "(", "identifier", "(", "tempRoot", ")", ",", "checkCast", "(", "_expr", "(", ")", ".", "getType", "(", ")", ",", "makeArray", "(", "resultCompType", ",", "numericLiteral", "(", "0", ")", ")", ")", ",", "checkCast", "(", "_expr", "(", ")", ".", "getType", "(", ")", ",", "expansion", ")", ")", ")", ";", "}", "else", "{", "return", "buildComposite", "(", "tempRootAssignment", ",", "checkCast", "(", "_expr", "(", ")", ".", "getType", "(", ")", ",", "expansion", ")", ")", ";", "}", "}" ]
If this method is being called, it means we're expanding a one-dimensional array or collection, with a right hand side that evaluates to a property that's not an array or collection. In that case, we build up an array and simply store values directly into it. We also null-short-circuit in the event that the root is null. The member expansion portion ends up as a composite that looks like: temp_array = new Foo[temp_root.length] for (a in temp_root index i) { temp_array[i] = a.Bar } temp_array And the overall expression looks like: temp_root = root ( temp_root == null ? (Bar[]) null : (Bar[]) member_expansion )
[ "If", "this", "method", "is", "being", "called", "it", "means", "we", "re", "expanding", "a", "one", "-", "dimensional", "array", "or", "collection", "with", "a", "right", "hand", "side", "that", "evaluates", "to", "a", "property", "that", "s", "not", "an", "array", "or", "collection", ".", "In", "that", "case", "we", "build", "up", "an", "array", "and", "simply", "store", "values", "directly", "into", "it", ".", "We", "also", "null", "-", "short", "-", "circuit", "in", "the", "event", "that", "the", "root", "is", "null", ".", "The", "member", "expansion", "portion", "ends", "up", "as", "a", "composite", "that", "looks", "like", ":" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/expression/AbstractMemberExpansionTransformer.java#L135-L163
geomajas/geomajas-project-client-gwt2
impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java
JsonService.getChildArray
public static JSONArray getChildArray(JSONObject jsonObject, String key) throws JSONException { """ Get a child JSON array from a parent JSON object. @param jsonObject The parent JSON object. @param key The name of the child object. @return Returns the child JSON array if it could be found, or null if the value was null. @throws JSONException In case something went wrong while searching for the child. """ checkArguments(jsonObject, key); JSONValue value = jsonObject.get(key); if (value != null) { if (value.isArray() != null) { return value.isArray(); } else if (value.isNull() != null) { return null; } throw new JSONException("Child is not a JSONArray, but a: " + value.getClass()); } return null; }
java
public static JSONArray getChildArray(JSONObject jsonObject, String key) throws JSONException { checkArguments(jsonObject, key); JSONValue value = jsonObject.get(key); if (value != null) { if (value.isArray() != null) { return value.isArray(); } else if (value.isNull() != null) { return null; } throw new JSONException("Child is not a JSONArray, but a: " + value.getClass()); } return null; }
[ "public", "static", "JSONArray", "getChildArray", "(", "JSONObject", "jsonObject", ",", "String", "key", ")", "throws", "JSONException", "{", "checkArguments", "(", "jsonObject", ",", "key", ")", ";", "JSONValue", "value", "=", "jsonObject", ".", "get", "(", "key", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "value", ".", "isArray", "(", ")", "!=", "null", ")", "{", "return", "value", ".", "isArray", "(", ")", ";", "}", "else", "if", "(", "value", ".", "isNull", "(", ")", "!=", "null", ")", "{", "return", "null", ";", "}", "throw", "new", "JSONException", "(", "\"Child is not a JSONArray, but a: \"", "+", "value", ".", "getClass", "(", ")", ")", ";", "}", "return", "null", ";", "}" ]
Get a child JSON array from a parent JSON object. @param jsonObject The parent JSON object. @param key The name of the child object. @return Returns the child JSON array if it could be found, or null if the value was null. @throws JSONException In case something went wrong while searching for the child.
[ "Get", "a", "child", "JSON", "array", "from", "a", "parent", "JSON", "object", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java#L116-L128
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java
DOMHelper.isNodeTheSame
public static boolean isNodeTheSame(Node node1, Node node2) { """ Use DTMNodeProxy to determine whether two nodes are the same. @param node1 The first DOM node to compare. @param node2 The second DOM node to compare. @return true if the two nodes are the same. """ if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy) return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2); else return (node1 == node2); }
java
public static boolean isNodeTheSame(Node node1, Node node2) { if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy) return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2); else return (node1 == node2); }
[ "public", "static", "boolean", "isNodeTheSame", "(", "Node", "node1", ",", "Node", "node2", ")", "{", "if", "(", "node1", "instanceof", "DTMNodeProxy", "&&", "node2", "instanceof", "DTMNodeProxy", ")", "return", "(", "(", "DTMNodeProxy", ")", "node1", ")", ".", "equals", "(", "(", "DTMNodeProxy", ")", "node2", ")", ";", "else", "return", "(", "node1", "==", "node2", ")", ";", "}" ]
Use DTMNodeProxy to determine whether two nodes are the same. @param node1 The first DOM node to compare. @param node2 The second DOM node to compare. @return true if the two nodes are the same.
[ "Use", "DTMNodeProxy", "to", "determine", "whether", "two", "nodes", "are", "the", "same", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java#L339-L345
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
DefaultMetadataService.createType
@Override public JSONObject createType(String typeDefinition) throws AtlasException { """ Creates a new type based on the type system to enable adding entities (instances for types). @param typeDefinition definition as json @return a unique id for this type """ return createOrUpdateTypes(OperationType.CREATE, typeDefinition, false); }
java
@Override public JSONObject createType(String typeDefinition) throws AtlasException { return createOrUpdateTypes(OperationType.CREATE, typeDefinition, false); }
[ "@", "Override", "public", "JSONObject", "createType", "(", "String", "typeDefinition", ")", "throws", "AtlasException", "{", "return", "createOrUpdateTypes", "(", "OperationType", ".", "CREATE", ",", "typeDefinition", ",", "false", ")", ";", "}" ]
Creates a new type based on the type system to enable adding entities (instances for types). @param typeDefinition definition as json @return a unique id for this type
[ "Creates", "a", "new", "type", "based", "on", "the", "type", "system", "to", "enable", "adding", "entities", "(", "instances", "for", "types", ")", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java#L166-L169
elki-project/elki
elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/normalization/columnwise/AttributeWiseCDFNormalization.java
AttributeWiseCDFNormalization.constantZero
protected boolean constantZero(List<V> column, Adapter adapter) { """ Test if an attribute is constant zero. @param column Column @param adapter Data accessor. @return {@code true} if all values are zero """ for(int i = 0, s = adapter.size(column); i < s; i++) { if(adapter.get(column, i) != 0.) { return false; } } return true; }
java
protected boolean constantZero(List<V> column, Adapter adapter) { for(int i = 0, s = adapter.size(column); i < s; i++) { if(adapter.get(column, i) != 0.) { return false; } } return true; }
[ "protected", "boolean", "constantZero", "(", "List", "<", "V", ">", "column", ",", "Adapter", "adapter", ")", "{", "for", "(", "int", "i", "=", "0", ",", "s", "=", "adapter", ".", "size", "(", "column", ")", ";", "i", "<", "s", ";", "i", "++", ")", "{", "if", "(", "adapter", ".", "get", "(", "column", ",", "i", ")", "!=", "0.", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Test if an attribute is constant zero. @param column Column @param adapter Data accessor. @return {@code true} if all values are zero
[ "Test", "if", "an", "attribute", "is", "constant", "zero", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/normalization/columnwise/AttributeWiseCDFNormalization.java#L210-L217
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java
FacesImpl.detectWithUrlWithServiceResponseAsync
public Observable<ServiceResponse<List<DetectedFace>>> detectWithUrlWithServiceResponseAsync(String url, DetectWithUrlOptionalParameter detectWithUrlOptionalParameter) { """ Detect human faces in an image and returns face locations, and optionally with faceIds, landmarks, and attributes. @param url Publicly reachable URL of an image @param detectWithUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;DetectedFace&gt; object """ if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final Boolean returnFaceId = detectWithUrlOptionalParameter != null ? detectWithUrlOptionalParameter.returnFaceId() : null; final Boolean returnFaceLandmarks = detectWithUrlOptionalParameter != null ? detectWithUrlOptionalParameter.returnFaceLandmarks() : null; final List<FaceAttributeType> returnFaceAttributes = detectWithUrlOptionalParameter != null ? detectWithUrlOptionalParameter.returnFaceAttributes() : null; return detectWithUrlWithServiceResponseAsync(url, returnFaceId, returnFaceLandmarks, returnFaceAttributes); }
java
public Observable<ServiceResponse<List<DetectedFace>>> detectWithUrlWithServiceResponseAsync(String url, DetectWithUrlOptionalParameter detectWithUrlOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final Boolean returnFaceId = detectWithUrlOptionalParameter != null ? detectWithUrlOptionalParameter.returnFaceId() : null; final Boolean returnFaceLandmarks = detectWithUrlOptionalParameter != null ? detectWithUrlOptionalParameter.returnFaceLandmarks() : null; final List<FaceAttributeType> returnFaceAttributes = detectWithUrlOptionalParameter != null ? detectWithUrlOptionalParameter.returnFaceAttributes() : null; return detectWithUrlWithServiceResponseAsync(url, returnFaceId, returnFaceLandmarks, returnFaceAttributes); }
[ "public", "Observable", "<", "ServiceResponse", "<", "List", "<", "DetectedFace", ">", ">", ">", "detectWithUrlWithServiceResponseAsync", "(", "String", "url", ",", "DetectWithUrlOptionalParameter", "detectWithUrlOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "azureRegion", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.azureRegion() is required and cannot be null.\"", ")", ";", "}", "if", "(", "url", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter url is required and cannot be null.\"", ")", ";", "}", "final", "Boolean", "returnFaceId", "=", "detectWithUrlOptionalParameter", "!=", "null", "?", "detectWithUrlOptionalParameter", ".", "returnFaceId", "(", ")", ":", "null", ";", "final", "Boolean", "returnFaceLandmarks", "=", "detectWithUrlOptionalParameter", "!=", "null", "?", "detectWithUrlOptionalParameter", ".", "returnFaceLandmarks", "(", ")", ":", "null", ";", "final", "List", "<", "FaceAttributeType", ">", "returnFaceAttributes", "=", "detectWithUrlOptionalParameter", "!=", "null", "?", "detectWithUrlOptionalParameter", ".", "returnFaceAttributes", "(", ")", ":", "null", ";", "return", "detectWithUrlWithServiceResponseAsync", "(", "url", ",", "returnFaceId", ",", "returnFaceLandmarks", ",", "returnFaceAttributes", ")", ";", "}" ]
Detect human faces in an image and returns face locations, and optionally with faceIds, landmarks, and attributes. @param url Publicly reachable URL of an image @param detectWithUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;DetectedFace&gt; object
[ "Detect", "human", "faces", "in", "an", "image", "and", "returns", "face", "locations", "and", "optionally", "with", "faceIds", "landmarks", "and", "attributes", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java#L699-L711
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java
DateTimePatternGenerator.getCanonicalChar
private static char getCanonicalChar(int field, char reference) { """ Gets the canonical character associated with the specified field (ERA, YEAR, etc). """ // Special case: distinguish between 12-hour and 24-hour if (reference == 'h' || reference == 'K') { return 'h'; } // Linear search over types (return the top entry for each field) for (int i = 0; i < types.length; ++i) { int[] row = types[i]; if (row[1] == field) { return (char) row[0]; } } throw new IllegalArgumentException("Could not find field " + field); }
java
private static char getCanonicalChar(int field, char reference) { // Special case: distinguish between 12-hour and 24-hour if (reference == 'h' || reference == 'K') { return 'h'; } // Linear search over types (return the top entry for each field) for (int i = 0; i < types.length; ++i) { int[] row = types[i]; if (row[1] == field) { return (char) row[0]; } } throw new IllegalArgumentException("Could not find field " + field); }
[ "private", "static", "char", "getCanonicalChar", "(", "int", "field", ",", "char", "reference", ")", "{", "// Special case: distinguish between 12-hour and 24-hour", "if", "(", "reference", "==", "'", "'", "||", "reference", "==", "'", "'", ")", "{", "return", "'", "'", ";", "}", "// Linear search over types (return the top entry for each field)", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "++", "i", ")", "{", "int", "[", "]", "row", "=", "types", "[", "i", "]", ";", "if", "(", "row", "[", "1", "]", "==", "field", ")", "{", "return", "(", "char", ")", "row", "[", "0", "]", ";", "}", "}", "throw", "new", "IllegalArgumentException", "(", "\"Could not find field \"", "+", "field", ")", ";", "}" ]
Gets the canonical character associated with the specified field (ERA, YEAR, etc).
[ "Gets", "the", "canonical", "character", "associated", "with", "the", "specified", "field", "(", "ERA", "YEAR", "etc", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L2112-L2126
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/listeners/SerializingListener.java
SerializingListener.processEvent
@Override public void processEvent(ListenerEvent event, SequenceVectors<T> sequenceVectors, long argument) { """ This method is called at each epoch end @param event @param sequenceVectors @param argument """ try { locker.acquire(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); StringBuilder builder = new StringBuilder(targetFolder.getAbsolutePath()); builder.append("/").append(modelPrefix).append("_").append(sdf.format(new Date())).append(".seqvec"); File targetFile = new File(builder.toString()); if (useBinarySerialization) { SerializationUtils.saveObject(sequenceVectors, targetFile); } else { throw new UnsupportedOperationException("Not implemented yet"); } } catch (Exception e) { e.printStackTrace(); } finally { locker.release(); } }
java
@Override public void processEvent(ListenerEvent event, SequenceVectors<T> sequenceVectors, long argument) { try { locker.acquire(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); StringBuilder builder = new StringBuilder(targetFolder.getAbsolutePath()); builder.append("/").append(modelPrefix).append("_").append(sdf.format(new Date())).append(".seqvec"); File targetFile = new File(builder.toString()); if (useBinarySerialization) { SerializationUtils.saveObject(sequenceVectors, targetFile); } else { throw new UnsupportedOperationException("Not implemented yet"); } } catch (Exception e) { e.printStackTrace(); } finally { locker.release(); } }
[ "@", "Override", "public", "void", "processEvent", "(", "ListenerEvent", "event", ",", "SequenceVectors", "<", "T", ">", "sequenceVectors", ",", "long", "argument", ")", "{", "try", "{", "locker", ".", "acquire", "(", ")", ";", "SimpleDateFormat", "sdf", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd HH:mm:ss.SSS\"", ")", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "targetFolder", ".", "getAbsolutePath", "(", ")", ")", ";", "builder", ".", "append", "(", "\"/\"", ")", ".", "append", "(", "modelPrefix", ")", ".", "append", "(", "\"_\"", ")", ".", "append", "(", "sdf", ".", "format", "(", "new", "Date", "(", ")", ")", ")", ".", "append", "(", "\".seqvec\"", ")", ";", "File", "targetFile", "=", "new", "File", "(", "builder", ".", "toString", "(", ")", ")", ";", "if", "(", "useBinarySerialization", ")", "{", "SerializationUtils", ".", "saveObject", "(", "sequenceVectors", ",", "targetFile", ")", ";", "}", "else", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Not implemented yet\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "locker", ".", "release", "(", ")", ";", "}", "}" ]
This method is called at each epoch end @param event @param sequenceVectors @param argument
[ "This", "method", "is", "called", "at", "each", "epoch", "end" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/listeners/SerializingListener.java#L81-L103
SeleniumHQ/selenium
java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java
StandaloneConfiguration.loadJsonFromResourceOrFile
protected static JsonInput loadJsonFromResourceOrFile(String resource) { """ load a JSON file from the resource or file system. As a fallback, treats {@code resource} as a JSON string to be parsed. @param resource file or jar resource location @return A JsonObject representing the passed resource argument. """ try { return new Json().newInput(readFileOrResource(resource)); } catch (RuntimeException e) { throw new GridConfigurationException("Unable to read input", e); } }
java
protected static JsonInput loadJsonFromResourceOrFile(String resource) { try { return new Json().newInput(readFileOrResource(resource)); } catch (RuntimeException e) { throw new GridConfigurationException("Unable to read input", e); } }
[ "protected", "static", "JsonInput", "loadJsonFromResourceOrFile", "(", "String", "resource", ")", "{", "try", "{", "return", "new", "Json", "(", ")", ".", "newInput", "(", "readFileOrResource", "(", "resource", ")", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "throw", "new", "GridConfigurationException", "(", "\"Unable to read input\"", ",", "e", ")", ";", "}", "}" ]
load a JSON file from the resource or file system. As a fallback, treats {@code resource} as a JSON string to be parsed. @param resource file or jar resource location @return A JsonObject representing the passed resource argument.
[ "load", "a", "JSON", "file", "from", "the", "resource", "or", "file", "system", ".", "As", "a", "fallback", "treats", "{", "@code", "resource", "}", "as", "a", "JSON", "string", "to", "be", "parsed", "." ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java#L304-L310
landawn/AbacusUtil
src/com/landawn/abacus/util/LongMultiset.java
LongMultiset.getAndSet
public long getAndSet(final T e, final long occurrences) { """ The element will be removed if the specified count is 0. @param e @param occurrences @return """ checkOccurrences(occurrences); final MutableLong count = valueMap.get(e); long result = count == null ? 0 : count.value(); if (occurrences == 0) { if (count != null) { valueMap.remove(e); } } else { if (count == null) { valueMap.put(e, MutableLong.of(occurrences)); } else { count.setValue(occurrences); } } return result; }
java
public long getAndSet(final T e, final long occurrences) { checkOccurrences(occurrences); final MutableLong count = valueMap.get(e); long result = count == null ? 0 : count.value(); if (occurrences == 0) { if (count != null) { valueMap.remove(e); } } else { if (count == null) { valueMap.put(e, MutableLong.of(occurrences)); } else { count.setValue(occurrences); } } return result; }
[ "public", "long", "getAndSet", "(", "final", "T", "e", ",", "final", "long", "occurrences", ")", "{", "checkOccurrences", "(", "occurrences", ")", ";", "final", "MutableLong", "count", "=", "valueMap", ".", "get", "(", "e", ")", ";", "long", "result", "=", "count", "==", "null", "?", "0", ":", "count", ".", "value", "(", ")", ";", "if", "(", "occurrences", "==", "0", ")", "{", "if", "(", "count", "!=", "null", ")", "{", "valueMap", ".", "remove", "(", "e", ")", ";", "}", "}", "else", "{", "if", "(", "count", "==", "null", ")", "{", "valueMap", ".", "put", "(", "e", ",", "MutableLong", ".", "of", "(", "occurrences", ")", ")", ";", "}", "else", "{", "count", ".", "setValue", "(", "occurrences", ")", ";", "}", "}", "return", "result", ";", "}" ]
The element will be removed if the specified count is 0. @param e @param occurrences @return
[ "The", "element", "will", "be", "removed", "if", "the", "specified", "count", "is", "0", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/LongMultiset.java#L201-L220
Impetus/Kundera
src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java
DocumentIndexer.addSuperColumnNameToDocument
private void addSuperColumnNameToDocument(String superColumnName, Document currentDoc) { """ Index super column name. @param superColumnName the super column name @param currentDoc the current doc """ Field luceneField = new Field(SUPERCOLUMN_INDEX, superColumnName, Store.YES, Field.Index.NO); currentDoc.add(luceneField); }
java
private void addSuperColumnNameToDocument(String superColumnName, Document currentDoc) { Field luceneField = new Field(SUPERCOLUMN_INDEX, superColumnName, Store.YES, Field.Index.NO); currentDoc.add(luceneField); }
[ "private", "void", "addSuperColumnNameToDocument", "(", "String", "superColumnName", ",", "Document", "currentDoc", ")", "{", "Field", "luceneField", "=", "new", "Field", "(", "SUPERCOLUMN_INDEX", ",", "superColumnName", ",", "Store", ".", "YES", ",", "Field", ".", "Index", ".", "NO", ")", ";", "currentDoc", ".", "add", "(", "luceneField", ")", ";", "}" ]
Index super column name. @param superColumnName the super column name @param currentDoc the current doc
[ "Index", "super", "column", "name", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java#L232-L235
Erudika/para
para-client/src/main/java/com/erudika/para/client/ParaClient.java
ParaClient.findSimilar
public <P extends ParaObject> List<P> findSimilar(String type, String filterKey, String[] fields, String liketext, Pager... pager) { """ Searches for objects that have similar property values to a given text. A "find like this" query. @param <P> type of the object @param type the type of object to search for. See {@link com.erudika.para.core.ParaObject#getType()} @param filterKey exclude an object with this key from the results (optional) @param fields a list of property names @param liketext text to compare to @param pager a {@link com.erudika.para.utils.Pager} @return a list of objects found """ MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); params.put("fields", fields == null ? null : Arrays.asList(fields)); params.putSingle("filterid", filterKey); params.putSingle("like", liketext); params.putSingle(Config._TYPE, type); params.putAll(pagerToParams(pager)); return getItems(find("similar", params), pager); }
java
public <P extends ParaObject> List<P> findSimilar(String type, String filterKey, String[] fields, String liketext, Pager... pager) { MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); params.put("fields", fields == null ? null : Arrays.asList(fields)); params.putSingle("filterid", filterKey); params.putSingle("like", liketext); params.putSingle(Config._TYPE, type); params.putAll(pagerToParams(pager)); return getItems(find("similar", params), pager); }
[ "public", "<", "P", "extends", "ParaObject", ">", "List", "<", "P", ">", "findSimilar", "(", "String", "type", ",", "String", "filterKey", ",", "String", "[", "]", "fields", ",", "String", "liketext", ",", "Pager", "...", "pager", ")", "{", "MultivaluedMap", "<", "String", ",", "String", ">", "params", "=", "new", "MultivaluedHashMap", "<>", "(", ")", ";", "params", ".", "put", "(", "\"fields\"", ",", "fields", "==", "null", "?", "null", ":", "Arrays", ".", "asList", "(", "fields", ")", ")", ";", "params", ".", "putSingle", "(", "\"filterid\"", ",", "filterKey", ")", ";", "params", ".", "putSingle", "(", "\"like\"", ",", "liketext", ")", ";", "params", ".", "putSingle", "(", "Config", ".", "_TYPE", ",", "type", ")", ";", "params", ".", "putAll", "(", "pagerToParams", "(", "pager", ")", ")", ";", "return", "getItems", "(", "find", "(", "\"similar\"", ",", "params", ")", ",", "pager", ")", ";", "}" ]
Searches for objects that have similar property values to a given text. A "find like this" query. @param <P> type of the object @param type the type of object to search for. See {@link com.erudika.para.core.ParaObject#getType()} @param filterKey exclude an object with this key from the results (optional) @param fields a list of property names @param liketext text to compare to @param pager a {@link com.erudika.para.utils.Pager} @return a list of objects found
[ "Searches", "for", "objects", "that", "have", "similar", "property", "values", "to", "a", "given", "text", ".", "A", "find", "like", "this", "query", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L761-L770
atomix/atomix
utils/src/main/java/io/atomix/utils/concurrent/AbstractAccumulator.java
AbstractAccumulator.rescheduleTask
private void rescheduleTask(AtomicReference<TimerTask> taskRef, long millis) { """ Reschedules the specified task, cancelling existing one if applicable. @param taskRef task reference @param millis delay in milliseconds """ ProcessorTask newTask = new ProcessorTask(); timer.schedule(newTask, millis); swapAndCancelTask(taskRef, newTask); }
java
private void rescheduleTask(AtomicReference<TimerTask> taskRef, long millis) { ProcessorTask newTask = new ProcessorTask(); timer.schedule(newTask, millis); swapAndCancelTask(taskRef, newTask); }
[ "private", "void", "rescheduleTask", "(", "AtomicReference", "<", "TimerTask", ">", "taskRef", ",", "long", "millis", ")", "{", "ProcessorTask", "newTask", "=", "new", "ProcessorTask", "(", ")", ";", "timer", ".", "schedule", "(", "newTask", ",", "millis", ")", ";", "swapAndCancelTask", "(", "taskRef", ",", "newTask", ")", ";", "}" ]
Reschedules the specified task, cancelling existing one if applicable. @param taskRef task reference @param millis delay in milliseconds
[ "Reschedules", "the", "specified", "task", "cancelling", "existing", "one", "if", "applicable", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/utils/src/main/java/io/atomix/utils/concurrent/AbstractAccumulator.java#L124-L128
derari/cthul
objects/src/main/java/org/cthul/objects/reflection/Signatures.java
Signatures.candidateConstructors
public static <T> Constructor<T>[] candidateConstructors(Constructor<T>[] constructors, Object[] args) { """ Selects the best equally-matching constructors for the given arguments. @param <T> @param constructors @param args @return constructors """ return candidateConstructors(constructors, collectArgTypes(args)); }
java
public static <T> Constructor<T>[] candidateConstructors(Constructor<T>[] constructors, Object[] args) { return candidateConstructors(constructors, collectArgTypes(args)); }
[ "public", "static", "<", "T", ">", "Constructor", "<", "T", ">", "[", "]", "candidateConstructors", "(", "Constructor", "<", "T", ">", "[", "]", "constructors", ",", "Object", "[", "]", "args", ")", "{", "return", "candidateConstructors", "(", "constructors", ",", "collectArgTypes", "(", "args", ")", ")", ";", "}" ]
Selects the best equally-matching constructors for the given arguments. @param <T> @param constructors @param args @return constructors
[ "Selects", "the", "best", "equally", "-", "matching", "constructors", "for", "the", "given", "arguments", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/reflection/Signatures.java#L104-L106
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java
URLConnectionTools.doPOST
public static InputStream doPOST(URL url, String data) throws IOException { """ Do a POST to a URL and return the response stream for further processing elsewhere. <p> The caller is responsible to close the returned InputStream not to cause resource leaks. @param url the input URL to be read @param data the post data @return an {@link InputStream} of response @throws IOException due to an error opening the URL """ return doPOST(url,data,DEFAULT_CONNECTION_TIMEOUT); }
java
public static InputStream doPOST(URL url, String data) throws IOException { return doPOST(url,data,DEFAULT_CONNECTION_TIMEOUT); }
[ "public", "static", "InputStream", "doPOST", "(", "URL", "url", ",", "String", "data", ")", "throws", "IOException", "{", "return", "doPOST", "(", "url", ",", "data", ",", "DEFAULT_CONNECTION_TIMEOUT", ")", ";", "}" ]
Do a POST to a URL and return the response stream for further processing elsewhere. <p> The caller is responsible to close the returned InputStream not to cause resource leaks. @param url the input URL to be read @param data the post data @return an {@link InputStream} of response @throws IOException due to an error opening the URL
[ "Do", "a", "POST", "to", "a", "URL", "and", "return", "the", "response", "stream", "for", "further", "processing", "elsewhere", ".", "<p", ">", "The", "caller", "is", "responsible", "to", "close", "the", "returned", "InputStream", "not", "to", "cause", "resource", "leaks", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java#L155-L158
esigate/esigate
esigate-server/src/main/java/org/esigate/server/EsigateServer.java
EsigateServer.getProperty
private static int getProperty(String prefix, String name, int defaultValue) { """ Get an integer from System properties @param prefix @param name @param defaultValue @return """ int result = defaultValue; try { result = Integer.parseInt(System.getProperty(prefix + name)); } catch (NumberFormatException e) { LOG.warn("Value for " + prefix + name + " must be an integer. Using default " + defaultValue); } return result; }
java
private static int getProperty(String prefix, String name, int defaultValue) { int result = defaultValue; try { result = Integer.parseInt(System.getProperty(prefix + name)); } catch (NumberFormatException e) { LOG.warn("Value for " + prefix + name + " must be an integer. Using default " + defaultValue); } return result; }
[ "private", "static", "int", "getProperty", "(", "String", "prefix", ",", "String", "name", ",", "int", "defaultValue", ")", "{", "int", "result", "=", "defaultValue", ";", "try", "{", "result", "=", "Integer", ".", "parseInt", "(", "System", ".", "getProperty", "(", "prefix", "+", "name", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Value for \"", "+", "prefix", "+", "name", "+", "\" must be an integer. Using default \"", "+", "defaultValue", ")", ";", "}", "return", "result", ";", "}" ]
Get an integer from System properties @param prefix @param name @param defaultValue @return
[ "Get", "an", "integer", "from", "System", "properties" ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-server/src/main/java/org/esigate/server/EsigateServer.java#L87-L96
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java
DwgUtil.getDefaultDouble
public static Vector getDefaultDouble(int[] data, int offset, double defVal) throws Exception { """ Read a double value from a group of unsigned bytes and a default double @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @param defVal Default double value @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines. @return Vector This vector has two parts. First is an int value that represents the new offset, and second is the double value """ int flags = ((Integer)getBits(data, 2, offset)).intValue(); int read = 2; double val; if (flags==0x0) { val = defVal; } else { int _offset = offset + 2; String dstr; if (flags==0x3) { byte[] bytes = (byte[])getBits(data, 64, _offset); ByteBuffer bb = ByteBuffer.wrap(bytes); bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getDouble(); read = 66; } else { byte[] dstrArrayAux = new byte[8]; int[] doubleOffset = new int[]{0}; ByteUtils.doubleToBytes(defVal, dstrArrayAux, doubleOffset); byte[] dstrArrayAuxx = new byte[8]; dstrArrayAuxx[0] = dstrArrayAux[7]; dstrArrayAuxx[1] = dstrArrayAux[6]; dstrArrayAuxx[2] = dstrArrayAux[5]; dstrArrayAuxx[3] = dstrArrayAux[4]; dstrArrayAuxx[4] = dstrArrayAux[3]; dstrArrayAuxx[5] = dstrArrayAux[2]; dstrArrayAuxx[6] = dstrArrayAux[1]; dstrArrayAuxx[7] = dstrArrayAux[0]; int[] dstrArrayAuxxx = new int[8]; for (int i=0;i<dstrArrayAuxxx.length;i++) { dstrArrayAuxxx[i] = ByteUtils.getUnsigned(dstrArrayAuxx[i]); } byte[] dstrArray = new byte[8]; for (int i=0;i<dstrArray.length;i++) { dstrArray[i] = (byte)dstrArrayAuxxx[i]; } if (flags==0x1) { byte[] ddArray = (byte[])getBits(data, 32, _offset); dstrArray[0] = ddArray[0]; dstrArray[1] = ddArray[1]; dstrArray[2] = ddArray[2]; dstrArray[3] = ddArray[3]; read = 34; } else { byte[] ddArray = (byte[])getBits(data, 48, _offset); dstrArray[4] = ddArray[0]; dstrArray[5] = ddArray[1]; dstrArray[0] = ddArray[2]; dstrArray[1] = ddArray[3]; dstrArray[2] = ddArray[4]; dstrArray[3] = ddArray[5]; read = 50; } ByteBuffer bb = ByteBuffer.wrap(dstrArray); bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getDouble(); } } Vector v = new Vector(); v.add(new Integer(offset+read)); v.add(new Double(val)); return v; }
java
public static Vector getDefaultDouble(int[] data, int offset, double defVal) throws Exception { int flags = ((Integer)getBits(data, 2, offset)).intValue(); int read = 2; double val; if (flags==0x0) { val = defVal; } else { int _offset = offset + 2; String dstr; if (flags==0x3) { byte[] bytes = (byte[])getBits(data, 64, _offset); ByteBuffer bb = ByteBuffer.wrap(bytes); bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getDouble(); read = 66; } else { byte[] dstrArrayAux = new byte[8]; int[] doubleOffset = new int[]{0}; ByteUtils.doubleToBytes(defVal, dstrArrayAux, doubleOffset); byte[] dstrArrayAuxx = new byte[8]; dstrArrayAuxx[0] = dstrArrayAux[7]; dstrArrayAuxx[1] = dstrArrayAux[6]; dstrArrayAuxx[2] = dstrArrayAux[5]; dstrArrayAuxx[3] = dstrArrayAux[4]; dstrArrayAuxx[4] = dstrArrayAux[3]; dstrArrayAuxx[5] = dstrArrayAux[2]; dstrArrayAuxx[6] = dstrArrayAux[1]; dstrArrayAuxx[7] = dstrArrayAux[0]; int[] dstrArrayAuxxx = new int[8]; for (int i=0;i<dstrArrayAuxxx.length;i++) { dstrArrayAuxxx[i] = ByteUtils.getUnsigned(dstrArrayAuxx[i]); } byte[] dstrArray = new byte[8]; for (int i=0;i<dstrArray.length;i++) { dstrArray[i] = (byte)dstrArrayAuxxx[i]; } if (flags==0x1) { byte[] ddArray = (byte[])getBits(data, 32, _offset); dstrArray[0] = ddArray[0]; dstrArray[1] = ddArray[1]; dstrArray[2] = ddArray[2]; dstrArray[3] = ddArray[3]; read = 34; } else { byte[] ddArray = (byte[])getBits(data, 48, _offset); dstrArray[4] = ddArray[0]; dstrArray[5] = ddArray[1]; dstrArray[0] = ddArray[2]; dstrArray[1] = ddArray[3]; dstrArray[2] = ddArray[4]; dstrArray[3] = ddArray[5]; read = 50; } ByteBuffer bb = ByteBuffer.wrap(dstrArray); bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getDouble(); } } Vector v = new Vector(); v.add(new Integer(offset+read)); v.add(new Double(val)); return v; }
[ "public", "static", "Vector", "getDefaultDouble", "(", "int", "[", "]", "data", ",", "int", "offset", ",", "double", "defVal", ")", "throws", "Exception", "{", "int", "flags", "=", "(", "(", "Integer", ")", "getBits", "(", "data", ",", "2", ",", "offset", ")", ")", ".", "intValue", "(", ")", ";", "int", "read", "=", "2", ";", "double", "val", ";", "if", "(", "flags", "==", "0x0", ")", "{", "val", "=", "defVal", ";", "}", "else", "{", "int", "_offset", "=", "offset", "+", "2", ";", "String", "dstr", ";", "if", "(", "flags", "==", "0x3", ")", "{", "byte", "[", "]", "bytes", "=", "(", "byte", "[", "]", ")", "getBits", "(", "data", ",", "64", ",", "_offset", ")", ";", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "wrap", "(", "bytes", ")", ";", "bb", ".", "order", "(", "ByteOrder", ".", "LITTLE_ENDIAN", ")", ";", "val", "=", "bb", ".", "getDouble", "(", ")", ";", "read", "=", "66", ";", "}", "else", "{", "byte", "[", "]", "dstrArrayAux", "=", "new", "byte", "[", "8", "]", ";", "int", "[", "]", "doubleOffset", "=", "new", "int", "[", "]", "{", "0", "}", ";", "ByteUtils", ".", "doubleToBytes", "(", "defVal", ",", "dstrArrayAux", ",", "doubleOffset", ")", ";", "byte", "[", "]", "dstrArrayAuxx", "=", "new", "byte", "[", "8", "]", ";", "dstrArrayAuxx", "[", "0", "]", "=", "dstrArrayAux", "[", "7", "]", ";", "dstrArrayAuxx", "[", "1", "]", "=", "dstrArrayAux", "[", "6", "]", ";", "dstrArrayAuxx", "[", "2", "]", "=", "dstrArrayAux", "[", "5", "]", ";", "dstrArrayAuxx", "[", "3", "]", "=", "dstrArrayAux", "[", "4", "]", ";", "dstrArrayAuxx", "[", "4", "]", "=", "dstrArrayAux", "[", "3", "]", ";", "dstrArrayAuxx", "[", "5", "]", "=", "dstrArrayAux", "[", "2", "]", ";", "dstrArrayAuxx", "[", "6", "]", "=", "dstrArrayAux", "[", "1", "]", ";", "dstrArrayAuxx", "[", "7", "]", "=", "dstrArrayAux", "[", "0", "]", ";", "int", "[", "]", "dstrArrayAuxxx", "=", "new", "int", "[", "8", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dstrArrayAuxxx", ".", "length", ";", "i", "++", ")", "{", "dstrArrayAuxxx", "[", "i", "]", "=", "ByteUtils", ".", "getUnsigned", "(", "dstrArrayAuxx", "[", "i", "]", ")", ";", "}", "byte", "[", "]", "dstrArray", "=", "new", "byte", "[", "8", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dstrArray", ".", "length", ";", "i", "++", ")", "{", "dstrArray", "[", "i", "]", "=", "(", "byte", ")", "dstrArrayAuxxx", "[", "i", "]", ";", "}", "if", "(", "flags", "==", "0x1", ")", "{", "byte", "[", "]", "ddArray", "=", "(", "byte", "[", "]", ")", "getBits", "(", "data", ",", "32", ",", "_offset", ")", ";", "dstrArray", "[", "0", "]", "=", "ddArray", "[", "0", "]", ";", "dstrArray", "[", "1", "]", "=", "ddArray", "[", "1", "]", ";", "dstrArray", "[", "2", "]", "=", "ddArray", "[", "2", "]", ";", "dstrArray", "[", "3", "]", "=", "ddArray", "[", "3", "]", ";", "read", "=", "34", ";", "}", "else", "{", "byte", "[", "]", "ddArray", "=", "(", "byte", "[", "]", ")", "getBits", "(", "data", ",", "48", ",", "_offset", ")", ";", "dstrArray", "[", "4", "]", "=", "ddArray", "[", "0", "]", ";", "dstrArray", "[", "5", "]", "=", "ddArray", "[", "1", "]", ";", "dstrArray", "[", "0", "]", "=", "ddArray", "[", "2", "]", ";", "dstrArray", "[", "1", "]", "=", "ddArray", "[", "3", "]", ";", "dstrArray", "[", "2", "]", "=", "ddArray", "[", "4", "]", ";", "dstrArray", "[", "3", "]", "=", "ddArray", "[", "5", "]", ";", "read", "=", "50", ";", "}", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "wrap", "(", "dstrArray", ")", ";", "bb", ".", "order", "(", "ByteOrder", ".", "LITTLE_ENDIAN", ")", ";", "val", "=", "bb", ".", "getDouble", "(", ")", ";", "}", "}", "Vector", "v", "=", "new", "Vector", "(", ")", ";", "v", ".", "add", "(", "new", "Integer", "(", "offset", "+", "read", ")", ")", ";", "v", ".", "add", "(", "new", "Double", "(", "val", ")", ")", ";", "return", "v", ";", "}" ]
Read a double value from a group of unsigned bytes and a default double @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @param defVal Default double value @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines. @return Vector This vector has two parts. First is an int value that represents the new offset, and second is the double value
[ "Read", "a", "double", "value", "from", "a", "group", "of", "unsigned", "bytes", "and", "a", "default", "double" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java#L177-L239
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java
PostConditionException.validateGreaterThan
public static void validateGreaterThan( Number value, Number limit, String identifier ) throws PostConditionException { """ Validates that the value is greater than a limit. This method ensures that <code>value > limit</code>. @param identifier The name of the object. @param limit The limit that the value must exceed. @param value The value to be tested. @throws PostConditionException if the condition is not met. """ if( value.doubleValue() > limit.doubleValue() ) { return; } throw new PostConditionException( identifier + " was not greater than " + limit + ". Was: " + value ); }
java
public static void validateGreaterThan( Number value, Number limit, String identifier ) throws PostConditionException { if( value.doubleValue() > limit.doubleValue() ) { return; } throw new PostConditionException( identifier + " was not greater than " + limit + ". Was: " + value ); }
[ "public", "static", "void", "validateGreaterThan", "(", "Number", "value", ",", "Number", "limit", ",", "String", "identifier", ")", "throws", "PostConditionException", "{", "if", "(", "value", ".", "doubleValue", "(", ")", ">", "limit", ".", "doubleValue", "(", ")", ")", "{", "return", ";", "}", "throw", "new", "PostConditionException", "(", "identifier", "+", "\" was not greater than \"", "+", "limit", "+", "\". Was: \"", "+", "value", ")", ";", "}" ]
Validates that the value is greater than a limit. This method ensures that <code>value > limit</code>. @param identifier The name of the object. @param limit The limit that the value must exceed. @param value The value to be tested. @throws PostConditionException if the condition is not met.
[ "Validates", "that", "the", "value", "is", "greater", "than", "a", "limit", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java#L128-L136
respoke/respoke-sdk-android
respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java
RespokeEndpoint.startCall
public RespokeCall startCall(RespokeCall.Listener callListener, Context context, GLSurfaceView glView, boolean audioOnly) { """ Create a new call with audio and optionally video. @param callListener A listener to receive notifications of call related events @param context An application context with which to access system resources @param glView A GLSurfaceView into which video from the call should be rendered, or null if the call is audio only @param audioOnly Specify true for an audio-only call @return A new RespokeCall instance """ RespokeCall call = null; if ((null != signalingChannel) && (signalingChannel.connected)) { call = new RespokeCall(signalingChannel, this, false); call.setListener(callListener); call.startCall(context, glView, audioOnly); } return call; }
java
public RespokeCall startCall(RespokeCall.Listener callListener, Context context, GLSurfaceView glView, boolean audioOnly) { RespokeCall call = null; if ((null != signalingChannel) && (signalingChannel.connected)) { call = new RespokeCall(signalingChannel, this, false); call.setListener(callListener); call.startCall(context, glView, audioOnly); } return call; }
[ "public", "RespokeCall", "startCall", "(", "RespokeCall", ".", "Listener", "callListener", ",", "Context", "context", ",", "GLSurfaceView", "glView", ",", "boolean", "audioOnly", ")", "{", "RespokeCall", "call", "=", "null", ";", "if", "(", "(", "null", "!=", "signalingChannel", ")", "&&", "(", "signalingChannel", ".", "connected", ")", ")", "{", "call", "=", "new", "RespokeCall", "(", "signalingChannel", ",", "this", ",", "false", ")", ";", "call", ".", "setListener", "(", "callListener", ")", ";", "call", ".", "startCall", "(", "context", ",", "glView", ",", "audioOnly", ")", ";", "}", "return", "call", ";", "}" ]
Create a new call with audio and optionally video. @param callListener A listener to receive notifications of call related events @param context An application context with which to access system resources @param glView A GLSurfaceView into which video from the call should be rendered, or null if the call is audio only @param audioOnly Specify true for an audio-only call @return A new RespokeCall instance
[ "Create", "a", "new", "call", "with", "audio", "and", "optionally", "video", "." ]
train
https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java#L145-L156
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiTransform.java
BidiTransform.shapeArabic
private void shapeArabic(int digitsDir, int lettersDir) { """ Performs digit and letter shaping @param digitsDir Digit shaping option that indicates whether the text should be treated as logical or visual. @param lettersDir Letter shaping option that indicates whether the text should be treated as logical or visual form (can mismatch the digit option). """ if (digitsDir == lettersDir) { shapeArabic(shapingOptions | digitsDir); } else { /* Honor all shape options other than letters (not necessarily digits only) */ shapeArabic((shapingOptions & ~ArabicShaping.LETTERS_MASK) | digitsDir); /* Honor all shape options other than digits (not necessarily letters only) */ shapeArabic((shapingOptions & ~ArabicShaping.DIGITS_MASK) | lettersDir); } }
java
private void shapeArabic(int digitsDir, int lettersDir) { if (digitsDir == lettersDir) { shapeArabic(shapingOptions | digitsDir); } else { /* Honor all shape options other than letters (not necessarily digits only) */ shapeArabic((shapingOptions & ~ArabicShaping.LETTERS_MASK) | digitsDir); /* Honor all shape options other than digits (not necessarily letters only) */ shapeArabic((shapingOptions & ~ArabicShaping.DIGITS_MASK) | lettersDir); } }
[ "private", "void", "shapeArabic", "(", "int", "digitsDir", ",", "int", "lettersDir", ")", "{", "if", "(", "digitsDir", "==", "lettersDir", ")", "{", "shapeArabic", "(", "shapingOptions", "|", "digitsDir", ")", ";", "}", "else", "{", "/* Honor all shape options other than letters (not necessarily digits\n only) */", "shapeArabic", "(", "(", "shapingOptions", "&", "~", "ArabicShaping", ".", "LETTERS_MASK", ")", "|", "digitsDir", ")", ";", "/* Honor all shape options other than digits (not necessarily letters\n only) */", "shapeArabic", "(", "(", "shapingOptions", "&", "~", "ArabicShaping", ".", "DIGITS_MASK", ")", "|", "lettersDir", ")", ";", "}", "}" ]
Performs digit and letter shaping @param digitsDir Digit shaping option that indicates whether the text should be treated as logical or visual. @param lettersDir Letter shaping option that indicates whether the text should be treated as logical or visual form (can mismatch the digit option).
[ "Performs", "digit", "and", "letter", "shaping" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiTransform.java#L350-L362
digitalpetri/ethernet-ip
cip-core/src/main/java/com/digitalpetri/enip/cip/structs/ForwardCloseRequest.java
ForwardCloseRequest.encodeConnectionPath
private static void encodeConnectionPath(PaddedEPath path, ByteBuf buffer) { """ Encode the connection path. <p> {@link PaddedEPath#encode(EPath, ByteBuf)} can't be used here because the {@link ForwardCloseRequest} has an extra reserved byte after the connection path size for some reason. @param path the {@link PaddedEPath} to encode. @param buffer the {@link ByteBuf} to encode into. """ // length placeholder... int lengthStartIndex = buffer.writerIndex(); buffer.writeByte(0); // reserved buffer.writeZero(1); // encode the path segments... int dataStartIndex = buffer.writerIndex(); for (EPathSegment segment : path.getSegments()) { if (segment instanceof LogicalSegment) { LogicalSegment.encode((LogicalSegment) segment, path.isPadded(), buffer); } else if (segment instanceof PortSegment) { PortSegment.encode((PortSegment) segment, path.isPadded(), buffer); } else if (segment instanceof DataSegment) { DataSegment.encode((DataSegment) segment, path.isPadded(), buffer); } else { throw new RuntimeException("no encoder for " + segment.getClass().getSimpleName()); } } // go back and update the length int bytesWritten = buffer.writerIndex() - dataStartIndex; int wordsWritten = bytesWritten / 2; buffer.markWriterIndex(); buffer.writerIndex(lengthStartIndex); buffer.writeByte(wordsWritten); buffer.resetWriterIndex(); }
java
private static void encodeConnectionPath(PaddedEPath path, ByteBuf buffer) { // length placeholder... int lengthStartIndex = buffer.writerIndex(); buffer.writeByte(0); // reserved buffer.writeZero(1); // encode the path segments... int dataStartIndex = buffer.writerIndex(); for (EPathSegment segment : path.getSegments()) { if (segment instanceof LogicalSegment) { LogicalSegment.encode((LogicalSegment) segment, path.isPadded(), buffer); } else if (segment instanceof PortSegment) { PortSegment.encode((PortSegment) segment, path.isPadded(), buffer); } else if (segment instanceof DataSegment) { DataSegment.encode((DataSegment) segment, path.isPadded(), buffer); } else { throw new RuntimeException("no encoder for " + segment.getClass().getSimpleName()); } } // go back and update the length int bytesWritten = buffer.writerIndex() - dataStartIndex; int wordsWritten = bytesWritten / 2; buffer.markWriterIndex(); buffer.writerIndex(lengthStartIndex); buffer.writeByte(wordsWritten); buffer.resetWriterIndex(); }
[ "private", "static", "void", "encodeConnectionPath", "(", "PaddedEPath", "path", ",", "ByteBuf", "buffer", ")", "{", "// length placeholder...", "int", "lengthStartIndex", "=", "buffer", ".", "writerIndex", "(", ")", ";", "buffer", ".", "writeByte", "(", "0", ")", ";", "// reserved", "buffer", ".", "writeZero", "(", "1", ")", ";", "// encode the path segments...", "int", "dataStartIndex", "=", "buffer", ".", "writerIndex", "(", ")", ";", "for", "(", "EPathSegment", "segment", ":", "path", ".", "getSegments", "(", ")", ")", "{", "if", "(", "segment", "instanceof", "LogicalSegment", ")", "{", "LogicalSegment", ".", "encode", "(", "(", "LogicalSegment", ")", "segment", ",", "path", ".", "isPadded", "(", ")", ",", "buffer", ")", ";", "}", "else", "if", "(", "segment", "instanceof", "PortSegment", ")", "{", "PortSegment", ".", "encode", "(", "(", "PortSegment", ")", "segment", ",", "path", ".", "isPadded", "(", ")", ",", "buffer", ")", ";", "}", "else", "if", "(", "segment", "instanceof", "DataSegment", ")", "{", "DataSegment", ".", "encode", "(", "(", "DataSegment", ")", "segment", ",", "path", ".", "isPadded", "(", ")", ",", "buffer", ")", ";", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"no encoder for \"", "+", "segment", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "}", "}", "// go back and update the length", "int", "bytesWritten", "=", "buffer", ".", "writerIndex", "(", ")", "-", "dataStartIndex", ";", "int", "wordsWritten", "=", "bytesWritten", "/", "2", ";", "buffer", ".", "markWriterIndex", "(", ")", ";", "buffer", ".", "writerIndex", "(", "lengthStartIndex", ")", ";", "buffer", ".", "writeByte", "(", "wordsWritten", ")", ";", "buffer", ".", "resetWriterIndex", "(", ")", ";", "}" ]
Encode the connection path. <p> {@link PaddedEPath#encode(EPath, ByteBuf)} can't be used here because the {@link ForwardCloseRequest} has an extra reserved byte after the connection path size for some reason. @param path the {@link PaddedEPath} to encode. @param buffer the {@link ByteBuf} to encode into.
[ "Encode", "the", "connection", "path", ".", "<p", ">", "{", "@link", "PaddedEPath#encode", "(", "EPath", "ByteBuf", ")", "}", "can", "t", "be", "used", "here", "because", "the", "{", "@link", "ForwardCloseRequest", "}", "has", "an", "extra", "reserved", "byte", "after", "the", "connection", "path", "size", "for", "some", "reason", "." ]
train
https://github.com/digitalpetri/ethernet-ip/blob/de69faa04f658ff8a086e66012308db851b5b51a/cip-core/src/main/java/com/digitalpetri/enip/cip/structs/ForwardCloseRequest.java#L79-L109
greenmail-mail-test/greenmail
greenmail-spring/src/main/java/com/icegreen/greenmail/spring/GreenMailBean.java
GreenMailBean.sendEmail
public void sendEmail(final String theTo, final String theFrom, final String theSubject, final String theContent) { """ Sends a mail message to the GreenMail server. <p/> Note: SMTP or SMTPS must be configured. @param theTo the <em>TO</em> field. @param theFrom the <em>FROM</em>field. @param theSubject the subject. @param theContent the message content. """ if (null == smtpServerSetup) { throw new IllegalStateException("Can not send mail, no SMTP or SMTPS setup found"); } GreenMailUtil.sendTextEmail(theTo, theFrom, theSubject, theContent, smtpServerSetup); }
java
public void sendEmail(final String theTo, final String theFrom, final String theSubject, final String theContent) { if (null == smtpServerSetup) { throw new IllegalStateException("Can not send mail, no SMTP or SMTPS setup found"); } GreenMailUtil.sendTextEmail(theTo, theFrom, theSubject, theContent, smtpServerSetup); }
[ "public", "void", "sendEmail", "(", "final", "String", "theTo", ",", "final", "String", "theFrom", ",", "final", "String", "theSubject", ",", "final", "String", "theContent", ")", "{", "if", "(", "null", "==", "smtpServerSetup", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Can not send mail, no SMTP or SMTPS setup found\"", ")", ";", "}", "GreenMailUtil", ".", "sendTextEmail", "(", "theTo", ",", "theFrom", ",", "theSubject", ",", "theContent", ",", "smtpServerSetup", ")", ";", "}" ]
Sends a mail message to the GreenMail server. <p/> Note: SMTP or SMTPS must be configured. @param theTo the <em>TO</em> field. @param theFrom the <em>FROM</em>field. @param theSubject the subject. @param theContent the message content.
[ "Sends", "a", "mail", "message", "to", "the", "GreenMail", "server", ".", "<p", "/", ">", "Note", ":", "SMTP", "or", "SMTPS", "must", "be", "configured", "." ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-spring/src/main/java/com/icegreen/greenmail/spring/GreenMailBean.java#L395-L401
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/config/LaunchConfigurationConfigurator.java
LaunchConfigurationConfigurator.setMainJavaClass
protected static void setMainJavaClass(ILaunchConfigurationWorkingCopy wc, String name) { """ Change the main java class within the given configuration. @param wc the configuration to change. @param name the qualified name of the main Java class. @since 0.7 """ wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, name); }
java
protected static void setMainJavaClass(ILaunchConfigurationWorkingCopy wc, String name) { wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, name); }
[ "protected", "static", "void", "setMainJavaClass", "(", "ILaunchConfigurationWorkingCopy", "wc", ",", "String", "name", ")", "{", "wc", ".", "setAttribute", "(", "IJavaLaunchConfigurationConstants", ".", "ATTR_MAIN_TYPE_NAME", ",", "name", ")", ";", "}" ]
Change the main java class within the given configuration. @param wc the configuration to change. @param name the qualified name of the main Java class. @since 0.7
[ "Change", "the", "main", "java", "class", "within", "the", "given", "configuration", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/config/LaunchConfigurationConfigurator.java#L201-L205
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.convertSqlXml
public static Object convertSqlXml(Connection conn, String value) throws SQLException { """ Transfers data from String into sql.SQLXML @param conn connection for which sql.SQLXML object would be created @param value String @return sql.SQLXML from String @throws SQLException """ return convertSqlXml(conn, value.getBytes()); }
java
public static Object convertSqlXml(Connection conn, String value) throws SQLException { return convertSqlXml(conn, value.getBytes()); }
[ "public", "static", "Object", "convertSqlXml", "(", "Connection", "conn", ",", "String", "value", ")", "throws", "SQLException", "{", "return", "convertSqlXml", "(", "conn", ",", "value", ".", "getBytes", "(", ")", ")", ";", "}" ]
Transfers data from String into sql.SQLXML @param conn connection for which sql.SQLXML object would be created @param value String @return sql.SQLXML from String @throws SQLException
[ "Transfers", "data", "from", "String", "into", "sql", ".", "SQLXML" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L305-L307
pwittchen/prefser
library/src/main/java/com/github/pwittchen/prefser/library/rx2/Prefser.java
Prefser.observePreferences
public Observable<String> observePreferences() { """ returns RxJava Observable from SharedPreferences used inside Prefser object. You can subscribe this Observable and every time, when SharedPreferences will change, subscriber will be notified about that and you will be able to read key of the value, which has been changed. @return Observable with String containing key of the value in default SharedPreferences """ return Observable.create(new ObservableOnSubscribe<String>() { @Override public void subscribe(final @io.reactivex.annotations.NonNull ObservableEmitter<String> e) { preferences.registerOnSharedPreferenceChangeListener( new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPrefs, String key) { if (!e.isDisposed()) { e.onNext(key); } } }); } }); }
java
public Observable<String> observePreferences() { return Observable.create(new ObservableOnSubscribe<String>() { @Override public void subscribe(final @io.reactivex.annotations.NonNull ObservableEmitter<String> e) { preferences.registerOnSharedPreferenceChangeListener( new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPrefs, String key) { if (!e.isDisposed()) { e.onNext(key); } } }); } }); }
[ "public", "Observable", "<", "String", ">", "observePreferences", "(", ")", "{", "return", "Observable", ".", "create", "(", "new", "ObservableOnSubscribe", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "void", "subscribe", "(", "final", "@", "io", ".", "reactivex", ".", "annotations", ".", "NonNull", "ObservableEmitter", "<", "String", ">", "e", ")", "{", "preferences", ".", "registerOnSharedPreferenceChangeListener", "(", "new", "SharedPreferences", ".", "OnSharedPreferenceChangeListener", "(", ")", "{", "@", "Override", "public", "void", "onSharedPreferenceChanged", "(", "SharedPreferences", "sharedPrefs", ",", "String", "key", ")", "{", "if", "(", "!", "e", ".", "isDisposed", "(", ")", ")", "{", "e", ".", "onNext", "(", "key", ")", ";", "}", "}", "}", ")", ";", "}", "}", ")", ";", "}" ]
returns RxJava Observable from SharedPreferences used inside Prefser object. You can subscribe this Observable and every time, when SharedPreferences will change, subscriber will be notified about that and you will be able to read key of the value, which has been changed. @return Observable with String containing key of the value in default SharedPreferences
[ "returns", "RxJava", "Observable", "from", "SharedPreferences", "used", "inside", "Prefser", "object", ".", "You", "can", "subscribe", "this", "Observable", "and", "every", "time", "when", "SharedPreferences", "will", "change", "subscriber", "will", "be", "notified", "about", "that", "and", "you", "will", "be", "able", "to", "read", "key", "of", "the", "value", "which", "has", "been", "changed", "." ]
train
https://github.com/pwittchen/prefser/blob/7dc7f980eeb71fd5617f8c749050c2400e4fbb2f/library/src/main/java/com/github/pwittchen/prefser/library/rx2/Prefser.java#L281-L296
js-lib-com/template.xhtml
src/main/java/js/template/xhtml/ObjectOperator.java
ObjectOperator.doExec
@Override protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws TemplateException { """ Execute object operator. This operator just returns the new object scope to be used by templates engine. Throws content exception if given property path does not designate an existing object. If requested object is null warn the event and return the null value. Templates engine consider returned null as fully processed branch signal. @param element context element, @param scope scope object, @param propertyPath object property path. @return new scope object or null. @throws TemplateException if given property path does not designate an existing object. """ if (!(propertyPath.equals(".") || isStrictObject(scope))) { throw new TemplateException("OBJECT operator on element |%s| requires object scope but got value type |%s|.", element, scope.getClass()); } Object value = content.getObject(scope, propertyPath); if (value == null) { log.warn("Null scope for property |%s| on element |%s|.", propertyPath, element); } else if (!(propertyPath.equals(".") || isStrictObject(value))) { throw new TemplateException(propertyPath, "Invalid content type. Expected strict object but got |%s|.", value.getClass()); } return value; }
java
@Override protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws TemplateException { if (!(propertyPath.equals(".") || isStrictObject(scope))) { throw new TemplateException("OBJECT operator on element |%s| requires object scope but got value type |%s|.", element, scope.getClass()); } Object value = content.getObject(scope, propertyPath); if (value == null) { log.warn("Null scope for property |%s| on element |%s|.", propertyPath, element); } else if (!(propertyPath.equals(".") || isStrictObject(value))) { throw new TemplateException(propertyPath, "Invalid content type. Expected strict object but got |%s|.", value.getClass()); } return value; }
[ "@", "Override", "protected", "Object", "doExec", "(", "Element", "element", ",", "Object", "scope", ",", "String", "propertyPath", ",", "Object", "...", "arguments", ")", "throws", "TemplateException", "{", "if", "(", "!", "(", "propertyPath", ".", "equals", "(", "\".\"", ")", "||", "isStrictObject", "(", "scope", ")", ")", ")", "{", "throw", "new", "TemplateException", "(", "\"OBJECT operator on element |%s| requires object scope but got value type |%s|.\"", ",", "element", ",", "scope", ".", "getClass", "(", ")", ")", ";", "}", "Object", "value", "=", "content", ".", "getObject", "(", "scope", ",", "propertyPath", ")", ";", "if", "(", "value", "==", "null", ")", "{", "log", ".", "warn", "(", "\"Null scope for property |%s| on element |%s|.\"", ",", "propertyPath", ",", "element", ")", ";", "}", "else", "if", "(", "!", "(", "propertyPath", ".", "equals", "(", "\".\"", ")", "||", "isStrictObject", "(", "value", ")", ")", ")", "{", "throw", "new", "TemplateException", "(", "propertyPath", ",", "\"Invalid content type. Expected strict object but got |%s|.\"", ",", "value", ".", "getClass", "(", ")", ")", ";", "}", "return", "value", ";", "}" ]
Execute object operator. This operator just returns the new object scope to be used by templates engine. Throws content exception if given property path does not designate an existing object. If requested object is null warn the event and return the null value. Templates engine consider returned null as fully processed branch signal. @param element context element, @param scope scope object, @param propertyPath object property path. @return new scope object or null. @throws TemplateException if given property path does not designate an existing object.
[ "Execute", "object", "operator", ".", "This", "operator", "just", "returns", "the", "new", "object", "scope", "to", "be", "used", "by", "templates", "engine", ".", "Throws", "content", "exception", "if", "given", "property", "path", "does", "not", "designate", "an", "existing", "object", ".", "If", "requested", "object", "is", "null", "warn", "the", "event", "and", "return", "the", "null", "value", ".", "Templates", "engine", "consider", "returned", "null", "as", "fully", "processed", "branch", "signal", "." ]
train
https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/ObjectOperator.java#L73-L85