repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.illegalCode | public static void illegalCode(Class<?> destination, Class<?> source, String path, Throwable e){
String additionalInformation = e.getMessage().split(",")[1];
throw new IllegalCodeException(MSG.INSTANCE.message(illegalCodePath,destination.getSimpleName(),source.getSimpleName(),path,additionalInformation));
} | java | public static void illegalCode(Class<?> destination, Class<?> source, String path, Throwable e){
String additionalInformation = e.getMessage().split(",")[1];
throw new IllegalCodeException(MSG.INSTANCE.message(illegalCodePath,destination.getSimpleName(),source.getSimpleName(),path,additionalInformation));
} | [
"public",
"static",
"void",
"illegalCode",
"(",
"Class",
"<",
"?",
">",
"destination",
",",
"Class",
"<",
"?",
">",
"source",
",",
"String",
"path",
",",
"Throwable",
"e",
")",
"{",
"String",
"additionalInformation",
"=",
"e",
".",
"getMessage",
"(",
")"... | Thrown when there is an error in mapper generated class.
@param destination destination class
@param source source class
@param path xml path configuration
@param e exception captured | [
"Thrown",
"when",
"there",
"is",
"an",
"error",
"in",
"mapper",
"generated",
"class",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L590-L593 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/INFLO.java | INFLO.computeNeighborhoods | private void computeNeighborhoods(Relation<O> relation, DataStore<SetDBIDs> knns, ModifiableDBIDs pruned, WritableDataStore<ModifiableDBIDs> rNNminuskNNs) {
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Finding RkNN", relation.size(), LOG) : null;
for(DBIDIter iter = relation.iterDBIDs(); iter.valid(); iter.advance()) {
DBIDs knn = knns.get(iter);
int count = 1; // The point itself.
for(DBIDIter niter = knn.iter(); niter.valid(); niter.advance()) {
// Ignore the query point itself.
if(DBIDUtil.equal(iter, niter)) {
continue;
}
// As we did not initialize count with the rNN size, we check all
// neighbors here.
if(knns.get(niter).contains(iter)) {
count++;
}
else {
// In contrast to INFLO pseudocode, we only update if it is not found,
// i.e., if it is in RkNN \setminus kNN, to save memory.
rNNminuskNNs.get(niter).add(iter);
}
}
// INFLO pruning rule
if(count >= knn.size() * m) {
pruned.add(iter);
}
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
} | java | private void computeNeighborhoods(Relation<O> relation, DataStore<SetDBIDs> knns, ModifiableDBIDs pruned, WritableDataStore<ModifiableDBIDs> rNNminuskNNs) {
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Finding RkNN", relation.size(), LOG) : null;
for(DBIDIter iter = relation.iterDBIDs(); iter.valid(); iter.advance()) {
DBIDs knn = knns.get(iter);
int count = 1; // The point itself.
for(DBIDIter niter = knn.iter(); niter.valid(); niter.advance()) {
// Ignore the query point itself.
if(DBIDUtil.equal(iter, niter)) {
continue;
}
// As we did not initialize count with the rNN size, we check all
// neighbors here.
if(knns.get(niter).contains(iter)) {
count++;
}
else {
// In contrast to INFLO pseudocode, we only update if it is not found,
// i.e., if it is in RkNN \setminus kNN, to save memory.
rNNminuskNNs.get(niter).add(iter);
}
}
// INFLO pruning rule
if(count >= knn.size() * m) {
pruned.add(iter);
}
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
} | [
"private",
"void",
"computeNeighborhoods",
"(",
"Relation",
"<",
"O",
">",
"relation",
",",
"DataStore",
"<",
"SetDBIDs",
">",
"knns",
",",
"ModifiableDBIDs",
"pruned",
",",
"WritableDataStore",
"<",
"ModifiableDBIDs",
">",
"rNNminuskNNs",
")",
"{",
"FiniteProgres... | Compute the reverse kNN minus the kNN.
<p>
This is based on algorithm 2 (two-way search) from the INFLO paper, but
unfortunately this algorithm does not compute the RkNN correctly, but
rather \( RkNN \cap kNN \), which is quite useless given that we will use
the union of that with kNN later on. Therefore, we decided to rather follow
what appears to be the idea of the method, not the literal pseudocode
included.
@param relation Data relation
@param knns Stored nearest neighbors
@param pruned Pruned objects: with too many neighbors
@param rNNminuskNNs reverse kNN storage | [
"Compute",
"the",
"reverse",
"kNN",
"minus",
"the",
"kNN",
".",
"<p",
">",
"This",
"is",
"based",
"on",
"algorithm",
"2",
"(",
"two",
"-",
"way",
"search",
")",
"from",
"the",
"INFLO",
"paper",
"but",
"unfortunately",
"this",
"algorithm",
"does",
"not",
... | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/INFLO.java#L185-L213 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.bitwiseOr | public IPv6AddressSection bitwiseOr(IPv6AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, SizeMismatchException {
checkMaskSectionCount(mask);
return getOredSegments(
this,
retainPrefix ? getPrefixLength() : null,
getAddressCreator(),
true,
this::getSegment,
i -> mask.getSegment(i).getSegmentValue());
} | java | public IPv6AddressSection bitwiseOr(IPv6AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, SizeMismatchException {
checkMaskSectionCount(mask);
return getOredSegments(
this,
retainPrefix ? getPrefixLength() : null,
getAddressCreator(),
true,
this::getSegment,
i -> mask.getSegment(i).getSegmentValue());
} | [
"public",
"IPv6AddressSection",
"bitwiseOr",
"(",
"IPv6AddressSection",
"mask",
",",
"boolean",
"retainPrefix",
")",
"throws",
"IncompatibleAddressException",
",",
"SizeMismatchException",
"{",
"checkMaskSectionCount",
"(",
"mask",
")",
";",
"return",
"getOredSegments",
"... | Does the bitwise disjunction with this address. Useful when subnetting. Similar to {@link #mask(IPv6AddressSection)} which does the bitwise conjunction.
@param mask
@param retainPrefix whether to drop the prefix
@return
@throws IncompatibleAddressException | [
"Does",
"the",
"bitwise",
"disjunction",
"with",
"this",
"address",
".",
"Useful",
"when",
"subnetting",
".",
"Similar",
"to",
"{",
"@link",
"#mask",
"(",
"IPv6AddressSection",
")",
"}",
"which",
"does",
"the",
"bitwise",
"conjunction",
"."
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1759-L1768 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java | Director.installAssets | public void installAssets(Collection<String> assetIds, RepositoryConnectionList loginInfo) throws InstallException {
fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING_ASSETS"));
if (assetIds == null || assetIds.isEmpty()) {
throw ExceptionUtils.createByKey("ERROR_ASSETS_LIST_INVALID");
}
RepositoryConnectionList li = loginInfo == null ? getResolveDirector().getRepositoryConnectionList(null, null, null,
this.getClass().getCanonicalName() + ".installAssets") : loginInfo;
Map<String, List<List<RepositoryResource>>> installResources = getResolveDirector().resolveMap(assetIds, li, false);
if (isEmpty(installResources)) {
throw ExceptionUtils.createByKey(InstallException.ALREADY_EXISTS, "ASSETS_ALREADY_INSTALLED",
InstallUtils.getShortNames(product.getFeatureDefinitions(), assetIds).toString());
}
downloadAssets(installResources, InstallConstants.TO_USER);
} | java | public void installAssets(Collection<String> assetIds, RepositoryConnectionList loginInfo) throws InstallException {
fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING_ASSETS"));
if (assetIds == null || assetIds.isEmpty()) {
throw ExceptionUtils.createByKey("ERROR_ASSETS_LIST_INVALID");
}
RepositoryConnectionList li = loginInfo == null ? getResolveDirector().getRepositoryConnectionList(null, null, null,
this.getClass().getCanonicalName() + ".installAssets") : loginInfo;
Map<String, List<List<RepositoryResource>>> installResources = getResolveDirector().resolveMap(assetIds, li, false);
if (isEmpty(installResources)) {
throw ExceptionUtils.createByKey(InstallException.ALREADY_EXISTS, "ASSETS_ALREADY_INSTALLED",
InstallUtils.getShortNames(product.getFeatureDefinitions(), assetIds).toString());
}
downloadAssets(installResources, InstallConstants.TO_USER);
} | [
"public",
"void",
"installAssets",
"(",
"Collection",
"<",
"String",
">",
"assetIds",
",",
"RepositoryConnectionList",
"loginInfo",
")",
"throws",
"InstallException",
"{",
"fireProgressEvent",
"(",
"InstallProgressEvent",
".",
"CHECK",
",",
"1",
",",
"Messages",
"."... | Installs the specified assets
@param assetIds Collection of asset Ids
@param loginInfo RepositoryConnectionList to access repository with assets
@throws InstallException | [
"Installs",
"the",
"specified",
"assets"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L1399-L1414 |
resilience4j/resilience4j | resilience4j-spring/src/main/java/io/github/resilience4j/retry/configure/RetryConfigurationProperties.java | RetryConfigurationProperties.configureRetryIntervalFunction | private void configureRetryIntervalFunction(BackendProperties properties, RetryConfig.Builder<Object> builder) {
if (properties.getWaitDuration() != 0) {
long waitDuration = properties.getWaitDuration();
if (properties.getEnableExponentialBackoff()) {
if (properties.getExponentialBackoffMultiplier() != 0) {
builder.intervalFunction(IntervalFunction.ofExponentialBackoff(waitDuration, properties.getExponentialBackoffMultiplier()));
} else {
builder.intervalFunction(IntervalFunction.ofExponentialBackoff(properties.getWaitDuration()));
}
} else if (properties.getEnableRandomizedWait()) {
if (properties.getRandomizedWaitFactor() != 0) {
builder.intervalFunction(IntervalFunction.ofRandomized(waitDuration, properties.getRandomizedWaitFactor()));
} else {
builder.intervalFunction(IntervalFunction.ofRandomized(waitDuration));
}
} else {
builder.waitDuration(Duration.ofMillis(properties.getWaitDuration()));
}
}
} | java | private void configureRetryIntervalFunction(BackendProperties properties, RetryConfig.Builder<Object> builder) {
if (properties.getWaitDuration() != 0) {
long waitDuration = properties.getWaitDuration();
if (properties.getEnableExponentialBackoff()) {
if (properties.getExponentialBackoffMultiplier() != 0) {
builder.intervalFunction(IntervalFunction.ofExponentialBackoff(waitDuration, properties.getExponentialBackoffMultiplier()));
} else {
builder.intervalFunction(IntervalFunction.ofExponentialBackoff(properties.getWaitDuration()));
}
} else if (properties.getEnableRandomizedWait()) {
if (properties.getRandomizedWaitFactor() != 0) {
builder.intervalFunction(IntervalFunction.ofRandomized(waitDuration, properties.getRandomizedWaitFactor()));
} else {
builder.intervalFunction(IntervalFunction.ofRandomized(waitDuration));
}
} else {
builder.waitDuration(Duration.ofMillis(properties.getWaitDuration()));
}
}
} | [
"private",
"void",
"configureRetryIntervalFunction",
"(",
"BackendProperties",
"properties",
",",
"RetryConfig",
".",
"Builder",
"<",
"Object",
">",
"builder",
")",
"{",
"if",
"(",
"properties",
".",
"getWaitDuration",
"(",
")",
"!=",
"0",
")",
"{",
"long",
"w... | decide which retry delay polciy will be configured based into the configured properties
@param properties the backend retry properties
@param builder the retry config builder | [
"decide",
"which",
"retry",
"delay",
"polciy",
"will",
"be",
"configured",
"based",
"into",
"the",
"configured",
"properties"
] | train | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring/src/main/java/io/github/resilience4j/retry/configure/RetryConfigurationProperties.java#L136-L155 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.isUserInRole | @Override
public boolean isUserInRole(String role, IExtendedRequest req) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "isUserInRole role = " + role);
}
if (role == null)
return false;
Subject subject = subjectManager.getCallerSubject();
if (subject == null) {
return false;
}
return wasch.isUserInRole(role, req, subject);
} | java | @Override
public boolean isUserInRole(String role, IExtendedRequest req) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "isUserInRole role = " + role);
}
if (role == null)
return false;
Subject subject = subjectManager.getCallerSubject();
if (subject == null) {
return false;
}
return wasch.isUserInRole(role, req, subject);
} | [
"@",
"Override",
"public",
"boolean",
"isUserInRole",
"(",
"String",
"role",
",",
"IExtendedRequest",
"req",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"deb... | {@inheritDoc} If the role is null or the call is unauthenticated,
return false. Otherwise, check if the authenticated subject is in
the requested role. | [
"{"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L472-L487 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/impl/flexi/FlexiBean.java | FlexiBean.put | public Object put(String propertyName, Object newValue) {
if (VALID_KEY.matcher(propertyName).matches() == false) {
throw new IllegalArgumentException("Invalid key for FlexiBean: " + propertyName);
}
return dataWritable().put(propertyName, newValue);
} | java | public Object put(String propertyName, Object newValue) {
if (VALID_KEY.matcher(propertyName).matches() == false) {
throw new IllegalArgumentException("Invalid key for FlexiBean: " + propertyName);
}
return dataWritable().put(propertyName, newValue);
} | [
"public",
"Object",
"put",
"(",
"String",
"propertyName",
",",
"Object",
"newValue",
")",
"{",
"if",
"(",
"VALID_KEY",
".",
"matcher",
"(",
"propertyName",
")",
".",
"matches",
"(",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Sets a property in this bean to the specified value.
<p>
This creates a property if one does not exist.
@param propertyName the property name, not empty
@param newValue the new value, may be null
@return the old value of the property, may be null | [
"Sets",
"a",
"property",
"in",
"this",
"bean",
"to",
"the",
"specified",
"value",
".",
"<p",
">",
"This",
"creates",
"a",
"property",
"if",
"one",
"does",
"not",
"exist",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/impl/flexi/FlexiBean.java#L288-L293 |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java | VerificationContextBuilder.setDocumentHash | public VerificationContextBuilder setDocumentHash(DataHash documentHash, Long level) {
this.documentHash = documentHash;
this.inputHashLevel = level;
return this;
} | java | public VerificationContextBuilder setDocumentHash(DataHash documentHash, Long level) {
this.documentHash = documentHash;
this.inputHashLevel = level;
return this;
} | [
"public",
"VerificationContextBuilder",
"setDocumentHash",
"(",
"DataHash",
"documentHash",
",",
"Long",
"level",
")",
"{",
"this",
".",
"documentHash",
"=",
"documentHash",
";",
"this",
".",
"inputHashLevel",
"=",
"level",
";",
"return",
"this",
";",
"}"
] | Used to set the hash and local aggregation tree height.
If present then this hash must equal to signature input hash.
@param documentHash document hash
@return instance of {@link VerificationContextBuilder} | [
"Used",
"to",
"set",
"the",
"hash",
"and",
"local",
"aggregation",
"tree",
"height",
".",
"If",
"present",
"then",
"this",
"hash",
"must",
"equal",
"to",
"signature",
"input",
"hash",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java#L121-L125 |
apache/groovy | src/main/groovy/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.checkValueIsType | public static boolean checkValueIsType(Object value, Object name, Class type) {
if (value != null) {
if (type.isAssignableFrom(value.getClass())) {
return true;
} else {
throw new RuntimeException("The value argument of '" + name + "' must be of type "
+ type.getName() + ". Found: " + value.getClass());
}
} else {
return false;
}
} | java | public static boolean checkValueIsType(Object value, Object name, Class type) {
if (value != null) {
if (type.isAssignableFrom(value.getClass())) {
return true;
} else {
throw new RuntimeException("The value argument of '" + name + "' must be of type "
+ type.getName() + ". Found: " + value.getClass());
}
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"checkValueIsType",
"(",
"Object",
"value",
",",
"Object",
"name",
",",
"Class",
"type",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"type",
".",
"isAssignableFrom",
"(",
"value",
".",
"getClass",
"(",
... | Checks type of value against builder type
@param value the node's value
@param name the node's name
@param type a Class that may be assignable to the value's class
@return true if type is assignable to the value's class, false if value
is null. | [
"Checks",
"type",
"of",
"value",
"against",
"builder",
"type"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L104-L115 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_SideBuffer.java | ST_SideBuffer.singleSideBuffer | public static Geometry singleSideBuffer(Geometry geometry, double distance){
if(geometry==null){
return null;
}
return computeSingleSideBuffer(geometry, distance, new BufferParameters());
} | java | public static Geometry singleSideBuffer(Geometry geometry, double distance){
if(geometry==null){
return null;
}
return computeSingleSideBuffer(geometry, distance, new BufferParameters());
} | [
"public",
"static",
"Geometry",
"singleSideBuffer",
"(",
"Geometry",
"geometry",
",",
"double",
"distance",
")",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"computeSingleSideBuffer",
"(",
"geometry",
",",
"distanc... | Compute a single side buffer with default parameters
@param geometry
@param distance
@return | [
"Compute",
"a",
"single",
"side",
"buffer",
"with",
"default",
"parameters"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_SideBuffer.java#L58-L63 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/context/GenericsContext.java | GenericsContext.couldRequireKnownOuterGenerics | private boolean couldRequireKnownOuterGenerics(final GenericsContext root, final Type type) {
final Type outer = TypeUtils.getOuter(type);
// inner class may use generics of the root class
return outer != null && genericsInfo.getComposingTypes().contains(root.resolveClass(outer));
} | java | private boolean couldRequireKnownOuterGenerics(final GenericsContext root, final Type type) {
final Type outer = TypeUtils.getOuter(type);
// inner class may use generics of the root class
return outer != null && genericsInfo.getComposingTypes().contains(root.resolveClass(outer));
} | [
"private",
"boolean",
"couldRequireKnownOuterGenerics",
"(",
"final",
"GenericsContext",
"root",
",",
"final",
"Type",
"type",
")",
"{",
"final",
"Type",
"outer",
"=",
"TypeUtils",
".",
"getOuter",
"(",
"type",
")",
";",
"// inner class may use generics of the root cl... | Inner class could use outer class generics, and if outer class is known (in current hierarchy),
we can assume to use it's generics (correct for most cases, but may be corner cases).
@param root correct context for type resolution
@param type type to check
@return true if type is inner and outer class is present in current hierarchy | [
"Inner",
"class",
"could",
"use",
"outer",
"class",
"generics",
"and",
"if",
"outer",
"class",
"is",
"known",
"(",
"in",
"current",
"hierarchy",
")",
"we",
"can",
"assume",
"to",
"use",
"it",
"s",
"generics",
"(",
"correct",
"for",
"most",
"cases",
"but"... | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/context/GenericsContext.java#L288-L292 |
j256/simplejmx | src/main/java/com/j256/simplejmx/common/ObjectNameUtil.java | ObjectNameUtil.makeObjectName | public static ObjectName makeObjectName(JmxResource jmxResource, Object obj) {
String domainName = jmxResource.domainName();
if (isEmpty(domainName)) {
throw new IllegalArgumentException(
"Could not create ObjectName because domain name not specified in @JmxResource");
}
String beanName = getBeanName(jmxResource);
if (beanName == null) {
beanName = obj.getClass().getSimpleName();
}
return makeObjectName(domainName, beanName, null, jmxResource.folderNames());
} | java | public static ObjectName makeObjectName(JmxResource jmxResource, Object obj) {
String domainName = jmxResource.domainName();
if (isEmpty(domainName)) {
throw new IllegalArgumentException(
"Could not create ObjectName because domain name not specified in @JmxResource");
}
String beanName = getBeanName(jmxResource);
if (beanName == null) {
beanName = obj.getClass().getSimpleName();
}
return makeObjectName(domainName, beanName, null, jmxResource.folderNames());
} | [
"public",
"static",
"ObjectName",
"makeObjectName",
"(",
"JmxResource",
"jmxResource",
",",
"Object",
"obj",
")",
"{",
"String",
"domainName",
"=",
"jmxResource",
".",
"domainName",
"(",
")",
";",
"if",
"(",
"isEmpty",
"(",
"domainName",
")",
")",
"{",
"thro... | Constructs an object-name from a jmx-resource and a object which is not self-naming.
@param jmxResource
Annotation from the class for which we are creating our ObjectName.
@param obj
Object for which we are creating our ObjectName
@throws IllegalArgumentException
If we had problems building the name | [
"Constructs",
"an",
"object",
"-",
"name",
"from",
"a",
"jmx",
"-",
"resource",
"and",
"a",
"object",
"which",
"is",
"not",
"self",
"-",
"naming",
"."
] | train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/common/ObjectNameUtil.java#L76-L87 |
biojava/biojava | biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitFacade.java | TwoBitFacade.getSequence | public String getSequence(String chromosomeName, int start, int end) throws Exception {
twoBitParser.close();
twoBitParser.setCurrentSequence(chromosomeName);
return twoBitParser.loadFragment(start,end-start);
} | java | public String getSequence(String chromosomeName, int start, int end) throws Exception {
twoBitParser.close();
twoBitParser.setCurrentSequence(chromosomeName);
return twoBitParser.loadFragment(start,end-start);
} | [
"public",
"String",
"getSequence",
"(",
"String",
"chromosomeName",
",",
"int",
"start",
",",
"int",
"end",
")",
"throws",
"Exception",
"{",
"twoBitParser",
".",
"close",
"(",
")",
";",
"twoBitParser",
".",
"setCurrentSequence",
"(",
"chromosomeName",
")",
";"... | Extract a sequence from a chromosome, using chromosomal coordinates
@param chromosomeName
@param start
@param end
@return the DNASequence from the requested coordinates.
@throws Exception | [
"Extract",
"a",
"sequence",
"from",
"a",
"chromosome",
"using",
"chromosomal",
"coordinates"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitFacade.java#L78-L82 |
square/okhttp | okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java | Http2Connection.writeData | public void writeData(int streamId, boolean outFinished, Buffer buffer, long byteCount)
throws IOException {
if (byteCount == 0) { // Empty data frames are not flow-controlled.
writer.data(outFinished, streamId, buffer, 0);
return;
}
while (byteCount > 0) {
int toWrite;
synchronized (Http2Connection.this) {
try {
while (bytesLeftInWriteWindow <= 0) {
// Before blocking, confirm that the stream we're writing is still open. It's possible
// that the stream has since been closed (such as if this write timed out.)
if (!streams.containsKey(streamId)) {
throw new IOException("stream closed");
}
Http2Connection.this.wait(); // Wait until we receive a WINDOW_UPDATE.
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // Retain interrupted status.
throw new InterruptedIOException();
}
toWrite = (int) Math.min(byteCount, bytesLeftInWriteWindow);
toWrite = Math.min(toWrite, writer.maxDataLength());
bytesLeftInWriteWindow -= toWrite;
}
byteCount -= toWrite;
writer.data(outFinished && byteCount == 0, streamId, buffer, toWrite);
}
} | java | public void writeData(int streamId, boolean outFinished, Buffer buffer, long byteCount)
throws IOException {
if (byteCount == 0) { // Empty data frames are not flow-controlled.
writer.data(outFinished, streamId, buffer, 0);
return;
}
while (byteCount > 0) {
int toWrite;
synchronized (Http2Connection.this) {
try {
while (bytesLeftInWriteWindow <= 0) {
// Before blocking, confirm that the stream we're writing is still open. It's possible
// that the stream has since been closed (such as if this write timed out.)
if (!streams.containsKey(streamId)) {
throw new IOException("stream closed");
}
Http2Connection.this.wait(); // Wait until we receive a WINDOW_UPDATE.
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // Retain interrupted status.
throw new InterruptedIOException();
}
toWrite = (int) Math.min(byteCount, bytesLeftInWriteWindow);
toWrite = Math.min(toWrite, writer.maxDataLength());
bytesLeftInWriteWindow -= toWrite;
}
byteCount -= toWrite;
writer.data(outFinished && byteCount == 0, streamId, buffer, toWrite);
}
} | [
"public",
"void",
"writeData",
"(",
"int",
"streamId",
",",
"boolean",
"outFinished",
",",
"Buffer",
"buffer",
",",
"long",
"byteCount",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteCount",
"==",
"0",
")",
"{",
"// Empty data frames are not flow-controlled."... | Callers of this method are not thread safe, and sometimes on application threads. Most often,
this method will be called to send a buffer worth of data to the peer.
<p>Writes are subject to the write window of the stream and the connection. Until there is a
window sufficient to send {@code byteCount}, the caller will block. For example, a user of
{@code HttpURLConnection} who flushes more bytes to the output stream than the connection's
write window will block.
<p>Zero {@code byteCount} writes are not subject to flow control and will not block. The only
use case for zero {@code byteCount} is closing a flushed output stream. | [
"Callers",
"of",
"this",
"method",
"are",
"not",
"thread",
"safe",
"and",
"sometimes",
"on",
"application",
"threads",
".",
"Most",
"often",
"this",
"method",
"will",
"be",
"called",
"to",
"send",
"a",
"buffer",
"worth",
"of",
"data",
"to",
"the",
"peer",
... | train | https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java#L286-L318 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java | IdentityPatchRunner.executeTasks | static PatchingResult executeTasks(final IdentityPatchContext context, final IdentityPatchContext.FinalizeCallback callback) throws Exception {
final List<PreparedTask> tasks = new ArrayList<PreparedTask>();
final List<ContentItem> conflicts = new ArrayList<ContentItem>();
// Identity
prepareTasks(context.getIdentityEntry(), context, tasks, conflicts);
// Layers
for (final IdentityPatchContext.PatchEntry layer : context.getLayers()) {
prepareTasks(layer, context, tasks, conflicts);
}
// AddOns
for (final IdentityPatchContext.PatchEntry addOn : context.getAddOns()) {
prepareTasks(addOn, context, tasks, conflicts);
}
// If there were problems report them
if (!conflicts.isEmpty()) {
throw PatchLogger.ROOT_LOGGER.conflictsDetected(conflicts);
}
// Execute the tasks
for (final PreparedTask task : tasks) {
// Unless it's excluded by the user
final ContentItem item = task.getContentItem();
if (item != null && context.isExcluded(item)) {
continue;
}
// Run the task
task.execute();
}
return context.finalize(callback);
} | java | static PatchingResult executeTasks(final IdentityPatchContext context, final IdentityPatchContext.FinalizeCallback callback) throws Exception {
final List<PreparedTask> tasks = new ArrayList<PreparedTask>();
final List<ContentItem> conflicts = new ArrayList<ContentItem>();
// Identity
prepareTasks(context.getIdentityEntry(), context, tasks, conflicts);
// Layers
for (final IdentityPatchContext.PatchEntry layer : context.getLayers()) {
prepareTasks(layer, context, tasks, conflicts);
}
// AddOns
for (final IdentityPatchContext.PatchEntry addOn : context.getAddOns()) {
prepareTasks(addOn, context, tasks, conflicts);
}
// If there were problems report them
if (!conflicts.isEmpty()) {
throw PatchLogger.ROOT_LOGGER.conflictsDetected(conflicts);
}
// Execute the tasks
for (final PreparedTask task : tasks) {
// Unless it's excluded by the user
final ContentItem item = task.getContentItem();
if (item != null && context.isExcluded(item)) {
continue;
}
// Run the task
task.execute();
}
return context.finalize(callback);
} | [
"static",
"PatchingResult",
"executeTasks",
"(",
"final",
"IdentityPatchContext",
"context",
",",
"final",
"IdentityPatchContext",
".",
"FinalizeCallback",
"callback",
")",
"throws",
"Exception",
"{",
"final",
"List",
"<",
"PreparedTask",
">",
"tasks",
"=",
"new",
"... | Execute all recorded tasks.
@param context the patch context
@param callback the finalization callback
@throws Exception | [
"Execute",
"all",
"recorded",
"tasks",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L630-L658 |
redkale/redkale | src/org/redkale/util/ResourceFactory.java | ResourceFactory.contains | public <A> boolean contains(boolean recursive, String name, Class<? extends A> clazz) {
Map<String, ResourceEntry> map = this.store.get(clazz);
return map == null ? ((recursive && parent != null) ? parent.contains(recursive, name, clazz) : false) : map.containsKey(name);
} | java | public <A> boolean contains(boolean recursive, String name, Class<? extends A> clazz) {
Map<String, ResourceEntry> map = this.store.get(clazz);
return map == null ? ((recursive && parent != null) ? parent.contains(recursive, name, clazz) : false) : map.containsKey(name);
} | [
"public",
"<",
"A",
">",
"boolean",
"contains",
"(",
"boolean",
"recursive",
",",
"String",
"name",
",",
"Class",
"<",
"?",
"extends",
"A",
">",
"clazz",
")",
"{",
"Map",
"<",
"String",
",",
"ResourceEntry",
">",
"map",
"=",
"this",
".",
"store",
"."... | 判断是否包含指定资源名和资源类型的资源对象
@param <A> 泛型
@param recursive 是否遍历父节点
@param name 资源名
@param clazz 资源类型
@return 是否存在 | [
"判断是否包含指定资源名和资源类型的资源对象"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/ResourceFactory.java#L432-L435 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java | TypeHandlerUtils.convertBlob | public static Object convertBlob(Object blob, String value) throws SQLException {
return convertBlob(blob, value.getBytes());
} | java | public static Object convertBlob(Object blob, String value) throws SQLException {
return convertBlob(blob, value.getBytes());
} | [
"public",
"static",
"Object",
"convertBlob",
"(",
"Object",
"blob",
",",
"String",
"value",
")",
"throws",
"SQLException",
"{",
"return",
"convertBlob",
"(",
"blob",
",",
"value",
".",
"getBytes",
"(",
")",
")",
";",
"}"
] | Transfers data from String into sql.Blob
@param blob sql.Blob which would be filled
@param value String
@return sql.Blob from String
@throws SQLException | [
"Transfers",
"data",
"from",
"String",
"into",
"sql",
".",
"Blob"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L161-L163 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java | ExternalizedBeanId.readExternalPKey | private Serializable readExternalPKey(ObjectInput in, byte[] j2eeNameBytes)
throws java.io.IOException, ClassNotFoundException {
int pkeyLength = in.readInt();
byte[] pkeyBytes = new byte[pkeyLength];
//d164415 start
int bytesRead = 0;
for (int offset = 0; offset < pkeyLength; offset += bytesRead)
{
bytesRead = in.read(pkeyBytes, offset, pkeyLength - offset);
if (bytesRead == -1)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "readExternalKey encountered end of stream");
throw new IOException("end of input stream while reading primary key");
}
}
//d164415 end
//
// What we are trying to do here is to get the j2eename of the
// bean in question. The reason we want to do this, we have get
// the ClassLoader of the bean before we attempt to deserialize
// the primary key. The container ClassLoader is no longer aware
// of the bean classes.
// This path may be traversed on a call to keyToObject. In that
// situation, the thread's context ClassLoader is of no use. So we
// have to use some static methods to access the container and get
// the specific ClassLoader for the bean
//
final EJSContainer container = EJSContainer.getDefaultContainer();
J2EEName j2eename = container.getJ2EENameFactory().create(j2eeNameBytes);
ByteArrayInputStream bais = new ByteArrayInputStream(pkeyBytes);
//
// Use a ObjectInputStream, it can then use the bean's ClassLoader
// to resolve the primary key class.
//
ClassLoader loader = EJSContainer.getClassLoader(j2eename);
ObjectInputStream pkeyStream =
container.getEJBRuntime().createObjectInputStream(bais, loader); // RTC71814
Serializable key = (Serializable) pkeyStream.readObject();
return key;
} | java | private Serializable readExternalPKey(ObjectInput in, byte[] j2eeNameBytes)
throws java.io.IOException, ClassNotFoundException {
int pkeyLength = in.readInt();
byte[] pkeyBytes = new byte[pkeyLength];
//d164415 start
int bytesRead = 0;
for (int offset = 0; offset < pkeyLength; offset += bytesRead)
{
bytesRead = in.read(pkeyBytes, offset, pkeyLength - offset);
if (bytesRead == -1)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "readExternalKey encountered end of stream");
throw new IOException("end of input stream while reading primary key");
}
}
//d164415 end
//
// What we are trying to do here is to get the j2eename of the
// bean in question. The reason we want to do this, we have get
// the ClassLoader of the bean before we attempt to deserialize
// the primary key. The container ClassLoader is no longer aware
// of the bean classes.
// This path may be traversed on a call to keyToObject. In that
// situation, the thread's context ClassLoader is of no use. So we
// have to use some static methods to access the container and get
// the specific ClassLoader for the bean
//
final EJSContainer container = EJSContainer.getDefaultContainer();
J2EEName j2eename = container.getJ2EENameFactory().create(j2eeNameBytes);
ByteArrayInputStream bais = new ByteArrayInputStream(pkeyBytes);
//
// Use a ObjectInputStream, it can then use the bean's ClassLoader
// to resolve the primary key class.
//
ClassLoader loader = EJSContainer.getClassLoader(j2eename);
ObjectInputStream pkeyStream =
container.getEJBRuntime().createObjectInputStream(bais, loader); // RTC71814
Serializable key = (Serializable) pkeyStream.readObject();
return key;
} | [
"private",
"Serializable",
"readExternalPKey",
"(",
"ObjectInput",
"in",
",",
"byte",
"[",
"]",
"j2eeNameBytes",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
",",
"ClassNotFoundException",
"{",
"int",
"pkeyLength",
"=",
"in",
".",
"readInt",
"(",
")",... | Private helper method for readExternal - reads the Serialized
primary key.
@author Adrian Colyer
@return java.io.Serializable
@param in java.io.ObjectInput
@exception java.io.IOException The exception description. | [
"Private",
"helper",
"method",
"for",
"readExternal",
"-",
"reads",
"the",
"Serialized",
"primary",
"key",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/ExternalizedBeanId.java#L208-L252 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java | DisksInner.revokeAccess | public OperationStatusResponseInner revokeAccess(String resourceGroupName, String diskName) {
return revokeAccessWithServiceResponseAsync(resourceGroupName, diskName).toBlocking().last().body();
} | java | public OperationStatusResponseInner revokeAccess(String resourceGroupName, String diskName) {
return revokeAccessWithServiceResponseAsync(resourceGroupName, diskName).toBlocking().last().body();
} | [
"public",
"OperationStatusResponseInner",
"revokeAccess",
"(",
"String",
"resourceGroupName",
",",
"String",
"diskName",
")",
"{",
"return",
"revokeAccessWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"diskName",
")",
".",
"toBlocking",
"(",
")",
".",
"last",... | Revokes access to a disk.
@param resourceGroupName The name of the resource group.
@param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@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 OperationStatusResponseInner object if successful. | [
"Revokes",
"access",
"to",
"a",
"disk",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java#L1124-L1126 |
houbb/log-integration | src/main/java/com/github/houbb/log/integration/support/placeholder/impl/DefaultPlaceholderConnector.java | DefaultPlaceholderConnector.buildString | private String buildString(String format, Object[] params) {
String stringFormat = format;
for(int i = 0; i < params.length; i++) {
stringFormat = stringFormat.replaceFirst("\\{}", "%s");
}
return String.format(stringFormat, params);
} | java | private String buildString(String format, Object[] params) {
String stringFormat = format;
for(int i = 0; i < params.length; i++) {
stringFormat = stringFormat.replaceFirst("\\{}", "%s");
}
return String.format(stringFormat, params);
} | [
"private",
"String",
"buildString",
"(",
"String",
"format",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"String",
"stringFormat",
"=",
"format",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"params",
".",
"length",
";",
"i",
"++",
")",
"... | 构建字符串
"1 {} 2 {} " TO "1 %s 2 %s"
@param format 格式化
@param params 参数列表
@return 构建的结果 | [
"构建字符串",
"1",
"{}",
"2",
"{}",
"TO",
"1",
"%s",
"2",
"%s"
] | train | https://github.com/houbb/log-integration/blob/c5e979719aec12a02f7d22b24b04b6fbb1789ca5/src/main/java/com/github/houbb/log/integration/support/placeholder/impl/DefaultPlaceholderConnector.java#L65-L71 |
mnlipp/jgrapes | org.jgrapes.io/src/org/jgrapes/net/SslCodec.java | SslCodec.onIOError | @Handler(channels = EncryptedChannel.class)
public void onIOError(IOError event, IOSubchannel encryptedChannel)
throws SSLException, InterruptedException {
@SuppressWarnings("unchecked")
final Optional<PlainChannel> plainChannel
= (Optional<PlainChannel>) LinkedIOSubchannel
.downstreamChannel(this, encryptedChannel);
plainChannel.ifPresent(channel -> fire(new IOError(event), channel));
} | java | @Handler(channels = EncryptedChannel.class)
public void onIOError(IOError event, IOSubchannel encryptedChannel)
throws SSLException, InterruptedException {
@SuppressWarnings("unchecked")
final Optional<PlainChannel> plainChannel
= (Optional<PlainChannel>) LinkedIOSubchannel
.downstreamChannel(this, encryptedChannel);
plainChannel.ifPresent(channel -> fire(new IOError(event), channel));
} | [
"@",
"Handler",
"(",
"channels",
"=",
"EncryptedChannel",
".",
"class",
")",
"public",
"void",
"onIOError",
"(",
"IOError",
"event",
",",
"IOSubchannel",
"encryptedChannel",
")",
"throws",
"SSLException",
",",
"InterruptedException",
"{",
"@",
"SuppressWarnings",
... | Handles an {@link IOError} event from the encrypted channel (client)
by sending it downstream.
@param event the event
@param encryptedChannel the channel for exchanging the encrypted data
@throws InterruptedException
@throws SSLException | [
"Handles",
"an",
"{",
"@link",
"IOError",
"}",
"event",
"from",
"the",
"encrypted",
"channel",
"(",
"client",
")",
"by",
"sending",
"it",
"downstream",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/net/SslCodec.java#L253-L261 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF6.java | CommonOps_DDF6.extractRow | public static DMatrix6 extractRow( DMatrix6x6 a , int row , DMatrix6 out ) {
if( out == null) out = new DMatrix6();
switch( row ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a12;
out.a3 = a.a13;
out.a4 = a.a14;
out.a5 = a.a15;
out.a6 = a.a16;
break;
case 1:
out.a1 = a.a21;
out.a2 = a.a22;
out.a3 = a.a23;
out.a4 = a.a24;
out.a5 = a.a25;
out.a6 = a.a26;
break;
case 2:
out.a1 = a.a31;
out.a2 = a.a32;
out.a3 = a.a33;
out.a4 = a.a34;
out.a5 = a.a35;
out.a6 = a.a36;
break;
case 3:
out.a1 = a.a41;
out.a2 = a.a42;
out.a3 = a.a43;
out.a4 = a.a44;
out.a5 = a.a45;
out.a6 = a.a46;
break;
case 4:
out.a1 = a.a51;
out.a2 = a.a52;
out.a3 = a.a53;
out.a4 = a.a54;
out.a5 = a.a55;
out.a6 = a.a56;
break;
case 5:
out.a1 = a.a61;
out.a2 = a.a62;
out.a3 = a.a63;
out.a4 = a.a64;
out.a5 = a.a65;
out.a6 = a.a66;
break;
default:
throw new IllegalArgumentException("Out of bounds row. row = "+row);
}
return out;
} | java | public static DMatrix6 extractRow( DMatrix6x6 a , int row , DMatrix6 out ) {
if( out == null) out = new DMatrix6();
switch( row ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a12;
out.a3 = a.a13;
out.a4 = a.a14;
out.a5 = a.a15;
out.a6 = a.a16;
break;
case 1:
out.a1 = a.a21;
out.a2 = a.a22;
out.a3 = a.a23;
out.a4 = a.a24;
out.a5 = a.a25;
out.a6 = a.a26;
break;
case 2:
out.a1 = a.a31;
out.a2 = a.a32;
out.a3 = a.a33;
out.a4 = a.a34;
out.a5 = a.a35;
out.a6 = a.a36;
break;
case 3:
out.a1 = a.a41;
out.a2 = a.a42;
out.a3 = a.a43;
out.a4 = a.a44;
out.a5 = a.a45;
out.a6 = a.a46;
break;
case 4:
out.a1 = a.a51;
out.a2 = a.a52;
out.a3 = a.a53;
out.a4 = a.a54;
out.a5 = a.a55;
out.a6 = a.a56;
break;
case 5:
out.a1 = a.a61;
out.a2 = a.a62;
out.a3 = a.a63;
out.a4 = a.a64;
out.a5 = a.a65;
out.a6 = a.a66;
break;
default:
throw new IllegalArgumentException("Out of bounds row. row = "+row);
}
return out;
} | [
"public",
"static",
"DMatrix6",
"extractRow",
"(",
"DMatrix6x6",
"a",
",",
"int",
"row",
",",
"DMatrix6",
"out",
")",
"{",
"if",
"(",
"out",
"==",
"null",
")",
"out",
"=",
"new",
"DMatrix6",
"(",
")",
";",
"switch",
"(",
"row",
")",
"{",
"case",
"0... | Extracts the row from the matrix a.
@param a Input matrix
@param row Which row is to be extracted
@param out output. Storage for the extracted row. If null then a new vector will be returned.
@return The extracted row. | [
"Extracts",
"the",
"row",
"from",
"the",
"matrix",
"a",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF6.java#L2149-L2204 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRadioButtonSelectExample.java | WRadioButtonSelectExample.addSingleColumnSelectExample | private void addSingleColumnSelectExample() {
add(new WHeading(HeadingLevel.H3, "WRadioButtonSelect laid out in a single column"));
add(new ExplanatoryText("When layout is COLUMN, setting the layoutColumnCount property to one, or forgetting to set it at all (default is "
+ "one) is a little bit pointless."));
final WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setButtonLayout(WRadioButtonSelect.LAYOUT_COLUMNS);
add(new WLabel("One column", select));
add(select);
} | java | private void addSingleColumnSelectExample() {
add(new WHeading(HeadingLevel.H3, "WRadioButtonSelect laid out in a single column"));
add(new ExplanatoryText("When layout is COLUMN, setting the layoutColumnCount property to one, or forgetting to set it at all (default is "
+ "one) is a little bit pointless."));
final WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setButtonLayout(WRadioButtonSelect.LAYOUT_COLUMNS);
add(new WLabel("One column", select));
add(select);
} | [
"private",
"void",
"addSingleColumnSelectExample",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"WRadioButtonSelect laid out in a single column\"",
")",
")",
";",
"add",
"(",
"new",
"ExplanatoryText",
"(",
"\"When layout is COLU... | adds a WRadioButtonSelect with LAYOUT_COLUMN in 1 column simply by not setting the number of columns. This is
superfluous as you should use LAYOUT_STACKED (the default) instead. | [
"adds",
"a",
"WRadioButtonSelect",
"with",
"LAYOUT_COLUMN",
"in",
"1",
"column",
"simply",
"by",
"not",
"setting",
"the",
"number",
"of",
"columns",
".",
"This",
"is",
"superfluous",
"as",
"you",
"should",
"use",
"LAYOUT_STACKED",
"(",
"the",
"default",
")",
... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRadioButtonSelectExample.java#L236-L244 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/time/JMTimeUtil.java | JMTimeUtil.changeFormatAndTimeZoneToOffsetDateTime | public static String changeFormatAndTimeZoneToOffsetDateTime(
String dateFormat, String dateString) {
return getOffsetDateTime(changeTimestampToLong(dateFormat, dateString))
.toString();
} | java | public static String changeFormatAndTimeZoneToOffsetDateTime(
String dateFormat, String dateString) {
return getOffsetDateTime(changeTimestampToLong(dateFormat, dateString))
.toString();
} | [
"public",
"static",
"String",
"changeFormatAndTimeZoneToOffsetDateTime",
"(",
"String",
"dateFormat",
",",
"String",
"dateString",
")",
"{",
"return",
"getOffsetDateTime",
"(",
"changeTimestampToLong",
"(",
"dateFormat",
",",
"dateString",
")",
")",
".",
"toString",
"... | Change format and time zone to offset date time string.
@param dateFormat the date format
@param dateString the date string
@return the string | [
"Change",
"format",
"and",
"time",
"zone",
"to",
"offset",
"date",
"time",
"string",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L417-L421 |
infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/DirectoryLucene.java | DirectoryLucene.forceUnlock | @Override
public void forceUnlock(String lockName) {
Cache<Object, Integer> lockCache = getDistLockCache().getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD);
FileCacheKey fileCacheKey = new FileCacheKey(indexName, lockName, affinitySegmentId);
Object previousValue = lockCache.remove(fileCacheKey);
if (previousValue!=null && trace) {
log.tracef("Lock forcibly removed for index: %s", indexName);
}
} | java | @Override
public void forceUnlock(String lockName) {
Cache<Object, Integer> lockCache = getDistLockCache().getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD);
FileCacheKey fileCacheKey = new FileCacheKey(indexName, lockName, affinitySegmentId);
Object previousValue = lockCache.remove(fileCacheKey);
if (previousValue!=null && trace) {
log.tracef("Lock forcibly removed for index: %s", indexName);
}
} | [
"@",
"Override",
"public",
"void",
"forceUnlock",
"(",
"String",
"lockName",
")",
"{",
"Cache",
"<",
"Object",
",",
"Integer",
">",
"lockCache",
"=",
"getDistLockCache",
"(",
")",
".",
"getAdvancedCache",
"(",
")",
".",
"withFlags",
"(",
"Flag",
".",
"SKIP... | Force release of the lock in this directory. Make sure to understand the
consequences | [
"Force",
"release",
"of",
"the",
"lock",
"in",
"this",
"directory",
".",
"Make",
"sure",
"to",
"understand",
"the",
"consequences"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/DirectoryLucene.java#L174-L182 |
elki-project/elki | elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mktab/MkTabTree.java | MkTabTree.createNewDirectoryEntry | @Override
protected MkTabEntry createNewDirectoryEntry(MkTabTreeNode<O> node, DBID routingObjectID, double parentDistance) {
return new MkTabDirectoryEntry(routingObjectID, parentDistance, node.getPageID(), node.coveringRadiusFromEntries(routingObjectID, this), node.kNNDistances());
} | java | @Override
protected MkTabEntry createNewDirectoryEntry(MkTabTreeNode<O> node, DBID routingObjectID, double parentDistance) {
return new MkTabDirectoryEntry(routingObjectID, parentDistance, node.getPageID(), node.coveringRadiusFromEntries(routingObjectID, this), node.kNNDistances());
} | [
"@",
"Override",
"protected",
"MkTabEntry",
"createNewDirectoryEntry",
"(",
"MkTabTreeNode",
"<",
"O",
">",
"node",
",",
"DBID",
"routingObjectID",
",",
"double",
"parentDistance",
")",
"{",
"return",
"new",
"MkTabDirectoryEntry",
"(",
"routingObjectID",
",",
"paren... | Creates a new directory entry representing the specified node.
@param node the node to be represented by the new entry
@param routingObjectID the id of the routing object of the node
@param parentDistance the distance from the routing object of the node to
the routing object of the parent node | [
"Creates",
"a",
"new",
"directory",
"entry",
"representing",
"the",
"specified",
"node",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mktab/MkTabTree.java#L187-L190 |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java | NameHelper.getGetterName | public String getGetterName(String propertyName, JType type, JsonNode node) {
propertyName = getPropertyNameForAccessor(propertyName, node);
String prefix = type.equals(type.owner()._ref(boolean.class)) ? "is" : "get";
String getterName;
if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) {
getterName = prefix + propertyName;
} else {
getterName = prefix + capitalize(propertyName);
}
if (getterName.equals("getClass")) {
getterName = "getClass_";
}
return getterName;
} | java | public String getGetterName(String propertyName, JType type, JsonNode node) {
propertyName = getPropertyNameForAccessor(propertyName, node);
String prefix = type.equals(type.owner()._ref(boolean.class)) ? "is" : "get";
String getterName;
if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) {
getterName = prefix + propertyName;
} else {
getterName = prefix + capitalize(propertyName);
}
if (getterName.equals("getClass")) {
getterName = "getClass_";
}
return getterName;
} | [
"public",
"String",
"getGetterName",
"(",
"String",
"propertyName",
",",
"JType",
"type",
",",
"JsonNode",
"node",
")",
"{",
"propertyName",
"=",
"getPropertyNameForAccessor",
"(",
"propertyName",
",",
"node",
")",
";",
"String",
"prefix",
"=",
"type",
".",
"e... | Generate getter method name for property.
@param propertyName
@param type
@param node
@return | [
"Generate",
"getter",
"method",
"name",
"for",
"property",
"."
] | train | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java#L197-L214 |
MaxLeap/SDK-CloudCode-Java | cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java | WebUtils.doGet | public static String doGet(String url, Map<String, String> header, Map<String, String> params) throws IOException {
return doRequestWithUrl(url, METHOD_GET, header, params, DEFAULT_CHARSET);
} | java | public static String doGet(String url, Map<String, String> header, Map<String, String> params) throws IOException {
return doRequestWithUrl(url, METHOD_GET, header, params, DEFAULT_CHARSET);
} | [
"public",
"static",
"String",
"doGet",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"String",
">",
"header",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"IOException",
"{",
"return",
"doRequestWithUrl",
"(",
"url",
",... | 执行HTTP GET请求。
@param url 请求地址
@param params 请求参数
@return 响应字符串
@throws IOException | [
"执行HTTP",
"GET请求。"
] | train | https://github.com/MaxLeap/SDK-CloudCode-Java/blob/756064c65dd613919c377bf136cf8710c7507968/cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java#L139-L141 |
SimplicityApks/ReminderDatePicker | lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java | DateSpinner.setSelectedDate | public void setSelectedDate(@NonNull Calendar date) {
final int count = getAdapter().getCount() - 1;
int itemPosition = -1;
for(int i=0; i<count; i++) {
if(getAdapter().getItem(i).equals(date)) { // because DateItem deeply compares to calendar
itemPosition = i;
break;
}
}
if(itemPosition >= 0)
setSelection(itemPosition);
else if(showWeekdayNames) {
final long MILLIS_IN_DAY = 1000*60*60*24;
final long dateDifference = (date.getTimeInMillis()/MILLIS_IN_DAY)
- (Calendar.getInstance().getTimeInMillis()/MILLIS_IN_DAY);
if(dateDifference>0 && dateDifference<7) { // if the date is within the next week:
// construct a temporary DateItem to select:
final int day = date.get(Calendar.DAY_OF_WEEK);
// Because these items are always temporarily selected, we can safely assume that
// they will never appear in the spinner dropdown. When a FLAG_NUMBERS is set, we
// want these items to have the date as secondary text in a short format.
selectTemporary(new DateItem(getWeekDay(day, R.string.date_only_weekday), formatSecondaryDate(date), date, NO_ID));
} else {
// show the date as a full text, using the current DateFormat:
selectTemporary(new DateItem(formatDate(date), date, NO_ID));
}
}
else {
// show the date as a full text, using the current DateFormat:
selectTemporary(new DateItem(formatDate(date), date, NO_ID));
}
} | java | public void setSelectedDate(@NonNull Calendar date) {
final int count = getAdapter().getCount() - 1;
int itemPosition = -1;
for(int i=0; i<count; i++) {
if(getAdapter().getItem(i).equals(date)) { // because DateItem deeply compares to calendar
itemPosition = i;
break;
}
}
if(itemPosition >= 0)
setSelection(itemPosition);
else if(showWeekdayNames) {
final long MILLIS_IN_DAY = 1000*60*60*24;
final long dateDifference = (date.getTimeInMillis()/MILLIS_IN_DAY)
- (Calendar.getInstance().getTimeInMillis()/MILLIS_IN_DAY);
if(dateDifference>0 && dateDifference<7) { // if the date is within the next week:
// construct a temporary DateItem to select:
final int day = date.get(Calendar.DAY_OF_WEEK);
// Because these items are always temporarily selected, we can safely assume that
// they will never appear in the spinner dropdown. When a FLAG_NUMBERS is set, we
// want these items to have the date as secondary text in a short format.
selectTemporary(new DateItem(getWeekDay(day, R.string.date_only_weekday), formatSecondaryDate(date), date, NO_ID));
} else {
// show the date as a full text, using the current DateFormat:
selectTemporary(new DateItem(formatDate(date), date, NO_ID));
}
}
else {
// show the date as a full text, using the current DateFormat:
selectTemporary(new DateItem(formatDate(date), date, NO_ID));
}
} | [
"public",
"void",
"setSelectedDate",
"(",
"@",
"NonNull",
"Calendar",
"date",
")",
"{",
"final",
"int",
"count",
"=",
"getAdapter",
"(",
")",
".",
"getCount",
"(",
")",
"-",
"1",
";",
"int",
"itemPosition",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",... | Sets the Spinner's selection as date. If the date was not in the possible selections, a temporary
item is created and passed to selectTemporary().
@param date The date to be selected. | [
"Sets",
"the",
"Spinner",
"s",
"selection",
"as",
"date",
".",
"If",
"the",
"date",
"was",
"not",
"in",
"the",
"possible",
"selections",
"a",
"temporary",
"item",
"is",
"created",
"and",
"passed",
"to",
"selectTemporary",
"()",
"."
] | train | https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L260-L292 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/ColumnLayoutExample.java | ColumnLayoutExample.addAutoWidthExample | private void addAutoWidthExample() {
add(new WHeading(HeadingLevel.H2, "Automatic (app defined) widths"));
add(new ExplanatoryText("This example shows what happens if you use undefined (0) column width and do not then define them in CSS."));
WPanel panel = new WPanel();
panel.setLayout(new ColumnLayout(new int[]{0, 0, 0},
new Alignment[]{Alignment.LEFT, Alignment.CENTER, Alignment.RIGHT}));
add(panel);
panel.add(new BoxComponent("Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."));
panel.add(new BoxComponent("Praesent eu turpis convallis, fringilla elit nec, ullamcorper purus. Proin dictum ac nunc rhoncus fringilla. "
+ "Pellentesque habitant morbi tristique senectus et netus et malesuada fames."));
panel.add(new BoxComponent("Vestibulum vehicula a turpis et efficitur. Integer maximus enim a orci posuere, id fermentum magna dignissim. "
+ "Sed condimentum, dui et condimentum faucibus, quam erat pharetra."));
panel.add(new BoxComponent("Left"));
panel.add(new BoxComponent("Center"));
panel.add(new BoxComponent("Right"));
add(new WHorizontalRule());
} | java | private void addAutoWidthExample() {
add(new WHeading(HeadingLevel.H2, "Automatic (app defined) widths"));
add(new ExplanatoryText("This example shows what happens if you use undefined (0) column width and do not then define them in CSS."));
WPanel panel = new WPanel();
panel.setLayout(new ColumnLayout(new int[]{0, 0, 0},
new Alignment[]{Alignment.LEFT, Alignment.CENTER, Alignment.RIGHT}));
add(panel);
panel.add(new BoxComponent("Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."));
panel.add(new BoxComponent("Praesent eu turpis convallis, fringilla elit nec, ullamcorper purus. Proin dictum ac nunc rhoncus fringilla. "
+ "Pellentesque habitant morbi tristique senectus et netus et malesuada fames."));
panel.add(new BoxComponent("Vestibulum vehicula a turpis et efficitur. Integer maximus enim a orci posuere, id fermentum magna dignissim. "
+ "Sed condimentum, dui et condimentum faucibus, quam erat pharetra."));
panel.add(new BoxComponent("Left"));
panel.add(new BoxComponent("Center"));
panel.add(new BoxComponent("Right"));
add(new WHorizontalRule());
} | [
"private",
"void",
"addAutoWidthExample",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H2",
",",
"\"Automatic (app defined) widths\"",
")",
")",
";",
"add",
"(",
"new",
"ExplanatoryText",
"(",
"\"This example shows what happens if you use u... | This example shows a column which does not have widths set in Java. This is a "good thing": widths should be set in CSS. | [
"This",
"example",
"shows",
"a",
"column",
"which",
"does",
"not",
"have",
"widths",
"set",
"in",
"Java",
".",
"This",
"is",
"a",
"good",
"thing",
":",
"widths",
"should",
"be",
"set",
"in",
"CSS",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/ColumnLayoutExample.java#L149-L165 |
google/error-prone | check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java | SuggestedFixes.addModifiers | public static Optional<SuggestedFix> addModifiers(
Tree tree, VisitorState state, Modifier... modifiers) {
ModifiersTree originalModifiers = getModifiers(tree);
if (originalModifiers == null) {
return Optional.empty();
}
return addModifiers(tree, originalModifiers, state, new TreeSet<>(Arrays.asList(modifiers)));
} | java | public static Optional<SuggestedFix> addModifiers(
Tree tree, VisitorState state, Modifier... modifiers) {
ModifiersTree originalModifiers = getModifiers(tree);
if (originalModifiers == null) {
return Optional.empty();
}
return addModifiers(tree, originalModifiers, state, new TreeSet<>(Arrays.asList(modifiers)));
} | [
"public",
"static",
"Optional",
"<",
"SuggestedFix",
">",
"addModifiers",
"(",
"Tree",
"tree",
",",
"VisitorState",
"state",
",",
"Modifier",
"...",
"modifiers",
")",
"{",
"ModifiersTree",
"originalModifiers",
"=",
"getModifiers",
"(",
"tree",
")",
";",
"if",
... | Adds modifiers to the given class, method, or field declaration. | [
"Adds",
"modifiers",
"to",
"the",
"given",
"class",
"method",
"or",
"field",
"declaration",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java#L157-L164 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java | DeprecatedListWriter.addAnchor | private void addAnchor(DeprecatedAPIListBuilder builder, int type, Content htmlTree) {
if (builder.hasDocumentation(type)) {
htmlTree.addContent(getMarkerAnchor(ANCHORS[type]));
}
} | java | private void addAnchor(DeprecatedAPIListBuilder builder, int type, Content htmlTree) {
if (builder.hasDocumentation(type)) {
htmlTree.addContent(getMarkerAnchor(ANCHORS[type]));
}
} | [
"private",
"void",
"addAnchor",
"(",
"DeprecatedAPIListBuilder",
"builder",
",",
"int",
"type",
",",
"Content",
"htmlTree",
")",
"{",
"if",
"(",
"builder",
".",
"hasDocumentation",
"(",
"type",
")",
")",
"{",
"htmlTree",
".",
"addContent",
"(",
"getMarkerAncho... | Add the anchor.
@param builder the deprecated list builder
@param type the type of list being documented
@param htmlTree the content tree to which the anchor will be added | [
"Add",
"the",
"anchor",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java#L233-L237 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java | SecurityContextImpl.getWSPrincipal | protected WSPrincipal getWSPrincipal(Subject subject) throws IOException {
WSPrincipal wsPrincipal = null;
Set<WSPrincipal> principals = (subject != null) ? subject.getPrincipals(WSPrincipal.class) : null;
if (principals != null && !principals.isEmpty()) {
if (principals.size() > 1) {
// Error - too many principals
String principalNames = null;
for (WSPrincipal principal : principals) {
if (principalNames == null)
principalNames = principal.getName();
else
principalNames = principalNames + ", " + principal.getName();
}
throw new IOException(Tr.formatMessage(tc, "SEC_CONTEXT_DESERIALIZE_TOO_MANY_PRINCIPALS", principalNames));
} else {
wsPrincipal = principals.iterator().next();
}
}
return wsPrincipal;
} | java | protected WSPrincipal getWSPrincipal(Subject subject) throws IOException {
WSPrincipal wsPrincipal = null;
Set<WSPrincipal> principals = (subject != null) ? subject.getPrincipals(WSPrincipal.class) : null;
if (principals != null && !principals.isEmpty()) {
if (principals.size() > 1) {
// Error - too many principals
String principalNames = null;
for (WSPrincipal principal : principals) {
if (principalNames == null)
principalNames = principal.getName();
else
principalNames = principalNames + ", " + principal.getName();
}
throw new IOException(Tr.formatMessage(tc, "SEC_CONTEXT_DESERIALIZE_TOO_MANY_PRINCIPALS", principalNames));
} else {
wsPrincipal = principals.iterator().next();
}
}
return wsPrincipal;
} | [
"protected",
"WSPrincipal",
"getWSPrincipal",
"(",
"Subject",
"subject",
")",
"throws",
"IOException",
"{",
"WSPrincipal",
"wsPrincipal",
"=",
"null",
";",
"Set",
"<",
"WSPrincipal",
">",
"principals",
"=",
"(",
"subject",
"!=",
"null",
")",
"?",
"subject",
".... | Get the WSPrincipal from the subject
@param subject
@return the WSPrincipal of the subject
@throws IOException if there is more than one WSPrincipal in the subject | [
"Get",
"the",
"WSPrincipal",
"from",
"the",
"subject"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.context/src/com/ibm/ws/security/context/internal/SecurityContextImpl.java#L391-L410 |
interedition/collatex | collatex-core/src/main/java/eu/interedition/collatex/suffixarray/DivSufSort.java | DivSufSort.trCopy | private void trCopy(int ISA, int first, int a, int b, int last, int depth) {
int c, d, e;// ptr
int s, v;
v = b - 1;
for (c = first, d = a - 1; c <= d; ++c) {
s = SA[c] - depth;
if ((0 <= s) && (SA[ISA + s] == v)) {
SA[++d] = s;
SA[ISA + s] = d;
}
}
for (c = last - 1, e = d + 1, d = b; e < d; --c) {
s = SA[c] - depth;
if ((0 <= s) && (SA[ISA + s] == v)) {
SA[--d] = s;
SA[ISA + s] = d;
}
}
} | java | private void trCopy(int ISA, int first, int a, int b, int last, int depth) {
int c, d, e;// ptr
int s, v;
v = b - 1;
for (c = first, d = a - 1; c <= d; ++c) {
s = SA[c] - depth;
if ((0 <= s) && (SA[ISA + s] == v)) {
SA[++d] = s;
SA[ISA + s] = d;
}
}
for (c = last - 1, e = d + 1, d = b; e < d; --c) {
s = SA[c] - depth;
if ((0 <= s) && (SA[ISA + s] == v)) {
SA[--d] = s;
SA[ISA + s] = d;
}
}
} | [
"private",
"void",
"trCopy",
"(",
"int",
"ISA",
",",
"int",
"first",
",",
"int",
"a",
",",
"int",
"b",
",",
"int",
"last",
",",
"int",
"depth",
")",
"{",
"int",
"c",
",",
"d",
",",
"e",
";",
"// ptr",
"int",
"s",
",",
"v",
";",
"v",
"=",
"b... | sort suffixes of middle partition by using sorted order of suffixes of left and
right partition. | [
"sort",
"suffixes",
"of",
"middle",
"partition",
"by",
"using",
"sorted",
"order",
"of",
"suffixes",
"of",
"left",
"and",
"right",
"partition",
"."
] | train | https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/DivSufSort.java#L2080-L2099 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.getInheritedPropertyObject | public CmsClientProperty getInheritedPropertyObject(CmsClientSitemapEntry entry, String name) {
CmsClientSitemapEntry currentEntry = entry;
while (currentEntry != null) {
currentEntry = getParentEntry(currentEntry);
if (currentEntry != null) {
CmsClientProperty folderProp = currentEntry.getOwnProperties().get(name);
if (!CmsClientProperty.isPropertyEmpty(folderProp)) {
return folderProp.withOrigin(currentEntry.getSitePath());
}
}
}
CmsClientProperty parentProp = getParentProperties().get(name);
if (!CmsClientProperty.isPropertyEmpty(parentProp)) {
String origin = parentProp.getOrigin();
String siteRoot = CmsCoreProvider.get().getSiteRoot();
if (origin.startsWith(siteRoot)) {
origin = origin.substring(siteRoot.length());
}
return parentProp.withOrigin(origin);
}
return null;
} | java | public CmsClientProperty getInheritedPropertyObject(CmsClientSitemapEntry entry, String name) {
CmsClientSitemapEntry currentEntry = entry;
while (currentEntry != null) {
currentEntry = getParentEntry(currentEntry);
if (currentEntry != null) {
CmsClientProperty folderProp = currentEntry.getOwnProperties().get(name);
if (!CmsClientProperty.isPropertyEmpty(folderProp)) {
return folderProp.withOrigin(currentEntry.getSitePath());
}
}
}
CmsClientProperty parentProp = getParentProperties().get(name);
if (!CmsClientProperty.isPropertyEmpty(parentProp)) {
String origin = parentProp.getOrigin();
String siteRoot = CmsCoreProvider.get().getSiteRoot();
if (origin.startsWith(siteRoot)) {
origin = origin.substring(siteRoot.length());
}
return parentProp.withOrigin(origin);
}
return null;
} | [
"public",
"CmsClientProperty",
"getInheritedPropertyObject",
"(",
"CmsClientSitemapEntry",
"entry",
",",
"String",
"name",
")",
"{",
"CmsClientSitemapEntry",
"currentEntry",
"=",
"entry",
";",
"while",
"(",
"currentEntry",
"!=",
"null",
")",
"{",
"currentEntry",
"=",
... | Gets the property object which would be inherited by a sitemap entry.<p>
@param entry the sitemap entry
@param name the name of the property
@return the property object which would be inherited | [
"Gets",
"the",
"property",
"object",
"which",
"would",
"be",
"inherited",
"by",
"a",
"sitemap",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1192-L1215 |
haifengl/smile | math/src/main/java/smile/math/matrix/JMatrix.java | JMatrix.eltran | private static void eltran(DenseMatrix A, DenseMatrix V, int[] perm) {
int n = A.nrows();
for (int mp = n - 2; mp > 0; mp--) {
for (int k = mp + 1; k < n; k++) {
V.set(k, mp, A.get(k, mp - 1));
}
int i = perm[mp];
if (i != mp) {
for (int j = mp; j < n; j++) {
V.set(mp, j, V.get(i, j));
V.set(i, j, 0.0);
}
V.set(i, mp, 1.0);
}
}
} | java | private static void eltran(DenseMatrix A, DenseMatrix V, int[] perm) {
int n = A.nrows();
for (int mp = n - 2; mp > 0; mp--) {
for (int k = mp + 1; k < n; k++) {
V.set(k, mp, A.get(k, mp - 1));
}
int i = perm[mp];
if (i != mp) {
for (int j = mp; j < n; j++) {
V.set(mp, j, V.get(i, j));
V.set(i, j, 0.0);
}
V.set(i, mp, 1.0);
}
}
} | [
"private",
"static",
"void",
"eltran",
"(",
"DenseMatrix",
"A",
",",
"DenseMatrix",
"V",
",",
"int",
"[",
"]",
"perm",
")",
"{",
"int",
"n",
"=",
"A",
".",
"nrows",
"(",
")",
";",
"for",
"(",
"int",
"mp",
"=",
"n",
"-",
"2",
";",
"mp",
">",
"... | Accumulate the stabilized elementary similarity transformations used
in the reduction of a real nonsymmetric matrix to upper Hessenberg form by elmhes. | [
"Accumulate",
"the",
"stabilized",
"elementary",
"similarity",
"transformations",
"used",
"in",
"the",
"reduction",
"of",
"a",
"real",
"nonsymmetric",
"matrix",
"to",
"upper",
"Hessenberg",
"form",
"by",
"elmhes",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/JMatrix.java#L1933-L1948 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.validateNamespace | public T validateNamespace(String prefix, String namespaceUri) {
xmlMessageValidationContext.getControlNamespaces().put(prefix, namespaceUri);
return self;
} | java | public T validateNamespace(String prefix, String namespaceUri) {
xmlMessageValidationContext.getControlNamespaces().put(prefix, namespaceUri);
return self;
} | [
"public",
"T",
"validateNamespace",
"(",
"String",
"prefix",
",",
"String",
"namespaceUri",
")",
"{",
"xmlMessageValidationContext",
".",
"getControlNamespaces",
"(",
")",
".",
"put",
"(",
"prefix",
",",
"namespaceUri",
")",
";",
"return",
"self",
";",
"}"
] | Validates XML namespace with prefix and uri.
@param prefix
@param namespaceUri
@return | [
"Validates",
"XML",
"namespace",
"with",
"prefix",
"and",
"uri",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L553-L556 |
phax/ph-commons | ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java | AbstractSingleton.isSingletonInstantiated | public static final boolean isSingletonInstantiated (@Nullable final IScope aScope,
@Nonnull final Class <? extends AbstractSingleton> aClass)
{
return getSingletonIfInstantiated (aScope, aClass) != null;
} | java | public static final boolean isSingletonInstantiated (@Nullable final IScope aScope,
@Nonnull final Class <? extends AbstractSingleton> aClass)
{
return getSingletonIfInstantiated (aScope, aClass) != null;
} | [
"public",
"static",
"final",
"boolean",
"isSingletonInstantiated",
"(",
"@",
"Nullable",
"final",
"IScope",
"aScope",
",",
"@",
"Nonnull",
"final",
"Class",
"<",
"?",
"extends",
"AbstractSingleton",
">",
"aClass",
")",
"{",
"return",
"getSingletonIfInstantiated",
... | Check if a singleton is already instantiated inside a scope
@param aScope
The scope to check. May be <code>null</code> to avoid constructing a
scope.
@param aClass
The class to be checked. May not be <code>null</code>.
@return <code>true</code> if the singleton for the specified class is
already instantiated, <code>false</code> otherwise. | [
"Check",
"if",
"a",
"singleton",
"is",
"already",
"instantiated",
"inside",
"a",
"scope"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java#L447-L451 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java | JobsInner.beginCreate | public JobInner beginCreate(String resourceGroupName, String workspaceName, String experimentName, String jobName, JobCreateParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName, parameters).toBlocking().single().body();
} | java | public JobInner beginCreate(String resourceGroupName, String workspaceName, String experimentName, String jobName, JobCreateParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName, parameters).toBlocking().single().body();
} | [
"public",
"JobInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"workspaceName",
",",
"String",
"experimentName",
",",
"String",
"jobName",
",",
"JobCreateParameters",
"parameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
... | Creates a Job in the given Experiment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param parameters The parameters to provide for job creation.
@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 JobInner object if successful. | [
"Creates",
"a",
"Job",
"in",
"the",
"given",
"Experiment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java#L493-L495 |
taskadapter/redmine-java-api | src/main/java/com/taskadapter/redmineapi/AttachmentManager.java | AttachmentManager.uploadAttachment | public Attachment uploadAttachment(String fileName, String contentType,
InputStream content) throws RedmineException, IOException {
return uploadAttachment(fileName, contentType, content, -1);
} | java | public Attachment uploadAttachment(String fileName, String contentType,
InputStream content) throws RedmineException, IOException {
return uploadAttachment(fileName, contentType, content, -1);
} | [
"public",
"Attachment",
"uploadAttachment",
"(",
"String",
"fileName",
",",
"String",
"contentType",
",",
"InputStream",
"content",
")",
"throws",
"RedmineException",
",",
"IOException",
"{",
"return",
"uploadAttachment",
"(",
"fileName",
",",
"contentType",
",",
"c... | Uploads an attachment.
@param fileName
file name of the attachment.
@param contentType
content type of the attachment.
@param content
attachment content stream.
@return attachment content.
@throws RedmineException if something goes wrong.
@throws IOException
if input cannot be read. This exception cannot be thrown yet
(I am not sure if http client can distinguish "network"
errors and local errors) but is will be good to distinguish
reading errors and transport errors. | [
"Uploads",
"an",
"attachment",
"."
] | train | https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/AttachmentManager.java#L126-L129 |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/client/Iobeam.java | Iobeam.sendAsync | public void sendAsync(SendCallback callback) {
List<ImportService.Submit> reqs;
try {
reqs = prepareDataRequests();
} catch (ApiException e) {
IobeamException ie = new IobeamException(e);
if (callback == null) {
throw ie;
} else {
callback.innerCallback.failed(ie, null);
return;
}
}
for (ImportService.Submit req : reqs) {
if (callback == null && !autoRetry) {
req.executeAsync();
} else if (callback != null && !autoRetry) {
req.executeAsync(callback.innerCallback);
} else {
req.executeAsync(new ReinsertSendCallback(this, callback).innerCallback);
}
}
} | java | public void sendAsync(SendCallback callback) {
List<ImportService.Submit> reqs;
try {
reqs = prepareDataRequests();
} catch (ApiException e) {
IobeamException ie = new IobeamException(e);
if (callback == null) {
throw ie;
} else {
callback.innerCallback.failed(ie, null);
return;
}
}
for (ImportService.Submit req : reqs) {
if (callback == null && !autoRetry) {
req.executeAsync();
} else if (callback != null && !autoRetry) {
req.executeAsync(callback.innerCallback);
} else {
req.executeAsync(new ReinsertSendCallback(this, callback).innerCallback);
}
}
} | [
"public",
"void",
"sendAsync",
"(",
"SendCallback",
"callback",
")",
"{",
"List",
"<",
"ImportService",
".",
"Submit",
">",
"reqs",
";",
"try",
"{",
"reqs",
"=",
"prepareDataRequests",
"(",
")",
";",
"}",
"catch",
"(",
"ApiException",
"e",
")",
"{",
"Iob... | Asynchronous version of send() that will not block the calling thread. Any provided callback
will be run on the background thread when the operation completes.
If `autoRetry` is set, failed requests will add the previous data to the new data store.
@param callback Callback for when the operation completes.
@throws IobeamException Thrown is the client is not initialized or if the device id has not
been set AND no callback set. Otherwise, the exception is passed to
the callback. | [
"Asynchronous",
"version",
"of",
"send",
"()",
"that",
"will",
"not",
"block",
"the",
"calling",
"thread",
".",
"Any",
"provided",
"callback",
"will",
"be",
"run",
"on",
"the",
"background",
"thread",
"when",
"the",
"operation",
"completes",
"."
] | train | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L1004-L1027 |
requery/requery | requery/src/main/java/io/requery/sql/SchemaModifier.java | SchemaModifier.dropColumn | public <T> void dropColumn(Attribute<T, ?> attribute) {
Type<T> type = attribute.getDeclaringType();
if (attribute.isForeignKey()) {
// TODO MySQL need to drop FK constraint first
}
QueryBuilder qb = createQueryBuilder();
qb.keyword(ALTER, TABLE)
.tableName(type.getName())
.keyword(DROP, COLUMN)
.attribute(attribute);
try (Connection connection = getConnection()) {
executeSql(connection, qb);
} catch (SQLException e) {
throw new TableModificationException(e);
}
} | java | public <T> void dropColumn(Attribute<T, ?> attribute) {
Type<T> type = attribute.getDeclaringType();
if (attribute.isForeignKey()) {
// TODO MySQL need to drop FK constraint first
}
QueryBuilder qb = createQueryBuilder();
qb.keyword(ALTER, TABLE)
.tableName(type.getName())
.keyword(DROP, COLUMN)
.attribute(attribute);
try (Connection connection = getConnection()) {
executeSql(connection, qb);
} catch (SQLException e) {
throw new TableModificationException(e);
}
} | [
"public",
"<",
"T",
">",
"void",
"dropColumn",
"(",
"Attribute",
"<",
"T",
",",
"?",
">",
"attribute",
")",
"{",
"Type",
"<",
"T",
">",
"type",
"=",
"attribute",
".",
"getDeclaringType",
"(",
")",
";",
"if",
"(",
"attribute",
".",
"isForeignKey",
"("... | Alters the attribute's table and removes the column representing the given {@link Attribute}.
@param attribute being added
@param <T> parent type of the attribute
@throws TableModificationException if the removal fails. | [
"Alters",
"the",
"attribute",
"s",
"table",
"and",
"removes",
"the",
"column",
"representing",
"the",
"given",
"{",
"@link",
"Attribute",
"}",
"."
] | train | https://github.com/requery/requery/blob/3070590c2ef76bb7062570bf9df03cd482db024a/requery/src/main/java/io/requery/sql/SchemaModifier.java#L306-L321 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ServicesApi.java | ServicesApi.updateJiraService | public JiraService updateJiraService(Object projectIdOrPath, JiraService jira) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("merge_requests_events", jira.getMergeRequestsEvents())
.withParam("commit_events", jira.getCommitEvents())
.withParam("url", jira.getUrl(), true)
.withParam("api_url", jira.getApiUrl())
.withParam("project_key", jira.getProjectKey())
.withParam("username", jira.getUsername(), true)
.withParam("password", jira.getPassword(), true)
.withParam("jira_issue_transition_id", jira.getJiraIssueTransitionId());
Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "services", "jira");
return (response.readEntity(JiraService.class));
} | java | public JiraService updateJiraService(Object projectIdOrPath, JiraService jira) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("merge_requests_events", jira.getMergeRequestsEvents())
.withParam("commit_events", jira.getCommitEvents())
.withParam("url", jira.getUrl(), true)
.withParam("api_url", jira.getApiUrl())
.withParam("project_key", jira.getProjectKey())
.withParam("username", jira.getUsername(), true)
.withParam("password", jira.getPassword(), true)
.withParam("jira_issue_transition_id", jira.getJiraIssueTransitionId());
Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "services", "jira");
return (response.readEntity(JiraService.class));
} | [
"public",
"JiraService",
"updateJiraService",
"(",
"Object",
"projectIdOrPath",
",",
"JiraService",
"jira",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"merge_requests_events\"",
... | Updates the JIRA service settings for a project.
<pre><code>GitLab Endpoint: PUT /projects/:id/services/jira</code></pre>
The following properties on the JiraService instance are utilized in the update of the settings:
<p>
mergeRequestsEvents (optional) - Enable notifications for merge request events
commitEvents (optional) - Enable notifications for commit events
url (required) - The URL to the JIRA project which is being linked to this GitLab project, e.g., https://jira.example.com.
apiUrl (optional) - The JIRA API url if different than url
projectKey (optional) - The short identifier for your JIRA project, all uppercase, e.g., PROJ.
username (required) - The username of the user created to be used with GitLab/JIRA.
password (required) - The password of the user created to be used with GitLab/JIRA.
jiraIssueTransitionId (optional) - The ID of a transition that moves issues to a closed state.
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param jira the JiraService instance holding the settings
@return a JiraService instance holding the newly updated settings
@throws GitLabApiException if any exception occurs | [
"Updates",
"the",
"JIRA",
"service",
"settings",
"for",
"a",
"project",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ServicesApi.java#L290-L302 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java | ExpressRouteCrossConnectionsInner.createOrUpdate | public ExpressRouteCrossConnectionInner createOrUpdate(String resourceGroupName, String crossConnectionName, ExpressRouteCrossConnectionInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, parameters).toBlocking().last().body();
} | java | public ExpressRouteCrossConnectionInner createOrUpdate(String resourceGroupName, String crossConnectionName, ExpressRouteCrossConnectionInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, parameters).toBlocking().last().body();
} | [
"public",
"ExpressRouteCrossConnectionInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
",",
"ExpressRouteCrossConnectionInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Update the specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@param parameters Parameters supplied to the update express route crossConnection operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRouteCrossConnectionInner object if successful. | [
"Update",
"the",
"specified",
"ExpressRouteCrossConnection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L444-L446 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java | IslamicCalendar.monthStart | private long monthStart(int year, int month) {
// Normalize year/month in case month is outside the normal bounds, which may occur
// in the case of an add operation
int realYear = year + month / 12;
int realMonth = month % 12;
long ms = 0;
if (cType == CalculationType.ISLAMIC_CIVIL
|| cType == CalculationType.ISLAMIC_TBLA
|| (cType == CalculationType.ISLAMIC_UMALQURA && year < UMALQURA_YEAR_START )) {
ms = (long)Math.ceil(29.5*realMonth)
+ (realYear-1)*354 + (long)Math.floor((3+11*realYear)/30.0);
} else if(cType == CalculationType.ISLAMIC) {
ms = trueMonthStart(12*(realYear-1) + realMonth);
} else if(cType == CalculationType.ISLAMIC_UMALQURA) {
ms = yearStart(year);
for(int i=0; i< month; i++) {
ms+= handleGetMonthLength(year, i);
}
}
return ms;
} | java | private long monthStart(int year, int month) {
// Normalize year/month in case month is outside the normal bounds, which may occur
// in the case of an add operation
int realYear = year + month / 12;
int realMonth = month % 12;
long ms = 0;
if (cType == CalculationType.ISLAMIC_CIVIL
|| cType == CalculationType.ISLAMIC_TBLA
|| (cType == CalculationType.ISLAMIC_UMALQURA && year < UMALQURA_YEAR_START )) {
ms = (long)Math.ceil(29.5*realMonth)
+ (realYear-1)*354 + (long)Math.floor((3+11*realYear)/30.0);
} else if(cType == CalculationType.ISLAMIC) {
ms = trueMonthStart(12*(realYear-1) + realMonth);
} else if(cType == CalculationType.ISLAMIC_UMALQURA) {
ms = yearStart(year);
for(int i=0; i< month; i++) {
ms+= handleGetMonthLength(year, i);
}
}
return ms;
} | [
"private",
"long",
"monthStart",
"(",
"int",
"year",
",",
"int",
"month",
")",
"{",
"// Normalize year/month in case month is outside the normal bounds, which may occur",
"// in the case of an add operation",
"int",
"realYear",
"=",
"year",
"+",
"month",
"/",
"12",
";",
"... | Return the day # on which the given month starts. Days are counted
from the Hijri epoch, origin 0.
@param year The hijri year
@param month The hijri month, 0-based | [
"Return",
"the",
"day",
"#",
"on",
"which",
"the",
"given",
"month",
"starts",
".",
"Days",
"are",
"counted",
"from",
"the",
"Hijri",
"epoch",
"origin",
"0",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java#L585-L606 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java | JacksonDBCollection.findOneById | public T findOneById(K id, DBObject fields) throws MongoException {
return findOne(createIdQuery(id), fields);
} | java | public T findOneById(K id, DBObject fields) throws MongoException {
return findOne(createIdQuery(id), fields);
} | [
"public",
"T",
"findOneById",
"(",
"K",
"id",
",",
"DBObject",
"fields",
")",
"throws",
"MongoException",
"{",
"return",
"findOne",
"(",
"createIdQuery",
"(",
"id",
")",
",",
"fields",
")",
";",
"}"
] | Find an object by the given id
@param id The id
@return The object
@throws MongoException If an error occurred | [
"Find",
"an",
"object",
"by",
"the",
"given",
"id"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L858-L860 |
RestComm/jss7 | isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/util/BcdHelper.java | BcdHelper.bcdDecodeToHexString | public static String bcdDecodeToHexString(int encodingScheme, byte[] bcdBytes) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
for (byte b : bcdBytes) {
sb.append(bcdToHexString(encodingScheme, b));
}
if (GenericDigits._ENCODING_SCHEME_BCD_ODD == encodingScheme) {
sb.deleteCharAt(sb.length()-1);
}
return sb.toString();
} | java | public static String bcdDecodeToHexString(int encodingScheme, byte[] bcdBytes) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
for (byte b : bcdBytes) {
sb.append(bcdToHexString(encodingScheme, b));
}
if (GenericDigits._ENCODING_SCHEME_BCD_ODD == encodingScheme) {
sb.deleteCharAt(sb.length()-1);
}
return sb.toString();
} | [
"public",
"static",
"String",
"bcdDecodeToHexString",
"(",
"int",
"encodingScheme",
",",
"byte",
"[",
"]",
"bcdBytes",
")",
"throws",
"UnsupportedEncodingException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"byte",
"b",... | Decoded BCD encoded string into Hex digits string.
@param encodingScheme BCD endcoding scheme to be used
@param bcdBytes bytes table to decode.
@return hex string representation of BCD encoded digits | [
"Decoded",
"BCD",
"encoded",
"string",
"into",
"Hex",
"digits",
"string",
"."
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/util/BcdHelper.java#L160-L171 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java | ClusterManagerClient.completeIPRotation | public final Operation completeIPRotation(String projectId, String zone, String clusterId) {
CompleteIPRotationRequest request =
CompleteIPRotationRequest.newBuilder()
.setProjectId(projectId)
.setZone(zone)
.setClusterId(clusterId)
.build();
return completeIPRotation(request);
} | java | public final Operation completeIPRotation(String projectId, String zone, String clusterId) {
CompleteIPRotationRequest request =
CompleteIPRotationRequest.newBuilder()
.setProjectId(projectId)
.setZone(zone)
.setClusterId(clusterId)
.build();
return completeIPRotation(request);
} | [
"public",
"final",
"Operation",
"completeIPRotation",
"(",
"String",
"projectId",
",",
"String",
"zone",
",",
"String",
"clusterId",
")",
"{",
"CompleteIPRotationRequest",
"request",
"=",
"CompleteIPRotationRequest",
".",
"newBuilder",
"(",
")",
".",
"setProjectId",
... | Completes master IP rotation.
<p>Sample code:
<pre><code>
try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) {
String projectId = "";
String zone = "";
String clusterId = "";
Operation response = clusterManagerClient.completeIPRotation(projectId, zone, clusterId);
}
</code></pre>
@param projectId Deprecated. The Google Developers Console [project ID or project
number](https://developers.google.com/console/help/new/#projectnumber). This field has been
deprecated and replaced by the name field.
@param zone Deprecated. The name of the Google Compute Engine
[zone](/compute/docs/zones#available) in which the cluster resides. This field has been
deprecated and replaced by the name field.
@param clusterId Deprecated. The name of the cluster. This field has been deprecated and
replaced by the name field.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Completes",
"master",
"IP",
"rotation",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L2528-L2537 |
andrehertwig/admintool | admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java | ReflectUtils.invokeGetter | @SuppressWarnings("unchecked")
public static <S extends Serializable> S invokeGetter(Object object, Field field)
{
Method m = ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toGetter(field.getName()));
if (null == m) {
for (String prefix : PREFIXES) {
m = ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toGetter(field.getName(), prefix));
if (null != m) {
break;
}
}
}
return (S) ReflectionUtils.invokeMethod(m, object);
} | java | @SuppressWarnings("unchecked")
public static <S extends Serializable> S invokeGetter(Object object, Field field)
{
Method m = ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toGetter(field.getName()));
if (null == m) {
for (String prefix : PREFIXES) {
m = ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toGetter(field.getName(), prefix));
if (null != m) {
break;
}
}
}
return (S) ReflectionUtils.invokeMethod(m, object);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"S",
"extends",
"Serializable",
">",
"S",
"invokeGetter",
"(",
"Object",
"object",
",",
"Field",
"field",
")",
"{",
"Method",
"m",
"=",
"ReflectionUtils",
".",
"findMethod",
"(",
"o... | invokes the getter on the filed
@param object
@param field
@return | [
"invokes",
"the",
"getter",
"on",
"the",
"filed"
] | train | https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java#L130-L143 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataPng.java | CoverageDataPng.getPixelValue | public short getPixelValue(BufferedImage image, int x, int y) {
validateImageType(image);
WritableRaster raster = image.getRaster();
short pixelValue = getPixelValue(raster, x, y);
return pixelValue;
} | java | public short getPixelValue(BufferedImage image, int x, int y) {
validateImageType(image);
WritableRaster raster = image.getRaster();
short pixelValue = getPixelValue(raster, x, y);
return pixelValue;
} | [
"public",
"short",
"getPixelValue",
"(",
"BufferedImage",
"image",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"validateImageType",
"(",
"image",
")",
";",
"WritableRaster",
"raster",
"=",
"image",
".",
"getRaster",
"(",
")",
";",
"short",
"pixelValue",
"=... | Get the pixel value as an "unsigned short"
@param image
tile image
@param x
x coordinate
@param y
y coordinate
@return "unsigned short" pixel value | [
"Get",
"the",
"pixel",
"value",
"as",
"an",
"unsigned",
"short"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataPng.java#L118-L123 |
mesosphere/mesos-http-adapter | src/main/java/com/mesosphere/mesos/http-adapter/MesosToSchedulerDriverAdapter.java | MesosToSchedulerDriverAdapter.startInternal | @VisibleForTesting
protected Mesos startInternal() {
String version = System.getenv("MESOS_API_VERSION");
if (version == null) {
version = "V0";
}
LOGGER.info("Using Mesos API version: {}", version);
if (version.equals("V0")) {
if (credential == null) {
return new V0Mesos(this, frameworkInfo, master);
} else {
return new V0Mesos(this, frameworkInfo, master, credential);
}
} else if (version.equals("V1")) {
if (credential == null) {
return new V1Mesos(this, master);
} else {
return new V1Mesos(this, master, credential);
}
} else {
throw new IllegalArgumentException("Unsupported API version: " + version);
}
} | java | @VisibleForTesting
protected Mesos startInternal() {
String version = System.getenv("MESOS_API_VERSION");
if (version == null) {
version = "V0";
}
LOGGER.info("Using Mesos API version: {}", version);
if (version.equals("V0")) {
if (credential == null) {
return new V0Mesos(this, frameworkInfo, master);
} else {
return new V0Mesos(this, frameworkInfo, master, credential);
}
} else if (version.equals("V1")) {
if (credential == null) {
return new V1Mesos(this, master);
} else {
return new V1Mesos(this, master, credential);
}
} else {
throw new IllegalArgumentException("Unsupported API version: " + version);
}
} | [
"@",
"VisibleForTesting",
"protected",
"Mesos",
"startInternal",
"(",
")",
"{",
"String",
"version",
"=",
"System",
".",
"getenv",
"(",
"\"MESOS_API_VERSION\"",
")",
";",
"if",
"(",
"version",
"==",
"null",
")",
"{",
"version",
"=",
"\"V0\"",
";",
"}",
"LO... | Broken out into a separate function to allow testing with custom `Mesos` implementations. | [
"Broken",
"out",
"into",
"a",
"separate",
"function",
"to",
"allow",
"testing",
"with",
"custom",
"Mesos",
"implementations",
"."
] | train | https://github.com/mesosphere/mesos-http-adapter/blob/5965d467c86ce7a1092bda5624dd2da9b0776334/src/main/java/com/mesosphere/mesos/http-adapter/MesosToSchedulerDriverAdapter.java#L314-L338 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java | MapTileCollisionRendererModel.createFunctionDraw | public static ImageBuffer createFunctionDraw(CollisionFormula collision, int tw, int th)
{
final ImageBuffer buffer = Graphics.createImageBuffer(tw, th, ColorRgba.TRANSPARENT);
final Graphic g = buffer.createGraphic();
g.setColor(ColorRgba.PURPLE);
createFunctionDraw(g, collision, tw, th);
g.dispose();
return buffer;
} | java | public static ImageBuffer createFunctionDraw(CollisionFormula collision, int tw, int th)
{
final ImageBuffer buffer = Graphics.createImageBuffer(tw, th, ColorRgba.TRANSPARENT);
final Graphic g = buffer.createGraphic();
g.setColor(ColorRgba.PURPLE);
createFunctionDraw(g, collision, tw, th);
g.dispose();
return buffer;
} | [
"public",
"static",
"ImageBuffer",
"createFunctionDraw",
"(",
"CollisionFormula",
"collision",
",",
"int",
"tw",
",",
"int",
"th",
")",
"{",
"final",
"ImageBuffer",
"buffer",
"=",
"Graphics",
".",
"createImageBuffer",
"(",
"tw",
",",
"th",
",",
"ColorRgba",
".... | Create the function draw to buffer.
@param collision The collision reference.
@param tw The tile width.
@param th The tile height.
@return The created collision representation buffer. | [
"Create",
"the",
"function",
"draw",
"to",
"buffer",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java#L48-L58 |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/util/TextUtil.java | TextUtil.relativizePath | public static String relativizePath(String path, boolean withIndex)
{
if (path.startsWith("/"))
path = path.substring(1);
if (!withIndex && path.endsWith("]"))
{
int index = path.lastIndexOf('[');
return index == -1 ? path : path.substring(0, index);
}
return path;
} | java | public static String relativizePath(String path, boolean withIndex)
{
if (path.startsWith("/"))
path = path.substring(1);
if (!withIndex && path.endsWith("]"))
{
int index = path.lastIndexOf('[');
return index == -1 ? path : path.substring(0, index);
}
return path;
} | [
"public",
"static",
"String",
"relativizePath",
"(",
"String",
"path",
",",
"boolean",
"withIndex",
")",
"{",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"path",
"=",
"path",
".",
"substring",
"(",
"1",
")",
";",
"if",
"(",
"!",
"wi... | Creates relative path from string.
@param path path
@param withIndex indicates whether we should keep the index or not
@return relative path | [
"Creates",
"relative",
"path",
"from",
"string",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/util/TextUtil.java#L166-L177 |
m-m-m/util | xml/src/main/java/net/sf/mmm/util/xml/base/jaxb/XmlBeanMapper.java | XmlBeanMapper.saveXml | public void saveXml(T jaxbBean, OutputStream outputStream) {
try {
validate(jaxbBean);
getOrCreateMarshaller().marshal(jaxbBean, outputStream);
} catch (MarshalException e) {
throw new XmlInvalidException(e, jaxbBean);
} catch (JAXBException e) {
throw new IllegalStateException(e);
}
} | java | public void saveXml(T jaxbBean, OutputStream outputStream) {
try {
validate(jaxbBean);
getOrCreateMarshaller().marshal(jaxbBean, outputStream);
} catch (MarshalException e) {
throw new XmlInvalidException(e, jaxbBean);
} catch (JAXBException e) {
throw new IllegalStateException(e);
}
} | [
"public",
"void",
"saveXml",
"(",
"T",
"jaxbBean",
",",
"OutputStream",
"outputStream",
")",
"{",
"try",
"{",
"validate",
"(",
"jaxbBean",
")",
";",
"getOrCreateMarshaller",
"(",
")",
".",
"marshal",
"(",
"jaxbBean",
",",
"outputStream",
")",
";",
"}",
"ca... | This method saves the given {@code jaxbBean} as XML to the given {@code outputStream}. <br>
<b>ATTENTION:</b><br>
The caller of this method has to {@link OutputStream#close() close} the {@code outputStream}.
@param jaxbBean is the JAXB-bean to save as XML.
@param outputStream is the {@link OutputStream} where to write the XML to. | [
"This",
"method",
"saves",
"the",
"given",
"{",
"@code",
"jaxbBean",
"}",
"as",
"XML",
"to",
"the",
"given",
"{",
"@code",
"outputStream",
"}",
".",
"<br",
">",
"<b",
">",
"ATTENTION",
":",
"<",
"/",
"b",
">",
"<br",
">",
"The",
"caller",
"of",
"th... | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/xml/src/main/java/net/sf/mmm/util/xml/base/jaxb/XmlBeanMapper.java#L330-L340 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java | EmulatedFields.get | public double get(String name, double defaultValue) throws IllegalArgumentException {
ObjectSlot slot = findMandatorySlot(name, double.class);
return slot.defaulted ? defaultValue : ((Double) slot.fieldValue).doubleValue();
} | java | public double get(String name, double defaultValue) throws IllegalArgumentException {
ObjectSlot slot = findMandatorySlot(name, double.class);
return slot.defaulted ? defaultValue : ((Double) slot.fieldValue).doubleValue();
} | [
"public",
"double",
"get",
"(",
"String",
"name",
",",
"double",
"defaultValue",
")",
"throws",
"IllegalArgumentException",
"{",
"ObjectSlot",
"slot",
"=",
"findMandatorySlot",
"(",
"name",
",",
"double",
".",
"class",
")",
";",
"return",
"slot",
".",
"default... | Finds and returns the double 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",
"double",
"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#L248-L251 |
negusoft/holoaccent | HoloAccent/src/com/negusoft/holoaccent/util/BitmapUtils.java | BitmapUtils.applyColor | public static Bitmap applyColor(Bitmap bitmap, int accentColor) {
int r = Color.red(accentColor);
int g = Color.green(accentColor);
int b = Color.blue(accentColor);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
for (int i=0; i<pixels.length; i++) {
int color = pixels[i];
int alpha = Color.alpha(color);
pixels[i] = Color.argb(alpha, r, g, b);
}
return Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888);
} | java | public static Bitmap applyColor(Bitmap bitmap, int accentColor) {
int r = Color.red(accentColor);
int g = Color.green(accentColor);
int b = Color.blue(accentColor);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
for (int i=0; i<pixels.length; i++) {
int color = pixels[i];
int alpha = Color.alpha(color);
pixels[i] = Color.argb(alpha, r, g, b);
}
return Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888);
} | [
"public",
"static",
"Bitmap",
"applyColor",
"(",
"Bitmap",
"bitmap",
",",
"int",
"accentColor",
")",
"{",
"int",
"r",
"=",
"Color",
".",
"red",
"(",
"accentColor",
")",
";",
"int",
"g",
"=",
"Color",
".",
"green",
"(",
"accentColor",
")",
";",
"int",
... | Creates a copy of the bitmap by replacing the color of every pixel
by accentColor while keeping the alpha value.
@param bitmap The original bitmap.
@param accentColor The color to apply to every pixel.
@return A copy of the given bitmap with the accent color applied. | [
"Creates",
"a",
"copy",
"of",
"the",
"bitmap",
"by",
"replacing",
"the",
"color",
"of",
"every",
"pixel",
"by",
"accentColor",
"while",
"keeping",
"the",
"alpha",
"value",
"."
] | train | https://github.com/negusoft/holoaccent/blob/7121a02dde94834e770cb81174d0bdc596323324/HoloAccent/src/com/negusoft/holoaccent/util/BitmapUtils.java#L53-L69 |
JodaOrg/joda-time | src/main/java/org/joda/time/field/DividedDateTimeField.java | DividedDateTimeField.addWrapField | public long addWrapField(long instant, int amount) {
return set(instant, FieldUtils.getWrappedValue(get(instant), amount, iMin, iMax));
} | java | public long addWrapField(long instant, int amount) {
return set(instant, FieldUtils.getWrappedValue(get(instant), amount, iMin, iMax));
} | [
"public",
"long",
"addWrapField",
"(",
"long",
"instant",
",",
"int",
"amount",
")",
"{",
"return",
"set",
"(",
"instant",
",",
"FieldUtils",
".",
"getWrappedValue",
"(",
"get",
"(",
"instant",
")",
",",
"amount",
",",
"iMin",
",",
"iMax",
")",
")",
";... | Add to the scaled component of the specified time instant,
wrapping around within that component if necessary.
@param instant the time instant in millis to update.
@param amount the amount of scaled units to add (can be negative).
@return the updated time instant. | [
"Add",
"to",
"the",
"scaled",
"component",
"of",
"the",
"specified",
"time",
"instant",
"wrapping",
"around",
"within",
"that",
"component",
"if",
"necessary",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/DividedDateTimeField.java#L181-L183 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java | UtilImageIO.loadPGM | public static BufferedImage loadPGM( String fileName , BufferedImage storage ) throws IOException {
return loadPGM(new FileInputStream(fileName), storage);
} | java | public static BufferedImage loadPGM( String fileName , BufferedImage storage ) throws IOException {
return loadPGM(new FileInputStream(fileName), storage);
} | [
"public",
"static",
"BufferedImage",
"loadPGM",
"(",
"String",
"fileName",
",",
"BufferedImage",
"storage",
")",
"throws",
"IOException",
"{",
"return",
"loadPGM",
"(",
"new",
"FileInputStream",
"(",
"fileName",
")",
",",
"storage",
")",
";",
"}"
] | Loads a PGM image from a file.
@param fileName Location of PGM image
@param storage (Optional) Storage for output image. Must be the width and height of the image being read.
Better performance of type BufferedImage.TYPE_BYTE_GRAY. If null or width/height incorrect a new image
will be declared.
@return The image
@throws IOException Thrown if there is a problem reading the image | [
"Loads",
"a",
"PGM",
"image",
"from",
"a",
"file",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/UtilImageIO.java#L217-L219 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java | FileSystemView.checkNotAncestor | private void checkNotAncestor(File source, Directory destParent, FileSystemView destView)
throws IOException {
// if dest is not in the same file system, it couldn't be in source's subdirectories
if (!isSameFileSystem(destView)) {
return;
}
Directory current = destParent;
while (true) {
if (current.equals(source)) {
throw new IOException(
"invalid argument: can't move directory into a subdirectory of itself");
}
if (current.isRootDirectory()) {
return;
} else {
current = current.parent();
}
}
} | java | private void checkNotAncestor(File source, Directory destParent, FileSystemView destView)
throws IOException {
// if dest is not in the same file system, it couldn't be in source's subdirectories
if (!isSameFileSystem(destView)) {
return;
}
Directory current = destParent;
while (true) {
if (current.equals(source)) {
throw new IOException(
"invalid argument: can't move directory into a subdirectory of itself");
}
if (current.isRootDirectory()) {
return;
} else {
current = current.parent();
}
}
} | [
"private",
"void",
"checkNotAncestor",
"(",
"File",
"source",
",",
"Directory",
"destParent",
",",
"FileSystemView",
"destView",
")",
"throws",
"IOException",
"{",
"// if dest is not in the same file system, it couldn't be in source's subdirectories",
"if",
"(",
"!",
"isSameF... | Checks that source is not an ancestor of dest, throwing an exception if it is. | [
"Checks",
"that",
"source",
"is",
"not",
"an",
"ancestor",
"of",
"dest",
"throwing",
"an",
"exception",
"if",
"it",
"is",
"."
] | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L640-L660 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java | VirtualNetworkGatewayConnectionsInner.resetSharedKeyAsync | public Observable<ConnectionResetSharedKeyInner> resetSharedKeyAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) {
return resetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, keyLength).map(new Func1<ServiceResponse<ConnectionResetSharedKeyInner>, ConnectionResetSharedKeyInner>() {
@Override
public ConnectionResetSharedKeyInner call(ServiceResponse<ConnectionResetSharedKeyInner> response) {
return response.body();
}
});
} | java | public Observable<ConnectionResetSharedKeyInner> resetSharedKeyAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) {
return resetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, keyLength).map(new Func1<ServiceResponse<ConnectionResetSharedKeyInner>, ConnectionResetSharedKeyInner>() {
@Override
public ConnectionResetSharedKeyInner call(ServiceResponse<ConnectionResetSharedKeyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ConnectionResetSharedKeyInner",
">",
"resetSharedKeyAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayConnectionName",
",",
"int",
"keyLength",
")",
"{",
"return",
"resetSharedKeyWithServiceResponseAsync",
"(",
"res... | The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayConnectionName The virtual network gateway connection reset shared key Name.
@param keyLength The virtual network connection reset shared key length, should between 1 and 128.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"The",
"VirtualNetworkGatewayConnectionResetSharedKey",
"operation",
"resets",
"the",
"virtual",
"network",
"gateway",
"connection",
"shared",
"key",
"for",
"passed",
"virtual",
"network",
"gateway",
"connection",
"in",
"the",
"specified",
"resource",
"group",
"through",
... | 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/VirtualNetworkGatewayConnectionsInner.java#L1250-L1257 |
jbundle/jbundle | thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellButton.java | JCellButton.init | public void init(Icon icon, String text)
{
this.setText(text);
this.setIcon(icon);
this.setMargin(JScreenConstants.NO_INSETS);
} | java | public void init(Icon icon, String text)
{
this.setText(text);
this.setIcon(icon);
this.setMargin(JScreenConstants.NO_INSETS);
} | [
"public",
"void",
"init",
"(",
"Icon",
"icon",
",",
"String",
"text",
")",
"{",
"this",
".",
"setText",
"(",
"text",
")",
";",
"this",
".",
"setIcon",
"(",
"icon",
")",
";",
"this",
".",
"setMargin",
"(",
"JScreenConstants",
".",
"NO_INSETS",
")",
";... | Creates new JCellButton. The icon and text are reversed, because of a conflicting method in JButton.
@param text the button text.
@param icon The button icon. | [
"Creates",
"new",
"JCellButton",
".",
"The",
"icon",
"and",
"text",
"are",
"reversed",
"because",
"of",
"a",
"conflicting",
"method",
"in",
"JButton",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellButton.java#L82-L87 |
redkale/redkale | src/org/redkale/net/http/HttpRequest.java | HttpRequest.getRequstURIPath | public short getRequstURIPath(String prefix, short defvalue) {
String val = getRequstURIPath(prefix, null);
try {
return val == null ? defvalue : Short.parseShort(val);
} catch (NumberFormatException e) {
return defvalue;
}
} | java | public short getRequstURIPath(String prefix, short defvalue) {
String val = getRequstURIPath(prefix, null);
try {
return val == null ? defvalue : Short.parseShort(val);
} catch (NumberFormatException e) {
return defvalue;
}
} | [
"public",
"short",
"getRequstURIPath",
"(",
"String",
"prefix",
",",
"short",
"defvalue",
")",
"{",
"String",
"val",
"=",
"getRequstURIPath",
"(",
"prefix",
",",
"null",
")",
";",
"try",
"{",
"return",
"val",
"==",
"null",
"?",
"defvalue",
":",
"Short",
... | 获取请求URL分段中含prefix段的short值 <br>
例如请求URL /pipes/record/query/type:10 <br>
获取type参数: short type = request.getRequstURIPath("type:", (short)0);
@param prefix prefix段前缀
@param defvalue 默认short值
@return short值 | [
"获取请求URL分段中含prefix段的short值",
"<br",
">",
"例如请求URL",
"/",
"pipes",
"/",
"record",
"/",
"query",
"/",
"type",
":",
"10",
"<br",
">",
"获取type参数",
":",
"short",
"type",
"=",
"request",
".",
"getRequstURIPath",
"(",
"type",
":",
"(",
"short",
")",
"0",
")",
... | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L817-L824 |
urish/gwt-titanium | src/main/java/org/urish/gwtit/client/util/Timers.java | Timers.setInterval | public static Timer setInterval(int milliseconds, TimerCallback callback) {
IntervalTimer interval = new IntervalTimer();
interval.setId(nativeSetInterval(milliseconds, callback, interval));
return interval;
} | java | public static Timer setInterval(int milliseconds, TimerCallback callback) {
IntervalTimer interval = new IntervalTimer();
interval.setId(nativeSetInterval(milliseconds, callback, interval));
return interval;
} | [
"public",
"static",
"Timer",
"setInterval",
"(",
"int",
"milliseconds",
",",
"TimerCallback",
"callback",
")",
"{",
"IntervalTimer",
"interval",
"=",
"new",
"IntervalTimer",
"(",
")",
";",
"interval",
".",
"setId",
"(",
"nativeSetInterval",
"(",
"milliseconds",
... | Defines a repeating timer with a specified interval.
@param milliseconds Interval between timer shots.
@param callback Callback to fire on each timer shot.
@return The new interval object | [
"Defines",
"a",
"repeating",
"timer",
"with",
"a",
"specified",
"interval",
"."
] | train | https://github.com/urish/gwt-titanium/blob/5b53a312093a84f235366932430f02006a570612/src/main/java/org/urish/gwtit/client/util/Timers.java#L127-L131 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/Tesseract1.java | Tesseract1.doOCR | @Override
public String doOCR(BufferedImage bi, Rectangle rect) throws TesseractException {
try {
return doOCR(ImageIOHelper.getIIOImageList(bi), rect);
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new TesseractException(e);
}
} | java | @Override
public String doOCR(BufferedImage bi, Rectangle rect) throws TesseractException {
try {
return doOCR(ImageIOHelper.getIIOImageList(bi), rect);
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new TesseractException(e);
}
} | [
"@",
"Override",
"public",
"String",
"doOCR",
"(",
"BufferedImage",
"bi",
",",
"Rectangle",
"rect",
")",
"throws",
"TesseractException",
"{",
"try",
"{",
"return",
"doOCR",
"(",
"ImageIOHelper",
".",
"getIIOImageList",
"(",
"bi",
")",
",",
"rect",
")",
";",
... | Performs OCR operation.
@param bi a buffered image
@param rect the bounding rectangle defines the region of the image to be
recognized. A rectangle of zero dimension or <code>null</code> indicates
the whole image.
@return the recognized text
@throws TesseractException | [
"Performs",
"OCR",
"operation",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/Tesseract1.java#L253-L261 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/ADMMessage.java | ADMMessage.withData | public ADMMessage withData(java.util.Map<String, String> data) {
setData(data);
return this;
} | java | public ADMMessage withData(java.util.Map<String, String> data) {
setData(data);
return this;
} | [
"public",
"ADMMessage",
"withData",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"{",
"setData",
"(",
"data",
")",
";",
"return",
"this",
";",
"}"
] | The data payload used for a silent push. This payload is added to the notifications' data.pinpoint.jsonBody'
object
@param data
The data payload used for a silent push. This payload is added to the notifications'
data.pinpoint.jsonBody' object
@return Returns a reference to this object so that method calls can be chained together. | [
"The",
"data",
"payload",
"used",
"for",
"a",
"silent",
"push",
".",
"This",
"payload",
"is",
"added",
"to",
"the",
"notifications",
"data",
".",
"pinpoint",
".",
"jsonBody",
"object"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/ADMMessage.java#L275-L278 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/theta/DirectQuickSelectSketchR.java | DirectQuickSelectSketchR.setHashTableThreshold | static final int setHashTableThreshold(final int lgNomLongs, final int lgArrLongs) {
//FindBugs may complain if DQS_RESIZE_THRESHOLD == REBUILD_THRESHOLD, but this allows us
// to tune these constants for different sketches.
final double fraction = (lgArrLongs <= lgNomLongs) ? DQS_RESIZE_THRESHOLD : REBUILD_THRESHOLD;
return (int) Math.floor(fraction * (1 << lgArrLongs));
} | java | static final int setHashTableThreshold(final int lgNomLongs, final int lgArrLongs) {
//FindBugs may complain if DQS_RESIZE_THRESHOLD == REBUILD_THRESHOLD, but this allows us
// to tune these constants for different sketches.
final double fraction = (lgArrLongs <= lgNomLongs) ? DQS_RESIZE_THRESHOLD : REBUILD_THRESHOLD;
return (int) Math.floor(fraction * (1 << lgArrLongs));
} | [
"static",
"final",
"int",
"setHashTableThreshold",
"(",
"final",
"int",
"lgNomLongs",
",",
"final",
"int",
"lgArrLongs",
")",
"{",
"//FindBugs may complain if DQS_RESIZE_THRESHOLD == REBUILD_THRESHOLD, but this allows us",
"// to tune these constants for different sketches.",
"final"... | Returns the cardinality limit given the current size of the hash table array.
@param lgNomLongs <a href="{@docRoot}/resources/dictionary.html#lgNomLongs">See lgNomLongs</a>.
@param lgArrLongs <a href="{@docRoot}/resources/dictionary.html#lgArrLongs">See lgArrLongs</a>.
@return the hash table threshold | [
"Returns",
"the",
"cardinality",
"limit",
"given",
"the",
"current",
"size",
"of",
"the",
"hash",
"table",
"array",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/DirectQuickSelectSketchR.java#L252-L257 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/util/automount/Automounter.java | Automounter.addHandle | public static boolean addHandle(VirtualFile owner, Closeable handle) {
RegistryEntry entry = getEntry(owner);
return entry.handles.add(handle);
} | java | public static boolean addHandle(VirtualFile owner, Closeable handle) {
RegistryEntry entry = getEntry(owner);
return entry.handles.add(handle);
} | [
"public",
"static",
"boolean",
"addHandle",
"(",
"VirtualFile",
"owner",
",",
"Closeable",
"handle",
")",
"{",
"RegistryEntry",
"entry",
"=",
"getEntry",
"(",
"owner",
")",
";",
"return",
"entry",
".",
"handles",
".",
"add",
"(",
"handle",
")",
";",
"}"
] | Add handle to owner, to be auto closed.
@param owner the handle owner
@param handle the handle
@return add result | [
"Add",
"handle",
"to",
"owner",
"to",
"be",
"auto",
"closed",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/automount/Automounter.java#L134-L137 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonServiceDocumentWriter.java | JsonServiceDocumentWriter.writeObject | private void writeObject(JsonGenerator jsonGenerator, Object entity) throws IOException {
jsonGenerator.writeStartObject();
writeName(jsonGenerator, entity);
writeKind(jsonGenerator, entity);
writeURL(jsonGenerator, entity);
jsonGenerator.writeEndObject();
} | java | private void writeObject(JsonGenerator jsonGenerator, Object entity) throws IOException {
jsonGenerator.writeStartObject();
writeName(jsonGenerator, entity);
writeKind(jsonGenerator, entity);
writeURL(jsonGenerator, entity);
jsonGenerator.writeEndObject();
} | [
"private",
"void",
"writeObject",
"(",
"JsonGenerator",
"jsonGenerator",
",",
"Object",
"entity",
")",
"throws",
"IOException",
"{",
"jsonGenerator",
".",
"writeStartObject",
"(",
")",
";",
"writeName",
"(",
"jsonGenerator",
",",
"entity",
")",
";",
"writeKind",
... | Build an embedded json object that will have key-value attributes like
'name' and 'url' (they are MUST), 'title' and 'kind'.
@param jsonGenerator jsonGenerator
@param entity entitySet or singleton
@throws IOException | [
"Build",
"an",
"embedded",
"json",
"object",
"that",
"will",
"have",
"key",
"-",
"value",
"attributes",
"like",
"name",
"and",
"url",
"(",
"they",
"are",
"MUST",
")",
"title",
"and",
"kind",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonServiceDocumentWriter.java#L106-L114 |
lessthanoptimal/ddogleg | src/org/ddogleg/optimization/trustregion/TrustRegionUpdateDogleg_F64.java | TrustRegionUpdateDogleg_F64.fractionCauchyToGN | static double fractionCauchyToGN(double lengthCauchy , double lengthGN , double lengthPtoGN, double region ) {
// First triangle has 3 known sides
double a=lengthGN,b=lengthCauchy,c=lengthPtoGN;
// Law of cosine to find angle for side GN (a.k.a 'a')
double cosineA = (a*a - b*b - c*c)/(-2.0*b*c);
double angleA = Math.acos(cosineA);
// In the second triangle, that is now being considered, lengthP is known and the side which intersects
// the region boundary is known, but we need to solve for the length from P to the intersection
// with the boundary
a=region;
double angleB = Math.asin((b/a)*Math.sin(angleA));
double angleC = Math.PI-angleA-angleB;
c = Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(angleC));
return c/lengthPtoGN;
} | java | static double fractionCauchyToGN(double lengthCauchy , double lengthGN , double lengthPtoGN, double region ) {
// First triangle has 3 known sides
double a=lengthGN,b=lengthCauchy,c=lengthPtoGN;
// Law of cosine to find angle for side GN (a.k.a 'a')
double cosineA = (a*a - b*b - c*c)/(-2.0*b*c);
double angleA = Math.acos(cosineA);
// In the second triangle, that is now being considered, lengthP is known and the side which intersects
// the region boundary is known, but we need to solve for the length from P to the intersection
// with the boundary
a=region;
double angleB = Math.asin((b/a)*Math.sin(angleA));
double angleC = Math.PI-angleA-angleB;
c = Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(angleC));
return c/lengthPtoGN;
} | [
"static",
"double",
"fractionCauchyToGN",
"(",
"double",
"lengthCauchy",
",",
"double",
"lengthGN",
",",
"double",
"lengthPtoGN",
",",
"double",
"region",
")",
"{",
"// First triangle has 3 known sides",
"double",
"a",
"=",
"lengthGN",
",",
"b",
"=",
"lengthCauchy",... | Compute the fractional distance from P to GN where the point intersects the region's boundary | [
"Compute",
"the",
"fractional",
"distance",
"from",
"P",
"to",
"GN",
"where",
"the",
"point",
"intersects",
"the",
"region",
"s",
"boundary"
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/trustregion/TrustRegionUpdateDogleg_F64.java#L207-L225 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/modules/calls/peers/PeerConnectionInt.java | PeerConnectionInt.onCandidate | public void onCandidate(long sessionId, int index, String id, String sdp) {
send(new PeerConnectionActor.OnCandidate(sessionId, index, id, sdp));
} | java | public void onCandidate(long sessionId, int index, String id, String sdp) {
send(new PeerConnectionActor.OnCandidate(sessionId, index, id, sdp));
} | [
"public",
"void",
"onCandidate",
"(",
"long",
"sessionId",
",",
"int",
"index",
",",
"String",
"id",
",",
"String",
"sdp",
")",
"{",
"send",
"(",
"new",
"PeerConnectionActor",
".",
"OnCandidate",
"(",
"sessionId",
",",
"index",
",",
"id",
",",
"sdp",
")"... | Call this method when new candidate arrived from other peer
@param index index of media in sdp
@param id id of candidate
@param sdp sdp of candidate | [
"Call",
"this",
"method",
"when",
"new",
"candidate",
"arrived",
"from",
"other",
"peer"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/modules/calls/peers/PeerConnectionInt.java#L104-L106 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/color/ColorXyz.java | ColorXyz.xyzToSrgb | public static void xyzToSrgb( float x , float y , float z , float srgb[] ) {
srgb[0] = 3.240479f*x - 1.53715f*y - 0.498535f*z;
srgb[1] = -0.969256f*x + 1.875991f*y + 0.041556f*z;
srgb[2] = 0.055648f*x - 0.204043f*y + 1.057311f*z;
} | java | public static void xyzToSrgb( float x , float y , float z , float srgb[] ) {
srgb[0] = 3.240479f*x - 1.53715f*y - 0.498535f*z;
srgb[1] = -0.969256f*x + 1.875991f*y + 0.041556f*z;
srgb[2] = 0.055648f*x - 0.204043f*y + 1.057311f*z;
} | [
"public",
"static",
"void",
"xyzToSrgb",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
",",
"float",
"srgb",
"[",
"]",
")",
"{",
"srgb",
"[",
"0",
"]",
"=",
"3.240479f",
"*",
"x",
"-",
"1.53715f",
"*",
"y",
"-",
"0.498535f",
"*",
"z",
... | Conversion from normalized RGB into XYZ. Normalized RGB values have a range of 0:1 | [
"Conversion",
"from",
"normalized",
"RGB",
"into",
"XYZ",
".",
"Normalized",
"RGB",
"values",
"have",
"a",
"range",
"of",
"0",
":",
"1"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/color/ColorXyz.java#L88-L92 |
drewwills/cernunnos | cernunnos-core/src/main/java/org/danann/cernunnos/xml/NodeProcessor.java | NodeProcessor.applyNamespace | public static void applyNamespace(Namespace nsp, Element e) {
// Assertions...
if (nsp == null) {
String msg = "Argument 'nsp' cannot be null.";
throw new IllegalArgumentException(msg);
}
if (e == null) {
String msg = "Argument 'e [Element]' cannot be null.";
throw new IllegalArgumentException(msg);
}
if (e.getNamespace().equals(Namespace.NO_NAMESPACE)) {
e.setQName(new QName(e.getName(), nsp));
for (Object n : e.elements()) {
applyNamespace(nsp, (Element) n);
}
}
} | java | public static void applyNamespace(Namespace nsp, Element e) {
// Assertions...
if (nsp == null) {
String msg = "Argument 'nsp' cannot be null.";
throw new IllegalArgumentException(msg);
}
if (e == null) {
String msg = "Argument 'e [Element]' cannot be null.";
throw new IllegalArgumentException(msg);
}
if (e.getNamespace().equals(Namespace.NO_NAMESPACE)) {
e.setQName(new QName(e.getName(), nsp));
for (Object n : e.elements()) {
applyNamespace(nsp, (Element) n);
}
}
} | [
"public",
"static",
"void",
"applyNamespace",
"(",
"Namespace",
"nsp",
",",
"Element",
"e",
")",
"{",
"// Assertions...",
"if",
"(",
"nsp",
"==",
"null",
")",
"{",
"String",
"msg",
"=",
"\"Argument 'nsp' cannot be null.\"",
";",
"throw",
"new",
"IllegalArgumentE... | Recursively applies the specified <code>Namespace</code> to the specified
<code>Element</code>, unless the <code>Element</code> (or any child
<code>Element</code>) already specifies a <code>Namespace</code>.
@param nsp Namespace to apply.
@param e XML structure upon which to apply the Namespace. | [
"Recursively",
"applies",
"the",
"specified",
"<code",
">",
"Namespace<",
"/",
"code",
">",
"to",
"the",
"specified",
"<code",
">",
"Element<",
"/",
"code",
">",
"unless",
"the",
"<code",
">",
"Element<",
"/",
"code",
">",
"(",
"or",
"any",
"child",
"<co... | train | https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/xml/NodeProcessor.java#L86-L105 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java | ServiceEndpointPolicyDefinitionsInner.createOrUpdateAsync | public Observable<ServiceEndpointPolicyDefinitionInner> createOrUpdateAsync(String resourceGroupName, String serviceEndpointPolicyName, String serviceEndpointPolicyDefinitionName, ServiceEndpointPolicyDefinitionInner serviceEndpointPolicyDefinitions) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, serviceEndpointPolicyDefinitions).map(new Func1<ServiceResponse<ServiceEndpointPolicyDefinitionInner>, ServiceEndpointPolicyDefinitionInner>() {
@Override
public ServiceEndpointPolicyDefinitionInner call(ServiceResponse<ServiceEndpointPolicyDefinitionInner> response) {
return response.body();
}
});
} | java | public Observable<ServiceEndpointPolicyDefinitionInner> createOrUpdateAsync(String resourceGroupName, String serviceEndpointPolicyName, String serviceEndpointPolicyDefinitionName, ServiceEndpointPolicyDefinitionInner serviceEndpointPolicyDefinitions) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, serviceEndpointPolicyDefinitions).map(new Func1<ServiceResponse<ServiceEndpointPolicyDefinitionInner>, ServiceEndpointPolicyDefinitionInner>() {
@Override
public ServiceEndpointPolicyDefinitionInner call(ServiceResponse<ServiceEndpointPolicyDefinitionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServiceEndpointPolicyDefinitionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serviceEndpointPolicyName",
",",
"String",
"serviceEndpointPolicyDefinitionName",
",",
"ServiceEndpointPolicyDefinitionInner",
"servi... | Creates or updates a service endpoint policy definition in the specified service endpoint policy.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy.
@param serviceEndpointPolicyDefinitionName The name of the service endpoint policy definition name.
@param serviceEndpointPolicyDefinitions Parameters supplied to the create or update service endpoint policy operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"service",
"endpoint",
"policy",
"definition",
"in",
"the",
"specified",
"service",
"endpoint",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java#L391-L398 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/lang/MessageResolver.java | MessageResolver.getMessage | public String getMessage(final MSLocale formatLocale, Locale runtimeLocale, final String key) {
if(formatLocale != null) {
return getMessage(formatLocale, key);
} else {
return getMessage(runtimeLocale, key);
}
} | java | public String getMessage(final MSLocale formatLocale, Locale runtimeLocale, final String key) {
if(formatLocale != null) {
return getMessage(formatLocale, key);
} else {
return getMessage(runtimeLocale, key);
}
} | [
"public",
"String",
"getMessage",
"(",
"final",
"MSLocale",
"formatLocale",
",",
"Locale",
"runtimeLocale",
",",
"final",
"String",
"key",
")",
"{",
"if",
"(",
"formatLocale",
"!=",
"null",
")",
"{",
"return",
"getMessage",
"(",
"formatLocale",
",",
"key",
"... | 書式のロケールを優先して、キーに対するメッセージを取得する。
formatLocaleがnullのとき、runtimeLocaleから値を取得する。
@since 0.10
@param formatLocale 書式に指定されているロケール。nullの場合がある。
@param runtimeLocale 実行時のロケール。
@param key メッセージキー
@return 該当するロケールのメッセージが見つからない場合は、デフォルトのリソースから取得する。 | [
"書式のロケールを優先して、キーに対するメッセージを取得する。",
"formatLocaleがnullのとき、runtimeLocaleから値を取得する。"
] | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/lang/MessageResolver.java#L338-L346 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.importCertificateAsync | public Observable<CertificateBundle> importCertificateAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate) {
return importCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate).map(new Func1<ServiceResponse<CertificateBundle>, CertificateBundle>() {
@Override
public CertificateBundle call(ServiceResponse<CertificateBundle> response) {
return response.body();
}
});
} | java | public Observable<CertificateBundle> importCertificateAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate) {
return importCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate).map(new Func1<ServiceResponse<CertificateBundle>, CertificateBundle>() {
@Override
public CertificateBundle call(ServiceResponse<CertificateBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CertificateBundle",
">",
"importCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"String",
"base64EncodedCertificate",
")",
"{",
"return",
"importCertificateWithServiceResponseAsync",
"(",
"vaultBaseUrl",
... | Imports a certificate into a specified key vault.
Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate.
@param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CertificateBundle object | [
"Imports",
"a",
"certificate",
"into",
"a",
"specified",
"key",
"vault",
".",
"Imports",
"an",
"existing",
"valid",
"certificate",
"containing",
"a",
"private",
"key",
"into",
"Azure",
"Key",
"Vault",
".",
"The",
"certificate",
"to",
"be",
"imported",
"can",
... | 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#L6713-L6720 |
joinfaces/joinfaces | joinfaces-tools/joinfaces-scan-tools/src/main/java/org/joinfaces/tools/ScanResultHandler.java | ScanResultHandler.writeClassList | protected void writeClassList(File file, Collection<String> classNames) throws IOException {
File baseDir = file.getParentFile();
if (baseDir.isDirectory() || baseDir.mkdirs()) {
Files.write(file.toPath(), classNames, StandardCharsets.UTF_8);
}
else {
throw new IOException(baseDir + " does not exist and could not be created");
}
} | java | protected void writeClassList(File file, Collection<String> classNames) throws IOException {
File baseDir = file.getParentFile();
if (baseDir.isDirectory() || baseDir.mkdirs()) {
Files.write(file.toPath(), classNames, StandardCharsets.UTF_8);
}
else {
throw new IOException(baseDir + " does not exist and could not be created");
}
} | [
"protected",
"void",
"writeClassList",
"(",
"File",
"file",
",",
"Collection",
"<",
"String",
">",
"classNames",
")",
"throws",
"IOException",
"{",
"File",
"baseDir",
"=",
"file",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"baseDir",
".",
"isDirectory",... | Helper method which writes a list of class names to the given file.
@param file The target file in which the class names should be written.
@param classNames The class names which should be written in the target file.
@throws IOException when the class names could not be written to the target file. | [
"Helper",
"method",
"which",
"writes",
"a",
"list",
"of",
"class",
"names",
"to",
"the",
"given",
"file",
"."
] | train | https://github.com/joinfaces/joinfaces/blob/c9fc811a9eaf695820951f2c04715297dd1e6d66/joinfaces-tools/joinfaces-scan-tools/src/main/java/org/joinfaces/tools/ScanResultHandler.java#L58-L67 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/FleetsApi.java | FleetsApi.postFleetsFleetIdWings | public FleetWingCreatedResponse postFleetsFleetIdWings(Long fleetId, String datasource, String token)
throws ApiException {
ApiResponse<FleetWingCreatedResponse> resp = postFleetsFleetIdWingsWithHttpInfo(fleetId, datasource, token);
return resp.getData();
} | java | public FleetWingCreatedResponse postFleetsFleetIdWings(Long fleetId, String datasource, String token)
throws ApiException {
ApiResponse<FleetWingCreatedResponse> resp = postFleetsFleetIdWingsWithHttpInfo(fleetId, datasource, token);
return resp.getData();
} | [
"public",
"FleetWingCreatedResponse",
"postFleetsFleetIdWings",
"(",
"Long",
"fleetId",
",",
"String",
"datasource",
",",
"String",
"token",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"FleetWingCreatedResponse",
">",
"resp",
"=",
"postFleetsFleetIdWingsWithHt... | Create fleet wing Create a new wing in a fleet --- SSO Scope:
esi-fleets.write_fleet.v1
@param fleetId
ID for a fleet (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param token
Access token to use if unable to set a header (optional)
@return FleetWingCreatedResponse
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Create",
"fleet",
"wing",
"Create",
"a",
"new",
"wing",
"in",
"a",
"fleet",
"---",
"SSO",
"Scope",
":",
"esi",
"-",
"fleets",
".",
"write_fleet",
".",
"v1"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/FleetsApi.java#L1479-L1483 |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/repository/ResourceRepositoryBase.java | ResourceRepositoryBase.findOne | @Override
public T findOne(I id, QuerySpec querySpec) {
RegistryEntry entry = resourceRegistry.findEntry(resourceClass);
String idName = entry.getResourceInformation().getIdField().getUnderlyingName();
QuerySpec idQuerySpec = querySpec.duplicate();
idQuerySpec.addFilter(new FilterSpec(Arrays.asList(idName), FilterOperator.EQ, id));
Iterable<T> iterable = findAll(idQuerySpec);
Iterator<T> iterator = iterable.iterator();
if (iterator.hasNext()) {
T resource = iterator.next();
PreconditionUtil.assertFalse("expected unique result", iterator.hasNext());
return resource;
} else {
throw new ResourceNotFoundException("resource not found");
}
} | java | @Override
public T findOne(I id, QuerySpec querySpec) {
RegistryEntry entry = resourceRegistry.findEntry(resourceClass);
String idName = entry.getResourceInformation().getIdField().getUnderlyingName();
QuerySpec idQuerySpec = querySpec.duplicate();
idQuerySpec.addFilter(new FilterSpec(Arrays.asList(idName), FilterOperator.EQ, id));
Iterable<T> iterable = findAll(idQuerySpec);
Iterator<T> iterator = iterable.iterator();
if (iterator.hasNext()) {
T resource = iterator.next();
PreconditionUtil.assertFalse("expected unique result", iterator.hasNext());
return resource;
} else {
throw new ResourceNotFoundException("resource not found");
}
} | [
"@",
"Override",
"public",
"T",
"findOne",
"(",
"I",
"id",
",",
"QuerySpec",
"querySpec",
")",
"{",
"RegistryEntry",
"entry",
"=",
"resourceRegistry",
".",
"findEntry",
"(",
"resourceClass",
")",
";",
"String",
"idName",
"=",
"entry",
".",
"getResourceInformat... | Forwards to {@link #findAll(QuerySpec)}
@param id
of the resource
@param querySpec
for field and relation inclusion
@return resource | [
"Forwards",
"to",
"{",
"@link",
"#findAll",
"(",
"QuerySpec",
")",
"}"
] | train | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/repository/ResourceRepositoryBase.java#L56-L72 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionComputer.java | MapTileCollisionComputer.getCollisionY | private static Double getCollisionY(CollisionCategory category, TileCollision tileCollision, double x, double y)
{
if (Axis.Y == category.getAxis())
{
return tileCollision.getCollisionY(category, x, y);
}
return null;
} | java | private static Double getCollisionY(CollisionCategory category, TileCollision tileCollision, double x, double y)
{
if (Axis.Y == category.getAxis())
{
return tileCollision.getCollisionY(category, x, y);
}
return null;
} | [
"private",
"static",
"Double",
"getCollisionY",
"(",
"CollisionCategory",
"category",
",",
"TileCollision",
"tileCollision",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"if",
"(",
"Axis",
".",
"Y",
"==",
"category",
".",
"getAxis",
"(",
")",
")",
"{"... | Get the vertical collision from current location.
@param category The collision category.
@param tileCollision The current tile collision.
@param x The current horizontal location.
@param y The current vertical location.
@return The computed vertical collision. | [
"Get",
"the",
"vertical",
"collision",
"from",
"current",
"location",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionComputer.java#L78-L85 |
aoindustries/aoweb-framework | src/main/java/com/aoindustries/website/framework/WebSiteRequest.java | WebSiteRequest.getURL | public String getURL(String classAndParams) throws IOException, SQLException {
String className, params;
int pos=classAndParams.indexOf('?');
if(pos==-1) {
className=classAndParams;
params=null;
} else {
className=classAndParams.substring(0, pos);
params=classAndParams.substring(pos+1);
}
return getURL(className, params);
} | java | public String getURL(String classAndParams) throws IOException, SQLException {
String className, params;
int pos=classAndParams.indexOf('?');
if(pos==-1) {
className=classAndParams;
params=null;
} else {
className=classAndParams.substring(0, pos);
params=classAndParams.substring(pos+1);
}
return getURL(className, params);
} | [
"public",
"String",
"getURL",
"(",
"String",
"classAndParams",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"String",
"className",
",",
"params",
";",
"int",
"pos",
"=",
"classAndParams",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pos"... | Gets a relative URL from a String containing a classname and optional parameters.
Parameters should already be URL encoded but not XML encoded. | [
"Gets",
"a",
"relative",
"URL",
"from",
"a",
"String",
"containing",
"a",
"classname",
"and",
"optional",
"parameters",
".",
"Parameters",
"should",
"already",
"be",
"URL",
"encoded",
"but",
"not",
"XML",
"encoded",
"."
] | train | https://github.com/aoindustries/aoweb-framework/blob/8e58af4f5dd898cd2fdb855ffa810a1ca6973ae0/src/main/java/com/aoindustries/website/framework/WebSiteRequest.java#L351-L362 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleFeatureSurf.java | ExampleFeatureSurf.easy | public static void easy( GrayF32 image ) {
// create the detector and descriptors
DetectDescribePoint<GrayF32,BrightFeature> surf = FactoryDetectDescribe.
surfStable(new ConfigFastHessian(0, 2, 200, 2, 9, 4, 4), null, null,GrayF32.class);
// specify the image to process
surf.detect(image);
System.out.println("Found Features: "+surf.getNumberOfFeatures());
System.out.println("First descriptor's first value: "+surf.getDescription(0).value[0]);
} | java | public static void easy( GrayF32 image ) {
// create the detector and descriptors
DetectDescribePoint<GrayF32,BrightFeature> surf = FactoryDetectDescribe.
surfStable(new ConfigFastHessian(0, 2, 200, 2, 9, 4, 4), null, null,GrayF32.class);
// specify the image to process
surf.detect(image);
System.out.println("Found Features: "+surf.getNumberOfFeatures());
System.out.println("First descriptor's first value: "+surf.getDescription(0).value[0]);
} | [
"public",
"static",
"void",
"easy",
"(",
"GrayF32",
"image",
")",
"{",
"// create the detector and descriptors",
"DetectDescribePoint",
"<",
"GrayF32",
",",
"BrightFeature",
">",
"surf",
"=",
"FactoryDetectDescribe",
".",
"surfStable",
"(",
"new",
"ConfigFastHessian",
... | Use generalized interfaces for working with SURF. This removes much of the drudgery, but also reduces flexibility
and slightly increases memory and computational requirements.
@param image Input image type. DOES NOT NEED TO BE GrayF32, GrayU8 works too | [
"Use",
"generalized",
"interfaces",
"for",
"working",
"with",
"SURF",
".",
"This",
"removes",
"much",
"of",
"the",
"drudgery",
"but",
"also",
"reduces",
"flexibility",
"and",
"slightly",
"increases",
"memory",
"and",
"computational",
"requirements",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleFeatureSurf.java#L59-L69 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryServers.java | DirectoryServers.validateServer | private boolean validateServer(String host, int port){
if(host==null || host.isEmpty()){
return false;
}
if(port <=0 || port > 65535){
return false;
}
return true;
} | java | private boolean validateServer(String host, int port){
if(host==null || host.isEmpty()){
return false;
}
if(port <=0 || port > 65535){
return false;
}
return true;
} | [
"private",
"boolean",
"validateServer",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"if",
"(",
"host",
"==",
"null",
"||",
"host",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"port",
"<=",
"0",
"||",
"port",... | Validate the host and port.
@param host
the host string.
@param port
the port number.
@return
true for success. | [
"Validate",
"the",
"host",
"and",
"port",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryServers.java#L147-L155 |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.startNewPipeline | public static String startNewPipeline(
JobSetting[] settings, Job<?> jobInstance, Object... params) {
UpdateSpec updateSpec = new UpdateSpec(null);
Job<?> rootJobInstance = jobInstance;
// If rootJobInstance has exceptionHandler it has to be wrapped to ensure that root job
// ends up in finalized state in case of exception of run method and
// exceptionHandler returning a result.
if (JobRecord.isExceptionHandlerSpecified(jobInstance)) {
rootJobInstance = new RootJobInstance(jobInstance, settings, params);
params = new Object[0];
}
// Create the root Job and its associated Barriers and Slots
// Passing null for parent JobRecord and graphGUID
// Create HandleSlotFilledTasks for the input parameters.
JobRecord jobRecord = registerNewJobRecord(
updateSpec, settings, null, null, rootJobInstance, params);
updateSpec.setRootJobKey(jobRecord.getRootJobKey());
// Save the Pipeline model objects and enqueue the tasks that start the Pipeline executing.
backEnd.save(updateSpec, jobRecord.getQueueSettings());
return jobRecord.getKey().getName();
} | java | public static String startNewPipeline(
JobSetting[] settings, Job<?> jobInstance, Object... params) {
UpdateSpec updateSpec = new UpdateSpec(null);
Job<?> rootJobInstance = jobInstance;
// If rootJobInstance has exceptionHandler it has to be wrapped to ensure that root job
// ends up in finalized state in case of exception of run method and
// exceptionHandler returning a result.
if (JobRecord.isExceptionHandlerSpecified(jobInstance)) {
rootJobInstance = new RootJobInstance(jobInstance, settings, params);
params = new Object[0];
}
// Create the root Job and its associated Barriers and Slots
// Passing null for parent JobRecord and graphGUID
// Create HandleSlotFilledTasks for the input parameters.
JobRecord jobRecord = registerNewJobRecord(
updateSpec, settings, null, null, rootJobInstance, params);
updateSpec.setRootJobKey(jobRecord.getRootJobKey());
// Save the Pipeline model objects and enqueue the tasks that start the Pipeline executing.
backEnd.save(updateSpec, jobRecord.getQueueSettings());
return jobRecord.getKey().getName();
} | [
"public",
"static",
"String",
"startNewPipeline",
"(",
"JobSetting",
"[",
"]",
"settings",
",",
"Job",
"<",
"?",
">",
"jobInstance",
",",
"Object",
"...",
"params",
")",
"{",
"UpdateSpec",
"updateSpec",
"=",
"new",
"UpdateSpec",
"(",
"null",
")",
";",
"Job... | Creates and launches a new Pipeline
<p>
Creates the root Job with its associated Barriers and Slots and saves them
to the data store. All slots in the root job are immediately filled with
the values of the parameters to this method, and
{@link HandleSlotFilledTask HandleSlotFilledTasks} are enqueued for each of
the filled slots.
@param settings JobSetting array used to control details of the Pipeline
@param jobInstance A user-supplied instance of {@link Job} that will serve
as the root job of the Pipeline.
@param params Arguments to the root job's run() method
@return The pipelineID of the newly created pipeline, also known as the
rootJobID. | [
"Creates",
"and",
"launches",
"a",
"new",
"Pipeline",
"<p",
">",
"Creates",
"the",
"root",
"Job",
"with",
"its",
"associated",
"Barriers",
"and",
"Slots",
"and",
"saves",
"them",
"to",
"the",
"data",
"store",
".",
"All",
"slots",
"in",
"the",
"root",
"jo... | train | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L93-L113 |
infinispan/infinispan | counter/src/main/java/org/infinispan/counter/configuration/CounterConfigurationSerializer.java | CounterConfigurationSerializer.serializeConfigurations | public void serializeConfigurations(OutputStream os, List<AbstractCounterConfiguration> configs)
throws XMLStreamException {
BufferedOutputStream output = new BufferedOutputStream(os);
XMLStreamWriter subWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(output);
XMLExtendedStreamWriter writer = new XMLExtendedStreamWriterImpl(subWriter);
writer.writeStartDocument();
writer.writeStartElement(Element.COUNTERS);
writeConfigurations(writer, configs);
writer.writeEndElement();
writer.writeEndDocument();
subWriter.close();
} | java | public void serializeConfigurations(OutputStream os, List<AbstractCounterConfiguration> configs)
throws XMLStreamException {
BufferedOutputStream output = new BufferedOutputStream(os);
XMLStreamWriter subWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(output);
XMLExtendedStreamWriter writer = new XMLExtendedStreamWriterImpl(subWriter);
writer.writeStartDocument();
writer.writeStartElement(Element.COUNTERS);
writeConfigurations(writer, configs);
writer.writeEndElement();
writer.writeEndDocument();
subWriter.close();
} | [
"public",
"void",
"serializeConfigurations",
"(",
"OutputStream",
"os",
",",
"List",
"<",
"AbstractCounterConfiguration",
">",
"configs",
")",
"throws",
"XMLStreamException",
"{",
"BufferedOutputStream",
"output",
"=",
"new",
"BufferedOutputStream",
"(",
"os",
")",
";... | It serializes a {@link List} of {@link AbstractCounterConfiguration} to an {@link OutputStream}.
@param os the {@link OutputStream} to write to.
@param configs the {@link List} if {@link AbstractCounterConfiguration}.
@throws XMLStreamException if xml is malformed | [
"It",
"serializes",
"a",
"{"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/configuration/CounterConfigurationSerializer.java#L38-L49 |
sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/PGPMessageSigner.java | PGPMessageSigner.verifyMessage | @Override
public boolean verifyMessage(InputStream publicKeyOfSender, InputStream message, InputStream signatureStream) {
LOGGER.trace("verifyMessage(InputStream, InputStream, InputStream)");
LOGGER.trace("Public Key: {}, Data: {}, Signature: {}",
publicKeyOfSender == null ? "not set" : "set", message == null ? "not set" : "set", signatureStream == null ? "not set" : "set");
boolean result = false;
LOGGER.debug("Wrapping signature stream in ArmoredInputStream");
try( InputStream armordPublicKeyStream = new ArmoredInputStream(signatureStream) ) {
Object pgpObject;
PGPObjectFactory pgpObjectFactory = new PGPObjectFactory(armordPublicKeyStream, new BcKeyFingerprintCalculator());
LOGGER.debug("Iterating over PGP objects in stream");
while( (pgpObject = pgpObjectFactory.nextObject()) != null ) {
if( pgpObject instanceof PGPSignatureList ) {
LOGGER.debug("Signature List found");
PGPSignatureList signatureList = (PGPSignatureList)pgpObject;
LOGGER.debug("Iterating over signature list");
Iterator<PGPSignature> signatureIterator = signatureList.iterator();
while( signatureIterator.hasNext() ) {
LOGGER.debug("Checking next signature");
final PGPSignature signature = signatureIterator.next();
PGPPublicKey pgpPublicKey = findPublicKey(publicKeyOfSender, new KeyFilter<PGPPublicKey>() {
@Override
public boolean accept(PGPPublicKey pgpKey) {
return pgpKey.getKeyID() == signature.getKeyID();
}
});
if( pgpPublicKey != null ) {
signature.init(new BcPGPContentVerifierBuilderProvider(), pgpPublicKey);
LOGGER.debug("Processing signature data");
IOUtils.process(message, new IOUtils.StreamHandler() {
@Override
public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException {
signature.update(buffer, offset, length);
}
});
result = signature.verify();
LOGGER.info("Verify Signature: {}", result);
} else {
LOGGER.warn("No public key found for signature. Key ID: {}", signature.getKeyID());
}
}
}
}
} catch (IOException | PGPException e) {
LOGGER.error("{}", e.getMessage());
result &= false;
}
return result;
} | java | @Override
public boolean verifyMessage(InputStream publicKeyOfSender, InputStream message, InputStream signatureStream) {
LOGGER.trace("verifyMessage(InputStream, InputStream, InputStream)");
LOGGER.trace("Public Key: {}, Data: {}, Signature: {}",
publicKeyOfSender == null ? "not set" : "set", message == null ? "not set" : "set", signatureStream == null ? "not set" : "set");
boolean result = false;
LOGGER.debug("Wrapping signature stream in ArmoredInputStream");
try( InputStream armordPublicKeyStream = new ArmoredInputStream(signatureStream) ) {
Object pgpObject;
PGPObjectFactory pgpObjectFactory = new PGPObjectFactory(armordPublicKeyStream, new BcKeyFingerprintCalculator());
LOGGER.debug("Iterating over PGP objects in stream");
while( (pgpObject = pgpObjectFactory.nextObject()) != null ) {
if( pgpObject instanceof PGPSignatureList ) {
LOGGER.debug("Signature List found");
PGPSignatureList signatureList = (PGPSignatureList)pgpObject;
LOGGER.debug("Iterating over signature list");
Iterator<PGPSignature> signatureIterator = signatureList.iterator();
while( signatureIterator.hasNext() ) {
LOGGER.debug("Checking next signature");
final PGPSignature signature = signatureIterator.next();
PGPPublicKey pgpPublicKey = findPublicKey(publicKeyOfSender, new KeyFilter<PGPPublicKey>() {
@Override
public boolean accept(PGPPublicKey pgpKey) {
return pgpKey.getKeyID() == signature.getKeyID();
}
});
if( pgpPublicKey != null ) {
signature.init(new BcPGPContentVerifierBuilderProvider(), pgpPublicKey);
LOGGER.debug("Processing signature data");
IOUtils.process(message, new IOUtils.StreamHandler() {
@Override
public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException {
signature.update(buffer, offset, length);
}
});
result = signature.verify();
LOGGER.info("Verify Signature: {}", result);
} else {
LOGGER.warn("No public key found for signature. Key ID: {}", signature.getKeyID());
}
}
}
}
} catch (IOException | PGPException e) {
LOGGER.error("{}", e.getMessage());
result &= false;
}
return result;
} | [
"@",
"Override",
"public",
"boolean",
"verifyMessage",
"(",
"InputStream",
"publicKeyOfSender",
",",
"InputStream",
"message",
",",
"InputStream",
"signatureStream",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"verifyMessage(InputStream, InputStream, InputStream)\"",
")",
";... | @see MessageSigner#verifyMessage(InputStream, InputStream, InputStream)
@param publicKeyOfSender
the public key of the sender of the message
@param message
the message / data to verify
@param signatureStream
the (detached) signature
@return | [
"@see",
"MessageSigner#verifyMessage",
"(",
"InputStream",
"InputStream",
"InputStream",
")"
] | train | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/PGPMessageSigner.java#L41-L89 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/TextModerationsImpl.java | TextModerationsImpl.screenTextWithServiceResponseAsync | public Observable<ServiceResponse<Screen>> screenTextWithServiceResponseAsync(String textContentType, byte[] textContent, ScreenTextOptionalParameter screenTextOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (textContentType == null) {
throw new IllegalArgumentException("Parameter textContentType is required and cannot be null.");
}
if (textContent == null) {
throw new IllegalArgumentException("Parameter textContent is required and cannot be null.");
}
final String language = screenTextOptionalParameter != null ? screenTextOptionalParameter.language() : null;
final Boolean autocorrect = screenTextOptionalParameter != null ? screenTextOptionalParameter.autocorrect() : null;
final Boolean pII = screenTextOptionalParameter != null ? screenTextOptionalParameter.pII() : null;
final String listId = screenTextOptionalParameter != null ? screenTextOptionalParameter.listId() : null;
final Boolean classify = screenTextOptionalParameter != null ? screenTextOptionalParameter.classify() : null;
return screenTextWithServiceResponseAsync(textContentType, textContent, language, autocorrect, pII, listId, classify);
} | java | public Observable<ServiceResponse<Screen>> screenTextWithServiceResponseAsync(String textContentType, byte[] textContent, ScreenTextOptionalParameter screenTextOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (textContentType == null) {
throw new IllegalArgumentException("Parameter textContentType is required and cannot be null.");
}
if (textContent == null) {
throw new IllegalArgumentException("Parameter textContent is required and cannot be null.");
}
final String language = screenTextOptionalParameter != null ? screenTextOptionalParameter.language() : null;
final Boolean autocorrect = screenTextOptionalParameter != null ? screenTextOptionalParameter.autocorrect() : null;
final Boolean pII = screenTextOptionalParameter != null ? screenTextOptionalParameter.pII() : null;
final String listId = screenTextOptionalParameter != null ? screenTextOptionalParameter.listId() : null;
final Boolean classify = screenTextOptionalParameter != null ? screenTextOptionalParameter.classify() : null;
return screenTextWithServiceResponseAsync(textContentType, textContent, language, autocorrect, pII, listId, classify);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Screen",
">",
">",
"screenTextWithServiceResponseAsync",
"(",
"String",
"textContentType",
",",
"byte",
"[",
"]",
"textContent",
",",
"ScreenTextOptionalParameter",
"screenTextOptionalParameter",
")",
"{",
"if",
"(",... | Detect profanity and match against custom and shared blacklists.
Detects profanity in more than 100 languages and match against custom and shared blacklists.
@param textContentType The content type. Possible values include: 'text/plain', 'text/html', 'text/xml', 'text/markdown'
@param textContent Content to screen.
@param screenTextOptionalParameter 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 Screen object | [
"Detect",
"profanity",
"and",
"match",
"against",
"custom",
"and",
"shared",
"blacklists",
".",
"Detects",
"profanity",
"in",
"more",
"than",
"100",
"languages",
"and",
"match",
"against",
"custom",
"and",
"shared",
"blacklists",
"."
] | 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/TextModerationsImpl.java#L132-L149 |
vdmeer/skb-java-base | src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java | SkbShellFactory.newShell | public static SkbShell newShell(String id, MessageRenderer renderer, boolean useConsole){
return new AbstractShell(id, renderer, useConsole);
} | java | public static SkbShell newShell(String id, MessageRenderer renderer, boolean useConsole){
return new AbstractShell(id, renderer, useConsole);
} | [
"public",
"static",
"SkbShell",
"newShell",
"(",
"String",
"id",
",",
"MessageRenderer",
"renderer",
",",
"boolean",
"useConsole",
")",
"{",
"return",
"new",
"AbstractShell",
"(",
"id",
",",
"renderer",
",",
"useConsole",
")",
";",
"}"
] | Returns a new shell with given identifier and console flag.
@param id new shell with identifier
@param renderer a renderer for help messages
@param useConsole flag to use (true) or not to use (false) console, of false then no output will happen
@return new shell | [
"Returns",
"a",
"new",
"shell",
"with",
"given",
"identifier",
"and",
"console",
"flag",
"."
] | train | https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L96-L98 |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.processSubheaderPointers | private SubheaderPointer processSubheaderPointers(long subheaderPointerOffset, int subheaderPointerIndex)
throws IOException {
int intOrLongLength = sasFileProperties.isU64() ? BYTES_IN_LONG : BYTES_IN_INT;
int subheaderPointerLength = sasFileProperties.isU64() ? SUBHEADER_POINTER_LENGTH_X64
: SUBHEADER_POINTER_LENGTH_X86;
long totalOffset = subheaderPointerOffset + subheaderPointerLength * ((long) subheaderPointerIndex);
Long[] offset = {totalOffset, totalOffset + intOrLongLength, totalOffset + 2L * intOrLongLength,
totalOffset + 2L * intOrLongLength + 1};
Integer[] length = {intOrLongLength, intOrLongLength, 1, 1};
List<byte[]> vars = getBytesFromFile(offset, length);
long subheaderOffset = bytesToLong(vars.get(0));
long subheaderLength = bytesToLong(vars.get(1));
byte subheaderCompression = vars.get(2)[0];
byte subheaderType = vars.get(3)[0];
return new SubheaderPointer(subheaderOffset, subheaderLength, subheaderCompression, subheaderType);
} | java | private SubheaderPointer processSubheaderPointers(long subheaderPointerOffset, int subheaderPointerIndex)
throws IOException {
int intOrLongLength = sasFileProperties.isU64() ? BYTES_IN_LONG : BYTES_IN_INT;
int subheaderPointerLength = sasFileProperties.isU64() ? SUBHEADER_POINTER_LENGTH_X64
: SUBHEADER_POINTER_LENGTH_X86;
long totalOffset = subheaderPointerOffset + subheaderPointerLength * ((long) subheaderPointerIndex);
Long[] offset = {totalOffset, totalOffset + intOrLongLength, totalOffset + 2L * intOrLongLength,
totalOffset + 2L * intOrLongLength + 1};
Integer[] length = {intOrLongLength, intOrLongLength, 1, 1};
List<byte[]> vars = getBytesFromFile(offset, length);
long subheaderOffset = bytesToLong(vars.get(0));
long subheaderLength = bytesToLong(vars.get(1));
byte subheaderCompression = vars.get(2)[0];
byte subheaderType = vars.get(3)[0];
return new SubheaderPointer(subheaderOffset, subheaderLength, subheaderCompression, subheaderType);
} | [
"private",
"SubheaderPointer",
"processSubheaderPointers",
"(",
"long",
"subheaderPointerOffset",
",",
"int",
"subheaderPointerIndex",
")",
"throws",
"IOException",
"{",
"int",
"intOrLongLength",
"=",
"sasFileProperties",
".",
"isU64",
"(",
")",
"?",
"BYTES_IN_LONG",
":... | The function to read the pointer with the subheaderPointerIndex index from the list of {@link SubheaderPointer}
located at the subheaderPointerOffset offset.
@param subheaderPointerOffset the offset before the list of {@link SubheaderPointer}.
@param subheaderPointerIndex the index of the subheader pointer being read.
@return the subheader pointer.
@throws IOException if reading from the {@link SasFileParser#sasFileStream} stream is impossible. | [
"The",
"function",
"to",
"read",
"the",
"pointer",
"with",
"the",
"subheaderPointerIndex",
"index",
"from",
"the",
"list",
"of",
"{",
"@link",
"SubheaderPointer",
"}",
"located",
"at",
"the",
"subheaderPointerOffset",
"offset",
"."
] | train | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L457-L474 |
jMotif/SAX | src/main/java/net/seninp/jmotif/sax/discord/HOTSAXImplementation.java | HOTSAXImplementation.hashToFreqEntries | @Deprecated
private static ArrayList<FrequencyTableEntry> hashToFreqEntries(
HashMap<String, ArrayList<Integer>> hash) {
ArrayList<FrequencyTableEntry> res = new ArrayList<FrequencyTableEntry>();
for (Entry<String, ArrayList<Integer>> e : hash.entrySet()) {
char[] payload = e.getKey().toCharArray();
int frequency = e.getValue().size();
for (Integer i : e.getValue()) {
res.add(new FrequencyTableEntry(i, payload.clone(), frequency));
}
}
return res;
} | java | @Deprecated
private static ArrayList<FrequencyTableEntry> hashToFreqEntries(
HashMap<String, ArrayList<Integer>> hash) {
ArrayList<FrequencyTableEntry> res = new ArrayList<FrequencyTableEntry>();
for (Entry<String, ArrayList<Integer>> e : hash.entrySet()) {
char[] payload = e.getKey().toCharArray();
int frequency = e.getValue().size();
for (Integer i : e.getValue()) {
res.add(new FrequencyTableEntry(i, payload.clone(), frequency));
}
}
return res;
} | [
"@",
"Deprecated",
"private",
"static",
"ArrayList",
"<",
"FrequencyTableEntry",
">",
"hashToFreqEntries",
"(",
"HashMap",
"<",
"String",
",",
"ArrayList",
"<",
"Integer",
">",
">",
"hash",
")",
"{",
"ArrayList",
"<",
"FrequencyTableEntry",
">",
"res",
"=",
"n... | Translates the hash table into sortable array of substrings.
@param hash
@return | [
"Translates",
"the",
"hash",
"table",
"into",
"sortable",
"array",
"of",
"substrings",
"."
] | train | https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/discord/HOTSAXImplementation.java#L651-L663 |
streamsets/datacollector-api | src/main/java/com/streamsets/pipeline/api/impl/Utils.java | Utils.checkNotNull | public static <T> T checkNotNull(@Nullable T value, Object varName) {
if (value == null) {
throw new NullPointerException(format("{} cannot be null", varName));
}
return value;
} | java | public static <T> T checkNotNull(@Nullable T value, Object varName) {
if (value == null) {
throw new NullPointerException(format("{} cannot be null", varName));
}
return value;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"@",
"Nullable",
"T",
"value",
",",
"Object",
"varName",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"format",
"(",
"\"{} cannot be null\"",... | Ensures that an object reference passed as a parameter to the calling method is not null.
@param value an object reference
@param varName the variable name to use in an exception message if the check fails
@return the non-null reference that was validated
@throws NullPointerException if {@code value} is null | [
"Ensures",
"that",
"an",
"object",
"reference",
"passed",
"as",
"a",
"parameter",
"to",
"the",
"calling",
"method",
"is",
"not",
"null",
"."
] | train | https://github.com/streamsets/datacollector-api/blob/ac832a97bea2fcef11f50fac6746e85019adad58/src/main/java/com/streamsets/pipeline/api/impl/Utils.java#L55-L60 |
jkyamog/DeDS | sample_clients/java/src/main/java/nz/net/catalyst/mobile/dds/sample/DDSClient.java | DDSClient.jsonDecode | private static <T> T jsonDecode(String responseContent, TypeReference<T> valueTypeRef) throws IOException {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.<T>readValue(responseContent, valueTypeRef);
} catch (JsonGenerationException e) {
logger.severe("unable decode");
throw new IOException(e);
} catch (JsonMappingException e) {
logger.severe("unable decode");
throw new IOException(e.getMessage());
}
} | java | private static <T> T jsonDecode(String responseContent, TypeReference<T> valueTypeRef) throws IOException {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.<T>readValue(responseContent, valueTypeRef);
} catch (JsonGenerationException e) {
logger.severe("unable decode");
throw new IOException(e);
} catch (JsonMappingException e) {
logger.severe("unable decode");
throw new IOException(e.getMessage());
}
} | [
"private",
"static",
"<",
"T",
">",
"T",
"jsonDecode",
"(",
"String",
"responseContent",
",",
"TypeReference",
"<",
"T",
">",
"valueTypeRef",
")",
"throws",
"IOException",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"try",
"{",
... | Given a string and a type ref. Decode the string and return the values.
@param <T>
@param responseContent
@param valueTypeRef
@return
@throws IOException | [
"Given",
"a",
"string",
"and",
"a",
"type",
"ref",
".",
"Decode",
"the",
"string",
"and",
"return",
"the",
"values",
"."
] | train | https://github.com/jkyamog/DeDS/blob/d8cf6a294a23daa8e8a92073827c73b1befe3fa1/sample_clients/java/src/main/java/nz/net/catalyst/mobile/dds/sample/DDSClient.java#L103-L116 |
yuvipanda/java-http-fluent | src/main/java/in/yuvi/http/fluent/Http.java | Http.asString | public static String asString(final HttpResponse response, final String encoding) {
if (response == null) {
throw new NullPointerException();
}
final HttpEntity entity = response.getEntity();
if (entity == null) {
return null;
}
try {
return EntityUtils.toString(entity, encoding);
} catch (final Exception e) {
return null;
}
} | java | public static String asString(final HttpResponse response, final String encoding) {
if (response == null) {
throw new NullPointerException();
}
final HttpEntity entity = response.getEntity();
if (entity == null) {
return null;
}
try {
return EntityUtils.toString(entity, encoding);
} catch (final Exception e) {
return null;
}
} | [
"public",
"static",
"String",
"asString",
"(",
"final",
"HttpResponse",
"response",
",",
"final",
"String",
"encoding",
")",
"{",
"if",
"(",
"response",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"final",
"HttpEntity"... | Converts a {@linkplain HttpResponse} to a String by calling {@link EntityUtils#toString(HttpEntity)} on its {@linkplain HttpEntity
entity}.
@param response
the {@linkplain HttpResponse response} to convert.
@param encoding
the encoding to use for the conversion.
@throws NullPointerException
if the given response was null
@return the response body as a String or {@code null}, if no
response body exists or an error occurred while converting. | [
"Converts",
"a",
"{",
"@linkplain",
"HttpResponse",
"}",
"to",
"a",
"String",
"by",
"calling",
"{",
"@link",
"EntityUtils#toString",
"(",
"HttpEntity",
")",
"}",
"on",
"its",
"{",
"@linkplain",
"HttpEntity",
"entity",
"}",
"."
] | train | https://github.com/yuvipanda/java-http-fluent/blob/e1da03aa23671cc099f30b9d7afbe2fad829f250/src/main/java/in/yuvi/http/fluent/Http.java#L187-L202 |
googleapis/google-oauth-java-client | google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/Credential.java | Credential.executeRefreshToken | protected TokenResponse executeRefreshToken() throws IOException {
if (refreshToken == null) {
return null;
}
return new RefreshTokenRequest(transport, jsonFactory, new GenericUrl(tokenServerEncodedUrl),
refreshToken).setClientAuthentication(clientAuthentication)
.setRequestInitializer(requestInitializer).execute();
} | java | protected TokenResponse executeRefreshToken() throws IOException {
if (refreshToken == null) {
return null;
}
return new RefreshTokenRequest(transport, jsonFactory, new GenericUrl(tokenServerEncodedUrl),
refreshToken).setClientAuthentication(clientAuthentication)
.setRequestInitializer(requestInitializer).execute();
} | [
"protected",
"TokenResponse",
"executeRefreshToken",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"refreshToken",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"RefreshTokenRequest",
"(",
"transport",
",",
"jsonFactory",
",",
"new",
... | Executes a request for new credentials from the token server.
<p>
The default implementation calls {@link RefreshTokenRequest#execute()} using the
{@link #getTransport()}, {@link #getJsonFactory()}, {@link #getRequestInitializer()},
{@link #getTokenServerEncodedUrl()}, {@link #getRefreshToken()}, and the
{@link #getClientAuthentication()}. If {@link #getRefreshToken()} is {@code null}, it instead
returns {@code null}.
</p>
<p>
Subclasses may override for a different implementation. Implementations can assume proper
thread synchronization is already taken care of inside {@link #refreshToken()}.
</p>
@return successful response from the token server or {@code null} if it is not possible to
refresh the access token
@throws TokenResponseException if an error response was received from the token server | [
"Executes",
"a",
"request",
"for",
"new",
"credentials",
"from",
"the",
"token",
"server",
"."
] | train | https://github.com/googleapis/google-oauth-java-client/blob/7a829f8fd4d216c7d5882a82b9b58930fb375592/google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/Credential.java#L571-L578 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java | Utils.findMethod | public ExecutableElement findMethod(TypeElement te, ExecutableElement method) {
for (Element m : getMethods(te)) {
if (executableMembersEqual(method, (ExecutableElement)m)) {
return (ExecutableElement)m;
}
}
return null;
} | java | public ExecutableElement findMethod(TypeElement te, ExecutableElement method) {
for (Element m : getMethods(te)) {
if (executableMembersEqual(method, (ExecutableElement)m)) {
return (ExecutableElement)m;
}
}
return null;
} | [
"public",
"ExecutableElement",
"findMethod",
"(",
"TypeElement",
"te",
",",
"ExecutableElement",
"method",
")",
"{",
"for",
"(",
"Element",
"m",
":",
"getMethods",
"(",
"te",
")",
")",
"{",
"if",
"(",
"executableMembersEqual",
"(",
"method",
",",
"(",
"Execu... | Search for the given method in the given class.
@param te Class to search into.
@param method Method to be searched.
@return ExecutableElement Method found, null otherwise. | [
"Search",
"for",
"the",
"given",
"method",
"in",
"the",
"given",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L200-L207 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileLexer.java | WhileyFileLexer.scanCharacterLiteral | public Token scanCharacterLiteral() {
int start = pos;
pos++;
char c = input.charAt(pos++);
if (c == '\\') {
// escape code
switch (input.charAt(pos++)) {
case 'b':
c = '\b';
break;
case 't':
c = '\t';
break;
case 'n':
c = '\n';
break;
case 'f':
c = '\f';
break;
case 'r':
c = '\r';
break;
case '"':
c = '\"';
break;
case '\'':
c = '\'';
break;
case '\\':
c = '\\';
break;
default:
syntaxError("unrecognised escape character", pos);
}
}
if (input.charAt(pos) != '\'') {
syntaxError("unexpected end-of-character", pos);
}
pos = pos + 1;
return new Token(Token.Kind.CharLiteral, input.substring(start, pos),
start);
} | java | public Token scanCharacterLiteral() {
int start = pos;
pos++;
char c = input.charAt(pos++);
if (c == '\\') {
// escape code
switch (input.charAt(pos++)) {
case 'b':
c = '\b';
break;
case 't':
c = '\t';
break;
case 'n':
c = '\n';
break;
case 'f':
c = '\f';
break;
case 'r':
c = '\r';
break;
case '"':
c = '\"';
break;
case '\'':
c = '\'';
break;
case '\\':
c = '\\';
break;
default:
syntaxError("unrecognised escape character", pos);
}
}
if (input.charAt(pos) != '\'') {
syntaxError("unexpected end-of-character", pos);
}
pos = pos + 1;
return new Token(Token.Kind.CharLiteral, input.substring(start, pos),
start);
} | [
"public",
"Token",
"scanCharacterLiteral",
"(",
")",
"{",
"int",
"start",
"=",
"pos",
";",
"pos",
"++",
";",
"char",
"c",
"=",
"input",
".",
"charAt",
"(",
"pos",
"++",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"// escape code",
"switch",... | Scan a character literal, such as e.g. 'c'. Observe that care must be
taken to properly handle escape codes. For example, '\n' is a single
character constant which is made up from two characters in the input
string.
@return | [
"Scan",
"a",
"character",
"literal",
"such",
"as",
"e",
".",
"g",
".",
"c",
".",
"Observe",
"that",
"care",
"must",
"be",
"taken",
"to",
"properly",
"handle",
"escape",
"codes",
".",
"For",
"example",
"\\",
"n",
"is",
"a",
"single",
"character",
"const... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileLexer.java#L160-L201 |
motown-io/motown | chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java | DomainService.getConnector | public Connector getConnector(Long chargingStationTypeId, Long evseId, Long id) {
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
Evse evse = getEvseById(chargingStationType, evseId);
return getConnectorById(evse, id);
} | java | public Connector getConnector(Long chargingStationTypeId, Long evseId, Long id) {
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
Evse evse = getEvseById(chargingStationType, evseId);
return getConnectorById(evse, id);
} | [
"public",
"Connector",
"getConnector",
"(",
"Long",
"chargingStationTypeId",
",",
"Long",
"evseId",
",",
"Long",
"id",
")",
"{",
"ChargingStationType",
"chargingStationType",
"=",
"chargingStationTypeRepository",
".",
"findOne",
"(",
"chargingStationTypeId",
")",
";",
... | Find a connector based on its id.
@param id the id of the entity to find.
@return the connector. | [
"Find",
"a",
"connector",
"based",
"on",
"its",
"id",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L244-L249 |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/application5/ApplicationDescriptorImpl.java | ApplicationDescriptorImpl.addNamespace | public ApplicationDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
} | java | public ApplicationDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
} | [
"public",
"ApplicationDescriptor",
"addNamespace",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"model",
".",
"attribute",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a new namespace
@return the current instance of <code>ApplicationDescriptor</code> | [
"Adds",
"a",
"new",
"namespace"
] | train | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/application5/ApplicationDescriptorImpl.java#L87-L91 |
apache/groovy | src/main/groovy/groovy/lang/ProxyMetaClass.java | ProxyMetaClass.invokeMethod | public Object invokeMethod(final Object object, final String methodName, final Object[] arguments) {
return doCall(object, methodName, arguments, interceptor, new Callable() {
public Object call() {
return adaptee.invokeMethod(object, methodName, arguments);
}
});
} | java | public Object invokeMethod(final Object object, final String methodName, final Object[] arguments) {
return doCall(object, methodName, arguments, interceptor, new Callable() {
public Object call() {
return adaptee.invokeMethod(object, methodName, arguments);
}
});
} | [
"public",
"Object",
"invokeMethod",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"methodName",
",",
"final",
"Object",
"[",
"]",
"arguments",
")",
"{",
"return",
"doCall",
"(",
"object",
",",
"methodName",
",",
"arguments",
",",
"interceptor",
"... | Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor.
With Interceptor the call is nested in its beforeInvoke and afterInvoke methods.
The method call is suppressed if Interceptor.doInvoke() returns false.
See Interceptor for details. | [
"Call",
"invokeMethod",
"on",
"adaptee",
"with",
"logic",
"like",
"in",
"MetaClass",
"unless",
"we",
"have",
"an",
"Interceptor",
".",
"With",
"Interceptor",
"the",
"call",
"is",
"nested",
"in",
"its",
"beforeInvoke",
"and",
"afterInvoke",
"methods",
".",
"The... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ProxyMetaClass.java#L117-L123 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/EntityMetadata.java | EntityMetadata.addRelation | public void addRelation(String property, Relation relation)
{
relationsMap.put(property, relation);
addRelationName(relation);
} | java | public void addRelation(String property, Relation relation)
{
relationsMap.put(property, relation);
addRelationName(relation);
} | [
"public",
"void",
"addRelation",
"(",
"String",
"property",
",",
"Relation",
"relation",
")",
"{",
"relationsMap",
".",
"put",
"(",
"property",
",",
"relation",
")",
";",
"addRelationName",
"(",
"relation",
")",
";",
"}"
] | Adds the relation.
@param property
the property
@param relation
the relation | [
"Adds",
"the",
"relation",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/EntityMetadata.java#L361-L365 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/Environment.java | Environment.handleErrorResponse | public static void handleErrorResponse(String msg, String responseText) {
String responseHtml;
Environment instance = getInstance();
try {
responseHtml = instance.getHtmlForXml(responseText);
} catch (Exception e) {
responseHtml = instance.getHtml(value -> value, responseText);
}
throw new FitFailureException(msg + responseHtml);
} | java | public static void handleErrorResponse(String msg, String responseText) {
String responseHtml;
Environment instance = getInstance();
try {
responseHtml = instance.getHtmlForXml(responseText);
} catch (Exception e) {
responseHtml = instance.getHtml(value -> value, responseText);
}
throw new FitFailureException(msg + responseHtml);
} | [
"public",
"static",
"void",
"handleErrorResponse",
"(",
"String",
"msg",
",",
"String",
"responseText",
")",
"{",
"String",
"responseHtml",
";",
"Environment",
"instance",
"=",
"getInstance",
"(",
")",
";",
"try",
"{",
"responseHtml",
"=",
"instance",
".",
"ge... | Creates exception that will display nicely in a columnFixture.
@param msg message for exception
@param responseText XML received, which will be shown in wiki table.
@throws FitFailureException always | [
"Creates",
"exception",
"that",
"will",
"display",
"nicely",
"in",
"a",
"columnFixture",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L545-L555 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.