repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java
CachingXmlDataStore.createCachingXmlDataStore
@Nonnull public static CachingXmlDataStore createCachingXmlDataStore(@Nonnull final File cacheFile, @Nonnull final URL dataUrl, @Nonnull final URL versionUrl, @Nonnull final Charset charset, @Nonnull final DataStore fallback) { Check.notNull(cacheFile, "cacheFile"); Check.notNull(charset, "charset"); Check.notNull(dataUrl, "dataUrl"); Check.notNull(fallback, "fallback"); Check.notNull(versionUrl, "versionUrl"); final DataReader reader = new XmlDataReader(); final DataStore fallbackDataStore = readCacheFileAsFallback(reader, cacheFile, charset, fallback); return new CachingXmlDataStore(reader, dataUrl, versionUrl, charset, cacheFile, fallbackDataStore); }
java
@Nonnull public static CachingXmlDataStore createCachingXmlDataStore(@Nonnull final File cacheFile, @Nonnull final URL dataUrl, @Nonnull final URL versionUrl, @Nonnull final Charset charset, @Nonnull final DataStore fallback) { Check.notNull(cacheFile, "cacheFile"); Check.notNull(charset, "charset"); Check.notNull(dataUrl, "dataUrl"); Check.notNull(fallback, "fallback"); Check.notNull(versionUrl, "versionUrl"); final DataReader reader = new XmlDataReader(); final DataStore fallbackDataStore = readCacheFileAsFallback(reader, cacheFile, charset, fallback); return new CachingXmlDataStore(reader, dataUrl, versionUrl, charset, cacheFile, fallbackDataStore); }
[ "@", "Nonnull", "public", "static", "CachingXmlDataStore", "createCachingXmlDataStore", "(", "@", "Nonnull", "final", "File", "cacheFile", ",", "@", "Nonnull", "final", "URL", "dataUrl", ",", "@", "Nonnull", "final", "URL", "versionUrl", ",", "@", "Nonnull", "fi...
Constructs a new instance of {@code CachingXmlDataStore} with the given arguments. The given {@code cacheFile} can be empty or filled with previously cached data in XML format. The file must be writable otherwise an exception will be thrown. @param cacheFile file with cached <em>UAS data</em> in XML format or empty file @param dataUrl URL to <em>UAS data</em> @param versionUrl URL to version information about the given <em>UAS data</em> @param charset the character set in which the data should be read @param fallback <em>UAS data</em> as fallback in case the data on the specified resource can not be read correctly @return new instance of {@link CachingXmlDataStore} @throws net.sf.qualitycheck.exception.IllegalNullArgumentException if one of the given arguments is {@code null} @throws net.sf.qualitycheck.exception.IllegalNullArgumentException if the given cache file can not be read @throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException if no URL can be resolved to the given given file
[ "Constructs", "a", "new", "instance", "of", "{", "@code", "CachingXmlDataStore", "}", "with", "the", "given", "arguments", ".", "The", "given", "{", "@code", "cacheFile", "}", "can", "be", "empty", "or", "filled", "with", "previously", "cached", "data", "in"...
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java#L173-L185
Whiley/WhileyCompiler
src/main/java/wyil/check/FlowTypeCheck.java
FlowTypeCheck.checkReturn
private Environment checkReturn(Stmt.Return stmt, Environment environment, EnclosingScope scope) throws IOException { // Determine the set of return types for the enclosing function or // method. This then allows us to check the given operands are // appropriate subtypes. Decl.FunctionOrMethod fm = scope.getEnclosingScope(FunctionOrMethodScope.class).getDeclaration(); Tuple<Type> types = fm.getType().getReturns(); // Type check the operands for the return statement (if any) checkMultiExpressions(stmt.getReturns(), environment, types); // Return bottom as following environment to signal that control-flow // cannot continue here. Thus, any following statements will encounter // the BOTTOM environment and, hence, report an appropriate error. return FlowTypeUtils.BOTTOM; }
java
private Environment checkReturn(Stmt.Return stmt, Environment environment, EnclosingScope scope) throws IOException { // Determine the set of return types for the enclosing function or // method. This then allows us to check the given operands are // appropriate subtypes. Decl.FunctionOrMethod fm = scope.getEnclosingScope(FunctionOrMethodScope.class).getDeclaration(); Tuple<Type> types = fm.getType().getReturns(); // Type check the operands for the return statement (if any) checkMultiExpressions(stmt.getReturns(), environment, types); // Return bottom as following environment to signal that control-flow // cannot continue here. Thus, any following statements will encounter // the BOTTOM environment and, hence, report an appropriate error. return FlowTypeUtils.BOTTOM; }
[ "private", "Environment", "checkReturn", "(", "Stmt", ".", "Return", "stmt", ",", "Environment", "environment", ",", "EnclosingScope", "scope", ")", "throws", "IOException", "{", "// Determine the set of return types for the enclosing function or", "// method. This then allows ...
Type check a <code>return</code> statement. If a return expression is given, then we must check that this is well-formed and is a subtype of the enclosing function or method's declared return type. The environment after a return statement is "bottom" because that represents an unreachable program point. @param stmt Statement to type check @param environment Determines the type of all variables immediately going into this block @param scope The stack of enclosing scopes @return @throws ResolveError If a named type within this statement cannot be resolved within the enclosing project.
[ "Type", "check", "a", "<code", ">", "return<", "/", "code", ">", "statement", ".", "If", "a", "return", "expression", "is", "given", "then", "we", "must", "check", "that", "this", "is", "well", "-", "formed", "and", "is", "a", "subtype", "of", "the", ...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L607-L620
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java
AuditUtils.valueChanged
public static boolean valueChanged(String before, String after) { if ((before == null && after == null) || after == null) { return false; } if (before == null) { return true; } return !before.trim().equals(after.trim()); }
java
public static boolean valueChanged(String before, String after) { if ((before == null && after == null) || after == null) { return false; } if (before == null) { return true; } return !before.trim().equals(after.trim()); }
[ "public", "static", "boolean", "valueChanged", "(", "String", "before", ",", "String", "after", ")", "{", "if", "(", "(", "before", "==", "null", "&&", "after", "==", "null", ")", "||", "after", "==", "null", ")", "{", "return", "false", ";", "}", "i...
Returns true only if the value changed. @param before the value before change @param after the value after change @return true if value changed, else false
[ "Returns", "true", "only", "if", "the", "value", "changed", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java#L67-L77
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.getValue
public static double getValue( GridCoverage2D raster, double easting, double northing ) { double[] values = null; try { values = raster.evaluate(new Point2D.Double(easting, northing), (double[]) null); } catch (Exception e) { return doubleNovalue; } return values[0]; }
java
public static double getValue( GridCoverage2D raster, double easting, double northing ) { double[] values = null; try { values = raster.evaluate(new Point2D.Double(easting, northing), (double[]) null); } catch (Exception e) { return doubleNovalue; } return values[0]; }
[ "public", "static", "double", "getValue", "(", "GridCoverage2D", "raster", ",", "double", "easting", ",", "double", "northing", ")", "{", "double", "[", "]", "values", "=", "null", ";", "try", "{", "values", "=", "raster", ".", "evaluate", "(", "new", "P...
Simple method to get a value from a single band raster. <p>Note that this method does always return a value. If invalid, a novalue is returned.</p> @param raster @param easting @param northing @return
[ "Simple", "method", "to", "get", "a", "value", "from", "a", "single", "band", "raster", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1536-L1544
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/business/oauth/AuthRequestHelper.java
AuthRequestHelper.validateAuthorizationRequest
public static boolean validateAuthorizationRequest(AuthRequestDto authRequestDto, OAuthApplicationDto oAuthApplicationDto) throws OAuthException { if (StringUtils.isNotBlank(oAuthApplicationDto.getClientId()) && oAuthApplicationDto.getClientId().equals(authRequestDto.getClientId())) { try { String decodedRedirectUri = java.net.URLDecoder.decode(authRequestDto.getRedirectUri(), "UTF-8"); if (StringUtils.isNotBlank(oAuthApplicationDto.getRedirectUri()) && oAuthApplicationDto.getRedirectUri().equals(decodedRedirectUri)) { return true; } else { _logger.info("Request Redirect URI '" + authRequestDto.getRedirectUri() + "' mismatch"); throw new OAuthException(ResponseCodes.INVALID_OR_MISSING_REDIRECT_URI, HttpResponseStatus.BAD_REQUEST); } } catch (UnsupportedEncodingException e) { _logger.info("Request Redirect URI '" + authRequestDto.getRedirectUri() + "' mismatch"); throw new OAuthException(ResponseCodes.INVALID_OR_MISSING_REDIRECT_URI, HttpResponseStatus.BAD_REQUEST); } } else { _logger.info("Request Client ID '" + authRequestDto.getClientId() + "' mismatch"); throw new OAuthException(ResponseCodes.INVALID_OR_MISSING_CLIENT_ID, HttpResponseStatus.BAD_REQUEST); } }
java
public static boolean validateAuthorizationRequest(AuthRequestDto authRequestDto, OAuthApplicationDto oAuthApplicationDto) throws OAuthException { if (StringUtils.isNotBlank(oAuthApplicationDto.getClientId()) && oAuthApplicationDto.getClientId().equals(authRequestDto.getClientId())) { try { String decodedRedirectUri = java.net.URLDecoder.decode(authRequestDto.getRedirectUri(), "UTF-8"); if (StringUtils.isNotBlank(oAuthApplicationDto.getRedirectUri()) && oAuthApplicationDto.getRedirectUri().equals(decodedRedirectUri)) { return true; } else { _logger.info("Request Redirect URI '" + authRequestDto.getRedirectUri() + "' mismatch"); throw new OAuthException(ResponseCodes.INVALID_OR_MISSING_REDIRECT_URI, HttpResponseStatus.BAD_REQUEST); } } catch (UnsupportedEncodingException e) { _logger.info("Request Redirect URI '" + authRequestDto.getRedirectUri() + "' mismatch"); throw new OAuthException(ResponseCodes.INVALID_OR_MISSING_REDIRECT_URI, HttpResponseStatus.BAD_REQUEST); } } else { _logger.info("Request Client ID '" + authRequestDto.getClientId() + "' mismatch"); throw new OAuthException(ResponseCodes.INVALID_OR_MISSING_CLIENT_ID, HttpResponseStatus.BAD_REQUEST); } }
[ "public", "static", "boolean", "validateAuthorizationRequest", "(", "AuthRequestDto", "authRequestDto", ",", "OAuthApplicationDto", "oAuthApplicationDto", ")", "throws", "OAuthException", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "oAuthApplicationDto", ".", "...
Validates Authorization Request @param authRequestDto Given Application DTO properties @param oAuthApplicationDto Expected Application DTO properties @return Boolean or Exception based on Validation @throws OAuthException Exception related to OAuth
[ "Validates", "Authorization", "Request" ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/business/oauth/AuthRequestHelper.java#L69-L87
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Waiter.java
Waiter.waitForView
public View waitForView(int id, int index, int timeout){ if(timeout == 0){ timeout = Timeout.getSmallTimeout(); } return waitForView(id, index, timeout, false); }
java
public View waitForView(int id, int index, int timeout){ if(timeout == 0){ timeout = Timeout.getSmallTimeout(); } return waitForView(id, index, timeout, false); }
[ "public", "View", "waitForView", "(", "int", "id", ",", "int", "index", ",", "int", "timeout", ")", "{", "if", "(", "timeout", "==", "0", ")", "{", "timeout", "=", "Timeout", ".", "getSmallTimeout", "(", ")", ";", "}", "return", "waitForView", "(", "...
Waits for a certain view. @param view the id of the view to wait for @param index the index of the {@link View}. {@code 0} if only one is available @param timeout the timeout in milliseconds @return the specified View
[ "Waits", "for", "a", "certain", "view", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L383-L388
molgenis/molgenis
molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java
MappingServiceController.scheduleMappingJob
@PostMapping(value = "/map", produces = TEXT_PLAIN_VALUE) public ResponseEntity<String> scheduleMappingJob( @RequestParam String mappingProjectId, @RequestParam String targetEntityTypeId, @RequestParam(required = false) String label, @RequestParam(required = false, name = "package") String rawPackageId, @RequestParam(required = false) Boolean addSourceAttribute) throws URISyntaxException { mappingProjectId = mappingProjectId.trim(); targetEntityTypeId = targetEntityTypeId.trim(); label = trim(label); String packageId = trim(rawPackageId); try { validateEntityName(targetEntityTypeId); if (mappingService.getMappingProject(mappingProjectId) == null) { throw new MolgenisDataException("No mapping project found with ID " + mappingProjectId); } if (packageId != null) { Package aPackage = dataService .getMeta() .getPackage(packageId) .orElseThrow( () -> new MolgenisDataException("No package found with ID " + packageId)); if (isSystemPackage(aPackage)) { throw new MolgenisDataException(format("Package [{0}] is a system package.", packageId)); } } } catch (MolgenisDataException mde) { return ResponseEntity.badRequest().contentType(TEXT_PLAIN).body(mde.getMessage()); } String jobHref = submitMappingJob(mappingProjectId, targetEntityTypeId, addSourceAttribute, packageId, label) .getBody(); return created(new URI(jobHref)).contentType(TEXT_PLAIN).body(jobHref); }
java
@PostMapping(value = "/map", produces = TEXT_PLAIN_VALUE) public ResponseEntity<String> scheduleMappingJob( @RequestParam String mappingProjectId, @RequestParam String targetEntityTypeId, @RequestParam(required = false) String label, @RequestParam(required = false, name = "package") String rawPackageId, @RequestParam(required = false) Boolean addSourceAttribute) throws URISyntaxException { mappingProjectId = mappingProjectId.trim(); targetEntityTypeId = targetEntityTypeId.trim(); label = trim(label); String packageId = trim(rawPackageId); try { validateEntityName(targetEntityTypeId); if (mappingService.getMappingProject(mappingProjectId) == null) { throw new MolgenisDataException("No mapping project found with ID " + mappingProjectId); } if (packageId != null) { Package aPackage = dataService .getMeta() .getPackage(packageId) .orElseThrow( () -> new MolgenisDataException("No package found with ID " + packageId)); if (isSystemPackage(aPackage)) { throw new MolgenisDataException(format("Package [{0}] is a system package.", packageId)); } } } catch (MolgenisDataException mde) { return ResponseEntity.badRequest().contentType(TEXT_PLAIN).body(mde.getMessage()); } String jobHref = submitMappingJob(mappingProjectId, targetEntityTypeId, addSourceAttribute, packageId, label) .getBody(); return created(new URI(jobHref)).contentType(TEXT_PLAIN).body(jobHref); }
[ "@", "PostMapping", "(", "value", "=", "\"/map\"", ",", "produces", "=", "TEXT_PLAIN_VALUE", ")", "public", "ResponseEntity", "<", "String", ">", "scheduleMappingJob", "(", "@", "RequestParam", "String", "mappingProjectId", ",", "@", "RequestParam", "String", "tar...
Schedules a {@link MappingJobExecution}. @param mappingProjectId ID of the mapping project @param targetEntityTypeId ID of the target entity to create or update @param label label of the target entity to create @param rawPackageId ID of the package to put the newly created entity in @return the href of the created MappingJobExecution
[ "Schedules", "a", "{", "@link", "MappingJobExecution", "}", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java#L599-L636
Azure/azure-sdk-for-java
streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java
FunctionsInner.getAsync
public Observable<FunctionInner> getAsync(String resourceGroupName, String jobName, String functionName) { return getWithServiceResponseAsync(resourceGroupName, jobName, functionName).map(new Func1<ServiceResponseWithHeaders<FunctionInner, FunctionsGetHeaders>, FunctionInner>() { @Override public FunctionInner call(ServiceResponseWithHeaders<FunctionInner, FunctionsGetHeaders> response) { return response.body(); } }); }
java
public Observable<FunctionInner> getAsync(String resourceGroupName, String jobName, String functionName) { return getWithServiceResponseAsync(resourceGroupName, jobName, functionName).map(new Func1<ServiceResponseWithHeaders<FunctionInner, FunctionsGetHeaders>, FunctionInner>() { @Override public FunctionInner call(ServiceResponseWithHeaders<FunctionInner, FunctionsGetHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "FunctionInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "jobName", ",", "String", "functionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "jobName", ",", "functionName"...
Gets details about the specified function. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param jobName The name of the streaming job. @param functionName The name of the function. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the FunctionInner object
[ "Gets", "details", "about", "the", "specified", "function", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java#L646-L653
dickschoeller/gedbrowser
gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/FamilyBuilderImpl.java
FamilyBuilderImpl.addChildToFamily
public Child addChildToFamily(final Family family, final Person person) { if (family == null || person == null) { return new Child(); } final FamC famC = new FamC(person, "FAMC", new ObjectId(family.getString())); final Child child = new Child(family, "Child", new ObjectId(person.getString())); family.insert(child); person.insert(famC); return child; }
java
public Child addChildToFamily(final Family family, final Person person) { if (family == null || person == null) { return new Child(); } final FamC famC = new FamC(person, "FAMC", new ObjectId(family.getString())); final Child child = new Child(family, "Child", new ObjectId(person.getString())); family.insert(child); person.insert(famC); return child; }
[ "public", "Child", "addChildToFamily", "(", "final", "Family", "family", ",", "final", "Person", "person", ")", "{", "if", "(", "family", "==", "null", "||", "person", "==", "null", ")", "{", "return", "new", "Child", "(", ")", ";", "}", "final", "FamC...
Add a person as a child in a family. @param person the person @param family the family @return the Child object
[ "Add", "a", "person", "as", "a", "child", "in", "a", "family", "." ]
train
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/FamilyBuilderImpl.java#L141-L152
f2prateek/dart
dart/src/main/java/dart/Dart.java
Dart.bindNavigationModel
public static void bindNavigationModel(Object target, Fragment source) { bindNavigationModel(target, source, Finder.FRAGMENT); }
java
public static void bindNavigationModel(Object target, Fragment source) { bindNavigationModel(target, source, Finder.FRAGMENT); }
[ "public", "static", "void", "bindNavigationModel", "(", "Object", "target", ",", "Fragment", "source", ")", "{", "bindNavigationModel", "(", "target", ",", "source", ",", "Finder", ".", "FRAGMENT", ")", ";", "}" ]
Inject fields annotated with {@link BindExtra} in the specified {@code target} using the {@code source} {@link android.app.Fragment}. @param target Target class for field binding. @param source Activity on which IDs will be looked up. @throws Dart.UnableToInjectException if binding could not be performed. @see android.content.Intent#getExtras()
[ "Inject", "fields", "annotated", "with", "{", "@link", "BindExtra", "}", "in", "the", "specified", "{", "@code", "target", "}", "using", "the", "{", "@code", "source", "}", "{", "@link", "android", ".", "app", ".", "Fragment", "}", "." ]
train
https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/dart/src/main/java/dart/Dart.java#L105-L107
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/conductor/Conductor.java
Conductor.maybeMovePartition
@SuppressWarnings("unchecked") void maybeMovePartition(final short partition) { Observable .timer(50, TimeUnit.MILLISECONDS) .filter(ignored -> { PartitionState ps = sessionState.get(partition); boolean desiredSeqnoReached = ps.isAtEnd(); if (desiredSeqnoReached) { LOGGER.debug("Reached desired high seqno {} for vbucket {}, not reopening stream.", ps.getEndSeqno(), partition); } return !desiredSeqnoReached; }) .flatMapCompletable(ignored -> { PartitionState ps = sessionState.get(partition); return startStreamForPartition( partition, ps.getLastUuid(), ps.getStartSeqno(), ps.getEndSeqno(), ps.getSnapshotStartSeqno(), ps.getSnapshotEndSeqno() ).retryWhen(anyOf(NotMyVbucketException.class) .max(Integer.MAX_VALUE) .delay(Delay.fixed(200, TimeUnit.MILLISECONDS)) .build()); }).toCompletable().subscribe(new CompletableSubscriber() { @Override public void onCompleted() { LOGGER.trace("Completed Partition Move for partition {}", partition); } @Override public void onError(Throwable e) { if (e instanceof RollbackException) { // Benign, so don't log a scary stack trace. A synthetic "rollback" message has been passed // to the Control Event Handler, which may react by calling Client.rollbackAndRestartStream(). LOGGER.warn("Rollback during Partition Move for partition {}", partition); } else { LOGGER.warn("Error during Partition Move for partition {}", partition, e); } if (env.eventBus() != null) { env.eventBus().publish(new FailedToMovePartitionEvent(partition, e)); } } @Override public void onSubscribe(Subscription d) { LOGGER.debug("Subscribing for Partition Move for partition {}", partition); } }); }
java
@SuppressWarnings("unchecked") void maybeMovePartition(final short partition) { Observable .timer(50, TimeUnit.MILLISECONDS) .filter(ignored -> { PartitionState ps = sessionState.get(partition); boolean desiredSeqnoReached = ps.isAtEnd(); if (desiredSeqnoReached) { LOGGER.debug("Reached desired high seqno {} for vbucket {}, not reopening stream.", ps.getEndSeqno(), partition); } return !desiredSeqnoReached; }) .flatMapCompletable(ignored -> { PartitionState ps = sessionState.get(partition); return startStreamForPartition( partition, ps.getLastUuid(), ps.getStartSeqno(), ps.getEndSeqno(), ps.getSnapshotStartSeqno(), ps.getSnapshotEndSeqno() ).retryWhen(anyOf(NotMyVbucketException.class) .max(Integer.MAX_VALUE) .delay(Delay.fixed(200, TimeUnit.MILLISECONDS)) .build()); }).toCompletable().subscribe(new CompletableSubscriber() { @Override public void onCompleted() { LOGGER.trace("Completed Partition Move for partition {}", partition); } @Override public void onError(Throwable e) { if (e instanceof RollbackException) { // Benign, so don't log a scary stack trace. A synthetic "rollback" message has been passed // to the Control Event Handler, which may react by calling Client.rollbackAndRestartStream(). LOGGER.warn("Rollback during Partition Move for partition {}", partition); } else { LOGGER.warn("Error during Partition Move for partition {}", partition, e); } if (env.eventBus() != null) { env.eventBus().publish(new FailedToMovePartitionEvent(partition, e)); } } @Override public void onSubscribe(Subscription d) { LOGGER.debug("Subscribing for Partition Move for partition {}", partition); } }); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "void", "maybeMovePartition", "(", "final", "short", "partition", ")", "{", "Observable", ".", "timer", "(", "50", ",", "TimeUnit", ".", "MILLISECONDS", ")", ".", "filter", "(", "ignored", "->", "{", "Parti...
Called by the {@link DcpChannel} to signal a stream end done by the server and it most likely needs to be moved over to a new node during rebalance/failover. @param partition the partition to move if needed
[ "Called", "by", "the", "{", "@link", "DcpChannel", "}", "to", "signal", "a", "stream", "end", "done", "by", "the", "server", "and", "it", "most", "likely", "needs", "to", "be", "moved", "over", "to", "a", "new", "node", "during", "rebalance", "/", "fai...
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/conductor/Conductor.java#L324-L375
jglobus/JGlobus
io/src/main/java/org/globus/io/urlcopy/UrlCopy.java
UrlCopy.createFTPConnection
private FTPClient createFTPConnection(GlobusURL ftpURL, boolean srcSide) throws Exception { String protocol = ftpURL.getProtocol(); if (protocol.equalsIgnoreCase("ftp")) { FTPClient ftp = new FTPClient(ftpURL.getHost(), ftpURL.getPort()); ftp.authorize(ftpURL.getUser(), ftpURL.getPwd()); return ftp; } else { GridFTPClient ftp = new GridFTPClient(ftpURL.getHost(), ftpURL.getPort()); if (srcSide) { Authorization auth = getSourceAuthorization(); if (auth == null) { auth = HostAuthorization.getInstance(); } ftp.setAuthorization(auth); ftp.authenticate(getSourceCredentials()); } else { Authorization auth = getDestinationAuthorization(); if (auth == null) { auth = HostAuthorization.getInstance(); } ftp.setAuthorization(auth); ftp.authenticate(getDestinationCredentials()); } if (tcpBufferSize != 0) { ftp.setTCPBufferSize(tcpBufferSize); } return ftp; } }
java
private FTPClient createFTPConnection(GlobusURL ftpURL, boolean srcSide) throws Exception { String protocol = ftpURL.getProtocol(); if (protocol.equalsIgnoreCase("ftp")) { FTPClient ftp = new FTPClient(ftpURL.getHost(), ftpURL.getPort()); ftp.authorize(ftpURL.getUser(), ftpURL.getPwd()); return ftp; } else { GridFTPClient ftp = new GridFTPClient(ftpURL.getHost(), ftpURL.getPort()); if (srcSide) { Authorization auth = getSourceAuthorization(); if (auth == null) { auth = HostAuthorization.getInstance(); } ftp.setAuthorization(auth); ftp.authenticate(getSourceCredentials()); } else { Authorization auth = getDestinationAuthorization(); if (auth == null) { auth = HostAuthorization.getInstance(); } ftp.setAuthorization(auth); ftp.authenticate(getDestinationCredentials()); } if (tcpBufferSize != 0) { ftp.setTCPBufferSize(tcpBufferSize); } return ftp; } }
[ "private", "FTPClient", "createFTPConnection", "(", "GlobusURL", "ftpURL", ",", "boolean", "srcSide", ")", "throws", "Exception", "{", "String", "protocol", "=", "ftpURL", ".", "getProtocol", "(", ")", ";", "if", "(", "protocol", ".", "equalsIgnoreCase", "(", ...
Creates ftp connection based on the ftp url (secure vs. unsecure)
[ "Creates", "ftp", "connection", "based", "on", "the", "ftp", "url", "(", "secure", "vs", ".", "unsecure", ")" ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/io/src/main/java/org/globus/io/urlcopy/UrlCopy.java#L834-L875
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.takeWhile
public static <U> Stream<U> takeWhile(final Stream<U> stream, final Predicate<? super U> predicate) { return StreamSupport.stream(new LimitWhileSpliterator<>(stream.spliterator(), predicate),stream.isParallel()); }
java
public static <U> Stream<U> takeWhile(final Stream<U> stream, final Predicate<? super U> predicate) { return StreamSupport.stream(new LimitWhileSpliterator<>(stream.spliterator(), predicate),stream.isParallel()); }
[ "public", "static", "<", "U", ">", "Stream", "<", "U", ">", "takeWhile", "(", "final", "Stream", "<", "U", ">", "stream", ",", "final", "Predicate", "<", "?", "super", "U", ">", "predicate", ")", "{", "return", "StreamSupport", ".", "stream", "(", "n...
Take elements from a stream while the predicates hold <pre> {@code Streams.takeWhile(Stream.of(4,3,6,7).sorted(),i->i<6).collect(CyclopsCollectors.toList()); //[4,3] } </pre> @param stream @param predicate @return
[ "Take", "elements", "from", "a", "stream", "while", "the", "predicates", "hold", "<pre", ">", "{" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L1292-L1294
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/Fragments.java
Fragments.detachedAnnotation
public static Annotation detachedAnnotation(@NonNull AnnotationType type, int start, int end) { return new Annotation(type, start, end); }
java
public static Annotation detachedAnnotation(@NonNull AnnotationType type, int start, int end) { return new Annotation(type, start, end); }
[ "public", "static", "Annotation", "detachedAnnotation", "(", "@", "NonNull", "AnnotationType", "type", ",", "int", "start", ",", "int", "end", ")", "{", "return", "new", "Annotation", "(", "type", ",", "start", ",", "end", ")", ";", "}" ]
Creates a detached annotation, i.e. no document associated with it. @param type the type of annotation @param start the start of the span @param end the end of the span @return the annotation
[ "Creates", "a", "detached", "annotation", "i", ".", "e", ".", "no", "document", "associated", "with", "it", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/Fragments.java#L56-L58
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java
TitlePaneMenuButtonPainter.paintHover
private void paintHover(Graphics2D g, JComponent c, int width, int height) { paintMenu(g, c, width, height, hover); }
java
private void paintHover(Graphics2D g, JComponent c, int width, int height) { paintMenu(g, c, width, height, hover); }
[ "private", "void", "paintHover", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "paintMenu", "(", "g", ",", "c", ",", "width", ",", "height", ",", "hover", ")", ";", "}" ]
Paint the background mouse-over state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "background", "mouse", "-", "over", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java#L122-L124
jayantk/jklol
src/com/jayantkrish/jklol/cfg/CfgParseChart.java
CfgParseChart.getMarginalEntries
public Factor getMarginalEntries(int spanStart, int spanEnd) { return getOutsideEntries(spanStart, spanEnd).product(getInsideEntries(spanStart, spanEnd)); }
java
public Factor getMarginalEntries(int spanStart, int spanEnd) { return getOutsideEntries(spanStart, spanEnd).product(getInsideEntries(spanStart, spanEnd)); }
[ "public", "Factor", "getMarginalEntries", "(", "int", "spanStart", ",", "int", "spanEnd", ")", "{", "return", "getOutsideEntries", "(", "spanStart", ",", "spanEnd", ")", ".", "product", "(", "getInsideEntries", "(", "spanStart", ",", "spanEnd", ")", ")", ";", ...
Get the marginal unnormalized probabilities over productions at a particular node in the tree.
[ "Get", "the", "marginal", "unnormalized", "probabilities", "over", "productions", "at", "a", "particular", "node", "in", "the", "tree", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParseChart.java#L277-L279
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readPropertyDefinition
public CmsPropertyDefinition readPropertyDefinition(CmsRequestContext context, String name) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsPropertyDefinition result = null; try { result = m_driverManager.readPropertyDefinition(dbc, name); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_PROPDEF_1, name), e); } finally { dbc.clear(); } return result; }
java
public CmsPropertyDefinition readPropertyDefinition(CmsRequestContext context, String name) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsPropertyDefinition result = null; try { result = m_driverManager.readPropertyDefinition(dbc, name); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_PROPDEF_1, name), e); } finally { dbc.clear(); } return result; }
[ "public", "CmsPropertyDefinition", "readPropertyDefinition", "(", "CmsRequestContext", "context", ",", "String", "name", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "CmsPropertyDefi...
Reads a property definition.<p> If no property definition with the given name is found, <code>null</code> is returned.<p> @param context the current request context @param name the name of the property definition to read @return the property definition that was read @throws CmsException a CmsDbEntryNotFoundException is thrown if the property definition does not exist
[ "Reads", "a", "property", "definition", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4806-L4818
TimotheeJeannin/ProviGen
ProviGenLib/src/com/tjeannin/provigen/helper/TableBuilder.java
TableBuilder.addConstraint
public TableBuilder addConstraint(String columnName, String constraintType, String constraintConflictClause) { constraints.add(new Constraint(columnName, constraintType, constraintConflictClause)); return this; }
java
public TableBuilder addConstraint(String columnName, String constraintType, String constraintConflictClause) { constraints.add(new Constraint(columnName, constraintType, constraintConflictClause)); return this; }
[ "public", "TableBuilder", "addConstraint", "(", "String", "columnName", ",", "String", "constraintType", ",", "String", "constraintConflictClause", ")", "{", "constraints", ".", "add", "(", "new", "Constraint", "(", "columnName", ",", "constraintType", ",", "constra...
Adds the specified constraint to the created table. @param columnName The name of the column on which the constraint is applied. @param constraintType The type of constraint to apply. One of <ul> <li>{@link com.tjeannin.provigen.model.Constraint#UNIQUE}</li> <li>{@link com.tjeannin.provigen.model.Constraint#NOT_NULL}</li> </ul> @param constraintConflictClause The conflict clause to apply in case of constraint violation. One of <ul> <li>{@link com.tjeannin.provigen.model.Constraint.OnConflict#ABORT}</li> <li>{@link com.tjeannin.provigen.model.Constraint.OnConflict#FAIL}</li> <li>{@link com.tjeannin.provigen.model.Constraint.OnConflict#IGNORE}</li> <li>{@link com.tjeannin.provigen.model.Constraint.OnConflict#REPLACE}</li> <li>{@link com.tjeannin.provigen.model.Constraint.OnConflict#ROLLBACK}</li> </ul> @return The {@link com.tjeannin.provigen.helper.TableBuilder} instance to allow chaining.
[ "Adds", "the", "specified", "constraint", "to", "the", "created", "table", "." ]
train
https://github.com/TimotheeJeannin/ProviGen/blob/80c8a2021434a44e8d38c69407e3e6abf70cf21e/ProviGenLib/src/com/tjeannin/provigen/helper/TableBuilder.java#L48-L51
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java
SftpClient.get
public SftpFileAttributes get(String remote, String local, FileTransferProgress progress) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return get(remote, local, progress, false); }
java
public SftpFileAttributes get(String remote, String local, FileTransferProgress progress) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return get(remote, local, progress, false); }
[ "public", "SftpFileAttributes", "get", "(", "String", "remote", ",", "String", "local", ",", "FileTransferProgress", "progress", ")", "throws", "FileNotFoundException", ",", "SftpStatusException", ",", "SshException", ",", "TransferCancelledException", "{", "return", "g...
<p> Download the remote file to the local computer. If the paths provided are not absolute the current working directory is used. </p> @param remote the path/name of the remote file @param local the path/name to place the file on the local computer @param progress @return the downloaded file's attributes @throws SftpStatusException @throws FileNotFoundException @throws SshException @throws TransferCancelledException
[ "<p", ">", "Download", "the", "remote", "file", "to", "the", "local", "computer", ".", "If", "the", "paths", "provided", "are", "not", "absolute", "the", "current", "working", "directory", "is", "used", ".", "<", "/", "p", ">" ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L937-L941
Stratio/deep-spark
deep-cassandra/src/main/java/com/stratio/deep/cassandra/cql/RangeUtils.java
RangeUtils.bisectTokeRange
private static void bisectTokeRange( DeepTokenRange range, final IPartitioner partitioner, final int bisectFactor, final List<DeepTokenRange> accumulator) { final AbstractType tkValidator = partitioner.getTokenValidator(); Token leftToken = partitioner.getTokenFactory().fromByteArray(tkValidator.decompose(range.getStartToken())); Token rightToken = partitioner.getTokenFactory().fromByteArray(tkValidator.decompose(range.getEndToken())); Token midToken = partitioner.midpoint(leftToken, rightToken); Comparable midpoint = (Comparable) tkValidator.compose(tkValidator.fromString(midToken.toString())); DeepTokenRange left = new DeepTokenRange(range.getStartToken(), midpoint, range.getReplicas()); DeepTokenRange right = new DeepTokenRange(midpoint, range.getEndToken(), range.getReplicas()); if (bisectFactor / 2 <= 1) { accumulator.add(left); accumulator.add(right); } else { bisectTokeRange(left, partitioner, bisectFactor / 2, accumulator); bisectTokeRange(right, partitioner, bisectFactor / 2, accumulator); } }
java
private static void bisectTokeRange( DeepTokenRange range, final IPartitioner partitioner, final int bisectFactor, final List<DeepTokenRange> accumulator) { final AbstractType tkValidator = partitioner.getTokenValidator(); Token leftToken = partitioner.getTokenFactory().fromByteArray(tkValidator.decompose(range.getStartToken())); Token rightToken = partitioner.getTokenFactory().fromByteArray(tkValidator.decompose(range.getEndToken())); Token midToken = partitioner.midpoint(leftToken, rightToken); Comparable midpoint = (Comparable) tkValidator.compose(tkValidator.fromString(midToken.toString())); DeepTokenRange left = new DeepTokenRange(range.getStartToken(), midpoint, range.getReplicas()); DeepTokenRange right = new DeepTokenRange(midpoint, range.getEndToken(), range.getReplicas()); if (bisectFactor / 2 <= 1) { accumulator.add(left); accumulator.add(right); } else { bisectTokeRange(left, partitioner, bisectFactor / 2, accumulator); bisectTokeRange(right, partitioner, bisectFactor / 2, accumulator); } }
[ "private", "static", "void", "bisectTokeRange", "(", "DeepTokenRange", "range", ",", "final", "IPartitioner", "partitioner", ",", "final", "int", "bisectFactor", ",", "final", "List", "<", "DeepTokenRange", ">", "accumulator", ")", "{", "final", "AbstractType", "t...
Recursive function that splits a given token range to a given number of token ranges. @param range the token range to be splitted. @param partitioner the cassandra partitioner. @param bisectFactor the actual number of pieces the original token range will be splitted to. @param accumulator a token range accumulator (ne
[ "Recursive", "function", "that", "splits", "a", "given", "token", "range", "to", "a", "given", "number", "of", "token", "ranges", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/cql/RangeUtils.java#L209-L231
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/SqlTileWriter.java
SqlTileWriter.getRowCount
protected long getRowCount(final String pWhereClause, final String[] pWhereClauseArgs) { Cursor cursor = null; try { final SQLiteDatabase db = getDb(); if (db == null || !db.isOpen()) { return -1; } cursor = db.rawQuery( "select count(*) from " + TABLE + (pWhereClause == null ? "" : " where " + pWhereClause), pWhereClauseArgs); if (cursor.moveToFirst()) { return cursor.getLong(0); } } catch (Exception ex) { catchException(ex); } finally { if (cursor != null) { cursor.close(); } } return -1; }
java
protected long getRowCount(final String pWhereClause, final String[] pWhereClauseArgs) { Cursor cursor = null; try { final SQLiteDatabase db = getDb(); if (db == null || !db.isOpen()) { return -1; } cursor = db.rawQuery( "select count(*) from " + TABLE + (pWhereClause == null ? "" : " where " + pWhereClause), pWhereClauseArgs); if (cursor.moveToFirst()) { return cursor.getLong(0); } } catch (Exception ex) { catchException(ex); } finally { if (cursor != null) { cursor.close(); } } return -1; }
[ "protected", "long", "getRowCount", "(", "final", "String", "pWhereClause", ",", "final", "String", "[", "]", "pWhereClauseArgs", ")", "{", "Cursor", "cursor", "=", "null", ";", "try", "{", "final", "SQLiteDatabase", "db", "=", "getDb", "(", ")", ";", "if"...
Count cache tiles: helper method @since 6.0.2 @return the number of tiles, or -1 if a problem occurred
[ "Count", "cache", "tiles", ":", "helper", "method" ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/SqlTileWriter.java#L424-L445
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java
BoxApiFile.getUploadRequest
public BoxRequestsFile.UploadFile getUploadRequest(File file, String destinationFolderId) { BoxRequestsFile.UploadFile request = new BoxRequestsFile.UploadFile(file, destinationFolderId, getFileUploadUrl(), mSession); return request; }
java
public BoxRequestsFile.UploadFile getUploadRequest(File file, String destinationFolderId) { BoxRequestsFile.UploadFile request = new BoxRequestsFile.UploadFile(file, destinationFolderId, getFileUploadUrl(), mSession); return request; }
[ "public", "BoxRequestsFile", ".", "UploadFile", "getUploadRequest", "(", "File", "file", ",", "String", "destinationFolderId", ")", "{", "BoxRequestsFile", ".", "UploadFile", "request", "=", "new", "BoxRequestsFile", ".", "UploadFile", "(", "file", ",", "destination...
Gets a request that uploads a file from an existing file @param file file to upload @param destinationFolderId id of the parent folder for the new file @return request to upload a file from an existing file
[ "Gets", "a", "request", "that", "uploads", "a", "file", "from", "an", "existing", "file" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L324-L327
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/parser/JSONParser.java
JSONParser.parse
public <T> T parse(String in, Class<T> mapTo) throws ParseException { return getPString().parse(in, JSONValue.defaultReader.getMapper(mapTo)); }
java
public <T> T parse(String in, Class<T> mapTo) throws ParseException { return getPString().parse(in, JSONValue.defaultReader.getMapper(mapTo)); }
[ "public", "<", "T", ">", "T", "parse", "(", "String", "in", ",", "Class", "<", "T", ">", "mapTo", ")", "throws", "ParseException", "{", "return", "getPString", "(", ")", ".", "parse", "(", "in", ",", "JSONValue", ".", "defaultReader", ".", "getMapper",...
use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory
[ "use", "to", "return", "Primitive", "Type", "or", "String", "Or", "JsonObject", "or", "JsonArray", "generated", "by", "a", "ContainerFactory" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParser.java#L278-L280
michael-rapp/AndroidMaterialDialog
example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java
PreferenceFragment.createThemeChangeListener
private OnPreferenceChangeListener createThemeChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { getActivity().recreate(); return true; } }; }
java
private OnPreferenceChangeListener createThemeChangeListener() { return new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { getActivity().recreate(); return true; } }; }
[ "private", "OnPreferenceChangeListener", "createThemeChangeListener", "(", ")", "{", "return", "new", "OnPreferenceChangeListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPreferenceChange", "(", "final", "Preference", "preference", ",", "final", "Object...
Creates and returns a listener, which allows to adapt the app's theme, when the value of the corresponding preference has been changed. @return The listener, which has been created, as an instance of the type {@link OnPreferenceChangeListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "adapt", "the", "app", "s", "theme", "when", "the", "value", "of", "the", "corresponding", "preference", "has", "been", "changed", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java#L270-L280
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/Text.java
Text.styledContent
public static Text styledContent(final String text, final TextStyle ts) { return Text.builder().parStyledContent(text, ts).build(); }
java
public static Text styledContent(final String text, final TextStyle ts) { return Text.builder().parStyledContent(text, ts).build(); }
[ "public", "static", "Text", "styledContent", "(", "final", "String", "text", ",", "final", "TextStyle", "ts", ")", "{", "return", "Text", ".", "builder", "(", ")", ".", "parStyledContent", "(", "text", ",", "ts", ")", ".", "build", "(", ")", ";", "}" ]
Create a simple Text object with a style @param text the text content @param ts the style @return the Text
[ "Create", "a", "simple", "Text", "object", "with", "a", "style" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/Text.java#L98-L100
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java
RoaringBitmap.orCardinality
public static int orCardinality(final RoaringBitmap x1, final RoaringBitmap x2) { // we use the fact that the cardinality of the bitmaps is known so that // the union is just the total cardinality minus the intersection return x1.getCardinality() + x2.getCardinality() - andCardinality(x1, x2); }
java
public static int orCardinality(final RoaringBitmap x1, final RoaringBitmap x2) { // we use the fact that the cardinality of the bitmaps is known so that // the union is just the total cardinality minus the intersection return x1.getCardinality() + x2.getCardinality() - andCardinality(x1, x2); }
[ "public", "static", "int", "orCardinality", "(", "final", "RoaringBitmap", "x1", ",", "final", "RoaringBitmap", "x2", ")", "{", "// we use the fact that the cardinality of the bitmaps is known so that", "// the union is just the total cardinality minus the intersection", "return", ...
Cardinality of the bitwise OR (union) operation. The provided bitmaps are *not* modified. This operation is thread-safe as long as the provided bitmaps remain unchanged. If you have more than 2 bitmaps, consider using the FastAggregation class. @param x1 first bitmap @param x2 other bitmap @return cardinality of the union @see FastAggregation#or(RoaringBitmap...) @see FastAggregation#horizontal_or(RoaringBitmap...)
[ "Cardinality", "of", "the", "bitwise", "OR", "(", "union", ")", "operation", ".", "The", "provided", "bitmaps", "are", "*", "not", "*", "modified", ".", "This", "operation", "is", "thread", "-", "safe", "as", "long", "as", "the", "provided", "bitmaps", "...
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java#L843-L847
google/closure-compiler
src/com/google/javascript/jscomp/CrossChunkMethodMotion.java
CrossChunkMethodMotion.createStubCall
private Node createStubCall(Node originalDefinition, int stubId) { return astFactory .createCall( // We can't look up the type of the stub creating method, because we add its // definition after type checking. astFactory.createNameWithUnknownType(STUB_METHOD_NAME), astFactory.createNumber(stubId)) .useSourceInfoIfMissingFromForTree(originalDefinition); }
java
private Node createStubCall(Node originalDefinition, int stubId) { return astFactory .createCall( // We can't look up the type of the stub creating method, because we add its // definition after type checking. astFactory.createNameWithUnknownType(STUB_METHOD_NAME), astFactory.createNumber(stubId)) .useSourceInfoIfMissingFromForTree(originalDefinition); }
[ "private", "Node", "createStubCall", "(", "Node", "originalDefinition", ",", "int", "stubId", ")", "{", "return", "astFactory", ".", "createCall", "(", "// We can't look up the type of the stub creating method, because we add its", "// definition after type checking.", "astFactor...
Returns a new Node to be used as the stub definition for a method. @param originalDefinition function Node whose definition is being stubbed @param stubId ID to use for stubbing and unstubbing @return a Node that looks like <code>JSCompiler_stubMethod(0)</code>
[ "Returns", "a", "new", "Node", "to", "be", "used", "as", "the", "stub", "definition", "for", "a", "method", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CrossChunkMethodMotion.java#L383-L390
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/Drawer.java
Drawer.setHeader
public void setHeader(@NonNull View view, boolean padding, boolean divider) { setHeader(view, padding, divider, null); }
java
public void setHeader(@NonNull View view, boolean padding, boolean divider) { setHeader(view, padding, divider, null); }
[ "public", "void", "setHeader", "(", "@", "NonNull", "View", "view", ",", "boolean", "padding", ",", "boolean", "divider", ")", "{", "setHeader", "(", "view", ",", "padding", ",", "divider", ",", "null", ")", ";", "}" ]
method to replace a previous set header @param view @param padding @param divider
[ "method", "to", "replace", "a", "previous", "set", "header" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java#L324-L326
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/deeplearning4j-scaleout-parallelwrapper/src/main/java/org/deeplearning4j/parallelism/ParallelWrapper.java
ParallelWrapper.setListeners
public void setListeners(StatsStorageRouter statsStorage, Collection<? extends TrainingListener> listeners) { //Check if we have any RoutingIterationListener instances that need a StatsStorage implementation... if (listeners != null) { for (TrainingListener l : listeners) { if (l instanceof RoutingIterationListener) { RoutingIterationListener rl = (RoutingIterationListener) l; if (statsStorage == null && rl.getStorageRouter() == null) { log.warn("RoutingIterationListener provided without providing any StatsStorage instance. Iterator may not function without one. Listener: {}", l); } } } this.listeners.addAll(listeners); } else { this.listeners.clear(); } this.storageRouter = statsStorage; }
java
public void setListeners(StatsStorageRouter statsStorage, Collection<? extends TrainingListener> listeners) { //Check if we have any RoutingIterationListener instances that need a StatsStorage implementation... if (listeners != null) { for (TrainingListener l : listeners) { if (l instanceof RoutingIterationListener) { RoutingIterationListener rl = (RoutingIterationListener) l; if (statsStorage == null && rl.getStorageRouter() == null) { log.warn("RoutingIterationListener provided without providing any StatsStorage instance. Iterator may not function without one. Listener: {}", l); } } } this.listeners.addAll(listeners); } else { this.listeners.clear(); } this.storageRouter = statsStorage; }
[ "public", "void", "setListeners", "(", "StatsStorageRouter", "statsStorage", ",", "Collection", "<", "?", "extends", "TrainingListener", ">", "listeners", ")", "{", "//Check if we have any RoutingIterationListener instances that need a StatsStorage implementation...", "if", "(", ...
Set the listeners, along with a StatsStorageRouter that the results will be shuffled to (in the case of any listeners that implement the {@link RoutingIterationListener} interface) @param statsStorage Stats storage router to place the results into @param listeners Listeners to set
[ "Set", "the", "listeners", "along", "with", "a", "StatsStorageRouter", "that", "the", "results", "will", "be", "shuffled", "to", "(", "in", "the", "case", "of", "any", "listeners", "that", "implement", "the", "{", "@link", "RoutingIterationListener", "}", "int...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/deeplearning4j-scaleout-parallelwrapper/src/main/java/org/deeplearning4j/parallelism/ParallelWrapper.java#L447-L466
dbracewell/mango
src/main/java/com/davidbracewell/config/Config.java
Config.hasProperty
public static boolean hasProperty(String propertyPrefix, String... propertyComponents) { String propertyName = propertyPrefix; if (propertyComponents != null && propertyComponents.length > 0) { propertyName += "." + StringUtils.join(propertyComponents, "."); } return getInstance().properties.containsKey(propertyName) || System.getProperties().contains(propertyName); }
java
public static boolean hasProperty(String propertyPrefix, String... propertyComponents) { String propertyName = propertyPrefix; if (propertyComponents != null && propertyComponents.length > 0) { propertyName += "." + StringUtils.join(propertyComponents, "."); } return getInstance().properties.containsKey(propertyName) || System.getProperties().contains(propertyName); }
[ "public", "static", "boolean", "hasProperty", "(", "String", "propertyPrefix", ",", "String", "...", "propertyComponents", ")", "{", "String", "propertyName", "=", "propertyPrefix", ";", "if", "(", "propertyComponents", "!=", "null", "&&", "propertyComponents", ".",...
Checks if a property is in the config or or set on the system. The property name is constructed as <code>propertyPrefix + . + propertyComponent[0] + . + propertyComponent[1] + ...</code> @param propertyPrefix The prefix @param propertyComponents The components. @return True if the property is known, false if not.
[ "Checks", "if", "a", "property", "is", "in", "the", "config", "or", "or", "set", "on", "the", "system", ".", "The", "property", "name", "is", "constructed", "as", "<code", ">", "propertyPrefix", "+", ".", "+", "propertyComponent", "[", "0", "]", "+", "...
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/config/Config.java#L196-L202
line/armeria
thrift/src/main/java/com/linecorp/armeria/internal/thrift/ThriftFunction.java
ThriftFunction.setSuccess
public void setSuccess(TBase<?, ?> result, Object value) { if (successField != null) { ThriftFieldAccess.set(result, successField, value); } }
java
public void setSuccess(TBase<?, ?> result, Object value) { if (successField != null) { ThriftFieldAccess.set(result, successField, value); } }
[ "public", "void", "setSuccess", "(", "TBase", "<", "?", ",", "?", ">", "result", ",", "Object", "value", ")", "{", "if", "(", "successField", "!=", "null", ")", "{", "ThriftFieldAccess", ".", "set", "(", "result", ",", "successField", ",", "value", ")"...
Sets the success field of the specified {@code result} to the specified {@code value}.
[ "Sets", "the", "success", "field", "of", "the", "specified", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/thrift/src/main/java/com/linecorp/armeria/internal/thrift/ThriftFunction.java#L232-L236
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java
ListManagementImagesImpl.addImageFileInputWithServiceResponseAsync
public Observable<ServiceResponse<Image>> addImageFileInputWithServiceResponseAsync(String listId, byte[] imageStream, AddImageFileInputOptionalParameter addImageFileInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (listId == null) { throw new IllegalArgumentException("Parameter listId is required and cannot be null."); } if (imageStream == null) { throw new IllegalArgumentException("Parameter imageStream is required and cannot be null."); } final Integer tag = addImageFileInputOptionalParameter != null ? addImageFileInputOptionalParameter.tag() : null; final String label = addImageFileInputOptionalParameter != null ? addImageFileInputOptionalParameter.label() : null; return addImageFileInputWithServiceResponseAsync(listId, imageStream, tag, label); }
java
public Observable<ServiceResponse<Image>> addImageFileInputWithServiceResponseAsync(String listId, byte[] imageStream, AddImageFileInputOptionalParameter addImageFileInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (listId == null) { throw new IllegalArgumentException("Parameter listId is required and cannot be null."); } if (imageStream == null) { throw new IllegalArgumentException("Parameter imageStream is required and cannot be null."); } final Integer tag = addImageFileInputOptionalParameter != null ? addImageFileInputOptionalParameter.tag() : null; final String label = addImageFileInputOptionalParameter != null ? addImageFileInputOptionalParameter.label() : null; return addImageFileInputWithServiceResponseAsync(listId, imageStream, tag, label); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Image", ">", ">", "addImageFileInputWithServiceResponseAsync", "(", "String", "listId", ",", "byte", "[", "]", "imageStream", ",", "AddImageFileInputOptionalParameter", "addImageFileInputOptionalParameter", ")", "{", "...
Add an image to the list with list Id equal to list Id passed. @param listId List Id of the image list. @param imageStream The image file. @param addImageFileInputOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Image object
[ "Add", "an", "image", "to", "the", "list", "with", "list", "Id", "equal", "to", "list", "Id", "passed", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java#L747-L761
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java
MaterialPathAnimator.reverseAnimate
public static void reverseAnimate(final Widget source, final Widget target) { reverseAnimate(source.getElement(), target.getElement()); }
java
public static void reverseAnimate(final Widget source, final Widget target) { reverseAnimate(source.getElement(), target.getElement()); }
[ "public", "static", "void", "reverseAnimate", "(", "final", "Widget", "source", ",", "final", "Widget", "target", ")", "{", "reverseAnimate", "(", "source", ".", "getElement", "(", ")", ",", "target", ".", "getElement", "(", ")", ")", ";", "}" ]
Helper method to reverse animate the source element to target element. @param source Source widget to apply the Path Animator @param target Target widget to apply the Path Animator
[ "Helper", "method", "to", "reverse", "animate", "the", "source", "element", "to", "target", "element", "." ]
train
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L223-L225
structr/structr
structr-rest/src/main/java/org/structr/rest/common/XMLHandler.java
XMLHandler.handleSetProperty
private void handleSetProperty(final Element element, final Map<String, Object> entityData, final Map<String, Object> config) { String propertyName = (String)config.get(PROPERTY_NAME); if (propertyName == null) { propertyName = element.tagName; } entityData.put(propertyName, element.text); }
java
private void handleSetProperty(final Element element, final Map<String, Object> entityData, final Map<String, Object> config) { String propertyName = (String)config.get(PROPERTY_NAME); if (propertyName == null) { propertyName = element.tagName; } entityData.put(propertyName, element.text); }
[ "private", "void", "handleSetProperty", "(", "final", "Element", "element", ",", "final", "Map", "<", "String", ",", "Object", ">", "entityData", ",", "final", "Map", "<", "String", ",", "Object", ">", "config", ")", "{", "String", "propertyName", "=", "("...
The setProperty action will not descend further into the collection of children, but will instead evaluate a transformation expression. @param element element @param entityData parent's entity data @param config type configuration
[ "The", "setProperty", "action", "will", "not", "descend", "further", "into", "the", "collection", "of", "children", "but", "will", "instead", "evaluate", "a", "transformation", "expression", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-rest/src/main/java/org/structr/rest/common/XMLHandler.java#L310-L319
tweea/matrixjavalib-main-common
src/main/java/net/matrix/lang/Reflections.java
Reflections.invokeMethodByName
public static <T> T invokeMethodByName(final Object target, final String name, final Object[] parameterValues) { Method method = getAccessibleMethodByName(target, name); if (method == null) { throw new IllegalArgumentException("Could not find method [" + name + "] on target [" + target + ']'); } try { return (T) method.invoke(target, parameterValues); } catch (ReflectiveOperationException e) { throw new ReflectionRuntimeException(e); } }
java
public static <T> T invokeMethodByName(final Object target, final String name, final Object[] parameterValues) { Method method = getAccessibleMethodByName(target, name); if (method == null) { throw new IllegalArgumentException("Could not find method [" + name + "] on target [" + target + ']'); } try { return (T) method.invoke(target, parameterValues); } catch (ReflectiveOperationException e) { throw new ReflectionRuntimeException(e); } }
[ "public", "static", "<", "T", ">", "T", "invokeMethodByName", "(", "final", "Object", "target", ",", "final", "String", "name", ",", "final", "Object", "[", "]", "parameterValues", ")", "{", "Method", "method", "=", "getAccessibleMethodByName", "(", "target", ...
直接调用对象方法,无视 private/protected 修饰符。 用于一次性调用的情况,否则应使用 getAccessibleMethodByName() 函数获得 Method 后反复调用。 只匹配函数名,如果有多个同名函数调用第一个。 @param target 目标对象 @param name 方法名 @param parameterValues 参数值 @param <T> 期待的返回值类型 @return 返回值
[ "直接调用对象方法,无视", "private", "/", "protected", "修饰符。", "用于一次性调用的情况,否则应使用", "getAccessibleMethodByName", "()", "函数获得", "Method", "后反复调用。", "只匹配函数名,如果有多个同名函数调用第一个。" ]
train
https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/lang/Reflections.java#L173-L184
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java
DirectoryConnection.onLossPacket
private void onLossPacket(Packet p) { if (p.respHeader == null) { p.respHeader = new ResponseHeader(-1, -1, ErrorCode.OK); } switch (getStatus()) { case AUTH_FAILED: p.respHeader.setErr(ErrorCode.AUTHENT_FAILED); break; case CLOSED: p.respHeader.setErr(ErrorCode.CLIENT_CLOSED); break; default: p.respHeader.setErr(ErrorCode.CONNECTION_LOSS); } finishPacket(p); }
java
private void onLossPacket(Packet p) { if (p.respHeader == null) { p.respHeader = new ResponseHeader(-1, -1, ErrorCode.OK); } switch (getStatus()) { case AUTH_FAILED: p.respHeader.setErr(ErrorCode.AUTHENT_FAILED); break; case CLOSED: p.respHeader.setErr(ErrorCode.CLIENT_CLOSED); break; default: p.respHeader.setErr(ErrorCode.CONNECTION_LOSS); } finishPacket(p); }
[ "private", "void", "onLossPacket", "(", "Packet", "p", ")", "{", "if", "(", "p", ".", "respHeader", "==", "null", ")", "{", "p", ".", "respHeader", "=", "new", "ResponseHeader", "(", "-", "1", ",", "-", "1", ",", "ErrorCode", ".", "OK", ")", ";", ...
On the Packet lost in the DirectoryConnection. @param p the Packet.
[ "On", "the", "Packet", "lost", "in", "the", "DirectoryConnection", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java#L822-L837
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/compare/CompareFileExtensions.java
CompareFileExtensions.compareFiles
public static IFileContentResultBean compareFiles(final File sourceFile, final File fileToCompare) { return compareFiles(sourceFile, fileToCompare, true, false, false, true, false, true); }
java
public static IFileContentResultBean compareFiles(final File sourceFile, final File fileToCompare) { return compareFiles(sourceFile, fileToCompare, true, false, false, true, false, true); }
[ "public", "static", "IFileContentResultBean", "compareFiles", "(", "final", "File", "sourceFile", ",", "final", "File", "fileToCompare", ")", "{", "return", "compareFiles", "(", "sourceFile", ",", "fileToCompare", ",", "true", ",", "false", ",", "false", ",", "t...
Compare files. @param sourceFile the source file @param fileToCompare the file to compare @return the i file content result bean
[ "Compare", "files", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/CompareFileExtensions.java#L321-L325
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/EventCollector.java
EventCollector.updateManagementGraph
private void updateManagementGraph(final JobID jobID, final ExecutionStateChangeEvent executionStateChangeEvent, String optionalMessage) { synchronized (this.recentManagementGraphs) { final ManagementGraph managementGraph = this.recentManagementGraphs.get(jobID); if (managementGraph == null) { return; } final ManagementVertex vertex = managementGraph.getVertexByID(executionStateChangeEvent.getVertexID()); if (vertex == null) { return; } vertex.setExecutionState(executionStateChangeEvent.getNewExecutionState()); if (executionStateChangeEvent.getNewExecutionState() == ExecutionState.FAILED) { vertex.setOptMessage(optionalMessage); } } }
java
private void updateManagementGraph(final JobID jobID, final ExecutionStateChangeEvent executionStateChangeEvent, String optionalMessage) { synchronized (this.recentManagementGraphs) { final ManagementGraph managementGraph = this.recentManagementGraphs.get(jobID); if (managementGraph == null) { return; } final ManagementVertex vertex = managementGraph.getVertexByID(executionStateChangeEvent.getVertexID()); if (vertex == null) { return; } vertex.setExecutionState(executionStateChangeEvent.getNewExecutionState()); if (executionStateChangeEvent.getNewExecutionState() == ExecutionState.FAILED) { vertex.setOptMessage(optionalMessage); } } }
[ "private", "void", "updateManagementGraph", "(", "final", "JobID", "jobID", ",", "final", "ExecutionStateChangeEvent", "executionStateChangeEvent", ",", "String", "optionalMessage", ")", "{", "synchronized", "(", "this", ".", "recentManagementGraphs", ")", "{", "final",...
Applies changes in the state of an execution vertex to the stored management graph. @param jobID the ID of the job whose management graph shall be updated @param executionStateChangeEvent the event describing the changes in the execution state of the vertex
[ "Applies", "changes", "in", "the", "state", "of", "an", "execution", "vertex", "to", "the", "stored", "management", "graph", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/EventCollector.java#L624-L642
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfoBuilder.java
JSDocInfoBuilder.markAnnotation
public void markAnnotation(String annotation, int lineno, int charno) { JSDocInfo.Marker marker = currentInfo.addMarker(); if (marker != null) { JSDocInfo.TrimmedStringPosition position = new JSDocInfo.TrimmedStringPosition(); position.setItem(annotation); position.setPositionInformation(lineno, charno, lineno, charno + annotation.length()); marker.setAnnotation(position); populated = true; } currentMarker = marker; }
java
public void markAnnotation(String annotation, int lineno, int charno) { JSDocInfo.Marker marker = currentInfo.addMarker(); if (marker != null) { JSDocInfo.TrimmedStringPosition position = new JSDocInfo.TrimmedStringPosition(); position.setItem(annotation); position.setPositionInformation(lineno, charno, lineno, charno + annotation.length()); marker.setAnnotation(position); populated = true; } currentMarker = marker; }
[ "public", "void", "markAnnotation", "(", "String", "annotation", ",", "int", "lineno", ",", "int", "charno", ")", "{", "JSDocInfo", ".", "Marker", "marker", "=", "currentInfo", ".", "addMarker", "(", ")", ";", "if", "(", "marker", "!=", "null", ")", "{",...
Adds a marker to the current JSDocInfo and populates the marker with the annotation information.
[ "Adds", "a", "marker", "to", "the", "current", "JSDocInfo", "and", "populates", "the", "marker", "with", "the", "annotation", "information", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L211-L225
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java
RenameFileExtensions.appendSystemtimeToFilename
public static String appendSystemtimeToFilename(final File fileToRename, final Date add2Name) { final String format = "HHmmssSSS"; String sysTime = null; if (null != add2Name) { final DateFormat df = new SimpleDateFormat(format); sysTime = df.format(add2Name); } else { final DateFormat df = new SimpleDateFormat(format); sysTime = df.format(new Date()); } final String fileName = fileToRename.getName(); final int ext_index = fileName.lastIndexOf("."); final String ext = fileName.substring(ext_index, fileName.length()); String newName = fileName.substring(0, ext_index); newName += "_" + sysTime + ext; return newName; }
java
public static String appendSystemtimeToFilename(final File fileToRename, final Date add2Name) { final String format = "HHmmssSSS"; String sysTime = null; if (null != add2Name) { final DateFormat df = new SimpleDateFormat(format); sysTime = df.format(add2Name); } else { final DateFormat df = new SimpleDateFormat(format); sysTime = df.format(new Date()); } final String fileName = fileToRename.getName(); final int ext_index = fileName.lastIndexOf("."); final String ext = fileName.substring(ext_index, fileName.length()); String newName = fileName.substring(0, ext_index); newName += "_" + sysTime + ext; return newName; }
[ "public", "static", "String", "appendSystemtimeToFilename", "(", "final", "File", "fileToRename", ",", "final", "Date", "add2Name", ")", "{", "final", "String", "format", "=", "\"HHmmssSSS\"", ";", "String", "sysTime", "=", "null", ";", "if", "(", "null", "!="...
Returns the filename from the given file with the systemtime. @param fileToRename The file. @param add2Name Adds the Date to the Filename. @return Returns the filename from the given file with the systemtime.
[ "Returns", "the", "filename", "from", "the", "given", "file", "with", "the", "systemtime", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L77-L98
deephacks/confit
provider-hbase-filter/src/main/java/org/deephacks/confit/internal/hbase/Bytes.java
Bytes.setLong
public static void setLong(final byte[] b, final long n, final int offset) { b[offset + 0] = (byte) (n >>> 56); b[offset + 1] = (byte) (n >>> 48); b[offset + 2] = (byte) (n >>> 40); b[offset + 3] = (byte) (n >>> 32); b[offset + 4] = (byte) (n >>> 24); b[offset + 5] = (byte) (n >>> 16); b[offset + 6] = (byte) (n >>> 8); b[offset + 7] = (byte) (n >>> 0); }
java
public static void setLong(final byte[] b, final long n, final int offset) { b[offset + 0] = (byte) (n >>> 56); b[offset + 1] = (byte) (n >>> 48); b[offset + 2] = (byte) (n >>> 40); b[offset + 3] = (byte) (n >>> 32); b[offset + 4] = (byte) (n >>> 24); b[offset + 5] = (byte) (n >>> 16); b[offset + 6] = (byte) (n >>> 8); b[offset + 7] = (byte) (n >>> 0); }
[ "public", "static", "void", "setLong", "(", "final", "byte", "[", "]", "b", ",", "final", "long", "n", ",", "final", "int", "offset", ")", "{", "b", "[", "offset", "+", "0", "]", "=", "(", "byte", ")", "(", "n", ">>>", "56", ")", ";", "b", "[...
Writes a big-endian 8-byte long at an offset in the given array. @param b The array to write to. @param offset The offset in the array to start writing at. @throws IndexOutOfBoundsException if the byte array is too small.
[ "Writes", "a", "big", "-", "endian", "8", "-", "byte", "long", "at", "an", "offset", "in", "the", "given", "array", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-hbase-filter/src/main/java/org/deephacks/confit/internal/hbase/Bytes.java#L243-L252
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_mailingList_name_subscriber_POST
public OvhTaskMl domain_mailingList_name_subscriber_POST(String domain, String name, String email) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}/subscriber"; StringBuilder sb = path(qPath, domain, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "email", email); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskMl.class); }
java
public OvhTaskMl domain_mailingList_name_subscriber_POST(String domain, String name, String email) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}/subscriber"; StringBuilder sb = path(qPath, domain, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "email", email); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskMl.class); }
[ "public", "OvhTaskMl", "domain_mailingList_name_subscriber_POST", "(", "String", "domain", ",", "String", "name", ",", "String", "email", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/mailingList/{name}/subscriber\"", ";", "StringBuild...
Add subscriber to mailing list REST: POST /email/domain/{domain}/mailingList/{name}/subscriber @param email [required] Email of subscriber @param domain [required] Name of your domain name @param name [required] Name of mailing list
[ "Add", "subscriber", "to", "mailing", "list" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1585-L1592
httl/httl
httl/src/main/java/httl/Engine.java
Engine.getEngine
public static Engine getEngine(String configPath, Properties configProperties) { if (StringUtils.isEmpty(configPath)) { configPath = HTTL_PROPERTIES; } VolatileReference<Engine> reference = ENGINES.get(configPath); if (reference == null) { reference = new VolatileReference<Engine>(); // quickly VolatileReference<Engine> old = ENGINES.putIfAbsent(configPath, reference); if (old != null) { // duplicate reference = old; } } assert (reference != null); Engine engine = reference.get(); if (engine == null) { synchronized (reference) { // reference lock engine = reference.get(); if (engine == null) { // double check engine = BeanFactory.createBean(Engine.class, initProperties(configPath, configProperties)); // slowly reference.set(engine); } } } assert (engine != null); return engine; }
java
public static Engine getEngine(String configPath, Properties configProperties) { if (StringUtils.isEmpty(configPath)) { configPath = HTTL_PROPERTIES; } VolatileReference<Engine> reference = ENGINES.get(configPath); if (reference == null) { reference = new VolatileReference<Engine>(); // quickly VolatileReference<Engine> old = ENGINES.putIfAbsent(configPath, reference); if (old != null) { // duplicate reference = old; } } assert (reference != null); Engine engine = reference.get(); if (engine == null) { synchronized (reference) { // reference lock engine = reference.get(); if (engine == null) { // double check engine = BeanFactory.createBean(Engine.class, initProperties(configPath, configProperties)); // slowly reference.set(engine); } } } assert (engine != null); return engine; }
[ "public", "static", "Engine", "getEngine", "(", "String", "configPath", ",", "Properties", "configProperties", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "configPath", ")", ")", "{", "configPath", "=", "HTTL_PROPERTIES", ";", "}", "VolatileReferenc...
Get template engine singleton. @param configPath - config path @param configProperties - config properties @return template engine
[ "Get", "template", "engine", "singleton", "." ]
train
https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/Engine.java#L105-L130
greese/dasein-cloud-digitalocean
src/main/java/org/dasein/cloud/digitalocean/compute/DOInstance.java
DOInstance.waitForAllDropletEventsToComplete
void waitForAllDropletEventsToComplete(@Nonnull String instanceId, int timeout) throws InternalException, CloudException { APITrace.begin(getProvider(), "listVirtualMachineStatus"); try { // allow maximum five minutes for events to complete long wait = System.currentTimeMillis() + timeout * 60 * 1000; boolean eventsPending = false; while( System.currentTimeMillis() < wait ) { Actions actions = DigitalOceanModelFactory.getDropletEvents(getProvider(), instanceId); for( Action action : actions.getActions() ) { if( "in-progress".equalsIgnoreCase(action.getStatus()) ) { eventsPending = true; } } if( !eventsPending ) { break; } try { // must be careful here not to cause rate limits Thread.sleep(30000); } catch( InterruptedException e ) { break; } } // if events are still pending the cloud will fail the next operation anyway } finally { APITrace.end(); } }
java
void waitForAllDropletEventsToComplete(@Nonnull String instanceId, int timeout) throws InternalException, CloudException { APITrace.begin(getProvider(), "listVirtualMachineStatus"); try { // allow maximum five minutes for events to complete long wait = System.currentTimeMillis() + timeout * 60 * 1000; boolean eventsPending = false; while( System.currentTimeMillis() < wait ) { Actions actions = DigitalOceanModelFactory.getDropletEvents(getProvider(), instanceId); for( Action action : actions.getActions() ) { if( "in-progress".equalsIgnoreCase(action.getStatus()) ) { eventsPending = true; } } if( !eventsPending ) { break; } try { // must be careful here not to cause rate limits Thread.sleep(30000); } catch( InterruptedException e ) { break; } } // if events are still pending the cloud will fail the next operation anyway } finally { APITrace.end(); } }
[ "void", "waitForAllDropletEventsToComplete", "(", "@", "Nonnull", "String", "instanceId", ",", "int", "timeout", ")", "throws", "InternalException", ",", "CloudException", "{", "APITrace", ".", "begin", "(", "getProvider", "(", ")", ",", "\"listVirtualMachineStatus\""...
Wait for specified number of minutes for all pending droplet events to complete @param instanceId Id of the droplet @param timeout Time in minutes to wait for events to complete @throws InternalException @throws CloudException
[ "Wait", "for", "specified", "number", "of", "minutes", "for", "all", "pending", "droplet", "events", "to", "complete" ]
train
https://github.com/greese/dasein-cloud-digitalocean/blob/09b74566b24d7f668379fca237524d4cc0335f77/src/main/java/org/dasein/cloud/digitalocean/compute/DOInstance.java#L95-L124
ical4j/ical4j
src/main/java/net/fortuna/ical4j/validate/ParameterValidator.java
ParameterValidator.assertOneOrLess
public void assertOneOrLess(final String paramName, final ParameterList parameters) throws ValidationException { if (parameters.getParameters(paramName).size() > 1) { throw new ValidationException(ASSERT_ONE_OR_LESS_MESSAGE, new Object[] {paramName}); } }
java
public void assertOneOrLess(final String paramName, final ParameterList parameters) throws ValidationException { if (parameters.getParameters(paramName).size() > 1) { throw new ValidationException(ASSERT_ONE_OR_LESS_MESSAGE, new Object[] {paramName}); } }
[ "public", "void", "assertOneOrLess", "(", "final", "String", "paramName", ",", "final", "ParameterList", "parameters", ")", "throws", "ValidationException", "{", "if", "(", "parameters", ".", "getParameters", "(", "paramName", ")", ".", "size", "(", ")", ">", ...
Ensure a parameter occurs no more than once. @param paramName the parameter name @param parameters a list of parameters to query @throws ValidationException when the specified parameter occurs more than once
[ "Ensure", "a", "parameter", "occurs", "no", "more", "than", "once", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/validate/ParameterValidator.java#L73-L79
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Request.java
Request.newUploadVideoRequest
public static Request newUploadVideoRequest(Session session, File file, Callback callback) throws FileNotFoundException { ParcelFileDescriptor descriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); Bundle parameters = new Bundle(1); parameters.putParcelable(file.getName(), descriptor); return new Request(session, MY_VIDEOS, parameters, HttpMethod.POST, callback); }
java
public static Request newUploadVideoRequest(Session session, File file, Callback callback) throws FileNotFoundException { ParcelFileDescriptor descriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); Bundle parameters = new Bundle(1); parameters.putParcelable(file.getName(), descriptor); return new Request(session, MY_VIDEOS, parameters, HttpMethod.POST, callback); }
[ "public", "static", "Request", "newUploadVideoRequest", "(", "Session", "session", ",", "File", "file", ",", "Callback", "callback", ")", "throws", "FileNotFoundException", "{", "ParcelFileDescriptor", "descriptor", "=", "ParcelFileDescriptor", ".", "open", "(", "file...
Creates a new Request configured to upload a photo to the user's default photo album. The photo will be read from the specified file descriptor. @param session the Session to use, or null; if non-null, the session must be in an opened state @param file the file to upload @param callback a callback that will be called when the request is completed to handle success or error conditions @return a Request that is ready to execute
[ "Creates", "a", "new", "Request", "configured", "to", "upload", "a", "photo", "to", "the", "user", "s", "default", "photo", "album", ".", "The", "photo", "will", "be", "read", "from", "the", "specified", "file", "descriptor", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L353-L360
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/ShellParser.java
ShellParser.findPattern
protected String findPattern(String strPattern, String text, int grp) { Pattern pattern = Pattern.compile(strPattern, Pattern.MULTILINE); Matcher matcher = pattern.matcher(text); if (matcher.find(0)) return matcher.group(grp); return null; }
java
protected String findPattern(String strPattern, String text, int grp) { Pattern pattern = Pattern.compile(strPattern, Pattern.MULTILINE); Matcher matcher = pattern.matcher(text); if (matcher.find(0)) return matcher.group(grp); return null; }
[ "protected", "String", "findPattern", "(", "String", "strPattern", ",", "String", "text", ",", "int", "grp", ")", "{", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "strPattern", ",", "Pattern", ".", "MULTILINE", ")", ";", "Matcher", "matcher", ...
Find the first occurence ofa pattern in a piece of text and return a specific group. @param strPattern the regular expression to match @param text the text to search @param grp the number of the matching group to return @return a String containing the matched group of the regular expression
[ "Find", "the", "first", "occurence", "ofa", "pattern", "in", "a", "piece", "of", "text", "and", "return", "a", "specific", "group", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/ShellParser.java#L47-L56
aoindustries/aocode-public
src/main/java/com/aoindustries/util/i18n/ModifiableResourceBundle.java
ModifiableResourceBundle.setObject
public final void setObject(String key, Object value, boolean modified) { if(!isModifiable()) throw new AssertionError("ResourceBundle is not modifiable: "+this); handleSetObject(key, value, modified); }
java
public final void setObject(String key, Object value, boolean modified) { if(!isModifiable()) throw new AssertionError("ResourceBundle is not modifiable: "+this); handleSetObject(key, value, modified); }
[ "public", "final", "void", "setObject", "(", "String", "key", ",", "Object", "value", ",", "boolean", "modified", ")", "{", "if", "(", "!", "isModifiable", "(", ")", ")", "throw", "new", "AssertionError", "(", "\"ResourceBundle is not modifiable: \"", "+", "th...
Adds or updates the value associated with the provided key and sets the verified time to the current time. If <code>modified</code> is <code>true</code>, the modified time will also be updated, which will cause other locales to require verification.
[ "Adds", "or", "updates", "the", "value", "associated", "with", "the", "provided", "key", "and", "sets", "the", "verified", "time", "to", "the", "current", "time", ".", "If", "<code", ">", "modified<", "/", "code", ">", "is", "<code", ">", "true<", "/", ...
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/i18n/ModifiableResourceBundle.java#L75-L78
google/closure-compiler
src/com/google/javascript/jscomp/Es6ToEs3Util.java
Es6ToEs3Util.arrayFromIterable
static Node arrayFromIterable(AbstractCompiler compiler, Node iterable) { JSTypeRegistry registry = compiler.getTypeRegistry(); JSType arrayType = registry.getNativeType(JSTypeNative.ARRAY_TYPE); Node call = callEs6RuntimeFunction(compiler, iterable, "arrayFromIterable").setJSType(arrayType); call.getFirstChild().setJSType(registry.createFunctionTypeWithVarArgs(arrayType)); return call; }
java
static Node arrayFromIterable(AbstractCompiler compiler, Node iterable) { JSTypeRegistry registry = compiler.getTypeRegistry(); JSType arrayType = registry.getNativeType(JSTypeNative.ARRAY_TYPE); Node call = callEs6RuntimeFunction(compiler, iterable, "arrayFromIterable").setJSType(arrayType); call.getFirstChild().setJSType(registry.createFunctionTypeWithVarArgs(arrayType)); return call; }
[ "static", "Node", "arrayFromIterable", "(", "AbstractCompiler", "compiler", ",", "Node", "iterable", ")", "{", "JSTypeRegistry", "registry", "=", "compiler", ".", "getTypeRegistry", "(", ")", ";", "JSType", "arrayType", "=", "registry", ".", "getNativeType", "(", ...
Returns a call to $jscomp.arrayFromIterable with {@code iterable} as its argument.
[ "Returns", "a", "call", "to", "$jscomp", ".", "arrayFromIterable", "with", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6ToEs3Util.java#L74-L82
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/VisualizeImageData.java
VisualizeImageData.drawEdgeContours
public static void drawEdgeContours( List<EdgeContour> contours , int color , Bitmap output , byte[] storage ) { if( output.getConfig() != Bitmap.Config.ARGB_8888 ) throw new IllegalArgumentException("Only ARGB_8888 is supported"); if( storage == null ) storage = declareStorage(output,null); else Arrays.fill(storage,(byte)0); byte r = (byte)((color >> 16) & 0xFF); byte g = (byte)((color >> 8) & 0xFF); byte b = (byte)( color ); for( int i = 0; i < contours.size(); i++ ) { EdgeContour e = contours.get(i); for( int j = 0; j < e.segments.size(); j++ ) { EdgeSegment s = e.segments.get(j); for( int k = 0; k < s.points.size(); k++ ) { Point2D_I32 p = s.points.get(k); int index = p.y*4*output.getWidth() + p.x*4; storage[index++] = b; storage[index++] = g; storage[index++] = r; storage[index] = (byte)0xFF; } } } output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
java
public static void drawEdgeContours( List<EdgeContour> contours , int color , Bitmap output , byte[] storage ) { if( output.getConfig() != Bitmap.Config.ARGB_8888 ) throw new IllegalArgumentException("Only ARGB_8888 is supported"); if( storage == null ) storage = declareStorage(output,null); else Arrays.fill(storage,(byte)0); byte r = (byte)((color >> 16) & 0xFF); byte g = (byte)((color >> 8) & 0xFF); byte b = (byte)( color ); for( int i = 0; i < contours.size(); i++ ) { EdgeContour e = contours.get(i); for( int j = 0; j < e.segments.size(); j++ ) { EdgeSegment s = e.segments.get(j); for( int k = 0; k < s.points.size(); k++ ) { Point2D_I32 p = s.points.get(k); int index = p.y*4*output.getWidth() + p.x*4; storage[index++] = b; storage[index++] = g; storage[index++] = r; storage[index] = (byte)0xFF; } } } output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
[ "public", "static", "void", "drawEdgeContours", "(", "List", "<", "EdgeContour", ">", "contours", ",", "int", "color", ",", "Bitmap", "output", ",", "byte", "[", "]", "storage", ")", "{", "if", "(", "output", ".", "getConfig", "(", ")", "!=", "Bitmap", ...
Draws each contour using a single color. @param contours List of edge contours @param color The RGB color that each edge pixel should be drawn @param output Where the output is written to @param storage Optional working buffer for Bitmap image. Can be null.
[ "Draws", "each", "contour", "using", "a", "single", "color", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/VisualizeImageData.java#L501-L535
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.restoreCertificateAsync
public Observable<CertificateBundle> restoreCertificateAsync(String vaultBaseUrl, byte[] certificateBundleBackup) { return restoreCertificateWithServiceResponseAsync(vaultBaseUrl, certificateBundleBackup).map(new Func1<ServiceResponse<CertificateBundle>, CertificateBundle>() { @Override public CertificateBundle call(ServiceResponse<CertificateBundle> response) { return response.body(); } }); }
java
public Observable<CertificateBundle> restoreCertificateAsync(String vaultBaseUrl, byte[] certificateBundleBackup) { return restoreCertificateWithServiceResponseAsync(vaultBaseUrl, certificateBundleBackup).map(new Func1<ServiceResponse<CertificateBundle>, CertificateBundle>() { @Override public CertificateBundle call(ServiceResponse<CertificateBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CertificateBundle", ">", "restoreCertificateAsync", "(", "String", "vaultBaseUrl", ",", "byte", "[", "]", "certificateBundleBackup", ")", "{", "return", "restoreCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateBundleB...
Restores a backed up certificate to a vault. Restores a backed up certificate, and all its versions, to a vault. This operation requires the certificates/restore permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateBundleBackup The backup blob associated with a certificate bundle. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateBundle object
[ "Restores", "a", "backed", "up", "certificate", "to", "a", "vault", ".", "Restores", "a", "backed", "up", "certificate", "and", "all", "its", "versions", "to", "a", "vault", ".", "This", "operation", "requires", "the", "certificates", "/", "restore", "permis...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8230-L8237
fredszaq/Rezenerator
rezenerator-core/src/main/java/com/tlorrain/android/rezenerator/core/definition/DefinitionReader.java
DefinitionReader.computeDef
private Dimensions computeDef(final String propName) { final String property = definition.getProperty(propName); final Matcher multiMethodCallMatcher = CALLS.matcher(property); if (multiMethodCallMatcher.matches()) { final String[] methodsLiterals = property.split(CALL_REG); final String dependancyName = multiMethodCallMatcher.group(1); Dimensions result = null; if (definition.containsKey(PREFIX_DEF + dependancyName)) { result = computeDef(PREFIX_DEF + dependancyName); } else { result = computeVal(PREFIX_VAL + dependancyName); } for (int i = 1; i < methodsLiterals.length; i++) { try { final Matcher methodCallMatcher = METHOD.matcher(methodsLiterals[i]); methodCallMatcher.matches(); final Method method = Dimensions.class.getMethod(methodCallMatcher.group(1), int.class); final int arg = Integer.parseInt(methodCallMatcher.group(2)); result = (Dimensions) method.invoke(result, arg); } catch (final Exception e) { throw new IllegalArgumentException(property, e); } } return result; } throw new IllegalArgumentException(property); }
java
private Dimensions computeDef(final String propName) { final String property = definition.getProperty(propName); final Matcher multiMethodCallMatcher = CALLS.matcher(property); if (multiMethodCallMatcher.matches()) { final String[] methodsLiterals = property.split(CALL_REG); final String dependancyName = multiMethodCallMatcher.group(1); Dimensions result = null; if (definition.containsKey(PREFIX_DEF + dependancyName)) { result = computeDef(PREFIX_DEF + dependancyName); } else { result = computeVal(PREFIX_VAL + dependancyName); } for (int i = 1; i < methodsLiterals.length; i++) { try { final Matcher methodCallMatcher = METHOD.matcher(methodsLiterals[i]); methodCallMatcher.matches(); final Method method = Dimensions.class.getMethod(methodCallMatcher.group(1), int.class); final int arg = Integer.parseInt(methodCallMatcher.group(2)); result = (Dimensions) method.invoke(result, arg); } catch (final Exception e) { throw new IllegalArgumentException(property, e); } } return result; } throw new IllegalArgumentException(property); }
[ "private", "Dimensions", "computeDef", "(", "final", "String", "propName", ")", "{", "final", "String", "property", "=", "definition", ".", "getProperty", "(", "propName", ")", ";", "final", "Matcher", "multiMethodCallMatcher", "=", "CALLS", ".", "matcher", "(",...
Computes a def from a property name. The string contained in the property must have this format : valName[.methodOnDefinitions(int)]+ @param propName the property containg the def to compute @return a {@link Dimensions} created by applying the method calls on the val
[ "Computes", "a", "def", "from", "a", "property", "name", ".", "The", "string", "contained", "in", "the", "property", "must", "have", "this", "format", ":", "valName", "[", ".", "methodOnDefinitions", "(", "int", ")", "]", "+" ]
train
https://github.com/fredszaq/Rezenerator/blob/e0f5e17c39e3f8742615c30677768665c75803cd/rezenerator-core/src/main/java/com/tlorrain/android/rezenerator/core/definition/DefinitionReader.java#L70-L96
mojohaus/xml-maven-plugin
src/main/java/org/codehaus/mojo/xml/Resolver.java
Resolver.resolveEntity
public InputSource resolveEntity( String pName, String pPublicId, String pBaseURI, String pSystemId ) throws SAXException, IOException { final InputSource source = resolver.resolveEntity( pPublicId, pSystemId ); if ( source != null ) { return source; } URI baseURI = null; if (pBaseURI!=null){ try { baseURI = new URI(pBaseURI); } catch ( URISyntaxException ex ) { throw new SAXException("Incorrectly formatted base URI", ex); } } URL url = resolve( pSystemId ,baseURI); if ( url != null ) { return asInputSource( url ); } return null; }
java
public InputSource resolveEntity( String pName, String pPublicId, String pBaseURI, String pSystemId ) throws SAXException, IOException { final InputSource source = resolver.resolveEntity( pPublicId, pSystemId ); if ( source != null ) { return source; } URI baseURI = null; if (pBaseURI!=null){ try { baseURI = new URI(pBaseURI); } catch ( URISyntaxException ex ) { throw new SAXException("Incorrectly formatted base URI", ex); } } URL url = resolve( pSystemId ,baseURI); if ( url != null ) { return asInputSource( url ); } return null; }
[ "public", "InputSource", "resolveEntity", "(", "String", "pName", ",", "String", "pPublicId", ",", "String", "pBaseURI", ",", "String", "pSystemId", ")", "throws", "SAXException", ",", "IOException", "{", "final", "InputSource", "source", "=", "resolver", ".", "...
Implementation of {@link EntityResolver2#resolveEntity(String, String, String, String)}
[ "Implementation", "of", "{" ]
train
https://github.com/mojohaus/xml-maven-plugin/blob/161edde37bbfe7a472369a9675c44d91ec24561d/src/main/java/org/codehaus/mojo/xml/Resolver.java#L450-L475
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java
Value.float64Array
public static Value float64Array(@Nullable double[] v, int pos, int length) { return float64ArrayFactory.create(v, pos, length); }
java
public static Value float64Array(@Nullable double[] v, int pos, int length) { return float64ArrayFactory.create(v, pos, length); }
[ "public", "static", "Value", "float64Array", "(", "@", "Nullable", "double", "[", "]", "v", ",", "int", "pos", ",", "int", "length", ")", "{", "return", "float64ArrayFactory", ".", "create", "(", "v", ",", "pos", ",", "length", ")", ";", "}" ]
Returns an {@code ARRAY<FLOAT64>} value that takes its elements from a region of an array. @param v the source of element values, which may be null to produce a value for which {@code isNull()} is {@code true} @param pos the start position of {@code v} to copy values from. Ignored if {@code v} is {@code null}. @param length the number of values to copy from {@code v}. Ignored if {@code v} is {@code null}.
[ "Returns", "an", "{", "@code", "ARRAY<FLOAT64", ">", "}", "value", "that", "takes", "its", "elements", "from", "a", "region", "of", "an", "array", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java#L272-L274
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/WorkspaceFolderResourcesImpl.java
WorkspaceFolderResourcesImpl.createFolder
public Folder createFolder(long workspaceId, Folder folder) throws SmartsheetException { return this.createResource("workspaces/" + workspaceId + "/folders", Folder.class, folder); }
java
public Folder createFolder(long workspaceId, Folder folder) throws SmartsheetException { return this.createResource("workspaces/" + workspaceId + "/folders", Folder.class, folder); }
[ "public", "Folder", "createFolder", "(", "long", "workspaceId", ",", "Folder", "folder", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "createResource", "(", "\"workspaces/\"", "+", "workspaceId", "+", "\"/folders\"", ",", "Folder", ".", "class...
Create a folder in the workspace. It mirrors to the following Smartsheet REST API method: POST /workspace/{id}/folders Exceptions: - IllegalArgumentException : if folder is null - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) - SmartsheetRestException : if there is any other REST API related error occurred during the operation - SmartsheetException : if there is any other error occurred during the operation @param workspaceId the workspace id @param folder the folder to create @return the created folder @throws SmartsheetException the smartsheet exception
[ "Create", "a", "folder", "in", "the", "workspace", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/WorkspaceFolderResourcesImpl.java#L94-L96
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.callRef
public static Ref callRef(Callable function, Scriptable thisObj, Object[] args, Context cx) { if (function instanceof RefCallable) { RefCallable rfunction = (RefCallable)function; Ref ref = rfunction.refCall(cx, thisObj, args); if (ref == null) { throw new IllegalStateException(rfunction.getClass().getName()+".refCall() returned null"); } return ref; } // No runtime support for now String msg = getMessage1("msg.no.ref.from.function", toString(function)); throw constructError("ReferenceError", msg); }
java
public static Ref callRef(Callable function, Scriptable thisObj, Object[] args, Context cx) { if (function instanceof RefCallable) { RefCallable rfunction = (RefCallable)function; Ref ref = rfunction.refCall(cx, thisObj, args); if (ref == null) { throw new IllegalStateException(rfunction.getClass().getName()+".refCall() returned null"); } return ref; } // No runtime support for now String msg = getMessage1("msg.no.ref.from.function", toString(function)); throw constructError("ReferenceError", msg); }
[ "public", "static", "Ref", "callRef", "(", "Callable", "function", ",", "Scriptable", "thisObj", ",", "Object", "[", "]", "args", ",", "Context", "cx", ")", "{", "if", "(", "function", "instanceof", "RefCallable", ")", "{", "RefCallable", "rfunction", "=", ...
Perform function call in reference context. Should always return value that can be passed to {@link #refGet(Ref, Context)} or {@link #refSet(Ref, Object, Context)} arbitrary number of times. The args array reference should not be stored in any object that is can be GC-reachable after this method returns. If this is necessary, store args.clone(), not args array itself.
[ "Perform", "function", "call", "in", "reference", "context", ".", "Should", "always", "return", "value", "that", "can", "be", "passed", "to", "{" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L2644-L2659
BlueBrain/bluima
modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/GIS.java
GIS.trainModel
public static GISModel trainModel(int iterations, DataIndexer indexer, boolean smoothing) { return trainModel(iterations,indexer,false,smoothing); }
java
public static GISModel trainModel(int iterations, DataIndexer indexer, boolean smoothing) { return trainModel(iterations,indexer,false,smoothing); }
[ "public", "static", "GISModel", "trainModel", "(", "int", "iterations", ",", "DataIndexer", "indexer", ",", "boolean", "smoothing", ")", "{", "return", "trainModel", "(", "iterations", ",", "indexer", ",", "false", ",", "smoothing", ")", ";", "}" ]
Train a model using the GIS algorithm. @param iterations The number of GIS iterations to perform. @param indexer The object which will be used for event compilation. @param smoothing Defines whether the created trainer will use smoothing while training the model. @return The newly trained model, which can be used immediately or saved to disk using an opennlp.maxent.io.GISModelWriter object.
[ "Train", "a", "model", "using", "the", "GIS", "algorithm", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/GIS.java#L117-L119
Azure/azure-sdk-for-java
cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java
AccountsInner.getUsages
public UsagesResultInner getUsages(String resourceGroupName, String accountName, String filter) { return getUsagesWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body(); }
java
public UsagesResultInner getUsages(String resourceGroupName, String accountName, String filter) { return getUsagesWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body(); }
[ "public", "UsagesResultInner", "getUsages", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "filter", ")", "{", "return", "getUsagesWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "filter", ")", ".", "toBl...
Get usages for the requested Cognitive Services account. @param resourceGroupName The name of the resource group within the user's subscription. @param accountName The name of Cognitive Services account. @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the UsagesResultInner object if successful.
[ "Get", "usages", "for", "the", "requested", "Cognitive", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java#L1155-L1157
zaproxy/zaproxy
src/org/zaproxy/zap/view/JCheckBoxTree.java
JCheckBoxTree.updatePredecessorsWithCheckMode
protected void updatePredecessorsWithCheckMode(TreePath tp, boolean check) { TreePath parentPath = tp.getParentPath(); // If it is the root, stop the recursive calls and return if (parentPath == null) { return; } CheckedNode parentCheckedNode = nodesCheckingState.get(parentPath); DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) parentPath.getLastPathComponent(); parentCheckedNode.allChildrenSelected = true; parentCheckedNode.isSelected = false; for (int i = 0 ; i < parentNode.getChildCount() ; i++) { TreePath childPath = parentPath.pathByAddingChild(parentNode.getChildAt(i)); CheckedNode childCheckedNode = nodesCheckingState.get(childPath); // It is enough that even one subtree is not fully selected // to determine that the parent is not fully selected if (!allSelected(childCheckedNode)) { parentCheckedNode.allChildrenSelected = false; } // If at least one child is selected, selecting also the parent if (childCheckedNode.isSelected) { parentCheckedNode.isSelected = true; } } if (parentCheckedNode.isSelected) { checkedPaths.add(parentPath); } else { checkedPaths.remove(parentPath); } // Go to upper predecessor updatePredecessorsWithCheckMode(parentPath, check); }
java
protected void updatePredecessorsWithCheckMode(TreePath tp, boolean check) { TreePath parentPath = tp.getParentPath(); // If it is the root, stop the recursive calls and return if (parentPath == null) { return; } CheckedNode parentCheckedNode = nodesCheckingState.get(parentPath); DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) parentPath.getLastPathComponent(); parentCheckedNode.allChildrenSelected = true; parentCheckedNode.isSelected = false; for (int i = 0 ; i < parentNode.getChildCount() ; i++) { TreePath childPath = parentPath.pathByAddingChild(parentNode.getChildAt(i)); CheckedNode childCheckedNode = nodesCheckingState.get(childPath); // It is enough that even one subtree is not fully selected // to determine that the parent is not fully selected if (!allSelected(childCheckedNode)) { parentCheckedNode.allChildrenSelected = false; } // If at least one child is selected, selecting also the parent if (childCheckedNode.isSelected) { parentCheckedNode.isSelected = true; } } if (parentCheckedNode.isSelected) { checkedPaths.add(parentPath); } else { checkedPaths.remove(parentPath); } // Go to upper predecessor updatePredecessorsWithCheckMode(parentPath, check); }
[ "protected", "void", "updatePredecessorsWithCheckMode", "(", "TreePath", "tp", ",", "boolean", "check", ")", "{", "TreePath", "parentPath", "=", "tp", ".", "getParentPath", "(", ")", ";", "// If it is the root, stop the recursive calls and return", "if", "(", "parentPat...
When a node is checked/unchecked, updating the states of the predecessors
[ "When", "a", "node", "is", "checked", "/", "unchecked", "updating", "the", "states", "of", "the", "predecessors" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/JCheckBoxTree.java#L239-L269
Harium/keel
src/main/java/com/harium/keel/catalano/math/tools/ImageStatistics.java
ImageStatistics.Mean
public static float Mean(ImageSource fastBitmap, int startX, int startY, int width, int height) { float mean = 0; if (fastBitmap.isGrayscale()) { for (int i = startX; i < height; i++) { for (int j = startY; j < width; j++) { mean += fastBitmap.getRGB(j, i); } } return mean / (width * height); } else { throw new IllegalArgumentException("ImageStatistics: Only compute mean in grayscale images."); } }
java
public static float Mean(ImageSource fastBitmap, int startX, int startY, int width, int height) { float mean = 0; if (fastBitmap.isGrayscale()) { for (int i = startX; i < height; i++) { for (int j = startY; j < width; j++) { mean += fastBitmap.getRGB(j, i); } } return mean / (width * height); } else { throw new IllegalArgumentException("ImageStatistics: Only compute mean in grayscale images."); } }
[ "public", "static", "float", "Mean", "(", "ImageSource", "fastBitmap", ",", "int", "startX", ",", "int", "startY", ",", "int", "width", ",", "int", "height", ")", "{", "float", "mean", "=", "0", ";", "if", "(", "fastBitmap", ".", "isGrayscale", "(", ")...
Calculate Mean value. @param fastBitmap Image to be processed. @param startX Initial X axis coordinate. @param startY Initial Y axis coordinate. @param width Width. @param height Height. @return Mean.
[ "Calculate", "Mean", "value", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/tools/ImageStatistics.java#L181-L193
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cloud_project_serviceName_ip_POST
public OvhOrder cloud_project_serviceName_ip_POST(String serviceName, OvhGeolocationEnum country, String instanceId, Long quantity) throws IOException { String qPath = "/order/cloud/project/{serviceName}/ip"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "country", country); addBody(o, "instanceId", instanceId); addBody(o, "quantity", quantity); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder cloud_project_serviceName_ip_POST(String serviceName, OvhGeolocationEnum country, String instanceId, Long quantity) throws IOException { String qPath = "/order/cloud/project/{serviceName}/ip"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "country", country); addBody(o, "instanceId", instanceId); addBody(o, "quantity", quantity); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "cloud_project_serviceName_ip_POST", "(", "String", "serviceName", ",", "OvhGeolocationEnum", "country", ",", "String", "instanceId", ",", "Long", "quantity", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cloud/project/{service...
Create order REST: POST /order/cloud/project/{serviceName}/ip @param instanceId [required] Instance id where ip will be routed to @param country [required] IP geolocation @param quantity [required] Number of failover ip @param serviceName [required] The project id
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2945-L2954
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java
EmulatedFields.get
public byte get(String name, byte defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, byte.class); return slot.defaulted ? defaultValue : ((Byte) slot.fieldValue).byteValue(); }
java
public byte get(String name, byte defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, byte.class); return slot.defaulted ? defaultValue : ((Byte) slot.fieldValue).byteValue(); }
[ "public", "byte", "get", "(", "String", "name", ",", "byte", "defaultValue", ")", "throws", "IllegalArgumentException", "{", "ObjectSlot", "slot", "=", "findMandatorySlot", "(", "name", ",", "byte", ".", "class", ")", ";", "return", "slot", ".", "defaulted", ...
Finds and returns the byte value of a given field named {@code name} in the receiver. If the field has not been assigned any value yet, the default value {@code defaultValue} is returned instead. @param name the name of the field to find. @param defaultValue return value in case the field has not been assigned to yet. @return the value of the given field if it has been assigned, the default value otherwise. @throws IllegalArgumentException if the corresponding field can not be found.
[ "Finds", "and", "returns", "the", "byte", "value", "of", "a", "given", "field", "named", "{", "@code", "name", "}", "in", "the", "receiver", ".", "If", "the", "field", "has", "not", "been", "assigned", "any", "value", "yet", "the", "default", "value", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L208-L211
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.toUnique
@SuppressWarnings("unchecked") public static <T> T[] toUnique(T[] self, @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure condition) { Comparator<T> comparator = condition.getMaximumNumberOfParameters() == 1 ? new OrderBy<T>(condition, true) : new ClosureComparator<T>(condition); return toUnique(self, comparator); }
java
@SuppressWarnings("unchecked") public static <T> T[] toUnique(T[] self, @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure condition) { Comparator<T> comparator = condition.getMaximumNumberOfParameters() == 1 ? new OrderBy<T>(condition, true) : new ClosureComparator<T>(condition); return toUnique(self, comparator); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "[", "]", "toUnique", "(", "T", "[", "]", "self", ",", "@", "ClosureParams", "(", "value", "=", "FromString", ".", "class", ",", "options", "=", "{", "\"T\"", ...
Returns a new Array containing the items from the original Array but with duplicates removed with the supplied comparator determining which items are unique. <p> <pre class="groovyTestCase"> String[] letters = ['c', 'a', 't', 's', 'A', 't', 'h', 'a', 'T'] String[] expected = ['c', 'a', 't', 's', 'h'] assert letters.toUnique{ p1, p2 {@code ->} p1.toLowerCase() {@code <=>} p2.toLowerCase() } == expected assert letters.toUnique{ it.toLowerCase() } == expected </pre> @param self an array @param condition a Closure used to determine unique items @return the unique items from the array
[ "Returns", "a", "new", "Array", "containing", "the", "items", "from", "the", "original", "Array", "but", "with", "duplicates", "removed", "with", "the", "supplied", "comparator", "determining", "which", "items", "are", "unique", ".", "<p", ">", "<pre", "class"...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L2091-L2097
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/AddressConfiguration.java
AddressConfiguration.withContext
public AddressConfiguration withContext(java.util.Map<String, String> context) { setContext(context); return this; }
java
public AddressConfiguration withContext(java.util.Map<String, String> context) { setContext(context); return this; }
[ "public", "AddressConfiguration", "withContext", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "context", ")", "{", "setContext", "(", "context", ")", ";", "return", "this", ";", "}" ]
A map of custom attributes to attributes to be attached to the message for this address. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @param context A map of custom attributes to attributes to be attached to the message for this address. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "map", "of", "custom", "attributes", "to", "attributes", "to", "be", "attached", "to", "the", "message", "for", "this", "address", ".", "This", "payload", "is", "added", "to", "the", "push", "notification", "s", "data", ".", "pinpoint", "object", "or"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/AddressConfiguration.java#L207-L210
rjeschke/txtmark
src/main/java/com/github/rjeschke/txtmark/Utils.java
Utils.appendHexEntity
public final static void appendHexEntity(final StringBuilder out, final char value) { out.append("&#x"); out.append(Integer.toHexString(value)); out.append(';'); }
java
public final static void appendHexEntity(final StringBuilder out, final char value) { out.append("&#x"); out.append(Integer.toHexString(value)); out.append(';'); }
[ "public", "final", "static", "void", "appendHexEntity", "(", "final", "StringBuilder", "out", ",", "final", "char", "value", ")", "{", "out", ".", "append", "(", "\"&#x\"", ")", ";", "out", ".", "append", "(", "Integer", ".", "toHexString", "(", "value", ...
Append the given char as a hexadecimal HTML entity. @param out The StringBuilder to write to. @param value The character.
[ "Append", "the", "given", "char", "as", "a", "hexadecimal", "HTML", "entity", "." ]
train
https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L537-L542
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
JaxbUtils.unmarshalCollection
public static <T> List<T> unmarshalCollection(Class<T> cl, Reader r) throws JAXBException { return unmarshalCollection(cl, new StreamSource(r)); }
java
public static <T> List<T> unmarshalCollection(Class<T> cl, Reader r) throws JAXBException { return unmarshalCollection(cl, new StreamSource(r)); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "unmarshalCollection", "(", "Class", "<", "T", ">", "cl", ",", "Reader", "r", ")", "throws", "JAXBException", "{", "return", "unmarshalCollection", "(", "cl", ",", "new", "StreamSource", "(", "r",...
Converts the contents of the Reader to a List with objects of the given class. @param cl Type to be used @param r Input @return List with objects of the given type
[ "Converts", "the", "contents", "of", "the", "Reader", "to", "a", "List", "with", "objects", "of", "the", "given", "class", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L310-L312
google/closure-compiler
src/com/google/javascript/jscomp/FunctionTypeBuilder.java
FunctionTypeBuilder.inferThisType
FunctionTypeBuilder inferThisType(JSDocInfo info, JSType type) { // Look at the @this annotation first. inferThisType(info); if (thisType == null) { ObjectType objType = ObjectType.cast(type); if (objType != null && (info == null || !info.hasType())) { thisType = objType; } } return this; }
java
FunctionTypeBuilder inferThisType(JSDocInfo info, JSType type) { // Look at the @this annotation first. inferThisType(info); if (thisType == null) { ObjectType objType = ObjectType.cast(type); if (objType != null && (info == null || !info.hasType())) { thisType = objType; } } return this; }
[ "FunctionTypeBuilder", "inferThisType", "(", "JSDocInfo", "info", ",", "JSType", "type", ")", "{", "// Look at the @this annotation first.", "inferThisType", "(", "info", ")", ";", "if", "(", "thisType", "==", "null", ")", "{", "ObjectType", "objType", "=", "Objec...
Infers the type of {@code this}. @param type The type of this if the info is missing.
[ "Infers", "the", "type", "of", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FunctionTypeBuilder.java#L524-L536
OpenLiberty/open-liberty
dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/UserInfoHelper.java
UserInfoHelper.isUserInfoValid
protected boolean isUserInfoValid(String userInfoStr, String subClaim) { String userInfoSubClaim = getUserInfoSubClaim(userInfoStr); if (userInfoSubClaim == null || subClaim == null || userInfoSubClaim.compareTo(subClaim) != 0) { Tr.error(tc, "USERINFO_INVALID", new Object[] { userInfoStr, subClaim }); return false; } return true; }
java
protected boolean isUserInfoValid(String userInfoStr, String subClaim) { String userInfoSubClaim = getUserInfoSubClaim(userInfoStr); if (userInfoSubClaim == null || subClaim == null || userInfoSubClaim.compareTo(subClaim) != 0) { Tr.error(tc, "USERINFO_INVALID", new Object[] { userInfoStr, subClaim }); return false; } return true; }
[ "protected", "boolean", "isUserInfoValid", "(", "String", "userInfoStr", ",", "String", "subClaim", ")", "{", "String", "userInfoSubClaim", "=", "getUserInfoSubClaim", "(", "userInfoStr", ")", ";", "if", "(", "userInfoSubClaim", "==", "null", "||", "subClaim", "==...
per oidc-connect-core-1.0 sec 5.3.2, sub claim of userinfo response must match sub claim in id token.
[ "per", "oidc", "-", "connect", "-", "core", "-", "1", ".", "0", "sec", "5", ".", "3", ".", "2", "sub", "claim", "of", "userinfo", "response", "must", "match", "sub", "claim", "in", "id", "token", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/UserInfoHelper.java#L73-L80
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplString_CustomFieldSerializer.java
OWLLiteralImplString_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplString instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplString instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLLiteralImplString", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplString_CustomFieldSerializer.java#L63-L66
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/rewrite/rewritepolicy_rewritepolicylabel_binding.java
rewritepolicy_rewritepolicylabel_binding.count_filtered
public static long count_filtered(nitro_service service, String name, String filter) throws Exception{ rewritepolicy_rewritepolicylabel_binding obj = new rewritepolicy_rewritepolicylabel_binding(); obj.set_name(name); options option = new options(); option.set_count(true); option.set_filter(filter); rewritepolicy_rewritepolicylabel_binding[] response = (rewritepolicy_rewritepolicylabel_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String name, String filter) throws Exception{ rewritepolicy_rewritepolicylabel_binding obj = new rewritepolicy_rewritepolicylabel_binding(); obj.set_name(name); options option = new options(); option.set_count(true); option.set_filter(filter); rewritepolicy_rewritepolicylabel_binding[] response = (rewritepolicy_rewritepolicylabel_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "name", ",", "String", "filter", ")", "throws", "Exception", "{", "rewritepolicy_rewritepolicylabel_binding", "obj", "=", "new", "rewritepolicy_rewritepolicylabel_binding", "(", ...
Use this API to count the filtered set of rewritepolicy_rewritepolicylabel_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "the", "filtered", "set", "of", "rewritepolicy_rewritepolicylabel_binding", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/rewrite/rewritepolicy_rewritepolicylabel_binding.java#L214-L225
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java
XPathParser.parseReverceAxis
private AbsAxis parseReverceAxis() { AbsAxis axis; if (is("parent", true)) { axis = new ParentAxis(getTransaction()); } else if (is("ancestor", true)) { axis = new AncestorAxis(getTransaction()); } else if (is("ancestor-or-self", true)) { axis = new AncestorAxis(getTransaction(), true); } else if (is("preceding", true)) { axis = new PrecedingAxis(getTransaction()); } else { consume("preceding-sibling", true); axis = new PrecedingSiblingAxis(getTransaction()); } consume(TokenType.COLON, true); consume(TokenType.COLON, true); return axis; }
java
private AbsAxis parseReverceAxis() { AbsAxis axis; if (is("parent", true)) { axis = new ParentAxis(getTransaction()); } else if (is("ancestor", true)) { axis = new AncestorAxis(getTransaction()); } else if (is("ancestor-or-self", true)) { axis = new AncestorAxis(getTransaction(), true); } else if (is("preceding", true)) { axis = new PrecedingAxis(getTransaction()); } else { consume("preceding-sibling", true); axis = new PrecedingSiblingAxis(getTransaction()); } consume(TokenType.COLON, true); consume(TokenType.COLON, true); return axis; }
[ "private", "AbsAxis", "parseReverceAxis", "(", ")", "{", "AbsAxis", "axis", ";", "if", "(", "is", "(", "\"parent\"", ",", "true", ")", ")", "{", "axis", "=", "new", "ParentAxis", "(", "getTransaction", "(", ")", ")", ";", "}", "else", "if", "(", "is"...
Parses the the rule ReverceAxis according to the following production rule: [33] ReverseAxis ::= <"parent" "::"> | <"ancestor" "::"> | <"preceding-sibling" "::">|<"preceding" "::">|<"ancestor-or-self" "::"> . @return axis
[ "Parses", "the", "the", "rule", "ReverceAxis", "according", "to", "the", "following", "production", "rule", ":", "[", "33", "]", "ReverseAxis", "::", "=", "<", "parent", "::", ">", "|", "<", "ancestor", "::", ">", "|", "<", "preceding", "-", "sibling", ...
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L973-L1003
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java
CmsGalleryController.lookForParent
private CmsGalleryTreeEntry lookForParent(CmsGalleryTreeEntry possibleParent, String targetPath) { if (targetPath.startsWith(possibleParent.getPath())) { return possibleParent; } if (possibleParent.getParent() != null) { return lookForParent(possibleParent.getParent(), targetPath); } return null; }
java
private CmsGalleryTreeEntry lookForParent(CmsGalleryTreeEntry possibleParent, String targetPath) { if (targetPath.startsWith(possibleParent.getPath())) { return possibleParent; } if (possibleParent.getParent() != null) { return lookForParent(possibleParent.getParent(), targetPath); } return null; }
[ "private", "CmsGalleryTreeEntry", "lookForParent", "(", "CmsGalleryTreeEntry", "possibleParent", ",", "String", "targetPath", ")", "{", "if", "(", "targetPath", ".", "startsWith", "(", "possibleParent", ".", "getPath", "(", ")", ")", ")", "{", "return", "possibleP...
Looks for an ancestor tree entry for the given path.<p> @param possibleParent the possible parent entry @param targetPath the target path @return the parent entry or <code>null</code> if there is none
[ "Looks", "for", "an", "ancestor", "tree", "entry", "for", "the", "given", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1982-L1991
alkacon/opencms-core
src/org/opencms/module/CmsModuleManager.java
CmsModuleManager.checkModuleSelectionList
public void checkModuleSelectionList(List<String> moduleNames, String rfsAbsPath, boolean forDeletion) throws CmsIllegalArgumentException, CmsConfigurationException { Map<String, List<String>> moduleDependencies = buildDepsForAllModules(rfsAbsPath, forDeletion); Iterator<String> itMods = moduleNames.iterator(); while (itMods.hasNext()) { String moduleName = itMods.next(); List<String> dependencies = moduleDependencies.get(moduleName); if (dependencies != null) { List<String> depModules = new ArrayList<String>(dependencies); depModules.removeAll(moduleNames); if (!depModules.isEmpty()) { throw new CmsIllegalArgumentException( Messages.get().container( Messages.ERR_MODULE_SELECTION_INCONSISTENT_2, moduleName, depModules.toString())); } } } }
java
public void checkModuleSelectionList(List<String> moduleNames, String rfsAbsPath, boolean forDeletion) throws CmsIllegalArgumentException, CmsConfigurationException { Map<String, List<String>> moduleDependencies = buildDepsForAllModules(rfsAbsPath, forDeletion); Iterator<String> itMods = moduleNames.iterator(); while (itMods.hasNext()) { String moduleName = itMods.next(); List<String> dependencies = moduleDependencies.get(moduleName); if (dependencies != null) { List<String> depModules = new ArrayList<String>(dependencies); depModules.removeAll(moduleNames); if (!depModules.isEmpty()) { throw new CmsIllegalArgumentException( Messages.get().container( Messages.ERR_MODULE_SELECTION_INCONSISTENT_2, moduleName, depModules.toString())); } } } }
[ "public", "void", "checkModuleSelectionList", "(", "List", "<", "String", ">", "moduleNames", ",", "String", "rfsAbsPath", ",", "boolean", "forDeletion", ")", "throws", "CmsIllegalArgumentException", ",", "CmsConfigurationException", "{", "Map", "<", "String", ",", ...
Checks the module selection list for consistency, that means that if a module is selected, all its dependencies are also selected.<p> The module dependencies are get from the installed modules or from the module manifest.xml files found in the given FRS path.<p> @param moduleNames a list of module names @param rfsAbsPath a RFS absolute path to search for modules, or <code>null</code> to use the installed modules @param forDeletion there are two modes, one for installation of modules, and one for deletion. @throws CmsIllegalArgumentException if the module list is not consistent @throws CmsConfigurationException if something goes wrong
[ "Checks", "the", "module", "selection", "list", "for", "consistency", "that", "means", "that", "if", "a", "module", "is", "selected", "all", "its", "dependencies", "are", "also", "selected", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleManager.java#L450-L470
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.getColorStateList
public static ColorStateList getColorStateList(@ColorInt int normal, @ColorInt int highLight) { int[][] states = new int[6][]; states[0] = new int[]{android.R.attr.state_checked}; states[1] = new int[]{android.R.attr.state_pressed}; states[2] = new int[]{android.R.attr.state_selected}; states[3] = new int[]{}; states[4] = new int[]{}; states[5] = new int[]{}; int[] colors = new int[]{highLight, highLight, highLight, normal, normal, normal}; return new ColorStateList(states, colors); }
java
public static ColorStateList getColorStateList(@ColorInt int normal, @ColorInt int highLight) { int[][] states = new int[6][]; states[0] = new int[]{android.R.attr.state_checked}; states[1] = new int[]{android.R.attr.state_pressed}; states[2] = new int[]{android.R.attr.state_selected}; states[3] = new int[]{}; states[4] = new int[]{}; states[5] = new int[]{}; int[] colors = new int[]{highLight, highLight, highLight, normal, normal, normal}; return new ColorStateList(states, colors); }
[ "public", "static", "ColorStateList", "getColorStateList", "(", "@", "ColorInt", "int", "normal", ",", "@", "ColorInt", "int", "highLight", ")", "{", "int", "[", "]", "[", "]", "states", "=", "new", "int", "[", "6", "]", "[", "", "]", ";", "states", ...
{@link ColorStateList}. @param normal normal color. @param highLight highLight color. @return {@link ColorStateList}.
[ "{", "@link", "ColorStateList", "}", "." ]
train
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L330-L340
actframework/actframework
src/main/java/act/data/MultipartStream.java
MultipartStream.readBoundary
public boolean readBoundary() throws MalformedStreamException { byte[] marker = new byte[2]; boolean nextChunk = false; head += boundaryLength; try { marker[0] = readByte(); if (marker[0] == LF) { // Work around IE5 Mac bug with input type=image. // Because the boundary delimiter, not including the trailing // CRLF, must not appear within any file (RFC 2046, section // 5.1.1), we know the missing CR is due to a buggy browser // rather than a file containing something similar to a // boundary. return true; } marker[1] = readByte(); if (arrayequals(marker, STREAM_TERMINATOR, 2)) { nextChunk = false; } else if (arrayequals(marker, FIELD_SEPARATOR, 2)) { nextChunk = true; } else { throw new MalformedStreamException( "Unexpected characters follow a boundary"); } } catch (IOException e) { throw new MalformedStreamException("Stream ended unexpectedly"); } return nextChunk; }
java
public boolean readBoundary() throws MalformedStreamException { byte[] marker = new byte[2]; boolean nextChunk = false; head += boundaryLength; try { marker[0] = readByte(); if (marker[0] == LF) { // Work around IE5 Mac bug with input type=image. // Because the boundary delimiter, not including the trailing // CRLF, must not appear within any file (RFC 2046, section // 5.1.1), we know the missing CR is due to a buggy browser // rather than a file containing something similar to a // boundary. return true; } marker[1] = readByte(); if (arrayequals(marker, STREAM_TERMINATOR, 2)) { nextChunk = false; } else if (arrayequals(marker, FIELD_SEPARATOR, 2)) { nextChunk = true; } else { throw new MalformedStreamException( "Unexpected characters follow a boundary"); } } catch (IOException e) { throw new MalformedStreamException("Stream ended unexpectedly"); } return nextChunk; }
[ "public", "boolean", "readBoundary", "(", ")", "throws", "MalformedStreamException", "{", "byte", "[", "]", "marker", "=", "new", "byte", "[", "2", "]", ";", "boolean", "nextChunk", "=", "false", ";", "head", "+=", "boundaryLength", ";", "try", "{", "marke...
Skips a <code>boundary</code> token, and checks whether more <code>encapsulations</code> are contained in the stream. @return <code>true</code> if there are more encapsulations in this stream; <code>false</code> otherwise. @throws MalformedStreamException if the stream ends unexpecetedly or fails to follow required syntax.
[ "Skips", "a", "<code", ">", "boundary<", "/", "code", ">", "token", "and", "checks", "whether", "more", "<code", ">", "encapsulations<", "/", "code", ">", "are", "contained", "in", "the", "stream", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/data/MultipartStream.java#L411-L442
lagom/lagom
service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/MessageProtocol.java
MessageProtocol.withCharset
public MessageProtocol withCharset(String charset) { return new MessageProtocol(contentType, Optional.ofNullable(charset), version); }
java
public MessageProtocol withCharset(String charset) { return new MessageProtocol(contentType, Optional.ofNullable(charset), version); }
[ "public", "MessageProtocol", "withCharset", "(", "String", "charset", ")", "{", "return", "new", "MessageProtocol", "(", "contentType", ",", "Optional", ".", "ofNullable", "(", "charset", ")", ",", "version", ")", ";", "}" ]
Return a copy of this message protocol with the charset set to the given charset. @param charset The charset to set. @return A copy of this message protocol.
[ "Return", "a", "copy", "of", "this", "message", "protocol", "with", "the", "charset", "set", "to", "the", "given", "charset", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/MessageProtocol.java#L109-L111
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/gateway/GatewayManagementBeanImpl.java
GatewayManagementBeanImpl.doMessageReceivedListeners
@Override public void doMessageReceivedListeners(final long sessionId, final long sessionReadBytes, final Object message) { runManagementTask(new Runnable() { @Override public void run() { try { // The particular management listeners change on strategy, so get them here. for (final GatewayManagementListener listener : getManagementListeners()) { listener.doMessageReceived(GatewayManagementBeanImpl.this, sessionId); } markChanged(); // mark ourselves as changed, possibly tell listeners } catch (Exception ex) { logger.warn("Error during messageReceived gateway listener notifications:", ex); } } }); }
java
@Override public void doMessageReceivedListeners(final long sessionId, final long sessionReadBytes, final Object message) { runManagementTask(new Runnable() { @Override public void run() { try { // The particular management listeners change on strategy, so get them here. for (final GatewayManagementListener listener : getManagementListeners()) { listener.doMessageReceived(GatewayManagementBeanImpl.this, sessionId); } markChanged(); // mark ourselves as changed, possibly tell listeners } catch (Exception ex) { logger.warn("Error during messageReceived gateway listener notifications:", ex); } } }); }
[ "@", "Override", "public", "void", "doMessageReceivedListeners", "(", "final", "long", "sessionId", ",", "final", "long", "sessionReadBytes", ",", "final", "Object", "message", ")", "{", "runManagementTask", "(", "new", "Runnable", "(", ")", "{", "@", "Override"...
Notify the management listeners on a messageReceived. <p/> NOTE: this starts on the IO thread, but runs a task OFF the thread.
[ "Notify", "the", "management", "listeners", "on", "a", "messageReceived", ".", "<p", "/", ">", "NOTE", ":", "this", "starts", "on", "the", "IO", "thread", "but", "runs", "a", "task", "OFF", "the", "thread", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/gateway/GatewayManagementBeanImpl.java#L492-L509
arquillian/arquillian-algeron
common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java
GitOperations.createBranchAndCheckout
public Ref createBranchAndCheckout(Git git, String branch) { try { return git.checkout() .setCreateBranch(true) .setName(branch) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
java
public Ref createBranchAndCheckout(Git git, String branch) { try { return git.checkout() .setCreateBranch(true) .setName(branch) .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
[ "public", "Ref", "createBranchAndCheckout", "(", "Git", "git", ",", "String", "branch", ")", "{", "try", "{", "return", "git", ".", "checkout", "(", ")", ".", "setCreateBranch", "(", "true", ")", ".", "setName", "(", "branch", ")", ".", "setUpstreamMode", ...
Executes a checkout -b command using given branch. @param git instance. @param branch to create and checkout. @return Ref to current branch.
[ "Executes", "a", "checkout", "-", "b", "command", "using", "given", "branch", "." ]
train
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L186-L196
google/flatbuffers
java/com/google/flatbuffers/Table.java
Table.compareStrings
protected static int compareStrings(int offset_1, byte[] key, ByteBuffer bb) { offset_1 += bb.getInt(offset_1); int len_1 = bb.getInt(offset_1); int len_2 = key.length; int startPos_1 = offset_1 + Constants.SIZEOF_INT; int len = Math.min(len_1, len_2); for (int i = 0; i < len; i++) { if (bb.get(i + startPos_1) != key[i]) return bb.get(i + startPos_1) - key[i]; } return len_1 - len_2; }
java
protected static int compareStrings(int offset_1, byte[] key, ByteBuffer bb) { offset_1 += bb.getInt(offset_1); int len_1 = bb.getInt(offset_1); int len_2 = key.length; int startPos_1 = offset_1 + Constants.SIZEOF_INT; int len = Math.min(len_1, len_2); for (int i = 0; i < len; i++) { if (bb.get(i + startPos_1) != key[i]) return bb.get(i + startPos_1) - key[i]; } return len_1 - len_2; }
[ "protected", "static", "int", "compareStrings", "(", "int", "offset_1", ",", "byte", "[", "]", "key", ",", "ByteBuffer", "bb", ")", "{", "offset_1", "+=", "bb", ".", "getInt", "(", "offset_1", ")", ";", "int", "len_1", "=", "bb", ".", "getInt", "(", ...
Compare string from the buffer with the 'String' object. @param offset_1 An 'int' index of the first string into the bb. @param key Second string as a byte array. @param bb A {@code ByteBuffer} to get the first string.
[ "Compare", "string", "from", "the", "buffer", "with", "the", "String", "object", "." ]
train
https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L253-L264
line/armeria
core/src/main/java/com/linecorp/armeria/server/AbstractHttpService.java
AbstractHttpService.doPatch
@Deprecated protected void doPatch(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); }
java
@Deprecated protected void doPatch(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); }
[ "@", "Deprecated", "protected", "void", "doPatch", "(", "ServiceRequestContext", "ctx", ",", "HttpRequest", "req", ",", "HttpResponseWriter", "res", ")", "throws", "Exception", "{", "res", ".", "respond", "(", "HttpStatus", ".", "METHOD_NOT_ALLOWED", ")", ";", "...
Handles an {@link HttpMethod#PATCH PATCH} request. This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. @deprecated Use {@link #doPatch(ServiceRequestContext, HttpRequest)}.
[ "Handles", "an", "{", "@link", "HttpMethod#PATCH", "PATCH", "}", "request", ".", "This", "method", "sends", "a", "{", "@link", "HttpStatus#METHOD_NOT_ALLOWED", "405", "Method", "Not", "Allowed", "}", "response", "by", "default", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/AbstractHttpService.java#L228-L232
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java
DatastreamResource.getDatastreamHistory
@Path("/{dsID}/history") @GET public Response getDatastreamHistory(@PathParam(RestParam.PID) String pid, @PathParam(RestParam.DSID) String dsID, @QueryParam(RestParam.FORMAT) @DefaultValue(HTML) String format, @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) { try { Context context = getContext(); Datastream[] datastreamHistory = m_management.getDatastreamHistory(context, pid, dsID); if (datastreamHistory == null || datastreamHistory.length == 0) { return Response .status(Status.NOT_FOUND) .type("text/plain") .entity("No datastream history could be found. There is no datastream history for " + "the digital object \"" + pid + "\" with datastream ID of \"" + dsID).build(); } ReadableCharArrayWriter out = new ReadableCharArrayWriter(1024); getSerializer(context).datastreamHistoryToXml( pid, dsID, datastreamHistory, out); out.close(); MediaType mime = RestHelper.getContentType(format); if (TEXT_HTML.isCompatible(mime)) { Reader reader = out.toReader(); out = new ReadableCharArrayWriter(1024); transform(reader, "management/viewDatastreamHistory.xslt", out); out.close(); } return Response.ok(out.toReader(), mime).build(); } catch (Exception e) { return handleException(e, flash); } }
java
@Path("/{dsID}/history") @GET public Response getDatastreamHistory(@PathParam(RestParam.PID) String pid, @PathParam(RestParam.DSID) String dsID, @QueryParam(RestParam.FORMAT) @DefaultValue(HTML) String format, @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) { try { Context context = getContext(); Datastream[] datastreamHistory = m_management.getDatastreamHistory(context, pid, dsID); if (datastreamHistory == null || datastreamHistory.length == 0) { return Response .status(Status.NOT_FOUND) .type("text/plain") .entity("No datastream history could be found. There is no datastream history for " + "the digital object \"" + pid + "\" with datastream ID of \"" + dsID).build(); } ReadableCharArrayWriter out = new ReadableCharArrayWriter(1024); getSerializer(context).datastreamHistoryToXml( pid, dsID, datastreamHistory, out); out.close(); MediaType mime = RestHelper.getContentType(format); if (TEXT_HTML.isCompatible(mime)) { Reader reader = out.toReader(); out = new ReadableCharArrayWriter(1024); transform(reader, "management/viewDatastreamHistory.xslt", out); out.close(); } return Response.ok(out.toReader(), mime).build(); } catch (Exception e) { return handleException(e, flash); } }
[ "@", "Path", "(", "\"/{dsID}/history\"", ")", "@", "GET", "public", "Response", "getDatastreamHistory", "(", "@", "PathParam", "(", "RestParam", ".", "PID", ")", "String", "pid", ",", "@", "PathParam", "(", "RestParam", ".", "DSID", ")", "String", "dsID", ...
Invoke API-M.getDatastreamHistory(context,pid,dsId) GET /objects/{pid}/datastreams/{dsID}/history @param pid the PID of the digital object @param dsID the ID of the datastream @param format the desired format. Either html or "xml" @return the response, either in XML or XHTML format
[ "Invoke", "API", "-", "M", ".", "getDatastreamHistory", "(", "context", "pid", "dsId", ")", "GET", "/", "objects", "/", "{", "pid", "}", "/", "datastreams", "/", "{", "dsID", "}", "/", "history" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java#L206-L249
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlUtility.java
SqlUtility.extractParametersFromString
public static Pair<String, List<Pair<String, TypeName>>> extractParametersFromString(String value, SQLiteModelMethod method, SQLiteEntity entity) { String whereStatement = value; Pair<String, List<Pair<String, TypeName>>> result = new Pair<String, List<Pair<String, TypeName>>>(); result.value1 = new ArrayList<Pair<String, TypeName>>(); // replace placeholder :{ } with ? { Matcher matcher = PARAMETER.matcher(whereStatement); String paramName; StringBuffer buffer = new StringBuffer(); TypeName paramType; while (matcher.find()) { matcher.appendReplacement(buffer, "?"); paramName = SqlAnalyzer.extractParamName(matcher); paramType = method.findParameterTypeByAliasOrName(paramName); if (paramType == null) { throw (new MethodParameterNotFoundException(method, paramName)); } result.value1.add(new Pair<String, TypeName>(paramName, paramType)); } matcher.appendTail(buffer); whereStatement = buffer.toString(); } // replace fields { Matcher matcher = WORD.matcher(whereStatement); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { ModelProperty property = entity.findPropertyByName(matcher.group(1)); if (property != null) { matcher.appendReplacement(buffer, entity.findPropertyByName(matcher.group(1)).columnName); } } matcher.appendTail(buffer); whereStatement = buffer.toString(); } result.value0 = whereStatement; return result; }
java
public static Pair<String, List<Pair<String, TypeName>>> extractParametersFromString(String value, SQLiteModelMethod method, SQLiteEntity entity) { String whereStatement = value; Pair<String, List<Pair<String, TypeName>>> result = new Pair<String, List<Pair<String, TypeName>>>(); result.value1 = new ArrayList<Pair<String, TypeName>>(); // replace placeholder :{ } with ? { Matcher matcher = PARAMETER.matcher(whereStatement); String paramName; StringBuffer buffer = new StringBuffer(); TypeName paramType; while (matcher.find()) { matcher.appendReplacement(buffer, "?"); paramName = SqlAnalyzer.extractParamName(matcher); paramType = method.findParameterTypeByAliasOrName(paramName); if (paramType == null) { throw (new MethodParameterNotFoundException(method, paramName)); } result.value1.add(new Pair<String, TypeName>(paramName, paramType)); } matcher.appendTail(buffer); whereStatement = buffer.toString(); } // replace fields { Matcher matcher = WORD.matcher(whereStatement); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { ModelProperty property = entity.findPropertyByName(matcher.group(1)); if (property != null) { matcher.appendReplacement(buffer, entity.findPropertyByName(matcher.group(1)).columnName); } } matcher.appendTail(buffer); whereStatement = buffer.toString(); } result.value0 = whereStatement; return result; }
[ "public", "static", "Pair", "<", "String", ",", "List", "<", "Pair", "<", "String", ",", "TypeName", ">", ">", ">", "extractParametersFromString", "(", "String", "value", ",", "SQLiteModelMethod", "method", ",", "SQLiteEntity", "entity", ")", "{", "String", ...
Extract from value string every placeholder :{}, replace it with ? and then convert every field typeName with column typeName. The result is a pair: the first value is the elaborated string. The second is the list of parameters associated to ?. This second parameter is the list of parameters and replaced with ?. @param value the value @param method the method @param entity the entity @return Pair
[ "Extract", "from", "value", "string", "every", "placeholder", ":", "{}", "replace", "it", "with", "?", "and", "then", "convert", "every", "field", "typeName", "with", "column", "typeName", ".", "The", "result", "is", "a", "pair", ":", "the", "first", "valu...
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlUtility.java#L63-L110
graknlabs/grakn
server/src/server/exception/TransactionException.java
TransactionException.hasNotAllowed
public static TransactionException hasNotAllowed(Thing thing, Attribute attribute) { return create(HAS_INVALID.getMessage(thing.type().label(), attribute.type().label())); }
java
public static TransactionException hasNotAllowed(Thing thing, Attribute attribute) { return create(HAS_INVALID.getMessage(thing.type().label(), attribute.type().label())); }
[ "public", "static", "TransactionException", "hasNotAllowed", "(", "Thing", "thing", ",", "Attribute", "attribute", ")", "{", "return", "create", "(", "HAS_INVALID", ".", "getMessage", "(", "thing", ".", "type", "(", ")", ".", "label", "(", ")", ",", "attribu...
Thrown when a Thing is not allowed to have Attribute of that AttributeType
[ "Thrown", "when", "a", "Thing", "is", "not", "allowed", "to", "have", "Attribute", "of", "that", "AttributeType" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L93-L95
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.getTroubleshooting
public TroubleshootingResultInner getTroubleshooting(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) { return getTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body(); }
java
public TroubleshootingResultInner getTroubleshooting(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) { return getTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body(); }
[ "public", "TroubleshootingResultInner", "getTroubleshooting", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "TroubleshootingParameters", "parameters", ")", "{", "return", "getTroubleshootingWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Initiate troubleshooting on a specified resource. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that define the resource to troubleshoot. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the TroubleshootingResultInner object if successful.
[ "Initiate", "troubleshooting", "on", "a", "specified", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1464-L1466
dita-ot/dita-ot
src/main/java/org/dita/dost/module/BranchFilterModule.java
BranchFilterModule.filterTopics
private void filterTopics(final Element topicref, final List<FilterUtils> filters) { final List<FilterUtils> fs = combineFilterUtils(topicref, filters); final String href = topicref.getAttribute(ATTRIBUTE_NAME_HREF); final Attr skipFilter = topicref.getAttributeNode(SKIP_FILTER); final URI srcAbsUri = job.tempDirURI.resolve(map.resolve(href)); if (!fs.isEmpty() && skipFilter == null && !filtered.contains(srcAbsUri) && !href.isEmpty() && !ATTR_SCOPE_VALUE_EXTERNAL.equals(topicref.getAttribute(ATTRIBUTE_NAME_SCOPE)) && !ATTR_PROCESSING_ROLE_VALUE_RESOURCE_ONLY.equals(topicref.getAttribute(ATTRIBUTE_NAME_PROCESSING_ROLE)) && isDitaFormat(topicref.getAttributeNode(ATTRIBUTE_NAME_FORMAT))) { final ProfilingFilter writer = new ProfilingFilter(); writer.setLogger(logger); writer.setJob(job); writer.setFilterUtils(fs); writer.setCurrentFile(srcAbsUri); final List<XMLFilter> pipe = singletonList(writer); logger.info("Filtering " + srcAbsUri); try { xmlUtils.transform(srcAbsUri, pipe); } catch (final DITAOTException e) { logger.error("Failed to filter " + srcAbsUri + ": " + e.getMessage(), e); } filtered.add(srcAbsUri); } if (skipFilter != null) { topicref.removeAttributeNode(skipFilter); } for (final Element child: getChildElements(topicref, MAP_TOPICREF)) { if (DITAVAREF_D_DITAVALREF.matches(child)) { continue; } filterTopics(child, fs); } }
java
private void filterTopics(final Element topicref, final List<FilterUtils> filters) { final List<FilterUtils> fs = combineFilterUtils(topicref, filters); final String href = topicref.getAttribute(ATTRIBUTE_NAME_HREF); final Attr skipFilter = topicref.getAttributeNode(SKIP_FILTER); final URI srcAbsUri = job.tempDirURI.resolve(map.resolve(href)); if (!fs.isEmpty() && skipFilter == null && !filtered.contains(srcAbsUri) && !href.isEmpty() && !ATTR_SCOPE_VALUE_EXTERNAL.equals(topicref.getAttribute(ATTRIBUTE_NAME_SCOPE)) && !ATTR_PROCESSING_ROLE_VALUE_RESOURCE_ONLY.equals(topicref.getAttribute(ATTRIBUTE_NAME_PROCESSING_ROLE)) && isDitaFormat(topicref.getAttributeNode(ATTRIBUTE_NAME_FORMAT))) { final ProfilingFilter writer = new ProfilingFilter(); writer.setLogger(logger); writer.setJob(job); writer.setFilterUtils(fs); writer.setCurrentFile(srcAbsUri); final List<XMLFilter> pipe = singletonList(writer); logger.info("Filtering " + srcAbsUri); try { xmlUtils.transform(srcAbsUri, pipe); } catch (final DITAOTException e) { logger.error("Failed to filter " + srcAbsUri + ": " + e.getMessage(), e); } filtered.add(srcAbsUri); } if (skipFilter != null) { topicref.removeAttributeNode(skipFilter); } for (final Element child: getChildElements(topicref, MAP_TOPICREF)) { if (DITAVAREF_D_DITAVALREF.matches(child)) { continue; } filterTopics(child, fs); } }
[ "private", "void", "filterTopics", "(", "final", "Element", "topicref", ",", "final", "List", "<", "FilterUtils", ">", "filters", ")", "{", "final", "List", "<", "FilterUtils", ">", "fs", "=", "combineFilterUtils", "(", "topicref", ",", "filters", ")", ";", ...
Modify and filter topics for branches. These files use an existing file name.
[ "Modify", "and", "filter", "topics", "for", "branches", ".", "These", "files", "use", "an", "existing", "file", "name", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/BranchFilterModule.java#L391-L428
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java
MarkLogicClient.sendBooleanQuery
public boolean sendBooleanQuery(String queryString, SPARQLQueryBindingSet bindings, boolean includeInferred, String baseURI) throws IOException, RepositoryException, MalformedQueryException, QueryInterruptedException { return getClient().performBooleanQuery(queryString, bindings, this.tx, includeInferred, baseURI); }
java
public boolean sendBooleanQuery(String queryString, SPARQLQueryBindingSet bindings, boolean includeInferred, String baseURI) throws IOException, RepositoryException, MalformedQueryException, QueryInterruptedException { return getClient().performBooleanQuery(queryString, bindings, this.tx, includeInferred, baseURI); }
[ "public", "boolean", "sendBooleanQuery", "(", "String", "queryString", ",", "SPARQLQueryBindingSet", "bindings", ",", "boolean", "includeInferred", ",", "String", "baseURI", ")", "throws", "IOException", ",", "RepositoryException", ",", "MalformedQueryException", ",", "...
BooleanQuery @param queryString @param bindings @param includeInferred @param baseURI @return @throws IOException @throws RepositoryException @throws MalformedQueryException @throws UnauthorizedException @throws QueryInterruptedException
[ "BooleanQuery" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L271-L274
jbundle/jbundle
main/db/src/main/java/org/jbundle/main/user/db/UpdateGroupPermissionHandler.java
UpdateGroupPermissionHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) || (iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_DELETE_TYPE)) { int iGroupID = (int)this.getOwner().getField(UserPermission.USER_GROUP_ID).getValue(); if (m_iOldGroupID != -1) if (iGroupID != m_iOldGroupID) this.updateGroupPermission(m_iOldGroupID); this.updateGroupPermission(iGroupID); } return super.doRecordChange(field, iChangeType, bDisplayOption); }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) || (iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_DELETE_TYPE)) { int iGroupID = (int)this.getOwner().getField(UserPermission.USER_GROUP_ID).getValue(); if (m_iOldGroupID != -1) if (iGroupID != m_iOldGroupID) this.updateGroupPermission(m_iOldGroupID); this.updateGroupPermission(iGroupID); } return super.doRecordChange(field, iChangeType, bDisplayOption); }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "if", "(", "(", "iChangeType", "==", "DBConstants", ".", "AFTER_UPDATE_TYPE", ")", "||", "(", "iChangeType", "==", "DBConstants",...
Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code. ADD_TYPE - Before a write. UPDATE_TYPE - Before an update. DELETE_TYPE - Before a delete. AFTER_UPDATE_TYPE - After a write or update. LOCK_TYPE - Before a lock. SELECT_TYPE - After a select. DESELECT_TYPE - After a deselect. MOVE_NEXT_TYPE - After a move. AFTER_REQUERY_TYPE - Record opened. SELECT_EOF_TYPE - EOF Hit.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/user/db/UpdateGroupPermissionHandler.java#L99-L112
kubernetes-client/java
kubernetes/src/main/java/io/kubernetes/client/ApiClient.java
ApiClient.parameterToPair
public List<Pair> parameterToPair(String name, Object value) { List<Pair> params = new ArrayList<Pair>(); // preconditions if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; params.add(new Pair(name, parameterToString(value))); return params; }
java
public List<Pair> parameterToPair(String name, Object value) { List<Pair> params = new ArrayList<Pair>(); // preconditions if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; params.add(new Pair(name, parameterToString(value))); return params; }
[ "public", "List", "<", "Pair", ">", "parameterToPair", "(", "String", "name", ",", "Object", "value", ")", "{", "List", "<", "Pair", ">", "params", "=", "new", "ArrayList", "<", "Pair", ">", "(", ")", ";", "// preconditions", "if", "(", "name", "==", ...
Formats the specified query parameter to a list containing a single {@code Pair} object. Note that {@code value} must not be a collection. @param name The name of the parameter. @param value The value of the parameter. @return A list containing a single {@code Pair} object.
[ "Formats", "the", "specified", "query", "parameter", "to", "a", "list", "containing", "a", "single", "{", "@code", "Pair", "}", "object", "." ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/ApiClient.java#L480-L488
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java
SloppyClassReflection.sawOpcode
@Override public void sawOpcode(int seen) { switch (state) { case COLLECT: if ((seen == Const.INVOKESTATIC) || (seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKESPECIAL)) { refClasses.add(getClassConstantOperand()); String signature = getSigConstantOperand(); Type[] argTypes = Type.getArgumentTypes(signature); for (Type t : argTypes) { addType(t); } Type resultType = Type.getReturnType(signature); addType(resultType); } break; case SEEN_NOTHING: if ((seen == Const.LDC) || (seen == Const.LDC_W)) { Constant c = getConstantRefOperand(); if (c instanceof ConstantString) { clsName = ((ConstantString) c).getBytes(getConstantPool()); state = State.SEEN_LDC; } } break; case SEEN_LDC: if ((seen == Const.INVOKESTATIC) && "forName".equals(getNameConstantOperand()) && "java/lang/Class".equals(getClassConstantOperand()) && refClasses.contains(clsName)) { bugReporter.reportBug(new BugInstance(this, BugType.SCR_SLOPPY_CLASS_REFLECTION.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); } state = State.SEEN_NOTHING; break; } }
java
@Override public void sawOpcode(int seen) { switch (state) { case COLLECT: if ((seen == Const.INVOKESTATIC) || (seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKESPECIAL)) { refClasses.add(getClassConstantOperand()); String signature = getSigConstantOperand(); Type[] argTypes = Type.getArgumentTypes(signature); for (Type t : argTypes) { addType(t); } Type resultType = Type.getReturnType(signature); addType(resultType); } break; case SEEN_NOTHING: if ((seen == Const.LDC) || (seen == Const.LDC_W)) { Constant c = getConstantRefOperand(); if (c instanceof ConstantString) { clsName = ((ConstantString) c).getBytes(getConstantPool()); state = State.SEEN_LDC; } } break; case SEEN_LDC: if ((seen == Const.INVOKESTATIC) && "forName".equals(getNameConstantOperand()) && "java/lang/Class".equals(getClassConstantOperand()) && refClasses.contains(clsName)) { bugReporter.reportBug(new BugInstance(this, BugType.SCR_SLOPPY_CLASS_REFLECTION.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); } state = State.SEEN_NOTHING; break; } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "switch", "(", "state", ")", "{", "case", "COLLECT", ":", "if", "(", "(", "seen", "==", "Const", ".", "INVOKESTATIC", ")", "||", "(", "seen", "==", "Const", ".", "INVOKEVIR...
overrides the visitor to find class loading that is non obfuscation proof @param seen the opcode that is being visited
[ "overrides", "the", "visitor", "to", "find", "class", "loading", "that", "is", "non", "obfuscation", "proof" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java#L138-L173
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java
BaseDataPublisher.publishSingleTaskData
private void publishSingleTaskData(WorkUnitState state, int branchId) throws IOException { publishData(state, branchId, true, new HashSet<Path>()); addLineageInfo(state, branchId); }
java
private void publishSingleTaskData(WorkUnitState state, int branchId) throws IOException { publishData(state, branchId, true, new HashSet<Path>()); addLineageInfo(state, branchId); }
[ "private", "void", "publishSingleTaskData", "(", "WorkUnitState", "state", ",", "int", "branchId", ")", "throws", "IOException", "{", "publishData", "(", "state", ",", "branchId", ",", "true", ",", "new", "HashSet", "<", "Path", ">", "(", ")", ")", ";", "a...
This method publishes output data for a single task based on the given {@link WorkUnitState}. Output data from other tasks won't be published even if they are in the same folder.
[ "This", "method", "publishes", "output", "data", "for", "a", "single", "task", "based", "on", "the", "given", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java#L346-L350
neo4j/neo4j-java-driver
driver/src/main/java/org/neo4j/driver/internal/util/Preconditions.java
Preconditions.checkArgument
public static void checkArgument( Object argument, Class<?> expectedClass ) { if ( !expectedClass.isInstance( argument ) ) { throw new IllegalArgumentException( "Argument expected to be of type: " + expectedClass.getName() + " but was: " + argument ); } }
java
public static void checkArgument( Object argument, Class<?> expectedClass ) { if ( !expectedClass.isInstance( argument ) ) { throw new IllegalArgumentException( "Argument expected to be of type: " + expectedClass.getName() + " but was: " + argument ); } }
[ "public", "static", "void", "checkArgument", "(", "Object", "argument", ",", "Class", "<", "?", ">", "expectedClass", ")", "{", "if", "(", "!", "expectedClass", ".", "isInstance", "(", "argument", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(...
Assert that given argument is of expected type. @param argument the object to check. @param expectedClass the expected type. @throws IllegalArgumentException if argument is not of expected type.
[ "Assert", "that", "given", "argument", "is", "of", "expected", "type", "." ]
train
https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/util/Preconditions.java#L49-L55
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java
MapApi.getNullableString
public static String getNullableString(final Map map, final Object... path) { return getNullable(map, String.class, path); }
java
public static String getNullableString(final Map map, final Object... path) { return getNullable(map, String.class, path); }
[ "public", "static", "String", "getNullableString", "(", "final", "Map", "map", ",", "final", "Object", "...", "path", ")", "{", "return", "getNullable", "(", "map", ",", "String", ".", "class", ",", "path", ")", ";", "}" ]
Get string value by path. @param map subject @param path nodes to walk in map @return value
[ "Get", "string", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java#L177-L179
jboss/jboss-el-api_spec
src/main/java/javax/el/ELManager.java
ELManager.mapFunction
public void mapFunction(String prefix, String function, Method meth) { getELContext().getFunctionMapper().mapFunction(prefix, function, meth); }
java
public void mapFunction(String prefix, String function, Method meth) { getELContext().getFunctionMapper().mapFunction(prefix, function, meth); }
[ "public", "void", "mapFunction", "(", "String", "prefix", ",", "String", "function", ",", "Method", "meth", ")", "{", "getELContext", "(", ")", ".", "getFunctionMapper", "(", ")", ".", "mapFunction", "(", "prefix", ",", "function", ",", "meth", ")", ";", ...
Maps a static method to an EL function. @param prefix The namespace of the functions, can be "". @param function The name of the function. @param meth The static method to be invoked when the function is used.
[ "Maps", "a", "static", "method", "to", "an", "EL", "function", "." ]
train
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELManager.java#L122-L124
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/Statement.java
Statement.writeIOExceptionMethod
public final void writeIOExceptionMethod(int access, Method method, ClassVisitor visitor) { writeMethodTo(new CodeBuilder(access, method, IO_EXCEPTION_ARRAY, visitor)); }
java
public final void writeIOExceptionMethod(int access, Method method, ClassVisitor visitor) { writeMethodTo(new CodeBuilder(access, method, IO_EXCEPTION_ARRAY, visitor)); }
[ "public", "final", "void", "writeIOExceptionMethod", "(", "int", "access", ",", "Method", "method", ",", "ClassVisitor", "visitor", ")", "{", "writeMethodTo", "(", "new", "CodeBuilder", "(", "access", ",", "method", ",", "IO_EXCEPTION_ARRAY", ",", "visitor", ")"...
Writes this statement to the {@link ClassVisitor} as a method. @param access The access modifiers of the method @param method The method signature @param visitor The class visitor to write it to
[ "Writes", "this", "statement", "to", "the", "{", "@link", "ClassVisitor", "}", "as", "a", "method", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/Statement.java#L135-L137
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/internal/stream/SpliteratorBasedStream.java
SpliteratorBasedStream.mergeMap
public <R> ReactiveSeq<R> mergeMap(final Function<? super T, ? extends Publisher<? extends R>> mapper) { return mergeMap(256,mapper); }
java
public <R> ReactiveSeq<R> mergeMap(final Function<? super T, ? extends Publisher<? extends R>> mapper) { return mergeMap(256,mapper); }
[ "public", "<", "R", ">", "ReactiveSeq", "<", "R", ">", "mergeMap", "(", "final", "Function", "<", "?", "super", "T", ",", "?", "extends", "Publisher", "<", "?", "extends", "R", ">", ">", "mapper", ")", "{", "return", "mergeMap", "(", "256", ",", "m...
A potentially asynchronous flatMap operation where data from each publisher may arrive out of order @param mapper @return
[ "A", "potentially", "asynchronous", "flatMap", "operation", "where", "data", "from", "each", "publisher", "may", "arrive", "out", "of", "order" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/internal/stream/SpliteratorBasedStream.java#L354-L356
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/model/TorqueModelDef.java
TorqueModelDef.addForeignkeys
private void addForeignkeys(ReferenceDescriptorDef refDef, TableDef tableDef) { if (!refDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_DATABASE_FOREIGNKEY, true)) { // we shall not generate a database foreignkey return; } // a foreignkey is added to the table schema if // the referenced table exists (i.e. the referenced type has an associated table) // then the foreignkey consists of: // remote table = table of referenced type // local fields = foreignkey fields of the reference // remote fields = primarykeys of the referenced type ClassDescriptorDef ownerClassDef = (ClassDescriptorDef)refDef.getOwner(); String targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF); ClassDescriptorDef referencedClassDef = ((ModelDef)ownerClassDef.getOwner()).getClass(targetClassName); // we can add a foreignkey only if the target type and all its subtypes either // map to the same table or do not map to a table at all String tableName = getHierarchyTable(referencedClassDef); if (tableName == null) { return; } try { String name = refDef.getName(); ArrayList localFields = ownerClassDef.getFields(refDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY)); ArrayList remoteFields = referencedClassDef.getPrimaryKeys(); tableDef.addForeignkey(name, tableName, getColumns(localFields), getColumns(remoteFields)); } catch (NoSuchFieldException ex) { // won't happen if we already checked the constraints } }
java
private void addForeignkeys(ReferenceDescriptorDef refDef, TableDef tableDef) { if (!refDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_DATABASE_FOREIGNKEY, true)) { // we shall not generate a database foreignkey return; } // a foreignkey is added to the table schema if // the referenced table exists (i.e. the referenced type has an associated table) // then the foreignkey consists of: // remote table = table of referenced type // local fields = foreignkey fields of the reference // remote fields = primarykeys of the referenced type ClassDescriptorDef ownerClassDef = (ClassDescriptorDef)refDef.getOwner(); String targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF); ClassDescriptorDef referencedClassDef = ((ModelDef)ownerClassDef.getOwner()).getClass(targetClassName); // we can add a foreignkey only if the target type and all its subtypes either // map to the same table or do not map to a table at all String tableName = getHierarchyTable(referencedClassDef); if (tableName == null) { return; } try { String name = refDef.getName(); ArrayList localFields = ownerClassDef.getFields(refDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY)); ArrayList remoteFields = referencedClassDef.getPrimaryKeys(); tableDef.addForeignkey(name, tableName, getColumns(localFields), getColumns(remoteFields)); } catch (NoSuchFieldException ex) { // won't happen if we already checked the constraints } }
[ "private", "void", "addForeignkeys", "(", "ReferenceDescriptorDef", "refDef", ",", "TableDef", "tableDef", ")", "{", "if", "(", "!", "refDef", ".", "getBooleanProperty", "(", "PropertyHelper", ".", "OJB_PROPERTY_DATABASE_FOREIGNKEY", ",", "true", ")", ")", "{", "/...
Adds foreignkey(s) for the reference to the corresponding table(s). @param refDef The reference @param tableDef The table of the class owning the reference
[ "Adds", "foreignkey", "(", "s", ")", "for", "the", "reference", "to", "the", "corresponding", "table", "(", "s", ")", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/TorqueModelDef.java#L198-L237
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.setRGB_preserveAlpha
public void setRGB_preserveAlpha(int r, int g, int b){ setValue((getValue() & 0xff000000 ) | Pixel.argb(0, r, g, b)); }
java
public void setRGB_preserveAlpha(int r, int g, int b){ setValue((getValue() & 0xff000000 ) | Pixel.argb(0, r, g, b)); }
[ "public", "void", "setRGB_preserveAlpha", "(", "int", "r", ",", "int", "g", ",", "int", "b", ")", "{", "setValue", "(", "(", "getValue", "(", ")", "&", "0xff000000", ")", "|", "Pixel", ".", "argb", "(", "0", ",", "r", ",", "g", ",", "b", ")", "...
Sets an RGB value at the position currently referenced by this Pixel. The present alpha value will not be altered by this operation. Each channel value is assumed to be 8bit and otherwise truncated. @param r red @param g green @param b blue @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the Img's data array. @see #setRGB_fromDouble_preserveAlpha(double, double, double) @since 1.2
[ "Sets", "an", "RGB", "value", "at", "the", "position", "currently", "referenced", "by", "this", "Pixel", ".", "The", "present", "alpha", "value", "will", "not", "be", "altered", "by", "this", "operation", ".", "Each", "channel", "value", "is", "assumed", "...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L382-L384
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassOptionPaneUI.java
SeaGlassOptionPaneUI.createMessageArea
@Override protected Container createMessageArea() { JPanel top = new JPanel(); top.setName("OptionPane.messageArea"); top.setLayout(new BorderLayout()); /* Fill the body. */ Container body = new JPanel(new GridBagLayout()); Container realBody = new JPanel(new BorderLayout()); body.setName("OptionPane.body"); realBody.setName("OptionPane.realBody"); if (getIcon() != null) { JPanel sep = new JPanel(); sep.setName("OptionPane.separator"); sep.setPreferredSize(new Dimension(15, 1)); realBody.add(sep, BorderLayout.BEFORE_LINE_BEGINS); } realBody.add(body, BorderLayout.CENTER); GridBagConstraints cons = new GridBagConstraints(); cons.gridx = cons.gridy = 0; cons.gridwidth = GridBagConstraints.REMAINDER; cons.gridheight = 1; SeaGlassContext context = getContext(optionPane, ENABLED); cons.anchor = context.getStyle().getInt(context, "OptionPane.messageAnchor", GridBagConstraints.CENTER); context.dispose(); cons.insets = new Insets(0, 0, 3, 0); addMessageComponents(body, cons, getMessage(), getMaxCharactersPerLineCount(), false); top.add(realBody, BorderLayout.CENTER); addIcon(top); return top; }
java
@Override protected Container createMessageArea() { JPanel top = new JPanel(); top.setName("OptionPane.messageArea"); top.setLayout(new BorderLayout()); /* Fill the body. */ Container body = new JPanel(new GridBagLayout()); Container realBody = new JPanel(new BorderLayout()); body.setName("OptionPane.body"); realBody.setName("OptionPane.realBody"); if (getIcon() != null) { JPanel sep = new JPanel(); sep.setName("OptionPane.separator"); sep.setPreferredSize(new Dimension(15, 1)); realBody.add(sep, BorderLayout.BEFORE_LINE_BEGINS); } realBody.add(body, BorderLayout.CENTER); GridBagConstraints cons = new GridBagConstraints(); cons.gridx = cons.gridy = 0; cons.gridwidth = GridBagConstraints.REMAINDER; cons.gridheight = 1; SeaGlassContext context = getContext(optionPane, ENABLED); cons.anchor = context.getStyle().getInt(context, "OptionPane.messageAnchor", GridBagConstraints.CENTER); context.dispose(); cons.insets = new Insets(0, 0, 3, 0); addMessageComponents(body, cons, getMessage(), getMaxCharactersPerLineCount(), false); top.add(realBody, BorderLayout.CENTER); addIcon(top); return top; }
[ "@", "Override", "protected", "Container", "createMessageArea", "(", ")", "{", "JPanel", "top", "=", "new", "JPanel", "(", ")", ";", "top", ".", "setName", "(", "\"OptionPane.messageArea\"", ")", ";", "top", ".", "setLayout", "(", "new", "BorderLayout", "(",...
Called from {@link #installComponents} to create a {@code Container} containing the body of the message. The icon is the created by calling {@link #addIcon}.
[ "Called", "from", "{" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassOptionPaneUI.java#L249-L286
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getUntilFirstIncl
@Nullable public static String getUntilFirstIncl (@Nullable final String sStr, @Nullable final String sSearch) { return _getUntilFirst (sStr, sSearch, true); }
java
@Nullable public static String getUntilFirstIncl (@Nullable final String sStr, @Nullable final String sSearch) { return _getUntilFirst (sStr, sSearch, true); }
[ "@", "Nullable", "public", "static", "String", "getUntilFirstIncl", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nullable", "final", "String", "sSearch", ")", "{", "return", "_getUntilFirst", "(", "sStr", ",", "sSearch", ",", "true", ")", ";",...
Get everything from the string up to and including the first passed string. @param sStr The source string. May be <code>null</code>. @param sSearch The string to search. May be <code>null</code>. @return <code>null</code> if the passed string does not contain the search string. If the search string is empty, the empty string is returned.
[ "Get", "everything", "from", "the", "string", "up", "to", "and", "including", "the", "first", "passed", "string", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4802-L4806
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/ClassHelper.java
ClassHelper.newInstance
public static Object newInstance(Class target, Class[] types, Object[] args, boolean makeAccessible) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { Constructor con; if (makeAccessible) { con = target.getDeclaredConstructor(types); if (makeAccessible && !con.isAccessible()) { con.setAccessible(true); } } else { con = target.getConstructor(types); } return con.newInstance(args); }
java
public static Object newInstance(Class target, Class[] types, Object[] args, boolean makeAccessible) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { Constructor con; if (makeAccessible) { con = target.getDeclaredConstructor(types); if (makeAccessible && !con.isAccessible()) { con.setAccessible(true); } } else { con = target.getConstructor(types); } return con.newInstance(args); }
[ "public", "static", "Object", "newInstance", "(", "Class", "target", ",", "Class", "[", "]", "types", ",", "Object", "[", "]", "args", ",", "boolean", "makeAccessible", ")", "throws", "InstantiationException", ",", "IllegalAccessException", ",", "IllegalArgumentEx...
Returns a new instance of the given class, using the constructor with the specified parameter types. This method can also use private constructors if <code>makeAccessible</code> is set to <code>true</code> (and there are no other security constraints). @param target The class to instantiate @param types The parameter types @param args The arguments @param makeAccessible If the constructor shall be made accessible prior to using it @return The instance
[ "Returns", "a", "new", "instance", "of", "the", "given", "class", "using", "the", "constructor", "with", "the", "specified", "parameter", "types", ".", "This", "method", "can", "also", "use", "private", "constructors", "if", "<code", ">", "makeAccessible<", "/...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L201-L223