repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.toStore
public static BitStore toStore(int size, Random random, float probability) { return preferredType.random(size, random, probability); }
java
public static BitStore toStore(int size, Random random, float probability) { return preferredType.random(size, random, probability); }
[ "public", "static", "BitStore", "toStore", "(", "int", "size", ",", "Random", "random", ",", "float", "probability", ")", "{", "return", "preferredType", ".", "random", "(", "size", ",", "random", ",", "probability", ")", ";", "}" ]
Creates a mutable {@link BitStore} initialized with random bit values. @param size the capacity, in bits, of the new {@link BitStore} @param random a source of randomness @param probability a number between 0 and 1 inclusive, being the independent probability that a bit is set @return a new mutable {@link BitStore} initialized with random bit values
[ "Creates", "a", "mutable", "{", "@link", "BitStore", "}", "initialized", "with", "random", "bit", "values", "." ]
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L303-L305
unbescape/unbescape
src/main/java/org/unbescape/java/JavaEscape.java
JavaEscape.unescapeJava
public static void unescapeJava(final String text, final Writer writer) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (text == null) { return; } if (text.indexOf('\\') < 0) { // Fail fast, avoid more complex (and less JIT-table) method to execute if not needed writer.write(text); return; } JavaEscapeUtil.unescape(new InternalStringReader(text), writer); }
java
public static void unescapeJava(final String text, final Writer writer) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (text == null) { return; } if (text.indexOf('\\') < 0) { // Fail fast, avoid more complex (and less JIT-table) method to execute if not needed writer.write(text); return; } JavaEscapeUtil.unescape(new InternalStringReader(text), writer); }
[ "public", "static", "void", "unescapeJava", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'writer' ca...
<p> Perform a Java <strong>unescape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> Java unescape of SECs, u-based and octal escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "Java", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/java/JavaEscape.java#L878-L895
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/support/TransparentToolTipDialog.java
TransparentToolTipDialog.setText
public void setText(String text) { // Only change if different if (!ValueUtils.areEqual(text, toolTip.getTipText())) { boolean wasVisible = isVisible(); if (wasVisible) { setVisible(false); } toolTip.setTipText(text); if (wasVisible) { setVisible(true); } } }
java
public void setText(String text) { // Only change if different if (!ValueUtils.areEqual(text, toolTip.getTipText())) { boolean wasVisible = isVisible(); if (wasVisible) { setVisible(false); } toolTip.setTipText(text); if (wasVisible) { setVisible(true); } } }
[ "public", "void", "setText", "(", "String", "text", ")", "{", "// Only change if different", "if", "(", "!", "ValueUtils", ".", "areEqual", "(", "text", ",", "toolTip", ".", "getTipText", "(", ")", ")", ")", "{", "boolean", "wasVisible", "=", "isVisible", ...
Sets the text to be displayed as a tooltip. @param text Text to be displayed
[ "Sets", "the", "text", "to", "be", "displayed", "as", "a", "tooltip", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/support/TransparentToolTipDialog.java#L359-L374
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.data_setCookie
public boolean data_setCookie(Integer userId, CharSequence cookieName, CharSequence cookieValue, Long expiresTimestamp, CharSequence path) throws FacebookException, IOException { if (null == userId || 0 >= userId) throw new IllegalArgumentException("userId should be provided."); if (null == cookieName || null == cookieValue) throw new IllegalArgumentException("cookieName and cookieValue should be provided."); ArrayList<Pair<String, CharSequence>> params = new ArrayList<Pair<String, CharSequence>>(FacebookMethod.DATA_GET_COOKIES.numParams()); params.add(new Pair<String, CharSequence>("uid", userId.toString())); params.add(new Pair<String, CharSequence>("name", cookieName)); params.add(new Pair<String, CharSequence>("value", cookieValue)); if (null != expiresTimestamp && expiresTimestamp >= 0L) params.add(new Pair<String, CharSequence>("expires", expiresTimestamp.toString())); if (null != path) params.add(new Pair<String, CharSequence>("path", path)); return extractBoolean(this.callMethod(FacebookMethod.DATA_GET_COOKIES, params)); }
java
public boolean data_setCookie(Integer userId, CharSequence cookieName, CharSequence cookieValue, Long expiresTimestamp, CharSequence path) throws FacebookException, IOException { if (null == userId || 0 >= userId) throw new IllegalArgumentException("userId should be provided."); if (null == cookieName || null == cookieValue) throw new IllegalArgumentException("cookieName and cookieValue should be provided."); ArrayList<Pair<String, CharSequence>> params = new ArrayList<Pair<String, CharSequence>>(FacebookMethod.DATA_GET_COOKIES.numParams()); params.add(new Pair<String, CharSequence>("uid", userId.toString())); params.add(new Pair<String, CharSequence>("name", cookieName)); params.add(new Pair<String, CharSequence>("value", cookieValue)); if (null != expiresTimestamp && expiresTimestamp >= 0L) params.add(new Pair<String, CharSequence>("expires", expiresTimestamp.toString())); if (null != path) params.add(new Pair<String, CharSequence>("path", path)); return extractBoolean(this.callMethod(FacebookMethod.DATA_GET_COOKIES, params)); }
[ "public", "boolean", "data_setCookie", "(", "Integer", "userId", ",", "CharSequence", "cookieName", ",", "CharSequence", "cookieValue", ",", "Long", "expiresTimestamp", ",", "CharSequence", "path", ")", "throws", "FacebookException", ",", "IOException", "{", "if", "...
Sets a cookie for a given user and application. @param userId The user for whom this cookie needs to be set @param cookieName Name of the cookie. @param cookieValue Value of the cookie. @param expiresTimestamp Time stamp when the cookie should expire. If not specified, the cookie never expires. @return true if cookie was successfully set, false otherwise @see <a href="http://wiki.developers.facebook.com/index.php/Data.getCookies"> Developers Wiki: Data.setCookie</a> @see <a href="http://wiki.developers.facebook.com/index.php/Cookies"> Developers Wiki: Cookies</a>
[ "Sets", "a", "cookie", "for", "a", "given", "user", "and", "application", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2369-L2388
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.updateContextDates
private void updateContextDates(CmsDbContext dbc, CmsResource resource) { CmsFlexRequestContextInfo info = dbc.getFlexRequestContextInfo(); if (info != null) { info.updateFromResource(resource); } }
java
private void updateContextDates(CmsDbContext dbc, CmsResource resource) { CmsFlexRequestContextInfo info = dbc.getFlexRequestContextInfo(); if (info != null) { info.updateFromResource(resource); } }
[ "private", "void", "updateContextDates", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ")", "{", "CmsFlexRequestContextInfo", "info", "=", "dbc", ".", "getFlexRequestContextInfo", "(", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "info", ...
Updates the current users context dates with the given resource.<p> This checks the date information of the resource based on {@link CmsResource#getDateLastModified()} as well as {@link CmsResource#getDateReleased()} and {@link CmsResource#getDateExpired()}. The current users request context is updated with the the "latest" dates found.<p> This is required in order to ensure proper setting of <code>"last-modified"</code> http headers and also for expiration of cached elements in the Flex cache. Consider the following use case: Page A is generated from resources x, y and z. If either x, y or z has an expiration / release date set, then page A must expire at a certain point in time. This is ensured by the context date check here.<p> @param dbc the current database context @param resource the resource to get the date information from
[ "Updates", "the", "current", "users", "context", "dates", "with", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L11882-L11888
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java
FieldScopeUtil.fieldNumbersFunction
static Function<Optional<Descriptor>, String> fieldNumbersFunction( final String fmt, final Iterable<Integer> fieldNumbers) { return new Function<Optional<Descriptor>, String>() { @Override public String apply(Optional<Descriptor> optDescriptor) { return resolveFieldNumbers(optDescriptor, fmt, fieldNumbers); } }; }
java
static Function<Optional<Descriptor>, String> fieldNumbersFunction( final String fmt, final Iterable<Integer> fieldNumbers) { return new Function<Optional<Descriptor>, String>() { @Override public String apply(Optional<Descriptor> optDescriptor) { return resolveFieldNumbers(optDescriptor, fmt, fieldNumbers); } }; }
[ "static", "Function", "<", "Optional", "<", "Descriptor", ">", ",", "String", ">", "fieldNumbersFunction", "(", "final", "String", "fmt", ",", "final", "Iterable", "<", "Integer", ">", "fieldNumbers", ")", "{", "return", "new", "Function", "<", "Optional", "...
Returns a function which translates integer field numbers into field names using the Descriptor if available. @param fmt Format string that must contain exactly one '%s' and no other format parameters.
[ "Returns", "a", "function", "which", "translates", "integer", "field", "numbers", "into", "field", "names", "using", "the", "Descriptor", "if", "available", "." ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/FieldScopeUtil.java#L36-L44
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java
CalendarAstronomer.trueAnomaly
private double trueAnomaly(double meanAnomaly, double eccentricity) { // First, solve Kepler's equation iteratively // Duffett-Smith, p.90 double delta; double E = meanAnomaly; do { delta = E - eccentricity * Math.sin(E) - meanAnomaly; E = E - delta / (1 - eccentricity * Math.cos(E)); } while (Math.abs(delta) > 1e-5); // epsilon = 1e-5 rad return 2.0 * Math.atan( Math.tan(E/2) * Math.sqrt( (1+eccentricity) /(1-eccentricity) ) ); }
java
private double trueAnomaly(double meanAnomaly, double eccentricity) { // First, solve Kepler's equation iteratively // Duffett-Smith, p.90 double delta; double E = meanAnomaly; do { delta = E - eccentricity * Math.sin(E) - meanAnomaly; E = E - delta / (1 - eccentricity * Math.cos(E)); } while (Math.abs(delta) > 1e-5); // epsilon = 1e-5 rad return 2.0 * Math.atan( Math.tan(E/2) * Math.sqrt( (1+eccentricity) /(1-eccentricity) ) ); }
[ "private", "double", "trueAnomaly", "(", "double", "meanAnomaly", ",", "double", "eccentricity", ")", "{", "// First, solve Kepler's equation iteratively", "// Duffett-Smith, p.90", "double", "delta", ";", "double", "E", "=", "meanAnomaly", ";", "do", "{", "delta", "=...
Find the "true anomaly" (longitude) of an object from its mean anomaly and the eccentricity of its orbit. This uses an iterative solution to Kepler's equation. @param meanAnomaly The object's longitude calculated as if it were in a regular, circular orbit, measured in radians from the point of perigee. @param eccentricity The eccentricity of the orbit @return The true anomaly (longitude) measured in radians
[ "Find", "the", "true", "anomaly", "(", "longitude", ")", "of", "an", "object", "from", "its", "mean", "anomaly", "and", "the", "eccentricity", "of", "its", "orbit", ".", "This", "uses", "an", "iterative", "solution", "to", "Kepler", "s", "equation", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarAstronomer.java#L1369-L1383
johnkil/Android-RobotoTextView
robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java
RobotoTypefaces.setUpTypeface
public static void setUpTypeface(@NonNull TextView textView, @NonNull Context context, @Nullable AttributeSet attrs) { Typeface typeface; if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RobotoTextView); try { typeface = obtainTypeface(context, a); } finally { a.recycle(); } } else { typeface = obtainTypeface(context, TYPEFACE_ROBOTO_REGULAR); } setUpTypeface(textView, typeface); }
java
public static void setUpTypeface(@NonNull TextView textView, @NonNull Context context, @Nullable AttributeSet attrs) { Typeface typeface; if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RobotoTextView); try { typeface = obtainTypeface(context, a); } finally { a.recycle(); } } else { typeface = obtainTypeface(context, TYPEFACE_ROBOTO_REGULAR); } setUpTypeface(textView, typeface); }
[ "public", "static", "void", "setUpTypeface", "(", "@", "NonNull", "TextView", "textView", ",", "@", "NonNull", "Context", "context", ",", "@", "Nullable", "AttributeSet", "attrs", ")", "{", "Typeface", "typeface", ";", "if", "(", "attrs", "!=", "null", ")", ...
Set up typeface for TextView from the attributes. @param textView The roboto text view @param context The context the widget is running in, through which it can access the current theme, resources, etc. @param attrs The attributes of the XML tag that is inflating the widget.
[ "Set", "up", "typeface", "for", "TextView", "from", "the", "attributes", "." ]
train
https://github.com/johnkil/Android-RobotoTextView/blob/1341602f16c08057dddd193411e7dab96f963b77/robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java#L504-L517
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java
URLMatchingUtils.getLongestUrlPattern
public static String getLongestUrlPattern(String firstUrlPattern, String secondUrlPattern) { if (secondUrlPattern == null || (firstUrlPattern != null && firstUrlPattern.length() >= secondUrlPattern.length())) { return firstUrlPattern; } else { return secondUrlPattern; } }
java
public static String getLongestUrlPattern(String firstUrlPattern, String secondUrlPattern) { if (secondUrlPattern == null || (firstUrlPattern != null && firstUrlPattern.length() >= secondUrlPattern.length())) { return firstUrlPattern; } else { return secondUrlPattern; } }
[ "public", "static", "String", "getLongestUrlPattern", "(", "String", "firstUrlPattern", ",", "String", "secondUrlPattern", ")", "{", "if", "(", "secondUrlPattern", "==", "null", "||", "(", "firstUrlPattern", "!=", "null", "&&", "firstUrlPattern", ".", "length", "(...
Determine the longest URL pattern. @param firstUrlPattern @param secondUrlPattern @return the longest url pattern
[ "Determine", "the", "longest", "URL", "pattern", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java#L27-L34
junit-team/junit4
src/main/java/junit/framework/Assert.java
Assert.assertEquals
static public void assertEquals(String message, int expected, int actual) { assertEquals(message, Integer.valueOf(expected), Integer.valueOf(actual)); }
java
static public void assertEquals(String message, int expected, int actual) { assertEquals(message, Integer.valueOf(expected), Integer.valueOf(actual)); }
[ "static", "public", "void", "assertEquals", "(", "String", "message", ",", "int", "expected", ",", "int", "actual", ")", "{", "assertEquals", "(", "message", ",", "Integer", ".", "valueOf", "(", "expected", ")", ",", "Integer", ".", "valueOf", "(", "actual...
Asserts that two ints are equal. If they are not an AssertionFailedError is thrown with the given message.
[ "Asserts", "that", "two", "ints", "are", "equal", ".", "If", "they", "are", "not", "an", "AssertionFailedError", "is", "thrown", "with", "the", "given", "message", "." ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/junit/framework/Assert.java#L233-L235
restfb/restfb
src/main/java/com/restfb/util/UrlUtils.java
UrlUtils.urlDecode
public static String urlDecode(String string) { if (string == null) { return null; } try { return decode(string, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Platform doesn't support " + StandardCharsets.UTF_8.name(), e); } }
java
public static String urlDecode(String string) { if (string == null) { return null; } try { return decode(string, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Platform doesn't support " + StandardCharsets.UTF_8.name(), e); } }
[ "public", "static", "String", "urlDecode", "(", "String", "string", ")", "{", "if", "(", "string", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "return", "decode", "(", "string", ",", "StandardCharsets", ".", "UTF_8", ".", "name", "(...
URL-decodes a string. <p> Assumes {@code string} is in {@link StandardCharsets#UTF_8} format. @param string The string to URL-decode. @return The URL-decoded version of the input string, or {@code null} if {@code string} is {@code null}. @throws IllegalStateException If unable to URL-decode because the JVM doesn't support {@link StandardCharsets#UTF_8}. @since 1.6.5
[ "URL", "-", "decodes", "a", "string", ".", "<p", ">", "Assumes", "{", "@code", "string", "}", "is", "in", "{", "@link", "StandardCharsets#UTF_8", "}", "format", "." ]
train
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/UrlUtils.java#L83-L92
grpc/grpc-java
netty/src/main/java/io/grpc/netty/GrpcSslContexts.java
GrpcSslContexts.forServer
public static SslContextBuilder forServer( InputStream keyCertChain, InputStream key, String keyPassword) { return configure(SslContextBuilder.forServer(keyCertChain, key, keyPassword)); }
java
public static SslContextBuilder forServer( InputStream keyCertChain, InputStream key, String keyPassword) { return configure(SslContextBuilder.forServer(keyCertChain, key, keyPassword)); }
[ "public", "static", "SslContextBuilder", "forServer", "(", "InputStream", "keyCertChain", ",", "InputStream", "key", ",", "String", "keyPassword", ")", "{", "return", "configure", "(", "SslContextBuilder", ".", "forServer", "(", "keyCertChain", ",", "key", ",", "k...
Creates a SslContextBuilder with ciphers and APN appropriate for gRPC. @see SslContextBuilder#forServer(InputStream, InputStream, String) @see #configure(SslContextBuilder)
[ "Creates", "a", "SslContextBuilder", "with", "ciphers", "and", "APN", "appropriate", "for", "gRPC", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/GrpcSslContexts.java#L160-L163
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_arp_ipBlocked_GET
public OvhArpBlockedIp ip_arp_ipBlocked_GET(String ip, String ipBlocked) throws IOException { String qPath = "/ip/{ip}/arp/{ipBlocked}"; StringBuilder sb = path(qPath, ip, ipBlocked); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhArpBlockedIp.class); }
java
public OvhArpBlockedIp ip_arp_ipBlocked_GET(String ip, String ipBlocked) throws IOException { String qPath = "/ip/{ip}/arp/{ipBlocked}"; StringBuilder sb = path(qPath, ip, ipBlocked); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhArpBlockedIp.class); }
[ "public", "OvhArpBlockedIp", "ip_arp_ipBlocked_GET", "(", "String", "ip", ",", "String", "ipBlocked", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/arp/{ipBlocked}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ",", ...
Get this object properties REST: GET /ip/{ip}/arp/{ipBlocked} @param ip [required] @param ipBlocked [required] your IP
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L272-L277
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java
CoverageDataCore.getValue
public Double getValue(GriddedTile griddedTile, float pixelValue) { Double value = null; if (!isDataNull(pixelValue)) { value = pixelValueToValue(griddedTile, new Double(pixelValue)); } return value; }
java
public Double getValue(GriddedTile griddedTile, float pixelValue) { Double value = null; if (!isDataNull(pixelValue)) { value = pixelValueToValue(griddedTile, new Double(pixelValue)); } return value; }
[ "public", "Double", "getValue", "(", "GriddedTile", "griddedTile", ",", "float", "pixelValue", ")", "{", "Double", "value", "=", "null", ";", "if", "(", "!", "isDataNull", "(", "pixelValue", ")", ")", "{", "value", "=", "pixelValueToValue", "(", "griddedTile...
Get the coverage data value for the pixel value @param griddedTile gridded tile @param pixelValue pixel value @return coverage data value
[ "Get", "the", "coverage", "data", "value", "for", "the", "pixel", "value" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1630-L1638
apereo/cas
api/cas-server-core-api-configuration-model/src/main/java/org/apereo/cas/configuration/support/CasConfigurationJasyptCipherExecutor.java
CasConfigurationJasyptCipherExecutor.getJasyptParamFromEnv
private static String getJasyptParamFromEnv(final Environment environment, final JasyptEncryptionParameters param) { return environment.getProperty(param.getPropertyName(), param.getDefaultValue()); }
java
private static String getJasyptParamFromEnv(final Environment environment, final JasyptEncryptionParameters param) { return environment.getProperty(param.getPropertyName(), param.getDefaultValue()); }
[ "private", "static", "String", "getJasyptParamFromEnv", "(", "final", "Environment", "environment", ",", "final", "JasyptEncryptionParameters", "param", ")", "{", "return", "environment", ".", "getProperty", "(", "param", ".", "getPropertyName", "(", ")", ",", "para...
Gets jasypt param from env. @param environment the environment @param param the param @return the jasypt param from env
[ "Gets", "jasypt", "param", "from", "env", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/api/cas-server-core-api-configuration-model/src/main/java/org/apereo/cas/configuration/support/CasConfigurationJasyptCipherExecutor.java#L59-L61
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/index/OIndexMVRBTreeAbstract.java
OIndexMVRBTreeAbstract.getValuesBetween
public Collection<OIdentifiable> getValuesBetween(final Object iRangeFrom, final Object iRangeTo) { return getValuesBetween(iRangeFrom, true, iRangeTo, true); }
java
public Collection<OIdentifiable> getValuesBetween(final Object iRangeFrom, final Object iRangeTo) { return getValuesBetween(iRangeFrom, true, iRangeTo, true); }
[ "public", "Collection", "<", "OIdentifiable", ">", "getValuesBetween", "(", "final", "Object", "iRangeFrom", ",", "final", "Object", "iRangeTo", ")", "{", "return", "getValuesBetween", "(", "iRangeFrom", ",", "true", ",", "iRangeTo", ",", "true", ")", ";", "}"...
Returns a set of records with key between the range passed as parameter. Range bounds are included. <p/> In case of {@link com.orientechnologies.common.collection.OCompositeKey}s partial keys can be used as values boundaries. @param iRangeFrom Starting range @param iRangeTo Ending range @return a set of records with key between the range passed as parameter. Range bounds are included. @see com.orientechnologies.common.collection.OCompositeKey#compareTo(com.orientechnologies.common.collection.OCompositeKey) @see #getValuesBetween(Object, boolean, Object, boolean)
[ "Returns", "a", "set", "of", "records", "with", "key", "between", "the", "range", "passed", "as", "parameter", ".", "Range", "bounds", "are", "included", ".", "<p", "/", ">", "In", "case", "of", "{", "@link", "com", ".", "orientechnologies", ".", "common...
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/index/OIndexMVRBTreeAbstract.java#L273-L275
avarabyeu/restendpoint
src/main/java/com/github/avarabyeu/restendpoint/http/RestEndpoints.java
RestEndpoints.forInterface
public static <T> T forInterface(@Nonnull Class<T> clazz, RestEndpoint endpoint) { return Reflection.newProxy(clazz, new RestEndpointInvocationHandler(clazz, endpoint)); }
java
public static <T> T forInterface(@Nonnull Class<T> clazz, RestEndpoint endpoint) { return Reflection.newProxy(clazz, new RestEndpointInvocationHandler(clazz, endpoint)); }
[ "public", "static", "<", "T", ">", "T", "forInterface", "(", "@", "Nonnull", "Class", "<", "T", ">", "clazz", ",", "RestEndpoint", "endpoint", ")", "{", "return", "Reflection", ".", "newProxy", "(", "clazz", ",", "new", "RestEndpointInvocationHandler", "(", ...
Creates interface implementation (via proxy) of provided class using RestEndpoint as rest client <b>Only interfaces are supported!</b> @param clazz - interface to be proxied @param endpoint - RestEndpoint to be used as rest client @param <T> - Type of interface to be proxied @return interface implementation (e.g.) just proxy
[ "Creates", "interface", "implementation", "(", "via", "proxy", ")", "of", "provided", "class", "using", "RestEndpoint", "as", "rest", "client", "<b", ">", "Only", "interfaces", "are", "supported!<", "/", "b", ">" ]
train
https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/http/RestEndpoints.java#L93-L95
apache/groovy
src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java
FileSystemCompiler.commandLineCompileWithErrorHandling
public static void commandLineCompileWithErrorHandling(String[] args, boolean lookupUnnamedFiles) { try { commandLineCompile(args, lookupUnnamedFiles); } catch (Throwable e) { new ErrorReporter(e, displayStackTraceOnError).write(System.err); System.exit(1); } }
java
public static void commandLineCompileWithErrorHandling(String[] args, boolean lookupUnnamedFiles) { try { commandLineCompile(args, lookupUnnamedFiles); } catch (Throwable e) { new ErrorReporter(e, displayStackTraceOnError).write(System.err); System.exit(1); } }
[ "public", "static", "void", "commandLineCompileWithErrorHandling", "(", "String", "[", "]", "args", ",", "boolean", "lookupUnnamedFiles", ")", "{", "try", "{", "commandLineCompile", "(", "args", ",", "lookupUnnamedFiles", ")", ";", "}", "catch", "(", "Throwable", ...
Primary entry point for compiling from the command line (using the groovyc script). <p> If calling inside a process and you don't want the JVM to exit on an error call commandLineCompile(String[]), which this method simply wraps @param args command line arguments @param lookupUnnamedFiles do a lookup for .groovy files not part of the given list of files to compile
[ "Primary", "entry", "point", "for", "compiling", "from", "the", "command", "line", "(", "using", "the", "groovyc", "script", ")", ".", "<p", ">", "If", "calling", "inside", "a", "process", "and", "you", "don", "t", "want", "the", "JVM", "to", "exit", "...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java#L201-L208
oboehm/jfachwert
src/main/java/de/jfachwert/pruefung/LengthValidator.java
LengthValidator.verify
public static String verify(String value, int min, int max) { try { return validate(value, min, max); } catch (IllegalArgumentException ex) { throw new LocalizedIllegalArgumentException(ex); } }
java
public static String verify(String value, int min, int max) { try { return validate(value, min, max); } catch (IllegalArgumentException ex) { throw new LocalizedIllegalArgumentException(ex); } }
[ "public", "static", "String", "verify", "(", "String", "value", ",", "int", "min", ",", "int", "max", ")", "{", "try", "{", "return", "validate", "(", "value", ",", "min", ",", "max", ")", ";", "}", "catch", "(", "IllegalArgumentException", "ex", ")", ...
Verifziert die Laenge des uebergebenen Wertes. Im Gegensatz zur {@link #validate(String, int, int)}-Methode wird herbei eine {@link IllegalArgumentException} geworfen. @param value zu pruefender Wert @param min geforderte Minimal-Laenge @param max Maximal-Laenge @return der gepruefte Wert (zur evtl. Weiterverarbeitung)
[ "Verifziert", "die", "Laenge", "des", "uebergebenen", "Wertes", ".", "Im", "Gegensatz", "zur", "{", "@link", "#validate", "(", "String", "int", "int", ")", "}", "-", "Methode", "wird", "herbei", "eine", "{", "@link", "IllegalArgumentException", "}", "geworfen"...
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/pruefung/LengthValidator.java#L126-L132
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/denoise/wavelet/UtilDenoiseWavelet.java
UtilDenoiseWavelet.estimateNoiseStdDev
public static float estimateNoiseStdDev(GrayF32 subband , float storage[] ) { storage = subbandAbsVal(subband, storage ); int N = subband.width*subband.height; return QuickSelect.select(storage, N / 2, N)/0.6745f; }
java
public static float estimateNoiseStdDev(GrayF32 subband , float storage[] ) { storage = subbandAbsVal(subband, storage ); int N = subband.width*subband.height; return QuickSelect.select(storage, N / 2, N)/0.6745f; }
[ "public", "static", "float", "estimateNoiseStdDev", "(", "GrayF32", "subband", ",", "float", "storage", "[", "]", ")", "{", "storage", "=", "subbandAbsVal", "(", "subband", ",", "storage", ")", ";", "int", "N", "=", "subband", ".", "width", "*", "subband",...
<p> Robust median estimator of the noise standard deviation. Typically applied to the HH<sub>1</sub> subband. </p> <p> &sigma; = Median(|Y<sub>ij</sub>|)/0.6745<br> where &sigma; is the estimated noise standard deviation, and Median(|Y<sub>ij</sub>|) is the median absolute value of all the pixels in the subband. </p> <p> D. L. Donoho and I. M. Johnstone, "Ideal spatial adaption via wavelet shrinkage." Biometrika, vol 81, pp. 425-455, 1994 </p> @param subband The subband the image is being computed from. Not modified. @param storage Used to temporarily store the absolute value of each element in the subband. @return estimated noise variance.
[ "<p", ">", "Robust", "median", "estimator", "of", "the", "noise", "standard", "deviation", ".", "Typically", "applied", "to", "the", "HH<sub", ">", "1<", "/", "sub", ">", "subband", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/denoise/wavelet/UtilDenoiseWavelet.java#L53-L59
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java
Resources.getString
public String getString( String key, Object arg1 ) { Object[] args = new Object[]{ arg1 }; return format( key, args ); }
java
public String getString( String key, Object arg1 ) { Object[] args = new Object[]{ arg1 }; return format( key, args ); }
[ "public", "String", "getString", "(", "String", "key", ",", "Object", "arg1", ")", "{", "Object", "[", "]", "args", "=", "new", "Object", "[", "]", "{", "arg1", "}", ";", "return", "format", "(", "key", ",", "args", ")", ";", "}" ]
Retrieve a string from resource bundle and format it with specified args. @param key the key for resource @param arg1 an arg @return the formatted string
[ "Retrieve", "a", "string", "from", "resource", "bundle", "and", "format", "it", "with", "specified", "args", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L697-L701
alkacon/opencms-core
src/org/opencms/xml/CmsXmlUtils.java
CmsXmlUtils.unmarshalHelper
public static Document unmarshalHelper(String xmlData, EntityResolver resolver) throws CmsXmlException { return CmsXmlUtils.unmarshalHelper(new InputSource(new StringReader(xmlData)), resolver); }
java
public static Document unmarshalHelper(String xmlData, EntityResolver resolver) throws CmsXmlException { return CmsXmlUtils.unmarshalHelper(new InputSource(new StringReader(xmlData)), resolver); }
[ "public", "static", "Document", "unmarshalHelper", "(", "String", "xmlData", ",", "EntityResolver", "resolver", ")", "throws", "CmsXmlException", "{", "return", "CmsXmlUtils", ".", "unmarshalHelper", "(", "new", "InputSource", "(", "new", "StringReader", "(", "xmlDa...
Helper to unmarshal (read) xml contents from a String into a document.<p> Using this method ensures that the OpenCms XML entitiy resolver is used.<p> @param xmlData the xml data in a String @param resolver the XML entity resolver to use @return the base object initialized with the unmarshalled XML document @throws CmsXmlException if something goes wrong @see CmsXmlUtils#unmarshalHelper(InputSource, EntityResolver)
[ "Helper", "to", "unmarshal", "(", "read", ")", "xml", "contents", "from", "a", "String", "into", "a", "document", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlUtils.java#L813-L816
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java
FormatUtil.formatTo
public static StringBuilder formatTo(StringBuilder buf, double[] d, String sep) { if(d == null) { return buf.append("null"); } if(d.length == 0) { return buf; } buf.append(d[0]); for(int i = 1; i < d.length; i++) { buf.append(sep).append(d[i]); } return buf; }
java
public static StringBuilder formatTo(StringBuilder buf, double[] d, String sep) { if(d == null) { return buf.append("null"); } if(d.length == 0) { return buf; } buf.append(d[0]); for(int i = 1; i < d.length; i++) { buf.append(sep).append(d[i]); } return buf; }
[ "public", "static", "StringBuilder", "formatTo", "(", "StringBuilder", "buf", ",", "double", "[", "]", "d", ",", "String", "sep", ")", "{", "if", "(", "d", "==", "null", ")", "{", "return", "buf", ".", "append", "(", "\"null\"", ")", ";", "}", "if", ...
Formats the double array d with the default number format. @param buf String builder to append to @param d the double array to be formatted @param sep separator between the single values of the array, e.g. ',' @return Output buffer buf
[ "Formats", "the", "double", "array", "d", "with", "the", "default", "number", "format", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java#L267-L279
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java
Authentication.validLogin
public boolean validLogin(String identifier, String password, String hash) { Objects.requireNonNull(identifier, Required.USERNAME.toString()); Objects.requireNonNull(password, Required.PASSWORD.toString()); Objects.requireNonNull(hash, Required.HASH.toString()); Cache cache = Application.getInstance(CacheProvider.class).getCache(CacheName.AUTH); boolean authenticated = false; if (!userHasLock(identifier) && CodecUtils.checkJBCrypt(password, hash)) { authenticated = true; } else { cache.increment(identifier); } return authenticated; }
java
public boolean validLogin(String identifier, String password, String hash) { Objects.requireNonNull(identifier, Required.USERNAME.toString()); Objects.requireNonNull(password, Required.PASSWORD.toString()); Objects.requireNonNull(hash, Required.HASH.toString()); Cache cache = Application.getInstance(CacheProvider.class).getCache(CacheName.AUTH); boolean authenticated = false; if (!userHasLock(identifier) && CodecUtils.checkJBCrypt(password, hash)) { authenticated = true; } else { cache.increment(identifier); } return authenticated; }
[ "public", "boolean", "validLogin", "(", "String", "identifier", ",", "String", "password", ",", "String", "hash", ")", "{", "Objects", ".", "requireNonNull", "(", "identifier", ",", "Required", ".", "USERNAME", ".", "toString", "(", ")", ")", ";", "Objects",...
Creates a hashed value of a given clear text password and checks if the value matches a given, already hashed password @param identifier The identifier to authenticate @param password The clear text password @param hash The previously hashed password to check @return True if the new hashed password matches the hash, false otherwise
[ "Creates", "a", "hashed", "value", "of", "a", "given", "clear", "text", "password", "and", "checks", "if", "the", "value", "matches", "a", "given", "already", "hashed", "password" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java#L109-L123
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/network/BranchRemoteInterface.java
BranchRemoteInterface.processEntityForJSON
private ServerResponse processEntityForJSON(String responseString, int statusCode, String tag) { ServerResponse result = new ServerResponse(tag, statusCode); PrefHelper.Debug("returned " + responseString); if (responseString != null) { try { JSONObject jsonObj = new JSONObject(responseString); result.setPost(jsonObj); } catch (JSONException ex) { try { JSONArray jsonArray = new JSONArray(responseString); result.setPost(jsonArray); } catch (JSONException ex2) { PrefHelper.Debug("JSON exception: " + ex2.getMessage()); } } } return result; }
java
private ServerResponse processEntityForJSON(String responseString, int statusCode, String tag) { ServerResponse result = new ServerResponse(tag, statusCode); PrefHelper.Debug("returned " + responseString); if (responseString != null) { try { JSONObject jsonObj = new JSONObject(responseString); result.setPost(jsonObj); } catch (JSONException ex) { try { JSONArray jsonArray = new JSONArray(responseString); result.setPost(jsonArray); } catch (JSONException ex2) { PrefHelper.Debug("JSON exception: " + ex2.getMessage()); } } } return result; }
[ "private", "ServerResponse", "processEntityForJSON", "(", "String", "responseString", ",", "int", "statusCode", ",", "String", "tag", ")", "{", "ServerResponse", "result", "=", "new", "ServerResponse", "(", "tag", ",", "statusCode", ")", ";", "PrefHelper", ".", ...
<p>Converts resultant output object from Branch Remote server into a {@link ServerResponse} object by reading the content supplied in the raw server response, and creating a {@link JSONObject} that contains the same data. This data is then attached as the post data of the {@link ServerResponse} object returned.</p> @param responseString Branch server response received. A string form of the input or error stream payload @param statusCode An {@link Integer} value containing the HTTP response code. @param tag A {@link String} value containing the tag value to be applied to the resultant {@link ServerResponse} object. @return A {@link ServerResponse} object representing the resultant output object from Branch Remote server response in Branch SDK terms. see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP/1.1: Status Codes</a>
[ "<p", ">", "Converts", "resultant", "output", "object", "from", "Branch", "Remote", "server", "into", "a", "{", "@link", "ServerResponse", "}", "object", "by", "reading", "the", "content", "supplied", "in", "the", "raw", "server", "response", "and", "creating"...
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/network/BranchRemoteInterface.java#L181-L199
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/DBObject.java
DBObject.addFieldValues
public void addFieldValues(String fieldName, Collection<String> values) { Utils.require(!Utils.isEmpty(fieldName), "fieldName"); if (values != null && values.size() > 0) { if (fieldName.charAt(0) == '_') { Utils.require(values.size() == 1, "System fields can have only 1 value: " + fieldName); setSystemField(fieldName, values.iterator().next()); } else { List<String> currValues = m_valueMap.get(fieldName); if (currValues == null) { currValues = new ArrayList<>(); m_valueMap.put(fieldName, currValues); } currValues.addAll(values); } } }
java
public void addFieldValues(String fieldName, Collection<String> values) { Utils.require(!Utils.isEmpty(fieldName), "fieldName"); if (values != null && values.size() > 0) { if (fieldName.charAt(0) == '_') { Utils.require(values.size() == 1, "System fields can have only 1 value: " + fieldName); setSystemField(fieldName, values.iterator().next()); } else { List<String> currValues = m_valueMap.get(fieldName); if (currValues == null) { currValues = new ArrayList<>(); m_valueMap.put(fieldName, currValues); } currValues.addAll(values); } } }
[ "public", "void", "addFieldValues", "(", "String", "fieldName", ",", "Collection", "<", "String", ">", "values", ")", "{", "Utils", ".", "require", "(", "!", "Utils", ".", "isEmpty", "(", "fieldName", ")", ",", "\"fieldName\"", ")", ";", "if", "(", "valu...
Add the value(s) in the given collection to the field with the given name. If the given collection is null or empty, this method is a no-op. @param fieldName Name of field. @param values Collection of values. Ignored if null or empty.
[ "Add", "the", "value", "(", "s", ")", "in", "the", "given", "collection", "to", "the", "field", "with", "the", "given", "name", ".", "If", "the", "given", "collection", "is", "null", "or", "empty", "this", "method", "is", "a", "no", "-", "op", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/DBObject.java#L377-L393
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java
MaxSAT.addSoftClause
public void addSoftClause(int weight, final LNGIntVector lits) { final LNGIntVector rVars = new LNGIntVector(); this.softClauses.push(new MSSoftClause(lits, weight, LIT_UNDEF, rVars)); this.nbSoft++; }
java
public void addSoftClause(int weight, final LNGIntVector lits) { final LNGIntVector rVars = new LNGIntVector(); this.softClauses.push(new MSSoftClause(lits, weight, LIT_UNDEF, rVars)); this.nbSoft++; }
[ "public", "void", "addSoftClause", "(", "int", "weight", ",", "final", "LNGIntVector", "lits", ")", "{", "final", "LNGIntVector", "rVars", "=", "new", "LNGIntVector", "(", ")", ";", "this", ".", "softClauses", ".", "push", "(", "new", "MSSoftClause", "(", ...
Adds a new soft clause to the soft clause database. @param weight the weight of the soft clause @param lits the literals of the soft clause
[ "Adds", "a", "new", "soft", "clause", "to", "the", "soft", "clause", "database", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java#L247-L251
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/category/IssueCategoryRegistry.java
IssueCategoryRegistry.loadFromGraph
public static IssueCategoryModel loadFromGraph(GraphContext graphContext, String issueCategoryID) { return loadFromGraph(graphContext.getFramed(), issueCategoryID); }
java
public static IssueCategoryModel loadFromGraph(GraphContext graphContext, String issueCategoryID) { return loadFromGraph(graphContext.getFramed(), issueCategoryID); }
[ "public", "static", "IssueCategoryModel", "loadFromGraph", "(", "GraphContext", "graphContext", ",", "String", "issueCategoryID", ")", "{", "return", "loadFromGraph", "(", "graphContext", ".", "getFramed", "(", ")", ",", "issueCategoryID", ")", ";", "}" ]
Loads the related graph vertex for the given {@link IssueCategory#getCategoryID()}.
[ "Loads", "the", "related", "graph", "vertex", "for", "the", "given", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/category/IssueCategoryRegistry.java#L81-L84
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.intersectRayLineSegment
public static float intersectRayLineSegment(Vector2fc origin, Vector2fc dir, Vector2fc a, Vector2fc b) { return intersectRayLineSegment(origin.x(), origin.y(), dir.x(), dir.y(), a.x(), a.y(), b.x(), b.y()); }
java
public static float intersectRayLineSegment(Vector2fc origin, Vector2fc dir, Vector2fc a, Vector2fc b) { return intersectRayLineSegment(origin.x(), origin.y(), dir.x(), dir.y(), a.x(), a.y(), b.x(), b.y()); }
[ "public", "static", "float", "intersectRayLineSegment", "(", "Vector2fc", "origin", ",", "Vector2fc", "dir", ",", "Vector2fc", "a", ",", "Vector2fc", "b", ")", "{", "return", "intersectRayLineSegment", "(", "origin", ".", "x", "(", ")", ",", "origin", ".", "...
Determine whether the ray with given <code>origin</code> and direction <code>dir</code> intersects the undirected line segment given by the two end points <code>a</code> and <code>b</code>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if any. <p> This method returns <code>-1.0</code> if the ray does not intersect the line segment. @see #intersectRayLineSegment(float, float, float, float, float, float, float, float) @param origin the ray's origin @param dir the ray's direction @param a the line segment's first end point @param b the line segment's second end point @return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if the ray intersects the line segment; <code>-1.0</code> otherwise
[ "Determine", "whether", "the", "ray", "with", "given", "<code", ">", "origin<", "/", "code", ">", "and", "direction", "<code", ">", "dir<", "/", "code", ">", "intersects", "the", "undirected", "line", "segment", "given", "by", "the", "two", "end", "points"...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L4015-L4017
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java
JavaScriptUtils.getUnencodedJavaScriptHtmlCookieString
public String getUnencodedJavaScriptHtmlCookieString(String name, String value) { return getUnencodedJavaScriptHtmlCookieString(name, value, null); }
java
public String getUnencodedJavaScriptHtmlCookieString(String name, String value) { return getUnencodedJavaScriptHtmlCookieString(name, value, null); }
[ "public", "String", "getUnencodedJavaScriptHtmlCookieString", "(", "String", "name", ",", "String", "value", ")", "{", "return", "getUnencodedJavaScriptHtmlCookieString", "(", "name", ",", "value", ",", "null", ")", ";", "}" ]
Creates and returns a JavaScript line that sets a cookie with the specified name, value, and cookie properties. For example, a cookie name of "test", value of "123", and properties "HttpOnly" and "path=/" would return {@code document.cookie="test=123; HttpOnly; path=/;";}. Note: The specified name and value will not be HTML-encoded.
[ "Creates", "and", "returns", "a", "JavaScript", "line", "that", "sets", "a", "cookie", "with", "the", "specified", "name", "value", "and", "cookie", "properties", ".", "For", "example", "a", "cookie", "name", "of", "test", "value", "of", "123", "and", "pro...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L57-L59
networknt/light-4j
service/src/main/java/com/networknt/service/SingletonServiceFactory.java
SingletonServiceFactory.handleSingletonList
private static void handleSingletonList(String key, List<Object> value) throws Exception { List<String> interfaceClasses = new ArrayList(); if(key.contains(",")) { String[] interfaces = key.split(","); interfaceClasses.addAll(Arrays.asList(interfaces)); } else { interfaceClasses.add(key); } // the value can be a list of implementation class names or a map. if(value != null && value.size() == 1) { handleSingleImpl(interfaceClasses, value); } else { handleMultipleImpl(interfaceClasses, value); } }
java
private static void handleSingletonList(String key, List<Object> value) throws Exception { List<String> interfaceClasses = new ArrayList(); if(key.contains(",")) { String[] interfaces = key.split(","); interfaceClasses.addAll(Arrays.asList(interfaces)); } else { interfaceClasses.add(key); } // the value can be a list of implementation class names or a map. if(value != null && value.size() == 1) { handleSingleImpl(interfaceClasses, value); } else { handleMultipleImpl(interfaceClasses, value); } }
[ "private", "static", "void", "handleSingletonList", "(", "String", "key", ",", "List", "<", "Object", ">", "value", ")", "throws", "Exception", "{", "List", "<", "String", ">", "interfaceClasses", "=", "new", "ArrayList", "(", ")", ";", "if", "(", "key", ...
For each singleton definition, create object for the interface with the implementation class, and push it into the service map with key and implemented object. @param key String interface or multiple interface separated by "," @param value List of implementations of interface(s) defined in the key @throws Exception exception thrown from the object creation
[ "For", "each", "singleton", "definition", "create", "object", "for", "the", "interface", "with", "the", "implementation", "class", "and", "push", "it", "into", "the", "service", "map", "with", "key", "and", "implemented", "object", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L210-L225
hal/core
gui/src/main/java/org/jboss/as/console/client/tools/ModelBrowserView.java
ModelBrowserView.updateRootTypes
public void updateRootTypes(ModelNode address, List<ModelNode> modelNodes) { deck.showWidget(CHILD_VIEW); tree.clear(); descView.clearDisplay(); formView.clearDisplay(); offsetDisplay.clear(); // IMPORTANT: when pin down is active, we need to consider the offset to calculate the real address addressOffset = address; nodeHeader.updateDescription(address); List<Property> offset = addressOffset.asPropertyList(); if(offset.size()>0) { String parentName = offset.get(offset.size() - 1).getName(); HTML parentTag = new HTML("<div class='gwt-ToggleButton gwt-ToggleButton-down' title='Remove Filter'>&nbsp;" + parentName + "&nbsp;<i class='icon-remove'></i></div>"); parentTag.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onPinTreeSelection(null); } }); offsetDisplay.add(parentTag); } TreeItem rootItem = null; String rootTitle = null; String key = null; if(address.asList().isEmpty()) { rootTitle = DEFAULT_ROOT; key = DEFAULT_ROOT; } else { List<ModelNode> tuples = address.asList(); rootTitle = tuples.get(tuples.size() - 1).asProperty().getValue().asString(); key = rootTitle; } SafeHtmlBuilder html = new SafeHtmlBuilder().appendEscaped(rootTitle); rootItem = new ModelTreeItem(html.toSafeHtml(), key, address, false); tree.addItem(rootItem); deck.showWidget(RESOURCE_VIEW); rootItem.setSelected(true); currentRootKey = key; addChildrenTypes((ModelTreeItem)rootItem, modelNodes); }
java
public void updateRootTypes(ModelNode address, List<ModelNode> modelNodes) { deck.showWidget(CHILD_VIEW); tree.clear(); descView.clearDisplay(); formView.clearDisplay(); offsetDisplay.clear(); // IMPORTANT: when pin down is active, we need to consider the offset to calculate the real address addressOffset = address; nodeHeader.updateDescription(address); List<Property> offset = addressOffset.asPropertyList(); if(offset.size()>0) { String parentName = offset.get(offset.size() - 1).getName(); HTML parentTag = new HTML("<div class='gwt-ToggleButton gwt-ToggleButton-down' title='Remove Filter'>&nbsp;" + parentName + "&nbsp;<i class='icon-remove'></i></div>"); parentTag.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onPinTreeSelection(null); } }); offsetDisplay.add(parentTag); } TreeItem rootItem = null; String rootTitle = null; String key = null; if(address.asList().isEmpty()) { rootTitle = DEFAULT_ROOT; key = DEFAULT_ROOT; } else { List<ModelNode> tuples = address.asList(); rootTitle = tuples.get(tuples.size() - 1).asProperty().getValue().asString(); key = rootTitle; } SafeHtmlBuilder html = new SafeHtmlBuilder().appendEscaped(rootTitle); rootItem = new ModelTreeItem(html.toSafeHtml(), key, address, false); tree.addItem(rootItem); deck.showWidget(RESOURCE_VIEW); rootItem.setSelected(true); currentRootKey = key; addChildrenTypes((ModelTreeItem)rootItem, modelNodes); }
[ "public", "void", "updateRootTypes", "(", "ModelNode", "address", ",", "List", "<", "ModelNode", ">", "modelNodes", ")", "{", "deck", ".", "showWidget", "(", "CHILD_VIEW", ")", ";", "tree", ".", "clear", "(", ")", ";", "descView", ".", "clearDisplay", "(",...
Update root node. Basicaly a refresh of the tree. @param address @param modelNodes
[ "Update", "root", "node", ".", "Basicaly", "a", "refresh", "of", "the", "tree", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/tools/ModelBrowserView.java#L411-L463
apereo/cas
support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/authentication/principal/WsFederationCredential.java
WsFederationCredential.isValid
public boolean isValid(final String expectedAudience, final String expectedIssuer, final long timeDrift) { if (!this.audience.equalsIgnoreCase(expectedAudience)) { LOGGER.warn("Audience [{}] is invalid where the expected audience should be [{}]", this.audience, expectedAudience); return false; } if (!this.issuer.equalsIgnoreCase(expectedIssuer)) { LOGGER.warn("Issuer [{}] is invalid since the expected issuer should be [{}]", this.issuer, expectedIssuer); return false; } val retrievedOnTimeDrift = this.getRetrievedOn().minus(timeDrift, ChronoUnit.MILLIS); if (this.issuedOn.isBefore(retrievedOnTimeDrift)) { LOGGER.warn("Ticket is issued before the allowed drift. Issued on [{}] while allowed drift is [{}]", this.issuedOn, retrievedOnTimeDrift); return false; } val retrievedOnTimeAfterDrift = this.retrievedOn.plus(timeDrift, ChronoUnit.MILLIS); if (this.issuedOn.isAfter(retrievedOnTimeAfterDrift)) { LOGGER.warn("Ticket is issued after the allowed drift. Issued on [{}] while allowed drift is [{}]", this.issuedOn, retrievedOnTimeAfterDrift); return false; } if (this.retrievedOn.isAfter(this.notOnOrAfter)) { LOGGER.warn("Ticket is too late because it's retrieved on [{}] which is after [{}].", this.retrievedOn, this.notOnOrAfter); return false; } LOGGER.debug("WsFed Credential is validated for [{}] and [{}].", expectedAudience, expectedIssuer); return true; }
java
public boolean isValid(final String expectedAudience, final String expectedIssuer, final long timeDrift) { if (!this.audience.equalsIgnoreCase(expectedAudience)) { LOGGER.warn("Audience [{}] is invalid where the expected audience should be [{}]", this.audience, expectedAudience); return false; } if (!this.issuer.equalsIgnoreCase(expectedIssuer)) { LOGGER.warn("Issuer [{}] is invalid since the expected issuer should be [{}]", this.issuer, expectedIssuer); return false; } val retrievedOnTimeDrift = this.getRetrievedOn().minus(timeDrift, ChronoUnit.MILLIS); if (this.issuedOn.isBefore(retrievedOnTimeDrift)) { LOGGER.warn("Ticket is issued before the allowed drift. Issued on [{}] while allowed drift is [{}]", this.issuedOn, retrievedOnTimeDrift); return false; } val retrievedOnTimeAfterDrift = this.retrievedOn.plus(timeDrift, ChronoUnit.MILLIS); if (this.issuedOn.isAfter(retrievedOnTimeAfterDrift)) { LOGGER.warn("Ticket is issued after the allowed drift. Issued on [{}] while allowed drift is [{}]", this.issuedOn, retrievedOnTimeAfterDrift); return false; } if (this.retrievedOn.isAfter(this.notOnOrAfter)) { LOGGER.warn("Ticket is too late because it's retrieved on [{}] which is after [{}].", this.retrievedOn, this.notOnOrAfter); return false; } LOGGER.debug("WsFed Credential is validated for [{}] and [{}].", expectedAudience, expectedIssuer); return true; }
[ "public", "boolean", "isValid", "(", "final", "String", "expectedAudience", ",", "final", "String", "expectedIssuer", ",", "final", "long", "timeDrift", ")", "{", "if", "(", "!", "this", ".", "audience", ".", "equalsIgnoreCase", "(", "expectedAudience", ")", "...
isValid validates the credential. @param expectedAudience the audience that the token was issued to (CAS Server) @param expectedIssuer the issuer of the token (the IdP) @param timeDrift the amount of acceptable time drift @return true if the credentials are valid, otherwise false
[ "isValid", "validates", "the", "credential", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/authentication/principal/WsFederationCredential.java#L60-L85
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/sftp/SftpFsHelper.java
SftpFsHelper.getExecChannel
public ChannelExec getExecChannel(String command) throws SftpException { ChannelExec channelExec; try { channelExec = (ChannelExec) this.session.openChannel("exec"); channelExec.setCommand(command); channelExec.connect(); return channelExec; } catch (JSchException e) { throw new SftpException(0, "Cannot open a channel to SFTP server", e); } }
java
public ChannelExec getExecChannel(String command) throws SftpException { ChannelExec channelExec; try { channelExec = (ChannelExec) this.session.openChannel("exec"); channelExec.setCommand(command); channelExec.connect(); return channelExec; } catch (JSchException e) { throw new SftpException(0, "Cannot open a channel to SFTP server", e); } }
[ "public", "ChannelExec", "getExecChannel", "(", "String", "command", ")", "throws", "SftpException", "{", "ChannelExec", "channelExec", ";", "try", "{", "channelExec", "=", "(", "ChannelExec", ")", "this", ".", "session", ".", "openChannel", "(", "\"exec\"", ")"...
Create a new sftp channel to execute commands. @param command to execute on the remote machine @return a new execution channel @throws SftpException if a channel could not be opened
[ "Create", "a", "new", "sftp", "channel", "to", "execute", "commands", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/sftp/SftpFsHelper.java#L116-L126
craterdog/java-security-framework
java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java
MessageCryptex.encryptString
public final byte[] encryptString(SecretKey sharedKey, String string) { logger.entry(); try (ByteArrayInputStream input = new ByteArrayInputStream(string.getBytes("UTF-8")); ByteArrayOutputStream output = new ByteArrayOutputStream()) { encryptStream(sharedKey, input, output); output.flush(); byte[] encryptedString = output.toByteArray(); logger.exit(); return encryptedString; } catch (IOException e) { // should never happen! RuntimeException exception = new RuntimeException("An unexpected exception occured while trying to encrypt a string.", e); logger.error(exception.toString()); throw exception; } }
java
public final byte[] encryptString(SecretKey sharedKey, String string) { logger.entry(); try (ByteArrayInputStream input = new ByteArrayInputStream(string.getBytes("UTF-8")); ByteArrayOutputStream output = new ByteArrayOutputStream()) { encryptStream(sharedKey, input, output); output.flush(); byte[] encryptedString = output.toByteArray(); logger.exit(); return encryptedString; } catch (IOException e) { // should never happen! RuntimeException exception = new RuntimeException("An unexpected exception occured while trying to encrypt a string.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "byte", "[", "]", "encryptString", "(", "SecretKey", "sharedKey", ",", "String", "string", ")", "{", "logger", ".", "entry", "(", ")", ";", "try", "(", "ByteArrayInputStream", "input", "=", "new", "ByteArrayInputStream", "(", "string", "."...
This method encrypts a string using a shared key. @param sharedKey The shared key used for the encryption. @param string The string to be encrypted. @return The encrypted string.
[ "This", "method", "encrypts", "a", "string", "using", "a", "shared", "key", "." ]
train
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L145-L160
gocd/gocd
base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java
DirectoryScanner.isMorePowerfulThanExcludes
private boolean isMorePowerfulThanExcludes(String name, String includepattern) { String soughtexclude = name + File.separator + "**"; for (int counter = 0; counter < excludes.length; counter++) { if (excludes[counter].equals(soughtexclude)) { return false; } } return true; }
java
private boolean isMorePowerfulThanExcludes(String name, String includepattern) { String soughtexclude = name + File.separator + "**"; for (int counter = 0; counter < excludes.length; counter++) { if (excludes[counter].equals(soughtexclude)) { return false; } } return true; }
[ "private", "boolean", "isMorePowerfulThanExcludes", "(", "String", "name", ",", "String", "includepattern", ")", "{", "String", "soughtexclude", "=", "name", "+", "File", ".", "separator", "+", "\"**\"", ";", "for", "(", "int", "counter", "=", "0", ";", "cou...
Find out whether one particular include pattern is more powerful than all the excludes. Note: the power comparison is based on the length of the include pattern and of the exclude patterns without the wildcards. Ideally the comparison should be done based on the depth of the match; that is to say how many file separators have been matched before the first ** or the end of the pattern. IMPORTANT : this function should return false "with care". @param name the relative path to test. @param includepattern one include pattern. @return true if there is no exclude pattern more powerful than this include pattern. @since Ant 1.6
[ "Find", "out", "whether", "one", "particular", "include", "pattern", "is", "more", "powerful", "than", "all", "the", "excludes", ".", "Note", ":", "the", "power", "comparison", "is", "based", "on", "the", "length", "of", "the", "include", "pattern", "and", ...
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L1241-L1249
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ServicesApi.java
ServicesApi.updateExternalWikiService
public ExternalWikiService updateExternalWikiService(Object projectIdOrPath, ExternalWikiService externalWiki) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("external_wiki_url", externalWiki.getExternalWikiUrl()); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "services", "external-wiki"); return (response.readEntity(ExternalWikiService.class)); }
java
public ExternalWikiService updateExternalWikiService(Object projectIdOrPath, ExternalWikiService externalWiki) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("external_wiki_url", externalWiki.getExternalWikiUrl()); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "services", "external-wiki"); return (response.readEntity(ExternalWikiService.class)); }
[ "public", "ExternalWikiService", "updateExternalWikiService", "(", "Object", "projectIdOrPath", ",", "ExternalWikiService", "externalWiki", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(",...
Updates the ExternalWikiService service settings for a project. <pre><code>GitLab Endpoint: PUT /projects/:id/services/external-wiki</code></pre> The following properties on the JiraService instance are utilized in the update of the settings: <p> external_wiki_url (required) - The URL to the External Wiki project which is being linked to this GitLab project, e.g., http://www.wikidot.com/ @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param externalWiki the ExternalWikiService instance holding the settings @return a ExternalWikiService instance holding the newly updated settings @throws GitLabApiException if any exception occurs
[ "Updates", "the", "ExternalWikiService", "service", "settings", "for", "a", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ServicesApi.java#L345-L350
eclipse/xtext-core
org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java
XtextSemanticSequencer.sequence_ParameterReference
protected void sequence_ParameterReference(ISerializationContext context, ParameterReference semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getParameterReferenceAccess().getParameterParameterIDTerminalRuleCall_0_1(), semanticObject.eGet(XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER, false)); feeder.finish(); }
java
protected void sequence_ParameterReference(ISerializationContext context, ParameterReference semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getParameterReferenceAccess().getParameterParameterIDTerminalRuleCall_0_1(), semanticObject.eGet(XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER, false)); feeder.finish(); }
[ "protected", "void", "sequence_ParameterReference", "(", "ISerializationContext", "context", ",", "ParameterReference", "semanticObject", ")", "{", "if", "(", "errorAcceptor", "!=", "null", ")", "{", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanti...
Contexts: Disjunction returns ParameterReference Disjunction.Disjunction_1_0 returns ParameterReference Conjunction returns ParameterReference Conjunction.Conjunction_1_0 returns ParameterReference Negation returns ParameterReference Atom returns ParameterReference ParenthesizedCondition returns ParameterReference ParameterReference returns ParameterReference Constraint: parameter=[Parameter|ID]
[ "Contexts", ":", "Disjunction", "returns", "ParameterReference", "Disjunction", ".", "Disjunction_1_0", "returns", "ParameterReference", "Conjunction", "returns", "ParameterReference", "Conjunction", ".", "Conjunction_1_0", "returns", "ParameterReference", "Negation", "returns"...
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java#L979-L987
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java
MapperConstructorAccessor.searchXmlConfig
private ChooseConfig searchXmlConfig(ChooseConfig cc, XML xml){ if(isNull(xml.getXmlPath())) return null; if((isNull(cc)||cc == ChooseConfig.DESTINATION) && xml.isInheritedMapped(destination)) return ChooseConfig.DESTINATION; if((isNull(cc)||cc == ChooseConfig.SOURCE) && xml.isInheritedMapped(source)) return ChooseConfig.SOURCE; return null; }
java
private ChooseConfig searchXmlConfig(ChooseConfig cc, XML xml){ if(isNull(xml.getXmlPath())) return null; if((isNull(cc)||cc == ChooseConfig.DESTINATION) && xml.isInheritedMapped(destination)) return ChooseConfig.DESTINATION; if((isNull(cc)||cc == ChooseConfig.SOURCE) && xml.isInheritedMapped(source)) return ChooseConfig.SOURCE; return null; }
[ "private", "ChooseConfig", "searchXmlConfig", "(", "ChooseConfig", "cc", ",", "XML", "xml", ")", "{", "if", "(", "isNull", "(", "xml", ".", "getXmlPath", "(", ")", ")", ")", "return", "null", ";", "if", "(", "(", "isNull", "(", "cc", ")", "||", "cc",...
This method finds the xml configuration, returns null if there are no. @param cc Configuration to check @param xml xml object return ChooseConfig configuration found
[ "This", "method", "finds", "the", "xml", "configuration", "returns", "null", "if", "there", "are", "no", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java#L101-L112
alkacon/opencms-core
src/org/opencms/gwt/CmsBrokenLinkRenderer.java
CmsBrokenLinkRenderer.createBrokenLinkBean
protected CmsBrokenLinkBean createBrokenLinkBean( CmsUUID structureId, String type, String title, String path, String extraTitle, String extraPath) { CmsBrokenLinkBean result = new CmsBrokenLinkBean(structureId, title, path, type); addPageInfo(result, extraTitle, extraPath); return result; }
java
protected CmsBrokenLinkBean createBrokenLinkBean( CmsUUID structureId, String type, String title, String path, String extraTitle, String extraPath) { CmsBrokenLinkBean result = new CmsBrokenLinkBean(structureId, title, path, type); addPageInfo(result, extraTitle, extraPath); return result; }
[ "protected", "CmsBrokenLinkBean", "createBrokenLinkBean", "(", "CmsUUID", "structureId", ",", "String", "type", ",", "String", "title", ",", "String", "path", ",", "String", "extraTitle", ",", "String", "extraPath", ")", "{", "CmsBrokenLinkBean", "result", "=", "n...
Creates a broken link bean from the necessary values.<p> @param structureId the structure id of the resource @param type the resource type @param title the title @param path the path @param extraTitle an optional additional page title @param extraPath an optional additional page path @return the created broken link bean
[ "Creates", "a", "broken", "link", "bean", "from", "the", "necessary", "values", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsBrokenLinkRenderer.java#L249-L260
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/metadata/TableMetadataBuilder.java
TableMetadataBuilder.addIndex
@TimerJ public TableMetadataBuilder addIndex(IndexType indType, String indexName, String... fields) throws ExecutionException { IndexName indName = new IndexName(tableName.getName(), tableName.getName(), indexName); Map<ColumnName, ColumnMetadata> columnsMetadata = new HashMap<ColumnName, ColumnMetadata>(fields.length); // recover the columns from the table metadata for (String field : fields) { ColumnMetadata cMetadata = columns.get(new ColumnName(tableName, field)); if (cMetadata == null) { throw new ExecutionException("Trying to index a not existing column: " + field); } columnsMetadata.put(new ColumnName(tableName, field), cMetadata); } IndexMetadata indMetadata = new IndexMetadata(indName, columnsMetadata, indType, null); indexes.put(indName, indMetadata); return this; }
java
@TimerJ public TableMetadataBuilder addIndex(IndexType indType, String indexName, String... fields) throws ExecutionException { IndexName indName = new IndexName(tableName.getName(), tableName.getName(), indexName); Map<ColumnName, ColumnMetadata> columnsMetadata = new HashMap<ColumnName, ColumnMetadata>(fields.length); // recover the columns from the table metadata for (String field : fields) { ColumnMetadata cMetadata = columns.get(new ColumnName(tableName, field)); if (cMetadata == null) { throw new ExecutionException("Trying to index a not existing column: " + field); } columnsMetadata.put(new ColumnName(tableName, field), cMetadata); } IndexMetadata indMetadata = new IndexMetadata(indName, columnsMetadata, indType, null); indexes.put(indName, indMetadata); return this; }
[ "@", "TimerJ", "public", "TableMetadataBuilder", "addIndex", "(", "IndexType", "indType", ",", "String", "indexName", ",", "String", "...", "fields", ")", "throws", "ExecutionException", "{", "IndexName", "indName", "=", "new", "IndexName", "(", "tableName", ".", ...
Add an index. Must be called after including columns because columnMetadata is recovered from the tableMetadata. Options in indexMetadata will be null. @param indType the index type. @param indexName the index name. @param fields the columns which define the index. @return the table metadata builder. @throws if an error happens.
[ "Add", "an", "index", ".", "Must", "be", "called", "after", "including", "columns", "because", "columnMetadata", "is", "recovered", "from", "the", "tableMetadata", ".", "Options", "in", "indexMetadata", "will", "be", "null", "." ]
train
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/metadata/TableMetadataBuilder.java#L155-L172
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java
ExtendedDatabaseBlobAuditingPoliciesInner.getAsync
public Observable<ExtendedDatabaseBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<ExtendedDatabaseBlobAuditingPolicyInner>, ExtendedDatabaseBlobAuditingPolicyInner>() { @Override public ExtendedDatabaseBlobAuditingPolicyInner call(ServiceResponse<ExtendedDatabaseBlobAuditingPolicyInner> response) { return response.body(); } }); }
java
public Observable<ExtendedDatabaseBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<ExtendedDatabaseBlobAuditingPolicyInner>, ExtendedDatabaseBlobAuditingPolicyInner>() { @Override public ExtendedDatabaseBlobAuditingPolicyInner call(ServiceResponse<ExtendedDatabaseBlobAuditingPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExtendedDatabaseBlobAuditingPolicyInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serv...
Gets an extended database's blob auditing policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExtendedDatabaseBlobAuditingPolicyInner object
[ "Gets", "an", "extended", "database", "s", "blob", "auditing", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ExtendedDatabaseBlobAuditingPoliciesInner.java#L105-L112
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/config/AbstractInterfaceConfig.java
AbstractInterfaceConfig.getMethodConfigValue
public Object getMethodConfigValue(String methodName, String configKey) { if (configValueCache == null) { return null; } String key = buildmkey(methodName, configKey); return configValueCache.get(key); }
java
public Object getMethodConfigValue(String methodName, String configKey) { if (configValueCache == null) { return null; } String key = buildmkey(methodName, configKey); return configValueCache.get(key); }
[ "public", "Object", "getMethodConfigValue", "(", "String", "methodName", ",", "String", "configKey", ")", "{", "if", "(", "configValueCache", "==", "null", ")", "{", "return", "null", ";", "}", "String", "key", "=", "buildmkey", "(", "methodName", ",", "conf...
得到方法级配置,找不到则返回null @param methodName 方法名 @param configKey 配置key,例如参数 @return 配置值 method config value
[ "得到方法级配置,找不到则返回null" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/AbstractInterfaceConfig.java#L958-L964
aws/aws-sdk-java
aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/TagResult.java
TagResult.withTags
public TagResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public TagResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "TagResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags that have been added to the specified resource. </p> @param tags The tags that have been added to the specified resource. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "that", "have", "been", "added", "to", "the", "specified", "resource", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/TagResult.java#L114-L117
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java
ConsumerUtil.getPublicKey
Key getPublicKey(String trustedAlias, String trustStoreRef, String signatureAlgorithm) throws KeyStoreServiceException, KeyException { Key signingKey = getPublicKeyFromKeystore(trustedAlias, trustStoreRef, signatureAlgorithm); if (tc.isDebugEnabled()) { Tr.debug(tc, "Trusted alias: " + trustedAlias + ", Truststore: " + trustStoreRef); Tr.debug(tc, "RSAPublicKey: " + (signingKey instanceof RSAPublicKey)); } if (signingKey != null && !(signingKey instanceof RSAPublicKey)) { signingKey = null; } return signingKey; }
java
Key getPublicKey(String trustedAlias, String trustStoreRef, String signatureAlgorithm) throws KeyStoreServiceException, KeyException { Key signingKey = getPublicKeyFromKeystore(trustedAlias, trustStoreRef, signatureAlgorithm); if (tc.isDebugEnabled()) { Tr.debug(tc, "Trusted alias: " + trustedAlias + ", Truststore: " + trustStoreRef); Tr.debug(tc, "RSAPublicKey: " + (signingKey instanceof RSAPublicKey)); } if (signingKey != null && !(signingKey instanceof RSAPublicKey)) { signingKey = null; } return signingKey; }
[ "Key", "getPublicKey", "(", "String", "trustedAlias", ",", "String", "trustStoreRef", ",", "String", "signatureAlgorithm", ")", "throws", "KeyStoreServiceException", ",", "KeyException", "{", "Key", "signingKey", "=", "getPublicKeyFromKeystore", "(", "trustedAlias", ","...
Creates a Key object from the certificate stored in the trust store and alias provided.
[ "Creates", "a", "Key", "object", "from", "the", "certificate", "stored", "in", "the", "trust", "store", "and", "alias", "provided", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L290-L301
unbescape/unbescape
src/main/java/org/unbescape/json/JsonEscape.java
JsonEscape.unescapeJson
public static void unescapeJson(final String text, final Writer writer) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (text == null) { return; } if (text.indexOf('\\') < 0) { // Fail fast, avoid more complex (and less JIT-table) method to execute if not needed writer.write(text); return; } JsonEscapeUtil.unescape(new InternalStringReader(text), writer); }
java
public static void unescapeJson(final String text, final Writer writer) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (text == null) { return; } if (text.indexOf('\\') < 0) { // Fail fast, avoid more complex (and less JIT-table) method to execute if not needed writer.write(text); return; } JsonEscapeUtil.unescape(new InternalStringReader(text), writer); }
[ "public", "static", "void", "unescapeJson", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'writer' ca...
<p> Perform a JSON <strong>unescape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> JSON unescape of SECs and u-based escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "JSON", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/json/JsonEscape.java#L917-L934
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.getLearnedRoutesAsync
public Observable<GatewayRouteListResultInner> getLearnedRoutesAsync(String resourceGroupName, String virtualNetworkGatewayName) { return getLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<GatewayRouteListResultInner>, GatewayRouteListResultInner>() { @Override public GatewayRouteListResultInner call(ServiceResponse<GatewayRouteListResultInner> response) { return response.body(); } }); }
java
public Observable<GatewayRouteListResultInner> getLearnedRoutesAsync(String resourceGroupName, String virtualNetworkGatewayName) { return getLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<GatewayRouteListResultInner>, GatewayRouteListResultInner>() { @Override public GatewayRouteListResultInner call(ServiceResponse<GatewayRouteListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "GatewayRouteListResultInner", ">", "getLearnedRoutesAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "return", "getLearnedRoutesWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetwo...
This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "This", "operation", "retrieves", "a", "list", "of", "routes", "the", "virtual", "network", "gateway", "has", "learned", "including", "routes", "learned", "from", "BGP", "peers", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2365-L2372
vanilladb/vanillacore
src/main/java/org/vanilladb/core/remote/jdbc/RemoteConnectionImpl.java
RemoteConnectionImpl.setReadOnly
@Override public void setReadOnly(boolean readOnly) throws RemoteException { if (this.readOnly != readOnly) { tx.commit(); this.readOnly = readOnly; try { tx = VanillaDb.txMgr().newTransaction(isolationLevel, readOnly); } catch (Exception e) { throw new RemoteException("error creating transaction ", e); } } }
java
@Override public void setReadOnly(boolean readOnly) throws RemoteException { if (this.readOnly != readOnly) { tx.commit(); this.readOnly = readOnly; try { tx = VanillaDb.txMgr().newTransaction(isolationLevel, readOnly); } catch (Exception e) { throw new RemoteException("error creating transaction ", e); } } }
[ "@", "Override", "public", "void", "setReadOnly", "(", "boolean", "readOnly", ")", "throws", "RemoteException", "{", "if", "(", "this", ".", "readOnly", "!=", "readOnly", ")", "{", "tx", ".", "commit", "(", ")", ";", "this", ".", "readOnly", "=", "readOn...
Sets this connection's auto-commit mode to the given state. The default setting of auto-commit mode is true. This method may commit current transaction and start a new transaction.
[ "Sets", "this", "connection", "s", "auto", "-", "commit", "mode", "to", "the", "given", "state", ".", "The", "default", "setting", "of", "auto", "-", "commit", "mode", "is", "true", ".", "This", "method", "may", "commit", "current", "transaction", "and", ...
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/remote/jdbc/RemoteConnectionImpl.java#L91-L102
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/HeapCache.java
HeapCache.resiliencePolicyException
private void resiliencePolicyException(final Entry<K, V> e, final long t0, final long t, Throwable _exception) { ExceptionWrapper<K> _value = new ExceptionWrapper(extractKeyObj(e), _exception, t0, e); insert(e, (V) _value, t0, t, t0, INSERT_STAT_LOAD, 0); }
java
private void resiliencePolicyException(final Entry<K, V> e, final long t0, final long t, Throwable _exception) { ExceptionWrapper<K> _value = new ExceptionWrapper(extractKeyObj(e), _exception, t0, e); insert(e, (V) _value, t0, t, t0, INSERT_STAT_LOAD, 0); }
[ "private", "void", "resiliencePolicyException", "(", "final", "Entry", "<", "K", ",", "V", ">", "e", ",", "final", "long", "t0", ",", "final", "long", "t", ",", "Throwable", "_exception", ")", "{", "ExceptionWrapper", "<", "K", ">", "_value", "=", "new",...
Exception from the resilience policy. We have two exceptions now. One from the loader or the expiry policy, one from the resilience policy. We propagate the more severe one from the resilience policy.
[ "Exception", "from", "the", "resilience", "policy", ".", "We", "have", "two", "exceptions", "now", ".", "One", "from", "the", "loader", "or", "the", "expiry", "policy", "one", "from", "the", "resilience", "policy", ".", "We", "propagate", "the", "more", "s...
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1445-L1448
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitUses
@Override public R visitUses(UsesTree node, P p) { R r = scan(node.getServiceType(), p); r = scanAndReduce(node.getDescription(), p, r); return r; }
java
@Override public R visitUses(UsesTree node, P p) { R r = scan(node.getServiceType(), p); r = scanAndReduce(node.getDescription(), p, r); return r; }
[ "@", "Override", "public", "R", "visitUses", "(", "UsesTree", "node", ",", "P", "p", ")", "{", "R", "r", "=", "scan", "(", "node", ".", "getServiceType", "(", ")", ",", "p", ")", ";", "r", "=", "scanAndReduce", "(", "node", ".", "getDescription", "...
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L497-L502
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.addChild
protected boolean addChild(final Widget child, final GVRSceneObject childRootSceneObject, boolean preventLayout) { return addChild(child, childRootSceneObject, -1, preventLayout); }
java
protected boolean addChild(final Widget child, final GVRSceneObject childRootSceneObject, boolean preventLayout) { return addChild(child, childRootSceneObject, -1, preventLayout); }
[ "protected", "boolean", "addChild", "(", "final", "Widget", "child", ",", "final", "GVRSceneObject", "childRootSceneObject", ",", "boolean", "preventLayout", ")", "{", "return", "addChild", "(", "child", ",", "childRootSceneObject", ",", "-", "1", ",", "preventLay...
Add another {@link Widget} as a child of this one. Convenience method for {@link #addChild(Widget, GVRSceneObject, int, boolean) addChild(child, childRootSceneObject, -1, preventLayout)}. @param child The {@code Widget} to add as a child. @param childRootSceneObject The root {@link GVRSceneObject} of the child. @param preventLayout The {@code Widget} whether to call layout(). @return {@code True} if {@code child} was added; {@code false} if {@code child} was previously added to this instance.
[ "Add", "another", "{", "@link", "Widget", "}", "as", "a", "child", "of", "this", "one", ".", "Convenience", "method", "for", "{", "@link", "#addChild", "(", "Widget", "GVRSceneObject", "int", "boolean", ")", "addChild", "(", "child", "childRootSceneObject", ...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L2973-L2976
google/closure-templates
java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java
InferenceEngine.inferStrictRenderUnitNode
static void inferStrictRenderUnitNode( RenderUnitNode node, Inferences inferences, ErrorReporter errorReporter) { InferenceEngine inferenceEngine = new InferenceEngine(inferences, errorReporter); // Context started off as startContext and we have propagated context through all of // node's children, so now context is the node's end context. Context endContext = inferenceEngine.inferChildren( node, Context.getStartContextForContentKind(node.getContentKind())); // Checking that start and end context is same. checkBlockEndContext(node, endContext); }
java
static void inferStrictRenderUnitNode( RenderUnitNode node, Inferences inferences, ErrorReporter errorReporter) { InferenceEngine inferenceEngine = new InferenceEngine(inferences, errorReporter); // Context started off as startContext and we have propagated context through all of // node's children, so now context is the node's end context. Context endContext = inferenceEngine.inferChildren( node, Context.getStartContextForContentKind(node.getContentKind())); // Checking that start and end context is same. checkBlockEndContext(node, endContext); }
[ "static", "void", "inferStrictRenderUnitNode", "(", "RenderUnitNode", "node", ",", "Inferences", "inferences", ",", "ErrorReporter", "errorReporter", ")", "{", "InferenceEngine", "inferenceEngine", "=", "new", "InferenceEngine", "(", "inferences", ",", "errorReporter", ...
Applies strict contextual autoescaping to the given node's children. <p>The start context is the given node's declared {@link ContentKind}, and it is enforced that the block's inferred end context matches the start context. <p>This method is used to visit the content of {let} and {param} nodes with a {@code kind} attribute.
[ "Applies", "strict", "contextual", "autoescaping", "to", "the", "given", "node", "s", "children", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java#L135-L145
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/WrapperBucket.java
WrapperBucket.insertByKey
public Element insertByKey(Object key, Object object) { EJSWrapperCommon element = (EJSWrapperCommon) object; if (ivWrappers == null) { ivWrappers = new HashMap<Object, EJSWrapperCommon>(DEFAULT_BUCKET_SIZE); } Object duplicate = ivWrappers.put(key, element); if (duplicate != null) { // The wrapper cache does not support duplicates.... however, the // first time a home is looked up, and keyToObject faults it in, // deferred init will initialize it and insert it into the cache // before returning to faultOnKey where it will be done AGAIN! // In the future, it would be nice if deferred init would NOT // add the home to the cache, but until then, it is fine to just // ignore this and go on.... at least this code will only allow // it in the cache once. d535968 if (duplicate == element) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "insertByKey : same object again : " + object); } else { // It is totally unacceptable to have more than one // EJSWrapperCommon instance per key. d535968 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "insertByKey : attempt to insert duplicate : " + key + " : " + object + " : " + duplicate); throw new IllegalArgumentException("Attempt to insert duplicate element into EJB Wrapper Cache"); } } // Give the element (EJSWrapperCommon) access to the bucket, so it // may syncronize on it, and also reset the pin count to 0, // a non-negative, to indiate the element is now in the cache. element.ivBucket = this; element.pinned = 0; return element; }
java
public Element insertByKey(Object key, Object object) { EJSWrapperCommon element = (EJSWrapperCommon) object; if (ivWrappers == null) { ivWrappers = new HashMap<Object, EJSWrapperCommon>(DEFAULT_BUCKET_SIZE); } Object duplicate = ivWrappers.put(key, element); if (duplicate != null) { // The wrapper cache does not support duplicates.... however, the // first time a home is looked up, and keyToObject faults it in, // deferred init will initialize it and insert it into the cache // before returning to faultOnKey where it will be done AGAIN! // In the future, it would be nice if deferred init would NOT // add the home to the cache, but until then, it is fine to just // ignore this and go on.... at least this code will only allow // it in the cache once. d535968 if (duplicate == element) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "insertByKey : same object again : " + object); } else { // It is totally unacceptable to have more than one // EJSWrapperCommon instance per key. d535968 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "insertByKey : attempt to insert duplicate : " + key + " : " + object + " : " + duplicate); throw new IllegalArgumentException("Attempt to insert duplicate element into EJB Wrapper Cache"); } } // Give the element (EJSWrapperCommon) access to the bucket, so it // may syncronize on it, and also reset the pin count to 0, // a non-negative, to indiate the element is now in the cache. element.ivBucket = this; element.pinned = 0; return element; }
[ "public", "Element", "insertByKey", "(", "Object", "key", ",", "Object", "object", ")", "{", "EJSWrapperCommon", "element", "=", "(", "EJSWrapperCommon", ")", "object", ";", "if", "(", "ivWrappers", "==", "null", ")", "{", "ivWrappers", "=", "new", "HashMap"...
Insert the specified object into the bucket and associate it with the specified key. Returns the Element which holds the newly- inserted object. @param key key of the object element to be inserted. @param object the object to be inserted for the specified key. @return the Element holding the target object just inserted.
[ "Insert", "the", "specified", "object", "into", "the", "bucket", "and", "associate", "it", "with", "the", "specified", "key", ".", "Returns", "the", "Element", "which", "holds", "the", "newly", "-", "inserted", "object", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/WrapperBucket.java#L119-L163
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.escapeXml11
public static String escapeXml11(final String text, final XmlEscapeType type, final XmlEscapeLevel level) { return escapeXml(text, XmlEscapeSymbols.XML11_SYMBOLS, type, level); }
java
public static String escapeXml11(final String text, final XmlEscapeType type, final XmlEscapeLevel level) { return escapeXml(text, XmlEscapeSymbols.XML11_SYMBOLS, type, level); }
[ "public", "static", "String", "escapeXml11", "(", "final", "String", "text", ",", "final", "XmlEscapeType", "type", ",", "final", "XmlEscapeLevel", "level", ")", "{", "return", "escapeXml", "(", "text", ",", "XmlEscapeSymbols", ".", "XML11_SYMBOLS", ",", "type",...
<p> Perform a (configurable) XML 1.1 <strong>escape</strong> operation on a <tt>String</tt> input. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.xml.XmlEscapeType} and {@link org.unbescape.xml.XmlEscapeLevel} argument values. </p> <p> All other <tt>String</tt>-based <tt>escapeXml11*(...)</tt> methods call this one with preconfigured <tt>type</tt> and <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param type the type of escape operation to be performed, see {@link org.unbescape.xml.XmlEscapeType}. @param level the escape level to be applied, see {@link org.unbescape.xml.XmlEscapeLevel}. @return The escaped result <tt>String</tt>. As a memory-performance improvement, will return the exact same object as the <tt>text</tt> input argument if no escaping modifications were required (and no additional <tt>String</tt> objects will be created during processing). Will return <tt>null</tt> if input is <tt>null</tt>.
[ "<p", ">", "Perform", "a", "(", "configurable", ")", "XML", "1", ".", "1", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "This", "method"...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L560-L562
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRVertexBuffer.java
GVRVertexBuffer.setFloatArray
public void setFloatArray(String attributeName, float[] data) { if (!NativeVertexBuffer.setFloatArray(getNative(), attributeName, data, 0, 0)) { throw new IllegalArgumentException("Attribute name " + attributeName + " cannot be updated"); } }
java
public void setFloatArray(String attributeName, float[] data) { if (!NativeVertexBuffer.setFloatArray(getNative(), attributeName, data, 0, 0)) { throw new IllegalArgumentException("Attribute name " + attributeName + " cannot be updated"); } }
[ "public", "void", "setFloatArray", "(", "String", "attributeName", ",", "float", "[", "]", "data", ")", "{", "if", "(", "!", "NativeVertexBuffer", ".", "setFloatArray", "(", "getNative", "(", ")", ",", "attributeName", ",", "data", ",", "0", ",", "0", ")...
Updates a vertex attribute from a float array. All of the entries of the input float array are copied into the storage for the named vertex attribute. Other vertex attributes are not affected. The attribute name must be one of the attributes named in the descriptor passed to the constructor. <p> All vertex attributes have the same number of entries. If this is the first attribute added to the vertex buffer, the size of the input data array will determine the number of vertices. Updating subsequent attributes will fail if the data array size is not consistent. For example, if you create a vertex buffer with descriptor "float3 a_position float2 a_texcoord" and provide an array of 12 floats for "a_position" this will result in a vertex count of 4. The corresponding data array for the "a_texcoord" attribute should contain 8 floats. @param attributeName name of the attribute to update @param data float array containing the new values @throws IllegalArgumentException if attribute name not in descriptor or float array is wrong size
[ "Updates", "a", "vertex", "attribute", "from", "a", "float", "array", ".", "All", "of", "the", "entries", "of", "the", "input", "float", "array", "are", "copied", "into", "the", "storage", "for", "the", "named", "vertex", "attribute", ".", "Other", "vertex...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRVertexBuffer.java#L314-L320
JodaOrg/joda-time
src/main/java/org/joda/time/LocalDateTime.java
LocalDateTime.correctDstTransition
private Date correctDstTransition(Date date, final TimeZone timeZone) { Calendar calendar = Calendar.getInstance(timeZone); calendar.setTime(date); LocalDateTime check = LocalDateTime.fromCalendarFields(calendar); if (check.isBefore(this)) { // DST gap // move forward in units of one minute until equal/after while (check.isBefore(this)) { calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000); check = LocalDateTime.fromCalendarFields(calendar); } // move back in units of one second until date wrong while (check.isBefore(this) == false) { calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000); check = LocalDateTime.fromCalendarFields(calendar); } calendar.setTimeInMillis(calendar.getTimeInMillis() + 1000); } else if (check.equals(this)) { // check for DST overlap final Calendar earlier = Calendar.getInstance(timeZone); earlier.setTimeInMillis(calendar.getTimeInMillis() - timeZone.getDSTSavings()); check = LocalDateTime.fromCalendarFields(earlier); if (check.equals(this)) { calendar = earlier; } } return calendar.getTime(); }
java
private Date correctDstTransition(Date date, final TimeZone timeZone) { Calendar calendar = Calendar.getInstance(timeZone); calendar.setTime(date); LocalDateTime check = LocalDateTime.fromCalendarFields(calendar); if (check.isBefore(this)) { // DST gap // move forward in units of one minute until equal/after while (check.isBefore(this)) { calendar.setTimeInMillis(calendar.getTimeInMillis() + 60000); check = LocalDateTime.fromCalendarFields(calendar); } // move back in units of one second until date wrong while (check.isBefore(this) == false) { calendar.setTimeInMillis(calendar.getTimeInMillis() - 1000); check = LocalDateTime.fromCalendarFields(calendar); } calendar.setTimeInMillis(calendar.getTimeInMillis() + 1000); } else if (check.equals(this)) { // check for DST overlap final Calendar earlier = Calendar.getInstance(timeZone); earlier.setTimeInMillis(calendar.getTimeInMillis() - timeZone.getDSTSavings()); check = LocalDateTime.fromCalendarFields(earlier); if (check.equals(this)) { calendar = earlier; } } return calendar.getTime(); }
[ "private", "Date", "correctDstTransition", "(", "Date", "date", ",", "final", "TimeZone", "timeZone", ")", "{", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", "timeZone", ")", ";", "calendar", ".", "setTime", "(", "date", ")", ";", "LocalD...
Correct <code>date</code> in case of DST overlap. <p> The <code>Date</code> object created has exactly the same fields as this date-time, except when the time would be invalid due to a daylight savings gap. In that case, the time will be set to the earliest valid time after the gap. <p> In the case of a daylight savings overlap, the earlier instant is selected. <p> Converting to a JDK Date is full of complications as the JDK Date constructor doesn't behave as you might expect around DST transitions. This method works by taking a first guess and then adjusting. This also handles the situation where the JDK time zone data differs from the Joda-Time time zone data. @see #toDate()
[ "Correct", "<code", ">", "date<", "/", "code", ">", "in", "case", "of", "DST", "overlap", ".", "<p", ">", "The", "<code", ">", "Date<", "/", "code", ">", "object", "created", "has", "exactly", "the", "same", "fields", "as", "this", "date", "-", "time...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDateTime.java#L848-L875
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.addTag
public GitlabTag addTag(GitlabProject project, String tagName, String ref, String message, String releaseDescription) throws IOException { String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabTag.URL; return dispatch() .with("tag_name", tagName) .with("ref", ref) .with("message", message) .with("release_description", releaseDescription) .to(tailUrl, GitlabTag.class); }
java
public GitlabTag addTag(GitlabProject project, String tagName, String ref, String message, String releaseDescription) throws IOException { String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabTag.URL; return dispatch() .with("tag_name", tagName) .with("ref", ref) .with("message", message) .with("release_description", releaseDescription) .to(tailUrl, GitlabTag.class); }
[ "public", "GitlabTag", "addTag", "(", "GitlabProject", "project", ",", "String", "tagName", ",", "String", "ref", ",", "String", "message", ",", "String", "releaseDescription", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "U...
Create tag in specific project @param project @param tagName @param ref @param message @param releaseDescription @return @throws IOException on gitlab api call error
[ "Create", "tag", "in", "specific", "project" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3410-L3418
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java
ToUnknownStream.namespaceAfterStartElement
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException { // hack for XSLTC with finding URI for default namespace if (m_firstTagNotEmitted && m_firstElementURI == null && m_firstElementName != null) { String prefix1 = getPrefixPart(m_firstElementName); if (prefix1 == null && EMPTYSTRING.equals(prefix)) { // the elements URI is not known yet, and it // doesn't have a prefix, and we are currently // setting the uri for prefix "", so we have // the uri for the element... lets remember it m_firstElementURI = uri; } } startPrefixMapping(prefix,uri, false); }
java
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException { // hack for XSLTC with finding URI for default namespace if (m_firstTagNotEmitted && m_firstElementURI == null && m_firstElementName != null) { String prefix1 = getPrefixPart(m_firstElementName); if (prefix1 == null && EMPTYSTRING.equals(prefix)) { // the elements URI is not known yet, and it // doesn't have a prefix, and we are currently // setting the uri for prefix "", so we have // the uri for the element... lets remember it m_firstElementURI = uri; } } startPrefixMapping(prefix,uri, false); }
[ "public", "void", "namespaceAfterStartElement", "(", "String", "prefix", ",", "String", "uri", ")", "throws", "SAXException", "{", "// hack for XSLTC with finding URI for default namespace", "if", "(", "m_firstTagNotEmitted", "&&", "m_firstElementURI", "==", "null", "&&", ...
This method is used when a prefix/uri namespace mapping is indicated after the element was started with a startElement() and before and endElement(). startPrefixMapping(prefix,uri) would be used before the startElement() call. @param uri the URI of the namespace @param prefix the prefix associated with the given URI. @see ExtendedContentHandler#namespaceAfterStartElement(String, String)
[ "This", "method", "is", "used", "when", "a", "prefix", "/", "uri", "namespace", "mapping", "is", "indicated", "after", "the", "element", "was", "started", "with", "a", "startElement", "()", "and", "before", "and", "endElement", "()", ".", "startPrefixMapping",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java#L363-L380
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.fixDiscouragedCapacityDefinition
@Fix(io.sarl.lang.validation.IssueCodes.DISCOURAGED_CAPACITY_DEFINITION) public void fixDiscouragedCapacityDefinition(Issue issue, IssueResolutionAcceptor acceptor) { MemberRemoveModification.accept(this, issue, acceptor, SarlCapacity.class); ActionAddModification.accept(this, issue, acceptor); }
java
@Fix(io.sarl.lang.validation.IssueCodes.DISCOURAGED_CAPACITY_DEFINITION) public void fixDiscouragedCapacityDefinition(Issue issue, IssueResolutionAcceptor acceptor) { MemberRemoveModification.accept(this, issue, acceptor, SarlCapacity.class); ActionAddModification.accept(this, issue, acceptor); }
[ "@", "Fix", "(", "io", ".", "sarl", ".", "lang", ".", "validation", ".", "IssueCodes", ".", "DISCOURAGED_CAPACITY_DEFINITION", ")", "public", "void", "fixDiscouragedCapacityDefinition", "(", "Issue", "issue", ",", "IssueResolutionAcceptor", "acceptor", ")", "{", "...
Quick fix for "Discouraged capacity definition". @param issue the issue. @param acceptor the quick fix acceptor.
[ "Quick", "fix", "for", "Discouraged", "capacity", "definition", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L855-L859
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java
DatastreamResource.getDatastream
@Path("/{dsID}/content") @GET public Response getDatastream(@PathParam(RestParam.PID) String pid, @PathParam(RestParam.DSID) String dsID, @QueryParam(RestParam.AS_OF_DATE_TIME) String dateTime, @QueryParam(RestParam.DOWNLOAD) String download, @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) { Context context = getContext(); try { Date asOfDateTime = DateUtility.parseDateOrNull(dateTime); MIMETypedStream stream = m_access.getDatastreamDissemination(context, pid, dsID, asOfDateTime); if (m_datastreamFilenameHelper != null) { m_datastreamFilenameHelper .addContentDispositionHeader(context, pid, dsID, download, asOfDateTime, stream); } return buildResponse(stream); } catch (Exception ex) { return handleException(ex, flash); } }
java
@Path("/{dsID}/content") @GET public Response getDatastream(@PathParam(RestParam.PID) String pid, @PathParam(RestParam.DSID) String dsID, @QueryParam(RestParam.AS_OF_DATE_TIME) String dateTime, @QueryParam(RestParam.DOWNLOAD) String download, @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) { Context context = getContext(); try { Date asOfDateTime = DateUtility.parseDateOrNull(dateTime); MIMETypedStream stream = m_access.getDatastreamDissemination(context, pid, dsID, asOfDateTime); if (m_datastreamFilenameHelper != null) { m_datastreamFilenameHelper .addContentDispositionHeader(context, pid, dsID, download, asOfDateTime, stream); } return buildResponse(stream); } catch (Exception ex) { return handleException(ex, flash); } }
[ "@", "Path", "(", "\"/{dsID}/content\"", ")", "@", "GET", "public", "Response", "getDatastream", "(", "@", "PathParam", "(", "RestParam", ".", "PID", ")", "String", "pid", ",", "@", "PathParam", "(", "RestParam", ".", "DSID", ")", "String", "dsID", ",", ...
<p>Invoke API-A.getDatastreamDissemination(context, pid, dsID, asOfDateTime) </p><p> GET /objects/{pid}/datastreams/{dsID}/content ? asOfDateTime</p>
[ "<p", ">", "Invoke", "API", "-", "A", ".", "getDatastreamDissemination", "(", "context", "pid", "dsID", "asOfDateTime", ")", "<", "/", "p", ">", "<p", ">", "GET", "/", "objects", "/", "{", "pid", "}", "/", "datastreams", "/", "{", "dsID", "}", "/", ...
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java#L256-L286
casbin/jcasbin
src/main/java/org/casbin/jcasbin/config/Config.java
Config.addConfig
private boolean addConfig(String section, String option, String value) { if (section.equals("")) { section = DEFAULT_SECTION; } if (!data.containsKey(section)) { data.put(section, new HashMap<>()); } boolean ok = data.get(section).containsKey(option); data.get(section).put(option, value); return !ok; }
java
private boolean addConfig(String section, String option, String value) { if (section.equals("")) { section = DEFAULT_SECTION; } if (!data.containsKey(section)) { data.put(section, new HashMap<>()); } boolean ok = data.get(section).containsKey(option); data.get(section).put(option, value); return !ok; }
[ "private", "boolean", "addConfig", "(", "String", "section", ",", "String", "option", ",", "String", "value", ")", "{", "if", "(", "section", ".", "equals", "(", "\"\"", ")", ")", "{", "section", "=", "DEFAULT_SECTION", ";", "}", "if", "(", "!", "data"...
addConfig adds a new section->key:value to the configuration.
[ "addConfig", "adds", "a", "new", "section", "-", ">", "key", ":", "value", "to", "the", "configuration", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/config/Config.java#L66-L78
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java
SnowflakeAzureClient.buildEncryptionMetadataJSON
private String buildEncryptionMetadataJSON(String iv64, String key64) { return String.format("{\"EncryptionMode\":\"FullBlob\",\"WrappedContentKey\"" + ":{\"KeyId\":\"symmKey1\",\"EncryptedKey\":\"%s\"" + ",\"Algorithm\":\"AES_CBC_256\"},\"EncryptionAgent\":" + "{\"Protocol\":\"1.0\",\"EncryptionAlgorithm\":" + "\"AES_CBC_256\"},\"ContentEncryptionIV\":\"%s\"" + ",\"KeyWrappingMetadata\":{\"EncryptionLibrary\":" + "\"Java 5.3.0\"}}", key64, iv64); }
java
private String buildEncryptionMetadataJSON(String iv64, String key64) { return String.format("{\"EncryptionMode\":\"FullBlob\",\"WrappedContentKey\"" + ":{\"KeyId\":\"symmKey1\",\"EncryptedKey\":\"%s\"" + ",\"Algorithm\":\"AES_CBC_256\"},\"EncryptionAgent\":" + "{\"Protocol\":\"1.0\",\"EncryptionAlgorithm\":" + "\"AES_CBC_256\"},\"ContentEncryptionIV\":\"%s\"" + ",\"KeyWrappingMetadata\":{\"EncryptionLibrary\":" + "\"Java 5.3.0\"}}", key64, iv64); }
[ "private", "String", "buildEncryptionMetadataJSON", "(", "String", "iv64", ",", "String", "key64", ")", "{", "return", "String", ".", "format", "(", "\"{\\\"EncryptionMode\\\":\\\"FullBlob\\\",\\\"WrappedContentKey\\\"\"", "+", "\":{\\\"KeyId\\\":\\\"symmKey1\\\",\\\"EncryptedKey...
/* buildEncryptionMetadataJSON Takes the base64-encoded iv and key and creates the JSON block to be used as the encryptiondata metadata field on the blob.
[ "/", "*", "buildEncryptionMetadataJSON", "Takes", "the", "base64", "-", "encoded", "iv", "and", "key", "and", "creates", "the", "JSON", "block", "to", "be", "used", "as", "the", "encryptiondata", "metadata", "field", "on", "the", "blob", "." ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java#L786-L795
apache/flink
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java
DefaultConfigurableOptionsFactory.checkArgumentValid
private static boolean checkArgumentValid(String key, String value) { if (POSITIVE_INT_CONFIG_SET.contains(key)) { Preconditions.checkArgument(Integer.parseInt(value) > 0, "Configured value for key: " + key + " must be larger than 0."); } else if (SIZE_CONFIG_SET.contains(key)) { Preconditions.checkArgument(MemorySize.parseBytes(value) > 0, "Configured size for key" + key + " must be larger than 0."); } else if (BOOLEAN_CONFIG_SET.contains(key)) { Preconditions.checkArgument("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value), "The configured boolean value: " + value + " for key: " + key + " is illegal."); } else if (key.equals(COMPACTION_STYLE.key())) { value = value.toLowerCase(); Preconditions.checkArgument(COMPACTION_STYLE_SET.contains(value), "Compression type: " + value + " is not recognized with legal types: " + String.join(", ", COMPACTION_STYLE_SET)); } return true; }
java
private static boolean checkArgumentValid(String key, String value) { if (POSITIVE_INT_CONFIG_SET.contains(key)) { Preconditions.checkArgument(Integer.parseInt(value) > 0, "Configured value for key: " + key + " must be larger than 0."); } else if (SIZE_CONFIG_SET.contains(key)) { Preconditions.checkArgument(MemorySize.parseBytes(value) > 0, "Configured size for key" + key + " must be larger than 0."); } else if (BOOLEAN_CONFIG_SET.contains(key)) { Preconditions.checkArgument("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value), "The configured boolean value: " + value + " for key: " + key + " is illegal."); } else if (key.equals(COMPACTION_STYLE.key())) { value = value.toLowerCase(); Preconditions.checkArgument(COMPACTION_STYLE_SET.contains(value), "Compression type: " + value + " is not recognized with legal types: " + String.join(", ", COMPACTION_STYLE_SET)); } return true; }
[ "private", "static", "boolean", "checkArgumentValid", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "POSITIVE_INT_CONFIG_SET", ".", "contains", "(", "key", ")", ")", "{", "Preconditions", ".", "checkArgument", "(", "Integer", ".", "parseIn...
Helper method to check whether the (key,value) is valid through given configuration and returns the formatted value. @param key The configuration key which is configurable in {@link RocksDBConfigurableOptions}. @param value The value within given configuration. @return whether the given key and value in string format is legal.
[ "Helper", "method", "to", "check", "whether", "the", "(", "key", "value", ")", "is", "valid", "through", "given", "configuration", "and", "returns", "the", "formatted", "value", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java#L380-L399
aol/cyclops
cyclops/src/main/java/cyclops/companion/Functions.java
Functions.mapLongs
public static Function<? super ReactiveSeq<Long>, ? extends ReactiveSeq<Long>> mapLongs(LongUnaryOperator b){ return a->a.longs(i->i,s->s.map(b)); }
java
public static Function<? super ReactiveSeq<Long>, ? extends ReactiveSeq<Long>> mapLongs(LongUnaryOperator b){ return a->a.longs(i->i,s->s.map(b)); }
[ "public", "static", "Function", "<", "?", "super", "ReactiveSeq", "<", "Long", ">", ",", "?", "extends", "ReactiveSeq", "<", "Long", ">", ">", "mapLongs", "(", "LongUnaryOperator", "b", ")", "{", "return", "a", "->", "a", ".", "longs", "(", "i", "->", ...
/* Fluent transform operation using primitive types e.g. <pre> {@code import static cyclops.ReactiveSeq.mapLongs; ReactiveSeq.ofLongs(1l,2l,3l) .to(mapLongs(i->i*2)); //[2l,4l,6l] } </pre>
[ "/", "*", "Fluent", "transform", "operation", "using", "primitive", "types", "e", ".", "g", ".", "<pre", ">", "{", "@code", "import", "static", "cyclops", ".", "ReactiveSeq", ".", "mapLongs", ";" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L376-L379
jcuda/jcudnn
JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java
JCudnn.cudnnCTCLoss
public static int cudnnCTCLoss( cudnnHandle handle, cudnnTensorDescriptor probsDesc, /** Tensor descriptor for probabilities, the dimensions are T,N,A (T is the timing steps, N is the mini batch size, A is the alphabet size) */ Pointer probs, /** probabilities after softmax, in GPU memory */ int[] labels, /** labels, in CPU memory */ int[] labelLengths, /** the length of each label, in CPU memory */ int[] inputLengths, /** the lengths of timing steps in each batch, in CPU memory */ Pointer costs, /** the returned costs of CTC, in GPU memory */ cudnnTensorDescriptor gradientsDesc, /** Tensor descriptor for gradients, the dimensions are T,N,A */ Pointer gradients, /** the returned CTC gradients, in GPU memory, to compute costs only, set it to NULL */ int algo, /** algorithm selected, supported now 0 and 1 */ cudnnCTCLossDescriptor ctcLossDesc, Pointer workspace, /** pointer to the workspace, in GPU memory */ long workSpaceSizeInBytes)/** the workspace size needed */ { return checkResult(cudnnCTCLossNative(handle, probsDesc, probs, labels, labelLengths, inputLengths, costs, gradientsDesc, gradients, algo, ctcLossDesc, workspace, workSpaceSizeInBytes)); }
java
public static int cudnnCTCLoss( cudnnHandle handle, cudnnTensorDescriptor probsDesc, /** Tensor descriptor for probabilities, the dimensions are T,N,A (T is the timing steps, N is the mini batch size, A is the alphabet size) */ Pointer probs, /** probabilities after softmax, in GPU memory */ int[] labels, /** labels, in CPU memory */ int[] labelLengths, /** the length of each label, in CPU memory */ int[] inputLengths, /** the lengths of timing steps in each batch, in CPU memory */ Pointer costs, /** the returned costs of CTC, in GPU memory */ cudnnTensorDescriptor gradientsDesc, /** Tensor descriptor for gradients, the dimensions are T,N,A */ Pointer gradients, /** the returned CTC gradients, in GPU memory, to compute costs only, set it to NULL */ int algo, /** algorithm selected, supported now 0 and 1 */ cudnnCTCLossDescriptor ctcLossDesc, Pointer workspace, /** pointer to the workspace, in GPU memory */ long workSpaceSizeInBytes)/** the workspace size needed */ { return checkResult(cudnnCTCLossNative(handle, probsDesc, probs, labels, labelLengths, inputLengths, costs, gradientsDesc, gradients, algo, ctcLossDesc, workspace, workSpaceSizeInBytes)); }
[ "public", "static", "int", "cudnnCTCLoss", "(", "cudnnHandle", "handle", ",", "cudnnTensorDescriptor", "probsDesc", ",", "/** Tensor descriptor for probabilities, the dimensions are T,N,A (T is the timing steps, N is the\n mini batch size, A is the alphabet size) */",...
return the ctc costs and gradients, given the probabilities and labels
[ "return", "the", "ctc", "costs", "and", "gradients", "given", "the", "probabilities", "and", "labels" ]
train
https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L3673-L3690
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/manifest/BaseRenderer.java
BaseRenderer.addColumn
public Column addColumn(Grid grid, String label, String width, String sortBy) { Column column = new Column(); grid.getColumns().addChild(column); column.setLabel(label); column.setWidth(width); column.setSortComparator(sortBy); column.setSortOrder(SortOrder.ASCENDING); return column; }
java
public Column addColumn(Grid grid, String label, String width, String sortBy) { Column column = new Column(); grid.getColumns().addChild(column); column.setLabel(label); column.setWidth(width); column.setSortComparator(sortBy); column.setSortOrder(SortOrder.ASCENDING); return column; }
[ "public", "Column", "addColumn", "(", "Grid", "grid", ",", "String", "label", ",", "String", "width", ",", "String", "sortBy", ")", "{", "Column", "column", "=", "new", "Column", "(", ")", ";", "grid", ".", "getColumns", "(", ")", ".", "addChild", "(",...
Adds a column to a grid. @param grid Grid. @param label Label for column. @param width Width for column. @param sortBy Field for sorting. @return Newly created column.
[ "Adds", "a", "column", "to", "a", "grid", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/manifest/BaseRenderer.java#L57-L65
knowm/XChange
xchange-wex/src/main/java/org/knowm/xchange/wex/v3/WexAdapters.java
WexAdapters.adaptTrades
public static Trades adaptTrades(WexTrade[] bTCETrades, CurrencyPair currencyPair) { List<Trade> tradesList = new ArrayList<>(); long lastTradeId = 0; for (WexTrade bTCETrade : bTCETrades) { // Date is reversed order. Insert at index 0 instead of appending long tradeId = bTCETrade.getTid(); if (tradeId > lastTradeId) { lastTradeId = tradeId; } tradesList.add(0, adaptTrade(bTCETrade, currencyPair)); } return new Trades(tradesList, lastTradeId, TradeSortType.SortByID); }
java
public static Trades adaptTrades(WexTrade[] bTCETrades, CurrencyPair currencyPair) { List<Trade> tradesList = new ArrayList<>(); long lastTradeId = 0; for (WexTrade bTCETrade : bTCETrades) { // Date is reversed order. Insert at index 0 instead of appending long tradeId = bTCETrade.getTid(); if (tradeId > lastTradeId) { lastTradeId = tradeId; } tradesList.add(0, adaptTrade(bTCETrade, currencyPair)); } return new Trades(tradesList, lastTradeId, TradeSortType.SortByID); }
[ "public", "static", "Trades", "adaptTrades", "(", "WexTrade", "[", "]", "bTCETrades", ",", "CurrencyPair", "currencyPair", ")", "{", "List", "<", "Trade", ">", "tradesList", "=", "new", "ArrayList", "<>", "(", ")", ";", "long", "lastTradeId", "=", "0", ";"...
Adapts a BTCETradeV3[] to a Trades Object @param bTCETrades The Wex trade data returned by API v.3 @param currencyPair the currency pair @return The trades
[ "Adapts", "a", "BTCETradeV3", "[]", "to", "a", "Trades", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-wex/src/main/java/org/knowm/xchange/wex/v3/WexAdapters.java#L122-L135
dustin/java-memcached-client
src/main/java/net/spy/memcached/MemcachedClient.java
MemcachedClient.asyncGetBulk
@Override public BulkFuture<Map<String, Object>> asyncGetBulk(Collection<String> keys) { return asyncGetBulk(keys, transcoder); }
java
@Override public BulkFuture<Map<String, Object>> asyncGetBulk(Collection<String> keys) { return asyncGetBulk(keys, transcoder); }
[ "@", "Override", "public", "BulkFuture", "<", "Map", "<", "String", ",", "Object", ">", ">", "asyncGetBulk", "(", "Collection", "<", "String", ">", "keys", ")", "{", "return", "asyncGetBulk", "(", "keys", ",", "transcoder", ")", ";", "}" ]
Asynchronously get a bunch of objects from the cache and decode them with the given transcoder. @param keys the keys to request @return a Future result of that fetch @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests
[ "Asynchronously", "get", "a", "bunch", "of", "objects", "from", "the", "cache", "and", "decode", "them", "with", "the", "given", "transcoder", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1444-L1447
landawn/AbacusUtil
src/com/landawn/abacus/util/CouchbaseExecutor.java
CouchbaseExecutor.toEntity
public static <T> T toEntity(final Class<T> targetClass, final JsonDocument jsonDocument) { final T result = toEntity(targetClass, jsonDocument.content()); final String id = jsonDocument.id(); if (N.notNullOrEmpty(id) && result != null) { if (Map.class.isAssignableFrom(targetClass)) { ((Map<String, Object>) result).put(_ID, id); } else { final Method idSetMethod = getObjectIdSetMethod(targetClass); if (idSetMethod != null) { ClassUtil.setPropValue(result, idSetMethod, id); } } } return result; }
java
public static <T> T toEntity(final Class<T> targetClass, final JsonDocument jsonDocument) { final T result = toEntity(targetClass, jsonDocument.content()); final String id = jsonDocument.id(); if (N.notNullOrEmpty(id) && result != null) { if (Map.class.isAssignableFrom(targetClass)) { ((Map<String, Object>) result).put(_ID, id); } else { final Method idSetMethod = getObjectIdSetMethod(targetClass); if (idSetMethod != null) { ClassUtil.setPropValue(result, idSetMethod, id); } } } return result; }
[ "public", "static", "<", "T", ">", "T", "toEntity", "(", "final", "Class", "<", "T", ">", "targetClass", ",", "final", "JsonDocument", "jsonDocument", ")", "{", "final", "T", "result", "=", "toEntity", "(", "targetClass", ",", "jsonDocument", ".", "content...
The id in the specified <code>jsonDocument</code> will be set to the returned object if and only if the id is not null or empty and the content in <code>jsonDocument</code> doesn't contain any "id" property, and it's acceptable to the <code>targetClass</code>. @param targetClass an entity class with getter/setter method or <code>Map.class</code> @param jsonDocument @return
[ "The", "id", "in", "the", "specified", "<code", ">", "jsonDocument<", "/", "code", ">", "will", "be", "set", "to", "the", "returned", "object", "if", "and", "only", "if", "the", "id", "is", "not", "null", "or", "empty", "and", "the", "content", "in", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CouchbaseExecutor.java#L309-L326
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlLogicConceptMatcher.java
SparqlLogicConceptMatcher.listMatchesAtLeastOfType
@Override public Map<URI, MatchResult> listMatchesAtLeastOfType(URI origin, MatchType minType) { return listMatchesWithinRange(origin, minType, LogicConceptMatchType.Exact); }
java
@Override public Map<URI, MatchResult> listMatchesAtLeastOfType(URI origin, MatchType minType) { return listMatchesWithinRange(origin, minType, LogicConceptMatchType.Exact); }
[ "@", "Override", "public", "Map", "<", "URI", ",", "MatchResult", ">", "listMatchesAtLeastOfType", "(", "URI", "origin", ",", "MatchType", "minType", ")", "{", "return", "listMatchesWithinRange", "(", "origin", ",", "minType", ",", "LogicConceptMatchType", ".", ...
Obtains all the matching resources that have a MatchType with the URI of {@code origin} of the type provided (inclusive) or more. @param origin URI to match @param minType the minimum MatchType we want to obtain @return an ImmutableMap sorted by value indexed by the URI of the matching resource and containing the particular {@code MatchResult}. If no result is found the Map should be empty not null.
[ "Obtains", "all", "the", "matching", "resources", "that", "have", "a", "MatchType", "with", "the", "URI", "of", "{", "@code", "origin", "}", "of", "the", "type", "provided", "(", "inclusive", ")", "or", "more", "." ]
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/SparqlLogicConceptMatcher.java#L265-L268
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/VariableSafeAbsRef.java
VariableSafeAbsRef.execute
public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { XNodeSet xns = (XNodeSet)super.execute(xctxt, destructiveOK); DTMManager dtmMgr = xctxt.getDTMManager(); int context = xctxt.getContextNode(); if(dtmMgr.getDTM(xns.getRoot()).getDocument() != dtmMgr.getDTM(context).getDocument()) { Expression expr = (Expression)xns.getContainedIter(); xns = (XNodeSet)expr.asIterator(xctxt, context); } return xns; }
java
public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { XNodeSet xns = (XNodeSet)super.execute(xctxt, destructiveOK); DTMManager dtmMgr = xctxt.getDTMManager(); int context = xctxt.getContextNode(); if(dtmMgr.getDTM(xns.getRoot()).getDocument() != dtmMgr.getDTM(context).getDocument()) { Expression expr = (Expression)xns.getContainedIter(); xns = (XNodeSet)expr.asIterator(xctxt, context); } return xns; }
[ "public", "XObject", "execute", "(", "XPathContext", "xctxt", ",", "boolean", "destructiveOK", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "XNodeSet", "xns", "=", "(", "XNodeSet", ")", "super", ".", "execute", "(", ...
Dereference the variable, and return the reference value. Note that lazy evaluation will occur. If a variable within scope is not found, a warning will be sent to the error listener, and an empty nodeset will be returned. @param xctxt The runtime execution context. @return The evaluated variable, or an empty nodeset if not found. @throws javax.xml.transform.TransformerException
[ "Dereference", "the", "variable", "and", "return", "the", "reference", "value", ".", "Note", "that", "lazy", "evaluation", "will", "occur", ".", "If", "a", "variable", "within", "scope", "is", "not", "found", "a", "warning", "will", "be", "sent", "to", "th...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/VariableSafeAbsRef.java#L58-L71
wuman/JReadability
src/main/java/com/wuman/jreadability/Readability.java
Readability.getInnerText
private static String getInnerText(Element e, boolean normalizeSpaces) { String textContent = e.text().trim(); if (normalizeSpaces) { textContent = textContent.replaceAll(Patterns.REGEX_NORMALIZE, ""); } return textContent; }
java
private static String getInnerText(Element e, boolean normalizeSpaces) { String textContent = e.text().trim(); if (normalizeSpaces) { textContent = textContent.replaceAll(Patterns.REGEX_NORMALIZE, ""); } return textContent; }
[ "private", "static", "String", "getInnerText", "(", "Element", "e", ",", "boolean", "normalizeSpaces", ")", "{", "String", "textContent", "=", "e", ".", "text", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "normalizeSpaces", ")", "{", "textContent", ...
Get the inner text of a node - cross browser compatibly. This also strips out any excess whitespace to be found. @param e @param normalizeSpaces @return
[ "Get", "the", "inner", "text", "of", "a", "node", "-", "cross", "browser", "compatibly", ".", "This", "also", "strips", "out", "any", "excess", "whitespace", "to", "be", "found", "." ]
train
https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L494-L502
taimos/dvalin
jaxrs/src/main/java/de/taimos/dvalin/jaxrs/JaxRsAnnotationScanner.java
JaxRsAnnotationScanner.hasAnnotation
public static boolean hasAnnotation(Method method, Class<? extends Annotation> annotation) { return !searchForAnnotation(method, annotation).isEmpty(); }
java
public static boolean hasAnnotation(Method method, Class<? extends Annotation> annotation) { return !searchForAnnotation(method, annotation).isEmpty(); }
[ "public", "static", "boolean", "hasAnnotation", "(", "Method", "method", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "return", "!", "searchForAnnotation", "(", "method", ",", "annotation", ")", ".", "isEmpty", "(", ")", ";",...
Checks if there is an annotation of the given type on this method or on type level for all interfaces and superclasses @param method the method to scan @param annotation the annotation to search for @return <i>true</i> if the given annotation is present on method or type level annotations in the type hierarchy
[ "Checks", "if", "there", "is", "an", "annotation", "of", "the", "given", "type", "on", "this", "method", "or", "on", "type", "level", "for", "all", "interfaces", "and", "superclasses" ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/jaxrs/src/main/java/de/taimos/dvalin/jaxrs/JaxRsAnnotationScanner.java#L48-L50
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/AbstractAjaxExecutorTypeaheadFinder.java
AbstractAjaxExecutorTypeaheadFinder.createFinder
@Nonnull @OverrideOnDemand protected Finder createFinder (@Nonnull final String sOriginalQuery, @Nonnull final LECTYPE aLEC) { return new Finder (aLEC.getDisplayLocale ()).initialize (sOriginalQuery); }
java
@Nonnull @OverrideOnDemand protected Finder createFinder (@Nonnull final String sOriginalQuery, @Nonnull final LECTYPE aLEC) { return new Finder (aLEC.getDisplayLocale ()).initialize (sOriginalQuery); }
[ "@", "Nonnull", "@", "OverrideOnDemand", "protected", "Finder", "createFinder", "(", "@", "Nonnull", "final", "String", "sOriginalQuery", ",", "@", "Nonnull", "final", "LECTYPE", "aLEC", ")", "{", "return", "new", "Finder", "(", "aLEC", ".", "getDisplayLocale", ...
Create a new {@link Finder} object. @param sOriginalQuery The original query string. Never <code>null</code>. @param aLEC The layout execution context. Never <code>null</code>. @return The non-<code>null</code> {@link Finder} object.
[ "Create", "a", "new", "{", "@link", "Finder", "}", "object", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/AbstractAjaxExecutorTypeaheadFinder.java#L228-L233
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/util/Mappings.java
Mappings.addMapping
private static void addMapping(Map<String, String> map, String key, String value, String kind) { String oldValue = map.put(key, value); if (oldValue != null && !oldValue.equals(value)) { ErrorUtil.error(kind + " redefined; was \"" + oldValue + ", now " + value); } }
java
private static void addMapping(Map<String, String> map, String key, String value, String kind) { String oldValue = map.put(key, value); if (oldValue != null && !oldValue.equals(value)) { ErrorUtil.error(kind + " redefined; was \"" + oldValue + ", now " + value); } }
[ "private", "static", "void", "addMapping", "(", "Map", "<", "String", ",", "String", ">", "map", ",", "String", "key", ",", "String", "value", ",", "String", "kind", ")", "{", "String", "oldValue", "=", "map", ".", "put", "(", "key", ",", "value", ")...
Adds a class, method or package-prefix property to its map, reporting an error if that mapping was previously specified.
[ "Adds", "a", "class", "method", "or", "package", "-", "prefix", "property", "to", "its", "map", "reporting", "an", "error", "if", "that", "mapping", "was", "previously", "specified", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/Mappings.java#L121-L126
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.addClasses
private void addClasses(XMLStreamWriter writer, File jarFile, boolean mapClassMethods) throws IOException, ClassNotFoundException, XMLStreamException, IntrospectionException { ClassLoader currentThreadClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader loader = new URLClassLoader(new URL[] { jarFile.toURI().toURL() }, currentThreadClassLoader); JarFile jar = new JarFile(jarFile); Enumeration<JarEntry> enumeration = jar.entries(); while (enumeration.hasMoreElements()) { JarEntry jarEntry = enumeration.nextElement(); if (!jarEntry.isDirectory() && jarEntry.getName().endsWith(".class")) { addClass(loader, jarEntry, writer, mapClassMethods); } } jar.close(); }
java
private void addClasses(XMLStreamWriter writer, File jarFile, boolean mapClassMethods) throws IOException, ClassNotFoundException, XMLStreamException, IntrospectionException { ClassLoader currentThreadClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader loader = new URLClassLoader(new URL[] { jarFile.toURI().toURL() }, currentThreadClassLoader); JarFile jar = new JarFile(jarFile); Enumeration<JarEntry> enumeration = jar.entries(); while (enumeration.hasMoreElements()) { JarEntry jarEntry = enumeration.nextElement(); if (!jarEntry.isDirectory() && jarEntry.getName().endsWith(".class")) { addClass(loader, jarEntry, writer, mapClassMethods); } } jar.close(); }
[ "private", "void", "addClasses", "(", "XMLStreamWriter", "writer", ",", "File", "jarFile", ",", "boolean", "mapClassMethods", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "XMLStreamException", ",", "IntrospectionException", "{", "ClassLoader", "curr...
Add classes to the map file. @param writer XML stream writer @param jarFile jar file @param mapClassMethods true if we want to produce .Net style class method names @throws IOException @throws ClassNotFoundException @throws XMLStreamException @throws IntrospectionException
[ "Add", "classes", "to", "the", "map", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L145-L165
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/PropertyMap.java
PropertyMap.getInteger
public Integer getInteger(String key, Integer def) { String value = getString(key); if (value == null) { return def; } else { try { return Integer.valueOf(value); } catch (NumberFormatException e) { } return def; } }
java
public Integer getInteger(String key, Integer def) { String value = getString(key); if (value == null) { return def; } else { try { return Integer.valueOf(value); } catch (NumberFormatException e) { } return def; } }
[ "public", "Integer", "getInteger", "(", "String", "key", ",", "Integer", "def", ")", "{", "String", "value", "=", "getString", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "def", ";", "}", "else", "{", "try", "{", "re...
Returns the default value if the given key isn't in this PropertyMap or it isn't a valid integer. @param key Key of property to read @param def Default value
[ "Returns", "the", "default", "value", "if", "the", "given", "key", "isn", "t", "in", "this", "PropertyMap", "or", "it", "isn", "t", "a", "valid", "integer", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/PropertyMap.java#L312-L325
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java
CommerceNotificationTemplatePersistenceImpl.removeByG_E
@Override public void removeByG_E(long groupId, boolean enabled) { for (CommerceNotificationTemplate commerceNotificationTemplate : findByG_E( groupId, enabled, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceNotificationTemplate); } }
java
@Override public void removeByG_E(long groupId, boolean enabled) { for (CommerceNotificationTemplate commerceNotificationTemplate : findByG_E( groupId, enabled, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceNotificationTemplate); } }
[ "@", "Override", "public", "void", "removeByG_E", "(", "long", "groupId", ",", "boolean", "enabled", ")", "{", "for", "(", "CommerceNotificationTemplate", "commerceNotificationTemplate", ":", "findByG_E", "(", "groupId", ",", "enabled", ",", "QueryUtil", ".", "ALL...
Removes all the commerce notification templates where groupId = &#63; and enabled = &#63; from the database. @param groupId the group ID @param enabled the enabled
[ "Removes", "all", "the", "commerce", "notification", "templates", "where", "groupId", "=", "&#63", ";", "and", "enabled", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L3227-L3233
alkacon/opencms-core
src/org/opencms/loader/CmsTemplateContextManager.java
CmsTemplateContextManager.getTemplateContextProvider
public I_CmsTemplateContextProvider getTemplateContextProvider(CmsObject cms, String path) throws CmsException { CmsResource resource = cms.readResource(path); I_CmsResourceLoader loader = OpenCms.getResourceManager().getLoader(resource); if (loader instanceof A_CmsXmlDocumentLoader) { String propertyName = ((A_CmsXmlDocumentLoader)loader).getTemplatePropertyDefinition(); List<CmsProperty> properties = cms.readPropertyObjects(resource, true); CmsProperty property = CmsProperty.get(propertyName, properties); if ((property != null) && !property.isNullProperty()) { String propertyValue = property.getValue(); if (CmsTemplateContextManager.hasPropertyPrefix(propertyValue)) { return getTemplateContextProvider(removePropertyPrefix(propertyValue)); } } return null; } else { return null; } }
java
public I_CmsTemplateContextProvider getTemplateContextProvider(CmsObject cms, String path) throws CmsException { CmsResource resource = cms.readResource(path); I_CmsResourceLoader loader = OpenCms.getResourceManager().getLoader(resource); if (loader instanceof A_CmsXmlDocumentLoader) { String propertyName = ((A_CmsXmlDocumentLoader)loader).getTemplatePropertyDefinition(); List<CmsProperty> properties = cms.readPropertyObjects(resource, true); CmsProperty property = CmsProperty.get(propertyName, properties); if ((property != null) && !property.isNullProperty()) { String propertyValue = property.getValue(); if (CmsTemplateContextManager.hasPropertyPrefix(propertyValue)) { return getTemplateContextProvider(removePropertyPrefix(propertyValue)); } } return null; } else { return null; } }
[ "public", "I_CmsTemplateContextProvider", "getTemplateContextProvider", "(", "CmsObject", "cms", ",", "String", "path", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "cms", ".", "readResource", "(", "path", ")", ";", "I_CmsResourceLoader", "loade...
Gets the template context provider for a given path.<p> @param cms the current CMS context @param path the path for which the template context provider should be determined @return the template context provider for the given path @throws CmsException if something goes wrong
[ "Gets", "the", "template", "context", "provider", "for", "a", "given", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsTemplateContextManager.java#L262-L280
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.vps_serviceName_upgrade_duration_POST
public OvhOrder vps_serviceName_upgrade_duration_POST(String serviceName, String duration, String model) throws IOException { String qPath = "/order/vps/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "model", model); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder vps_serviceName_upgrade_duration_POST(String serviceName, String duration, String model) throws IOException { String qPath = "/order/vps/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "model", model); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "vps_serviceName_upgrade_duration_POST", "(", "String", "serviceName", ",", "String", "duration", ",", "String", "model", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/vps/{serviceName}/upgrade/{duration}\"", ";", "StringBuilder"...
Create order REST: POST /order/vps/{serviceName}/upgrade/{duration} @param model [required] Model @param serviceName [required] The internal name of your VPS offer @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3485-L3492
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java
NetworkConfig.getPeerAdmin
public UserInfo getPeerAdmin(String orgName) throws NetworkConfigurationException { OrgInfo org = getOrganizationInfo(orgName); if (org == null) { throw new NetworkConfigurationException(format("Organization %s is not defined", orgName)); } return org.getPeerAdmin(); }
java
public UserInfo getPeerAdmin(String orgName) throws NetworkConfigurationException { OrgInfo org = getOrganizationInfo(orgName); if (org == null) { throw new NetworkConfigurationException(format("Organization %s is not defined", orgName)); } return org.getPeerAdmin(); }
[ "public", "UserInfo", "getPeerAdmin", "(", "String", "orgName", ")", "throws", "NetworkConfigurationException", "{", "OrgInfo", "org", "=", "getOrganizationInfo", "(", "orgName", ")", ";", "if", "(", "org", "==", "null", ")", "{", "throw", "new", "NetworkConfigu...
Returns the admin user associated with the specified organization @param orgName The name of the organization @return The admin user details @throws NetworkConfigurationException
[ "Returns", "the", "admin", "user", "associated", "with", "the", "specified", "organization" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java#L427-L435
skuzzle/semantic-version
src/main/java/de/skuzzle/semantic/Version.java
Version.min
public static Version min(Version v1, Version v2) { require(v1 != null, "v1 is null"); require(v2 != null, "v2 is null"); return compare(v1, v2, false) <= 0 ? v1 : v2; }
java
public static Version min(Version v1, Version v2) { require(v1 != null, "v1 is null"); require(v2 != null, "v2 is null"); return compare(v1, v2, false) <= 0 ? v1 : v2; }
[ "public", "static", "Version", "min", "(", "Version", "v1", ",", "Version", "v2", ")", "{", "require", "(", "v1", "!=", "null", ",", "\"v1 is null\"", ")", ";", "require", "(", "v2", "!=", "null", ",", "\"v2 is null\"", ")", ";", "return", "compare", "...
Returns the lower of the two given versions by comparing them using their natural ordering. If both versions are equal, then the first argument is returned. @param v1 The first version. @param v2 The second version. @return The lower version. @throws IllegalArgumentException If either argument is <code>null</code>. @since 0.4.0
[ "Returns", "the", "lower", "of", "the", "two", "given", "versions", "by", "comparing", "them", "using", "their", "natural", "ordering", ".", "If", "both", "versions", "are", "equal", "then", "the", "first", "argument", "is", "returned", "." ]
train
https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L1066-L1072
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java
BackupLongTermRetentionVaultsInner.getAsync
public Observable<BackupLongTermRetentionVaultInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<BackupLongTermRetentionVaultInner>, BackupLongTermRetentionVaultInner>() { @Override public BackupLongTermRetentionVaultInner call(ServiceResponse<BackupLongTermRetentionVaultInner> response) { return response.body(); } }); }
java
public Observable<BackupLongTermRetentionVaultInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<BackupLongTermRetentionVaultInner>, BackupLongTermRetentionVaultInner>() { @Override public BackupLongTermRetentionVaultInner call(ServiceResponse<BackupLongTermRetentionVaultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BackupLongTermRetentionVaultInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "n...
Gets a server backup long term retention vault. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackupLongTermRetentionVaultInner object
[ "Gets", "a", "server", "backup", "long", "term", "retention", "vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java#L110-L117
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getReadableChannel
public ReadableGridFileChannel getReadableChannel(String pathname) throws FileNotFoundException { GridFile file = (GridFile) getFile(pathname); checkFileIsReadable(file); return new ReadableGridFileChannel(file, data); }
java
public ReadableGridFileChannel getReadableChannel(String pathname) throws FileNotFoundException { GridFile file = (GridFile) getFile(pathname); checkFileIsReadable(file); return new ReadableGridFileChannel(file, data); }
[ "public", "ReadableGridFileChannel", "getReadableChannel", "(", "String", "pathname", ")", "throws", "FileNotFoundException", "{", "GridFile", "file", "=", "(", "GridFile", ")", "getFile", "(", "pathname", ")", ";", "checkFileIsReadable", "(", "file", ")", ";", "r...
Opens a ReadableGridFileChannel for reading from the file denoted by the given file path. One of the benefits of using a channel over an InputStream is the possibility to randomly seek to any position in the file (see #ReadableGridChannel.position()). @param pathname path of the file to open for reading @return a ReadableGridFileChannel for reading from the file @throws FileNotFoundException if the file does not exist or is a directory
[ "Opens", "a", "ReadableGridFileChannel", "for", "reading", "from", "the", "file", "denoted", "by", "the", "given", "file", "path", ".", "One", "of", "the", "benefits", "of", "using", "a", "channel", "over", "an", "InputStream", "is", "the", "possibility", "t...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L189-L193
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
AbstractDefinitionDeployer.getNextVersion
protected int getNextVersion(DeploymentEntity deployment, DefinitionEntity newDefinition, DefinitionEntity latestDefinition) { int result = 1; if (latestDefinition != null) { int latestVersion = latestDefinition.getVersion(); result = latestVersion + 1; } return result; }
java
protected int getNextVersion(DeploymentEntity deployment, DefinitionEntity newDefinition, DefinitionEntity latestDefinition) { int result = 1; if (latestDefinition != null) { int latestVersion = latestDefinition.getVersion(); result = latestVersion + 1; } return result; }
[ "protected", "int", "getNextVersion", "(", "DeploymentEntity", "deployment", ",", "DefinitionEntity", "newDefinition", ",", "DefinitionEntity", "latestDefinition", ")", "{", "int", "result", "=", "1", ";", "if", "(", "latestDefinition", "!=", "null", ")", "{", "in...
per default we increment the latest definition version by one - but you might want to hook in some own logic here, e.g. to align definition versions with deployment / build versions.
[ "per", "default", "we", "increment", "the", "latest", "definition", "version", "by", "one", "-", "but", "you", "might", "want", "to", "hook", "in", "some", "own", "logic", "here", "e", ".", "g", ".", "to", "align", "definition", "versions", "with", "depl...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java#L322-L329
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Base.java
Base.setAttribute
public void setAttribute(String name, String value, String facet) throws JspException { boolean error = false; // validate the name attribute, in the case of an error simply return. if (name == null || name.length() <= 0) { String s = Bundle.getString("Tags_AttributeNameNotSet"); registerTagError(s, null); error = true; } if (facet != null) { String s = Bundle.getString("Tags_AttributeFacetNotSupported", new Object[]{facet}); registerTagError(s, null); error = true; } // it's not legal to set the href attributes this way if (name != null && name.equals(HREF)) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); registerTagError(s, null); error = true; } if (error) return; // set the state variables that will override the tag settings... if (name.equals(TARGET)) { _state.target = value; return; } _state.registerAttribute(AbstractAttributeState.ATTR_GENERAL, name, value); }
java
public void setAttribute(String name, String value, String facet) throws JspException { boolean error = false; // validate the name attribute, in the case of an error simply return. if (name == null || name.length() <= 0) { String s = Bundle.getString("Tags_AttributeNameNotSet"); registerTagError(s, null); error = true; } if (facet != null) { String s = Bundle.getString("Tags_AttributeFacetNotSupported", new Object[]{facet}); registerTagError(s, null); error = true; } // it's not legal to set the href attributes this way if (name != null && name.equals(HREF)) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); registerTagError(s, null); error = true; } if (error) return; // set the state variables that will override the tag settings... if (name.equals(TARGET)) { _state.target = value; return; } _state.registerAttribute(AbstractAttributeState.ATTR_GENERAL, name, value); }
[ "public", "void", "setAttribute", "(", "String", "name", ",", "String", "value", ",", "String", "facet", ")", "throws", "JspException", "{", "boolean", "error", "=", "false", ";", "// validate the name attribute, in the case of an error simply return.", "if", "(", "na...
Base support for the attribute tag. The <code>href</code> may not bet set. @param name The name of the attribute. This value may not be null or the empty string. @param value The value of the attribute. This may contain an expression. @param facet The name of a facet to which the attribute will be applied. This is optional. @throws JspException A JspException may be thrown if there is an error setting the attribute.
[ "Base", "support", "for", "the", "attribute", "tag", ".", "The", "<code", ">", "href<", "/", "code", ">", "may", "not", "bet", "set", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Base.java#L84-L117
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/html/HC_Target.java
HC_Target.getFromName
@Nullable public static HC_Target getFromName (@Nonnull final String sName, @Nullable final HC_Target aDefault) { if (BLANK.getAttrValue ().equalsIgnoreCase (sName)) return BLANK; if (SELF.getAttrValue ().equalsIgnoreCase (sName)) return SELF; if (PARENT.getAttrValue ().equalsIgnoreCase (sName)) return PARENT; if (TOP.getAttrValue ().equalsIgnoreCase (sName)) return TOP; return aDefault; }
java
@Nullable public static HC_Target getFromName (@Nonnull final String sName, @Nullable final HC_Target aDefault) { if (BLANK.getAttrValue ().equalsIgnoreCase (sName)) return BLANK; if (SELF.getAttrValue ().equalsIgnoreCase (sName)) return SELF; if (PARENT.getAttrValue ().equalsIgnoreCase (sName)) return PARENT; if (TOP.getAttrValue ().equalsIgnoreCase (sName)) return TOP; return aDefault; }
[ "@", "Nullable", "public", "static", "HC_Target", "getFromName", "(", "@", "Nonnull", "final", "String", "sName", ",", "@", "Nullable", "final", "HC_Target", "aDefault", ")", "{", "if", "(", "BLANK", ".", "getAttrValue", "(", ")", ".", "equalsIgnoreCase", "(...
Try to find one of the default targets by name. The name comparison is performed case insensitive. @param sName The name to check. May not be <code>null</code>. @param aDefault The default value to be returned in case the name was never found. May be <code>null</code>. @return The constant link target representing the name or the default value. May be <code>null</code> if the passed default value is <code>null</code> and the name was not found.
[ "Try", "to", "find", "one", "of", "the", "default", "targets", "by", "name", ".", "The", "name", "comparison", "is", "performed", "case", "insensitive", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/html/HC_Target.java#L102-L114
samskivert/pythagoras
src/main/java/pythagoras/d/Vectors.java
Vectors.epsilonEquals
public static boolean epsilonEquals (IVector v1, IVector v2) { return epsilonEquals(v1, v2, MathUtil.EPSILON); }
java
public static boolean epsilonEquals (IVector v1, IVector v2) { return epsilonEquals(v1, v2, MathUtil.EPSILON); }
[ "public", "static", "boolean", "epsilonEquals", "(", "IVector", "v1", ",", "IVector", "v2", ")", "{", "return", "epsilonEquals", "(", "v1", ",", "v2", ",", "MathUtil", ".", "EPSILON", ")", ";", "}" ]
Returns true if the supplied vectors' x and y components are equal to one another within {@link MathUtil#EPSILON}.
[ "Returns", "true", "if", "the", "supplied", "vectors", "x", "and", "y", "components", "are", "equal", "to", "one", "another", "within", "{" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Vectors.java#L83-L85
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/Utils.java
Utils.getReturnTypeDescriptor
public static ReturnType getReturnTypeDescriptor(String methodDescriptor) { int index = methodDescriptor.indexOf(')') + 1; if (methodDescriptor.charAt(index) == 'L') { return new ReturnType(methodDescriptor.substring(index + 1, methodDescriptor.length() - 1), Kind.REFERENCE); } else { return new ReturnType(methodDescriptor.substring(index), methodDescriptor.charAt(index) == '[' ? Kind.ARRAY : Kind.PRIMITIVE); } }
java
public static ReturnType getReturnTypeDescriptor(String methodDescriptor) { int index = methodDescriptor.indexOf(')') + 1; if (methodDescriptor.charAt(index) == 'L') { return new ReturnType(methodDescriptor.substring(index + 1, methodDescriptor.length() - 1), Kind.REFERENCE); } else { return new ReturnType(methodDescriptor.substring(index), methodDescriptor.charAt(index) == '[' ? Kind.ARRAY : Kind.PRIMITIVE); } }
[ "public", "static", "ReturnType", "getReturnTypeDescriptor", "(", "String", "methodDescriptor", ")", "{", "int", "index", "=", "methodDescriptor", ".", "indexOf", "(", "'", "'", ")", "+", "1", ";", "if", "(", "methodDescriptor", ".", "charAt", "(", "index", ...
Discover the descriptor for the return type. It may be a primitive (so one char) or a reference type (so a/b/c, with no 'L' or ';') or it may be an array descriptor ([Ljava/lang/String;). @param methodDescriptor method descriptor @return return type descriptor (with any 'L' or ';' trimmed off)
[ "Discover", "the", "descriptor", "for", "the", "return", "type", ".", "It", "may", "be", "a", "primitive", "(", "so", "one", "char", ")", "or", "a", "reference", "type", "(", "so", "a", "/", "b", "/", "c", "with", "no", "L", "or", ";", ")", "or",...
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L919-L928
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java
BasicEvaluationCtx.getActionAttribute
public EvaluationResult getActionAttribute(URI type, URI id, URI issuer) { return getGenericAttributes(type, id, issuer, actionMap, null, AttributeDesignator.ACTION_TARGET); }
java
public EvaluationResult getActionAttribute(URI type, URI id, URI issuer) { return getGenericAttributes(type, id, issuer, actionMap, null, AttributeDesignator.ACTION_TARGET); }
[ "public", "EvaluationResult", "getActionAttribute", "(", "URI", "type", ",", "URI", "id", ",", "URI", "issuer", ")", "{", "return", "getGenericAttributes", "(", "type", ",", "id", ",", "issuer", ",", "actionMap", ",", "null", ",", "AttributeDesignator", ".", ...
Returns attribute value(s) from the action section of the request. @param type the type of the attribute value(s) to find @param id the id of the attribute value(s) to find @param issuer the issuer of the attribute value(s) to find or null @return a result containing a bag either empty because no values were found or containing at least one value, or status associated with an Indeterminate result
[ "Returns", "attribute", "value", "(", "s", ")", "from", "the", "action", "section", "of", "the", "request", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java#L603-L606
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java
ViewUtils.setText
public static void setText(View parentView, int field, String text) { View view = parentView.findViewById(field); if (view instanceof TextView) { ((TextView) view).setText(text); } else { Log.e("Caffeine", "ViewUtils.setText() given a field that is not a TextView"); } }
java
public static void setText(View parentView, int field, String text) { View view = parentView.findViewById(field); if (view instanceof TextView) { ((TextView) view).setText(text); } else { Log.e("Caffeine", "ViewUtils.setText() given a field that is not a TextView"); } }
[ "public", "static", "void", "setText", "(", "View", "parentView", ",", "int", "field", ",", "String", "text", ")", "{", "View", "view", "=", "parentView", ".", "findViewById", "(", "field", ")", ";", "if", "(", "view", "instanceof", "TextView", ")", "{",...
Method used to set text for a TextView. @param parentView The View used to call findViewId() on. @param field R.id.xxxx value for the text field. @param text Text to place in the text field.
[ "Method", "used", "to", "set", "text", "for", "a", "TextView", "." ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L217-L224
igniterealtime/Smack
smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java
EnhancedDebugger.addReadPacketToTable
private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { String messageType; Jid from; String stanzaId; if (packet instanceof Stanza) { Stanza stanza = (Stanza) packet; from = stanza.getFrom(); stanzaId = stanza.getStanzaId(); } else { from = null; stanzaId = "(Nonza)"; } String type = ""; Icon packetTypeIcon; receivedPackets++; if (packet instanceof IQ) { packetTypeIcon = iqPacketIcon; messageType = "IQ Received (class=" + packet.getClass().getName() + ")"; type = ((IQ) packet).getType().toString(); receivedIQPackets++; } else if (packet instanceof Message) { packetTypeIcon = messagePacketIcon; messageType = "Message Received"; type = ((Message) packet).getType().toString(); receivedMessagePackets++; } else if (packet instanceof Presence) { packetTypeIcon = presencePacketIcon; messageType = "Presence Received"; type = ((Presence) packet).getType().toString(); receivedPresencePackets++; } else { packetTypeIcon = unknownPacketTypeIcon; messageType = packet.getClass().getName() + " Received"; receivedOtherPackets++; } // Check if we need to remove old rows from the table to keep memory consumption low if (EnhancedDebuggerWindow.MAX_TABLE_ROWS > 0 && messagesTable.getRowCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) { messagesTable.removeRow(0); } messagesTable.addRow( new Object[] { XmlUtil.prettyFormatXml(packet.toXML().toString()), dateFormatter.format(new Date()), packetReceivedIcon, packetTypeIcon, messageType, stanzaId, type, "", from}); // Update the statistics table updateStatistics(); } }); }
java
private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { String messageType; Jid from; String stanzaId; if (packet instanceof Stanza) { Stanza stanza = (Stanza) packet; from = stanza.getFrom(); stanzaId = stanza.getStanzaId(); } else { from = null; stanzaId = "(Nonza)"; } String type = ""; Icon packetTypeIcon; receivedPackets++; if (packet instanceof IQ) { packetTypeIcon = iqPacketIcon; messageType = "IQ Received (class=" + packet.getClass().getName() + ")"; type = ((IQ) packet).getType().toString(); receivedIQPackets++; } else if (packet instanceof Message) { packetTypeIcon = messagePacketIcon; messageType = "Message Received"; type = ((Message) packet).getType().toString(); receivedMessagePackets++; } else if (packet instanceof Presence) { packetTypeIcon = presencePacketIcon; messageType = "Presence Received"; type = ((Presence) packet).getType().toString(); receivedPresencePackets++; } else { packetTypeIcon = unknownPacketTypeIcon; messageType = packet.getClass().getName() + " Received"; receivedOtherPackets++; } // Check if we need to remove old rows from the table to keep memory consumption low if (EnhancedDebuggerWindow.MAX_TABLE_ROWS > 0 && messagesTable.getRowCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) { messagesTable.removeRow(0); } messagesTable.addRow( new Object[] { XmlUtil.prettyFormatXml(packet.toXML().toString()), dateFormatter.format(new Date()), packetReceivedIcon, packetTypeIcon, messageType, stanzaId, type, "", from}); // Update the statistics table updateStatistics(); } }); }
[ "private", "void", "addReadPacketToTable", "(", "final", "SimpleDateFormat", "dateFormatter", ",", "final", "TopLevelStreamElement", "packet", ")", "{", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", ...
Adds the received stanza detail to the messages table. @param dateFormatter the SimpleDateFormat to use to format Dates @param packet the read stanza to add to the table
[ "Adds", "the", "received", "stanza", "detail", "to", "the", "messages", "table", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java#L764-L827
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateOfMonthsBack
public static Date getDateOfMonthsBack(final int monthsBack, final Date date) { return dateBack(Calendar.MONTH, monthsBack, date); }
java
public static Date getDateOfMonthsBack(final int monthsBack, final Date date) { return dateBack(Calendar.MONTH, monthsBack, date); }
[ "public", "static", "Date", "getDateOfMonthsBack", "(", "final", "int", "monthsBack", ",", "final", "Date", "date", ")", "{", "return", "dateBack", "(", "Calendar", ".", "MONTH", ",", "monthsBack", ",", "date", ")", ";", "}" ]
Get specify months back from given date. @param monthsBack how many months want to be back. @param date date to be handled. @return a new Date object.
[ "Get", "specify", "months", "back", "from", "given", "date", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L209-L212
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/security/csiv2/config/css/CommonClientCfg.java
CommonClientCfg.populateSecMechList
private void populateSecMechList(CSSCompoundSecMechListConfig mechListConfig, List<LayersData> layersList) throws Exception { for (LayersData mech : layersList) { for (CSSCompoundSecMechConfig cssCompoundSecMechConfig : extractCompoundSecMech(mech)) { mechListConfig.add(cssCompoundSecMechConfig); } } }
java
private void populateSecMechList(CSSCompoundSecMechListConfig mechListConfig, List<LayersData> layersList) throws Exception { for (LayersData mech : layersList) { for (CSSCompoundSecMechConfig cssCompoundSecMechConfig : extractCompoundSecMech(mech)) { mechListConfig.add(cssCompoundSecMechConfig); } } }
[ "private", "void", "populateSecMechList", "(", "CSSCompoundSecMechListConfig", "mechListConfig", ",", "List", "<", "LayersData", ">", "layersList", ")", "throws", "Exception", "{", "for", "(", "LayersData", "mech", ":", "layersList", ")", "{", "for", "(", "CSSComp...
/* Iterate through each of the "layers" elements to add compound sec mechs to the compound sec mech list.
[ "/", "*", "Iterate", "through", "each", "of", "the", "layers", "elements", "to", "add", "compound", "sec", "mechs", "to", "the", "compound", "sec", "mech", "list", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/security/csiv2/config/css/CommonClientCfg.java#L87-L93
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java
UriUtils.encodeUri
@Deprecated public static String encodeUri(String uri, String encoding) throws UnsupportedEncodingException { Assert.notNull(uri, "URI must not be null"); Assert.hasLength(encoding, "Encoding must not be empty"); Matcher matcher = URI_PATTERN.matcher(uri); if (matcher.matches()) { String scheme = matcher.group(2); String authority = matcher.group(3); String userinfo = matcher.group(5); String host = matcher.group(6); String port = matcher.group(8); String path = matcher.group(9); String query = matcher.group(11); String fragment = matcher.group(13); return encodeUriComponents(scheme, authority, userinfo, host, port, path, query, fragment, encoding); } else { throw new IllegalArgumentException("[" + uri + "] is not a valid URI"); } }
java
@Deprecated public static String encodeUri(String uri, String encoding) throws UnsupportedEncodingException { Assert.notNull(uri, "URI must not be null"); Assert.hasLength(encoding, "Encoding must not be empty"); Matcher matcher = URI_PATTERN.matcher(uri); if (matcher.matches()) { String scheme = matcher.group(2); String authority = matcher.group(3); String userinfo = matcher.group(5); String host = matcher.group(6); String port = matcher.group(8); String path = matcher.group(9); String query = matcher.group(11); String fragment = matcher.group(13); return encodeUriComponents(scheme, authority, userinfo, host, port, path, query, fragment, encoding); } else { throw new IllegalArgumentException("[" + uri + "] is not a valid URI"); } }
[ "@", "Deprecated", "public", "static", "String", "encodeUri", "(", "String", "uri", ",", "String", "encoding", ")", "throws", "UnsupportedEncodingException", "{", "Assert", ".", "notNull", "(", "uri", ",", "\"URI must not be null\"", ")", ";", "Assert", ".", "ha...
Encodes the given source URI into an encoded String. All various URI components are encoded according to their respective valid character sets. <p><strong>Note</strong> that this method does not attempt to encode "=" and "&" characters in query parameter names and query parameter values because they cannot be parsed in a reliable way. Instead use: <pre class="code"> UriComponents uriComponents = UriComponentsBuilder.fromUri("/path?name={value}").buildAndExpand("a=b"); String encodedUri = uriComponents.encode().toUriString(); </pre> @param uri the URI to be encoded @param encoding the character encoding to encode to @return the encoded URI @throws IllegalArgumentException when the given uri parameter is not a valid URI @throws UnsupportedEncodingException when the given encoding parameter is not supported @deprecated in favor of {@link UriComponentsBuilder}; see note about query param encoding
[ "Encodes", "the", "given", "source", "URI", "into", "an", "encoded", "String", ".", "All", "various", "URI", "components", "are", "encoded", "according", "to", "their", "respective", "valid", "character", "sets", ".", "<p", ">", "<strong", ">", "Note<", "/",...
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L89-L108
mgormley/prim
src/main/java/edu/jhu/prim/tuple/ComparablePair.java
ComparablePair.naturalOrder
public static <T1 extends Comparable<T1>, T2 extends Comparable<T2>> Comparator<Pair<T1, T2>> naturalOrder() { return new Comparator<Pair<T1,T2>>() { @Override public int compare(Pair<T1, T2> lhs, Pair<T1, T2> rhs) { return compareTo(lhs, rhs); } }; }
java
public static <T1 extends Comparable<T1>, T2 extends Comparable<T2>> Comparator<Pair<T1, T2>> naturalOrder() { return new Comparator<Pair<T1,T2>>() { @Override public int compare(Pair<T1, T2> lhs, Pair<T1, T2> rhs) { return compareTo(lhs, rhs); } }; }
[ "public", "static", "<", "T1", "extends", "Comparable", "<", "T1", ">", ",", "T2", "extends", "Comparable", "<", "T2", ">", ">", "Comparator", "<", "Pair", "<", "T1", ",", "T2", ">", ">", "naturalOrder", "(", ")", "{", "return", "new", "Comparator", ...
creates a natural order for pairs of comparable things @return
[ "creates", "a", "natural", "order", "for", "pairs", "of", "comparable", "things" ]
train
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/tuple/ComparablePair.java#L33-L42
VoltDB/voltdb
src/frontend/org/voltdb/parser/SQLLexer.java
SQLLexer.matchTokenFast
private static boolean matchTokenFast(char[] buffer, int position, String lowercaseToken) { if (position != 0 && isIdentifierPartFast(buffer[position - 1])) { // character at position is preceded by a letter or digit return false; } int tokenLength = lowercaseToken.length(); if (position + tokenLength > buffer.length) { // Buffer not long enough to contain token. return false; } if (position + tokenLength < buffer.length && isIdentifierPartFast(buffer[position + tokenLength])) { // Character after where token would be is a letter return false; } for (int i = 0; i < tokenLength; ++i) { char c = buffer[position + i]; if (!isLetterFast(c) || (toLowerFast(c) != lowercaseToken.charAt(i))) { return false; } } return true; }
java
private static boolean matchTokenFast(char[] buffer, int position, String lowercaseToken) { if (position != 0 && isIdentifierPartFast(buffer[position - 1])) { // character at position is preceded by a letter or digit return false; } int tokenLength = lowercaseToken.length(); if (position + tokenLength > buffer.length) { // Buffer not long enough to contain token. return false; } if (position + tokenLength < buffer.length && isIdentifierPartFast(buffer[position + tokenLength])) { // Character after where token would be is a letter return false; } for (int i = 0; i < tokenLength; ++i) { char c = buffer[position + i]; if (!isLetterFast(c) || (toLowerFast(c) != lowercaseToken.charAt(i))) { return false; } } return true; }
[ "private", "static", "boolean", "matchTokenFast", "(", "char", "[", "]", "buffer", ",", "int", "position", ",", "String", "lowercaseToken", ")", "{", "if", "(", "position", "!=", "0", "&&", "isIdentifierPartFast", "(", "buffer", "[", "position", "-", "1", ...
Quickly determine if the characters in a char array match the given token. Token must be specified in lower case, and must be all ASCII letters. Will return false if the token is preceded by alphanumeric characters--- it may be embedded in an indentifier in this case. Similar to the method matchesToken, but makes some assumptions that may enhance performance. @param buffer char array in which to look for token @param position position in char array to look for token @param lowercaseToken token to look for, must be all lowercase ASCII characters @return true if the token is found, and false otherwise
[ "Quickly", "determine", "if", "the", "characters", "in", "a", "char", "array", "match", "the", "given", "token", ".", "Token", "must", "be", "specified", "in", "lower", "case", "and", "must", "be", "all", "ASCII", "letters", ".", "Will", "return", "false",...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/parser/SQLLexer.java#L360-L385
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/graph/WeightedLinkClustering.java
WeightedLinkClustering.getVertexWeightVector
private <E extends WeightedEdge> SparseDoubleVector getVertexWeightVector( WeightedGraph<E> g, int vertex) { if (keepWeightVectors) { SparseDoubleVector weightVec = vertexToWeightVector.get(vertex); if (weightVec == null) { synchronized(this) { weightVec = vertexToWeightVector.get(vertex); if (weightVec == null) { weightVec = computeWeightVector(g, vertex); vertexToWeightVector.put(vertex, weightVec); } } } return weightVec; } else return computeWeightVector(g, vertex); }
java
private <E extends WeightedEdge> SparseDoubleVector getVertexWeightVector( WeightedGraph<E> g, int vertex) { if (keepWeightVectors) { SparseDoubleVector weightVec = vertexToWeightVector.get(vertex); if (weightVec == null) { synchronized(this) { weightVec = vertexToWeightVector.get(vertex); if (weightVec == null) { weightVec = computeWeightVector(g, vertex); vertexToWeightVector.put(vertex, weightVec); } } } return weightVec; } else return computeWeightVector(g, vertex); }
[ "private", "<", "E", "extends", "WeightedEdge", ">", "SparseDoubleVector", "getVertexWeightVector", "(", "WeightedGraph", "<", "E", ">", "g", ",", "int", "vertex", ")", "{", "if", "(", "keepWeightVectors", ")", "{", "SparseDoubleVector", "weightVec", "=", "verte...
Returns the normalized weight vector for the specified row, to be used in edge comparisons. The weight vector is normalized by the number of edges from the row with positive weights and includes a weight for the row to itself, which reflects the similarity of the keystone nod.
[ "Returns", "the", "normalized", "weight", "vector", "for", "the", "specified", "row", "to", "be", "used", "in", "edge", "comparisons", ".", "The", "weight", "vector", "is", "normalized", "by", "the", "number", "of", "edges", "from", "the", "row", "with", "...
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/graph/WeightedLinkClustering.java#L107-L124
skuzzle/semantic-version
src/main/java/de/skuzzle/semantic/Version.java
Version.max
public static Version max(Version v1, Version v2) { require(v1 != null, "v1 is null"); require(v2 != null, "v2 is null"); return compare(v1, v2, false) < 0 ? v2 : v1; }
java
public static Version max(Version v1, Version v2) { require(v1 != null, "v1 is null"); require(v2 != null, "v2 is null"); return compare(v1, v2, false) < 0 ? v2 : v1; }
[ "public", "static", "Version", "max", "(", "Version", "v1", ",", "Version", "v2", ")", "{", "require", "(", "v1", "!=", "null", ",", "\"v1 is null\"", ")", ";", "require", "(", "v2", "!=", "null", ",", "\"v2 is null\"", ")", ";", "return", "compare", "...
Returns the greater of the two given versions by comparing them using their natural ordering. If both versions are equal, then the first argument is returned. @param v1 The first version. @param v2 The second version. @return The greater version. @throws IllegalArgumentException If either argument is <code>null</code>. @since 0.4.0
[ "Returns", "the", "greater", "of", "the", "two", "given", "versions", "by", "comparing", "them", "using", "their", "natural", "ordering", ".", "If", "both", "versions", "are", "equal", "then", "the", "first", "argument", "is", "returned", "." ]
train
https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L1048-L1054
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.toUnique
public static <T> Collection<T> toUnique(Iterable<T> self) { return toUnique(self, (Comparator<T>) null); }
java
public static <T> Collection<T> toUnique(Iterable<T> self) { return toUnique(self, (Comparator<T>) null); }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "toUnique", "(", "Iterable", "<", "T", ">", "self", ")", "{", "return", "toUnique", "(", "self", ",", "(", "Comparator", "<", "T", ">", ")", "null", ")", ";", "}" ]
Returns a Collection containing the items from the Iterable but with duplicates removed using the natural ordering of the items to determine uniqueness. <p> <pre class="groovyTestCase"> String[] letters = ['c', 'a', 't', 's', 'a', 't', 'h', 'a', 't'] String[] expected = ['c', 'a', 't', 's', 'h'] assert letters.toUnique() == expected </pre> @param self an Iterable @return the Collection of non-duplicate items @since 2.4.0
[ "Returns", "a", "Collection", "containing", "the", "items", "from", "the", "Iterable", "but", "with", "duplicates", "removed", "using", "the", "natural", "ordering", "of", "the", "items", "to", "determine", "uniqueness", ".", "<p", ">", "<pre", "class", "=", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L1924-L1926