repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
line/armeria
core/src/main/java/com/linecorp/armeria/common/MediaType.java
MediaType.withParameters
public MediaType withParameters(Map<String, ? extends Iterable<String>> parameters) { """ <em>Replaces</em> all parameters with the given parameters. @throws IllegalArgumentException if any parameter or value is invalid """ final ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder(); for (Map.Entry<String, ? extends Iterable<String>> e : parameters.entrySet()) { final String k = e.getKey(); for (String v : e.getValue()) { builder.put(k, v); } } return create(type, subtype, builder.build()); }
java
public MediaType withParameters(Map<String, ? extends Iterable<String>> parameters) { final ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder(); for (Map.Entry<String, ? extends Iterable<String>> e : parameters.entrySet()) { final String k = e.getKey(); for (String v : e.getValue()) { builder.put(k, v); } } return create(type, subtype, builder.build()); }
[ "public", "MediaType", "withParameters", "(", "Map", "<", "String", ",", "?", "extends", "Iterable", "<", "String", ">", ">", "parameters", ")", "{", "final", "ImmutableListMultimap", ".", "Builder", "<", "String", ",", "String", ">", "builder", "=", "ImmutableListMultimap", ".", "builder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "?", "extends", "Iterable", "<", "String", ">", ">", "e", ":", "parameters", ".", "entrySet", "(", ")", ")", "{", "final", "String", "k", "=", "e", ".", "getKey", "(", ")", ";", "for", "(", "String", "v", ":", "e", ".", "getValue", "(", ")", ")", "{", "builder", ".", "put", "(", "k", ",", "v", ")", ";", "}", "}", "return", "create", "(", "type", ",", "subtype", ",", "builder", ".", "build", "(", ")", ")", ";", "}" ]
<em>Replaces</em> all parameters with the given parameters. @throws IllegalArgumentException if any parameter or value is invalid
[ "<em", ">", "Replaces<", "/", "em", ">", "all", "parameters", "with", "the", "given", "parameters", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/MediaType.java#L685-L694
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_statistics_GET
public OvhUnitAndValues<OvhTimestampAndValue> billingAccount_line_serviceName_statistics_GET(String billingAccount, String serviceName, OvhStatisticsTimeframeEnum timeframe, OvhLineStatisticsTypeEnum type) throws IOException { """ Get statistics of the current line REST: GET /telephony/{billingAccount}/line/{serviceName}/statistics @param timeframe [required] @param type [required] @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/line/{serviceName}/statistics"; StringBuilder sb = path(qPath, billingAccount, serviceName); query(sb, "timeframe", timeframe); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t10); }
java
public OvhUnitAndValues<OvhTimestampAndValue> billingAccount_line_serviceName_statistics_GET(String billingAccount, String serviceName, OvhStatisticsTimeframeEnum timeframe, OvhLineStatisticsTypeEnum type) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/statistics"; StringBuilder sb = path(qPath, billingAccount, serviceName); query(sb, "timeframe", timeframe); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t10); }
[ "public", "OvhUnitAndValues", "<", "OvhTimestampAndValue", ">", "billingAccount_line_serviceName_statistics_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhStatisticsTimeframeEnum", "timeframe", ",", "OvhLineStatisticsTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/line/{serviceName}/statistics\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"timeframe\"", ",", "timeframe", ")", ";", "query", "(", "sb", ",", "\"type\"", ",", "type", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t10", ")", ";", "}" ]
Get statistics of the current line REST: GET /telephony/{billingAccount}/line/{serviceName}/statistics @param timeframe [required] @param type [required] @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Get", "statistics", "of", "the", "current", "line" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2050-L2057
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getMovieAccountState
public MediaState getMovieAccountState(int movieId, String sessionId) throws MovieDbException { """ This method lets a user get the status of whether or not the movie has been rated or added to their favourite or movie watch list. A valid session id is required. @param movieId @param sessionId @return @throws MovieDbException """ TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); parameters.add(Param.SESSION_ID, sessionId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, MediaState.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex); } }
java
public MediaState getMovieAccountState(int movieId, String sessionId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); parameters.add(Param.SESSION_ID, sessionId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, MediaState.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex); } }
[ "public", "MediaState", "getMovieAccountState", "(", "int", "movieId", ",", "String", "sessionId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "movieId", ")", ";", "parameters", ".", "add", "(", "Param", ".", "SESSION_ID", ",", "sessionId", ")", ";", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "MOVIE", ")", ".", "subMethod", "(", "MethodSub", ".", "ACCOUNT_STATES", ")", ".", "buildUrl", "(", "parameters", ")", ";", "String", "webpage", "=", "httpTools", ".", "getRequest", "(", "url", ")", ";", "try", "{", "return", "MAPPER", ".", "readValue", "(", "webpage", ",", "MediaState", ".", "class", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "MovieDbException", "(", "ApiExceptionType", ".", "MAPPING_FAILED", ",", "\"Failed to get account state\"", ",", "url", ",", "ex", ")", ";", "}", "}" ]
This method lets a user get the status of whether or not the movie has been rated or added to their favourite or movie watch list. A valid session id is required. @param movieId @param sessionId @return @throws MovieDbException
[ "This", "method", "lets", "a", "user", "get", "the", "status", "of", "whether", "or", "not", "the", "movie", "has", "been", "rated", "or", "added", "to", "their", "favourite", "or", "movie", "watch", "list", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L153-L166
eBay/parallec
src/main/java/io/parallec/core/taskbuilder/targethosts/TargetHostsBuilderHelperCms.java
TargetHostsBuilderHelperCms.readJsonFromUrlWithCmsHeader
static JSONObject readJsonFromUrlWithCmsHeader(String url, String token) throws MalformedURLException, IOException, JSONException { """ removed header (only used for authorization for PP) 2015.08 @param url the url @return the JSON object @throws MalformedURLException the malformed url exception @throws IOException Signals that an I/O exception has occurred. @throws JSONException the JSON exception """ InputStream is = null; JSONObject jObj = new JSONObject(); try { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); con.setRequestMethod("GET"); if(token!=null){ con.setRequestProperty("Authorization", token); } con.setConnectTimeout(ParallecGlobalConfig.urlConnectionConnectTimeoutMillis); con.setReadTimeout(ParallecGlobalConfig.urlConnectionReadTimeoutMillis); is = con.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); String jsonText = PcFileNetworkIoUtils.readAll(rd); jObj = new JSONObject(jsonText); rd.close(); } catch (Exception t) { logger.error("readJsonFromUrl() exception: " + t.getLocalizedMessage() + PcDateUtils.getNowDateTimeStrStandard()); } finally { if (is != null) { is.close(); } } return jObj; }
java
static JSONObject readJsonFromUrlWithCmsHeader(String url, String token) throws MalformedURLException, IOException, JSONException { InputStream is = null; JSONObject jObj = new JSONObject(); try { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); con.setRequestMethod("GET"); if(token!=null){ con.setRequestProperty("Authorization", token); } con.setConnectTimeout(ParallecGlobalConfig.urlConnectionConnectTimeoutMillis); con.setReadTimeout(ParallecGlobalConfig.urlConnectionReadTimeoutMillis); is = con.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); String jsonText = PcFileNetworkIoUtils.readAll(rd); jObj = new JSONObject(jsonText); rd.close(); } catch (Exception t) { logger.error("readJsonFromUrl() exception: " + t.getLocalizedMessage() + PcDateUtils.getNowDateTimeStrStandard()); } finally { if (is != null) { is.close(); } } return jObj; }
[ "static", "JSONObject", "readJsonFromUrlWithCmsHeader", "(", "String", "url", ",", "String", "token", ")", "throws", "MalformedURLException", ",", "IOException", ",", "JSONException", "{", "InputStream", "is", "=", "null", ";", "JSONObject", "jObj", "=", "new", "JSONObject", "(", ")", ";", "try", "{", "HttpURLConnection", ".", "setFollowRedirects", "(", "false", ")", ";", "HttpURLConnection", "con", "=", "(", "HttpURLConnection", ")", "new", "URL", "(", "url", ")", ".", "openConnection", "(", ")", ";", "con", ".", "setRequestMethod", "(", "\"GET\"", ")", ";", "if", "(", "token", "!=", "null", ")", "{", "con", ".", "setRequestProperty", "(", "\"Authorization\"", ",", "token", ")", ";", "}", "con", ".", "setConnectTimeout", "(", "ParallecGlobalConfig", ".", "urlConnectionConnectTimeoutMillis", ")", ";", "con", ".", "setReadTimeout", "(", "ParallecGlobalConfig", ".", "urlConnectionReadTimeoutMillis", ")", ";", "is", "=", "con", ".", "getInputStream", "(", ")", ";", "BufferedReader", "rd", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "is", ",", "Charset", ".", "forName", "(", "\"UTF-8\"", ")", ")", ")", ";", "String", "jsonText", "=", "PcFileNetworkIoUtils", ".", "readAll", "(", "rd", ")", ";", "jObj", "=", "new", "JSONObject", "(", "jsonText", ")", ";", "rd", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "t", ")", "{", "logger", ".", "error", "(", "\"readJsonFromUrl() exception: \"", "+", "t", ".", "getLocalizedMessage", "(", ")", "+", "PcDateUtils", ".", "getNowDateTimeStrStandard", "(", ")", ")", ";", "}", "finally", "{", "if", "(", "is", "!=", "null", ")", "{", "is", ".", "close", "(", ")", ";", "}", "}", "return", "jObj", ";", "}" ]
removed header (only used for authorization for PP) 2015.08 @param url the url @return the JSON object @throws MalformedURLException the malformed url exception @throws IOException Signals that an I/O exception has occurred. @throws JSONException the JSON exception
[ "removed", "header", "(", "only", "used", "for", "authorization", "for", "PP", ")", "2015", ".", "08" ]
train
https://github.com/eBay/parallec/blob/1b4f1628f34fedfb06b24c33a5372d64d3df0952/src/main/java/io/parallec/core/taskbuilder/targethosts/TargetHostsBuilderHelperCms.java#L109-L143
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/components/Configurable.java
Configurable.makeComponentPrefix
protected static String makeComponentPrefix(String tokenName, String className) { """ Creates a prefix for component to search for its properties in properties. @param tokenName a component configuration key @param className a component class name @return prefix """ String simpleClassName = className; if (null != className) { int lastDotIdx = className.lastIndexOf("."); if (lastDotIdx > -1) { simpleClassName = className.substring(lastDotIdx + 1, className.length()); } } return tokenName + "." + simpleClassName + "."; }
java
protected static String makeComponentPrefix(String tokenName, String className) { String simpleClassName = className; if (null != className) { int lastDotIdx = className.lastIndexOf("."); if (lastDotIdx > -1) { simpleClassName = className.substring(lastDotIdx + 1, className.length()); } } return tokenName + "." + simpleClassName + "."; }
[ "protected", "static", "String", "makeComponentPrefix", "(", "String", "tokenName", ",", "String", "className", ")", "{", "String", "simpleClassName", "=", "className", ";", "if", "(", "null", "!=", "className", ")", "{", "int", "lastDotIdx", "=", "className", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "lastDotIdx", ">", "-", "1", ")", "{", "simpleClassName", "=", "className", ".", "substring", "(", "lastDotIdx", "+", "1", ",", "className", ".", "length", "(", ")", ")", ";", "}", "}", "return", "tokenName", "+", "\".\"", "+", "simpleClassName", "+", "\".\"", ";", "}" ]
Creates a prefix for component to search for its properties in properties. @param tokenName a component configuration key @param className a component class name @return prefix
[ "Creates", "a", "prefix", "for", "component", "to", "search", "for", "its", "properties", "in", "properties", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/components/Configurable.java#L81-L90
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyDirectLinearTransform.java
HomographyDirectLinearTransform.process
public boolean process( List<AssociatedPair> points , DMatrixRMaj foundH ) { """ <p> Computes the homography matrix given a set of observed points in two images. A set of {@link AssociatedPair} is passed in. The computed homography 'H' is found such that the attributes 'p1' and 'p2' in {@link AssociatedPair} refers to x1 and x2, respectively, in the equation below:<br> x<sub>2</sub> = H*x<sub>1</sub> </p> @param points A set of observed image points that are generated from a planar object. Minimum of 4 pairs required. @param foundH Output: Storage for the found solution. 3x3 matrix. @return True if successful. False if it failed. """ return process(points,null,null,foundH); }
java
public boolean process( List<AssociatedPair> points , DMatrixRMaj foundH ) { return process(points,null,null,foundH); }
[ "public", "boolean", "process", "(", "List", "<", "AssociatedPair", ">", "points", ",", "DMatrixRMaj", "foundH", ")", "{", "return", "process", "(", "points", ",", "null", ",", "null", ",", "foundH", ")", ";", "}" ]
<p> Computes the homography matrix given a set of observed points in two images. A set of {@link AssociatedPair} is passed in. The computed homography 'H' is found such that the attributes 'p1' and 'p2' in {@link AssociatedPair} refers to x1 and x2, respectively, in the equation below:<br> x<sub>2</sub> = H*x<sub>1</sub> </p> @param points A set of observed image points that are generated from a planar object. Minimum of 4 pairs required. @param foundH Output: Storage for the found solution. 3x3 matrix. @return True if successful. False if it failed.
[ "<p", ">", "Computes", "the", "homography", "matrix", "given", "a", "set", "of", "observed", "points", "in", "two", "images", ".", "A", "set", "of", "{", "@link", "AssociatedPair", "}", "is", "passed", "in", ".", "The", "computed", "homography", "H", "is", "found", "such", "that", "the", "attributes", "p1", "and", "p2", "in", "{", "@link", "AssociatedPair", "}", "refers", "to", "x1", "and", "x2", "respectively", "in", "the", "equation", "below", ":", "<br", ">", "x<sub", ">", "2<", "/", "sub", ">", "=", "H", "*", "x<sub", ">", "1<", "/", "sub", ">", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyDirectLinearTransform.java#L125-L127
mbrade/prefixedproperties
pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java
PrefixedPropertiesPersister.storeToYAML
public void storeToYAML(final Properties props, final OutputStream os, final String header, final String encoding) throws IOException { """ Store to json. @param props the props @param os the os @param header the header @param encoding the encoding @throws IOException Signals that an I/O exception has occurred. """ try { ((PrefixedProperties) props).storeToYAML(os, header, encoding); } catch (final ClassCastException err) { throw new IOException( "Cannot store properties JSON file - not using PrefixedProperties: " + err.getMessage()); } }
java
public void storeToYAML(final Properties props, final OutputStream os, final String header, final String encoding) throws IOException { try { ((PrefixedProperties) props).storeToYAML(os, header, encoding); } catch (final ClassCastException err) { throw new IOException( "Cannot store properties JSON file - not using PrefixedProperties: " + err.getMessage()); } }
[ "public", "void", "storeToYAML", "(", "final", "Properties", "props", ",", "final", "OutputStream", "os", ",", "final", "String", "header", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "try", "{", "(", "(", "PrefixedProperties", ")", "props", ")", ".", "storeToYAML", "(", "os", ",", "header", ",", "encoding", ")", ";", "}", "catch", "(", "final", "ClassCastException", "err", ")", "{", "throw", "new", "IOException", "(", "\"Cannot store properties JSON file - not using PrefixedProperties: \"", "+", "err", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Store to json. @param props the props @param os the os @param header the header @param encoding the encoding @throws IOException Signals that an I/O exception has occurred.
[ "Store", "to", "json", "." ]
train
https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java#L235-L243
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java
WritableUtils.writeEnum
public static void writeEnum(DataOutput out, Enum<?> enumVal) throws IOException { """ writes String value of enum to DataOutput. @param out Dataoutput stream @param enumVal enum value @throws IOException """ Text.writeString(out, enumVal.name()); }
java
public static void writeEnum(DataOutput out, Enum<?> enumVal) throws IOException { Text.writeString(out, enumVal.name()); }
[ "public", "static", "void", "writeEnum", "(", "DataOutput", "out", ",", "Enum", "<", "?", ">", "enumVal", ")", "throws", "IOException", "{", "Text", ".", "writeString", "(", "out", ",", "enumVal", ".", "name", "(", ")", ")", ";", "}" ]
writes String value of enum to DataOutput. @param out Dataoutput stream @param enumVal enum value @throws IOException
[ "writes", "String", "value", "of", "enum", "to", "DataOutput", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java#L380-L382
jlib-framework/jlib-array
src/main/java/org/jlib/array/ArrayUtility.java
ArrayUtility.flatten
@SafeVarargs public static <Item> void flatten(final Collection<? super Item> target, final Item... items) { """ Recursively appends all Items specified as a comma separated list to the specified {@link Collection}. @param <Item> type of the array items @param items comma separated sequence of Items @param target target {@link Collection} of Items """ flattenAsStream(items).forEachOrdered(target::add); }
java
@SafeVarargs public static <Item> void flatten(final Collection<? super Item> target, final Item... items) { flattenAsStream(items).forEachOrdered(target::add); }
[ "@", "SafeVarargs", "public", "static", "<", "Item", ">", "void", "flatten", "(", "final", "Collection", "<", "?", "super", "Item", ">", "target", ",", "final", "Item", "...", "items", ")", "{", "flattenAsStream", "(", "items", ")", ".", "forEachOrdered", "(", "target", "::", "add", ")", ";", "}" ]
Recursively appends all Items specified as a comma separated list to the specified {@link Collection}. @param <Item> type of the array items @param items comma separated sequence of Items @param target target {@link Collection} of Items
[ "Recursively", "appends", "all", "Items", "specified", "as", "a", "comma", "separated", "list", "to", "the", "specified", "{", "@link", "Collection", "}", "." ]
train
https://github.com/jlib-framework/jlib-array/blob/d0aa06fe95aa70fdac0d34e066fe8f883a8e855a/src/main/java/org/jlib/array/ArrayUtility.java#L144-L147
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/values/Value.java
Value.convertTo
public Value convertTo(PType to, Context ctxt) throws AnalysisException { """ Performing a dynamic type conversion. This method is usually specialized by subclasses that know how to convert themselves to other types. If they fail, they delegate the conversion up to this superclass method which deals with the special cases: unions, type parameters, optional types, bracketed types and named types. If all these also fail, the method throws a runtime dynamic type check exception - though that may be caught, for example by the union processing, as it iterates through the types in the union given, trying to convert the value. @param to The target type. @param ctxt The context in which to make the conversion. @return This value converted to the target type. @throws AnalysisException """ if (Settings.dynamictypechecks) { // In VDM++ and VDM-RT, we do not want to do thread swaps half way // through a DTC check (which can include calculating an invariant), // so we set the atomic flag around the conversion. This also stops // VDM-RT from performing "time step" calculations. Value converted; try { ctxt.threadState.setAtomic(true); converted = convertValueTo(to, ctxt); } finally { ctxt.threadState.setAtomic(false); } return converted; } else { return this; // Good luck!! } }
java
public Value convertTo(PType to, Context ctxt) throws AnalysisException { if (Settings.dynamictypechecks) { // In VDM++ and VDM-RT, we do not want to do thread swaps half way // through a DTC check (which can include calculating an invariant), // so we set the atomic flag around the conversion. This also stops // VDM-RT from performing "time step" calculations. Value converted; try { ctxt.threadState.setAtomic(true); converted = convertValueTo(to, ctxt); } finally { ctxt.threadState.setAtomic(false); } return converted; } else { return this; // Good luck!! } }
[ "public", "Value", "convertTo", "(", "PType", "to", ",", "Context", "ctxt", ")", "throws", "AnalysisException", "{", "if", "(", "Settings", ".", "dynamictypechecks", ")", "{", "// In VDM++ and VDM-RT, we do not want to do thread swaps half way", "// through a DTC check (which can include calculating an invariant),", "// so we set the atomic flag around the conversion. This also stops", "// VDM-RT from performing \"time step\" calculations.", "Value", "converted", ";", "try", "{", "ctxt", ".", "threadState", ".", "setAtomic", "(", "true", ")", ";", "converted", "=", "convertValueTo", "(", "to", ",", "ctxt", ")", ";", "}", "finally", "{", "ctxt", ".", "threadState", ".", "setAtomic", "(", "false", ")", ";", "}", "return", "converted", ";", "}", "else", "{", "return", "this", ";", "// Good luck!!", "}", "}" ]
Performing a dynamic type conversion. This method is usually specialized by subclasses that know how to convert themselves to other types. If they fail, they delegate the conversion up to this superclass method which deals with the special cases: unions, type parameters, optional types, bracketed types and named types. If all these also fail, the method throws a runtime dynamic type check exception - though that may be caught, for example by the union processing, as it iterates through the types in the union given, trying to convert the value. @param to The target type. @param ctxt The context in which to make the conversion. @return This value converted to the target type. @throws AnalysisException
[ "Performing", "a", "dynamic", "type", "conversion", ".", "This", "method", "is", "usually", "specialized", "by", "subclasses", "that", "know", "how", "to", "convert", "themselves", "to", "other", "types", ".", "If", "they", "fail", "they", "delegate", "the", "conversion", "up", "to", "this", "superclass", "method", "which", "deals", "with", "the", "special", "cases", ":", "unions", "type", "parameters", "optional", "types", "bracketed", "types", "and", "named", "types", ".", "If", "all", "these", "also", "fail", "the", "method", "throws", "a", "runtime", "dynamic", "type", "check", "exception", "-", "though", "that", "may", "be", "caught", "for", "example", "by", "the", "union", "processing", "as", "it", "iterates", "through", "the", "types", "in", "the", "union", "given", "trying", "to", "convert", "the", "value", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/values/Value.java#L165-L189
codeprimate-software/cp-elements
src/main/java/org/cp/elements/beans/AbstractBean.java
AbstractBean.compareTo
@SuppressWarnings("all") public int compareTo(Bean<ID, USER, PROCESS> obj) { """ Compares the specified Bean with this Bean to determine order. The default implementation is to order by identifier, where null identifiers are ordered before non-null identifiers. @param obj the Bean being compared with this Bean. @return an integer value indicating the relative ordering of the specified Bean with this Bean. A negative value implies this Bean logically occurs before the specified Bean. A zero value indicates the specified Bean and this Bean are comparatively equal, and a positive value indicates this Bean logically occurs after the specified Bean. @throws IllegalArgumentException if the specified Bean is not an instance of this Bean class. @see java.lang.Comparable#compareTo(Object) """ Assert.isInstanceOf(obj, getClass(), new ClassCastException(String.format( "The Bean being compared with this Bean must be an instance of %1$s!", getClass().getName()))); return ComparatorUtils.compareIgnoreNull(getId(), obj.getId()); }
java
@SuppressWarnings("all") public int compareTo(Bean<ID, USER, PROCESS> obj) { Assert.isInstanceOf(obj, getClass(), new ClassCastException(String.format( "The Bean being compared with this Bean must be an instance of %1$s!", getClass().getName()))); return ComparatorUtils.compareIgnoreNull(getId(), obj.getId()); }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "int", "compareTo", "(", "Bean", "<", "ID", ",", "USER", ",", "PROCESS", ">", "obj", ")", "{", "Assert", ".", "isInstanceOf", "(", "obj", ",", "getClass", "(", ")", ",", "new", "ClassCastException", "(", "String", ".", "format", "(", "\"The Bean being compared with this Bean must be an instance of %1$s!\"", ",", "getClass", "(", ")", ".", "getName", "(", ")", ")", ")", ")", ";", "return", "ComparatorUtils", ".", "compareIgnoreNull", "(", "getId", "(", ")", ",", "obj", ".", "getId", "(", ")", ")", ";", "}" ]
Compares the specified Bean with this Bean to determine order. The default implementation is to order by identifier, where null identifiers are ordered before non-null identifiers. @param obj the Bean being compared with this Bean. @return an integer value indicating the relative ordering of the specified Bean with this Bean. A negative value implies this Bean logically occurs before the specified Bean. A zero value indicates the specified Bean and this Bean are comparatively equal, and a positive value indicates this Bean logically occurs after the specified Bean. @throws IllegalArgumentException if the specified Bean is not an instance of this Bean class. @see java.lang.Comparable#compareTo(Object)
[ "Compares", "the", "specified", "Bean", "with", "this", "Bean", "to", "determine", "order", ".", "The", "default", "implementation", "is", "to", "order", "by", "identifier", "where", "null", "identifiers", "are", "ordered", "before", "non", "-", "null", "identifiers", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L467-L472
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.task_domain_id_argument_key_PUT
public void task_domain_id_argument_key_PUT(Long id, String key, OvhDomainTaskArgument body) throws IOException { """ Alter this object properties REST: PUT /me/task/domain/{id}/argument/{key} @param body [required] New object properties @param id [required] Id of the task @param key [required] Key of the argument """ String qPath = "/me/task/domain/{id}/argument/{key}"; StringBuilder sb = path(qPath, id, key); exec(qPath, "PUT", sb.toString(), body); }
java
public void task_domain_id_argument_key_PUT(Long id, String key, OvhDomainTaskArgument body) throws IOException { String qPath = "/me/task/domain/{id}/argument/{key}"; StringBuilder sb = path(qPath, id, key); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "task_domain_id_argument_key_PUT", "(", "Long", "id", ",", "String", "key", ",", "OvhDomainTaskArgument", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/task/domain/{id}/argument/{key}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", ",", "key", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /me/task/domain/{id}/argument/{key} @param body [required] New object properties @param id [required] Id of the task @param key [required] Key of the argument
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2389-L2393
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDs.java
LocaleIDs.findIndex
private static int findIndex(String[] array, String target) { """ linear search of the string array. the arrays are unfortunately ordered by the two-letter target code, not the three-letter search code, which seems backwards. """ for (int i = 0; i < array.length; i++) { if (target.equals(array[i])) { return i; } } return -1; }
java
private static int findIndex(String[] array, String target){ for (int i = 0; i < array.length; i++) { if (target.equals(array[i])) { return i; } } return -1; }
[ "private", "static", "int", "findIndex", "(", "String", "[", "]", "array", ",", "String", "target", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "target", ".", "equals", "(", "array", "[", "i", "]", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
linear search of the string array. the arrays are unfortunately ordered by the two-letter target code, not the three-letter search code, which seems backwards.
[ "linear", "search", "of", "the", "string", "array", ".", "the", "arrays", "are", "unfortunately", "ordered", "by", "the", "two", "-", "letter", "target", "code", "not", "the", "three", "-", "letter", "search", "code", "which", "seems", "backwards", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDs.java#L122-L129
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java
StringUtilities.lastIndexOf
public static int lastIndexOf(final String input, final char delim, final int fromIndex) { """ Gets the last index of a character starting at fromIndex. Ignoring characters that have been escaped @param input The string to be searched @param delim The character to be found @param fromIndex Start searching from this index @return The index of the found character or -1 if the character wasn't found """ if (input == null) return -1; int index = input.lastIndexOf(delim, fromIndex); while (index != -1 && index != 0) { if (input.charAt(index - 1) != '\\') break; index = input.lastIndexOf(delim, index - 1); } return index; }
java
public static int lastIndexOf(final String input, final char delim, final int fromIndex) { if (input == null) return -1; int index = input.lastIndexOf(delim, fromIndex); while (index != -1 && index != 0) { if (input.charAt(index - 1) != '\\') break; index = input.lastIndexOf(delim, index - 1); } return index; }
[ "public", "static", "int", "lastIndexOf", "(", "final", "String", "input", ",", "final", "char", "delim", ",", "final", "int", "fromIndex", ")", "{", "if", "(", "input", "==", "null", ")", "return", "-", "1", ";", "int", "index", "=", "input", ".", "lastIndexOf", "(", "delim", ",", "fromIndex", ")", ";", "while", "(", "index", "!=", "-", "1", "&&", "index", "!=", "0", ")", "{", "if", "(", "input", ".", "charAt", "(", "index", "-", "1", ")", "!=", "'", "'", ")", "break", ";", "index", "=", "input", ".", "lastIndexOf", "(", "delim", ",", "index", "-", "1", ")", ";", "}", "return", "index", ";", "}" ]
Gets the last index of a character starting at fromIndex. Ignoring characters that have been escaped @param input The string to be searched @param delim The character to be found @param fromIndex Start searching from this index @return The index of the found character or -1 if the character wasn't found
[ "Gets", "the", "last", "index", "of", "a", "character", "starting", "at", "fromIndex", ".", "Ignoring", "characters", "that", "have", "been", "escaped" ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java#L260-L268
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/TimeoutHelper.java
TimeoutHelper.callWithTimeout
public void callWithTimeout(String description, int timeout, Runnable task) { """ Calls task but ensures it ends. @param description description of task. @param timeout timeout in milliseconds. @param task task to execute. """ Future<?> callFuture = threadPool.submit(task); getWithTimeout(callFuture, timeout, description); }
java
public void callWithTimeout(String description, int timeout, Runnable task) { Future<?> callFuture = threadPool.submit(task); getWithTimeout(callFuture, timeout, description); }
[ "public", "void", "callWithTimeout", "(", "String", "description", ",", "int", "timeout", ",", "Runnable", "task", ")", "{", "Future", "<", "?", ">", "callFuture", "=", "threadPool", ".", "submit", "(", "task", ")", ";", "getWithTimeout", "(", "callFuture", ",", "timeout", ",", "description", ")", ";", "}" ]
Calls task but ensures it ends. @param description description of task. @param timeout timeout in milliseconds. @param task task to execute.
[ "Calls", "task", "but", "ensures", "it", "ends", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/TimeoutHelper.java#L36-L39
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java
BigDecimalMath.tanh
public static BigDecimal tanh(BigDecimal x, MathContext mathContext) { """ Calculates the hyperbolic tangens of {@link BigDecimal} x. <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p> @param x the {@link BigDecimal} to calculate the hyperbolic tangens for @param mathContext the {@link MathContext} used for the result @return the calculated hyperbolic tangens {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision """ checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); BigDecimal result = sinh(x, mc).divide(cosh(x, mc), mc); return round(result, mathContext); }
java
public static BigDecimal tanh(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); BigDecimal result = sinh(x, mc).divide(cosh(x, mc), mc); return round(result, mathContext); }
[ "public", "static", "BigDecimal", "tanh", "(", "BigDecimal", "x", ",", "MathContext", "mathContext", ")", "{", "checkMathContext", "(", "mathContext", ")", ";", "MathContext", "mc", "=", "new", "MathContext", "(", "mathContext", ".", "getPrecision", "(", ")", "+", "6", ",", "mathContext", ".", "getRoundingMode", "(", ")", ")", ";", "BigDecimal", "result", "=", "sinh", "(", "x", ",", "mc", ")", ".", "divide", "(", "cosh", "(", "x", ",", "mc", ")", ",", "mc", ")", ";", "return", "round", "(", "result", ",", "mathContext", ")", ";", "}" ]
Calculates the hyperbolic tangens of {@link BigDecimal} x. <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p> @param x the {@link BigDecimal} to calculate the hyperbolic tangens for @param mathContext the {@link MathContext} used for the result @return the calculated hyperbolic tangens {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision
[ "Calculates", "the", "hyperbolic", "tangens", "of", "{", "@link", "BigDecimal", "}", "x", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1567-L1572
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/ArrayLabelSetterFactory.java
ArrayLabelSetterFactory.createField
private Optional<ArrayLabelSetter> createField(final Class<?> beanClass, final String fieldName) { """ フィールドによるラベル情報を格納する場合。 <p>{@code <フィールド名> + Label}のメソッド名</p> @param beanClass フィールドが定義してあるクラスのインスタンス @param fieldName フィールド名 @return ラベル情報の設定用クラス """ final String labelFieldName = fieldName + "Label"; final Field labelField; try { labelField = beanClass.getDeclaredField(labelFieldName); labelField.setAccessible(true); } catch (NoSuchFieldException | SecurityException e) { return Optional.empty(); } if(!List.class.isAssignableFrom(labelField.getType())) { return Optional.empty(); } final ParameterizedType type = (ParameterizedType) labelField.getGenericType(); final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[0]; if(valueType.equals(String.class)) { return Optional.of(new ArrayLabelSetter() { @SuppressWarnings("unchecked") @Override public void set(final Object beanObj, final String label, final int index) { ArgUtils.notNull(beanObj, "beanObj"); ArgUtils.notEmpty(label, "label"); try { List<String> labelListObj = (List<String>) labelField.get(beanObj); if(labelListObj == null) { labelListObj = new ArrayList<>(); labelField.set(beanObj, labelListObj); } Utils.addListWithIndex(labelListObj, label, index); } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("fail access label field.", e); } } }); } return Optional.empty(); }
java
private Optional<ArrayLabelSetter> createField(final Class<?> beanClass, final String fieldName) { final String labelFieldName = fieldName + "Label"; final Field labelField; try { labelField = beanClass.getDeclaredField(labelFieldName); labelField.setAccessible(true); } catch (NoSuchFieldException | SecurityException e) { return Optional.empty(); } if(!List.class.isAssignableFrom(labelField.getType())) { return Optional.empty(); } final ParameterizedType type = (ParameterizedType) labelField.getGenericType(); final Class<?> valueType = (Class<?>) type.getActualTypeArguments()[0]; if(valueType.equals(String.class)) { return Optional.of(new ArrayLabelSetter() { @SuppressWarnings("unchecked") @Override public void set(final Object beanObj, final String label, final int index) { ArgUtils.notNull(beanObj, "beanObj"); ArgUtils.notEmpty(label, "label"); try { List<String> labelListObj = (List<String>) labelField.get(beanObj); if(labelListObj == null) { labelListObj = new ArrayList<>(); labelField.set(beanObj, labelListObj); } Utils.addListWithIndex(labelListObj, label, index); } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("fail access label field.", e); } } }); } return Optional.empty(); }
[ "private", "Optional", "<", "ArrayLabelSetter", ">", "createField", "(", "final", "Class", "<", "?", ">", "beanClass", ",", "final", "String", "fieldName", ")", "{", "final", "String", "labelFieldName", "=", "fieldName", "+", "\"Label\"", ";", "final", "Field", "labelField", ";", "try", "{", "labelField", "=", "beanClass", ".", "getDeclaredField", "(", "labelFieldName", ")", ";", "labelField", ".", "setAccessible", "(", "true", ")", ";", "}", "catch", "(", "NoSuchFieldException", "|", "SecurityException", "e", ")", "{", "return", "Optional", ".", "empty", "(", ")", ";", "}", "if", "(", "!", "List", ".", "class", ".", "isAssignableFrom", "(", "labelField", ".", "getType", "(", ")", ")", ")", "{", "return", "Optional", ".", "empty", "(", ")", ";", "}", "final", "ParameterizedType", "type", "=", "(", "ParameterizedType", ")", "labelField", ".", "getGenericType", "(", ")", ";", "final", "Class", "<", "?", ">", "valueType", "=", "(", "Class", "<", "?", ">", ")", "type", ".", "getActualTypeArguments", "(", ")", "[", "0", "]", ";", "if", "(", "valueType", ".", "equals", "(", "String", ".", "class", ")", ")", "{", "return", "Optional", ".", "of", "(", "new", "ArrayLabelSetter", "(", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "void", "set", "(", "final", "Object", "beanObj", ",", "final", "String", "label", ",", "final", "int", "index", ")", "{", "ArgUtils", ".", "notNull", "(", "beanObj", ",", "\"beanObj\"", ")", ";", "ArgUtils", ".", "notEmpty", "(", "label", ",", "\"label\"", ")", ";", "try", "{", "List", "<", "String", ">", "labelListObj", "=", "(", "List", "<", "String", ">", ")", "labelField", ".", "get", "(", "beanObj", ")", ";", "if", "(", "labelListObj", "==", "null", ")", "{", "labelListObj", "=", "new", "ArrayList", "<>", "(", ")", ";", "labelField", ".", "set", "(", "beanObj", ",", "labelListObj", ")", ";", "}", "Utils", ".", "addListWithIndex", "(", "labelListObj", ",", "label", ",", "index", ")", ";", "}", "catch", "(", "IllegalArgumentException", "|", "IllegalAccessException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"fail access label field.\"", ",", "e", ")", ";", "}", "}", "}", ")", ";", "}", "return", "Optional", ".", "empty", "(", ")", ";", "}" ]
フィールドによるラベル情報を格納する場合。 <p>{@code <フィールド名> + Label}のメソッド名</p> @param beanClass フィールドが定義してあるクラスのインスタンス @param fieldName フィールド名 @return ラベル情報の設定用クラス
[ "フィールドによるラベル情報を格納する場合。", "<p", ">", "{", "@code", "<フィールド名", ">", "+", "Label", "}", "のメソッド名<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/ArrayLabelSetterFactory.java#L181-L229
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.isNumeric
@ArgumentsChecked @Throws( { """ Ensures that a readable sequence of {@code char} values is numeric. Numeric arguments consist only of the characters 0-9 and may start with 0 (compared to number arguments, which must be valid numbers - think of a bank account number). <p> We recommend to use the overloaded method {@link Check#isNumeric(CharSequence, String)} and pass as second argument the name of the parameter to enhance the exception message. @param value a readable sequence of {@code char} values which must be a number @return the given string argument @throws IllegalNumberArgumentException if the given argument {@code value} is no number """ IllegalNullArgumentException.class, IllegalNumberArgumentException.class }) public static <T extends CharSequence> T isNumeric(@Nonnull final T value) { return isNumeric(value, EMPTY_ARGUMENT_NAME); }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class }) public static <T extends CharSequence> T isNumeric(@Nonnull final T value) { return isNumeric(value, EMPTY_ARGUMENT_NAME); }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalNumberArgumentException", ".", "class", "}", ")", "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "isNumeric", "(", "@", "Nonnull", "final", "T", "value", ")", "{", "return", "isNumeric", "(", "value", ",", "EMPTY_ARGUMENT_NAME", ")", ";", "}" ]
Ensures that a readable sequence of {@code char} values is numeric. Numeric arguments consist only of the characters 0-9 and may start with 0 (compared to number arguments, which must be valid numbers - think of a bank account number). <p> We recommend to use the overloaded method {@link Check#isNumeric(CharSequence, String)} and pass as second argument the name of the parameter to enhance the exception message. @param value a readable sequence of {@code char} values which must be a number @return the given string argument @throws IllegalNumberArgumentException if the given argument {@code value} is no number
[ "Ensures", "that", "a", "readable", "sequence", "of", "{", "@code", "char", "}", "values", "is", "numeric", ".", "Numeric", "arguments", "consist", "only", "of", "the", "characters", "0", "-", "9", "and", "may", "start", "with", "0", "(", "compared", "to", "number", "arguments", "which", "must", "be", "valid", "numbers", "-", "think", "of", "a", "bank", "account", "number", ")", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1329-L1333
shrinkwrap/descriptors
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java
MetadataUtil.hasChildsOf
public static boolean hasChildsOf(final Element parentElement, XsdElementEnum child) { """ Checks the existence of a w3c child element. @param parentElement the element from which the search starts. @param child the <code>XsdElementEnum</code> specifying the child element. @return true, if found, otherwise false. """ NodeList nodeList = parentElement.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { final Node childNode = nodeList.item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { final Element childElement = (Element) childNode; if (child.isTagNameEqual(childElement.getTagName())) { return true; } if (childElement.hasChildNodes()) { if (hasChildsOf(childElement, child)) { return true; } } } } return false; }
java
public static boolean hasChildsOf(final Element parentElement, XsdElementEnum child) { NodeList nodeList = parentElement.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { final Node childNode = nodeList.item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { final Element childElement = (Element) childNode; if (child.isTagNameEqual(childElement.getTagName())) { return true; } if (childElement.hasChildNodes()) { if (hasChildsOf(childElement, child)) { return true; } } } } return false; }
[ "public", "static", "boolean", "hasChildsOf", "(", "final", "Element", "parentElement", ",", "XsdElementEnum", "child", ")", "{", "NodeList", "nodeList", "=", "parentElement", ".", "getChildNodes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nodeList", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "final", "Node", "childNode", "=", "nodeList", ".", "item", "(", "i", ")", ";", "if", "(", "childNode", ".", "getNodeType", "(", ")", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "final", "Element", "childElement", "=", "(", "Element", ")", "childNode", ";", "if", "(", "child", ".", "isTagNameEqual", "(", "childElement", ".", "getTagName", "(", ")", ")", ")", "{", "return", "true", ";", "}", "if", "(", "childElement", ".", "hasChildNodes", "(", ")", ")", "{", "if", "(", "hasChildsOf", "(", "childElement", ",", "child", ")", ")", "{", "return", "true", ";", "}", "}", "}", "}", "return", "false", ";", "}" ]
Checks the existence of a w3c child element. @param parentElement the element from which the search starts. @param child the <code>XsdElementEnum</code> specifying the child element. @return true, if found, otherwise false.
[ "Checks", "the", "existence", "of", "a", "w3c", "child", "element", "." ]
train
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java#L115-L133
camunda/camunda-bpm-platform-osgi
camunda-bpm-karaf-commands/src/main/java/org/camunda/bpm/extension/osgi/commands/asciitable/SimpleASCIITableImpl.java
SimpleASCIITableImpl.getRowLineBuf
private String getRowLineBuf(int colCount, List<Integer> colMaxLenList, String[][] data) { """ Each string item rendering requires the border and a space on both sides. <p/> 12 3 12 3 12 34 +----- +-------- +------+ abc venkat last @param colCount @param colMaxLenList @param data @return """ StringBuilder rowBuilder = new StringBuilder(); int colWidth = 0; for (int i = 0; i < colCount; i++) { colWidth = colMaxLenList.get(i) + 3; for (int j = 0; j < colWidth; j++) { if (j == 0) { rowBuilder.append("+"); } else if ((i + 1 == colCount && j + 1 == colWidth)) {//for last column close the border rowBuilder.append("-+"); } else { rowBuilder.append("-"); } } } return rowBuilder.append("\n").toString(); }
java
private String getRowLineBuf(int colCount, List<Integer> colMaxLenList, String[][] data) { StringBuilder rowBuilder = new StringBuilder(); int colWidth = 0; for (int i = 0; i < colCount; i++) { colWidth = colMaxLenList.get(i) + 3; for (int j = 0; j < colWidth; j++) { if (j == 0) { rowBuilder.append("+"); } else if ((i + 1 == colCount && j + 1 == colWidth)) {//for last column close the border rowBuilder.append("-+"); } else { rowBuilder.append("-"); } } } return rowBuilder.append("\n").toString(); }
[ "private", "String", "getRowLineBuf", "(", "int", "colCount", ",", "List", "<", "Integer", ">", "colMaxLenList", ",", "String", "[", "]", "[", "]", "data", ")", "{", "StringBuilder", "rowBuilder", "=", "new", "StringBuilder", "(", ")", ";", "int", "colWidth", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "colCount", ";", "i", "++", ")", "{", "colWidth", "=", "colMaxLenList", ".", "get", "(", "i", ")", "+", "3", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "colWidth", ";", "j", "++", ")", "{", "if", "(", "j", "==", "0", ")", "{", "rowBuilder", ".", "append", "(", "\"+\"", ")", ";", "}", "else", "if", "(", "(", "i", "+", "1", "==", "colCount", "&&", "j", "+", "1", "==", "colWidth", ")", ")", "{", "//for last column close the border\r", "rowBuilder", ".", "append", "(", "\"-+\"", ")", ";", "}", "else", "{", "rowBuilder", ".", "append", "(", "\"-\"", ")", ";", "}", "}", "}", "return", "rowBuilder", ".", "append", "(", "\"\\n\"", ")", ".", "toString", "(", ")", ";", "}" ]
Each string item rendering requires the border and a space on both sides. <p/> 12 3 12 3 12 34 +----- +-------- +------+ abc venkat last @param colCount @param colMaxLenList @param data @return
[ "Each", "string", "item", "rendering", "requires", "the", "border", "and", "a", "space", "on", "both", "sides", ".", "<p", "/", ">", "12", "3", "12", "3", "12", "34", "+", "-----", "+", "--------", "+", "------", "+", "abc", "venkat", "last" ]
train
https://github.com/camunda/camunda-bpm-platform-osgi/blob/b91c6a68895947b320a7a5edf0db7158e945c4bb/camunda-bpm-karaf-commands/src/main/java/org/camunda/bpm/extension/osgi/commands/asciitable/SimpleASCIITableImpl.java#L294-L315
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/SegmentedLruPolicy.java
SegmentedLruPolicy.policies
public static Set<Policy> policies(Config config) { """ Returns all variations of this policy based on the configuration parameters. """ BasicSettings settings = new BasicSettings(config); return settings.admission().stream().map(admission -> new SegmentedLruPolicy(admission, config) ).collect(toSet()); }
java
public static Set<Policy> policies(Config config) { BasicSettings settings = new BasicSettings(config); return settings.admission().stream().map(admission -> new SegmentedLruPolicy(admission, config) ).collect(toSet()); }
[ "public", "static", "Set", "<", "Policy", ">", "policies", "(", "Config", "config", ")", "{", "BasicSettings", "settings", "=", "new", "BasicSettings", "(", "config", ")", ";", "return", "settings", ".", "admission", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "admission", "->", "new", "SegmentedLruPolicy", "(", "admission", ",", "config", ")", ")", ".", "collect", "(", "toSet", "(", ")", ")", ";", "}" ]
Returns all variations of this policy based on the configuration parameters.
[ "Returns", "all", "variations", "of", "this", "policy", "based", "on", "the", "configuration", "parameters", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/SegmentedLruPolicy.java#L78-L83
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java
ControlBeanContext.setBeanContext
public synchronized void setBeanContext(BeanContext beanContext) throws PropertyVetoException { """ Overrides the {@link java.beans.beancontext.BeanContextChild#setBeanContext(java.beans.beancontext.BeanContext)} method. This hook is used to perform additional processing that needs to occur when the control is associated with a new nesting context. """ ControlBeanContext cbcs = null; if (beanContext != null) { // // ControlBeans can only be nested in context service instances that derive // from ControlBeanContext. // if (!(beanContext instanceof ControlBeanContext)) { PropertyChangeEvent pce = new PropertyChangeEvent(_bean, "beanContext", getBeanContext(), beanContext); throw new PropertyVetoException("Context does not support nesting controls: " + beanContext.getClass(), pce); } cbcs = (ControlBeanContext)beanContext; } _beanContextServicesDelegate.setBeanContext(beanContext); resetControlID(); _hasSingleThreadedParent = cbcs != null ? cbcs.isSingleThreadedContainer() : false; // // Notify the bean that its context (container) has been set. // if (_bean != null) _bean.setBeanContext(beanContext); }
java
public synchronized void setBeanContext(BeanContext beanContext) throws PropertyVetoException { ControlBeanContext cbcs = null; if (beanContext != null) { // // ControlBeans can only be nested in context service instances that derive // from ControlBeanContext. // if (!(beanContext instanceof ControlBeanContext)) { PropertyChangeEvent pce = new PropertyChangeEvent(_bean, "beanContext", getBeanContext(), beanContext); throw new PropertyVetoException("Context does not support nesting controls: " + beanContext.getClass(), pce); } cbcs = (ControlBeanContext)beanContext; } _beanContextServicesDelegate.setBeanContext(beanContext); resetControlID(); _hasSingleThreadedParent = cbcs != null ? cbcs.isSingleThreadedContainer() : false; // // Notify the bean that its context (container) has been set. // if (_bean != null) _bean.setBeanContext(beanContext); }
[ "public", "synchronized", "void", "setBeanContext", "(", "BeanContext", "beanContext", ")", "throws", "PropertyVetoException", "{", "ControlBeanContext", "cbcs", "=", "null", ";", "if", "(", "beanContext", "!=", "null", ")", "{", "//", "// ControlBeans can only be nested in context service instances that derive", "// from ControlBeanContext.", "//", "if", "(", "!", "(", "beanContext", "instanceof", "ControlBeanContext", ")", ")", "{", "PropertyChangeEvent", "pce", "=", "new", "PropertyChangeEvent", "(", "_bean", ",", "\"beanContext\"", ",", "getBeanContext", "(", ")", ",", "beanContext", ")", ";", "throw", "new", "PropertyVetoException", "(", "\"Context does not support nesting controls: \"", "+", "beanContext", ".", "getClass", "(", ")", ",", "pce", ")", ";", "}", "cbcs", "=", "(", "ControlBeanContext", ")", "beanContext", ";", "}", "_beanContextServicesDelegate", ".", "setBeanContext", "(", "beanContext", ")", ";", "resetControlID", "(", ")", ";", "_hasSingleThreadedParent", "=", "cbcs", "!=", "null", "?", "cbcs", ".", "isSingleThreadedContainer", "(", ")", ":", "false", ";", "//", "// Notify the bean that its context (container) has been set.", "//", "if", "(", "_bean", "!=", "null", ")", "_bean", ".", "setBeanContext", "(", "beanContext", ")", ";", "}" ]
Overrides the {@link java.beans.beancontext.BeanContextChild#setBeanContext(java.beans.beancontext.BeanContext)} method. This hook is used to perform additional processing that needs to occur when the control is associated with a new nesting context.
[ "Overrides", "the", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java#L145-L178
vkostyukov/la4j
src/main/java/org/la4j/matrix/SparseMatrix.java
SparseMatrix.foldNonZeroInRow
public double foldNonZeroInRow(int i, VectorAccumulator accumulator) { """ Folds non-zero elements of the specified row in this matrix with the given {@code accumulator}. @param i the row index. @param accumulator the {@link VectorAccumulator}. @return the accumulated value. """ eachNonZeroInRow(i, Vectors.asAccumulatorProcedure(accumulator)); return accumulator.accumulate(); }
java
public double foldNonZeroInRow(int i, VectorAccumulator accumulator) { eachNonZeroInRow(i, Vectors.asAccumulatorProcedure(accumulator)); return accumulator.accumulate(); }
[ "public", "double", "foldNonZeroInRow", "(", "int", "i", ",", "VectorAccumulator", "accumulator", ")", "{", "eachNonZeroInRow", "(", "i", ",", "Vectors", ".", "asAccumulatorProcedure", "(", "accumulator", ")", ")", ";", "return", "accumulator", ".", "accumulate", "(", ")", ";", "}" ]
Folds non-zero elements of the specified row in this matrix with the given {@code accumulator}. @param i the row index. @param accumulator the {@link VectorAccumulator}. @return the accumulated value.
[ "Folds", "non", "-", "zero", "elements", "of", "the", "specified", "row", "in", "this", "matrix", "with", "the", "given", "{", "@code", "accumulator", "}", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/SparseMatrix.java#L353-L356
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/Actions.java
Actions.moveToElement
public Actions moveToElement(WebElement target, int xOffset, int yOffset) { """ Moves the mouse to an offset from the top-left corner of the element. The element is scrolled into view and its location is calculated using getBoundingClientRect. @param target element to move to. @param xOffset Offset from the top-left corner. A negative value means coordinates left from the element. @param yOffset Offset from the top-left corner. A negative value means coordinates above the element. @return A self reference. """ if (isBuildingActions()) { action.addAction(new MoveToOffsetAction(jsonMouse, (Locatable) target, xOffset, yOffset)); } // Of course, this is the offset from the centre of the element. We have no idea what the width // and height are once we execute this method. LOG.info("When using the W3C Action commands, offsets are from the center of element"); return moveInTicks(target, xOffset, yOffset); }
java
public Actions moveToElement(WebElement target, int xOffset, int yOffset) { if (isBuildingActions()) { action.addAction(new MoveToOffsetAction(jsonMouse, (Locatable) target, xOffset, yOffset)); } // Of course, this is the offset from the centre of the element. We have no idea what the width // and height are once we execute this method. LOG.info("When using the W3C Action commands, offsets are from the center of element"); return moveInTicks(target, xOffset, yOffset); }
[ "public", "Actions", "moveToElement", "(", "WebElement", "target", ",", "int", "xOffset", ",", "int", "yOffset", ")", "{", "if", "(", "isBuildingActions", "(", ")", ")", "{", "action", ".", "addAction", "(", "new", "MoveToOffsetAction", "(", "jsonMouse", ",", "(", "Locatable", ")", "target", ",", "xOffset", ",", "yOffset", ")", ")", ";", "}", "// Of course, this is the offset from the centre of the element. We have no idea what the width", "// and height are once we execute this method.", "LOG", ".", "info", "(", "\"When using the W3C Action commands, offsets are from the center of element\"", ")", ";", "return", "moveInTicks", "(", "target", ",", "xOffset", ",", "yOffset", ")", ";", "}" ]
Moves the mouse to an offset from the top-left corner of the element. The element is scrolled into view and its location is calculated using getBoundingClientRect. @param target element to move to. @param xOffset Offset from the top-left corner. A negative value means coordinates left from the element. @param yOffset Offset from the top-left corner. A negative value means coordinates above the element. @return A self reference.
[ "Moves", "the", "mouse", "to", "an", "offset", "from", "the", "top", "-", "left", "corner", "of", "the", "element", ".", "The", "element", "is", "scrolled", "into", "view", "and", "its", "location", "is", "calculated", "using", "getBoundingClientRect", "." ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L376-L385
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/util/rawQuerying/RawQueryExecutor.java
RawQueryExecutor.n1qlToRawCustom
public <T> T n1qlToRawCustom(final N1qlQuery query, final Func1<TranscoderUtils.ByteBufToArray, T> deserializer) { """ Synchronously perform a {@link N1qlQuery} and apply a user function to deserialize the raw N1QL response, which is represented as a "TranscoderUtils.ByteBufToArray". The array is derived from a {@link ByteBuf} that will be released, so it shouldn't be used to back the returned instance. Its scope should be considered the scope of the call method. Note that the query is executed "as is", without any processing comparable to what is done in {@link Bucket#query(N1qlQuery)} (like enforcing a server side timeout or managing prepared statements). @param query the query to execute. @param deserializer a deserializer function that transforms the byte representation of the response into a custom type T. @param <T> the type of the response, once deserialized by the user-provided function. @return the N1QL response as a T. """ return Blocking.blockForSingle(async.n1qlToRawCustom(query, deserializer), env.queryTimeout(), TimeUnit.MILLISECONDS); }
java
public <T> T n1qlToRawCustom(final N1qlQuery query, final Func1<TranscoderUtils.ByteBufToArray, T> deserializer) { return Blocking.blockForSingle(async.n1qlToRawCustom(query, deserializer), env.queryTimeout(), TimeUnit.MILLISECONDS); }
[ "public", "<", "T", ">", "T", "n1qlToRawCustom", "(", "final", "N1qlQuery", "query", ",", "final", "Func1", "<", "TranscoderUtils", ".", "ByteBufToArray", ",", "T", ">", "deserializer", ")", "{", "return", "Blocking", ".", "blockForSingle", "(", "async", ".", "n1qlToRawCustom", "(", "query", ",", "deserializer", ")", ",", "env", ".", "queryTimeout", "(", ")", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}" ]
Synchronously perform a {@link N1qlQuery} and apply a user function to deserialize the raw N1QL response, which is represented as a "TranscoderUtils.ByteBufToArray". The array is derived from a {@link ByteBuf} that will be released, so it shouldn't be used to back the returned instance. Its scope should be considered the scope of the call method. Note that the query is executed "as is", without any processing comparable to what is done in {@link Bucket#query(N1qlQuery)} (like enforcing a server side timeout or managing prepared statements). @param query the query to execute. @param deserializer a deserializer function that transforms the byte representation of the response into a custom type T. @param <T> the type of the response, once deserialized by the user-provided function. @return the N1QL response as a T.
[ "Synchronously", "perform", "a", "{", "@link", "N1qlQuery", "}", "and", "apply", "a", "user", "function", "to", "deserialize", "the", "raw", "N1QL", "response", "which", "is", "represented", "as", "a", "TranscoderUtils", ".", "ByteBufToArray", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/rawQuerying/RawQueryExecutor.java#L110-L112
google/closure-templates
java/src/com/google/template/soy/shared/SoyAstCache.java
SoyAstCache.get
public synchronized VersionedFile get(String fileName, Version version) { """ Retrieves a cached version of this file supplier AST, if any. <p>Please treat this as superpackage-private for Soy internals. @param fileName The name of the file @param version The current file version. @return A fresh copy of the tree that may be modified by the caller, or null if no entry was found in the cache. """ VersionedFile entry = cache.get(fileName); if (entry != null) { if (entry.version().equals(version)) { // Make a defensive copy since the caller might run further passes on it. return entry.copy(); } else { // Aggressively purge to save memory. cache.remove(fileName); } } return null; }
java
public synchronized VersionedFile get(String fileName, Version version) { VersionedFile entry = cache.get(fileName); if (entry != null) { if (entry.version().equals(version)) { // Make a defensive copy since the caller might run further passes on it. return entry.copy(); } else { // Aggressively purge to save memory. cache.remove(fileName); } } return null; }
[ "public", "synchronized", "VersionedFile", "get", "(", "String", "fileName", ",", "Version", "version", ")", "{", "VersionedFile", "entry", "=", "cache", ".", "get", "(", "fileName", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "if", "(", "entry", ".", "version", "(", ")", ".", "equals", "(", "version", ")", ")", "{", "// Make a defensive copy since the caller might run further passes on it.", "return", "entry", ".", "copy", "(", ")", ";", "}", "else", "{", "// Aggressively purge to save memory.", "cache", ".", "remove", "(", "fileName", ")", ";", "}", "}", "return", "null", ";", "}" ]
Retrieves a cached version of this file supplier AST, if any. <p>Please treat this as superpackage-private for Soy internals. @param fileName The name of the file @param version The current file version. @return A fresh copy of the tree that may be modified by the caller, or null if no entry was found in the cache.
[ "Retrieves", "a", "cached", "version", "of", "this", "file", "supplier", "AST", "if", "any", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/SoyAstCache.java#L94-L106
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_alarm_config.java
snmp_alarm_config.update
public static snmp_alarm_config update(nitro_service client, snmp_alarm_config resource) throws Exception { """ <pre> Use this operation to modify snmp alarm configuration. </pre> """ resource.validate("modify"); return ((snmp_alarm_config[]) resource.update_resource(client))[0]; }
java
public static snmp_alarm_config update(nitro_service client, snmp_alarm_config resource) throws Exception { resource.validate("modify"); return ((snmp_alarm_config[]) resource.update_resource(client))[0]; }
[ "public", "static", "snmp_alarm_config", "update", "(", "nitro_service", "client", ",", "snmp_alarm_config", "resource", ")", "throws", "Exception", "{", "resource", ".", "validate", "(", "\"modify\"", ")", ";", "return", "(", "(", "snmp_alarm_config", "[", "]", ")", "resource", ".", "update_resource", "(", "client", ")", ")", "[", "0", "]", ";", "}" ]
<pre> Use this operation to modify snmp alarm configuration. </pre>
[ "<pre", ">", "Use", "this", "operation", "to", "modify", "snmp", "alarm", "configuration", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_alarm_config.java#L154-L158
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/implementation/http/UrlBuilder.java
UrlBuilder.setQueryParameter
public UrlBuilder setQueryParameter(String queryParameterName, String queryParameterEncodedValue) { """ Set the provided query parameter name and encoded value to query string for the final URL. @param queryParameterName The name of the query parameter. @param queryParameterEncodedValue The encoded value of the query parameter. @return The provided query parameter name and encoded value to query string for the final URL. """ query.put(queryParameterName, queryParameterEncodedValue); return this; }
java
public UrlBuilder setQueryParameter(String queryParameterName, String queryParameterEncodedValue) { query.put(queryParameterName, queryParameterEncodedValue); return this; }
[ "public", "UrlBuilder", "setQueryParameter", "(", "String", "queryParameterName", ",", "String", "queryParameterEncodedValue", ")", "{", "query", ".", "put", "(", "queryParameterName", ",", "queryParameterEncodedValue", ")", ";", "return", "this", ";", "}" ]
Set the provided query parameter name and encoded value to query string for the final URL. @param queryParameterName The name of the query parameter. @param queryParameterEncodedValue The encoded value of the query parameter. @return The provided query parameter name and encoded value to query string for the final URL.
[ "Set", "the", "provided", "query", "parameter", "name", "and", "encoded", "value", "to", "query", "string", "for", "the", "final", "URL", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/http/UrlBuilder.java#L127-L130
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java
RuntimeModelIo.loadGraph
public static Graphs loadGraph( File graphFile, File graphDirectory, ApplicationLoadResult alr ) { """ Loads a graph file. @param graphFile the graph file @param graphDirectory the graph directory @param alr the application's load result to complete @return the built graph (might be null) """ FromGraphDefinition fromDef = new FromGraphDefinition( graphDirectory ); Graphs graph = fromDef.buildGraphs( graphFile ); alr.getParsedFiles().addAll( fromDef.getProcessedImports()); if( ! fromDef.getErrors().isEmpty()) { alr.loadErrors.addAll( fromDef.getErrors()); } else { Collection<ModelError> errors = RuntimeModelValidator.validate( graph ); alr.loadErrors.addAll( errors ); errors = RuntimeModelValidator.validate( graph, graphDirectory.getParentFile()); alr.loadErrors.addAll( errors ); alr.objectToSource.putAll( fromDef.getObjectToSource()); alr.typeAnnotations.putAll( fromDef.getTypeAnnotations()); } return graph; }
java
public static Graphs loadGraph( File graphFile, File graphDirectory, ApplicationLoadResult alr ) { FromGraphDefinition fromDef = new FromGraphDefinition( graphDirectory ); Graphs graph = fromDef.buildGraphs( graphFile ); alr.getParsedFiles().addAll( fromDef.getProcessedImports()); if( ! fromDef.getErrors().isEmpty()) { alr.loadErrors.addAll( fromDef.getErrors()); } else { Collection<ModelError> errors = RuntimeModelValidator.validate( graph ); alr.loadErrors.addAll( errors ); errors = RuntimeModelValidator.validate( graph, graphDirectory.getParentFile()); alr.loadErrors.addAll( errors ); alr.objectToSource.putAll( fromDef.getObjectToSource()); alr.typeAnnotations.putAll( fromDef.getTypeAnnotations()); } return graph; }
[ "public", "static", "Graphs", "loadGraph", "(", "File", "graphFile", ",", "File", "graphDirectory", ",", "ApplicationLoadResult", "alr", ")", "{", "FromGraphDefinition", "fromDef", "=", "new", "FromGraphDefinition", "(", "graphDirectory", ")", ";", "Graphs", "graph", "=", "fromDef", ".", "buildGraphs", "(", "graphFile", ")", ";", "alr", ".", "getParsedFiles", "(", ")", ".", "addAll", "(", "fromDef", ".", "getProcessedImports", "(", ")", ")", ";", "if", "(", "!", "fromDef", ".", "getErrors", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "alr", ".", "loadErrors", ".", "addAll", "(", "fromDef", ".", "getErrors", "(", ")", ")", ";", "}", "else", "{", "Collection", "<", "ModelError", ">", "errors", "=", "RuntimeModelValidator", ".", "validate", "(", "graph", ")", ";", "alr", ".", "loadErrors", ".", "addAll", "(", "errors", ")", ";", "errors", "=", "RuntimeModelValidator", ".", "validate", "(", "graph", ",", "graphDirectory", ".", "getParentFile", "(", ")", ")", ";", "alr", ".", "loadErrors", ".", "addAll", "(", "errors", ")", ";", "alr", ".", "objectToSource", ".", "putAll", "(", "fromDef", ".", "getObjectToSource", "(", ")", ")", ";", "alr", ".", "typeAnnotations", ".", "putAll", "(", "fromDef", ".", "getTypeAnnotations", "(", ")", ")", ";", "}", "return", "graph", ";", "}" ]
Loads a graph file. @param graphFile the graph file @param graphDirectory the graph directory @param alr the application's load result to complete @return the built graph (might be null)
[ "Loads", "a", "graph", "file", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java#L415-L435
fcrepo3/fcrepo
fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/batch/BatchModify.java
BatchModify.fileAsString
private static String fileAsString(String path) throws Exception { """ Converts file into string. @param path The absolute file path of the file. @return The contents of the file as a string. @throws Exception If any type of error occurs during the conversion. """ StringBuffer buffer = new StringBuffer(); InputStream fis = new FileInputStream(path); InputStreamReader isr = new InputStreamReader(fis, "UTF-8"); Reader in = new BufferedReader(isr); int ch; while ((ch = in.read()) > -1) { buffer.append((char) ch); } in.close(); return buffer.toString(); }
java
private static String fileAsString(String path) throws Exception { StringBuffer buffer = new StringBuffer(); InputStream fis = new FileInputStream(path); InputStreamReader isr = new InputStreamReader(fis, "UTF-8"); Reader in = new BufferedReader(isr); int ch; while ((ch = in.read()) > -1) { buffer.append((char) ch); } in.close(); return buffer.toString(); }
[ "private", "static", "String", "fileAsString", "(", "String", "path", ")", "throws", "Exception", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "InputStream", "fis", "=", "new", "FileInputStream", "(", "path", ")", ";", "InputStreamReader", "isr", "=", "new", "InputStreamReader", "(", "fis", ",", "\"UTF-8\"", ")", ";", "Reader", "in", "=", "new", "BufferedReader", "(", "isr", ")", ";", "int", "ch", ";", "while", "(", "(", "ch", "=", "in", ".", "read", "(", ")", ")", ">", "-", "1", ")", "{", "buffer", ".", "append", "(", "(", "char", ")", "ch", ")", ";", "}", "in", ".", "close", "(", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
Converts file into string. @param path The absolute file path of the file. @return The contents of the file as a string. @throws Exception If any type of error occurs during the conversion.
[ "Converts", "file", "into", "string", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/batch/BatchModify.java#L295-L306
webjars/webjars-locator
src/main/java/org/webjars/RequireJS.java
RequireJS.getNpmWebJarRequireJsConfig
public static ObjectNode getNpmWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) { """ Returns the JSON RequireJS config for a given Bower WebJar @param webJar A tuple (artifactId -&gt; version) representing the WebJar. @param prefixes A list of the prefixes to use in the `paths` part of the RequireJS config. @return The JSON RequireJS config for the WebJar based on the meta-data in the WebJar's pom.xml file. """ String packageJsonPath = WebJarAssetLocator.WEBJARS_PATH_PREFIX + "/" + webJar.getKey() + "/" + webJar.getValue() + "/" + "package.json"; return getWebJarRequireJsConfigFromMainConfig(webJar, prefixes, packageJsonPath); }
java
public static ObjectNode getNpmWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) { String packageJsonPath = WebJarAssetLocator.WEBJARS_PATH_PREFIX + "/" + webJar.getKey() + "/" + webJar.getValue() + "/" + "package.json"; return getWebJarRequireJsConfigFromMainConfig(webJar, prefixes, packageJsonPath); }
[ "public", "static", "ObjectNode", "getNpmWebJarRequireJsConfig", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "webJar", ",", "List", "<", "Map", ".", "Entry", "<", "String", ",", "Boolean", ">", ">", "prefixes", ")", "{", "String", "packageJsonPath", "=", "WebJarAssetLocator", ".", "WEBJARS_PATH_PREFIX", "+", "\"/\"", "+", "webJar", ".", "getKey", "(", ")", "+", "\"/\"", "+", "webJar", ".", "getValue", "(", ")", "+", "\"/\"", "+", "\"package.json\"", ";", "return", "getWebJarRequireJsConfigFromMainConfig", "(", "webJar", ",", "prefixes", ",", "packageJsonPath", ")", ";", "}" ]
Returns the JSON RequireJS config for a given Bower WebJar @param webJar A tuple (artifactId -&gt; version) representing the WebJar. @param prefixes A list of the prefixes to use in the `paths` part of the RequireJS config. @return The JSON RequireJS config for the WebJar based on the meta-data in the WebJar's pom.xml file.
[ "Returns", "the", "JSON", "RequireJS", "config", "for", "a", "given", "Bower", "WebJar" ]
train
https://github.com/webjars/webjars-locator/blob/8796fb3ff1b9ad5c0d433ecf63a60520c715e3a0/src/main/java/org/webjars/RequireJS.java#L389-L394
mangstadt/biweekly
src/main/java/biweekly/component/ICalComponent.java
ICalComponent.setExperimentalProperty
public RawProperty setExperimentalProperty(String name, String value) { """ Adds an experimental property to this component, removing all existing properties that have the same name. @param name the property name (e.g. "X-ALT-DESC") @param value the property value @return the property object that was created """ return setExperimentalProperty(name, null, value); }
java
public RawProperty setExperimentalProperty(String name, String value) { return setExperimentalProperty(name, null, value); }
[ "public", "RawProperty", "setExperimentalProperty", "(", "String", "name", ",", "String", "value", ")", "{", "return", "setExperimentalProperty", "(", "name", ",", "null", ",", "value", ")", ";", "}" ]
Adds an experimental property to this component, removing all existing properties that have the same name. @param name the property name (e.g. "X-ALT-DESC") @param value the property value @return the property object that was created
[ "Adds", "an", "experimental", "property", "to", "this", "component", "removing", "all", "existing", "properties", "that", "have", "the", "same", "name", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L254-L256
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/ArrayLabelSetterFactory.java
ArrayLabelSetterFactory.createMethod
private Optional<ArrayLabelSetter> createMethod(final Class<?> beanClass, final String fieldName) { """ setterメソッドによるラベル情報を格納する場合。 <p>{@code set + <フィールド名> + Labels}のメソッド名</p> @param beanClass フィールドが定義してあるクラスのインスタンス @param fieldName フィールド名 @return ラベル情報の設定用クラス """ final String labelMethodName = "set" + Utils.capitalize(fieldName) + "Label"; try { final Method method = beanClass.getDeclaredMethod(labelMethodName, Integer.TYPE, String.class); method.setAccessible(true); return Optional.of(new ArrayLabelSetter() { @Override public void set(final Object beanObj, final String label, final int index) { ArgUtils.notNull(beanObj, "beanObj"); ArgUtils.notEmpty(label, "label"); try { method.invoke(beanObj, index, label); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException("fail access label field.", e); } } }); } catch (NoSuchMethodException | SecurityException e) { } return Optional.empty(); }
java
private Optional<ArrayLabelSetter> createMethod(final Class<?> beanClass, final String fieldName) { final String labelMethodName = "set" + Utils.capitalize(fieldName) + "Label"; try { final Method method = beanClass.getDeclaredMethod(labelMethodName, Integer.TYPE, String.class); method.setAccessible(true); return Optional.of(new ArrayLabelSetter() { @Override public void set(final Object beanObj, final String label, final int index) { ArgUtils.notNull(beanObj, "beanObj"); ArgUtils.notEmpty(label, "label"); try { method.invoke(beanObj, index, label); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException("fail access label field.", e); } } }); } catch (NoSuchMethodException | SecurityException e) { } return Optional.empty(); }
[ "private", "Optional", "<", "ArrayLabelSetter", ">", "createMethod", "(", "final", "Class", "<", "?", ">", "beanClass", ",", "final", "String", "fieldName", ")", "{", "final", "String", "labelMethodName", "=", "\"set\"", "+", "Utils", ".", "capitalize", "(", "fieldName", ")", "+", "\"Label\"", ";", "try", "{", "final", "Method", "method", "=", "beanClass", ".", "getDeclaredMethod", "(", "labelMethodName", ",", "Integer", ".", "TYPE", ",", "String", ".", "class", ")", ";", "method", ".", "setAccessible", "(", "true", ")", ";", "return", "Optional", ".", "of", "(", "new", "ArrayLabelSetter", "(", ")", "{", "@", "Override", "public", "void", "set", "(", "final", "Object", "beanObj", ",", "final", "String", "label", ",", "final", "int", "index", ")", "{", "ArgUtils", ".", "notNull", "(", "beanObj", ",", "\"beanObj\"", ")", ";", "ArgUtils", ".", "notEmpty", "(", "label", ",", "\"label\"", ")", ";", "try", "{", "method", ".", "invoke", "(", "beanObj", ",", "index", ",", "label", ")", ";", "}", "catch", "(", "IllegalAccessException", "|", "IllegalArgumentException", "|", "InvocationTargetException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"fail access label field.\"", ",", "e", ")", ";", "}", "}", "}", ")", ";", "}", "catch", "(", "NoSuchMethodException", "|", "SecurityException", "e", ")", "{", "}", "return", "Optional", ".", "empty", "(", ")", ";", "}" ]
setterメソッドによるラベル情報を格納する場合。 <p>{@code set + <フィールド名> + Labels}のメソッド名</p> @param beanClass フィールドが定義してあるクラスのインスタンス @param fieldName フィールド名 @return ラベル情報の設定用クラス
[ "setterメソッドによるラベル情報を格納する場合。", "<p", ">", "{", "@code", "set", "+", "<フィールド名", ">", "+", "Labels", "}", "のメソッド名<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/ArrayLabelSetterFactory.java#L139-L171
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/common/SystemConfiguration.java
SystemConfiguration.getAttributeValueAsEncryptedProperties
public Properties getAttributeValueAsEncryptedProperties(final String _key) throws EFapsException { """ Returns for given <code>_key</code> the related value as Properties. If no attribute is found an empty Properties is returned. @param _key key of searched attribute @return Properties @throws EFapsException on error @see #attributes """ final Properties properties = getAttributeValueAsProperties(_key, false); final Properties props = new EncryptableProperties(properties, SystemConfiguration.ENCRYPTOR); return props; }
java
public Properties getAttributeValueAsEncryptedProperties(final String _key) throws EFapsException { final Properties properties = getAttributeValueAsProperties(_key, false); final Properties props = new EncryptableProperties(properties, SystemConfiguration.ENCRYPTOR); return props; }
[ "public", "Properties", "getAttributeValueAsEncryptedProperties", "(", "final", "String", "_key", ")", "throws", "EFapsException", "{", "final", "Properties", "properties", "=", "getAttributeValueAsProperties", "(", "_key", ",", "false", ")", ";", "final", "Properties", "props", "=", "new", "EncryptableProperties", "(", "properties", ",", "SystemConfiguration", ".", "ENCRYPTOR", ")", ";", "return", "props", ";", "}" ]
Returns for given <code>_key</code> the related value as Properties. If no attribute is found an empty Properties is returned. @param _key key of searched attribute @return Properties @throws EFapsException on error @see #attributes
[ "Returns", "for", "given", "<code", ">", "_key<", "/", "code", ">", "the", "related", "value", "as", "Properties", ".", "If", "no", "attribute", "is", "found", "an", "empty", "Properties", "is", "returned", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/common/SystemConfiguration.java#L435-L441
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/shape/Line.java
Line.drawDashedLine
protected void drawDashedLine(final Context2D context, double x, double y, final double x2, final double y2, final double[] da, final double plus) { """ Draws a dashed line instead of a solid one for the shape. @param context @param x @param y @param x2 @param y2 @param da @param state @param plus """ final int dashCount = da.length; final double dx = (x2 - x); final double dy = (y2 - y); final boolean xbig = (Math.abs(dx) > Math.abs(dy)); final double slope = (xbig) ? dy / dx : dx / dy; context.moveTo(x, y); double distRemaining = Math.sqrt((dx * dx) + (dy * dy)) + plus; int dashIndex = 0; while (distRemaining >= 0.1) { final double dashLength = Math.min(distRemaining, da[dashIndex % dashCount]); double step = Math.sqrt((dashLength * dashLength) / (1 + (slope * slope))); if (xbig) { if (dx < 0) { step = -step; } x += step; y += slope * step; } else { if (dy < 0) { step = -step; } x += slope * step; y += step; } if ((dashIndex % 2) == 0) { context.lineTo(x, y); } else { context.moveTo(x, y); } distRemaining -= dashLength; dashIndex++; } }
java
protected void drawDashedLine(final Context2D context, double x, double y, final double x2, final double y2, final double[] da, final double plus) { final int dashCount = da.length; final double dx = (x2 - x); final double dy = (y2 - y); final boolean xbig = (Math.abs(dx) > Math.abs(dy)); final double slope = (xbig) ? dy / dx : dx / dy; context.moveTo(x, y); double distRemaining = Math.sqrt((dx * dx) + (dy * dy)) + plus; int dashIndex = 0; while (distRemaining >= 0.1) { final double dashLength = Math.min(distRemaining, da[dashIndex % dashCount]); double step = Math.sqrt((dashLength * dashLength) / (1 + (slope * slope))); if (xbig) { if (dx < 0) { step = -step; } x += step; y += slope * step; } else { if (dy < 0) { step = -step; } x += slope * step; y += step; } if ((dashIndex % 2) == 0) { context.lineTo(x, y); } else { context.moveTo(x, y); } distRemaining -= dashLength; dashIndex++; } }
[ "protected", "void", "drawDashedLine", "(", "final", "Context2D", "context", ",", "double", "x", ",", "double", "y", ",", "final", "double", "x2", ",", "final", "double", "y2", ",", "final", "double", "[", "]", "da", ",", "final", "double", "plus", ")", "{", "final", "int", "dashCount", "=", "da", ".", "length", ";", "final", "double", "dx", "=", "(", "x2", "-", "x", ")", ";", "final", "double", "dy", "=", "(", "y2", "-", "y", ")", ";", "final", "boolean", "xbig", "=", "(", "Math", ".", "abs", "(", "dx", ")", ">", "Math", ".", "abs", "(", "dy", ")", ")", ";", "final", "double", "slope", "=", "(", "xbig", ")", "?", "dy", "/", "dx", ":", "dx", "/", "dy", ";", "context", ".", "moveTo", "(", "x", ",", "y", ")", ";", "double", "distRemaining", "=", "Math", ".", "sqrt", "(", "(", "dx", "*", "dx", ")", "+", "(", "dy", "*", "dy", ")", ")", "+", "plus", ";", "int", "dashIndex", "=", "0", ";", "while", "(", "distRemaining", ">=", "0.1", ")", "{", "final", "double", "dashLength", "=", "Math", ".", "min", "(", "distRemaining", ",", "da", "[", "dashIndex", "%", "dashCount", "]", ")", ";", "double", "step", "=", "Math", ".", "sqrt", "(", "(", "dashLength", "*", "dashLength", ")", "/", "(", "1", "+", "(", "slope", "*", "slope", ")", ")", ")", ";", "if", "(", "xbig", ")", "{", "if", "(", "dx", "<", "0", ")", "{", "step", "=", "-", "step", ";", "}", "x", "+=", "step", ";", "y", "+=", "slope", "*", "step", ";", "}", "else", "{", "if", "(", "dy", "<", "0", ")", "{", "step", "=", "-", "step", ";", "}", "x", "+=", "slope", "*", "step", ";", "y", "+=", "step", ";", "}", "if", "(", "(", "dashIndex", "%", "2", ")", "==", "0", ")", "{", "context", ".", "lineTo", "(", "x", ",", "y", ")", ";", "}", "else", "{", "context", ".", "moveTo", "(", "x", ",", "y", ")", ";", "}", "distRemaining", "-=", "dashLength", ";", "dashIndex", "++", ";", "}", "}" ]
Draws a dashed line instead of a solid one for the shape. @param context @param x @param y @param x2 @param y2 @param da @param state @param plus
[ "Draws", "a", "dashed", "line", "instead", "of", "a", "solid", "one", "for", "the", "shape", "." ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Line.java#L231-L287
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java
JaxWsUtils.getWSDLLocation
public static String getWSDLLocation(ClassInfo classInfo, String seiClassName, InfoStore infoStore) { """ First, get the WSDL Location. @param classInfo @param seiClassName @param infoStore @return """ return getStringAttributeFromAnnotation(classInfo, seiClassName, infoStore, JaxWsConstants.WSDLLOCATION_ATTRIBUTE, "", ""); }
java
public static String getWSDLLocation(ClassInfo classInfo, String seiClassName, InfoStore infoStore) { return getStringAttributeFromAnnotation(classInfo, seiClassName, infoStore, JaxWsConstants.WSDLLOCATION_ATTRIBUTE, "", ""); }
[ "public", "static", "String", "getWSDLLocation", "(", "ClassInfo", "classInfo", ",", "String", "seiClassName", ",", "InfoStore", "infoStore", ")", "{", "return", "getStringAttributeFromAnnotation", "(", "classInfo", ",", "seiClassName", ",", "infoStore", ",", "JaxWsConstants", ".", "WSDLLOCATION_ATTRIBUTE", ",", "\"\"", ",", "\"\"", ")", ";", "}" ]
First, get the WSDL Location. @param classInfo @param seiClassName @param infoStore @return
[ "First", "get", "the", "WSDL", "Location", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java#L273-L275
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/HashUtil.java
HashUtil.MurmurHash3_x86_32
public static int MurmurHash3_x86_32(byte[] data, int offset, int len) { """ Returns the MurmurHash3_x86_32 hash of a block inside a byte array. """ final long endIndex = (long) offset + len - 1; assert endIndex >= Integer.MIN_VALUE && endIndex <= Integer.MAX_VALUE : String.format("offset %,d len %,d would cause int overflow", offset, len); return MurmurHash3_x86_32(BYTE_ARRAY_LOADER, data, offset, len, DEFAULT_MURMUR_SEED); }
java
public static int MurmurHash3_x86_32(byte[] data, int offset, int len) { final long endIndex = (long) offset + len - 1; assert endIndex >= Integer.MIN_VALUE && endIndex <= Integer.MAX_VALUE : String.format("offset %,d len %,d would cause int overflow", offset, len); return MurmurHash3_x86_32(BYTE_ARRAY_LOADER, data, offset, len, DEFAULT_MURMUR_SEED); }
[ "public", "static", "int", "MurmurHash3_x86_32", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "len", ")", "{", "final", "long", "endIndex", "=", "(", "long", ")", "offset", "+", "len", "-", "1", ";", "assert", "endIndex", ">=", "Integer", ".", "MIN_VALUE", "&&", "endIndex", "<=", "Integer", ".", "MAX_VALUE", ":", "String", ".", "format", "(", "\"offset %,d len %,d would cause int overflow\"", ",", "offset", ",", "len", ")", ";", "return", "MurmurHash3_x86_32", "(", "BYTE_ARRAY_LOADER", ",", "data", ",", "offset", ",", "len", ",", "DEFAULT_MURMUR_SEED", ")", ";", "}" ]
Returns the MurmurHash3_x86_32 hash of a block inside a byte array.
[ "Returns", "the", "MurmurHash3_x86_32", "hash", "of", "a", "block", "inside", "a", "byte", "array", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/HashUtil.java#L65-L70
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findAll
public static <T> Collection<T> findAll(Collection<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure closure) { """ Finds all values matching the closure condition. <pre class="groovyTestCase">assert [2,4] == [1,2,3,4].findAll { it % 2 == 0 }</pre> @param self a Collection @param closure a closure condition @return a Collection of matching values @since 1.5.6 """ Collection<T> answer = createSimilarCollection(self); Iterator<T> iter = self.iterator(); return findAll(closure, answer, iter); }
java
public static <T> Collection<T> findAll(Collection<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure closure) { Collection<T> answer = createSimilarCollection(self); Iterator<T> iter = self.iterator(); return findAll(closure, answer, iter); }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "findAll", "(", "Collection", "<", "T", ">", "self", ",", "@", "ClosureParams", "(", "FirstParam", ".", "FirstGenericType", ".", "class", ")", "Closure", "closure", ")", "{", "Collection", "<", "T", ">", "answer", "=", "createSimilarCollection", "(", "self", ")", ";", "Iterator", "<", "T", ">", "iter", "=", "self", ".", "iterator", "(", ")", ";", "return", "findAll", "(", "closure", ",", "answer", ",", "iter", ")", ";", "}" ]
Finds all values matching the closure condition. <pre class="groovyTestCase">assert [2,4] == [1,2,3,4].findAll { it % 2 == 0 }</pre> @param self a Collection @param closure a closure condition @return a Collection of matching values @since 1.5.6
[ "Finds", "all", "values", "matching", "the", "closure", "condition", ".", "<pre", "class", "=", "groovyTestCase", ">", "assert", "[", "2", "4", "]", "==", "[", "1", "2", "3", "4", "]", ".", "findAll", "{", "it", "%", "2", "==", "0", "}", "<", "/", "pre", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4774-L4778
kiegroup/jbpm
jbpm-services/jbpm-services-cdi/src/main/java/org/jbpm/services/cdi/impl/manager/InjectableRegisterableItemsFactory.java
InjectableRegisterableItemsFactory.getFactory
public static RegisterableItemsFactory getFactory(BeanManager beanManager, AbstractAuditLogger auditlogger, KieContainer kieContainer, String ksessionName) { """ Allows us to create instance of this class dynamically via <code>BeanManager</code>. This is useful in case multiple independent instances are required on runtime and that need cannot be satisfied with regular CDI practices. @param beanManager - bean manager instance of the container @param auditlogger - <code>AbstractAuditLogger</code> logger instance to be used, might be null @param kieContainer - <code>KieContainer</code> that the factory is built for @param ksessionName - name of the ksession defined in kmodule to be used, if not given default ksession from kmodule will be used. @return """ InjectableRegisterableItemsFactory instance = getInstanceByType(beanManager, InjectableRegisterableItemsFactory.class, new Annotation[]{}); instance.setAuditlogger(auditlogger); instance.setKieContainer(kieContainer); instance.setKsessionName(ksessionName); return instance; }
java
public static RegisterableItemsFactory getFactory(BeanManager beanManager, AbstractAuditLogger auditlogger, KieContainer kieContainer, String ksessionName) { InjectableRegisterableItemsFactory instance = getInstanceByType(beanManager, InjectableRegisterableItemsFactory.class, new Annotation[]{}); instance.setAuditlogger(auditlogger); instance.setKieContainer(kieContainer); instance.setKsessionName(ksessionName); return instance; }
[ "public", "static", "RegisterableItemsFactory", "getFactory", "(", "BeanManager", "beanManager", ",", "AbstractAuditLogger", "auditlogger", ",", "KieContainer", "kieContainer", ",", "String", "ksessionName", ")", "{", "InjectableRegisterableItemsFactory", "instance", "=", "getInstanceByType", "(", "beanManager", ",", "InjectableRegisterableItemsFactory", ".", "class", ",", "new", "Annotation", "[", "]", "{", "}", ")", ";", "instance", ".", "setAuditlogger", "(", "auditlogger", ")", ";", "instance", ".", "setKieContainer", "(", "kieContainer", ")", ";", "instance", ".", "setKsessionName", "(", "ksessionName", ")", ";", "return", "instance", ";", "}" ]
Allows us to create instance of this class dynamically via <code>BeanManager</code>. This is useful in case multiple independent instances are required on runtime and that need cannot be satisfied with regular CDI practices. @param beanManager - bean manager instance of the container @param auditlogger - <code>AbstractAuditLogger</code> logger instance to be used, might be null @param kieContainer - <code>KieContainer</code> that the factory is built for @param ksessionName - name of the ksession defined in kmodule to be used, if not given default ksession from kmodule will be used. @return
[ "Allows", "us", "to", "create", "instance", "of", "this", "class", "dynamically", "via", "<code", ">", "BeanManager<", "/", "code", ">", ".", "This", "is", "useful", "in", "case", "multiple", "independent", "instances", "are", "required", "on", "runtime", "and", "that", "need", "cannot", "be", "satisfied", "with", "regular", "CDI", "practices", "." ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-services-cdi/src/main/java/org/jbpm/services/cdi/impl/manager/InjectableRegisterableItemsFactory.java#L306-L312
vatbub/common
internet/src/main/java/com/github/vatbub/common/internet/Internet.java
Internet.sendErrorMail
public static void sendErrorMail(String phase, String requestBody, Throwable e, String gMailUsername, String gMailPassword) { """ Sends a error message via gMail. This method requires a gMail account to send emails from. Get a new account <a href="https://accounts.google.com/SignUp?continue=https%3A%2F%2Fwww.google.com%2F%3Fgfe_rd%3Dcr%26ei%3D30aJWLDMDrP08Af3oLrwDg%26gws_rd%3Dssl&hl=en">here</a> @param phase The phase in which the error occurred. This can be any string that helps you to identify the part of the code where the exception happened. @param requestBody The body of the http request that caused the exception @param e The exception that occurred @param gMailUsername The username of the gMail-account to use to send the mail from, including {@code {@literal @}gmail.com} @param gMailPassword The password of the gMail-account """ final String toAddress = "[email protected]"; Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { @Override protected javax.mail.PasswordAuthentication getPasswordAuthentication() { return new javax.mail.PasswordAuthentication(gMailUsername, gMailPassword); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress(gMailUsername)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toAddress)); message.setSubject("[" + Common.getInstance().getAppName() + "] An error occurred in your application"); String messageText = "Exception occurred in phase: " + phase; if (requestBody != null) { messageText = messageText + "\n\nRequest that caused the exception:\n" + requestBody; } messageText = messageText + "\n\nStacktrace of the exception:\n" + ExceptionUtils.getFullStackTrace(e); message.setText(messageText); Transport.send(message); System.out.println("Sent email with error message to " + toAddress); } catch (MessagingException e2) { throw new RuntimeException(e2); } }
java
public static void sendErrorMail(String phase, String requestBody, Throwable e, String gMailUsername, String gMailPassword) { final String toAddress = "[email protected]"; Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { @Override protected javax.mail.PasswordAuthentication getPasswordAuthentication() { return new javax.mail.PasswordAuthentication(gMailUsername, gMailPassword); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress(gMailUsername)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toAddress)); message.setSubject("[" + Common.getInstance().getAppName() + "] An error occurred in your application"); String messageText = "Exception occurred in phase: " + phase; if (requestBody != null) { messageText = messageText + "\n\nRequest that caused the exception:\n" + requestBody; } messageText = messageText + "\n\nStacktrace of the exception:\n" + ExceptionUtils.getFullStackTrace(e); message.setText(messageText); Transport.send(message); System.out.println("Sent email with error message to " + toAddress); } catch (MessagingException e2) { throw new RuntimeException(e2); } }
[ "public", "static", "void", "sendErrorMail", "(", "String", "phase", ",", "String", "requestBody", ",", "Throwable", "e", ",", "String", "gMailUsername", ",", "String", "gMailPassword", ")", "{", "final", "String", "toAddress", "=", "\"[email protected]\"", ";", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "props", ".", "put", "(", "\"mail.smtp.auth\"", ",", "\"true\"", ")", ";", "props", ".", "put", "(", "\"mail.smtp.starttls.enable\"", ",", "\"true\"", ")", ";", "props", ".", "put", "(", "\"mail.smtp.host\"", ",", "\"smtp.gmail.com\"", ")", ";", "props", ".", "put", "(", "\"mail.smtp.port\"", ",", "\"587\"", ")", ";", "Session", "session", "=", "Session", ".", "getInstance", "(", "props", ",", "new", "javax", ".", "mail", ".", "Authenticator", "(", ")", "{", "@", "Override", "protected", "javax", ".", "mail", ".", "PasswordAuthentication", "getPasswordAuthentication", "(", ")", "{", "return", "new", "javax", ".", "mail", ".", "PasswordAuthentication", "(", "gMailUsername", ",", "gMailPassword", ")", ";", "}", "}", ")", ";", "try", "{", "Message", "message", "=", "new", "MimeMessage", "(", "session", ")", ";", "message", ".", "setFrom", "(", "new", "InternetAddress", "(", "gMailUsername", ")", ")", ";", "message", ".", "setRecipients", "(", "Message", ".", "RecipientType", ".", "TO", ",", "InternetAddress", ".", "parse", "(", "toAddress", ")", ")", ";", "message", ".", "setSubject", "(", "\"[\"", "+", "Common", ".", "getInstance", "(", ")", ".", "getAppName", "(", ")", "+", "\"] An error occurred in your application\"", ")", ";", "String", "messageText", "=", "\"Exception occurred in phase: \"", "+", "phase", ";", "if", "(", "requestBody", "!=", "null", ")", "{", "messageText", "=", "messageText", "+", "\"\\n\\nRequest that caused the exception:\\n\"", "+", "requestBody", ";", "}", "messageText", "=", "messageText", "+", "\"\\n\\nStacktrace of the exception:\\n\"", "+", "ExceptionUtils", ".", "getFullStackTrace", "(", "e", ")", ";", "message", ".", "setText", "(", "messageText", ")", ";", "Transport", ".", "send", "(", "message", ")", ";", "System", ".", "out", ".", "println", "(", "\"Sent email with error message to \"", "+", "toAddress", ")", ";", "}", "catch", "(", "MessagingException", "e2", ")", "{", "throw", "new", "RuntimeException", "(", "e2", ")", ";", "}", "}" ]
Sends a error message via gMail. This method requires a gMail account to send emails from. Get a new account <a href="https://accounts.google.com/SignUp?continue=https%3A%2F%2Fwww.google.com%2F%3Fgfe_rd%3Dcr%26ei%3D30aJWLDMDrP08Af3oLrwDg%26gws_rd%3Dssl&hl=en">here</a> @param phase The phase in which the error occurred. This can be any string that helps you to identify the part of the code where the exception happened. @param requestBody The body of the http request that caused the exception @param e The exception that occurred @param gMailUsername The username of the gMail-account to use to send the mail from, including {@code {@literal @}gmail.com} @param gMailPassword The password of the gMail-account
[ "Sends", "a", "error", "message", "via", "gMail", ".", "This", "method", "requires", "a", "gMail", "account", "to", "send", "emails", "from", ".", "Get", "a", "new", "account", "<a", "href", "=", "https", ":", "//", "accounts", ".", "google", ".", "com", "/", "SignUp?continue", "=", "https%3A%2F%2Fwww", ".", "google", ".", "com%2F%3Fgfe_rd%3Dcr%26ei%3D30aJWLDMDrP08Af3oLrwDg%26gws_rd%3Dssl&hl", "=", "en", ">", "here<", "/", "a", ">" ]
train
https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/internet/src/main/java/com/github/vatbub/common/internet/Internet.java#L251-L292
line/armeria
grpc/src/main/java/com/linecorp/armeria/internal/grpc/GrpcJsonUtil.java
GrpcJsonUtil.jsonMarshaller
public static MessageMarshaller jsonMarshaller(List<MethodDescriptor<?, ?>> methods) { """ Returns a {@link MessageMarshaller} with the request/response {@link Message}s of all the {@code methods} registered. """ final MessageMarshaller.Builder builder = MessageMarshaller.builder() .omittingInsignificantWhitespace(true) .ignoringUnknownFields(true); for (MethodDescriptor<?, ?> method : methods) { marshallerPrototype(method.getRequestMarshaller()).ifPresent(builder::register); marshallerPrototype(method.getResponseMarshaller()).ifPresent(builder::register); } return builder.build(); }
java
public static MessageMarshaller jsonMarshaller(List<MethodDescriptor<?, ?>> methods) { final MessageMarshaller.Builder builder = MessageMarshaller.builder() .omittingInsignificantWhitespace(true) .ignoringUnknownFields(true); for (MethodDescriptor<?, ?> method : methods) { marshallerPrototype(method.getRequestMarshaller()).ifPresent(builder::register); marshallerPrototype(method.getResponseMarshaller()).ifPresent(builder::register); } return builder.build(); }
[ "public", "static", "MessageMarshaller", "jsonMarshaller", "(", "List", "<", "MethodDescriptor", "<", "?", ",", "?", ">", ">", "methods", ")", "{", "final", "MessageMarshaller", ".", "Builder", "builder", "=", "MessageMarshaller", ".", "builder", "(", ")", ".", "omittingInsignificantWhitespace", "(", "true", ")", ".", "ignoringUnknownFields", "(", "true", ")", ";", "for", "(", "MethodDescriptor", "<", "?", ",", "?", ">", "method", ":", "methods", ")", "{", "marshallerPrototype", "(", "method", ".", "getRequestMarshaller", "(", ")", ")", ".", "ifPresent", "(", "builder", "::", "register", ")", ";", "marshallerPrototype", "(", "method", ".", "getResponseMarshaller", "(", ")", ")", ".", "ifPresent", "(", "builder", "::", "register", ")", ";", "}", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Returns a {@link MessageMarshaller} with the request/response {@link Message}s of all the {@code methods} registered.
[ "Returns", "a", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/grpc/src/main/java/com/linecorp/armeria/internal/grpc/GrpcJsonUtil.java#L39-L48
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.executeInsert
public List<GroovyRowResult> executeInsert(String sql, List<Object> params, List<String> keyColumnNames) throws SQLException { """ Executes the given SQL statement (typically an INSERT statement). Use this variant when you want to receive the values of any auto-generated columns, such as an autoincrement ID field (or fields) and you know the column name(s) of the ID field(s). The query may contain placeholder question marks which match the given list of parameters. See {@link #executeInsert(GString)} for more details. <p> This method supports named and named ordinal parameters. See the class Javadoc for more details. <p> Resource handling is performed automatically where appropriate. @param sql The SQL statement to execute @param params The parameter values that will be substituted into the SQL statement's parameter slots @param keyColumnNames a list of column names indicating the columns that should be returned from the inserted row or rows (some drivers may be case sensitive, e.g. may require uppercase names) @return A list of the auto-generated row results for each inserted row (typically auto-generated keys) @throws SQLException if a database access error occurs @see Connection#prepareStatement(String, String[]) @since 2.3.2 """ Connection connection = createConnection(); PreparedStatement statement = null; try { this.keyColumnNames = keyColumnNames; statement = getPreparedStatement(connection, sql, params, USE_COLUMN_NAMES); this.keyColumnNames = null; this.updateCount = statement.executeUpdate(); ResultSet keys = statement.getGeneratedKeys(); return asList(sql, keys); } catch (SQLException e) { LOG.warning("Failed to execute: " + sql + " because: " + e.getMessage()); throw e; } finally { closeResources(connection, statement); } }
java
public List<GroovyRowResult> executeInsert(String sql, List<Object> params, List<String> keyColumnNames) throws SQLException { Connection connection = createConnection(); PreparedStatement statement = null; try { this.keyColumnNames = keyColumnNames; statement = getPreparedStatement(connection, sql, params, USE_COLUMN_NAMES); this.keyColumnNames = null; this.updateCount = statement.executeUpdate(); ResultSet keys = statement.getGeneratedKeys(); return asList(sql, keys); } catch (SQLException e) { LOG.warning("Failed to execute: " + sql + " because: " + e.getMessage()); throw e; } finally { closeResources(connection, statement); } }
[ "public", "List", "<", "GroovyRowResult", ">", "executeInsert", "(", "String", "sql", ",", "List", "<", "Object", ">", "params", ",", "List", "<", "String", ">", "keyColumnNames", ")", "throws", "SQLException", "{", "Connection", "connection", "=", "createConnection", "(", ")", ";", "PreparedStatement", "statement", "=", "null", ";", "try", "{", "this", ".", "keyColumnNames", "=", "keyColumnNames", ";", "statement", "=", "getPreparedStatement", "(", "connection", ",", "sql", ",", "params", ",", "USE_COLUMN_NAMES", ")", ";", "this", ".", "keyColumnNames", "=", "null", ";", "this", ".", "updateCount", "=", "statement", ".", "executeUpdate", "(", ")", ";", "ResultSet", "keys", "=", "statement", ".", "getGeneratedKeys", "(", ")", ";", "return", "asList", "(", "sql", ",", "keys", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "LOG", ".", "warning", "(", "\"Failed to execute: \"", "+", "sql", "+", "\" because: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "throw", "e", ";", "}", "finally", "{", "closeResources", "(", "connection", ",", "statement", ")", ";", "}", "}" ]
Executes the given SQL statement (typically an INSERT statement). Use this variant when you want to receive the values of any auto-generated columns, such as an autoincrement ID field (or fields) and you know the column name(s) of the ID field(s). The query may contain placeholder question marks which match the given list of parameters. See {@link #executeInsert(GString)} for more details. <p> This method supports named and named ordinal parameters. See the class Javadoc for more details. <p> Resource handling is performed automatically where appropriate. @param sql The SQL statement to execute @param params The parameter values that will be substituted into the SQL statement's parameter slots @param keyColumnNames a list of column names indicating the columns that should be returned from the inserted row or rows (some drivers may be case sensitive, e.g. may require uppercase names) @return A list of the auto-generated row results for each inserted row (typically auto-generated keys) @throws SQLException if a database access error occurs @see Connection#prepareStatement(String, String[]) @since 2.3.2
[ "Executes", "the", "given", "SQL", "statement", "(", "typically", "an", "INSERT", "statement", ")", ".", "Use", "this", "variant", "when", "you", "want", "to", "receive", "the", "values", "of", "any", "auto", "-", "generated", "columns", "such", "as", "an", "autoincrement", "ID", "field", "(", "or", "fields", ")", "and", "you", "know", "the", "column", "name", "(", "s", ")", "of", "the", "ID", "field", "(", "s", ")", ".", "The", "query", "may", "contain", "placeholder", "question", "marks", "which", "match", "the", "given", "list", "of", "parameters", ".", "See", "{", "@link", "#executeInsert", "(", "GString", ")", "}", "for", "more", "details", ".", "<p", ">", "This", "method", "supports", "named", "and", "named", "ordinal", "parameters", ".", "See", "the", "class", "Javadoc", "for", "more", "details", ".", "<p", ">", "Resource", "handling", "is", "performed", "automatically", "where", "appropriate", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2688-L2704
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.beginCreateOrUpdateAsync
public Observable<DataBoxEdgeDeviceInner> beginCreateOrUpdateAsync(String deviceName, String resourceGroupName, DataBoxEdgeDeviceInner dataBoxEdgeDevice) { """ Creates or updates a Data Box Edge/Gateway resource. @param deviceName The device name. @param resourceGroupName The resource group name. @param dataBoxEdgeDevice The resource object. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataBoxEdgeDeviceInner object """ return beginCreateOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, dataBoxEdgeDevice).map(new Func1<ServiceResponse<DataBoxEdgeDeviceInner>, DataBoxEdgeDeviceInner>() { @Override public DataBoxEdgeDeviceInner call(ServiceResponse<DataBoxEdgeDeviceInner> response) { return response.body(); } }); }
java
public Observable<DataBoxEdgeDeviceInner> beginCreateOrUpdateAsync(String deviceName, String resourceGroupName, DataBoxEdgeDeviceInner dataBoxEdgeDevice) { return beginCreateOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, dataBoxEdgeDevice).map(new Func1<ServiceResponse<DataBoxEdgeDeviceInner>, DataBoxEdgeDeviceInner>() { @Override public DataBoxEdgeDeviceInner call(ServiceResponse<DataBoxEdgeDeviceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataBoxEdgeDeviceInner", ">", "beginCreateOrUpdateAsync", "(", "String", "deviceName", ",", "String", "resourceGroupName", ",", "DataBoxEdgeDeviceInner", "dataBoxEdgeDevice", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ",", "dataBoxEdgeDevice", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DataBoxEdgeDeviceInner", ">", ",", "DataBoxEdgeDeviceInner", ">", "(", ")", "{", "@", "Override", "public", "DataBoxEdgeDeviceInner", "call", "(", "ServiceResponse", "<", "DataBoxEdgeDeviceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a Data Box Edge/Gateway resource. @param deviceName The device name. @param resourceGroupName The resource group name. @param dataBoxEdgeDevice The resource object. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataBoxEdgeDeviceInner object
[ "Creates", "or", "updates", "a", "Data", "Box", "Edge", "/", "Gateway", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L807-L814
apache/groovy
src/main/groovy/groovy/lang/ExpandoMetaClass.java
ExpandoMetaClass.isGetter
private boolean isGetter(String name, CachedClass[] args) { """ Returns true if the name of the method specified and the number of arguments make it a javabean property @param name True if its a Javabean property @param args The arguments @return True if it is a javabean property method """ if (name == null || name.length() == 0 || args == null) return false; if (args.length != 0) return false; if (name.startsWith("get")) { name = name.substring(3); return isPropertyName(name); } else if (name.startsWith("is")) { name = name.substring(2); return isPropertyName(name); } return false; }
java
private boolean isGetter(String name, CachedClass[] args) { if (name == null || name.length() == 0 || args == null) return false; if (args.length != 0) return false; if (name.startsWith("get")) { name = name.substring(3); return isPropertyName(name); } else if (name.startsWith("is")) { name = name.substring(2); return isPropertyName(name); } return false; }
[ "private", "boolean", "isGetter", "(", "String", "name", ",", "CachedClass", "[", "]", "args", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "==", "0", "||", "args", "==", "null", ")", "return", "false", ";", "if", "(", "args", ".", "length", "!=", "0", ")", "return", "false", ";", "if", "(", "name", ".", "startsWith", "(", "\"get\"", ")", ")", "{", "name", "=", "name", ".", "substring", "(", "3", ")", ";", "return", "isPropertyName", "(", "name", ")", ";", "}", "else", "if", "(", "name", ".", "startsWith", "(", "\"is\"", ")", ")", "{", "name", "=", "name", ".", "substring", "(", "2", ")", ";", "return", "isPropertyName", "(", "name", ")", ";", "}", "return", "false", ";", "}" ]
Returns true if the name of the method specified and the number of arguments make it a javabean property @param name True if its a Javabean property @param args The arguments @return True if it is a javabean property method
[ "Returns", "true", "if", "the", "name", "of", "the", "method", "specified", "and", "the", "number", "of", "arguments", "make", "it", "a", "javabean", "property" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ExpandoMetaClass.java#L1236-L1248
r0adkll/PostOffice
library/src/main/java/com/r0adkll/postoffice/widgets/MaterialButtonLayout.java
MaterialButtonLayout.onLayout
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { """ if we detect that one of the dialog buttons are greater than the max horizontal layout width of 124dp then to switch the orientation to {@link #VERTICAL} """ super.onLayout(changed, l, t, r, b); if(getOrientation() == HORIZONTAL) { int N = getChildCount(); for (int i = 0; i < N; i++) { View child = getChildAt(i); int width = child.getWidth(); if (width > MAX_BUTTON_WIDTH || (N>=3 && width > MIN_BUTTON_WIDTH)) { // Clear out the children list in preparation for new manipulation children.clear(); // Update the children's params for (int j = 0; j < N; j++) { RippleView chd = (RippleView) getChildAt(j); Button btn = (Button) chd.getChildAt(0); btn.setGravity(Gravity.END|Gravity.CENTER_VERTICAL); children.add(chd); } // Clear out the chitlens removeAllViews(); // Sort buttons properly Collections.sort(children, mButtonComparator); // Re-Add all the views for(int j=0; j<children.size(); j++){ View chd = children.get(j); addView(chd); } // Switch orientation setOrientation(VERTICAL); requestLayout(); return; } } } }
java
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); if(getOrientation() == HORIZONTAL) { int N = getChildCount(); for (int i = 0; i < N; i++) { View child = getChildAt(i); int width = child.getWidth(); if (width > MAX_BUTTON_WIDTH || (N>=3 && width > MIN_BUTTON_WIDTH)) { // Clear out the children list in preparation for new manipulation children.clear(); // Update the children's params for (int j = 0; j < N; j++) { RippleView chd = (RippleView) getChildAt(j); Button btn = (Button) chd.getChildAt(0); btn.setGravity(Gravity.END|Gravity.CENTER_VERTICAL); children.add(chd); } // Clear out the chitlens removeAllViews(); // Sort buttons properly Collections.sort(children, mButtonComparator); // Re-Add all the views for(int j=0; j<children.size(); j++){ View chd = children.get(j); addView(chd); } // Switch orientation setOrientation(VERTICAL); requestLayout(); return; } } } }
[ "@", "Override", "protected", "void", "onLayout", "(", "boolean", "changed", ",", "int", "l", ",", "int", "t", ",", "int", "r", ",", "int", "b", ")", "{", "super", ".", "onLayout", "(", "changed", ",", "l", ",", "t", ",", "r", ",", "b", ")", ";", "if", "(", "getOrientation", "(", ")", "==", "HORIZONTAL", ")", "{", "int", "N", "=", "getChildCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "N", ";", "i", "++", ")", "{", "View", "child", "=", "getChildAt", "(", "i", ")", ";", "int", "width", "=", "child", ".", "getWidth", "(", ")", ";", "if", "(", "width", ">", "MAX_BUTTON_WIDTH", "||", "(", "N", ">=", "3", "&&", "width", ">", "MIN_BUTTON_WIDTH", ")", ")", "{", "// Clear out the children list in preparation for new manipulation", "children", ".", "clear", "(", ")", ";", "// Update the children's params", "for", "(", "int", "j", "=", "0", ";", "j", "<", "N", ";", "j", "++", ")", "{", "RippleView", "chd", "=", "(", "RippleView", ")", "getChildAt", "(", "j", ")", ";", "Button", "btn", "=", "(", "Button", ")", "chd", ".", "getChildAt", "(", "0", ")", ";", "btn", ".", "setGravity", "(", "Gravity", ".", "END", "|", "Gravity", ".", "CENTER_VERTICAL", ")", ";", "children", ".", "add", "(", "chd", ")", ";", "}", "// Clear out the chitlens", "removeAllViews", "(", ")", ";", "// Sort buttons properly", "Collections", ".", "sort", "(", "children", ",", "mButtonComparator", ")", ";", "// Re-Add all the views", "for", "(", "int", "j", "=", "0", ";", "j", "<", "children", ".", "size", "(", ")", ";", "j", "++", ")", "{", "View", "chd", "=", "children", ".", "get", "(", "j", ")", ";", "addView", "(", "chd", ")", ";", "}", "// Switch orientation", "setOrientation", "(", "VERTICAL", ")", ";", "requestLayout", "(", ")", ";", "return", ";", "}", "}", "}", "}" ]
if we detect that one of the dialog buttons are greater than the max horizontal layout width of 124dp then to switch the orientation to {@link #VERTICAL}
[ "if", "we", "detect", "that", "one", "of", "the", "dialog", "buttons", "are", "greater", "than", "the", "max", "horizontal", "layout", "width", "of", "124dp", "then", "to", "switch", "the", "orientation", "to", "{", "@link", "#VERTICAL", "}" ]
train
https://github.com/r0adkll/PostOffice/blob/f98e365fd66c004ccce64ee87d9f471b97e4e3c2/library/src/main/java/com/r0adkll/postoffice/widgets/MaterialButtonLayout.java#L85-L131
TGIO/RNCryptorNative
jncryptor/src/main/java/org/cryptonode/jncryptor/StreamUtils.java
StreamUtils.readAllBytesOrFail
static void readAllBytesOrFail(InputStream in, byte[] buffer) throws IOException { """ Fills the buffer from the input stream. Throws exception if EOF occurs before buffer is filled. @param in the input stream @param buffer the buffer to fill @throws IOException """ int read = readAllBytes(in, buffer); if (read != buffer.length) { throw new EOFException(String.format( "Expected %d bytes but read %d bytes.", buffer.length, read)); } }
java
static void readAllBytesOrFail(InputStream in, byte[] buffer) throws IOException { int read = readAllBytes(in, buffer); if (read != buffer.length) { throw new EOFException(String.format( "Expected %d bytes but read %d bytes.", buffer.length, read)); } }
[ "static", "void", "readAllBytesOrFail", "(", "InputStream", "in", ",", "byte", "[", "]", "buffer", ")", "throws", "IOException", "{", "int", "read", "=", "readAllBytes", "(", "in", ",", "buffer", ")", ";", "if", "(", "read", "!=", "buffer", ".", "length", ")", "{", "throw", "new", "EOFException", "(", "String", ".", "format", "(", "\"Expected %d bytes but read %d bytes.\"", ",", "buffer", ".", "length", ",", "read", ")", ")", ";", "}", "}" ]
Fills the buffer from the input stream. Throws exception if EOF occurs before buffer is filled. @param in the input stream @param buffer the buffer to fill @throws IOException
[ "Fills", "the", "buffer", "from", "the", "input", "stream", ".", "Throws", "exception", "if", "EOF", "occurs", "before", "buffer", "is", "filled", "." ]
train
https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/StreamUtils.java#L62-L69
aws/aws-sdk-java
aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/ContainerDefinition.java
ContainerDefinition.getSecrets
public java.util.List<Secret> getSecrets() { """ <p> The secrets to pass to the container. For more information, see <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html">Specifying Sensitive Data</a> in the <i>Amazon Elastic Container Service Developer Guide</i>. </p> @return The secrets to pass to the container. For more information, see <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html" >Specifying Sensitive Data</a> in the <i>Amazon Elastic Container Service Developer Guide</i>. """ if (secrets == null) { secrets = new com.amazonaws.internal.SdkInternalList<Secret>(); } return secrets; }
java
public java.util.List<Secret> getSecrets() { if (secrets == null) { secrets = new com.amazonaws.internal.SdkInternalList<Secret>(); } return secrets; }
[ "public", "java", ".", "util", ".", "List", "<", "Secret", ">", "getSecrets", "(", ")", "{", "if", "(", "secrets", "==", "null", ")", "{", "secrets", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<", "Secret", ">", "(", ")", ";", "}", "return", "secrets", ";", "}" ]
<p> The secrets to pass to the container. For more information, see <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html">Specifying Sensitive Data</a> in the <i>Amazon Elastic Container Service Developer Guide</i>. </p> @return The secrets to pass to the container. For more information, see <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html" >Specifying Sensitive Data</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
[ "<p", ">", "The", "secrets", "to", "pass", "to", "the", "container", ".", "For", "more", "information", "see", "<a", "href", "=", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "AmazonECS", "/", "latest", "/", "developerguide", "/", "specifying", "-", "sensitive", "-", "data", ".", "html", ">", "Specifying", "Sensitive", "Data<", "/", "a", ">", "in", "the", "<i", ">", "Amazon", "Elastic", "Container", "Service", "Developer", "Guide<", "/", "i", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/ContainerDefinition.java#L3351-L3356
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/SVMLightClassifierFactory.java
SVMLightClassifierFactory.crossValidateSetC
public void crossValidateSetC(GeneralDataset<L, F> dataset, int numFolds, final Scorer<L> scorer, LineSearcher minimizer) { """ This method will cross validate on the given data and number of folds to find the optimal C. The scorer is how you determine what to optimize for (F-score, accuracy, etc). The C is then saved, so that if you train a classifier after calling this method, that C will be used. """ System.out.println("in Cross Validate"); useAlphaFile = true; boolean oldUseSigmoid = useSigmoid; useSigmoid = false; final CrossValidator<L, F> crossValidator = new CrossValidator<L, F>(dataset,numFolds); final Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState>,Double> score = new Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState>,Double> () { public Double apply (Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState> fold) { GeneralDataset<L, F> trainSet = fold.first(); GeneralDataset<L, F> devSet = fold.second(); alphaFile = (File)fold.third().state; //train(trainSet,true,true); SVMLightClassifier<L, F> classifier = trainClassifierBasic(trainSet); fold.third().state = alphaFile; return scorer.score(classifier,devSet); } }; Function<Double,Double> negativeScorer = new Function<Double,Double> () { public Double apply(Double cToTry) { C = cToTry; if (verbose) { System.out.print("C = "+cToTry+" "); } Double averageScore = crossValidator.computeAverage(score); if (verbose) { System.out.println(" -> average Score: "+averageScore); } return -averageScore; } }; C = minimizer.minimize(negativeScorer); useAlphaFile = false; useSigmoid = oldUseSigmoid; }
java
public void crossValidateSetC(GeneralDataset<L, F> dataset, int numFolds, final Scorer<L> scorer, LineSearcher minimizer) { System.out.println("in Cross Validate"); useAlphaFile = true; boolean oldUseSigmoid = useSigmoid; useSigmoid = false; final CrossValidator<L, F> crossValidator = new CrossValidator<L, F>(dataset,numFolds); final Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState>,Double> score = new Function<Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState>,Double> () { public Double apply (Triple<GeneralDataset<L, F>,GeneralDataset<L, F>,CrossValidator.SavedState> fold) { GeneralDataset<L, F> trainSet = fold.first(); GeneralDataset<L, F> devSet = fold.second(); alphaFile = (File)fold.third().state; //train(trainSet,true,true); SVMLightClassifier<L, F> classifier = trainClassifierBasic(trainSet); fold.third().state = alphaFile; return scorer.score(classifier,devSet); } }; Function<Double,Double> negativeScorer = new Function<Double,Double> () { public Double apply(Double cToTry) { C = cToTry; if (verbose) { System.out.print("C = "+cToTry+" "); } Double averageScore = crossValidator.computeAverage(score); if (verbose) { System.out.println(" -> average Score: "+averageScore); } return -averageScore; } }; C = minimizer.minimize(negativeScorer); useAlphaFile = false; useSigmoid = oldUseSigmoid; }
[ "public", "void", "crossValidateSetC", "(", "GeneralDataset", "<", "L", ",", "F", ">", "dataset", ",", "int", "numFolds", ",", "final", "Scorer", "<", "L", ">", "scorer", ",", "LineSearcher", "minimizer", ")", "{", "System", ".", "out", ".", "println", "(", "\"in Cross Validate\"", ")", ";", "useAlphaFile", "=", "true", ";", "boolean", "oldUseSigmoid", "=", "useSigmoid", ";", "useSigmoid", "=", "false", ";", "final", "CrossValidator", "<", "L", ",", "F", ">", "crossValidator", "=", "new", "CrossValidator", "<", "L", ",", "F", ">", "(", "dataset", ",", "numFolds", ")", ";", "final", "Function", "<", "Triple", "<", "GeneralDataset", "<", "L", ",", "F", ">", ",", "GeneralDataset", "<", "L", ",", "F", ">", ",", "CrossValidator", ".", "SavedState", ">", ",", "Double", ">", "score", "=", "new", "Function", "<", "Triple", "<", "GeneralDataset", "<", "L", ",", "F", ">", ",", "GeneralDataset", "<", "L", ",", "F", ">", ",", "CrossValidator", ".", "SavedState", ">", ",", "Double", ">", "(", ")", "{", "public", "Double", "apply", "(", "Triple", "<", "GeneralDataset", "<", "L", ",", "F", ">", ",", "GeneralDataset", "<", "L", ",", "F", ">", ",", "CrossValidator", ".", "SavedState", ">", "fold", ")", "{", "GeneralDataset", "<", "L", ",", "F", ">", "trainSet", "=", "fold", ".", "first", "(", ")", ";", "GeneralDataset", "<", "L", ",", "F", ">", "devSet", "=", "fold", ".", "second", "(", ")", ";", "alphaFile", "=", "(", "File", ")", "fold", ".", "third", "(", ")", ".", "state", ";", "//train(trainSet,true,true);\r", "SVMLightClassifier", "<", "L", ",", "F", ">", "classifier", "=", "trainClassifierBasic", "(", "trainSet", ")", ";", "fold", ".", "third", "(", ")", ".", "state", "=", "alphaFile", ";", "return", "scorer", ".", "score", "(", "classifier", ",", "devSet", ")", ";", "}", "}", ";", "Function", "<", "Double", ",", "Double", ">", "negativeScorer", "=", "new", "Function", "<", "Double", ",", "Double", ">", "(", ")", "{", "public", "Double", "apply", "(", "Double", "cToTry", ")", "{", "C", "=", "cToTry", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "print", "(", "\"C = \"", "+", "cToTry", "+", "\" \"", ")", ";", "}", "Double", "averageScore", "=", "crossValidator", ".", "computeAverage", "(", "score", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\" -> average Score: \"", "+", "averageScore", ")", ";", "}", "return", "-", "averageScore", ";", "}", "}", ";", "C", "=", "minimizer", ".", "minimize", "(", "negativeScorer", ")", ";", "useAlphaFile", "=", "false", ";", "useSigmoid", "=", "oldUseSigmoid", ";", "}" ]
This method will cross validate on the given data and number of folds to find the optimal C. The scorer is how you determine what to optimize for (F-score, accuracy, etc). The C is then saved, so that if you train a classifier after calling this method, that C will be used.
[ "This", "method", "will", "cross", "validate", "on", "the", "given", "data", "and", "number", "of", "folds", "to", "find", "the", "optimal", "C", ".", "The", "scorer", "is", "how", "you", "determine", "what", "to", "optimize", "for", "(", "F", "-", "score", "accuracy", "etc", ")", ".", "The", "C", "is", "then", "saved", "so", "that", "if", "you", "train", "a", "classifier", "after", "calling", "this", "method", "that", "C", "will", "be", "used", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/SVMLightClassifierFactory.java#L243-L281
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/builder/SqlInfoBuilder.java
SqlInfoBuilder.buildInSql
public SqlInfo buildInSql(String fieldText, Object[] values) { """ 构建" IN "范围查询的SqlInfo信息. @param fieldText 数据库字段文本 @param values 对象数组的值 @return 返回SqlInfo信息 """ if (values == null || values.length == 0) { return sqlInfo; } // 遍历数组,并遍历添加in查询的替换符和参数 this.suffix = StringHelper.isBlank(this.suffix) ? ZealotConst.IN_SUFFIX : this.suffix; join.append(prefix).append(fieldText).append(this.suffix).append("("); int len = values.length; for (int i = 0; i < len; i++) { if (i == len - 1) { join.append("?) "); } else { join.append("?, "); } params.add(values[i]); } return sqlInfo.setJoin(join).setParams(params); }
java
public SqlInfo buildInSql(String fieldText, Object[] values) { if (values == null || values.length == 0) { return sqlInfo; } // 遍历数组,并遍历添加in查询的替换符和参数 this.suffix = StringHelper.isBlank(this.suffix) ? ZealotConst.IN_SUFFIX : this.suffix; join.append(prefix).append(fieldText).append(this.suffix).append("("); int len = values.length; for (int i = 0; i < len; i++) { if (i == len - 1) { join.append("?) "); } else { join.append("?, "); } params.add(values[i]); } return sqlInfo.setJoin(join).setParams(params); }
[ "public", "SqlInfo", "buildInSql", "(", "String", "fieldText", ",", "Object", "[", "]", "values", ")", "{", "if", "(", "values", "==", "null", "||", "values", ".", "length", "==", "0", ")", "{", "return", "sqlInfo", ";", "}", "// 遍历数组,并遍历添加in查询的替换符和参数", "this", ".", "suffix", "=", "StringHelper", ".", "isBlank", "(", "this", ".", "suffix", ")", "?", "ZealotConst", ".", "IN_SUFFIX", ":", "this", ".", "suffix", ";", "join", ".", "append", "(", "prefix", ")", ".", "append", "(", "fieldText", ")", ".", "append", "(", "this", ".", "suffix", ")", ".", "append", "(", "\"(\"", ")", ";", "int", "len", "=", "values", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "i", "==", "len", "-", "1", ")", "{", "join", ".", "append", "(", "\"?) \"", ")", ";", "}", "else", "{", "join", ".", "append", "(", "\"?, \"", ")", ";", "}", "params", ".", "add", "(", "values", "[", "i", "]", ")", ";", "}", "return", "sqlInfo", ".", "setJoin", "(", "join", ")", ".", "setParams", "(", "params", ")", ";", "}" ]
构建" IN "范围查询的SqlInfo信息. @param fieldText 数据库字段文本 @param values 对象数组的值 @return 返回SqlInfo信息
[ "构建", "IN", "范围查询的SqlInfo信息", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/builder/SqlInfoBuilder.java#L134-L153
kaazing/gateway
security/src/main/java/org/kaazing/gateway/security/auth/context/DefaultLoginContextFactory.java
DefaultLoginContextFactory.createLoginContext
@Override public LoginContext createLoginContext(Subject subject, final String username, final char[] password) throws LoginException { """ For login context providers that can abstract their tokens into a username and password, this is a utility method that can create the login context based on the provided username and password. @param subject the subject that has been created for the user, or <code>null</code> if none has been created. @param username the presented user name @param password the presented password @return a login context based on the parameters @throws LoginException when a login context cannot be created """ final DefaultLoginResult loginResult = new DefaultLoginResult(); CallbackHandler handler = new CallbackHandler() { @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) { if (callback instanceof NameCallback) { ((NameCallback) callback).setName(username); } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(password); } else if (callback instanceof LoginResultCallback) { ((LoginResultCallback) callback).setLoginResult(loginResult); } else { throw new UnsupportedCallbackException(callback); } } } }; // use JAAS to login and establish subject principals return createLoginContext(subject, handler, loginResult); }
java
@Override public LoginContext createLoginContext(Subject subject, final String username, final char[] password) throws LoginException { final DefaultLoginResult loginResult = new DefaultLoginResult(); CallbackHandler handler = new CallbackHandler() { @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) { if (callback instanceof NameCallback) { ((NameCallback) callback).setName(username); } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(password); } else if (callback instanceof LoginResultCallback) { ((LoginResultCallback) callback).setLoginResult(loginResult); } else { throw new UnsupportedCallbackException(callback); } } } }; // use JAAS to login and establish subject principals return createLoginContext(subject, handler, loginResult); }
[ "@", "Override", "public", "LoginContext", "createLoginContext", "(", "Subject", "subject", ",", "final", "String", "username", ",", "final", "char", "[", "]", "password", ")", "throws", "LoginException", "{", "final", "DefaultLoginResult", "loginResult", "=", "new", "DefaultLoginResult", "(", ")", ";", "CallbackHandler", "handler", "=", "new", "CallbackHandler", "(", ")", "{", "@", "Override", "public", "void", "handle", "(", "Callback", "[", "]", "callbacks", ")", "throws", "IOException", ",", "UnsupportedCallbackException", "{", "for", "(", "Callback", "callback", ":", "callbacks", ")", "{", "if", "(", "callback", "instanceof", "NameCallback", ")", "{", "(", "(", "NameCallback", ")", "callback", ")", ".", "setName", "(", "username", ")", ";", "}", "else", "if", "(", "callback", "instanceof", "PasswordCallback", ")", "{", "(", "(", "PasswordCallback", ")", "callback", ")", ".", "setPassword", "(", "password", ")", ";", "}", "else", "if", "(", "callback", "instanceof", "LoginResultCallback", ")", "{", "(", "(", "LoginResultCallback", ")", "callback", ")", ".", "setLoginResult", "(", "loginResult", ")", ";", "}", "else", "{", "throw", "new", "UnsupportedCallbackException", "(", "callback", ")", ";", "}", "}", "}", "}", ";", "// use JAAS to login and establish subject principals", "return", "createLoginContext", "(", "subject", ",", "handler", ",", "loginResult", ")", ";", "}" ]
For login context providers that can abstract their tokens into a username and password, this is a utility method that can create the login context based on the provided username and password. @param subject the subject that has been created for the user, or <code>null</code> if none has been created. @param username the presented user name @param password the presented password @return a login context based on the parameters @throws LoginException when a login context cannot be created
[ "For", "login", "context", "providers", "that", "can", "abstract", "their", "tokens", "into", "a", "username", "and", "password", "this", "is", "a", "utility", "method", "that", "can", "create", "the", "login", "context", "based", "on", "the", "provided", "username", "and", "password", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/security/src/main/java/org/kaazing/gateway/security/auth/context/DefaultLoginContextFactory.java#L155-L179
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java
AuthorizationProcessManager.createTokenRequestHeaders
private HashMap<String, String> createTokenRequestHeaders(String grantCode) { """ Generate the headers that will be used during the token request phase @param grantCode from the authorization phase @return Map with all the headers """ JSONObject payload = new JSONObject(); HashMap<String, String> headers; try { payload.put("code", grantCode); KeyPair keyPair = certificateStore.getStoredKeyPair(); String jws = jsonSigner.sign(keyPair, payload); headers = new HashMap<>(1); headers.put("X-WL-Authenticate", jws); } catch (Exception e) { throw new RuntimeException("Failed to create token request headers", e); } return headers; }
java
private HashMap<String, String> createTokenRequestHeaders(String grantCode) { JSONObject payload = new JSONObject(); HashMap<String, String> headers; try { payload.put("code", grantCode); KeyPair keyPair = certificateStore.getStoredKeyPair(); String jws = jsonSigner.sign(keyPair, payload); headers = new HashMap<>(1); headers.put("X-WL-Authenticate", jws); } catch (Exception e) { throw new RuntimeException("Failed to create token request headers", e); } return headers; }
[ "private", "HashMap", "<", "String", ",", "String", ">", "createTokenRequestHeaders", "(", "String", "grantCode", ")", "{", "JSONObject", "payload", "=", "new", "JSONObject", "(", ")", ";", "HashMap", "<", "String", ",", "String", ">", "headers", ";", "try", "{", "payload", ".", "put", "(", "\"code\"", ",", "grantCode", ")", ";", "KeyPair", "keyPair", "=", "certificateStore", ".", "getStoredKeyPair", "(", ")", ";", "String", "jws", "=", "jsonSigner", ".", "sign", "(", "keyPair", ",", "payload", ")", ";", "headers", "=", "new", "HashMap", "<>", "(", "1", ")", ";", "headers", ".", "put", "(", "\"X-WL-Authenticate\"", ",", "jws", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failed to create token request headers\"", ",", "e", ")", ";", "}", "return", "headers", ";", "}" ]
Generate the headers that will be used during the token request phase @param grantCode from the authorization phase @return Map with all the headers
[ "Generate", "the", "headers", "that", "will", "be", "used", "during", "the", "token", "request", "phase" ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java#L361-L378
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java
XOrganizationalExtension.assignGroup
public void assignGroup(XEvent event, String group) { """ Assigns the group attribute value for a given event. @param event Event to be modified. @param resource Group string to be assigned. """ if (group != null && group.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_GROUP.clone(); attr.setValue(group.trim()); event.getAttributes().put(KEY_GROUP, attr); } }
java
public void assignGroup(XEvent event, String group) { if (group != null && group.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_GROUP.clone(); attr.setValue(group.trim()); event.getAttributes().put(KEY_GROUP, attr); } }
[ "public", "void", "assignGroup", "(", "XEvent", "event", ",", "String", "group", ")", "{", "if", "(", "group", "!=", "null", "&&", "group", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "XAttributeLiteral", "attr", "=", "(", "XAttributeLiteral", ")", "ATTR_GROUP", ".", "clone", "(", ")", ";", "attr", ".", "setValue", "(", "group", ".", "trim", "(", ")", ")", ";", "event", ".", "getAttributes", "(", ")", ".", "put", "(", "KEY_GROUP", ",", "attr", ")", ";", "}", "}" ]
Assigns the group attribute value for a given event. @param event Event to be modified. @param resource Group string to be assigned.
[ "Assigns", "the", "group", "attribute", "value", "for", "a", "given", "event", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java#L261-L267
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java
DBFDriverFunction.getSQLColumnTypes
public static String getSQLColumnTypes(DbaseFileHeader header, boolean isH2Database) throws IOException { """ Return SQL Columns declaration @param header DBAse file header @param isH2Database true if H2 database @return Array of columns ex: ["id INTEGER", "len DOUBLE"] @throws IOException """ StringBuilder stringBuilder = new StringBuilder(); for(int idColumn = 0; idColumn < header.getNumFields(); idColumn++) { if(idColumn > 0) { stringBuilder.append(", "); } String fieldName = TableLocation.capsIdentifier(header.getFieldName(idColumn), isH2Database); stringBuilder.append(TableLocation.quoteIdentifier(fieldName,isH2Database)); stringBuilder.append(" "); switch (header.getFieldType(idColumn)) { // (L)logical (T,t,F,f,Y,y,N,n) case 'l': case 'L': stringBuilder.append("BOOLEAN"); break; // (C)character (String) case 'c': case 'C': stringBuilder.append("VARCHAR("); // Append size int length = header.getFieldLength(idColumn); stringBuilder.append(String.valueOf(length)); stringBuilder.append(")"); break; // (D)date (Date) case 'd': case 'D': stringBuilder.append("DATE"); break; // (F)floating (Double) case 'n': case 'N': if ((header.getFieldDecimalCount(idColumn) == 0)) { if ((header.getFieldLength(idColumn) >= 0) && (header.getFieldLength(idColumn) < 10)) { stringBuilder.append("INT4"); } else { stringBuilder.append("INT8"); } } else { stringBuilder.append("FLOAT8"); } break; case 'f': case 'F': // floating point number case 'o': case 'O': // floating point number stringBuilder.append("FLOAT8"); break; default: throw new IOException("Unknown DBF field type " + header.getFieldType(idColumn)); } } return stringBuilder.toString(); }
java
public static String getSQLColumnTypes(DbaseFileHeader header, boolean isH2Database) throws IOException { StringBuilder stringBuilder = new StringBuilder(); for(int idColumn = 0; idColumn < header.getNumFields(); idColumn++) { if(idColumn > 0) { stringBuilder.append(", "); } String fieldName = TableLocation.capsIdentifier(header.getFieldName(idColumn), isH2Database); stringBuilder.append(TableLocation.quoteIdentifier(fieldName,isH2Database)); stringBuilder.append(" "); switch (header.getFieldType(idColumn)) { // (L)logical (T,t,F,f,Y,y,N,n) case 'l': case 'L': stringBuilder.append("BOOLEAN"); break; // (C)character (String) case 'c': case 'C': stringBuilder.append("VARCHAR("); // Append size int length = header.getFieldLength(idColumn); stringBuilder.append(String.valueOf(length)); stringBuilder.append(")"); break; // (D)date (Date) case 'd': case 'D': stringBuilder.append("DATE"); break; // (F)floating (Double) case 'n': case 'N': if ((header.getFieldDecimalCount(idColumn) == 0)) { if ((header.getFieldLength(idColumn) >= 0) && (header.getFieldLength(idColumn) < 10)) { stringBuilder.append("INT4"); } else { stringBuilder.append("INT8"); } } else { stringBuilder.append("FLOAT8"); } break; case 'f': case 'F': // floating point number case 'o': case 'O': // floating point number stringBuilder.append("FLOAT8"); break; default: throw new IOException("Unknown DBF field type " + header.getFieldType(idColumn)); } } return stringBuilder.toString(); }
[ "public", "static", "String", "getSQLColumnTypes", "(", "DbaseFileHeader", "header", ",", "boolean", "isH2Database", ")", "throws", "IOException", "{", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "idColumn", "=", "0", ";", "idColumn", "<", "header", ".", "getNumFields", "(", ")", ";", "idColumn", "++", ")", "{", "if", "(", "idColumn", ">", "0", ")", "{", "stringBuilder", ".", "append", "(", "\", \"", ")", ";", "}", "String", "fieldName", "=", "TableLocation", ".", "capsIdentifier", "(", "header", ".", "getFieldName", "(", "idColumn", ")", ",", "isH2Database", ")", ";", "stringBuilder", ".", "append", "(", "TableLocation", ".", "quoteIdentifier", "(", "fieldName", ",", "isH2Database", ")", ")", ";", "stringBuilder", ".", "append", "(", "\" \"", ")", ";", "switch", "(", "header", ".", "getFieldType", "(", "idColumn", ")", ")", "{", "// (L)logical (T,t,F,f,Y,y,N,n)", "case", "'", "'", ":", "case", "'", "'", ":", "stringBuilder", ".", "append", "(", "\"BOOLEAN\"", ")", ";", "break", ";", "// (C)character (String)", "case", "'", "'", ":", "case", "'", "'", ":", "stringBuilder", ".", "append", "(", "\"VARCHAR(\"", ")", ";", "// Append size", "int", "length", "=", "header", ".", "getFieldLength", "(", "idColumn", ")", ";", "stringBuilder", ".", "append", "(", "String", ".", "valueOf", "(", "length", ")", ")", ";", "stringBuilder", ".", "append", "(", "\")\"", ")", ";", "break", ";", "// (D)date (Date)", "case", "'", "'", ":", "case", "'", "'", ":", "stringBuilder", ".", "append", "(", "\"DATE\"", ")", ";", "break", ";", "// (F)floating (Double)", "case", "'", "'", ":", "case", "'", "'", ":", "if", "(", "(", "header", ".", "getFieldDecimalCount", "(", "idColumn", ")", "==", "0", ")", ")", "{", "if", "(", "(", "header", ".", "getFieldLength", "(", "idColumn", ")", ">=", "0", ")", "&&", "(", "header", ".", "getFieldLength", "(", "idColumn", ")", "<", "10", ")", ")", "{", "stringBuilder", ".", "append", "(", "\"INT4\"", ")", ";", "}", "else", "{", "stringBuilder", ".", "append", "(", "\"INT8\"", ")", ";", "}", "}", "else", "{", "stringBuilder", ".", "append", "(", "\"FLOAT8\"", ")", ";", "}", "break", ";", "case", "'", "'", ":", "case", "'", "'", ":", "// floating point number", "case", "'", "'", ":", "case", "'", "'", ":", "// floating point number", "stringBuilder", ".", "append", "(", "\"FLOAT8\"", ")", ";", "break", ";", "default", ":", "throw", "new", "IOException", "(", "\"Unknown DBF field type \"", "+", "header", ".", "getFieldType", "(", "idColumn", ")", ")", ";", "}", "}", "return", "stringBuilder", ".", "toString", "(", ")", ";", "}" ]
Return SQL Columns declaration @param header DBAse file header @param isH2Database true if H2 database @return Array of columns ex: ["id INTEGER", "len DOUBLE"] @throws IOException
[ "Return", "SQL", "Columns", "declaration" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java#L304-L358
cdk/cdk
legacy/src/main/java/org/openscience/cdk/ringsearch/FiguerasSSSRFinder.java
FiguerasSSSRFinder.checkEdges
private IBond checkEdges(IRing ring, IAtomContainer molecule) { """ Selects an optimum edge for elimination in structures without N2 nodes. <p>This might be severely broken! Would have helped if there was an explanation of how this algorithm worked. @param ring @param molecule """ IRing r1, r2; IRingSet ringSet = ring.getBuilder().newInstance(IRingSet.class); IBond bond; int minMaxSize = Integer.MAX_VALUE; int minMax = 0; logger.debug("Molecule: " + molecule); Iterator<IBond> bonds = ring.bonds().iterator(); while (bonds.hasNext()) { bond = (IBond) bonds.next(); molecule.removeElectronContainer(bond); r1 = getRing(bond.getBegin(), molecule); r2 = getRing(bond.getEnd(), molecule); logger.debug("checkEdges: " + bond); if (r1.getAtomCount() > r2.getAtomCount()) { ringSet.addAtomContainer(r1); } else { ringSet.addAtomContainer(r2); } molecule.addBond(bond); } for (int i = 0; i < ringSet.getAtomContainerCount(); i++) { if (((IRing) ringSet.getAtomContainer(i)).getBondCount() < minMaxSize) { minMaxSize = ((IRing) ringSet.getAtomContainer(i)).getBondCount(); minMax = i; } } return (IBond) ring.getElectronContainer(minMax); }
java
private IBond checkEdges(IRing ring, IAtomContainer molecule) { IRing r1, r2; IRingSet ringSet = ring.getBuilder().newInstance(IRingSet.class); IBond bond; int minMaxSize = Integer.MAX_VALUE; int minMax = 0; logger.debug("Molecule: " + molecule); Iterator<IBond> bonds = ring.bonds().iterator(); while (bonds.hasNext()) { bond = (IBond) bonds.next(); molecule.removeElectronContainer(bond); r1 = getRing(bond.getBegin(), molecule); r2 = getRing(bond.getEnd(), molecule); logger.debug("checkEdges: " + bond); if (r1.getAtomCount() > r2.getAtomCount()) { ringSet.addAtomContainer(r1); } else { ringSet.addAtomContainer(r2); } molecule.addBond(bond); } for (int i = 0; i < ringSet.getAtomContainerCount(); i++) { if (((IRing) ringSet.getAtomContainer(i)).getBondCount() < minMaxSize) { minMaxSize = ((IRing) ringSet.getAtomContainer(i)).getBondCount(); minMax = i; } } return (IBond) ring.getElectronContainer(minMax); }
[ "private", "IBond", "checkEdges", "(", "IRing", "ring", ",", "IAtomContainer", "molecule", ")", "{", "IRing", "r1", ",", "r2", ";", "IRingSet", "ringSet", "=", "ring", ".", "getBuilder", "(", ")", ".", "newInstance", "(", "IRingSet", ".", "class", ")", ";", "IBond", "bond", ";", "int", "minMaxSize", "=", "Integer", ".", "MAX_VALUE", ";", "int", "minMax", "=", "0", ";", "logger", ".", "debug", "(", "\"Molecule: \"", "+", "molecule", ")", ";", "Iterator", "<", "IBond", ">", "bonds", "=", "ring", ".", "bonds", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "bonds", ".", "hasNext", "(", ")", ")", "{", "bond", "=", "(", "IBond", ")", "bonds", ".", "next", "(", ")", ";", "molecule", ".", "removeElectronContainer", "(", "bond", ")", ";", "r1", "=", "getRing", "(", "bond", ".", "getBegin", "(", ")", ",", "molecule", ")", ";", "r2", "=", "getRing", "(", "bond", ".", "getEnd", "(", ")", ",", "molecule", ")", ";", "logger", ".", "debug", "(", "\"checkEdges: \"", "+", "bond", ")", ";", "if", "(", "r1", ".", "getAtomCount", "(", ")", ">", "r2", ".", "getAtomCount", "(", ")", ")", "{", "ringSet", ".", "addAtomContainer", "(", "r1", ")", ";", "}", "else", "{", "ringSet", ".", "addAtomContainer", "(", "r2", ")", ";", "}", "molecule", ".", "addBond", "(", "bond", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ringSet", ".", "getAtomContainerCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "(", "(", "IRing", ")", "ringSet", ".", "getAtomContainer", "(", "i", ")", ")", ".", "getBondCount", "(", ")", "<", "minMaxSize", ")", "{", "minMaxSize", "=", "(", "(", "IRing", ")", "ringSet", ".", "getAtomContainer", "(", "i", ")", ")", ".", "getBondCount", "(", ")", ";", "minMax", "=", "i", ";", "}", "}", "return", "(", "IBond", ")", "ring", ".", "getElectronContainer", "(", "minMax", ")", ";", "}" ]
Selects an optimum edge for elimination in structures without N2 nodes. <p>This might be severely broken! Would have helped if there was an explanation of how this algorithm worked. @param ring @param molecule
[ "Selects", "an", "optimum", "edge", "for", "elimination", "in", "structures", "without", "N2", "nodes", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/ringsearch/FiguerasSSSRFinder.java#L374-L402
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201808/customfieldservice/GetAllCustomFields.java
GetAllCustomFields.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { """ Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. """ // Get the CustomFieldService. CustomFieldServiceInterface customFieldService = adManagerServices.get(session, CustomFieldServiceInterface.class); // Create a statement to get all custom fields. StatementBuilder statementBuilder = new StatementBuilder() .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get custom fields by statement. CustomFieldPage page = customFieldService.getCustomFieldsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (CustomField customField : page.getResults()) { System.out.printf( "%d) Custom field with ID %d and name '%s' was found.%n", i++, customField.getId(), customField.getName()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the CustomFieldService. CustomFieldServiceInterface customFieldService = adManagerServices.get(session, CustomFieldServiceInterface.class); // Create a statement to get all custom fields. StatementBuilder statementBuilder = new StatementBuilder() .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get custom fields by statement. CustomFieldPage page = customFieldService.getCustomFieldsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (CustomField customField : page.getResults()) { System.out.printf( "%d) Custom field with ID %d and name '%s' was found.%n", i++, customField.getId(), customField.getName()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "// Get the CustomFieldService.", "CustomFieldServiceInterface", "customFieldService", "=", "adManagerServices", ".", "get", "(", "session", ",", "CustomFieldServiceInterface", ".", "class", ")", ";", "// Create a statement to get all custom fields.", "StatementBuilder", "statementBuilder", "=", "new", "StatementBuilder", "(", ")", ".", "orderBy", "(", "\"id ASC\"", ")", ".", "limit", "(", "StatementBuilder", ".", "SUGGESTED_PAGE_LIMIT", ")", ";", "// Default for total result set size.", "int", "totalResultSetSize", "=", "0", ";", "do", "{", "// Get custom fields by statement.", "CustomFieldPage", "page", "=", "customFieldService", ".", "getCustomFieldsByStatement", "(", "statementBuilder", ".", "toStatement", "(", ")", ")", ";", "if", "(", "page", ".", "getResults", "(", ")", "!=", "null", ")", "{", "totalResultSetSize", "=", "page", ".", "getTotalResultSetSize", "(", ")", ";", "int", "i", "=", "page", ".", "getStartIndex", "(", ")", ";", "for", "(", "CustomField", "customField", ":", "page", ".", "getResults", "(", ")", ")", "{", "System", ".", "out", ".", "printf", "(", "\"%d) Custom field with ID %d and name '%s' was found.%n\"", ",", "i", "++", ",", "customField", ".", "getId", "(", ")", ",", "customField", ".", "getName", "(", ")", ")", ";", "}", "}", "statementBuilder", ".", "increaseOffsetBy", "(", "StatementBuilder", ".", "SUGGESTED_PAGE_LIMIT", ")", ";", "}", "while", "(", "statementBuilder", ".", "getOffset", "(", ")", "<", "totalResultSetSize", ")", ";", "System", ".", "out", ".", "printf", "(", "\"Number of results found: %d%n\"", ",", "totalResultSetSize", ")", ";", "}" ]
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/customfieldservice/GetAllCustomFields.java#L52-L85
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.populateRecurringException
private void populateRecurringException(ProjectCalendarException mpxjException, Exceptions.Exception xmlException) { """ Writes the details of a recurring exception. @param mpxjException source MPXJ calendar exception @param xmlException target MSPDI exception """ RecurringData data = mpxjException.getRecurring(); xmlException.setEnteredByOccurrences(Boolean.TRUE); xmlException.setOccurrences(NumberHelper.getBigInteger(data.getOccurrences())); switch (data.getRecurrenceType()) { case DAILY: { xmlException.setType(BigInteger.valueOf(7)); xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); break; } case WEEKLY: { xmlException.setType(BigInteger.valueOf(6)); xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); xmlException.setDaysOfWeek(getDaysOfTheWeek(data)); break; } case MONTHLY: { xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); if (data.getRelative()) { xmlException.setType(BigInteger.valueOf(5)); xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2)); xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1)); } else { xmlException.setType(BigInteger.valueOf(4)); xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber())); } break; } case YEARLY: { xmlException.setMonth(BigInteger.valueOf(NumberHelper.getInt(data.getMonthNumber()) - 1)); if (data.getRelative()) { xmlException.setType(BigInteger.valueOf(3)); xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2)); xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1)); } else { xmlException.setType(BigInteger.valueOf(2)); xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber())); } } } }
java
private void populateRecurringException(ProjectCalendarException mpxjException, Exceptions.Exception xmlException) { RecurringData data = mpxjException.getRecurring(); xmlException.setEnteredByOccurrences(Boolean.TRUE); xmlException.setOccurrences(NumberHelper.getBigInteger(data.getOccurrences())); switch (data.getRecurrenceType()) { case DAILY: { xmlException.setType(BigInteger.valueOf(7)); xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); break; } case WEEKLY: { xmlException.setType(BigInteger.valueOf(6)); xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); xmlException.setDaysOfWeek(getDaysOfTheWeek(data)); break; } case MONTHLY: { xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency())); if (data.getRelative()) { xmlException.setType(BigInteger.valueOf(5)); xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2)); xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1)); } else { xmlException.setType(BigInteger.valueOf(4)); xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber())); } break; } case YEARLY: { xmlException.setMonth(BigInteger.valueOf(NumberHelper.getInt(data.getMonthNumber()) - 1)); if (data.getRelative()) { xmlException.setType(BigInteger.valueOf(3)); xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2)); xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1)); } else { xmlException.setType(BigInteger.valueOf(2)); xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber())); } } } }
[ "private", "void", "populateRecurringException", "(", "ProjectCalendarException", "mpxjException", ",", "Exceptions", ".", "Exception", "xmlException", ")", "{", "RecurringData", "data", "=", "mpxjException", ".", "getRecurring", "(", ")", ";", "xmlException", ".", "setEnteredByOccurrences", "(", "Boolean", ".", "TRUE", ")", ";", "xmlException", ".", "setOccurrences", "(", "NumberHelper", ".", "getBigInteger", "(", "data", ".", "getOccurrences", "(", ")", ")", ")", ";", "switch", "(", "data", ".", "getRecurrenceType", "(", ")", ")", "{", "case", "DAILY", ":", "{", "xmlException", ".", "setType", "(", "BigInteger", ".", "valueOf", "(", "7", ")", ")", ";", "xmlException", ".", "setPeriod", "(", "NumberHelper", ".", "getBigInteger", "(", "data", ".", "getFrequency", "(", ")", ")", ")", ";", "break", ";", "}", "case", "WEEKLY", ":", "{", "xmlException", ".", "setType", "(", "BigInteger", ".", "valueOf", "(", "6", ")", ")", ";", "xmlException", ".", "setPeriod", "(", "NumberHelper", ".", "getBigInteger", "(", "data", ".", "getFrequency", "(", ")", ")", ")", ";", "xmlException", ".", "setDaysOfWeek", "(", "getDaysOfTheWeek", "(", "data", ")", ")", ";", "break", ";", "}", "case", "MONTHLY", ":", "{", "xmlException", ".", "setPeriod", "(", "NumberHelper", ".", "getBigInteger", "(", "data", ".", "getFrequency", "(", ")", ")", ")", ";", "if", "(", "data", ".", "getRelative", "(", ")", ")", "{", "xmlException", ".", "setType", "(", "BigInteger", ".", "valueOf", "(", "5", ")", ")", ";", "xmlException", ".", "setMonthItem", "(", "BigInteger", ".", "valueOf", "(", "data", ".", "getDayOfWeek", "(", ")", ".", "getValue", "(", ")", "+", "2", ")", ")", ";", "xmlException", ".", "setMonthPosition", "(", "BigInteger", ".", "valueOf", "(", "NumberHelper", ".", "getInt", "(", "data", ".", "getDayNumber", "(", ")", ")", "-", "1", ")", ")", ";", "}", "else", "{", "xmlException", ".", "setType", "(", "BigInteger", ".", "valueOf", "(", "4", ")", ")", ";", "xmlException", ".", "setMonthDay", "(", "NumberHelper", ".", "getBigInteger", "(", "data", ".", "getDayNumber", "(", ")", ")", ")", ";", "}", "break", ";", "}", "case", "YEARLY", ":", "{", "xmlException", ".", "setMonth", "(", "BigInteger", ".", "valueOf", "(", "NumberHelper", ".", "getInt", "(", "data", ".", "getMonthNumber", "(", ")", ")", "-", "1", ")", ")", ";", "if", "(", "data", ".", "getRelative", "(", ")", ")", "{", "xmlException", ".", "setType", "(", "BigInteger", ".", "valueOf", "(", "3", ")", ")", ";", "xmlException", ".", "setMonthItem", "(", "BigInteger", ".", "valueOf", "(", "data", ".", "getDayOfWeek", "(", ")", ".", "getValue", "(", ")", "+", "2", ")", ")", ";", "xmlException", ".", "setMonthPosition", "(", "BigInteger", ".", "valueOf", "(", "NumberHelper", ".", "getInt", "(", "data", ".", "getDayNumber", "(", ")", ")", "-", "1", ")", ")", ";", "}", "else", "{", "xmlException", ".", "setType", "(", "BigInteger", ".", "valueOf", "(", "2", ")", ")", ";", "xmlException", ".", "setMonthDay", "(", "NumberHelper", ".", "getBigInteger", "(", "data", ".", "getDayNumber", "(", ")", ")", ")", ";", "}", "}", "}", "}" ]
Writes the details of a recurring exception. @param mpxjException source MPXJ calendar exception @param xmlException target MSPDI exception
[ "Writes", "the", "details", "of", "a", "recurring", "exception", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L584-L640
vdmeer/asciitable
src/main/java/de/vandermeer/asciitable/AsciiTable.java
AsciiTable.addRow
public final AT_Row addRow(Object ...columns) throws NullPointerException, AsciiTableException { """ Adds a content row to the table. For the first content row added, the number of objects given here determines the number of columns in the table. For every subsequent content row, the array must have an entry for each column, i.e. the size of the array must be the same as the result of {@link #getColNumber()}. @param columns content of the columns for the row, must not be null @return the created row for further customization @throws {@link NullPointerException} if columns was null @throws {@link AsciiTableException} if columns does not have the correct size (more or less entries than columns defined for the table) """ AT_Row ret = AT_Row.createContentRow(columns, TableRowStyle.NORMAL); if(this.colNumber==0){ this.colNumber = columns.length; } else{ if(columns.length!=this.colNumber){ throw new AsciiTableException("wrong columns argument", "wrong number of columns, expected " + this.colNumber + " received " + columns.length); } } this.rows.add(ret); return ret; }
java
public final AT_Row addRow(Object ...columns) throws NullPointerException, AsciiTableException { AT_Row ret = AT_Row.createContentRow(columns, TableRowStyle.NORMAL); if(this.colNumber==0){ this.colNumber = columns.length; } else{ if(columns.length!=this.colNumber){ throw new AsciiTableException("wrong columns argument", "wrong number of columns, expected " + this.colNumber + " received " + columns.length); } } this.rows.add(ret); return ret; }
[ "public", "final", "AT_Row", "addRow", "(", "Object", "...", "columns", ")", "throws", "NullPointerException", ",", "AsciiTableException", "{", "AT_Row", "ret", "=", "AT_Row", ".", "createContentRow", "(", "columns", ",", "TableRowStyle", ".", "NORMAL", ")", ";", "if", "(", "this", ".", "colNumber", "==", "0", ")", "{", "this", ".", "colNumber", "=", "columns", ".", "length", ";", "}", "else", "{", "if", "(", "columns", ".", "length", "!=", "this", ".", "colNumber", ")", "{", "throw", "new", "AsciiTableException", "(", "\"wrong columns argument\"", ",", "\"wrong number of columns, expected \"", "+", "this", ".", "colNumber", "+", "\" received \"", "+", "columns", ".", "length", ")", ";", "}", "}", "this", ".", "rows", ".", "add", "(", "ret", ")", ";", "return", "ret", ";", "}" ]
Adds a content row to the table. For the first content row added, the number of objects given here determines the number of columns in the table. For every subsequent content row, the array must have an entry for each column, i.e. the size of the array must be the same as the result of {@link #getColNumber()}. @param columns content of the columns for the row, must not be null @return the created row for further customization @throws {@link NullPointerException} if columns was null @throws {@link AsciiTableException} if columns does not have the correct size (more or less entries than columns defined for the table)
[ "Adds", "a", "content", "row", "to", "the", "table", ".", "For", "the", "first", "content", "row", "added", "the", "number", "of", "objects", "given", "here", "determines", "the", "number", "of", "columns", "in", "the", "table", ".", "For", "every", "subsequent", "content", "row", "the", "array", "must", "have", "an", "entry", "for", "each", "column", "i", ".", "e", ".", "the", "size", "of", "the", "array", "must", "be", "the", "same", "as", "the", "result", "of", "{" ]
train
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L101-L115
jbundle/webapp
xsl/src/main/java/org/jbundle/util/webapp/xsl/XSLServlet.java
XSLServlet.service
@Override public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { """ process an HTML get or post. @exception ServletException From inherited class. @exception IOException From inherited class. """ String sourceFileName = req.getParameter("source"); String styleSheetFileName = req.getParameter("stylesheet"); FileReader sourceFileReader = new FileReader(sourceFileName); FileReader stylesheetFileReader = new FileReader(styleSheetFileName); ServletOutputStream outStream = res.getOutputStream(); try { StreamSource source = new StreamSource(sourceFileReader); Result result = new StreamResult(outStream); TransformerFactory tFact = TransformerFactory.newInstance(); StreamSource streamTransformer = new StreamSource(stylesheetFileReader); Transformer transformer = tFact.newTransformer(streamTransformer); transformer.transform(source, result); } catch (TransformerConfigurationException ex) { ex.printStackTrace(); } catch (TransformerException ex) { ex.printStackTrace(); } super.service(req, res); }
java
@Override public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String sourceFileName = req.getParameter("source"); String styleSheetFileName = req.getParameter("stylesheet"); FileReader sourceFileReader = new FileReader(sourceFileName); FileReader stylesheetFileReader = new FileReader(styleSheetFileName); ServletOutputStream outStream = res.getOutputStream(); try { StreamSource source = new StreamSource(sourceFileReader); Result result = new StreamResult(outStream); TransformerFactory tFact = TransformerFactory.newInstance(); StreamSource streamTransformer = new StreamSource(stylesheetFileReader); Transformer transformer = tFact.newTransformer(streamTransformer); transformer.transform(source, result); } catch (TransformerConfigurationException ex) { ex.printStackTrace(); } catch (TransformerException ex) { ex.printStackTrace(); } super.service(req, res); }
[ "@", "Override", "public", "void", "service", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "ServletException", ",", "IOException", "{", "String", "sourceFileName", "=", "req", ".", "getParameter", "(", "\"source\"", ")", ";", "String", "styleSheetFileName", "=", "req", ".", "getParameter", "(", "\"stylesheet\"", ")", ";", "FileReader", "sourceFileReader", "=", "new", "FileReader", "(", "sourceFileName", ")", ";", "FileReader", "stylesheetFileReader", "=", "new", "FileReader", "(", "styleSheetFileName", ")", ";", "ServletOutputStream", "outStream", "=", "res", ".", "getOutputStream", "(", ")", ";", "try", "{", "StreamSource", "source", "=", "new", "StreamSource", "(", "sourceFileReader", ")", ";", "Result", "result", "=", "new", "StreamResult", "(", "outStream", ")", ";", "TransformerFactory", "tFact", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "StreamSource", "streamTransformer", "=", "new", "StreamSource", "(", "stylesheetFileReader", ")", ";", "Transformer", "transformer", "=", "tFact", ".", "newTransformer", "(", "streamTransformer", ")", ";", "transformer", ".", "transform", "(", "source", ",", "result", ")", ";", "}", "catch", "(", "TransformerConfigurationException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "TransformerException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "super", ".", "service", "(", "req", ",", "res", ")", ";", "}" ]
process an HTML get or post. @exception ServletException From inherited class. @exception IOException From inherited class.
[ "process", "an", "HTML", "get", "or", "post", "." ]
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/xsl/src/main/java/org/jbundle/util/webapp/xsl/XSLServlet.java#L78-L107
igniterealtime/Smack
smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java
Workgroup.joinQueue
public void joinQueue(Map<String,Object> metadata, Jid userID) throws XMPPException, SmackException, InterruptedException { """ <p>Joins the workgroup queue to wait to be routed to an agent. After joining the queue, queue status events will be sent to indicate the user's position and estimated time left in the queue. Once joining the queue, there are three ways the user can leave the queue: <ul> <li>The user is routed to an agent, which triggers a GroupChat invitation. <li>The user asks to leave the queue by calling the {@link #departQueue} method. <li>A server error occurs, or an administrator explicitly removes the user from the queue. </ul> A user cannot request to join the queue again if already in the queue. Therefore, this method will throw an IllegalStateException if the user is already in the queue.<p> Some servers may be configured to require certain meta-data in order to join the queue.<p> The server tracks the conversations that a user has with agents over time. By default, that tracking is done using the user's JID. However, this is not always possible. For example, when the user is logged in anonymously using a web client. In that case the user ID might be a randomly generated value put into a persistent cookie or a username obtained via the session. When specified, that userID will be used instead of the user's JID to track conversations. The server will ignore a manually specified userID if the user's connection to the server is not anonymous. @param metadata metadata to create a dataform from. @param userID String that represents the ID of the user when using anonymous sessions or <tt>null</tt> if a userID should not be used. @throws XMPPException if an error occurred joining the queue. An error may indicate that a connection failure occurred or that the server explicitly rejected the request to join the queue. @throws SmackException @throws InterruptedException """ // If already in the queue ignore the join request. if (inQueue) { throw new IllegalStateException("Already in queue " + workgroupJID); } // Build dataform from metadata Form form = new Form(DataForm.Type.submit); Iterator<String> iter = metadata.keySet().iterator(); while (iter.hasNext()) { String name = iter.next(); String value = metadata.get(name).toString(); FormField field = new FormField(name); field.setType(FormField.Type.text_single); form.addField(field); form.setAnswer(name, value); } joinQueue(form, userID); }
java
public void joinQueue(Map<String,Object> metadata, Jid userID) throws XMPPException, SmackException, InterruptedException { // If already in the queue ignore the join request. if (inQueue) { throw new IllegalStateException("Already in queue " + workgroupJID); } // Build dataform from metadata Form form = new Form(DataForm.Type.submit); Iterator<String> iter = metadata.keySet().iterator(); while (iter.hasNext()) { String name = iter.next(); String value = metadata.get(name).toString(); FormField field = new FormField(name); field.setType(FormField.Type.text_single); form.addField(field); form.setAnswer(name, value); } joinQueue(form, userID); }
[ "public", "void", "joinQueue", "(", "Map", "<", "String", ",", "Object", ">", "metadata", ",", "Jid", "userID", ")", "throws", "XMPPException", ",", "SmackException", ",", "InterruptedException", "{", "// If already in the queue ignore the join request.", "if", "(", "inQueue", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Already in queue \"", "+", "workgroupJID", ")", ";", "}", "// Build dataform from metadata", "Form", "form", "=", "new", "Form", "(", "DataForm", ".", "Type", ".", "submit", ")", ";", "Iterator", "<", "String", ">", "iter", "=", "metadata", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "String", "name", "=", "iter", ".", "next", "(", ")", ";", "String", "value", "=", "metadata", ".", "get", "(", "name", ")", ".", "toString", "(", ")", ";", "FormField", "field", "=", "new", "FormField", "(", "name", ")", ";", "field", ".", "setType", "(", "FormField", ".", "Type", ".", "text_single", ")", ";", "form", ".", "addField", "(", "field", ")", ";", "form", ".", "setAnswer", "(", "name", ",", "value", ")", ";", "}", "joinQueue", "(", "form", ",", "userID", ")", ";", "}" ]
<p>Joins the workgroup queue to wait to be routed to an agent. After joining the queue, queue status events will be sent to indicate the user's position and estimated time left in the queue. Once joining the queue, there are three ways the user can leave the queue: <ul> <li>The user is routed to an agent, which triggers a GroupChat invitation. <li>The user asks to leave the queue by calling the {@link #departQueue} method. <li>A server error occurs, or an administrator explicitly removes the user from the queue. </ul> A user cannot request to join the queue again if already in the queue. Therefore, this method will throw an IllegalStateException if the user is already in the queue.<p> Some servers may be configured to require certain meta-data in order to join the queue.<p> The server tracks the conversations that a user has with agents over time. By default, that tracking is done using the user's JID. However, this is not always possible. For example, when the user is logged in anonymously using a web client. In that case the user ID might be a randomly generated value put into a persistent cookie or a username obtained via the session. When specified, that userID will be used instead of the user's JID to track conversations. The server will ignore a manually specified userID if the user's connection to the server is not anonymous. @param metadata metadata to create a dataform from. @param userID String that represents the ID of the user when using anonymous sessions or <tt>null</tt> if a userID should not be used. @throws XMPPException if an error occurred joining the queue. An error may indicate that a connection failure occurred or that the server explicitly rejected the request to join the queue. @throws SmackException @throws InterruptedException
[ "<p", ">", "Joins", "the", "workgroup", "queue", "to", "wait", "to", "be", "routed", "to", "an", "agent", ".", "After", "joining", "the", "queue", "queue", "status", "events", "will", "be", "sent", "to", "indicate", "the", "user", "s", "position", "and", "estimated", "time", "left", "in", "the", "queue", ".", "Once", "joining", "the", "queue", "there", "are", "three", "ways", "the", "user", "can", "leave", "the", "queue", ":", "<ul", ">" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java#L393-L412
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
BasicRecordStoreLoader.removeExistingKeys
private Future removeExistingKeys(List<Data> keys) { """ Removes keys already present in the partition record store from the provided keys list. This is done by sending a partition operation. This operation is supposed to be invoked locally and the provided parameter is supposed to be thread-safe as it will be mutated directly from the partition thread. @param keys the keys to be filtered @return the future representing the pending completion of the key filtering task """ OperationService operationService = mapServiceContext.getNodeEngine().getOperationService(); Operation operation = new RemoveFromLoadAllOperation(name, keys); return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId); }
java
private Future removeExistingKeys(List<Data> keys) { OperationService operationService = mapServiceContext.getNodeEngine().getOperationService(); Operation operation = new RemoveFromLoadAllOperation(name, keys); return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId); }
[ "private", "Future", "removeExistingKeys", "(", "List", "<", "Data", ">", "keys", ")", "{", "OperationService", "operationService", "=", "mapServiceContext", ".", "getNodeEngine", "(", ")", ".", "getOperationService", "(", ")", ";", "Operation", "operation", "=", "new", "RemoveFromLoadAllOperation", "(", "name", ",", "keys", ")", ";", "return", "operationService", ".", "invokeOnPartition", "(", "MapService", ".", "SERVICE_NAME", ",", "operation", ",", "partitionId", ")", ";", "}" ]
Removes keys already present in the partition record store from the provided keys list. This is done by sending a partition operation. This operation is supposed to be invoked locally and the provided parameter is supposed to be thread-safe as it will be mutated directly from the partition thread. @param keys the keys to be filtered @return the future representing the pending completion of the key filtering task
[ "Removes", "keys", "already", "present", "in", "the", "partition", "record", "store", "from", "the", "provided", "keys", "list", ".", "This", "is", "done", "by", "sending", "a", "partition", "operation", ".", "This", "operation", "is", "supposed", "to", "be", "invoked", "locally", "and", "the", "provided", "parameter", "is", "supposed", "to", "be", "thread", "-", "safe", "as", "it", "will", "be", "mutated", "directly", "from", "the", "partition", "thread", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L156-L160
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/StatementQuery.java
StatementQuery.voltGetStatementXML
@Override VoltXMLElement voltGetStatementXML(Session session) throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException { """ VoltDB added method to get a non-catalog-dependent representation of this HSQLDB object. @param session The current Session object may be needed to resolve some names. @return XML, correctly indented, representing this object. @throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException """ return voltGetXMLExpression(queryExpression, parameters, session); }
java
@Override VoltXMLElement voltGetStatementXML(Session session) throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException { return voltGetXMLExpression(queryExpression, parameters, session); }
[ "@", "Override", "VoltXMLElement", "voltGetStatementXML", "(", "Session", "session", ")", "throws", "org", ".", "hsqldb_voltpatches", ".", "HSQLInterface", ".", "HSQLParseException", "{", "return", "voltGetXMLExpression", "(", "queryExpression", ",", "parameters", ",", "session", ")", ";", "}" ]
VoltDB added method to get a non-catalog-dependent representation of this HSQLDB object. @param session The current Session object may be needed to resolve some names. @return XML, correctly indented, representing this object. @throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException
[ "VoltDB", "added", "method", "to", "get", "a", "non", "-", "catalog", "-", "dependent", "representation", "of", "this", "HSQLDB", "object", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/StatementQuery.java#L127-L132
aws/aws-sdk-java
aws-java-sdk-mediaconvert/src/main/java/com/amazonaws/services/mediaconvert/model/CreatePresetRequest.java
CreatePresetRequest.withTags
public CreatePresetRequest withTags(java.util.Map<String, String> tags) { """ The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key. @param tags The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreatePresetRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreatePresetRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key. @param tags The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key. @return Returns a reference to this object so that method calls can be chained together.
[ "The", "tags", "that", "you", "want", "to", "add", "to", "the", "resource", ".", "You", "can", "tag", "resources", "with", "a", "key", "-", "value", "pair", "or", "with", "only", "a", "key", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-mediaconvert/src/main/java/com/amazonaws/services/mediaconvert/model/CreatePresetRequest.java#L207-L210
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeClass
@Pure public static Class<?> getAttributeClass(Node document, boolean caseSensitive, String... path) { """ Read an enumeration value. @param document is the XML document to explore. @param caseSensitive indicates of the {@code path}'s components are case sensitive. @param path is the list of and ended by the attribute's name. @return the java class or <code>null</code> if none. """ assert document != null : AssertMessages.notNullParameter(0); return getAttributeClassWithDefault(document, caseSensitive, null, path); }
java
@Pure public static Class<?> getAttributeClass(Node document, boolean caseSensitive, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeClassWithDefault(document, caseSensitive, null, path); }
[ "@", "Pure", "public", "static", "Class", "<", "?", ">", "getAttributeClass", "(", "Node", "document", ",", "boolean", "caseSensitive", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "return", "getAttributeClassWithDefault", "(", "document", ",", "caseSensitive", ",", "null", ",", "path", ")", ";", "}" ]
Read an enumeration value. @param document is the XML document to explore. @param caseSensitive indicates of the {@code path}'s components are case sensitive. @param path is the list of and ended by the attribute's name. @return the java class or <code>null</code> if none.
[ "Read", "an", "enumeration", "value", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L356-L360
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.mayEffectMutableState
static boolean mayEffectMutableState(Node n, AbstractCompiler compiler) { """ Returns true if the node may create new mutable state, or change existing state. @see <a href="http://www.xkcd.org/326/">XKCD Cartoon</a> """ checkNotNull(compiler); return checkForStateChangeHelper(n, true, compiler); }
java
static boolean mayEffectMutableState(Node n, AbstractCompiler compiler) { checkNotNull(compiler); return checkForStateChangeHelper(n, true, compiler); }
[ "static", "boolean", "mayEffectMutableState", "(", "Node", "n", ",", "AbstractCompiler", "compiler", ")", "{", "checkNotNull", "(", "compiler", ")", ";", "return", "checkForStateChangeHelper", "(", "n", ",", "true", ",", "compiler", ")", ";", "}" ]
Returns true if the node may create new mutable state, or change existing state. @see <a href="http://www.xkcd.org/326/">XKCD Cartoon</a>
[ "Returns", "true", "if", "the", "node", "may", "create", "new", "mutable", "state", "or", "change", "existing", "state", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L1066-L1069
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/scheduler/SchedulerTask.java
SchedulerTask.checkRunnable
private void checkRunnable(Class<?> type) { """ Checks if the type is a Runnable and gets the run method. @param type """ if(Runnable.class.isAssignableFrom(type)) { try{ this.method = type.getMethod("run"); } catch(Exception e) { throw new RuntimeException("Cannot get run method of runnable class.", e); } } }
java
private void checkRunnable(Class<?> type) { if(Runnable.class.isAssignableFrom(type)) { try{ this.method = type.getMethod("run"); } catch(Exception e) { throw new RuntimeException("Cannot get run method of runnable class.", e); } } }
[ "private", "void", "checkRunnable", "(", "Class", "<", "?", ">", "type", ")", "{", "if", "(", "Runnable", ".", "class", ".", "isAssignableFrom", "(", "type", ")", ")", "{", "try", "{", "this", ".", "method", "=", "type", ".", "getMethod", "(", "\"run\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Cannot get run method of runnable class.\"", ",", "e", ")", ";", "}", "}", "}" ]
Checks if the type is a Runnable and gets the run method. @param type
[ "Checks", "if", "the", "type", "is", "a", "Runnable", "and", "gets", "the", "run", "method", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/scheduler/SchedulerTask.java#L117-L125
apereo/cas
core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java
DefaultRegisteredServiceAccessStrategy.doRejectedAttributesRefusePrincipalAccess
protected boolean doRejectedAttributesRefusePrincipalAccess(final Map<String, Object> principalAttributes) { """ Do rejected attributes refuse principal access boolean. @param principalAttributes the principal attributes @return the boolean """ LOGGER.debug("These rejected attributes [{}] are examined against [{}] before service can proceed.", rejectedAttributes, principalAttributes); if (rejectedAttributes.isEmpty()) { return false; } return requiredAttributesFoundInMap(principalAttributes, rejectedAttributes); }
java
protected boolean doRejectedAttributesRefusePrincipalAccess(final Map<String, Object> principalAttributes) { LOGGER.debug("These rejected attributes [{}] are examined against [{}] before service can proceed.", rejectedAttributes, principalAttributes); if (rejectedAttributes.isEmpty()) { return false; } return requiredAttributesFoundInMap(principalAttributes, rejectedAttributes); }
[ "protected", "boolean", "doRejectedAttributesRefusePrincipalAccess", "(", "final", "Map", "<", "String", ",", "Object", ">", "principalAttributes", ")", "{", "LOGGER", ".", "debug", "(", "\"These rejected attributes [{}] are examined against [{}] before service can proceed.\"", ",", "rejectedAttributes", ",", "principalAttributes", ")", ";", "if", "(", "rejectedAttributes", ".", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "return", "requiredAttributesFoundInMap", "(", "principalAttributes", ",", "rejectedAttributes", ")", ";", "}" ]
Do rejected attributes refuse principal access boolean. @param principalAttributes the principal attributes @return the boolean
[ "Do", "rejected", "attributes", "refuse", "principal", "access", "boolean", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java#L206-L212
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java
ResultInterpreter.interpretResourceMethod
private ResourceMethod interpretResourceMethod(final MethodResult methodResult, final ClassResult classResult) { """ Interprets the result of a resource method. @param methodResult The method result @param classResult The result of the containing class @return The resource method which this method represents """ final MethodComment methodDoc = methodResult.getMethodDoc(); final String description = methodDoc != null ? methodDoc.getComment() : null; final ResourceMethod resourceMethod = new ResourceMethod(methodResult.getHttpMethod(), description); updateMethodParameters(resourceMethod.getMethodParameters(), classResult.getClassFields()); updateMethodParameters(resourceMethod.getMethodParameters(), methodResult.getMethodParameters()); addParameterDescriptions(resourceMethod.getMethodParameters(), methodDoc); stringParameterResolver.replaceParametersTypes(resourceMethod.getMethodParameters()); if (methodResult.getRequestBodyType() != null) { resourceMethod.setRequestBody(javaTypeAnalyzer.analyze(methodResult.getRequestBodyType())); resourceMethod.setRequestBodyDescription(findRequestBodyDescription(methodDoc)); } // add default status code due to JSR 339 addDefaultResponses(methodResult); methodResult.getResponses().forEach(r -> interpretResponse(r, resourceMethod)); addResponseComments(methodResult, resourceMethod); addMediaTypes(methodResult, classResult, resourceMethod); if (methodResult.isDeprecated() || classResult.isDeprecated() || hasDeprecationTag(methodDoc)) resourceMethod.setDeprecated(true); return resourceMethod; }
java
private ResourceMethod interpretResourceMethod(final MethodResult methodResult, final ClassResult classResult) { final MethodComment methodDoc = methodResult.getMethodDoc(); final String description = methodDoc != null ? methodDoc.getComment() : null; final ResourceMethod resourceMethod = new ResourceMethod(methodResult.getHttpMethod(), description); updateMethodParameters(resourceMethod.getMethodParameters(), classResult.getClassFields()); updateMethodParameters(resourceMethod.getMethodParameters(), methodResult.getMethodParameters()); addParameterDescriptions(resourceMethod.getMethodParameters(), methodDoc); stringParameterResolver.replaceParametersTypes(resourceMethod.getMethodParameters()); if (methodResult.getRequestBodyType() != null) { resourceMethod.setRequestBody(javaTypeAnalyzer.analyze(methodResult.getRequestBodyType())); resourceMethod.setRequestBodyDescription(findRequestBodyDescription(methodDoc)); } // add default status code due to JSR 339 addDefaultResponses(methodResult); methodResult.getResponses().forEach(r -> interpretResponse(r, resourceMethod)); addResponseComments(methodResult, resourceMethod); addMediaTypes(methodResult, classResult, resourceMethod); if (methodResult.isDeprecated() || classResult.isDeprecated() || hasDeprecationTag(methodDoc)) resourceMethod.setDeprecated(true); return resourceMethod; }
[ "private", "ResourceMethod", "interpretResourceMethod", "(", "final", "MethodResult", "methodResult", ",", "final", "ClassResult", "classResult", ")", "{", "final", "MethodComment", "methodDoc", "=", "methodResult", ".", "getMethodDoc", "(", ")", ";", "final", "String", "description", "=", "methodDoc", "!=", "null", "?", "methodDoc", ".", "getComment", "(", ")", ":", "null", ";", "final", "ResourceMethod", "resourceMethod", "=", "new", "ResourceMethod", "(", "methodResult", ".", "getHttpMethod", "(", ")", ",", "description", ")", ";", "updateMethodParameters", "(", "resourceMethod", ".", "getMethodParameters", "(", ")", ",", "classResult", ".", "getClassFields", "(", ")", ")", ";", "updateMethodParameters", "(", "resourceMethod", ".", "getMethodParameters", "(", ")", ",", "methodResult", ".", "getMethodParameters", "(", ")", ")", ";", "addParameterDescriptions", "(", "resourceMethod", ".", "getMethodParameters", "(", ")", ",", "methodDoc", ")", ";", "stringParameterResolver", ".", "replaceParametersTypes", "(", "resourceMethod", ".", "getMethodParameters", "(", ")", ")", ";", "if", "(", "methodResult", ".", "getRequestBodyType", "(", ")", "!=", "null", ")", "{", "resourceMethod", ".", "setRequestBody", "(", "javaTypeAnalyzer", ".", "analyze", "(", "methodResult", ".", "getRequestBodyType", "(", ")", ")", ")", ";", "resourceMethod", ".", "setRequestBodyDescription", "(", "findRequestBodyDescription", "(", "methodDoc", ")", ")", ";", "}", "// add default status code due to JSR 339", "addDefaultResponses", "(", "methodResult", ")", ";", "methodResult", ".", "getResponses", "(", ")", ".", "forEach", "(", "r", "->", "interpretResponse", "(", "r", ",", "resourceMethod", ")", ")", ";", "addResponseComments", "(", "methodResult", ",", "resourceMethod", ")", ";", "addMediaTypes", "(", "methodResult", ",", "classResult", ",", "resourceMethod", ")", ";", "if", "(", "methodResult", ".", "isDeprecated", "(", ")", "||", "classResult", ".", "isDeprecated", "(", ")", "||", "hasDeprecationTag", "(", "methodDoc", ")", ")", "resourceMethod", ".", "setDeprecated", "(", "true", ")", ";", "return", "resourceMethod", ";", "}" ]
Interprets the result of a resource method. @param methodResult The method result @param classResult The result of the containing class @return The resource method which this method represents
[ "Interprets", "the", "result", "of", "a", "resource", "method", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L104-L133
yanzhenjie/AndPermission
support/src/main/java/com/yanzhenjie/permission/AndPermission.java
AndPermission.hasAlwaysDeniedPermission
public static boolean hasAlwaysDeniedPermission(Activity activity, List<String> deniedPermissions) { """ Some privileges permanently disabled, may need to set up in the execute. @param activity {@link Activity}. @param deniedPermissions one or more permissions. @return true, other wise is false. """ return hasAlwaysDeniedPermission(new ActivitySource(activity), deniedPermissions); }
java
public static boolean hasAlwaysDeniedPermission(Activity activity, List<String> deniedPermissions) { return hasAlwaysDeniedPermission(new ActivitySource(activity), deniedPermissions); }
[ "public", "static", "boolean", "hasAlwaysDeniedPermission", "(", "Activity", "activity", ",", "List", "<", "String", ">", "deniedPermissions", ")", "{", "return", "hasAlwaysDeniedPermission", "(", "new", "ActivitySource", "(", "activity", ")", ",", "deniedPermissions", ")", ";", "}" ]
Some privileges permanently disabled, may need to set up in the execute. @param activity {@link Activity}. @param deniedPermissions one or more permissions. @return true, other wise is false.
[ "Some", "privileges", "permanently", "disabled", "may", "need", "to", "set", "up", "in", "the", "execute", "." ]
train
https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/AndPermission.java#L130-L132
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/CertificatesInner.java
CertificatesInner.updateAsync
public Observable<CertificateInner> updateAsync(String resourceGroupName, String name, CertificatePatchResource certificateEnvelope) { """ Create or update a certificate. Create or update a certificate. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the certificate. @param certificateEnvelope Details of certificate, if it exists already. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateInner object """ return updateWithServiceResponseAsync(resourceGroupName, name, certificateEnvelope).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() { @Override public CertificateInner call(ServiceResponse<CertificateInner> response) { return response.body(); } }); }
java
public Observable<CertificateInner> updateAsync(String resourceGroupName, String name, CertificatePatchResource certificateEnvelope) { return updateWithServiceResponseAsync(resourceGroupName, name, certificateEnvelope).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() { @Override public CertificateInner call(ServiceResponse<CertificateInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CertificateInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "CertificatePatchResource", "certificateEnvelope", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "certificateEnvelope", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "CertificateInner", ">", ",", "CertificateInner", ">", "(", ")", "{", "@", "Override", "public", "CertificateInner", "call", "(", "ServiceResponse", "<", "CertificateInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update a certificate. Create or update a certificate. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the certificate. @param certificateEnvelope Details of certificate, if it exists already. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateInner object
[ "Create", "or", "update", "a", "certificate", ".", "Create", "or", "update", "a", "certificate", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/CertificatesInner.java#L654-L661
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java
CheckArg.isEquals
public static <T> void isEquals( final T argument, String argumentName, final T object, String objectName ) { """ Asserts that the specified first object is {@link Object#equals(Object) equal to} the specified second object. This method does take null references into consideration. @param <T> @param argument The argument to assert equal to <code>object</code>. @param argumentName The name that will be used within the exception message for the argument should an exception be thrown @param object The object to assert as equal to <code>argument</code>. @param objectName The name that will be used within the exception message for <code>object</code> should an exception be thrown; if <code>null</code> and <code>object</code> is not <code>null</code>, <code>object.toString()</code> will be used. @throws IllegalArgumentException If the specified objects are not equal. """ if (argument == null) { if (object == null) return; // fall through ... one is null } else { if (argument.equals(object)) return; // fall through ... they are not equal } if (objectName == null) objectName = getObjectName(object); throw new IllegalArgumentException(CommonI18n.argumentMustBeEquals.text(argumentName, objectName)); }
java
public static <T> void isEquals( final T argument, String argumentName, final T object, String objectName ) { if (argument == null) { if (object == null) return; // fall through ... one is null } else { if (argument.equals(object)) return; // fall through ... they are not equal } if (objectName == null) objectName = getObjectName(object); throw new IllegalArgumentException(CommonI18n.argumentMustBeEquals.text(argumentName, objectName)); }
[ "public", "static", "<", "T", ">", "void", "isEquals", "(", "final", "T", "argument", ",", "String", "argumentName", ",", "final", "T", "object", ",", "String", "objectName", ")", "{", "if", "(", "argument", "==", "null", ")", "{", "if", "(", "object", "==", "null", ")", "return", ";", "// fall through ... one is null", "}", "else", "{", "if", "(", "argument", ".", "equals", "(", "object", ")", ")", "return", ";", "// fall through ... they are not equal", "}", "if", "(", "objectName", "==", "null", ")", "objectName", "=", "getObjectName", "(", "object", ")", ";", "throw", "new", "IllegalArgumentException", "(", "CommonI18n", ".", "argumentMustBeEquals", ".", "text", "(", "argumentName", ",", "objectName", ")", ")", ";", "}" ]
Asserts that the specified first object is {@link Object#equals(Object) equal to} the specified second object. This method does take null references into consideration. @param <T> @param argument The argument to assert equal to <code>object</code>. @param argumentName The name that will be used within the exception message for the argument should an exception be thrown @param object The object to assert as equal to <code>argument</code>. @param objectName The name that will be used within the exception message for <code>object</code> should an exception be thrown; if <code>null</code> and <code>object</code> is not <code>null</code>, <code>object.toString()</code> will be used. @throws IllegalArgumentException If the specified objects are not equal.
[ "Asserts", "that", "the", "specified", "first", "object", "is", "{", "@link", "Object#equals", "(", "Object", ")", "equal", "to", "}", "the", "specified", "second", "object", ".", "This", "method", "does", "take", "null", "references", "into", "consideration", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L517-L530
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java
SftpClient.get
public SftpFileAttributes get(String remote, OutputStream local, FileTransferProgress progress) throws SftpStatusException, SshException, TransferCancelledException { """ <p> Download the remote file writing it to the specified <code>OutputStream</code>. The OutputStream is closed by this method even if the operation fails. </p> @param remote the path/name of the remote file @param local the OutputStream to write @param progress @return the downloaded file's attributes @throws SftpStatusException @throws SshException @throws TransferCancelledException """ return get(remote, local, progress, 0); }
java
public SftpFileAttributes get(String remote, OutputStream local, FileTransferProgress progress) throws SftpStatusException, SshException, TransferCancelledException { return get(remote, local, progress, 0); }
[ "public", "SftpFileAttributes", "get", "(", "String", "remote", ",", "OutputStream", "local", ",", "FileTransferProgress", "progress", ")", "throws", "SftpStatusException", ",", "SshException", ",", "TransferCancelledException", "{", "return", "get", "(", "remote", ",", "local", ",", "progress", ",", "0", ")", ";", "}" ]
<p> Download the remote file writing it to the specified <code>OutputStream</code>. The OutputStream is closed by this method even if the operation fails. </p> @param remote the path/name of the remote file @param local the OutputStream to write @param progress @return the downloaded file's attributes @throws SftpStatusException @throws SshException @throws TransferCancelledException
[ "<p", ">", "Download", "the", "remote", "file", "writing", "it", "to", "the", "specified", "<code", ">", "OutputStream<", "/", "code", ">", ".", "The", "OutputStream", "is", "closed", "by", "this", "method", "even", "if", "the", "operation", "fails", ".", "<", "/", "p", ">" ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L1151-L1155
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java
BuildStepsInner.listBuildArgumentsWithServiceResponseAsync
public Observable<ServiceResponse<Page<BuildArgumentInner>>> listBuildArgumentsWithServiceResponseAsync(final String resourceGroupName, final String registryName, final String buildTaskName, final String stepName) { """ List the build arguments for a step including the secret arguments. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @param stepName The name of a build step for a container registry build task. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;BuildArgumentInner&gt; object """ return listBuildArgumentsSinglePageAsync(resourceGroupName, registryName, buildTaskName, stepName) .concatMap(new Func1<ServiceResponse<Page<BuildArgumentInner>>, Observable<ServiceResponse<Page<BuildArgumentInner>>>>() { @Override public Observable<ServiceResponse<Page<BuildArgumentInner>>> call(ServiceResponse<Page<BuildArgumentInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listBuildArgumentsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<BuildArgumentInner>>> listBuildArgumentsWithServiceResponseAsync(final String resourceGroupName, final String registryName, final String buildTaskName, final String stepName) { return listBuildArgumentsSinglePageAsync(resourceGroupName, registryName, buildTaskName, stepName) .concatMap(new Func1<ServiceResponse<Page<BuildArgumentInner>>, Observable<ServiceResponse<Page<BuildArgumentInner>>>>() { @Override public Observable<ServiceResponse<Page<BuildArgumentInner>>> call(ServiceResponse<Page<BuildArgumentInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listBuildArgumentsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "BuildArgumentInner", ">", ">", ">", "listBuildArgumentsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "registryName", ",", "final", "String", "buildTaskName", ",", "final", "String", "stepName", ")", "{", "return", "listBuildArgumentsSinglePageAsync", "(", "resourceGroupName", ",", "registryName", ",", "buildTaskName", ",", "stepName", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "BuildArgumentInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "BuildArgumentInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "BuildArgumentInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "BuildArgumentInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listBuildArgumentsNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
List the build arguments for a step including the secret arguments. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @param stepName The name of a build step for a container registry build task. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;BuildArgumentInner&gt; object
[ "List", "the", "build", "arguments", "for", "a", "step", "including", "the", "secret", "arguments", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java#L1161-L1173
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/DatabaseVulnerabilityAssessmentsInner.java
DatabaseVulnerabilityAssessmentsInner.createOrUpdateAsync
public Observable<DatabaseVulnerabilityAssessmentInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { """ Creates or updates the database's vulnerability assessment. @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 for which the vulnerability assessment is defined. @param parameters The requested resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseVulnerabilityAssessmentInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseVulnerabilityAssessmentInner>, DatabaseVulnerabilityAssessmentInner>() { @Override public DatabaseVulnerabilityAssessmentInner call(ServiceResponse<DatabaseVulnerabilityAssessmentInner> response) { return response.body(); } }); }
java
public Observable<DatabaseVulnerabilityAssessmentInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseVulnerabilityAssessmentInner>, DatabaseVulnerabilityAssessmentInner>() { @Override public DatabaseVulnerabilityAssessmentInner call(ServiceResponse<DatabaseVulnerabilityAssessmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DatabaseVulnerabilityAssessmentInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "DatabaseVulnerabilityAssessmentInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DatabaseVulnerabilityAssessmentInner", ">", ",", "DatabaseVulnerabilityAssessmentInner", ">", "(", ")", "{", "@", "Override", "public", "DatabaseVulnerabilityAssessmentInner", "call", "(", "ServiceResponse", "<", "DatabaseVulnerabilityAssessmentInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates the database's vulnerability assessment. @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 for which the vulnerability assessment is defined. @param parameters The requested resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseVulnerabilityAssessmentInner object
[ "Creates", "or", "updates", "the", "database", "s", "vulnerability", "assessment", "." ]
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/DatabaseVulnerabilityAssessmentsInner.java#L221-L228
NextFaze/power-adapters
power-adapters/src/main/java/com/nextfaze/poweradapters/DividerAdapterBuilder.java
DividerAdapterBuilder.leadingView
@NonNull public DividerAdapterBuilder leadingView(@NonNull ViewFactory viewFactory) { """ Sets the divider that appears before the wrapped adapters items. """ mLeadingItem = new Item(checkNotNull(viewFactory, "viewFactory"), false); return this; }
java
@NonNull public DividerAdapterBuilder leadingView(@NonNull ViewFactory viewFactory) { mLeadingItem = new Item(checkNotNull(viewFactory, "viewFactory"), false); return this; }
[ "@", "NonNull", "public", "DividerAdapterBuilder", "leadingView", "(", "@", "NonNull", "ViewFactory", "viewFactory", ")", "{", "mLeadingItem", "=", "new", "Item", "(", "checkNotNull", "(", "viewFactory", ",", "\"viewFactory\"", ")", ",", "false", ")", ";", "return", "this", ";", "}" ]
Sets the divider that appears before the wrapped adapters items.
[ "Sets", "the", "divider", "that", "appears", "before", "the", "wrapped", "adapters", "items", "." ]
train
https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters/src/main/java/com/nextfaze/poweradapters/DividerAdapterBuilder.java#L38-L42
dropwizard/dropwizard
dropwizard-core/src/main/java/io/dropwizard/cli/CheckCommand.java
CheckCommand.onError
@Override public void onError(Cli cli, Namespace namespace, Throwable e) { """ /* The stacktrace is redundant as the message contains the yaml error location """ cli.getStdErr().println(e.getMessage()); }
java
@Override public void onError(Cli cli, Namespace namespace, Throwable e) { cli.getStdErr().println(e.getMessage()); }
[ "@", "Override", "public", "void", "onError", "(", "Cli", "cli", ",", "Namespace", "namespace", ",", "Throwable", "e", ")", "{", "cli", ".", "getStdErr", "(", ")", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}" ]
/* The stacktrace is redundant as the message contains the yaml error location
[ "/", "*", "The", "stacktrace", "is", "redundant", "as", "the", "message", "contains", "the", "yaml", "error", "location" ]
train
https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-core/src/main/java/io/dropwizard/cli/CheckCommand.java#L42-L45
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java
AccountsImpl.listPoolNodeCountsAsync
public ServiceFuture<List<PoolNodeCounts>> listPoolNodeCountsAsync(final ListOperationCallback<PoolNodeCounts> serviceCallback) { """ Gets the number of nodes in each state, grouped by pool. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return AzureServiceFuture.fromHeaderPageResponse( listPoolNodeCountsSinglePageAsync(), new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null); } }, serviceCallback); }
java
public ServiceFuture<List<PoolNodeCounts>> listPoolNodeCountsAsync(final ListOperationCallback<PoolNodeCounts> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listPoolNodeCountsSinglePageAsync(), new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { return listPoolNodeCountsNextSinglePageAsync(nextPageLink, null); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "PoolNodeCounts", ">", ">", "listPoolNodeCountsAsync", "(", "final", "ListOperationCallback", "<", "PoolNodeCounts", ">", "serviceCallback", ")", "{", "return", "AzureServiceFuture", ".", "fromHeaderPageResponse", "(", "listPoolNodeCountsSinglePageAsync", "(", ")", ",", "new", "Func1", "<", "String", ",", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "PoolNodeCounts", ">", ",", "AccountListPoolNodeCountsHeaders", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "PoolNodeCounts", ">", ",", "AccountListPoolNodeCountsHeaders", ">", ">", "call", "(", "String", "nextPageLink", ")", "{", "return", "listPoolNodeCountsNextSinglePageAsync", "(", "nextPageLink", ",", "null", ")", ";", "}", "}", ",", "serviceCallback", ")", ";", "}" ]
Gets the number of nodes in each state, grouped by pool. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Gets", "the", "number", "of", "nodes", "in", "each", "state", "grouped", "by", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L387-L397
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java
ContextRepresenters.onContextReady
private synchronized void onContextReady(final ContextStatusPOJO contextStatus, final boolean notifyClientOnNewActiveContext) { """ Process a message with status READY from a context. @param contextStatus @param notifyClientOnNewActiveContext whether or not to inform the application when this in fact refers to a new context. """ assert ContextState.READY == contextStatus.getContextState(); final String contextID = contextStatus.getContextId(); // This could be the first message we get from that context if (this.isUnknownContextId(contextID)) { this.onNewContext(contextStatus, notifyClientOnNewActiveContext); } // Dispatch the messages to the application, if there are any. for (final ContextMessagePOJO contextMessage : contextStatus.getContextMessageList()) { final byte[] theMessage = contextMessage.getMessage(); final String sourceID = contextMessage.getSourceId(); final long sequenceNumber = contextMessage.getSequenceNumber(); this.messageDispatcher.onContextMessage(new ContextMessageImpl(theMessage, contextID, sourceID, sequenceNumber)); } }
java
private synchronized void onContextReady(final ContextStatusPOJO contextStatus, final boolean notifyClientOnNewActiveContext) { assert ContextState.READY == contextStatus.getContextState(); final String contextID = contextStatus.getContextId(); // This could be the first message we get from that context if (this.isUnknownContextId(contextID)) { this.onNewContext(contextStatus, notifyClientOnNewActiveContext); } // Dispatch the messages to the application, if there are any. for (final ContextMessagePOJO contextMessage : contextStatus.getContextMessageList()) { final byte[] theMessage = contextMessage.getMessage(); final String sourceID = contextMessage.getSourceId(); final long sequenceNumber = contextMessage.getSequenceNumber(); this.messageDispatcher.onContextMessage(new ContextMessageImpl(theMessage, contextID, sourceID, sequenceNumber)); } }
[ "private", "synchronized", "void", "onContextReady", "(", "final", "ContextStatusPOJO", "contextStatus", ",", "final", "boolean", "notifyClientOnNewActiveContext", ")", "{", "assert", "ContextState", ".", "READY", "==", "contextStatus", ".", "getContextState", "(", ")", ";", "final", "String", "contextID", "=", "contextStatus", ".", "getContextId", "(", ")", ";", "// This could be the first message we get from that context", "if", "(", "this", ".", "isUnknownContextId", "(", "contextID", ")", ")", "{", "this", ".", "onNewContext", "(", "contextStatus", ",", "notifyClientOnNewActiveContext", ")", ";", "}", "// Dispatch the messages to the application, if there are any.", "for", "(", "final", "ContextMessagePOJO", "contextMessage", ":", "contextStatus", ".", "getContextMessageList", "(", ")", ")", "{", "final", "byte", "[", "]", "theMessage", "=", "contextMessage", ".", "getMessage", "(", ")", ";", "final", "String", "sourceID", "=", "contextMessage", ".", "getSourceId", "(", ")", ";", "final", "long", "sequenceNumber", "=", "contextMessage", ".", "getSequenceNumber", "(", ")", ";", "this", ".", "messageDispatcher", ".", "onContextMessage", "(", "new", "ContextMessageImpl", "(", "theMessage", ",", "contextID", ",", "sourceID", ",", "sequenceNumber", ")", ")", ";", "}", "}" ]
Process a message with status READY from a context. @param contextStatus @param notifyClientOnNewActiveContext whether or not to inform the application when this in fact refers to a new context.
[ "Process", "a", "message", "with", "status", "READY", "from", "a", "context", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L187-L205
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/tsdb/model/ValueFilter.java
ValueFilter.createValueFilterOfTag
public static ValueFilter createValueFilterOfTag(String operation, String tagKey) { """ Create value filter for comparing with the value of tag key. @param operation Operation for comparing which support =, !=, &gt;, &lt;, &gt;= and &lt;=. @param tagKey Value of tag key for comparing with. @return ValueFilter """ checkArgument(TAG_SUPPORTED_OPERATION.contains(operation), "Value of tag key only support operations in " + TAG_SUPPORTED_OPERATION.toString()); ValueFilter valueFilter = new ValueFilter(operation, tagKey); return valueFilter; }
java
public static ValueFilter createValueFilterOfTag(String operation, String tagKey) { checkArgument(TAG_SUPPORTED_OPERATION.contains(operation), "Value of tag key only support operations in " + TAG_SUPPORTED_OPERATION.toString()); ValueFilter valueFilter = new ValueFilter(operation, tagKey); return valueFilter; }
[ "public", "static", "ValueFilter", "createValueFilterOfTag", "(", "String", "operation", ",", "String", "tagKey", ")", "{", "checkArgument", "(", "TAG_SUPPORTED_OPERATION", ".", "contains", "(", "operation", ")", ",", "\"Value of tag key only support operations in \"", "+", "TAG_SUPPORTED_OPERATION", ".", "toString", "(", ")", ")", ";", "ValueFilter", "valueFilter", "=", "new", "ValueFilter", "(", "operation", ",", "tagKey", ")", ";", "return", "valueFilter", ";", "}" ]
Create value filter for comparing with the value of tag key. @param operation Operation for comparing which support =, !=, &gt;, &lt;, &gt;= and &lt;=. @param tagKey Value of tag key for comparing with. @return ValueFilter
[ "Create", "value", "filter", "for", "comparing", "with", "the", "value", "of", "tag", "key", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/ValueFilter.java#L121-L126
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.copy
public static long copy(InputStream in, OutputStream out, int bufferSize) throws IORuntimeException { """ 拷贝流 @param in 输入流 @param out 输出流 @param bufferSize 缓存大小 @return 传输的byte数 @throws IORuntimeException IO异常 """ return copy(in, out, bufferSize, null); }
java
public static long copy(InputStream in, OutputStream out, int bufferSize) throws IORuntimeException { return copy(in, out, bufferSize, null); }
[ "public", "static", "long", "copy", "(", "InputStream", "in", ",", "OutputStream", "out", ",", "int", "bufferSize", ")", "throws", "IORuntimeException", "{", "return", "copy", "(", "in", ",", "out", ",", "bufferSize", ",", "null", ")", ";", "}" ]
拷贝流 @param in 输入流 @param out 输出流 @param bufferSize 缓存大小 @return 传输的byte数 @throws IORuntimeException IO异常
[ "拷贝流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L146-L148
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/Medias.java
Medias.getByExtension
public static synchronized List<Media> getByExtension(String extension, Media folder) { """ Get all media by extension found in the direct path (does not search in sub folders). @param extension The extension without dot; eg: png (must not be <code>null</code>). @param folder The folder to search in (must not be <code>null</code>). @return The medias found. @throws LionEngineException If invalid parameters. """ Check.notNull(extension); Check.notNull(folder); if (!loader.isPresent()) { return getFilesByExtension(folder, extension); } final File jar = getJarResources(); final String prefix = getJarResourcesPrefix(); final String fullPath = Medias.create(prefix, folder.getPath()).getPath(); final int prefixLength = prefix.length() + 1; return getByExtension(jar, fullPath, prefixLength, extension); }
java
public static synchronized List<Media> getByExtension(String extension, Media folder) { Check.notNull(extension); Check.notNull(folder); if (!loader.isPresent()) { return getFilesByExtension(folder, extension); } final File jar = getJarResources(); final String prefix = getJarResourcesPrefix(); final String fullPath = Medias.create(prefix, folder.getPath()).getPath(); final int prefixLength = prefix.length() + 1; return getByExtension(jar, fullPath, prefixLength, extension); }
[ "public", "static", "synchronized", "List", "<", "Media", ">", "getByExtension", "(", "String", "extension", ",", "Media", "folder", ")", "{", "Check", ".", "notNull", "(", "extension", ")", ";", "Check", ".", "notNull", "(", "folder", ")", ";", "if", "(", "!", "loader", ".", "isPresent", "(", ")", ")", "{", "return", "getFilesByExtension", "(", "folder", ",", "extension", ")", ";", "}", "final", "File", "jar", "=", "getJarResources", "(", ")", ";", "final", "String", "prefix", "=", "getJarResourcesPrefix", "(", ")", ";", "final", "String", "fullPath", "=", "Medias", ".", "create", "(", "prefix", ",", "folder", ".", "getPath", "(", ")", ")", ".", "getPath", "(", ")", ";", "final", "int", "prefixLength", "=", "prefix", ".", "length", "(", ")", "+", "1", ";", "return", "getByExtension", "(", "jar", ",", "fullPath", ",", "prefixLength", ",", "extension", ")", ";", "}" ]
Get all media by extension found in the direct path (does not search in sub folders). @param extension The extension without dot; eg: png (must not be <code>null</code>). @param folder The folder to search in (must not be <code>null</code>). @return The medias found. @throws LionEngineException If invalid parameters.
[ "Get", "all", "media", "by", "extension", "found", "in", "the", "direct", "path", "(", "does", "not", "search", "in", "sub", "folders", ")", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/Medias.java#L137-L153
paypal/SeLion
dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/YamlDataProviderImpl.java
YamlDataProviderImpl.getDataByFilter
@Override public Iterator<Object[]> getDataByFilter(DataProviderFilter dataFilter) throws IOException { """ Gets yaml data by applying the given filter. Throws {@link DataProviderException} when unexpected error occurs during processing of YAML file data by filter @param dataFilter an implementation class of {@link DataProviderFilter} @return An iterator over a collection of Object Array to be used with TestNG DataProvider @throws IOException """ logger.entering(dataFilter); InputStream inputStream = resource.getInputStream(); Yaml yaml = constructYaml(resource.getCls()); Object yamlObject; // Mark the input stream in case multiple documents has been detected // so we can reset it. inputStream.mark(100); try { yamlObject = yaml.load(inputStream); } catch (ComposerException composerException) { String msg = composerException.getMessage(); msg = (msg == null) ? "" : msg; if (msg.toLowerCase().contains("expected a single document")) { inputStream.reset(); yamlObject = loadDataFromDocuments(yaml, inputStream); } else { throw new DataProviderException("Error reading YAML data", composerException); } } return DataProviderHelper.filterToListOfObjects(yamlObject, dataFilter).iterator(); }
java
@Override public Iterator<Object[]> getDataByFilter(DataProviderFilter dataFilter) throws IOException { logger.entering(dataFilter); InputStream inputStream = resource.getInputStream(); Yaml yaml = constructYaml(resource.getCls()); Object yamlObject; // Mark the input stream in case multiple documents has been detected // so we can reset it. inputStream.mark(100); try { yamlObject = yaml.load(inputStream); } catch (ComposerException composerException) { String msg = composerException.getMessage(); msg = (msg == null) ? "" : msg; if (msg.toLowerCase().contains("expected a single document")) { inputStream.reset(); yamlObject = loadDataFromDocuments(yaml, inputStream); } else { throw new DataProviderException("Error reading YAML data", composerException); } } return DataProviderHelper.filterToListOfObjects(yamlObject, dataFilter).iterator(); }
[ "@", "Override", "public", "Iterator", "<", "Object", "[", "]", ">", "getDataByFilter", "(", "DataProviderFilter", "dataFilter", ")", "throws", "IOException", "{", "logger", ".", "entering", "(", "dataFilter", ")", ";", "InputStream", "inputStream", "=", "resource", ".", "getInputStream", "(", ")", ";", "Yaml", "yaml", "=", "constructYaml", "(", "resource", ".", "getCls", "(", ")", ")", ";", "Object", "yamlObject", ";", "// Mark the input stream in case multiple documents has been detected", "// so we can reset it.", "inputStream", ".", "mark", "(", "100", ")", ";", "try", "{", "yamlObject", "=", "yaml", ".", "load", "(", "inputStream", ")", ";", "}", "catch", "(", "ComposerException", "composerException", ")", "{", "String", "msg", "=", "composerException", ".", "getMessage", "(", ")", ";", "msg", "=", "(", "msg", "==", "null", ")", "?", "\"\"", ":", "msg", ";", "if", "(", "msg", ".", "toLowerCase", "(", ")", ".", "contains", "(", "\"expected a single document\"", ")", ")", "{", "inputStream", ".", "reset", "(", ")", ";", "yamlObject", "=", "loadDataFromDocuments", "(", "yaml", ",", "inputStream", ")", ";", "}", "else", "{", "throw", "new", "DataProviderException", "(", "\"Error reading YAML data\"", ",", "composerException", ")", ";", "}", "}", "return", "DataProviderHelper", ".", "filterToListOfObjects", "(", "yamlObject", ",", "dataFilter", ")", ".", "iterator", "(", ")", ";", "}" ]
Gets yaml data by applying the given filter. Throws {@link DataProviderException} when unexpected error occurs during processing of YAML file data by filter @param dataFilter an implementation class of {@link DataProviderFilter} @return An iterator over a collection of Object Array to be used with TestNG DataProvider @throws IOException
[ "Gets", "yaml", "data", "by", "applying", "the", "given", "filter", ".", "Throws", "{", "@link", "DataProviderException", "}", "when", "unexpected", "error", "occurs", "during", "processing", "of", "YAML", "file", "data", "by", "filter" ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/YamlDataProviderImpl.java#L287-L313
authlete/authlete-java-common
src/main/java/com/authlete/common/dto/RevocationRequest.java
RevocationRequest.setParameters
public RevocationRequest setParameters(Map<String, String[]> parameters) { """ Set the value of {@code parameters} which are the request parameters that the OAuth 2.0 token revocation endpoint of the service implementation received from the client application. <p> This method converts the given map into a string in {@code x-www-form-urlencoded} and passes it to {@link #setParameters(String)} method. </p> @param parameters Request parameters. @return {@code this} object. @since 1.24 """ return setParameters(URLCoder.formUrlEncode(parameters)); }
java
public RevocationRequest setParameters(Map<String, String[]> parameters) { return setParameters(URLCoder.formUrlEncode(parameters)); }
[ "public", "RevocationRequest", "setParameters", "(", "Map", "<", "String", ",", "String", "[", "]", ">", "parameters", ")", "{", "return", "setParameters", "(", "URLCoder", ".", "formUrlEncode", "(", "parameters", ")", ")", ";", "}" ]
Set the value of {@code parameters} which are the request parameters that the OAuth 2.0 token revocation endpoint of the service implementation received from the client application. <p> This method converts the given map into a string in {@code x-www-form-urlencoded} and passes it to {@link #setParameters(String)} method. </p> @param parameters Request parameters. @return {@code this} object. @since 1.24
[ "Set", "the", "value", "of", "{", "@code", "parameters", "}", "which", "are", "the", "request", "parameters", "that", "the", "OAuth", "2", ".", "0", "token", "revocation", "endpoint", "of", "the", "service", "implementation", "received", "from", "the", "client", "application", "." ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/dto/RevocationRequest.java#L170-L173
google/truth
core/src/main/java/com/google/common/truth/Truth.java
Truth.assertWithMessage
public static StandardSubjectBuilder assertWithMessage(String format, Object... args) { """ Returns a {@link StandardSubjectBuilder} that will prepend the formatted message using the specified arguments to the failure message in the event of a test failure. <p><b>Note:</b> the arguments will be substituted into the format template using {@link com.google.common.base.Strings#lenientFormat Strings.lenientFormat}. Note this only supports the {@code %s} specifier. @throws IllegalArgumentException if the number of placeholders in the format string does not equal the number of given arguments """ return assert_().withMessage(format, args); }
java
public static StandardSubjectBuilder assertWithMessage(String format, Object... args) { return assert_().withMessage(format, args); }
[ "public", "static", "StandardSubjectBuilder", "assertWithMessage", "(", "String", "format", ",", "Object", "...", "args", ")", "{", "return", "assert_", "(", ")", ".", "withMessage", "(", "format", ",", "args", ")", ";", "}" ]
Returns a {@link StandardSubjectBuilder} that will prepend the formatted message using the specified arguments to the failure message in the event of a test failure. <p><b>Note:</b> the arguments will be substituted into the format template using {@link com.google.common.base.Strings#lenientFormat Strings.lenientFormat}. Note this only supports the {@code %s} specifier. @throws IllegalArgumentException if the number of placeholders in the format string does not equal the number of given arguments
[ "Returns", "a", "{", "@link", "StandardSubjectBuilder", "}", "that", "will", "prepend", "the", "formatted", "message", "using", "the", "specified", "arguments", "to", "the", "failure", "message", "in", "the", "event", "of", "a", "test", "failure", "." ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Truth.java#L118-L120
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/Util.java
Util.floorPowerOfBdouble
public static double floorPowerOfBdouble(final double b, final double n) { """ Computes the floor power of B as a double. This is the largest positive power of B that equal to or less than the given n and equal to a mathematical integer. The result of this function is consistent with {@link #floorPowerOf2(int)} for values less than one. I.e., if <i>n &lt; 1,</i> the result is 1. @param b The base in the expression &#8970;b<sup>n</sup>&#8971;. @param n The input argument. @return the floor power of 2 and equal to a mathematical integer. """ final double x = (n < 1.0) ? 1.0 : n; return pow(b, floor(logB(b, x))); }
java
public static double floorPowerOfBdouble(final double b, final double n) { final double x = (n < 1.0) ? 1.0 : n; return pow(b, floor(logB(b, x))); }
[ "public", "static", "double", "floorPowerOfBdouble", "(", "final", "double", "b", ",", "final", "double", "n", ")", "{", "final", "double", "x", "=", "(", "n", "<", "1.0", ")", "?", "1.0", ":", "n", ";", "return", "pow", "(", "b", ",", "floor", "(", "logB", "(", "b", ",", "x", ")", ")", ")", ";", "}" ]
Computes the floor power of B as a double. This is the largest positive power of B that equal to or less than the given n and equal to a mathematical integer. The result of this function is consistent with {@link #floorPowerOf2(int)} for values less than one. I.e., if <i>n &lt; 1,</i> the result is 1. @param b The base in the expression &#8970;b<sup>n</sup>&#8971;. @param n The input argument. @return the floor power of 2 and equal to a mathematical integer.
[ "Computes", "the", "floor", "power", "of", "B", "as", "a", "double", ".", "This", "is", "the", "largest", "positive", "power", "of", "B", "that", "equal", "to", "or", "less", "than", "the", "given", "n", "and", "equal", "to", "a", "mathematical", "integer", ".", "The", "result", "of", "this", "function", "is", "consistent", "with", "{", "@link", "#floorPowerOf2", "(", "int", ")", "}", "for", "values", "less", "than", "one", ".", "I", ".", "e", ".", "if", "<i", ">", "n", "&lt", ";", "1", "<", "/", "i", ">", "the", "result", "is", "1", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L594-L597
FINRAOS/JTAF-ExtWebDriver
src/main/java/org/finra/jtaf/ewd/properties/GUIHierarchyConcatenationProperties.java
GUIHierarchyConcatenationProperties.getPropertyValueAsList
public List<String> getPropertyValueAsList(String key, String... parameters) { """ Searches over the group of {@code GUIProperties} for a property list corresponding to the given key. @param key key to be found @param parameters instances of the {@code String} literal <code>"{n}"</code> in the retrieved value will be replaced by {@code params[n]} @return the first property list found associated with a concatenation of the given names @throws MissingGUIPropertyException """ return getPropertyValueAsList(new String[] { key }, parameters); }
java
public List<String> getPropertyValueAsList(String key, String... parameters) { return getPropertyValueAsList(new String[] { key }, parameters); }
[ "public", "List", "<", "String", ">", "getPropertyValueAsList", "(", "String", "key", ",", "String", "...", "parameters", ")", "{", "return", "getPropertyValueAsList", "(", "new", "String", "[", "]", "{", "key", "}", ",", "parameters", ")", ";", "}" ]
Searches over the group of {@code GUIProperties} for a property list corresponding to the given key. @param key key to be found @param parameters instances of the {@code String} literal <code>"{n}"</code> in the retrieved value will be replaced by {@code params[n]} @return the first property list found associated with a concatenation of the given names @throws MissingGUIPropertyException
[ "Searches", "over", "the", "group", "of", "{", "@code", "GUIProperties", "}", "for", "a", "property", "list", "corresponding", "to", "the", "given", "key", "." ]
train
https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/properties/GUIHierarchyConcatenationProperties.java#L254-L256
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.addRelationshipToProcessTopic
public void addRelationshipToProcessTopic(final SpecTopic topic, final RelationshipType type) { """ Add a relationship to the topic. @param topic The topic that is to be related to. @param type The type of the relationship. """ final ProcessRelationship relationship = new ProcessRelationship(this, topic, type); topicTargetRelationships.add(relationship); relationships.add(relationship); }
java
public void addRelationshipToProcessTopic(final SpecTopic topic, final RelationshipType type) { final ProcessRelationship relationship = new ProcessRelationship(this, topic, type); topicTargetRelationships.add(relationship); relationships.add(relationship); }
[ "public", "void", "addRelationshipToProcessTopic", "(", "final", "SpecTopic", "topic", ",", "final", "RelationshipType", "type", ")", "{", "final", "ProcessRelationship", "relationship", "=", "new", "ProcessRelationship", "(", "this", ",", "topic", ",", "type", ")", ";", "topicTargetRelationships", ".", "add", "(", "relationship", ")", ";", "relationships", ".", "add", "(", "relationship", ")", ";", "}" ]
Add a relationship to the topic. @param topic The topic that is to be related to. @param type The type of the relationship.
[ "Add", "a", "relationship", "to", "the", "topic", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L208-L212
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java
ReflectionUtils.getField
public static Field getField(Class<?> clazz, String fieldName) { """ Returns the field object found for the given field name in the given class. This method traverses through the super classes of the given class and tries to find the field as declared field within these classes. When the object class is reached the traversing stops. If the field can not be found, null is returned. @param clazz The class within to look for the field with the given field name @param fieldName The name of the field to be returned @return The field object with the given field name if the field can be found, otherwise null """ final String internedName = fieldName.intern(); return traverseHierarchy(clazz, new TraverseTask<Field>() { @Override public Field run(Class<?> clazz) { Field[] fields = clazz.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { if (fields[i].getName() == internedName) { return fields[i]; } } return null; } }); }
java
public static Field getField(Class<?> clazz, String fieldName) { final String internedName = fieldName.intern(); return traverseHierarchy(clazz, new TraverseTask<Field>() { @Override public Field run(Class<?> clazz) { Field[] fields = clazz.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { if (fields[i].getName() == internedName) { return fields[i]; } } return null; } }); }
[ "public", "static", "Field", "getField", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fieldName", ")", "{", "final", "String", "internedName", "=", "fieldName", ".", "intern", "(", ")", ";", "return", "traverseHierarchy", "(", "clazz", ",", "new", "TraverseTask", "<", "Field", ">", "(", ")", "{", "@", "Override", "public", "Field", "run", "(", "Class", "<", "?", ">", "clazz", ")", "{", "Field", "[", "]", "fields", "=", "clazz", ".", "getDeclaredFields", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "length", ";", "i", "++", ")", "{", "if", "(", "fields", "[", "i", "]", ".", "getName", "(", ")", "==", "internedName", ")", "{", "return", "fields", "[", "i", "]", ";", "}", "}", "return", "null", ";", "}", "}", ")", ";", "}" ]
Returns the field object found for the given field name in the given class. This method traverses through the super classes of the given class and tries to find the field as declared field within these classes. When the object class is reached the traversing stops. If the field can not be found, null is returned. @param clazz The class within to look for the field with the given field name @param fieldName The name of the field to be returned @return The field object with the given field name if the field can be found, otherwise null
[ "Returns", "the", "field", "object", "found", "for", "the", "given", "field", "name", "in", "the", "given", "class", ".", "This", "method", "traverses", "through", "the", "super", "classes", "of", "the", "given", "class", "and", "tries", "to", "find", "the", "field", "as", "declared", "field", "within", "these", "classes", ".", "When", "the", "object", "class", "is", "reached", "the", "traversing", "stops", ".", "If", "the", "field", "can", "not", "be", "found", "null", "is", "returned", "." ]
train
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L631-L646
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java
CodeBuilderUtil.incrementVersion
public static void incrementVersion(CodeBuilder b, TypeDesc type) throws SupportException { """ Generates code to increment a version property value, already on the stack. @throws SupportException if version type is not supported """ adjustVersion(b, type, 0, true); }
java
public static void incrementVersion(CodeBuilder b, TypeDesc type) throws SupportException { adjustVersion(b, type, 0, true); }
[ "public", "static", "void", "incrementVersion", "(", "CodeBuilder", "b", ",", "TypeDesc", "type", ")", "throws", "SupportException", "{", "adjustVersion", "(", "b", ",", "type", ",", "0", ",", "true", ")", ";", "}" ]
Generates code to increment a version property value, already on the stack. @throws SupportException if version type is not supported
[ "Generates", "code", "to", "increment", "a", "version", "property", "value", "already", "on", "the", "stack", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java#L696-L700
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java
DeploymentResourceSupport.getDeploymentSubsystemModel
public ModelNode getDeploymentSubsystemModel(final String subsystemName) { """ Get the subsystem deployment model root. <p> If the subsystem resource does not exist one will be created. </p> @param subsystemName the subsystem name. @return the model """ assert subsystemName != null : "The subsystemName cannot be null"; return getDeploymentSubModel(subsystemName, PathAddress.EMPTY_ADDRESS, null, deploymentUnit); }
java
public ModelNode getDeploymentSubsystemModel(final String subsystemName) { assert subsystemName != null : "The subsystemName cannot be null"; return getDeploymentSubModel(subsystemName, PathAddress.EMPTY_ADDRESS, null, deploymentUnit); }
[ "public", "ModelNode", "getDeploymentSubsystemModel", "(", "final", "String", "subsystemName", ")", "{", "assert", "subsystemName", "!=", "null", ":", "\"The subsystemName cannot be null\"", ";", "return", "getDeploymentSubModel", "(", "subsystemName", ",", "PathAddress", ".", "EMPTY_ADDRESS", ",", "null", ",", "deploymentUnit", ")", ";", "}" ]
Get the subsystem deployment model root. <p> If the subsystem resource does not exist one will be created. </p> @param subsystemName the subsystem name. @return the model
[ "Get", "the", "subsystem", "deployment", "model", "root", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java#L76-L79
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/DatagramStream.java
DatagramStream.readTimeout
public int readTimeout(byte []buf, int offset, int length, long timeout) throws IOException { """ Reads bytes from the socket. @param buf byte buffer receiving the bytes @param offset offset into the buffer @param length number of bytes to read @return number of bytes read or -1 @exception throws ClientDisconnectException if the connection is dropped """ if (_s == null || _is == null) return -1; int oldTimeout = _s.getSoTimeout(); try { _s.setSoTimeout((int) timeout); int readLength = read(buf, offset, length); return readLength; } finally { _s.setSoTimeout(oldTimeout); } }
java
public int readTimeout(byte []buf, int offset, int length, long timeout) throws IOException { if (_s == null || _is == null) return -1; int oldTimeout = _s.getSoTimeout(); try { _s.setSoTimeout((int) timeout); int readLength = read(buf, offset, length); return readLength; } finally { _s.setSoTimeout(oldTimeout); } }
[ "public", "int", "readTimeout", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ",", "long", "timeout", ")", "throws", "IOException", "{", "if", "(", "_s", "==", "null", "||", "_is", "==", "null", ")", "return", "-", "1", ";", "int", "oldTimeout", "=", "_s", ".", "getSoTimeout", "(", ")", ";", "try", "{", "_s", ".", "setSoTimeout", "(", "(", "int", ")", "timeout", ")", ";", "int", "readLength", "=", "read", "(", "buf", ",", "offset", ",", "length", ")", ";", "return", "readLength", ";", "}", "finally", "{", "_s", ".", "setSoTimeout", "(", "oldTimeout", ")", ";", "}", "}" ]
Reads bytes from the socket. @param buf byte buffer receiving the bytes @param offset offset into the buffer @param length number of bytes to read @return number of bytes read or -1 @exception throws ClientDisconnectException if the connection is dropped
[ "Reads", "bytes", "from", "the", "socket", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/DatagramStream.java#L199-L216
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/processor/ProcessorExecutionContext.java
ProcessorExecutionContext.allAreFinished
public boolean allAreFinished(final Set<ProcessorGraphNode<?, ?>> processorNodes) { """ Verify that all processors have finished executing atomically (within the same lock as {@link #finished(ProcessorGraphNode)} and {@link #isFinished(ProcessorGraphNode)} is within. @param processorNodes the node to check for completion. """ this.processorLock.lock(); try { for (ProcessorGraphNode<?, ?> node: processorNodes) { if (!isFinished(node)) { return false; } } return true; } finally { this.processorLock.unlock(); } }
java
public boolean allAreFinished(final Set<ProcessorGraphNode<?, ?>> processorNodes) { this.processorLock.lock(); try { for (ProcessorGraphNode<?, ?> node: processorNodes) { if (!isFinished(node)) { return false; } } return true; } finally { this.processorLock.unlock(); } }
[ "public", "boolean", "allAreFinished", "(", "final", "Set", "<", "ProcessorGraphNode", "<", "?", ",", "?", ">", ">", "processorNodes", ")", "{", "this", ".", "processorLock", ".", "lock", "(", ")", ";", "try", "{", "for", "(", "ProcessorGraphNode", "<", "?", ",", "?", ">", "node", ":", "processorNodes", ")", "{", "if", "(", "!", "isFinished", "(", "node", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "finally", "{", "this", ".", "processorLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Verify that all processors have finished executing atomically (within the same lock as {@link #finished(ProcessorGraphNode)} and {@link #isFinished(ProcessorGraphNode)} is within. @param processorNodes the node to check for completion.
[ "Verify", "that", "all", "processors", "have", "finished", "executing", "atomically", "(", "within", "the", "same", "lock", "as", "{", "@link", "#finished", "(", "ProcessorGraphNode", ")", "}", "and", "{", "@link", "#isFinished", "(", "ProcessorGraphNode", ")", "}", "is", "within", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/ProcessorExecutionContext.java#L129-L142
mgormley/prim
src/main/java_generated/edu/jhu/prim/sort/IntLongSort.java
IntLongSort.sortIndexAsc
public static void sortIndexAsc(int[] index, long[] values, int top) { """ Performs an in-place quick sort on {@code index} on the positions up to but not including {@code top}. All the sorting operations on {@code index} are mirrored in {@code values}. Sorts in ascending order. @return {@code index} - sorted. """ assert top <= index.length; quicksortIndex(index, values, 0, top - 1, true); }
java
public static void sortIndexAsc(int[] index, long[] values, int top) { assert top <= index.length; quicksortIndex(index, values, 0, top - 1, true); }
[ "public", "static", "void", "sortIndexAsc", "(", "int", "[", "]", "index", ",", "long", "[", "]", "values", ",", "int", "top", ")", "{", "assert", "top", "<=", "index", ".", "length", ";", "quicksortIndex", "(", "index", ",", "values", ",", "0", ",", "top", "-", "1", ",", "true", ")", ";", "}" ]
Performs an in-place quick sort on {@code index} on the positions up to but not including {@code top}. All the sorting operations on {@code index} are mirrored in {@code values}. Sorts in ascending order. @return {@code index} - sorted.
[ "Performs", "an", "in", "-", "place", "quick", "sort", "on", "{" ]
train
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/sort/IntLongSort.java#L128-L131
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java
FastDateFormat.getDateInstance
public static FastDateFormat getDateInstance(final int style, final Locale locale) { """ 获得 {@link FastDateFormat} 实例<br> 支持缓存 @param style date style: FULL, LONG, MEDIUM, or SHORT @param locale {@link Locale} 日期地理位置 @return 本地化 {@link FastDateFormat} """ return cache.getDateInstance(style, null, locale); }
java
public static FastDateFormat getDateInstance(final int style, final Locale locale) { return cache.getDateInstance(style, null, locale); }
[ "public", "static", "FastDateFormat", "getDateInstance", "(", "final", "int", "style", ",", "final", "Locale", "locale", ")", "{", "return", "cache", ".", "getDateInstance", "(", "style", ",", "null", ",", "locale", ")", ";", "}" ]
获得 {@link FastDateFormat} 实例<br> 支持缓存 @param style date style: FULL, LONG, MEDIUM, or SHORT @param locale {@link Locale} 日期地理位置 @return 本地化 {@link FastDateFormat}
[ "获得", "{", "@link", "FastDateFormat", "}", "实例<br", ">", "支持缓存" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L133-L135
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/beans/PropertyChangeSupport.java
PropertyChangeSupport.fireIndexedPropertyChange
public void fireIndexedPropertyChange(String propertyName, int index, Object oldValue, Object newValue) { """ Reports a bound indexed property update to listeners that have been registered to track updates of all properties or a property with the specified name. <p> No event is fired if old and new values are equal and non-null. <p> This is merely a convenience wrapper around the more general {@link #firePropertyChange(PropertyChangeEvent)} method. @param propertyName the programmatic name of the property that was changed @param index the index of the property element that was changed @param oldValue the old value of the property @param newValue the new value of the property @since 1.5 """ if (oldValue == null || newValue == null || !oldValue.equals(newValue)) { firePropertyChange(new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index)); } }
java
public void fireIndexedPropertyChange(String propertyName, int index, Object oldValue, Object newValue) { if (oldValue == null || newValue == null || !oldValue.equals(newValue)) { firePropertyChange(new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index)); } }
[ "public", "void", "fireIndexedPropertyChange", "(", "String", "propertyName", ",", "int", "index", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "{", "if", "(", "oldValue", "==", "null", "||", "newValue", "==", "null", "||", "!", "oldValue", ".", "equals", "(", "newValue", ")", ")", "{", "firePropertyChange", "(", "new", "IndexedPropertyChangeEvent", "(", "source", ",", "propertyName", ",", "oldValue", ",", "newValue", ",", "index", ")", ")", ";", "}", "}" ]
Reports a bound indexed property update to listeners that have been registered to track updates of all properties or a property with the specified name. <p> No event is fired if old and new values are equal and non-null. <p> This is merely a convenience wrapper around the more general {@link #firePropertyChange(PropertyChangeEvent)} method. @param propertyName the programmatic name of the property that was changed @param index the index of the property element that was changed @param oldValue the old value of the property @param newValue the new value of the property @since 1.5
[ "Reports", "a", "bound", "indexed", "property", "update", "to", "listeners", "that", "have", "been", "registered", "to", "track", "updates", "of", "all", "properties", "or", "a", "property", "with", "the", "specified", "name", ".", "<p", ">", "No", "event", "is", "fired", "if", "old", "and", "new", "values", "are", "equal", "and", "non", "-", "null", ".", "<p", ">", "This", "is", "merely", "a", "convenience", "wrapper", "around", "the", "more", "general", "{", "@link", "#firePropertyChange", "(", "PropertyChangeEvent", ")", "}", "method", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/beans/PropertyChangeSupport.java#L356-L360
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/chunkcollision/ChunkCollision.java
ChunkCollision.updateBlocks
public void updateBlocks(World world, MBlockState state) { """ Notifies all the blocks colliding with the {@link AxisAlignedBB} of the {@link MBlockState}. @param world the world @param state the state """ AxisAlignedBB[] aabbs = AABBUtils.getCollisionBoundingBoxes(world, state, true); for (AxisAlignedBB aabb : aabbs) { if (aabb == null) continue; for (BlockPos pos : BlockPosUtils.getAllInBox(aabb)) world.neighborChanged(pos, state.getBlock(), state.getPos()); } }
java
public void updateBlocks(World world, MBlockState state) { AxisAlignedBB[] aabbs = AABBUtils.getCollisionBoundingBoxes(world, state, true); for (AxisAlignedBB aabb : aabbs) { if (aabb == null) continue; for (BlockPos pos : BlockPosUtils.getAllInBox(aabb)) world.neighborChanged(pos, state.getBlock(), state.getPos()); } }
[ "public", "void", "updateBlocks", "(", "World", "world", ",", "MBlockState", "state", ")", "{", "AxisAlignedBB", "[", "]", "aabbs", "=", "AABBUtils", ".", "getCollisionBoundingBoxes", "(", "world", ",", "state", ",", "true", ")", ";", "for", "(", "AxisAlignedBB", "aabb", ":", "aabbs", ")", "{", "if", "(", "aabb", "==", "null", ")", "continue", ";", "for", "(", "BlockPos", "pos", ":", "BlockPosUtils", ".", "getAllInBox", "(", "aabb", ")", ")", "world", ".", "neighborChanged", "(", "pos", ",", "state", ".", "getBlock", "(", ")", ",", "state", ".", "getPos", "(", ")", ")", ";", "}", "}" ]
Notifies all the blocks colliding with the {@link AxisAlignedBB} of the {@link MBlockState}. @param world the world @param state the state
[ "Notifies", "all", "the", "blocks", "colliding", "with", "the", "{", "@link", "AxisAlignedBB", "}", "of", "the", "{", "@link", "MBlockState", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunkcollision/ChunkCollision.java#L288-L299
alibaba/canal
client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java
ESSyncService.singleTableSimpleFiledInsert
private void singleTableSimpleFiledInsert(ESSyncConfig config, Dml dml, Map<String, Object> data) { """ 单表简单字段insert @param config es配置 @param dml dml信息 @param data 单行dml数据 """ ESMapping mapping = config.getEsMapping(); Map<String, Object> esFieldData = new LinkedHashMap<>(); Object idVal = esTemplate.getESDataFromDmlData(mapping, data, esFieldData); if (logger.isTraceEnabled()) { logger.trace("Single table insert to es index, destination:{}, table: {}, index: {}, id: {}", config.getDestination(), dml.getTable(), mapping.get_index(), idVal); } esTemplate.insert(mapping, idVal, esFieldData); }
java
private void singleTableSimpleFiledInsert(ESSyncConfig config, Dml dml, Map<String, Object> data) { ESMapping mapping = config.getEsMapping(); Map<String, Object> esFieldData = new LinkedHashMap<>(); Object idVal = esTemplate.getESDataFromDmlData(mapping, data, esFieldData); if (logger.isTraceEnabled()) { logger.trace("Single table insert to es index, destination:{}, table: {}, index: {}, id: {}", config.getDestination(), dml.getTable(), mapping.get_index(), idVal); } esTemplate.insert(mapping, idVal, esFieldData); }
[ "private", "void", "singleTableSimpleFiledInsert", "(", "ESSyncConfig", "config", ",", "Dml", "dml", ",", "Map", "<", "String", ",", "Object", ">", "data", ")", "{", "ESMapping", "mapping", "=", "config", ".", "getEsMapping", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "esFieldData", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "Object", "idVal", "=", "esTemplate", ".", "getESDataFromDmlData", "(", "mapping", ",", "data", ",", "esFieldData", ")", ";", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "{", "logger", ".", "trace", "(", "\"Single table insert to es index, destination:{}, table: {}, index: {}, id: {}\"", ",", "config", ".", "getDestination", "(", ")", ",", "dml", ".", "getTable", "(", ")", ",", "mapping", ".", "get_index", "(", ")", ",", "idVal", ")", ";", "}", "esTemplate", ".", "insert", "(", "mapping", ",", "idVal", ",", "esFieldData", ")", ";", "}" ]
单表简单字段insert @param config es配置 @param dml dml信息 @param data 单行dml数据
[ "单表简单字段insert" ]
train
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java#L433-L446
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java
FieldUtils.resolveField
public static Optional<Field> resolveField(Class<?> someClass, String fieldName) { """ Returns the specified field found on the specified class and its ancestors. @param someClass the class to search the field on. @param fieldName the field name. @return the corresponding field object wrapped in an optional. """ return fieldCache.get(new FieldReference(someClass, fieldName)); }
java
public static Optional<Field> resolveField(Class<?> someClass, String fieldName) { return fieldCache.get(new FieldReference(someClass, fieldName)); }
[ "public", "static", "Optional", "<", "Field", ">", "resolveField", "(", "Class", "<", "?", ">", "someClass", ",", "String", "fieldName", ")", "{", "return", "fieldCache", ".", "get", "(", "new", "FieldReference", "(", "someClass", ",", "fieldName", ")", ")", ";", "}" ]
Returns the specified field found on the specified class and its ancestors. @param someClass the class to search the field on. @param fieldName the field name. @return the corresponding field object wrapped in an optional.
[ "Returns", "the", "specified", "field", "found", "on", "the", "specified", "class", "and", "its", "ancestors", "." ]
train
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java#L60-L62
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.publishExpired
public void publishExpired(Cache<K, V> cache, K key, V value) { """ Publishes a expire event for the entry to all of the interested listeners. @param cache the cache where the entry expired @param key the entry's key @param value the entry's value """ publish(cache, EventType.EXPIRED, key, value, /* newValue */ null, /* quiet */ false); }
java
public void publishExpired(Cache<K, V> cache, K key, V value) { publish(cache, EventType.EXPIRED, key, value, /* newValue */ null, /* quiet */ false); }
[ "public", "void", "publishExpired", "(", "Cache", "<", "K", ",", "V", ">", "cache", ",", "K", "key", ",", "V", "value", ")", "{", "publish", "(", "cache", ",", "EventType", ".", "EXPIRED", ",", "key", ",", "value", ",", "/* newValue */", "null", ",", "/* quiet */", "false", ")", ";", "}" ]
Publishes a expire event for the entry to all of the interested listeners. @param cache the cache where the entry expired @param key the entry's key @param value the entry's value
[ "Publishes", "a", "expire", "event", "for", "the", "entry", "to", "all", "of", "the", "interested", "listeners", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L159-L161
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addCalledMethod
@Nonnull public BugInstance addCalledMethod(String className, String methodName, String methodSig, boolean isStatic) { """ Add a method annotation. @param className name of class containing called method @param methodName name of called method @param methodSig signature of called method @param isStatic true if called method is static, false if not @return this object """ return addMethod(MethodAnnotation.fromCalledMethod(className, methodName, methodSig, isStatic)).describe( MethodAnnotation.METHOD_CALLED); }
java
@Nonnull public BugInstance addCalledMethod(String className, String methodName, String methodSig, boolean isStatic) { return addMethod(MethodAnnotation.fromCalledMethod(className, methodName, methodSig, isStatic)).describe( MethodAnnotation.METHOD_CALLED); }
[ "@", "Nonnull", "public", "BugInstance", "addCalledMethod", "(", "String", "className", ",", "String", "methodName", ",", "String", "methodSig", ",", "boolean", "isStatic", ")", "{", "return", "addMethod", "(", "MethodAnnotation", ".", "fromCalledMethod", "(", "className", ",", "methodName", ",", "methodSig", ",", "isStatic", ")", ")", ".", "describe", "(", "MethodAnnotation", ".", "METHOD_CALLED", ")", ";", "}" ]
Add a method annotation. @param className name of class containing called method @param methodName name of called method @param methodSig signature of called method @param isStatic true if called method is static, false if not @return this object
[ "Add", "a", "method", "annotation", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1436-L1440
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmElements.java
XsdAsmElements.generateClassFromElement
static void generateClassFromElement(XsdAsmInterfaces interfaceGenerator, Map<String, List<XsdAttribute>> createdAttributes, XsdElement element, String apiName) { """ Generates a class based on the information present in a {@link XsdElement} object. It also generated its constructors and required methods. @param interfaceGenerator An instance of {@link XsdAsmInterfaces} which contains interface information. @param createdAttributes Information regarding attribute classes that were already created. @param element The {@link XsdElement} object from which the class will be generated. @param apiName The name of the generated fluent interface. """ String className = getCleanName(element); String[] interfaces = interfaceGenerator.getInterfaces(element, apiName); String signature = getClassSignature(interfaces, className, apiName); ClassWriter classWriter = generateClass(className, JAVA_OBJECT, interfaces, signature,ACC_PUBLIC + ACC_SUPER + ACC_FINAL, apiName); generateClassMethods(classWriter, className, apiName); interfaceGenerator.checkForSequenceMethod(classWriter, className); getOwnAttributes(element).forEach(elementAttribute -> generateMethodsAndCreateAttribute(createdAttributes, classWriter, elementAttribute, getFullClassTypeNameDesc(className, apiName), className, apiName)); writeClassToFile(className, classWriter, apiName); }
java
static void generateClassFromElement(XsdAsmInterfaces interfaceGenerator, Map<String, List<XsdAttribute>> createdAttributes, XsdElement element, String apiName) { String className = getCleanName(element); String[] interfaces = interfaceGenerator.getInterfaces(element, apiName); String signature = getClassSignature(interfaces, className, apiName); ClassWriter classWriter = generateClass(className, JAVA_OBJECT, interfaces, signature,ACC_PUBLIC + ACC_SUPER + ACC_FINAL, apiName); generateClassMethods(classWriter, className, apiName); interfaceGenerator.checkForSequenceMethod(classWriter, className); getOwnAttributes(element).forEach(elementAttribute -> generateMethodsAndCreateAttribute(createdAttributes, classWriter, elementAttribute, getFullClassTypeNameDesc(className, apiName), className, apiName)); writeClassToFile(className, classWriter, apiName); }
[ "static", "void", "generateClassFromElement", "(", "XsdAsmInterfaces", "interfaceGenerator", ",", "Map", "<", "String", ",", "List", "<", "XsdAttribute", ">", ">", "createdAttributes", ",", "XsdElement", "element", ",", "String", "apiName", ")", "{", "String", "className", "=", "getCleanName", "(", "element", ")", ";", "String", "[", "]", "interfaces", "=", "interfaceGenerator", ".", "getInterfaces", "(", "element", ",", "apiName", ")", ";", "String", "signature", "=", "getClassSignature", "(", "interfaces", ",", "className", ",", "apiName", ")", ";", "ClassWriter", "classWriter", "=", "generateClass", "(", "className", ",", "JAVA_OBJECT", ",", "interfaces", ",", "signature", ",", "ACC_PUBLIC", "+", "ACC_SUPER", "+", "ACC_FINAL", ",", "apiName", ")", ";", "generateClassMethods", "(", "classWriter", ",", "className", ",", "apiName", ")", ";", "interfaceGenerator", ".", "checkForSequenceMethod", "(", "classWriter", ",", "className", ")", ";", "getOwnAttributes", "(", "element", ")", ".", "forEach", "(", "elementAttribute", "->", "generateMethodsAndCreateAttribute", "(", "createdAttributes", ",", "classWriter", ",", "elementAttribute", ",", "getFullClassTypeNameDesc", "(", "className", ",", "apiName", ")", ",", "className", ",", "apiName", ")", ")", ";", "writeClassToFile", "(", "className", ",", "classWriter", ",", "apiName", ")", ";", "}" ]
Generates a class based on the information present in a {@link XsdElement} object. It also generated its constructors and required methods. @param interfaceGenerator An instance of {@link XsdAsmInterfaces} which contains interface information. @param createdAttributes Information regarding attribute classes that were already created. @param element The {@link XsdElement} object from which the class will be generated. @param apiName The name of the generated fluent interface.
[ "Generates", "a", "class", "based", "on", "the", "information", "present", "in", "a", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmElements.java#L31-L46