repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
headius/invokebinder
src/main/java/com/headius/invokebinder/Binder.java
Binder.invoke
public MethodHandle invoke(MethodHandles.Lookup lookup, Method method) throws IllegalAccessException { return invoke(lookup.unreflect(method)); }
java
public MethodHandle invoke(MethodHandles.Lookup lookup, Method method) throws IllegalAccessException { return invoke(lookup.unreflect(method)); }
[ "public", "MethodHandle", "invoke", "(", "MethodHandles", ".", "Lookup", "lookup", ",", "Method", "method", ")", "throws", "IllegalAccessException", "{", "return", "invoke", "(", "lookup", ".", "unreflect", "(", "method", ")", ")", ";", "}" ]
Apply the chain of transforms and bind them to a static method specified using the end signature plus the given class and method. The method will be retrieved using the given Lookup and must match the end signature exactly. If the final handle's type does not exactly match the initial type for this Binder, an additional cast will be attempted. @param lookup the MethodHandles.Lookup to use to unreflect the method @param method the Method to unreflect @return the full handle chain, bound to the given method @throws java.lang.IllegalAccessException if the method is not accessible
[ "Apply", "the", "chain", "of", "transforms", "and", "bind", "them", "to", "a", "static", "method", "specified", "using", "the", "end", "signature", "plus", "the", "given", "class", "and", "method", ".", "The", "method", "will", "be", "retrieved", "using", ...
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1166-L1168
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.checkForRequiredParameters
public <T extends Object> Map<String, Object> checkForRequiredParameters(String endpoint, @Sensitive Map<String, T> responseValues, String... requiredParams) { if (responseValues == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "The provided response values map is null, so all required parameters will be determined to be missing"); } } List<String> missingParams = new ArrayList<String>(); for (String param : requiredParams) { if (responseValues == null || !responseValues.containsKey(param)) { missingParams.add(param); } } if (!missingParams.isEmpty()) { return createErrorResponse("TWITTER_RESPONSE_MISSING_PARAMETER", new Object[] { endpoint, Arrays.toString(missingParams.toArray(new String[0])) }); } return null; }
java
public <T extends Object> Map<String, Object> checkForRequiredParameters(String endpoint, @Sensitive Map<String, T> responseValues, String... requiredParams) { if (responseValues == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "The provided response values map is null, so all required parameters will be determined to be missing"); } } List<String> missingParams = new ArrayList<String>(); for (String param : requiredParams) { if (responseValues == null || !responseValues.containsKey(param)) { missingParams.add(param); } } if (!missingParams.isEmpty()) { return createErrorResponse("TWITTER_RESPONSE_MISSING_PARAMETER", new Object[] { endpoint, Arrays.toString(missingParams.toArray(new String[0])) }); } return null; }
[ "public", "<", "T", "extends", "Object", ">", "Map", "<", "String", ",", "Object", ">", "checkForRequiredParameters", "(", "String", "endpoint", ",", "@", "Sensitive", "Map", "<", "String", ",", "T", ">", "responseValues", ",", "String", "...", "requiredPara...
Checks that the provided map contains all of the required parameters. @param endpoint @param responseValues May contain token secrets, so has been annotated as @Sensitive. @param requiredParams @return {@code null} if the map contains all of the specified required parameters. If any parameters are missing, a Map with an error response status and error message is returned.
[ "Checks", "that", "the", "provided", "map", "contains", "all", "of", "the", "required", "parameters", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L579-L595
TestFX/Monocle
src/main/java/com/sun/glass/ui/monocle/X11InputDeviceRegistry.java
X11InputDeviceRegistry.processXEvent
private void processXEvent(X.XEvent event, RunnableProcessor runnableProcessor) { switch (X.XEvent.getType(event.p)) { case X.ButtonPress: { X.XButtonEvent buttonEvent = new X.XButtonEvent(event); int button = X.XButtonEvent.getButton(buttonEvent.p); runnableProcessor.invokeLater(new ButtonPressProcessor(button)); break; } case X.ButtonRelease: { X.XButtonEvent buttonEvent = new X.XButtonEvent(event); int button = X.XButtonEvent.getButton(buttonEvent.p); runnableProcessor.invokeLater( new ButtonReleaseProcessor(button)); break; } case X.MotionNotify: { X.XMotionEvent motionEvent = new X.XMotionEvent(event); int x = X.XMotionEvent.getX(motionEvent.p); int y = X.XMotionEvent.getY(motionEvent.p); runnableProcessor.invokeLater(new MotionProcessor(x, y)); break; } } }
java
private void processXEvent(X.XEvent event, RunnableProcessor runnableProcessor) { switch (X.XEvent.getType(event.p)) { case X.ButtonPress: { X.XButtonEvent buttonEvent = new X.XButtonEvent(event); int button = X.XButtonEvent.getButton(buttonEvent.p); runnableProcessor.invokeLater(new ButtonPressProcessor(button)); break; } case X.ButtonRelease: { X.XButtonEvent buttonEvent = new X.XButtonEvent(event); int button = X.XButtonEvent.getButton(buttonEvent.p); runnableProcessor.invokeLater( new ButtonReleaseProcessor(button)); break; } case X.MotionNotify: { X.XMotionEvent motionEvent = new X.XMotionEvent(event); int x = X.XMotionEvent.getX(motionEvent.p); int y = X.XMotionEvent.getY(motionEvent.p); runnableProcessor.invokeLater(new MotionProcessor(x, y)); break; } } }
[ "private", "void", "processXEvent", "(", "X", ".", "XEvent", "event", ",", "RunnableProcessor", "runnableProcessor", ")", "{", "switch", "(", "X", ".", "XEvent", ".", "getType", "(", "event", ".", "p", ")", ")", "{", "case", "X", ".", "ButtonPress", ":",...
Dispatch the X Event to the appropriate processor. All processors run via invokeLater @param event @param runnableProcessor
[ "Dispatch", "the", "X", "Event", "to", "the", "appropriate", "processor", ".", "All", "processors", "run", "via", "invokeLater" ]
train
https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/X11InputDeviceRegistry.java#L98-L122
zsoltk/overpasser
library/src/main/java/hu/supercluster/overpasser/library/query/OverpassQuery.java
OverpassQuery.boundingBox
public OverpassQuery boundingBox(double southernLat, double westernLon, double northernLat, double easternLon) { builder.append(String.format(Locale.US, "[bbox:%s,%s,%s,%s]", southernLat, westernLon, northernLat, easternLon )); return this; }
java
public OverpassQuery boundingBox(double southernLat, double westernLon, double northernLat, double easternLon) { builder.append(String.format(Locale.US, "[bbox:%s,%s,%s,%s]", southernLat, westernLon, northernLat, easternLon )); return this; }
[ "public", "OverpassQuery", "boundingBox", "(", "double", "southernLat", ",", "double", "westernLon", ",", "double", "northernLat", ",", "double", "easternLon", ")", "{", "builder", ".", "append", "(", "String", ".", "format", "(", "Locale", ".", "US", ",", "...
Defines a global bounding box that is then implicitly added to all queries (unless they specify a different explicit bounding box) @param southernLat the southern latitude @param westernLon the western longitude @param northernLat the northern latitude @param easternLon the eastern longitude @return the current OverpassQuery object
[ "Defines", "a", "global", "bounding", "box", "that", "is", "then", "implicitly", "added", "to", "all", "queries", "(", "unless", "they", "specify", "a", "different", "explicit", "bounding", "box", ")" ]
train
https://github.com/zsoltk/overpasser/blob/0464d3844e75c5f9393d2458d3a3aedf3e40f30d/library/src/main/java/hu/supercluster/overpasser/library/query/OverpassQuery.java#L68-L77
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/convert/NumberConverter.java
NumberConverter.getNumberFormat
private NumberFormat getNumberFormat(Locale locale) { if (pattern == null && type == null) { throw new IllegalArgumentException("Either pattern or type must" + " be specified."); } // PENDING(craigmcc) - Implement pooling if needed for performance? // If pattern is specified, type is ignored if (pattern != null) { DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale); return (new DecimalFormat(pattern, symbols)); } // Create an instance based on the specified type else if (type.equals("currency")) { return (NumberFormat.getCurrencyInstance(locale)); } else if (type.equals("number")) { return (NumberFormat.getNumberInstance(locale)); } else if (type.equals("percent")) { return (NumberFormat.getPercentInstance(locale)); } else { // PENDING(craigmcc) - i18n throw new ConverterException (new IllegalArgumentException(type)); } }
java
private NumberFormat getNumberFormat(Locale locale) { if (pattern == null && type == null) { throw new IllegalArgumentException("Either pattern or type must" + " be specified."); } // PENDING(craigmcc) - Implement pooling if needed for performance? // If pattern is specified, type is ignored if (pattern != null) { DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale); return (new DecimalFormat(pattern, symbols)); } // Create an instance based on the specified type else if (type.equals("currency")) { return (NumberFormat.getCurrencyInstance(locale)); } else if (type.equals("number")) { return (NumberFormat.getNumberInstance(locale)); } else if (type.equals("percent")) { return (NumberFormat.getPercentInstance(locale)); } else { // PENDING(craigmcc) - i18n throw new ConverterException (new IllegalArgumentException(type)); } }
[ "private", "NumberFormat", "getNumberFormat", "(", "Locale", "locale", ")", "{", "if", "(", "pattern", "==", "null", "&&", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Either pattern or type must\"", "+", "\" be specified.\"", ...
<p>Return a <code>NumberFormat</code> instance to use for formatting and parsing in this {@link Converter}.</p> @param locale The <code>Locale</code> used to select formatting and parsing conventions @throws ConverterException if no instance can be created
[ "<p", ">", "Return", "a", "<code", ">", "NumberFormat<", "/", "code", ">", "instance", "to", "use", "for", "formatting", "and", "parsing", "in", "this", "{", "@link", "Converter", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/convert/NumberConverter.java#L879-L908
alibaba/Tangram-Android
tangram/src/main/java/com/tmall/wireless/tangram3/BaseTangramEngine.java
BaseTangramEngine.parseSingleComponent
public BaseCell parseSingleComponent(@Nullable Card parent, @Nullable O data, @Nullable Map<String, ComponentInfo> componentInfoMap) { return mDataParser.parseSingleComponent(data, parent, this, componentInfoMap); }
java
public BaseCell parseSingleComponent(@Nullable Card parent, @Nullable O data, @Nullable Map<String, ComponentInfo> componentInfoMap) { return mDataParser.parseSingleComponent(data, parent, this, componentInfoMap); }
[ "public", "BaseCell", "parseSingleComponent", "(", "@", "Nullable", "Card", "parent", ",", "@", "Nullable", "O", "data", ",", "@", "Nullable", "Map", "<", "String", ",", "ComponentInfo", ">", "componentInfoMap", ")", "{", "return", "mDataParser", ".", "parseSi...
Parse original data with type {@link O} into model data with type {@link BaseCell} @param parent the parent group to hold parsed object. @param data Original data. @return Parsed data. @since 3.0.0
[ "Parse", "original", "data", "with", "type", "{", "@link", "O", "}", "into", "model", "data", "with", "type", "{", "@link", "BaseCell", "}" ]
train
https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram3/BaseTangramEngine.java#L488-L490
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createOrEditJiraService
public boolean createOrEditJiraService(Integer projectId, GitlabJiraProperties jiraPropties) throws IOException { Query query = new Query() .appendIf("url", jiraPropties.getUrl()) .appendIf("project_key", jiraPropties.getProjectKey()); if (!jiraPropties.getUsername().isEmpty()) { query.appendIf("username", jiraPropties.getUsername()); } if (!jiraPropties.getPassword().isEmpty()) { query.appendIf("password", jiraPropties.getPassword()); } if (jiraPropties.getIssueTransitionId() != null) { query.appendIf("jira_issue_transition_id", jiraPropties.getIssueTransitionId()); } String tailUrl = GitlabProject.URL + "/" + projectId + GitlabServiceJira.URL + query.toString(); return retrieve().method(PUT).to(tailUrl, Boolean.class); }
java
public boolean createOrEditJiraService(Integer projectId, GitlabJiraProperties jiraPropties) throws IOException { Query query = new Query() .appendIf("url", jiraPropties.getUrl()) .appendIf("project_key", jiraPropties.getProjectKey()); if (!jiraPropties.getUsername().isEmpty()) { query.appendIf("username", jiraPropties.getUsername()); } if (!jiraPropties.getPassword().isEmpty()) { query.appendIf("password", jiraPropties.getPassword()); } if (jiraPropties.getIssueTransitionId() != null) { query.appendIf("jira_issue_transition_id", jiraPropties.getIssueTransitionId()); } String tailUrl = GitlabProject.URL + "/" + projectId + GitlabServiceJira.URL + query.toString(); return retrieve().method(PUT).to(tailUrl, Boolean.class); }
[ "public", "boolean", "createOrEditJiraService", "(", "Integer", "projectId", ",", "GitlabJiraProperties", "jiraPropties", ")", "throws", "IOException", "{", "Query", "query", "=", "new", "Query", "(", ")", ".", "appendIf", "(", "\"url\"", ",", "jiraPropties", ".",...
Set JIRA service for a project. https://docs.gitlab.com/ce/api/services.html#create-edit-jira-service @param projectId The ID of the project containing the variable. @param jiraPropties @return @throws IOException on gitlab api call error
[ "Set", "JIRA", "service", "for", "a", "project", ".", "https", ":", "//", "docs", ".", "gitlab", ".", "com", "/", "ce", "/", "api", "/", "services", ".", "html#create", "-", "edit", "-", "jira", "-", "service" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3840-L3862
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/utilities/xml/DOM.java
DOM.selectInteger
public static Integer selectInteger(Node node, String xpath, Integer defaultValue) { return selector.selectInteger(node, xpath, defaultValue); }
java
public static Integer selectInteger(Node node, String xpath, Integer defaultValue) { return selector.selectInteger(node, xpath, defaultValue); }
[ "public", "static", "Integer", "selectInteger", "(", "Node", "node", ",", "String", "xpath", ",", "Integer", "defaultValue", ")", "{", "return", "selector", ".", "selectInteger", "(", "node", ",", "xpath", ",", "defaultValue", ")", ";", "}" ]
Extract an integer value from {@code node} or return {@code defaultValue} if it is not found. @param node the node with the wanted attribute. @param xpath the XPath to extract. @param defaultValue the default value. @return the value of the path, if existing, else defaultValue
[ "Extract", "an", "integer", "value", "from", "{", "@code", "node", "}", "or", "return", "{", "@code", "defaultValue", "}", "if", "it", "is", "not", "found", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/xml/DOM.java#L218-L220
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
UnrelatedCollectionContents.mergeItem
private void mergeItem(final Set<String> supers, final Set<SourceLineAnnotation> sla, final OpcodeStack.Item addItm) throws ClassNotFoundException { if (supers.isEmpty()) { return; } Set<String> s = new HashSet<>(); addNewItem(s, addItm); if (s.isEmpty()) { return; } intersection(supers, s); if (supers.isEmpty()) { BugInstance bug = new BugInstance(this, BugType.UCC_UNRELATED_COLLECTION_CONTENTS.name(), NORMAL_PRIORITY).addClass(this); if (addItm.getRegisterNumber() != -1) { bug.addMethod(this); } for (SourceLineAnnotation a : sla) { bug.addSourceLine(a); } bugReporter.reportBug(bug); } }
java
private void mergeItem(final Set<String> supers, final Set<SourceLineAnnotation> sla, final OpcodeStack.Item addItm) throws ClassNotFoundException { if (supers.isEmpty()) { return; } Set<String> s = new HashSet<>(); addNewItem(s, addItm); if (s.isEmpty()) { return; } intersection(supers, s); if (supers.isEmpty()) { BugInstance bug = new BugInstance(this, BugType.UCC_UNRELATED_COLLECTION_CONTENTS.name(), NORMAL_PRIORITY).addClass(this); if (addItm.getRegisterNumber() != -1) { bug.addMethod(this); } for (SourceLineAnnotation a : sla) { bug.addSourceLine(a); } bugReporter.reportBug(bug); } }
[ "private", "void", "mergeItem", "(", "final", "Set", "<", "String", ">", "supers", ",", "final", "Set", "<", "SourceLineAnnotation", ">", "sla", ",", "final", "OpcodeStack", ".", "Item", "addItm", ")", "throws", "ClassNotFoundException", "{", "if", "(", "sup...
intersects the set of possible superclass that this collection might have seen before with this one. If we find that there is no commonality between superclasses, report it as a bug. @param supers the collection of possible superclass/interfaces that has been seen for this collection thus far @param sla the location of this add @param addItm the currently added item @throws ClassNotFoundException if a superclass/interface can not be found
[ "intersects", "the", "set", "of", "possible", "superclass", "that", "this", "collection", "might", "have", "seen", "before", "with", "this", "one", ".", "If", "we", "find", "that", "there", "is", "no", "commonality", "between", "superclasses", "report", "it", ...
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java#L245-L273
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
ReflectionFragment.getPreparedStatementText
protected String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) { // this reflection fragment may resolve to a JdbcControl.ComplexSqlFragment // if so it changes the behavior a bit. Object val = getParameterValue(context, m, args); if (val instanceof JdbcControl.ComplexSqlFragment) { return ((JdbcControl.ComplexSqlFragment)val).getSQL(); } else { return PREPARED_STATEMENT_SUB_MARK; } }
java
protected String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) { // this reflection fragment may resolve to a JdbcControl.ComplexSqlFragment // if so it changes the behavior a bit. Object val = getParameterValue(context, m, args); if (val instanceof JdbcControl.ComplexSqlFragment) { return ((JdbcControl.ComplexSqlFragment)val).getSQL(); } else { return PREPARED_STATEMENT_SUB_MARK; } }
[ "protected", "String", "getPreparedStatementText", "(", "ControlBeanContext", "context", ",", "Method", "m", ",", "Object", "[", "]", "args", ")", "{", "// this reflection fragment may resolve to a JdbcControl.ComplexSqlFragment", "// if so it changes the behavior a bit.", "Objec...
Return text generated by this fragment for a PreparedStatement @param context A ControlBeanContext instance. @param m The annotated method. @param args The method's parameters @return Always returns a PREPARED_STATEMENT_SUB_MARK
[ "Return", "text", "generated", "by", "this", "fragment", "for", "a", "PreparedStatement" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java#L81-L90
pravega/pravega
bindings/src/main/java/io/pravega/storage/extendeds3/ExtendedS3Storage.java
ExtendedS3Storage.doConcat
private Void doConcat(SegmentHandle targetHandle, long offset, String sourceSegment) throws StreamSegmentNotExistsException { Preconditions.checkArgument(!targetHandle.isReadOnly(), "target handle must not be read-only."); long traceId = LoggerHelpers.traceEnter(log, "concat", targetHandle.getSegmentName(), offset, sourceSegment); SortedSet<MultipartPartETag> partEtags = new TreeSet<>(); String targetPath = config.getRoot() + targetHandle.getSegmentName(); String uploadId = client.initiateMultipartUpload(config.getBucket(), targetPath); // check whether the target exists if (!doExists(targetHandle.getSegmentName())) { throw new StreamSegmentNotExistsException(targetHandle.getSegmentName()); } // check whether the source is sealed SegmentProperties si = doGetStreamSegmentInfo(sourceSegment); Preconditions.checkState(si.isSealed(), "Cannot concat segment '%s' into '%s' because it is not sealed.", sourceSegment, targetHandle.getSegmentName()); //Copy the first part CopyPartRequest copyRequest = new CopyPartRequest(config.getBucket(), targetPath, config.getBucket(), targetPath, uploadId, 1).withSourceRange(Range.fromOffsetLength(0, offset)); CopyPartResult copyResult = client.copyPart(copyRequest); partEtags.add(new MultipartPartETag(copyResult.getPartNumber(), copyResult.getETag())); //Copy the second part S3ObjectMetadata metadataResult = client.getObjectMetadata(config.getBucket(), config.getRoot() + sourceSegment); long objectSize = metadataResult.getContentLength(); // in bytes copyRequest = new CopyPartRequest(config.getBucket(), config.getRoot() + sourceSegment, config.getBucket(), targetPath, uploadId, 2).withSourceRange(Range.fromOffsetLength(0, objectSize)); copyResult = client.copyPart(copyRequest); partEtags.add(new MultipartPartETag(copyResult.getPartNumber(), copyResult.getETag())); //Close the upload client.completeMultipartUpload(new CompleteMultipartUploadRequest(config.getBucket(), targetPath, uploadId).withParts(partEtags)); client.deleteObject(config.getBucket(), config.getRoot() + sourceSegment); LoggerHelpers.traceLeave(log, "concat", traceId); return null; }
java
private Void doConcat(SegmentHandle targetHandle, long offset, String sourceSegment) throws StreamSegmentNotExistsException { Preconditions.checkArgument(!targetHandle.isReadOnly(), "target handle must not be read-only."); long traceId = LoggerHelpers.traceEnter(log, "concat", targetHandle.getSegmentName(), offset, sourceSegment); SortedSet<MultipartPartETag> partEtags = new TreeSet<>(); String targetPath = config.getRoot() + targetHandle.getSegmentName(); String uploadId = client.initiateMultipartUpload(config.getBucket(), targetPath); // check whether the target exists if (!doExists(targetHandle.getSegmentName())) { throw new StreamSegmentNotExistsException(targetHandle.getSegmentName()); } // check whether the source is sealed SegmentProperties si = doGetStreamSegmentInfo(sourceSegment); Preconditions.checkState(si.isSealed(), "Cannot concat segment '%s' into '%s' because it is not sealed.", sourceSegment, targetHandle.getSegmentName()); //Copy the first part CopyPartRequest copyRequest = new CopyPartRequest(config.getBucket(), targetPath, config.getBucket(), targetPath, uploadId, 1).withSourceRange(Range.fromOffsetLength(0, offset)); CopyPartResult copyResult = client.copyPart(copyRequest); partEtags.add(new MultipartPartETag(copyResult.getPartNumber(), copyResult.getETag())); //Copy the second part S3ObjectMetadata metadataResult = client.getObjectMetadata(config.getBucket(), config.getRoot() + sourceSegment); long objectSize = metadataResult.getContentLength(); // in bytes copyRequest = new CopyPartRequest(config.getBucket(), config.getRoot() + sourceSegment, config.getBucket(), targetPath, uploadId, 2).withSourceRange(Range.fromOffsetLength(0, objectSize)); copyResult = client.copyPart(copyRequest); partEtags.add(new MultipartPartETag(copyResult.getPartNumber(), copyResult.getETag())); //Close the upload client.completeMultipartUpload(new CompleteMultipartUploadRequest(config.getBucket(), targetPath, uploadId).withParts(partEtags)); client.deleteObject(config.getBucket(), config.getRoot() + sourceSegment); LoggerHelpers.traceLeave(log, "concat", traceId); return null; }
[ "private", "Void", "doConcat", "(", "SegmentHandle", "targetHandle", ",", "long", "offset", ",", "String", "sourceSegment", ")", "throws", "StreamSegmentNotExistsException", "{", "Preconditions", ".", "checkArgument", "(", "!", "targetHandle", ".", "isReadOnly", "(", ...
The concat is implemented using extended S3 implementation of multipart copy API. Please see here for more detail on multipart copy: http://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjctsUsingLLJavaMPUapi.html The multipart copy is an atomic operation. We schedule two parts and commit them atomically using completeMultiPartUpload call. Specifically, to concatenate, we are copying the target segment T and the source segment S to T, so essentially we are doing T <- T + S.
[ "The", "concat", "is", "implemented", "using", "extended", "S3", "implementation", "of", "multipart", "copy", "API", ".", "Please", "see", "here", "for", "more", "detail", "on", "multipart", "copy", ":", "http", ":", "//", "docs", ".", "aws", ".", "amazon"...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/bindings/src/main/java/io/pravega/storage/extendeds3/ExtendedS3Storage.java#L371-L422
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java
PathOverrideService.setRequestType
public void setRequestType(int pathId, Integer requestType) { if (requestType == null) { requestType = Constants.REQUEST_TYPE_GET; } PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_PATH + " SET " + Constants.PATH_PROFILE_REQUEST_TYPE + " = ?" + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setInt(1, requestType); statement.setInt(2, pathId); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void setRequestType(int pathId, Integer requestType) { if (requestType == null) { requestType = Constants.REQUEST_TYPE_GET; } PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_PATH + " SET " + Constants.PATH_PROFILE_REQUEST_TYPE + " = ?" + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setInt(1, requestType); statement.setInt(2, pathId); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "setRequestType", "(", "int", "pathId", ",", "Integer", "requestType", ")", "{", "if", "(", "requestType", "==", "null", ")", "{", "requestType", "=", "Constants", ".", "REQUEST_TYPE_GET", ";", "}", "PreparedStatement", "statement", "=", "nul...
Sets the request type for this ID. Defaults to GET @param pathId ID of path @param requestType type of request to service
[ "Sets", "the", "request", "type", "for", "this", "ID", ".", "Defaults", "to", "GET" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L1237-L1262
SG-O/miIO
src/main/java/de/sg_o/app/miio/base/Device.java
Device.sendToArray
public JSONArray sendToArray(String method, Object params) throws CommandExecutionException { Response resp = send(method, params); if (resp == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE); if (resp.getParams() == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE); if (resp.getParams().getClass() != JSONArray.class) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE); return (JSONArray)resp.getParams(); }
java
public JSONArray sendToArray(String method, Object params) throws CommandExecutionException { Response resp = send(method, params); if (resp == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE); if (resp.getParams() == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE); if (resp.getParams().getClass() != JSONArray.class) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_RESPONSE); return (JSONArray)resp.getParams(); }
[ "public", "JSONArray", "sendToArray", "(", "String", "method", ",", "Object", "params", ")", "throws", "CommandExecutionException", "{", "Response", "resp", "=", "send", "(", "method", ",", "params", ")", ";", "if", "(", "resp", "==", "null", ")", "throw", ...
Send a command to a device. If no IP has been specified, this will try do discover a device on the network. @param method The method to execute on the device. @param params The command to execute on the device. Must be a JSONArray or JSONObject. @return The response from the device as a JSONArray. @throws CommandExecutionException When there has been a error during the communication or the response was invalid.
[ "Send", "a", "command", "to", "a", "device", ".", "If", "no", "IP", "has", "been", "specified", "this", "will", "try", "do", "discover", "a", "device", "on", "the", "network", "." ]
train
https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/base/Device.java#L377-L383
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.matchString
protected int matchString(String text, int start, int field, String[] data, Calendar cal) { return matchString(text, start, field, data, null, cal); }
java
protected int matchString(String text, int start, int field, String[] data, Calendar cal) { return matchString(text, start, field, data, null, cal); }
[ "protected", "int", "matchString", "(", "String", "text", ",", "int", "start", ",", "int", "field", ",", "String", "[", "]", "data", ",", "Calendar", "cal", ")", "{", "return", "matchString", "(", "text", ",", "start", ",", "field", ",", "data", ",", ...
Attempt to match the text at a given position against an array of strings. Since multiple strings in the array may match (for example, if the array contains "a", "ab", and "abc", all will match the input string "abcd") the longest match is returned. As a side effect, the given field of <code>cal</code> is set to the index of the best match, if there is one. @param text the time text being parsed. @param start where to start parsing. @param field the date field being parsed. @param data the string array to parsed. @param cal @return the new start position if matching succeeded; a negative number indicating matching failure, otherwise. As a side effect, sets the <code>cal</code> field <code>field</code> to the index of the best match, if matching succeeded.
[ "Attempt", "to", "match", "the", "text", "at", "a", "given", "position", "against", "an", "array", "of", "strings", ".", "Since", "multiple", "strings", "in", "the", "array", "may", "match", "(", "for", "example", "if", "the", "array", "contains", "a", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L2849-L2852
opengeospatial/teamengine
teamengine-core/src/main/java/com/occamlab/te/html/EarlToHtmlTransformation.java
EarlToHtmlTransformation.earlHtmlReport
public void earlHtmlReport( String outputDir ) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath(); String earlXsl = cl.getResource( "com/occamlab/te/earl_html_report.xsl" ).toString(); File htmlOutput = new File( outputDir, "result" ); htmlOutput.mkdir(); File earlResult = findEarlResultFile( outputDir ); LOGR.log( FINE, "Try to transform earl result file '" + earlResult + "' to directory " + htmlOutput ); try { if ( earlResult != null && earlResult.exists() ) { Transformer transformer = TransformerFactory.newInstance().newTransformer( new StreamSource( earlXsl ) ); transformer.setParameter( "outputDir", htmlOutput ); File indexHtml = new File( htmlOutput, "index.html" ); indexHtml.createNewFile(); // Fortify Mod: Make sure the FileOutputStream is closed when we are done with it. // transformer.transform( new StreamSource( earlResult ), // new StreamResult( new FileOutputStream( indexHtml ) ) ); FileOutputStream fo = new FileOutputStream( indexHtml ); transformer.transform( new StreamSource( earlResult ), new StreamResult( fo ) ); fo.close(); FileUtils.copyDirectory( new File( resourceDir ), htmlOutput ); } } catch ( Exception e ) { LOGR.log( SEVERE, "Transformation of EARL to HTML failed.", e ); } }
java
public void earlHtmlReport( String outputDir ) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath(); String earlXsl = cl.getResource( "com/occamlab/te/earl_html_report.xsl" ).toString(); File htmlOutput = new File( outputDir, "result" ); htmlOutput.mkdir(); File earlResult = findEarlResultFile( outputDir ); LOGR.log( FINE, "Try to transform earl result file '" + earlResult + "' to directory " + htmlOutput ); try { if ( earlResult != null && earlResult.exists() ) { Transformer transformer = TransformerFactory.newInstance().newTransformer( new StreamSource( earlXsl ) ); transformer.setParameter( "outputDir", htmlOutput ); File indexHtml = new File( htmlOutput, "index.html" ); indexHtml.createNewFile(); // Fortify Mod: Make sure the FileOutputStream is closed when we are done with it. // transformer.transform( new StreamSource( earlResult ), // new StreamResult( new FileOutputStream( indexHtml ) ) ); FileOutputStream fo = new FileOutputStream( indexHtml ); transformer.transform( new StreamSource( earlResult ), new StreamResult( fo ) ); fo.close(); FileUtils.copyDirectory( new File( resourceDir ), htmlOutput ); } } catch ( Exception e ) { LOGR.log( SEVERE, "Transformation of EARL to HTML failed.", e ); } }
[ "public", "void", "earlHtmlReport", "(", "String", "outputDir", ")", "{", "ClassLoader", "cl", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "String", "resourceDir", "=", "cl", ".", "getResource", "(", "\"com/occam...
Transform EARL result into HTML report using XSLT. @param outputDir
[ "Transform", "EARL", "result", "into", "HTML", "report", "using", "XSLT", "." ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/html/EarlToHtmlTransformation.java#L29-L57
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/map/AbstractLongObjectMap.java
AbstractLongObjectMap.containsValue
public boolean containsValue(final Object value) { return ! forEachPair( new LongObjectProcedure() { public boolean apply(long iterKey, Object iterValue) { return (value != iterValue); } } ); }
java
public boolean containsValue(final Object value) { return ! forEachPair( new LongObjectProcedure() { public boolean apply(long iterKey, Object iterValue) { return (value != iterValue); } } ); }
[ "public", "boolean", "containsValue", "(", "final", "Object", "value", ")", "{", "return", "!", "forEachPair", "(", "new", "LongObjectProcedure", "(", ")", "{", "public", "boolean", "apply", "(", "long", "iterKey", ",", "Object", "iterValue", ")", "{", "retu...
Returns <tt>true</tt> if the receiver contains the specified value. Tests for identity. @return <tt>true</tt> if the receiver contains the specified value.
[ "Returns", "<tt", ">", "true<", "/", "tt", ">", "if", "the", "receiver", "contains", "the", "specified", "value", ".", "Tests", "for", "identity", "." ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/AbstractLongObjectMap.java#L54-L62
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java
Decimal.divideToIntegralValue
public static Decimal divideToIntegralValue(Decimal value, Decimal divisor, int precision, int scale) { BigDecimal bd = value.toBigDecimal().divideToIntegralValue(divisor.toBigDecimal()); return fromBigDecimal(bd, precision, scale); }
java
public static Decimal divideToIntegralValue(Decimal value, Decimal divisor, int precision, int scale) { BigDecimal bd = value.toBigDecimal().divideToIntegralValue(divisor.toBigDecimal()); return fromBigDecimal(bd, precision, scale); }
[ "public", "static", "Decimal", "divideToIntegralValue", "(", "Decimal", "value", ",", "Decimal", "divisor", ",", "int", "precision", ",", "int", "scale", ")", "{", "BigDecimal", "bd", "=", "value", ".", "toBigDecimal", "(", ")", ".", "divideToIntegralValue", "...
Returns a {@code Decimal} whose value is the integer part of the quotient {@code (this / divisor)} rounded down. @param value value by which this {@code Decimal} is to be divided. @param divisor value by which this {@code Decimal} is to be divided. @return The integer part of {@code this / divisor}. @throws ArithmeticException if {@code divisor==0}
[ "Returns", "a", "{", "@code", "Decimal", "}", "whose", "value", "is", "the", "integer", "part", "of", "the", "quotient", "{", "@code", "(", "this", "/", "divisor", ")", "}", "rounded", "down", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java#L328-L331
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.listMetricDefintionsWithServiceResponseAsync
public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMetricDefintionsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listMetricDefintionsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricDefintionsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMetricDefintionsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listMetricDefintionsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricDefintionsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ResourceMetricDefinitionInner", ">", ">", ">", "listMetricDefintionsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listMetric...
Get metrics that can be queried for an App Service plan, and their definitions. Get metrics that can be queried for an App Service plan, and their definitions. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricDefinitionInner&gt; object
[ "Get", "metrics", "that", "can", "be", "queried", "for", "an", "App", "Service", "plan", "and", "their", "definitions", ".", "Get", "metrics", "that", "can", "be", "queried", "for", "an", "App", "Service", "plan", "and", "their", "definitions", "." ]
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/AppServicePlansInner.java#L1867-L1879
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/collections/MultimapUtils.java
MultimapUtils.composeToSetMultimapStrictly
public static <K1, K2, V1 extends K2, V2> ImmutableSetMultimap<K1, V2> composeToSetMultimapStrictly( final Multimap<K1, V1> first, final Multimap<K2, V2> second) { checkArgument(second.keySet().containsAll(first.values())); return composeToSetMultimap(first, second); }
java
public static <K1, K2, V1 extends K2, V2> ImmutableSetMultimap<K1, V2> composeToSetMultimapStrictly( final Multimap<K1, V1> first, final Multimap<K2, V2> second) { checkArgument(second.keySet().containsAll(first.values())); return composeToSetMultimap(first, second); }
[ "public", "static", "<", "K1", ",", "K2", ",", "V1", "extends", "K2", ",", "V2", ">", "ImmutableSetMultimap", "<", "K1", ",", "V2", ">", "composeToSetMultimapStrictly", "(", "final", "Multimap", "<", "K1", ",", "V1", ">", "first", ",", "final", "Multimap...
Performs a (strict) composition of two multimaps to an {@link ImmutableSetMultimap}. This returns a new {@link ImmutableSetMultimap} which will contain an entry {@code (k,v)} if and only if there is some {@code i} such that {@code (k, i)} is in {@code first} and {@code (i, v)} is in {@code second}. Neither {@code first} nor {@code second} is permitted to contain null keys or values. The output of this method is not a view and will not be updated for changes to the input multimaps. Strict compositions require that for each entry {@code (k,i)} in {@code first}, there exists an entry {@code (i,v)} in {@code second}.
[ "Performs", "a", "(", "strict", ")", "composition", "of", "two", "multimaps", "to", "an", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/MultimapUtils.java#L117-L121
looly/hutool
hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java
AnnotationUtil.getAnnotation
public static <A extends Annotation> A getAnnotation(AnnotatedElement annotationEle, Class<A> annotationType) { return (null == annotationEle) ? null : toCombination(annotationEle).getAnnotation(annotationType); }
java
public static <A extends Annotation> A getAnnotation(AnnotatedElement annotationEle, Class<A> annotationType) { return (null == annotationEle) ? null : toCombination(annotationEle).getAnnotation(annotationType); }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "getAnnotation", "(", "AnnotatedElement", "annotationEle", ",", "Class", "<", "A", ">", "annotationType", ")", "{", "return", "(", "null", "==", "annotationEle", ")", "?", "null", ":", "toCombi...
获取指定注解 @param <A> 注解类型 @param annotationEle {@link AnnotatedElement},可以是Class、Method、Field、Constructor、ReflectPermission @param annotationType 注解类型 @return 注解对象
[ "获取指定注解" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java#L61-L63
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.createSuccess
public static UnitResponse createSuccess(Object data, String errMsg) { return createSuccess(data).setMessage(errMsg); }
java
public static UnitResponse createSuccess(Object data, String errMsg) { return createSuccess(data).setMessage(errMsg); }
[ "public", "static", "UnitResponse", "createSuccess", "(", "Object", "data", ",", "String", "errMsg", ")", "{", "return", "createSuccess", "(", "data", ")", ".", "setMessage", "(", "errMsg", ")", ";", "}" ]
create a succeeded response instance with specified data. @param data the data for the susccessful response @param errMsg the description message @return the newly created response
[ "create", "a", "succeeded", "response", "instance", "with", "specified", "data", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L106-L108
knowm/Yank
src/main/java/org/knowm/yank/Yank.java
Yank.queryObjectArrays
public static List<Object[]> queryObjectArrays(String sql, Object[] params) throws YankSQLException { return queryObjectArrays(YankPoolManager.DEFAULT_POOL_NAME, sql, params); }
java
public static List<Object[]> queryObjectArrays(String sql, Object[] params) throws YankSQLException { return queryObjectArrays(YankPoolManager.DEFAULT_POOL_NAME, sql, params); }
[ "public", "static", "List", "<", "Object", "[", "]", ">", "queryObjectArrays", "(", "String", "sql", ",", "Object", "[", "]", "params", ")", "throws", "YankSQLException", "{", "return", "queryObjectArrays", "(", "YankPoolManager", ".", "DEFAULT_POOL_NAME", ",", ...
Return a List of generic Object[]s given an SQL statement using the default connection pool. @param sql The SQL statement @param params The replacement parameters @return The List of generic Object[]s
[ "Return", "a", "List", "of", "generic", "Object", "[]", "s", "given", "an", "SQL", "statement", "using", "the", "default", "connection", "pool", "." ]
train
https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L665-L669
alipay/sofa-hessian
src/main/java/com/caucho/hessian/io/HessianOutput.java
HessianOutput.writeString
public void writeString(char[] buffer, int offset, int length) throws IOException { if (buffer == null) { os.write('N'); } else { while (length > 0x8000) { int sublen = 0x8000; // chunk can't end in high surrogate char tail = buffer[offset + sublen - 1]; if (0xd800 <= tail && tail <= 0xdbff) sublen--; os.write('s'); os.write(sublen >> 8); os.write(sublen); printString(buffer, offset, sublen); length -= sublen; offset += sublen; } os.write('S'); os.write(length >> 8); os.write(length); printString(buffer, offset, length); } }
java
public void writeString(char[] buffer, int offset, int length) throws IOException { if (buffer == null) { os.write('N'); } else { while (length > 0x8000) { int sublen = 0x8000; // chunk can't end in high surrogate char tail = buffer[offset + sublen - 1]; if (0xd800 <= tail && tail <= 0xdbff) sublen--; os.write('s'); os.write(sublen >> 8); os.write(sublen); printString(buffer, offset, sublen); length -= sublen; offset += sublen; } os.write('S'); os.write(length >> 8); os.write(length); printString(buffer, offset, length); } }
[ "public", "void", "writeString", "(", "char", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "if", "(", "buffer", "==", "null", ")", "{", "os", ".", "write", "(", "'", "'", ")", ";", "}", "else", ...
Writes a string value to the stream using UTF-8 encoding. The string will be written with the following syntax: <code><pre> S b16 b8 string-value </pre></code> If the value is null, it will be written as <code><pre> N </pre></code> @param value the string value to write.
[ "Writes", "a", "string", "value", "to", "the", "stream", "using", "UTF", "-", "8", "encoding", ".", "The", "string", "will", "be", "written", "with", "the", "following", "syntax", ":" ]
train
https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianOutput.java#L610-L642
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.createParameterDescriptions
public ParameterDescription[] createParameterDescriptions( MethodDescriptor md) { if (md == null) { return null; } Method method = md.getMethod(); Class<?>[] paramClasses = method.getParameterTypes(); int descriptionCount = paramClasses.length; if (acceptsSubstitution(md)) { descriptionCount--; } ParameterDescriptor[] pds = md.getParameterDescriptors(); ParameterDescription[] descriptions = new ParameterDescription[descriptionCount]; for (int i = 0; i < descriptions.length; i++) { TypeDescription type = createTypeDescription(paramClasses[i]); ParameterDescriptor pd = null; if (pds != null && i < pds.length) { pd = pds[i]; } descriptions[i] = new ParameterDescription(type, pd, this); } return descriptions; }
java
public ParameterDescription[] createParameterDescriptions( MethodDescriptor md) { if (md == null) { return null; } Method method = md.getMethod(); Class<?>[] paramClasses = method.getParameterTypes(); int descriptionCount = paramClasses.length; if (acceptsSubstitution(md)) { descriptionCount--; } ParameterDescriptor[] pds = md.getParameterDescriptors(); ParameterDescription[] descriptions = new ParameterDescription[descriptionCount]; for (int i = 0; i < descriptions.length; i++) { TypeDescription type = createTypeDescription(paramClasses[i]); ParameterDescriptor pd = null; if (pds != null && i < pds.length) { pd = pds[i]; } descriptions[i] = new ParameterDescription(type, pd, this); } return descriptions; }
[ "public", "ParameterDescription", "[", "]", "createParameterDescriptions", "(", "MethodDescriptor", "md", ")", "{", "if", "(", "md", "==", "null", ")", "{", "return", "null", ";", "}", "Method", "method", "=", "md", ".", "getMethod", "(", ")", ";", "Class"...
Returns an array of ParameterDescriptions to wrap and describe the parameters of the specified MethodDescriptor.
[ "Returns", "an", "array", "of", "ParameterDescriptions", "to", "wrap", "and", "describe", "the", "parameters", "of", "the", "specified", "MethodDescriptor", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L146-L175
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/chunkblock/ChunkCallbackRegistry.java
ChunkCallbackRegistry.processCallbacks
public CallbackResult<V> processCallbacks(Chunk chunk, Object... params) { //true = cancel => return Set<BlockPos> coords = ChunkBlockHandler.get().chunks(chunk).get(chunk); return processListeners(coords, chunk, params); }
java
public CallbackResult<V> processCallbacks(Chunk chunk, Object... params) { //true = cancel => return Set<BlockPos> coords = ChunkBlockHandler.get().chunks(chunk).get(chunk); return processListeners(coords, chunk, params); }
[ "public", "CallbackResult", "<", "V", ">", "processCallbacks", "(", "Chunk", "chunk", ",", "Object", "...", "params", ")", "{", "//true = cancel => return", "Set", "<", "BlockPos", ">", "coords", "=", "ChunkBlockHandler", ".", "get", "(", ")", ".", "chunks", ...
Processes the {@link IChunkCallback IChunkCallbacks} registered. @param chunk the chunk @param params the params @return the callback result
[ "Processes", "the", "{", "@link", "IChunkCallback", "IChunkCallbacks", "}", "registered", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunkblock/ChunkCallbackRegistry.java#L54-L59
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/form/CmsFormRow.java
CmsFormRow.setInfo
public void setInfo(final String info, final boolean isHtml) { if (info != null) { if (!CmsStringUtil.isEmptyOrWhitespaceOnly(info)) { initInfoStyle(); final Data tooltipData = new CmsFieldTooltip.Data(m_icon, info, isHtml); final Panel icon = m_icon; final Supplier<Data> dataSupplier = Suppliers.ofInstance(tooltipData); installTooltipEventHandlers(icon, dataSupplier); } } }
java
public void setInfo(final String info, final boolean isHtml) { if (info != null) { if (!CmsStringUtil.isEmptyOrWhitespaceOnly(info)) { initInfoStyle(); final Data tooltipData = new CmsFieldTooltip.Data(m_icon, info, isHtml); final Panel icon = m_icon; final Supplier<Data> dataSupplier = Suppliers.ofInstance(tooltipData); installTooltipEventHandlers(icon, dataSupplier); } } }
[ "public", "void", "setInfo", "(", "final", "String", "info", ",", "final", "boolean", "isHtml", ")", "{", "if", "(", "info", "!=", "null", ")", "{", "if", "(", "!", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "info", ")", ")", "{", "initInfoSty...
Shows the info icon and sets the information text as its title.<p> @param info the info @param isHtml true if info should be interpreted as HTML rather than plain text
[ "Shows", "the", "info", "icon", "and", "sets", "the", "information", "text", "as", "its", "title", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsFormRow.java#L247-L258
kopihao/peasy-recyclerview
peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyRecyclerView.java
PeasyRecyclerView.enhanceFAB
private void enhanceFAB(final FloatingActionButton fab, int dx, int dy) { if (isEnhancedFAB() && getFab() != null) { final FloatingActionButton mFloatingActionButton = this.fab; if (getLinearLayoutManager() != null) { if (dy > 0) { if (mFloatingActionButton.getVisibility() == View.VISIBLE) { mFloatingActionButton.hide(); } } else { if (mFloatingActionButton.getVisibility() != View.VISIBLE) { mFloatingActionButton.show(); } } } } }
java
private void enhanceFAB(final FloatingActionButton fab, int dx, int dy) { if (isEnhancedFAB() && getFab() != null) { final FloatingActionButton mFloatingActionButton = this.fab; if (getLinearLayoutManager() != null) { if (dy > 0) { if (mFloatingActionButton.getVisibility() == View.VISIBLE) { mFloatingActionButton.hide(); } } else { if (mFloatingActionButton.getVisibility() != View.VISIBLE) { mFloatingActionButton.show(); } } } } }
[ "private", "void", "enhanceFAB", "(", "final", "FloatingActionButton", "fab", ",", "int", "dx", ",", "int", "dy", ")", "{", "if", "(", "isEnhancedFAB", "(", ")", "&&", "getFab", "(", ")", "!=", "null", ")", "{", "final", "FloatingActionButton", "mFloatingA...
Enhanced FAB UX Logic Handle RecyclerView scrolling @param fab FloatingActionButton @param dx scrolling dx @param dy scrolling dy
[ "Enhanced", "FAB", "UX", "Logic", "Handle", "RecyclerView", "scrolling" ]
train
https://github.com/kopihao/peasy-recyclerview/blob/a26071849e5d5b5b1febe685f205558b49908f87/peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyRecyclerView.java#L218-L233
GoSimpleLLC/nbvcxz
src/main/java/me/gosimple/nbvcxz/matching/DictionaryMatcher.java
DictionaryMatcher.replaceAtIndex
private static void replaceAtIndex(final TreeMap<Integer, Character[]> replacements, Integer current_index, final char[] password, final List<String> final_passwords) { for (final char replacement : replacements.get(current_index)) { password[current_index] = replacement; if (current_index.equals(replacements.lastKey())) { final_passwords.add(new String(password)); } else if (final_passwords.size() > 100) { // Give up if we've already made 100 replacements return; } else { replaceAtIndex(replacements, replacements.higherKey(current_index), password, final_passwords); } } }
java
private static void replaceAtIndex(final TreeMap<Integer, Character[]> replacements, Integer current_index, final char[] password, final List<String> final_passwords) { for (final char replacement : replacements.get(current_index)) { password[current_index] = replacement; if (current_index.equals(replacements.lastKey())) { final_passwords.add(new String(password)); } else if (final_passwords.size() > 100) { // Give up if we've already made 100 replacements return; } else { replaceAtIndex(replacements, replacements.higherKey(current_index), password, final_passwords); } } }
[ "private", "static", "void", "replaceAtIndex", "(", "final", "TreeMap", "<", "Integer", ",", "Character", "[", "]", ">", "replacements", ",", "Integer", "current_index", ",", "final", "char", "[", "]", "password", ",", "final", "List", "<", "String", ">", ...
Internal function to recursively build the list of un-leet possibilities. @param replacements TreeMap of replacement index, and the possible characters at that index to be replaced @param current_index internal use for the function @param password a Character array of the original password @param final_passwords List of the final passwords to be filled
[ "Internal", "function", "to", "recursively", "build", "the", "list", "of", "un", "-", "leet", "possibilities", "." ]
train
https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/matching/DictionaryMatcher.java#L66-L85
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createGroup
public GitlabGroup createGroup(CreateGroupRequest request, GitlabUser sudoUser) throws IOException { Query query = request.toQuery(); query.appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null); String tailUrl = GitlabGroup.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroup.class); }
java
public GitlabGroup createGroup(CreateGroupRequest request, GitlabUser sudoUser) throws IOException { Query query = request.toQuery(); query.appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null); String tailUrl = GitlabGroup.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroup.class); }
[ "public", "GitlabGroup", "createGroup", "(", "CreateGroupRequest", "request", ",", "GitlabUser", "sudoUser", ")", "throws", "IOException", "{", "Query", "query", "=", "request", ".", "toQuery", "(", ")", ";", "query", ".", "appendIf", "(", "PARAM_SUDO", ",", "...
Creates a Group @param request An object that represents the parameters for the request. @param sudoUser The user for whom we're creating the group @return The GitLab Group @throws IOException on gitlab api call error
[ "Creates", "a", "Group" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L600-L607
sarl/sarl
main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java
MavenImportUtils.restorePom
static void restorePom(IProject project, IProgressMonitor monitor) throws CoreException { final IFile pomFile = project.getFile(POM_FILE); final IFile savedPomFile = project.getFile(POM_BACKUP_FILE); pomFile.refreshLocal(IResource.DEPTH_ZERO, monitor); savedPomFile.refreshLocal(IResource.DEPTH_ZERO, monitor); monitor.worked(1); if (savedPomFile.exists()) { final SubMonitor submon = SubMonitor.convert(monitor, 3); if (pomFile.exists()) { pomFile.delete(true, false, submon); } else { submon.worked(1); } savedPomFile.copy(pomFile.getFullPath(), true, submon); savedPomFile.delete(true, false, monitor); submon.worked(1); } else { monitor.worked(1); } }
java
static void restorePom(IProject project, IProgressMonitor monitor) throws CoreException { final IFile pomFile = project.getFile(POM_FILE); final IFile savedPomFile = project.getFile(POM_BACKUP_FILE); pomFile.refreshLocal(IResource.DEPTH_ZERO, monitor); savedPomFile.refreshLocal(IResource.DEPTH_ZERO, monitor); monitor.worked(1); if (savedPomFile.exists()) { final SubMonitor submon = SubMonitor.convert(monitor, 3); if (pomFile.exists()) { pomFile.delete(true, false, submon); } else { submon.worked(1); } savedPomFile.copy(pomFile.getFullPath(), true, submon); savedPomFile.delete(true, false, monitor); submon.worked(1); } else { monitor.worked(1); } }
[ "static", "void", "restorePom", "(", "IProject", "project", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "final", "IFile", "pomFile", "=", "project", ".", "getFile", "(", "POM_FILE", ")", ";", "final", "IFile", "savedPomFile", "=", ...
Restore the original pom file. @param project the project in which the pom file is located. @param monitor the progress monitor. @throws CoreException if the pom file cannot be changed.
[ "Restore", "the", "original", "pom", "file", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java#L218-L237
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.localSeo_visibilityCheck_POST
public OvhVisibilityCheckResponse localSeo_visibilityCheck_POST(OvhCountryEnum country, String name, String street, String zip) throws IOException { String qPath = "/hosting/web/localSeo/visibilityCheck"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "country", country); addBody(o, "name", name); addBody(o, "street", street); addBody(o, "zip", zip); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVisibilityCheckResponse.class); }
java
public OvhVisibilityCheckResponse localSeo_visibilityCheck_POST(OvhCountryEnum country, String name, String street, String zip) throws IOException { String qPath = "/hosting/web/localSeo/visibilityCheck"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "country", country); addBody(o, "name", name); addBody(o, "street", street); addBody(o, "zip", zip); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVisibilityCheckResponse.class); }
[ "public", "OvhVisibilityCheckResponse", "localSeo_visibilityCheck_POST", "(", "OvhCountryEnum", "country", ",", "String", "name", ",", "String", "street", ",", "String", "zip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/localSeo/visibilityC...
Check visibility of a location REST: POST /hosting/web/localSeo/visibilityCheck @param name [required] Name of the location @param country [required] Country of the location @param street [required] Address line 1 of the location @param zip [required] Zipcode of the location
[ "Check", "visibility", "of", "a", "location" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2211-L2221
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.data_afnicCorporationTrademarkInformation_POST
public OvhAfnicCorporationTrademarkContact data_afnicCorporationTrademarkInformation_POST(Long contactId, String inpiNumber, String inpiTrademarkOwner) throws IOException { String qPath = "/domain/data/afnicCorporationTrademarkInformation"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "contactId", contactId); addBody(o, "inpiNumber", inpiNumber); addBody(o, "inpiTrademarkOwner", inpiTrademarkOwner); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhAfnicCorporationTrademarkContact.class); }
java
public OvhAfnicCorporationTrademarkContact data_afnicCorporationTrademarkInformation_POST(Long contactId, String inpiNumber, String inpiTrademarkOwner) throws IOException { String qPath = "/domain/data/afnicCorporationTrademarkInformation"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "contactId", contactId); addBody(o, "inpiNumber", inpiNumber); addBody(o, "inpiTrademarkOwner", inpiTrademarkOwner); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhAfnicCorporationTrademarkContact.class); }
[ "public", "OvhAfnicCorporationTrademarkContact", "data_afnicCorporationTrademarkInformation_POST", "(", "Long", "contactId", ",", "String", "inpiNumber", ",", "String", "inpiTrademarkOwner", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/data/afnicCorpora...
Post a new corporation trademark information according to Afnic REST: POST /domain/data/afnicCorporationTrademarkInformation @param inpiNumber [required] Number of the Inpi declaration @param inpiTrademarkOwner [required] Owner of the trademark @param contactId [required] Contact ID related to the Inpi additional information
[ "Post", "a", "new", "corporation", "trademark", "information", "according", "to", "Afnic" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L95-L104
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java
CertificatesImpl.cancelDeletion
public void cancelDeletion(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions) { cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateCancelDeletionOptions).toBlocking().single().body(); }
java
public void cancelDeletion(String thumbprintAlgorithm, String thumbprint, CertificateCancelDeletionOptions certificateCancelDeletionOptions) { cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint, certificateCancelDeletionOptions).toBlocking().single().body(); }
[ "public", "void", "cancelDeletion", "(", "String", "thumbprintAlgorithm", ",", "String", "thumbprint", ",", "CertificateCancelDeletionOptions", "certificateCancelDeletionOptions", ")", "{", "cancelDeletionWithServiceResponseAsync", "(", "thumbprintAlgorithm", ",", "thumbprint", ...
Cancels a failed deletion of a certificate from the specified account. If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. @param thumbprint The thumbprint of the certificate being deleted. @param certificateCancelDeletionOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Cancels", "a", "failed", "deletion", "of", "a", "certificate", "from", "the", "specified", "account", ".", "If", "you", "try", "to", "delete", "a", "certificate", "that", "is", "being", "used", "by", "a", "pool", "or", "compute", "node", "the", "status", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java#L675-L677
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/OutputPropertiesFactory.java
OutputPropertiesFactory.fixupPropertyString
static private String fixupPropertyString(String s, boolean doClipping) { int index; if (doClipping && s.startsWith(S_XSLT_PREFIX)) { s = s.substring(S_XSLT_PREFIX_LEN); } if (s.startsWith(S_XALAN_PREFIX)) { s = S_BUILTIN_EXTENSIONS_UNIVERSAL + s.substring(S_XALAN_PREFIX_LEN); } if ((index = s.indexOf("\\u003a")) > 0) { String temp = s.substring(index + 6); s = s.substring(0, index) + ":" + temp; } return s; }
java
static private String fixupPropertyString(String s, boolean doClipping) { int index; if (doClipping && s.startsWith(S_XSLT_PREFIX)) { s = s.substring(S_XSLT_PREFIX_LEN); } if (s.startsWith(S_XALAN_PREFIX)) { s = S_BUILTIN_EXTENSIONS_UNIVERSAL + s.substring(S_XALAN_PREFIX_LEN); } if ((index = s.indexOf("\\u003a")) > 0) { String temp = s.substring(index + 6); s = s.substring(0, index) + ":" + temp; } return s; }
[ "static", "private", "String", "fixupPropertyString", "(", "String", "s", ",", "boolean", "doClipping", ")", "{", "int", "index", ";", "if", "(", "doClipping", "&&", "s", ".", "startsWith", "(", "S_XSLT_PREFIX", ")", ")", "{", "s", "=", "s", ".", "substr...
Fix up a string in an output properties file according to the rules of {@link #loadPropertiesFile}. @param s non-null reference to string that may need to be fixed up. @return A new string if fixup occured, otherwise the s argument.
[ "Fix", "up", "a", "string", "in", "an", "output", "properties", "file", "according", "to", "the", "rules", "of", "{", "@link", "#loadPropertiesFile", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/OutputPropertiesFactory.java#L516-L536
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoMaterial.java
ContentCryptoMaterial.parseInstructionFile
static String parseInstructionFile(S3Object instructionFile) { try { return convertStreamToString(instructionFile.getObjectContent()); } catch (Exception e) { throw failure(e, "Error parsing JSON instruction file"); } }
java
static String parseInstructionFile(S3Object instructionFile) { try { return convertStreamToString(instructionFile.getObjectContent()); } catch (Exception e) { throw failure(e, "Error parsing JSON instruction file"); } }
[ "static", "String", "parseInstructionFile", "(", "S3Object", "instructionFile", ")", "{", "try", "{", "return", "convertStreamToString", "(", "instructionFile", ".", "getObjectContent", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", ...
Parses instruction data retrieved from S3 and returns a JSON string representing the instruction. Made for testing purposes.
[ "Parses", "instruction", "data", "retrieved", "from", "S3", "and", "returns", "a", "JSON", "string", "representing", "the", "instruction", ".", "Made", "for", "testing", "purposes", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoMaterial.java#L562-L568
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/executors/IteratorExecutor.java
IteratorExecutor.logFailures
public static <T> void logFailures(List<Either<T, ExecutionException>> results, Logger useLogger, int atMost) { Logger actualLogger = useLogger == null ? log : useLogger; Iterator<Either<T, ExecutionException>> it = results.iterator(); int printed = 0; while (it.hasNext()) { Either<T, ExecutionException> nextResult = it.next(); if (nextResult instanceof Either.Right) { ExecutionException exc = ((Either.Right<T, ExecutionException>) nextResult).getRight(); actualLogger.error("Iterator executor failure.", exc); printed++; if (printed >= atMost) { return; } } } }
java
public static <T> void logFailures(List<Either<T, ExecutionException>> results, Logger useLogger, int atMost) { Logger actualLogger = useLogger == null ? log : useLogger; Iterator<Either<T, ExecutionException>> it = results.iterator(); int printed = 0; while (it.hasNext()) { Either<T, ExecutionException> nextResult = it.next(); if (nextResult instanceof Either.Right) { ExecutionException exc = ((Either.Right<T, ExecutionException>) nextResult).getRight(); actualLogger.error("Iterator executor failure.", exc); printed++; if (printed >= atMost) { return; } } } }
[ "public", "static", "<", "T", ">", "void", "logFailures", "(", "List", "<", "Either", "<", "T", ",", "ExecutionException", ">", ">", "results", ",", "Logger", "useLogger", ",", "int", "atMost", ")", "{", "Logger", "actualLogger", "=", "useLogger", "==", ...
Log failures in the output of {@link #executeAndGetResults()}. @param results output of {@link #executeAndGetResults()} @param useLogger logger to log the messages into. @param atMost will log at most this many errors.
[ "Log", "failures", "in", "the", "output", "of", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/executors/IteratorExecutor.java#L155-L170
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java
AbstractController.getUserData
protected <T> Optional<T> getUserData(Optional<? extends Node> node, Class<T> type) { if (node.isPresent()) { final Node n = node.get(); return getValue(n, n::getUserData, type); } return Optional.empty(); }
java
protected <T> Optional<T> getUserData(Optional<? extends Node> node, Class<T> type) { if (node.isPresent()) { final Node n = node.get(); return getValue(n, n::getUserData, type); } return Optional.empty(); }
[ "protected", "<", "T", ">", "Optional", "<", "T", ">", "getUserData", "(", "Optional", "<", "?", "extends", "Node", ">", "node", ",", "Class", "<", "T", ">", "type", ")", "{", "if", "(", "node", ".", "isPresent", "(", ")", ")", "{", "final", "Nod...
Gets the user data. @param node the node @param type the cls @param <T> the generic type @return the user data
[ "Gets", "the", "user", "data", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java#L315-L321
dustin/java-memcached-client
src/main/java/net/spy/memcached/compat/log/AbstractLogger.java
AbstractLogger.warn
public void warn(String message, Object... args) { warn(String.format(message, args), getThrowable(args)); }
java
public void warn(String message, Object... args) { warn(String.format(message, args), getThrowable(args)); }
[ "public", "void", "warn", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "warn", "(", "String", ".", "format", "(", "message", ",", "args", ")", ",", "getThrowable", "(", "args", ")", ")", ";", "}" ]
Log a formatted message at debug level. @param message the message to log @param args the arguments for that message
[ "Log", "a", "formatted", "message", "at", "debug", "level", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/compat/log/AbstractLogger.java#L190-L192
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/WishlistUrl.java
WishlistUrl.updateWishlistUrl
public static MozuUrl updateWishlistUrl(String responseFields, String wishlistId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/{wishlistId}?responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("wishlistId", wishlistId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateWishlistUrl(String responseFields, String wishlistId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/{wishlistId}?responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("wishlistId", wishlistId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateWishlistUrl", "(", "String", "responseFields", ",", "String", "wishlistId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/wishlists/{wishlistId}?responseFields={responseFields}\"", ")", ";", "f...
Get Resource Url for UpdateWishlist @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param wishlistId Unique identifier of the wish list. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateWishlist" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/WishlistUrl.java#L88-L94
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.offlineRegionAsync
public Observable<Void> offlineRegionAsync(String resourceGroupName, String accountName, String region) { return offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> offlineRegionAsync(String resourceGroupName, String accountName, String region) { return offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "offlineRegionAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "region", ")", "{", "return", "offlineRegionWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "...
Offline the specified region for the specified Azure Cosmos DB database account. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param region Cosmos DB region, with spaces between words and each word capitalized. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Offline", "the", "specified", "region", "for", "the", "specified", "Azure", "Cosmos", "DB", "database", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1311-L1318
aws/aws-sdk-java
aws-java-sdk-iam/src/main/java/com/amazonaws/services/identitymanagement/waiters/AmazonIdentityManagementWaiters.java
AmazonIdentityManagementWaiters.instanceProfileExists
public Waiter<GetInstanceProfileRequest> instanceProfileExists() { return new WaiterBuilder<GetInstanceProfileRequest, GetInstanceProfileResult>().withSdkFunction(new GetInstanceProfileFunction(client)) .withAcceptors(new HttpSuccessStatusAcceptor(WaiterState.SUCCESS), new HttpFailureStatusAcceptor(404, WaiterState.RETRY)) .withDefaultPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(40), new FixedDelayStrategy(1))) .withExecutorService(executorService).build(); }
java
public Waiter<GetInstanceProfileRequest> instanceProfileExists() { return new WaiterBuilder<GetInstanceProfileRequest, GetInstanceProfileResult>().withSdkFunction(new GetInstanceProfileFunction(client)) .withAcceptors(new HttpSuccessStatusAcceptor(WaiterState.SUCCESS), new HttpFailureStatusAcceptor(404, WaiterState.RETRY)) .withDefaultPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(40), new FixedDelayStrategy(1))) .withExecutorService(executorService).build(); }
[ "public", "Waiter", "<", "GetInstanceProfileRequest", ">", "instanceProfileExists", "(", ")", "{", "return", "new", "WaiterBuilder", "<", "GetInstanceProfileRequest", ",", "GetInstanceProfileResult", ">", "(", ")", ".", "withSdkFunction", "(", "new", "GetInstanceProfile...
Builds a InstanceProfileExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification, and then polls until it determines whether the resource entered the desired state or not, where polling criteria is bound by either default polling strategy or custom polling strategy.
[ "Builds", "a", "InstanceProfileExists", "waiter", "by", "using", "custom", "parameters", "waiterParameters", "and", "other", "parameters", "defined", "in", "the", "waiters", "specification", "and", "then", "polls", "until", "it", "determines", "whether", "the", "res...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iam/src/main/java/com/amazonaws/services/identitymanagement/waiters/AmazonIdentityManagementWaiters.java#L64-L70
alkacon/opencms-core
src/org/opencms/security/CmsRoleManager.java
CmsRoleManager.getManageableUsers
public List<CmsUser> getManageableUsers(CmsObject cms, String ouFqn, boolean includeSubOus) throws CmsException { return getManageableUsers(cms, ouFqn, includeSubOus, false); }
java
public List<CmsUser> getManageableUsers(CmsObject cms, String ouFqn, boolean includeSubOus) throws CmsException { return getManageableUsers(cms, ouFqn, includeSubOus, false); }
[ "public", "List", "<", "CmsUser", ">", "getManageableUsers", "(", "CmsObject", "cms", ",", "String", "ouFqn", ",", "boolean", "includeSubOus", ")", "throws", "CmsException", "{", "return", "getManageableUsers", "(", "cms", ",", "ouFqn", ",", "includeSubOus", ","...
Returns all users of organizational units for which the current user has the {@link CmsRole#ACCOUNT_MANAGER} role.<p> @param cms the current cms context @param ouFqn the fully qualified name of the organizational unit @param includeSubOus if sub organizational units should be included in the search @return a list of {@link org.opencms.file.CmsUser} objects @throws CmsException if something goes wrong
[ "Returns", "all", "users", "of", "organizational", "units", "for", "which", "the", "current", "user", "has", "the", "{", "@link", "CmsRole#ACCOUNT_MANAGER", "}", "role", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsRoleManager.java#L202-L205
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_hunting_agent_POST
public OvhOvhPabxHuntingAgent billingAccount_ovhPabx_serviceName_hunting_agent_POST(String billingAccount, String serviceName, String description, String number, Long simultaneousLines, OvhOvhPabxHuntingAgentStatusEnum status, Long timeout, Long wrapUpTime) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "number", number); addBody(o, "simultaneousLines", simultaneousLines); addBody(o, "status", status); addBody(o, "timeout", timeout); addBody(o, "wrapUpTime", wrapUpTime); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxHuntingAgent.class); }
java
public OvhOvhPabxHuntingAgent billingAccount_ovhPabx_serviceName_hunting_agent_POST(String billingAccount, String serviceName, String description, String number, Long simultaneousLines, OvhOvhPabxHuntingAgentStatusEnum status, Long timeout, Long wrapUpTime) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "number", number); addBody(o, "simultaneousLines", simultaneousLines); addBody(o, "status", status); addBody(o, "timeout", timeout); addBody(o, "wrapUpTime", wrapUpTime); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxHuntingAgent.class); }
[ "public", "OvhOvhPabxHuntingAgent", "billingAccount_ovhPabx_serviceName_hunting_agent_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "description", ",", "String", "number", ",", "Long", "simultaneousLines", ",", "OvhOvhPabxHuntingAgentStatu...
Create a new agent REST: POST /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent @param number [required] The number of the agent @param simultaneousLines [required] The maximum of simultaneous calls that the agent will receive from the hunting @param description [required] The agent's description @param status [required] The current status of the agent @param wrapUpTime [required] The wrap up time (in seconds) after the calls @param timeout [required] The waiting timeout (in seconds) before hangup for an assigned called @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Create", "a", "new", "agent" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6043-L6055
line/armeria
saml/src/main/java/com/linecorp/armeria/server/saml/KeyStoreCredentialResolverBuilder.java
KeyStoreCredentialResolverBuilder.addKeyPasswords
public KeyStoreCredentialResolverBuilder addKeyPasswords(Map<String, String> keyPasswords) { requireNonNull(keyPasswords, "keyPasswords"); keyPasswords.forEach(this::addKeyPassword); return this; }
java
public KeyStoreCredentialResolverBuilder addKeyPasswords(Map<String, String> keyPasswords) { requireNonNull(keyPasswords, "keyPasswords"); keyPasswords.forEach(this::addKeyPassword); return this; }
[ "public", "KeyStoreCredentialResolverBuilder", "addKeyPasswords", "(", "Map", "<", "String", ",", "String", ">", "keyPasswords", ")", "{", "requireNonNull", "(", "keyPasswords", ",", "\"keyPasswords\"", ")", ";", "keyPasswords", ".", "forEach", "(", "this", "::", ...
Adds all key names and their passwords which are specified by the {@code keyPasswords}.
[ "Adds", "all", "key", "names", "and", "their", "passwords", "which", "are", "specified", "by", "the", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/saml/src/main/java/com/linecorp/armeria/server/saml/KeyStoreCredentialResolverBuilder.java#L108-L112
wildfly/wildfly-core
domain-http/interface/src/main/java/org/jboss/as/domain/http/server/DomainUtil.java
DomainUtil.constructUrl
public static String constructUrl(final HttpServerExchange exchange, final String path) { final HeaderMap headers = exchange.getRequestHeaders(); String host = headers.getFirst(HOST); String protocol = exchange.getConnection().getSslSessionInfo() != null ? "https" : "http"; return protocol + "://" + host + path; }
java
public static String constructUrl(final HttpServerExchange exchange, final String path) { final HeaderMap headers = exchange.getRequestHeaders(); String host = headers.getFirst(HOST); String protocol = exchange.getConnection().getSslSessionInfo() != null ? "https" : "http"; return protocol + "://" + host + path; }
[ "public", "static", "String", "constructUrl", "(", "final", "HttpServerExchange", "exchange", ",", "final", "String", "path", ")", "{", "final", "HeaderMap", "headers", "=", "exchange", ".", "getRequestHeaders", "(", ")", ";", "String", "host", "=", "headers", ...
Based on the current request represented by the HttpExchange construct a complete URL for the supplied path. @param exchange - The current HttpExchange @param path - The path to include in the constructed URL @return The constructed URL
[ "Based", "on", "the", "current", "request", "represented", "by", "the", "HttpExchange", "construct", "a", "complete", "URL", "for", "the", "supplied", "path", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/DomainUtil.java#L205-L211
grandstaish/paperparcel
paperparcel-compiler/src/main/java/paperparcel/Utils.java
Utils.isSingleton
static boolean isSingleton(Types types, TypeElement element) { return isSingleton(types, element, element.asType()); }
java
static boolean isSingleton(Types types, TypeElement element) { return isSingleton(types, element, element.asType()); }
[ "static", "boolean", "isSingleton", "(", "Types", "types", ",", "TypeElement", "element", ")", "{", "return", "isSingleton", "(", "types", ",", "element", ",", "element", ".", "asType", "(", ")", ")", ";", "}" ]
A singleton is defined by a class with a public static final field named "INSTANCE" with a type assignable from itself.
[ "A", "singleton", "is", "defined", "by", "a", "class", "with", "a", "public", "static", "final", "field", "named", "INSTANCE", "with", "a", "type", "assignable", "from", "itself", "." ]
train
https://github.com/grandstaish/paperparcel/blob/917686ced81b335b6708d81d6cc0e3e496f7280d/paperparcel-compiler/src/main/java/paperparcel/Utils.java#L334-L336
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java
BetterCFGBuilder2.inlineAll
private CFG inlineAll() throws CFGBuilderException { CFG result = new CFG(); Context rootContext = new Context(null, topLevelSubroutine, result); rootContext.mapBlock(topLevelSubroutine.getEntry(), result.getEntry()); rootContext.mapBlock(topLevelSubroutine.getExit(), result.getExit()); BasicBlock resultStartBlock = rootContext.getBlock(topLevelSubroutine.getStartBlock()); result.createEdge(result.getEntry(), resultStartBlock, START_EDGE); inline(rootContext); return result; }
java
private CFG inlineAll() throws CFGBuilderException { CFG result = new CFG(); Context rootContext = new Context(null, topLevelSubroutine, result); rootContext.mapBlock(topLevelSubroutine.getEntry(), result.getEntry()); rootContext.mapBlock(topLevelSubroutine.getExit(), result.getExit()); BasicBlock resultStartBlock = rootContext.getBlock(topLevelSubroutine.getStartBlock()); result.createEdge(result.getEntry(), resultStartBlock, START_EDGE); inline(rootContext); return result; }
[ "private", "CFG", "inlineAll", "(", ")", "throws", "CFGBuilderException", "{", "CFG", "result", "=", "new", "CFG", "(", ")", ";", "Context", "rootContext", "=", "new", "Context", "(", "null", ",", "topLevelSubroutine", ",", "result", ")", ";", "rootContext",...
Inline all JSR subroutines into the top-level subroutine. This produces a complete CFG for the entire method, in which all JSR subroutines are inlined. @return the CFG for the method
[ "Inline", "all", "JSR", "subroutines", "into", "the", "top", "-", "level", "subroutine", ".", "This", "produces", "a", "complete", "CFG", "for", "the", "entire", "method", "in", "which", "all", "JSR", "subroutines", "are", "inlined", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BetterCFGBuilder2.java#L1098-L1111
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/base/Preconditions.java
Preconditions.checkNotNull
@CanIgnoreReturnValue public static <T> T checkNotNull( T reference, @Nullable String errorMessageTemplate, @Nullable Object... errorMessageArgs) { if (reference == null) { // If either of these parameters is null, the right thing happens anyway throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs)); } return reference; }
java
@CanIgnoreReturnValue public static <T> T checkNotNull( T reference, @Nullable String errorMessageTemplate, @Nullable Object... errorMessageArgs) { if (reference == null) { // If either of these parameters is null, the right thing happens anyway throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs)); } return reference; }
[ "@", "CanIgnoreReturnValue", "public", "static", "<", "T", ">", "T", "checkNotNull", "(", "T", "reference", ",", "@", "Nullable", "String", "errorMessageTemplate", ",", "@", "Nullable", "Object", "...", "errorMessageArgs", ")", "{", "if", "(", "reference", "==...
Ensures that an object reference passed as a parameter to the calling method is not null. @param reference an object reference @param errorMessageTemplate a template for the exception message should the check fail. The message is formed by replacing each {@code %s} placeholder in the template with an argument. These are matched by position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc. Unmatched arguments will be appended to the formatted message in square braces. Unmatched placeholders will be left as-is. @param errorMessageArgs the arguments to be substituted into the message template. Arguments are converted to strings using {@link String#valueOf(Object)}. @return the non-null reference that was validated @throws NullPointerException if {@code reference} is null
[ "Ensures", "that", "an", "object", "reference", "passed", "as", "a", "parameter", "to", "the", "calling", "method", "is", "not", "null", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/base/Preconditions.java#L806-L814
protostuff/protostuff
protostuff-core/src/main/java/io/protostuff/GraphIOUtil.java
GraphIOUtil.optMergeDelimitedFrom
public static <T> boolean optMergeDelimitedFrom(InputStream in, T message, Schema<T> schema, LinkedBuffer buffer) throws IOException { return optMergeDelimitedFrom(in, message, schema, true, buffer); }
java
public static <T> boolean optMergeDelimitedFrom(InputStream in, T message, Schema<T> schema, LinkedBuffer buffer) throws IOException { return optMergeDelimitedFrom(in, message, schema, true, buffer); }
[ "public", "static", "<", "T", ">", "boolean", "optMergeDelimitedFrom", "(", "InputStream", "in", ",", "T", "message", ",", "Schema", "<", "T", ">", "schema", ",", "LinkedBuffer", "buffer", ")", "throws", "IOException", "{", "return", "optMergeDelimitedFrom", "...
Optimal/Optional mergeDelimitedFrom - If the message does not fit the buffer, no merge is done and this method will return false. <p> This is strictly for reading a single message from the stream because the buffer is aggressively filled when reading the delimited size (which could result into reading more bytes than it has to). <p> The remaining bytes will be drained (consumed and discared) when the message is too large.
[ "Optimal", "/", "Optional", "mergeDelimitedFrom", "-", "If", "the", "message", "does", "not", "fit", "the", "buffer", "no", "merge", "is", "done", "and", "this", "method", "will", "return", "false", ".", "<p", ">", "This", "is", "strictly", "for", "reading...
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-core/src/main/java/io/protostuff/GraphIOUtil.java#L361-L366
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_fan_speed.java
xen_health_monitor_fan_speed.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_monitor_fan_speed_responses result = (xen_health_monitor_fan_speed_responses) service.get_payload_formatter().string_to_resource(xen_health_monitor_fan_speed_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_monitor_fan_speed_response_array); } xen_health_monitor_fan_speed[] result_xen_health_monitor_fan_speed = new xen_health_monitor_fan_speed[result.xen_health_monitor_fan_speed_response_array.length]; for(int i = 0; i < result.xen_health_monitor_fan_speed_response_array.length; i++) { result_xen_health_monitor_fan_speed[i] = result.xen_health_monitor_fan_speed_response_array[i].xen_health_monitor_fan_speed[0]; } return result_xen_health_monitor_fan_speed; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_monitor_fan_speed_responses result = (xen_health_monitor_fan_speed_responses) service.get_payload_formatter().string_to_resource(xen_health_monitor_fan_speed_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_monitor_fan_speed_response_array); } xen_health_monitor_fan_speed[] result_xen_health_monitor_fan_speed = new xen_health_monitor_fan_speed[result.xen_health_monitor_fan_speed_response_array.length]; for(int i = 0; i < result.xen_health_monitor_fan_speed_response_array.length; i++) { result_xen_health_monitor_fan_speed[i] = result.xen_health_monitor_fan_speed_response_array[i].xen_health_monitor_fan_speed[0]; } return result_xen_health_monitor_fan_speed; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_health_monitor_fan_speed_responses", "result", "=", "(", "xen_health_monitor_fan_speed_responses", ")", "serv...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_fan_speed.java#L173-L190
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java
ParseUtils.duplicateAttribute
public static XMLStreamException duplicateAttribute(final XMLStreamReader reader, final String name) { return new XMLStreamException("An attribute named '" + name + "' has already been declared", reader.getLocation()); }
java
public static XMLStreamException duplicateAttribute(final XMLStreamReader reader, final String name) { return new XMLStreamException("An attribute named '" + name + "' has already been declared", reader.getLocation()); }
[ "public", "static", "XMLStreamException", "duplicateAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "name", ")", "{", "return", "new", "XMLStreamException", "(", "\"An attribute named '\"", "+", "name", "+", "\"' has already been declared\""...
Get an exception reporting that an attribute of a given name has already been declared in this scope. @param reader the stream reader @param name the name that was redeclared @return the exception
[ "Get", "an", "exception", "reporting", "that", "an", "attribute", "of", "a", "given", "name", "has", "already", "been", "declared", "in", "this", "scope", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java#L154-L156
jblas-project/jblas
src/main/java/org/jblas/util/LibraryLoader.java
LibraryLoader.loadLibrary
public void loadLibrary(String libname, boolean withFlavor) { // preload flavor libraries String flavor = null; if (withFlavor) { logger.debug("Preloading ArchFlavor library."); flavor = ArchFlavor.archFlavor(); if (flavor != null && flavor.equals("sse2")) { throw new UnsupportedArchitectureException("Support for SSE2 processors stopped with version 1.2.2. Sorry."); } } logger.debug("Found flavor = '" + flavor + "'"); libname = System.mapLibraryName(libname); /* * JDK 7 changed the ending for Mac OS from "jnilib" to "dylib". * * If that is the case, remap the filename. */ String loadLibname = libname; if (libname.endsWith("dylib")) { loadLibname = libname.replace(".dylib", ".jnilib"); logger.config("Replaced .dylib with .jnilib"); } logger.debug("Attempting to load \"" + loadLibname + "\"."); String[] paths = { fatJarLibraryPath("static", flavor), fatJarLibraryPath("dynamic", flavor), }; InputStream is = findLibrary(paths, loadLibname); // Haven't found the lib anywhere? Throw a reception. if (is == null) { throw new UnsatisfiedLinkError("Couldn't find the resource " + loadLibname + "."); } logger.config("Loading " + loadLibname + " from " + libpath + ", copying to " + libname + "."); loadLibraryFromStream(libname, is); }
java
public void loadLibrary(String libname, boolean withFlavor) { // preload flavor libraries String flavor = null; if (withFlavor) { logger.debug("Preloading ArchFlavor library."); flavor = ArchFlavor.archFlavor(); if (flavor != null && flavor.equals("sse2")) { throw new UnsupportedArchitectureException("Support for SSE2 processors stopped with version 1.2.2. Sorry."); } } logger.debug("Found flavor = '" + flavor + "'"); libname = System.mapLibraryName(libname); /* * JDK 7 changed the ending for Mac OS from "jnilib" to "dylib". * * If that is the case, remap the filename. */ String loadLibname = libname; if (libname.endsWith("dylib")) { loadLibname = libname.replace(".dylib", ".jnilib"); logger.config("Replaced .dylib with .jnilib"); } logger.debug("Attempting to load \"" + loadLibname + "\"."); String[] paths = { fatJarLibraryPath("static", flavor), fatJarLibraryPath("dynamic", flavor), }; InputStream is = findLibrary(paths, loadLibname); // Haven't found the lib anywhere? Throw a reception. if (is == null) { throw new UnsatisfiedLinkError("Couldn't find the resource " + loadLibname + "."); } logger.config("Loading " + loadLibname + " from " + libpath + ", copying to " + libname + "."); loadLibraryFromStream(libname, is); }
[ "public", "void", "loadLibrary", "(", "String", "libname", ",", "boolean", "withFlavor", ")", "{", "// preload flavor libraries\r", "String", "flavor", "=", "null", ";", "if", "(", "withFlavor", ")", "{", "logger", ".", "debug", "(", "\"Preloading ArchFlavor libra...
<p>Find the library <tt>libname</tt> as a resource, copy it to a tempfile and load it using System.load(). The name of the library has to be the base name, it is mapped to the corresponding system name using System.mapLibraryName(). For example, the library "foo" is called "libfoo.so" under Linux and "foo.dll" under Windows, but you just have to pass "foo" the loadLibrary().</p> <p/> <p>I'm not quite sure if this doesn't open all kinds of security holes. Any ideas?</p> <p/> <p>This function reports some more information to the "org.jblas" logger at the FINE level.</p> @param libname basename of the library @throws UnsatisfiedLinkError if library cannot be founds
[ "<p", ">", "Find", "the", "library", "<tt", ">", "libname<", "/", "tt", ">", "as", "a", "resource", "copy", "it", "to", "a", "tempfile", "and", "load", "it", "using", "System", ".", "load", "()", ".", "The", "name", "of", "the", "library", "has", "...
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/LibraryLoader.java#L146-L187
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.rollDateTime
public static java.util.Date rollDateTime(java.util.Date startDate, int period, int amount) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(startDate); gc.add(period, amount); return new java.util.Date(gc.getTime().getTime()); }
java
public static java.util.Date rollDateTime(java.util.Date startDate, int period, int amount) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(startDate); gc.add(period, amount); return new java.util.Date(gc.getTime().getTime()); }
[ "public", "static", "java", ".", "util", ".", "Date", "rollDateTime", "(", "java", ".", "util", ".", "Date", "startDate", ",", "int", "period", ",", "int", "amount", ")", "{", "GregorianCalendar", "gc", "=", "new", "GregorianCalendar", "(", ")", ";", "gc...
Roll the java.util.Date forward or backward. @param startDate - The start date @param period Calendar.YEAR etc @param amount - Negative to rollbackwards.
[ "Roll", "the", "java", ".", "util", ".", "Date", "forward", "or", "backward", "." ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L155-L160
CloudSlang/cs-actions
cs-json/src/main/java/io/cloudslang/content/json/actions/GetValueFromObject.java
GetValueFromObject.execute
@Action(name = "Get Value from Object", outputs = { @Output(OutputNames.RETURN_RESULT), @Output(OutputNames.RETURN_CODE), @Output(OutputNames.EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> execute( @Param(value = Constants.InputNames.OBJECT, required = true) String object, @Param(value = Constants.InputNames.KEY, required = true) String key) { Map<String, String> returnResult = new HashMap<>(); if (StringUtilities.isBlank(object)) { return populateResult(returnResult, new Exception("Empty object provided!")); } if (key == null) { return populateResult(returnResult, new Exception("Null key provided!")); } final JsonNode jsonRoot; ObjectMapper objectMapper = new ObjectMapper(); try { jsonRoot = objectMapper.readTree(object); } catch (Exception exception) { final String value = "Invalid object provided! " + exception.getMessage(); return populateResult(returnResult, value, exception); } int startIndex = 0; final JsonNode valueFromObject; try { valueFromObject = getObject(jsonRoot, key.split(ESCAPED_SLASH + "."), startIndex); } catch (Exception exception) { return populateResult(returnResult, exception); } if (valueFromObject.isValueNode()) { return populateResult(returnResult, valueFromObject.asText(), null); } else { return populateResult(returnResult, valueFromObject.toString(), null); } }
java
@Action(name = "Get Value from Object", outputs = { @Output(OutputNames.RETURN_RESULT), @Output(OutputNames.RETURN_CODE), @Output(OutputNames.EXCEPTION) }, responses = { @Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true) }) public Map<String, String> execute( @Param(value = Constants.InputNames.OBJECT, required = true) String object, @Param(value = Constants.InputNames.KEY, required = true) String key) { Map<String, String> returnResult = new HashMap<>(); if (StringUtilities.isBlank(object)) { return populateResult(returnResult, new Exception("Empty object provided!")); } if (key == null) { return populateResult(returnResult, new Exception("Null key provided!")); } final JsonNode jsonRoot; ObjectMapper objectMapper = new ObjectMapper(); try { jsonRoot = objectMapper.readTree(object); } catch (Exception exception) { final String value = "Invalid object provided! " + exception.getMessage(); return populateResult(returnResult, value, exception); } int startIndex = 0; final JsonNode valueFromObject; try { valueFromObject = getObject(jsonRoot, key.split(ESCAPED_SLASH + "."), startIndex); } catch (Exception exception) { return populateResult(returnResult, exception); } if (valueFromObject.isValueNode()) { return populateResult(returnResult, valueFromObject.asText(), null); } else { return populateResult(returnResult, valueFromObject.toString(), null); } }
[ "@", "Action", "(", "name", "=", "\"Get Value from Object\"", ",", "outputs", "=", "{", "@", "Output", "(", "OutputNames", ".", "RETURN_RESULT", ")", ",", "@", "Output", "(", "OutputNames", ".", "RETURN_CODE", ")", ",", "@", "Output", "(", "OutputNames", "...
This operation accepts an object in the JavaScript Object Notation format (JSON) and returns a value for the specified key. @param object The string representation of a JSON object. Objects in JSON are a collection of name value pairs, separated by a colon and surrounded with curly brackets {}. The name must be a string value, and the value can be a single string or any valid JSON object or array. Examples: {"one":1, "two":2}, {"one":{"a":"a","B":"B"}, "two":"two", "three":[1,2,3.4]} @param key The key in the object to get the value of. Examples: city, location[0].city @return a map containing the output of the operation. Keys present in the map are: <p/> <br><br><b>returnResult</b> - This will contain the value for the specified key in the object. <br><b>exception</b> - In case of success response, this result is empty. In case of failure response, this result contains the java stack trace of the runtime exception. <br><br><b>returnCode</b> - The returnCode of the operation: 0 for success, -1 for failure.
[ "This", "operation", "accepts", "an", "object", "in", "the", "JavaScript", "Object", "Notation", "format", "(", "JSON", ")", "and", "returns", "a", "value", "for", "the", "specified", "key", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-json/src/main/java/io/cloudslang/content/json/actions/GetValueFromObject.java#L65-L110
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.readCertificate
public static Certificate readCertificate(String type, InputStream in) { return KeyUtil.readCertificate(type, in); }
java
public static Certificate readCertificate(String type, InputStream in) { return KeyUtil.readCertificate(type, in); }
[ "public", "static", "Certificate", "readCertificate", "(", "String", "type", ",", "InputStream", "in", ")", "{", "return", "KeyUtil", ".", "readCertificate", "(", "type", ",", "in", ")", ";", "}" ]
读取Certification文件<br> Certification为证书文件<br> see: http://snowolf.iteye.com/blog/391931 @param type 类型,例如X.509 @param in {@link InputStream} 如果想从文件读取.cer文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取 @return {@link Certificate}
[ "读取Certification文件<br", ">", "Certification为证书文件<br", ">", "see", ":", "http", ":", "//", "snowolf", ".", "iteye", ".", "com", "/", "blog", "/", "391931" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L377-L379
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.addRelationToResource
public void addRelationToResource(CmsResource resource, CmsResource target, String type) throws CmsException { createRelation(resource, target, type, false); }
java
public void addRelationToResource(CmsResource resource, CmsResource target, String type) throws CmsException { createRelation(resource, target, type, false); }
[ "public", "void", "addRelationToResource", "(", "CmsResource", "resource", ",", "CmsResource", "target", ",", "String", "type", ")", "throws", "CmsException", "{", "createRelation", "(", "resource", ",", "target", ",", "type", ",", "false", ")", ";", "}" ]
Adds a new relation to the given resource.<p> @param resource the source resource @param target the target resource @param type the type of the relation @throws CmsException if something goes wrong
[ "Adds", "a", "new", "relation", "to", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L132-L135
kiegroup/drools
drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java
DroolsStreamUtils.streamIn
public static Object streamIn(byte[] bytes, ClassLoader classLoader, boolean compressed) throws IOException, ClassNotFoundException { return streamIn(new ByteArrayInputStream(bytes), classLoader, compressed); }
java
public static Object streamIn(byte[] bytes, ClassLoader classLoader, boolean compressed) throws IOException, ClassNotFoundException { return streamIn(new ByteArrayInputStream(bytes), classLoader, compressed); }
[ "public", "static", "Object", "streamIn", "(", "byte", "[", "]", "bytes", ",", "ClassLoader", "classLoader", ",", "boolean", "compressed", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "return", "streamIn", "(", "new", "ByteArrayInputStream", "...
This method reads the contents from the given byte array and returns the object. The contents in the given buffer could be compressed or uncompressed depending on the given flag. It is assumed that the content stream was written by the corresponding streamOut methods of this class. @param bytes @param classLoader @param compressed @return @throws IOException @throws ClassNotFoundException
[ "This", "method", "reads", "the", "contents", "from", "the", "given", "byte", "array", "and", "returns", "the", "object", ".", "The", "contents", "in", "the", "given", "buffer", "could", "be", "compressed", "or", "uncompressed", "depending", "on", "the", "gi...
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java#L159-L162
aol/micro-server
micro-s3/src/main/java/com/oath/micro/server/s3/data/S3ObjectWriter.java
S3ObjectWriter.putSync
public Try<UploadResult, Throwable> putSync(String key, Object value) { return put(key, value).map(FluentFunctions.ofChecked(i -> i.waitForUploadResult())); }
java
public Try<UploadResult, Throwable> putSync(String key, Object value) { return put(key, value).map(FluentFunctions.ofChecked(i -> i.waitForUploadResult())); }
[ "public", "Try", "<", "UploadResult", ",", "Throwable", ">", "putSync", "(", "String", "key", ",", "Object", "value", ")", "{", "return", "put", "(", "key", ",", "value", ")", ".", "map", "(", "FluentFunctions", ".", "ofChecked", "(", "i", "->", "i", ...
Blocking call @param key with which to store data @param value Data value @return Try with completed result of operation
[ "Blocking", "call" ]
train
https://github.com/aol/micro-server/blob/5c7103c5b43d2f4d16350dbd2f9802af307c63f7/micro-s3/src/main/java/com/oath/micro/server/s3/data/S3ObjectWriter.java#L111-L113
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/ExtractionUtil.java
ExtractionUtil.extractFile
private static void extractFile(ArchiveInputStream input, File destination, FilenameFilter filter, ArchiveEntry entry) throws ExtractionException { final File file = new File(destination, entry.getName()); try { if (filter.accept(file.getParentFile(), file.getName())) { final String destPath = destination.getCanonicalPath(); if (!file.getCanonicalPath().startsWith(destPath)) { final String msg = String.format( "Archive contains a file (%s) that would be extracted outside of the target directory.", file.getAbsolutePath()); throw new ExtractionException(msg); } LOGGER.debug("Extracting '{}'", file.getPath()); createParentFile(file); try (FileOutputStream fos = new FileOutputStream(file)) { IOUtils.copy(input, fos); } catch (FileNotFoundException ex) { LOGGER.debug("", ex); final String msg = String.format("Unable to find file '%s'.", file.getName()); throw new ExtractionException(msg, ex); } } } catch (IOException ex) { LOGGER.debug("", ex); final String msg = String.format("IO Exception while parsing file '%s'.", file.getName()); throw new ExtractionException(msg, ex); } }
java
private static void extractFile(ArchiveInputStream input, File destination, FilenameFilter filter, ArchiveEntry entry) throws ExtractionException { final File file = new File(destination, entry.getName()); try { if (filter.accept(file.getParentFile(), file.getName())) { final String destPath = destination.getCanonicalPath(); if (!file.getCanonicalPath().startsWith(destPath)) { final String msg = String.format( "Archive contains a file (%s) that would be extracted outside of the target directory.", file.getAbsolutePath()); throw new ExtractionException(msg); } LOGGER.debug("Extracting '{}'", file.getPath()); createParentFile(file); try (FileOutputStream fos = new FileOutputStream(file)) { IOUtils.copy(input, fos); } catch (FileNotFoundException ex) { LOGGER.debug("", ex); final String msg = String.format("Unable to find file '%s'.", file.getName()); throw new ExtractionException(msg, ex); } } } catch (IOException ex) { LOGGER.debug("", ex); final String msg = String.format("IO Exception while parsing file '%s'.", file.getName()); throw new ExtractionException(msg, ex); } }
[ "private", "static", "void", "extractFile", "(", "ArchiveInputStream", "input", ",", "File", "destination", ",", "FilenameFilter", "filter", ",", "ArchiveEntry", "entry", ")", "throws", "ExtractionException", "{", "final", "File", "file", "=", "new", "File", "(", ...
Extracts a file from an archive (input stream) and correctly builds the directory structure. @param input the archive input stream @param destination where to write the file @param filter the file filter to apply to the files being extracted @param entry the entry from the archive to extract @throws ExtractionException thrown if there is an error reading from the archive stream
[ "Extracts", "a", "file", "from", "an", "archive", "(", "input", "stream", ")", "and", "correctly", "builds", "the", "directory", "structure", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/ExtractionUtil.java#L279-L307
dhanji/sitebricks
sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java
Generics.mapTypeParameters
private static Type mapTypeParameters(Type toMapType, Type typeAndParams) { if (isMissingTypeParameters(typeAndParams)) { return erase(toMapType); } else { VarMap varMap = new VarMap(); Type handlingTypeAndParams = typeAndParams; while (handlingTypeAndParams instanceof ParameterizedType) { ParameterizedType pType = (ParameterizedType) handlingTypeAndParams; Class<?> clazz = (Class<?>) pType.getRawType(); // getRawType // should always // be Class varMap.addAll(clazz.getTypeParameters(), pType.getActualTypeArguments()); handlingTypeAndParams = pType.getOwnerType(); } return varMap.map(toMapType); } }
java
private static Type mapTypeParameters(Type toMapType, Type typeAndParams) { if (isMissingTypeParameters(typeAndParams)) { return erase(toMapType); } else { VarMap varMap = new VarMap(); Type handlingTypeAndParams = typeAndParams; while (handlingTypeAndParams instanceof ParameterizedType) { ParameterizedType pType = (ParameterizedType) handlingTypeAndParams; Class<?> clazz = (Class<?>) pType.getRawType(); // getRawType // should always // be Class varMap.addAll(clazz.getTypeParameters(), pType.getActualTypeArguments()); handlingTypeAndParams = pType.getOwnerType(); } return varMap.map(toMapType); } }
[ "private", "static", "Type", "mapTypeParameters", "(", "Type", "toMapType", ",", "Type", "typeAndParams", ")", "{", "if", "(", "isMissingTypeParameters", "(", "typeAndParams", ")", ")", "{", "return", "erase", "(", "toMapType", ")", ";", "}", "else", "{", "V...
Maps type parameters in a type to their values. @param toMapType Type possibly containing type arguments @param typeAndParams must be either ParameterizedType, or (in case there are no type arguments, or it's a raw type) Class @return toMapType, but with type parameters from typeAndParams replaced.
[ "Maps", "type", "parameters", "in", "a", "type", "to", "their", "values", "." ]
train
https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java#L67-L88
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/OutputLayerUtil.java
OutputLayerUtil.validateOutputLayerForClassifierEvaluation
public static void validateOutputLayerForClassifierEvaluation(Layer outputLayer, Class<? extends IEvaluation> classifierEval){ if(outputLayer instanceof Yolo2OutputLayer){ throw new IllegalStateException("Classifier evaluation using " + classifierEval.getSimpleName() + " class cannot be applied for object" + " detection evaluation using Yolo2OutputLayer: " + classifierEval.getSimpleName() + " class is for classifier evaluation only."); } //Check that the activation function provides probabilities. This can't catch everything, but should catch a few // of the common mistakes users make if(outputLayer instanceof BaseLayer){ BaseLayer bl = (BaseLayer)outputLayer; boolean isOutputLayer = outputLayer instanceof OutputLayer || outputLayer instanceof RnnOutputLayer || outputLayer instanceof CenterLossOutputLayer; if(activationExceedsZeroOneRange(bl.getActivationFn(), !isOutputLayer)){ throw new IllegalStateException("Classifier evaluation using " + classifierEval.getSimpleName() + " class cannot be applied to output" + " layers with activation functions that are not probabilities (in range 0 to 1). Output layer type: " + outputLayer.getClass().getSimpleName() + " has activation function " + bl.getActivationFn().getClass().getSimpleName() + ". This check can be disabled using MultiLayerNetwork.getLayerWiseConfigurations().setValidateOutputLayerConfig(false)" + " or ComputationGraph.getConfiguration().setValidateOutputLayerConfig(false)"); } } }
java
public static void validateOutputLayerForClassifierEvaluation(Layer outputLayer, Class<? extends IEvaluation> classifierEval){ if(outputLayer instanceof Yolo2OutputLayer){ throw new IllegalStateException("Classifier evaluation using " + classifierEval.getSimpleName() + " class cannot be applied for object" + " detection evaluation using Yolo2OutputLayer: " + classifierEval.getSimpleName() + " class is for classifier evaluation only."); } //Check that the activation function provides probabilities. This can't catch everything, but should catch a few // of the common mistakes users make if(outputLayer instanceof BaseLayer){ BaseLayer bl = (BaseLayer)outputLayer; boolean isOutputLayer = outputLayer instanceof OutputLayer || outputLayer instanceof RnnOutputLayer || outputLayer instanceof CenterLossOutputLayer; if(activationExceedsZeroOneRange(bl.getActivationFn(), !isOutputLayer)){ throw new IllegalStateException("Classifier evaluation using " + classifierEval.getSimpleName() + " class cannot be applied to output" + " layers with activation functions that are not probabilities (in range 0 to 1). Output layer type: " + outputLayer.getClass().getSimpleName() + " has activation function " + bl.getActivationFn().getClass().getSimpleName() + ". This check can be disabled using MultiLayerNetwork.getLayerWiseConfigurations().setValidateOutputLayerConfig(false)" + " or ComputationGraph.getConfiguration().setValidateOutputLayerConfig(false)"); } } }
[ "public", "static", "void", "validateOutputLayerForClassifierEvaluation", "(", "Layer", "outputLayer", ",", "Class", "<", "?", "extends", "IEvaluation", ">", "classifierEval", ")", "{", "if", "(", "outputLayer", "instanceof", "Yolo2OutputLayer", ")", "{", "throw", "...
Validates if the output layer configuration is valid for classifier evaluation. This is used to try and catch invalid evaluation - i.e., trying to use classifier evaluation on a regression model. This method won't catch all possible invalid cases, but should catch some common problems. @param outputLayer Output layer @param classifierEval Class for the classifier evaluation
[ "Validates", "if", "the", "output", "layer", "configuration", "is", "valid", "for", "classifier", "evaluation", ".", "This", "is", "used", "to", "try", "and", "catch", "invalid", "evaluation", "-", "i", ".", "e", ".", "trying", "to", "use", "classifier", "...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/OutputLayerUtil.java#L173-L193
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.beginStop
public void beginStop(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) { beginStopWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).toBlocking().single().body(); }
java
public void beginStop(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) { beginStopWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).toBlocking().single().body(); }
[ "public", "void", "beginStop", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ")", "{", "beginStopWithServiceResponseAsync", "(", "resourceGroupName"...
Stops an environment by stopping all resources inside the environment This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Stops", "an", "environment", "by", "stopping", "all", "resources", "inside", "the", "environment", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L1675-L1677
tango-controls/JTango
client/src/main/java/org/tango/client/database/DatabaseFactory.java
DatabaseFactory.getDatabase
public static synchronized ITangoDB getDatabase(final String host, final String port) throws DevFailed { final ITangoDB dbase; if (useDb) { final String tangoHost = host + ":" + port; // Search if database object already created for this host and port if (databaseMap.containsKey(tangoHost)) { return databaseMap.get(tangoHost); } // Else, create a new database object dbase = new Database(host, port); databaseMap.put(tangoHost, dbase); } else { dbase = fileDatabase; } return dbase; }
java
public static synchronized ITangoDB getDatabase(final String host, final String port) throws DevFailed { final ITangoDB dbase; if (useDb) { final String tangoHost = host + ":" + port; // Search if database object already created for this host and port if (databaseMap.containsKey(tangoHost)) { return databaseMap.get(tangoHost); } // Else, create a new database object dbase = new Database(host, port); databaseMap.put(tangoHost, dbase); } else { dbase = fileDatabase; } return dbase; }
[ "public", "static", "synchronized", "ITangoDB", "getDatabase", "(", "final", "String", "host", ",", "final", "String", "port", ")", "throws", "DevFailed", "{", "final", "ITangoDB", "dbase", ";", "if", "(", "useDb", ")", "{", "final", "String", "tangoHost", "...
Get the database object created for specified host and port. @param host host where database is running. @param port port for database connection.
[ "Get", "the", "database", "object", "created", "for", "specified", "host", "and", "port", "." ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/DatabaseFactory.java#L38-L53
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newSecurityException
public static SecurityException newSecurityException(String message, Object... args) { return newSecurityException(null, message, args); }
java
public static SecurityException newSecurityException(String message, Object... args) { return newSecurityException(null, message, args); }
[ "public", "static", "SecurityException", "newSecurityException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newSecurityException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link SecurityException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link SecurityException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link SecurityException} with the given {@link String message}. @see #newSecurityException(Throwable, String, Object...) @see org.cp.elements.security.SecurityException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "SecurityException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L641-L643
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusTaskStatusHandler.java
FileStatusTaskStatusHandler.allStatus
private void allStatus(RESTRequest request, RESTResponse response) { MultipleRoutingHelper helper = getMultipleRoutingHelper(); Map<String, List<String>> queryParams = new HashMap<String, List<String>>(); for (Entry<String, String[]> entry : request.getParameterMap().entrySet()) { queryParams.put(entry.getKey(), Arrays.asList(entry.getValue())); } String allStatusJson; if (queryParams == null || queryParams.isEmpty()) { allStatusJson = helper.getAllStatus(null); } else { allStatusJson = helper.getAllStatus(queryParams.entrySet()); } OutputHelper.writeJsonOutput(response, allStatusJson); }
java
private void allStatus(RESTRequest request, RESTResponse response) { MultipleRoutingHelper helper = getMultipleRoutingHelper(); Map<String, List<String>> queryParams = new HashMap<String, List<String>>(); for (Entry<String, String[]> entry : request.getParameterMap().entrySet()) { queryParams.put(entry.getKey(), Arrays.asList(entry.getValue())); } String allStatusJson; if (queryParams == null || queryParams.isEmpty()) { allStatusJson = helper.getAllStatus(null); } else { allStatusJson = helper.getAllStatus(queryParams.entrySet()); } OutputHelper.writeJsonOutput(response, allStatusJson); }
[ "private", "void", "allStatus", "(", "RESTRequest", "request", ",", "RESTResponse", "response", ")", "{", "MultipleRoutingHelper", "helper", "=", "getMultipleRoutingHelper", "(", ")", ";", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "queryParams"...
Returns a JSON array of {taskID,taskStatus,taskURL} tuples, representing all the IDs currently being stored. [ { "taskID" : "123", "taskStatus" : "status" , "taskURL" : "url" }* ] This method allows for query params to be specified as filters. They key/value of the query param will represent a property pertaining to a task. <p>Example: GET file/status?user=bob will return all tasks that contain a property called "user" with value "bob"
[ "Returns", "a", "JSON", "array", "of", "{", "taskID", "taskStatus", "taskURL", "}", "tuples", "representing", "all", "the", "IDs", "currently", "being", "stored", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusTaskStatusHandler.java#L97-L113
samskivert/samskivert
src/main/java/com/samskivert/util/Config.java
Config.instantiateValue
public Object instantiateValue (String name, String defcname) throws Exception { return Class.forName(getValue(name, defcname)).newInstance(); }
java
public Object instantiateValue (String name, String defcname) throws Exception { return Class.forName(getValue(name, defcname)).newInstance(); }
[ "public", "Object", "instantiateValue", "(", "String", "name", ",", "String", "defcname", ")", "throws", "Exception", "{", "return", "Class", ".", "forName", "(", "getValue", "(", "name", ",", "defcname", ")", ")", ".", "newInstance", "(", ")", ";", "}" ]
Looks up the specified string-valued configuration entry, loads the class with that name and instantiates a new instance of that class, which is returned. @param name the name of the property to be fetched. @param defcname the class name to use if the property is not specified in the config file. @exception Exception thrown if any error occurs while loading or instantiating the class.
[ "Looks", "up", "the", "specified", "string", "-", "valued", "configuration", "entry", "loads", "the", "class", "with", "that", "name", "and", "instantiates", "a", "new", "instance", "of", "that", "class", "which", "is", "returned", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Config.java#L336-L340
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java
ZooKeeper.setACL
public Stat setACL(final String path, List<ACL> acl, int version) throws KeeperException, InterruptedException { verbotenThreadCheck(); final String clientPath = path; PathUtils.validatePath(clientPath); final String serverPath = prependChroot(clientPath); RequestHeader h = new RequestHeader(); h.setType(ZooDefs.OpCode.setACL); SetACLRequest request = new SetACLRequest(); request.setPath(serverPath); if (acl != null && acl.size() == 0) { throw new KeeperException.InvalidACLException(); } request.setAcl(acl); request.setVersion(version); SetACLResponse response = new SetACLResponse(); ReplyHeader r = cnxn.submitRequest(h, request, response, null); if (r.getErr() != 0) { throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath); } return response.getStat(); }
java
public Stat setACL(final String path, List<ACL> acl, int version) throws KeeperException, InterruptedException { verbotenThreadCheck(); final String clientPath = path; PathUtils.validatePath(clientPath); final String serverPath = prependChroot(clientPath); RequestHeader h = new RequestHeader(); h.setType(ZooDefs.OpCode.setACL); SetACLRequest request = new SetACLRequest(); request.setPath(serverPath); if (acl != null && acl.size() == 0) { throw new KeeperException.InvalidACLException(); } request.setAcl(acl); request.setVersion(version); SetACLResponse response = new SetACLResponse(); ReplyHeader r = cnxn.submitRequest(h, request, response, null); if (r.getErr() != 0) { throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath); } return response.getStat(); }
[ "public", "Stat", "setACL", "(", "final", "String", "path", ",", "List", "<", "ACL", ">", "acl", ",", "int", "version", ")", "throws", "KeeperException", ",", "InterruptedException", "{", "verbotenThreadCheck", "(", ")", ";", "final", "String", "clientPath", ...
Set the ACL for the node of the given path if such a node exists and the given version matches the version of the node. Return the stat of the node. <p> A KeeperException with error code KeeperException.NoNode will be thrown if no node with the given path exists. <p> A KeeperException with error code KeeperException.BadVersion will be thrown if the given version does not match the node's version. @param path @param acl @param version @return the stat of the node. @throws InterruptedException If the server transaction is interrupted. @throws KeeperException If the server signals an error with a non-zero error code. @throws org.apache.zookeeper_voltpatches.KeeperException.InvalidACLException If the acl is invalide. @throws IllegalArgumentException if an invalid path is specified
[ "Set", "the", "ACL", "for", "the", "node", "of", "the", "given", "path", "if", "such", "a", "node", "exists", "and", "the", "given", "version", "matches", "the", "version", "of", "the", "node", ".", "Return", "the", "stat", "of", "the", "node", ".", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java#L1208-L1232
CloudSlang/cs-actions
cs-powershell/src/main/java/io/cloudslang/content/entities/EncoderDecoder.java
EncoderDecoder.encodeStringInBase64
public static String encodeStringInBase64(String str, Charset charset) { return new String(Base64.encodeBase64(str.getBytes(charset))); }
java
public static String encodeStringInBase64(String str, Charset charset) { return new String(Base64.encodeBase64(str.getBytes(charset))); }
[ "public", "static", "String", "encodeStringInBase64", "(", "String", "str", ",", "Charset", "charset", ")", "{", "return", "new", "String", "(", "Base64", ".", "encodeBase64", "(", "str", ".", "getBytes", "(", "charset", ")", ")", ")", ";", "}" ]
Encodes a string to base64. @param str The string value to encode. @param charset The encoding charset used to obtain the byte sequence of the string. @return The encoded byte sequence using the base64 encoding.
[ "Encodes", "a", "string", "to", "base64", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/entities/EncoderDecoder.java#L36-L38
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXReader.java
MPXReader.populateCurrencySettings
private void populateCurrencySettings(Record record, ProjectProperties properties) { properties.setCurrencySymbol(record.getString(0)); properties.setSymbolPosition(record.getCurrencySymbolPosition(1)); properties.setCurrencyDigits(record.getInteger(2)); Character c = record.getCharacter(3); if (c != null) { properties.setThousandsSeparator(c.charValue()); } c = record.getCharacter(4); if (c != null) { properties.setDecimalSeparator(c.charValue()); } }
java
private void populateCurrencySettings(Record record, ProjectProperties properties) { properties.setCurrencySymbol(record.getString(0)); properties.setSymbolPosition(record.getCurrencySymbolPosition(1)); properties.setCurrencyDigits(record.getInteger(2)); Character c = record.getCharacter(3); if (c != null) { properties.setThousandsSeparator(c.charValue()); } c = record.getCharacter(4); if (c != null) { properties.setDecimalSeparator(c.charValue()); } }
[ "private", "void", "populateCurrencySettings", "(", "Record", "record", ",", "ProjectProperties", "properties", ")", "{", "properties", ".", "setCurrencySymbol", "(", "record", ".", "getString", "(", "0", ")", ")", ";", "properties", ".", "setSymbolPosition", "(",...
Populates currency settings. @param record MPX record @param properties project properties
[ "Populates", "currency", "settings", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L483-L500
cketti/ckChangeLog
ckChangeLog/src/main/java/de/cketti/library/changelog/ChangeLog.java
ChangeLog.readChangeLogFromResource
protected final SparseArray<ReleaseItem> readChangeLogFromResource(int resId, boolean full) { XmlResourceParser xml = mContext.getResources().getXml(resId); try { return readChangeLog(xml, full); } finally { xml.close(); } }
java
protected final SparseArray<ReleaseItem> readChangeLogFromResource(int resId, boolean full) { XmlResourceParser xml = mContext.getResources().getXml(resId); try { return readChangeLog(xml, full); } finally { xml.close(); } }
[ "protected", "final", "SparseArray", "<", "ReleaseItem", ">", "readChangeLogFromResource", "(", "int", "resId", ",", "boolean", "full", ")", "{", "XmlResourceParser", "xml", "=", "mContext", ".", "getResources", "(", ")", ".", "getXml", "(", "resId", ")", ";",...
Read change log from XML resource file. @param resId Resource ID of the XML file to read the change log from. @param full If this is {@code true} the full change log is returned. Otherwise only changes for versions newer than the last version are returned. @return A {@code SparseArray} containing {@link ReleaseItem}s representing the (partial) change log.
[ "Read", "change", "log", "from", "XML", "resource", "file", "." ]
train
https://github.com/cketti/ckChangeLog/blob/e9a81ad3e043357e80922aa7c149241af73223d3/ckChangeLog/src/main/java/de/cketti/library/changelog/ChangeLog.java#L455-L462
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlUtil.java
SqlUtil.buildLikeValue
public static String buildLikeValue(String value, LikeType likeType, boolean withLikeKeyword) { if (null == value) { return value; } StringBuilder likeValue = StrUtil.builder(withLikeKeyword ? "LIKE " : ""); switch (likeType) { case StartWith: likeValue.append('%').append(value); break; case EndWith: likeValue.append(value).append('%'); break; case Contains: likeValue.append('%').append(value).append('%'); break; default: break; } return likeValue.toString(); }
java
public static String buildLikeValue(String value, LikeType likeType, boolean withLikeKeyword) { if (null == value) { return value; } StringBuilder likeValue = StrUtil.builder(withLikeKeyword ? "LIKE " : ""); switch (likeType) { case StartWith: likeValue.append('%').append(value); break; case EndWith: likeValue.append(value).append('%'); break; case Contains: likeValue.append('%').append(value).append('%'); break; default: break; } return likeValue.toString(); }
[ "public", "static", "String", "buildLikeValue", "(", "String", "value", ",", "LikeType", "likeType", ",", "boolean", "withLikeKeyword", ")", "{", "if", "(", "null", "==", "value", ")", "{", "return", "value", ";", "}", "StringBuilder", "likeValue", "=", "Str...
创建LIKE语句中的值,创建的结果为: <pre> 1、LikeType.StartWith: %value 2、LikeType.EndWith: value% 3、LikeType.Contains: %value% </pre> 如果withLikeKeyword为true,则结果为: <pre> 1、LikeType.StartWith: LIKE %value 2、LikeType.EndWith: LIKE value% 3、LikeType.Contains: LIKE %value% </pre> @param value 被查找值 @param likeType LIKE值类型 {@link LikeType} @return 拼接后的like值
[ "创建LIKE语句中的值,创建的结果为:" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlUtil.java#L103-L124
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/impl/ConfigurableImpl.java
ConfigurableImpl.collectInterfaces
private static void collectInterfaces(Set<Class<?>> interfaces, Class<?> anInterface) { interfaces.add(anInterface); for (Class<?> superInterface : anInterface.getInterfaces()) { collectInterfaces(interfaces, superInterface); } }
java
private static void collectInterfaces(Set<Class<?>> interfaces, Class<?> anInterface) { interfaces.add(anInterface); for (Class<?> superInterface : anInterface.getInterfaces()) { collectInterfaces(interfaces, superInterface); } }
[ "private", "static", "void", "collectInterfaces", "(", "Set", "<", "Class", "<", "?", ">", ">", "interfaces", ",", "Class", "<", "?", ">", "anInterface", ")", "{", "interfaces", ".", "add", "(", "anInterface", ")", ";", "for", "(", "Class", "<", "?", ...
internal helper function to recursively collect Interfaces. This is needed since {@link Class#getInterfaces()} does only return directly implemented Interfaces, But not the ones derived from those classes.
[ "internal", "helper", "function", "to", "recursively", "collect", "Interfaces", ".", "This", "is", "needed", "since", "{" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.frontend.jaxrs.3.2/src/org/apache/cxf/jaxrs/impl/ConfigurableImpl.java#L127-L132
meridor/perspective-backend
perspective-sql/src/main/java/org/meridor/perspective/sql/impl/parser/DataSourceUtils.java
DataSourceUtils.addToDataSource
public static void addToDataSource(DataSource parent, DataSource child) { if (!parent.getLeftDataSource().isPresent()) { parent.setLeftDataSource(child); } else if (!parent.getRightDataSource().isPresent()) { parent.setRightDataSource(child); } else { DataSource newLeftDataSource = new DataSource(parent.getLeftDataSource().get()); newLeftDataSource.setRightDataSource(parent.getRightDataSource().get()); parent.setLeftDataSource(newLeftDataSource); parent.setRightDataSource(child); } }
java
public static void addToDataSource(DataSource parent, DataSource child) { if (!parent.getLeftDataSource().isPresent()) { parent.setLeftDataSource(child); } else if (!parent.getRightDataSource().isPresent()) { parent.setRightDataSource(child); } else { DataSource newLeftDataSource = new DataSource(parent.getLeftDataSource().get()); newLeftDataSource.setRightDataSource(parent.getRightDataSource().get()); parent.setLeftDataSource(newLeftDataSource); parent.setRightDataSource(child); } }
[ "public", "static", "void", "addToDataSource", "(", "DataSource", "parent", ",", "DataSource", "child", ")", "{", "if", "(", "!", "parent", ".", "getLeftDataSource", "(", ")", ".", "isPresent", "(", ")", ")", "{", "parent", ".", "setLeftDataSource", "(", "...
Builds optimized data source as a tree @param parent data source to add child to @param child child data source
[ "Builds", "optimized", "data", "source", "as", "a", "tree" ]
train
https://github.com/meridor/perspective-backend/blob/5f98083977a57115988678e97d1642ee83431258/perspective-sql/src/main/java/org/meridor/perspective/sql/impl/parser/DataSourceUtils.java#L31-L42
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ShakeAroundAPI.java
ShakeAroundAPI.pageSearch
public static PageSearchResult pageSearch(String accessToken, PageSearch pageSearch) { return pageSearch(accessToken, JsonUtil.toJSONString(pageSearch)); }
java
public static PageSearchResult pageSearch(String accessToken, PageSearch pageSearch) { return pageSearch(accessToken, JsonUtil.toJSONString(pageSearch)); }
[ "public", "static", "PageSearchResult", "pageSearch", "(", "String", "accessToken", ",", "PageSearch", "pageSearch", ")", "{", "return", "pageSearch", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "pageSearch", ")", ")", ";", "}" ]
页面管理-查询页面列表 @param accessToken accessToken @param pageSearch pageSearch @return result
[ "页面管理-查询页面列表" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ShakeAroundAPI.java#L788-L791
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/mime/MimeTypeParser.java
MimeTypeParser.parseMimeType
@Nullable public static MimeType parseMimeType (@Nullable final String sMimeType) { return parseMimeType (sMimeType, CMimeType.DEFAULT_QUOTING); }
java
@Nullable public static MimeType parseMimeType (@Nullable final String sMimeType) { return parseMimeType (sMimeType, CMimeType.DEFAULT_QUOTING); }
[ "@", "Nullable", "public", "static", "MimeType", "parseMimeType", "(", "@", "Nullable", "final", "String", "sMimeType", ")", "{", "return", "parseMimeType", "(", "sMimeType", ",", "CMimeType", ".", "DEFAULT_QUOTING", ")", ";", "}" ]
Try to convert the string representation of a MIME type to an object. The default quoting algorithm {@link CMimeType#DEFAULT_QUOTING} is used to unquote strings. @param sMimeType The string representation to be converted. May be <code>null</code>. @return <code>null</code> if the parsed string is empty. @throws MimeTypeParserException In case of an error
[ "Try", "to", "convert", "the", "string", "representation", "of", "a", "MIME", "type", "to", "an", "object", ".", "The", "default", "quoting", "algorithm", "{", "@link", "CMimeType#DEFAULT_QUOTING", "}", "is", "used", "to", "unquote", "strings", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mime/MimeTypeParser.java#L291-L295
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java
TaskSession.createRemoteTask
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { try { Application app = this.getApplication(); RemoteTask remoteServer = new TaskSession(app); ((TaskSession)remoteServer).setProperties(properties); return remoteServer; } catch (Exception ex) { ex.printStackTrace(); return null; } }
java
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { try { Application app = this.getApplication(); RemoteTask remoteServer = new TaskSession(app); ((TaskSession)remoteServer).setProperties(properties); return remoteServer; } catch (Exception ex) { ex.printStackTrace(); return null; } }
[ "public", "RemoteTask", "createRemoteTask", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "RemoteException", "{", "try", "{", "Application", "app", "=", "this", ".", "getApplication", "(", ")", ";", "RemoteTask", "remoteServer", "...
Build a new remote session and initialize it. NOTE: This is convenience method to create a task below the current APPLICATION (not below this task) @param properties to create the new remote task @return The remote Task.
[ "Build", "a", "new", "remote", "session", "and", "initialize", "it", ".", "NOTE", ":", "This", "is", "convenience", "method", "to", "create", "a", "task", "below", "the", "current", "APPLICATION", "(", "not", "below", "this", "task", ")" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java#L151-L162
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.findRRset
public boolean findRRset(Name name, int type) { return (findRRset(name, type, Section.ANSWER) || findRRset(name, type, Section.AUTHORITY) || findRRset(name, type, Section.ADDITIONAL)); }
java
public boolean findRRset(Name name, int type) { return (findRRset(name, type, Section.ANSWER) || findRRset(name, type, Section.AUTHORITY) || findRRset(name, type, Section.ADDITIONAL)); }
[ "public", "boolean", "findRRset", "(", "Name", "name", ",", "int", "type", ")", "{", "return", "(", "findRRset", "(", "name", ",", "type", ",", "Section", ".", "ANSWER", ")", "||", "findRRset", "(", "name", ",", "type", ",", "Section", ".", "AUTHORITY"...
Determines if an RRset with the given name and type is already present in any section. @see RRset @see Section
[ "Determines", "if", "an", "RRset", "with", "the", "given", "name", "and", "type", "is", "already", "present", "in", "any", "section", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L252-L257
ModeShape/modeshape
modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java
JcrTools.uploadFile
public Node uploadFile( Session session, String path, File file ) throws RepositoryException, IOException { isNotNull(session, "session"); isNotNull(path, "path"); isNotNull(file, "file"); if (!file.exists()) { throw new IllegalArgumentException("The file \"" + file.getCanonicalPath() + "\" does not exist"); } if (!file.canRead()) { throw new IllegalArgumentException("The file \"" + file.getCanonicalPath() + "\" is not readable"); } // Determine the 'lastModified' timestamp ... Calendar lastModified = Calendar.getInstance(); lastModified.setTimeInMillis(file.lastModified()); // Open the URL's stream first ... InputStream stream = new BufferedInputStream(new FileInputStream(file)); return uploadFile(session, path, stream); }
java
public Node uploadFile( Session session, String path, File file ) throws RepositoryException, IOException { isNotNull(session, "session"); isNotNull(path, "path"); isNotNull(file, "file"); if (!file.exists()) { throw new IllegalArgumentException("The file \"" + file.getCanonicalPath() + "\" does not exist"); } if (!file.canRead()) { throw new IllegalArgumentException("The file \"" + file.getCanonicalPath() + "\" is not readable"); } // Determine the 'lastModified' timestamp ... Calendar lastModified = Calendar.getInstance(); lastModified.setTimeInMillis(file.lastModified()); // Open the URL's stream first ... InputStream stream = new BufferedInputStream(new FileInputStream(file)); return uploadFile(session, path, stream); }
[ "public", "Node", "uploadFile", "(", "Session", "session", ",", "String", "path", ",", "File", "file", ")", "throws", "RepositoryException", ",", "IOException", "{", "isNotNull", "(", "session", ",", "\"session\"", ")", ";", "isNotNull", "(", "path", ",", "\...
Upload the content in the supplied file into the repository at the defined path, using the given session. This method will create a 'nt:file' node at the supplied path, and any non-existant ancestors with nodes of type 'nt:folder'. As defined by the JCR specification, the binary content (and other properties) will be placed on a child of the 'nt:file' node named 'jcr:content' with a node type of 'nt:resource'. @param session the JCR session @param path the path to the file @param file the existing and readable file to be uploaded @return the newly created 'nt:file' node @throws RepositoryException if there is a problem uploading the file @throws IOException if there is a problem using the stream @throws IllegalArgumentException if the file does not exist or is not readable @throws IllegalArgumentException is any of the parameters are null
[ "Upload", "the", "content", "in", "the", "supplied", "file", "into", "the", "repository", "at", "the", "defined", "path", "using", "the", "given", "session", ".", "This", "method", "will", "create", "a", "nt", ":", "file", "node", "at", "the", "supplied", ...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java#L233-L253
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentQuotaStatusInner.java
ComponentQuotaStatusInner.getAsync
public Observable<ApplicationInsightsComponentQuotaStatusInner> getAsync(String resourceGroupName, String resourceName) { return getWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ApplicationInsightsComponentQuotaStatusInner>, ApplicationInsightsComponentQuotaStatusInner>() { @Override public ApplicationInsightsComponentQuotaStatusInner call(ServiceResponse<ApplicationInsightsComponentQuotaStatusInner> response) { return response.body(); } }); }
java
public Observable<ApplicationInsightsComponentQuotaStatusInner> getAsync(String resourceGroupName, String resourceName) { return getWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ApplicationInsightsComponentQuotaStatusInner>, ApplicationInsightsComponentQuotaStatusInner>() { @Override public ApplicationInsightsComponentQuotaStatusInner call(ServiceResponse<ApplicationInsightsComponentQuotaStatusInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationInsightsComponentQuotaStatusInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "ma...
Returns daily data volume cap (quota) status for an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInsightsComponentQuotaStatusInner object
[ "Returns", "daily", "data", "volume", "cap", "(", "quota", ")", "status", "for", "an", "Application", "Insights", "component", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentQuotaStatusInner.java#L95-L102
lightblueseas/jcommons-lang
src/main/java/de/alpharogroup/lang/AnnotationExtensions.java
AnnotationExtensions.getAllClasses
public static Set<Class<?>> getAllClasses(final String packagePath) throws ClassNotFoundException, IOException, URISyntaxException { return getAllAnnotatedClasses(packagePath, null); }
java
public static Set<Class<?>> getAllClasses(final String packagePath) throws ClassNotFoundException, IOException, URISyntaxException { return getAllAnnotatedClasses(packagePath, null); }
[ "public", "static", "Set", "<", "Class", "<", "?", ">", ">", "getAllClasses", "(", "final", "String", "packagePath", ")", "throws", "ClassNotFoundException", ",", "IOException", ",", "URISyntaxException", "{", "return", "getAllAnnotatedClasses", "(", "packagePath", ...
Gets all the classes from the class loader that belongs to the given package path. @param packagePath the package path @return the all classes @throws ClassNotFoundException occurs if a given class cannot be located by the specified class loader @throws IOException Signals that an I/O exception has occurred. @throws URISyntaxException is thrown if a string could not be parsed as a URI reference.
[ "Gets", "all", "the", "classes", "from", "the", "class", "loader", "that", "belongs", "to", "the", "given", "package", "path", "." ]
train
https://github.com/lightblueseas/jcommons-lang/blob/000e1f198e949ec3e721fd0fc3f5946e945232a3/src/main/java/de/alpharogroup/lang/AnnotationExtensions.java#L134-L138
UrielCh/ovh-java-sdk
ovh-java-sdk-contact/src/main/java/net/minidev/ovh/api/ApiOvhContact.java
ApiOvhContact.form_send_POST
public void form_send_POST(OvhSafeKeyValue<String>[] form, String type) throws IOException { String qPath = "/contact/form/send"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "form", form); addBody(o, "type", type); execN(qPath, "POST", sb.toString(), o); }
java
public void form_send_POST(OvhSafeKeyValue<String>[] form, String type) throws IOException { String qPath = "/contact/form/send"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "form", form); addBody(o, "type", type); execN(qPath, "POST", sb.toString(), o); }
[ "public", "void", "form_send_POST", "(", "OvhSafeKeyValue", "<", "String", ">", "[", "]", "form", ",", "String", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/contact/form/send\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath",...
Send form following characteristics of /contact/form REST: POST /contact/form/send @param type [required] Form type @param form [required] Form informations
[ "Send", "form", "following", "characteristics", "of", "/", "contact", "/", "form" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-contact/src/main/java/net/minidev/ovh/api/ApiOvhContact.java#L42-L49
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getReadResourceCategories
public Map<String, CmsJspCategoryAccessBean> getReadResourceCategories() { if (null == m_resourceCategories) { m_resourceCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object resourceName) { try { CmsResource resource = m_cms.readResource( getRequestContext().removeSiteRoot((String)resourceName)); return new CmsJspCategoryAccessBean(m_cms, resource); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return null; } } }); } return m_resourceCategories; }
java
public Map<String, CmsJspCategoryAccessBean> getReadResourceCategories() { if (null == m_resourceCategories) { m_resourceCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object resourceName) { try { CmsResource resource = m_cms.readResource( getRequestContext().removeSiteRoot((String)resourceName)); return new CmsJspCategoryAccessBean(m_cms, resource); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return null; } } }); } return m_resourceCategories; }
[ "public", "Map", "<", "String", ",", "CmsJspCategoryAccessBean", ">", "getReadResourceCategories", "(", ")", "{", "if", "(", "null", "==", "m_resourceCategories", ")", "{", "m_resourceCategories", "=", "CmsCollectionsGenericWrapper", ".", "createLazyMap", "(", "new", ...
Reads the categories assigned to a resource. @return map from the resource path (root path) to the assigned categories
[ "Reads", "the", "categories", "assigned", "to", "a", "resource", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1528-L1547
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/mapred/GenWriterThread.java
GenWriterThread.writeChecksumFile
private Path writeChecksumFile(FileSystem fs, String name, GenThread[] threads) throws IOException { Path checksumFile = new Path(rtc.output_dir, name + ".checksum"); SequenceFile.Writer write = null; write = SequenceFile.createWriter(fs, fs.getConf(), checksumFile, Text.class, Text.class, CompressionType.NONE); try { for (GenThread rawThread: threads) { GenWriterThread thread = (GenWriterThread)rawThread; write.append(new Text(thread.outputPath.toString()), new Text(Long.toString(thread.dc.getDirectoryChecksum()))); } } finally { if (write != null) write.close(); write = null; } return checksumFile; }
java
private Path writeChecksumFile(FileSystem fs, String name, GenThread[] threads) throws IOException { Path checksumFile = new Path(rtc.output_dir, name + ".checksum"); SequenceFile.Writer write = null; write = SequenceFile.createWriter(fs, fs.getConf(), checksumFile, Text.class, Text.class, CompressionType.NONE); try { for (GenThread rawThread: threads) { GenWriterThread thread = (GenWriterThread)rawThread; write.append(new Text(thread.outputPath.toString()), new Text(Long.toString(thread.dc.getDirectoryChecksum()))); } } finally { if (write != null) write.close(); write = null; } return checksumFile; }
[ "private", "Path", "writeChecksumFile", "(", "FileSystem", "fs", ",", "String", "name", ",", "GenThread", "[", "]", "threads", ")", "throws", "IOException", "{", "Path", "checksumFile", "=", "new", "Path", "(", "rtc", ".", "output_dir", ",", "name", "+", "...
Each mapper will write one checksum file. checksum file contains N pairs where N is the number of threads Each pair is has two entries: outputPath and checksum outputPath is the directory of files written by the thread checksum is the CRC checksum of all files under that directory @param name checksum file name @param threads array of writer threads @return checksum file path @throws IOException
[ "Each", "mapper", "will", "write", "one", "checksum", "file", ".", "checksum", "file", "contains", "N", "pairs", "where", "N", "is", "the", "number", "of", "threads", "Each", "pair", "is", "has", "two", "entries", ":", "outputPath", "and", "checksum", "out...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/GenWriterThread.java#L237-L255
keenlabs/KeenClient-Java
core/src/main/java/io/keen/client/java/KeenClient.java
KeenClient.queueEvent
public void queueEvent(String eventCollection, Map<String, Object> event) { queueEvent(eventCollection, event, null); }
java
public void queueEvent(String eventCollection, Map<String, Object> event) { queueEvent(eventCollection, event, null); }
[ "public", "void", "queueEvent", "(", "String", "eventCollection", ",", "Map", "<", "String", ",", "Object", ">", "event", ")", "{", "queueEvent", "(", "eventCollection", ",", "event", ",", "null", ")", ";", "}" ]
Queues an event in the default project with default Keen properties and no callbacks. @see #queueEvent(KeenProject, String, java.util.Map, java.util.Map, KeenCallback) @param eventCollection The name of the collection in which to publish the event. @param event A Map that consists of key/value pairs. Keen naming conventions apply (see docs). Nested Maps and lists are acceptable (and encouraged!).
[ "Queues", "an", "event", "in", "the", "default", "project", "with", "default", "Keen", "properties", "and", "no", "callbacks", "." ]
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/KeenClient.java#L262-L264
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Note.java
Note.createResponse
public Note createResponse(String name, String content, boolean personal) { return getInstance().create().note(this, name, content, personal); }
java
public Note createResponse(String name, String content, boolean personal) { return getInstance().create().note(this, name, content, personal); }
[ "public", "Note", "createResponse", "(", "String", "name", ",", "String", "content", ",", "boolean", "personal", ")", "{", "return", "getInstance", "(", ")", ".", "create", "(", ")", ".", "note", "(", "this", ",", "name", ",", "content", ",", "personal",...
Create a response to this note @param name The name of the note @param content The content of the note @param personal True if the note is only visible to the currently logged in user @return a new note
[ "Create", "a", "response", "to", "this", "note" ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Note.java#L122-L124
ggrandes/kvstore
src/main/java/org/javastack/kvstore/utils/HexStrings.java
HexStrings.nativeAsHex
public static final String nativeAsHex(final long input, final int bits) { final char[] sb = new char[(bits > 64 ? 64 : (bits < 8 ? 8 : bits)) >> 2]; final int len = (sb.length - 1); for (int i = 0; i <= len; i++) { // MSB sb[i] = HEX_TABLE[((int) (input >>> ((len - i) << 2))) & 0xF]; } return new String(sb); }
java
public static final String nativeAsHex(final long input, final int bits) { final char[] sb = new char[(bits > 64 ? 64 : (bits < 8 ? 8 : bits)) >> 2]; final int len = (sb.length - 1); for (int i = 0; i <= len; i++) { // MSB sb[i] = HEX_TABLE[((int) (input >>> ((len - i) << 2))) & 0xF]; } return new String(sb); }
[ "public", "static", "final", "String", "nativeAsHex", "(", "final", "long", "input", ",", "final", "int", "bits", ")", "{", "final", "char", "[", "]", "sb", "=", "new", "char", "[", "(", "bits", ">", "64", "?", "64", ":", "(", "bits", "<", "8", "...
Return hex string (zero-left-padded) of an native number @param input the number @param bits the size in bits for a number (64 for long, 32 for int, 16 for short, 8 for byte) @return string
[ "Return", "hex", "string", "(", "zero", "-", "left", "-", "padded", ")", "of", "an", "native", "number" ]
train
https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/utils/HexStrings.java#L76-L84
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/documents/XlsWorkbook.java
XlsWorkbook.appendToSheet
@Override public void appendToSheet(FileColumn[] columns, List<String[]> lines, String sheetName) throws IOException { try { XlsWorksheet sheet = getSheet(sheetName); if(sheet != null) appendRows((WritableSheet)sheet.getSheet(), columns, lines, sheetName); } catch(WriteException e) { throw new IOException(e); } }
java
@Override public void appendToSheet(FileColumn[] columns, List<String[]> lines, String sheetName) throws IOException { try { XlsWorksheet sheet = getSheet(sheetName); if(sheet != null) appendRows((WritableSheet)sheet.getSheet(), columns, lines, sheetName); } catch(WriteException e) { throw new IOException(e); } }
[ "@", "Override", "public", "void", "appendToSheet", "(", "FileColumn", "[", "]", "columns", ",", "List", "<", "String", "[", "]", ">", "lines", ",", "String", "sheetName", ")", "throws", "IOException", "{", "try", "{", "XlsWorksheet", "sheet", "=", "getShe...
Adds the given lines of data to an existing sheet in the workbook. @param columns The column definitions for the worksheet @param lines The list of lines to be added to the worksheet @param sheetName The name of the worksheet to be added @throws IOException if the data cannot be appended
[ "Adds", "the", "given", "lines", "of", "data", "to", "an", "existing", "sheet", "in", "the", "workbook", "." ]
train
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/XlsWorkbook.java#L279-L293
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java
ImageDeformPointMLS_F32.interpolateDeformedPoint
void interpolateDeformedPoint(float v_x , float v_y , Point2D_F32 deformed ) { // sample the closest point and x+1,y+1 int x0 = (int)v_x; int y0 = (int)v_y; int x1 = x0+1; int y1 = y0+1; // make sure the 4 sample points are in bounds if( x1 >= gridCols ) x1 = gridCols-1; if( y1 >= gridRows ) y1 = gridRows-1; // weight along each axis float ax = v_x - x0; float ay = v_y - y0; // bilinear weight for each sample point float w00 = (1.0f - ax) * (1.0f - ay); float w01 = ax * (1.0f - ay); float w11 = ax * ay; float w10 = (1.0f - ax) * ay; // apply weights to each sample point Point2D_F32 d00 = getGrid(y0,x0).deformed; Point2D_F32 d01 = getGrid(y0,x1).deformed; Point2D_F32 d10 = getGrid(y1,x0).deformed; Point2D_F32 d11 = getGrid(y1,x1).deformed; deformed.set(0,0); deformed.x += w00 * d00.x; deformed.x += w01 * d01.x; deformed.x += w11 * d11.x; deformed.x += w10 * d10.x; deformed.y += w00 * d00.y; deformed.y += w01 * d01.y; deformed.y += w11 * d11.y; deformed.y += w10 * d10.y; }
java
void interpolateDeformedPoint(float v_x , float v_y , Point2D_F32 deformed ) { // sample the closest point and x+1,y+1 int x0 = (int)v_x; int y0 = (int)v_y; int x1 = x0+1; int y1 = y0+1; // make sure the 4 sample points are in bounds if( x1 >= gridCols ) x1 = gridCols-1; if( y1 >= gridRows ) y1 = gridRows-1; // weight along each axis float ax = v_x - x0; float ay = v_y - y0; // bilinear weight for each sample point float w00 = (1.0f - ax) * (1.0f - ay); float w01 = ax * (1.0f - ay); float w11 = ax * ay; float w10 = (1.0f - ax) * ay; // apply weights to each sample point Point2D_F32 d00 = getGrid(y0,x0).deformed; Point2D_F32 d01 = getGrid(y0,x1).deformed; Point2D_F32 d10 = getGrid(y1,x0).deformed; Point2D_F32 d11 = getGrid(y1,x1).deformed; deformed.set(0,0); deformed.x += w00 * d00.x; deformed.x += w01 * d01.x; deformed.x += w11 * d11.x; deformed.x += w10 * d10.x; deformed.y += w00 * d00.y; deformed.y += w01 * d01.y; deformed.y += w11 * d11.y; deformed.y += w10 * d10.y; }
[ "void", "interpolateDeformedPoint", "(", "float", "v_x", ",", "float", "v_y", ",", "Point2D_F32", "deformed", ")", "{", "// sample the closest point and x+1,y+1", "int", "x0", "=", "(", "int", ")", "v_x", ";", "int", "y0", "=", "(", "int", ")", "v_y", ";", ...
Samples the 4 grid points around v and performs bilinear interpolation @param v_x Grid coordinate x-axis, undistorted @param v_y Grid coordinate y-axis, undistorted @param deformed Distorted grid coordinate in image pixels
[ "Samples", "the", "4", "grid", "points", "around", "v", "and", "performs", "bilinear", "interpolation" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L298-L338
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/MessageUtil.java
MessageUtil.isMessageExcluded
public static boolean isMessageExcluded(Message message, Recipient recipient) { return isMessageExcluded(message, recipient.getType(), recipient.getValue()); }
java
public static boolean isMessageExcluded(Message message, Recipient recipient) { return isMessageExcluded(message, recipient.getType(), recipient.getValue()); }
[ "public", "static", "boolean", "isMessageExcluded", "(", "Message", "message", ",", "Recipient", "recipient", ")", "{", "return", "isMessageExcluded", "(", "message", ",", "recipient", ".", "getType", "(", ")", ",", "recipient", ".", "getValue", "(", ")", ")",...
Returns true if the message should be excluded based on the given recipient. A message is considered excluded if it has any constraint on the recipient's type and does not have a matching recipient for that type. @param message The message to examine. @param recipient The recipient. @return True if the message should be excluded.
[ "Returns", "true", "if", "the", "message", "should", "be", "excluded", "based", "on", "the", "given", "recipient", ".", "A", "message", "is", "considered", "excluded", "if", "it", "has", "any", "constraint", "on", "the", "recipient", "s", "type", "and", "d...
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/MessageUtil.java#L44-L46
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
MultiUserChat.changeAvailabilityStatus
public void changeAvailabilityStatus(String status, Presence.Mode mode) throws NotConnectedException, InterruptedException, MucNotJoinedException { final EntityFullJid myRoomJid = this.myRoomJid; if (myRoomJid == null) { throw new MucNotJoinedException(this); } // Check that we already have joined the room before attempting to change the // availability status. if (!joined) { throw new MucNotJoinedException(this); } // We change the availability status by sending a presence packet to the room with the // new presence status and mode Presence joinPresence = new Presence(Presence.Type.available); joinPresence.setStatus(status); joinPresence.setMode(mode); joinPresence.setTo(myRoomJid); // Send join packet. connection.sendStanza(joinPresence); }
java
public void changeAvailabilityStatus(String status, Presence.Mode mode) throws NotConnectedException, InterruptedException, MucNotJoinedException { final EntityFullJid myRoomJid = this.myRoomJid; if (myRoomJid == null) { throw new MucNotJoinedException(this); } // Check that we already have joined the room before attempting to change the // availability status. if (!joined) { throw new MucNotJoinedException(this); } // We change the availability status by sending a presence packet to the room with the // new presence status and mode Presence joinPresence = new Presence(Presence.Type.available); joinPresence.setStatus(status); joinPresence.setMode(mode); joinPresence.setTo(myRoomJid); // Send join packet. connection.sendStanza(joinPresence); }
[ "public", "void", "changeAvailabilityStatus", "(", "String", "status", ",", "Presence", ".", "Mode", "mode", ")", "throws", "NotConnectedException", ",", "InterruptedException", ",", "MucNotJoinedException", "{", "final", "EntityFullJid", "myRoomJid", "=", "this", "."...
Changes the occupant's availability status within the room. The presence type will remain available but with a new status that describes the presence update and a new presence mode (e.g. Extended away). @param status a text message describing the presence update. @param mode the mode type for the presence update. @throws NotConnectedException @throws InterruptedException @throws MucNotJoinedException
[ "Changes", "the", "occupant", "s", "availability", "status", "within", "the", "room", ".", "The", "presence", "type", "will", "remain", "available", "but", "with", "a", "new", "status", "that", "describes", "the", "presence", "update", "and", "a", "new", "pr...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java#L1157-L1177
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.getConversation
public void getConversation(@NonNull final String conversationId, @Nullable Callback<ComapiResult<ConversationDetails>> callback) { adapter.adapt(getConversation(conversationId), callback); }
java
public void getConversation(@NonNull final String conversationId, @Nullable Callback<ComapiResult<ConversationDetails>> callback) { adapter.adapt(getConversation(conversationId), callback); }
[ "public", "void", "getConversation", "(", "@", "NonNull", "final", "String", "conversationId", ",", "@", "Nullable", "Callback", "<", "ComapiResult", "<", "ConversationDetails", ">", ">", "callback", ")", "{", "adapter", ".", "adapt", "(", "getConversation", "("...
Returns observable to create a conversation. @param conversationId ID of a conversation to obtain. @param callback Callback to deliver new session instance.
[ "Returns", "observable", "to", "create", "a", "conversation", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L493-L495
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/SmartGrid.java
SmartGrid.setText
public void setText (int row, int column, String text, String style) { setText(row, column, text); if (style != null) { getCellFormatter().setStyleName(row, column, style); } }
java
public void setText (int row, int column, String text, String style) { setText(row, column, text); if (style != null) { getCellFormatter().setStyleName(row, column, style); } }
[ "public", "void", "setText", "(", "int", "row", ",", "int", "column", ",", "String", "text", ",", "String", "style", ")", "{", "setText", "(", "row", ",", "column", ",", "text", ")", ";", "if", "(", "style", "!=", "null", ")", "{", "getCellFormatter"...
Sets the text in the specified cell, with the specified style and column span.
[ "Sets", "the", "text", "in", "the", "specified", "cell", "with", "the", "specified", "style", "and", "column", "span", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/SmartGrid.java#L57-L63
kejunxia/AndroidMvc
library/android-mvc-core/src/main/java/com/shipdream/lib/android/mvc/Controller.java
Controller.runTask
protected <RESULT> Task.Monitor<RESULT> runTask(final Task<RESULT> task, final Task.Callback<RESULT> callback) { return runTask(executorService, task, callback); }
java
protected <RESULT> Task.Monitor<RESULT> runTask(final Task<RESULT> task, final Task.Callback<RESULT> callback) { return runTask(executorService, task, callback); }
[ "protected", "<", "RESULT", ">", "Task", ".", "Monitor", "<", "RESULT", ">", "runTask", "(", "final", "Task", "<", "RESULT", ">", "task", ",", "final", "Task", ".", "Callback", "<", "RESULT", ">", "callback", ")", "{", "return", "runTask", "(", "execut...
Run a task on threads supplied by injected {@link ExecutorService}. By default it runs tasks on separate threads by {@link ExecutorService} injected from AndroidMvc framework. A simple {@link ExecutorService} that runs tasks on the same thread in test cases to make the test easier. <p>The methods of callback will be guaranteed to be run Android's UI thread</p> <p><b> User the protected property {@link UiThreadRunner} to post action back to main UI thread in the method block of {@link Task#execute(Task.Monitor)}. </b></p> <pre> uiThreadRunner.post(new Runnable() { @Override public void run() { view.update(); } }); </pre> @param task The task @param callback The callback @return The monitor to track the state of the execution of the task. It also can cancel the task.
[ "Run", "a", "task", "on", "threads", "supplied", "by", "injected", "{", "@link", "ExecutorService", "}", ".", "By", "default", "it", "runs", "tasks", "on", "separate", "threads", "by", "{", "@link", "ExecutorService", "}", "injected", "from", "AndroidMvc", "...
train
https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/library/android-mvc-core/src/main/java/com/shipdream/lib/android/mvc/Controller.java#L188-L191
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/AbstractReplicator.java
AbstractReplicator.addChangeListener
@NonNull public ListenerToken addChangeListener(Executor executor, @NonNull ReplicatorChangeListener listener) { if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); } synchronized (lock) { if (listener == null) { throw new IllegalArgumentException(); } final ReplicatorChangeListenerToken token = new ReplicatorChangeListenerToken(executor, listener); changeListenerTokens.add(token); return token; } }
java
@NonNull public ListenerToken addChangeListener(Executor executor, @NonNull ReplicatorChangeListener listener) { if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); } synchronized (lock) { if (listener == null) { throw new IllegalArgumentException(); } final ReplicatorChangeListenerToken token = new ReplicatorChangeListenerToken(executor, listener); changeListenerTokens.add(token); return token; } }
[ "@", "NonNull", "public", "ListenerToken", "addChangeListener", "(", "Executor", "executor", ",", "@", "NonNull", "ReplicatorChangeListener", "listener", ")", "{", "if", "(", "listener", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"l...
Set the given ReplicatorChangeListener to the this replicator. @param listener
[ "Set", "the", "given", "ReplicatorChangeListener", "to", "the", "this", "replicator", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/AbstractReplicator.java#L397-L407
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java
IndentedPrintStream.println
public void println(String pattern, Object... arguments) { println(String.format(pattern, arguments)); }
java
public void println(String pattern, Object... arguments) { println(String.format(pattern, arguments)); }
[ "public", "void", "println", "(", "String", "pattern", ",", "Object", "...", "arguments", ")", "{", "println", "(", "String", ".", "format", "(", "pattern", ",", "arguments", ")", ")", ";", "}" ]
Convenience method for calling string.format and printing with line breaks
[ "Convenience", "method", "for", "calling", "string", ".", "format", "and", "printing", "with", "line", "breaks" ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java#L585-L587
alkacon/opencms-core
src/org/opencms/workplace/tools/CmsToolManager.java
CmsToolManager.setCurrentRoot
public void setCurrentRoot(CmsWorkplace wp, String key) { // use last used root if param empty if (CmsStringUtil.isEmpty(key) || key.trim().equals("null")) { key = getCurrentRoot(wp).getKey(); } // set it CmsToolUserData userData = getUserData(wp); userData.setRootKey(key); }
java
public void setCurrentRoot(CmsWorkplace wp, String key) { // use last used root if param empty if (CmsStringUtil.isEmpty(key) || key.trim().equals("null")) { key = getCurrentRoot(wp).getKey(); } // set it CmsToolUserData userData = getUserData(wp); userData.setRootKey(key); }
[ "public", "void", "setCurrentRoot", "(", "CmsWorkplace", "wp", ",", "String", "key", ")", "{", "// use last used root if param empty", "if", "(", "CmsStringUtil", ".", "isEmpty", "(", "key", ")", "||", "key", ".", "trim", "(", ")", ".", "equals", "(", "\"nul...
Sets the current user's root key.<p> @param wp the workplace context @param key the current user's root key to set
[ "Sets", "the", "current", "user", "s", "root", "key", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolManager.java#L553-L562
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Camera.java
Camera.drawFov
public void drawFov(Graphic g, int x, int y, int gridH, int gridV, Surface surface) { final int h = x + (int) Math.floor((getX() + getViewX()) / gridH); final int v = y + (int) -Math.floor((getY() + getHeight()) / gridV); final int tileWidth = getWidth() / gridH; final int tileHeight = getHeight() / gridV; g.drawRect(h, v + surface.getHeight(), tileWidth, tileHeight, false); }
java
public void drawFov(Graphic g, int x, int y, int gridH, int gridV, Surface surface) { final int h = x + (int) Math.floor((getX() + getViewX()) / gridH); final int v = y + (int) -Math.floor((getY() + getHeight()) / gridV); final int tileWidth = getWidth() / gridH; final int tileHeight = getHeight() / gridV; g.drawRect(h, v + surface.getHeight(), tileWidth, tileHeight, false); }
[ "public", "void", "drawFov", "(", "Graphic", "g", ",", "int", "x", ",", "int", "y", ",", "int", "gridH", ",", "int", "gridV", ",", "Surface", "surface", ")", "{", "final", "int", "h", "=", "x", "+", "(", "int", ")", "Math", ".", "floor", "(", "...
Draw the camera field of view according to a grid. @param g The graphic output. @param x The horizontal location. @param y The vertical location. @param gridH The horizontal grid. @param gridV The vertical grid. @param surface The surface referential (minimap).
[ "Draw", "the", "camera", "field", "of", "view", "according", "to", "a", "grid", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Camera.java#L158-L165
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/concurrency/AutoCloseableExecutorService.java
AutoCloseableExecutorService.afterExecute
@Override public void afterExecute(final Runnable runnable, final Throwable throwable) { super.afterExecute(runnable, throwable); if (throwable != null) { // Wrap the throwable in an ExecutionException (execute() does not do this) interruptionChecker.setExecutionException(new ExecutionException("Uncaught exception", throwable)); // execute() was called and an uncaught exception or error was thrown interruptionChecker.interrupt(); } else if (/* throwable == null && */ runnable instanceof Future<?>) { // submit() was called, so throwable is not set try { // This call will not block, since execution has finished ((Future<?>) runnable).get(); } catch (CancellationException | InterruptedException e) { // If this thread was cancelled or interrupted, interrupt other threads interruptionChecker.interrupt(); } catch (final ExecutionException e) { // Record the exception that was thrown by the thread interruptionChecker.setExecutionException(e); // Interrupt other threads interruptionChecker.interrupt(); } } }
java
@Override public void afterExecute(final Runnable runnable, final Throwable throwable) { super.afterExecute(runnable, throwable); if (throwable != null) { // Wrap the throwable in an ExecutionException (execute() does not do this) interruptionChecker.setExecutionException(new ExecutionException("Uncaught exception", throwable)); // execute() was called and an uncaught exception or error was thrown interruptionChecker.interrupt(); } else if (/* throwable == null && */ runnable instanceof Future<?>) { // submit() was called, so throwable is not set try { // This call will not block, since execution has finished ((Future<?>) runnable).get(); } catch (CancellationException | InterruptedException e) { // If this thread was cancelled or interrupted, interrupt other threads interruptionChecker.interrupt(); } catch (final ExecutionException e) { // Record the exception that was thrown by the thread interruptionChecker.setExecutionException(e); // Interrupt other threads interruptionChecker.interrupt(); } } }
[ "@", "Override", "public", "void", "afterExecute", "(", "final", "Runnable", "runnable", ",", "final", "Throwable", "throwable", ")", "{", "super", ".", "afterExecute", "(", "runnable", ",", "throwable", ")", ";", "if", "(", "throwable", "!=", "null", ")", ...
Catch exceptions from both submit() and execute(), and call {@link InterruptionChecker#interrupt()} to interrupt all threads. @param runnable the Runnable @param throwable the Throwable
[ "Catch", "exceptions", "from", "both", "submit", "()", "and", "execute", "()", "and", "call", "{", "@link", "InterruptionChecker#interrupt", "()", "}", "to", "interrupt", "all", "threads", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/concurrency/AutoCloseableExecutorService.java#L65-L88
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyStaticMethods.java
DefaultGroovyStaticMethods.sleepImpl
private static void sleepImpl(long millis, Closure closure) { long start = System.currentTimeMillis(); long rest = millis; long current; while (rest > 0) { try { Thread.sleep(rest); rest = 0; } catch (InterruptedException e) { if (closure != null) { if (DefaultTypeTransformation.castToBoolean(closure.call(e))) { return; } } current = System.currentTimeMillis(); // compensate for closure's time rest = millis + start - current; } } }
java
private static void sleepImpl(long millis, Closure closure) { long start = System.currentTimeMillis(); long rest = millis; long current; while (rest > 0) { try { Thread.sleep(rest); rest = 0; } catch (InterruptedException e) { if (closure != null) { if (DefaultTypeTransformation.castToBoolean(closure.call(e))) { return; } } current = System.currentTimeMillis(); // compensate for closure's time rest = millis + start - current; } } }
[ "private", "static", "void", "sleepImpl", "(", "long", "millis", ",", "Closure", "closure", ")", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "rest", "=", "millis", ";", "long", "current", ";", "while", "(", "rest...
This method is used by both sleep() methods to implement sleeping for the given time even if interrupted @param millis the number of milliseconds to sleep @param closure optional closure called when interrupted as long as the closure returns false the sleep continues
[ "This", "method", "is", "used", "by", "both", "sleep", "()", "methods", "to", "implement", "sleeping", "for", "the", "given", "time", "even", "if", "interrupted" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyStaticMethods.java#L120-L138
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java
LegacyDfuImpl.getStatusCode
private int getStatusCode(@Nullable final byte[] response, final int request) throws UnknownResponseException { if (response == null || response.length != 3 || response[0] != OP_CODE_RESPONSE_CODE_KEY || response[1] != request || response[2] < 1 || response[2] > 6) throw new UnknownResponseException("Invalid response received", response, OP_CODE_RESPONSE_CODE_KEY, request); return response[2]; }
java
private int getStatusCode(@Nullable final byte[] response, final int request) throws UnknownResponseException { if (response == null || response.length != 3 || response[0] != OP_CODE_RESPONSE_CODE_KEY || response[1] != request || response[2] < 1 || response[2] > 6) throw new UnknownResponseException("Invalid response received", response, OP_CODE_RESPONSE_CODE_KEY, request); return response[2]; }
[ "private", "int", "getStatusCode", "(", "@", "Nullable", "final", "byte", "[", "]", "response", ",", "final", "int", "request", ")", "throws", "UnknownResponseException", "{", "if", "(", "response", "==", "null", "||", "response", ".", "length", "!=", "3", ...
Checks whether the response received is valid and returns the status code. @param response the response received from the DFU device. @param request the expected Op Code. @return The status code. @throws UnknownResponseException if response was not valid.
[ "Checks", "whether", "the", "response", "received", "is", "valid", "and", "returns", "the", "status", "code", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java#L574-L580