repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/CreateApplicationRequest.java
CreateApplicationRequest.withTags
public CreateApplicationRequest withTags(java.util.Map<String, String> tags) { """ The Tags for the app. @param tags The Tags for the app. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreateApplicationRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateApplicationRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
The Tags for the app. @param tags The Tags for the app. @return Returns a reference to this object so that method calls can be chained together.
[ "The", "Tags", "for", "the", "app", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/CreateApplicationRequest.java#L97-L100
paypal/SeLion
server/src/main/java/com/paypal/selion/utils/AuthenticationHelper.java
AuthenticationHelper.authenticate
public static boolean authenticate(String userName, String userPassword) { """ Tries authenticating a given credentials and returns <code>true</code> if the credentials were valid. @param userName @param userPassword @return - <code>true</code> if the credentials were valid. """ LOGGER.entering(userName, StringUtils.isBlank(userPassword) ? userPassword : userPassword.replaceAll(".", "*")); boolean validLogin = false; byte[] currentAuthData; byte[] hashedInputData; if (StringUtils.isBlank(userName) || StringUtils.isBlank(userPassword)) { return validLogin; } try { File authFile = new File(AUTH_FILE_LOCATION); if (!authFile.exists()) { authFile.createNewFile(); createAuthFile(authFile, DEFAULT_USERNAME, DEFAULT_PASSWORD); } currentAuthData = getBytesFromFile(authFile); hashedInputData = hashData(userName, userPassword); validLogin = Arrays.equals(currentAuthData, hashedInputData); } catch (Exception e) { validLogin = false; } LOGGER.exiting(validLogin); return validLogin; }
java
public static boolean authenticate(String userName, String userPassword) { LOGGER.entering(userName, StringUtils.isBlank(userPassword) ? userPassword : userPassword.replaceAll(".", "*")); boolean validLogin = false; byte[] currentAuthData; byte[] hashedInputData; if (StringUtils.isBlank(userName) || StringUtils.isBlank(userPassword)) { return validLogin; } try { File authFile = new File(AUTH_FILE_LOCATION); if (!authFile.exists()) { authFile.createNewFile(); createAuthFile(authFile, DEFAULT_USERNAME, DEFAULT_PASSWORD); } currentAuthData = getBytesFromFile(authFile); hashedInputData = hashData(userName, userPassword); validLogin = Arrays.equals(currentAuthData, hashedInputData); } catch (Exception e) { validLogin = false; } LOGGER.exiting(validLogin); return validLogin; }
[ "public", "static", "boolean", "authenticate", "(", "String", "userName", ",", "String", "userPassword", ")", "{", "LOGGER", ".", "entering", "(", "userName", ",", "StringUtils", ".", "isBlank", "(", "userPassword", ")", "?", "userPassword", ":", "userPassword", ".", "replaceAll", "(", "\".\"", ",", "\"*\"", ")", ")", ";", "boolean", "validLogin", "=", "false", ";", "byte", "[", "]", "currentAuthData", ";", "byte", "[", "]", "hashedInputData", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "userName", ")", "||", "StringUtils", ".", "isBlank", "(", "userPassword", ")", ")", "{", "return", "validLogin", ";", "}", "try", "{", "File", "authFile", "=", "new", "File", "(", "AUTH_FILE_LOCATION", ")", ";", "if", "(", "!", "authFile", ".", "exists", "(", ")", ")", "{", "authFile", ".", "createNewFile", "(", ")", ";", "createAuthFile", "(", "authFile", ",", "DEFAULT_USERNAME", ",", "DEFAULT_PASSWORD", ")", ";", "}", "currentAuthData", "=", "getBytesFromFile", "(", "authFile", ")", ";", "hashedInputData", "=", "hashData", "(", "userName", ",", "userPassword", ")", ";", "validLogin", "=", "Arrays", ".", "equals", "(", "currentAuthData", ",", "hashedInputData", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "validLogin", "=", "false", ";", "}", "LOGGER", ".", "exiting", "(", "validLogin", ")", ";", "return", "validLogin", ";", "}" ]
Tries authenticating a given credentials and returns <code>true</code> if the credentials were valid. @param userName @param userPassword @return - <code>true</code> if the credentials were valid.
[ "Tries", "authenticating", "a", "given", "credentials", "and", "returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "credentials", "were", "valid", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/utils/AuthenticationHelper.java#L68-L90
crawljax/crawljax
core/src/main/java/com/crawljax/browser/WebDriverBackedEmbeddedBrowser.java
WebDriverBackedEmbeddedBrowser.fireEventWait
private boolean fireEventWait(WebElement webElement, Eventable eventable) throws ElementNotVisibleException, InterruptedException { """ Fires the event and waits for a specified time. @param webElement the element to fire event on. @param eventable The HTML event type (onclick, onmouseover, ...). @return true if firing event is successful. @throws InterruptedException when interrupted during the wait. """ switch (eventable.getEventType()) { case click: try { webElement.click(); } catch (ElementNotVisibleException e) { throw e; } catch (WebDriverException e) { throwIfConnectionException(e); return false; } break; case hover: LOGGER.info("EventType hover called but this isn't implemented yet"); break; default: LOGGER.info("EventType {} not supported in WebDriver.", eventable.getEventType()); return false; } Thread.sleep(this.crawlWaitEvent); return true; }
java
private boolean fireEventWait(WebElement webElement, Eventable eventable) throws ElementNotVisibleException, InterruptedException { switch (eventable.getEventType()) { case click: try { webElement.click(); } catch (ElementNotVisibleException e) { throw e; } catch (WebDriverException e) { throwIfConnectionException(e); return false; } break; case hover: LOGGER.info("EventType hover called but this isn't implemented yet"); break; default: LOGGER.info("EventType {} not supported in WebDriver.", eventable.getEventType()); return false; } Thread.sleep(this.crawlWaitEvent); return true; }
[ "private", "boolean", "fireEventWait", "(", "WebElement", "webElement", ",", "Eventable", "eventable", ")", "throws", "ElementNotVisibleException", ",", "InterruptedException", "{", "switch", "(", "eventable", ".", "getEventType", "(", ")", ")", "{", "case", "click", ":", "try", "{", "webElement", ".", "click", "(", ")", ";", "}", "catch", "(", "ElementNotVisibleException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "WebDriverException", "e", ")", "{", "throwIfConnectionException", "(", "e", ")", ";", "return", "false", ";", "}", "break", ";", "case", "hover", ":", "LOGGER", ".", "info", "(", "\"EventType hover called but this isn't implemented yet\"", ")", ";", "break", ";", "default", ":", "LOGGER", ".", "info", "(", "\"EventType {} not supported in WebDriver.\"", ",", "eventable", ".", "getEventType", "(", ")", ")", ";", "return", "false", ";", "}", "Thread", ".", "sleep", "(", "this", ".", "crawlWaitEvent", ")", ";", "return", "true", ";", "}" ]
Fires the event and waits for a specified time. @param webElement the element to fire event on. @param eventable The HTML event type (onclick, onmouseover, ...). @return true if firing event is successful. @throws InterruptedException when interrupted during the wait.
[ "Fires", "the", "event", "and", "waits", "for", "a", "specified", "time", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/browser/WebDriverBackedEmbeddedBrowser.java#L288-L311
payneteasy/superfly
superfly-service/src/main/java/com/payneteasy/superfly/utils/PGPKeyValidator.java
PGPKeyValidator.validatePublicKey
public static void validatePublicKey(String value, PublicKeyCrypto crypto) throws BadPublicKeyException { """ Validates a PGP public key. @param value value to validate @param crypto crypto implementation to carry out additional checks @throws BadPublicKeyException thrown if validation fails; getMessage() contains error code """ if (org.springframework.util.StringUtils.hasText(value)) { int open = value.indexOf("-----BEGIN PGP PUBLIC KEY BLOCK-----"); int close = value.indexOf("-----END PGP PUBLIC KEY BLOCK-----"); if (open < 0) { throw new BadPublicKeyException("PublicKeyValidator.noBeginBlock"); } if (close < 0) { throw new BadPublicKeyException("PublicKeyValidator.noEndBlock"); } if (open >= 0 && close >= 0 &&open >= close) { throw new BadPublicKeyException("PublicKeyValidator.wrongBlockOrder"); } if (!crypto.isPublicKeyValid(value)) { throw new BadPublicKeyException("PublicKeyValidator.invalidKey"); } } }
java
public static void validatePublicKey(String value, PublicKeyCrypto crypto) throws BadPublicKeyException { if (org.springframework.util.StringUtils.hasText(value)) { int open = value.indexOf("-----BEGIN PGP PUBLIC KEY BLOCK-----"); int close = value.indexOf("-----END PGP PUBLIC KEY BLOCK-----"); if (open < 0) { throw new BadPublicKeyException("PublicKeyValidator.noBeginBlock"); } if (close < 0) { throw new BadPublicKeyException("PublicKeyValidator.noEndBlock"); } if (open >= 0 && close >= 0 &&open >= close) { throw new BadPublicKeyException("PublicKeyValidator.wrongBlockOrder"); } if (!crypto.isPublicKeyValid(value)) { throw new BadPublicKeyException("PublicKeyValidator.invalidKey"); } } }
[ "public", "static", "void", "validatePublicKey", "(", "String", "value", ",", "PublicKeyCrypto", "crypto", ")", "throws", "BadPublicKeyException", "{", "if", "(", "org", ".", "springframework", ".", "util", ".", "StringUtils", ".", "hasText", "(", "value", ")", ")", "{", "int", "open", "=", "value", ".", "indexOf", "(", "\"-----BEGIN PGP PUBLIC KEY BLOCK-----\"", ")", ";", "int", "close", "=", "value", ".", "indexOf", "(", "\"-----END PGP PUBLIC KEY BLOCK-----\"", ")", ";", "if", "(", "open", "<", "0", ")", "{", "throw", "new", "BadPublicKeyException", "(", "\"PublicKeyValidator.noBeginBlock\"", ")", ";", "}", "if", "(", "close", "<", "0", ")", "{", "throw", "new", "BadPublicKeyException", "(", "\"PublicKeyValidator.noEndBlock\"", ")", ";", "}", "if", "(", "open", ">=", "0", "&&", "close", ">=", "0", "&&", "open", ">=", "close", ")", "{", "throw", "new", "BadPublicKeyException", "(", "\"PublicKeyValidator.wrongBlockOrder\"", ")", ";", "}", "if", "(", "!", "crypto", ".", "isPublicKeyValid", "(", "value", ")", ")", "{", "throw", "new", "BadPublicKeyException", "(", "\"PublicKeyValidator.invalidKey\"", ")", ";", "}", "}", "}" ]
Validates a PGP public key. @param value value to validate @param crypto crypto implementation to carry out additional checks @throws BadPublicKeyException thrown if validation fails; getMessage() contains error code
[ "Validates", "a", "PGP", "public", "key", "." ]
train
https://github.com/payneteasy/superfly/blob/4cad6d0f8e951a61f3c302c49b13a51d179076f8/superfly-service/src/main/java/com/payneteasy/superfly/utils/PGPKeyValidator.java#L20-L38
HeidelTime/heideltime
src/de/unihd/dbs/uima/annotator/treetagger/TreeTaggerProperties.java
TreeTaggerProperties.getTokenizationProcess
@Deprecated public Process getTokenizationProcess(File inputFile) throws IOException { """ This method creates a process with some parameters for the tokenizer script. Deprecated: We use TreeTaggerTokenizer in the same package nowadays which implements the utf8-tokenize.perl script from the TreeTagger package. This fixes some issues with Perl's Unicode handling. @param inputFile @return @throws IOException """ // assemble a command line for the tokenization script and execute it ArrayList<String> command = new ArrayList<String>(); command.add("perl"); if(this.utf8Switch != "") command.add(this.utf8Switch); command.add(this.rootPath + this.fileSeparator + "cmd" + this.fileSeparator + this.tokScriptName); if(this.languageSwitch != "") command.add(this.languageSwitch); if(new File(this.rootPath + this.fileSeparator + "lib" + this.fileSeparator, this.abbFileName).exists()) { command.add("-a"); command.add(this.rootPath + this.fileSeparator + "lib" + this.fileSeparator + this.abbFileName); } command.add(inputFile.getAbsolutePath()); String[] commandStr = new String[command.size()]; command.toArray(commandStr); Process p = Runtime.getRuntime().exec(commandStr); return p; }
java
@Deprecated public Process getTokenizationProcess(File inputFile) throws IOException { // assemble a command line for the tokenization script and execute it ArrayList<String> command = new ArrayList<String>(); command.add("perl"); if(this.utf8Switch != "") command.add(this.utf8Switch); command.add(this.rootPath + this.fileSeparator + "cmd" + this.fileSeparator + this.tokScriptName); if(this.languageSwitch != "") command.add(this.languageSwitch); if(new File(this.rootPath + this.fileSeparator + "lib" + this.fileSeparator, this.abbFileName).exists()) { command.add("-a"); command.add(this.rootPath + this.fileSeparator + "lib" + this.fileSeparator + this.abbFileName); } command.add(inputFile.getAbsolutePath()); String[] commandStr = new String[command.size()]; command.toArray(commandStr); Process p = Runtime.getRuntime().exec(commandStr); return p; }
[ "@", "Deprecated", "public", "Process", "getTokenizationProcess", "(", "File", "inputFile", ")", "throws", "IOException", "{", "// assemble a command line for the tokenization script and execute it", "ArrayList", "<", "String", ">", "command", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "command", ".", "add", "(", "\"perl\"", ")", ";", "if", "(", "this", ".", "utf8Switch", "!=", "\"\"", ")", "command", ".", "add", "(", "this", ".", "utf8Switch", ")", ";", "command", ".", "add", "(", "this", ".", "rootPath", "+", "this", ".", "fileSeparator", "+", "\"cmd\"", "+", "this", ".", "fileSeparator", "+", "this", ".", "tokScriptName", ")", ";", "if", "(", "this", ".", "languageSwitch", "!=", "\"\"", ")", "command", ".", "add", "(", "this", ".", "languageSwitch", ")", ";", "if", "(", "new", "File", "(", "this", ".", "rootPath", "+", "this", ".", "fileSeparator", "+", "\"lib\"", "+", "this", ".", "fileSeparator", ",", "this", ".", "abbFileName", ")", ".", "exists", "(", ")", ")", "{", "command", ".", "add", "(", "\"-a\"", ")", ";", "command", ".", "add", "(", "this", ".", "rootPath", "+", "this", ".", "fileSeparator", "+", "\"lib\"", "+", "this", ".", "fileSeparator", "+", "this", ".", "abbFileName", ")", ";", "}", "command", ".", "add", "(", "inputFile", ".", "getAbsolutePath", "(", ")", ")", ";", "String", "[", "]", "commandStr", "=", "new", "String", "[", "command", ".", "size", "(", ")", "]", ";", "command", ".", "toArray", "(", "commandStr", ")", ";", "Process", "p", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "commandStr", ")", ";", "return", "p", ";", "}" ]
This method creates a process with some parameters for the tokenizer script. Deprecated: We use TreeTaggerTokenizer in the same package nowadays which implements the utf8-tokenize.perl script from the TreeTagger package. This fixes some issues with Perl's Unicode handling. @param inputFile @return @throws IOException
[ "This", "method", "creates", "a", "process", "with", "some", "parameters", "for", "the", "tokenizer", "script", "." ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/treetagger/TreeTaggerProperties.java#L59-L80
line/armeria
saml/src/main/java/com/linecorp/armeria/server/saml/SamlEndpoint.java
SamlEndpoint.ofHttpPost
public static SamlEndpoint ofHttpPost(URI uri) { """ Creates a {@link SamlEndpoint} of the specified {@code uri} and the HTTP POST binding protocol. """ requireNonNull(uri, "uri"); return new SamlEndpoint(uri, SamlBindingProtocol.HTTP_POST); }
java
public static SamlEndpoint ofHttpPost(URI uri) { requireNonNull(uri, "uri"); return new SamlEndpoint(uri, SamlBindingProtocol.HTTP_POST); }
[ "public", "static", "SamlEndpoint", "ofHttpPost", "(", "URI", "uri", ")", "{", "requireNonNull", "(", "uri", ",", "\"uri\"", ")", ";", "return", "new", "SamlEndpoint", "(", "uri", ",", "SamlBindingProtocol", ".", "HTTP_POST", ")", ";", "}" ]
Creates a {@link SamlEndpoint} of the specified {@code uri} and the HTTP POST binding protocol.
[ "Creates", "a", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/saml/src/main/java/com/linecorp/armeria/server/saml/SamlEndpoint.java#L68-L71
finmath/finmath-lib
src/main/java6/net/finmath/marketdata/model/curves/DiscountCurve.java
DiscountCurve.createDiscountFactorsFromForwardRates
public static DiscountCurveInterface createDiscountFactorsFromForwardRates(String name, TimeDiscretizationInterface tenor, double[] forwardRates) { """ Create a discount curve from given time discretization and forward rates. This function is provided for "single interest rate curve" frameworks. @param name The name of this discount curve. @param tenor Time discretization for the forward rates @param forwardRates Array of forward rates. @return A new discount factor object. """ DiscountCurve discountFactors = new DiscountCurve(name); double df = 1.0; for(int timeIndex=0; timeIndex<tenor.getNumberOfTimeSteps();timeIndex++) { df /= 1.0 + forwardRates[timeIndex] * tenor.getTimeStep(timeIndex); discountFactors.addDiscountFactor(tenor.getTime(timeIndex+1), df, tenor.getTime(timeIndex+1) > 0); } return discountFactors; }
java
public static DiscountCurveInterface createDiscountFactorsFromForwardRates(String name, TimeDiscretizationInterface tenor, double[] forwardRates) { DiscountCurve discountFactors = new DiscountCurve(name); double df = 1.0; for(int timeIndex=0; timeIndex<tenor.getNumberOfTimeSteps();timeIndex++) { df /= 1.0 + forwardRates[timeIndex] * tenor.getTimeStep(timeIndex); discountFactors.addDiscountFactor(tenor.getTime(timeIndex+1), df, tenor.getTime(timeIndex+1) > 0); } return discountFactors; }
[ "public", "static", "DiscountCurveInterface", "createDiscountFactorsFromForwardRates", "(", "String", "name", ",", "TimeDiscretizationInterface", "tenor", ",", "double", "[", "]", "forwardRates", ")", "{", "DiscountCurve", "discountFactors", "=", "new", "DiscountCurve", "(", "name", ")", ";", "double", "df", "=", "1.0", ";", "for", "(", "int", "timeIndex", "=", "0", ";", "timeIndex", "<", "tenor", ".", "getNumberOfTimeSteps", "(", ")", ";", "timeIndex", "++", ")", "{", "df", "/=", "1.0", "+", "forwardRates", "[", "timeIndex", "]", "*", "tenor", ".", "getTimeStep", "(", "timeIndex", ")", ";", "discountFactors", ".", "addDiscountFactor", "(", "tenor", ".", "getTime", "(", "timeIndex", "+", "1", ")", ",", "df", ",", "tenor", ".", "getTime", "(", "timeIndex", "+", "1", ")", ">", "0", ")", ";", "}", "return", "discountFactors", ";", "}" ]
Create a discount curve from given time discretization and forward rates. This function is provided for "single interest rate curve" frameworks. @param name The name of this discount curve. @param tenor Time discretization for the forward rates @param forwardRates Array of forward rates. @return A new discount factor object.
[ "Create", "a", "discount", "curve", "from", "given", "time", "discretization", "and", "forward", "rates", ".", "This", "function", "is", "provided", "for", "single", "interest", "rate", "curve", "frameworks", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/DiscountCurve.java#L377-L387
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.getUntaggedImagesAsync
public Observable<List<Image>> getUntaggedImagesAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { """ 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 @return the observable to the List&lt;Image&gt; object """ return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).map(new Func1<ServiceResponse<List<Image>>, List<Image>>() { @Override public List<Image> call(ServiceResponse<List<Image>> response) { return response.body(); } }); }
java
public Observable<List<Image>> getUntaggedImagesAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).map(new Func1<ServiceResponse<List<Image>>, List<Image>>() { @Override public List<Image> call(ServiceResponse<List<Image>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "Image", ">", ">", "getUntaggedImagesAsync", "(", "UUID", "projectId", ",", "GetUntaggedImagesOptionalParameter", "getUntaggedImagesOptionalParameter", ")", "{", "return", "getUntaggedImagesWithServiceResponseAsync", "(", "projectId", ",", "getUntaggedImagesOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "Image", ">", ">", ",", "List", "<", "Image", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "Image", ">", "call", "(", "ServiceResponse", "<", "List", "<", "Image", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
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 @return the observable to the List&lt;Image&gt; object
[ "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", "." ]
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#L4814-L4821
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/BrightnessContrastFilter.java
BrightnessContrastFilter.filterRGB
public int filterRGB(int pX, int pY, int pARGB) { """ Filters one pixel, adjusting brightness and contrast according to this filter. @param pX x @param pY y @param pARGB pixel value in default color space @return the filtered pixel value in the default color space """ // Get color components int r = pARGB >> 16 & 0xFF; int g = pARGB >> 8 & 0xFF; int b = pARGB & 0xFF; // Scale to new contrast r = LUT[r]; g = LUT[g]; b = LUT[b]; // Return ARGB pixel, leave transparency as is return (pARGB & 0xFF000000) | (r << 16) | (g << 8) | b; }
java
public int filterRGB(int pX, int pY, int pARGB) { // Get color components int r = pARGB >> 16 & 0xFF; int g = pARGB >> 8 & 0xFF; int b = pARGB & 0xFF; // Scale to new contrast r = LUT[r]; g = LUT[g]; b = LUT[b]; // Return ARGB pixel, leave transparency as is return (pARGB & 0xFF000000) | (r << 16) | (g << 8) | b; }
[ "public", "int", "filterRGB", "(", "int", "pX", ",", "int", "pY", ",", "int", "pARGB", ")", "{", "// Get color components\r", "int", "r", "=", "pARGB", ">>", "16", "&", "0xFF", ";", "int", "g", "=", "pARGB", ">>", "8", "&", "0xFF", ";", "int", "b", "=", "pARGB", "&", "0xFF", ";", "// Scale to new contrast\r", "r", "=", "LUT", "[", "r", "]", ";", "g", "=", "LUT", "[", "g", "]", ";", "b", "=", "LUT", "[", "b", "]", ";", "// Return ARGB pixel, leave transparency as is\r", "return", "(", "pARGB", "&", "0xFF000000", ")", "|", "(", "r", "<<", "16", ")", "|", "(", "g", "<<", "8", ")", "|", "b", ";", "}" ]
Filters one pixel, adjusting brightness and contrast according to this filter. @param pX x @param pY y @param pARGB pixel value in default color space @return the filtered pixel value in the default color space
[ "Filters", "one", "pixel", "adjusting", "brightness", "and", "contrast", "according", "to", "this", "filter", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/BrightnessContrastFilter.java#L156-L169
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.generatePublicKey
public static PublicKey generatePublicKey(String algorithm, byte[] key) { """ 生成公钥,仅用于非对称加密<br> 采用X509证书规范<br> 算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyFactory @param algorithm 算法 @param key 密钥,必须为DER编码存储 @return 公钥 {@link PublicKey} """ if (null == key) { return null; } return generatePublicKey(algorithm, new X509EncodedKeySpec(key)); }
java
public static PublicKey generatePublicKey(String algorithm, byte[] key) { if (null == key) { return null; } return generatePublicKey(algorithm, new X509EncodedKeySpec(key)); }
[ "public", "static", "PublicKey", "generatePublicKey", "(", "String", "algorithm", ",", "byte", "[", "]", "key", ")", "{", "if", "(", "null", "==", "key", ")", "{", "return", "null", ";", "}", "return", "generatePublicKey", "(", "algorithm", ",", "new", "X509EncodedKeySpec", "(", "key", ")", ")", ";", "}" ]
生成公钥,仅用于非对称加密<br> 采用X509证书规范<br> 算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyFactory @param algorithm 算法 @param key 密钥,必须为DER编码存储 @return 公钥 {@link PublicKey}
[ "生成公钥,仅用于非对称加密<br", ">", "采用X509证书规范<br", ">", "算法见:https", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "7", "/", "docs", "/", "technotes", "/", "guides", "/", "security", "/", "StandardNames", ".", "html#KeyFactory" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L285-L290
twilio/twilio-java
src/main/java/com/twilio/rest/voice/v1/dialingpermissions/CountryReader.java
CountryReader.previousPage
@Override public Page<Country> previousPage(final Page<Country> page, final TwilioRestClient client) { """ Retrieve the previous page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Previous Page """ Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.VOICE.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<Country> previousPage(final Page<Country> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.VOICE.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "Country", ">", "previousPage", "(", "final", "Page", "<", "Country", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", "page", ".", "getPreviousPageUrl", "(", "Domains", ".", "VOICE", ".", "toString", "(", ")", ",", "client", ".", "getRegion", "(", ")", ")", ")", ";", "return", "pageForRequest", "(", "client", ",", "request", ")", ";", "}" ]
Retrieve the previous page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Previous Page
[ "Retrieve", "the", "previous", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/voice/v1/dialingpermissions/CountryReader.java#L190-L201
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/MopWriter.java
MopWriter.getMopMethodName
public static String getMopMethodName(MethodNode method, boolean useThis) { """ creates a MOP method name from a method @param method the method to be called by the mop method @param useThis if true, then it is a call on "this", "super" else @return the mop method name """ ClassNode declaringNode = method.getDeclaringClass(); int distance = 0; for (; declaringNode != null; declaringNode = declaringNode.getSuperClass()) { distance++; } return (useThis ? "this" : "super") + "$" + distance + "$" + method.getName(); }
java
public static String getMopMethodName(MethodNode method, boolean useThis) { ClassNode declaringNode = method.getDeclaringClass(); int distance = 0; for (; declaringNode != null; declaringNode = declaringNode.getSuperClass()) { distance++; } return (useThis ? "this" : "super") + "$" + distance + "$" + method.getName(); }
[ "public", "static", "String", "getMopMethodName", "(", "MethodNode", "method", ",", "boolean", "useThis", ")", "{", "ClassNode", "declaringNode", "=", "method", ".", "getDeclaringClass", "(", ")", ";", "int", "distance", "=", "0", ";", "for", "(", ";", "declaringNode", "!=", "null", ";", "declaringNode", "=", "declaringNode", ".", "getSuperClass", "(", ")", ")", "{", "distance", "++", ";", "}", "return", "(", "useThis", "?", "\"this\"", ":", "\"super\"", ")", "+", "\"$\"", "+", "distance", "+", "\"$\"", "+", "method", ".", "getName", "(", ")", ";", "}" ]
creates a MOP method name from a method @param method the method to be called by the mop method @param useThis if true, then it is a call on "this", "super" else @return the mop method name
[ "creates", "a", "MOP", "method", "name", "from", "a", "method" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/MopWriter.java#L160-L167
line/armeria
grpc/src/main/java/com/linecorp/armeria/internal/grpc/GrpcLogUtil.java
GrpcLogUtil.rpcRequest
public static RpcRequest rpcRequest(MethodDescriptor<?, ?> method, Object message) { """ Returns a {@link RpcRequest} corresponding to the given {@link MethodDescriptor}. """ // We don't actually use the RpcRequest for request processing since it doesn't fit well with streaming. // We still populate it with a reasonable method name for use in logging. The service type is currently // arbitrarily set as gRPC doesn't use Class<?> to represent services - if this becomes a problem, we // would need to refactor it to take a Object instead. return RpcRequest.of(GrpcLogUtil.class, method.getFullMethodName(), message); }
java
public static RpcRequest rpcRequest(MethodDescriptor<?, ?> method, Object message) { // We don't actually use the RpcRequest for request processing since it doesn't fit well with streaming. // We still populate it with a reasonable method name for use in logging. The service type is currently // arbitrarily set as gRPC doesn't use Class<?> to represent services - if this becomes a problem, we // would need to refactor it to take a Object instead. return RpcRequest.of(GrpcLogUtil.class, method.getFullMethodName(), message); }
[ "public", "static", "RpcRequest", "rpcRequest", "(", "MethodDescriptor", "<", "?", ",", "?", ">", "method", ",", "Object", "message", ")", "{", "// We don't actually use the RpcRequest for request processing since it doesn't fit well with streaming.", "// We still populate it with a reasonable method name for use in logging. The service type is currently", "// arbitrarily set as gRPC doesn't use Class<?> to represent services - if this becomes a problem, we", "// would need to refactor it to take a Object instead.", "return", "RpcRequest", ".", "of", "(", "GrpcLogUtil", ".", "class", ",", "method", ".", "getFullMethodName", "(", ")", ",", "message", ")", ";", "}" ]
Returns a {@link RpcRequest} corresponding to the given {@link MethodDescriptor}.
[ "Returns", "a", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/grpc/src/main/java/com/linecorp/armeria/internal/grpc/GrpcLogUtil.java#L43-L49
lawloretienne/ImageGallery
library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java
TouchImageView.transformCoordBitmapToTouch
private PointF transformCoordBitmapToTouch(float bx, float by) { """ Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the drawable's coordinate system to the view's coordinate system. @param bx x-coordinate in original bitmap coordinate system @param by y-coordinate in original bitmap coordinate system @return Coordinates of the point in the view's coordinate system. """ matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float px = bx / origW; float py = by / origH; float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px; float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py; return new PointF(finalX, finalY); }
java
private PointF transformCoordBitmapToTouch(float bx, float by) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float px = bx / origW; float py = by / origH; float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px; float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py; return new PointF(finalX, finalY); }
[ "private", "PointF", "transformCoordBitmapToTouch", "(", "float", "bx", ",", "float", "by", ")", "{", "matrix", ".", "getValues", "(", "m", ")", ";", "float", "origW", "=", "getDrawable", "(", ")", ".", "getIntrinsicWidth", "(", ")", ";", "float", "origH", "=", "getDrawable", "(", ")", ".", "getIntrinsicHeight", "(", ")", ";", "float", "px", "=", "bx", "/", "origW", ";", "float", "py", "=", "by", "/", "origH", ";", "float", "finalX", "=", "m", "[", "Matrix", ".", "MTRANS_X", "]", "+", "getImageWidth", "(", ")", "*", "px", ";", "float", "finalY", "=", "m", "[", "Matrix", ".", "MTRANS_Y", "]", "+", "getImageHeight", "(", ")", "*", "py", ";", "return", "new", "PointF", "(", "finalX", ",", "finalY", ")", ";", "}" ]
Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the drawable's coordinate system to the view's coordinate system. @param bx x-coordinate in original bitmap coordinate system @param by y-coordinate in original bitmap coordinate system @return Coordinates of the point in the view's coordinate system.
[ "Inverse", "of", "transformCoordTouchToBitmap", ".", "This", "function", "will", "transform", "the", "coordinates", "in", "the", "drawable", "s", "coordinate", "system", "to", "the", "view", "s", "coordinate", "system", "." ]
train
https://github.com/lawloretienne/ImageGallery/blob/960d68dfb2b81d05322a576723ac4f090e10eda7/library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java#L1102-L1111
nicoulaj/checksum-maven-plugin
src/main/java/net/nicoulaj/maven/plugins/checksum/mojo/FilesMojo.java
FilesMojo.getFilesToProcess
@Override protected List<ChecksumFile> getFilesToProcess() { """ Build the list of files from which digests should be generated. @return the list of files that should be processed. """ final List<ChecksumFile> filesToProcess = new ArrayList<ChecksumFile>(); for ( final FileSet fileSet : fileSets ) { final DirectoryScanner scanner = new DirectoryScanner(); final String fileSetDirectory = (new File( fileSet.getDirectory() ) ).getPath(); scanner.setBasedir( fileSetDirectory ); String[] includes; if ( fileSet.getIncludes() != null && !fileSet.getIncludes().isEmpty() ) { final List<String> fileSetIncludes = fileSet.getIncludes(); includes = fileSetIncludes.toArray( new String[fileSetIncludes.size()] ); } else { includes = DEFAULT_INCLUDES; } scanner.setIncludes( includes ); if ( fileSet.getExcludes() != null && !fileSet.getExcludes().isEmpty() ) { final List<String> fileSetExcludes = fileSet.getExcludes(); scanner.setExcludes( fileSetExcludes.toArray( new String[fileSetExcludes.size()] ) ); } scanner.addDefaultExcludes(); scanner.scan(); for ( String filePath : scanner.getIncludedFiles() ) { filesToProcess.add( new ChecksumFile( (new File( fileSetDirectory ) ).getPath(), new File( fileSetDirectory, filePath ), null, null ) ); } } return filesToProcess; }
java
@Override protected List<ChecksumFile> getFilesToProcess() { final List<ChecksumFile> filesToProcess = new ArrayList<ChecksumFile>(); for ( final FileSet fileSet : fileSets ) { final DirectoryScanner scanner = new DirectoryScanner(); final String fileSetDirectory = (new File( fileSet.getDirectory() ) ).getPath(); scanner.setBasedir( fileSetDirectory ); String[] includes; if ( fileSet.getIncludes() != null && !fileSet.getIncludes().isEmpty() ) { final List<String> fileSetIncludes = fileSet.getIncludes(); includes = fileSetIncludes.toArray( new String[fileSetIncludes.size()] ); } else { includes = DEFAULT_INCLUDES; } scanner.setIncludes( includes ); if ( fileSet.getExcludes() != null && !fileSet.getExcludes().isEmpty() ) { final List<String> fileSetExcludes = fileSet.getExcludes(); scanner.setExcludes( fileSetExcludes.toArray( new String[fileSetExcludes.size()] ) ); } scanner.addDefaultExcludes(); scanner.scan(); for ( String filePath : scanner.getIncludedFiles() ) { filesToProcess.add( new ChecksumFile( (new File( fileSetDirectory ) ).getPath(), new File( fileSetDirectory, filePath ), null, null ) ); } } return filesToProcess; }
[ "@", "Override", "protected", "List", "<", "ChecksumFile", ">", "getFilesToProcess", "(", ")", "{", "final", "List", "<", "ChecksumFile", ">", "filesToProcess", "=", "new", "ArrayList", "<", "ChecksumFile", ">", "(", ")", ";", "for", "(", "final", "FileSet", "fileSet", ":", "fileSets", ")", "{", "final", "DirectoryScanner", "scanner", "=", "new", "DirectoryScanner", "(", ")", ";", "final", "String", "fileSetDirectory", "=", "(", "new", "File", "(", "fileSet", ".", "getDirectory", "(", ")", ")", ")", ".", "getPath", "(", ")", ";", "scanner", ".", "setBasedir", "(", "fileSetDirectory", ")", ";", "String", "[", "]", "includes", ";", "if", "(", "fileSet", ".", "getIncludes", "(", ")", "!=", "null", "&&", "!", "fileSet", ".", "getIncludes", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "final", "List", "<", "String", ">", "fileSetIncludes", "=", "fileSet", ".", "getIncludes", "(", ")", ";", "includes", "=", "fileSetIncludes", ".", "toArray", "(", "new", "String", "[", "fileSetIncludes", ".", "size", "(", ")", "]", ")", ";", "}", "else", "{", "includes", "=", "DEFAULT_INCLUDES", ";", "}", "scanner", ".", "setIncludes", "(", "includes", ")", ";", "if", "(", "fileSet", ".", "getExcludes", "(", ")", "!=", "null", "&&", "!", "fileSet", ".", "getExcludes", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "final", "List", "<", "String", ">", "fileSetExcludes", "=", "fileSet", ".", "getExcludes", "(", ")", ";", "scanner", ".", "setExcludes", "(", "fileSetExcludes", ".", "toArray", "(", "new", "String", "[", "fileSetExcludes", ".", "size", "(", ")", "]", ")", ")", ";", "}", "scanner", ".", "addDefaultExcludes", "(", ")", ";", "scanner", ".", "scan", "(", ")", ";", "for", "(", "String", "filePath", ":", "scanner", ".", "getIncludedFiles", "(", ")", ")", "{", "filesToProcess", ".", "add", "(", "new", "ChecksumFile", "(", "(", "new", "File", "(", "fileSetDirectory", ")", ")", ".", "getPath", "(", ")", ",", "new", "File", "(", "fileSetDirectory", ",", "filePath", ")", ",", "null", ",", "null", ")", ")", ";", "}", "}", "return", "filesToProcess", ";", "}" ]
Build the list of files from which digests should be generated. @return the list of files that should be processed.
[ "Build", "the", "list", "of", "files", "from", "which", "digests", "should", "be", "generated", "." ]
train
https://github.com/nicoulaj/checksum-maven-plugin/blob/8d8feab8a0a34e24ae41621e7372be6387e1fe55/src/main/java/net/nicoulaj/maven/plugins/checksum/mojo/FilesMojo.java#L167-L206
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java
TriggersInner.createOrUpdate
public TriggerInner createOrUpdate(String deviceName, String name, String resourceGroupName, TriggerInner trigger) { """ Creates or updates a trigger. @param deviceName Creates or updates a trigger @param name The trigger name. @param resourceGroupName The resource group name. @param trigger The trigger. @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 TriggerInner object if successful. """ return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, trigger).toBlocking().last().body(); }
java
public TriggerInner createOrUpdate(String deviceName, String name, String resourceGroupName, TriggerInner trigger) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, trigger).toBlocking().last().body(); }
[ "public", "TriggerInner", "createOrUpdate", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "TriggerInner", "trigger", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroupName", ",", "trigger", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a trigger. @param deviceName Creates or updates a trigger @param name The trigger name. @param resourceGroupName The resource group name. @param trigger The trigger. @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 TriggerInner object if successful.
[ "Creates", "or", "updates", "a", "trigger", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java#L444-L446
Coveros/selenified
src/main/java/com/coveros/selenified/application/App.java
App.isNotConfirmation
private boolean isNotConfirmation(String action, String expected) { """ Determines if a confirmation is present or not, and can be interacted with. If it's not present, an indication that the confirmation can't be clicked on is written to the log file @param action - the action occurring @param expected - the expected result @return Boolean: is a confirmation actually present or not. """ // wait for element to be present if (!is.confirmationPresent()) { waitFor.confirmationPresent(); } if (!is.confirmationPresent()) { reporter.fail(action, expected, "Unable to click confirmation as it is not present"); return true; // indicates element not present } return false; }
java
private boolean isNotConfirmation(String action, String expected) { // wait for element to be present if (!is.confirmationPresent()) { waitFor.confirmationPresent(); } if (!is.confirmationPresent()) { reporter.fail(action, expected, "Unable to click confirmation as it is not present"); return true; // indicates element not present } return false; }
[ "private", "boolean", "isNotConfirmation", "(", "String", "action", ",", "String", "expected", ")", "{", "// wait for element to be present", "if", "(", "!", "is", ".", "confirmationPresent", "(", ")", ")", "{", "waitFor", ".", "confirmationPresent", "(", ")", ";", "}", "if", "(", "!", "is", ".", "confirmationPresent", "(", ")", ")", "{", "reporter", ".", "fail", "(", "action", ",", "expected", ",", "\"Unable to click confirmation as it is not present\"", ")", ";", "return", "true", ";", "// indicates element not present", "}", "return", "false", ";", "}" ]
Determines if a confirmation is present or not, and can be interacted with. If it's not present, an indication that the confirmation can't be clicked on is written to the log file @param action - the action occurring @param expected - the expected result @return Boolean: is a confirmation actually present or not.
[ "Determines", "if", "a", "confirmation", "is", "present", "or", "not", "and", "can", "be", "interacted", "with", ".", "If", "it", "s", "not", "present", "an", "indication", "that", "the", "confirmation", "can", "t", "be", "clicked", "on", "is", "written", "to", "the", "log", "file" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/App.java#L809-L819
jillesvangurp/jsonj
src/main/java/com/github/jsonj/tools/JsonSerializer.java
JsonSerializer.serialize
public static void serialize(OutputStream out, @Nonnull JsonElement json, boolean pretty) throws IOException { """ Writes the object out as json. @param out output writer @param json a {@link JsonElement} @param pretty if true, a properly indented version of the json is written @throws IOException if there is a problem writing to the stream """ Validate.notNull(out); BufferedOutputStream bufferedOut = new BufferedOutputStream(out); OutputStreamWriter w = new OutputStreamWriter(bufferedOut, UTF8); if(pretty) { serialize(w, json, pretty); } else { json.serialize(w); // subtle bug where not flushing this results in empty string when serializing to a ByteArrayOutputStream w.flush(); bufferedOut.flush(); } }
java
public static void serialize(OutputStream out, @Nonnull JsonElement json, boolean pretty) throws IOException { Validate.notNull(out); BufferedOutputStream bufferedOut = new BufferedOutputStream(out); OutputStreamWriter w = new OutputStreamWriter(bufferedOut, UTF8); if(pretty) { serialize(w, json, pretty); } else { json.serialize(w); // subtle bug where not flushing this results in empty string when serializing to a ByteArrayOutputStream w.flush(); bufferedOut.flush(); } }
[ "public", "static", "void", "serialize", "(", "OutputStream", "out", ",", "@", "Nonnull", "JsonElement", "json", ",", "boolean", "pretty", ")", "throws", "IOException", "{", "Validate", ".", "notNull", "(", "out", ")", ";", "BufferedOutputStream", "bufferedOut", "=", "new", "BufferedOutputStream", "(", "out", ")", ";", "OutputStreamWriter", "w", "=", "new", "OutputStreamWriter", "(", "bufferedOut", ",", "UTF8", ")", ";", "if", "(", "pretty", ")", "{", "serialize", "(", "w", ",", "json", ",", "pretty", ")", ";", "}", "else", "{", "json", ".", "serialize", "(", "w", ")", ";", "// subtle bug where not flushing this results in empty string when serializing to a ByteArrayOutputStream", "w", ".", "flush", "(", ")", ";", "bufferedOut", ".", "flush", "(", ")", ";", "}", "}" ]
Writes the object out as json. @param out output writer @param json a {@link JsonElement} @param pretty if true, a properly indented version of the json is written @throws IOException if there is a problem writing to the stream
[ "Writes", "the", "object", "out", "as", "json", "." ]
train
https://github.com/jillesvangurp/jsonj/blob/1da0c44c5bdb60c0cd806c48d2da5a8a75bf84af/src/main/java/com/github/jsonj/tools/JsonSerializer.java#L161-L173
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildSerialUIDInfo
public void buildSerialUIDInfo(XMLNode node, Content classTree) { """ Build the serial UID information for the given class. @param node the XML element that specifies which components to document @param classTree content tree to which the serial UID information will be added """ Content serialUidTree = writer.getSerialUIDInfoHeader(); for (Element e : utils.getFieldsUnfiltered(currentTypeElement)) { VariableElement field = (VariableElement)e; if (field.getSimpleName().toString().compareTo(SERIAL_VERSION_UID) == 0 && field.getConstantValue() != null) { writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, utils.constantValueExpresion(field), serialUidTree); break; } } classTree.addContent(serialUidTree); }
java
public void buildSerialUIDInfo(XMLNode node, Content classTree) { Content serialUidTree = writer.getSerialUIDInfoHeader(); for (Element e : utils.getFieldsUnfiltered(currentTypeElement)) { VariableElement field = (VariableElement)e; if (field.getSimpleName().toString().compareTo(SERIAL_VERSION_UID) == 0 && field.getConstantValue() != null) { writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, utils.constantValueExpresion(field), serialUidTree); break; } } classTree.addContent(serialUidTree); }
[ "public", "void", "buildSerialUIDInfo", "(", "XMLNode", "node", ",", "Content", "classTree", ")", "{", "Content", "serialUidTree", "=", "writer", ".", "getSerialUIDInfoHeader", "(", ")", ";", "for", "(", "Element", "e", ":", "utils", ".", "getFieldsUnfiltered", "(", "currentTypeElement", ")", ")", "{", "VariableElement", "field", "=", "(", "VariableElement", ")", "e", ";", "if", "(", "field", ".", "getSimpleName", "(", ")", ".", "toString", "(", ")", ".", "compareTo", "(", "SERIAL_VERSION_UID", ")", "==", "0", "&&", "field", ".", "getConstantValue", "(", ")", "!=", "null", ")", "{", "writer", ".", "addSerialUIDInfo", "(", "SERIAL_VERSION_UID_HEADER", ",", "utils", ".", "constantValueExpresion", "(", "field", ")", ",", "serialUidTree", ")", ";", "break", ";", "}", "}", "classTree", ".", "addContent", "(", "serialUidTree", ")", ";", "}" ]
Build the serial UID information for the given class. @param node the XML element that specifies which components to document @param classTree content tree to which the serial UID information will be added
[ "Build", "the", "serial", "UID", "information", "for", "the", "given", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L253-L265
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.fundamentalCompatible3
public static boolean fundamentalCompatible3( DMatrixRMaj F21 , DMatrixRMaj F31 , DMatrixRMaj F32 , double tol ) { """ <p> Checks to see if the three fundamental matrices are consistent based on their epipoles. </p> <p> e<sub>23</sub><sup>T</sup>F<sub>21</sub>e<sub>13</sub> = 0<br> e<sub>31</sub><sup>T</sup>F<sub>32</sub>e<sub>21</sub> = 0<br> e<sub>32</sub><sup>T</sup>F<sub>31</sub>e<sub>12</sub> = 0<br> </p> <p> Section 15.4 in R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003 </p> @param F21 (Input) Fundamental matrix between view 1 and 2 @param F31 (Input) Fundamental matrix between view 1 and 3 @param F32 (Input) Fundamental matrix between view 2 and 3 """ FundamentalExtractEpipoles extractEpi = new FundamentalExtractEpipoles(); Point3D_F64 e21 = new Point3D_F64(); Point3D_F64 e12 = new Point3D_F64(); Point3D_F64 e31 = new Point3D_F64(); Point3D_F64 e13 = new Point3D_F64(); Point3D_F64 e32 = new Point3D_F64(); Point3D_F64 e23 = new Point3D_F64(); extractEpi.process(F21,e21,e12); extractEpi.process(F31,e31,e13); extractEpi.process(F32,e32,e23); // GeometryMath_F64.innerProd(e12,F21,e21) // GeometryMath_F64.innerProd(e13,F31,e31) double score = 0; score += Math.abs(GeometryMath_F64.innerProd(e23,F21,e13)); score += Math.abs(GeometryMath_F64.innerProd(e31,F31,e21)); score += Math.abs(GeometryMath_F64.innerProd(e32,F32,e12)); score /= 3; return score <= tol; }
java
public static boolean fundamentalCompatible3( DMatrixRMaj F21 , DMatrixRMaj F31 , DMatrixRMaj F32 , double tol ) { FundamentalExtractEpipoles extractEpi = new FundamentalExtractEpipoles(); Point3D_F64 e21 = new Point3D_F64(); Point3D_F64 e12 = new Point3D_F64(); Point3D_F64 e31 = new Point3D_F64(); Point3D_F64 e13 = new Point3D_F64(); Point3D_F64 e32 = new Point3D_F64(); Point3D_F64 e23 = new Point3D_F64(); extractEpi.process(F21,e21,e12); extractEpi.process(F31,e31,e13); extractEpi.process(F32,e32,e23); // GeometryMath_F64.innerProd(e12,F21,e21) // GeometryMath_F64.innerProd(e13,F31,e31) double score = 0; score += Math.abs(GeometryMath_F64.innerProd(e23,F21,e13)); score += Math.abs(GeometryMath_F64.innerProd(e31,F31,e21)); score += Math.abs(GeometryMath_F64.innerProd(e32,F32,e12)); score /= 3; return score <= tol; }
[ "public", "static", "boolean", "fundamentalCompatible3", "(", "DMatrixRMaj", "F21", ",", "DMatrixRMaj", "F31", ",", "DMatrixRMaj", "F32", ",", "double", "tol", ")", "{", "FundamentalExtractEpipoles", "extractEpi", "=", "new", "FundamentalExtractEpipoles", "(", ")", ";", "Point3D_F64", "e21", "=", "new", "Point3D_F64", "(", ")", ";", "Point3D_F64", "e12", "=", "new", "Point3D_F64", "(", ")", ";", "Point3D_F64", "e31", "=", "new", "Point3D_F64", "(", ")", ";", "Point3D_F64", "e13", "=", "new", "Point3D_F64", "(", ")", ";", "Point3D_F64", "e32", "=", "new", "Point3D_F64", "(", ")", ";", "Point3D_F64", "e23", "=", "new", "Point3D_F64", "(", ")", ";", "extractEpi", ".", "process", "(", "F21", ",", "e21", ",", "e12", ")", ";", "extractEpi", ".", "process", "(", "F31", ",", "e31", ",", "e13", ")", ";", "extractEpi", ".", "process", "(", "F32", ",", "e32", ",", "e23", ")", ";", "// GeometryMath_F64.innerProd(e12,F21,e21)", "// GeometryMath_F64.innerProd(e13,F31,e31)", "double", "score", "=", "0", ";", "score", "+=", "Math", ".", "abs", "(", "GeometryMath_F64", ".", "innerProd", "(", "e23", ",", "F21", ",", "e13", ")", ")", ";", "score", "+=", "Math", ".", "abs", "(", "GeometryMath_F64", ".", "innerProd", "(", "e31", ",", "F31", ",", "e21", ")", ")", ";", "score", "+=", "Math", ".", "abs", "(", "GeometryMath_F64", ".", "innerProd", "(", "e32", ",", "F32", ",", "e12", ")", ")", ";", "score", "/=", "3", ";", "return", "score", "<=", "tol", ";", "}" ]
<p> Checks to see if the three fundamental matrices are consistent based on their epipoles. </p> <p> e<sub>23</sub><sup>T</sup>F<sub>21</sub>e<sub>13</sub> = 0<br> e<sub>31</sub><sup>T</sup>F<sub>32</sub>e<sub>21</sub> = 0<br> e<sub>32</sub><sup>T</sup>F<sub>31</sub>e<sub>12</sub> = 0<br> </p> <p> Section 15.4 in R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003 </p> @param F21 (Input) Fundamental matrix between view 1 and 2 @param F31 (Input) Fundamental matrix between view 1 and 3 @param F32 (Input) Fundamental matrix between view 2 and 3
[ "<p", ">", "Checks", "to", "see", "if", "the", "three", "fundamental", "matrices", "are", "consistent", "based", "on", "their", "epipoles", ".", "<", "/", "p", ">", "<p", ">", "e<sub", ">", "23<", "/", "sub", ">", "<sup", ">", "T<", "/", "sup", ">", "F<sub", ">", "21<", "/", "sub", ">", "e<sub", ">", "13<", "/", "sub", ">", "=", "0<br", ">", "e<sub", ">", "31<", "/", "sub", ">", "<sup", ">", "T<", "/", "sup", ">", "F<sub", ">", "32<", "/", "sub", ">", "e<sub", ">", "21<", "/", "sub", ">", "=", "0<br", ">", "e<sub", ">", "32<", "/", "sub", ">", "<sup", ">", "T<", "/", "sup", ">", "F<sub", ">", "31<", "/", "sub", ">", "e<sub", ">", "12<", "/", "sub", ">", "=", "0<br", ">", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L1030-L1056
linkhub-sdk/popbill.sdk.java
src/main/java/com/popbill/api/cashbill/CashbillServiceImp.java
CashbillServiceImp.sendSMS
@Override public Response sendSMS(String CorpNum, String MgtKey, String Sender, String Receiver, String Contents) throws PopbillException { """ /* (non-Javadoc) @see com.popbill.api.CashbillService#sendSMS(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) """ if (MgtKey == null || MgtKey.isEmpty()) throw new PopbillException(-99999999, "관리번호가 입력되지 않았습니다."); return sendSMS(CorpNum, MgtKey, Sender, Receiver, Contents, null); }
java
@Override public Response sendSMS(String CorpNum, String MgtKey, String Sender, String Receiver, String Contents) throws PopbillException { if (MgtKey == null || MgtKey.isEmpty()) throw new PopbillException(-99999999, "관리번호가 입력되지 않았습니다."); return sendSMS(CorpNum, MgtKey, Sender, Receiver, Contents, null); }
[ "@", "Override", "public", "Response", "sendSMS", "(", "String", "CorpNum", ",", "String", "MgtKey", ",", "String", "Sender", ",", "String", "Receiver", ",", "String", "Contents", ")", "throws", "PopbillException", "{", "if", "(", "MgtKey", "==", "null", "||", "MgtKey", ".", "isEmpty", "(", ")", ")", "throw", "new", "PopbillException", "(", "-", "99999999", ",", "\"관리번호가 입력되지 않았습니다.\");\r", "", "", "return", "sendSMS", "(", "CorpNum", ",", "MgtKey", ",", "Sender", ",", "Receiver", ",", "Contents", ",", "null", ")", ";", "}" ]
/* (non-Javadoc) @see com.popbill.api.CashbillService#sendSMS(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/linkhub-sdk/popbill.sdk.java/blob/63a341fefe96d60a368776638f3d4c81888238b7/src/main/java/com/popbill/api/cashbill/CashbillServiceImp.java#L262-L270
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/DOTranslationUtility.java
DOTranslationUtility.readStateAttribute
public static String readStateAttribute(String rawValue) throws ParseException { """ Parse and read the object state value from raw text. <p> Reads a text representation of object state, and returns a "state code" abbreviation corresponding to that state. Null or empty values are interpreted as "Active". </p> XXX: It might clearer to nix state codes altogether and just use the full value @param rawValue Raw string to parse. May be null @return String containing the state code (A, D, or I) @throws ParseException thrown when state value cannot be determined """ if (MODEL.DELETED.looselyMatches(rawValue, true)) { return "D"; } else if (MODEL.INACTIVE.looselyMatches(rawValue, true)) { return "I"; } else if (MODEL.ACTIVE.looselyMatches(rawValue, true) || rawValue == null || rawValue.isEmpty()) { return "A"; } else { throw new ParseException("Could not interpret state value of '" + rawValue + "'", 0); } }
java
public static String readStateAttribute(String rawValue) throws ParseException { if (MODEL.DELETED.looselyMatches(rawValue, true)) { return "D"; } else if (MODEL.INACTIVE.looselyMatches(rawValue, true)) { return "I"; } else if (MODEL.ACTIVE.looselyMatches(rawValue, true) || rawValue == null || rawValue.isEmpty()) { return "A"; } else { throw new ParseException("Could not interpret state value of '" + rawValue + "'", 0); } }
[ "public", "static", "String", "readStateAttribute", "(", "String", "rawValue", ")", "throws", "ParseException", "{", "if", "(", "MODEL", ".", "DELETED", ".", "looselyMatches", "(", "rawValue", ",", "true", ")", ")", "{", "return", "\"D\"", ";", "}", "else", "if", "(", "MODEL", ".", "INACTIVE", ".", "looselyMatches", "(", "rawValue", ",", "true", ")", ")", "{", "return", "\"I\"", ";", "}", "else", "if", "(", "MODEL", ".", "ACTIVE", ".", "looselyMatches", "(", "rawValue", ",", "true", ")", "||", "rawValue", "==", "null", "||", "rawValue", ".", "isEmpty", "(", ")", ")", "{", "return", "\"A\"", ";", "}", "else", "{", "throw", "new", "ParseException", "(", "\"Could not interpret state value of '\"", "+", "rawValue", "+", "\"'\"", ",", "0", ")", ";", "}", "}" ]
Parse and read the object state value from raw text. <p> Reads a text representation of object state, and returns a "state code" abbreviation corresponding to that state. Null or empty values are interpreted as "Active". </p> XXX: It might clearer to nix state codes altogether and just use the full value @param rawValue Raw string to parse. May be null @return String containing the state code (A, D, or I) @throws ParseException thrown when state value cannot be determined
[ "Parse", "and", "read", "the", "object", "state", "value", "from", "raw", "text", ".", "<p", ">", "Reads", "a", "text", "representation", "of", "object", "state", "and", "returns", "a", "state", "code", "abbreviation", "corresponding", "to", "that", "state", ".", "Null", "or", "empty", "values", "are", "interpreted", "as", "Active", ".", "<", "/", "p", ">" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/translation/DOTranslationUtility.java#L875-L888
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.getObjectIndex
public static Object getObjectIndex(Object obj, double dblIndex, Context cx, Scriptable scope) { """ A cheaper and less general version of the above for well-known argument types. """ Scriptable sobj = toObjectOrNull(cx, obj, scope); if (sobj == null) { throw undefReadError(obj, toString(dblIndex)); } int index = (int)dblIndex; if (index == dblIndex) { return getObjectIndex(sobj, index, cx); } String s = toString(dblIndex); return getObjectProp(sobj, s, cx); }
java
public static Object getObjectIndex(Object obj, double dblIndex, Context cx, Scriptable scope) { Scriptable sobj = toObjectOrNull(cx, obj, scope); if (sobj == null) { throw undefReadError(obj, toString(dblIndex)); } int index = (int)dblIndex; if (index == dblIndex) { return getObjectIndex(sobj, index, cx); } String s = toString(dblIndex); return getObjectProp(sobj, s, cx); }
[ "public", "static", "Object", "getObjectIndex", "(", "Object", "obj", ",", "double", "dblIndex", ",", "Context", "cx", ",", "Scriptable", "scope", ")", "{", "Scriptable", "sobj", "=", "toObjectOrNull", "(", "cx", ",", "obj", ",", "scope", ")", ";", "if", "(", "sobj", "==", "null", ")", "{", "throw", "undefReadError", "(", "obj", ",", "toString", "(", "dblIndex", ")", ")", ";", "}", "int", "index", "=", "(", "int", ")", "dblIndex", ";", "if", "(", "index", "==", "dblIndex", ")", "{", "return", "getObjectIndex", "(", "sobj", ",", "index", ",", "cx", ")", ";", "}", "String", "s", "=", "toString", "(", "dblIndex", ")", ";", "return", "getObjectProp", "(", "sobj", ",", "s", ",", "cx", ")", ";", "}" ]
A cheaper and less general version of the above for well-known argument types.
[ "A", "cheaper", "and", "less", "general", "version", "of", "the", "above", "for", "well", "-", "known", "argument", "types", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1642-L1656
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java
MessageProcessInfo.createReplyMessage
public Message createReplyMessage(Message message) { """ Create the response message for this message. @return the response message (or null if none). """ Object objResponseID = ((BaseMessage)message).getMessageHeader().get(TrxMessageHeader.MESSAGE_RESPONSE_ID); if (objResponseID == null) return null; // TODO (don) FIX this - return an error. MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getMessageProcessInfo(objResponseID.toString()); MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); BaseMessage replyMessage = new TreeMessage(null, null); MessageRecordDesc messageRecordDesc = recMessageInfo.createNewMessage(replyMessage, null); return replyMessage; }
java
public Message createReplyMessage(Message message) { Object objResponseID = ((BaseMessage)message).getMessageHeader().get(TrxMessageHeader.MESSAGE_RESPONSE_ID); if (objResponseID == null) return null; // TODO (don) FIX this - return an error. MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getMessageProcessInfo(objResponseID.toString()); MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); BaseMessage replyMessage = new TreeMessage(null, null); MessageRecordDesc messageRecordDesc = recMessageInfo.createNewMessage(replyMessage, null); return replyMessage; }
[ "public", "Message", "createReplyMessage", "(", "Message", "message", ")", "{", "Object", "objResponseID", "=", "(", "(", "BaseMessage", ")", "message", ")", ".", "getMessageHeader", "(", ")", ".", "get", "(", "TrxMessageHeader", ".", "MESSAGE_RESPONSE_ID", ")", ";", "if", "(", "objResponseID", "==", "null", ")", "return", "null", ";", "// TODO (don) FIX this - return an error.", "MessageProcessInfo", "recMessageProcessInfo", "=", "(", "MessageProcessInfo", ")", "this", ".", "getMessageProcessInfo", "(", "objResponseID", ".", "toString", "(", ")", ")", ";", "MessageInfo", "recMessageInfo", "=", "(", "MessageInfo", ")", "(", "(", "ReferenceField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", ";", "BaseMessage", "replyMessage", "=", "new", "TreeMessage", "(", "null", ",", "null", ")", ";", "MessageRecordDesc", "messageRecordDesc", "=", "recMessageInfo", ".", "createNewMessage", "(", "replyMessage", ",", "null", ")", ";", "return", "replyMessage", ";", "}" ]
Create the response message for this message. @return the response message (or null if none).
[ "Create", "the", "response", "message", "for", "this", "message", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java#L708-L718
JOML-CI/JOML
src/org/joml/Matrix3f.java
Matrix3f.setLookAlong
public Matrix3f setLookAlong(Vector3fc dir, Vector3fc up) { """ Set this matrix to a rotation transformation to make <code>-z</code> point along <code>dir</code>. <p> In order to apply the lookalong transformation to any previous existing transformation, use {@link #lookAlong(Vector3fc, Vector3fc)}. @see #setLookAlong(Vector3fc, Vector3fc) @see #lookAlong(Vector3fc, Vector3fc) @param dir the direction in space to look along @param up the direction of 'up' @return this """ return setLookAlong(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
java
public Matrix3f setLookAlong(Vector3fc dir, Vector3fc up) { return setLookAlong(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
[ "public", "Matrix3f", "setLookAlong", "(", "Vector3fc", "dir", ",", "Vector3fc", "up", ")", "{", "return", "setLookAlong", "(", "dir", ".", "x", "(", ")", ",", "dir", ".", "y", "(", ")", ",", "dir", ".", "z", "(", ")", ",", "up", ".", "x", "(", ")", ",", "up", ".", "y", "(", ")", ",", "up", ".", "z", "(", ")", ")", ";", "}" ]
Set this matrix to a rotation transformation to make <code>-z</code> point along <code>dir</code>. <p> In order to apply the lookalong transformation to any previous existing transformation, use {@link #lookAlong(Vector3fc, Vector3fc)}. @see #setLookAlong(Vector3fc, Vector3fc) @see #lookAlong(Vector3fc, Vector3fc) @param dir the direction in space to look along @param up the direction of 'up' @return this
[ "Set", "this", "matrix", "to", "a", "rotation", "transformation", "to", "make", "<code", ">", "-", "z<", "/", "code", ">", "point", "along", "<code", ">", "dir<", "/", "code", ">", ".", "<p", ">", "In", "order", "to", "apply", "the", "lookalong", "transformation", "to", "any", "previous", "existing", "transformation", "use", "{", "@link", "#lookAlong", "(", "Vector3fc", "Vector3fc", ")", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L3148-L3150
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java
SymmOptimizer.probabilityFunction
private double probabilityFunction(double AS, int m, int maxIter) { """ Calculates the probability of accepting a bad move given the iteration step and the score change. <p> Function: p=(C-AS)/(C*sqrt(step)) Added a normalization factor so that the probability approaches 0 when the maxIter is reached. """ double prob = (C + AS) / (C * Math.sqrt(m)); double norm = (1 - (m * 1.0) / maxIter); // Normalization factor return Math.min(Math.max(prob * norm, 0.0), 1.0); }
java
private double probabilityFunction(double AS, int m, int maxIter) { double prob = (C + AS) / (C * Math.sqrt(m)); double norm = (1 - (m * 1.0) / maxIter); // Normalization factor return Math.min(Math.max(prob * norm, 0.0), 1.0); }
[ "private", "double", "probabilityFunction", "(", "double", "AS", ",", "int", "m", ",", "int", "maxIter", ")", "{", "double", "prob", "=", "(", "C", "+", "AS", ")", "/", "(", "C", "*", "Math", ".", "sqrt", "(", "m", ")", ")", ";", "double", "norm", "=", "(", "1", "-", "(", "m", "*", "1.0", ")", "/", "maxIter", ")", ";", "// Normalization factor", "return", "Math", ".", "min", "(", "Math", ".", "max", "(", "prob", "*", "norm", ",", "0.0", ")", ",", "1.0", ")", ";", "}" ]
Calculates the probability of accepting a bad move given the iteration step and the score change. <p> Function: p=(C-AS)/(C*sqrt(step)) Added a normalization factor so that the probability approaches 0 when the maxIter is reached.
[ "Calculates", "the", "probability", "of", "accepting", "a", "bad", "move", "given", "the", "iteration", "step", "and", "the", "score", "change", ".", "<p", ">", "Function", ":", "p", "=", "(", "C", "-", "AS", ")", "/", "(", "C", "*", "sqrt", "(", "step", "))", "Added", "a", "normalization", "factor", "so", "that", "the", "probability", "approaches", "0", "when", "the", "maxIter", "is", "reached", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java#L827-L832
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgBlock.java
DwgBlock.readDwgBlockV15
public void readDwgBlockV15(int[] data, int offset) throws Exception { """ Read a Block in the DWG format Version 15 @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines. """ int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); Vector v = DwgUtil.getTextString(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); String text = (String)v.get(1); name = text; bitPos = readObjectTailV15(data, bitPos); }
java
public void readDwgBlockV15(int[] data, int offset) throws Exception { int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); Vector v = DwgUtil.getTextString(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); String text = (String)v.get(1); name = text; bitPos = readObjectTailV15(data, bitPos); }
[ "public", "void", "readDwgBlockV15", "(", "int", "[", "]", "data", ",", "int", "offset", ")", "throws", "Exception", "{", "int", "bitPos", "=", "offset", ";", "bitPos", "=", "readObjectHeaderV15", "(", "data", ",", "bitPos", ")", ";", "Vector", "v", "=", "DwgUtil", ".", "getTextString", "(", "data", ",", "bitPos", ")", ";", "bitPos", "=", "(", "(", "Integer", ")", "v", ".", "get", "(", "0", ")", ")", ".", "intValue", "(", ")", ";", "String", "text", "=", "(", "String", ")", "v", ".", "get", "(", "1", ")", ";", "name", "=", "text", ";", "bitPos", "=", "readObjectTailV15", "(", "data", ",", "bitPos", ")", ";", "}" ]
Read a Block in the DWG format Version 15 @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines.
[ "Read", "a", "Block", "in", "the", "DWG", "format", "Version", "15" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgBlock.java#L42-L50
Wikidata/Wikidata-Toolkit
wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java
Datamodel.makeSiteLink
public static SiteLink makeSiteLink(String title, String siteKey) { """ Creates a {@link SiteLink} without badges. @param title the title string of the linked page, including namespace prefixes if any @param siteKey the string key of the site of the linked article @return a {@link SiteLink} corresponding to the input """ return factory.getSiteLink(title, siteKey, Collections.emptyList()); }
java
public static SiteLink makeSiteLink(String title, String siteKey) { return factory.getSiteLink(title, siteKey, Collections.emptyList()); }
[ "public", "static", "SiteLink", "makeSiteLink", "(", "String", "title", ",", "String", "siteKey", ")", "{", "return", "factory", ".", "getSiteLink", "(", "title", ",", "siteKey", ",", "Collections", ".", "emptyList", "(", ")", ")", ";", "}" ]
Creates a {@link SiteLink} without badges. @param title the title string of the linked page, including namespace prefixes if any @param siteKey the string key of the site of the linked article @return a {@link SiteLink} corresponding to the input
[ "Creates", "a", "{", "@link", "SiteLink", "}", "without", "badges", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java#L577-L579
threerings/nenya
core/src/main/java/com/threerings/util/KeyboardManager.java
KeyboardManager.setTarget
public void setTarget (JComponent target, KeyTranslator xlate) { """ Initializes the keyboard manager with the supplied target component and key translator and disables the keyboard manager if it is currently active. @param target the component whose keyboard events are to be observed. @param xlate the key translator used to map keyboard events to controller action commands. """ setEnabled(false); // save off references _target = target; _xlate = xlate; }
java
public void setTarget (JComponent target, KeyTranslator xlate) { setEnabled(false); // save off references _target = target; _xlate = xlate; }
[ "public", "void", "setTarget", "(", "JComponent", "target", ",", "KeyTranslator", "xlate", ")", "{", "setEnabled", "(", "false", ")", ";", "// save off references", "_target", "=", "target", ";", "_xlate", "=", "xlate", ";", "}" ]
Initializes the keyboard manager with the supplied target component and key translator and disables the keyboard manager if it is currently active. @param target the component whose keyboard events are to be observed. @param xlate the key translator used to map keyboard events to controller action commands.
[ "Initializes", "the", "keyboard", "manager", "with", "the", "supplied", "target", "component", "and", "key", "translator", "and", "disables", "the", "keyboard", "manager", "if", "it", "is", "currently", "active", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyboardManager.java#L107-L114
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.readPropertyObject
public CmsProperty readPropertyObject(CmsResource resource, String property, boolean search) throws CmsException { """ Reads a property object from a resource specified by a property name.<p> Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p> This method is more efficient then using <code>{@link CmsObject#readPropertyObject(String, String, boolean)}</code> if you already have an instance of the resource to look up the property from.<p> @param resource the resource where the property is attached to @param property the property name @param search if true, the property is searched on all parent folders of the resource, if it's not found attached directly to the resource @return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found @throws CmsException if something goes wrong """ return m_securityManager.readPropertyObject(m_context, resource, property, search); }
java
public CmsProperty readPropertyObject(CmsResource resource, String property, boolean search) throws CmsException { return m_securityManager.readPropertyObject(m_context, resource, property, search); }
[ "public", "CmsProperty", "readPropertyObject", "(", "CmsResource", "resource", ",", "String", "property", ",", "boolean", "search", ")", "throws", "CmsException", "{", "return", "m_securityManager", ".", "readPropertyObject", "(", "m_context", ",", "resource", ",", "property", ",", "search", ")", ";", "}" ]
Reads a property object from a resource specified by a property name.<p> Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p> This method is more efficient then using <code>{@link CmsObject#readPropertyObject(String, String, boolean)}</code> if you already have an instance of the resource to look up the property from.<p> @param resource the resource where the property is attached to @param property the property name @param search if true, the property is searched on all parent folders of the resource, if it's not found attached directly to the resource @return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found @throws CmsException if something goes wrong
[ "Reads", "a", "property", "object", "from", "a", "resource", "specified", "by", "a", "property", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2899-L2902
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.addEntry
public Jar addEntry(String path, byte[] content) throws IOException { """ Adds an entry to this JAR. @param path the entry's path within the JAR @param content the entry's content @return {@code this} """ beginWriting(); addEntry(jos, path, content); return this; }
java
public Jar addEntry(String path, byte[] content) throws IOException { beginWriting(); addEntry(jos, path, content); return this; }
[ "public", "Jar", "addEntry", "(", "String", "path", ",", "byte", "[", "]", "content", ")", "throws", "IOException", "{", "beginWriting", "(", ")", ";", "addEntry", "(", "jos", ",", "path", ",", "content", ")", ";", "return", "this", ";", "}" ]
Adds an entry to this JAR. @param path the entry's path within the JAR @param content the entry's content @return {@code this}
[ "Adds", "an", "entry", "to", "this", "JAR", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L308-L312
mbenson/uelbox
src/main/java/uelbox/UEL.java
UEL.getContext
public static <T> T getContext(ELContext context, Class<T> key, T defaultValue) { """ Casts context objects per documented convention. @param <T> @param context @param key @param defaultValue @return T """ @SuppressWarnings("unchecked") final T result = (T) context.getContext(key); return result == null ? defaultValue : result; }
java
public static <T> T getContext(ELContext context, Class<T> key, T defaultValue) { @SuppressWarnings("unchecked") final T result = (T) context.getContext(key); return result == null ? defaultValue : result; }
[ "public", "static", "<", "T", ">", "T", "getContext", "(", "ELContext", "context", ",", "Class", "<", "T", ">", "key", ",", "T", "defaultValue", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "T", "result", "=", "(", "T", ")", "context", ".", "getContext", "(", "key", ")", ";", "return", "result", "==", "null", "?", "defaultValue", ":", "result", ";", "}" ]
Casts context objects per documented convention. @param <T> @param context @param key @param defaultValue @return T
[ "Casts", "context", "objects", "per", "documented", "convention", "." ]
train
https://github.com/mbenson/uelbox/blob/b0c2df2c738295bddfd3c16a916e67c9c7c512ef/src/main/java/uelbox/UEL.java#L120-L124
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.changePolymerNotation
public final static void changePolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { """ method to change the PolymerNotation at a specific position of the HELM2Notation @param position position of the PolymerNotation @param polymer new PolymerNotation @param helm2notation input HELM2Notation """ helm2notation.getListOfPolymers().set(position, polymer); }
java
public final static void changePolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { helm2notation.getListOfPolymers().set(position, polymer); }
[ "public", "final", "static", "void", "changePolymerNotation", "(", "int", "position", ",", "PolymerNotation", "polymer", ",", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfPolymers", "(", ")", ".", "set", "(", "position", ",", "polymer", ")", ";", "}" ]
method to change the PolymerNotation at a specific position of the HELM2Notation @param position position of the PolymerNotation @param polymer new PolymerNotation @param helm2notation input HELM2Notation
[ "method", "to", "change", "the", "PolymerNotation", "at", "a", "specific", "position", "of", "the", "HELM2Notation" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L380-L382
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.dateTimeTemplate
public static <T extends Comparable<?>> DateTimeTemplate<T> dateTimeTemplate(Class<? extends T> cl, Template template, Object... args) { """ Create a new Template expression @param cl type of expression @param template template @param args template parameters @return template expression """ return dateTimeTemplate(cl, template, ImmutableList.copyOf(args)); }
java
public static <T extends Comparable<?>> DateTimeTemplate<T> dateTimeTemplate(Class<? extends T> cl, Template template, Object... args) { return dateTimeTemplate(cl, template, ImmutableList.copyOf(args)); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", ">", ">", "DateTimeTemplate", "<", "T", ">", "dateTimeTemplate", "(", "Class", "<", "?", "extends", "T", ">", "cl", ",", "Template", "template", ",", "Object", "...", "args", ")", "{", "return", "dateTimeTemplate", "(", "cl", ",", "template", ",", "ImmutableList", ".", "copyOf", "(", "args", ")", ")", ";", "}" ]
Create a new Template expression @param cl type of expression @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L603-L606
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/api/Database.java
Database.getPermissions
public Map<String, EnumSet<Permissions>> getPermissions() { """ Returns the Permissions of this database. <p> Note this method is only applicable to databases that support the <a target="_blank" href="https://console.bluemix.net/docs/services/Cloudant/api/authorization.html#authorization"> Cloudant authorization API </a> such as Cloudant DBaaS. For unsupported databases consider using the /db/_security endpoint. </p> @return the map of userNames to their Permissions @throws UnsupportedOperationException if called on a database that does not provide the Cloudant authorization API @see <a href="https://console.bluemix.net/docs/services/Cloudant/api/authorization.html#roles" target="_blank">Roles</a> @see <a href="https://console.bluemix.net/docs/services/Cloudant/api/authorization.html#viewing-permissions" target="_blank">Viewing permissions</a> """ JsonObject perms = getPermissionsObject(); return client.getGson().getAdapter(DeserializationTypes.PERMISSIONS_MAP_TOKEN).fromJsonTree (perms); }
java
public Map<String, EnumSet<Permissions>> getPermissions() { JsonObject perms = getPermissionsObject(); return client.getGson().getAdapter(DeserializationTypes.PERMISSIONS_MAP_TOKEN).fromJsonTree (perms); }
[ "public", "Map", "<", "String", ",", "EnumSet", "<", "Permissions", ">", ">", "getPermissions", "(", ")", "{", "JsonObject", "perms", "=", "getPermissionsObject", "(", ")", ";", "return", "client", ".", "getGson", "(", ")", ".", "getAdapter", "(", "DeserializationTypes", ".", "PERMISSIONS_MAP_TOKEN", ")", ".", "fromJsonTree", "(", "perms", ")", ";", "}" ]
Returns the Permissions of this database. <p> Note this method is only applicable to databases that support the <a target="_blank" href="https://console.bluemix.net/docs/services/Cloudant/api/authorization.html#authorization"> Cloudant authorization API </a> such as Cloudant DBaaS. For unsupported databases consider using the /db/_security endpoint. </p> @return the map of userNames to their Permissions @throws UnsupportedOperationException if called on a database that does not provide the Cloudant authorization API @see <a href="https://console.bluemix.net/docs/services/Cloudant/api/authorization.html#roles" target="_blank">Roles</a> @see <a href="https://console.bluemix.net/docs/services/Cloudant/api/authorization.html#viewing-permissions" target="_blank">Viewing permissions</a>
[ "Returns", "the", "Permissions", "of", "this", "database", ".", "<p", ">", "Note", "this", "method", "is", "only", "applicable", "to", "databases", "that", "support", "the", "<a", "target", "=", "_blank", "href", "=", "https", ":", "//", "console", ".", "bluemix", ".", "net", "/", "docs", "/", "services", "/", "Cloudant", "/", "api", "/", "authorization", ".", "html#authorization", ">", "Cloudant", "authorization", "API", "<", "/", "a", ">", "such", "as", "Cloudant", "DBaaS", ".", "For", "unsupported", "databases", "consider", "using", "the", "/", "db", "/", "_security", "endpoint", ".", "<", "/", "p", ">" ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L230-L234
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java
URLTemplate.substitute
public void substitute( String token, int value ) { """ Replace a single token in the template with a corresponding int value. Tokens are expected to be qualified in braces. E.g. {url:port} """ String valueStr = Integer.toString( value ); _tokenValuesMap.put( token, valueStr ); }
java
public void substitute( String token, int value ) { String valueStr = Integer.toString( value ); _tokenValuesMap.put( token, valueStr ); }
[ "public", "void", "substitute", "(", "String", "token", ",", "int", "value", ")", "{", "String", "valueStr", "=", "Integer", ".", "toString", "(", "value", ")", ";", "_tokenValuesMap", ".", "put", "(", "token", ",", "valueStr", ")", ";", "}" ]
Replace a single token in the template with a corresponding int value. Tokens are expected to be qualified in braces. E.g. {url:port}
[ "Replace", "a", "single", "token", "in", "the", "template", "with", "a", "corresponding", "int", "value", ".", "Tokens", "are", "expected", "to", "be", "qualified", "in", "braces", ".", "E", ".", "g", ".", "{", "url", ":", "port", "}" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java#L258-L262
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_GET
public OvhDHCPStaticAddress serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_GET(String serviceName, String lanName, String dhcpName, String MACAddress) throws IOException { """ Get this object properties REST: GET /xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress} @param serviceName [required] The internal name of your XDSL offer @param lanName [required] Name of the LAN @param dhcpName [required] Name of the DHCP @param MACAddress [required] The MAC address of the device """ String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}"; StringBuilder sb = path(qPath, serviceName, lanName, dhcpName, MACAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDHCPStaticAddress.class); }
java
public OvhDHCPStaticAddress serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_GET(String serviceName, String lanName, String dhcpName, String MACAddress) throws IOException { String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}"; StringBuilder sb = path(qPath, serviceName, lanName, dhcpName, MACAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDHCPStaticAddress.class); }
[ "public", "OvhDHCPStaticAddress", "serviceName_modem_lan_lanName_dhcp_dhcpName_DHCPStaticAddresses_MACAddress_GET", "(", "String", "serviceName", ",", "String", "lanName", ",", "String", "dhcpName", ",", "String", "MACAddress", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "lanName", ",", "dhcpName", ",", "MACAddress", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhDHCPStaticAddress", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}/DHCPStaticAddresses/{MACAddress} @param serviceName [required] The internal name of your XDSL offer @param lanName [required] Name of the LAN @param dhcpName [required] Name of the DHCP @param MACAddress [required] The MAC address of the device
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1090-L1095
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaNonTransactionalDispatcher.java
SibRaNonTransactionalDispatcher.beforeDelivery
protected final void beforeDelivery(final SIBusMessage message, MessageEndpoint endpoint) { """ Invoked before delivery of a message. @param message the message that is about to be delivered @param endpoint The messaage endpoint """ if (TRACE.isEntryEnabled()) { final String methodName = "beforeDelivery"; SibTr.entry(this, TRACE, methodName, new Object [] { message, endpoint}); SibTr.exit(this, TRACE, methodName); } }
java
protected final void beforeDelivery(final SIBusMessage message, MessageEndpoint endpoint) { if (TRACE.isEntryEnabled()) { final String methodName = "beforeDelivery"; SibTr.entry(this, TRACE, methodName, new Object [] { message, endpoint}); SibTr.exit(this, TRACE, methodName); } }
[ "protected", "final", "void", "beforeDelivery", "(", "final", "SIBusMessage", "message", ",", "MessageEndpoint", "endpoint", ")", "{", "if", "(", "TRACE", ".", "isEntryEnabled", "(", ")", ")", "{", "final", "String", "methodName", "=", "\"beforeDelivery\"", ";", "SibTr", ".", "entry", "(", "this", ",", "TRACE", ",", "methodName", ",", "new", "Object", "[", "]", "{", "message", ",", "endpoint", "}", ")", ";", "SibTr", ".", "exit", "(", "this", ",", "TRACE", ",", "methodName", ")", ";", "}", "}" ]
Invoked before delivery of a message. @param message the message that is about to be delivered @param endpoint The messaage endpoint
[ "Invoked", "before", "delivery", "of", "a", "message", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaNonTransactionalDispatcher.java#L146-L154
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.importKey
public KeyBundle importKey(String vaultBaseUrl, String keyName, JsonWebKey key, Boolean hsm, KeyAttributes keyAttributes, Map<String, String> tags) { """ Imports an externally created key, stores it, and returns key parameters and attributes to the client. The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName Name for the imported key. @param key The Json web key @param hsm Whether to import as a hardware key (HSM) or software key. @param keyAttributes The key management attributes. @param tags Application specific metadata in the form of key-value pairs. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyBundle object if successful. """ return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key, hsm, keyAttributes, tags).toBlocking().single().body(); }
java
public KeyBundle importKey(String vaultBaseUrl, String keyName, JsonWebKey key, Boolean hsm, KeyAttributes keyAttributes, Map<String, String> tags) { return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key, hsm, keyAttributes, tags).toBlocking().single().body(); }
[ "public", "KeyBundle", "importKey", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "JsonWebKey", "key", ",", "Boolean", "hsm", ",", "KeyAttributes", "keyAttributes", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "importKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "key", ",", "hsm", ",", "keyAttributes", ",", "tags", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Imports an externally created key, stores it, and returns key parameters and attributes to the client. The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName Name for the imported key. @param key The Json web key @param hsm Whether to import as a hardware key (HSM) or software key. @param keyAttributes The key management attributes. @param tags Application specific metadata in the form of key-value pairs. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyBundle object if successful.
[ "Imports", "an", "externally", "created", "key", "stores", "it", "and", "returns", "key", "parameters", "and", "attributes", "to", "the", "client", ".", "The", "import", "key", "operation", "may", "be", "used", "to", "import", "any", "key", "type", "into", "an", "Azure", "Key", "Vault", ".", "If", "the", "named", "key", "already", "exists", "Azure", "Key", "Vault", "creates", "a", "new", "version", "of", "the", "key", ".", "This", "operation", "requires", "the", "keys", "/", "import", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L976-L978
jinahya/bit-io
src/main/java/com/github/jinahya/bit/io/AbstractBitOutput.java
AbstractBitOutput.unsigned16
protected void unsigned16(final int size, final int value) throws IOException { """ Writes an unsigned value whose size is {@value Short#SIZE} in maximum. @param size the number of lower bits to write; between {@code 1} and {@value Short#SIZE}, both inclusive. @param value the value to write @throws IOException if an I/O error occurs """ requireValidSizeUnsigned16(size); final int quotient = size / Byte.SIZE; final int remainder = size % Byte.SIZE; if (remainder > 0) { unsigned8(remainder, value >> (quotient * Byte.SIZE)); } for (int i = quotient - 1; i >= 0; i--) { unsigned8(Byte.SIZE, value >> (Byte.SIZE * i)); } }
java
protected void unsigned16(final int size, final int value) throws IOException { requireValidSizeUnsigned16(size); final int quotient = size / Byte.SIZE; final int remainder = size % Byte.SIZE; if (remainder > 0) { unsigned8(remainder, value >> (quotient * Byte.SIZE)); } for (int i = quotient - 1; i >= 0; i--) { unsigned8(Byte.SIZE, value >> (Byte.SIZE * i)); } }
[ "protected", "void", "unsigned16", "(", "final", "int", "size", ",", "final", "int", "value", ")", "throws", "IOException", "{", "requireValidSizeUnsigned16", "(", "size", ")", ";", "final", "int", "quotient", "=", "size", "/", "Byte", ".", "SIZE", ";", "final", "int", "remainder", "=", "size", "%", "Byte", ".", "SIZE", ";", "if", "(", "remainder", ">", "0", ")", "{", "unsigned8", "(", "remainder", ",", "value", ">>", "(", "quotient", "*", "Byte", ".", "SIZE", ")", ")", ";", "}", "for", "(", "int", "i", "=", "quotient", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "unsigned8", "(", "Byte", ".", "SIZE", ",", "value", ">>", "(", "Byte", ".", "SIZE", "*", "i", ")", ")", ";", "}", "}" ]
Writes an unsigned value whose size is {@value Short#SIZE} in maximum. @param size the number of lower bits to write; between {@code 1} and {@value Short#SIZE}, both inclusive. @param value the value to write @throws IOException if an I/O error occurs
[ "Writes", "an", "unsigned", "value", "whose", "size", "is", "{", "@value", "Short#SIZE", "}", "in", "maximum", "." ]
train
https://github.com/jinahya/bit-io/blob/f3b49bbec80047c0cc3ea2424def98eb2d08352a/src/main/java/com/github/jinahya/bit/io/AbstractBitOutput.java#L86-L96
kuali/ojb-1.0.4
src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java
RollbackBean.rollbackClientWrongInput
public void rollbackClientWrongInput(List articles, List persons) { """ This test method expect an invalid object in the person list, so that OJB cause an internal error. @ejb:interface-method """ log.info("rollbackClientWrongInput method was called"); ArticleManagerPBLocal am = getArticleManager(); PersonManagerPBLocal pm = getPersonManager(); am.storeArticles(articles); pm.storePersons(persons); }
java
public void rollbackClientWrongInput(List articles, List persons) { log.info("rollbackClientWrongInput method was called"); ArticleManagerPBLocal am = getArticleManager(); PersonManagerPBLocal pm = getPersonManager(); am.storeArticles(articles); pm.storePersons(persons); }
[ "public", "void", "rollbackClientWrongInput", "(", "List", "articles", ",", "List", "persons", ")", "{", "log", ".", "info", "(", "\"rollbackClientWrongInput method was called\"", ")", ";", "ArticleManagerPBLocal", "am", "=", "getArticleManager", "(", ")", ";", "PersonManagerPBLocal", "pm", "=", "getPersonManager", "(", ")", ";", "am", ".", "storeArticles", "(", "articles", ")", ";", "pm", ".", "storePersons", "(", "persons", ")", ";", "}" ]
This test method expect an invalid object in the person list, so that OJB cause an internal error. @ejb:interface-method
[ "This", "test", "method", "expect", "an", "invalid", "object", "in", "the", "person", "list", "so", "that", "OJB", "cause", "an", "internal", "error", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java#L132-L139
redbox-mint/redbox
plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java
CurationManager.scheduleTransformers
private void scheduleTransformers(JsonSimple message, JsonSimple response) { """ Generate orders for the list of normal transformers scheduled to execute on the tool chain @param message The incoming message, which contains the tool chain config for this object @param response The response to edit @param oid The object to schedule for clearing """ String oid = message.getString(null, "oid"); List<String> list = message.getStringList("transformer", "metadata"); if (list != null && !list.isEmpty()) { for (String id : list) { JsonObject order = newTransform(response, id, oid); // Add item config to message... if it exists JsonObject itemConfig = message.getObject( "transformerOverrides", id); if (itemConfig != null) { JsonObject config = (JsonObject) order.get("config"); config.putAll(itemConfig); } } } }
java
private void scheduleTransformers(JsonSimple message, JsonSimple response) { String oid = message.getString(null, "oid"); List<String> list = message.getStringList("transformer", "metadata"); if (list != null && !list.isEmpty()) { for (String id : list) { JsonObject order = newTransform(response, id, oid); // Add item config to message... if it exists JsonObject itemConfig = message.getObject( "transformerOverrides", id); if (itemConfig != null) { JsonObject config = (JsonObject) order.get("config"); config.putAll(itemConfig); } } } }
[ "private", "void", "scheduleTransformers", "(", "JsonSimple", "message", ",", "JsonSimple", "response", ")", "{", "String", "oid", "=", "message", ".", "getString", "(", "null", ",", "\"oid\"", ")", ";", "List", "<", "String", ">", "list", "=", "message", ".", "getStringList", "(", "\"transformer\"", ",", "\"metadata\"", ")", ";", "if", "(", "list", "!=", "null", "&&", "!", "list", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "String", "id", ":", "list", ")", "{", "JsonObject", "order", "=", "newTransform", "(", "response", ",", "id", ",", "oid", ")", ";", "// Add item config to message... if it exists", "JsonObject", "itemConfig", "=", "message", ".", "getObject", "(", "\"transformerOverrides\"", ",", "id", ")", ";", "if", "(", "itemConfig", "!=", "null", ")", "{", "JsonObject", "config", "=", "(", "JsonObject", ")", "order", ".", "get", "(", "\"config\"", ")", ";", "config", ".", "putAll", "(", "itemConfig", ")", ";", "}", "}", "}", "}" ]
Generate orders for the list of normal transformers scheduled to execute on the tool chain @param message The incoming message, which contains the tool chain config for this object @param response The response to edit @param oid The object to schedule for clearing
[ "Generate", "orders", "for", "the", "list", "of", "normal", "transformers", "scheduled", "to", "execute", "on", "the", "tool", "chain" ]
train
https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java#L1616-L1631
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java
UserResources.checkOauthAccess
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/check_oauth_access") @Description("Returns redirectURI based on whether this user has previously accepted the authorization page") public OAuthAcceptResponseDto checkOauthAccess(@Context HttpServletRequest req) { """ Returns redirectURI based on whether this user has previously accepted the authorization page @param req The Http Request with authorization header @return Returns either redirectURI or OauthException """ String userName=findUserByToken(req); int result = authService.countByUserId(userName); OAuthAcceptResponseDto responseDto = new OAuthAcceptResponseDto(); if (result==0) { throw new OAuthException(ResponseCodes.ERR_FINDING_USERNAME, HttpResponseStatus.BAD_REQUEST); } else { responseDto.setRedirectURI(applicationRedirectURI); return responseDto; } }
java
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/check_oauth_access") @Description("Returns redirectURI based on whether this user has previously accepted the authorization page") public OAuthAcceptResponseDto checkOauthAccess(@Context HttpServletRequest req) { String userName=findUserByToken(req); int result = authService.countByUserId(userName); OAuthAcceptResponseDto responseDto = new OAuthAcceptResponseDto(); if (result==0) { throw new OAuthException(ResponseCodes.ERR_FINDING_USERNAME, HttpResponseStatus.BAD_REQUEST); } else { responseDto.setRedirectURI(applicationRedirectURI); return responseDto; } }
[ "@", "GET", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Path", "(", "\"/check_oauth_access\"", ")", "@", "Description", "(", "\"Returns redirectURI based on whether this user has previously accepted the authorization page\"", ")", "public", "OAuthAcceptResponseDto", "checkOauthAccess", "(", "@", "Context", "HttpServletRequest", "req", ")", "{", "String", "userName", "=", "findUserByToken", "(", "req", ")", ";", "int", "result", "=", "authService", ".", "countByUserId", "(", "userName", ")", ";", "OAuthAcceptResponseDto", "responseDto", "=", "new", "OAuthAcceptResponseDto", "(", ")", ";", "if", "(", "result", "==", "0", ")", "{", "throw", "new", "OAuthException", "(", "ResponseCodes", ".", "ERR_FINDING_USERNAME", ",", "HttpResponseStatus", ".", "BAD_REQUEST", ")", ";", "}", "else", "{", "responseDto", ".", "setRedirectURI", "(", "applicationRedirectURI", ")", ";", "return", "responseDto", ";", "}", "}" ]
Returns redirectURI based on whether this user has previously accepted the authorization page @param req The Http Request with authorization header @return Returns either redirectURI or OauthException
[ "Returns", "redirectURI", "based", "on", "whether", "this", "user", "has", "previously", "accepted", "the", "authorization", "page" ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java#L388-L403
ACRA/acra
acra-core/src/main/java/org/acra/collector/ReflectionCollector.java
ReflectionCollector.collectConstants
private static void collectConstants(@NonNull Class<?> someClass, @NonNull JSONObject container) throws JSONException { """ Retrieves key/value pairs from static fields of a class. @param someClass the class to be inspected. """ final Field[] fields = someClass.getFields(); for (final Field field : fields) { try { final Object value = field.get(null); if (value != null) { if (field.getType().isArray()) { container.put(field.getName(), new JSONArray(Arrays.asList((Object[]) value))); } else { container.put(field.getName(), value); } } } catch (IllegalArgumentException ignored) { // NOOP } catch (IllegalAccessException ignored) { // NOOP } } }
java
private static void collectConstants(@NonNull Class<?> someClass, @NonNull JSONObject container) throws JSONException { final Field[] fields = someClass.getFields(); for (final Field field : fields) { try { final Object value = field.get(null); if (value != null) { if (field.getType().isArray()) { container.put(field.getName(), new JSONArray(Arrays.asList((Object[]) value))); } else { container.put(field.getName(), value); } } } catch (IllegalArgumentException ignored) { // NOOP } catch (IllegalAccessException ignored) { // NOOP } } }
[ "private", "static", "void", "collectConstants", "(", "@", "NonNull", "Class", "<", "?", ">", "someClass", ",", "@", "NonNull", "JSONObject", "container", ")", "throws", "JSONException", "{", "final", "Field", "[", "]", "fields", "=", "someClass", ".", "getFields", "(", ")", ";", "for", "(", "final", "Field", "field", ":", "fields", ")", "{", "try", "{", "final", "Object", "value", "=", "field", ".", "get", "(", "null", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "field", ".", "getType", "(", ")", ".", "isArray", "(", ")", ")", "{", "container", ".", "put", "(", "field", ".", "getName", "(", ")", ",", "new", "JSONArray", "(", "Arrays", ".", "asList", "(", "(", "Object", "[", "]", ")", "value", ")", ")", ")", ";", "}", "else", "{", "container", ".", "put", "(", "field", ".", "getName", "(", ")", ",", "value", ")", ";", "}", "}", "}", "catch", "(", "IllegalArgumentException", "ignored", ")", "{", "// NOOP", "}", "catch", "(", "IllegalAccessException", "ignored", ")", "{", "// NOOP", "}", "}", "}" ]
Retrieves key/value pairs from static fields of a class. @param someClass the class to be inspected.
[ "Retrieves", "key", "/", "value", "pairs", "from", "static", "fields", "of", "a", "class", "." ]
train
https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/collector/ReflectionCollector.java#L82-L100
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Mapper.java
Mapper.mapValues
public static Map mapValues(Mapper mapper, Map map) { """ Create a new Map by mapping all values from the original map and maintaining the original key. @param mapper a Mapper to map the values @param map an Map @return a new Map with values mapped """ return mapValues(mapper, map, false); }
java
public static Map mapValues(Mapper mapper, Map map) { return mapValues(mapper, map, false); }
[ "public", "static", "Map", "mapValues", "(", "Mapper", "mapper", ",", "Map", "map", ")", "{", "return", "mapValues", "(", "mapper", ",", "map", ",", "false", ")", ";", "}" ]
Create a new Map by mapping all values from the original map and maintaining the original key. @param mapper a Mapper to map the values @param map an Map @return a new Map with values mapped
[ "Create", "a", "new", "Map", "by", "mapping", "all", "values", "from", "the", "original", "map", "and", "maintaining", "the", "original", "key", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L410-L412
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_reinstall_POST
public OvhTask serviceName_reinstall_POST(String serviceName, Boolean doNotSendPassword, String language, Long[] softwareId, String[] sshKey, Long templateId) throws IOException { """ Reinstall the virtual server REST: POST /vps/{serviceName}/reinstall @param doNotSendPassword [required] If asked, the installation password will NOT be sent (only if sshKey defined) @param softwareId [required] Id of the vps.Software type fetched in /template/{id}/software @param language [required] Distribution language. default : en @param templateId [required] Id of the vps.Template fetched in /templates list @param sshKey [required] SSH key names to pre-install on your VPS (name from /me/sshKey) @param serviceName [required] The internal name of your VPS offer """ String qPath = "/vps/{serviceName}/reinstall"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "doNotSendPassword", doNotSendPassword); addBody(o, "language", language); addBody(o, "softwareId", softwareId); addBody(o, "sshKey", sshKey); addBody(o, "templateId", templateId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_reinstall_POST(String serviceName, Boolean doNotSendPassword, String language, Long[] softwareId, String[] sshKey, Long templateId) throws IOException { String qPath = "/vps/{serviceName}/reinstall"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "doNotSendPassword", doNotSendPassword); addBody(o, "language", language); addBody(o, "softwareId", softwareId); addBody(o, "sshKey", sshKey); addBody(o, "templateId", templateId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_reinstall_POST", "(", "String", "serviceName", ",", "Boolean", "doNotSendPassword", ",", "String", "language", ",", "Long", "[", "]", "softwareId", ",", "String", "[", "]", "sshKey", ",", "Long", "templateId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vps/{serviceName}/reinstall\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"doNotSendPassword\"", ",", "doNotSendPassword", ")", ";", "addBody", "(", "o", ",", "\"language\"", ",", "language", ")", ";", "addBody", "(", "o", ",", "\"softwareId\"", ",", "softwareId", ")", ";", "addBody", "(", "o", ",", "\"sshKey\"", ",", "sshKey", ")", ";", "addBody", "(", "o", ",", "\"templateId\"", ",", "templateId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Reinstall the virtual server REST: POST /vps/{serviceName}/reinstall @param doNotSendPassword [required] If asked, the installation password will NOT be sent (only if sshKey defined) @param softwareId [required] Id of the vps.Software type fetched in /template/{id}/software @param language [required] Distribution language. default : en @param templateId [required] Id of the vps.Template fetched in /templates list @param sshKey [required] SSH key names to pre-install on your VPS (name from /me/sshKey) @param serviceName [required] The internal name of your VPS offer
[ "Reinstall", "the", "virtual", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L84-L95
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryTreeDump.java
QueryTreeDump.appendPath
private static void appendPath(QPath relPath, StringBuilder buffer) { """ Appends the relative path to the <code>buffer</code> using '/' as the delimiter for path elements. @param relPath a relative path. @param buffer the buffer where to append the path. """ QPathEntry[] elements = relPath.getEntries(); String slash = ""; for (int i = 0; i < elements.length; i++) { buffer.append(slash); slash = "/"; buffer.append(elements[i].getAsString(true)); } }
java
private static void appendPath(QPath relPath, StringBuilder buffer) { QPathEntry[] elements = relPath.getEntries(); String slash = ""; for (int i = 0; i < elements.length; i++) { buffer.append(slash); slash = "/"; buffer.append(elements[i].getAsString(true)); } }
[ "private", "static", "void", "appendPath", "(", "QPath", "relPath", ",", "StringBuilder", "buffer", ")", "{", "QPathEntry", "[", "]", "elements", "=", "relPath", ".", "getEntries", "(", ")", ";", "String", "slash", "=", "\"\"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "slash", ")", ";", "slash", "=", "\"/\"", ";", "buffer", ".", "append", "(", "elements", "[", "i", "]", ".", "getAsString", "(", "true", ")", ")", ";", "}", "}" ]
Appends the relative path to the <code>buffer</code> using '/' as the delimiter for path elements. @param relPath a relative path. @param buffer the buffer where to append the path.
[ "Appends", "the", "relative", "path", "to", "the", "<code", ">", "buffer<", "/", "code", ">", "using", "/", "as", "the", "delimiter", "for", "path", "elements", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryTreeDump.java#L307-L315
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java
CPDefinitionLinkPersistenceImpl.fetchByC_C_T
@Override public CPDefinitionLink fetchByC_C_T(long CPDefinitionId, long CProductId, String type) { """ Returns the cp definition link where CPDefinitionId = &#63; and CProductId = &#63; and type = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param CPDefinitionId the cp definition ID @param CProductId the c product ID @param type the type @return the matching cp definition link, or <code>null</code> if a matching cp definition link could not be found """ return fetchByC_C_T(CPDefinitionId, CProductId, type, true); }
java
@Override public CPDefinitionLink fetchByC_C_T(long CPDefinitionId, long CProductId, String type) { return fetchByC_C_T(CPDefinitionId, CProductId, type, true); }
[ "@", "Override", "public", "CPDefinitionLink", "fetchByC_C_T", "(", "long", "CPDefinitionId", ",", "long", "CProductId", ",", "String", "type", ")", "{", "return", "fetchByC_C_T", "(", "CPDefinitionId", ",", "CProductId", ",", "type", ",", "true", ")", ";", "}" ]
Returns the cp definition link where CPDefinitionId = &#63; and CProductId = &#63; and type = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param CPDefinitionId the cp definition ID @param CProductId the c product ID @param type the type @return the matching cp definition link, or <code>null</code> if a matching cp definition link could not be found
[ "Returns", "the", "cp", "definition", "link", "where", "CPDefinitionId", "=", "&#63", ";", "and", "CProductId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "cache", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L3762-L3766
buyi/RecyclerViewPagerIndicator
recycler-viewpager-indicator/src/main/java/com/viewpagerindicator/as/library/pageview/RecyclerViewHeader.java
RecyclerViewHeader.fromXml
public static RecyclerViewHeader fromXml(Context context, @LayoutRes int layoutRes) { """ Inflates layout from <code>xml</code> and encapsulates it with <code>RecyclerViewHeader</code>. @param context application context. @param layoutRes layout resource to be inflated. @return <code>RecyclerViewHeader</code> view object. """ RecyclerViewHeader header = new RecyclerViewHeader(context); View.inflate(context, layoutRes, header); return header; }
java
public static RecyclerViewHeader fromXml(Context context, @LayoutRes int layoutRes) { RecyclerViewHeader header = new RecyclerViewHeader(context); View.inflate(context, layoutRes, header); return header; }
[ "public", "static", "RecyclerViewHeader", "fromXml", "(", "Context", "context", ",", "@", "LayoutRes", "int", "layoutRes", ")", "{", "RecyclerViewHeader", "header", "=", "new", "RecyclerViewHeader", "(", "context", ")", ";", "View", ".", "inflate", "(", "context", ",", "layoutRes", ",", "header", ")", ";", "return", "header", ";", "}" ]
Inflates layout from <code>xml</code> and encapsulates it with <code>RecyclerViewHeader</code>. @param context application context. @param layoutRes layout resource to be inflated. @return <code>RecyclerViewHeader</code> view object.
[ "Inflates", "layout", "from", "<code", ">", "xml<", "/", "code", ">", "and", "encapsulates", "it", "with", "<code", ">", "RecyclerViewHeader<", "/", "code", ">", "." ]
train
https://github.com/buyi/RecyclerViewPagerIndicator/blob/b3b5283801b60d40f7325c7f590c945262194fad/recycler-viewpager-indicator/src/main/java/com/viewpagerindicator/as/library/pageview/RecyclerViewHeader.java#L69-L73
beders/Resty
src/main/java/us/monoid/util/EncoderUtil.java
EncoderUtil.encodeHeaderParameter
public static String encodeHeaderParameter(String name, String value) { """ Encodes the specified strings into a header parameter as described in RFC 2045 section 5.1 and RFC 2183 section 2. The specified strings should not contain any illegal (control or non-ASCII) characters. @param name parameter name. @param value parameter value. @return encoded result. """ name = name.toLowerCase(Locale.US); // value := token / quoted-string if (isToken(value)) { return name + "=" + value; } else { return name + "=" + quote(value); } }
java
public static String encodeHeaderParameter(String name, String value) { name = name.toLowerCase(Locale.US); // value := token / quoted-string if (isToken(value)) { return name + "=" + value; } else { return name + "=" + quote(value); } }
[ "public", "static", "String", "encodeHeaderParameter", "(", "String", "name", ",", "String", "value", ")", "{", "name", "=", "name", ".", "toLowerCase", "(", "Locale", ".", "US", ")", ";", "// value := token / quoted-string", "if", "(", "isToken", "(", "value", ")", ")", "{", "return", "name", "+", "\"=\"", "+", "value", ";", "}", "else", "{", "return", "name", "+", "\"=\"", "+", "quote", "(", "value", ")", ";", "}", "}" ]
Encodes the specified strings into a header parameter as described in RFC 2045 section 5.1 and RFC 2183 section 2. The specified strings should not contain any illegal (control or non-ASCII) characters. @param name parameter name. @param value parameter value. @return encoded result.
[ "Encodes", "the", "specified", "strings", "into", "a", "header", "parameter", "as", "described", "in", "RFC", "2045", "section", "5", ".", "1", "and", "RFC", "2183", "section", "2", ".", "The", "specified", "strings", "should", "not", "contain", "any", "illegal", "(", "control", "or", "non", "-", "ASCII", ")", "characters", "." ]
train
https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L164-L173
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/ModuleInitDataFactory.java
ModuleInitDataFactory.getManagedBeansInternalEJBName
private String getManagedBeansInternalEJBName(ClassInfo classInfo, AnnotationInfo managedBeanAnn) { """ Return the ManagedBean name to be used internally by the EJBContainer. The internal ManagedBean name is the value on the annotation (which must be unique even compared to EJBs in the module) or the class name of the ManagedBean with a $ prefix. This is done for two reasons: 1 - when a name is not specified, our internal derived name cannot conflict with other EJB names that happen to be the same. 2 - when a name is not specified, the managed bean is not supposed to be bound into naming... the '$' will tip off the binding code. '$' is used for consistency with JDK synthesized names. """ String name = getStringValue(managedBeanAnn, "value"); if (name == null) { name = '$' + classInfo.getName(); } return name; }
java
private String getManagedBeansInternalEJBName(ClassInfo classInfo, AnnotationInfo managedBeanAnn) { String name = getStringValue(managedBeanAnn, "value"); if (name == null) { name = '$' + classInfo.getName(); } return name; }
[ "private", "String", "getManagedBeansInternalEJBName", "(", "ClassInfo", "classInfo", ",", "AnnotationInfo", "managedBeanAnn", ")", "{", "String", "name", "=", "getStringValue", "(", "managedBeanAnn", ",", "\"value\"", ")", ";", "if", "(", "name", "==", "null", ")", "{", "name", "=", "'", "'", "+", "classInfo", ".", "getName", "(", ")", ";", "}", "return", "name", ";", "}" ]
Return the ManagedBean name to be used internally by the EJBContainer. The internal ManagedBean name is the value on the annotation (which must be unique even compared to EJBs in the module) or the class name of the ManagedBean with a $ prefix. This is done for two reasons: 1 - when a name is not specified, our internal derived name cannot conflict with other EJB names that happen to be the same. 2 - when a name is not specified, the managed bean is not supposed to be bound into naming... the '$' will tip off the binding code. '$' is used for consistency with JDK synthesized names.
[ "Return", "the", "ManagedBean", "name", "to", "be", "used", "internally", "by", "the", "EJBContainer", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/ModuleInitDataFactory.java#L882-L888
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCRUserListAccess.java
JCRUserListAccess.reuseIterator
protected void reuseIterator(Session session, int newPosition) throws RepositoryException { """ Check if possible to reuse current iterator (which means possibility to fetch next nodes in row). Otherwise the new one will be created. """ if (!(canReuseIterator() && iterator != null && iterator.getPosition() == newPosition)) { iterator = createIterator(session); iterator.skip(newPosition); } }
java
protected void reuseIterator(Session session, int newPosition) throws RepositoryException { if (!(canReuseIterator() && iterator != null && iterator.getPosition() == newPosition)) { iterator = createIterator(session); iterator.skip(newPosition); } }
[ "protected", "void", "reuseIterator", "(", "Session", "session", ",", "int", "newPosition", ")", "throws", "RepositoryException", "{", "if", "(", "!", "(", "canReuseIterator", "(", ")", "&&", "iterator", "!=", "null", "&&", "iterator", ".", "getPosition", "(", ")", "==", "newPosition", ")", ")", "{", "iterator", "=", "createIterator", "(", "session", ")", ";", "iterator", ".", "skip", "(", "newPosition", ")", ";", "}", "}" ]
Check if possible to reuse current iterator (which means possibility to fetch next nodes in row). Otherwise the new one will be created.
[ "Check", "if", "possible", "to", "reuse", "current", "iterator", "(", "which", "means", "possibility", "to", "fetch", "next", "nodes", "in", "row", ")", ".", "Otherwise", "the", "new", "one", "will", "be", "created", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/JCRUserListAccess.java#L161-L168
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java
AnnotationUtils.getValue
public static Object getValue(Annotation annotation, String attributeName) { """ Retrieve the <em>value</em> of a named attribute, given an annotation instance. @param annotation the annotation instance from which to retrieve the value @param attributeName the name of the attribute value to retrieve @return the attribute value, or {@code null} if not found @see #getValue(Annotation) """ if (annotation == null || !StringUtils.hasLength(attributeName)) { return null; } try { Method method = annotation.annotationType().getDeclaredMethod(attributeName); ReflectionUtils.makeAccessible(method); return method.invoke(annotation); } catch (Exception ex) { return null; } }
java
public static Object getValue(Annotation annotation, String attributeName) { if (annotation == null || !StringUtils.hasLength(attributeName)) { return null; } try { Method method = annotation.annotationType().getDeclaredMethod(attributeName); ReflectionUtils.makeAccessible(method); return method.invoke(annotation); } catch (Exception ex) { return null; } }
[ "public", "static", "Object", "getValue", "(", "Annotation", "annotation", ",", "String", "attributeName", ")", "{", "if", "(", "annotation", "==", "null", "||", "!", "StringUtils", ".", "hasLength", "(", "attributeName", ")", ")", "{", "return", "null", ";", "}", "try", "{", "Method", "method", "=", "annotation", ".", "annotationType", "(", ")", ".", "getDeclaredMethod", "(", "attributeName", ")", ";", "ReflectionUtils", ".", "makeAccessible", "(", "method", ")", ";", "return", "method", ".", "invoke", "(", "annotation", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "return", "null", ";", "}", "}" ]
Retrieve the <em>value</em> of a named attribute, given an annotation instance. @param annotation the annotation instance from which to retrieve the value @param attributeName the name of the attribute value to retrieve @return the attribute value, or {@code null} if not found @see #getValue(Annotation)
[ "Retrieve", "the", "<em", ">", "value<", "/", "em", ">", "of", "a", "named", "attribute", "given", "an", "annotation", "instance", "." ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L636-L648
morimekta/providence
it-serialization/src/main/java/net/morimekta/providence/it/serialization/FormatStatistics.java
FormatStatistics.colorHeader
public static String colorHeader() { """ Header string that matches the asString output. @return The asString header. """ return Color.BOLD + HEADER_L1 + "\n" + new Color(Color.YELLOW, Color.UNDERLINE) + HEADER_L2 + " " + Color.CLEAR; }
java
public static String colorHeader() { return Color.BOLD + HEADER_L1 + "\n" + new Color(Color.YELLOW, Color.UNDERLINE) + HEADER_L2 + " " + Color.CLEAR; }
[ "public", "static", "String", "colorHeader", "(", ")", "{", "return", "Color", ".", "BOLD", "+", "HEADER_L1", "+", "\"\\n\"", "+", "new", "Color", "(", "Color", ".", "YELLOW", ",", "Color", ".", "UNDERLINE", ")", "+", "HEADER_L2", "+", "\" \"", "+", "Color", ".", "CLEAR", ";", "}" ]
Header string that matches the asString output. @return The asString header.
[ "Header", "string", "that", "matches", "the", "asString", "output", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/it-serialization/src/main/java/net/morimekta/providence/it/serialization/FormatStatistics.java#L94-L100
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateTime.java
DateTime.setField
public DateTime setField(int field, int value) { """ 设置日期的某个部分<br> 如果此对象为可变对象,返回自身,否则返回新对象,设置是否可变对象见{@link #setMutable(boolean)} @param field 表示日期的哪个部分的int值 {@link Calendar} @param value 值 @return {@link DateTime} """ final Calendar calendar = toCalendar(); calendar.set(field, value); DateTime dt = this; if (false == mutable) { dt = ObjectUtil.clone(this); } return dt.setTimeInternal(calendar.getTimeInMillis()); }
java
public DateTime setField(int field, int value) { final Calendar calendar = toCalendar(); calendar.set(field, value); DateTime dt = this; if (false == mutable) { dt = ObjectUtil.clone(this); } return dt.setTimeInternal(calendar.getTimeInMillis()); }
[ "public", "DateTime", "setField", "(", "int", "field", ",", "int", "value", ")", "{", "final", "Calendar", "calendar", "=", "toCalendar", "(", ")", ";", "calendar", ".", "set", "(", "field", ",", "value", ")", ";", "DateTime", "dt", "=", "this", ";", "if", "(", "false", "==", "mutable", ")", "{", "dt", "=", "ObjectUtil", ".", "clone", "(", "this", ")", ";", "}", "return", "dt", ".", "setTimeInternal", "(", "calendar", ".", "getTimeInMillis", "(", ")", ")", ";", "}" ]
设置日期的某个部分<br> 如果此对象为可变对象,返回自身,否则返回新对象,设置是否可变对象见{@link #setMutable(boolean)} @param field 表示日期的哪个部分的int值 {@link Calendar} @param value 值 @return {@link DateTime}
[ "设置日期的某个部分<br", ">", "如果此对象为可变对象,返回自身,否则返回新对象,设置是否可变对象见", "{", "@link", "#setMutable", "(", "boolean", ")", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L263-L272
facebook/fresco
animated-base/src/main/java/com/facebook/imagepipeline/animated/util/AnimatedDrawableUtil.java
AnimatedDrawableUtil.getFrameForTimestampMs
public int getFrameForTimestampMs(int frameTimestampsMs[], int timestampMs) { """ Gets the frame index for specified timestamp. @param frameTimestampsMs an array of timestamps generated by {@link #getFrameForTimestampMs)} @param timestampMs the timestamp @return the frame index for the timestamp or the last frame number if the timestamp is outside the duration of the entire animation """ int index = Arrays.binarySearch(frameTimestampsMs, timestampMs); if (index < 0) { return -index - 1 - 1; } else { return index; } }
java
public int getFrameForTimestampMs(int frameTimestampsMs[], int timestampMs) { int index = Arrays.binarySearch(frameTimestampsMs, timestampMs); if (index < 0) { return -index - 1 - 1; } else { return index; } }
[ "public", "int", "getFrameForTimestampMs", "(", "int", "frameTimestampsMs", "[", "]", ",", "int", "timestampMs", ")", "{", "int", "index", "=", "Arrays", ".", "binarySearch", "(", "frameTimestampsMs", ",", "timestampMs", ")", ";", "if", "(", "index", "<", "0", ")", "{", "return", "-", "index", "-", "1", "-", "1", ";", "}", "else", "{", "return", "index", ";", "}", "}" ]
Gets the frame index for specified timestamp. @param frameTimestampsMs an array of timestamps generated by {@link #getFrameForTimestampMs)} @param timestampMs the timestamp @return the frame index for the timestamp or the last frame number if the timestamp is outside the duration of the entire animation
[ "Gets", "the", "frame", "index", "for", "specified", "timestamp", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/animated-base/src/main/java/com/facebook/imagepipeline/animated/util/AnimatedDrawableUtil.java#L81-L88
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ObjectUtils.java
ObjectUtils.identityToString
public static void identityToString(final Appendable appendable, final Object object) throws IOException { """ <p>Appends the toString that would be produced by {@code Object} if a class did not override toString itself. {@code null} will throw a NullPointerException for either of the two parameters. </p> <pre> ObjectUtils.identityToString(appendable, "") = appendable.append("java.lang.String@1e23" ObjectUtils.identityToString(appendable, Boolean.TRUE) = appendable.append("java.lang.Boolean@7fa" ObjectUtils.identityToString(appendable, Boolean.TRUE) = appendable.append("java.lang.Boolean@7fa") </pre> @param appendable the appendable to append to @param object the object to create a toString for @throws IOException if an I/O error occurs @since 3.2 """ Validate.notNull(object, "Cannot get the toString of a null identity"); appendable.append(object.getClass().getName()) .append('@') .append(Integer.toHexString(System.identityHashCode(object))); }
java
public static void identityToString(final Appendable appendable, final Object object) throws IOException { Validate.notNull(object, "Cannot get the toString of a null identity"); appendable.append(object.getClass().getName()) .append('@') .append(Integer.toHexString(System.identityHashCode(object))); }
[ "public", "static", "void", "identityToString", "(", "final", "Appendable", "appendable", ",", "final", "Object", "object", ")", "throws", "IOException", "{", "Validate", ".", "notNull", "(", "object", ",", "\"Cannot get the toString of a null identity\"", ")", ";", "appendable", ".", "append", "(", "object", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "Integer", ".", "toHexString", "(", "System", ".", "identityHashCode", "(", "object", ")", ")", ")", ";", "}" ]
<p>Appends the toString that would be produced by {@code Object} if a class did not override toString itself. {@code null} will throw a NullPointerException for either of the two parameters. </p> <pre> ObjectUtils.identityToString(appendable, "") = appendable.append("java.lang.String@1e23" ObjectUtils.identityToString(appendable, Boolean.TRUE) = appendable.append("java.lang.Boolean@7fa" ObjectUtils.identityToString(appendable, Boolean.TRUE) = appendable.append("java.lang.Boolean@7fa") </pre> @param appendable the appendable to append to @param object the object to create a toString for @throws IOException if an I/O error occurs @since 3.2
[ "<p", ">", "Appends", "the", "toString", "that", "would", "be", "produced", "by", "{", "@code", "Object", "}", "if", "a", "class", "did", "not", "override", "toString", "itself", ".", "{", "@code", "null", "}", "will", "throw", "a", "NullPointerException", "for", "either", "of", "the", "two", "parameters", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ObjectUtils.java#L357-L362
alexvasilkov/GestureViews
library/src/main/java/com/alexvasilkov/gestures/StateController.java
StateController.toggleMinMaxZoom
State toggleMinMaxZoom(State state, float pivotX, float pivotY) { """ Maximizes zoom if it closer to min zoom or minimizes it if it closer to max zoom. @param state Current state @param pivotX Pivot's X coordinate @param pivotY Pivot's Y coordinate @return End state for toggle animation. """ zoomBounds.set(state); final float minZoom = zoomBounds.getFitZoom(); final float maxZoom = settings.getDoubleTapZoom() > 0f ? settings.getDoubleTapZoom() : zoomBounds.getMaxZoom(); final float middleZoom = 0.5f * (minZoom + maxZoom); final float targetZoom = state.getZoom() < middleZoom ? maxZoom : minZoom; final State end = state.copy(); end.zoomTo(targetZoom, pivotX, pivotY); return end; }
java
State toggleMinMaxZoom(State state, float pivotX, float pivotY) { zoomBounds.set(state); final float minZoom = zoomBounds.getFitZoom(); final float maxZoom = settings.getDoubleTapZoom() > 0f ? settings.getDoubleTapZoom() : zoomBounds.getMaxZoom(); final float middleZoom = 0.5f * (minZoom + maxZoom); final float targetZoom = state.getZoom() < middleZoom ? maxZoom : minZoom; final State end = state.copy(); end.zoomTo(targetZoom, pivotX, pivotY); return end; }
[ "State", "toggleMinMaxZoom", "(", "State", "state", ",", "float", "pivotX", ",", "float", "pivotY", ")", "{", "zoomBounds", ".", "set", "(", "state", ")", ";", "final", "float", "minZoom", "=", "zoomBounds", ".", "getFitZoom", "(", ")", ";", "final", "float", "maxZoom", "=", "settings", ".", "getDoubleTapZoom", "(", ")", ">", "0f", "?", "settings", ".", "getDoubleTapZoom", "(", ")", ":", "zoomBounds", ".", "getMaxZoom", "(", ")", ";", "final", "float", "middleZoom", "=", "0.5f", "*", "(", "minZoom", "+", "maxZoom", ")", ";", "final", "float", "targetZoom", "=", "state", ".", "getZoom", "(", ")", "<", "middleZoom", "?", "maxZoom", ":", "minZoom", ";", "final", "State", "end", "=", "state", ".", "copy", "(", ")", ";", "end", ".", "zoomTo", "(", "targetZoom", ",", "pivotX", ",", "pivotY", ")", ";", "return", "end", ";", "}" ]
Maximizes zoom if it closer to min zoom or minimizes it if it closer to max zoom. @param state Current state @param pivotX Pivot's X coordinate @param pivotY Pivot's Y coordinate @return End state for toggle animation.
[ "Maximizes", "zoom", "if", "it", "closer", "to", "min", "zoom", "or", "minimizes", "it", "if", "it", "closer", "to", "max", "zoom", "." ]
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/StateController.java#L106-L118
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java
RedundentExprEliminator.eleminateRedundent
protected void eleminateRedundent(ElemTemplateElement psuedoVarRecipient, Vector paths) { """ Method to be called after the all expressions within an node context have been visited. It eliminates redundent expressions by creating a variable in the psuedoVarRecipient for each redundent expression, and then rewriting the redundent expression to be a variable reference. @param psuedoVarRecipient The owner of the subtree from where the paths were collected. @param paths A vector of paths that hold ExpressionOwner objects, which must yield LocationPathIterators. """ int n = paths.size(); int numPathsEliminated = 0; int numUniquePathsEliminated = 0; for (int i = 0; i < n; i++) { ExpressionOwner owner = (ExpressionOwner) paths.elementAt(i); if (null != owner) { int found = findAndEliminateRedundant(i + 1, i, owner, psuedoVarRecipient, paths); if (found > 0) numUniquePathsEliminated++; numPathsEliminated += found; } } eleminateSharedPartialPaths(psuedoVarRecipient, paths); if(DIAGNOSE_NUM_PATHS_REDUCED) diagnoseNumPaths(paths, numPathsEliminated, numUniquePathsEliminated); }
java
protected void eleminateRedundent(ElemTemplateElement psuedoVarRecipient, Vector paths) { int n = paths.size(); int numPathsEliminated = 0; int numUniquePathsEliminated = 0; for (int i = 0; i < n; i++) { ExpressionOwner owner = (ExpressionOwner) paths.elementAt(i); if (null != owner) { int found = findAndEliminateRedundant(i + 1, i, owner, psuedoVarRecipient, paths); if (found > 0) numUniquePathsEliminated++; numPathsEliminated += found; } } eleminateSharedPartialPaths(psuedoVarRecipient, paths); if(DIAGNOSE_NUM_PATHS_REDUCED) diagnoseNumPaths(paths, numPathsEliminated, numUniquePathsEliminated); }
[ "protected", "void", "eleminateRedundent", "(", "ElemTemplateElement", "psuedoVarRecipient", ",", "Vector", "paths", ")", "{", "int", "n", "=", "paths", ".", "size", "(", ")", ";", "int", "numPathsEliminated", "=", "0", ";", "int", "numUniquePathsEliminated", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "ExpressionOwner", "owner", "=", "(", "ExpressionOwner", ")", "paths", ".", "elementAt", "(", "i", ")", ";", "if", "(", "null", "!=", "owner", ")", "{", "int", "found", "=", "findAndEliminateRedundant", "(", "i", "+", "1", ",", "i", ",", "owner", ",", "psuedoVarRecipient", ",", "paths", ")", ";", "if", "(", "found", ">", "0", ")", "numUniquePathsEliminated", "++", ";", "numPathsEliminated", "+=", "found", ";", "}", "}", "eleminateSharedPartialPaths", "(", "psuedoVarRecipient", ",", "paths", ")", ";", "if", "(", "DIAGNOSE_NUM_PATHS_REDUCED", ")", "diagnoseNumPaths", "(", "paths", ",", "numPathsEliminated", ",", "numUniquePathsEliminated", ")", ";", "}" ]
Method to be called after the all expressions within an node context have been visited. It eliminates redundent expressions by creating a variable in the psuedoVarRecipient for each redundent expression, and then rewriting the redundent expression to be a variable reference. @param psuedoVarRecipient The owner of the subtree from where the paths were collected. @param paths A vector of paths that hold ExpressionOwner objects, which must yield LocationPathIterators.
[ "Method", "to", "be", "called", "after", "the", "all", "expressions", "within", "an", "node", "context", "have", "been", "visited", ".", "It", "eliminates", "redundent", "expressions", "by", "creating", "a", "variable", "in", "the", "psuedoVarRecipient", "for", "each", "redundent", "expression", "and", "then", "rewriting", "the", "redundent", "expression", "to", "be", "a", "variable", "reference", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L121-L142
modelmapper/modelmapper
core/src/main/java/org/modelmapper/internal/util/Iterables.java
Iterables.getElementFromArrary
public static Object getElementFromArrary(Object array, int index) { """ Gets the element from an array with given index. @param array the array @param index the index @return null if the array doesn't have the element at index, otherwise, return the element """ try { return Array.get(array, index); } catch (ArrayIndexOutOfBoundsException e) { return null; } }
java
public static Object getElementFromArrary(Object array, int index) { try { return Array.get(array, index); } catch (ArrayIndexOutOfBoundsException e) { return null; } }
[ "public", "static", "Object", "getElementFromArrary", "(", "Object", "array", ",", "int", "index", ")", "{", "try", "{", "return", "Array", ".", "get", "(", "array", ",", "index", ")", ";", "}", "catch", "(", "ArrayIndexOutOfBoundsException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Gets the element from an array with given index. @param array the array @param index the index @return null if the array doesn't have the element at index, otherwise, return the element
[ "Gets", "the", "element", "from", "an", "array", "with", "given", "index", "." ]
train
https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/internal/util/Iterables.java#L90-L96
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/platforms/PlatformSybaseASAImpl.java
PlatformSybaseASAImpl.initializeJdbcConnection
public void initializeJdbcConnection(JdbcConnectionDescriptor jcd, Connection conn) throws PlatformException { """ Sybase Adaptive Server Enterprise (ASE) support timestamp to a precision of 1/300th of second. Adaptive Server Anywhere (ASA) support timestamp to a precision of 1/1000000tho of second. Sybase JDBC driver (JConnect) retrieving timestamp always rounds to 1/300th sec., causing rounding problems with ASA when retrieving Timestamp fields. This work around was suggested by Sybase Support. Unfortunately it works only with ASA. <br/> author Lorenzo Nicora """ // Do origial init super.initializeJdbcConnection(jcd, conn); // Execute a statement setting the tempory option try { Statement stmt = conn.createStatement(); stmt.executeUpdate("set temporary option RETURN_DATE_TIME_AS_STRING = On"); } catch (SQLException e) { throw new PlatformException(e); } }
java
public void initializeJdbcConnection(JdbcConnectionDescriptor jcd, Connection conn) throws PlatformException { // Do origial init super.initializeJdbcConnection(jcd, conn); // Execute a statement setting the tempory option try { Statement stmt = conn.createStatement(); stmt.executeUpdate("set temporary option RETURN_DATE_TIME_AS_STRING = On"); } catch (SQLException e) { throw new PlatformException(e); } }
[ "public", "void", "initializeJdbcConnection", "(", "JdbcConnectionDescriptor", "jcd", ",", "Connection", "conn", ")", "throws", "PlatformException", "{", "// Do origial init\r", "super", ".", "initializeJdbcConnection", "(", "jcd", ",", "conn", ")", ";", "// Execute a statement setting the tempory option\r", "try", "{", "Statement", "stmt", "=", "conn", ".", "createStatement", "(", ")", ";", "stmt", ".", "executeUpdate", "(", "\"set temporary option RETURN_DATE_TIME_AS_STRING = On\"", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "PlatformException", "(", "e", ")", ";", "}", "}" ]
Sybase Adaptive Server Enterprise (ASE) support timestamp to a precision of 1/300th of second. Adaptive Server Anywhere (ASA) support timestamp to a precision of 1/1000000tho of second. Sybase JDBC driver (JConnect) retrieving timestamp always rounds to 1/300th sec., causing rounding problems with ASA when retrieving Timestamp fields. This work around was suggested by Sybase Support. Unfortunately it works only with ASA. <br/> author Lorenzo Nicora
[ "Sybase", "Adaptive", "Server", "Enterprise", "(", "ASE", ")", "support", "timestamp", "to", "a", "precision", "of", "1", "/", "300th", "of", "second", ".", "Adaptive", "Server", "Anywhere", "(", "ASA", ")", "support", "timestamp", "to", "a", "precision", "of", "1", "/", "1000000tho", "of", "second", ".", "Sybase", "JDBC", "driver", "(", "JConnect", ")", "retrieving", "timestamp", "always", "rounds", "to", "1", "/", "300th", "sec", ".", "causing", "rounding", "problems", "with", "ASA", "when", "retrieving", "Timestamp", "fields", ".", "This", "work", "around", "was", "suggested", "by", "Sybase", "Support", ".", "Unfortunately", "it", "works", "only", "with", "ASA", ".", "<br", "/", ">", "author", "Lorenzo", "Nicora" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/platforms/PlatformSybaseASAImpl.java#L47-L61
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/component/JideOverlayService.java
JideOverlayService.installOverlay
@Override public Boolean installOverlay(JComponent targetComponent, JComponent overlay) { """ {@inheritDoc} <p> Employs a default position <code>SwingConstants.NORTH_WEST</code> and <code>null</code> insets to avoid changes. @see #installOverlay(JComponent, JComponent, int, Insets) """ return this.installOverlay(targetComponent, overlay, SwingConstants.NORTH_WEST, null); }
java
@Override public Boolean installOverlay(JComponent targetComponent, JComponent overlay) { return this.installOverlay(targetComponent, overlay, SwingConstants.NORTH_WEST, null); }
[ "@", "Override", "public", "Boolean", "installOverlay", "(", "JComponent", "targetComponent", ",", "JComponent", "overlay", ")", "{", "return", "this", ".", "installOverlay", "(", "targetComponent", ",", "overlay", ",", "SwingConstants", ".", "NORTH_WEST", ",", "null", ")", ";", "}" ]
{@inheritDoc} <p> Employs a default position <code>SwingConstants.NORTH_WEST</code> and <code>null</code> insets to avoid changes. @see #installOverlay(JComponent, JComponent, int, Insets)
[ "{", "@inheritDoc", "}", "<p", ">", "Employs", "a", "default", "position", "<code", ">", "SwingConstants", ".", "NORTH_WEST<", "/", "code", ">", "and", "<code", ">", "null<", "/", "code", ">", "insets", "to", "avoid", "changes", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/component/JideOverlayService.java#L99-L103
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java
CommsLightTrace._traceMessageId
private static void _traceMessageId(TraceComponent callersTrace, String action, String messageText) { """ Allow minimal tracing of System Message IDs (along with a transaction if on exists) @param callersTrace The trace component of the caller @param action A string (no spaces) provided by the caller to prefix the keyword included in the trace line @param message The message to trace """ // Build the trace string String traceText = action + ": " + messageText; // Trace using the correct trace group if (light_tc.isDebugEnabled()) { SibTr.debug(light_tc, traceText); } else { SibTr.debug(callersTrace, traceText); } }
java
private static void _traceMessageId(TraceComponent callersTrace, String action, String messageText) { // Build the trace string String traceText = action + ": " + messageText; // Trace using the correct trace group if (light_tc.isDebugEnabled()) { SibTr.debug(light_tc, traceText); } else { SibTr.debug(callersTrace, traceText); } }
[ "private", "static", "void", "_traceMessageId", "(", "TraceComponent", "callersTrace", ",", "String", "action", ",", "String", "messageText", ")", "{", "// Build the trace string", "String", "traceText", "=", "action", "+", "\": \"", "+", "messageText", ";", "// Trace using the correct trace group", "if", "(", "light_tc", ".", "isDebugEnabled", "(", ")", ")", "{", "SibTr", ".", "debug", "(", "light_tc", ",", "traceText", ")", ";", "}", "else", "{", "SibTr", ".", "debug", "(", "callersTrace", ",", "traceText", ")", ";", "}", "}" ]
Allow minimal tracing of System Message IDs (along with a transaction if on exists) @param callersTrace The trace component of the caller @param action A string (no spaces) provided by the caller to prefix the keyword included in the trace line @param message The message to trace
[ "Allow", "minimal", "tracing", "of", "System", "Message", "IDs", "(", "along", "with", "a", "transaction", "if", "on", "exists", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java#L80-L92
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.andLikePattern
public ZealotKhala andLikePattern(String field, String pattern) { """ 根据指定的模式字符串生成带" AND "前缀的like模糊查询的SQL片段. <p>示例:传入 {"b.title", "Java%"} 两个参数,生成的SQL片段为:" AND b.title LIKE 'Java%' "</p> @param field 数据库字段 @param pattern 模式字符串 @return ZealotKhala实例 """ return this.doLikePattern(ZealotConst.AND_PREFIX, field, pattern, true, true); }
java
public ZealotKhala andLikePattern(String field, String pattern) { return this.doLikePattern(ZealotConst.AND_PREFIX, field, pattern, true, true); }
[ "public", "ZealotKhala", "andLikePattern", "(", "String", "field", ",", "String", "pattern", ")", "{", "return", "this", ".", "doLikePattern", "(", "ZealotConst", ".", "AND_PREFIX", ",", "field", ",", "pattern", ",", "true", ",", "true", ")", ";", "}" ]
根据指定的模式字符串生成带" AND "前缀的like模糊查询的SQL片段. <p>示例:传入 {"b.title", "Java%"} 两个参数,生成的SQL片段为:" AND b.title LIKE 'Java%' "</p> @param field 数据库字段 @param pattern 模式字符串 @return ZealotKhala实例
[ "根据指定的模式字符串生成带", "AND", "前缀的like模糊查询的SQL片段", ".", "<p", ">", "示例:传入", "{", "b", ".", "title", "Java%", "}", "两个参数,生成的SQL片段为:", "AND", "b", ".", "title", "LIKE", "Java%", "<", "/", "p", ">" ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1066-L1068
dita-ot/dita-ot
src/main/java/org/dita/dost/util/StringUtils.java
StringUtils.setOrAppend
public static String setOrAppend(final String target, final String value, final boolean withSpace) { """ If target is null, return the value; else append value to target. If withSpace is true, insert a blank between them. @param target target to be appended @param value value to append @param withSpace whether insert a blank @return processed string """ if (target == null) { return value; }if(value == null) { return target; } else { if (withSpace && !target.endsWith(STRING_BLANK)) { return target + STRING_BLANK + value; } else { return target + value; } } }
java
public static String setOrAppend(final String target, final String value, final boolean withSpace) { if (target == null) { return value; }if(value == null) { return target; } else { if (withSpace && !target.endsWith(STRING_BLANK)) { return target + STRING_BLANK + value; } else { return target + value; } } }
[ "public", "static", "String", "setOrAppend", "(", "final", "String", "target", ",", "final", "String", "value", ",", "final", "boolean", "withSpace", ")", "{", "if", "(", "target", "==", "null", ")", "{", "return", "value", ";", "}", "if", "(", "value", "==", "null", ")", "{", "return", "target", ";", "}", "else", "{", "if", "(", "withSpace", "&&", "!", "target", ".", "endsWith", "(", "STRING_BLANK", ")", ")", "{", "return", "target", "+", "STRING_BLANK", "+", "value", ";", "}", "else", "{", "return", "target", "+", "value", ";", "}", "}", "}" ]
If target is null, return the value; else append value to target. If withSpace is true, insert a blank between them. @param target target to be appended @param value value to append @param withSpace whether insert a blank @return processed string
[ "If", "target", "is", "null", "return", "the", "value", ";", "else", "append", "value", "to", "target", ".", "If", "withSpace", "is", "true", "insert", "a", "blank", "between", "them", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L179-L191
Azure/azure-sdk-for-java
dns/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/dns/v2017_10_01/implementation/ZonesInner.java
ZonesInner.getByResourceGroupAsync
public Observable<ZoneInner> getByResourceGroupAsync(String resourceGroupName, String zoneName) { """ Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. @param resourceGroupName The name of the resource group. @param zoneName The name of the DNS zone (without a terminating dot). @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ZoneInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, zoneName).map(new Func1<ServiceResponse<ZoneInner>, ZoneInner>() { @Override public ZoneInner call(ServiceResponse<ZoneInner> response) { return response.body(); } }); }
java
public Observable<ZoneInner> getByResourceGroupAsync(String resourceGroupName, String zoneName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, zoneName).map(new Func1<ServiceResponse<ZoneInner>, ZoneInner>() { @Override public ZoneInner call(ServiceResponse<ZoneInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ZoneInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "zoneName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "zoneName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ZoneInner", ">", ",", "ZoneInner", ">", "(", ")", "{", "@", "Override", "public", "ZoneInner", "call", "(", "ServiceResponse", "<", "ZoneInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. @param resourceGroupName The name of the resource group. @param zoneName The name of the DNS zone (without a terminating dot). @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ZoneInner object
[ "Gets", "a", "DNS", "zone", ".", "Retrieves", "the", "zone", "properties", "but", "not", "the", "record", "sets", "within", "the", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/dns/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/dns/v2017_10_01/implementation/ZonesInner.java#L645-L652
albfernandez/javadbf
src/main/java/com/linuxense/javadbf/Utils.java
Utils.textPadding
@Deprecated public static byte[] textPadding(String text, String characterSetName, int length, int alignment, byte paddingByte) throws UnsupportedEncodingException { """ Text is truncated if exceed field capacity. Uses spaces as padding @param text the text to write @param characterSetName The charset to use @param length field length @param alignment where to align the data @param paddingByte the byte to use for padding @return byte[] to store in the file @throws UnsupportedEncodingException if characterSetName doesn't exists @deprecated Use {@link DBFUtils#textPadding(String, Charset, int, DBFAlignment, byte)} """ DBFAlignment align = DBFAlignment.RIGHT; if (alignment == ALIGN_LEFT) { align = DBFAlignment.LEFT; } return textPadding(text, characterSetName, length, align, paddingByte); }
java
@Deprecated public static byte[] textPadding(String text, String characterSetName, int length, int alignment, byte paddingByte) throws UnsupportedEncodingException { DBFAlignment align = DBFAlignment.RIGHT; if (alignment == ALIGN_LEFT) { align = DBFAlignment.LEFT; } return textPadding(text, characterSetName, length, align, paddingByte); }
[ "@", "Deprecated", "public", "static", "byte", "[", "]", "textPadding", "(", "String", "text", ",", "String", "characterSetName", ",", "int", "length", ",", "int", "alignment", ",", "byte", "paddingByte", ")", "throws", "UnsupportedEncodingException", "{", "DBFAlignment", "align", "=", "DBFAlignment", ".", "RIGHT", ";", "if", "(", "alignment", "==", "ALIGN_LEFT", ")", "{", "align", "=", "DBFAlignment", ".", "LEFT", ";", "}", "return", "textPadding", "(", "text", ",", "characterSetName", ",", "length", ",", "align", ",", "paddingByte", ")", ";", "}" ]
Text is truncated if exceed field capacity. Uses spaces as padding @param text the text to write @param characterSetName The charset to use @param length field length @param alignment where to align the data @param paddingByte the byte to use for padding @return byte[] to store in the file @throws UnsupportedEncodingException if characterSetName doesn't exists @deprecated Use {@link DBFUtils#textPadding(String, Charset, int, DBFAlignment, byte)}
[ "Text", "is", "truncated", "if", "exceed", "field", "capacity", ".", "Uses", "spaces", "as", "padding" ]
train
https://github.com/albfernandez/javadbf/blob/ac9867b46786cb055bce9323e2cf074365207693/src/main/java/com/linuxense/javadbf/Utils.java#L264-L273
mozilla/rhino
src/org/mozilla/javascript/WrapFactory.java
WrapFactory.wrapAsJavaObject
public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class<?> staticType) { """ Wrap Java object as Scriptable instance to allow full access to its methods and fields from JavaScript. <p> {@link #wrap(Context, Scriptable, Object, Class)} and {@link #wrapNewObject(Context, Scriptable, Object)} call this method when they can not convert <tt>javaObject</tt> to JavaScript primitive value or JavaScript array. <p> Subclasses can override the method to provide custom wrappers for Java objects. @param cx the current Context for this thread @param scope the scope of the executing script @param javaObject the object to be wrapped @param staticType type hint. If security restrictions prevent to wrap object based on its class, staticType will be used instead. @return the wrapped value which shall not be null """ return new NativeJavaObject(scope, javaObject, staticType); }
java
public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class<?> staticType) { return new NativeJavaObject(scope, javaObject, staticType); }
[ "public", "Scriptable", "wrapAsJavaObject", "(", "Context", "cx", ",", "Scriptable", "scope", ",", "Object", "javaObject", ",", "Class", "<", "?", ">", "staticType", ")", "{", "return", "new", "NativeJavaObject", "(", "scope", ",", "javaObject", ",", "staticType", ")", ";", "}" ]
Wrap Java object as Scriptable instance to allow full access to its methods and fields from JavaScript. <p> {@link #wrap(Context, Scriptable, Object, Class)} and {@link #wrapNewObject(Context, Scriptable, Object)} call this method when they can not convert <tt>javaObject</tt> to JavaScript primitive value or JavaScript array. <p> Subclasses can override the method to provide custom wrappers for Java objects. @param cx the current Context for this thread @param scope the scope of the executing script @param javaObject the object to be wrapped @param staticType type hint. If security restrictions prevent to wrap object based on its class, staticType will be used instead. @return the wrapped value which shall not be null
[ "Wrap", "Java", "object", "as", "Scriptable", "instance", "to", "allow", "full", "access", "to", "its", "methods", "and", "fields", "from", "JavaScript", ".", "<p", ">", "{" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/WrapFactory.java#L117-L121
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.notifications_sendEmail
public String notifications_sendEmail(Collection<Integer> recipientIds, CharSequence subject, CharSequence fbml, CharSequence text) throws FacebookException, IOException { """ Sends a notification email to the specified users, who must have added your application. You can send five (5) emails to a user per day. Requires a session key for desktop applications, which may only send email to the person whose session it is. This method does not require a session for Web applications. Either <code>fbml</code> or <code>text</code> must be specified. @param recipientIds up to 100 user ids to which the message is to be sent @param subject the subject of the notification email (optional) @param fbml markup to be sent to the specified users via email; only a stripped-down set of FBML tags that result in text, links and linebreaks is allowed @param text the plain text to send to the specified users via email @return a comma-separated list of the IDs of the users to whom the email was successfully sent @see <a href="http://wiki.developers.facebook.com/index.php/Notifications.send"> Developers Wiki: notifications.sendEmail</a> """ if (null == recipientIds || recipientIds.isEmpty()) { throw new IllegalArgumentException("List of email recipients cannot be empty"); } boolean hasText = null != text && (0 != text.length()); boolean hasFbml = null != fbml && (0 != fbml.length()); if (!hasText && !hasFbml) { throw new IllegalArgumentException("Text and/or fbml must not be empty"); } ArrayList<Pair<String, CharSequence>> args = new ArrayList<Pair<String, CharSequence>>(4); args.add(new Pair<String, CharSequence>("recipients", delimit(recipientIds))); args.add(new Pair<String, CharSequence>("subject", subject)); if (hasText) { args.add(new Pair<String, CharSequence>("text", text)); } if (hasFbml) { args.add(new Pair<String, CharSequence>("fbml", fbml)); } // this method requires a session only if we're dealing with a desktop app T result = this.callMethod(this.isDesktop() ? FacebookMethod.NOTIFICATIONS_SEND_EMAIL : FacebookMethod.NOTIFICATIONS_SEND_EMAIL, args); return extractString(result); }
java
public String notifications_sendEmail(Collection<Integer> recipientIds, CharSequence subject, CharSequence fbml, CharSequence text) throws FacebookException, IOException { if (null == recipientIds || recipientIds.isEmpty()) { throw new IllegalArgumentException("List of email recipients cannot be empty"); } boolean hasText = null != text && (0 != text.length()); boolean hasFbml = null != fbml && (0 != fbml.length()); if (!hasText && !hasFbml) { throw new IllegalArgumentException("Text and/or fbml must not be empty"); } ArrayList<Pair<String, CharSequence>> args = new ArrayList<Pair<String, CharSequence>>(4); args.add(new Pair<String, CharSequence>("recipients", delimit(recipientIds))); args.add(new Pair<String, CharSequence>("subject", subject)); if (hasText) { args.add(new Pair<String, CharSequence>("text", text)); } if (hasFbml) { args.add(new Pair<String, CharSequence>("fbml", fbml)); } // this method requires a session only if we're dealing with a desktop app T result = this.callMethod(this.isDesktop() ? FacebookMethod.NOTIFICATIONS_SEND_EMAIL : FacebookMethod.NOTIFICATIONS_SEND_EMAIL, args); return extractString(result); }
[ "public", "String", "notifications_sendEmail", "(", "Collection", "<", "Integer", ">", "recipientIds", ",", "CharSequence", "subject", ",", "CharSequence", "fbml", ",", "CharSequence", "text", ")", "throws", "FacebookException", ",", "IOException", "{", "if", "(", "null", "==", "recipientIds", "||", "recipientIds", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"List of email recipients cannot be empty\"", ")", ";", "}", "boolean", "hasText", "=", "null", "!=", "text", "&&", "(", "0", "!=", "text", ".", "length", "(", ")", ")", ";", "boolean", "hasFbml", "=", "null", "!=", "fbml", "&&", "(", "0", "!=", "fbml", ".", "length", "(", ")", ")", ";", "if", "(", "!", "hasText", "&&", "!", "hasFbml", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Text and/or fbml must not be empty\"", ")", ";", "}", "ArrayList", "<", "Pair", "<", "String", ",", "CharSequence", ">", ">", "args", "=", "new", "ArrayList", "<", "Pair", "<", "String", ",", "CharSequence", ">", ">", "(", "4", ")", ";", "args", ".", "add", "(", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"recipients\"", ",", "delimit", "(", "recipientIds", ")", ")", ")", ";", "args", ".", "add", "(", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"subject\"", ",", "subject", ")", ")", ";", "if", "(", "hasText", ")", "{", "args", ".", "add", "(", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"text\"", ",", "text", ")", ")", ";", "}", "if", "(", "hasFbml", ")", "{", "args", ".", "add", "(", "new", "Pair", "<", "String", ",", "CharSequence", ">", "(", "\"fbml\"", ",", "fbml", ")", ")", ";", "}", "// this method requires a session only if we're dealing with a desktop app", "T", "result", "=", "this", ".", "callMethod", "(", "this", ".", "isDesktop", "(", ")", "?", "FacebookMethod", ".", "NOTIFICATIONS_SEND_EMAIL", ":", "FacebookMethod", ".", "NOTIFICATIONS_SEND_EMAIL", ",", "args", ")", ";", "return", "extractString", "(", "result", ")", ";", "}" ]
Sends a notification email to the specified users, who must have added your application. You can send five (5) emails to a user per day. Requires a session key for desktop applications, which may only send email to the person whose session it is. This method does not require a session for Web applications. Either <code>fbml</code> or <code>text</code> must be specified. @param recipientIds up to 100 user ids to which the message is to be sent @param subject the subject of the notification email (optional) @param fbml markup to be sent to the specified users via email; only a stripped-down set of FBML tags that result in text, links and linebreaks is allowed @param text the plain text to send to the specified users via email @return a comma-separated list of the IDs of the users to whom the email was successfully sent @see <a href="http://wiki.developers.facebook.com/index.php/Notifications.send"> Developers Wiki: notifications.sendEmail</a>
[ "Sends", "a", "notification", "email", "to", "the", "specified", "users", "who", "must", "have", "added", "your", "application", ".", "You", "can", "send", "five", "(", "5", ")", "emails", "to", "a", "user", "per", "day", ".", "Requires", "a", "session", "key", "for", "desktop", "applications", "which", "may", "only", "send", "email", "to", "the", "person", "whose", "session", "it", "is", ".", "This", "method", "does", "not", "require", "a", "session", "for", "Web", "applications", ".", "Either", "<code", ">", "fbml<", "/", "code", ">", "or", "<code", ">", "text<", "/", "code", ">", "must", "be", "specified", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1197-L1220
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java
ChannelFrameworkImpl.initChannelFactory
protected synchronized void initChannelFactory(Class<?> type, ChannelFactory factory, Map<Object, Object> properties) throws ChannelFactoryException { """ This method will store factory properties, initialize the factory & map the factory to it's type. This method exists primarily as a performance enhancement for the WebSphere-specific implementation; without this method we would have to create two factory instances: one to translate WCCM objects to property maps, the other to be the actual factory in use. @param type @param factory @param properties """ // if no properties were provided, then we must retrieve them from // channelFactoriesProperties using the factory type as the key; if // the properties were provided, make sure that they are in // channelFactoriesProperties for potential future use // ChannelFactoryDataImpl cfd = findOrCreateChannelFactoryData(type); cfd.setChannelFactory(factory); if (properties != null) { cfd.setProperties(properties); } try { factory.init(cfd); } catch (ChannelFactoryException ce) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Factory " + factory + " threw ChannelFactoryException " + ce.getMessage()); } throw ce; } catch (Throwable e) { FFDCFilter.processException(e, getClass().getName() + ".initChannelFactory", "770", this, new Object[] { factory }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Factory " + factory + " threw non-ChannelFactoryException " + e.getMessage()); } throw new ChannelFactoryException(e); } }
java
protected synchronized void initChannelFactory(Class<?> type, ChannelFactory factory, Map<Object, Object> properties) throws ChannelFactoryException { // if no properties were provided, then we must retrieve them from // channelFactoriesProperties using the factory type as the key; if // the properties were provided, make sure that they are in // channelFactoriesProperties for potential future use // ChannelFactoryDataImpl cfd = findOrCreateChannelFactoryData(type); cfd.setChannelFactory(factory); if (properties != null) { cfd.setProperties(properties); } try { factory.init(cfd); } catch (ChannelFactoryException ce) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Factory " + factory + " threw ChannelFactoryException " + ce.getMessage()); } throw ce; } catch (Throwable e) { FFDCFilter.processException(e, getClass().getName() + ".initChannelFactory", "770", this, new Object[] { factory }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Factory " + factory + " threw non-ChannelFactoryException " + e.getMessage()); } throw new ChannelFactoryException(e); } }
[ "protected", "synchronized", "void", "initChannelFactory", "(", "Class", "<", "?", ">", "type", ",", "ChannelFactory", "factory", ",", "Map", "<", "Object", ",", "Object", ">", "properties", ")", "throws", "ChannelFactoryException", "{", "// if no properties were provided, then we must retrieve them from", "// channelFactoriesProperties using the factory type as the key; if", "// the properties were provided, make sure that they are in", "// channelFactoriesProperties for potential future use", "//", "ChannelFactoryDataImpl", "cfd", "=", "findOrCreateChannelFactoryData", "(", "type", ")", ";", "cfd", ".", "setChannelFactory", "(", "factory", ")", ";", "if", "(", "properties", "!=", "null", ")", "{", "cfd", ".", "setProperties", "(", "properties", ")", ";", "}", "try", "{", "factory", ".", "init", "(", "cfd", ")", ";", "}", "catch", "(", "ChannelFactoryException", "ce", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Factory \"", "+", "factory", "+", "\" threw ChannelFactoryException \"", "+", "ce", ".", "getMessage", "(", ")", ")", ";", "}", "throw", "ce", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".initChannelFactory\"", ",", "\"770\"", ",", "this", ",", "new", "Object", "[", "]", "{", "factory", "}", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Factory \"", "+", "factory", "+", "\" threw non-ChannelFactoryException \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "throw", "new", "ChannelFactoryException", "(", "e", ")", ";", "}", "}" ]
This method will store factory properties, initialize the factory & map the factory to it's type. This method exists primarily as a performance enhancement for the WebSphere-specific implementation; without this method we would have to create two factory instances: one to translate WCCM objects to property maps, the other to be the actual factory in use. @param type @param factory @param properties
[ "This", "method", "will", "store", "factory", "properties", "initialize", "the", "factory", "&", "map", "the", "factory", "to", "it", "s", "type", ".", "This", "method", "exists", "primarily", "as", "a", "performance", "enhancement", "for", "the", "WebSphere", "-", "specific", "implementation", ";", "without", "this", "method", "we", "would", "have", "to", "create", "two", "factory", "instances", ":", "one", "to", "translate", "WCCM", "objects", "to", "property", "maps", "the", "other", "to", "be", "the", "actual", "factory", "in", "use", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java#L839-L869
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/xspec/SS.java
SS.ifNotExists
public IfNotExistsFunction<SS> ifNotExists(String... defaultValue) { """ Returns an <code>IfNotExistsFunction</code> object which represents an <a href= "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html" >if_not_exists(path, operand)</a> function call where path refers to that of the current path operand; used for building expressions. <pre> "if_not_exists (path, operand) – If the item does not contain an attribute at the specified path, then if_not_exists evaluates to operand; otherwise, it evaluates to path. You can use this function to avoid overwriting an attribute already present in the item." </pre> @param defaultValue the default value that will be used as the operand to the if_not_exists function call. """ return new IfNotExistsFunction<SS>(this, new LiteralOperand( new LinkedHashSet<String>(Arrays.asList(defaultValue)))); }
java
public IfNotExistsFunction<SS> ifNotExists(String... defaultValue) { return new IfNotExistsFunction<SS>(this, new LiteralOperand( new LinkedHashSet<String>(Arrays.asList(defaultValue)))); }
[ "public", "IfNotExistsFunction", "<", "SS", ">", "ifNotExists", "(", "String", "...", "defaultValue", ")", "{", "return", "new", "IfNotExistsFunction", "<", "SS", ">", "(", "this", ",", "new", "LiteralOperand", "(", "new", "LinkedHashSet", "<", "String", ">", "(", "Arrays", ".", "asList", "(", "defaultValue", ")", ")", ")", ")", ";", "}" ]
Returns an <code>IfNotExistsFunction</code> object which represents an <a href= "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html" >if_not_exists(path, operand)</a> function call where path refers to that of the current path operand; used for building expressions. <pre> "if_not_exists (path, operand) – If the item does not contain an attribute at the specified path, then if_not_exists evaluates to operand; otherwise, it evaluates to path. You can use this function to avoid overwriting an attribute already present in the item." </pre> @param defaultValue the default value that will be used as the operand to the if_not_exists function call.
[ "Returns", "an", "<code", ">", "IfNotExistsFunction<", "/", "code", ">", "object", "which", "represents", "an", "<a", "href", "=", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "amazondynamodb", "/", "latest", "/", "developerguide", "/", "Expressions", ".", "Modifying", ".", "html", ">", "if_not_exists", "(", "path", "operand", ")", "<", "/", "a", ">", "function", "call", "where", "path", "refers", "to", "that", "of", "the", "current", "path", "operand", ";", "used", "for", "building", "expressions", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/xspec/SS.java#L190-L193
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.removeValues
static protected void removeValues(TreeMultimap<Long, Long> mm, Set<Long> values) { """ Convenience method that remove all instances of the given values from the given map @param mm a multimap @param values a set of values that need to be removed """ Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator(); while (itr.hasNext()) { Map.Entry<Long, Long> e = itr.next(); if (values.contains(e.getValue())) { itr.remove(); } } }
java
static protected void removeValues(TreeMultimap<Long, Long> mm, Set<Long> values) { Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator(); while (itr.hasNext()) { Map.Entry<Long, Long> e = itr.next(); if (values.contains(e.getValue())) { itr.remove(); } } }
[ "static", "protected", "void", "removeValues", "(", "TreeMultimap", "<", "Long", ",", "Long", ">", "mm", ",", "Set", "<", "Long", ">", "values", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "Long", ",", "Long", ">", ">", "itr", "=", "mm", ".", "entries", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "itr", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "<", "Long", ",", "Long", ">", "e", "=", "itr", ".", "next", "(", ")", ";", "if", "(", "values", ".", "contains", "(", "e", ".", "getValue", "(", ")", ")", ")", "{", "itr", ".", "remove", "(", ")", ";", "}", "}", "}" ]
Convenience method that remove all instances of the given values from the given map @param mm a multimap @param values a set of values that need to be removed
[ "Convenience", "method", "that", "remove", "all", "instances", "of", "the", "given", "values", "from", "the", "given", "map" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L116-L124
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf.java
ns_conf.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ ns_conf_responses result = (ns_conf_responses) service.get_payload_formatter().string_to_resource(ns_conf_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_response_array); } ns_conf[] result_ns_conf = new ns_conf[result.ns_conf_response_array.length]; for(int i = 0; i < result.ns_conf_response_array.length; i++) { result_ns_conf[i] = result.ns_conf_response_array[i].ns_conf[0]; } return result_ns_conf; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_conf_responses result = (ns_conf_responses) service.get_payload_formatter().string_to_resource(ns_conf_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_response_array); } ns_conf[] result_ns_conf = new ns_conf[result.ns_conf_response_array.length]; for(int i = 0; i < result.ns_conf_response_array.length; i++) { result_ns_conf[i] = result.ns_conf_response_array[i].ns_conf[0]; } return result_ns_conf; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_conf_responses", "result", "=", "(", "ns_conf_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "ns_conf_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "ns_conf_response_array", ")", ";", "}", "ns_conf", "[", "]", "result_ns_conf", "=", "new", "ns_conf", "[", "result", ".", "ns_conf_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "ns_conf_response_array", ".", "length", ";", "i", "++", ")", "{", "result_ns_conf", "[", "i", "]", "=", "result", ".", "ns_conf_response_array", "[", "i", "]", ".", "ns_conf", "[", "0", "]", ";", "}", "return", "result_ns_conf", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf.java#L269-L286
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java
COSAPIClient.copyFile
private void copyFile(String srcKey, String dstKey, long size) throws IOException, InterruptedIOException, AmazonClientException { """ Copy a single object in the bucket via a COPY operation. @param srcKey source object path @param dstKey destination object path @param size object size @throws AmazonClientException on failures inside the AWS SDK @throws InterruptedIOException the operation was interrupted @throws IOException Other IO problems """ LOG.debug("copyFile {} -> {} ", srcKey, dstKey); CopyObjectRequest copyObjectRequest = new CopyObjectRequest(mBucket, srcKey, mBucket, dstKey); try { ObjectMetadata srcmd = getObjectMetadata(srcKey); if (srcmd != null) { copyObjectRequest.setNewObjectMetadata(srcmd); } ProgressListener progressListener = new ProgressListener() { public void progressChanged(ProgressEvent progressEvent) { switch (progressEvent.getEventType()) { case TRANSFER_PART_COMPLETED_EVENT: break; default: break; } } }; Copy copy = transfers.copy(copyObjectRequest); copy.addProgressListener(progressListener); try { copy.waitForCopyResult(); } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted copying " + srcKey + " to " + dstKey + ", cancelling"); } } catch (AmazonClientException e) { throw translateException("copyFile(" + srcKey + ", " + dstKey + ")", srcKey, e); } }
java
private void copyFile(String srcKey, String dstKey, long size) throws IOException, InterruptedIOException, AmazonClientException { LOG.debug("copyFile {} -> {} ", srcKey, dstKey); CopyObjectRequest copyObjectRequest = new CopyObjectRequest(mBucket, srcKey, mBucket, dstKey); try { ObjectMetadata srcmd = getObjectMetadata(srcKey); if (srcmd != null) { copyObjectRequest.setNewObjectMetadata(srcmd); } ProgressListener progressListener = new ProgressListener() { public void progressChanged(ProgressEvent progressEvent) { switch (progressEvent.getEventType()) { case TRANSFER_PART_COMPLETED_EVENT: break; default: break; } } }; Copy copy = transfers.copy(copyObjectRequest); copy.addProgressListener(progressListener); try { copy.waitForCopyResult(); } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted copying " + srcKey + " to " + dstKey + ", cancelling"); } } catch (AmazonClientException e) { throw translateException("copyFile(" + srcKey + ", " + dstKey + ")", srcKey, e); } }
[ "private", "void", "copyFile", "(", "String", "srcKey", ",", "String", "dstKey", ",", "long", "size", ")", "throws", "IOException", ",", "InterruptedIOException", ",", "AmazonClientException", "{", "LOG", ".", "debug", "(", "\"copyFile {} -> {} \"", ",", "srcKey", ",", "dstKey", ")", ";", "CopyObjectRequest", "copyObjectRequest", "=", "new", "CopyObjectRequest", "(", "mBucket", ",", "srcKey", ",", "mBucket", ",", "dstKey", ")", ";", "try", "{", "ObjectMetadata", "srcmd", "=", "getObjectMetadata", "(", "srcKey", ")", ";", "if", "(", "srcmd", "!=", "null", ")", "{", "copyObjectRequest", ".", "setNewObjectMetadata", "(", "srcmd", ")", ";", "}", "ProgressListener", "progressListener", "=", "new", "ProgressListener", "(", ")", "{", "public", "void", "progressChanged", "(", "ProgressEvent", "progressEvent", ")", "{", "switch", "(", "progressEvent", ".", "getEventType", "(", ")", ")", "{", "case", "TRANSFER_PART_COMPLETED_EVENT", ":", "break", ";", "default", ":", "break", ";", "}", "}", "}", ";", "Copy", "copy", "=", "transfers", ".", "copy", "(", "copyObjectRequest", ")", ";", "copy", ".", "addProgressListener", "(", "progressListener", ")", ";", "try", "{", "copy", ".", "waitForCopyResult", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "InterruptedIOException", "(", "\"Interrupted copying \"", "+", "srcKey", "+", "\" to \"", "+", "dstKey", "+", "\", cancelling\"", ")", ";", "}", "}", "catch", "(", "AmazonClientException", "e", ")", "{", "throw", "translateException", "(", "\"copyFile(\"", "+", "srcKey", "+", "\", \"", "+", "dstKey", "+", "\")\"", ",", "srcKey", ",", "e", ")", ";", "}", "}" ]
Copy a single object in the bucket via a COPY operation. @param srcKey source object path @param dstKey destination object path @param size object size @throws AmazonClientException on failures inside the AWS SDK @throws InterruptedIOException the operation was interrupted @throws IOException Other IO problems
[ "Copy", "a", "single", "object", "in", "the", "bucket", "via", "a", "COPY", "operation", "." ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java#L1604-L1637
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getInfo
public Photo getInfo(String photoId, String secret) throws FlickrException { """ Get all info for the specified photo. The calling user must have permission to view the photo. This method does not require authentication. @param photoId The photo Id @param secret The optional secret String @return The Photo @throws FlickrException """ Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); parameters.put("photo_id", photoId); if (secret != null) { parameters.put("secret", secret); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photoElement = response.getPayload(); return PhotoUtils.createPhoto(photoElement); }
java
public Photo getInfo(String photoId, String secret) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); parameters.put("photo_id", photoId); if (secret != null) { parameters.put("secret", secret); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photoElement = response.getPayload(); return PhotoUtils.createPhoto(photoElement); }
[ "public", "Photo", "getInfo", "(", "String", "photoId", ",", "String", "secret", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_INFO", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "if", "(", "secret", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"secret\"", ",", "secret", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photoElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ";", "}" ]
Get all info for the specified photo. The calling user must have permission to view the photo. This method does not require authentication. @param photoId The photo Id @param secret The optional secret String @return The Photo @throws FlickrException
[ "Get", "all", "info", "for", "the", "specified", "photo", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L565-L581
google/closure-templates
java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java
SoyNodeCompiler.getParamStoreExpression
private Expression getParamStoreExpression(CallNode node, Label reattachPoint) { """ Returns an expression that creates a new {@link ParamStore} suitable for holding all the parameters. """ if (!node.isPassingData()) { return ConstructorRef.BASIC_PARAM_STORE.construct(constant(node.numChildren())); } Expression dataExpression; if (node.isPassingAllData()) { dataExpression = parameterLookup.getParamsRecord(); } else { dataExpression = getDataRecordExpression(node, reattachPoint); } Expression paramStoreExpression = ConstructorRef.AUGMENTED_PARAM_STORE.construct( dataExpression, constant(node.numChildren())); if (node.isPassingAllData()) { paramStoreExpression = maybeAddDefaultParams(node, paramStoreExpression).or(paramStoreExpression); } return paramStoreExpression; }
java
private Expression getParamStoreExpression(CallNode node, Label reattachPoint) { if (!node.isPassingData()) { return ConstructorRef.BASIC_PARAM_STORE.construct(constant(node.numChildren())); } Expression dataExpression; if (node.isPassingAllData()) { dataExpression = parameterLookup.getParamsRecord(); } else { dataExpression = getDataRecordExpression(node, reattachPoint); } Expression paramStoreExpression = ConstructorRef.AUGMENTED_PARAM_STORE.construct( dataExpression, constant(node.numChildren())); if (node.isPassingAllData()) { paramStoreExpression = maybeAddDefaultParams(node, paramStoreExpression).or(paramStoreExpression); } return paramStoreExpression; }
[ "private", "Expression", "getParamStoreExpression", "(", "CallNode", "node", ",", "Label", "reattachPoint", ")", "{", "if", "(", "!", "node", ".", "isPassingData", "(", ")", ")", "{", "return", "ConstructorRef", ".", "BASIC_PARAM_STORE", ".", "construct", "(", "constant", "(", "node", ".", "numChildren", "(", ")", ")", ")", ";", "}", "Expression", "dataExpression", ";", "if", "(", "node", ".", "isPassingAllData", "(", ")", ")", "{", "dataExpression", "=", "parameterLookup", ".", "getParamsRecord", "(", ")", ";", "}", "else", "{", "dataExpression", "=", "getDataRecordExpression", "(", "node", ",", "reattachPoint", ")", ";", "}", "Expression", "paramStoreExpression", "=", "ConstructorRef", ".", "AUGMENTED_PARAM_STORE", ".", "construct", "(", "dataExpression", ",", "constant", "(", "node", ".", "numChildren", "(", ")", ")", ")", ";", "if", "(", "node", ".", "isPassingAllData", "(", ")", ")", "{", "paramStoreExpression", "=", "maybeAddDefaultParams", "(", "node", ",", "paramStoreExpression", ")", ".", "or", "(", "paramStoreExpression", ")", ";", "}", "return", "paramStoreExpression", ";", "}" ]
Returns an expression that creates a new {@link ParamStore} suitable for holding all the parameters.
[ "Returns", "an", "expression", "that", "creates", "a", "new", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java#L1052-L1071
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/cli/CLIUtils.java
CLIUtils.generateArgline
public static String generateArgline(final String scriptpath, final String[] args, final Boolean unsafe) { """ Create an appropriately quoted argline to use given the command (script path) and argument strings. @param scriptpath path to command or script @param args arguments to pass to the command @param unsafe whether to use backwards-compatible, known-insecure quoting @return a String of the command followed by the arguments, where each item which has spaces is appropriately quoted. Pre-quoted items are not changed during "unsafe" quoting. """ return generateArgline(scriptpath, args, " ", unsafe); }
java
public static String generateArgline(final String scriptpath, final String[] args, final Boolean unsafe) { return generateArgline(scriptpath, args, " ", unsafe); }
[ "public", "static", "String", "generateArgline", "(", "final", "String", "scriptpath", ",", "final", "String", "[", "]", "args", ",", "final", "Boolean", "unsafe", ")", "{", "return", "generateArgline", "(", "scriptpath", ",", "args", ",", "\" \"", ",", "unsafe", ")", ";", "}" ]
Create an appropriately quoted argline to use given the command (script path) and argument strings. @param scriptpath path to command or script @param args arguments to pass to the command @param unsafe whether to use backwards-compatible, known-insecure quoting @return a String of the command followed by the arguments, where each item which has spaces is appropriately quoted. Pre-quoted items are not changed during "unsafe" quoting.
[ "Create", "an", "appropriately", "quoted", "argline", "to", "use", "given", "the", "command", "(", "script", "path", ")", "and", "argument", "strings", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/cli/CLIUtils.java#L66-L68
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/camera/VideoRenderProcessing.java
VideoRenderProcessing.outputToImage
protected void outputToImage( double x , double y , Point2D_F64 pt ) { """ Converts a coordinate from output image coordinates to input image """ pt.x = x*scale + tranX; pt.y = y*scale + tranY; }
java
protected void outputToImage( double x , double y , Point2D_F64 pt ) { pt.x = x*scale + tranX; pt.y = y*scale + tranY; }
[ "protected", "void", "outputToImage", "(", "double", "x", ",", "double", "y", ",", "Point2D_F64", "pt", ")", "{", "pt", ".", "x", "=", "x", "*", "scale", "+", "tranX", ";", "pt", ".", "y", "=", "y", "*", "scale", "+", "tranY", ";", "}" ]
Converts a coordinate from output image coordinates to input image
[ "Converts", "a", "coordinate", "from", "output", "image", "coordinates", "to", "input", "image" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera/VideoRenderProcessing.java#L147-L150
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/AnimatorModel.java
AnimatorModel.updateReversing
private void updateReversing(double extrp) { """ Update in reverse mode routine. @param extrp The extrapolation value. """ current -= speed * extrp; // First frame reached, done if (Double.compare(current, first) <= 0) { current = first; if (repeat) { state = AnimState.PLAYING; current += 1.0; } else { state = AnimState.FINISHED; } } }
java
private void updateReversing(double extrp) { current -= speed * extrp; // First frame reached, done if (Double.compare(current, first) <= 0) { current = first; if (repeat) { state = AnimState.PLAYING; current += 1.0; } else { state = AnimState.FINISHED; } } }
[ "private", "void", "updateReversing", "(", "double", "extrp", ")", "{", "current", "-=", "speed", "*", "extrp", ";", "// First frame reached, done", "if", "(", "Double", ".", "compare", "(", "current", ",", "first", ")", "<=", "0", ")", "{", "current", "=", "first", ";", "if", "(", "repeat", ")", "{", "state", "=", "AnimState", ".", "PLAYING", ";", "current", "+=", "1.0", ";", "}", "else", "{", "state", "=", "AnimState", ".", "FINISHED", ";", "}", "}", "}" ]
Update in reverse mode routine. @param extrp The extrapolation value.
[ "Update", "in", "reverse", "mode", "routine", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/AnimatorModel.java#L99-L118
line/armeria
core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java
AnnotatedHttpServiceFactory.getInstance
static <T> T getInstance(Annotation annotation, Class<T> expectedType) { """ Returns a cached instance of the specified {@link Class} which is specified in the given {@link Annotation}. """ try { @SuppressWarnings("unchecked") final Class<? extends T> clazz = (Class<? extends T>) invokeValueMethod(annotation); return expectedType.cast(instanceCache.computeIfAbsent(clazz, type -> { try { return getInstance0(clazz); } catch (Exception e) { throw new IllegalStateException( "A class specified in @" + annotation.getClass().getSimpleName() + " annotation must have an accessible default constructor: " + clazz.getName(), e); } })); } catch (ClassCastException e) { throw new IllegalArgumentException( "A class specified in @" + annotation.getClass().getSimpleName() + " annotation cannot be cast to " + expectedType, e); } }
java
static <T> T getInstance(Annotation annotation, Class<T> expectedType) { try { @SuppressWarnings("unchecked") final Class<? extends T> clazz = (Class<? extends T>) invokeValueMethod(annotation); return expectedType.cast(instanceCache.computeIfAbsent(clazz, type -> { try { return getInstance0(clazz); } catch (Exception e) { throw new IllegalStateException( "A class specified in @" + annotation.getClass().getSimpleName() + " annotation must have an accessible default constructor: " + clazz.getName(), e); } })); } catch (ClassCastException e) { throw new IllegalArgumentException( "A class specified in @" + annotation.getClass().getSimpleName() + " annotation cannot be cast to " + expectedType, e); } }
[ "static", "<", "T", ">", "T", "getInstance", "(", "Annotation", "annotation", ",", "Class", "<", "T", ">", "expectedType", ")", "{", "try", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "Class", "<", "?", "extends", "T", ">", "clazz", "=", "(", "Class", "<", "?", "extends", "T", ">", ")", "invokeValueMethod", "(", "annotation", ")", ";", "return", "expectedType", ".", "cast", "(", "instanceCache", ".", "computeIfAbsent", "(", "clazz", ",", "type", "->", "{", "try", "{", "return", "getInstance0", "(", "clazz", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"A class specified in @\"", "+", "annotation", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\" annotation must have an accessible default constructor: \"", "+", "clazz", ".", "getName", "(", ")", ",", "e", ")", ";", "}", "}", ")", ")", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A class specified in @\"", "+", "annotation", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\" annotation cannot be cast to \"", "+", "expectedType", ",", "e", ")", ";", "}", "}" ]
Returns a cached instance of the specified {@link Class} which is specified in the given {@link Annotation}.
[ "Returns", "a", "cached", "instance", "of", "the", "specified", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java#L735-L753
mikepenz/FastAdapter
library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java
FastAdapterDialog.withPositiveButton
public FastAdapterDialog<Item> withPositiveButton(@StringRes int textRes, OnClickListener listener) { """ Set a listener to be invoked when the positive button of the dialog is pressed. @param textRes The resource id of the text to display in the positive button @param listener The {@link DialogInterface.OnClickListener} to use. @return This Builder object to allow for chaining of calls to set methods """ return withButton(BUTTON_POSITIVE, textRes, listener); }
java
public FastAdapterDialog<Item> withPositiveButton(@StringRes int textRes, OnClickListener listener) { return withButton(BUTTON_POSITIVE, textRes, listener); }
[ "public", "FastAdapterDialog", "<", "Item", ">", "withPositiveButton", "(", "@", "StringRes", "int", "textRes", ",", "OnClickListener", "listener", ")", "{", "return", "withButton", "(", "BUTTON_POSITIVE", ",", "textRes", ",", "listener", ")", ";", "}" ]
Set a listener to be invoked when the positive button of the dialog is pressed. @param textRes The resource id of the text to display in the positive button @param listener The {@link DialogInterface.OnClickListener} to use. @return This Builder object to allow for chaining of calls to set methods
[ "Set", "a", "listener", "to", "be", "invoked", "when", "the", "positive", "button", "of", "the", "dialog", "is", "pressed", "." ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java#L142-L144
mikepenz/FastAdapter
library-core/src/main/java/com/mikepenz/fastadapter/utils/ComparableItemListImpl.java
ComparableItemListImpl.withComparator
public ComparableItemListImpl<Item> withComparator(@Nullable Comparator<Item> comparator) { """ define a comparator which will be used to sort the list "everytime" it is altered NOTE this will only sort if you "set" a new list or "add" new items (not if you provide a position for the add function) @param comparator used to sort the list @return this """ return withComparator(comparator, true); }
java
public ComparableItemListImpl<Item> withComparator(@Nullable Comparator<Item> comparator) { return withComparator(comparator, true); }
[ "public", "ComparableItemListImpl", "<", "Item", ">", "withComparator", "(", "@", "Nullable", "Comparator", "<", "Item", ">", "comparator", ")", "{", "return", "withComparator", "(", "comparator", ",", "true", ")", ";", "}" ]
define a comparator which will be used to sort the list "everytime" it is altered NOTE this will only sort if you "set" a new list or "add" new items (not if you provide a position for the add function) @param comparator used to sort the list @return this
[ "define", "a", "comparator", "which", "will", "be", "used", "to", "sort", "the", "list", "everytime", "it", "is", "altered", "NOTE", "this", "will", "only", "sort", "if", "you", "set", "a", "new", "list", "or", "add", "new", "items", "(", "not", "if", "you", "provide", "a", "position", "for", "the", "add", "function", ")" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/utils/ComparableItemListImpl.java#L44-L46
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.xmlAttributeInexistent
public static void xmlAttributeInexistent(String path, String attributeName, Class<?> aClass) { """ Thrown if attribute is present in the xml file. @param path xml path @param attributeName attribute present @param aClass attribute's class """ throw new XmlMappingAttributeDoesNotExistException (MSG.INSTANCE.message(xmlMappingAttributeDoesNotExistException2,attributeName,aClass.getSimpleName(),path)); }
java
public static void xmlAttributeInexistent(String path, String attributeName, Class<?> aClass){ throw new XmlMappingAttributeDoesNotExistException (MSG.INSTANCE.message(xmlMappingAttributeDoesNotExistException2,attributeName,aClass.getSimpleName(),path)); }
[ "public", "static", "void", "xmlAttributeInexistent", "(", "String", "path", ",", "String", "attributeName", ",", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "XmlMappingAttributeDoesNotExistException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "xmlMappingAttributeDoesNotExistException2", ",", "attributeName", ",", "aClass", ".", "getSimpleName", "(", ")", ",", "path", ")", ")", ";", "}" ]
Thrown if attribute is present in the xml file. @param path xml path @param attributeName attribute present @param aClass attribute's class
[ "Thrown", "if", "attribute", "is", "present", "in", "the", "xml", "file", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L294-L296
apache/incubator-atlas
webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
SetupSteps.runSetup
@PostConstruct public void runSetup() throws SetupException { """ Call each registered {@link SetupStep} one after the other. @throws SetupException Thrown with any error during running setup, including Zookeeper interactions, and individual failures in the {@link SetupStep}. """ HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration); InterProcessMutex lock = curatorFactory.lockInstance(zookeeperProperties.getZkRoot()); try { LOG.info("Trying to acquire lock for running setup."); lock.acquire(); LOG.info("Acquired lock for running setup."); handleSetupInProgress(configuration, zookeeperProperties); for (SetupStep step : setupSteps) { LOG.info("Running setup step: {}", step); step.run(); } clearSetupInProgress(zookeeperProperties); } catch (SetupException se) { LOG.error("Got setup exception while trying to setup", se); throw se; } catch (Throwable e) { LOG.error("Error running setup steps", e); throw new SetupException("Error running setup steps", e); } finally { releaseLock(lock); curatorFactory.close(); } }
java
@PostConstruct public void runSetup() throws SetupException { HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration); InterProcessMutex lock = curatorFactory.lockInstance(zookeeperProperties.getZkRoot()); try { LOG.info("Trying to acquire lock for running setup."); lock.acquire(); LOG.info("Acquired lock for running setup."); handleSetupInProgress(configuration, zookeeperProperties); for (SetupStep step : setupSteps) { LOG.info("Running setup step: {}", step); step.run(); } clearSetupInProgress(zookeeperProperties); } catch (SetupException se) { LOG.error("Got setup exception while trying to setup", se); throw se; } catch (Throwable e) { LOG.error("Error running setup steps", e); throw new SetupException("Error running setup steps", e); } finally { releaseLock(lock); curatorFactory.close(); } }
[ "@", "PostConstruct", "public", "void", "runSetup", "(", ")", "throws", "SetupException", "{", "HAConfiguration", ".", "ZookeeperProperties", "zookeeperProperties", "=", "HAConfiguration", ".", "getZookeeperProperties", "(", "configuration", ")", ";", "InterProcessMutex", "lock", "=", "curatorFactory", ".", "lockInstance", "(", "zookeeperProperties", ".", "getZkRoot", "(", ")", ")", ";", "try", "{", "LOG", ".", "info", "(", "\"Trying to acquire lock for running setup.\"", ")", ";", "lock", ".", "acquire", "(", ")", ";", "LOG", ".", "info", "(", "\"Acquired lock for running setup.\"", ")", ";", "handleSetupInProgress", "(", "configuration", ",", "zookeeperProperties", ")", ";", "for", "(", "SetupStep", "step", ":", "setupSteps", ")", "{", "LOG", ".", "info", "(", "\"Running setup step: {}\"", ",", "step", ")", ";", "step", ".", "run", "(", ")", ";", "}", "clearSetupInProgress", "(", "zookeeperProperties", ")", ";", "}", "catch", "(", "SetupException", "se", ")", "{", "LOG", ".", "error", "(", "\"Got setup exception while trying to setup\"", ",", "se", ")", ";", "throw", "se", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "LOG", ".", "error", "(", "\"Error running setup steps\"", ",", "e", ")", ";", "throw", "new", "SetupException", "(", "\"Error running setup steps\"", ",", "e", ")", ";", "}", "finally", "{", "releaseLock", "(", "lock", ")", ";", "curatorFactory", ".", "close", "(", ")", ";", "}", "}" ]
Call each registered {@link SetupStep} one after the other. @throws SetupException Thrown with any error during running setup, including Zookeeper interactions, and individual failures in the {@link SetupStep}.
[ "Call", "each", "registered", "{" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java#L75-L99
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.ellipticalArc
public SVGPath ellipticalArc(double[] rxy, double ar, double la, double sp, double[] xy) { """ Elliptical arc curve to the given coordinates. @param rxy radius @param ar x-axis-rotation @param la large arc flag, if angle &gt;= 180 deg @param sp sweep flag, if arc will be drawn in positive-angle direction @param xy new coordinates """ return append(PATH_ARC).append(rxy[0]).append(rxy[1]).append(ar).append(la).append(sp).append(xy[0]).append(xy[1]); }
java
public SVGPath ellipticalArc(double[] rxy, double ar, double la, double sp, double[] xy) { return append(PATH_ARC).append(rxy[0]).append(rxy[1]).append(ar).append(la).append(sp).append(xy[0]).append(xy[1]); }
[ "public", "SVGPath", "ellipticalArc", "(", "double", "[", "]", "rxy", ",", "double", "ar", ",", "double", "la", ",", "double", "sp", ",", "double", "[", "]", "xy", ")", "{", "return", "append", "(", "PATH_ARC", ")", ".", "append", "(", "rxy", "[", "0", "]", ")", ".", "append", "(", "rxy", "[", "1", "]", ")", ".", "append", "(", "ar", ")", ".", "append", "(", "la", ")", ".", "append", "(", "sp", ")", ".", "append", "(", "xy", "[", "0", "]", ")", ".", "append", "(", "xy", "[", "1", "]", ")", ";", "}" ]
Elliptical arc curve to the given coordinates. @param rxy radius @param ar x-axis-rotation @param la large arc flag, if angle &gt;= 180 deg @param sp sweep flag, if arc will be drawn in positive-angle direction @param xy new coordinates
[ "Elliptical", "arc", "curve", "to", "the", "given", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L576-L578
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/j/LongTuples.java
LongTuples.incrementLexicographically
private static boolean incrementLexicographically( MutableLongTuple current, LongTuple min, LongTuple max, int index) { """ Recursively increment the given tuple lexicographically, starting at the given index. @param current The tuple to increment @param min The minimum values @param max The maximum values @param index The index @return Whether the tuple could be incremented """ if (index == -1) { return false; } long oldValue = current.get(index); long newValue = oldValue + 1; current.set(index, newValue); if (newValue >= max.get(index)) { current.set(index, min.get(index)); return incrementLexicographically(current, min, max, index-1); } return true; }
java
private static boolean incrementLexicographically( MutableLongTuple current, LongTuple min, LongTuple max, int index) { if (index == -1) { return false; } long oldValue = current.get(index); long newValue = oldValue + 1; current.set(index, newValue); if (newValue >= max.get(index)) { current.set(index, min.get(index)); return incrementLexicographically(current, min, max, index-1); } return true; }
[ "private", "static", "boolean", "incrementLexicographically", "(", "MutableLongTuple", "current", ",", "LongTuple", "min", ",", "LongTuple", "max", ",", "int", "index", ")", "{", "if", "(", "index", "==", "-", "1", ")", "{", "return", "false", ";", "}", "long", "oldValue", "=", "current", ".", "get", "(", "index", ")", ";", "long", "newValue", "=", "oldValue", "+", "1", ";", "current", ".", "set", "(", "index", ",", "newValue", ")", ";", "if", "(", "newValue", ">=", "max", ".", "get", "(", "index", ")", ")", "{", "current", ".", "set", "(", "index", ",", "min", ".", "get", "(", "index", ")", ")", ";", "return", "incrementLexicographically", "(", "current", ",", "min", ",", "max", ",", "index", "-", "1", ")", ";", "}", "return", "true", ";", "}" ]
Recursively increment the given tuple lexicographically, starting at the given index. @param current The tuple to increment @param min The minimum values @param max The maximum values @param index The index @return Whether the tuple could be incremented
[ "Recursively", "increment", "the", "given", "tuple", "lexicographically", "starting", "at", "the", "given", "index", "." ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/j/LongTuples.java#L1557-L1573
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java
FastDateFormat.getDateTimeInstance
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) { """ 获得 {@link FastDateFormat} 实例<br> 支持缓存 @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT @param timeZone 时区{@link TimeZone} @param locale {@link Locale} 日期地理位置 @return 本地化 {@link FastDateFormat} """ return cache.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale); }
java
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) { return cache.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale); }
[ "public", "static", "FastDateFormat", "getDateTimeInstance", "(", "final", "int", "dateStyle", ",", "final", "int", "timeStyle", ",", "final", "TimeZone", "timeZone", ",", "final", "Locale", "locale", ")", "{", "return", "cache", ".", "getDateTimeInstance", "(", "dateStyle", ",", "timeStyle", ",", "timeZone", ",", "locale", ")", ";", "}" ]
获得 {@link FastDateFormat} 实例<br> 支持缓存 @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT @param timeZone 时区{@link TimeZone} @param locale {@link Locale} 日期地理位置 @return 本地化 {@link FastDateFormat}
[ "获得", "{", "@link", "FastDateFormat", "}", "实例<br", ">", "支持缓存" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L260-L262
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ParameterMapper.java
ParameterMapper.requestParamaterToObject
public static <T> T requestParamaterToObject(HttpServletRequest request, Class<T> c, String charset) { """ Request paramater to object t. @param <T> the type parameter @param request the request @param c the c @param charset the charset @return the t """ Map<String, String> map = new HashMap<>(); String query = request.getQueryString(); if (query != null) { String[] params = query.split("&"); for (String param : params) { if (param == null || param.indexOf('=') < 0) { continue; } String pv[] = param.split("="); if (pv.length != QUERY_PARAM_SPLIT_SIZE) { continue; } String value = pv[1]; try { value = URLDecoder.decode(pv[1], charset); } catch (UnsupportedEncodingException e) { log.info("unsupport encoding : " + pv[1]); value = pv[1]; } map.put(pv[0], value); } } return c.cast(mapToObject(map, c)); }
java
public static <T> T requestParamaterToObject(HttpServletRequest request, Class<T> c, String charset) { Map<String, String> map = new HashMap<>(); String query = request.getQueryString(); if (query != null) { String[] params = query.split("&"); for (String param : params) { if (param == null || param.indexOf('=') < 0) { continue; } String pv[] = param.split("="); if (pv.length != QUERY_PARAM_SPLIT_SIZE) { continue; } String value = pv[1]; try { value = URLDecoder.decode(pv[1], charset); } catch (UnsupportedEncodingException e) { log.info("unsupport encoding : " + pv[1]); value = pv[1]; } map.put(pv[0], value); } } return c.cast(mapToObject(map, c)); }
[ "public", "static", "<", "T", ">", "T", "requestParamaterToObject", "(", "HttpServletRequest", "request", ",", "Class", "<", "T", ">", "c", ",", "String", "charset", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<>", "(", ")", ";", "String", "query", "=", "request", ".", "getQueryString", "(", ")", ";", "if", "(", "query", "!=", "null", ")", "{", "String", "[", "]", "params", "=", "query", ".", "split", "(", "\"&\"", ")", ";", "for", "(", "String", "param", ":", "params", ")", "{", "if", "(", "param", "==", "null", "||", "param", ".", "indexOf", "(", "'", "'", ")", "<", "0", ")", "{", "continue", ";", "}", "String", "pv", "[", "]", "=", "param", ".", "split", "(", "\"=\"", ")", ";", "if", "(", "pv", ".", "length", "!=", "QUERY_PARAM_SPLIT_SIZE", ")", "{", "continue", ";", "}", "String", "value", "=", "pv", "[", "1", "]", ";", "try", "{", "value", "=", "URLDecoder", ".", "decode", "(", "pv", "[", "1", "]", ",", "charset", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "log", ".", "info", "(", "\"unsupport encoding : \"", "+", "pv", "[", "1", "]", ")", ";", "value", "=", "pv", "[", "1", "]", ";", "}", "map", ".", "put", "(", "pv", "[", "0", "]", ",", "value", ")", ";", "}", "}", "return", "c", ".", "cast", "(", "mapToObject", "(", "map", ",", "c", ")", ")", ";", "}" ]
Request paramater to object t. @param <T> the type parameter @param request the request @param c the c @param charset the charset @return the t
[ "Request", "paramater", "to", "object", "t", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ParameterMapper.java#L50-L83
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java
StringUtil.lastIndexOfIgnoreCase
public static int lastIndexOfIgnoreCase(String pString, String pLookFor) { """ Returns the index within this string of the rightmost occurrence of the specified substring. The rightmost empty string "" is considered to occur at the index value {@code pString.length() - 1}. @param pString The string to test @param pLookFor The string to look for @return If the string argument occurs one or more times as a substring within this object at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned. @see String#lastIndexOf(String) """ return lastIndexOfIgnoreCase(pString, pLookFor, pString != null ? pString.length() - 1 : -1); }
java
public static int lastIndexOfIgnoreCase(String pString, String pLookFor) { return lastIndexOfIgnoreCase(pString, pLookFor, pString != null ? pString.length() - 1 : -1); }
[ "public", "static", "int", "lastIndexOfIgnoreCase", "(", "String", "pString", ",", "String", "pLookFor", ")", "{", "return", "lastIndexOfIgnoreCase", "(", "pString", ",", "pLookFor", ",", "pString", "!=", "null", "?", "pString", ".", "length", "(", ")", "-", "1", ":", "-", "1", ")", ";", "}" ]
Returns the index within this string of the rightmost occurrence of the specified substring. The rightmost empty string "" is considered to occur at the index value {@code pString.length() - 1}. @param pString The string to test @param pLookFor The string to look for @return If the string argument occurs one or more times as a substring within this object at a starting index no greater than fromIndex, then the index of the first character of the last such substring is returned. If it does not occur as a substring starting at fromIndex or earlier, -1 is returned. @see String#lastIndexOf(String)
[ "Returns", "the", "index", "within", "this", "string", "of", "the", "rightmost", "occurrence", "of", "the", "specified", "substring", ".", "The", "rightmost", "empty", "string", "is", "considered", "to", "occur", "at", "the", "index", "value", "{", "@code", "pString", ".", "length", "()", "-", "1", "}", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java#L347-L349
xqbase/util
util/src/main/java/com/xqbase/util/Numbers.java
Numbers.parseDouble
public static double parseDouble(String s, double d) { """ Parse a <b>double</b> with a given default value <b>d</b> @return default value if null or not parsable """ if (s == null) { return d; } try { return Double.parseDouble(s.trim()); } catch (NumberFormatException e) { return d; } }
java
public static double parseDouble(String s, double d) { if (s == null) { return d; } try { return Double.parseDouble(s.trim()); } catch (NumberFormatException e) { return d; } }
[ "public", "static", "double", "parseDouble", "(", "String", "s", ",", "double", "d", ")", "{", "if", "(", "s", "==", "null", ")", "{", "return", "d", ";", "}", "try", "{", "return", "Double", ".", "parseDouble", "(", "s", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "d", ";", "}", "}" ]
Parse a <b>double</b> with a given default value <b>d</b> @return default value if null or not parsable
[ "Parse", "a", "<b", ">", "double<", "/", "b", ">", "with", "a", "given", "default", "value", "<b", ">", "d<", "/", "b", ">" ]
train
https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Numbers.java#L124-L133
lucee/Lucee
core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java
CFMLEngineImpl.getInstance
public static synchronized CFMLEngine getInstance(CFMLEngineFactory factory, BundleCollection bc) { """ get singelton instance of the CFML Engine @param factory @return CFMLEngine """ if (engine == null) { if (SystemUtil.getLoaderVersion() < 6.0D) { // windows needs 6.0 because restart is not working with older versions if (SystemUtil.isWindows()) throw new RuntimeException("You need to update a newer lucee.jar to run this version, you can download the latest jar from http://download.lucee.org."); else if (SystemUtil.getLoaderVersion() < 5.8D) throw new RuntimeException("You need to update your lucee.jar to run this version, you can download the latest jar from http://download.lucee.org."); else if (SystemUtil.getLoaderVersion() < 5.9D) SystemOut.printDate("To use all features Lucee provides, you need to update your lucee.jar, you can download the latest jar from http://download.lucee.org."); } engine = new CFMLEngineImpl(factory, bc); } return engine; }
java
public static synchronized CFMLEngine getInstance(CFMLEngineFactory factory, BundleCollection bc) { if (engine == null) { if (SystemUtil.getLoaderVersion() < 6.0D) { // windows needs 6.0 because restart is not working with older versions if (SystemUtil.isWindows()) throw new RuntimeException("You need to update a newer lucee.jar to run this version, you can download the latest jar from http://download.lucee.org."); else if (SystemUtil.getLoaderVersion() < 5.8D) throw new RuntimeException("You need to update your lucee.jar to run this version, you can download the latest jar from http://download.lucee.org."); else if (SystemUtil.getLoaderVersion() < 5.9D) SystemOut.printDate("To use all features Lucee provides, you need to update your lucee.jar, you can download the latest jar from http://download.lucee.org."); } engine = new CFMLEngineImpl(factory, bc); } return engine; }
[ "public", "static", "synchronized", "CFMLEngine", "getInstance", "(", "CFMLEngineFactory", "factory", ",", "BundleCollection", "bc", ")", "{", "if", "(", "engine", "==", "null", ")", "{", "if", "(", "SystemUtil", ".", "getLoaderVersion", "(", ")", "<", "6.0D", ")", "{", "// windows needs 6.0 because restart is not working with older versions", "if", "(", "SystemUtil", ".", "isWindows", "(", ")", ")", "throw", "new", "RuntimeException", "(", "\"You need to update a newer lucee.jar to run this version, you can download the latest jar from http://download.lucee.org.\"", ")", ";", "else", "if", "(", "SystemUtil", ".", "getLoaderVersion", "(", ")", "<", "5.8D", ")", "throw", "new", "RuntimeException", "(", "\"You need to update your lucee.jar to run this version, you can download the latest jar from http://download.lucee.org.\"", ")", ";", "else", "if", "(", "SystemUtil", ".", "getLoaderVersion", "(", ")", "<", "5.9D", ")", "SystemOut", ".", "printDate", "(", "\"To use all features Lucee provides, you need to update your lucee.jar, you can download the latest jar from http://download.lucee.org.\"", ")", ";", "}", "engine", "=", "new", "CFMLEngineImpl", "(", "factory", ",", "bc", ")", ";", "}", "return", "engine", ";", "}" ]
get singelton instance of the CFML Engine @param factory @return CFMLEngine
[ "get", "singelton", "instance", "of", "the", "CFML", "Engine" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java#L592-L607
infinispan/infinispan
core/src/main/java/org/infinispan/manager/DefaultCacheManager.java
DefaultCacheManager.getCache
@Override public <K, V> Cache<K, V> getCache() { """ Retrieves the default cache associated with this cache manager. Note that the default cache does not need to be explicitly created with {@link #createCache(String, String)} (String)} since it is automatically created lazily when first used. <p/> As such, this method is always guaranteed to return the default cache. @return the default cache. """ if (defaultCacheName == null) { throw log.noDefaultCache(); } return internalGetCache(defaultCacheName, defaultCacheName); }
java
@Override public <K, V> Cache<K, V> getCache() { if (defaultCacheName == null) { throw log.noDefaultCache(); } return internalGetCache(defaultCacheName, defaultCacheName); }
[ "@", "Override", "public", "<", "K", ",", "V", ">", "Cache", "<", "K", ",", "V", ">", "getCache", "(", ")", "{", "if", "(", "defaultCacheName", "==", "null", ")", "{", "throw", "log", ".", "noDefaultCache", "(", ")", ";", "}", "return", "internalGetCache", "(", "defaultCacheName", ",", "defaultCacheName", ")", ";", "}" ]
Retrieves the default cache associated with this cache manager. Note that the default cache does not need to be explicitly created with {@link #createCache(String, String)} (String)} since it is automatically created lazily when first used. <p/> As such, this method is always guaranteed to return the default cache. @return the default cache.
[ "Retrieves", "the", "default", "cache", "associated", "with", "this", "cache", "manager", ".", "Note", "that", "the", "default", "cache", "does", "not", "need", "to", "be", "explicitly", "created", "with", "{", "@link", "#createCache", "(", "String", "String", ")", "}", "(", "String", ")", "}", "since", "it", "is", "automatically", "created", "lazily", "when", "first", "used", ".", "<p", "/", ">", "As", "such", "this", "method", "is", "always", "guaranteed", "to", "return", "the", "default", "cache", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/manager/DefaultCacheManager.java#L434-L440
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecuteSQLQueryBuilder.java
ExecuteSQLQueryBuilder.validateScript
public ExecuteSQLQueryBuilder validateScript(String script, String type) { """ Validate SQL result set via validation script, for instance Groovy. @param script @param type """ ScriptValidationContext scriptValidationContext = new ScriptValidationContext(type); scriptValidationContext.setValidationScript(script); action.setScriptValidationContext(scriptValidationContext); return this; }
java
public ExecuteSQLQueryBuilder validateScript(String script, String type) { ScriptValidationContext scriptValidationContext = new ScriptValidationContext(type); scriptValidationContext.setValidationScript(script); action.setScriptValidationContext(scriptValidationContext); return this; }
[ "public", "ExecuteSQLQueryBuilder", "validateScript", "(", "String", "script", ",", "String", "type", ")", "{", "ScriptValidationContext", "scriptValidationContext", "=", "new", "ScriptValidationContext", "(", "type", ")", ";", "scriptValidationContext", ".", "setValidationScript", "(", "script", ")", ";", "action", ".", "setScriptValidationContext", "(", "scriptValidationContext", ")", ";", "return", "this", ";", "}" ]
Validate SQL result set via validation script, for instance Groovy. @param script @param type
[ "Validate", "SQL", "result", "set", "via", "validation", "script", "for", "instance", "Groovy", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecuteSQLQueryBuilder.java#L175-L180
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/component/UIComponent.java
UIComponent.getComponentAt
public UIComponent getComponentAt(int x, int y) { """ Gets the {@link UIComponent} at the specified coordinates.<br> Will return a {@link IControlComponent} if any. Checks if inside bounds, visible and not disabled. @param x the x @param y the y @return this {@link UIComponent} or null if outside its bounds. """ //control components take precedence over regular components for (IControlComponent c : controlComponents) { UIComponent component = c.getComponentAt(x, y); if (component != null) return component; } return isInsideBounds(x, y) ? this : null; }
java
public UIComponent getComponentAt(int x, int y) { //control components take precedence over regular components for (IControlComponent c : controlComponents) { UIComponent component = c.getComponentAt(x, y); if (component != null) return component; } return isInsideBounds(x, y) ? this : null; }
[ "public", "UIComponent", "getComponentAt", "(", "int", "x", ",", "int", "y", ")", "{", "//control components take precedence over regular components", "for", "(", "IControlComponent", "c", ":", "controlComponents", ")", "{", "UIComponent", "component", "=", "c", ".", "getComponentAt", "(", "x", ",", "y", ")", ";", "if", "(", "component", "!=", "null", ")", "return", "component", ";", "}", "return", "isInsideBounds", "(", "x", ",", "y", ")", "?", "this", ":", "null", ";", "}" ]
Gets the {@link UIComponent} at the specified coordinates.<br> Will return a {@link IControlComponent} if any. Checks if inside bounds, visible and not disabled. @param x the x @param y the y @return this {@link UIComponent} or null if outside its bounds.
[ "Gets", "the", "{", "@link", "UIComponent", "}", "at", "the", "specified", "coordinates", ".", "<br", ">", "Will", "return", "a", "{", "@link", "IControlComponent", "}", "if", "any", ".", "Checks", "if", "inside", "bounds", "visible", "and", "not", "disabled", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/component/UIComponent.java#L702-L713
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoKeyUtil.java
OmemoKeyUtil.addInBounds
public static int addInBounds(int value, int added) { """ Add integers modulo MAX_VALUE. @param value base integer @param added value that is added to the base value @return (value plus added) modulo Integer.MAX_VALUE """ int avail = Integer.MAX_VALUE - value; if (avail < added) { return added - avail; } else { return value + added; } }
java
public static int addInBounds(int value, int added) { int avail = Integer.MAX_VALUE - value; if (avail < added) { return added - avail; } else { return value + added; } }
[ "public", "static", "int", "addInBounds", "(", "int", "value", ",", "int", "added", ")", "{", "int", "avail", "=", "Integer", ".", "MAX_VALUE", "-", "value", ";", "if", "(", "avail", "<", "added", ")", "{", "return", "added", "-", "avail", ";", "}", "else", "{", "return", "value", "+", "added", ";", "}", "}" ]
Add integers modulo MAX_VALUE. @param value base integer @param added value that is added to the base value @return (value plus added) modulo Integer.MAX_VALUE
[ "Add", "integers", "modulo", "MAX_VALUE", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoKeyUtil.java#L383-L390
asterisk-java/asterisk-java
src/main/java/org/asteriskjava/manager/internal/ManagerUtil.java
ManagerUtil.addInternalActionId
public static String addInternalActionId(String actionId, String internalActionId) { """ Adds the internal action id to the given action id. @param actionId the action id as set by the user. @param internalActionId the internal action id to add. @return the action id prefixed by the internal action id suitable to be sent to Asterisk. """ if (actionId == null) { return internalActionId + INTERNAL_ACTION_ID_DELIMITER; } return internalActionId + INTERNAL_ACTION_ID_DELIMITER + actionId; }
java
public static String addInternalActionId(String actionId, String internalActionId) { if (actionId == null) { return internalActionId + INTERNAL_ACTION_ID_DELIMITER; } return internalActionId + INTERNAL_ACTION_ID_DELIMITER + actionId; }
[ "public", "static", "String", "addInternalActionId", "(", "String", "actionId", ",", "String", "internalActionId", ")", "{", "if", "(", "actionId", "==", "null", ")", "{", "return", "internalActionId", "+", "INTERNAL_ACTION_ID_DELIMITER", ";", "}", "return", "internalActionId", "+", "INTERNAL_ACTION_ID_DELIMITER", "+", "actionId", ";", "}" ]
Adds the internal action id to the given action id. @param actionId the action id as set by the user. @param internalActionId the internal action id to add. @return the action id prefixed by the internal action id suitable to be sent to Asterisk.
[ "Adds", "the", "internal", "action", "id", "to", "the", "given", "action", "id", "." ]
train
https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/manager/internal/ManagerUtil.java#L123-L130
zaproxy/zaproxy
src/org/zaproxy/zap/view/StandardFieldsDialog.java
StandardFieldsDialog.addTableField
public void addTableField(String fieldLabel, JTable field, List<JButton> buttons) { """ Add a table field. @param fieldLabel If null then the table will be full width @param field the table field @param buttons if not null then the buttons will be added to the right of the table """ validateNotTabbed(); JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setViewportView(field); field.setFillsViewportHeight(true); // Tables are a special case - they don't have labels and are accessed via the model if (this.fieldList.contains(field)) { throw new IllegalArgumentException("Field already added: " + field); } if (buttons == null || buttons.size() == 0) { if (fieldLabel == null) { this.getMainPanel().add(scrollPane, LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4))); } else { this.addField(fieldLabel, field, scrollPane, 1.0D); } } else { JPanel tablePanel = new JPanel(); tablePanel.setLayout(new GridBagLayout()); tablePanel.add(scrollPane, LayoutHelper.getGBC(0, 0, 1, 1.0D, 1.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4))); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); int buttonId = 0; for (JButton button : buttons) { buttonPanel.add(button, LayoutHelper.getGBC(0, buttonId++, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2))); } // Add spacer to force buttons to the top buttonPanel.add(new JLabel(), LayoutHelper.getGBC(0, buttonId++, 1, 0D, 1.0D, GridBagConstraints.BOTH, new Insets(2,2,2,2))); tablePanel.add(buttonPanel, LayoutHelper.getGBC(1, 0, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2))); if (fieldLabel == null) { this.getMainPanel().add(tablePanel, LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4))); } else { this.addField(fieldLabel, field, tablePanel, 1.0D); } } this.fieldList.add(field); }
java
public void addTableField(String fieldLabel, JTable field, List<JButton> buttons) { validateNotTabbed(); JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setViewportView(field); field.setFillsViewportHeight(true); // Tables are a special case - they don't have labels and are accessed via the model if (this.fieldList.contains(field)) { throw new IllegalArgumentException("Field already added: " + field); } if (buttons == null || buttons.size() == 0) { if (fieldLabel == null) { this.getMainPanel().add(scrollPane, LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4))); } else { this.addField(fieldLabel, field, scrollPane, 1.0D); } } else { JPanel tablePanel = new JPanel(); tablePanel.setLayout(new GridBagLayout()); tablePanel.add(scrollPane, LayoutHelper.getGBC(0, 0, 1, 1.0D, 1.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4))); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); int buttonId = 0; for (JButton button : buttons) { buttonPanel.add(button, LayoutHelper.getGBC(0, buttonId++, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2))); } // Add spacer to force buttons to the top buttonPanel.add(new JLabel(), LayoutHelper.getGBC(0, buttonId++, 1, 0D, 1.0D, GridBagConstraints.BOTH, new Insets(2,2,2,2))); tablePanel.add(buttonPanel, LayoutHelper.getGBC(1, 0, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2))); if (fieldLabel == null) { this.getMainPanel().add(tablePanel, LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4))); } else { this.addField(fieldLabel, field, tablePanel, 1.0D); } } this.fieldList.add(field); }
[ "public", "void", "addTableField", "(", "String", "fieldLabel", ",", "JTable", "field", ",", "List", "<", "JButton", ">", "buttons", ")", "{", "validateNotTabbed", "(", ")", ";", "JScrollPane", "scrollPane", "=", "new", "JScrollPane", "(", ")", ";", "scrollPane", ".", "setVerticalScrollBarPolicy", "(", "JScrollPane", ".", "VERTICAL_SCROLLBAR_AS_NEEDED", ")", ";", "scrollPane", ".", "setViewportView", "(", "field", ")", ";", "field", ".", "setFillsViewportHeight", "(", "true", ")", ";", "// Tables are a special case - they don't have labels and are accessed via the model", "if", "(", "this", ".", "fieldList", ".", "contains", "(", "field", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Field already added: \"", "+", "field", ")", ";", "}", "if", "(", "buttons", "==", "null", "||", "buttons", ".", "size", "(", ")", "==", "0", ")", "{", "if", "(", "fieldLabel", "==", "null", ")", "{", "this", ".", "getMainPanel", "(", ")", ".", "add", "(", "scrollPane", ",", "LayoutHelper", ".", "getGBC", "(", "1", ",", "this", ".", "fieldList", ".", "size", "(", ")", ",", "1", ",", "fieldWeight", ",", "1.0D", ",", "GridBagConstraints", ".", "BOTH", ",", "new", "Insets", "(", "4", ",", "4", ",", "4", ",", "4", ")", ")", ")", ";", "}", "else", "{", "this", ".", "addField", "(", "fieldLabel", ",", "field", ",", "scrollPane", ",", "1.0D", ")", ";", "}", "}", "else", "{", "JPanel", "tablePanel", "=", "new", "JPanel", "(", ")", ";", "tablePanel", ".", "setLayout", "(", "new", "GridBagLayout", "(", ")", ")", ";", "tablePanel", ".", "add", "(", "scrollPane", ",", "LayoutHelper", ".", "getGBC", "(", "0", ",", "0", ",", "1", ",", "1.0D", ",", "1.0D", ",", "GridBagConstraints", ".", "BOTH", ",", "new", "Insets", "(", "4", ",", "4", ",", "4", ",", "4", ")", ")", ")", ";", "JPanel", "buttonPanel", "=", "new", "JPanel", "(", ")", ";", "buttonPanel", ".", "setLayout", "(", "new", "GridBagLayout", "(", ")", ")", ";", "int", "buttonId", "=", "0", ";", "for", "(", "JButton", "button", ":", "buttons", ")", "{", "buttonPanel", ".", "add", "(", "button", ",", "LayoutHelper", ".", "getGBC", "(", "0", ",", "buttonId", "++", ",", "1", ",", "0D", ",", "0D", ",", "GridBagConstraints", ".", "BOTH", ",", "new", "Insets", "(", "2", ",", "2", ",", "2", ",", "2", ")", ")", ")", ";", "}", "// Add spacer to force buttons to the top", "buttonPanel", ".", "add", "(", "new", "JLabel", "(", ")", ",", "LayoutHelper", ".", "getGBC", "(", "0", ",", "buttonId", "++", ",", "1", ",", "0D", ",", "1.0D", ",", "GridBagConstraints", ".", "BOTH", ",", "new", "Insets", "(", "2", ",", "2", ",", "2", ",", "2", ")", ")", ")", ";", "tablePanel", ".", "add", "(", "buttonPanel", ",", "LayoutHelper", ".", "getGBC", "(", "1", ",", "0", ",", "1", ",", "0D", ",", "0D", ",", "GridBagConstraints", ".", "BOTH", ",", "new", "Insets", "(", "2", ",", "2", ",", "2", ",", "2", ")", ")", ")", ";", "if", "(", "fieldLabel", "==", "null", ")", "{", "this", ".", "getMainPanel", "(", ")", ".", "add", "(", "tablePanel", ",", "LayoutHelper", ".", "getGBC", "(", "1", ",", "this", ".", "fieldList", ".", "size", "(", ")", ",", "1", ",", "fieldWeight", ",", "1.0D", ",", "GridBagConstraints", ".", "BOTH", ",", "new", "Insets", "(", "4", ",", "4", ",", "4", ",", "4", ")", ")", ")", ";", "}", "else", "{", "this", ".", "addField", "(", "fieldLabel", ",", "field", ",", "tablePanel", ",", "1.0D", ")", ";", "}", "}", "this", ".", "fieldList", ".", "add", "(", "field", ")", ";", "}" ]
Add a table field. @param fieldLabel If null then the table will be full width @param field the table field @param buttons if not null then the buttons will be added to the right of the table
[ "Add", "a", "table", "field", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/StandardFieldsDialog.java#L900-L949
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java
JobsInner.getOutputAsync
public Observable<InputStream> getOutputAsync(String resourceGroupName, String automationAccountName, String jobId) { """ Retrieve the job output identified by job id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the InputStream object """ return getOutputWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<InputStream>, InputStream>() { @Override public InputStream call(ServiceResponse<InputStream> response) { return response.body(); } }); }
java
public Observable<InputStream> getOutputAsync(String resourceGroupName, String automationAccountName, String jobId) { return getOutputWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<InputStream>, InputStream>() { @Override public InputStream call(ServiceResponse<InputStream> response) { return response.body(); } }); }
[ "public", "Observable", "<", "InputStream", ">", "getOutputAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "jobId", ")", "{", "return", "getOutputWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "jobId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "InputStream", ">", ",", "InputStream", ">", "(", ")", "{", "@", "Override", "public", "InputStream", "call", "(", "ServiceResponse", "<", "InputStream", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieve the job output identified by job id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the InputStream object
[ "Retrieve", "the", "job", "output", "identified", "by", "job", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java#L146-L153
msgpack/msgpack-java
msgpack-core/src/main/java/org/msgpack/core/MessagePack.java
MessagePack.newDefaultUnpacker
public static MessageUnpacker newDefaultUnpacker(byte[] contents, int offset, int length) { """ Creates an unpacker that deserializes objects from subarray of a specified byte array. <p> This method provides an optimized implementation of <code>newDefaultUnpacker(new ByteArrayInputStream(contents, offset, length))</code>. <p> This method is equivalent to <code>DEFAULT_UNPACKER_CONFIG.newDefaultUnpacker(contents)</code>. @param contents The byte array that contains packed objects @param offset The index of the first byte @param length The number of bytes @return A new MessageUnpacker instance that will never throw IOException """ return DEFAULT_UNPACKER_CONFIG.newUnpacker(contents, offset, length); }
java
public static MessageUnpacker newDefaultUnpacker(byte[] contents, int offset, int length) { return DEFAULT_UNPACKER_CONFIG.newUnpacker(contents, offset, length); }
[ "public", "static", "MessageUnpacker", "newDefaultUnpacker", "(", "byte", "[", "]", "contents", ",", "int", "offset", ",", "int", "length", ")", "{", "return", "DEFAULT_UNPACKER_CONFIG", ".", "newUnpacker", "(", "contents", ",", "offset", ",", "length", ")", ";", "}" ]
Creates an unpacker that deserializes objects from subarray of a specified byte array. <p> This method provides an optimized implementation of <code>newDefaultUnpacker(new ByteArrayInputStream(contents, offset, length))</code>. <p> This method is equivalent to <code>DEFAULT_UNPACKER_CONFIG.newDefaultUnpacker(contents)</code>. @param contents The byte array that contains packed objects @param offset The index of the first byte @param length The number of bytes @return A new MessageUnpacker instance that will never throw IOException
[ "Creates", "an", "unpacker", "that", "deserializes", "objects", "from", "subarray", "of", "a", "specified", "byte", "array", ".", "<p", ">", "This", "method", "provides", "an", "optimized", "implementation", "of", "<code", ">", "newDefaultUnpacker", "(", "new", "ByteArrayInputStream", "(", "contents", "offset", "length", "))", "<", "/", "code", ">", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "<code", ">", "DEFAULT_UNPACKER_CONFIG", ".", "newDefaultUnpacker", "(", "contents", ")", "<", "/", "code", ">", "." ]
train
https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessagePack.java#L309-L312
Azure/azure-sdk-for-java
mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java
ServersInner.getByResourceGroup
public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { """ Gets information about a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @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 ServerInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); }
java
public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); }
[ "public", "ServerInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets information about a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @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 ServerInner object if successful.
[ "Gets", "information", "about", "a", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java#L615-L617