repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
JodaOrg/joda-time
src/main/java/org/joda/time/MonthDay.java
MonthDay.withDayOfMonth
public MonthDay withDayOfMonth(int dayOfMonth) { int[] newValues = getValues(); newValues = getChronology().dayOfMonth().set(this, DAY_OF_MONTH, newValues, dayOfMonth); return new MonthDay(this, newValues); }
java
public MonthDay withDayOfMonth(int dayOfMonth) { int[] newValues = getValues(); newValues = getChronology().dayOfMonth().set(this, DAY_OF_MONTH, newValues, dayOfMonth); return new MonthDay(this, newValues); }
[ "public", "MonthDay", "withDayOfMonth", "(", "int", "dayOfMonth", ")", "{", "int", "[", "]", "newValues", "=", "getValues", "(", ")", ";", "newValues", "=", "getChronology", "(", ")", ".", "dayOfMonth", "(", ")", ".", "set", "(", "this", ",", "DAY_OF_MON...
Returns a copy of this month-day with the day of month field updated. <p> MonthDay is immutable, so there are no set methods. Instead, this method returns a new instance with the value of day of month changed. @param dayOfMonth the day of month to set @return a copy of this object with the field set, never null @throws IllegalArgumentException if the value is invalid
[ "Returns", "a", "copy", "of", "this", "month", "-", "day", "with", "the", "day", "of", "month", "field", "updated", ".", "<p", ">", "MonthDay", "is", "immutable", "so", "there", "are", "no", "set", "methods", ".", "Instead", "this", "method", "returns", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/MonthDay.java#L737-L741
virgo47/javasimon
core/src/main/java/org/javasimon/utils/SimonUtils.java
SimonUtils.compact
public static String compact(String input, int limitTo) { if (input == null || input.length() <= limitTo) { return input; } int headLength = limitTo / 2; int tailLength = limitTo - SHRINKED_STRING.length() - headLength; if (tailLength < 0) { tailLength = 1; } return input.substring(0, headLength) + SHRINKED_STRING + input.substring(input.length() - tailLength); }
java
public static String compact(String input, int limitTo) { if (input == null || input.length() <= limitTo) { return input; } int headLength = limitTo / 2; int tailLength = limitTo - SHRINKED_STRING.length() - headLength; if (tailLength < 0) { tailLength = 1; } return input.substring(0, headLength) + SHRINKED_STRING + input.substring(input.length() - tailLength); }
[ "public", "static", "String", "compact", "(", "String", "input", ",", "int", "limitTo", ")", "{", "if", "(", "input", "==", "null", "||", "input", ".", "length", "(", ")", "<=", "limitTo", ")", "{", "return", "input", ";", "}", "int", "headLength", "...
Shrinks the middle of the input string if it is too long, so it does not exceed limitTo. @since 3.2
[ "Shrinks", "the", "middle", "of", "the", "input", "string", "if", "it", "is", "too", "long", "so", "it", "does", "not", "exceed", "limitTo", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SimonUtils.java#L371-L383
lessthanoptimal/BoofCV
main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java
SelfCalibrationGuessAndCheckFocus.setSampling
public void setSampling( double min , double max , int total ) { this.sampleMin = min; this.sampleMax = max; this.numSamples = total; this.scores = new double[numSamples]; }
java
public void setSampling( double min , double max , int total ) { this.sampleMin = min; this.sampleMax = max; this.numSamples = total; this.scores = new double[numSamples]; }
[ "public", "void", "setSampling", "(", "double", "min", ",", "double", "max", ",", "int", "total", ")", "{", "this", ".", "sampleMin", "=", "min", ";", "this", ".", "sampleMax", "=", "max", ";", "this", ".", "numSamples", "=", "total", ";", "this", "....
Specifies how focal lengths are sampled on a log scale. Remember 1.0 = nominal length @param min min value. 0.3 is default @param max max value. 3.0 is default @param total Number of sample points. 50 is default
[ "Specifies", "how", "focal", "lengths", "are", "sampled", "on", "a", "log", "scale", ".", "Remember", "1", ".", "0", "=", "nominal", "length" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java#L154-L159
cose-wg/COSE-JAVA
src/main/java/COSE/Attribute.java
Attribute.findAttribute
public CBORObject findAttribute(CBORObject label, int where) { if (((where & PROTECTED) == PROTECTED) && objProtected.ContainsKey(label)) return objProtected.get(label); if (((where & UNPROTECTED) == UNPROTECTED) && objUnprotected.ContainsKey(label)) return objUnprotected.get(label); if (((where & DO_NOT_SEND) == DO_NOT_SEND) && objDontSend.ContainsKey(label)) return objDontSend.get(label); return null; }
java
public CBORObject findAttribute(CBORObject label, int where) { if (((where & PROTECTED) == PROTECTED) && objProtected.ContainsKey(label)) return objProtected.get(label); if (((where & UNPROTECTED) == UNPROTECTED) && objUnprotected.ContainsKey(label)) return objUnprotected.get(label); if (((where & DO_NOT_SEND) == DO_NOT_SEND) && objDontSend.ContainsKey(label)) return objDontSend.get(label); return null; }
[ "public", "CBORObject", "findAttribute", "(", "CBORObject", "label", ",", "int", "where", ")", "{", "if", "(", "(", "(", "where", "&", "PROTECTED", ")", "==", "PROTECTED", ")", "&&", "objProtected", ".", "ContainsKey", "(", "label", ")", ")", "return", "...
Locate an attribute in one of the attribute buckets The buckets are searched in the order protected, unprotected, unsent. @param label - HeaderKey enumeration value to search for @param where which maps to search for the label @return - CBORObject with the value if found; otherwise null
[ "Locate", "an", "attribute", "in", "one", "of", "the", "attribute", "buckets", "The", "buckets", "are", "searched", "in", "the", "order", "protected", "unprotected", "unsent", "." ]
train
https://github.com/cose-wg/COSE-JAVA/blob/f972b11ab4c9a18f911bc49a15225a6951cf6f63/src/main/java/COSE/Attribute.java#L271-L276
graphhopper/graphhopper
core/src/main/java/com/graphhopper/storage/GraphHopperStorage.java
GraphHopperStorage.getGraph
public <T extends Graph> T getGraph(Class<T> clazz, Weighting weighting) { if (clazz.equals(Graph.class)) return (T) baseGraph; Collection<CHGraphImpl> chGraphs = getAllCHGraphs(); if (chGraphs.isEmpty()) throw new IllegalStateException("Cannot find graph implementation for " + clazz); if (weighting == null) throw new IllegalStateException("Cannot find CHGraph with null weighting"); List<Weighting> existing = new ArrayList<>(); for (CHGraphImpl cg : chGraphs) { if (cg.getWeighting() == weighting) return (T) cg; existing.add(cg.getWeighting()); } throw new IllegalStateException("Cannot find CHGraph for specified weighting: " + weighting + ", existing:" + existing); }
java
public <T extends Graph> T getGraph(Class<T> clazz, Weighting weighting) { if (clazz.equals(Graph.class)) return (T) baseGraph; Collection<CHGraphImpl> chGraphs = getAllCHGraphs(); if (chGraphs.isEmpty()) throw new IllegalStateException("Cannot find graph implementation for " + clazz); if (weighting == null) throw new IllegalStateException("Cannot find CHGraph with null weighting"); List<Weighting> existing = new ArrayList<>(); for (CHGraphImpl cg : chGraphs) { if (cg.getWeighting() == weighting) return (T) cg; existing.add(cg.getWeighting()); } throw new IllegalStateException("Cannot find CHGraph for specified weighting: " + weighting + ", existing:" + existing); }
[ "public", "<", "T", "extends", "Graph", ">", "T", "getGraph", "(", "Class", "<", "T", ">", "clazz", ",", "Weighting", "weighting", ")", "{", "if", "(", "clazz", ".", "equals", "(", "Graph", ".", "class", ")", ")", "return", "(", "T", ")", "baseGrap...
This method returns the routing graph for the specified weighting, could be potentially filled with shortcuts.
[ "This", "method", "returns", "the", "routing", "graph", "for", "the", "specified", "weighting", "could", "be", "potentially", "filled", "with", "shortcuts", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/GraphHopperStorage.java#L102-L122
ralscha/wampspring
src/main/java/ch/rasc/wampspring/method/DestinationPatternsMessageCondition.java
DestinationPatternsMessageCondition.compareTo
@Override public int compareTo(DestinationPatternsMessageCondition other, Message<?> message) { WampMessage wampMessage = (WampMessage) message; String destination = wampMessage.getDestination(); Comparator<String> patternComparator = this.pathMatcher .getPatternComparator(destination); Iterator<String> iterator = this.patterns.iterator(); Iterator<String> iteratorOther = other.patterns.iterator(); while (iterator.hasNext() && iteratorOther.hasNext()) { int result = patternComparator.compare(iterator.next(), iteratorOther.next()); if (result != 0) { return result; } } if (iterator.hasNext()) { return -1; } else if (iteratorOther.hasNext()) { return 1; } else { return 0; } }
java
@Override public int compareTo(DestinationPatternsMessageCondition other, Message<?> message) { WampMessage wampMessage = (WampMessage) message; String destination = wampMessage.getDestination(); Comparator<String> patternComparator = this.pathMatcher .getPatternComparator(destination); Iterator<String> iterator = this.patterns.iterator(); Iterator<String> iteratorOther = other.patterns.iterator(); while (iterator.hasNext() && iteratorOther.hasNext()) { int result = patternComparator.compare(iterator.next(), iteratorOther.next()); if (result != 0) { return result; } } if (iterator.hasNext()) { return -1; } else if (iteratorOther.hasNext()) { return 1; } else { return 0; } }
[ "@", "Override", "public", "int", "compareTo", "(", "DestinationPatternsMessageCondition", "other", ",", "Message", "<", "?", ">", "message", ")", "{", "WampMessage", "wampMessage", "=", "(", "WampMessage", ")", "message", ";", "String", "destination", "=", "wam...
Compare the two conditions based on the destination patterns they contain. Patterns are compared one at a time, from top to bottom via {@link org.springframework.util.PathMatcher#getPatternComparator(String)}. If all compared patterns match equally, but one instance has more patterns, it is considered a closer match. <p> It is assumed that both instances have been obtained via {@link #getMatchingCondition(Message)} to ensure they contain only patterns that match the request and are sorted with the best matches on top.
[ "Compare", "the", "two", "conditions", "based", "on", "the", "destination", "patterns", "they", "contain", ".", "Patterns", "are", "compared", "one", "at", "a", "time", "from", "top", "to", "bottom", "via", "{" ]
train
https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/method/DestinationPatternsMessageCondition.java#L171-L196
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getUntaggedImages
public List<Image> getUntaggedImages(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).toBlocking().single().body(); }
java
public List<Image> getUntaggedImages(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "Image", ">", "getUntaggedImages", "(", "UUID", "projectId", ",", "GetUntaggedImagesOptionalParameter", "getUntaggedImagesOptionalParameter", ")", "{", "return", "getUntaggedImagesWithServiceResponseAsync", "(", "projectId", ",", "getUntaggedImagesOptiona...
Get untagged images for a given project iteration. This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. @param projectId The project id @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;Image&gt; object if successful.
[ "Get", "untagged", "images", "for", "a", "given", "project", "iteration", ".", "This", "API", "supports", "batching", "and", "range", "selection", ".", "By", "default", "it", "will", "only", "return", "first", "50", "images", "matching", "images", ".", "Use"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4785-L4787
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.assertVersionCompatible
static void assertVersionCompatible(final String expectedVersion, final String actualVersion) { final String shortActualVersion = actualVersion.replaceAll(VERSION_BUILD_PART_REGEX, ""); final String shortExpectedVersion = expectedVersion.replaceAll(VERSION_BUILD_PART_REGEX, ""); if (shortExpectedVersion.compareTo(shortActualVersion) != 0) { throw new JsiiException("Incompatible jsii-runtime version. Expecting " + shortExpectedVersion + ", actual was " + shortActualVersion); } }
java
static void assertVersionCompatible(final String expectedVersion, final String actualVersion) { final String shortActualVersion = actualVersion.replaceAll(VERSION_BUILD_PART_REGEX, ""); final String shortExpectedVersion = expectedVersion.replaceAll(VERSION_BUILD_PART_REGEX, ""); if (shortExpectedVersion.compareTo(shortActualVersion) != 0) { throw new JsiiException("Incompatible jsii-runtime version. Expecting " + shortExpectedVersion + ", actual was " + shortActualVersion); } }
[ "static", "void", "assertVersionCompatible", "(", "final", "String", "expectedVersion", ",", "final", "String", "actualVersion", ")", "{", "final", "String", "shortActualVersion", "=", "actualVersion", ".", "replaceAll", "(", "VERSION_BUILD_PART_REGEX", ",", "\"\"", "...
Asserts that a peer runtimeVersion is compatible with this Java runtime version, which means they share the same version components, with the possible exception of the build number. @param expectedVersion The version this client expects from the runtime @param actualVersion The actual version the runtime reports @throws JsiiException if versions mismatch
[ "Asserts", "that", "a", "peer", "runtimeVersion", "is", "compatible", "with", "this", "Java", "runtime", "version", "which", "means", "they", "share", "the", "same", "version", "components", "with", "the", "possible", "exception", "of", "the", "build", "number",...
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L330-L338
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigWebUtil.java
ConfigWebUtil.getFile
public static Resource getFile(Config config, Resource directory, String path, short type) { path = replacePlaceholder(path, config); if (!StringUtil.isEmpty(path, true)) { Resource file = getFile(directory.getRealResource(path), type); if (file != null) return file; file = getFile(config.getResource(path), type); if (file != null) return file; } return null; }
java
public static Resource getFile(Config config, Resource directory, String path, short type) { path = replacePlaceholder(path, config); if (!StringUtil.isEmpty(path, true)) { Resource file = getFile(directory.getRealResource(path), type); if (file != null) return file; file = getFile(config.getResource(path), type); if (file != null) return file; } return null; }
[ "public", "static", "Resource", "getFile", "(", "Config", "config", ",", "Resource", "directory", ",", "String", "path", ",", "short", "type", ")", "{", "path", "=", "replacePlaceholder", "(", "path", ",", "config", ")", ";", "if", "(", "!", "StringUtil", ...
touch a file object by the string definition @param config @param directory @param path @param type @return matching file
[ "touch", "a", "file", "object", "by", "the", "string", "definition" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigWebUtil.java#L225-L236
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GitLabApiClient.java
GitLabApiClient.putUpload
protected Response putUpload(String name, File fileToUpload, Object... pathArgs) throws IOException { URL url = getApiUrl(pathArgs); return (putUpload(name, fileToUpload, url)); }
java
protected Response putUpload(String name, File fileToUpload, Object... pathArgs) throws IOException { URL url = getApiUrl(pathArgs); return (putUpload(name, fileToUpload, url)); }
[ "protected", "Response", "putUpload", "(", "String", "name", ",", "File", "fileToUpload", ",", "Object", "...", "pathArgs", ")", "throws", "IOException", "{", "URL", "url", "=", "getApiUrl", "(", "pathArgs", ")", ";", "return", "(", "putUpload", "(", "name",...
Perform a file upload using multipart/form-data using the HTTP PUT method, returning a ClientResponse instance with the data returned from the endpoint. @param name the name for the form field that contains the file name @param fileToUpload a File instance pointing to the file to upload @param pathArgs variable list of arguments used to build the URI @return a ClientResponse instance with the data returned from the endpoint @throws IOException if an error occurs while constructing the URL
[ "Perform", "a", "file", "upload", "using", "multipart", "/", "form", "-", "data", "using", "the", "HTTP", "PUT", "method", "returning", "a", "ClientResponse", "instance", "with", "the", "data", "returned", "from", "the", "endpoint", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApiClient.java#L606-L609
apereo/cas
support/cas-server-support-trusted-mfa/src/main/java/org/apereo/cas/trusted/authentication/api/MultifactorAuthenticationTrustRecord.java
MultifactorAuthenticationTrustRecord.newInstance
public static MultifactorAuthenticationTrustRecord newInstance(final String principal, final String geography, final String fingerprint) { val r = new MultifactorAuthenticationTrustRecord(); r.setRecordDate(LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS)); r.setPrincipal(principal); r.setDeviceFingerprint(fingerprint); r.setName(principal.concat("-").concat(LocalDate.now().toString()).concat("-").concat(geography)); return r; }
java
public static MultifactorAuthenticationTrustRecord newInstance(final String principal, final String geography, final String fingerprint) { val r = new MultifactorAuthenticationTrustRecord(); r.setRecordDate(LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS)); r.setPrincipal(principal); r.setDeviceFingerprint(fingerprint); r.setName(principal.concat("-").concat(LocalDate.now().toString()).concat("-").concat(geography)); return r; }
[ "public", "static", "MultifactorAuthenticationTrustRecord", "newInstance", "(", "final", "String", "principal", ",", "final", "String", "geography", ",", "final", "String", "fingerprint", ")", "{", "val", "r", "=", "new", "MultifactorAuthenticationTrustRecord", "(", "...
New instance of authentication trust record. @param principal the principal @param geography the geography @param fingerprint the device fingerprint @return the authentication trust record
[ "New", "instance", "of", "authentication", "trust", "record", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-trusted-mfa/src/main/java/org/apereo/cas/trusted/authentication/api/MultifactorAuthenticationTrustRecord.java#L83-L90
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getMoviesSearch
public List<RTMovie> getMoviesSearch(String query, int pageLimit, int page) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_SEARCH); properties.put(ApiBuilder.PROPERTY_PAGE_LIMIT, ApiBuilder.validatePageLimit(pageLimit)); properties.put(ApiBuilder.PROPERTY_PAGE, ApiBuilder.validatePage(page)); try { properties.put(ApiBuilder.PROPERTY_QUERY, URLEncoder.encode(query, ENCODING_UTF8)); } catch (UnsupportedEncodingException ex) { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, "Failed to encode URL", query, ex); } WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getMovies() != null) { return wrapper.getMovies(); } else { return Collections.emptyList(); } }
java
public List<RTMovie> getMoviesSearch(String query, int pageLimit, int page) throws RottenTomatoesException { properties.clear(); properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_SEARCH); properties.put(ApiBuilder.PROPERTY_PAGE_LIMIT, ApiBuilder.validatePageLimit(pageLimit)); properties.put(ApiBuilder.PROPERTY_PAGE, ApiBuilder.validatePage(page)); try { properties.put(ApiBuilder.PROPERTY_QUERY, URLEncoder.encode(query, ENCODING_UTF8)); } catch (UnsupportedEncodingException ex) { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, "Failed to encode URL", query, ex); } WrapperLists wrapper = response.getResponse(WrapperLists.class, properties); if (wrapper != null && wrapper.getMovies() != null) { return wrapper.getMovies(); } else { return Collections.emptyList(); } }
[ "public", "List", "<", "RTMovie", ">", "getMoviesSearch", "(", "String", "query", ",", "int", "pageLimit", ",", "int", "page", ")", "throws", "RottenTomatoesException", "{", "properties", ".", "clear", "(", ")", ";", "properties", ".", "put", "(", "ApiBuilde...
The movies search endpoint for plain text queries. Let's you search for movies! @param query @param pageLimit @param page @return @throws RottenTomatoesException
[ "The", "movies", "search", "endpoint", "for", "plain", "text", "queries", ".", "Let", "s", "you", "search", "for", "movies!" ]
train
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L682-L700
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.handle
public static boolean handle(InputStream is, String name, ZipEntryCallback action) { SingleZipEntryCallback helper = new SingleZipEntryCallback(name, action); iterate(is, helper); return helper.found(); }
java
public static boolean handle(InputStream is, String name, ZipEntryCallback action) { SingleZipEntryCallback helper = new SingleZipEntryCallback(name, action); iterate(is, helper); return helper.found(); }
[ "public", "static", "boolean", "handle", "(", "InputStream", "is", ",", "String", "name", ",", "ZipEntryCallback", "action", ")", "{", "SingleZipEntryCallback", "helper", "=", "new", "SingleZipEntryCallback", "(", "name", ",", "action", ")", ";", "iterate", "(",...
Reads the given ZIP stream and executes the given action for a single entry. @param is input ZIP stream (it will not be closed automatically). @param name entry name. @param action action to be called for this entry. @return <code>true</code> if the entry was found, <code>false</code> if the entry was not found. @see ZipEntryCallback
[ "Reads", "the", "given", "ZIP", "stream", "and", "executes", "the", "given", "action", "for", "a", "single", "entry", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L889-L893
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpRequest.java
HttpRequest.form
public HttpRequest form(String name, Object value, Object... parameters) { form(name, value); for (int i = 0; i < parameters.length; i += 2) { name = parameters[i].toString(); form(name, parameters[i + 1]); } return this; }
java
public HttpRequest form(String name, Object value, Object... parameters) { form(name, value); for (int i = 0; i < parameters.length; i += 2) { name = parameters[i].toString(); form(name, parameters[i + 1]); } return this; }
[ "public", "HttpRequest", "form", "(", "String", "name", ",", "Object", "value", ",", "Object", "...", "parameters", ")", "{", "form", "(", "name", ",", "value", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parameters", ".", "length", ...
设置表单数据 @param name 名 @param value 值 @param parameters 参数对,奇数为名,偶数为值 @return this
[ "设置表单数据" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java#L465-L473
timewalker74/ffmq
core/src/main/java/net/timewalker/ffmq4/local/connection/LocalConnection.java
LocalConnection.checkPermission
public final void checkPermission( Destination destination , String action ) throws JMSException { if (securityContext == null) return; // Security is disabled DestinationRef destinationRef = DestinationTools.asRef(destination); securityContext.checkPermission(destinationRef.getResourceName(), action); }
java
public final void checkPermission( Destination destination , String action ) throws JMSException { if (securityContext == null) return; // Security is disabled DestinationRef destinationRef = DestinationTools.asRef(destination); securityContext.checkPermission(destinationRef.getResourceName(), action); }
[ "public", "final", "void", "checkPermission", "(", "Destination", "destination", ",", "String", "action", ")", "throws", "JMSException", "{", "if", "(", "securityContext", "==", "null", ")", "return", ";", "// Security is disabled", "DestinationRef", "destinationRef",...
Check if the connection has the required credentials to use the given destination
[ "Check", "if", "the", "connection", "has", "the", "required", "credentials", "to", "use", "the", "given", "destination" ]
train
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/connection/LocalConnection.java#L182-L189
killbill/killbill
invoice/src/main/java/org/killbill/billing/invoice/tree/NodeInterval.java
NodeInterval.findNode
public NodeInterval findNode(final LocalDate targetDate, final SearchCallback callback) { Preconditions.checkNotNull(callback); Preconditions.checkNotNull(targetDate); if (targetDate.compareTo(getStart()) < 0 || targetDate.compareTo(getEnd()) > 0) { return null; } NodeInterval curChild = leftChild; while (curChild != null) { if (curChild.getStart().compareTo(targetDate) <= 0 && curChild.getEnd().compareTo(targetDate) >= 0) { if (callback.isMatch(curChild)) { return curChild; } NodeInterval result = curChild.findNode(targetDate, callback); if (result != null) { return result; } } curChild = curChild.getRightSibling(); } return null; }
java
public NodeInterval findNode(final LocalDate targetDate, final SearchCallback callback) { Preconditions.checkNotNull(callback); Preconditions.checkNotNull(targetDate); if (targetDate.compareTo(getStart()) < 0 || targetDate.compareTo(getEnd()) > 0) { return null; } NodeInterval curChild = leftChild; while (curChild != null) { if (curChild.getStart().compareTo(targetDate) <= 0 && curChild.getEnd().compareTo(targetDate) >= 0) { if (callback.isMatch(curChild)) { return curChild; } NodeInterval result = curChild.findNode(targetDate, callback); if (result != null) { return result; } } curChild = curChild.getRightSibling(); } return null; }
[ "public", "NodeInterval", "findNode", "(", "final", "LocalDate", "targetDate", ",", "final", "SearchCallback", "callback", ")", "{", "Preconditions", ".", "checkNotNull", "(", "callback", ")", ";", "Preconditions", ".", "checkNotNull", "(", "targetDate", ")", ";",...
Return the first node satisfying the date and match callback. @param targetDate target date for possible match nodes whose interval comprises that date @param callback custom logic to decide if a given node is a match @return the found node or null if there is nothing.
[ "Return", "the", "first", "node", "satisfying", "the", "date", "and", "match", "callback", "." ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/NodeInterval.java#L215-L238
wcm-io/wcm-io-tooling
commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java
ContentPackage.addFile
public void addFile(String path, File file, String contentType) throws IOException { try (InputStream is = new FileInputStream(file)) { addFile(path, is, contentType); } }
java
public void addFile(String path, File file, String contentType) throws IOException { try (InputStream is = new FileInputStream(file)) { addFile(path, is, contentType); } }
[ "public", "void", "addFile", "(", "String", "path", ",", "File", "file", ",", "String", "contentType", ")", "throws", "IOException", "{", "try", "(", "InputStream", "is", "=", "new", "FileInputStream", "(", "file", ")", ")", "{", "addFile", "(", "path", ...
Adds a binary file with explicit mime type. @param path Full content path and file name of file @param file File with binary data @param contentType Mime type, optionally with ";charset=XYZ" extension @throws IOException I/O exception
[ "Adds", "a", "binary", "file", "with", "explicit", "mime", "type", "." ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java#L234-L238
opendatatrentino/smatch-webapi-client
src/main/java/it/unitn/disi/smatch/webapi/client/WebApiClient.java
WebApiClient.getInstance
public static WebApiClient getInstance(Locale locale, String host, int port) { if (null == webApiClient) { webApiClient = new WebApiClient(locale, host, "" + port); } return webApiClient; }
java
public static WebApiClient getInstance(Locale locale, String host, int port) { if (null == webApiClient) { webApiClient = new WebApiClient(locale, host, "" + port); } return webApiClient; }
[ "public", "static", "WebApiClient", "getInstance", "(", "Locale", "locale", ",", "String", "host", ",", "int", "port", ")", "{", "if", "(", "null", "==", "webApiClient", ")", "{", "webApiClient", "=", "new", "WebApiClient", "(", "locale", ",", "host", ",",...
Returns instance of web API client for given locale and connection properties. @param locale language. @param host Sweb web API server host. @param port Sweb web API server port. @return instance of web API client for given locale and connection properties.
[ "Returns", "instance", "of", "web", "API", "client", "for", "given", "locale", "and", "connection", "properties", "." ]
train
https://github.com/opendatatrentino/smatch-webapi-client/blob/d74fc41ab5bdc29afafd11c9001ac25dff20f965/src/main/java/it/unitn/disi/smatch/webapi/client/WebApiClient.java#L127-L132
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java
WorkflowsInner.getByResourceGroupAsync
public Observable<WorkflowInner> getByResourceGroupAsync(String resourceGroupName, String workflowName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, workflowName).map(new Func1<ServiceResponse<WorkflowInner>, WorkflowInner>() { @Override public WorkflowInner call(ServiceResponse<WorkflowInner> response) { return response.body(); } }); }
java
public Observable<WorkflowInner> getByResourceGroupAsync(String resourceGroupName, String workflowName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, workflowName).map(new Func1<ServiceResponse<WorkflowInner>, WorkflowInner>() { @Override public WorkflowInner call(ServiceResponse<WorkflowInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkflowInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "workflowName", ")", ".", "map...
Gets a workflow. @param resourceGroupName The resource group name. @param workflowName The workflow name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkflowInner object
[ "Gets", "a", "workflow", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L632-L639
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/AbstractBackupJob.java
AbstractBackupJob.notifyError
protected void notifyError(String message, Throwable error) { synchronized (listeners) { Thread notifier = new ErrorNotifyThread(listeners.toArray(new BackupJobListener[listeners.size()]), this, message, error); notifier.start(); } }
java
protected void notifyError(String message, Throwable error) { synchronized (listeners) { Thread notifier = new ErrorNotifyThread(listeners.toArray(new BackupJobListener[listeners.size()]), this, message, error); notifier.start(); } }
[ "protected", "void", "notifyError", "(", "String", "message", ",", "Throwable", "error", ")", "{", "synchronized", "(", "listeners", ")", "{", "Thread", "notifier", "=", "new", "ErrorNotifyThread", "(", "listeners", ".", "toArray", "(", "new", "BackupJobListener...
Notify all listeners about an error @param error - Throwable instance
[ "Notify", "all", "listeners", "about", "an", "error" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/AbstractBackupJob.java#L178-L186
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.serviceName_rules_emailsObfuscation_GET
public ArrayList<OvhContactAllTypesEnum> serviceName_rules_emailsObfuscation_GET(String serviceName) throws IOException { String qPath = "/domain/{serviceName}/rules/emailsObfuscation"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
java
public ArrayList<OvhContactAllTypesEnum> serviceName_rules_emailsObfuscation_GET(String serviceName) throws IOException { String qPath = "/domain/{serviceName}/rules/emailsObfuscation"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
[ "public", "ArrayList", "<", "OvhContactAllTypesEnum", ">", "serviceName_rules_emailsObfuscation_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/{serviceName}/rules/emailsObfuscation\"", ";", "StringBuilder", "sb", "=",...
Retrieve emails obfuscation rule REST: GET /domain/{serviceName}/rules/emailsObfuscation @param serviceName [required] The internal name of your domain
[ "Retrieve", "emails", "obfuscation", "rule" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1390-L1395
hdbeukel/james-core
src/main/java/org/jamesframework/core/search/Search.java
Search.updateBestSolution
protected boolean updateBestSolution(SolutionType newSolution, Evaluation newSolutionEvaluation, Validation newSolutionValidation){ // check: valid solution if(newSolutionValidation.passed()){ // check: improvement or no best solution set Double delta = null; if(bestSolution == null || (delta = computeDelta(newSolutionEvaluation, getBestSolutionEvaluation())) > 0){ // flag improvement improvementDuringCurrentStep = true; // store last improvement time lastImprovementTime = System.currentTimeMillis(); // update minimum delta if applicable (only if first delta or smaller than current minimum delta) if(delta != null && (minDelta == JamesConstants.INVALID_DELTA || delta < minDelta)){ minDelta = delta; } // update best solution (create copy!) bestSolution = Solution.checkedCopy(newSolution); bestSolutionEvaluation = newSolutionEvaluation; bestSolutionValidation = newSolutionValidation; // fire callback fireNewBestSolution(bestSolution, bestSolutionEvaluation, bestSolutionValidation); // found improvement return true; } else { // no improvement return false; } } else { // invalid solution return false; } }
java
protected boolean updateBestSolution(SolutionType newSolution, Evaluation newSolutionEvaluation, Validation newSolutionValidation){ // check: valid solution if(newSolutionValidation.passed()){ // check: improvement or no best solution set Double delta = null; if(bestSolution == null || (delta = computeDelta(newSolutionEvaluation, getBestSolutionEvaluation())) > 0){ // flag improvement improvementDuringCurrentStep = true; // store last improvement time lastImprovementTime = System.currentTimeMillis(); // update minimum delta if applicable (only if first delta or smaller than current minimum delta) if(delta != null && (minDelta == JamesConstants.INVALID_DELTA || delta < minDelta)){ minDelta = delta; } // update best solution (create copy!) bestSolution = Solution.checkedCopy(newSolution); bestSolutionEvaluation = newSolutionEvaluation; bestSolutionValidation = newSolutionValidation; // fire callback fireNewBestSolution(bestSolution, bestSolutionEvaluation, bestSolutionValidation); // found improvement return true; } else { // no improvement return false; } } else { // invalid solution return false; } }
[ "protected", "boolean", "updateBestSolution", "(", "SolutionType", "newSolution", ",", "Evaluation", "newSolutionEvaluation", ",", "Validation", "newSolutionValidation", ")", "{", "// check: valid solution", "if", "(", "newSolutionValidation", ".", "passed", "(", ")", ")"...
<p> Checks whether a new best solution has been found and updates it accordingly, given that the solution has already been evaluated and validated. The best solution is updated only if the presented solution is valid and </p> <ul> <li>no best solution had been set before, or</li> <li>the new solution has a better evaluation</li> </ul> <p> If the new solution is invalid or has a worse evaluation than the current best solution, calling this method has no effect. Note that the best solution is <b>retained</b> across subsequent runs of the same search. </p> @param newSolution newly presented solution @param newSolutionEvaluation evaluation of given solution @param newSolutionValidation validation of given solution @return <code>true</code> if the given solution is accepted as the new best solution
[ "<p", ">", "Checks", "whether", "a", "new", "best", "solution", "has", "been", "found", "and", "updates", "it", "accordingly", "given", "that", "the", "solution", "has", "already", "been", "evaluated", "and", "validated", ".", "The", "best", "solution", "is"...
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/Search.java#L888-L921
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.deleteFunctionCall
public static void deleteFunctionCall(Node n, AbstractCompiler compiler) { checkState(n.isCall()); Node parent = n.getParent(); if (parent.isExprResult()) { Node grandParent = parent.getParent(); grandParent.removeChild(parent); parent = grandParent; } else { // Seems like part of more complex expression, fallback to replacing with no-op. parent.replaceChild(n, newUndefinedNode(n)); } NodeUtil.markFunctionsDeleted(n, compiler); compiler.reportChangeToEnclosingScope(parent); }
java
public static void deleteFunctionCall(Node n, AbstractCompiler compiler) { checkState(n.isCall()); Node parent = n.getParent(); if (parent.isExprResult()) { Node grandParent = parent.getParent(); grandParent.removeChild(parent); parent = grandParent; } else { // Seems like part of more complex expression, fallback to replacing with no-op. parent.replaceChild(n, newUndefinedNode(n)); } NodeUtil.markFunctionsDeleted(n, compiler); compiler.reportChangeToEnclosingScope(parent); }
[ "public", "static", "void", "deleteFunctionCall", "(", "Node", "n", ",", "AbstractCompiler", "compiler", ")", "{", "checkState", "(", "n", ".", "isCall", "(", ")", ")", ";", "Node", "parent", "=", "n", ".", "getParent", "(", ")", ";", "if", "(", "paren...
Permanently delete the given call from the AST while maintaining a valid node structure, as well as report the related AST changes to the given compiler. In some cases, this is done by deleting the parent from the AST and is come cases expression is replaced by {@code undefined}.
[ "Permanently", "delete", "the", "given", "call", "from", "the", "AST", "while", "maintaining", "a", "valid", "node", "structure", "as", "well", "as", "report", "the", "related", "AST", "changes", "to", "the", "given", "compiler", ".", "In", "some", "cases", ...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L2759-L2774
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURIFactory.java
UsableURIFactory.ensureMinimalEscaping
private String ensureMinimalEscaping(String u, final String charset) { return ensureMinimalEscaping(u, charset, LaxURLCodec.EXPANDED_URI_SAFE); }
java
private String ensureMinimalEscaping(String u, final String charset) { return ensureMinimalEscaping(u, charset, LaxURLCodec.EXPANDED_URI_SAFE); }
[ "private", "String", "ensureMinimalEscaping", "(", "String", "u", ",", "final", "String", "charset", ")", "{", "return", "ensureMinimalEscaping", "(", "u", ",", "charset", ",", "LaxURLCodec", ".", "EXPANDED_URI_SAFE", ")", ";", "}" ]
Ensure that there all characters needing escaping in the passed-in String are escaped. Stray '%' characters are *not* escaped, as per browser behavior. @param u String to escape @param charset @return string with any necessary escaping applied
[ "Ensure", "that", "there", "all", "characters", "needing", "escaping", "in", "the", "passed", "-", "in", "String", "are", "escaped", ".", "Stray", "%", "characters", "are", "*", "not", "*", "escaped", "as", "per", "browser", "behavior", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURIFactory.java#L630-L632
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.unpackEntry
public static boolean unpackEntry(File zip, String name, File file) { return unpackEntry(zip, name, file, null); }
java
public static boolean unpackEntry(File zip, String name, File file) { return unpackEntry(zip, name, file, null); }
[ "public", "static", "boolean", "unpackEntry", "(", "File", "zip", ",", "String", "name", ",", "File", "file", ")", "{", "return", "unpackEntry", "(", "zip", ",", "name", ",", "file", ",", "null", ")", ";", "}" ]
Unpacks a single file from a ZIP archive to a file. @param zip ZIP file. @param name entry name. @param file target file to be created or overwritten. @return <code>true</code> if the entry was found and unpacked, <code>false</code> if the entry was not found.
[ "Unpacks", "a", "single", "file", "from", "a", "ZIP", "archive", "to", "a", "file", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L318-L320
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseMenuScreen.java
XBaseMenuScreen.printControl
public boolean printControl(PrintWriter out, int iPrintOptions) { boolean bFieldsFound = true; // This will keep screen from printing (non-existent sub-fields) MenusModel recMenus = (MenusModel)((BaseMenuScreen)this.getScreenField()).getMainRecord(); if ((recMenus.getField(MenusModel.XML_DATA).isNull()) || (recMenus.getField(MenusModel.XML_DATA).toString().startsWith("<HTML>")) || (recMenus.getField(Menus.XML_DATA).toString().startsWith("<html>"))) { String filename = ((PropertiesField)recMenus.getField(MenusModel.PARAMS)).getProperty(DBParams.XML); if ((filename != null) && (filename.length() > 0)) { InputStream streamIn = this.getTask().getInputStream(filename); if (streamIn == null) { Utility.getLogger().warning("XmlFile not found " + filename); return false; } String str = Utility.transferURLStream(null, null, new InputStreamReader(streamIn)); recMenus.getField(MenusModel.XML_DATA).setString(str); } } if (!recMenus.getField(MenusModel.XML_DATA).isNull()) { String str = recMenus.getField(Menus.XML_DATA).toString(); str = Utility.replaceResources(str, null, null, (BaseMenuScreen)this.getScreenField()); recMenus.getField(MenusModel.XML_DATA).setString(str); } String strContentArea = recMenus.getSubMenuXML(); out.println(strContentArea); return bFieldsFound; }
java
public boolean printControl(PrintWriter out, int iPrintOptions) { boolean bFieldsFound = true; // This will keep screen from printing (non-existent sub-fields) MenusModel recMenus = (MenusModel)((BaseMenuScreen)this.getScreenField()).getMainRecord(); if ((recMenus.getField(MenusModel.XML_DATA).isNull()) || (recMenus.getField(MenusModel.XML_DATA).toString().startsWith("<HTML>")) || (recMenus.getField(Menus.XML_DATA).toString().startsWith("<html>"))) { String filename = ((PropertiesField)recMenus.getField(MenusModel.PARAMS)).getProperty(DBParams.XML); if ((filename != null) && (filename.length() > 0)) { InputStream streamIn = this.getTask().getInputStream(filename); if (streamIn == null) { Utility.getLogger().warning("XmlFile not found " + filename); return false; } String str = Utility.transferURLStream(null, null, new InputStreamReader(streamIn)); recMenus.getField(MenusModel.XML_DATA).setString(str); } } if (!recMenus.getField(MenusModel.XML_DATA).isNull()) { String str = recMenus.getField(Menus.XML_DATA).toString(); str = Utility.replaceResources(str, null, null, (BaseMenuScreen)this.getScreenField()); recMenus.getField(MenusModel.XML_DATA).setString(str); } String strContentArea = recMenus.getSubMenuXML(); out.println(strContentArea); return bFieldsFound; }
[ "public", "boolean", "printControl", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "boolean", "bFieldsFound", "=", "true", ";", "// This will keep screen from printing (non-existent sub-fields)", "MenusModel", "recMenus", "=", "(", "MenusModel", ")", ...
Code to display a Menu. @exception DBException File exception.
[ "Code", "to", "display", "a", "Menu", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseMenuScreen.java#L82-L113
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java
InlineRendition.getRequestedDimension
private Dimension getRequestedDimension() { // check for fixed dimensions from media args if (mediaArgs.getFixedWidth() > 0 || mediaArgs.getFixedHeight() > 0) { return new Dimension(mediaArgs.getFixedWidth(), mediaArgs.getFixedHeight()); } // check for dimensions from mediaformat (evaluate only first media format) MediaFormat[] mediaFormats = mediaArgs.getMediaFormats(); if (mediaFormats != null && mediaFormats.length > 0) { Dimension dimension = mediaFormats[0].getMinDimension(); if (dimension != null) { return dimension; } } // fallback to 0/0 - no specific dimension requested return new Dimension(0, 0); }
java
private Dimension getRequestedDimension() { // check for fixed dimensions from media args if (mediaArgs.getFixedWidth() > 0 || mediaArgs.getFixedHeight() > 0) { return new Dimension(mediaArgs.getFixedWidth(), mediaArgs.getFixedHeight()); } // check for dimensions from mediaformat (evaluate only first media format) MediaFormat[] mediaFormats = mediaArgs.getMediaFormats(); if (mediaFormats != null && mediaFormats.length > 0) { Dimension dimension = mediaFormats[0].getMinDimension(); if (dimension != null) { return dimension; } } // fallback to 0/0 - no specific dimension requested return new Dimension(0, 0); }
[ "private", "Dimension", "getRequestedDimension", "(", ")", "{", "// check for fixed dimensions from media args", "if", "(", "mediaArgs", ".", "getFixedWidth", "(", ")", ">", "0", "||", "mediaArgs", ".", "getFixedHeight", "(", ")", ">", "0", ")", "{", "return", "...
Requested dimensions either from media format or fixed dimensions from media args. @return Requested dimensions
[ "Requested", "dimensions", "either", "from", "media", "format", "or", "fixed", "dimensions", "from", "media", "args", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java#L326-L344
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java
P2sVpnServerConfigurationsInner.beginCreateOrUpdateAsync
public Observable<P2SVpnServerConfigurationInner> beginCreateOrUpdateAsync(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName, P2SVpnServerConfigurationInner p2SVpnServerConfigurationParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName, p2SVpnServerConfigurationParameters).map(new Func1<ServiceResponse<P2SVpnServerConfigurationInner>, P2SVpnServerConfigurationInner>() { @Override public P2SVpnServerConfigurationInner call(ServiceResponse<P2SVpnServerConfigurationInner> response) { return response.body(); } }); }
java
public Observable<P2SVpnServerConfigurationInner> beginCreateOrUpdateAsync(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName, P2SVpnServerConfigurationInner p2SVpnServerConfigurationParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName, p2SVpnServerConfigurationParameters).map(new Func1<ServiceResponse<P2SVpnServerConfigurationInner>, P2SVpnServerConfigurationInner>() { @Override public P2SVpnServerConfigurationInner call(ServiceResponse<P2SVpnServerConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "P2SVpnServerConfigurationInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "virtualWanName", ",", "String", "p2SVpnServerConfigurationName", ",", "P2SVpnServerConfigurationInner", "p2SVpnServerConfigurationPara...
Creates a P2SVpnServerConfiguration to associate with a VirtualWan if it doesn't exist else updates the existing P2SVpnServerConfiguration. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWanName The name of the VirtualWan. @param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration. @param p2SVpnServerConfigurationParameters Parameters supplied to create or Update a P2SVpnServerConfiguration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the P2SVpnServerConfigurationInner object
[ "Creates", "a", "P2SVpnServerConfiguration", "to", "associate", "with", "a", "VirtualWan", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "P2SVpnServerConfiguration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L308-L315
JOML-CI/JOML
src/org/joml/Vector2d.java
Vector2d.fma
public Vector2d fma(Vector2dc a, Vector2dc b) { return fma(a, b, thisOrNew()); }
java
public Vector2d fma(Vector2dc a, Vector2dc b) { return fma(a, b, thisOrNew()); }
[ "public", "Vector2d", "fma", "(", "Vector2dc", "a", ",", "Vector2dc", "b", ")", "{", "return", "fma", "(", "a", ",", "b", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Add the component-wise multiplication of <code>a * b</code> to this vector. @param a the first multiplicand @param b the second multiplicand @return a vector holding the result
[ "Add", "the", "component", "-", "wise", "multiplication", "of", "<code", ">", "a", "*", "b<", "/", "code", ">", "to", "this", "vector", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2d.java#L1012-L1014
theHilikus/Event-manager
src/main/java/com/github/thehilikus/events/event_manager/GenericEventDispatcher.java
GenericEventDispatcher.addListener
public void addListener(T listener) { Method[] declaredMethods = listener.getClass().getDeclaredMethods(); boolean found = false; for (Method method : declaredMethods) { // loop only on declared methods to avoid // calling // empty Adapter methods on event fire if (CALLBACK_NAME.equals(method.getName())) { found = true; Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length >= 1 && EventObject.class.isAssignableFrom(parameterTypes[0])) { // since // event // methods // have // at // least // the // event // argument register(listener, parameterTypes[0]); } } } if (!found) { log.warn("[addListener] No callback method found in provided listener {}", listener); } }
java
public void addListener(T listener) { Method[] declaredMethods = listener.getClass().getDeclaredMethods(); boolean found = false; for (Method method : declaredMethods) { // loop only on declared methods to avoid // calling // empty Adapter methods on event fire if (CALLBACK_NAME.equals(method.getName())) { found = true; Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length >= 1 && EventObject.class.isAssignableFrom(parameterTypes[0])) { // since // event // methods // have // at // least // the // event // argument register(listener, parameterTypes[0]); } } } if (!found) { log.warn("[addListener] No callback method found in provided listener {}", listener); } }
[ "public", "void", "addListener", "(", "T", "listener", ")", "{", "Method", "[", "]", "declaredMethods", "=", "listener", ".", "getClass", "(", ")", ".", "getDeclaredMethods", "(", ")", ";", "boolean", "found", "=", "false", ";", "for", "(", "Method", "me...
Adds a listener if it doesn't already exist. The event handler methods must have its first argument as a descendant of {@link EventObject} <br> The event handling methods must be declared directly in the listener and not in one of its super-classes. This is a performance limitation @param listener the object to notify
[ "Adds", "a", "listener", "if", "it", "doesn", "t", "already", "exist", ".", "The", "event", "handler", "methods", "must", "have", "its", "first", "argument", "as", "a", "descendant", "of", "{", "@link", "EventObject", "}", "<br", ">", "The", "event", "ha...
train
https://github.com/theHilikus/Event-manager/blob/c3dabf5a145e57b2a6de89c1910851b8a8ae6064/src/main/java/com/github/thehilikus/events/event_manager/GenericEventDispatcher.java#L43-L71
amzn/ion-java
src/com/amazon/ion/impl/bin/WriteBuffer.java
WriteBuffer.writeBytesSlow
private void writeBytesSlow(final byte[] bytes, int off, int len) { while (len > 0) { final Block block = current; final int amount = Math.min(len, block.remaining()); System.arraycopy(bytes, off, block.data, block.limit, amount); block.limit += amount; off += amount; len -= amount; if (block.remaining() == 0) { if (index == blocks.size() - 1) { allocateNewBlock(); } index++; current = blocks.get(index); } } }
java
private void writeBytesSlow(final byte[] bytes, int off, int len) { while (len > 0) { final Block block = current; final int amount = Math.min(len, block.remaining()); System.arraycopy(bytes, off, block.data, block.limit, amount); block.limit += amount; off += amount; len -= amount; if (block.remaining() == 0) { if (index == blocks.size() - 1) { allocateNewBlock(); } index++; current = blocks.get(index); } } }
[ "private", "void", "writeBytesSlow", "(", "final", "byte", "[", "]", "bytes", ",", "int", "off", ",", "int", "len", ")", "{", "while", "(", "len", ">", "0", ")", "{", "final", "Block", "block", "=", "current", ";", "final", "int", "amount", "=", "M...
slow in the sense that we do all kind of block boundary checking
[ "slow", "in", "the", "sense", "that", "we", "do", "all", "kind", "of", "block", "boundary", "checking" ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/bin/WriteBuffer.java#L136-L157
GCRC/nunaliit
nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java
SubmissionUtils.recreateDocumentFromDocAndReserved
static public JSONObject recreateDocumentFromDocAndReserved(JSONObject doc, JSONObject reserved) throws Exception { JSONObject result = JSONSupport.copyObject( doc ); // Re-insert attributes that start with '_' if( null != reserved ) { Iterator<?> it = reserved.keys(); while( it.hasNext() ){ Object keyObj = it.next(); if( keyObj instanceof String ){ String key = (String)keyObj; Object value = reserved.opt(key); result.put("_"+key, value); } } } return result; }
java
static public JSONObject recreateDocumentFromDocAndReserved(JSONObject doc, JSONObject reserved) throws Exception { JSONObject result = JSONSupport.copyObject( doc ); // Re-insert attributes that start with '_' if( null != reserved ) { Iterator<?> it = reserved.keys(); while( it.hasNext() ){ Object keyObj = it.next(); if( keyObj instanceof String ){ String key = (String)keyObj; Object value = reserved.opt(key); result.put("_"+key, value); } } } return result; }
[ "static", "public", "JSONObject", "recreateDocumentFromDocAndReserved", "(", "JSONObject", "doc", ",", "JSONObject", "reserved", ")", "throws", "Exception", "{", "JSONObject", "result", "=", "JSONSupport", ".", "copyObject", "(", "doc", ")", ";", "// Re-insert attribu...
Re-creates a document given the document and the reserved keys. @param doc Main document @param reserved Document that contains reserved keys. A reserve key starts with an underscore. In this document, the reserved keys do not have the starting underscore. @return @throws Exception
[ "Re", "-", "creates", "a", "document", "given", "the", "document", "and", "the", "reserved", "keys", "." ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java#L99-L116
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.isLive
private boolean isLive(long index, Segment segment, OffsetPredicate predicate) { long offset = segment.offset(index); return offset != -1 && predicate.test(offset); }
java
private boolean isLive(long index, Segment segment, OffsetPredicate predicate) { long offset = segment.offset(index); return offset != -1 && predicate.test(offset); }
[ "private", "boolean", "isLive", "(", "long", "index", ",", "Segment", "segment", ",", "OffsetPredicate", "predicate", ")", "{", "long", "offset", "=", "segment", ".", "offset", "(", "index", ")", ";", "return", "offset", "!=", "-", "1", "&&", "predicate", ...
Returns a boolean value indicating whether the given index is release.
[ "Returns", "a", "boolean", "value", "indicating", "whether", "the", "given", "index", "is", "release", "." ]
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L289-L292
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.getObjects
public JSONObject getObjects(List<String> objectIDs, List<String> attributesToRetrieve) throws AlgoliaException { return this.getObjects(objectIDs, attributesToRetrieve, RequestOptions.empty); }
java
public JSONObject getObjects(List<String> objectIDs, List<String> attributesToRetrieve) throws AlgoliaException { return this.getObjects(objectIDs, attributesToRetrieve, RequestOptions.empty); }
[ "public", "JSONObject", "getObjects", "(", "List", "<", "String", ">", "objectIDs", ",", "List", "<", "String", ">", "attributesToRetrieve", ")", "throws", "AlgoliaException", "{", "return", "this", ".", "getObjects", "(", "objectIDs", ",", "attributesToRetrieve",...
Get several objects from this index @param objectIDs the array of unique identifier of objects to retrieve @param attributesToRetrieve contains the list of attributes to retrieve.
[ "Get", "several", "objects", "from", "this", "index" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L301-L303
apiman/apiman
gateway/engine/redis/src/main/java/io/apiman/gateway/engine/redis/common/RedisBackingStore.java
RedisBackingStore.withMap
private void withMap(Consumer<RMap<String, String>> consumer) { final RMap<String, String> map = client.getMap(prefix); consumer.accept(map); }
java
private void withMap(Consumer<RMap<String, String>> consumer) { final RMap<String, String> map = client.getMap(prefix); consumer.accept(map); }
[ "private", "void", "withMap", "(", "Consumer", "<", "RMap", "<", "String", ",", "String", ">", ">", "consumer", ")", "{", "final", "RMap", "<", "String", ",", "String", ">", "map", "=", "client", ".", "getMap", "(", "prefix", ")", ";", "consumer", "....
Pass an {@link RMap} to the consumer. @param consumer the consumer of the {@link RMap}
[ "Pass", "an", "{", "@link", "RMap", "}", "to", "the", "consumer", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/redis/src/main/java/io/apiman/gateway/engine/redis/common/RedisBackingStore.java#L60-L63
drallgood/jpasskit
jpasskit/src/main/java/de/brendamour/jpasskit/util/CertUtils.java
CertUtils.toX509Certificate
public static X509Certificate toX509Certificate(InputStream certificateInputStream) throws CertificateException { try { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509", getProviderName()); Certificate certificate = certificateFactory.generateCertificate(certificateInputStream); if (certificate instanceof X509Certificate) { ((X509Certificate) certificate).checkValidity(); return (X509Certificate) certificate; } throw new IllegalStateException("The key from the input stream could not be decrypted"); } catch (NoSuchProviderException ex) { throw new IllegalStateException("The key from the input stream could not be decrypted", ex); } }
java
public static X509Certificate toX509Certificate(InputStream certificateInputStream) throws CertificateException { try { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509", getProviderName()); Certificate certificate = certificateFactory.generateCertificate(certificateInputStream); if (certificate instanceof X509Certificate) { ((X509Certificate) certificate).checkValidity(); return (X509Certificate) certificate; } throw new IllegalStateException("The key from the input stream could not be decrypted"); } catch (NoSuchProviderException ex) { throw new IllegalStateException("The key from the input stream could not be decrypted", ex); } }
[ "public", "static", "X509Certificate", "toX509Certificate", "(", "InputStream", "certificateInputStream", ")", "throws", "CertificateException", "{", "try", "{", "CertificateFactory", "certificateFactory", "=", "CertificateFactory", ".", "getInstance", "(", "\"X.509\"", ","...
Load a DER Certificate from an already opened {@link InputStream}. The caller is responsible for closing the stream after this method completes successfully or fails. @param certificateInputStream {@link InputStream} containing the certificate. @return {@link X509Certificate} loaded from {@code certificateInputStream} @throws IllegalStateException If {@link X509Certificate} loading failed. @throws CertificateException If {@link X509Certificate} is invalid or cannot be loaded.
[ "Load", "a", "DER", "Certificate", "from", "an", "already", "opened", "{", "@link", "InputStream", "}", ".", "The", "caller", "is", "responsible", "for", "closing", "the", "stream", "after", "this", "method", "completes", "successfully", "or", "fails", "." ]
train
https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/util/CertUtils.java#L117-L129
opentable/otj-jaxrs
client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java
JaxRsClientFactory.newClient
public Client newClient(String clientName, JaxRsFeatureGroup feature, JaxRsFeatureGroup... moreFeatures) { return newBuilder(clientName, feature, moreFeatures).build(); }
java
public Client newClient(String clientName, JaxRsFeatureGroup feature, JaxRsFeatureGroup... moreFeatures) { return newBuilder(clientName, feature, moreFeatures).build(); }
[ "public", "Client", "newClient", "(", "String", "clientName", ",", "JaxRsFeatureGroup", "feature", ",", "JaxRsFeatureGroup", "...", "moreFeatures", ")", "{", "return", "newBuilder", "(", "clientName", ",", "feature", ",", "moreFeatures", ")", ".", "build", "(", ...
Create a new {@link Client} instance with the given name and groups. You own the returned client and are responsible for managing its cleanup.
[ "Create", "a", "new", "{" ]
train
https://github.com/opentable/otj-jaxrs/blob/384e7094fe5a56d41b2a9970bfd783fa85cbbcb8/client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java#L239-L241
spring-projects/spring-boot
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java
InitializrService.executeInitializrMetadataRetrieval
private CloseableHttpResponse executeInitializrMetadataRetrieval(String url) { HttpGet request = new HttpGet(url); request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_META_DATA)); return execute(request, url, "retrieve metadata"); }
java
private CloseableHttpResponse executeInitializrMetadataRetrieval(String url) { HttpGet request = new HttpGet(url); request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_META_DATA)); return execute(request, url, "retrieve metadata"); }
[ "private", "CloseableHttpResponse", "executeInitializrMetadataRetrieval", "(", "String", "url", ")", "{", "HttpGet", "request", "=", "new", "HttpGet", "(", "url", ")", ";", "request", ".", "setHeader", "(", "new", "BasicHeader", "(", "HttpHeaders", ".", "ACCEPT", ...
Retrieves the meta-data of the service at the specified URL. @param url the URL @return the response
[ "Retrieves", "the", "meta", "-", "data", "of", "the", "service", "at", "the", "specified", "URL", "." ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java#L185-L189
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullRemoteServices.java
NullRemoteServices.batchUpdate
public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents) { notificationService.batchUpdate(invalidateIdEvents, invalidateTemplateEvents, pushEntryEvents, aliasEntryEvents, cacheUnit); }
java
public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents) { notificationService.batchUpdate(invalidateIdEvents, invalidateTemplateEvents, pushEntryEvents, aliasEntryEvents, cacheUnit); }
[ "public", "void", "batchUpdate", "(", "HashMap", "invalidateIdEvents", ",", "HashMap", "invalidateTemplateEvents", ",", "ArrayList", "pushEntryEvents", ",", "ArrayList", "aliasEntryEvents", ")", "{", "notificationService", ".", "batchUpdate", "(", "invalidateIdEvents", ",...
This allows the BatchUpdateDaemon to send its batch update events to all CacheUnits. @param invalidateIdEvents A Vector of invalidate by id. @param invalidateTemplateEvents A Vector of invalidate by template. @param pushEntryEvents A Vector of cache entries.
[ "This", "allows", "the", "BatchUpdateDaemon", "to", "send", "its", "batch", "update", "events", "to", "all", "CacheUnits", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullRemoteServices.java#L104-L106
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java
ElementMatchers.nameContainsIgnoreCase
public static <T extends NamedElement> ElementMatcher.Junction<T> nameContainsIgnoreCase(String infix) { return new NameMatcher<T>(new StringMatcher(infix, StringMatcher.Mode.CONTAINS_IGNORE_CASE)); }
java
public static <T extends NamedElement> ElementMatcher.Junction<T> nameContainsIgnoreCase(String infix) { return new NameMatcher<T>(new StringMatcher(infix, StringMatcher.Mode.CONTAINS_IGNORE_CASE)); }
[ "public", "static", "<", "T", "extends", "NamedElement", ">", "ElementMatcher", ".", "Junction", "<", "T", ">", "nameContainsIgnoreCase", "(", "String", "infix", ")", "{", "return", "new", "NameMatcher", "<", "T", ">", "(", "new", "StringMatcher", "(", "infi...
Matches a {@link NamedElement} for an infix of its name. The name's capitalization is ignored. @param infix The expected infix of the name. @param <T> The type of the matched object. @return An element matcher for a named element's name's infix.
[ "Matches", "a", "{", "@link", "NamedElement", "}", "for", "an", "infix", "of", "its", "name", ".", "The", "name", "s", "capitalization", "is", "ignored", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L735-L737
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.betweenDay
public static long betweenDay(Date beginDate, Date endDate, boolean isReset) { if (isReset) { beginDate = beginOfDay(beginDate); endDate = beginOfDay(endDate); } return between(beginDate, endDate, DateUnit.DAY); }
java
public static long betweenDay(Date beginDate, Date endDate, boolean isReset) { if (isReset) { beginDate = beginOfDay(beginDate); endDate = beginOfDay(endDate); } return between(beginDate, endDate, DateUnit.DAY); }
[ "public", "static", "long", "betweenDay", "(", "Date", "beginDate", ",", "Date", "endDate", ",", "boolean", "isReset", ")", "{", "if", "(", "isReset", ")", "{", "beginDate", "=", "beginOfDay", "(", "beginDate", ")", ";", "endDate", "=", "beginOfDay", "(", ...
判断两个日期相差的天数<br> <pre> 有时候我们计算相差天数的时候需要忽略时分秒。 比如:2016-02-01 23:59:59和2016-02-02 00:00:00相差一秒 如果isReset为<code>false</code>相差天数为0。 如果isReset为<code>true</code>相差天数将被计算为1 </pre> @param beginDate 起始日期 @param endDate 结束日期 @param isReset 是否重置时间为起始时间 @return 日期差 @since 3.0.1
[ "判断两个日期相差的天数<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1274-L1280
julianhyde/eigenbase-properties
src/main/java/org/eigenbase/util/property/TriggerableProperties.java
TriggerableProperties.superSetProperty
private void superSetProperty(String key, String oldValue) { if (oldValue != null) { super.setProperty(key, oldValue); } }
java
private void superSetProperty(String key, String oldValue) { if (oldValue != null) { super.setProperty(key, oldValue); } }
[ "private", "void", "superSetProperty", "(", "String", "key", ",", "String", "oldValue", ")", "{", "if", "(", "oldValue", "!=", "null", ")", "{", "super", ".", "setProperty", "(", "key", ",", "oldValue", ")", ";", "}", "}" ]
This is ONLY called during a veto operation. It calls the super class {@link #setProperty}. @param key Property name @param oldValue Previous value of property
[ "This", "is", "ONLY", "called", "during", "a", "veto", "operation", ".", "It", "calls", "the", "super", "class", "{", "@link", "#setProperty", "}", "." ]
train
https://github.com/julianhyde/eigenbase-properties/blob/fb8a544fa3775a52030c9434285478f139880d58/src/main/java/org/eigenbase/util/property/TriggerableProperties.java#L136-L141
glyptodon/guacamole-client
guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleConfiguration.java
GuacamoleConfiguration.setParameters
public void setParameters(Map<String, String> parameters) { this.parameters.clear(); this.parameters.putAll(parameters); }
java
public void setParameters(Map<String, String> parameters) { this.parameters.clear(); this.parameters.putAll(parameters); }
[ "public", "void", "setParameters", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "this", ".", "parameters", ".", "clear", "(", ")", ";", "this", ".", "parameters", ".", "putAll", "(", "parameters", ")", ";", "}" ]
Replaces all current parameters with the parameters defined within the given map. Key/value pairs within the map represent parameter name/value pairs. @param parameters A map which contains all parameter name/value pairs as key/value pairs.
[ "Replaces", "all", "current", "parameters", "with", "the", "parameters", "defined", "within", "the", "given", "map", ".", "Key", "/", "value", "pairs", "within", "the", "map", "represent", "parameter", "name", "/", "value", "pairs", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleConfiguration.java#L182-L185
allure-framework/allure-java
allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java
AllureLifecycle.updateStep
public void updateStep(final String uuid, final Consumer<StepResult> update) { final Optional<StepResult> found = storage.getStep(uuid); if (!found.isPresent()) { LOGGER.error("Could not update step: step with uuid {} not found", uuid); return; } final StepResult step = found.get(); notifier.beforeStepUpdate(step); update.accept(step); notifier.afterStepUpdate(step); }
java
public void updateStep(final String uuid, final Consumer<StepResult> update) { final Optional<StepResult> found = storage.getStep(uuid); if (!found.isPresent()) { LOGGER.error("Could not update step: step with uuid {} not found", uuid); return; } final StepResult step = found.get(); notifier.beforeStepUpdate(step); update.accept(step); notifier.afterStepUpdate(step); }
[ "public", "void", "updateStep", "(", "final", "String", "uuid", ",", "final", "Consumer", "<", "StepResult", ">", "update", ")", "{", "final", "Optional", "<", "StepResult", ">", "found", "=", "storage", ".", "getStep", "(", "uuid", ")", ";", "if", "(", ...
Updates step by specified uuid. @param uuid the uuid of step. @param update the update function.
[ "Updates", "step", "by", "specified", "uuid", "." ]
train
https://github.com/allure-framework/allure-java/blob/64015ca2b789aa6f7b19c793f1512e2f11d0174e/allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java#L510-L522
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/KeyHasher.java
KeyHasher.getNextHash
static UUID getNextHash(UUID hash) { if (hash == null) { // No hash given. By definition, the first hash is the "next" one". hash = MIN_HASH; } else if (hash.compareTo(MAX_HASH) >= 0) { // Given hash already equals or exceeds the max value. There is no successor. return null; } long msb = hash.getMostSignificantBits(); long lsb = hash.getLeastSignificantBits(); if (lsb == Long.MAX_VALUE) { msb++; // This won't overflow since we've checked that state is not end (i.e., id != MAX). lsb = Long.MIN_VALUE; } else { lsb++; } return new UUID(msb, lsb); }
java
static UUID getNextHash(UUID hash) { if (hash == null) { // No hash given. By definition, the first hash is the "next" one". hash = MIN_HASH; } else if (hash.compareTo(MAX_HASH) >= 0) { // Given hash already equals or exceeds the max value. There is no successor. return null; } long msb = hash.getMostSignificantBits(); long lsb = hash.getLeastSignificantBits(); if (lsb == Long.MAX_VALUE) { msb++; // This won't overflow since we've checked that state is not end (i.e., id != MAX). lsb = Long.MIN_VALUE; } else { lsb++; } return new UUID(msb, lsb); }
[ "static", "UUID", "getNextHash", "(", "UUID", "hash", ")", "{", "if", "(", "hash", "==", "null", ")", "{", "// No hash given. By definition, the first hash is the \"next\" one\".", "hash", "=", "MIN_HASH", ";", "}", "else", "if", "(", "hash", ".", "compareTo", "...
Generates a new Key Hash that is immediately after the given one. We define Key Hash H2 to be immediately after Key Hash h1 if there doesn't exist Key Hash H3 such that H1&lt;H3&lt;H2. The ordering is performed using {@link UUID#compareTo}. @return The successor Key Hash, or null if no more successors are available (if {@link IteratorState#isEnd} returns true).
[ "Generates", "a", "new", "Key", "Hash", "that", "is", "immediately", "after", "the", "given", "one", ".", "We", "define", "Key", "Hash", "H2", "to", "be", "immediately", "after", "Key", "Hash", "h1", "if", "there", "doesn", "t", "exist", "Key", "Hash", ...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/KeyHasher.java#L80-L99
wcm-io/wcm-io-handler
url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java
SuffixParser.getResources
@SuppressWarnings("null") public @NotNull List<Resource> getResources(@Nullable Predicate<Resource> filter, @Nullable Resource baseResource) { // resolve base path or fallback to current page's content if not specified Resource baseResourceToUse = baseResource; if (baseResourceToUse == null) { PageManager pageManager = request.getResourceResolver().adaptTo(PageManager.class); Page currentPage = pageManager.getContainingPage(request.getResource()); if (currentPage != null) { baseResourceToUse = currentPage.getContentResource(); } else { baseResourceToUse = request.getResource(); } } return getResourcesWithBaseResource(filter, baseResourceToUse); }
java
@SuppressWarnings("null") public @NotNull List<Resource> getResources(@Nullable Predicate<Resource> filter, @Nullable Resource baseResource) { // resolve base path or fallback to current page's content if not specified Resource baseResourceToUse = baseResource; if (baseResourceToUse == null) { PageManager pageManager = request.getResourceResolver().adaptTo(PageManager.class); Page currentPage = pageManager.getContainingPage(request.getResource()); if (currentPage != null) { baseResourceToUse = currentPage.getContentResource(); } else { baseResourceToUse = request.getResource(); } } return getResourcesWithBaseResource(filter, baseResourceToUse); }
[ "@", "SuppressWarnings", "(", "\"null\"", ")", "public", "@", "NotNull", "List", "<", "Resource", ">", "getResources", "(", "@", "Nullable", "Predicate", "<", "Resource", ">", "filter", ",", "@", "Nullable", "Resource", "baseResource", ")", "{", "// resolve ba...
Get the resources selected in the suffix of the URL @param filter optional filter to select only specific resources @param baseResource the suffix path is relative to this resource path (null for current page's jcr:content node) @return a list containing the Resources
[ "Get", "the", "resources", "selected", "in", "the", "suffix", "of", "the", "URL" ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java#L260-L276
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java
ServiceEndpointPoliciesInner.createOrUpdate
public ServiceEndpointPolicyInner createOrUpdate(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).toBlocking().last().body(); }
java
public ServiceEndpointPolicyInner createOrUpdate(String resourceGroupName, String serviceEndpointPolicyName, ServiceEndpointPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, parameters).toBlocking().last().body(); }
[ "public", "ServiceEndpointPolicyInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serviceEndpointPolicyName", ",", "ServiceEndpointPolicyInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Creates or updates a service Endpoint Policies. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy. @param parameters Parameters supplied to the create or update service endpoint policy operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ServiceEndpointPolicyInner object if successful.
[ "Creates", "or", "updates", "a", "service", "Endpoint", "Policies", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java#L444-L446
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.pauseDomainStream
public PauseDomainStreamResponse pauseDomainStream(PauseDomainStreamRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getDomain(), "Domain should NOT be empty."); checkStringNotEmpty(request.getApp(), "App should NOT be empty."); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter(PAUSE, null); return invokeHttpClient(internalRequest, PauseDomainStreamResponse.class); }
java
public PauseDomainStreamResponse pauseDomainStream(PauseDomainStreamRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getDomain(), "Domain should NOT be empty."); checkStringNotEmpty(request.getApp(), "App should NOT be empty."); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); internalRequest.addParameter(PAUSE, null); return invokeHttpClient(internalRequest, PauseDomainStreamResponse.class); }
[ "public", "PauseDomainStreamResponse", "pauseDomainStream", "(", "PauseDomainStreamRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDomain", "(", ")...
pause domain's stream in the live stream service. @param request The request object containing all options for pause a domain's stream @return the response
[ "pause", "domain", "s", "stream", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1498-L1511
phax/ph-css
ph-css/src/main/java/com/helger/css/writer/CSSCompressor.java
CSSCompressor.getCompressedCSS
@Nonnull public static String getCompressedCSS (@Nonnull final String sOriginalCSS, @Nonnull final ECSSVersion eCSSVersion) { return getCompressedCSS (sOriginalCSS, eCSSVersion, false); }
java
@Nonnull public static String getCompressedCSS (@Nonnull final String sOriginalCSS, @Nonnull final ECSSVersion eCSSVersion) { return getCompressedCSS (sOriginalCSS, eCSSVersion, false); }
[ "@", "Nonnull", "public", "static", "String", "getCompressedCSS", "(", "@", "Nonnull", "final", "String", "sOriginalCSS", ",", "@", "Nonnull", "final", "ECSSVersion", "eCSSVersion", ")", "{", "return", "getCompressedCSS", "(", "sOriginalCSS", ",", "eCSSVersion", "...
Get the compressed version of the passed CSS code. @param sOriginalCSS The original CSS code to be compressed. @param eCSSVersion The CSS version to use. @return If compression failed because the CSS is invalid or whatsoever, the original CSS is returned, else the compressed version is returned.
[ "Get", "the", "compressed", "version", "of", "the", "passed", "CSS", "code", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/writer/CSSCompressor.java#L57-L61
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_phone_changePhoneConfiguration_POST
public void billingAccount_line_serviceName_phone_changePhoneConfiguration_POST(String billingAccount, String serviceName, Boolean autoReboot, OvhSafeKeyValue<String>[] newConfigurations) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/changePhoneConfiguration"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "autoReboot", autoReboot); addBody(o, "newConfigurations", newConfigurations); exec(qPath, "POST", sb.toString(), o); }
java
public void billingAccount_line_serviceName_phone_changePhoneConfiguration_POST(String billingAccount, String serviceName, Boolean autoReboot, OvhSafeKeyValue<String>[] newConfigurations) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/changePhoneConfiguration"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "autoReboot", autoReboot); addBody(o, "newConfigurations", newConfigurations); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "billingAccount_line_serviceName_phone_changePhoneConfiguration_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Boolean", "autoReboot", ",", "OvhSafeKeyValue", "<", "String", ">", "[", "]", "newConfigurations", ")", "throws", ...
Edit configuration of the phone remotely by provisioning REST: POST /telephony/{billingAccount}/line/{serviceName}/phone/changePhoneConfiguration @param autoReboot [required] Automatically reboot phone when applying the configuration @param newConfigurations [required] Name value pairs of provisioning options @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Edit", "configuration", "of", "the", "phone", "remotely", "by", "provisioning" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1208-L1215
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_instance_group_groupId_DELETE
public void project_serviceName_instance_group_groupId_DELETE(String serviceName, String groupId) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/group/{groupId}"; StringBuilder sb = path(qPath, serviceName, groupId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void project_serviceName_instance_group_groupId_DELETE(String serviceName, String groupId) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/group/{groupId}"; StringBuilder sb = path(qPath, serviceName, groupId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "project_serviceName_instance_group_groupId_DELETE", "(", "String", "serviceName", ",", "String", "groupId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/instance/group/{groupId}\"", ";", "StringBuilder", "sb", "...
Delete a group REST: DELETE /cloud/project/{serviceName}/instance/group/{groupId} @param groupId [required] Group id @param serviceName [required] Project name
[ "Delete", "a", "group" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2152-L2156
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.convertTz
public static String convertTz(String dateStr, String format, String tzFrom, String tzTo) { return dateFormatTz(toTimestampTz(dateStr, format, tzFrom), tzTo); }
java
public static String convertTz(String dateStr, String format, String tzFrom, String tzTo) { return dateFormatTz(toTimestampTz(dateStr, format, tzFrom), tzTo); }
[ "public", "static", "String", "convertTz", "(", "String", "dateStr", ",", "String", "format", ",", "String", "tzFrom", ",", "String", "tzTo", ")", "{", "return", "dateFormatTz", "(", "toTimestampTz", "(", "dateStr", ",", "format", ",", "tzFrom", ")", ",", ...
Convert datetime string from a time zone to another time zone. @param dateStr the date time string @param format the date time format @param tzFrom the original time zone @param tzTo the target time zone
[ "Convert", "datetime", "string", "from", "a", "time", "zone", "to", "another", "time", "zone", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L376-L378
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/fit/MapColumnFixture.java
MapColumnFixture.getSymbolArrayValue
private Object getSymbolArrayValue(Object arraySymbol, int index) { Object result = null; if (index > -1 && index < ((Object[]) arraySymbol).length) { result = ((Object[]) arraySymbol)[index]; } return result; }
java
private Object getSymbolArrayValue(Object arraySymbol, int index) { Object result = null; if (index > -1 && index < ((Object[]) arraySymbol).length) { result = ((Object[]) arraySymbol)[index]; } return result; }
[ "private", "Object", "getSymbolArrayValue", "(", "Object", "arraySymbol", ",", "int", "index", ")", "{", "Object", "result", "=", "null", ";", "if", "(", "index", ">", "-", "1", "&&", "index", "<", "(", "(", "Object", "[", "]", ")", "arraySymbol", ")",...
Fetch the value from arraySymbol on specified index. @param arraySymbol symbol from Fixture that is array @param index to find element from array @return the element from the symbol array
[ "Fetch", "the", "value", "from", "arraySymbol", "on", "specified", "index", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/fit/MapColumnFixture.java#L496-L502
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.groupBy
public static Map<Object, Map> groupBy(Map self, List<Closure> closures) { return groupBy(self, closures.toArray()); }
java
public static Map<Object, Map> groupBy(Map self, List<Closure> closures) { return groupBy(self, closures.toArray()); }
[ "public", "static", "Map", "<", "Object", ",", "Map", ">", "groupBy", "(", "Map", "self", ",", "List", "<", "Closure", ">", "closures", ")", "{", "return", "groupBy", "(", "self", ",", "closures", ".", "toArray", "(", ")", ")", ";", "}" ]
Groups the members of a map into sub maps determined by the supplied mapping closures. Each closure will be passed a Map.Entry or key and value (depending on the number of parameters the closure accepts) and should return the key that each item should be grouped under. The resulting map will have an entry for each 'group path' returned by all closures, with values being the map members from the original map that belong to each such 'group path'. If the <code>self</code> map is one of TreeMap, Hashtable, or Properties, the returned Map will preserve that type, otherwise a LinkedHashMap will be returned. <pre class="groovyTestCase">def result = [a:1,b:2,c:3,d:4,e:5,f:6].groupBy([{ it.value % 2 }, { it.key.next() }]) assert result == [1:[b:[a:1], d:[c:3], f:[e:5]], 0:[c:[b:2], e:[d:4], g:[f:6]]]</pre> If an empty list of closures is supplied the IDENTITY Closure will be used. @param self a map to group @param closures a list of closures that map entries on keys @return a new map grouped by keys on each criterion @since 1.8.1 @see Closure#IDENTITY
[ "Groups", "the", "members", "of", "a", "map", "into", "sub", "maps", "determined", "by", "the", "supplied", "mapping", "closures", ".", "Each", "closure", "will", "be", "passed", "a", "Map", ".", "Entry", "or", "key", "and", "value", "(", "depending", "o...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L5882-L5884
tvesalainen/util
util/src/main/java/org/vesalainen/math/CubicSplineCurve.java
CubicSplineCurve.get141Matrix
public static final DenseMatrix64F get141Matrix(int order) { if (order < 2) { throw new IllegalArgumentException("order has to be at least 2 for 1 4 1 matrix"); } double[] data = new double[order*order]; for (int row=0;row<order;row++) { for (int col=0;col<order;col++) { int index = row*order+col; if (row == col) { data[index] = 4; } else { if (Math.abs(row-col) == 1) { data[index] = 1; } else { data[index] = 0; } } } } return new DenseMatrix64F(order, order, true, data); }
java
public static final DenseMatrix64F get141Matrix(int order) { if (order < 2) { throw new IllegalArgumentException("order has to be at least 2 for 1 4 1 matrix"); } double[] data = new double[order*order]; for (int row=0;row<order;row++) { for (int col=0;col<order;col++) { int index = row*order+col; if (row == col) { data[index] = 4; } else { if (Math.abs(row-col) == 1) { data[index] = 1; } else { data[index] = 0; } } } } return new DenseMatrix64F(order, order, true, data); }
[ "public", "static", "final", "DenseMatrix64F", "get141Matrix", "(", "int", "order", ")", "{", "if", "(", "order", "<", "2", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"order has to be at least 2 for 1 4 1 matrix\"", ")", ";", "}", "double", "[", ...
Creates a 1 4 1 matrix eg. |4 1 0| |1 4 1| |0 1 4| @param order Matrix dimension > 1 @return 1 4 1 matrix
[ "Creates", "a", "1", "4", "1", "matrix", "eg", ".", "|4", "1", "0|", "|1", "4", "1|", "|0", "1", "4|" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CubicSplineCurve.java#L172-L202
Wikidata/Wikidata-Toolkit
wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImpl.java
DataObjectFactoryImpl.getValueSnak
@Override public ValueSnak getValueSnak(PropertyIdValue propertyId, Value value) { return new ValueSnakImpl(propertyId, value); }
java
@Override public ValueSnak getValueSnak(PropertyIdValue propertyId, Value value) { return new ValueSnakImpl(propertyId, value); }
[ "@", "Override", "public", "ValueSnak", "getValueSnak", "(", "PropertyIdValue", "propertyId", ",", "Value", "value", ")", "{", "return", "new", "ValueSnakImpl", "(", "propertyId", ",", "value", ")", ";", "}" ]
Creates a {@link ValueSnakImpl}. Value snaks in JSON need to know the datatype of their property, which is not given in the parameters of this method. The snak that will be returned will use a default type based on the kind of value that is used (usually the "simplest" type for that value). This may not be desired. @see DataObjectFactory#getValueSnak(PropertyIdValue, Value)
[ "Creates", "a", "{", "@link", "ValueSnakImpl", "}", ".", "Value", "snaks", "in", "JSON", "need", "to", "know", "the", "datatype", "of", "their", "property", "which", "is", "not", "given", "in", "the", "parameters", "of", "this", "method", ".", "The", "sn...
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/DataObjectFactoryImpl.java#L137-L140
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.verifyImplicitOption
private static String[] verifyImplicitOption(String[] args) throws ProblemException { boolean foundImplicit = false; for (String a : args) { if (a.startsWith("-implicit:")) { foundImplicit = true; if (!a.equals("-implicit:none")) { throw new ProblemException("The only allowed setting for sjavac is -implicit:none, it is also the default."); } } } if (foundImplicit) { return args; } // -implicit:none not found lets add it. String[] newargs = new String[args.length+1]; System.arraycopy(args,0, newargs, 0, args.length); newargs[args.length] = "-implicit:none"; return newargs; }
java
private static String[] verifyImplicitOption(String[] args) throws ProblemException { boolean foundImplicit = false; for (String a : args) { if (a.startsWith("-implicit:")) { foundImplicit = true; if (!a.equals("-implicit:none")) { throw new ProblemException("The only allowed setting for sjavac is -implicit:none, it is also the default."); } } } if (foundImplicit) { return args; } // -implicit:none not found lets add it. String[] newargs = new String[args.length+1]; System.arraycopy(args,0, newargs, 0, args.length); newargs[args.length] = "-implicit:none"; return newargs; }
[ "private", "static", "String", "[", "]", "verifyImplicitOption", "(", "String", "[", "]", "args", ")", "throws", "ProblemException", "{", "boolean", "foundImplicit", "=", "false", ";", "for", "(", "String", "a", ":", "args", ")", "{", "if", "(", "a", "."...
Check if -implicit is supplied, if so check that it is none. If -implicit is not supplied, supply -implicit:none Only implicit:none is allowed because otherwise the multicore compilations and dependency tracking will be tangled up.
[ "Check", "if", "-", "implicit", "is", "supplied", "if", "so", "check", "that", "it", "is", "none", ".", "If", "-", "implicit", "is", "not", "supplied", "supply", "-", "implicit", ":", "none", "Only", "implicit", ":", "none", "is", "allowed", "because", ...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L578-L598
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.deleteFromConference
public ApiSuccessResponse deleteFromConference(String id, DeleteFromConferenceData deleteFromConferenceData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = deleteFromConferenceWithHttpInfo(id, deleteFromConferenceData); return resp.getData(); }
java
public ApiSuccessResponse deleteFromConference(String id, DeleteFromConferenceData deleteFromConferenceData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = deleteFromConferenceWithHttpInfo(id, deleteFromConferenceData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "deleteFromConference", "(", "String", "id", ",", "DeleteFromConferenceData", "deleteFromConferenceData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "deleteFromConferenceWithHttpInfo", "(", ...
Delete a party from a conference call Delete the specified DN from the conference call. This operation can only be performed by the owner of the conference call. @param id The connection ID of the conference call. (required) @param deleteFromConferenceData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Delete", "a", "party", "from", "a", "conference", "call", "Delete", "the", "specified", "DN", "from", "the", "conference", "call", ".", "This", "operation", "can", "only", "be", "performed", "by", "the", "owner", "of", "the", "conference", "call", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L1211-L1214
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java
FileInputFormat.registerInflaterInputStreamFactory
public static void registerInflaterInputStreamFactory(String fileExtension, InflaterInputStreamFactory<?> factory) { synchronized (INFLATER_INPUT_STREAM_FACTORIES) { if (INFLATER_INPUT_STREAM_FACTORIES.put(fileExtension, factory) != null) { LOG.warn("Overwriting an existing decompression algorithm for \"{}\" files.", fileExtension); } } }
java
public static void registerInflaterInputStreamFactory(String fileExtension, InflaterInputStreamFactory<?> factory) { synchronized (INFLATER_INPUT_STREAM_FACTORIES) { if (INFLATER_INPUT_STREAM_FACTORIES.put(fileExtension, factory) != null) { LOG.warn("Overwriting an existing decompression algorithm for \"{}\" files.", fileExtension); } } }
[ "public", "static", "void", "registerInflaterInputStreamFactory", "(", "String", "fileExtension", ",", "InflaterInputStreamFactory", "<", "?", ">", "factory", ")", "{", "synchronized", "(", "INFLATER_INPUT_STREAM_FACTORIES", ")", "{", "if", "(", "INFLATER_INPUT_STREAM_FAC...
Registers a decompression algorithm through a {@link org.apache.flink.api.common.io.compression.InflaterInputStreamFactory} with a file extension for transparent decompression. @param fileExtension of the compressed files @param factory to create an {@link java.util.zip.InflaterInputStream} that handles the decompression format
[ "Registers", "a", "decompression", "algorithm", "through", "a", "{" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L138-L144
alkacon/opencms-core
src/org/opencms/pdftools/CmsPdfResourceHandler.java
CmsPdfResourceHandler.handleThumbnailLink
private void handleThumbnailLink( CmsObject cms, HttpServletRequest request, HttpServletResponse response, String uri) throws Exception { String options = request.getParameter(CmsPdfThumbnailLink.PARAM_OPTIONS); if (CmsStringUtil.isEmptyOrWhitespaceOnly(options)) { options = "w:64"; } CmsPdfThumbnailLink linkObj = new CmsPdfThumbnailLink(cms, uri, options); CmsResource pdf = linkObj.getPdfResource(); CmsFile pdfFile = cms.readFile(pdf); CmsPdfThumbnailGenerator thumbnailGenerator = new CmsPdfThumbnailGenerator(); // use a wrapped resource because we want the cache to store files with the correct (image file) extensions CmsWrappedResource wrapperWithImageExtension = new CmsWrappedResource(pdfFile); wrapperWithImageExtension.setRootPath(pdfFile.getRootPath() + "." + linkObj.getFormat()); String cacheName = m_thumbnailCache.getCacheName( wrapperWithImageExtension.getResource(), options + ";" + linkObj.getFormat()); byte[] imageData = m_thumbnailCache.getCacheContent(cacheName); if (imageData == null) { imageData = thumbnailGenerator.generateThumbnail( new ByteArrayInputStream(pdfFile.getContents()), linkObj.getWidth(), linkObj.getHeight(), linkObj.getFormat(), linkObj.getPage()); m_thumbnailCache.saveCacheFile(cacheName, imageData); } response.setContentType(IMAGE_MIMETYPES.get(linkObj.getFormat())); response.getOutputStream().write(imageData); CmsResourceInitException initEx = new CmsResourceInitException(CmsPdfResourceHandler.class); initEx.setClearErrors(true); throw initEx; }
java
private void handleThumbnailLink( CmsObject cms, HttpServletRequest request, HttpServletResponse response, String uri) throws Exception { String options = request.getParameter(CmsPdfThumbnailLink.PARAM_OPTIONS); if (CmsStringUtil.isEmptyOrWhitespaceOnly(options)) { options = "w:64"; } CmsPdfThumbnailLink linkObj = new CmsPdfThumbnailLink(cms, uri, options); CmsResource pdf = linkObj.getPdfResource(); CmsFile pdfFile = cms.readFile(pdf); CmsPdfThumbnailGenerator thumbnailGenerator = new CmsPdfThumbnailGenerator(); // use a wrapped resource because we want the cache to store files with the correct (image file) extensions CmsWrappedResource wrapperWithImageExtension = new CmsWrappedResource(pdfFile); wrapperWithImageExtension.setRootPath(pdfFile.getRootPath() + "." + linkObj.getFormat()); String cacheName = m_thumbnailCache.getCacheName( wrapperWithImageExtension.getResource(), options + ";" + linkObj.getFormat()); byte[] imageData = m_thumbnailCache.getCacheContent(cacheName); if (imageData == null) { imageData = thumbnailGenerator.generateThumbnail( new ByteArrayInputStream(pdfFile.getContents()), linkObj.getWidth(), linkObj.getHeight(), linkObj.getFormat(), linkObj.getPage()); m_thumbnailCache.saveCacheFile(cacheName, imageData); } response.setContentType(IMAGE_MIMETYPES.get(linkObj.getFormat())); response.getOutputStream().write(imageData); CmsResourceInitException initEx = new CmsResourceInitException(CmsPdfResourceHandler.class); initEx.setClearErrors(true); throw initEx; }
[ "private", "void", "handleThumbnailLink", "(", "CmsObject", "cms", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "String", "uri", ")", "throws", "Exception", "{", "String", "options", "=", "request", ".", "getParameter", "(", "...
Handles a request for a PDF thumbnail.<p> @param cms the current CMS context @param request the servlet request @param response the servlet response @param uri the current uri @throws Exception if something goes wrong
[ "Handles", "a", "request", "for", "a", "PDF", "thumbnail", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/pdftools/CmsPdfResourceHandler.java#L247-L284
kevinherron/opc-ua-stack
stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/ArrayUtil.java
ArrayUtil.unflatten
public static Object unflatten(Object array, int[] dimensions) { Class<?> type = getType(array); return unflatten(type, array, dimensions, 0); }
java
public static Object unflatten(Object array, int[] dimensions) { Class<?> type = getType(array); return unflatten(type, array, dimensions, 0); }
[ "public", "static", "Object", "unflatten", "(", "Object", "array", ",", "int", "[", "]", "dimensions", ")", "{", "Class", "<", "?", ">", "type", "=", "getType", "(", "array", ")", ";", "return", "unflatten", "(", "type", ",", "array", ",", "dimensions"...
Un-flatten a one-dimensional array into an multi-dimensional array based on the provided dimensions. @param array the 1-dimensional array to un-flatten. @param dimensions the dimensions to un-flatten to. @return a multi-dimensional array of the provided dimensions.
[ "Un", "-", "flatten", "a", "one", "-", "dimensional", "array", "into", "an", "multi", "-", "dimensional", "array", "based", "on", "the", "provided", "dimensions", "." ]
train
https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/ArrayUtil.java#L70-L74
upwork/java-upwork
src/com/Upwork/api/UpworkRestClient.java
UpworkRestClient.genError
private static JSONObject genError(HttpResponse response) throws JSONException { String code = response.getFirstHeader("X-Upwork-Error-Code").getValue(); String message = response.getFirstHeader("X-Upwork-Error-Message").getValue(); if (code == null) { code = Integer.toString(response.getStatusLine().getStatusCode()); } if (message == null) { message = response.getStatusLine().toString(); } return new JSONObject("{error: {code: \"" + code + "\", message: \"" + message + "\"}}"); }
java
private static JSONObject genError(HttpResponse response) throws JSONException { String code = response.getFirstHeader("X-Upwork-Error-Code").getValue(); String message = response.getFirstHeader("X-Upwork-Error-Message").getValue(); if (code == null) { code = Integer.toString(response.getStatusLine().getStatusCode()); } if (message == null) { message = response.getStatusLine().toString(); } return new JSONObject("{error: {code: \"" + code + "\", message: \"" + message + "\"}}"); }
[ "private", "static", "JSONObject", "genError", "(", "HttpResponse", "response", ")", "throws", "JSONException", "{", "String", "code", "=", "response", ".", "getFirstHeader", "(", "\"X-Upwork-Error-Code\"", ")", ".", "getValue", "(", ")", ";", "String", "message",...
Generate error as JSONObject @param code Error code @param message Error message @throws JSONException @return {@link JSONObject}
[ "Generate", "error", "as", "JSONObject" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/UpworkRestClient.java#L254-L267
google/error-prone
check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java
ASTHelpers.hasAnnotation
public static boolean hasAnnotation( Symbol sym, Class<? extends Annotation> annotationClass, VisitorState state) { return hasAnnotation(sym, annotationClass.getName(), state); }
java
public static boolean hasAnnotation( Symbol sym, Class<? extends Annotation> annotationClass, VisitorState state) { return hasAnnotation(sym, annotationClass.getName(), state); }
[ "public", "static", "boolean", "hasAnnotation", "(", "Symbol", "sym", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ",", "VisitorState", "state", ")", "{", "return", "hasAnnotation", "(", "sym", ",", "annotationClass", ".", "getName", ...
Check for the presence of an annotation, considering annotation inheritance. @return true if the symbol is annotated with given type.
[ "Check", "for", "the", "presence", "of", "an", "annotation", "considering", "annotation", "inheritance", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L705-L708
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java
ComputeNodesImpl.uploadBatchServiceLogsAsync
public Observable<UploadBatchServiceLogsResult> uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions) { return uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration, computeNodeUploadBatchServiceLogsOptions).map(new Func1<ServiceResponseWithHeaders<UploadBatchServiceLogsResult, ComputeNodeUploadBatchServiceLogsHeaders>, UploadBatchServiceLogsResult>() { @Override public UploadBatchServiceLogsResult call(ServiceResponseWithHeaders<UploadBatchServiceLogsResult, ComputeNodeUploadBatchServiceLogsHeaders> response) { return response.body(); } }); }
java
public Observable<UploadBatchServiceLogsResult> uploadBatchServiceLogsAsync(String poolId, String nodeId, UploadBatchServiceLogsConfiguration uploadBatchServiceLogsConfiguration, ComputeNodeUploadBatchServiceLogsOptions computeNodeUploadBatchServiceLogsOptions) { return uploadBatchServiceLogsWithServiceResponseAsync(poolId, nodeId, uploadBatchServiceLogsConfiguration, computeNodeUploadBatchServiceLogsOptions).map(new Func1<ServiceResponseWithHeaders<UploadBatchServiceLogsResult, ComputeNodeUploadBatchServiceLogsHeaders>, UploadBatchServiceLogsResult>() { @Override public UploadBatchServiceLogsResult call(ServiceResponseWithHeaders<UploadBatchServiceLogsResult, ComputeNodeUploadBatchServiceLogsHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "UploadBatchServiceLogsResult", ">", "uploadBatchServiceLogsAsync", "(", "String", "poolId", ",", "String", "nodeId", ",", "UploadBatchServiceLogsConfiguration", "uploadBatchServiceLogsConfiguration", ",", "ComputeNodeUploadBatchServiceLogsOptions", "co...
Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. @param uploadBatchServiceLogsConfiguration The Azure Batch service log files upload configuration. @param computeNodeUploadBatchServiceLogsOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UploadBatchServiceLogsResult object
[ "Upload", "Azure", "Batch", "service", "log", "files", "from", "the", "specified", "compute", "node", "to", "Azure", "Blob", "Storage", ".", "This", "is", "for", "gathering", "Azure", "Batch", "service", "log", "files", "in", "an", "automated", "fashion", "f...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L2515-L2522
killbill/killbill
invoice/src/main/java/org/killbill/billing/invoice/tree/SubscriptionItemTree.java
SubscriptionItemTree.mergeProposedItem
public void mergeProposedItem(final InvoiceItem invoiceItem) { Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem); // Check if it was an existing item ignored for tree purposes (e.g. FIXED or $0 RECURRING, both of which aren't repaired) final InvoiceItem existingItem = Iterables.tryFind(existingIgnoredItems, new Predicate<InvoiceItem>() { @Override public boolean apply(final InvoiceItem input) { return input.matches(invoiceItem); } }).orNull(); if (existingItem != null) { return; } switch (invoiceItem.getInvoiceItemType()) { case RECURRING: // merged means we've either matched the proposed to an existing, or triggered a repair final boolean merged = root.addProposedItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD))); if (!merged) { items.add(new Item(invoiceItem, targetInvoiceId, ItemAction.ADD)); } break; case FIXED: remainingIgnoredItems.add(invoiceItem); break; default: Preconditions.checkState(false, "Unexpected proposed item " + invoiceItem); } }
java
public void mergeProposedItem(final InvoiceItem invoiceItem) { Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem); // Check if it was an existing item ignored for tree purposes (e.g. FIXED or $0 RECURRING, both of which aren't repaired) final InvoiceItem existingItem = Iterables.tryFind(existingIgnoredItems, new Predicate<InvoiceItem>() { @Override public boolean apply(final InvoiceItem input) { return input.matches(invoiceItem); } }).orNull(); if (existingItem != null) { return; } switch (invoiceItem.getInvoiceItemType()) { case RECURRING: // merged means we've either matched the proposed to an existing, or triggered a repair final boolean merged = root.addProposedItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD))); if (!merged) { items.add(new Item(invoiceItem, targetInvoiceId, ItemAction.ADD)); } break; case FIXED: remainingIgnoredItems.add(invoiceItem); break; default: Preconditions.checkState(false, "Unexpected proposed item " + invoiceItem); } }
[ "public", "void", "mergeProposedItem", "(", "final", "InvoiceItem", "invoiceItem", ")", "{", "Preconditions", ".", "checkState", "(", "!", "isBuilt", ",", "\"Tree already built, unable to add new invoiceItem=%s\"", ",", "invoiceItem", ")", ";", "// Check if it was an existi...
Merge a new proposed item in the tree. @param invoiceItem new proposed item that should be merged in the existing tree
[ "Merge", "a", "new", "proposed", "item", "in", "the", "tree", "." ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/SubscriptionItemTree.java#L173-L203
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java
ObjectPropertiesController.loadObject
public void loadObject(Object object, Set<String> excludedMethods) { m_model.setTableModel(createTableModel(object, excludedMethods)); }
java
public void loadObject(Object object, Set<String> excludedMethods) { m_model.setTableModel(createTableModel(object, excludedMethods)); }
[ "public", "void", "loadObject", "(", "Object", "object", ",", "Set", "<", "String", ">", "excludedMethods", ")", "{", "m_model", ".", "setTableModel", "(", "createTableModel", "(", "object", ",", "excludedMethods", ")", ")", ";", "}" ]
Populate the model with the object's properties. @param object object whose properties we're displaying @param excludedMethods method names to exclude
[ "Populate", "the", "model", "with", "the", "object", "s", "properties", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java#L62-L65
ops4j/org.ops4j.pax.web
pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java
WebAppParser.parseErrorPages
private static void parseErrorPages(final ErrorPageType errorPageType, final WebApp webApp) { final WebAppErrorPage errorPage = new WebAppErrorPage(); if (errorPageType.getErrorCode() != null) { errorPage.setErrorCode(errorPageType.getErrorCode().getValue().toString()); } if (errorPageType.getExceptionType() != null) { errorPage.setExceptionType(errorPageType.getExceptionType().getValue()); } if (errorPageType.getLocation() != null) { errorPage.setLocation(errorPageType.getLocation().getValue()); } if (errorPage.getErrorCode() == null && errorPage.getExceptionType() == null) { errorPage.setExceptionType(ErrorPageModel.ERROR_PAGE); } webApp.addErrorPage(errorPage); }
java
private static void parseErrorPages(final ErrorPageType errorPageType, final WebApp webApp) { final WebAppErrorPage errorPage = new WebAppErrorPage(); if (errorPageType.getErrorCode() != null) { errorPage.setErrorCode(errorPageType.getErrorCode().getValue().toString()); } if (errorPageType.getExceptionType() != null) { errorPage.setExceptionType(errorPageType.getExceptionType().getValue()); } if (errorPageType.getLocation() != null) { errorPage.setLocation(errorPageType.getLocation().getValue()); } if (errorPage.getErrorCode() == null && errorPage.getExceptionType() == null) { errorPage.setExceptionType(ErrorPageModel.ERROR_PAGE); } webApp.addErrorPage(errorPage); }
[ "private", "static", "void", "parseErrorPages", "(", "final", "ErrorPageType", "errorPageType", ",", "final", "WebApp", "webApp", ")", "{", "final", "WebAppErrorPage", "errorPage", "=", "new", "WebAppErrorPage", "(", ")", ";", "if", "(", "errorPageType", ".", "g...
Parses error pages out of web.xml. @param errorPageType errorPageType element from web.xml @param webApp model for web.xml
[ "Parses", "error", "pages", "out", "of", "web", ".", "xml", "." ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/parser/WebAppParser.java#L755-L770
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentTreeUrl.java
DocumentTreeUrl.getTreeDocumentUrl
public static MozuUrl getTreeDocumentUrl(String documentListName, String documentName, Boolean includeInactive, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documentTree/{documentName}?includeInactive={includeInactive}&responseFields={responseFields}"); formatter.formatUrl("documentListName", documentListName); formatter.formatUrl("documentName", documentName); formatter.formatUrl("includeInactive", includeInactive); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getTreeDocumentUrl(String documentListName, String documentName, Boolean includeInactive, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documentTree/{documentName}?includeInactive={includeInactive}&responseFields={responseFields}"); formatter.formatUrl("documentListName", documentListName); formatter.formatUrl("documentName", documentName); formatter.formatUrl("includeInactive", includeInactive); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getTreeDocumentUrl", "(", "String", "documentListName", ",", "String", "documentName", ",", "Boolean", "includeInactive", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/c...
Get Resource Url for GetTreeDocument @param documentListName Name of content documentListName to delete @param documentName The name of the document in the site. @param includeInactive Include inactive content. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetTreeDocument" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentTreeUrl.java#L66-L74
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java
FeatureScopes.createLocalVariableScope
protected IScope createLocalVariableScope(EObject featureCall, IScope parent, IFeatureScopeSession session, IResolvedTypes resolvedTypes) { return new LocalVariableScope(parent, session, asAbstractFeatureCall(featureCall)); }
java
protected IScope createLocalVariableScope(EObject featureCall, IScope parent, IFeatureScopeSession session, IResolvedTypes resolvedTypes) { return new LocalVariableScope(parent, session, asAbstractFeatureCall(featureCall)); }
[ "protected", "IScope", "createLocalVariableScope", "(", "EObject", "featureCall", ",", "IScope", "parent", ",", "IFeatureScopeSession", "session", ",", "IResolvedTypes", "resolvedTypes", ")", "{", "return", "new", "LocalVariableScope", "(", "parent", ",", "session", "...
Creates a scope for the local variables that have been registered in the given session. @param featureCall the feature call that is currently processed by the scoping infrastructure @param parent the parent scope. Is never null. @param session the currently known scope session. Is never null. @param resolvedTypes may be used by inheritors.
[ "Creates", "a", "scope", "for", "the", "local", "variables", "that", "have", "been", "registered", "in", "the", "given", "session", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java#L628-L630
spockframework/spock
spock-core/src/main/java/org/spockframework/util/ReflectionUtil.java
ReflectionUtil.getMethodByName
@Nullable public static Method getMethodByName(Class<?> clazz, String name) { for (Method method : clazz.getMethods()) if (method.getName().equals(name)) return method; return null; }
java
@Nullable public static Method getMethodByName(Class<?> clazz, String name) { for (Method method : clazz.getMethods()) if (method.getName().equals(name)) return method; return null; }
[ "@", "Nullable", "public", "static", "Method", "getMethodByName", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ")", "{", "for", "(", "Method", "method", ":", "clazz", ".", "getMethods", "(", ")", ")", "if", "(", "method", ".", "getName"...
Finds a public method with the given name declared in the given class/interface or one of its super classes/interfaces. If multiple such methods exists, it is undefined which one is returned.
[ "Finds", "a", "public", "method", "with", "the", "given", "name", "declared", "in", "the", "given", "class", "/", "interface", "or", "one", "of", "its", "super", "classes", "/", "interfaces", ".", "If", "multiple", "such", "methods", "exists", "it", "is", ...
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/util/ReflectionUtil.java#L118-L125
looly/hutool
hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java
MapUtil.getDate
public static Date getDate(Map<?, ?> map, Object key) { return get(map, key, Date.class); }
java
public static Date getDate(Map<?, ?> map, Object key) { return get(map, key, Date.class); }
[ "public", "static", "Date", "getDate", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "Object", "key", ")", "{", "return", "get", "(", "map", ",", "key", ",", "Date", ".", "class", ")", ";", "}" ]
获取Map指定key的值,并转换为{@link Date} @param map Map @param key 键 @return 值 @since 4.1.2
[ "获取Map指定key的值,并转换为", "{", "@link", "Date", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L852-L854
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_region_regionName_workflow_backup_POST
public OvhBackup project_serviceName_region_regionName_workflow_backup_POST(String serviceName, String regionName, String cron, String instanceId, Long maxExecutionCount, String name, Long rotation) throws IOException { String qPath = "/cloud/project/{serviceName}/region/{regionName}/workflow/backup"; StringBuilder sb = path(qPath, serviceName, regionName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "cron", cron); addBody(o, "instanceId", instanceId); addBody(o, "maxExecutionCount", maxExecutionCount); addBody(o, "name", name); addBody(o, "rotation", rotation); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhBackup.class); }
java
public OvhBackup project_serviceName_region_regionName_workflow_backup_POST(String serviceName, String regionName, String cron, String instanceId, Long maxExecutionCount, String name, Long rotation) throws IOException { String qPath = "/cloud/project/{serviceName}/region/{regionName}/workflow/backup"; StringBuilder sb = path(qPath, serviceName, regionName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "cron", cron); addBody(o, "instanceId", instanceId); addBody(o, "maxExecutionCount", maxExecutionCount); addBody(o, "name", name); addBody(o, "rotation", rotation); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhBackup.class); }
[ "public", "OvhBackup", "project_serviceName_region_regionName_workflow_backup_POST", "(", "String", "serviceName", ",", "String", "regionName", ",", "String", "cron", ",", "String", "instanceId", ",", "Long", "maxExecutionCount", ",", "String", "name", ",", "Long", "rot...
Create a new automated backup REST: POST /cloud/project/{serviceName}/region/{regionName}/workflow/backup @param cron [required] Unix Cron pattern (eg: '* * * * *') @param instanceId [required] Instance ID to backup @param maxExecutionCount [required] Number of execution to process before ending the job. Null value means that the job will never end. @param name [required] Name of your backup job @param regionName [required] Public Cloud region @param rotation [required] Number of backup to keep @param serviceName [required] Public Cloud project API beta
[ "Create", "a", "new", "automated", "backup" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L192-L203
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java
AbstractOracleQuery.connectBy
@WithBridgeMethods(value = OracleQuery.class, castRequired = true) public C connectBy(Predicate cond) { return addFlag(Position.BEFORE_ORDER, CONNECT_BY, cond); }
java
@WithBridgeMethods(value = OracleQuery.class, castRequired = true) public C connectBy(Predicate cond) { return addFlag(Position.BEFORE_ORDER, CONNECT_BY, cond); }
[ "@", "WithBridgeMethods", "(", "value", "=", "OracleQuery", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "connectBy", "(", "Predicate", "cond", ")", "{", "return", "addFlag", "(", "Position", ".", "BEFORE_ORDER", ",", "CONNECT_BY", ","...
CONNECT BY specifies the relationship between parent rows and child rows of the hierarchy. @param cond condition @return the current object
[ "CONNECT", "BY", "specifies", "the", "relationship", "between", "parent", "rows", "and", "child", "rows", "of", "the", "hierarchy", "." ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java#L72-L75
datasift/datasift-java
src/main/java/com/datasift/client/push/DataSiftPush.java
DataSiftPush.createPull
public FutureData<PushSubscription> createPull(PullJsonType jsonMeta, PreparedHistoricsQuery historics, String name, Status initialStatus, long start, long end) { return createPull(jsonMeta, historics, null, name, initialStatus, start, end); }
java
public FutureData<PushSubscription> createPull(PullJsonType jsonMeta, PreparedHistoricsQuery historics, String name, Status initialStatus, long start, long end) { return createPull(jsonMeta, historics, null, name, initialStatus, start, end); }
[ "public", "FutureData", "<", "PushSubscription", ">", "createPull", "(", "PullJsonType", "jsonMeta", ",", "PreparedHistoricsQuery", "historics", ",", "String", "name", ",", "Status", "initialStatus", ",", "long", "start", ",", "long", "end", ")", "{", "return", ...
/* Create a push subscription to be consumed via {@link #pull(PushSubscription, int, String)} using a live stream @param historics the historic query which will be consumed via pull @param name a name for the subscription @param initialStatus the initial status of the subscription @param start an option timestamp of when to start the subscription @param end an optional timestamp of when to stop @return this
[ "/", "*", "Create", "a", "push", "subscription", "to", "be", "consumed", "via", "{", "@link", "#pull", "(", "PushSubscription", "int", "String", ")", "}", "using", "a", "live", "stream" ]
train
https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/push/DataSiftPush.java#L491-L494
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.executeInsert
public List<List<Object>> executeInsert(Map params, String sql) throws SQLException { return executeInsert(sql, singletonList(params)); }
java
public List<List<Object>> executeInsert(Map params, String sql) throws SQLException { return executeInsert(sql, singletonList(params)); }
[ "public", "List", "<", "List", "<", "Object", ">", ">", "executeInsert", "(", "Map", "params", ",", "String", "sql", ")", "throws", "SQLException", "{", "return", "executeInsert", "(", "sql", ",", "singletonList", "(", "params", ")", ")", ";", "}" ]
A variant of {@link #executeInsert(String, java.util.List)} useful when providing the named parameters as named arguments. @param params a map containing the named parameters @param sql The SQL statement to execute @return A list of the auto-generated column values for each inserted row (typically auto-generated keys) @throws SQLException if a database access error occurs @since 1.8.7
[ "A", "variant", "of", "{", "@link", "#executeInsert", "(", "String", "java", ".", "util", ".", "List", ")", "}", "useful", "when", "providing", "the", "named", "parameters", "as", "named", "arguments", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2717-L2719
alkacon/opencms-core
src/org/opencms/search/fields/CmsSearchFieldConfigurationOldCategories.java
CmsSearchFieldConfigurationOldCategories.appendCategories
@Override protected I_CmsSearchDocument appendCategories( I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, List<CmsProperty> properties, List<CmsProperty> propertiesSearched) { Document doc = (Document)document.getDocument(); // add the category of the file (this is searched so the value can also be attached on a folder) String value = CmsProperty.get(CmsPropertyDefinition.PROPERTY_SEARCH_CATEGORY, propertiesSearched).getValue(); if (CmsStringUtil.isNotEmpty(value)) { // all categories are internally stored lower case value = value.trim().toLowerCase(); if (value.length() > 0) { Field field = new StringField(CmsSearchField.FIELD_CATEGORY, value, Field.Store.YES); // field.setBoost(0); doc.add(field); } } return document; }
java
@Override protected I_CmsSearchDocument appendCategories( I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, List<CmsProperty> properties, List<CmsProperty> propertiesSearched) { Document doc = (Document)document.getDocument(); // add the category of the file (this is searched so the value can also be attached on a folder) String value = CmsProperty.get(CmsPropertyDefinition.PROPERTY_SEARCH_CATEGORY, propertiesSearched).getValue(); if (CmsStringUtil.isNotEmpty(value)) { // all categories are internally stored lower case value = value.trim().toLowerCase(); if (value.length() > 0) { Field field = new StringField(CmsSearchField.FIELD_CATEGORY, value, Field.Store.YES); // field.setBoost(0); doc.add(field); } } return document; }
[ "@", "Override", "protected", "I_CmsSearchDocument", "appendCategories", "(", "I_CmsSearchDocument", "document", ",", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "I_CmsExtractionResult", "extractionResult", ",", "List", "<", "CmsProperty", ">", "properties", ...
Extends the given document by resource category information based on properties.<p> @param document the document to extend @param cms the OpenCms context used for building the search index @param resource the resource that is indexed @param extractionResult the plain text extraction result from the resource @param properties the list of all properties directly attached to the resource (not searched) @param propertiesSearched the list of all searched properties of the resource @return the document extended by resource category information @see org.opencms.search.fields.CmsSearchFieldConfiguration#appendCategories(org.opencms.search.I_CmsSearchDocument, org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.opencms.search.extractors.I_CmsExtractionResult, java.util.List, java.util.List)
[ "Extends", "the", "given", "document", "by", "resource", "category", "information", "based", "on", "properties", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/fields/CmsSearchFieldConfigurationOldCategories.java#L78-L101
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java
Boot.startJanusWithModuleType
public static Kernel startJanusWithModuleType(Class<? extends Module> platformModule, Class<? extends Agent> agentCls, Object... params) throws Exception { Class<? extends Module> startupModule = platformModule; if (startupModule == null) { startupModule = JanusConfig.getSystemPropertyAsClass(Module.class, JanusConfig.INJECTION_MODULE_NAME, JanusConfig.INJECTION_MODULE_NAME_VALUE); } assert startupModule != null : "No platform injection module"; //$NON-NLS-1$ return startJanusWithModule(startupModule.newInstance(), agentCls, params); }
java
public static Kernel startJanusWithModuleType(Class<? extends Module> platformModule, Class<? extends Agent> agentCls, Object... params) throws Exception { Class<? extends Module> startupModule = platformModule; if (startupModule == null) { startupModule = JanusConfig.getSystemPropertyAsClass(Module.class, JanusConfig.INJECTION_MODULE_NAME, JanusConfig.INJECTION_MODULE_NAME_VALUE); } assert startupModule != null : "No platform injection module"; //$NON-NLS-1$ return startJanusWithModule(startupModule.newInstance(), agentCls, params); }
[ "public", "static", "Kernel", "startJanusWithModuleType", "(", "Class", "<", "?", "extends", "Module", ">", "platformModule", ",", "Class", "<", "?", "extends", "Agent", ">", "agentCls", ",", "Object", "...", "params", ")", "throws", "Exception", "{", "Class",...
Launch the Janus kernel and the first agent in the kernel. <p>Thus function does not parse the command line. See {@link #main(String[])} for the command line management. When this function is called, it is assumed that all the system's properties are correctly set. <p>The platformModule parameter permits to specify the injection module to use. The injection module is in change of creating/injecting all the components of the platform. The default injection module is retreived from the system property with the name stored in {@link JanusConfig#INJECTION_MODULE_NAME}. The default type for the injection module is stored in the constant {@link JanusConfig#INJECTION_MODULE_NAME_VALUE}. <p>The function {@link #getBootAgentIdentifier()} permits to retreive the identifier of the launched agent. @param platformModule type of the injection module to use for initializing the platform, if <code>null</code> the default module will be used. @param agentCls type of the first agent to launch. @param params parameters to pass to the agent as its initliazation parameters. @return the kernel that was launched. @throws Exception - if it is impossible to start the platform. @since 0.5 @see #main(String[]) @see #getBootAgentIdentifier()
[ "Launch", "the", "Janus", "kernel", "and", "the", "first", "agent", "in", "the", "kernel", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L950-L959
alibaba/canal
driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/ErrorPacket.java
ErrorPacket.fromBytes
public void fromBytes(byte[] data) { int index = 0; // 1. read field count this.fieldCount = data[0]; index++; // 2. read error no. this.errorNumber = ByteHelper.readUnsignedShortLittleEndian(data, index); index += 2; // 3. read marker this.sqlStateMarker = data[index]; index++; // 4. read sqlState this.sqlState = ByteHelper.readFixedLengthBytes(data, index, 5); index += 5; // 5. read message this.message = new String(ByteHelper.readFixedLengthBytes(data, index, data.length - index)); // end read }
java
public void fromBytes(byte[] data) { int index = 0; // 1. read field count this.fieldCount = data[0]; index++; // 2. read error no. this.errorNumber = ByteHelper.readUnsignedShortLittleEndian(data, index); index += 2; // 3. read marker this.sqlStateMarker = data[index]; index++; // 4. read sqlState this.sqlState = ByteHelper.readFixedLengthBytes(data, index, 5); index += 5; // 5. read message this.message = new String(ByteHelper.readFixedLengthBytes(data, index, data.length - index)); // end read }
[ "public", "void", "fromBytes", "(", "byte", "[", "]", "data", ")", "{", "int", "index", "=", "0", ";", "// 1. read field count", "this", ".", "fieldCount", "=", "data", "[", "0", "]", ";", "index", "++", ";", "// 2. read error no.", "this", ".", "errorNu...
<pre> VERSION 4.1 Bytes Name ----- ---- 1 field_count, always = 0xff 2 errno 1 (sqlstate marker), always '#' 5 sqlstate (5 characters) n message </pre>
[ "<pre", ">", "VERSION", "4", ".", "1", "Bytes", "Name", "-----", "----", "1", "field_count", "always", "=", "0xff", "2", "errno", "1", "(", "sqlstate", "marker", ")", "always", "#", "5", "sqlstate", "(", "5", "characters", ")", "n", "message" ]
train
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/ErrorPacket.java#L29-L46
buschmais/jqa-maven-plugin
src/main/java/com/buschmais/jqassistant/scm/maven/provider/CachingStoreProvider.java
CachingStoreProvider.getStore
public Store getStore(StoreConfiguration storeConfiguration, List<Class<?>> types) { StoreKey key = StoreKey.builder().uri(storeConfiguration.getUri().normalize()).username(storeConfiguration.getUsername()).build(); Store store = storesByKey.get(key); if (store == null) { store = StoreFactory.getStore(storeConfiguration); store.start(types); storesByKey.put(key, store); keysByStore.put(store, key); } return store; }
java
public Store getStore(StoreConfiguration storeConfiguration, List<Class<?>> types) { StoreKey key = StoreKey.builder().uri(storeConfiguration.getUri().normalize()).username(storeConfiguration.getUsername()).build(); Store store = storesByKey.get(key); if (store == null) { store = StoreFactory.getStore(storeConfiguration); store.start(types); storesByKey.put(key, store); keysByStore.put(store, key); } return store; }
[ "public", "Store", "getStore", "(", "StoreConfiguration", "storeConfiguration", ",", "List", "<", "Class", "<", "?", ">", ">", "types", ")", "{", "StoreKey", "key", "=", "StoreKey", ".", "builder", "(", ")", ".", "uri", "(", "storeConfiguration", ".", "get...
Create/open store in the given directory. @param storeConfiguration The store configuration. @param types The types to register. @return The store.
[ "Create", "/", "open", "store", "in", "the", "given", "directory", "." ]
train
https://github.com/buschmais/jqa-maven-plugin/blob/5c21a8058fc1b013333081907fbf00d3525e11c3/src/main/java/com/buschmais/jqassistant/scm/maven/provider/CachingStoreProvider.java#L53-L63
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java
FileSystem.toJarURL
@Pure public static URL toJarURL(File jarFile, File insideFile) throws MalformedURLException { if (jarFile == null || insideFile == null) { return null; } return toJarURL(jarFile, fromFileStandardToURLStandard(insideFile)); }
java
@Pure public static URL toJarURL(File jarFile, File insideFile) throws MalformedURLException { if (jarFile == null || insideFile == null) { return null; } return toJarURL(jarFile, fromFileStandardToURLStandard(insideFile)); }
[ "@", "Pure", "public", "static", "URL", "toJarURL", "(", "File", "jarFile", ",", "File", "insideFile", ")", "throws", "MalformedURLException", "{", "if", "(", "jarFile", "==", "null", "||", "insideFile", "==", "null", ")", "{", "return", "null", ";", "}", ...
Replies the jar-schemed URL composed of the two given components. <p>If the inputs are {@code /path1/archive.jar} and @{code /path2/file}, the output of this function is {@code jar:file:/path1/archive.jar!/path2/file}. @param jarFile is the URL to the jar file. @param insideFile is the name of the file inside the jar. @return the jar-schemed URL. @throws MalformedURLException when the URL is malformed.
[ "Replies", "the", "jar", "-", "schemed", "URL", "composed", "of", "the", "two", "given", "components", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L298-L304
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/body/request/RequestMultipartBody.java
RequestMultipartBody.addInputStreamPart
public void addInputStreamPart(String name, String inputStreamName, InputStream inputStream, String contentTransferEncoding, String contentType) { stream.put(name, new NamedInputStream(inputStreamName, inputStream, contentTransferEncoding, contentType)); }
java
public void addInputStreamPart(String name, String inputStreamName, InputStream inputStream, String contentTransferEncoding, String contentType) { stream.put(name, new NamedInputStream(inputStreamName, inputStream, contentTransferEncoding, contentType)); }
[ "public", "void", "addInputStreamPart", "(", "String", "name", ",", "String", "inputStreamName", ",", "InputStream", "inputStream", ",", "String", "contentTransferEncoding", ",", "String", "contentType", ")", "{", "stream", ".", "put", "(", "name", ",", "new", "...
Adds an inputstream to te request @param name @param inputStreamName @param inputStream @param contentTransferEncoding usually binary @param contentType
[ "Adds", "an", "inputstream", "to", "te", "request" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/body/request/RequestMultipartBody.java#L154-L156
samskivert/samskivert
src/main/java/com/samskivert/util/SortableArrayList.java
SortableArrayList.binarySearch
public int binarySearch (T key, Comparator<? super T> comp) { return ArrayUtil.binarySearch(_elements, 0, _size, key, comp); }
java
public int binarySearch (T key, Comparator<? super T> comp) { return ArrayUtil.binarySearch(_elements, 0, _size, key, comp); }
[ "public", "int", "binarySearch", "(", "T", "key", ",", "Comparator", "<", "?", "super", "T", ">", "comp", ")", "{", "return", "ArrayUtil", ".", "binarySearch", "(", "_elements", ",", "0", ",", "_size", ",", "key", ",", "comp", ")", ";", "}" ]
Performs a binary search, attempting to locate the specified object. The array must be in the sort order defined by the supplied {@link Comparator} for this to operate correctly. @return the index of the object in question or <code>(-(<i>insertion point</i>) - 1)</code> (always a negative value) if the object was not found in the list.
[ "Performs", "a", "binary", "search", "attempting", "to", "locate", "the", "specified", "object", ".", "The", "array", "must", "be", "in", "the", "sort", "order", "defined", "by", "the", "supplied", "{", "@link", "Comparator", "}", "for", "this", "to", "ope...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/SortableArrayList.java#L67-L70
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.unescapeUriPathSegment
public static void unescapeUriPathSegment(final Reader reader, final Writer writer) throws IOException { unescapeUriPathSegment(reader, writer, DEFAULT_ENCODING); }
java
public static void unescapeUriPathSegment(final Reader reader, final Writer writer) throws IOException { unescapeUriPathSegment(reader, writer, DEFAULT_ENCODING); }
[ "public", "static", "void", "unescapeUriPathSegment", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "unescapeUriPathSegment", "(", "reader", ",", "writer", ",", "DEFAULT_ENCODING", ")", ";", "}" ]
<p> Perform am URI path segment <strong>unescape</strong> operation on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use <tt>UTF-8</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "path", "segment", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "using", "<tt", ">", "UTF", "-", "8<", "/", "tt", ">", "as", "encoding", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L2186-L2189
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/media/MediaClient.java
MediaClient.listTranscodingJobs
public ListTranscodingJobsResponse listTranscodingJobs(ListTranscodingJobsRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, TRANSCODE_JOB); internalRequest.addParameter("pipelineName", request.getPipelineName()); return invokeHttpClient(internalRequest, ListTranscodingJobsResponse.class); }
java
public ListTranscodingJobsResponse listTranscodingJobs(ListTranscodingJobsRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, TRANSCODE_JOB); internalRequest.addParameter("pipelineName", request.getPipelineName()); return invokeHttpClient(internalRequest, ListTranscodingJobsResponse.class); }
[ "public", "ListTranscodingJobsResponse", "listTranscodingJobs", "(", "ListTranscodingJobsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPipelineName",...
List all transcoder jobs on specified pipeline. @param request The request object containing all options for list jobs. @return The list of job IDs.
[ "List", "all", "transcoder", "jobs", "on", "specified", "pipeline", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L459-L466
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XAbstractNestedAttributeSupport.java
XAbstractNestedAttributeSupport.assignValues
public void assignValues(XAttributable element, Map<String, Type> values) { Map<List<String>, Type> nestedValues = new HashMap<List<String>, Type>(); for (String key : values.keySet()) { List<String> keys = new ArrayList<String>(); keys.add(key); nestedValues.put(keys, values.get(key)); } assignNestedValues(element, nestedValues); }
java
public void assignValues(XAttributable element, Map<String, Type> values) { Map<List<String>, Type> nestedValues = new HashMap<List<String>, Type>(); for (String key : values.keySet()) { List<String> keys = new ArrayList<String>(); keys.add(key); nestedValues.put(keys, values.get(key)); } assignNestedValues(element, nestedValues); }
[ "public", "void", "assignValues", "(", "XAttributable", "element", ",", "Map", "<", "String", ",", "Type", ">", "values", ")", "{", "Map", "<", "List", "<", "String", ">", ",", "Type", ">", "nestedValues", "=", "new", "HashMap", "<", "List", "<", "Stri...
Assigns (to the given element) multiple values given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key. For example, the call: <pre> assignValues(event, [[key.1 val.1] [key.2 val.2] [key.3 val.3]]) </pre> should result into the following XES fragment: <pre> {@code <event> <string key="key.1" value=""> <float key="ext:attr" value="val.1"/> </string> <string key="key.2" value=""> <float key="ext:attr" value="val.2"/> </string> <string key="key.3" value=""> <float key="ext:attr" value="val.3"/> </string> </event> } </pre> @param event Event to assign the values to. @param amounts Mapping from keys to values which are to be assigned.
[ "Assigns", "(", "to", "the", "given", "element", ")", "multiple", "values", "given", "their", "keys", ".", "Note", "that", "as", "a", "side", "effect", "this", "method", "creates", "attributes", "when", "it", "does", "not", "find", "an", "attribute", "with...
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XAbstractNestedAttributeSupport.java#L237-L245
SonarSource/sonarqube
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java
ProjectReactorBuilder.getListFromProperty
static String[] getListFromProperty(Map<String, String> properties, String key) { String propValue = properties.get(key); if (propValue != null) { return parseAsCsv(key, propValue); } return new String[0]; }
java
static String[] getListFromProperty(Map<String, String> properties, String key) { String propValue = properties.get(key); if (propValue != null) { return parseAsCsv(key, propValue); } return new String[0]; }
[ "static", "String", "[", "]", "getListFromProperty", "(", "Map", "<", "String", ",", "String", ">", "properties", ",", "String", "key", ")", "{", "String", "propValue", "=", "properties", ".", "get", "(", "key", ")", ";", "if", "(", "propValue", "!=", ...
Transforms a comma-separated list String property in to a array of trimmed strings. <p> This works even if they are separated by whitespace characters (space char, EOL, ...)
[ "Transforms", "a", "comma", "-", "separated", "list", "String", "property", "in", "to", "a", "array", "of", "trimmed", "strings", ".", "<p", ">", "This", "works", "even", "if", "they", "are", "separated", "by", "whitespace", "characters", "(", "space", "ch...
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java#L427-L433
mbrade/prefixedproperties
pp-core/src/main/java/net/sf/prefixedproperties/PrefixedProperties.java
PrefixedProperties.createCascadingPrefixProperties
public static PrefixedProperties createCascadingPrefixProperties(final String[] prefixes) { PrefixedProperties properties = null; for (final String aPrefix : prefixes) { if (properties == null) { properties = new PrefixedProperties(aPrefix); } else { properties = new PrefixedProperties(properties, aPrefix); } } return properties; }
java
public static PrefixedProperties createCascadingPrefixProperties(final String[] prefixes) { PrefixedProperties properties = null; for (final String aPrefix : prefixes) { if (properties == null) { properties = new PrefixedProperties(aPrefix); } else { properties = new PrefixedProperties(properties, aPrefix); } } return properties; }
[ "public", "static", "PrefixedProperties", "createCascadingPrefixProperties", "(", "final", "String", "[", "]", "prefixes", ")", "{", "PrefixedProperties", "properties", "=", "null", ";", "for", "(", "final", "String", "aPrefix", ":", "prefixes", ")", "{", "if", ...
Creates the cascading prefix properties by using the given Prefixes. @param prefixes the prefixes @return the prefixed properties
[ "Creates", "the", "cascading", "prefix", "properties", "by", "using", "the", "given", "Prefixes", "." ]
train
https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-core/src/main/java/net/sf/prefixedproperties/PrefixedProperties.java#L362-L372
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java
IPv6AddressSection.maskNetwork
public IPv6AddressSection maskNetwork(IPv6AddressSection mask, int networkPrefixLength) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException { checkMaskSectionCount(mask); if(getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets()) { return getSubnetSegments( this, cacheBits(networkPrefixLength), getAddressCreator(), true, this::getSegment, i -> mask.getSegment(i).getSegmentValue(), false); } IPv6AddressSection hostMask = getNetwork().getHostMaskSection(networkPrefixLength); return getSubnetSegments( this, cacheBits(networkPrefixLength), getAddressCreator(), true, this::getSegment, i -> { int val1 = mask.getSegment(i).getSegmentValue(); int val2 = hostMask.getSegment(i).getSegmentValue(); return val1 | val2; }, false ); }
java
public IPv6AddressSection maskNetwork(IPv6AddressSection mask, int networkPrefixLength) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException { checkMaskSectionCount(mask); if(getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets()) { return getSubnetSegments( this, cacheBits(networkPrefixLength), getAddressCreator(), true, this::getSegment, i -> mask.getSegment(i).getSegmentValue(), false); } IPv6AddressSection hostMask = getNetwork().getHostMaskSection(networkPrefixLength); return getSubnetSegments( this, cacheBits(networkPrefixLength), getAddressCreator(), true, this::getSegment, i -> { int val1 = mask.getSegment(i).getSegmentValue(); int val2 = hostMask.getSegment(i).getSegmentValue(); return val1 | val2; }, false ); }
[ "public", "IPv6AddressSection", "maskNetwork", "(", "IPv6AddressSection", "mask", ",", "int", "networkPrefixLength", ")", "throws", "IncompatibleAddressException", ",", "PrefixLenException", ",", "SizeMismatchException", "{", "checkMaskSectionCount", "(", "mask", ")", ";", ...
Applies the given mask to the network section of the address as indicated by the given prefix length. Useful for subnetting. Once you have zeroed a section of the network you can insert bits using {@link #bitwiseOr(IPv6AddressSection)} or {@link #replace(int, IPv6AddressSection)} @param mask @param networkPrefixLength @return @throws IncompatibleAddressException
[ "Applies", "the", "given", "mask", "to", "the", "network", "section", "of", "the", "address", "as", "indicated", "by", "the", "given", "prefix", "length", ".", "Useful", "for", "subnetting", ".", "Once", "you", "have", "zeroed", "a", "section", "of", "the"...
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1891-L1917
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addSizeGreaterThanCondition
protected void addSizeGreaterThanCondition(final String propertyName, final Integer size) { final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class)); fieldConditions.add(getCriteriaBuilder().gt(propertySizeExpression, size)); }
java
protected void addSizeGreaterThanCondition(final String propertyName, final Integer size) { final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class)); fieldConditions.add(getCriteriaBuilder().gt(propertySizeExpression, size)); }
[ "protected", "void", "addSizeGreaterThanCondition", "(", "final", "String", "propertyName", ",", "final", "Integer", "size", ")", "{", "final", "Expression", "<", "Integer", ">", "propertySizeExpression", "=", "getCriteriaBuilder", "(", ")", ".", "size", "(", "get...
Add a Field Search Condition that will check if the size of a collection in an entity is greater than the specified size. @param propertyName The name of the collection as defined in the Entity mapping class. @param size The size that the collection should be greater than.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "check", "if", "the", "size", "of", "a", "collection", "in", "an", "entity", "is", "greater", "than", "the", "specified", "size", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L258-L261
alipay/sofa-rpc
extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/transport/http/AbstractHttp2ClientTransport.java
AbstractHttp2ClientTransport.flatCopyTo
protected void flatCopyTo(String prefix, Map<String, Object> sourceMap, HttpHeaders headers) { for (Map.Entry<String, Object> entry : sourceMap.entrySet()) { String key = prefix + entry.getKey(); Object value = entry.getValue(); if (value instanceof String) { addToHeader(headers, key, (CharSequence) value); } else if (value instanceof Number) { addToHeader(headers, key, value.toString()); } else if (value instanceof Map) { flatCopyTo(key + ".", (Map<String, Object>) value, headers); } } }
java
protected void flatCopyTo(String prefix, Map<String, Object> sourceMap, HttpHeaders headers) { for (Map.Entry<String, Object> entry : sourceMap.entrySet()) { String key = prefix + entry.getKey(); Object value = entry.getValue(); if (value instanceof String) { addToHeader(headers, key, (CharSequence) value); } else if (value instanceof Number) { addToHeader(headers, key, value.toString()); } else if (value instanceof Map) { flatCopyTo(key + ".", (Map<String, Object>) value, headers); } } }
[ "protected", "void", "flatCopyTo", "(", "String", "prefix", ",", "Map", "<", "String", ",", "Object", ">", "sourceMap", ",", "HttpHeaders", "headers", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "sourceMap"...
扁平化复制 @param prefix 前缀 @param sourceMap 原始map @param headers 目标map
[ "扁平化复制" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/transport/http/AbstractHttp2ClientTransport.java#L434-L446
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.addInPlace
public static <E> void addInPlace(Counter<E> target, Counter<E> arg) { for (Map.Entry<E, Double> entry : arg.entrySet()) { double count = entry.getValue(); if (count != 0) { target.incrementCount(entry.getKey(), count); } } }
java
public static <E> void addInPlace(Counter<E> target, Counter<E> arg) { for (Map.Entry<E, Double> entry : arg.entrySet()) { double count = entry.getValue(); if (count != 0) { target.incrementCount(entry.getKey(), count); } } }
[ "public", "static", "<", "E", ">", "void", "addInPlace", "(", "Counter", "<", "E", ">", "target", ",", "Counter", "<", "E", ">", "arg", ")", "{", "for", "(", "Map", ".", "Entry", "<", "E", ",", "Double", ">", "entry", ":", "arg", ".", "entrySet",...
Sets each value of target to be target[k]+arg[k] for all keys k in arg.
[ "Sets", "each", "value", "of", "target", "to", "be", "target", "[", "k", "]", "+", "arg", "[", "k", "]", "for", "all", "keys", "k", "in", "arg", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L321-L328
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/client/LibertyServiceImpl.java
LibertyServiceImpl.configureCustomizeBinding
protected void configureCustomizeBinding(Client client, QName portName) { //put all properties defined in ibm-ws-bnd.xml into the client request context Map<String, Object> requestContext = client.getRequestContext(); if (null != requestContext && null != wsrInfo) { PortComponentRefInfo portRefInfo = wsrInfo.getPortComponentRefInfo(portName); Map<String, String> wsrProps = wsrInfo.getProperties(); Map<String, String> portProps = (null != portRefInfo) ? portRefInfo.getProperties() : null; if (null != wsrProps) { requestContext.putAll(wsrProps); } if (null != portProps) { requestContext.putAll(portProps); } if (null != wsrProps && Boolean.valueOf(wsrProps.get(JaxWsConstants.ENABLE_lOGGINGINOUTINTERCEPTOR))) { List<Interceptor<? extends Message>> inInterceptors = client.getInInterceptors(); inInterceptors.add(new LoggingInInterceptor()); List<Interceptor<? extends Message>> outInterceptors = client.getOutInterceptors(); outInterceptors.add(new LoggingOutInterceptor()); } } Set<ConfigProperties> configPropsSet = servicePropertiesMap.get(portName); client.getOutInterceptors().add(new LibertyCustomizeBindingOutInterceptor(wsrInfo, securityConfigService, configPropsSet)); //need to add an interceptor to clean up HTTPTransportActivator.sorted & props via calling HTTPTransportActivator. deleted(String) //Memory Leak fix for 130985 client.getOutInterceptors().add(new LibertyCustomizeBindingOutEndingInterceptor(wsrInfo)); }
java
protected void configureCustomizeBinding(Client client, QName portName) { //put all properties defined in ibm-ws-bnd.xml into the client request context Map<String, Object> requestContext = client.getRequestContext(); if (null != requestContext && null != wsrInfo) { PortComponentRefInfo portRefInfo = wsrInfo.getPortComponentRefInfo(portName); Map<String, String> wsrProps = wsrInfo.getProperties(); Map<String, String> portProps = (null != portRefInfo) ? portRefInfo.getProperties() : null; if (null != wsrProps) { requestContext.putAll(wsrProps); } if (null != portProps) { requestContext.putAll(portProps); } if (null != wsrProps && Boolean.valueOf(wsrProps.get(JaxWsConstants.ENABLE_lOGGINGINOUTINTERCEPTOR))) { List<Interceptor<? extends Message>> inInterceptors = client.getInInterceptors(); inInterceptors.add(new LoggingInInterceptor()); List<Interceptor<? extends Message>> outInterceptors = client.getOutInterceptors(); outInterceptors.add(new LoggingOutInterceptor()); } } Set<ConfigProperties> configPropsSet = servicePropertiesMap.get(portName); client.getOutInterceptors().add(new LibertyCustomizeBindingOutInterceptor(wsrInfo, securityConfigService, configPropsSet)); //need to add an interceptor to clean up HTTPTransportActivator.sorted & props via calling HTTPTransportActivator. deleted(String) //Memory Leak fix for 130985 client.getOutInterceptors().add(new LibertyCustomizeBindingOutEndingInterceptor(wsrInfo)); }
[ "protected", "void", "configureCustomizeBinding", "(", "Client", "client", ",", "QName", "portName", ")", "{", "//put all properties defined in ibm-ws-bnd.xml into the client request context", "Map", "<", "String", ",", "Object", ">", "requestContext", "=", "client", ".", ...
Add the LibertyCustomizeBindingOutInterceptor in the out interceptor chain. @param client @param portName
[ "Add", "the", "LibertyCustomizeBindingOutInterceptor", "in", "the", "out", "interceptor", "chain", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/client/LibertyServiceImpl.java#L134-L165
rhuss/jolokia
agent/osgi/src/main/java/org/jolokia/osgi/security/DelegatingRestrictor.java
DelegatingRestrictor.checkRestrictorService
private boolean checkRestrictorService(RestrictorCheck pCheck, Object ... args) { try { ServiceReference[] serviceRefs = bundleContext.getServiceReferences(Restrictor.class.getName(),null); if (serviceRefs != null) { boolean ret = true; boolean found = false; for (ServiceReference serviceRef : serviceRefs) { Restrictor restrictor = (Restrictor) bundleContext.getService(serviceRef); if (restrictor != null) { ret = ret && pCheck.check(restrictor,args); found = true; } } return found && ret; } else { return false; } } catch (InvalidSyntaxException e) { // Will not happen, since we dont use a filter here throw new IllegalArgumentException("Impossible exception (we don't use a filter for fetching the services)",e); } }
java
private boolean checkRestrictorService(RestrictorCheck pCheck, Object ... args) { try { ServiceReference[] serviceRefs = bundleContext.getServiceReferences(Restrictor.class.getName(),null); if (serviceRefs != null) { boolean ret = true; boolean found = false; for (ServiceReference serviceRef : serviceRefs) { Restrictor restrictor = (Restrictor) bundleContext.getService(serviceRef); if (restrictor != null) { ret = ret && pCheck.check(restrictor,args); found = true; } } return found && ret; } else { return false; } } catch (InvalidSyntaxException e) { // Will not happen, since we dont use a filter here throw new IllegalArgumentException("Impossible exception (we don't use a filter for fetching the services)",e); } }
[ "private", "boolean", "checkRestrictorService", "(", "RestrictorCheck", "pCheck", ",", "Object", "...", "args", ")", "{", "try", "{", "ServiceReference", "[", "]", "serviceRefs", "=", "bundleContext", ".", "getServiceReferences", "(", "Restrictor", ".", "class", "...
Actual check which delegate to one or more restrictor services if available. @param pCheck a function object for performing the actual check @param args arguments passed through to the check @return true if all checks return true
[ "Actual", "check", "which", "delegate", "to", "one", "or", "more", "restrictor", "services", "if", "available", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/osgi/src/main/java/org/jolokia/osgi/security/DelegatingRestrictor.java#L52-L73
apache/reef
lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexFuture.java
VortexFuture.threwException
@Private @Override public void threwException(final int pTaskletId, final Exception exception) { assert taskletId == pTaskletId; this.userException = exception; if (callbackHandler != null) { executor.execute(new Runnable() { @Override public void run() { callbackHandler.onFailure(exception); } }); } this.countDownLatch.countDown(); }
java
@Private @Override public void threwException(final int pTaskletId, final Exception exception) { assert taskletId == pTaskletId; this.userException = exception; if (callbackHandler != null) { executor.execute(new Runnable() { @Override public void run() { callbackHandler.onFailure(exception); } }); } this.countDownLatch.countDown(); }
[ "@", "Private", "@", "Override", "public", "void", "threwException", "(", "final", "int", "pTaskletId", ",", "final", "Exception", "exception", ")", "{", "assert", "taskletId", "==", "pTaskletId", ";", "this", ".", "userException", "=", "exception", ";", "if",...
Called by VortexMaster to let the user know that the Tasklet threw an exception.
[ "Called", "by", "VortexMaster", "to", "let", "the", "user", "know", "that", "the", "Tasklet", "threw", "an", "exception", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexFuture.java#L210-L225
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java
InternalTextureLoader.getTexture
public Texture getTexture(String resourceName, boolean flipped, int filter) throws IOException { InputStream in = ResourceLoader.getResourceAsStream(resourceName); return getTexture(in, resourceName, flipped, filter, null); }
java
public Texture getTexture(String resourceName, boolean flipped, int filter) throws IOException { InputStream in = ResourceLoader.getResourceAsStream(resourceName); return getTexture(in, resourceName, flipped, filter, null); }
[ "public", "Texture", "getTexture", "(", "String", "resourceName", ",", "boolean", "flipped", ",", "int", "filter", ")", "throws", "IOException", "{", "InputStream", "in", "=", "ResourceLoader", ".", "getResourceAsStream", "(", "resourceName", ")", ";", "return", ...
Get a texture from a resource location @param resourceName The location to load the texture from @param flipped True if we should flip the texture on the y axis while loading @param filter The filter to use when scaling the texture @return The texture loaded @throws IOException Indicates a failure to load the image
[ "Get", "a", "texture", "from", "a", "resource", "location" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java#L168-L172
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java
MoveOnEventHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if (((iChangeType == DBConstants.SELECT_TYPE) && (m_bMoveOnSelect)) || ((iChangeType == DBConstants.AFTER_ADD_TYPE) && (m_bMoveOnAdd)) || ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) && (m_bMoveOnUpdate))) this.moveTheData(bDisplayOption, DBConstants.SCREEN_MOVE); // Do trigger a record change. return iErrorCode; }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if (((iChangeType == DBConstants.SELECT_TYPE) && (m_bMoveOnSelect)) || ((iChangeType == DBConstants.AFTER_ADD_TYPE) && (m_bMoveOnAdd)) || ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) && (m_bMoveOnUpdate))) this.moveTheData(bDisplayOption, DBConstants.SCREEN_MOVE); // Do trigger a record change. return iErrorCode; }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "// Read a valid record", "int", "iErrorCode", "=", "super", ".", "doRecordChange", "(", "field", ",", "iChangeType", ",", "bDispla...
Called when a change is the record status is about to happen/has happened. If this file is selected (opened) move the field. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", ".", "If", "this", "file", "is", "selected", "(", "opened", ")", "move", "the", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java#L185-L195
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.parse
void parse( URL baseURL, Reader input, ReaderFactory readerFactory ) throws MalformedURLException, LessException { this.baseURL = baseURL; this.readerFactory = readerFactory; this.relativeURL = new URL( "file", null, "" ); this.reader = new LessLookAheadReader( input, null, false, false ); parse( this ); }
java
void parse( URL baseURL, Reader input, ReaderFactory readerFactory ) throws MalformedURLException, LessException { this.baseURL = baseURL; this.readerFactory = readerFactory; this.relativeURL = new URL( "file", null, "" ); this.reader = new LessLookAheadReader( input, null, false, false ); parse( this ); }
[ "void", "parse", "(", "URL", "baseURL", ",", "Reader", "input", ",", "ReaderFactory", "readerFactory", ")", "throws", "MalformedURLException", ",", "LessException", "{", "this", ".", "baseURL", "=", "baseURL", ";", "this", ".", "readerFactory", "=", "readerFacto...
Main method for parsing of main less file. @param baseURL the baseURL for import of external less data. @param input the less input data @param readerFactory A factory for the readers for imports. @throws MalformedURLException Should never occur @throws LessException if any parsing error occurred
[ "Main", "method", "for", "parsing", "of", "main", "less", "file", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L117-L123
Stratio/bdt
src/main/java/com/stratio/qa/specs/SeleniumSpec.java
SeleniumSpec.assertSeleniumTextOnElementPresent
@Then("^the element on index '(\\d+?)' has '(.+?)' as text$") public void assertSeleniumTextOnElementPresent(Integer index, String text) { assertThat(commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); String elementText = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getText().replace("\n", " ").replace("\r", " "); if (!elementText.startsWith("regex:")) { //We are verifying that a web element contains a string assertThat(elementText.matches("(.*)" + text + "(.*)")).isTrue(); } else { //We are verifying that a web element contains a regex assertThat(elementText.matches(text.substring(text.indexOf("regex:") + 6, text.length()))).isTrue(); } }
java
@Then("^the element on index '(\\d+?)' has '(.+?)' as text$") public void assertSeleniumTextOnElementPresent(Integer index, String text) { assertThat(commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); String elementText = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getText().replace("\n", " ").replace("\r", " "); if (!elementText.startsWith("regex:")) { //We are verifying that a web element contains a string assertThat(elementText.matches("(.*)" + text + "(.*)")).isTrue(); } else { //We are verifying that a web element contains a regex assertThat(elementText.matches(text.substring(text.indexOf("regex:") + 6, text.length()))).isTrue(); } }
[ "@", "Then", "(", "\"^the element on index '(\\\\d+?)' has '(.+?)' as text$\"", ")", "public", "void", "assertSeleniumTextOnElementPresent", "(", "Integer", "index", ",", "String", "text", ")", "{", "assertThat", "(", "commonspec", ".", "getPreviousWebElements", "(", ")",...
Verifies that a webelement previously found has {@code text} as text @param index @param text
[ "Verifies", "that", "a", "webelement", "previously", "found", "has", "{", "@code", "text", "}", "as", "text" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L399-L411
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java
base_resource.stat_resource
protected base_resource stat_resource(nitro_service service,options option) throws Exception { if (!service.isLogin()) service.login(); base_resource[] response = stat_request(service, option); if (response != null && response.length > 0) { return response[0]; } return null; }
java
protected base_resource stat_resource(nitro_service service,options option) throws Exception { if (!service.isLogin()) service.login(); base_resource[] response = stat_request(service, option); if (response != null && response.length > 0) { return response[0]; } return null; }
[ "protected", "base_resource", "stat_resource", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "if", "(", "!", "service", ".", "isLogin", "(", ")", ")", "service", ".", "login", "(", ")", ";", "base_resource", "[",...
Use this method to perform a stat operation on a netscaler resource. @param service nitro_service object. @param option options class object. @return Requested Nitro stat resource. @throws Exception Nitro exception is thrown.
[ "Use", "this", "method", "to", "perform", "a", "stat", "operation", "on", "a", "netscaler", "resource", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L323-L334
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
DocBookBuildUtilities.convertDocumentToFormattedString
public static String convertDocumentToFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) { return convertDocumentToFormattedString(doc, xmlFormatProperties, true); }
java
public static String convertDocumentToFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) { return convertDocumentToFormattedString(doc, xmlFormatProperties, true); }
[ "public", "static", "String", "convertDocumentToFormattedString", "(", "final", "Document", "doc", ",", "final", "XMLFormatProperties", "xmlFormatProperties", ")", "{", "return", "convertDocumentToFormattedString", "(", "doc", ",", "xmlFormatProperties", ",", "true", ")",...
Convert a DOM Document to a Formatted String representation. @param doc The DOM Document to be converted and formatted. @param xmlFormatProperties The XML Formatting Properties. @return The converted XML String representation.
[ "Convert", "a", "DOM", "Document", "to", "a", "Formatted", "String", "representation", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L485-L487