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
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java
SSLConfigManager.addSSLPropertiesFromKeyStore
public synchronized void addSSLPropertiesFromKeyStore(WSKeyStore wsks, SSLConfig sslprops) { """ Adds all the properties from a WSKeyStore to an SSLConfig. @param wsks @param sslprops """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "addSSLPropertiesFromKeyStore"); for (Enumeration<?> e = wsks.propertyNames(); e.hasMoreElements();) { String property = (String) e.nextElement(); String value = wsks.getProperty(property); sslprops.setProperty(property, value); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "addSSLPropertiesFromKeyStore"); }
java
public synchronized void addSSLPropertiesFromKeyStore(WSKeyStore wsks, SSLConfig sslprops) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "addSSLPropertiesFromKeyStore"); for (Enumeration<?> e = wsks.propertyNames(); e.hasMoreElements();) { String property = (String) e.nextElement(); String value = wsks.getProperty(property); sslprops.setProperty(property, value); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "addSSLPropertiesFromKeyStore"); }
[ "public", "synchronized", "void", "addSSLPropertiesFromKeyStore", "(", "WSKeyStore", "wsks", ",", "SSLConfig", "sslprops", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"addSSLPropertiesFromKeyStore\"", ")", ";", "for", "(", "Enumeration", "<", "?", ">", "e", "=", "wsks", ".", "propertyNames", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "String", "property", "=", "(", "String", ")", "e", ".", "nextElement", "(", ")", ";", "String", "value", "=", "wsks", ".", "getProperty", "(", "property", ")", ";", "sslprops", ".", "setProperty", "(", "property", ",", "value", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"addSSLPropertiesFromKeyStore\"", ")", ";", "}" ]
Adds all the properties from a WSKeyStore to an SSLConfig. @param wsks @param sslprops
[ "Adds", "all", "the", "properties", "from", "a", "WSKeyStore", "to", "an", "SSLConfig", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java#L536-L547
Axway/Grapes
server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java
ArtifactResource.isPromoted
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/isPromoted") public Response isPromoted(@QueryParam("user") final String user, @QueryParam("stage") final int stage, @QueryParam("name") final String filename, @QueryParam("sha256") final String sha256, @QueryParam("type") final String type, @QueryParam("location") final String location) { """ Return promotion status of an Artifact regarding artifactQuery from third party. This method is call via POST <grapes_url>/artifact/isPromoted @param user The user name in the external system @param stage An integer value depending on the stage in the external system @param filename The name of the file needing validation @param sha256 The file checksum value @param type The type of the file as defined in the external system @param location The location of the binary file @return Response A response message in case the request is invalid or or an object containing the promotional status and additional message providing human readable information """ LOG.info("Got a get artifact promotion request"); // Validating request final ArtifactQuery query = new ArtifactQuery(user, stage, filename, sha256, type, location); DataValidator.validate(query); if(LOG.isInfoEnabled()) { LOG.info(String.format("Artifact validation request. Details [%s]", query.toString())); } // Validating type of request file final GrapesServerConfig cfg = getConfig(); final List<String> validatedTypes = cfg.getExternalValidatedTypes(); if(!validatedTypes.contains(type)) { return Response.ok(buildArtifactNotSupportedResponse(validatedTypes)).status(HttpStatus.UNPROCESSABLE_ENTITY_422).build(); } final DbArtifact dbArtifact = getArtifactHandler().getArtifactUsingSHA256(sha256); // // No such artifact was identified in the underlying data structure // if(dbArtifact == null) { final String jiraLink = buildArtifactNotificationJiraLink(query); sender.send(cfg.getArtifactNotificationRecipients(), buildArtifactValidationSubject(filename), buildArtifactValidationBody(query, "N/A")); // No Jenkins job if not artifact return Response.ok(buildArtifactNotKnown(query, jiraLink)).status(HttpStatus.NOT_FOUND_404).build(); } final ArtifactPromotionStatus promotionStatus = new ArtifactPromotionStatus(); promotionStatus.setPromoted(dbArtifact.isPromoted()); // If artifact is promoted if(dbArtifact.isPromoted()){ promotionStatus.setMessage(Messages.get(ARTIFACT_VALIDATION_IS_PROMOTED)); return Response.ok(promotionStatus).build(); } else { final String jenkinsJobInfo = getArtifactHandler().getModuleJenkinsJobInfo(dbArtifact); promotionStatus.setMessage(buildArtifactNotPromotedYetResponse(query, jenkinsJobInfo.isEmpty() ? "<i>(Link to Jenkins job not found)</i>" : jenkinsJobInfo)); // If someone just did not promote the artifact, don't spam the support with more emails } return Response.ok(promotionStatus).build(); }
java
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/isPromoted") public Response isPromoted(@QueryParam("user") final String user, @QueryParam("stage") final int stage, @QueryParam("name") final String filename, @QueryParam("sha256") final String sha256, @QueryParam("type") final String type, @QueryParam("location") final String location) { LOG.info("Got a get artifact promotion request"); // Validating request final ArtifactQuery query = new ArtifactQuery(user, stage, filename, sha256, type, location); DataValidator.validate(query); if(LOG.isInfoEnabled()) { LOG.info(String.format("Artifact validation request. Details [%s]", query.toString())); } // Validating type of request file final GrapesServerConfig cfg = getConfig(); final List<String> validatedTypes = cfg.getExternalValidatedTypes(); if(!validatedTypes.contains(type)) { return Response.ok(buildArtifactNotSupportedResponse(validatedTypes)).status(HttpStatus.UNPROCESSABLE_ENTITY_422).build(); } final DbArtifact dbArtifact = getArtifactHandler().getArtifactUsingSHA256(sha256); // // No such artifact was identified in the underlying data structure // if(dbArtifact == null) { final String jiraLink = buildArtifactNotificationJiraLink(query); sender.send(cfg.getArtifactNotificationRecipients(), buildArtifactValidationSubject(filename), buildArtifactValidationBody(query, "N/A")); // No Jenkins job if not artifact return Response.ok(buildArtifactNotKnown(query, jiraLink)).status(HttpStatus.NOT_FOUND_404).build(); } final ArtifactPromotionStatus promotionStatus = new ArtifactPromotionStatus(); promotionStatus.setPromoted(dbArtifact.isPromoted()); // If artifact is promoted if(dbArtifact.isPromoted()){ promotionStatus.setMessage(Messages.get(ARTIFACT_VALIDATION_IS_PROMOTED)); return Response.ok(promotionStatus).build(); } else { final String jenkinsJobInfo = getArtifactHandler().getModuleJenkinsJobInfo(dbArtifact); promotionStatus.setMessage(buildArtifactNotPromotedYetResponse(query, jenkinsJobInfo.isEmpty() ? "<i>(Link to Jenkins job not found)</i>" : jenkinsJobInfo)); // If someone just did not promote the artifact, don't spam the support with more emails } return Response.ok(promotionStatus).build(); }
[ "@", "GET", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Path", "(", "\"/isPromoted\"", ")", "public", "Response", "isPromoted", "(", "@", "QueryParam", "(", "\"user\"", ")", "final", "String", "user", ",", "@", "QueryParam", "(", "\"stage\"", ")", "final", "int", "stage", ",", "@", "QueryParam", "(", "\"name\"", ")", "final", "String", "filename", ",", "@", "QueryParam", "(", "\"sha256\"", ")", "final", "String", "sha256", ",", "@", "QueryParam", "(", "\"type\"", ")", "final", "String", "type", ",", "@", "QueryParam", "(", "\"location\"", ")", "final", "String", "location", ")", "{", "LOG", ".", "info", "(", "\"Got a get artifact promotion request\"", ")", ";", "// Validating request", "final", "ArtifactQuery", "query", "=", "new", "ArtifactQuery", "(", "user", ",", "stage", ",", "filename", ",", "sha256", ",", "type", ",", "location", ")", ";", "DataValidator", ".", "validate", "(", "query", ")", ";", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "LOG", ".", "info", "(", "String", ".", "format", "(", "\"Artifact validation request. Details [%s]\"", ",", "query", ".", "toString", "(", ")", ")", ")", ";", "}", "// Validating type of request file", "final", "GrapesServerConfig", "cfg", "=", "getConfig", "(", ")", ";", "final", "List", "<", "String", ">", "validatedTypes", "=", "cfg", ".", "getExternalValidatedTypes", "(", ")", ";", "if", "(", "!", "validatedTypes", ".", "contains", "(", "type", ")", ")", "{", "return", "Response", ".", "ok", "(", "buildArtifactNotSupportedResponse", "(", "validatedTypes", ")", ")", ".", "status", "(", "HttpStatus", ".", "UNPROCESSABLE_ENTITY_422", ")", ".", "build", "(", ")", ";", "}", "final", "DbArtifact", "dbArtifact", "=", "getArtifactHandler", "(", ")", ".", "getArtifactUsingSHA256", "(", "sha256", ")", ";", "//", "// No such artifact was identified in the underlying data structure", "//", "if", "(", "dbArtifact", "==", "null", ")", "{", "final", "String", "jiraLink", "=", "buildArtifactNotificationJiraLink", "(", "query", ")", ";", "sender", ".", "send", "(", "cfg", ".", "getArtifactNotificationRecipients", "(", ")", ",", "buildArtifactValidationSubject", "(", "filename", ")", ",", "buildArtifactValidationBody", "(", "query", ",", "\"N/A\"", ")", ")", ";", "// No Jenkins job if not artifact", "return", "Response", ".", "ok", "(", "buildArtifactNotKnown", "(", "query", ",", "jiraLink", ")", ")", ".", "status", "(", "HttpStatus", ".", "NOT_FOUND_404", ")", ".", "build", "(", ")", ";", "}", "final", "ArtifactPromotionStatus", "promotionStatus", "=", "new", "ArtifactPromotionStatus", "(", ")", ";", "promotionStatus", ".", "setPromoted", "(", "dbArtifact", ".", "isPromoted", "(", ")", ")", ";", "// If artifact is promoted", "if", "(", "dbArtifact", ".", "isPromoted", "(", ")", ")", "{", "promotionStatus", ".", "setMessage", "(", "Messages", ".", "get", "(", "ARTIFACT_VALIDATION_IS_PROMOTED", ")", ")", ";", "return", "Response", ".", "ok", "(", "promotionStatus", ")", ".", "build", "(", ")", ";", "}", "else", "{", "final", "String", "jenkinsJobInfo", "=", "getArtifactHandler", "(", ")", ".", "getModuleJenkinsJobInfo", "(", "dbArtifact", ")", ";", "promotionStatus", ".", "setMessage", "(", "buildArtifactNotPromotedYetResponse", "(", "query", ",", "jenkinsJobInfo", ".", "isEmpty", "(", ")", "?", "\"<i>(Link to Jenkins job not found)</i>\"", ":", "jenkinsJobInfo", ")", ")", ";", "// If someone just did not promote the artifact, don't spam the support with more emails", "}", "return", "Response", ".", "ok", "(", "promotionStatus", ")", ".", "build", "(", ")", ";", "}" ]
Return promotion status of an Artifact regarding artifactQuery from third party. This method is call via POST <grapes_url>/artifact/isPromoted @param user The user name in the external system @param stage An integer value depending on the stage in the external system @param filename The name of the file needing validation @param sha256 The file checksum value @param type The type of the file as defined in the external system @param location The location of the binary file @return Response A response message in case the request is invalid or or an object containing the promotional status and additional message providing human readable information
[ "Return", "promotion", "status", "of", "an", "Artifact", "regarding", "artifactQuery", "from", "third", "party", ".", "This", "method", "is", "call", "via", "POST", "<grapes_url", ">", "/", "artifact", "/", "isPromoted" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java#L258-L318
orhanobut/dialogplus
dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java
DialogPlusBuilder.setHeader
public DialogPlusBuilder setHeader(@NonNull View view, boolean fixed) { """ Set the header view using a view @param fixed is used to determine whether header should be fixed or not. Fixed if true, scrollable otherwise """ this.headerView = view; this.fixedHeader = fixed; return this; }
java
public DialogPlusBuilder setHeader(@NonNull View view, boolean fixed) { this.headerView = view; this.fixedHeader = fixed; return this; }
[ "public", "DialogPlusBuilder", "setHeader", "(", "@", "NonNull", "View", "view", ",", "boolean", "fixed", ")", "{", "this", ".", "headerView", "=", "view", ";", "this", ".", "fixedHeader", "=", "fixed", ";", "return", "this", ";", "}" ]
Set the header view using a view @param fixed is used to determine whether header should be fixed or not. Fixed if true, scrollable otherwise
[ "Set", "the", "header", "view", "using", "a", "view" ]
train
https://github.com/orhanobut/dialogplus/blob/291bf4daaa3c81bf5537125f547913beb8ee2c17/dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java#L137-L141
jcuda/jcudnn
JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java
JCudnn.cudnnGetConvolutionBackwardDataWorkspaceSize
public static int cudnnGetConvolutionBackwardDataWorkspaceSize( cudnnHandle handle, cudnnFilterDescriptor wDesc, cudnnTensorDescriptor dyDesc, cudnnConvolutionDescriptor convDesc, cudnnTensorDescriptor dxDesc, int algo, long[] sizeInBytes) { """ Helper function to return the minimum size of the workspace to be passed to the convolution given an algo """ return checkResult(cudnnGetConvolutionBackwardDataWorkspaceSizeNative(handle, wDesc, dyDesc, convDesc, dxDesc, algo, sizeInBytes)); }
java
public static int cudnnGetConvolutionBackwardDataWorkspaceSize( cudnnHandle handle, cudnnFilterDescriptor wDesc, cudnnTensorDescriptor dyDesc, cudnnConvolutionDescriptor convDesc, cudnnTensorDescriptor dxDesc, int algo, long[] sizeInBytes) { return checkResult(cudnnGetConvolutionBackwardDataWorkspaceSizeNative(handle, wDesc, dyDesc, convDesc, dxDesc, algo, sizeInBytes)); }
[ "public", "static", "int", "cudnnGetConvolutionBackwardDataWorkspaceSize", "(", "cudnnHandle", "handle", ",", "cudnnFilterDescriptor", "wDesc", ",", "cudnnTensorDescriptor", "dyDesc", ",", "cudnnConvolutionDescriptor", "convDesc", ",", "cudnnTensorDescriptor", "dxDesc", ",", "int", "algo", ",", "long", "[", "]", "sizeInBytes", ")", "{", "return", "checkResult", "(", "cudnnGetConvolutionBackwardDataWorkspaceSizeNative", "(", "handle", ",", "wDesc", ",", "dyDesc", ",", "convDesc", ",", "dxDesc", ",", "algo", ",", "sizeInBytes", ")", ")", ";", "}" ]
Helper function to return the minimum size of the workspace to be passed to the convolution given an algo
[ "Helper", "function", "to", "return", "the", "minimum", "size", "of", "the", "workspace", "to", "be", "passed", "to", "the", "convolution", "given", "an", "algo" ]
train
https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L1540-L1550
OpenFeign/feign
core/src/main/java/feign/template/UriUtils.java
UriUtils.queryParamEncode
public static String queryParamEncode(String queryParam, Charset charset) { """ Uri Encode a Query Parameter name or value. @param queryParam containing the query parameter. @param charset to use. @return the encoded query fragment. """ return encodeReserved(queryParam, FragmentType.QUERY_PARAM, charset); }
java
public static String queryParamEncode(String queryParam, Charset charset) { return encodeReserved(queryParam, FragmentType.QUERY_PARAM, charset); }
[ "public", "static", "String", "queryParamEncode", "(", "String", "queryParam", ",", "Charset", "charset", ")", "{", "return", "encodeReserved", "(", "queryParam", ",", "FragmentType", ".", "QUERY_PARAM", ",", "charset", ")", ";", "}" ]
Uri Encode a Query Parameter name or value. @param queryParam containing the query parameter. @param charset to use. @return the encoded query fragment.
[ "Uri", "Encode", "a", "Query", "Parameter", "name", "or", "value", "." ]
train
https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/template/UriUtils.java#L117-L119
JOML-CI/JOML
src/org/joml/Matrix3x2f.java
Matrix3x2f.scaleAround
public Matrix3x2f scaleAround(float sx, float sy, float ox, float oy) { """ Apply scaling to this matrix by scaling the base axes by the given sx and sy factors while using <code>(ox, oy)</code> as the scaling origin. <p> If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix, then the new matrix will be <code>M * S</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the scaling will be applied first! <p> This method is equivalent to calling: <code>translate(ox, oy).scale(sx, sy).translate(-ox, -oy)</code> @param sx the scaling factor of the x component @param sy the scaling factor of the y component @param ox the x coordinate of the scaling origin @param oy the y coordinate of the scaling origin @return this """ return scaleAround(sx, sy, ox, oy, this); }
java
public Matrix3x2f scaleAround(float sx, float sy, float ox, float oy) { return scaleAround(sx, sy, ox, oy, this); }
[ "public", "Matrix3x2f", "scaleAround", "(", "float", "sx", ",", "float", "sy", ",", "float", "ox", ",", "float", "oy", ")", "{", "return", "scaleAround", "(", "sx", ",", "sy", ",", "ox", ",", "oy", ",", "this", ")", ";", "}" ]
Apply scaling to this matrix by scaling the base axes by the given sx and sy factors while using <code>(ox, oy)</code> as the scaling origin. <p> If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix, then the new matrix will be <code>M * S</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the scaling will be applied first! <p> This method is equivalent to calling: <code>translate(ox, oy).scale(sx, sy).translate(-ox, -oy)</code> @param sx the scaling factor of the x component @param sy the scaling factor of the y component @param ox the x coordinate of the scaling origin @param oy the y coordinate of the scaling origin @return this
[ "Apply", "scaling", "to", "this", "matrix", "by", "scaling", "the", "base", "axes", "by", "the", "given", "sx", "and", "sy", "factors", "while", "using", "<code", ">", "(", "ox", "oy", ")", "<", "/", "code", ">", "as", "the", "scaling", "origin", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "S<", "/", "code", ">", "the", "scaling", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "S<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "S", "*", "v<", "/", "code", ">", "the", "scaling", "will", "be", "applied", "first!", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", ":", "<code", ">", "translate", "(", "ox", "oy", ")", ".", "scale", "(", "sx", "sy", ")", ".", "translate", "(", "-", "ox", "-", "oy", ")", "<", "/", "code", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2f.java#L1431-L1433
mojohaus/xml-maven-plugin
src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.java
IndentCheckSaxHandler.endElement
@Override public void endElement( String uri, String localName, String qName ) throws SAXException { """ Checks indentation for an end element. @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) """ flushCharacters(); if ( stack.isEmpty() ) { throw new IllegalStateException( "Stack must not be empty when closing the element " + qName + " around line " + locator.getLineNumber() + " and column " + locator.getColumnNumber() ); } IndentCheckSaxHandler.ElementEntry startEntry = stack.pop(); int indentDiff = lastIndent.size - startEntry.expectedIndent.size; int expectedIndent = startEntry.expectedIndent.size; if ( lastIndent.lineNumber != startEntry.foundIndent.lineNumber && indentDiff != 0 ) { /* * diff should be zero unless we are on the same line as start element */ int opValue = expectedIndent - lastIndent.size; String op = opValue > 0 ? "Insert" : "Delete"; String units = opValue == 1 ? "space" : "spaces"; String message = op + " " + Math.abs( opValue ) + " " + units + ". Expected " + expectedIndent + " found " + lastIndent.size + " spaces before end element </" + qName + ">"; XmlFormatViolation violation = new XmlFormatViolation( file, locator.getLineNumber(), locator.getColumnNumber(), message ); violationHandler.handle( violation ); } }
java
@Override public void endElement( String uri, String localName, String qName ) throws SAXException { flushCharacters(); if ( stack.isEmpty() ) { throw new IllegalStateException( "Stack must not be empty when closing the element " + qName + " around line " + locator.getLineNumber() + " and column " + locator.getColumnNumber() ); } IndentCheckSaxHandler.ElementEntry startEntry = stack.pop(); int indentDiff = lastIndent.size - startEntry.expectedIndent.size; int expectedIndent = startEntry.expectedIndent.size; if ( lastIndent.lineNumber != startEntry.foundIndent.lineNumber && indentDiff != 0 ) { /* * diff should be zero unless we are on the same line as start element */ int opValue = expectedIndent - lastIndent.size; String op = opValue > 0 ? "Insert" : "Delete"; String units = opValue == 1 ? "space" : "spaces"; String message = op + " " + Math.abs( opValue ) + " " + units + ". Expected " + expectedIndent + " found " + lastIndent.size + " spaces before end element </" + qName + ">"; XmlFormatViolation violation = new XmlFormatViolation( file, locator.getLineNumber(), locator.getColumnNumber(), message ); violationHandler.handle( violation ); } }
[ "@", "Override", "public", "void", "endElement", "(", "String", "uri", ",", "String", "localName", ",", "String", "qName", ")", "throws", "SAXException", "{", "flushCharacters", "(", ")", ";", "if", "(", "stack", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Stack must not be empty when closing the element \"", "+", "qName", "+", "\" around line \"", "+", "locator", ".", "getLineNumber", "(", ")", "+", "\" and column \"", "+", "locator", ".", "getColumnNumber", "(", ")", ")", ";", "}", "IndentCheckSaxHandler", ".", "ElementEntry", "startEntry", "=", "stack", ".", "pop", "(", ")", ";", "int", "indentDiff", "=", "lastIndent", ".", "size", "-", "startEntry", ".", "expectedIndent", ".", "size", ";", "int", "expectedIndent", "=", "startEntry", ".", "expectedIndent", ".", "size", ";", "if", "(", "lastIndent", ".", "lineNumber", "!=", "startEntry", ".", "foundIndent", ".", "lineNumber", "&&", "indentDiff", "!=", "0", ")", "{", "/*\n * diff should be zero unless we are on the same line as start element\n */", "int", "opValue", "=", "expectedIndent", "-", "lastIndent", ".", "size", ";", "String", "op", "=", "opValue", ">", "0", "?", "\"Insert\"", ":", "\"Delete\"", ";", "String", "units", "=", "opValue", "==", "1", "?", "\"space\"", ":", "\"spaces\"", ";", "String", "message", "=", "op", "+", "\" \"", "+", "Math", ".", "abs", "(", "opValue", ")", "+", "\" \"", "+", "units", "+", "\". Expected \"", "+", "expectedIndent", "+", "\" found \"", "+", "lastIndent", ".", "size", "+", "\" spaces before end element </\"", "+", "qName", "+", "\">\"", ";", "XmlFormatViolation", "violation", "=", "new", "XmlFormatViolation", "(", "file", ",", "locator", ".", "getLineNumber", "(", ")", ",", "locator", ".", "getColumnNumber", "(", ")", ",", "message", ")", ";", "violationHandler", ".", "handle", "(", "violation", ")", ";", "}", "}" ]
Checks indentation for an end element. @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
[ "Checks", "indentation", "for", "an", "end", "element", "." ]
train
https://github.com/mojohaus/xml-maven-plugin/blob/161edde37bbfe7a472369a9675c44d91ec24561d/src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.java#L143-L170
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java
PredictionsImpl.predictImageUrlAsync
public Observable<ImagePrediction> predictImageUrlAsync(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { """ Predict an image url and saves the result. @param projectId The project id @param predictImageUrlOptionalParameter 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 ImagePrediction object """ return predictImageUrlWithServiceResponseAsync(projectId, predictImageUrlOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse<ImagePrediction> response) { return response.body(); } }); }
java
public Observable<ImagePrediction> predictImageUrlAsync(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { return predictImageUrlWithServiceResponseAsync(projectId, predictImageUrlOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse<ImagePrediction> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ImagePrediction", ">", "predictImageUrlAsync", "(", "UUID", "projectId", ",", "PredictImageUrlOptionalParameter", "predictImageUrlOptionalParameter", ")", "{", "return", "predictImageUrlWithServiceResponseAsync", "(", "projectId", ",", "predictImageUrlOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ImagePrediction", ">", ",", "ImagePrediction", ">", "(", ")", "{", "@", "Override", "public", "ImagePrediction", "call", "(", "ServiceResponse", "<", "ImagePrediction", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Predict an image url and saves the result. @param projectId The project id @param predictImageUrlOptionalParameter 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 ImagePrediction object
[ "Predict", "an", "image", "url", "and", "saves", "the", "result", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L650-L657
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getPvPSeasonInfo
public void getPvPSeasonInfo(String[] ids, Callback<List<PvPSeason>> callback) throws GuildWars2Exception, NullPointerException { """ For more info on pvp season API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/seasons">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of pvp season id(s) @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see PvPSeason pvp season info """ isParamValid(new ParamChecker(ids)); gw2API.getPvPSeasonInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getPvPSeasonInfo(String[] ids, Callback<List<PvPSeason>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getPvPSeasonInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getPvPSeasonInfo", "(", "String", "[", "]", "ids", ",", "Callback", "<", "List", "<", "PvPSeason", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ";", "gw2API", ".", "getPvPSeasonInfo", "(", "processIds", "(", "ids", ")", ",", "GuildWars2", ".", "lang", ".", "getValue", "(", ")", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on pvp season API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/seasons">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of pvp season id(s) @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see PvPSeason pvp season info
[ "For", "more", "info", "on", "pvp", "season", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "pvp", "/", "seasons", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2141-L2144
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java
XPathParser.parseQName
private String parseQName() { """ Parses the the rule QName according to the following production rule: http://www.w3.org/TR/REC-xml-names <p> [7] QName ::= PrefixedName | UnprefixedName </p> <p> [8] PrefixedName ::= Prefix ':' LocalPart </p> <p> [9] UnprefixedName ::= LocalPart </p> <p> [10] Prefix ::= NCName </p> <p> [11] LocalPart ::= NCName => QName ::= (NCName ":" )? NCName . </p> @return string representation of QName """ String qName = parseNCName(); // can be prefix or localPartName if (is(TokenType.COLON, false)) { qName += ":"; qName += parseNCName(); // is localPartName } return qName; }
java
private String parseQName() { String qName = parseNCName(); // can be prefix or localPartName if (is(TokenType.COLON, false)) { qName += ":"; qName += parseNCName(); // is localPartName } return qName; }
[ "private", "String", "parseQName", "(", ")", "{", "String", "qName", "=", "parseNCName", "(", ")", ";", "// can be prefix or localPartName", "if", "(", "is", "(", "TokenType", ".", "COLON", ",", "false", ")", ")", "{", "qName", "+=", "\":\"", ";", "qName", "+=", "parseNCName", "(", ")", ";", "// is localPartName", "}", "return", "qName", ";", "}" ]
Parses the the rule QName according to the following production rule: http://www.w3.org/TR/REC-xml-names <p> [7] QName ::= PrefixedName | UnprefixedName </p> <p> [8] PrefixedName ::= Prefix ':' LocalPart </p> <p> [9] UnprefixedName ::= LocalPart </p> <p> [10] Prefix ::= NCName </p> <p> [11] LocalPart ::= NCName => QName ::= (NCName ":" )? NCName . </p> @return string representation of QName
[ "Parses", "the", "the", "rule", "QName", "according", "to", "the", "following", "production", "rule", ":", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "REC", "-", "xml", "-", "names", "<p", ">", "[", "7", "]", "QName", "::", "=", "PrefixedName", "|", "UnprefixedName", "<", "/", "p", ">", "<p", ">", "[", "8", "]", "PrefixedName", "::", "=", "Prefix", ":", "LocalPart", "<", "/", "p", ">", "<p", ">", "[", "9", "]", "UnprefixedName", "::", "=", "LocalPart", "<", "/", "p", ">", "<p", ">", "[", "10", "]", "Prefix", "::", "=", "NCName", "<", "/", "p", ">", "<p", ">", "[", "11", "]", "LocalPart", "::", "=", "NCName", "=", ">", "QName", "::", "=", "(", "NCName", ":", ")", "?", "NCName", ".", "<", "/", "p", ">" ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L2047-L2058
apache/groovy
src/main/java/org/apache/groovy/plugin/GroovyRunnerRegistry.java
GroovyRunnerRegistry.put
@Override public GroovyRunner put(String key, GroovyRunner runner) { """ Registers a runner with the specified key. @param key to associate with the runner @param runner the runner to register @return the previously registered runner for the given key, if no runner was previously registered for the key then {@code null} """ if (key == null || runner == null) { return null; } Map<String, GroovyRunner> map = getMap(); writeLock.lock(); try { cachedValues = null; return map.put(key, runner); } finally { writeLock.unlock(); } }
java
@Override public GroovyRunner put(String key, GroovyRunner runner) { if (key == null || runner == null) { return null; } Map<String, GroovyRunner> map = getMap(); writeLock.lock(); try { cachedValues = null; return map.put(key, runner); } finally { writeLock.unlock(); } }
[ "@", "Override", "public", "GroovyRunner", "put", "(", "String", "key", ",", "GroovyRunner", "runner", ")", "{", "if", "(", "key", "==", "null", "||", "runner", "==", "null", ")", "{", "return", "null", ";", "}", "Map", "<", "String", ",", "GroovyRunner", ">", "map", "=", "getMap", "(", ")", ";", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "cachedValues", "=", "null", ";", "return", "map", ".", "put", "(", "key", ",", "runner", ")", ";", "}", "finally", "{", "writeLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Registers a runner with the specified key. @param key to associate with the runner @param runner the runner to register @return the previously registered runner for the given key, if no runner was previously registered for the key then {@code null}
[ "Registers", "a", "runner", "with", "the", "specified", "key", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/plugin/GroovyRunnerRegistry.java#L311-L324
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/TableDefinition.java
TableDefinition.setOption
public void setOption(String optionName, String optionValue) { """ Set the option with the given name to the given value. This method does not validate that the given option name and value are valid since options are storage service-specific. @param optionName Option name. This is down-cased when stored. @param optionValue Option value. Cannot be null. """ // Ensure option value is not empty and trim excess whitespace. Utils.require(optionName != null, "optionName"); Utils.require(optionValue != null && optionValue.trim().length() > 0, "Value for option '" + optionName + "' can not be empty"); optionValue = optionValue.trim(); m_optionMap.put(optionName.toLowerCase(), optionValue); // sharding-granularity and sharding-start are validated here since we must set // local members when the table's definition is parsed. if (optionName.equalsIgnoreCase(CommonDefs.OPT_SHARDING_GRANULARITY)) { m_shardingGranularity = ShardingGranularity.fromString(optionValue); Utils.require(m_shardingGranularity != null, "Unrecognized 'sharding-granularity' value: " + optionValue); } else if (optionName.equalsIgnoreCase(CommonDefs.OPT_SHARDING_START)) { Utils.require(isValidShardDate(optionValue), "'sharding-start' must be YYYY-MM-DD: " + optionValue); m_shardingStartDate = new GregorianCalendar(Utils.UTC_TIMEZONE); m_shardingStartDate.setTime(Utils.dateFromString(optionValue)); } }
java
public void setOption(String optionName, String optionValue) { // Ensure option value is not empty and trim excess whitespace. Utils.require(optionName != null, "optionName"); Utils.require(optionValue != null && optionValue.trim().length() > 0, "Value for option '" + optionName + "' can not be empty"); optionValue = optionValue.trim(); m_optionMap.put(optionName.toLowerCase(), optionValue); // sharding-granularity and sharding-start are validated here since we must set // local members when the table's definition is parsed. if (optionName.equalsIgnoreCase(CommonDefs.OPT_SHARDING_GRANULARITY)) { m_shardingGranularity = ShardingGranularity.fromString(optionValue); Utils.require(m_shardingGranularity != null, "Unrecognized 'sharding-granularity' value: " + optionValue); } else if (optionName.equalsIgnoreCase(CommonDefs.OPT_SHARDING_START)) { Utils.require(isValidShardDate(optionValue), "'sharding-start' must be YYYY-MM-DD: " + optionValue); m_shardingStartDate = new GregorianCalendar(Utils.UTC_TIMEZONE); m_shardingStartDate.setTime(Utils.dateFromString(optionValue)); } }
[ "public", "void", "setOption", "(", "String", "optionName", ",", "String", "optionValue", ")", "{", "// Ensure option value is not empty and trim excess whitespace.\r", "Utils", ".", "require", "(", "optionName", "!=", "null", ",", "\"optionName\"", ")", ";", "Utils", ".", "require", "(", "optionValue", "!=", "null", "&&", "optionValue", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ",", "\"Value for option '\"", "+", "optionName", "+", "\"' can not be empty\"", ")", ";", "optionValue", "=", "optionValue", ".", "trim", "(", ")", ";", "m_optionMap", ".", "put", "(", "optionName", ".", "toLowerCase", "(", ")", ",", "optionValue", ")", ";", "// sharding-granularity and sharding-start are validated here since we must set\r", "// local members when the table's definition is parsed.\r", "if", "(", "optionName", ".", "equalsIgnoreCase", "(", "CommonDefs", ".", "OPT_SHARDING_GRANULARITY", ")", ")", "{", "m_shardingGranularity", "=", "ShardingGranularity", ".", "fromString", "(", "optionValue", ")", ";", "Utils", ".", "require", "(", "m_shardingGranularity", "!=", "null", ",", "\"Unrecognized 'sharding-granularity' value: \"", "+", "optionValue", ")", ";", "}", "else", "if", "(", "optionName", ".", "equalsIgnoreCase", "(", "CommonDefs", ".", "OPT_SHARDING_START", ")", ")", "{", "Utils", ".", "require", "(", "isValidShardDate", "(", "optionValue", ")", ",", "\"'sharding-start' must be YYYY-MM-DD: \"", "+", "optionValue", ")", ";", "m_shardingStartDate", "=", "new", "GregorianCalendar", "(", "Utils", ".", "UTC_TIMEZONE", ")", ";", "m_shardingStartDate", ".", "setTime", "(", "Utils", ".", "dateFromString", "(", "optionValue", ")", ")", ";", "}", "}" ]
Set the option with the given name to the given value. This method does not validate that the given option name and value are valid since options are storage service-specific. @param optionName Option name. This is down-cased when stored. @param optionValue Option value. Cannot be null.
[ "Set", "the", "option", "with", "the", "given", "name", "to", "the", "given", "value", ".", "This", "method", "does", "not", "validate", "that", "the", "given", "option", "name", "and", "value", "are", "valid", "since", "options", "are", "storage", "service", "-", "specific", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/TableDefinition.java#L599-L619
JOML-CI/JOML
src/org/joml/GeometryUtils.java
GeometryUtils.tangentBitangent
public static void tangentBitangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f destTangent, Vector3f destBitangent) { """ Calculate the surface tangent and bitangent for the three supplied vertices and UV coordinates and store the result in <code>dest</code>. @param v1 XYZ of first vertex @param uv1 UV of first vertex @param v2 XYZ of second vertex @param uv2 UV of second vertex @param v3 XYZ of third vertex @param uv3 UV of third vertex @param destTangent the tangent will be stored here @param destBitangent the bitangent will be stored here """ float DeltaV1 = uv2.y() - uv1.y(); float DeltaV2 = uv3.y() - uv1.y(); float DeltaU1 = uv2.x() - uv1.x(); float DeltaU2 = uv3.x() - uv1.x(); float f = 1.0f / (DeltaU1 * DeltaV2 - DeltaU2 * DeltaV1); destTangent.x = f * (DeltaV2 * (v2.x() - v1.x()) - DeltaV1 * (v3.x() - v1.x())); destTangent.y = f * (DeltaV2 * (v2.y() - v1.y()) - DeltaV1 * (v3.y() - v1.y())); destTangent.z = f * (DeltaV2 * (v2.z() - v1.z()) - DeltaV1 * (v3.z() - v1.z())); destTangent.normalize(); destBitangent.x = f * (-DeltaU2 * (v2.x() - v1.x()) - DeltaU1 * (v3.x() - v1.x())); destBitangent.y = f * (-DeltaU2 * (v2.y() - v1.y()) - DeltaU1 * (v3.y() - v1.y())); destBitangent.z = f * (-DeltaU2 * (v2.z() - v1.z()) - DeltaU1 * (v3.z() - v1.z())); destBitangent.normalize(); }
java
public static void tangentBitangent(Vector3fc v1, Vector2fc uv1, Vector3fc v2, Vector2fc uv2, Vector3fc v3, Vector2fc uv3, Vector3f destTangent, Vector3f destBitangent) { float DeltaV1 = uv2.y() - uv1.y(); float DeltaV2 = uv3.y() - uv1.y(); float DeltaU1 = uv2.x() - uv1.x(); float DeltaU2 = uv3.x() - uv1.x(); float f = 1.0f / (DeltaU1 * DeltaV2 - DeltaU2 * DeltaV1); destTangent.x = f * (DeltaV2 * (v2.x() - v1.x()) - DeltaV1 * (v3.x() - v1.x())); destTangent.y = f * (DeltaV2 * (v2.y() - v1.y()) - DeltaV1 * (v3.y() - v1.y())); destTangent.z = f * (DeltaV2 * (v2.z() - v1.z()) - DeltaV1 * (v3.z() - v1.z())); destTangent.normalize(); destBitangent.x = f * (-DeltaU2 * (v2.x() - v1.x()) - DeltaU1 * (v3.x() - v1.x())); destBitangent.y = f * (-DeltaU2 * (v2.y() - v1.y()) - DeltaU1 * (v3.y() - v1.y())); destBitangent.z = f * (-DeltaU2 * (v2.z() - v1.z()) - DeltaU1 * (v3.z() - v1.z())); destBitangent.normalize(); }
[ "public", "static", "void", "tangentBitangent", "(", "Vector3fc", "v1", ",", "Vector2fc", "uv1", ",", "Vector3fc", "v2", ",", "Vector2fc", "uv2", ",", "Vector3fc", "v3", ",", "Vector2fc", "uv3", ",", "Vector3f", "destTangent", ",", "Vector3f", "destBitangent", ")", "{", "float", "DeltaV1", "=", "uv2", ".", "y", "(", ")", "-", "uv1", ".", "y", "(", ")", ";", "float", "DeltaV2", "=", "uv3", ".", "y", "(", ")", "-", "uv1", ".", "y", "(", ")", ";", "float", "DeltaU1", "=", "uv2", ".", "x", "(", ")", "-", "uv1", ".", "x", "(", ")", ";", "float", "DeltaU2", "=", "uv3", ".", "x", "(", ")", "-", "uv1", ".", "x", "(", ")", ";", "float", "f", "=", "1.0f", "/", "(", "DeltaU1", "*", "DeltaV2", "-", "DeltaU2", "*", "DeltaV1", ")", ";", "destTangent", ".", "x", "=", "f", "*", "(", "DeltaV2", "*", "(", "v2", ".", "x", "(", ")", "-", "v1", ".", "x", "(", ")", ")", "-", "DeltaV1", "*", "(", "v3", ".", "x", "(", ")", "-", "v1", ".", "x", "(", ")", ")", ")", ";", "destTangent", ".", "y", "=", "f", "*", "(", "DeltaV2", "*", "(", "v2", ".", "y", "(", ")", "-", "v1", ".", "y", "(", ")", ")", "-", "DeltaV1", "*", "(", "v3", ".", "y", "(", ")", "-", "v1", ".", "y", "(", ")", ")", ")", ";", "destTangent", ".", "z", "=", "f", "*", "(", "DeltaV2", "*", "(", "v2", ".", "z", "(", ")", "-", "v1", ".", "z", "(", ")", ")", "-", "DeltaV1", "*", "(", "v3", ".", "z", "(", ")", "-", "v1", ".", "z", "(", ")", ")", ")", ";", "destTangent", ".", "normalize", "(", ")", ";", "destBitangent", ".", "x", "=", "f", "*", "(", "-", "DeltaU2", "*", "(", "v2", ".", "x", "(", ")", "-", "v1", ".", "x", "(", ")", ")", "-", "DeltaU1", "*", "(", "v3", ".", "x", "(", ")", "-", "v1", ".", "x", "(", ")", ")", ")", ";", "destBitangent", ".", "y", "=", "f", "*", "(", "-", "DeltaU2", "*", "(", "v2", ".", "y", "(", ")", "-", "v1", ".", "y", "(", ")", ")", "-", "DeltaU1", "*", "(", "v3", ".", "y", "(", ")", "-", "v1", ".", "y", "(", ")", ")", ")", ";", "destBitangent", ".", "z", "=", "f", "*", "(", "-", "DeltaU2", "*", "(", "v2", ".", "z", "(", ")", "-", "v1", ".", "z", "(", ")", ")", "-", "DeltaU1", "*", "(", "v3", ".", "z", "(", ")", "-", "v1", ".", "z", "(", ")", ")", ")", ";", "destBitangent", ".", "normalize", "(", ")", ";", "}" ]
Calculate the surface tangent and bitangent for the three supplied vertices and UV coordinates and store the result in <code>dest</code>. @param v1 XYZ of first vertex @param uv1 UV of first vertex @param v2 XYZ of second vertex @param uv2 UV of second vertex @param v3 XYZ of third vertex @param uv3 UV of third vertex @param destTangent the tangent will be stored here @param destBitangent the bitangent will be stored here
[ "Calculate", "the", "surface", "tangent", "and", "bitangent", "for", "the", "three", "supplied", "vertices", "and", "UV", "coordinates", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/GeometryUtils.java#L228-L245
line/armeria
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
ServerBuilder.contentPreview
public ServerBuilder contentPreview(int length, Charset defaultCharset) { """ Sets the {@link ContentPreviewerFactory} creating a {@link ContentPreviewer} which produces the preview with the maxmium {@code length} limit for a request and a response of this {@link Server}. The previewer is enabled only if the content type of a request/response meets any of the following cases. <ul> <li>when it matches {@code text/*} or {@code application/x-www-form-urlencoded}</li> <li>when its charset has been specified</li> <li>when its subtype is {@code "xml"} or {@code "json"}</li> <li>when its subtype ends with {@code "+xml"} or {@code "+json"}</li> </ul> @param length the maximum length of the preview. @param defaultCharset the default charset for a request/response with unspecified charset in {@code "content-type"} header. """ return contentPreviewerFactory(ContentPreviewerFactory.ofText(length, defaultCharset)); }
java
public ServerBuilder contentPreview(int length, Charset defaultCharset) { return contentPreviewerFactory(ContentPreviewerFactory.ofText(length, defaultCharset)); }
[ "public", "ServerBuilder", "contentPreview", "(", "int", "length", ",", "Charset", "defaultCharset", ")", "{", "return", "contentPreviewerFactory", "(", "ContentPreviewerFactory", ".", "ofText", "(", "length", ",", "defaultCharset", ")", ")", ";", "}" ]
Sets the {@link ContentPreviewerFactory} creating a {@link ContentPreviewer} which produces the preview with the maxmium {@code length} limit for a request and a response of this {@link Server}. The previewer is enabled only if the content type of a request/response meets any of the following cases. <ul> <li>when it matches {@code text/*} or {@code application/x-www-form-urlencoded}</li> <li>when its charset has been specified</li> <li>when its subtype is {@code "xml"} or {@code "json"}</li> <li>when its subtype ends with {@code "+xml"} or {@code "+json"}</li> </ul> @param length the maximum length of the preview. @param defaultCharset the default charset for a request/response with unspecified charset in {@code "content-type"} header.
[ "Sets", "the", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L1321-L1323
ZuInnoTe/hadoopcryptoledger
examples/spark-bitcoinblock/src/main/java/org/zuinnote/spark/bitcoin/example/SparkBitcoinBlockCounter.java
SparkBitcoinBlockCounter.jobTotalNumOfTransactions
public static void jobTotalNumOfTransactions(JavaSparkContext sc, Configuration hadoopConf, String inputFile, String outputFile) { """ a job for counting the total number of transactions @param sc context @param hadoopConf Configuration for input format @param inputFile Input file @param output outputFile file """ // read bitcoin data from HDFS JavaPairRDD<BytesWritable, BitcoinBlock> bitcoinBlocksRDD = sc.newAPIHadoopFile(inputFile, BitcoinBlockFileInputFormat.class, BytesWritable.class, BitcoinBlock.class,hadoopConf); // extract the no transactions / block (map) JavaPairRDD<String, Long> noOfTransactionPair = bitcoinBlocksRDD.mapToPair(new PairFunction<Tuple2<BytesWritable,BitcoinBlock>, String, Long>() { @Override public Tuple2<String, Long> call(Tuple2<BytesWritable,BitcoinBlock> tupleBlock) { return mapNoOfTransaction(tupleBlock._2()); } }); // combine the results from all blocks JavaPairRDD<String, Long> totalCount = noOfTransactionPair.reduceByKey(new Function2<Long, Long, Long>() { @Override public Long call(Long a, Long b) { return reduceSumUpTransactions(a,b); } }); // write results to HDFS totalCount.repartition(1).saveAsTextFile(outputFile); }
java
public static void jobTotalNumOfTransactions(JavaSparkContext sc, Configuration hadoopConf, String inputFile, String outputFile) { // read bitcoin data from HDFS JavaPairRDD<BytesWritable, BitcoinBlock> bitcoinBlocksRDD = sc.newAPIHadoopFile(inputFile, BitcoinBlockFileInputFormat.class, BytesWritable.class, BitcoinBlock.class,hadoopConf); // extract the no transactions / block (map) JavaPairRDD<String, Long> noOfTransactionPair = bitcoinBlocksRDD.mapToPair(new PairFunction<Tuple2<BytesWritable,BitcoinBlock>, String, Long>() { @Override public Tuple2<String, Long> call(Tuple2<BytesWritable,BitcoinBlock> tupleBlock) { return mapNoOfTransaction(tupleBlock._2()); } }); // combine the results from all blocks JavaPairRDD<String, Long> totalCount = noOfTransactionPair.reduceByKey(new Function2<Long, Long, Long>() { @Override public Long call(Long a, Long b) { return reduceSumUpTransactions(a,b); } }); // write results to HDFS totalCount.repartition(1).saveAsTextFile(outputFile); }
[ "public", "static", "void", "jobTotalNumOfTransactions", "(", "JavaSparkContext", "sc", ",", "Configuration", "hadoopConf", ",", "String", "inputFile", ",", "String", "outputFile", ")", "{", "// read bitcoin data from HDFS", "JavaPairRDD", "<", "BytesWritable", ",", "BitcoinBlock", ">", "bitcoinBlocksRDD", "=", "sc", ".", "newAPIHadoopFile", "(", "inputFile", ",", "BitcoinBlockFileInputFormat", ".", "class", ",", "BytesWritable", ".", "class", ",", "BitcoinBlock", ".", "class", ",", "hadoopConf", ")", ";", "// extract the no transactions / block (map)", "JavaPairRDD", "<", "String", ",", "Long", ">", "noOfTransactionPair", "=", "bitcoinBlocksRDD", ".", "mapToPair", "(", "new", "PairFunction", "<", "Tuple2", "<", "BytesWritable", ",", "BitcoinBlock", ">", ",", "String", ",", "Long", ">", "(", ")", "{", "@", "Override", "public", "Tuple2", "<", "String", ",", "Long", ">", "call", "(", "Tuple2", "<", "BytesWritable", ",", "BitcoinBlock", ">", "tupleBlock", ")", "{", "return", "mapNoOfTransaction", "(", "tupleBlock", ".", "_2", "(", ")", ")", ";", "}", "}", ")", ";", "// combine the results from all blocks", "JavaPairRDD", "<", "String", ",", "Long", ">", "totalCount", "=", "noOfTransactionPair", ".", "reduceByKey", "(", "new", "Function2", "<", "Long", ",", "Long", ",", "Long", ">", "(", ")", "{", "@", "Override", "public", "Long", "call", "(", "Long", "a", ",", "Long", "b", ")", "{", "return", "reduceSumUpTransactions", "(", "a", ",", "b", ")", ";", "}", "}", ")", ";", "// write results to HDFS", "totalCount", ".", "repartition", "(", "1", ")", ".", "saveAsTextFile", "(", "outputFile", ")", ";", "}" ]
a job for counting the total number of transactions @param sc context @param hadoopConf Configuration for input format @param inputFile Input file @param output outputFile file
[ "a", "job", "for", "counting", "the", "total", "number", "of", "transactions" ]
train
https://github.com/ZuInnoTe/hadoopcryptoledger/blob/5c9bfb61dd1a82374cd0de8413a7c66391ee4414/examples/spark-bitcoinblock/src/main/java/org/zuinnote/spark/bitcoin/example/SparkBitcoinBlockCounter.java#L80-L99
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java
JMapperCache.relationalMapperName
private static String relationalMapperName(Class<?> configuredClass, String resource) { """ Returns a unique name that identify this relationalMapper. @param configuredClass configured class @param resource resource to analyze @return Returns a string that represents the identifier for this relationalMapper instance """ String className = configuredClass.getName().replaceAll("\\.",""); if(isEmpty(resource)) return className; if(!isPath(resource)) return write(className, String.valueOf(resource.hashCode())); String[]dep = resource.split("\\\\"); if(dep.length<=1)dep = resource.split("/"); String xml = dep[dep.length-1]; return write(className, xml.replaceAll("\\.","").replaceAll(" ","")); }
java
private static String relationalMapperName(Class<?> configuredClass, String resource){ String className = configuredClass.getName().replaceAll("\\.",""); if(isEmpty(resource)) return className; if(!isPath(resource)) return write(className, String.valueOf(resource.hashCode())); String[]dep = resource.split("\\\\"); if(dep.length<=1)dep = resource.split("/"); String xml = dep[dep.length-1]; return write(className, xml.replaceAll("\\.","").replaceAll(" ","")); }
[ "private", "static", "String", "relationalMapperName", "(", "Class", "<", "?", ">", "configuredClass", ",", "String", "resource", ")", "{", "String", "className", "=", "configuredClass", ".", "getName", "(", ")", ".", "replaceAll", "(", "\"\\\\.\"", ",", "\"\"", ")", ";", "if", "(", "isEmpty", "(", "resource", ")", ")", "return", "className", ";", "if", "(", "!", "isPath", "(", "resource", ")", ")", "return", "write", "(", "className", ",", "String", ".", "valueOf", "(", "resource", ".", "hashCode", "(", ")", ")", ")", ";", "String", "[", "]", "dep", "=", "resource", ".", "split", "(", "\"\\\\\\\\\"", ")", ";", "if", "(", "dep", ".", "length", "<=", "1", ")", "dep", "=", "resource", ".", "split", "(", "\"/\"", ")", ";", "String", "xml", "=", "dep", "[", "dep", ".", "length", "-", "1", "]", ";", "return", "write", "(", "className", ",", "xml", ".", "replaceAll", "(", "\"\\\\.\"", ",", "\"\"", ")", ".", "replaceAll", "(", "\" \"", ",", "\"\"", ")", ")", ";", "}" ]
Returns a unique name that identify this relationalMapper. @param configuredClass configured class @param resource resource to analyze @return Returns a string that represents the identifier for this relationalMapper instance
[ "Returns", "a", "unique", "name", "that", "identify", "this", "relationalMapper", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java#L215-L229
jwtk/jjwt
api/src/main/java/io/jsonwebtoken/lang/Strings.java
Strings.endsWithIgnoreCase
public static boolean endsWithIgnoreCase(String str, String suffix) { """ Test if the given String ends with the specified suffix, ignoring upper/lower case. @param str the String to check @param suffix the suffix to look for @see java.lang.String#endsWith """ if (str == null || suffix == null) { return false; } if (str.endsWith(suffix)) { return true; } if (str.length() < suffix.length()) { return false; } String lcStr = str.substring(str.length() - suffix.length()).toLowerCase(); String lcSuffix = suffix.toLowerCase(); return lcStr.equals(lcSuffix); }
java
public static boolean endsWithIgnoreCase(String str, String suffix) { if (str == null || suffix == null) { return false; } if (str.endsWith(suffix)) { return true; } if (str.length() < suffix.length()) { return false; } String lcStr = str.substring(str.length() - suffix.length()).toLowerCase(); String lcSuffix = suffix.toLowerCase(); return lcStr.equals(lcSuffix); }
[ "public", "static", "boolean", "endsWithIgnoreCase", "(", "String", "str", ",", "String", "suffix", ")", "{", "if", "(", "str", "==", "null", "||", "suffix", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "str", ".", "endsWith", "(", "suffix", ")", ")", "{", "return", "true", ";", "}", "if", "(", "str", ".", "length", "(", ")", "<", "suffix", ".", "length", "(", ")", ")", "{", "return", "false", ";", "}", "String", "lcStr", "=", "str", ".", "substring", "(", "str", ".", "length", "(", ")", "-", "suffix", ".", "length", "(", ")", ")", ".", "toLowerCase", "(", ")", ";", "String", "lcSuffix", "=", "suffix", ".", "toLowerCase", "(", ")", ";", "return", "lcStr", ".", "equals", "(", "lcSuffix", ")", ";", "}" ]
Test if the given String ends with the specified suffix, ignoring upper/lower case. @param str the String to check @param suffix the suffix to look for @see java.lang.String#endsWith
[ "Test", "if", "the", "given", "String", "ends", "with", "the", "specified", "suffix", "ignoring", "upper", "/", "lower", "case", "." ]
train
https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Strings.java#L319-L333
googleapis/google-cloud-java
google-cloud-clients/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceClient.java
TraceServiceClient.getTrace
public final Trace getTrace(String projectId, String traceId) { """ Gets a single trace by its ID. <p>Sample code: <pre><code> try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) { String projectId = ""; String traceId = ""; Trace response = traceServiceClient.getTrace(projectId, traceId); } </code></pre> @param projectId ID of the Cloud project where the trace data is stored. @param traceId ID of the trace to return. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ GetTraceRequest request = GetTraceRequest.newBuilder().setProjectId(projectId).setTraceId(traceId).build(); return getTrace(request); }
java
public final Trace getTrace(String projectId, String traceId) { GetTraceRequest request = GetTraceRequest.newBuilder().setProjectId(projectId).setTraceId(traceId).build(); return getTrace(request); }
[ "public", "final", "Trace", "getTrace", "(", "String", "projectId", ",", "String", "traceId", ")", "{", "GetTraceRequest", "request", "=", "GetTraceRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", "setTraceId", "(", "traceId", ")", ".", "build", "(", ")", ";", "return", "getTrace", "(", "request", ")", ";", "}" ]
Gets a single trace by its ID. <p>Sample code: <pre><code> try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) { String projectId = ""; String traceId = ""; Trace response = traceServiceClient.getTrace(projectId, traceId); } </code></pre> @param projectId ID of the Cloud project where the trace data is stored. @param traceId ID of the trace to return. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Gets", "a", "single", "trace", "by", "its", "ID", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-trace/src/main/java/com/google/cloud/trace/v1/TraceServiceClient.java#L267-L272
apache/fluo
modules/accumulo/src/main/java/org/apache/fluo/accumulo/iterators/ColumnBuffer.java
ColumnBuffer.copyTo
public void copyTo(ColumnBuffer dest, LongPredicate timestampTest) { """ Clears the dest ColumnBuffer and inserts all entries in dest where the timestamp passes the timestampTest. @param dest Destination ColumnBuffer @param timestampTest Test to determine which timestamps get added to dest """ dest.clear(); if (key != null) { dest.key = new Key(key); } for (int i = 0; i < timeStamps.size(); i++) { long time = timeStamps.get(i); if (timestampTest.test(time)) { dest.add(time, values.get(i)); } } }
java
public void copyTo(ColumnBuffer dest, LongPredicate timestampTest) { dest.clear(); if (key != null) { dest.key = new Key(key); } for (int i = 0; i < timeStamps.size(); i++) { long time = timeStamps.get(i); if (timestampTest.test(time)) { dest.add(time, values.get(i)); } } }
[ "public", "void", "copyTo", "(", "ColumnBuffer", "dest", ",", "LongPredicate", "timestampTest", ")", "{", "dest", ".", "clear", "(", ")", ";", "if", "(", "key", "!=", "null", ")", "{", "dest", ".", "key", "=", "new", "Key", "(", "key", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "timeStamps", ".", "size", "(", ")", ";", "i", "++", ")", "{", "long", "time", "=", "timeStamps", ".", "get", "(", "i", ")", ";", "if", "(", "timestampTest", ".", "test", "(", "time", ")", ")", "{", "dest", ".", "add", "(", "time", ",", "values", ".", "get", "(", "i", ")", ")", ";", "}", "}", "}" ]
Clears the dest ColumnBuffer and inserts all entries in dest where the timestamp passes the timestampTest. @param dest Destination ColumnBuffer @param timestampTest Test to determine which timestamps get added to dest
[ "Clears", "the", "dest", "ColumnBuffer", "and", "inserts", "all", "entries", "in", "dest", "where", "the", "timestamp", "passes", "the", "timestampTest", "." ]
train
https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/accumulo/src/main/java/org/apache/fluo/accumulo/iterators/ColumnBuffer.java#L91-L104
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java
HylaFaxClientSpi.submitFaxJobImpl
@Override protected void submitFaxJobImpl(FaxJob faxJob) { """ This function will submit a new fax job.<br> The fax job ID may be populated by this method in the provided fax job object. @param faxJob The fax job object containing the needed information """ //get fax job HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob; //get client HylaFAXClient client=this.getHylaFAXClient(); try { this.submitFaxJob(hylaFaxJob,client); } catch(FaxException exception) { throw exception; } catch(Exception exception) { throw new FaxException("General error.",exception); } }
java
@Override protected void submitFaxJobImpl(FaxJob faxJob) { //get fax job HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob; //get client HylaFAXClient client=this.getHylaFAXClient(); try { this.submitFaxJob(hylaFaxJob,client); } catch(FaxException exception) { throw exception; } catch(Exception exception) { throw new FaxException("General error.",exception); } }
[ "@", "Override", "protected", "void", "submitFaxJobImpl", "(", "FaxJob", "faxJob", ")", "{", "//get fax job", "HylaFaxJob", "hylaFaxJob", "=", "(", "HylaFaxJob", ")", "faxJob", ";", "//get client", "HylaFAXClient", "client", "=", "this", ".", "getHylaFAXClient", "(", ")", ";", "try", "{", "this", ".", "submitFaxJob", "(", "hylaFaxJob", ",", "client", ")", ";", "}", "catch", "(", "FaxException", "exception", ")", "{", "throw", "exception", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "FaxException", "(", "\"General error.\"", ",", "exception", ")", ";", "}", "}" ]
This function will submit a new fax job.<br> The fax job ID may be populated by this method in the provided fax job object. @param faxJob The fax job object containing the needed information
[ "This", "function", "will", "submit", "a", "new", "fax", "job", ".", "<br", ">", "The", "fax", "job", "ID", "may", "be", "populated", "by", "this", "method", "in", "the", "provided", "fax", "job", "object", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java#L305-L326
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/ngmf/util/cosu/MH.java
MHdparam.qobs
double qobs(int i, double[] xt) { """ Draw an (internal) new state y given that we're in (internal) state xt """ int x = (int) (xt[0]); double p = Math.random(); int y = 0; p -= pi(x, y); while (p > 0) { y++; p -= pi(x, y); } return (double) y; }
java
double qobs(int i, double[] xt) { int x = (int) (xt[0]); double p = Math.random(); int y = 0; p -= pi(x, y); while (p > 0) { y++; p -= pi(x, y); } return (double) y; }
[ "double", "qobs", "(", "int", "i", ",", "double", "[", "]", "xt", ")", "{", "int", "x", "=", "(", "int", ")", "(", "xt", "[", "0", "]", ")", ";", "double", "p", "=", "Math", ".", "random", "(", ")", ";", "int", "y", "=", "0", ";", "p", "-=", "pi", "(", "x", ",", "y", ")", ";", "while", "(", "p", ">", "0", ")", "{", "y", "++", ";", "p", "-=", "pi", "(", "x", ",", "y", ")", ";", "}", "return", "(", "double", ")", "y", ";", "}" ]
Draw an (internal) new state y given that we're in (internal) state xt
[ "Draw", "an", "(", "internal", ")", "new", "state", "y", "given", "that", "we", "re", "in", "(", "internal", ")", "state", "xt" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/cosu/MH.java#L328-L338
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/component/SimpleInternalFrame.java
SimpleInternalFrame.buildHeader
private JPanel buildHeader(JLabel label, JToolBar bar) { """ Creates and answers the header panel, that consists of: an icon, a title label, a tool bar, and a gradient background. @param label the label to paint the icon and text @param bar the panel's tool bar @return the panel's built header area """ gradientPanel = new GradientPanel(new BorderLayout(), getHeaderBackground()); label.setOpaque(false); gradientPanel.add(label, BorderLayout.WEST); gradientPanel.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 1)); headerPanel = new JPanel(new BorderLayout()); headerPanel.add(gradientPanel, BorderLayout.CENTER); setToolBar(bar); headerPanel.setBorder(new RaisedHeaderBorder()); headerPanel.setOpaque(false); return headerPanel; }
java
private JPanel buildHeader(JLabel label, JToolBar bar) { gradientPanel = new GradientPanel(new BorderLayout(), getHeaderBackground()); label.setOpaque(false); gradientPanel.add(label, BorderLayout.WEST); gradientPanel.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 1)); headerPanel = new JPanel(new BorderLayout()); headerPanel.add(gradientPanel, BorderLayout.CENTER); setToolBar(bar); headerPanel.setBorder(new RaisedHeaderBorder()); headerPanel.setOpaque(false); return headerPanel; }
[ "private", "JPanel", "buildHeader", "(", "JLabel", "label", ",", "JToolBar", "bar", ")", "{", "gradientPanel", "=", "new", "GradientPanel", "(", "new", "BorderLayout", "(", ")", ",", "getHeaderBackground", "(", ")", ")", ";", "label", ".", "setOpaque", "(", "false", ")", ";", "gradientPanel", ".", "add", "(", "label", ",", "BorderLayout", ".", "WEST", ")", ";", "gradientPanel", ".", "setBorder", "(", "BorderFactory", ".", "createEmptyBorder", "(", "3", ",", "4", ",", "3", ",", "1", ")", ")", ";", "headerPanel", "=", "new", "JPanel", "(", "new", "BorderLayout", "(", ")", ")", ";", "headerPanel", ".", "add", "(", "gradientPanel", ",", "BorderLayout", ".", "CENTER", ")", ";", "setToolBar", "(", "bar", ")", ";", "headerPanel", ".", "setBorder", "(", "new", "RaisedHeaderBorder", "(", ")", ")", ";", "headerPanel", ".", "setOpaque", "(", "false", ")", ";", "return", "headerPanel", ";", "}" ]
Creates and answers the header panel, that consists of: an icon, a title label, a tool bar, and a gradient background. @param label the label to paint the icon and text @param bar the panel's tool bar @return the panel's built header area
[ "Creates", "and", "answers", "the", "header", "panel", "that", "consists", "of", ":", "an", "icon", "a", "title", "label", "a", "tool", "bar", "and", "a", "gradient", "background", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/component/SimpleInternalFrame.java#L272-L285
VoltDB/voltdb
src/frontend/org/voltdb/importer/ChannelDistributer.java
ChannelDistributer.acquireAndRelease
static void acquireAndRelease(Semaphore lock) { """ Boiler plate method that acquires, and releases a {@link Semaphore} @param lock a {@link Semaphore} """ try { lock.acquire(); lock.release(); } catch (InterruptedException ex) { throw loggedDistributerException(ex, "interruped while waiting for a semaphare"); } }
java
static void acquireAndRelease(Semaphore lock) { try { lock.acquire(); lock.release(); } catch (InterruptedException ex) { throw loggedDistributerException(ex, "interruped while waiting for a semaphare"); } }
[ "static", "void", "acquireAndRelease", "(", "Semaphore", "lock", ")", "{", "try", "{", "lock", ".", "acquire", "(", ")", ";", "lock", ".", "release", "(", ")", ";", "}", "catch", "(", "InterruptedException", "ex", ")", "{", "throw", "loggedDistributerException", "(", "ex", ",", "\"interruped while waiting for a semaphare\"", ")", ";", "}", "}" ]
Boiler plate method that acquires, and releases a {@link Semaphore} @param lock a {@link Semaphore}
[ "Boiler", "plate", "method", "that", "acquires", "and", "releases", "a", "{" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importer/ChannelDistributer.java#L166-L173
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/QueryImpl.java
QueryImpl.parseFieldsString
@Deprecated public static BasicDBObject parseFieldsString(final String str, final Class clazz, final Mapper mapper, final boolean validate) { """ Parses the string and validates each part @param str the String to parse @param clazz the class to use when validating @param mapper the Mapper to use @param validate true if the results should be validated @return the DBObject @deprecated this is an internal method and will be removed in the next version """ BasicDBObject ret = new BasicDBObject(); final String[] parts = str.split(","); for (String s : parts) { s = s.trim(); int dir = 1; if (s.startsWith("-")) { dir = -1; s = s.substring(1).trim(); } if (validate) { s = new PathTarget(mapper, clazz, s).translatedPath(); } ret.put(s, dir); } return ret; }
java
@Deprecated public static BasicDBObject parseFieldsString(final String str, final Class clazz, final Mapper mapper, final boolean validate) { BasicDBObject ret = new BasicDBObject(); final String[] parts = str.split(","); for (String s : parts) { s = s.trim(); int dir = 1; if (s.startsWith("-")) { dir = -1; s = s.substring(1).trim(); } if (validate) { s = new PathTarget(mapper, clazz, s).translatedPath(); } ret.put(s, dir); } return ret; }
[ "@", "Deprecated", "public", "static", "BasicDBObject", "parseFieldsString", "(", "final", "String", "str", ",", "final", "Class", "clazz", ",", "final", "Mapper", "mapper", ",", "final", "boolean", "validate", ")", "{", "BasicDBObject", "ret", "=", "new", "BasicDBObject", "(", ")", ";", "final", "String", "[", "]", "parts", "=", "str", ".", "split", "(", "\",\"", ")", ";", "for", "(", "String", "s", ":", "parts", ")", "{", "s", "=", "s", ".", "trim", "(", ")", ";", "int", "dir", "=", "1", ";", "if", "(", "s", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "dir", "=", "-", "1", ";", "s", "=", "s", ".", "substring", "(", "1", ")", ".", "trim", "(", ")", ";", "}", "if", "(", "validate", ")", "{", "s", "=", "new", "PathTarget", "(", "mapper", ",", "clazz", ",", "s", ")", ".", "translatedPath", "(", ")", ";", "}", "ret", ".", "put", "(", "s", ",", "dir", ")", ";", "}", "return", "ret", ";", "}" ]
Parses the string and validates each part @param str the String to parse @param clazz the class to use when validating @param mapper the Mapper to use @param validate true if the results should be validated @return the DBObject @deprecated this is an internal method and will be removed in the next version
[ "Parses", "the", "string", "and", "validates", "each", "part" ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/QueryImpl.java#L101-L120
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/ted/TreeEditDistance.java
TreeEditDistance.getWorstCaseSubstituteAll
public double getWorstCaseSubstituteAll() { """ This worst-case is computed as follows: We look at the original graph <code>editDistanceGraph</code>, and change the weights of all diagonal edges to {@link #weightSubstitute}. Previously their weights depended on whether the node-tuple is equal or not. But now we look at it as if all the labels in both trees were different. Then we compute again the shortest path through this altered graph. By considering the shortestPath, we are still able to insert nodes prior to delete others. This is not possible in: {@link #getWorstCaseRetainStructure()}. @return the worst-case scenario of edit operations """ double worstCase = -1; // make a copy of editDistanceGraph SimpleDirectedWeightedGraph worstCaseGraph = new SimpleDirectedWeightedGraph(); Set vertices = editDistanceGraph.vertexSet(); Set edges = editDistanceGraph.edgeSet(); worstCaseGraph.addAllVertices(vertices); worstCaseGraph.addAllEdges(edges); edges = worstCaseGraph.edgeSet(); for (Object o : edges) { Edge edge = (Edge) o; GraphVertexTuple vertex1 = (GraphVertexTuple) edge.getSource(); GraphVertexTuple vertex2 = (GraphVertexTuple) edge.getTarget(); // check if this edge is a diagonal if (vertex2.getLeft() == vertex1.getLeft() + 1 && vertex2.getRight() == vertex1.getRight() + 1) { edge.setWeight(weightSubstitute); } } DijkstraShortestPath shortestPath = new DijkstraShortestPath(worstCaseGraph, firstVertex, lastVertex, pathLengthLimit); worstCase = shortestPath.getPathLength(); return worstCase; }
java
public double getWorstCaseSubstituteAll() { double worstCase = -1; // make a copy of editDistanceGraph SimpleDirectedWeightedGraph worstCaseGraph = new SimpleDirectedWeightedGraph(); Set vertices = editDistanceGraph.vertexSet(); Set edges = editDistanceGraph.edgeSet(); worstCaseGraph.addAllVertices(vertices); worstCaseGraph.addAllEdges(edges); edges = worstCaseGraph.edgeSet(); for (Object o : edges) { Edge edge = (Edge) o; GraphVertexTuple vertex1 = (GraphVertexTuple) edge.getSource(); GraphVertexTuple vertex2 = (GraphVertexTuple) edge.getTarget(); // check if this edge is a diagonal if (vertex2.getLeft() == vertex1.getLeft() + 1 && vertex2.getRight() == vertex1.getRight() + 1) { edge.setWeight(weightSubstitute); } } DijkstraShortestPath shortestPath = new DijkstraShortestPath(worstCaseGraph, firstVertex, lastVertex, pathLengthLimit); worstCase = shortestPath.getPathLength(); return worstCase; }
[ "public", "double", "getWorstCaseSubstituteAll", "(", ")", "{", "double", "worstCase", "=", "-", "1", ";", "// make a copy of editDistanceGraph\r", "SimpleDirectedWeightedGraph", "worstCaseGraph", "=", "new", "SimpleDirectedWeightedGraph", "(", ")", ";", "Set", "vertices", "=", "editDistanceGraph", ".", "vertexSet", "(", ")", ";", "Set", "edges", "=", "editDistanceGraph", ".", "edgeSet", "(", ")", ";", "worstCaseGraph", ".", "addAllVertices", "(", "vertices", ")", ";", "worstCaseGraph", ".", "addAllEdges", "(", "edges", ")", ";", "edges", "=", "worstCaseGraph", ".", "edgeSet", "(", ")", ";", "for", "(", "Object", "o", ":", "edges", ")", "{", "Edge", "edge", "=", "(", "Edge", ")", "o", ";", "GraphVertexTuple", "vertex1", "=", "(", "GraphVertexTuple", ")", "edge", ".", "getSource", "(", ")", ";", "GraphVertexTuple", "vertex2", "=", "(", "GraphVertexTuple", ")", "edge", ".", "getTarget", "(", ")", ";", "// check if this edge is a diagonal\r", "if", "(", "vertex2", ".", "getLeft", "(", ")", "==", "vertex1", ".", "getLeft", "(", ")", "+", "1", "&&", "vertex2", ".", "getRight", "(", ")", "==", "vertex1", ".", "getRight", "(", ")", "+", "1", ")", "{", "edge", ".", "setWeight", "(", "weightSubstitute", ")", ";", "}", "}", "DijkstraShortestPath", "shortestPath", "=", "new", "DijkstraShortestPath", "(", "worstCaseGraph", ",", "firstVertex", ",", "lastVertex", ",", "pathLengthLimit", ")", ";", "worstCase", "=", "shortestPath", ".", "getPathLength", "(", ")", ";", "return", "worstCase", ";", "}" ]
This worst-case is computed as follows: We look at the original graph <code>editDistanceGraph</code>, and change the weights of all diagonal edges to {@link #weightSubstitute}. Previously their weights depended on whether the node-tuple is equal or not. But now we look at it as if all the labels in both trees were different. Then we compute again the shortest path through this altered graph. By considering the shortestPath, we are still able to insert nodes prior to delete others. This is not possible in: {@link #getWorstCaseRetainStructure()}. @return the worst-case scenario of edit operations
[ "This", "worst", "-", "case", "is", "computed", "as", "follows", ":", "We", "look", "at", "the", "original", "graph", "<code", ">", "editDistanceGraph<", "/", "code", ">", "and", "change", "the", "weights", "of", "all", "diagonal", "edges", "to", "{", "@link", "#weightSubstitute", "}", ".", "Previously", "their", "weights", "depended", "on", "whether", "the", "node", "-", "tuple", "is", "equal", "or", "not", ".", "But", "now", "we", "look", "at", "it", "as", "if", "all", "the", "labels", "in", "both", "trees", "were", "different", ".", "Then", "we", "compute", "again", "the", "shortest", "path", "through", "this", "altered", "graph", ".", "By", "considering", "the", "shortestPath", "we", "are", "still", "able", "to", "insert", "nodes", "prior", "to", "delete", "others", ".", "This", "is", "not", "possible", "in", ":", "{", "@link", "#getWorstCaseRetainStructure", "()", "}", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/ted/TreeEditDistance.java#L463-L488
buschmais/jqa-javaee6-plugin
src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java
WebXmlScannerPlugin.setAsyncSupported
private void setAsyncSupported(AsyncSupportedDescriptor asyncSupportedDescriptor, TrueFalseType asyncSupported) { """ Set the value for an async supported on the given descriptor. @param asyncSupportedDescriptor The async supported descriptor. @param asyncSupported The value. """ if (asyncSupported != null) { asyncSupportedDescriptor.setAsyncSupported(asyncSupported.isValue()); } }
java
private void setAsyncSupported(AsyncSupportedDescriptor asyncSupportedDescriptor, TrueFalseType asyncSupported) { if (asyncSupported != null) { asyncSupportedDescriptor.setAsyncSupported(asyncSupported.isValue()); } }
[ "private", "void", "setAsyncSupported", "(", "AsyncSupportedDescriptor", "asyncSupportedDescriptor", ",", "TrueFalseType", "asyncSupported", ")", "{", "if", "(", "asyncSupported", "!=", "null", ")", "{", "asyncSupportedDescriptor", ".", "setAsyncSupported", "(", "asyncSupported", ".", "isValue", "(", ")", ")", ";", "}", "}" ]
Set the value for an async supported on the given descriptor. @param asyncSupportedDescriptor The async supported descriptor. @param asyncSupported The value.
[ "Set", "the", "value", "for", "an", "async", "supported", "on", "the", "given", "descriptor", "." ]
train
https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java#L480-L484
Netflix/zeno
src/main/java/com/netflix/zeno/genericobject/DiffHtmlGenerator.java
DiffHtmlGenerator.generateDiff
public String generateDiff(String objectType, Object from, Object to) { """ Generate the HTML difference between two objects. @param objectType - The NFTypeSerializer name of the objects @param from - The first object to diff @param to - The second object to diff @return """ GenericObject fromGenericObject = from == null ? null : genericObjectFramework.serialize(from, objectType); GenericObject toGenericObject = to == null ? null : genericObjectFramework.serialize(to, objectType); return generateDiff(fromGenericObject, toGenericObject); }
java
public String generateDiff(String objectType, Object from, Object to) { GenericObject fromGenericObject = from == null ? null : genericObjectFramework.serialize(from, objectType); GenericObject toGenericObject = to == null ? null : genericObjectFramework.serialize(to, objectType); return generateDiff(fromGenericObject, toGenericObject); }
[ "public", "String", "generateDiff", "(", "String", "objectType", ",", "Object", "from", ",", "Object", "to", ")", "{", "GenericObject", "fromGenericObject", "=", "from", "==", "null", "?", "null", ":", "genericObjectFramework", ".", "serialize", "(", "from", ",", "objectType", ")", ";", "GenericObject", "toGenericObject", "=", "to", "==", "null", "?", "null", ":", "genericObjectFramework", ".", "serialize", "(", "to", ",", "objectType", ")", ";", "return", "generateDiff", "(", "fromGenericObject", ",", "toGenericObject", ")", ";", "}" ]
Generate the HTML difference between two objects. @param objectType - The NFTypeSerializer name of the objects @param from - The first object to diff @param to - The second object to diff @return
[ "Generate", "the", "HTML", "difference", "between", "two", "objects", "." ]
train
https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/genericobject/DiffHtmlGenerator.java#L65-L70
sdl/Testy
src/main/java/com/sdl/selenium/web/utils/MultiThreadClipboardUtils.java
MultiThreadClipboardUtils.pasteString
public static void pasteString(WebLocator locator) { """ * Waits until the system clipboard is not being used by another WebDriver instance, then populates the system clipboard with the value previously stored for the current WebDriver instance and finally sends the CTRL + v command to the specified locator <p> {@link #copyString(String) copyString} method should have been called before @param locator WebLocator where the value from clipboard corresponding to the current WebDriver instance should be pasted """ waitForUnlockedClipboard(); lockClipboard(); String value = clipboardContents.get(((RemoteWebDriver) WebDriverConfig.getDriver()).getSessionId().toString()); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(value), new ClipboardOwner() { @Override public void lostOwnership(final java.awt.datatransfer.Clipboard clipboard, final Transferable contents) { // do nothing } }); try { locator.sendKeys(Keys.CONTROL, "v"); } catch (Throwable throwable) { // Making sure clipboard would not unexpectedly remain locked unlockClipboard(); } unlockClipboard(); }
java
public static void pasteString(WebLocator locator) { waitForUnlockedClipboard(); lockClipboard(); String value = clipboardContents.get(((RemoteWebDriver) WebDriverConfig.getDriver()).getSessionId().toString()); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(value), new ClipboardOwner() { @Override public void lostOwnership(final java.awt.datatransfer.Clipboard clipboard, final Transferable contents) { // do nothing } }); try { locator.sendKeys(Keys.CONTROL, "v"); } catch (Throwable throwable) { // Making sure clipboard would not unexpectedly remain locked unlockClipboard(); } unlockClipboard(); }
[ "public", "static", "void", "pasteString", "(", "WebLocator", "locator", ")", "{", "waitForUnlockedClipboard", "(", ")", ";", "lockClipboard", "(", ")", ";", "String", "value", "=", "clipboardContents", ".", "get", "(", "(", "(", "RemoteWebDriver", ")", "WebDriverConfig", ".", "getDriver", "(", ")", ")", ".", "getSessionId", "(", ")", ".", "toString", "(", ")", ")", ";", "Toolkit", ".", "getDefaultToolkit", "(", ")", ".", "getSystemClipboard", "(", ")", ".", "setContents", "(", "new", "StringSelection", "(", "value", ")", ",", "new", "ClipboardOwner", "(", ")", "{", "@", "Override", "public", "void", "lostOwnership", "(", "final", "java", ".", "awt", ".", "datatransfer", ".", "Clipboard", "clipboard", ",", "final", "Transferable", "contents", ")", "{", "// do nothing", "}", "}", ")", ";", "try", "{", "locator", ".", "sendKeys", "(", "Keys", ".", "CONTROL", ",", "\"v\"", ")", ";", "}", "catch", "(", "Throwable", "throwable", ")", "{", "// Making sure clipboard would not unexpectedly remain locked", "unlockClipboard", "(", ")", ";", "}", "unlockClipboard", "(", ")", ";", "}" ]
* Waits until the system clipboard is not being used by another WebDriver instance, then populates the system clipboard with the value previously stored for the current WebDriver instance and finally sends the CTRL + v command to the specified locator <p> {@link #copyString(String) copyString} method should have been called before @param locator WebLocator where the value from clipboard corresponding to the current WebDriver instance should be pasted
[ "*", "Waits", "until", "the", "system", "clipboard", "is", "not", "being", "used", "by", "another", "WebDriver", "instance", "then", "populates", "the", "system", "clipboard", "with", "the", "value", "previously", "stored", "for", "the", "current", "WebDriver", "instance", "and", "finally", "sends", "the", "CTRL", "+", "v", "command", "to", "the", "specified", "locator", "<p", ">", "{", "@link", "#copyString", "(", "String", ")", "copyString", "}", "method", "should", "have", "been", "called", "before" ]
train
https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/web/utils/MultiThreadClipboardUtils.java#L50-L68
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java
HttpMessage.setAttribute
public Object setAttribute(String name, Object attribute) { """ Set a request attribute. @param name Attribute name @param attribute Attribute value @return Previous Attribute value """ if (_attributes==null) _attributes=new HashMap(11); return _attributes.put(name,attribute); }
java
public Object setAttribute(String name, Object attribute) { if (_attributes==null) _attributes=new HashMap(11); return _attributes.put(name,attribute); }
[ "public", "Object", "setAttribute", "(", "String", "name", ",", "Object", "attribute", ")", "{", "if", "(", "_attributes", "==", "null", ")", "_attributes", "=", "new", "HashMap", "(", "11", ")", ";", "return", "_attributes", ".", "put", "(", "name", ",", "attribute", ")", ";", "}" ]
Set a request attribute. @param name Attribute name @param attribute Attribute value @return Previous Attribute value
[ "Set", "a", "request", "attribute", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpMessage.java#L733-L738
knowm/XChart
xchart/src/main/java/org/knowm/xchart/DialChart.java
DialChart.addSeries
public DialSeries addSeries(String seriesName, double value, String annotation) { """ Add a series for a Dial type chart @param seriesName @param value @param annotation @return """ // Sanity checks sanityCheck(seriesName, value); DialSeries series = new DialSeries(seriesName, value, annotation); seriesMap.put(seriesName, series); return series; }
java
public DialSeries addSeries(String seriesName, double value, String annotation) { // Sanity checks sanityCheck(seriesName, value); DialSeries series = new DialSeries(seriesName, value, annotation); seriesMap.put(seriesName, series); return series; }
[ "public", "DialSeries", "addSeries", "(", "String", "seriesName", ",", "double", "value", ",", "String", "annotation", ")", "{", "// Sanity checks", "sanityCheck", "(", "seriesName", ",", "value", ")", ";", "DialSeries", "series", "=", "new", "DialSeries", "(", "seriesName", ",", "value", ",", "annotation", ")", ";", "seriesMap", ".", "put", "(", "seriesName", ",", "series", ")", ";", "return", "series", ";", "}" ]
Add a series for a Dial type chart @param seriesName @param value @param annotation @return
[ "Add", "a", "series", "for", "a", "Dial", "type", "chart" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/DialChart.java#L84-L94
beangle/beangle3
commons/model/src/main/java/org/beangle/commons/transfer/excel/ExcelTools.java
ExcelTools.object2Excel
public <T> HSSFWorkbook object2Excel(List<T> list, String propertyKeys, String propertyShowKeys) throws Exception { """ <p> object2Excel. </p> @param list a {@link java.util.List} object. @param propertyKeys a {@link java.lang.String} object. @param propertyShowKeys a {@link java.lang.String} object. @param <T> a T object. @return a {@link org.apache.poi.hssf.usermodel.HSSFWorkbook} object. @throws java.lang.Exception if any. """ return object2Excel(list, propertyKeys, propertyShowKeys, new DefaultPropertyExtractor()); }
java
public <T> HSSFWorkbook object2Excel(List<T> list, String propertyKeys, String propertyShowKeys) throws Exception { return object2Excel(list, propertyKeys, propertyShowKeys, new DefaultPropertyExtractor()); }
[ "public", "<", "T", ">", "HSSFWorkbook", "object2Excel", "(", "List", "<", "T", ">", "list", ",", "String", "propertyKeys", ",", "String", "propertyShowKeys", ")", "throws", "Exception", "{", "return", "object2Excel", "(", "list", ",", "propertyKeys", ",", "propertyShowKeys", ",", "new", "DefaultPropertyExtractor", "(", ")", ")", ";", "}" ]
<p> object2Excel. </p> @param list a {@link java.util.List} object. @param propertyKeys a {@link java.lang.String} object. @param propertyShowKeys a {@link java.lang.String} object. @param <T> a T object. @return a {@link org.apache.poi.hssf.usermodel.HSSFWorkbook} object. @throws java.lang.Exception if any.
[ "<p", ">", "object2Excel", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/transfer/excel/ExcelTools.java#L194-L198
qiujuer/Genius-Android
caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/TouchEffectDrawable.java
TouchEffectDrawable.setPadding
public void setPadding(int left, int top, int right, int bottom) { """ Sets padding for the shape. @param left padding for the left side (in pixels) @param top padding for the top (in pixels) @param right padding for the right side (in pixels) @param bottom padding for the bottom (in pixels) """ if ((left | top | right | bottom) == 0) { mState.mPadding = null; } else { if (mState.mPadding == null) { mState.mPadding = new Rect(); } mState.mPadding.set(left, top, right, bottom); } invalidateSelf(); }
java
public void setPadding(int left, int top, int right, int bottom) { if ((left | top | right | bottom) == 0) { mState.mPadding = null; } else { if (mState.mPadding == null) { mState.mPadding = new Rect(); } mState.mPadding.set(left, top, right, bottom); } invalidateSelf(); }
[ "public", "void", "setPadding", "(", "int", "left", ",", "int", "top", ",", "int", "right", ",", "int", "bottom", ")", "{", "if", "(", "(", "left", "|", "top", "|", "right", "|", "bottom", ")", "==", "0", ")", "{", "mState", ".", "mPadding", "=", "null", ";", "}", "else", "{", "if", "(", "mState", ".", "mPadding", "==", "null", ")", "{", "mState", ".", "mPadding", "=", "new", "Rect", "(", ")", ";", "}", "mState", ".", "mPadding", ".", "set", "(", "left", ",", "top", ",", "right", ",", "bottom", ")", ";", "}", "invalidateSelf", "(", ")", ";", "}" ]
Sets padding for the shape. @param left padding for the left side (in pixels) @param top padding for the top (in pixels) @param right padding for the right side (in pixels) @param bottom padding for the bottom (in pixels)
[ "Sets", "padding", "for", "the", "shape", "." ]
train
https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/TouchEffectDrawable.java#L167-L177
JCTools/JCTools
jctools-build/src/main/java/org/jctools/queues/atomic/JavaParsingAtomicLinkedQueueGenerator.java
JavaParsingAtomicLinkedQueueGenerator.fieldUpdaterGetAndSet
private BlockStmt fieldUpdaterGetAndSet(String fieldUpdaterFieldName, String newValueName) { """ Generates something like <code>return P_INDEX_UPDATER.getAndSet(this, newValue)</code> @param fieldUpdaterFieldName @param newValueName @return """ BlockStmt body = new BlockStmt(); body.addStatement(new ReturnStmt( methodCallExpr(fieldUpdaterFieldName, "getAndSet", new ThisExpr(), new NameExpr(newValueName)))); return body; }
java
private BlockStmt fieldUpdaterGetAndSet(String fieldUpdaterFieldName, String newValueName) { BlockStmt body = new BlockStmt(); body.addStatement(new ReturnStmt( methodCallExpr(fieldUpdaterFieldName, "getAndSet", new ThisExpr(), new NameExpr(newValueName)))); return body; }
[ "private", "BlockStmt", "fieldUpdaterGetAndSet", "(", "String", "fieldUpdaterFieldName", ",", "String", "newValueName", ")", "{", "BlockStmt", "body", "=", "new", "BlockStmt", "(", ")", ";", "body", ".", "addStatement", "(", "new", "ReturnStmt", "(", "methodCallExpr", "(", "fieldUpdaterFieldName", ",", "\"getAndSet\"", ",", "new", "ThisExpr", "(", ")", ",", "new", "NameExpr", "(", "newValueName", ")", ")", ")", ")", ";", "return", "body", ";", "}" ]
Generates something like <code>return P_INDEX_UPDATER.getAndSet(this, newValue)</code> @param fieldUpdaterFieldName @param newValueName @return
[ "Generates", "something", "like", "<code", ">", "return", "P_INDEX_UPDATER", ".", "getAndSet", "(", "this", "newValue", ")", "<", "/", "code", ">" ]
train
https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-build/src/main/java/org/jctools/queues/atomic/JavaParsingAtomicLinkedQueueGenerator.java#L319-L324
dlew/joda-time-android
library/src/main/java/net/danlew/android/joda/DateUtils.java
DateUtils.formatElapsedTime
public static String formatElapsedTime(StringBuilder recycle, ReadableDuration elapsedDuration) { """ Formats an elapsed time in a format like "MM:SS" or "H:MM:SS" (using a form suited to the current locale), similar to that used on the call-in-progress screen. See {@link android.text.format.DateUtils#formatElapsedTime} for full docs. @param recycle {@link StringBuilder} to recycle, or null to use a temporary one. @param elapsedDuration the elapsed duration """ return android.text.format.DateUtils.formatElapsedTime(recycle, elapsedDuration.toDuration().toStandardSeconds().getSeconds()); }
java
public static String formatElapsedTime(StringBuilder recycle, ReadableDuration elapsedDuration) { return android.text.format.DateUtils.formatElapsedTime(recycle, elapsedDuration.toDuration().toStandardSeconds().getSeconds()); }
[ "public", "static", "String", "formatElapsedTime", "(", "StringBuilder", "recycle", ",", "ReadableDuration", "elapsedDuration", ")", "{", "return", "android", ".", "text", ".", "format", ".", "DateUtils", ".", "formatElapsedTime", "(", "recycle", ",", "elapsedDuration", ".", "toDuration", "(", ")", ".", "toStandardSeconds", "(", ")", ".", "getSeconds", "(", ")", ")", ";", "}" ]
Formats an elapsed time in a format like "MM:SS" or "H:MM:SS" (using a form suited to the current locale), similar to that used on the call-in-progress screen. See {@link android.text.format.DateUtils#formatElapsedTime} for full docs. @param recycle {@link StringBuilder} to recycle, or null to use a temporary one. @param elapsedDuration the elapsed duration
[ "Formats", "an", "elapsed", "time", "in", "a", "format", "like", "MM", ":", "SS", "or", "H", ":", "MM", ":", "SS", "(", "using", "a", "form", "suited", "to", "the", "current", "locale", ")", "similar", "to", "that", "used", "on", "the", "call", "-", "in", "-", "progress", "screen", "." ]
train
https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L175-L178
Stratio/cassandra-lucene-index
builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java
Builder.bitemporalMapper
public static BitemporalMapper bitemporalMapper(String vtFrom, String vtTo, String ttFrom, String ttTo) { """ Returns a new {@link BitemporalMapper}. @param vtFrom the column name containing the valid time start @param vtTo the column name containing the valid time stop @param ttFrom the column name containing the transaction time start @param ttTo the column name containing the transaction time stop @return a new {@link BitemporalMapper} """ return new BitemporalMapper(vtFrom, vtTo, ttFrom, ttTo); }
java
public static BitemporalMapper bitemporalMapper(String vtFrom, String vtTo, String ttFrom, String ttTo) { return new BitemporalMapper(vtFrom, vtTo, ttFrom, ttTo); }
[ "public", "static", "BitemporalMapper", "bitemporalMapper", "(", "String", "vtFrom", ",", "String", "vtTo", ",", "String", "ttFrom", ",", "String", "ttTo", ")", "{", "return", "new", "BitemporalMapper", "(", "vtFrom", ",", "vtTo", ",", "ttFrom", ",", "ttTo", ")", ";", "}" ]
Returns a new {@link BitemporalMapper}. @param vtFrom the column name containing the valid time start @param vtTo the column name containing the valid time stop @param ttFrom the column name containing the transaction time start @param ttTo the column name containing the transaction time stop @return a new {@link BitemporalMapper}
[ "Returns", "a", "new", "{", "@link", "BitemporalMapper", "}", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java#L101-L103
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockInlineChecksumReader.java
BlockInlineChecksumReader.getPosFromBlockOffset
public static long getPosFromBlockOffset(long offsetInBlock, int bytesPerChecksum, int checksumSize) { """ Translate from block offset to position in file. @param offsetInBlock @param bytesPerChecksum @param checksumSize @return """ // We only support to read full chunks, so offsetInBlock must be the boundary // of the chunks. assert offsetInBlock % bytesPerChecksum == 0; // The position in the file will be the same as the file size for the block // size. return getFileLengthFromBlockSize(offsetInBlock, bytesPerChecksum, checksumSize); }
java
public static long getPosFromBlockOffset(long offsetInBlock, int bytesPerChecksum, int checksumSize) { // We only support to read full chunks, so offsetInBlock must be the boundary // of the chunks. assert offsetInBlock % bytesPerChecksum == 0; // The position in the file will be the same as the file size for the block // size. return getFileLengthFromBlockSize(offsetInBlock, bytesPerChecksum, checksumSize); }
[ "public", "static", "long", "getPosFromBlockOffset", "(", "long", "offsetInBlock", ",", "int", "bytesPerChecksum", ",", "int", "checksumSize", ")", "{", "// We only support to read full chunks, so offsetInBlock must be the boundary", "// of the chunks.", "assert", "offsetInBlock", "%", "bytesPerChecksum", "==", "0", ";", "// The position in the file will be the same as the file size for the block", "// size.", "return", "getFileLengthFromBlockSize", "(", "offsetInBlock", ",", "bytesPerChecksum", ",", "checksumSize", ")", ";", "}" ]
Translate from block offset to position in file. @param offsetInBlock @param bytesPerChecksum @param checksumSize @return
[ "Translate", "from", "block", "offset", "to", "position", "in", "file", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockInlineChecksumReader.java#L164-L172
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listWorkerPoolInstanceMetricsAsync
public Observable<Page<ResourceMetricInner>> listWorkerPoolInstanceMetricsAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance) { """ Get metrics for a specific instance of a worker pool of an App Service Environment. Get metrics for a specific instance of a worker pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @param instance Name of the instance in the worker pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricInner&gt; object """ return listWorkerPoolInstanceMetricsWithServiceResponseAsync(resourceGroupName, name, workerPoolName, instance) .map(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Page<ResourceMetricInner>>() { @Override public Page<ResourceMetricInner> call(ServiceResponse<Page<ResourceMetricInner>> response) { return response.body(); } }); }
java
public Observable<Page<ResourceMetricInner>> listWorkerPoolInstanceMetricsAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance) { return listWorkerPoolInstanceMetricsWithServiceResponseAsync(resourceGroupName, name, workerPoolName, instance) .map(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Page<ResourceMetricInner>>() { @Override public Page<ResourceMetricInner> call(ServiceResponse<Page<ResourceMetricInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ResourceMetricInner", ">", ">", "listWorkerPoolInstanceMetricsAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ",", "final", "String", "workerPoolName", ",", "final", "String", "instance", ")", "{", "return", "listWorkerPoolInstanceMetricsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "workerPoolName", ",", "instance", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ResourceMetricInner", ">", ">", ",", "Page", "<", "ResourceMetricInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "ResourceMetricInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ResourceMetricInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get metrics for a specific instance of a worker pool of an App Service Environment. Get metrics for a specific instance of a worker pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @param instance Name of the instance in the worker pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricInner&gt; object
[ "Get", "metrics", "for", "a", "specific", "instance", "of", "a", "worker", "pool", "of", "an", "App", "Service", "Environment", ".", "Get", "metrics", "for", "a", "specific", "instance", "of", "a", "worker", "pool", "of", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5685-L5693
aws/aws-sdk-java
aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/CreateDeploymentResult.java
CreateDeploymentResult.withApiSummary
public CreateDeploymentResult withApiSummary(java.util.Map<String, java.util.Map<String, MethodSnapshot>> apiSummary) { """ <p> A summary of the <a>RestApi</a> at the date and time that the deployment resource was created. </p> @param apiSummary A summary of the <a>RestApi</a> at the date and time that the deployment resource was created. @return Returns a reference to this object so that method calls can be chained together. """ setApiSummary(apiSummary); return this; }
java
public CreateDeploymentResult withApiSummary(java.util.Map<String, java.util.Map<String, MethodSnapshot>> apiSummary) { setApiSummary(apiSummary); return this; }
[ "public", "CreateDeploymentResult", "withApiSummary", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "Map", "<", "String", ",", "MethodSnapshot", ">", ">", "apiSummary", ")", "{", "setApiSummary", "(", "apiSummary", ")", ";", "return", "this", ";", "}" ]
<p> A summary of the <a>RestApi</a> at the date and time that the deployment resource was created. </p> @param apiSummary A summary of the <a>RestApi</a> at the date and time that the deployment resource was created. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "summary", "of", "the", "<a", ">", "RestApi<", "/", "a", ">", "at", "the", "date", "and", "time", "that", "the", "deployment", "resource", "was", "created", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/CreateDeploymentResult.java#L214-L217
nispok/snackbar
lib/src/main/java/com/nispok/snackbar/SnackbarManager.java
SnackbarManager.show
public static void show(@NonNull Snackbar snackbar, @NonNull ViewGroup parent) { """ Displays a {@link com.nispok.snackbar.Snackbar} in the specified {@link ViewGroup}, dismissing the current Snackbar being displayed, if any @param snackbar instance of {@link com.nispok.snackbar.Snackbar} to display @param parent parent {@link ViewGroup} to display the Snackbar """ show(snackbar, parent, Snackbar.shouldUsePhoneLayout(snackbar.getContext())); }
java
public static void show(@NonNull Snackbar snackbar, @NonNull ViewGroup parent) { show(snackbar, parent, Snackbar.shouldUsePhoneLayout(snackbar.getContext())); }
[ "public", "static", "void", "show", "(", "@", "NonNull", "Snackbar", "snackbar", ",", "@", "NonNull", "ViewGroup", "parent", ")", "{", "show", "(", "snackbar", ",", "parent", ",", "Snackbar", ".", "shouldUsePhoneLayout", "(", "snackbar", ".", "getContext", "(", ")", ")", ")", ";", "}" ]
Displays a {@link com.nispok.snackbar.Snackbar} in the specified {@link ViewGroup}, dismissing the current Snackbar being displayed, if any @param snackbar instance of {@link com.nispok.snackbar.Snackbar} to display @param parent parent {@link ViewGroup} to display the Snackbar
[ "Displays", "a", "{", "@link", "com", ".", "nispok", ".", "snackbar", ".", "Snackbar", "}", "in", "the", "specified", "{", "@link", "ViewGroup", "}", "dismissing", "the", "current", "Snackbar", "being", "displayed", "if", "any" ]
train
https://github.com/nispok/snackbar/blob/a4e0449874423031107f6aaa7e97d0f1714a1d3b/lib/src/main/java/com/nispok/snackbar/SnackbarManager.java#L79-L81
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/ObjectTreeParser.java
ObjectTreeParser.typeValue
private Object typeValue(String value, Class clazz) throws SlickXMLException { """ Convert a given value to a given type @param value The value to convert @param clazz The class that the returned object must be @return The value as the given type @throws SlickXMLException Indicates there is no automatic way of converting the value to the type """ if (clazz == String.class) { return value; } try { clazz = mapPrimitive(clazz); return clazz.getConstructor(new Class[] {String.class}).newInstance(new Object[] {value}); } catch (Exception e) { throw new SlickXMLException("Failed to convert: "+value+" to the expected primitive type: "+clazz, e); } }
java
private Object typeValue(String value, Class clazz) throws SlickXMLException { if (clazz == String.class) { return value; } try { clazz = mapPrimitive(clazz); return clazz.getConstructor(new Class[] {String.class}).newInstance(new Object[] {value}); } catch (Exception e) { throw new SlickXMLException("Failed to convert: "+value+" to the expected primitive type: "+clazz, e); } }
[ "private", "Object", "typeValue", "(", "String", "value", ",", "Class", "clazz", ")", "throws", "SlickXMLException", "{", "if", "(", "clazz", "==", "String", ".", "class", ")", "{", "return", "value", ";", "}", "try", "{", "clazz", "=", "mapPrimitive", "(", "clazz", ")", ";", "return", "clazz", ".", "getConstructor", "(", "new", "Class", "[", "]", "{", "String", ".", "class", "}", ")", ".", "newInstance", "(", "new", "Object", "[", "]", "{", "value", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SlickXMLException", "(", "\"Failed to convert: \"", "+", "value", "+", "\" to the expected primitive type: \"", "+", "clazz", ",", "e", ")", ";", "}", "}" ]
Convert a given value to a given type @param value The value to convert @param clazz The class that the returned object must be @return The value as the given type @throws SlickXMLException Indicates there is no automatic way of converting the value to the type
[ "Convert", "a", "given", "value", "to", "a", "given", "type" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/ObjectTreeParser.java#L306-L317
Impetus/Kundera
examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java
ExecutorService.findByQuery
@SuppressWarnings("unchecked") static void findByQuery(final EntityManager em, final String query) { """ on find by wild search query. @param em entity manager instance. @param query query. """ Query q = em.createNamedQuery(query); logger.info("[On Find All by Query]"); List<User> users = q.getResultList(); if (users == null || users.isEmpty()) { logger.info("0 Users Returned"); return; } System.out.println("#######################START##########################################"); logger.info("\t\t Total number of users:" + users.size()); logger.info("\t\t User's total tweets:" + users.get(0).getTweets().size()); printTweets(users); logger.info("\n"); // logger.info("First tweet:" users.get(0).getTweets().); System.out.println("#######################END############################################"); logger.info("\n"); }
java
@SuppressWarnings("unchecked") static void findByQuery(final EntityManager em, final String query) { Query q = em.createNamedQuery(query); logger.info("[On Find All by Query]"); List<User> users = q.getResultList(); if (users == null || users.isEmpty()) { logger.info("0 Users Returned"); return; } System.out.println("#######################START##########################################"); logger.info("\t\t Total number of users:" + users.size()); logger.info("\t\t User's total tweets:" + users.get(0).getTweets().size()); printTweets(users); logger.info("\n"); // logger.info("First tweet:" users.get(0).getTweets().); System.out.println("#######################END############################################"); logger.info("\n"); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "void", "findByQuery", "(", "final", "EntityManager", "em", ",", "final", "String", "query", ")", "{", "Query", "q", "=", "em", ".", "createNamedQuery", "(", "query", ")", ";", "logger", ".", "info", "(", "\"[On Find All by Query]\"", ")", ";", "List", "<", "User", ">", "users", "=", "q", ".", "getResultList", "(", ")", ";", "if", "(", "users", "==", "null", "||", "users", ".", "isEmpty", "(", ")", ")", "{", "logger", ".", "info", "(", "\"0 Users Returned\"", ")", ";", "return", ";", "}", "System", ".", "out", ".", "println", "(", "\"#######################START##########################################\"", ")", ";", "logger", ".", "info", "(", "\"\\t\\t Total number of users:\"", "+", "users", ".", "size", "(", ")", ")", ";", "logger", ".", "info", "(", "\"\\t\\t User's total tweets:\"", "+", "users", ".", "get", "(", "0", ")", ".", "getTweets", "(", ")", ".", "size", "(", ")", ")", ";", "printTweets", "(", "users", ")", ";", "logger", ".", "info", "(", "\"\\n\"", ")", ";", "// logger.info(\"First tweet:\" users.get(0).getTweets().);\r", "System", ".", "out", ".", "println", "(", "\"#######################END############################################\"", ")", ";", "logger", ".", "info", "(", "\"\\n\"", ")", ";", "}" ]
on find by wild search query. @param em entity manager instance. @param query query.
[ "on", "find", "by", "wild", "search", "query", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java#L119-L141
omise/omise-java
src/main/java/co/omise/Serializer.java
Serializer.deserializeFromMap
public <T extends OmiseObject> T deserializeFromMap(Map<String, Object> map, TypeReference<T> ref) { """ Deserialize an instance of the given type reference from the map. @param map The {@link Map} containing the JSON structure to deserialize from. @param ref The {@link TypeReference} of the type to deserialize the result into. @param <T> The type to deserialize the result into. @return An instance of the given type T deserialized from the map. """ return objectMapper.convertValue(map, ref); }
java
public <T extends OmiseObject> T deserializeFromMap(Map<String, Object> map, TypeReference<T> ref) { return objectMapper.convertValue(map, ref); }
[ "public", "<", "T", "extends", "OmiseObject", ">", "T", "deserializeFromMap", "(", "Map", "<", "String", ",", "Object", ">", "map", ",", "TypeReference", "<", "T", ">", "ref", ")", "{", "return", "objectMapper", ".", "convertValue", "(", "map", ",", "ref", ")", ";", "}" ]
Deserialize an instance of the given type reference from the map. @param map The {@link Map} containing the JSON structure to deserialize from. @param ref The {@link TypeReference} of the type to deserialize the result into. @param <T> The type to deserialize the result into. @return An instance of the given type T deserialized from the map.
[ "Deserialize", "an", "instance", "of", "the", "given", "type", "reference", "from", "the", "map", "." ]
train
https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L152-L154
Azure/azure-sdk-for-java
eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/RetryPolicy.java
RetryPolicy.getNextRetryInterval
public Duration getNextRetryInterval(String clientId, Exception lastException, Duration remainingTime) { """ Gets the Interval after which nextRetry should be done. @param clientId clientId @param lastException lastException @param remainingTime remainingTime to retry @return returns 'null' Duration when not Allowed """ int baseWaitTime = 0; synchronized (this.serverBusySync) { if (lastException != null && (lastException instanceof ServerBusyException || (lastException.getCause() != null && lastException.getCause() instanceof ServerBusyException))) { baseWaitTime += ClientConstants.SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS; } } return this.onGetNextRetryInterval(clientId, lastException, remainingTime, baseWaitTime); }
java
public Duration getNextRetryInterval(String clientId, Exception lastException, Duration remainingTime) { int baseWaitTime = 0; synchronized (this.serverBusySync) { if (lastException != null && (lastException instanceof ServerBusyException || (lastException.getCause() != null && lastException.getCause() instanceof ServerBusyException))) { baseWaitTime += ClientConstants.SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS; } } return this.onGetNextRetryInterval(clientId, lastException, remainingTime, baseWaitTime); }
[ "public", "Duration", "getNextRetryInterval", "(", "String", "clientId", ",", "Exception", "lastException", ",", "Duration", "remainingTime", ")", "{", "int", "baseWaitTime", "=", "0", ";", "synchronized", "(", "this", ".", "serverBusySync", ")", "{", "if", "(", "lastException", "!=", "null", "&&", "(", "lastException", "instanceof", "ServerBusyException", "||", "(", "lastException", ".", "getCause", "(", ")", "!=", "null", "&&", "lastException", ".", "getCause", "(", ")", "instanceof", "ServerBusyException", ")", ")", ")", "{", "baseWaitTime", "+=", "ClientConstants", ".", "SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS", ";", "}", "}", "return", "this", ".", "onGetNextRetryInterval", "(", "clientId", ",", "lastException", ",", "remainingTime", ",", "baseWaitTime", ")", ";", "}" ]
Gets the Interval after which nextRetry should be done. @param clientId clientId @param lastException lastException @param remainingTime remainingTime to retry @return returns 'null' Duration when not Allowed
[ "Gets", "the", "Interval", "after", "which", "nextRetry", "should", "be", "done", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/RetryPolicy.java#L76-L86
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/AppEventsLogger.java
AppEventsLogger.activateApp
@SuppressWarnings("deprecation") public static void activateApp(Context context, String applicationId) { """ Notifies the events system that the app has launched & logs an activatedApp event. Should be called whenever your app becomes active, typically in the onResume() method of each long-running Activity of your app. @param context Used to access the attributionId for non-authenticated users. @param applicationId The specific applicationId to report the activation for. """ if (context == null || applicationId == null) { throw new IllegalArgumentException("Both context and applicationId must be non-null"); } if ((context instanceof Activity)) { setSourceApplication((Activity) context); } else { // If context is not an Activity, we cannot get intent nor calling activity. resetSourceApplication(); Log.d(AppEventsLogger.class.getName(), "To set source application the context of activateApp must be an instance of Activity"); } // activateApp supercedes publishInstall in the public API, so we need to explicitly invoke it, since the server // can't reliably infer install state for all conditions of an app activate. Settings.publishInstallAsync(context, applicationId, null); final AppEventsLogger logger = new AppEventsLogger(context, applicationId, null); final long eventTime = System.currentTimeMillis(); final String sourceApplicationInfo = getSourceApplication(); backgroundExecutor.execute(new Runnable() { @Override public void run() { logger.logAppSessionResumeEvent(eventTime, sourceApplicationInfo); } }); }
java
@SuppressWarnings("deprecation") public static void activateApp(Context context, String applicationId) { if (context == null || applicationId == null) { throw new IllegalArgumentException("Both context and applicationId must be non-null"); } if ((context instanceof Activity)) { setSourceApplication((Activity) context); } else { // If context is not an Activity, we cannot get intent nor calling activity. resetSourceApplication(); Log.d(AppEventsLogger.class.getName(), "To set source application the context of activateApp must be an instance of Activity"); } // activateApp supercedes publishInstall in the public API, so we need to explicitly invoke it, since the server // can't reliably infer install state for all conditions of an app activate. Settings.publishInstallAsync(context, applicationId, null); final AppEventsLogger logger = new AppEventsLogger(context, applicationId, null); final long eventTime = System.currentTimeMillis(); final String sourceApplicationInfo = getSourceApplication(); backgroundExecutor.execute(new Runnable() { @Override public void run() { logger.logAppSessionResumeEvent(eventTime, sourceApplicationInfo); } }); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "void", "activateApp", "(", "Context", "context", ",", "String", "applicationId", ")", "{", "if", "(", "context", "==", "null", "||", "applicationId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Both context and applicationId must be non-null\"", ")", ";", "}", "if", "(", "(", "context", "instanceof", "Activity", ")", ")", "{", "setSourceApplication", "(", "(", "Activity", ")", "context", ")", ";", "}", "else", "{", "// If context is not an Activity, we cannot get intent nor calling activity.", "resetSourceApplication", "(", ")", ";", "Log", ".", "d", "(", "AppEventsLogger", ".", "class", ".", "getName", "(", ")", ",", "\"To set source application the context of activateApp must be an instance of Activity\"", ")", ";", "}", "// activateApp supercedes publishInstall in the public API, so we need to explicitly invoke it, since the server", "// can't reliably infer install state for all conditions of an app activate.", "Settings", ".", "publishInstallAsync", "(", "context", ",", "applicationId", ",", "null", ")", ";", "final", "AppEventsLogger", "logger", "=", "new", "AppEventsLogger", "(", "context", ",", "applicationId", ",", "null", ")", ";", "final", "long", "eventTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "final", "String", "sourceApplicationInfo", "=", "getSourceApplication", "(", ")", ";", "backgroundExecutor", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "logger", ".", "logAppSessionResumeEvent", "(", "eventTime", ",", "sourceApplicationInfo", ")", ";", "}", "}", ")", ";", "}" ]
Notifies the events system that the app has launched & logs an activatedApp event. Should be called whenever your app becomes active, typically in the onResume() method of each long-running Activity of your app. @param context Used to access the attributionId for non-authenticated users. @param applicationId The specific applicationId to report the activation for.
[ "Notifies", "the", "events", "system", "that", "the", "app", "has", "launched", "&", "logs", "an", "activatedApp", "event", ".", "Should", "be", "called", "whenever", "your", "app", "becomes", "active", "typically", "in", "the", "onResume", "()", "method", "of", "each", "long", "-", "running", "Activity", "of", "your", "app", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/AppEventsLogger.java#L258-L286
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/utilities/xml/XercesXmlSerializers.java
XercesXmlSerializers.writeXmlNoSpace
public static void writeXmlNoSpace(Document doc, String encoding, Writer out) throws IOException { """ Serialize the dom Document with no preserved space between elements, but without indenting, line wrapping, omission of XML declaration, or omission of doctype @param doc @param encoding @param out @throws IOException """ XMLSerializer ser = new XMLSerializer(out, getXmlNoSpace(encoding)); ser.serialize(doc); out.close(); }
java
public static void writeXmlNoSpace(Document doc, String encoding, Writer out) throws IOException { XMLSerializer ser = new XMLSerializer(out, getXmlNoSpace(encoding)); ser.serialize(doc); out.close(); }
[ "public", "static", "void", "writeXmlNoSpace", "(", "Document", "doc", ",", "String", "encoding", ",", "Writer", "out", ")", "throws", "IOException", "{", "XMLSerializer", "ser", "=", "new", "XMLSerializer", "(", "out", ",", "getXmlNoSpace", "(", "encoding", ")", ")", ";", "ser", ".", "serialize", "(", "doc", ")", ";", "out", ".", "close", "(", ")", ";", "}" ]
Serialize the dom Document with no preserved space between elements, but without indenting, line wrapping, omission of XML declaration, or omission of doctype @param doc @param encoding @param out @throws IOException
[ "Serialize", "the", "dom", "Document", "with", "no", "preserved", "space", "between", "elements", "but", "without", "indenting", "line", "wrapping", "omission", "of", "XML", "declaration", "or", "omission", "of", "doctype" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/xml/XercesXmlSerializers.java#L31-L37
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java
JanusConfig.getSystemProperty
public static String getSystemProperty(String name, String defaultValue) { """ Replies the value of the system property. @param name - name of the property. @param defaultValue - value to reply if the these is no property found @return the value, or defaultValue. """ String value; value = System.getProperty(name, null); if (value != null) { return value; } value = System.getenv(name); if (value != null) { return value; } return defaultValue; }
java
public static String getSystemProperty(String name, String defaultValue) { String value; value = System.getProperty(name, null); if (value != null) { return value; } value = System.getenv(name); if (value != null) { return value; } return defaultValue; }
[ "public", "static", "String", "getSystemProperty", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "String", "value", ";", "value", "=", "System", ".", "getProperty", "(", "name", ",", "null", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";", "}", "value", "=", "System", ".", "getenv", "(", "name", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";", "}", "return", "defaultValue", ";", "}" ]
Replies the value of the system property. @param name - name of the property. @param defaultValue - value to reply if the these is no property found @return the value, or defaultValue.
[ "Replies", "the", "value", "of", "the", "system", "property", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java#L320-L331
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/data/clock/Day.java
Day.getNthOfMonth
public static Day getNthOfMonth(int n, int dayOfWeek, int month, int year) { """ Find the n'th xxxxday of s specified month (for instance find 1st sunday of May 2006; findNthOfMonth (1, Calendar.SUNDAY, Calendar.MAY, 2006); Return null if the specified day doesn't exists. @param n Nth day to look for. @param dayOfWeek Day to look for (Calendar.XXXDAY). @param month Month to check (Calendar.XXX). @param year Year to check. @return Required Day (or null if non-existent) @throws IllegalArgumentException if dyaOfWeek parameter doesn't represent a valid day. """ // Validate the dayOfWeek argument if (dayOfWeek < 0 || dayOfWeek > 6) throw new IllegalArgumentException("Invalid day of week: " + dayOfWeek); LocalDateTime localDateTime = LocalDateTime.of(year, month, 0, 0, 0); return new Day(localDateTime .with(TemporalAdjusters .next(DayOfWeek.of(dayOfWeek))) .toLocalDate()); }
java
public static Day getNthOfMonth(int n, int dayOfWeek, int month, int year) { // Validate the dayOfWeek argument if (dayOfWeek < 0 || dayOfWeek > 6) throw new IllegalArgumentException("Invalid day of week: " + dayOfWeek); LocalDateTime localDateTime = LocalDateTime.of(year, month, 0, 0, 0); return new Day(localDateTime .with(TemporalAdjusters .next(DayOfWeek.of(dayOfWeek))) .toLocalDate()); }
[ "public", "static", "Day", "getNthOfMonth", "(", "int", "n", ",", "int", "dayOfWeek", ",", "int", "month", ",", "int", "year", ")", "{", "// Validate the dayOfWeek argument\r", "if", "(", "dayOfWeek", "<", "0", "||", "dayOfWeek", ">", "6", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid day of week: \"", "+", "dayOfWeek", ")", ";", "LocalDateTime", "localDateTime", "=", "LocalDateTime", ".", "of", "(", "year", ",", "month", ",", "0", ",", "0", ",", "0", ")", ";", "return", "new", "Day", "(", "localDateTime", ".", "with", "(", "TemporalAdjusters", ".", "next", "(", "DayOfWeek", ".", "of", "(", "dayOfWeek", ")", ")", ")", ".", "toLocalDate", "(", ")", ")", ";", "}" ]
Find the n'th xxxxday of s specified month (for instance find 1st sunday of May 2006; findNthOfMonth (1, Calendar.SUNDAY, Calendar.MAY, 2006); Return null if the specified day doesn't exists. @param n Nth day to look for. @param dayOfWeek Day to look for (Calendar.XXXDAY). @param month Month to check (Calendar.XXX). @param year Year to check. @return Required Day (or null if non-existent) @throws IllegalArgumentException if dyaOfWeek parameter doesn't represent a valid day.
[ "Find", "the", "n", "th", "xxxxday", "of", "s", "specified", "month", "(", "for", "instance", "find", "1st", "sunday", "of", "May", "2006", ";", "findNthOfMonth", "(", "1", "Calendar", ".", "SUNDAY", "Calendar", ".", "MAY", "2006", ")", ";", "Return", "null", "if", "the", "specified", "day", "doesn", "t", "exists", "." ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/data/clock/Day.java#L563-L574
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getMovieTranslations
public ResultList<Translation> getMovieTranslations(int movieId) throws MovieDbException { """ This method is used to retrieve a list of the available translations for a specific movie. @param movieId @return @throws MovieDbException """ TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.TRANSLATIONS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class); ResultList<Translation> results = new ResultList<>(wrapper.getTranslations()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get translations", url, ex); } }
java
public ResultList<Translation> getMovieTranslations(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.TRANSLATIONS).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class); ResultList<Translation> results = new ResultList<>(wrapper.getTranslations()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get translations", url, ex); } }
[ "public", "ResultList", "<", "Translation", ">", "getMovieTranslations", "(", "int", "movieId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "movieId", ")", ";", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "MOVIE", ")", ".", "subMethod", "(", "MethodSub", ".", "TRANSLATIONS", ")", ".", "buildUrl", "(", "parameters", ")", ";", "String", "webpage", "=", "httpTools", ".", "getRequest", "(", "url", ")", ";", "try", "{", "WrapperTranslations", "wrapper", "=", "MAPPER", ".", "readValue", "(", "webpage", ",", "WrapperTranslations", ".", "class", ")", ";", "ResultList", "<", "Translation", ">", "results", "=", "new", "ResultList", "<>", "(", "wrapper", ".", "getTranslations", "(", ")", ")", ";", "wrapper", ".", "setResultProperties", "(", "results", ")", ";", "return", "results", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "MovieDbException", "(", "ApiExceptionType", ".", "MAPPING_FAILED", ",", "\"Failed to get translations\"", ",", "url", ",", "ex", ")", ";", "}", "}" ]
This method is used to retrieve a list of the available translations for a specific movie. @param movieId @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "retrieve", "a", "list", "of", "the", "available", "translations", "for", "a", "specific", "movie", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L362-L377
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.getRunbookContentAsync
public Observable<InputStream> getRunbookContentAsync(String resourceGroupName, String automationAccountName, String jobId) { """ Retrieve the runbook content of the job 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 getRunbookContentWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<InputStream>, InputStream>() { @Override public InputStream call(ServiceResponse<InputStream> response) { return response.body(); } }); }
java
public Observable<InputStream> getRunbookContentAsync(String resourceGroupName, String automationAccountName, String jobId) { return getRunbookContentWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<InputStream>, InputStream>() { @Override public InputStream call(ServiceResponse<InputStream> response) { return response.body(); } }); }
[ "public", "Observable", "<", "InputStream", ">", "getRunbookContentAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "jobId", ")", "{", "return", "getRunbookContentWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "jobId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "InputStream", ">", ",", "InputStream", ">", "(", ")", "{", "@", "Override", "public", "InputStream", "call", "(", "ServiceResponse", "<", "InputStream", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieve the runbook content of the job 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", "runbook", "content", "of", "the", "job", "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#L237-L244
joniles/mpxj
src/main/java/net/sf/mpxj/utility/TimephasedUtility.java
TimephasedUtility.getRangeDuration
private Duration getRangeDuration(ProjectCalendar projectCalendar, TimescaleUnits rangeUnits, DateRange range, List<TimephasedWork> assignments, int startIndex) { """ For a given date range, determine the duration of work, based on the timephased resource assignment data. @param projectCalendar calendar used for the resource assignment calendar @param rangeUnits timescale units @param range target date range @param assignments timephased resource assignments @param startIndex index at which to start searching through the timephased resource assignments @return work duration """ Duration result; switch (rangeUnits) { case MINUTES: case HOURS: { result = getRangeDurationSubDay(projectCalendar, rangeUnits, range, assignments, startIndex); break; } default: { result = getRangeDurationWholeDay(projectCalendar, rangeUnits, range, assignments, startIndex); break; } } return result; }
java
private Duration getRangeDuration(ProjectCalendar projectCalendar, TimescaleUnits rangeUnits, DateRange range, List<TimephasedWork> assignments, int startIndex) { Duration result; switch (rangeUnits) { case MINUTES: case HOURS: { result = getRangeDurationSubDay(projectCalendar, rangeUnits, range, assignments, startIndex); break; } default: { result = getRangeDurationWholeDay(projectCalendar, rangeUnits, range, assignments, startIndex); break; } } return result; }
[ "private", "Duration", "getRangeDuration", "(", "ProjectCalendar", "projectCalendar", ",", "TimescaleUnits", "rangeUnits", ",", "DateRange", "range", ",", "List", "<", "TimephasedWork", ">", "assignments", ",", "int", "startIndex", ")", "{", "Duration", "result", ";", "switch", "(", "rangeUnits", ")", "{", "case", "MINUTES", ":", "case", "HOURS", ":", "{", "result", "=", "getRangeDurationSubDay", "(", "projectCalendar", ",", "rangeUnits", ",", "range", ",", "assignments", ",", "startIndex", ")", ";", "break", ";", "}", "default", ":", "{", "result", "=", "getRangeDurationWholeDay", "(", "projectCalendar", ",", "rangeUnits", ",", "range", ",", "assignments", ",", "startIndex", ")", ";", "break", ";", "}", "}", "return", "result", ";", "}" ]
For a given date range, determine the duration of work, based on the timephased resource assignment data. @param projectCalendar calendar used for the resource assignment calendar @param rangeUnits timescale units @param range target date range @param assignments timephased resource assignments @param startIndex index at which to start searching through the timephased resource assignments @return work duration
[ "For", "a", "given", "date", "range", "determine", "the", "duration", "of", "work", "based", "on", "the", "timephased", "resource", "assignment", "data", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/TimephasedUtility.java#L247-L268
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_mailingList_mailingListAddress_alias_alias_GET
public OvhExchangeMailingListAlias organizationName_service_exchangeService_mailingList_mailingListAddress_alias_alias_GET(String organizationName, String exchangeService, String mailingListAddress, String alias) throws IOException { """ Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/alias/{alias} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param mailingListAddress [required] The mailing list address @param alias [required] Alias """ String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/alias/{alias}"; StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress, alias); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeMailingListAlias.class); }
java
public OvhExchangeMailingListAlias organizationName_service_exchangeService_mailingList_mailingListAddress_alias_alias_GET(String organizationName, String exchangeService, String mailingListAddress, String alias) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/alias/{alias}"; StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress, alias); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeMailingListAlias.class); }
[ "public", "OvhExchangeMailingListAlias", "organizationName_service_exchangeService_mailingList_mailingListAddress_alias_alias_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "mailingListAddress", ",", "String", "alias", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/alias/{alias}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "organizationName", ",", "exchangeService", ",", "mailingListAddress", ",", "alias", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhExchangeMailingListAlias", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/alias/{alias} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param mailingListAddress [required] The mailing list address @param alias [required] Alias
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1435-L1440
facebook/fresco
drawee/src/main/java/com/facebook/drawee/generic/WrappingUtils.java
WrappingUtils.maybeWrapWithScaleType
@Nullable static Drawable maybeWrapWithScaleType( @Nullable Drawable drawable, @Nullable ScalingUtils.ScaleType scaleType) { """ Wraps the given drawable with a new {@link ScaleTypeDrawable}. <p>If the provided drawable or scale type is null, the given drawable is returned without being wrapped. @return the wrapping scale type drawable, or the original drawable if the wrapping didn't take place """ return maybeWrapWithScaleType(drawable, scaleType, null); }
java
@Nullable static Drawable maybeWrapWithScaleType( @Nullable Drawable drawable, @Nullable ScalingUtils.ScaleType scaleType) { return maybeWrapWithScaleType(drawable, scaleType, null); }
[ "@", "Nullable", "static", "Drawable", "maybeWrapWithScaleType", "(", "@", "Nullable", "Drawable", "drawable", ",", "@", "Nullable", "ScalingUtils", ".", "ScaleType", "scaleType", ")", "{", "return", "maybeWrapWithScaleType", "(", "drawable", ",", "scaleType", ",", "null", ")", ";", "}" ]
Wraps the given drawable with a new {@link ScaleTypeDrawable}. <p>If the provided drawable or scale type is null, the given drawable is returned without being wrapped. @return the wrapping scale type drawable, or the original drawable if the wrapping didn't take place
[ "Wraps", "the", "given", "drawable", "with", "a", "new", "{", "@link", "ScaleTypeDrawable", "}", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/generic/WrappingUtils.java#L65-L69
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.findBinding
public <S, T> Binding<S, T> findBinding(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier) { """ Resolve a Binding with the given source and target class. A binding unifies a marshaller and an unmarshaller and both must be available to resolve a binding. The source class is considered the owning class of the binding. The source can be marshalled into the target class. Similarly, the target can be unmarshalled to produce an instance of the source type. @param source The source (owning) class @param target The target (foreign) class @param qualifier The qualifier for which the binding must be registered """ return findBinding(new ConverterKey<S,T>(source, target, qualifier == null ? DefaultBinding.class : qualifier)); }
java
public <S, T> Binding<S, T> findBinding(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier) { return findBinding(new ConverterKey<S,T>(source, target, qualifier == null ? DefaultBinding.class : qualifier)); }
[ "public", "<", "S", ",", "T", ">", "Binding", "<", "S", ",", "T", ">", "findBinding", "(", "Class", "<", "S", ">", "source", ",", "Class", "<", "T", ">", "target", ",", "Class", "<", "?", "extends", "Annotation", ">", "qualifier", ")", "{", "return", "findBinding", "(", "new", "ConverterKey", "<", "S", ",", "T", ">", "(", "source", ",", "target", ",", "qualifier", "==", "null", "?", "DefaultBinding", ".", "class", ":", "qualifier", ")", ")", ";", "}" ]
Resolve a Binding with the given source and target class. A binding unifies a marshaller and an unmarshaller and both must be available to resolve a binding. The source class is considered the owning class of the binding. The source can be marshalled into the target class. Similarly, the target can be unmarshalled to produce an instance of the source type. @param source The source (owning) class @param target The target (foreign) class @param qualifier The qualifier for which the binding must be registered
[ "Resolve", "a", "Binding", "with", "the", "given", "source", "and", "target", "class", ".", "A", "binding", "unifies", "a", "marshaller", "and", "an", "unmarshaller", "and", "both", "must", "be", "available", "to", "resolve", "a", "binding", "." ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L891-L893
rometools/rome
rome/src/main/java/com/rometools/rome/io/impl/PropertiesLoader.java
PropertiesLoader.getPropertiesLoader
public static PropertiesLoader getPropertiesLoader() { """ Returns the PropertiesLoader singleton used by ROME to load plugin components. @return PropertiesLoader singleton. """ synchronized (PropertiesLoader.class) { final ClassLoader classLoader = ConfigurableClassLoader.INSTANCE.getClassLoader(); PropertiesLoader loader = clMap.get(classLoader); if (loader == null) { try { loader = new PropertiesLoader(MASTER_PLUGIN_FILE, EXTRA_PLUGIN_FILE); clMap.put(classLoader, loader); } catch (final IOException ex) { throw new RuntimeException(ex); } } return loader; } }
java
public static PropertiesLoader getPropertiesLoader() { synchronized (PropertiesLoader.class) { final ClassLoader classLoader = ConfigurableClassLoader.INSTANCE.getClassLoader(); PropertiesLoader loader = clMap.get(classLoader); if (loader == null) { try { loader = new PropertiesLoader(MASTER_PLUGIN_FILE, EXTRA_PLUGIN_FILE); clMap.put(classLoader, loader); } catch (final IOException ex) { throw new RuntimeException(ex); } } return loader; } }
[ "public", "static", "PropertiesLoader", "getPropertiesLoader", "(", ")", "{", "synchronized", "(", "PropertiesLoader", ".", "class", ")", "{", "final", "ClassLoader", "classLoader", "=", "ConfigurableClassLoader", ".", "INSTANCE", ".", "getClassLoader", "(", ")", ";", "PropertiesLoader", "loader", "=", "clMap", ".", "get", "(", "classLoader", ")", ";", "if", "(", "loader", "==", "null", ")", "{", "try", "{", "loader", "=", "new", "PropertiesLoader", "(", "MASTER_PLUGIN_FILE", ",", "EXTRA_PLUGIN_FILE", ")", ";", "clMap", ".", "put", "(", "classLoader", ",", "loader", ")", ";", "}", "catch", "(", "final", "IOException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ")", ";", "}", "}", "return", "loader", ";", "}", "}" ]
Returns the PropertiesLoader singleton used by ROME to load plugin components. @return PropertiesLoader singleton.
[ "Returns", "the", "PropertiesLoader", "singleton", "used", "by", "ROME", "to", "load", "plugin", "components", "." ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/PropertiesLoader.java#L57-L71
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.conjunctiveNormalFormSplit
public List<Filter<S>> conjunctiveNormalFormSplit() { """ Splits the filter from its conjunctive normal form. And'ng the filters together produces the full conjunctive normal form. @return unmodifiable list of sub filters which don't perform any 'and' operations @since 1.1.1 """ final List<Filter<S>> list = new ArrayList<Filter<S>>(); conjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(OrFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
java
public List<Filter<S>> conjunctiveNormalFormSplit() { final List<Filter<S>> list = new ArrayList<Filter<S>>(); conjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(OrFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
[ "public", "List", "<", "Filter", "<", "S", ">", ">", "conjunctiveNormalFormSplit", "(", ")", "{", "final", "List", "<", "Filter", "<", "S", ">", ">", "list", "=", "new", "ArrayList", "<", "Filter", "<", "S", ">", ">", "(", ")", ";", "conjunctiveNormalForm", "(", ")", ".", "accept", "(", "new", "Visitor", "<", "S", ",", "Object", ",", "Object", ">", "(", ")", "{", "@", "Override", "public", "Object", "visit", "(", "OrFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "@", "Override", "public", "Object", "visit", "(", "PropertyFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "@", "Override", "public", "Object", "visit", "(", "ExistsFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "}", ",", "null", ")", ";", "return", "Collections", ".", "unmodifiableList", "(", "list", ")", ";", "}" ]
Splits the filter from its conjunctive normal form. And'ng the filters together produces the full conjunctive normal form. @return unmodifiable list of sub filters which don't perform any 'and' operations @since 1.1.1
[ "Splits", "the", "filter", "from", "its", "conjunctive", "normal", "form", ".", "And", "ng", "the", "filters", "together", "produces", "the", "full", "conjunctive", "normal", "form", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L517-L541
fuinorg/units4j
src/main/java/org/fuin/units4j/Units4JUtils.java
Units4JUtils.assertCauseCauseMessage
public static void assertCauseCauseMessage(final Throwable ex, final String expectedMessage) { """ Verifies that the cause of a cause of an exception contains an expected message. @param ex Exception with the cause/cause to check, @param expectedMessage Message of the cause/cause. """ assertThat(ex.getCause()).isNotNull(); assertThat(ex.getCause().getCause()).isNotNull(); assertThat(ex.getCause().getCause().getMessage()).isEqualTo(expectedMessage); }
java
public static void assertCauseCauseMessage(final Throwable ex, final String expectedMessage) { assertThat(ex.getCause()).isNotNull(); assertThat(ex.getCause().getCause()).isNotNull(); assertThat(ex.getCause().getCause().getMessage()).isEqualTo(expectedMessage); }
[ "public", "static", "void", "assertCauseCauseMessage", "(", "final", "Throwable", "ex", ",", "final", "String", "expectedMessage", ")", "{", "assertThat", "(", "ex", ".", "getCause", "(", ")", ")", ".", "isNotNull", "(", ")", ";", "assertThat", "(", "ex", ".", "getCause", "(", ")", ".", "getCause", "(", ")", ")", ".", "isNotNull", "(", ")", ";", "assertThat", "(", "ex", ".", "getCause", "(", ")", ".", "getCause", "(", ")", ".", "getMessage", "(", ")", ")", ".", "isEqualTo", "(", "expectedMessage", ")", ";", "}" ]
Verifies that the cause of a cause of an exception contains an expected message. @param ex Exception with the cause/cause to check, @param expectedMessage Message of the cause/cause.
[ "Verifies", "that", "the", "cause", "of", "a", "cause", "of", "an", "exception", "contains", "an", "expected", "message", "." ]
train
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/Units4JUtils.java#L286-L290
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java
Indices.exists
public boolean exists(String indexName) { """ Check if a given name is an existing index. @param indexName Name of the index to check presence for. @return {@code true} if indexName is an existing index, {@code false} if it is non-existing or an alias. """ try { final JestResult result = jestClient.execute(new GetSettings.Builder().addIndex(indexName).build()); return result.isSucceeded() && Iterators.contains(result.getJsonObject().fieldNames(), indexName); } catch (IOException e) { throw new ElasticsearchException("Couldn't check existence of index " + indexName, e); } }
java
public boolean exists(String indexName) { try { final JestResult result = jestClient.execute(new GetSettings.Builder().addIndex(indexName).build()); return result.isSucceeded() && Iterators.contains(result.getJsonObject().fieldNames(), indexName); } catch (IOException e) { throw new ElasticsearchException("Couldn't check existence of index " + indexName, e); } }
[ "public", "boolean", "exists", "(", "String", "indexName", ")", "{", "try", "{", "final", "JestResult", "result", "=", "jestClient", ".", "execute", "(", "new", "GetSettings", ".", "Builder", "(", ")", ".", "addIndex", "(", "indexName", ")", ".", "build", "(", ")", ")", ";", "return", "result", ".", "isSucceeded", "(", ")", "&&", "Iterators", ".", "contains", "(", "result", ".", "getJsonObject", "(", ")", ".", "fieldNames", "(", ")", ",", "indexName", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ElasticsearchException", "(", "\"Couldn't check existence of index \"", "+", "indexName", ",", "e", ")", ";", "}", "}" ]
Check if a given name is an existing index. @param indexName Name of the index to check presence for. @return {@code true} if indexName is an existing index, {@code false} if it is non-existing or an alias.
[ "Check", "if", "a", "given", "name", "is", "an", "existing", "index", "." ]
train
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java#L275-L282
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByLastName
public Iterable<DContact> queryByLastName(Object parent, java.lang.String lastName) { """ query-by method for field lastName @param lastName the specified attribute @return an Iterable of DContacts for the specified lastName """ return queryByField(parent, DContactMapper.Field.LASTNAME.getFieldName(), lastName); }
java
public Iterable<DContact> queryByLastName(Object parent, java.lang.String lastName) { return queryByField(parent, DContactMapper.Field.LASTNAME.getFieldName(), lastName); }
[ "public", "Iterable", "<", "DContact", ">", "queryByLastName", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "lastName", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "LASTNAME", ".", "getFieldName", "(", ")", ",", "lastName", ")", ";", "}" ]
query-by method for field lastName @param lastName the specified attribute @return an Iterable of DContacts for the specified lastName
[ "query", "-", "by", "method", "for", "field", "lastName" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L187-L189
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MultiMapLayer.java
MultiMapLayer.setMapLayerAt
protected void setMapLayerAt(int index, L layer) { """ Put the given layer at the given index but do not fire any event. <p>This function does not test if the layer is already present in the list of layers. @param index index. @param layer layer. @throws IndexOutOfBoundsException if the index is invalid. """ this.subLayers.set(index, layer); layer.setContainer(this); resetBoundingBox(); }
java
protected void setMapLayerAt(int index, L layer) { this.subLayers.set(index, layer); layer.setContainer(this); resetBoundingBox(); }
[ "protected", "void", "setMapLayerAt", "(", "int", "index", ",", "L", "layer", ")", "{", "this", ".", "subLayers", ".", "set", "(", "index", ",", "layer", ")", ";", "layer", ".", "setContainer", "(", "this", ")", ";", "resetBoundingBox", "(", ")", ";", "}" ]
Put the given layer at the given index but do not fire any event. <p>This function does not test if the layer is already present in the list of layers. @param index index. @param layer layer. @throws IndexOutOfBoundsException if the index is invalid.
[ "Put", "the", "given", "layer", "at", "the", "given", "index", "but", "do", "not", "fire", "any", "event", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MultiMapLayer.java#L286-L290
OpenLiberty/open-liberty
dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java
SelfExtractor.handleLicenseAcceptance
public void handleLicenseAcceptance(LicenseProvider licenseProvider, boolean acceptLicense) { """ This method will print out information about the license and if necessary prompt the user to accept it. @param licenseProvider The license provider to use to get information about the license from the archive @param acceptLicense <code>true</code> if the license should be automatically accepted """ // // Display license requirement // SelfExtract.wordWrappedOut(SelfExtract.format("licenseStatement", new Object[] { licenseProvider.getProgramName(), licenseProvider.getLicenseName() })); System.out.println(); if (acceptLicense) { // Indicate license acceptance via option SelfExtract.wordWrappedOut(SelfExtract.format("licenseAccepted", "--acceptLicense")); System.out.println(); } else { // Check for license agreement: exit if not accepted. if (!obtainLicenseAgreement(licenseProvider)) { System.exit(0); } } }
java
public void handleLicenseAcceptance(LicenseProvider licenseProvider, boolean acceptLicense) { // // Display license requirement // SelfExtract.wordWrappedOut(SelfExtract.format("licenseStatement", new Object[] { licenseProvider.getProgramName(), licenseProvider.getLicenseName() })); System.out.println(); if (acceptLicense) { // Indicate license acceptance via option SelfExtract.wordWrappedOut(SelfExtract.format("licenseAccepted", "--acceptLicense")); System.out.println(); } else { // Check for license agreement: exit if not accepted. if (!obtainLicenseAgreement(licenseProvider)) { System.exit(0); } } }
[ "public", "void", "handleLicenseAcceptance", "(", "LicenseProvider", "licenseProvider", ",", "boolean", "acceptLicense", ")", "{", "//", "// Display license requirement", "//", "SelfExtract", ".", "wordWrappedOut", "(", "SelfExtract", ".", "format", "(", "\"licenseStatement\"", ",", "new", "Object", "[", "]", "{", "licenseProvider", ".", "getProgramName", "(", ")", ",", "licenseProvider", ".", "getLicenseName", "(", ")", "}", ")", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "if", "(", "acceptLicense", ")", "{", "// Indicate license acceptance via option", "SelfExtract", ".", "wordWrappedOut", "(", "SelfExtract", ".", "format", "(", "\"licenseAccepted\"", ",", "\"--acceptLicense\"", ")", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "}", "else", "{", "// Check for license agreement: exit if not accepted.", "if", "(", "!", "obtainLicenseAgreement", "(", "licenseProvider", ")", ")", "{", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "}" ]
This method will print out information about the license and if necessary prompt the user to accept it. @param licenseProvider The license provider to use to get information about the license from the archive @param acceptLicense <code>true</code> if the license should be automatically accepted
[ "This", "method", "will", "print", "out", "information", "about", "the", "license", "and", "if", "necessary", "prompt", "the", "user", "to", "accept", "it", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L1390-L1407
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelOptions.java
SSLChannelOptions.updateConfguration
void updateConfguration(Dictionary<String, Object> props, String defaultId) { """ Create the new keystore based on the properties provided. Package private. @param properties """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "updateConfguration", props, defaultId); } String id = (String) props.get(SSLChannelProvider.SSL_CFG_REF); synchronized (this) { properties = props; if (id == null || id.isEmpty()) { useDefaultId = true; id = sslRefId = defaultId; properties.put(SSLChannelProvider.SSL_CFG_REF, defaultId); } else { sslRefId = id; useDefaultId = false; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "updateConfguration", id); } }
java
void updateConfguration(Dictionary<String, Object> props, String defaultId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "updateConfguration", props, defaultId); } String id = (String) props.get(SSLChannelProvider.SSL_CFG_REF); synchronized (this) { properties = props; if (id == null || id.isEmpty()) { useDefaultId = true; id = sslRefId = defaultId; properties.put(SSLChannelProvider.SSL_CFG_REF, defaultId); } else { sslRefId = id; useDefaultId = false; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "updateConfguration", id); } }
[ "void", "updateConfguration", "(", "Dictionary", "<", "String", ",", "Object", ">", "props", ",", "String", "defaultId", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"updateConfguration\"", ",", "props", ",", "defaultId", ")", ";", "}", "String", "id", "=", "(", "String", ")", "props", ".", "get", "(", "SSLChannelProvider", ".", "SSL_CFG_REF", ")", ";", "synchronized", "(", "this", ")", "{", "properties", "=", "props", ";", "if", "(", "id", "==", "null", "||", "id", ".", "isEmpty", "(", ")", ")", "{", "useDefaultId", "=", "true", ";", "id", "=", "sslRefId", "=", "defaultId", ";", "properties", ".", "put", "(", "SSLChannelProvider", ".", "SSL_CFG_REF", ",", "defaultId", ")", ";", "}", "else", "{", "sslRefId", "=", "id", ";", "useDefaultId", "=", "false", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"updateConfguration\"", ",", "id", ")", ";", "}", "}" ]
Create the new keystore based on the properties provided. Package private. @param properties
[ "Create", "the", "new", "keystore", "based", "on", "the", "properties", "provided", ".", "Package", "private", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelOptions.java#L50-L73
aoindustries/aocode-public
src/main/java/com/aoindustries/util/StringUtility.java
StringUtility.splitString
public static List<String> splitString(String line, int begin, int end, char delim) { """ Splits a string on the given delimiter over the given range. Does include all empty elements on the split. @return the modifiable list from the split """ return splitString(line, begin, end, delim, new ArrayList<String>()); }
java
public static List<String> splitString(String line, int begin, int end, char delim) { return splitString(line, begin, end, delim, new ArrayList<String>()); }
[ "public", "static", "List", "<", "String", ">", "splitString", "(", "String", "line", ",", "int", "begin", ",", "int", "end", ",", "char", "delim", ")", "{", "return", "splitString", "(", "line", ",", "begin", ",", "end", ",", "delim", ",", "new", "ArrayList", "<", "String", ">", "(", ")", ")", ";", "}" ]
Splits a string on the given delimiter over the given range. Does include all empty elements on the split. @return the modifiable list from the split
[ "Splits", "a", "string", "on", "the", "given", "delimiter", "over", "the", "given", "range", ".", "Does", "include", "all", "empty", "elements", "on", "the", "split", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/StringUtility.java#L933-L935
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.java
FalsePositiveAnalyzer.analyzeDependency
@Override protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException { """ Analyzes the dependencies and removes bad/incorrect CPE associations based on various heuristics. @param dependency the dependency to analyze. @param engine the engine that is scanning the dependencies @throws AnalysisException is thrown if there is an error reading the JAR file. """ removeJreEntries(dependency); removeBadMatches(dependency); removeBadSpringMatches(dependency); removeWrongVersionMatches(dependency); removeSpuriousCPE(dependency); removeDuplicativeEntriesFromJar(dependency, engine); addFalseNegativeCPEs(dependency); }
java
@Override protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException { removeJreEntries(dependency); removeBadMatches(dependency); removeBadSpringMatches(dependency); removeWrongVersionMatches(dependency); removeSpuriousCPE(dependency); removeDuplicativeEntriesFromJar(dependency, engine); addFalseNegativeCPEs(dependency); }
[ "@", "Override", "protected", "void", "analyzeDependency", "(", "Dependency", "dependency", ",", "Engine", "engine", ")", "throws", "AnalysisException", "{", "removeJreEntries", "(", "dependency", ")", ";", "removeBadMatches", "(", "dependency", ")", ";", "removeBadSpringMatches", "(", "dependency", ")", ";", "removeWrongVersionMatches", "(", "dependency", ")", ";", "removeSpuriousCPE", "(", "dependency", ")", ";", "removeDuplicativeEntriesFromJar", "(", "dependency", ",", "engine", ")", ";", "addFalseNegativeCPEs", "(", "dependency", ")", ";", "}" ]
Analyzes the dependencies and removes bad/incorrect CPE associations based on various heuristics. @param dependency the dependency to analyze. @param engine the engine that is scanning the dependencies @throws AnalysisException is thrown if there is an error reading the JAR file.
[ "Analyzes", "the", "dependencies", "and", "removes", "bad", "/", "incorrect", "CPE", "associations", "based", "on", "various", "heuristics", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/FalsePositiveAnalyzer.java#L136-L145
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java
ConditionalCheck.isNull
@Throws(IllegalNotNullArgumentException.class) public static void isNull(final boolean condition, @Nullable final Object reference, @Nullable final String name) { """ Ensures that a given argument is {@code null}. Normally, the usage of {@code null} arguments is disregarded by the authors of quality-check. Still, there are certain circumstances where null is required, e.g. the primary key of an entity before it is written to the database for the first time. In such cases it is ok to use null values and there should also be checks for them. For example, to avoid overwriting an existing primary key with a new one. @param condition condition must be {@code true}^ so that the check will be performed @param reference reference which must be null. @param name name of object reference (in source code) @throws IllegalNotNullArgumentException if the given argument {@code reference} is not null """ if (condition) { Check.isNull(reference, name); } }
java
@Throws(IllegalNotNullArgumentException.class) public static void isNull(final boolean condition, @Nullable final Object reference, @Nullable final String name) { if (condition) { Check.isNull(reference, name); } }
[ "@", "Throws", "(", "IllegalNotNullArgumentException", ".", "class", ")", "public", "static", "void", "isNull", "(", "final", "boolean", "condition", ",", "@", "Nullable", "final", "Object", "reference", ",", "@", "Nullable", "final", "String", "name", ")", "{", "if", "(", "condition", ")", "{", "Check", ".", "isNull", "(", "reference", ",", "name", ")", ";", "}", "}" ]
Ensures that a given argument is {@code null}. Normally, the usage of {@code null} arguments is disregarded by the authors of quality-check. Still, there are certain circumstances where null is required, e.g. the primary key of an entity before it is written to the database for the first time. In such cases it is ok to use null values and there should also be checks for them. For example, to avoid overwriting an existing primary key with a new one. @param condition condition must be {@code true}^ so that the check will be performed @param reference reference which must be null. @param name name of object reference (in source code) @throws IllegalNotNullArgumentException if the given argument {@code reference} is not null
[ "Ensures", "that", "a", "given", "argument", "is", "{", "@code", "null", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L795-L800
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java
ContentKeyPoliciesInner.getPolicyPropertiesWithSecretsAsync
public Observable<ContentKeyPolicyPropertiesInner> getPolicyPropertiesWithSecretsAsync(String resourceGroupName, String accountName, String contentKeyPolicyName) { """ Get a Content Key Policy with secrets. Get a Content Key Policy including secret values. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param contentKeyPolicyName The Content Key Policy name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContentKeyPolicyPropertiesInner object """ return getPolicyPropertiesWithSecretsWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName).map(new Func1<ServiceResponse<ContentKeyPolicyPropertiesInner>, ContentKeyPolicyPropertiesInner>() { @Override public ContentKeyPolicyPropertiesInner call(ServiceResponse<ContentKeyPolicyPropertiesInner> response) { return response.body(); } }); }
java
public Observable<ContentKeyPolicyPropertiesInner> getPolicyPropertiesWithSecretsAsync(String resourceGroupName, String accountName, String contentKeyPolicyName) { return getPolicyPropertiesWithSecretsWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName).map(new Func1<ServiceResponse<ContentKeyPolicyPropertiesInner>, ContentKeyPolicyPropertiesInner>() { @Override public ContentKeyPolicyPropertiesInner call(ServiceResponse<ContentKeyPolicyPropertiesInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ContentKeyPolicyPropertiesInner", ">", "getPolicyPropertiesWithSecretsAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "contentKeyPolicyName", ")", "{", "return", "getPolicyPropertiesWithSecretsWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "contentKeyPolicyName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ContentKeyPolicyPropertiesInner", ">", ",", "ContentKeyPolicyPropertiesInner", ">", "(", ")", "{", "@", "Override", "public", "ContentKeyPolicyPropertiesInner", "call", "(", "ServiceResponse", "<", "ContentKeyPolicyPropertiesInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get a Content Key Policy with secrets. Get a Content Key Policy including secret values. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param contentKeyPolicyName The Content Key Policy name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContentKeyPolicyPropertiesInner object
[ "Get", "a", "Content", "Key", "Policy", "with", "secrets", ".", "Get", "a", "Content", "Key", "Policy", "including", "secret", "values", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java#L810-L817
javagl/ND
nd-distance/src/main/java/de/javagl/nd/distance/tuples/i/IntTupleDistanceFunctions.java
IntTupleDistanceFunctions.computeChebyshev
static int computeChebyshev(IntTuple t0, IntTuple t1) { """ Computes the Chebyshev distance between the given tuples @param t0 The first tuple @param t1 The second tuple @return The distance @throws IllegalArgumentException If the given tuples do not have the same {@link Tuple#getSize() size} """ Utils.checkForEqualSize(t0, t1); int max = 0; for (int i=0; i<t0.getSize(); i++) { int d = t0.get(i)-t1.get(i); max = Math.max(max, Math.abs(d)); } return max; }
java
static int computeChebyshev(IntTuple t0, IntTuple t1) { Utils.checkForEqualSize(t0, t1); int max = 0; for (int i=0; i<t0.getSize(); i++) { int d = t0.get(i)-t1.get(i); max = Math.max(max, Math.abs(d)); } return max; }
[ "static", "int", "computeChebyshev", "(", "IntTuple", "t0", ",", "IntTuple", "t1", ")", "{", "Utils", ".", "checkForEqualSize", "(", "t0", ",", "t1", ")", ";", "int", "max", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "t0", ".", "getSize", "(", ")", ";", "i", "++", ")", "{", "int", "d", "=", "t0", ".", "get", "(", "i", ")", "-", "t1", ".", "get", "(", "i", ")", ";", "max", "=", "Math", ".", "max", "(", "max", ",", "Math", ".", "abs", "(", "d", ")", ")", ";", "}", "return", "max", ";", "}" ]
Computes the Chebyshev distance between the given tuples @param t0 The first tuple @param t1 The second tuple @return The distance @throws IllegalArgumentException If the given tuples do not have the same {@link Tuple#getSize() size}
[ "Computes", "the", "Chebyshev", "distance", "between", "the", "given", "tuples" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-distance/src/main/java/de/javagl/nd/distance/tuples/i/IntTupleDistanceFunctions.java#L313-L323
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-filter/xwiki-commons-filter-xml/src/main/java/org/xwiki/filter/xml/internal/output/FilterStreamXMLStreamWriter.java
FilterStreamXMLStreamWriter.writeStartDocument
public void writeStartDocument(String encoding, String version) throws FilterException { """ Write the XML Declaration. @param encoding the XML version @param version the XML encoding @throws FilterException """ try { this.writer.writeStartDocument(encoding, version); } catch (XMLStreamException e) { throw new FilterException("Failed to write start document", e); } }
java
public void writeStartDocument(String encoding, String version) throws FilterException { try { this.writer.writeStartDocument(encoding, version); } catch (XMLStreamException e) { throw new FilterException("Failed to write start document", e); } }
[ "public", "void", "writeStartDocument", "(", "String", "encoding", ",", "String", "version", ")", "throws", "FilterException", "{", "try", "{", "this", ".", "writer", ".", "writeStartDocument", "(", "encoding", ",", "version", ")", ";", "}", "catch", "(", "XMLStreamException", "e", ")", "{", "throw", "new", "FilterException", "(", "\"Failed to write start document\"", ",", "e", ")", ";", "}", "}" ]
Write the XML Declaration. @param encoding the XML version @param version the XML encoding @throws FilterException
[ "Write", "the", "XML", "Declaration", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-filter/xwiki-commons-filter-xml/src/main/java/org/xwiki/filter/xml/internal/output/FilterStreamXMLStreamWriter.java#L108-L115
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/RepositoryConfigUtils.java
RepositoryConfigUtils.isLibertyRepository
public static boolean isLibertyRepository(RestRepositoryConnection lie, Properties repoProperties) throws InstallException { """ Checks if the inputed Repository Connection is a liberty repository @param lie The RestRepositoryConnection connection @param repoProperties The repository properties @return True of the repository location is a liberty location @throws InstallException """ if (isWlpRepoEnabled(repoProperties)) { return lie.getRepositoryLocation().startsWith(InstallConstants.REPOSITORY_LIBERTY_URL); } return false; }
java
public static boolean isLibertyRepository(RestRepositoryConnection lie, Properties repoProperties) throws InstallException { if (isWlpRepoEnabled(repoProperties)) { return lie.getRepositoryLocation().startsWith(InstallConstants.REPOSITORY_LIBERTY_URL); } return false; }
[ "public", "static", "boolean", "isLibertyRepository", "(", "RestRepositoryConnection", "lie", ",", "Properties", "repoProperties", ")", "throws", "InstallException", "{", "if", "(", "isWlpRepoEnabled", "(", "repoProperties", ")", ")", "{", "return", "lie", ".", "getRepositoryLocation", "(", ")", ".", "startsWith", "(", "InstallConstants", ".", "REPOSITORY_LIBERTY_URL", ")", ";", "}", "return", "false", ";", "}" ]
Checks if the inputed Repository Connection is a liberty repository @param lie The RestRepositoryConnection connection @param repoProperties The repository properties @return True of the repository location is a liberty location @throws InstallException
[ "Checks", "if", "the", "inputed", "Repository", "Connection", "is", "a", "liberty", "repository" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/RepositoryConfigUtils.java#L448-L453
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java
JobRepositoryRestore.removeRepository
protected void removeRepository(RepositoryService repositoryService, String repositoryName) throws RepositoryException, RepositoryConfigurationException { """ Remove repository. @param repositoryService RepositoryService, the repository service @param repositoryName String, the repository name @throws RepositoryException will be generated the RepositoryException @throws RepositoryConfigurationException """ ManageableRepository mr = null; try { mr = repositoryService.getRepository(repositoryName); } catch (RepositoryException e) { // The repository not exist. if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + e.getMessage()); } } if (mr != null) { closeAllSession(mr); repositoryService.removeRepository(repositoryName); repositoryService.getConfig().retain(); // save configuration to persistence (file or persister) } }
java
protected void removeRepository(RepositoryService repositoryService, String repositoryName) throws RepositoryException, RepositoryConfigurationException { ManageableRepository mr = null; try { mr = repositoryService.getRepository(repositoryName); } catch (RepositoryException e) { // The repository not exist. if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + e.getMessage()); } } if (mr != null) { closeAllSession(mr); repositoryService.removeRepository(repositoryName); repositoryService.getConfig().retain(); // save configuration to persistence (file or persister) } }
[ "protected", "void", "removeRepository", "(", "RepositoryService", "repositoryService", ",", "String", "repositoryName", ")", "throws", "RepositoryException", ",", "RepositoryConfigurationException", "{", "ManageableRepository", "mr", "=", "null", ";", "try", "{", "mr", "=", "repositoryService", ".", "getRepository", "(", "repositoryName", ")", ";", "}", "catch", "(", "RepositoryException", "e", ")", "{", "// The repository not exist.", "if", "(", "LOG", ".", "isTraceEnabled", "(", ")", ")", "{", "LOG", ".", "trace", "(", "\"An exception occurred: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "if", "(", "mr", "!=", "null", ")", "{", "closeAllSession", "(", "mr", ")", ";", "repositoryService", ".", "removeRepository", "(", "repositoryName", ")", ";", "repositoryService", ".", "getConfig", "(", ")", ".", "retain", "(", ")", ";", "// save configuration to persistence (file or persister)", "}", "}" ]
Remove repository. @param repositoryService RepositoryService, the repository service @param repositoryName String, the repository name @throws RepositoryException will be generated the RepositoryException @throws RepositoryConfigurationException
[ "Remove", "repository", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java#L294-L319
UrielCh/ovh-java-sdk
ovh-java-sdk-paastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhPaastimeseries.java
ApiOvhPaastimeseries.serviceName_serviceInfos_PUT
public void serviceName_serviceInfos_PUT(String serviceName, OvhService body) throws IOException { """ Alter this object properties REST: PUT /paas/timeseries/{serviceName}/serviceInfos @param body [required] New object properties @param serviceName [required] The internal name of your timeseries project @deprecated """ String qPath = "/paas/timeseries/{serviceName}/serviceInfos"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_serviceInfos_PUT(String serviceName, OvhService body) throws IOException { String qPath = "/paas/timeseries/{serviceName}/serviceInfos"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_serviceInfos_PUT", "(", "String", "serviceName", ",", "OvhService", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/paas/timeseries/{serviceName}/serviceInfos\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /paas/timeseries/{serviceName}/serviceInfos @param body [required] New object properties @param serviceName [required] The internal name of your timeseries project @deprecated
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-paastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhPaastimeseries.java#L163-L167
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/message/record/GridRecordMessageFilter.java
GridRecordMessageFilter.init
public void init(Record record, Object source, boolean bReceiveAllAdds) { """ Constructor. @param record The record to watch. @param source The source of this filter, to eliminate echos. @param bReceiveAllAdds If true, receive all add notifications, otherwise just receive the adds on secondary reads. """ m_htBookmarks = new BookmarkList(); m_bReceiveAllAdds = bReceiveAllAdds; super.init(record, null, source); if (record != null) record.addListener(new GridSyncRecordMessageFilterHandler(this, true)); }
java
public void init(Record record, Object source, boolean bReceiveAllAdds) { m_htBookmarks = new BookmarkList(); m_bReceiveAllAdds = bReceiveAllAdds; super.init(record, null, source); if (record != null) record.addListener(new GridSyncRecordMessageFilterHandler(this, true)); }
[ "public", "void", "init", "(", "Record", "record", ",", "Object", "source", ",", "boolean", "bReceiveAllAdds", ")", "{", "m_htBookmarks", "=", "new", "BookmarkList", "(", ")", ";", "m_bReceiveAllAdds", "=", "bReceiveAllAdds", ";", "super", ".", "init", "(", "record", ",", "null", ",", "source", ")", ";", "if", "(", "record", "!=", "null", ")", "record", ".", "addListener", "(", "new", "GridSyncRecordMessageFilterHandler", "(", "this", ",", "true", ")", ")", ";", "}" ]
Constructor. @param record The record to watch. @param source The source of this filter, to eliminate echos. @param bReceiveAllAdds If true, receive all add notifications, otherwise just receive the adds on secondary reads.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/GridRecordMessageFilter.java#L93-L100
looly/hutool
hutool-json/src/main/java/cn/hutool/json/JSONConverter.java
JSONConverter.jsonConvert
@SuppressWarnings("unchecked") protected static <T> T jsonConvert(Type targetType, Object value, boolean ignoreError) throws ConvertException { """ JSON递归转换<br> 首先尝试JDK类型转换,如果失败尝试JSON转Bean @param <T> @param targetType 目标类型 @param value 值 @param ignoreError 是否忽略转换错误 @return 目标类型的值 @throws ConvertException 转换失败 """ if (JSONUtil.isNull(value)) { return null; } Object targetValue = null; try { targetValue = Convert.convert(targetType, value); } catch (ConvertException e) { if (ignoreError) { return null; } throw e; } if (null == targetValue && false == ignoreError) { if (StrUtil.isBlankIfStr(value)) { // 对于传入空字符串的情况,如果转换的目标对象是非字符串或非原始类型,转换器会返回false。 // 此处特殊处理,认为返回null属于正常情况 return null; } throw new ConvertException("Can not convert {} to type {}", value, ObjectUtil.defaultIfNull(TypeUtil.getClass(targetType), targetType)); } return (T) targetValue; }
java
@SuppressWarnings("unchecked") protected static <T> T jsonConvert(Type targetType, Object value, boolean ignoreError) throws ConvertException { if (JSONUtil.isNull(value)) { return null; } Object targetValue = null; try { targetValue = Convert.convert(targetType, value); } catch (ConvertException e) { if (ignoreError) { return null; } throw e; } if (null == targetValue && false == ignoreError) { if (StrUtil.isBlankIfStr(value)) { // 对于传入空字符串的情况,如果转换的目标对象是非字符串或非原始类型,转换器会返回false。 // 此处特殊处理,认为返回null属于正常情况 return null; } throw new ConvertException("Can not convert {} to type {}", value, ObjectUtil.defaultIfNull(TypeUtil.getClass(targetType), targetType)); } return (T) targetValue; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "static", "<", "T", ">", "T", "jsonConvert", "(", "Type", "targetType", ",", "Object", "value", ",", "boolean", "ignoreError", ")", "throws", "ConvertException", "{", "if", "(", "JSONUtil", ".", "isNull", "(", "value", ")", ")", "{", "return", "null", ";", "}", "Object", "targetValue", "=", "null", ";", "try", "{", "targetValue", "=", "Convert", ".", "convert", "(", "targetType", ",", "value", ")", ";", "}", "catch", "(", "ConvertException", "e", ")", "{", "if", "(", "ignoreError", ")", "{", "return", "null", ";", "}", "throw", "e", ";", "}", "if", "(", "null", "==", "targetValue", "&&", "false", "==", "ignoreError", ")", "{", "if", "(", "StrUtil", ".", "isBlankIfStr", "(", "value", ")", ")", "{", "// 对于传入空字符串的情况,如果转换的目标对象是非字符串或非原始类型,转换器会返回false。\r", "// 此处特殊处理,认为返回null属于正常情况\r", "return", "null", ";", "}", "throw", "new", "ConvertException", "(", "\"Can not convert {} to type {}\"", ",", "value", ",", "ObjectUtil", ".", "defaultIfNull", "(", "TypeUtil", ".", "getClass", "(", "targetType", ")", ",", "targetType", ")", ")", ";", "}", "return", "(", "T", ")", "targetValue", ";", "}" ]
JSON递归转换<br> 首先尝试JDK类型转换,如果失败尝试JSON转Bean @param <T> @param targetType 目标类型 @param value 值 @param ignoreError 是否忽略转换错误 @return 目标类型的值 @throws ConvertException 转换失败
[ "JSON递归转换<br", ">", "首先尝试JDK类型转换,如果失败尝试JSON转Bean", "@param", "<T", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONConverter.java#L65-L92
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.processFile
static void processFile(final IdentityPatchContext context, final File file, final PatchingTaskContext.Mode mode) throws IOException { """ Process a file. @param file the file to be processed @param mode the patching mode @throws IOException """ if (mode == PatchingTaskContext.Mode.APPLY) { if (ENABLE_INVALIDATION) { updateJar(file, GOOD_ENDSIG_PATTERN, BAD_BYTE_SKIP, CRIPPLED_ENDSIG, GOOD_ENDSIG); backup(context, file); } } else if (mode == PatchingTaskContext.Mode.ROLLBACK) { updateJar(file, CRIPPLED_ENDSIG_PATTERN, BAD_BYTE_SKIP, GOOD_ENDSIG, CRIPPLED_ENDSIG); restore(context, file); } else { throw new IllegalStateException(); } }
java
static void processFile(final IdentityPatchContext context, final File file, final PatchingTaskContext.Mode mode) throws IOException { if (mode == PatchingTaskContext.Mode.APPLY) { if (ENABLE_INVALIDATION) { updateJar(file, GOOD_ENDSIG_PATTERN, BAD_BYTE_SKIP, CRIPPLED_ENDSIG, GOOD_ENDSIG); backup(context, file); } } else if (mode == PatchingTaskContext.Mode.ROLLBACK) { updateJar(file, CRIPPLED_ENDSIG_PATTERN, BAD_BYTE_SKIP, GOOD_ENDSIG, CRIPPLED_ENDSIG); restore(context, file); } else { throw new IllegalStateException(); } }
[ "static", "void", "processFile", "(", "final", "IdentityPatchContext", "context", ",", "final", "File", "file", ",", "final", "PatchingTaskContext", ".", "Mode", "mode", ")", "throws", "IOException", "{", "if", "(", "mode", "==", "PatchingTaskContext", ".", "Mode", ".", "APPLY", ")", "{", "if", "(", "ENABLE_INVALIDATION", ")", "{", "updateJar", "(", "file", ",", "GOOD_ENDSIG_PATTERN", ",", "BAD_BYTE_SKIP", ",", "CRIPPLED_ENDSIG", ",", "GOOD_ENDSIG", ")", ";", "backup", "(", "context", ",", "file", ")", ";", "}", "}", "else", "if", "(", "mode", "==", "PatchingTaskContext", ".", "Mode", ".", "ROLLBACK", ")", "{", "updateJar", "(", "file", ",", "CRIPPLED_ENDSIG_PATTERN", ",", "BAD_BYTE_SKIP", ",", "GOOD_ENDSIG", ",", "CRIPPLED_ENDSIG", ")", ";", "restore", "(", "context", ",", "file", ")", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "}" ]
Process a file. @param file the file to be processed @param mode the patching mode @throws IOException
[ "Process", "a", "file", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L150-L162
RallyTools/RallyRestToolkitForJava
src/main/java/com/rallydev/rest/request/CollectionUpdateRequest.java
CollectionUpdateRequest.toUrl
@Override public String toUrl() { """ <p>Convert this request into a url compatible with the WSAPI.</p> The current fetch and any other parameters will be included. @return the url representing this request. """ List<NameValuePair> params = new ArrayList<NameValuePair>(getParams()); params.add(new BasicNameValuePair("fetch", getFetch().toString())); return String.format("%s/%s.js?%s", Ref.getRelativeRef(ref), adding ? "add" : "remove", URLEncodedUtils.format(params, "utf-8")); }
java
@Override public String toUrl() { List<NameValuePair> params = new ArrayList<NameValuePair>(getParams()); params.add(new BasicNameValuePair("fetch", getFetch().toString())); return String.format("%s/%s.js?%s", Ref.getRelativeRef(ref), adding ? "add" : "remove", URLEncodedUtils.format(params, "utf-8")); }
[ "@", "Override", "public", "String", "toUrl", "(", ")", "{", "List", "<", "NameValuePair", ">", "params", "=", "new", "ArrayList", "<", "NameValuePair", ">", "(", "getParams", "(", ")", ")", ";", "params", ".", "add", "(", "new", "BasicNameValuePair", "(", "\"fetch\"", ",", "getFetch", "(", ")", ".", "toString", "(", ")", ")", ")", ";", "return", "String", ".", "format", "(", "\"%s/%s.js?%s\"", ",", "Ref", ".", "getRelativeRef", "(", "ref", ")", ",", "adding", "?", "\"add\"", ":", "\"remove\"", ",", "URLEncodedUtils", ".", "format", "(", "params", ",", "\"utf-8\"", ")", ")", ";", "}" ]
<p>Convert this request into a url compatible with the WSAPI.</p> The current fetch and any other parameters will be included. @return the url representing this request.
[ "<p", ">", "Convert", "this", "request", "into", "a", "url", "compatible", "with", "the", "WSAPI", ".", "<", "/", "p", ">", "The", "current", "fetch", "and", "any", "other", "parameters", "will", "be", "included", "." ]
train
https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/request/CollectionUpdateRequest.java#L85-L95
alkacon/opencms-core
src/org/opencms/ui/sitemap/CmsCopyPageDialog.java
CmsCopyPageDialog.getInitialTarget
private String getInitialTarget(CmsObject cms, CmsResource resource) { """ Gets the initial target path to display, based on the selected resource.<p> @param cms the cms context @param resource the selected resource @return the initial target path """ String sitePath = cms.getSitePath(resource); String parent = CmsResource.getParentFolder(sitePath); if (parent != null) { return parent; } else { String rootParent = CmsResource.getParentFolder(resource.getRootPath()); if (rootParent != null) { return rootParent; } else { return sitePath; } } }
java
private String getInitialTarget(CmsObject cms, CmsResource resource) { String sitePath = cms.getSitePath(resource); String parent = CmsResource.getParentFolder(sitePath); if (parent != null) { return parent; } else { String rootParent = CmsResource.getParentFolder(resource.getRootPath()); if (rootParent != null) { return rootParent; } else { return sitePath; } } }
[ "private", "String", "getInitialTarget", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "{", "String", "sitePath", "=", "cms", ".", "getSitePath", "(", "resource", ")", ";", "String", "parent", "=", "CmsResource", ".", "getParentFolder", "(", "sitePath", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "return", "parent", ";", "}", "else", "{", "String", "rootParent", "=", "CmsResource", ".", "getParentFolder", "(", "resource", ".", "getRootPath", "(", ")", ")", ";", "if", "(", "rootParent", "!=", "null", ")", "{", "return", "rootParent", ";", "}", "else", "{", "return", "sitePath", ";", "}", "}", "}" ]
Gets the initial target path to display, based on the selected resource.<p> @param cms the cms context @param resource the selected resource @return the initial target path
[ "Gets", "the", "initial", "target", "path", "to", "display", "based", "on", "the", "selected", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/sitemap/CmsCopyPageDialog.java#L287-L301
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/img/ImageExtensions.java
ImageExtensions.randomBufferedImage
public static BufferedImage randomBufferedImage(final int width, final int height, final int imageType) { """ Generates a random {@link BufferedImage} with the given parameters. @param width the width @param height the height @param imageType the type of the image @return The generated {@link BufferedImage}. """ final BufferedImage img = new BufferedImage(width, height, imageType); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { img.setRGB(x, y, RandomExtensions.newRandomPixel()); } } return img; }
java
public static BufferedImage randomBufferedImage(final int width, final int height, final int imageType) { final BufferedImage img = new BufferedImage(width, height, imageType); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { img.setRGB(x, y, RandomExtensions.newRandomPixel()); } } return img; }
[ "public", "static", "BufferedImage", "randomBufferedImage", "(", "final", "int", "width", ",", "final", "int", "height", ",", "final", "int", "imageType", ")", "{", "final", "BufferedImage", "img", "=", "new", "BufferedImage", "(", "width", ",", "height", ",", "imageType", ")", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "height", ";", "y", "++", ")", "{", "for", "(", "int", "x", "=", "0", ";", "x", "<", "width", ";", "x", "++", ")", "{", "img", ".", "setRGB", "(", "x", ",", "y", ",", "RandomExtensions", ".", "newRandomPixel", "(", ")", ")", ";", "}", "}", "return", "img", ";", "}" ]
Generates a random {@link BufferedImage} with the given parameters. @param width the width @param height the height @param imageType the type of the image @return The generated {@link BufferedImage}.
[ "Generates", "a", "random", "{", "@link", "BufferedImage", "}", "with", "the", "given", "parameters", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L242-L254
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
MiniCluster.createRpcService
protected RpcService createRpcService( AkkaRpcServiceConfiguration akkaRpcServiceConfig, boolean remoteEnabled, String bindAddress) { """ Factory method to instantiate the RPC service. @param akkaRpcServiceConfig The default RPC timeout for asynchronous "ask" requests. @param remoteEnabled True, if the RPC service should be reachable from other (remote) RPC services. @param bindAddress The address to bind the RPC service to. Only relevant when "remoteEnabled" is true. @return The instantiated RPC service """ final Config akkaConfig; if (remoteEnabled) { akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration(), bindAddress, 0); } else { akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration()); } final Config effectiveAkkaConfig = AkkaUtils.testDispatcherConfig().withFallback(akkaConfig); final ActorSystem actorSystem = AkkaUtils.createActorSystem(effectiveAkkaConfig); return new AkkaRpcService(actorSystem, akkaRpcServiceConfig); }
java
protected RpcService createRpcService( AkkaRpcServiceConfiguration akkaRpcServiceConfig, boolean remoteEnabled, String bindAddress) { final Config akkaConfig; if (remoteEnabled) { akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration(), bindAddress, 0); } else { akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration()); } final Config effectiveAkkaConfig = AkkaUtils.testDispatcherConfig().withFallback(akkaConfig); final ActorSystem actorSystem = AkkaUtils.createActorSystem(effectiveAkkaConfig); return new AkkaRpcService(actorSystem, akkaRpcServiceConfig); }
[ "protected", "RpcService", "createRpcService", "(", "AkkaRpcServiceConfiguration", "akkaRpcServiceConfig", ",", "boolean", "remoteEnabled", ",", "String", "bindAddress", ")", "{", "final", "Config", "akkaConfig", ";", "if", "(", "remoteEnabled", ")", "{", "akkaConfig", "=", "AkkaUtils", ".", "getAkkaConfig", "(", "akkaRpcServiceConfig", ".", "getConfiguration", "(", ")", ",", "bindAddress", ",", "0", ")", ";", "}", "else", "{", "akkaConfig", "=", "AkkaUtils", ".", "getAkkaConfig", "(", "akkaRpcServiceConfig", ".", "getConfiguration", "(", ")", ")", ";", "}", "final", "Config", "effectiveAkkaConfig", "=", "AkkaUtils", ".", "testDispatcherConfig", "(", ")", ".", "withFallback", "(", "akkaConfig", ")", ";", "final", "ActorSystem", "actorSystem", "=", "AkkaUtils", ".", "createActorSystem", "(", "effectiveAkkaConfig", ")", ";", "return", "new", "AkkaRpcService", "(", "actorSystem", ",", "akkaRpcServiceConfig", ")", ";", "}" ]
Factory method to instantiate the RPC service. @param akkaRpcServiceConfig The default RPC timeout for asynchronous "ask" requests. @param remoteEnabled True, if the RPC service should be reachable from other (remote) RPC services. @param bindAddress The address to bind the RPC service to. Only relevant when "remoteEnabled" is true. @return The instantiated RPC service
[ "Factory", "method", "to", "instantiate", "the", "RPC", "service", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L715-L733
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/util/TextUtils.java
TextUtils.compareTo
public static int compareTo(final boolean caseSensitive, final CharSequence text1, final char[] text2) { """ <p> Compares two texts lexicographically. </p> <p> The comparison is based on the Unicode value of each character in the CharSequences. The character sequence represented by the first text object is compared lexicographically to the character sequence represented by the second text. </p> <p> The result is a negative integer if the first text lexicographically precedes the second text. The result is a positive integer if the first text lexicographically follows the second text. The result is zero if the texts are equal. </p> <p> This method works in a way equivalent to that of the {@link java.lang.String#compareTo(String)} and {@link java.lang.String#compareToIgnoreCase(String)} methods. </p> @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way. @param text1 the first text to be compared. @param text2 the second text to be compared. @return the value {@code 0} if both texts are equal; a value less than {@code 0} if the first text is lexicographically less than the second text; and a value greater than {@code 0} if the first text is lexicographically greater than the second text. """ return compareTo(caseSensitive, text1, 0, text1.length(), text2, 0, text2.length); }
java
public static int compareTo(final boolean caseSensitive, final CharSequence text1, final char[] text2) { return compareTo(caseSensitive, text1, 0, text1.length(), text2, 0, text2.length); }
[ "public", "static", "int", "compareTo", "(", "final", "boolean", "caseSensitive", ",", "final", "CharSequence", "text1", ",", "final", "char", "[", "]", "text2", ")", "{", "return", "compareTo", "(", "caseSensitive", ",", "text1", ",", "0", ",", "text1", ".", "length", "(", ")", ",", "text2", ",", "0", ",", "text2", ".", "length", ")", ";", "}" ]
<p> Compares two texts lexicographically. </p> <p> The comparison is based on the Unicode value of each character in the CharSequences. The character sequence represented by the first text object is compared lexicographically to the character sequence represented by the second text. </p> <p> The result is a negative integer if the first text lexicographically precedes the second text. The result is a positive integer if the first text lexicographically follows the second text. The result is zero if the texts are equal. </p> <p> This method works in a way equivalent to that of the {@link java.lang.String#compareTo(String)} and {@link java.lang.String#compareToIgnoreCase(String)} methods. </p> @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way. @param text1 the first text to be compared. @param text2 the second text to be compared. @return the value {@code 0} if both texts are equal; a value less than {@code 0} if the first text is lexicographically less than the second text; and a value greater than {@code 0} if the first text is lexicographically greater than the second text.
[ "<p", ">", "Compares", "two", "texts", "lexicographically", ".", "<", "/", "p", ">", "<p", ">", "The", "comparison", "is", "based", "on", "the", "Unicode", "value", "of", "each", "character", "in", "the", "CharSequences", ".", "The", "character", "sequence", "represented", "by", "the", "first", "text", "object", "is", "compared", "lexicographically", "to", "the", "character", "sequence", "represented", "by", "the", "second", "text", ".", "<", "/", "p", ">", "<p", ">", "The", "result", "is", "a", "negative", "integer", "if", "the", "first", "text", "lexicographically", "precedes", "the", "second", "text", ".", "The", "result", "is", "a", "positive", "integer", "if", "the", "first", "text", "lexicographically", "follows", "the", "second", "text", ".", "The", "result", "is", "zero", "if", "the", "texts", "are", "equal", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "works", "in", "a", "way", "equivalent", "to", "that", "of", "the", "{", "@link", "java", ".", "lang", ".", "String#compareTo", "(", "String", ")", "}", "and", "{", "@link", "java", ".", "lang", ".", "String#compareToIgnoreCase", "(", "String", ")", "}", "methods", ".", "<", "/", "p", ">" ]
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/TextUtils.java#L1499-L1501
riccardove/easyjasub
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/bdsup2sub/BDSup2SubWrapper.java
BDSup2SubWrapper.convertSup
private void convertSup(int index, int displayNum, int displayMax) throws CoreException { """ Convert source subpicture image to target subpicture image. @param index Index of subtitle to convert @param displayNum Subtitle number to display (needed for forced subs) @param displayMax Maximum subtitle number to display (needed for forced subs) @throws CoreException """ convertSup(index, displayNum, displayMax, false); }
java
private void convertSup(int index, int displayNum, int displayMax) throws CoreException { convertSup(index, displayNum, displayMax, false); }
[ "private", "void", "convertSup", "(", "int", "index", ",", "int", "displayNum", ",", "int", "displayMax", ")", "throws", "CoreException", "{", "convertSup", "(", "index", ",", "displayNum", ",", "displayMax", ",", "false", ")", ";", "}" ]
Convert source subpicture image to target subpicture image. @param index Index of subtitle to convert @param displayNum Subtitle number to display (needed for forced subs) @param displayMax Maximum subtitle number to display (needed for forced subs) @throws CoreException
[ "Convert", "source", "subpicture", "image", "to", "target", "subpicture", "image", "." ]
train
https://github.com/riccardove/easyjasub/blob/58d6af66b1b1c738326c74d9ad5e4ad514120e27/easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/bdsup2sub/BDSup2SubWrapper.java#L459-L462
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_mitigation_ipOnMitigation_topStream_GET
public ArrayList<OvhMitigationDetailedStats> ip_mitigation_ipOnMitigation_topStream_GET(String ip, String ipOnMitigation, Date date, OvhMitigationStatsScaleEnum scale) throws IOException { """ AntiDDOS option. Get top stream on your ip on a specific timestamp REST: GET /ip/{ip}/mitigation/{ipOnMitigation}/topStream @param date [required] Date to view top traffic @param scale [required] Scale of aggregation @param ip [required] @param ipOnMitigation [required] """ String qPath = "/ip/{ip}/mitigation/{ipOnMitigation}/topStream"; StringBuilder sb = path(qPath, ip, ipOnMitigation); query(sb, "date", date); query(sb, "scale", scale); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public ArrayList<OvhMitigationDetailedStats> ip_mitigation_ipOnMitigation_topStream_GET(String ip, String ipOnMitigation, Date date, OvhMitigationStatsScaleEnum scale) throws IOException { String qPath = "/ip/{ip}/mitigation/{ipOnMitigation}/topStream"; StringBuilder sb = path(qPath, ip, ipOnMitigation); query(sb, "date", date); query(sb, "scale", scale); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "ArrayList", "<", "OvhMitigationDetailedStats", ">", "ip_mitigation_ipOnMitigation_topStream_GET", "(", "String", "ip", ",", "String", "ipOnMitigation", ",", "Date", "date", ",", "OvhMitigationStatsScaleEnum", "scale", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/mitigation/{ipOnMitigation}/topStream\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ",", "ipOnMitigation", ")", ";", "query", "(", "sb", ",", "\"date\"", ",", "date", ")", ";", "query", "(", "sb", ",", "\"scale\"", ",", "scale", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t5", ")", ";", "}" ]
AntiDDOS option. Get top stream on your ip on a specific timestamp REST: GET /ip/{ip}/mitigation/{ipOnMitigation}/topStream @param date [required] Date to view top traffic @param scale [required] Scale of aggregation @param ip [required] @param ipOnMitigation [required]
[ "AntiDDOS", "option", ".", "Get", "top", "stream", "on", "your", "ip", "on", "a", "specific", "timestamp" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L761-L768
azkaban/azkaban
azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java
DagBuilder.addParentNode
public void addParentNode(final String childNodeName, final String parentNodeName) { """ Add a parent node to a child node. All the names should have been registered with this builder with the {@link DagBuilder#createNode(String, NodeProcessor)} call. @param childNodeName name of the child node @param parentNodeName name of the parent node """ checkIsBuilt(); final Node child = this.nameToNodeMap.get(childNodeName); if (child == null) { throw new DagException(String.format("Unknown child node (%s). Did you create the node?", childNodeName)); } final Node parent = this.nameToNodeMap.get(parentNodeName); if (parent == null) { throw new DagException( String.format("Unknown parent node (%s). Did you create the node?", parentNodeName)); } child.addParent(parent); }
java
public void addParentNode(final String childNodeName, final String parentNodeName) { checkIsBuilt(); final Node child = this.nameToNodeMap.get(childNodeName); if (child == null) { throw new DagException(String.format("Unknown child node (%s). Did you create the node?", childNodeName)); } final Node parent = this.nameToNodeMap.get(parentNodeName); if (parent == null) { throw new DagException( String.format("Unknown parent node (%s). Did you create the node?", parentNodeName)); } child.addParent(parent); }
[ "public", "void", "addParentNode", "(", "final", "String", "childNodeName", ",", "final", "String", "parentNodeName", ")", "{", "checkIsBuilt", "(", ")", ";", "final", "Node", "child", "=", "this", ".", "nameToNodeMap", ".", "get", "(", "childNodeName", ")", ";", "if", "(", "child", "==", "null", ")", "{", "throw", "new", "DagException", "(", "String", ".", "format", "(", "\"Unknown child node (%s). Did you create the node?\"", ",", "childNodeName", ")", ")", ";", "}", "final", "Node", "parent", "=", "this", ".", "nameToNodeMap", ".", "get", "(", "parentNodeName", ")", ";", "if", "(", "parent", "==", "null", ")", "{", "throw", "new", "DagException", "(", "String", ".", "format", "(", "\"Unknown parent node (%s). Did you create the node?\"", ",", "parentNodeName", ")", ")", ";", "}", "child", ".", "addParent", "(", "parent", ")", ";", "}" ]
Add a parent node to a child node. All the names should have been registered with this builder with the {@link DagBuilder#createNode(String, NodeProcessor)} call. @param childNodeName name of the child node @param parentNodeName name of the parent node
[ "Add", "a", "parent", "node", "to", "a", "child", "node", ".", "All", "the", "names", "should", "have", "been", "registered", "with", "this", "builder", "with", "the", "{", "@link", "DagBuilder#createNode", "(", "String", "NodeProcessor", ")", "}", "call", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java#L96-L112
paypal/SeLion
server/src/main/java/com/paypal/selion/utils/ServletHelper.java
ServletHelper.respondAsHtmlWithMessage
public static void respondAsHtmlWithMessage(HttpServletResponse resp, String message) throws IOException { """ Utility method used to display a message when re-direction happens in the UI flow. Uses the template {@link #MESSAGE_RESOURCE_PAGE_FILE} @param resp A {@link HttpServletResponse} object that the servlet is responding on. @param message Message to display. @throws IOException """ respondAsHtmlUsingArgsAndTemplateWithHttpStatus(resp, MESSAGE_RESOURCE_PAGE_FILE, HttpStatus.SC_OK, message); }
java
public static void respondAsHtmlWithMessage(HttpServletResponse resp, String message) throws IOException { respondAsHtmlUsingArgsAndTemplateWithHttpStatus(resp, MESSAGE_RESOURCE_PAGE_FILE, HttpStatus.SC_OK, message); }
[ "public", "static", "void", "respondAsHtmlWithMessage", "(", "HttpServletResponse", "resp", ",", "String", "message", ")", "throws", "IOException", "{", "respondAsHtmlUsingArgsAndTemplateWithHttpStatus", "(", "resp", ",", "MESSAGE_RESOURCE_PAGE_FILE", ",", "HttpStatus", ".", "SC_OK", ",", "message", ")", ";", "}" ]
Utility method used to display a message when re-direction happens in the UI flow. Uses the template {@link #MESSAGE_RESOURCE_PAGE_FILE} @param resp A {@link HttpServletResponse} object that the servlet is responding on. @param message Message to display. @throws IOException
[ "Utility", "method", "used", "to", "display", "a", "message", "when", "re", "-", "direction", "happens", "in", "the", "UI", "flow", ".", "Uses", "the", "template", "{", "@link", "#MESSAGE_RESOURCE_PAGE_FILE", "}" ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/utils/ServletHelper.java#L180-L182
google/closure-templates
java/src/com/google/template/soy/jbcsrc/api/Continuations.java
Continuations.strictContinuation
static Continuation<SanitizedContent> strictContinuation( WriteContinuation delegate, final StringBuilder buffer, final ContentKind kind) { """ Return a {@link SanitizedContent} valued continuation. Rendering logic is delegated to the {@link WriteContinuation}, but it is assumed that the builder is the render target. """ if (delegate.result().isDone()) { return new ResultContinuation<>( UnsafeSanitizedContentOrdainer.ordainAsSafe(buffer.toString(), kind)); } return new AbstractContinuation<SanitizedContent>(delegate) { @Override Continuation<SanitizedContent> nextContinuation(WriteContinuation next) { return strictContinuation(next, buffer, kind); } }; }
java
static Continuation<SanitizedContent> strictContinuation( WriteContinuation delegate, final StringBuilder buffer, final ContentKind kind) { if (delegate.result().isDone()) { return new ResultContinuation<>( UnsafeSanitizedContentOrdainer.ordainAsSafe(buffer.toString(), kind)); } return new AbstractContinuation<SanitizedContent>(delegate) { @Override Continuation<SanitizedContent> nextContinuation(WriteContinuation next) { return strictContinuation(next, buffer, kind); } }; }
[ "static", "Continuation", "<", "SanitizedContent", ">", "strictContinuation", "(", "WriteContinuation", "delegate", ",", "final", "StringBuilder", "buffer", ",", "final", "ContentKind", "kind", ")", "{", "if", "(", "delegate", ".", "result", "(", ")", ".", "isDone", "(", ")", ")", "{", "return", "new", "ResultContinuation", "<>", "(", "UnsafeSanitizedContentOrdainer", ".", "ordainAsSafe", "(", "buffer", ".", "toString", "(", ")", ",", "kind", ")", ")", ";", "}", "return", "new", "AbstractContinuation", "<", "SanitizedContent", ">", "(", "delegate", ")", "{", "@", "Override", "Continuation", "<", "SanitizedContent", ">", "nextContinuation", "(", "WriteContinuation", "next", ")", "{", "return", "strictContinuation", "(", "next", ",", "buffer", ",", "kind", ")", ";", "}", "}", ";", "}" ]
Return a {@link SanitizedContent} valued continuation. Rendering logic is delegated to the {@link WriteContinuation}, but it is assumed that the builder is the render target.
[ "Return", "a", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/api/Continuations.java#L67-L81
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java
MergeableManifest2.make512Safe
public static String make512Safe(StringBuffer input, String newline) { """ Return a string that ensures that no line is longer then 512 characters and lines are broken according to manifest specification. @param input The buffer containing the content that should be made safe @param newline The string to use to create newlines (usually "\n" or "\r\n") @return The string with no longer lines then 512, ready to be read again by {@link MergeableManifest2}. """ StringBuilder result = new StringBuilder(); String content = input.toString(); String rest = content; while (!rest.isEmpty()) { if (rest.contains("\n")) { String line = rest.substring(0, rest.indexOf("\n")); rest = rest.substring(rest.indexOf("\n") + 1); if (line.length() > 1 && line.charAt(line.length() - 1) == '\r') line = line.substring(0, line.length() - 1); append512Safe(line, result, newline); } else { append512Safe(rest, result, newline); break; } } return result.toString(); }
java
public static String make512Safe(StringBuffer input, String newline) { StringBuilder result = new StringBuilder(); String content = input.toString(); String rest = content; while (!rest.isEmpty()) { if (rest.contains("\n")) { String line = rest.substring(0, rest.indexOf("\n")); rest = rest.substring(rest.indexOf("\n") + 1); if (line.length() > 1 && line.charAt(line.length() - 1) == '\r') line = line.substring(0, line.length() - 1); append512Safe(line, result, newline); } else { append512Safe(rest, result, newline); break; } } return result.toString(); }
[ "public", "static", "String", "make512Safe", "(", "StringBuffer", "input", ",", "String", "newline", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "String", "content", "=", "input", ".", "toString", "(", ")", ";", "String", "rest", "=", "content", ";", "while", "(", "!", "rest", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "rest", ".", "contains", "(", "\"\\n\"", ")", ")", "{", "String", "line", "=", "rest", ".", "substring", "(", "0", ",", "rest", ".", "indexOf", "(", "\"\\n\"", ")", ")", ";", "rest", "=", "rest", ".", "substring", "(", "rest", ".", "indexOf", "(", "\"\\n\"", ")", "+", "1", ")", ";", "if", "(", "line", ".", "length", "(", ")", ">", "1", "&&", "line", ".", "charAt", "(", "line", ".", "length", "(", ")", "-", "1", ")", "==", "'", "'", ")", "line", "=", "line", ".", "substring", "(", "0", ",", "line", ".", "length", "(", ")", "-", "1", ")", ";", "append512Safe", "(", "line", ",", "result", ",", "newline", ")", ";", "}", "else", "{", "append512Safe", "(", "rest", ",", "result", ",", "newline", ")", ";", "break", ";", "}", "}", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Return a string that ensures that no line is longer then 512 characters and lines are broken according to manifest specification. @param input The buffer containing the content that should be made safe @param newline The string to use to create newlines (usually "\n" or "\r\n") @return The string with no longer lines then 512, ready to be read again by {@link MergeableManifest2}.
[ "Return", "a", "string", "that", "ensures", "that", "no", "line", "is", "longer", "then", "512", "characters", "and", "lines", "are", "broken", "according", "to", "manifest", "specification", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest2.java#L505-L522
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/route/Route.java
Route.OPTIONS
public static Route OPTIONS(String uriPattern, RouteHandler routeHandler) { """ Create an {@code OPTIONS} route. @param uriPattern @param routeHandler @return """ return new Route(HttpConstants.Method.OPTIONS, uriPattern, routeHandler); }
java
public static Route OPTIONS(String uriPattern, RouteHandler routeHandler) { return new Route(HttpConstants.Method.OPTIONS, uriPattern, routeHandler); }
[ "public", "static", "Route", "OPTIONS", "(", "String", "uriPattern", ",", "RouteHandler", "routeHandler", ")", "{", "return", "new", "Route", "(", "HttpConstants", ".", "Method", ".", "OPTIONS", ",", "uriPattern", ",", "routeHandler", ")", ";", "}" ]
Create an {@code OPTIONS} route. @param uriPattern @param routeHandler @return
[ "Create", "an", "{", "@code", "OPTIONS", "}", "route", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/Route.java#L136-L138
KyoriPowered/text
api/src/main/java/net/kyori/text/TranslatableComponent.java
TranslatableComponent.of
public static TranslatableComponent of(final @NonNull String key, final @Nullable TextColor color, final @NonNull List<Component> args) { """ Creates a translatable component with a translation key and arguments. @param key the translation key @param color the color @param args the translation arguments @return the translatable component """ return of(key, color, Collections.emptySet(), args); }
java
public static TranslatableComponent of(final @NonNull String key, final @Nullable TextColor color, final @NonNull List<Component> args) { return of(key, color, Collections.emptySet(), args); }
[ "public", "static", "TranslatableComponent", "of", "(", "final", "@", "NonNull", "String", "key", ",", "final", "@", "Nullable", "TextColor", "color", ",", "final", "@", "NonNull", "List", "<", "Component", ">", "args", ")", "{", "return", "of", "(", "key", ",", "color", ",", "Collections", ".", "emptySet", "(", ")", ",", "args", ")", ";", "}" ]
Creates a translatable component with a translation key and arguments. @param key the translation key @param color the color @param args the translation arguments @return the translatable component
[ "Creates", "a", "translatable", "component", "with", "a", "translation", "key", "and", "arguments", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TranslatableComponent.java#L169-L171
graknlabs/grakn
server/src/graql/gremlin/sets/EquivalentFragmentSets.java
EquivalentFragmentSets.rolePlayer
public static EquivalentFragmentSet rolePlayer(VarProperty varProperty, Variable relation, Variable edge, Variable rolePlayer, @Nullable Variable role, @Nullable ImmutableSet<Label> roleLabels, @Nullable ImmutableSet<Label> relTypeLabels) { """ Describes the edge connecting a {@link Relation} to a role-player. <p> Can be constrained with information about the possible {@link Role}s or {@link RelationType}s. """ return new AutoValue_RolePlayerFragmentSet(varProperty, relation, edge, rolePlayer, role, roleLabels, relTypeLabels); }
java
public static EquivalentFragmentSet rolePlayer(VarProperty varProperty, Variable relation, Variable edge, Variable rolePlayer, @Nullable Variable role, @Nullable ImmutableSet<Label> roleLabels, @Nullable ImmutableSet<Label> relTypeLabels) { return new AutoValue_RolePlayerFragmentSet(varProperty, relation, edge, rolePlayer, role, roleLabels, relTypeLabels); }
[ "public", "static", "EquivalentFragmentSet", "rolePlayer", "(", "VarProperty", "varProperty", ",", "Variable", "relation", ",", "Variable", "edge", ",", "Variable", "rolePlayer", ",", "@", "Nullable", "Variable", "role", ",", "@", "Nullable", "ImmutableSet", "<", "Label", ">", "roleLabels", ",", "@", "Nullable", "ImmutableSet", "<", "Label", ">", "relTypeLabels", ")", "{", "return", "new", "AutoValue_RolePlayerFragmentSet", "(", "varProperty", ",", "relation", ",", "edge", ",", "rolePlayer", ",", "role", ",", "roleLabels", ",", "relTypeLabels", ")", ";", "}" ]
Describes the edge connecting a {@link Relation} to a role-player. <p> Can be constrained with information about the possible {@link Role}s or {@link RelationType}s.
[ "Describes", "the", "edge", "connecting", "a", "{", "@link", "Relation", "}", "to", "a", "role", "-", "player", ".", "<p", ">", "Can", "be", "constrained", "with", "information", "about", "the", "possible", "{", "@link", "Role", "}", "s", "or", "{", "@link", "RelationType", "}", "s", "." ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/sets/EquivalentFragmentSets.java#L72-L74
rhuss/jolokia
agent/core/src/main/java/org/jolokia/handler/JsonRequestHandler.java
JsonRequestHandler.handleRequest
public Object handleRequest(MBeanServerExecutor pServerManager, R request) throws ReflectionException, InstanceNotFoundException, MBeanException, AttributeNotFoundException, IOException, NotChangedException { """ Override this if you want to have all servers at once for processing the request (like need for merging info as for a <code>list</code> command). This method is only called when {@link #handleAllServersAtOnce(JmxRequest)} returns <code>true</code> @param pServerManager server manager holding all MBeans servers detected @param request request to process @return the object found @throws IOException @throws AttributeNotFoundException @throws InstanceNotFoundException @throws MBeanException @throws ReflectionException """ checkForRestriction(request); checkHttpMethod(request); return doHandleRequest(pServerManager,request); }
java
public Object handleRequest(MBeanServerExecutor pServerManager, R request) throws ReflectionException, InstanceNotFoundException, MBeanException, AttributeNotFoundException, IOException, NotChangedException { checkForRestriction(request); checkHttpMethod(request); return doHandleRequest(pServerManager,request); }
[ "public", "Object", "handleRequest", "(", "MBeanServerExecutor", "pServerManager", ",", "R", "request", ")", "throws", "ReflectionException", ",", "InstanceNotFoundException", ",", "MBeanException", ",", "AttributeNotFoundException", ",", "IOException", ",", "NotChangedException", "{", "checkForRestriction", "(", "request", ")", ";", "checkHttpMethod", "(", "request", ")", ";", "return", "doHandleRequest", "(", "pServerManager", ",", "request", ")", ";", "}" ]
Override this if you want to have all servers at once for processing the request (like need for merging info as for a <code>list</code> command). This method is only called when {@link #handleAllServersAtOnce(JmxRequest)} returns <code>true</code> @param pServerManager server manager holding all MBeans servers detected @param request request to process @return the object found @throws IOException @throws AttributeNotFoundException @throws InstanceNotFoundException @throws MBeanException @throws ReflectionException
[ "Override", "this", "if", "you", "want", "to", "have", "all", "servers", "at", "once", "for", "processing", "the", "request", "(", "like", "need", "for", "merging", "info", "as", "for", "a", "<code", ">", "list<", "/", "code", ">", "command", ")", ".", "This", "method", "is", "only", "called", "when", "{", "@link", "#handleAllServersAtOnce", "(", "JmxRequest", ")", "}", "returns", "<code", ">", "true<", "/", "code", ">" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/handler/JsonRequestHandler.java#L157-L162
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java
ManagedCompletableFuture.completedStage
@Trivial public static <U> CompletionStage<U> completedStage(U value) { """ Because CompletableFuture.completedStage is static, this is not a true override. It will be difficult for the user to invoke this method because they would need to get the class of the CompletableFuture implementation and locate the static completedStage method on that. @throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead. """ throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.completedStage")); }
java
@Trivial public static <U> CompletionStage<U> completedStage(U value) { throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.completedStage")); }
[ "@", "Trivial", "public", "static", "<", "U", ">", "CompletionStage", "<", "U", ">", "completedStage", "(", "U", "value", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"CWWKC1156.not.supported\"", ",", "\"ManagedExecutor.completedStage\"", ")", ")", ";", "}" ]
Because CompletableFuture.completedStage is static, this is not a true override. It will be difficult for the user to invoke this method because they would need to get the class of the CompletableFuture implementation and locate the static completedStage method on that. @throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead.
[ "Because", "CompletableFuture", ".", "completedStage", "is", "static", "this", "is", "not", "a", "true", "override", ".", "It", "will", "be", "difficult", "for", "the", "user", "to", "invoke", "this", "method", "because", "they", "would", "need", "to", "get", "the", "class", "of", "the", "CompletableFuture", "implementation", "and", "locate", "the", "static", "completedStage", "method", "on", "that", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L303-L306
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.notEmpty
@ArgumentsChecked @Throws( { """ Ensures that a passed collection as a parameter of the calling method is not empty. <p> The following example describes how to use it. <pre> &#064;ArgumentsChecked public setCollection(Collection&lt;String&gt; collection) { this.collection = Check.notEmpty(collection, &quot;collection&quot;); } </pre> @param collection a collection which should not be empty @param name name of object reference (in source code) @return the passed reference that is not empty @throws IllegalNullArgumentException if the given argument {@code collection} is {@code null} @throws IllegalEmptyArgumentException if the given argument {@code collection} is empty """ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T extends Collection<?>> T notEmpty(@Nonnull final T collection, @Nullable final String name) { notNull(collection, name); notEmpty(collection, collection.isEmpty(), name); return collection; }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T extends Collection<?>> T notEmpty(@Nonnull final T collection, @Nullable final String name) { notNull(collection, name); notEmpty(collection, collection.isEmpty(), name); return collection; }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalEmptyArgumentException", ".", "class", "}", ")", "public", "static", "<", "T", "extends", "Collection", "<", "?", ">", ">", "T", "notEmpty", "(", "@", "Nonnull", "final", "T", "collection", ",", "@", "Nullable", "final", "String", "name", ")", "{", "notNull", "(", "collection", ",", "name", ")", ";", "notEmpty", "(", "collection", ",", "collection", ".", "isEmpty", "(", ")", ",", "name", ")", ";", "return", "collection", ";", "}" ]
Ensures that a passed collection as a parameter of the calling method is not empty. <p> The following example describes how to use it. <pre> &#064;ArgumentsChecked public setCollection(Collection&lt;String&gt; collection) { this.collection = Check.notEmpty(collection, &quot;collection&quot;); } </pre> @param collection a collection which should not be empty @param name name of object reference (in source code) @return the passed reference that is not empty @throws IllegalNullArgumentException if the given argument {@code collection} is {@code null} @throws IllegalEmptyArgumentException if the given argument {@code collection} is empty
[ "Ensures", "that", "a", "passed", "collection", "as", "a", "parameter", "of", "the", "calling", "method", "is", "not", "empty", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L2147-L2153
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/MultiLayerConfiguration.java
MultiLayerConfiguration.getMemoryReport
public NetworkMemoryReport getMemoryReport(InputType inputType) { """ Get a {@link MemoryReport} for the given MultiLayerConfiguration. This is used to estimate the memory requirements for the given network configuration and input @param inputType Input types for the network @return Memory report for the network """ Map<String, MemoryReport> memoryReportMap = new LinkedHashMap<>(); int nLayers = confs.size(); for (int i = 0; i < nLayers; i++) { String layerName = confs.get(i).getLayer().getLayerName(); if (layerName == null) { layerName = String.valueOf(i); } //Pass input type through preprocessor, if necessary InputPreProcessor preproc = getInputPreProcess(i); //TODO memory requirements for preprocessor if (preproc != null) { inputType = preproc.getOutputType(inputType); } LayerMemoryReport report = confs.get(i).getLayer().getMemoryReport(inputType); memoryReportMap.put(layerName, report); inputType = confs.get(i).getLayer().getOutputType(i, inputType); } return new NetworkMemoryReport(memoryReportMap, MultiLayerConfiguration.class, "MultiLayerNetwork", inputType); }
java
public NetworkMemoryReport getMemoryReport(InputType inputType) { Map<String, MemoryReport> memoryReportMap = new LinkedHashMap<>(); int nLayers = confs.size(); for (int i = 0; i < nLayers; i++) { String layerName = confs.get(i).getLayer().getLayerName(); if (layerName == null) { layerName = String.valueOf(i); } //Pass input type through preprocessor, if necessary InputPreProcessor preproc = getInputPreProcess(i); //TODO memory requirements for preprocessor if (preproc != null) { inputType = preproc.getOutputType(inputType); } LayerMemoryReport report = confs.get(i).getLayer().getMemoryReport(inputType); memoryReportMap.put(layerName, report); inputType = confs.get(i).getLayer().getOutputType(i, inputType); } return new NetworkMemoryReport(memoryReportMap, MultiLayerConfiguration.class, "MultiLayerNetwork", inputType); }
[ "public", "NetworkMemoryReport", "getMemoryReport", "(", "InputType", "inputType", ")", "{", "Map", "<", "String", ",", "MemoryReport", ">", "memoryReportMap", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "int", "nLayers", "=", "confs", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nLayers", ";", "i", "++", ")", "{", "String", "layerName", "=", "confs", ".", "get", "(", "i", ")", ".", "getLayer", "(", ")", ".", "getLayerName", "(", ")", ";", "if", "(", "layerName", "==", "null", ")", "{", "layerName", "=", "String", ".", "valueOf", "(", "i", ")", ";", "}", "//Pass input type through preprocessor, if necessary", "InputPreProcessor", "preproc", "=", "getInputPreProcess", "(", "i", ")", ";", "//TODO memory requirements for preprocessor", "if", "(", "preproc", "!=", "null", ")", "{", "inputType", "=", "preproc", ".", "getOutputType", "(", "inputType", ")", ";", "}", "LayerMemoryReport", "report", "=", "confs", ".", "get", "(", "i", ")", ".", "getLayer", "(", ")", ".", "getMemoryReport", "(", "inputType", ")", ";", "memoryReportMap", ".", "put", "(", "layerName", ",", "report", ")", ";", "inputType", "=", "confs", ".", "get", "(", "i", ")", ".", "getLayer", "(", ")", ".", "getOutputType", "(", "i", ",", "inputType", ")", ";", "}", "return", "new", "NetworkMemoryReport", "(", "memoryReportMap", ",", "MultiLayerConfiguration", ".", "class", ",", "\"MultiLayerNetwork\"", ",", "inputType", ")", ";", "}" ]
Get a {@link MemoryReport} for the given MultiLayerConfiguration. This is used to estimate the memory requirements for the given network configuration and input @param inputType Input types for the network @return Memory report for the network
[ "Get", "a", "{", "@link", "MemoryReport", "}", "for", "the", "given", "MultiLayerConfiguration", ".", "This", "is", "used", "to", "estimate", "the", "memory", "requirements", "for", "the", "given", "network", "configuration", "and", "input" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/MultiLayerConfiguration.java#L397-L421
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/component/DefinitionComponent.java
DefinitionComponent.addInlineDefinitionTitle
private void addInlineDefinitionTitle(String title, String anchor, MarkupDocBuilder docBuilder) { """ Builds the title of an inline schema. Inline definitions should never been referenced in TOC because they have no real existence, so they are just text. @param title inline schema title @param anchor inline schema anchor @param docBuilder the docbuilder do use for output """ docBuilder.anchor(anchor, null); docBuilder.newLine(); docBuilder.boldTextLine(title); }
java
private void addInlineDefinitionTitle(String title, String anchor, MarkupDocBuilder docBuilder) { docBuilder.anchor(anchor, null); docBuilder.newLine(); docBuilder.boldTextLine(title); }
[ "private", "void", "addInlineDefinitionTitle", "(", "String", "title", ",", "String", "anchor", ",", "MarkupDocBuilder", "docBuilder", ")", "{", "docBuilder", ".", "anchor", "(", "anchor", ",", "null", ")", ";", "docBuilder", ".", "newLine", "(", ")", ";", "docBuilder", ".", "boldTextLine", "(", "title", ")", ";", "}" ]
Builds the title of an inline schema. Inline definitions should never been referenced in TOC because they have no real existence, so they are just text. @param title inline schema title @param anchor inline schema anchor @param docBuilder the docbuilder do use for output
[ "Builds", "the", "title", "of", "an", "inline", "schema", ".", "Inline", "definitions", "should", "never", "been", "referenced", "in", "TOC", "because", "they", "have", "no", "real", "existence", "so", "they", "are", "just", "text", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/component/DefinitionComponent.java#L120-L124
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/Drawer.java
Drawer.updateIcon
public void updateIcon(long identifier, ImageHolder image) { """ update the name for a specific drawerItem identified by its id @param identifier @param image """ IDrawerItem drawerItem = getDrawerItem(identifier); if (drawerItem instanceof Iconable) { Iconable pdi = (Iconable) drawerItem; pdi.withIcon(image); updateItem((IDrawerItem) pdi); } }
java
public void updateIcon(long identifier, ImageHolder image) { IDrawerItem drawerItem = getDrawerItem(identifier); if (drawerItem instanceof Iconable) { Iconable pdi = (Iconable) drawerItem; pdi.withIcon(image); updateItem((IDrawerItem) pdi); } }
[ "public", "void", "updateIcon", "(", "long", "identifier", ",", "ImageHolder", "image", ")", "{", "IDrawerItem", "drawerItem", "=", "getDrawerItem", "(", "identifier", ")", ";", "if", "(", "drawerItem", "instanceof", "Iconable", ")", "{", "Iconable", "pdi", "=", "(", "Iconable", ")", "drawerItem", ";", "pdi", ".", "withIcon", "(", "image", ")", ";", "updateItem", "(", "(", "IDrawerItem", ")", "pdi", ")", ";", "}", "}" ]
update the name for a specific drawerItem identified by its id @param identifier @param image
[ "update", "the", "name", "for", "a", "specific", "drawerItem", "identified", "by", "its", "id" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java#L697-L704
forge/core
parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/utils/JLSValidator.java
JLSValidator.validateClassName
public static ValidationResult validateClassName(String className) { """ Validates whether the <code>className</code> parameter is a valid class name. This method verifies both qualified and unqualified class names. @param className @return """ if (Strings.isNullOrEmpty(className)) return new ValidationResult(ERROR, Messages.notNullOrEmpty(CLASS_NAME)); int indexOfDot = className.lastIndexOf("."); if (indexOfDot == -1) { return validateIdentifier(className, CLASS_NAME); } else { String packageSequence = className.substring(0, indexOfDot); ValidationResult result = validatePackageName(packageSequence); if (!result.getType().equals(ResultType.INFO)) { return result; } String classSequence = className.substring(indexOfDot + 1); return validateIdentifier(classSequence, CLASS_NAME); } }
java
public static ValidationResult validateClassName(String className) { if (Strings.isNullOrEmpty(className)) return new ValidationResult(ERROR, Messages.notNullOrEmpty(CLASS_NAME)); int indexOfDot = className.lastIndexOf("."); if (indexOfDot == -1) { return validateIdentifier(className, CLASS_NAME); } else { String packageSequence = className.substring(0, indexOfDot); ValidationResult result = validatePackageName(packageSequence); if (!result.getType().equals(ResultType.INFO)) { return result; } String classSequence = className.substring(indexOfDot + 1); return validateIdentifier(classSequence, CLASS_NAME); } }
[ "public", "static", "ValidationResult", "validateClassName", "(", "String", "className", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "className", ")", ")", "return", "new", "ValidationResult", "(", "ERROR", ",", "Messages", ".", "notNullOrEmpty", "(", "CLASS_NAME", ")", ")", ";", "int", "indexOfDot", "=", "className", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "indexOfDot", "==", "-", "1", ")", "{", "return", "validateIdentifier", "(", "className", ",", "CLASS_NAME", ")", ";", "}", "else", "{", "String", "packageSequence", "=", "className", ".", "substring", "(", "0", ",", "indexOfDot", ")", ";", "ValidationResult", "result", "=", "validatePackageName", "(", "packageSequence", ")", ";", "if", "(", "!", "result", ".", "getType", "(", ")", ".", "equals", "(", "ResultType", ".", "INFO", ")", ")", "{", "return", "result", ";", "}", "String", "classSequence", "=", "className", ".", "substring", "(", "indexOfDot", "+", "1", ")", ";", "return", "validateIdentifier", "(", "classSequence", ",", "CLASS_NAME", ")", ";", "}", "}" ]
Validates whether the <code>className</code> parameter is a valid class name. This method verifies both qualified and unqualified class names. @param className @return
[ "Validates", "whether", "the", "<code", ">", "className<", "/", "code", ">", "parameter", "is", "a", "valid", "class", "name", ".", "This", "method", "verifies", "both", "qualified", "and", "unqualified", "class", "names", "." ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/utils/JLSValidator.java#L65-L85
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/UsernameAndPasswordLoginModule.java
UsernameAndPasswordLoginModule.getRequiredCallbacks
@Override public Callback[] getRequiredCallbacks(CallbackHandler callbackHandler) throws IOException, UnsupportedCallbackException { """ Gets the required Callback objects needed by this login module. @param callbackHandler @return @throws IOException @throws UnsupportedCallbackException """ Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("Username: "); callbacks[1] = new PasswordCallback("Password: ", false); callbackHandler.handle(callbacks); return callbacks; }
java
@Override public Callback[] getRequiredCallbacks(CallbackHandler callbackHandler) throws IOException, UnsupportedCallbackException { Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("Username: "); callbacks[1] = new PasswordCallback("Password: ", false); callbackHandler.handle(callbacks); return callbacks; }
[ "@", "Override", "public", "Callback", "[", "]", "getRequiredCallbacks", "(", "CallbackHandler", "callbackHandler", ")", "throws", "IOException", ",", "UnsupportedCallbackException", "{", "Callback", "[", "]", "callbacks", "=", "new", "Callback", "[", "2", "]", ";", "callbacks", "[", "0", "]", "=", "new", "NameCallback", "(", "\"Username: \"", ")", ";", "callbacks", "[", "1", "]", "=", "new", "PasswordCallback", "(", "\"Password: \"", ",", "false", ")", ";", "callbackHandler", ".", "handle", "(", "callbacks", ")", ";", "return", "callbacks", ";", "}" ]
Gets the required Callback objects needed by this login module. @param callbackHandler @return @throws IOException @throws UnsupportedCallbackException
[ "Gets", "the", "required", "Callback", "objects", "needed", "by", "this", "login", "module", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/jaas/modules/UsernameAndPasswordLoginModule.java#L121-L129
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java
JComponentFactory.newJSplitPane
public static JSplitPane newJSplitPane(Component newLeftComponent, Component newRightComponent) { """ Factory method for create new {@link JSplitPane} object @param newLeftComponent the <code>Component</code> that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane @param newRightComponent the <code>Component</code> that will appear on the right of a horizontally-split pane, or at the bottom of a vertically-split pane @return the new {@link JSplitPane} object """ return newJSplitPane(JSplitPane.HORIZONTAL_SPLIT, newLeftComponent, newRightComponent); }
java
public static JSplitPane newJSplitPane(Component newLeftComponent, Component newRightComponent) { return newJSplitPane(JSplitPane.HORIZONTAL_SPLIT, newLeftComponent, newRightComponent); }
[ "public", "static", "JSplitPane", "newJSplitPane", "(", "Component", "newLeftComponent", ",", "Component", "newRightComponent", ")", "{", "return", "newJSplitPane", "(", "JSplitPane", ".", "HORIZONTAL_SPLIT", ",", "newLeftComponent", ",", "newRightComponent", ")", ";", "}" ]
Factory method for create new {@link JSplitPane} object @param newLeftComponent the <code>Component</code> that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane @param newRightComponent the <code>Component</code> that will appear on the right of a horizontally-split pane, or at the bottom of a vertically-split pane @return the new {@link JSplitPane} object
[ "Factory", "method", "for", "create", "new", "{", "@link", "JSplitPane", "}", "object" ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java#L83-L86
apache/groovy
src/main/java/org/codehaus/groovy/runtime/callsite/CallSiteArray.java
CallSiteArray.createPojoSite
private static CallSite createPojoSite(CallSite callSite, Object receiver, Object[] args) { """ otherwise or if method doesn't exist we make call via POJO meta class """ final Class klazz = receiver.getClass(); MetaClass metaClass = InvokerHelper.getMetaClass(receiver); if (!GroovyCategorySupport.hasCategoryInCurrentThread() && metaClass instanceof MetaClassImpl) { final MetaClassImpl mci = (MetaClassImpl) metaClass; final ClassInfo info = mci.getTheCachedClass().classInfo; if (info.hasPerInstanceMetaClasses()) { return new PerInstancePojoMetaClassSite(callSite, info); } else { return mci.createPojoCallSite(callSite, receiver, args); } } ClassInfo info = ClassInfo.getClassInfo(klazz); if (info.hasPerInstanceMetaClasses()) return new PerInstancePojoMetaClassSite(callSite, info); else return new PojoMetaClassSite(callSite, metaClass); }
java
private static CallSite createPojoSite(CallSite callSite, Object receiver, Object[] args) { final Class klazz = receiver.getClass(); MetaClass metaClass = InvokerHelper.getMetaClass(receiver); if (!GroovyCategorySupport.hasCategoryInCurrentThread() && metaClass instanceof MetaClassImpl) { final MetaClassImpl mci = (MetaClassImpl) metaClass; final ClassInfo info = mci.getTheCachedClass().classInfo; if (info.hasPerInstanceMetaClasses()) { return new PerInstancePojoMetaClassSite(callSite, info); } else { return mci.createPojoCallSite(callSite, receiver, args); } } ClassInfo info = ClassInfo.getClassInfo(klazz); if (info.hasPerInstanceMetaClasses()) return new PerInstancePojoMetaClassSite(callSite, info); else return new PojoMetaClassSite(callSite, metaClass); }
[ "private", "static", "CallSite", "createPojoSite", "(", "CallSite", "callSite", ",", "Object", "receiver", ",", "Object", "[", "]", "args", ")", "{", "final", "Class", "klazz", "=", "receiver", ".", "getClass", "(", ")", ";", "MetaClass", "metaClass", "=", "InvokerHelper", ".", "getMetaClass", "(", "receiver", ")", ";", "if", "(", "!", "GroovyCategorySupport", ".", "hasCategoryInCurrentThread", "(", ")", "&&", "metaClass", "instanceof", "MetaClassImpl", ")", "{", "final", "MetaClassImpl", "mci", "=", "(", "MetaClassImpl", ")", "metaClass", ";", "final", "ClassInfo", "info", "=", "mci", ".", "getTheCachedClass", "(", ")", ".", "classInfo", ";", "if", "(", "info", ".", "hasPerInstanceMetaClasses", "(", ")", ")", "{", "return", "new", "PerInstancePojoMetaClassSite", "(", "callSite", ",", "info", ")", ";", "}", "else", "{", "return", "mci", ".", "createPojoCallSite", "(", "callSite", ",", "receiver", ",", "args", ")", ";", "}", "}", "ClassInfo", "info", "=", "ClassInfo", ".", "getClassInfo", "(", "klazz", ")", ";", "if", "(", "info", ".", "hasPerInstanceMetaClasses", "(", ")", ")", "return", "new", "PerInstancePojoMetaClassSite", "(", "callSite", ",", "info", ")", ";", "else", "return", "new", "PojoMetaClassSite", "(", "callSite", ",", "metaClass", ")", ";", "}" ]
otherwise or if method doesn't exist we make call via POJO meta class
[ "otherwise", "or", "if", "method", "doesn", "t", "exist", "we", "make", "call", "via", "POJO", "meta", "class" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/callsite/CallSiteArray.java#L122-L140
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java
Value.dateArray
public static Value dateArray(@Nullable Iterable<Date> v) { """ Returns an {@code ARRAY<DATE>} value. The range [1678-01-01, 2262-01-01) is the legal interval for cloud spanner dates. A write to a date column is rejected if the value is outside of that interval. @param v the source of element values. This may be {@code null} to produce a value for which {@code isNull()} is {@code true}. Individual elements may also be {@code null}. """ return new DateArrayImpl(v == null, v == null ? null : immutableCopyOf(v)); }
java
public static Value dateArray(@Nullable Iterable<Date> v) { return new DateArrayImpl(v == null, v == null ? null : immutableCopyOf(v)); }
[ "public", "static", "Value", "dateArray", "(", "@", "Nullable", "Iterable", "<", "Date", ">", "v", ")", "{", "return", "new", "DateArrayImpl", "(", "v", "==", "null", ",", "v", "==", "null", "?", "null", ":", "immutableCopyOf", "(", "v", ")", ")", ";", "}" ]
Returns an {@code ARRAY<DATE>} value. The range [1678-01-01, 2262-01-01) is the legal interval for cloud spanner dates. A write to a date column is rejected if the value is outside of that interval. @param v the source of element values. This may be {@code null} to produce a value for which {@code isNull()} is {@code true}. Individual elements may also be {@code null}.
[ "Returns", "an", "{", "@code", "ARRAY<DATE", ">", "}", "value", ".", "The", "range", "[", "1678", "-", "01", "-", "01", "2262", "-", "01", "-", "01", ")", "is", "the", "legal", "interval", "for", "cloud", "spanner", "dates", ".", "A", "write", "to", "a", "date", "column", "is", "rejected", "if", "the", "value", "is", "outside", "of", "that", "interval", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java#L324-L326
BlueBrain/bluima
modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/util/BeamSearch.java
BeamSearch.bestSequence
public Sequence bestSequence(Object[] sequence, Object[] additionalContext) { """ Returns the best sequence of outcomes based on model for this object. @param sequence The input sequence. @param additionalContext An Object[] of additional context. This is passed to the context generator blindly with the assumption that the context are appropiate. @return The top ranked sequence of outcomes. """ return bestSequences(1, sequence, additionalContext,zeroLog)[0]; }
java
public Sequence bestSequence(Object[] sequence, Object[] additionalContext) { return bestSequences(1, sequence, additionalContext,zeroLog)[0]; }
[ "public", "Sequence", "bestSequence", "(", "Object", "[", "]", "sequence", ",", "Object", "[", "]", "additionalContext", ")", "{", "return", "bestSequences", "(", "1", ",", "sequence", ",", "additionalContext", ",", "zeroLog", ")", "[", "0", "]", ";", "}" ]
Returns the best sequence of outcomes based on model for this object. @param sequence The input sequence. @param additionalContext An Object[] of additional context. This is passed to the context generator blindly with the assumption that the context are appropiate. @return The top ranked sequence of outcomes.
[ "Returns", "the", "best", "sequence", "of", "outcomes", "based", "on", "model", "for", "this", "object", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/util/BeamSearch.java#L155-L157
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putLongAt
public WrappedByteBuffer putLongAt(int index, long v) { """ Puts an eight-byte long into the buffer at the specified index. @param index the index @param v the eight-byte long @return the buffer """ _checkForWriteAt(index, 8); _buf.putLong(index, v); return this; }
java
public WrappedByteBuffer putLongAt(int index, long v) { _checkForWriteAt(index, 8); _buf.putLong(index, v); return this; }
[ "public", "WrappedByteBuffer", "putLongAt", "(", "int", "index", ",", "long", "v", ")", "{", "_checkForWriteAt", "(", "index", ",", "8", ")", ";", "_buf", ".", "putLong", "(", "index", ",", "v", ")", ";", "return", "this", ";", "}" ]
Puts an eight-byte long into the buffer at the specified index. @param index the index @param v the eight-byte long @return the buffer
[ "Puts", "an", "eight", "-", "byte", "long", "into", "the", "buffer", "at", "the", "specified", "index", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L546-L550