repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src/org/opencms/search/documents/CmsDocumentXmlPage.java | CmsDocumentXmlPage.extractContent | public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsException {
logContentExtraction(resource, index);
try {
CmsFile file = readFile(cms, resource);
CmsXmlPage page = CmsXmlPageFactory.unmarshal(cms, file);
Locale locale = index.getLocaleForResource(cms, resource, page.getLocales());
List<String> elements = page.getNames(locale);
StringBuffer content = new StringBuffer();
LinkedHashMap<String, String> items = new LinkedHashMap<String, String>();
for (Iterator<String> i = elements.iterator(); i.hasNext();) {
String elementName = i.next();
String value = page.getStringValue(cms, elementName, locale);
String extracted = CmsHtmlExtractor.extractText(value, page.getEncoding());
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(extracted)) {
items.put(elementName, extracted);
content.append(extracted);
content.append('\n');
}
}
return new CmsExtractionResult(content.toString(), items);
} catch (Exception e) {
throw new CmsIndexException(
Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()),
e);
}
} | java | public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsException {
logContentExtraction(resource, index);
try {
CmsFile file = readFile(cms, resource);
CmsXmlPage page = CmsXmlPageFactory.unmarshal(cms, file);
Locale locale = index.getLocaleForResource(cms, resource, page.getLocales());
List<String> elements = page.getNames(locale);
StringBuffer content = new StringBuffer();
LinkedHashMap<String, String> items = new LinkedHashMap<String, String>();
for (Iterator<String> i = elements.iterator(); i.hasNext();) {
String elementName = i.next();
String value = page.getStringValue(cms, elementName, locale);
String extracted = CmsHtmlExtractor.extractText(value, page.getEncoding());
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(extracted)) {
items.put(elementName, extracted);
content.append(extracted);
content.append('\n');
}
}
return new CmsExtractionResult(content.toString(), items);
} catch (Exception e) {
throw new CmsIndexException(
Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()),
e);
}
} | [
"public",
"I_CmsExtractionResult",
"extractContent",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"I_CmsSearchIndex",
"index",
")",
"throws",
"CmsException",
"{",
"logContentExtraction",
"(",
"resource",
",",
"index",
")",
";",
"try",
"{",
"CmsFile"... | Returns the raw text content of a given vfs resource of type <code>CmsResourceTypeXmlPage</code>.<p>
@see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex) | [
"Returns",
"the",
"raw",
"text",
"content",
"of",
"a",
"given",
"vfs",
"resource",
"of",
"type",
"<code",
">",
"CmsResourceTypeXmlPage<",
"/",
"code",
">",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentXmlPage.java#L71-L101 |
eirbjo/jetty-console | jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java | JettyConsoleBootstrapMainClass.unpackFile | private static void unpackFile(InputStream in, File file) {
byte[] buffer = new byte[4096];
try {
OutputStream out = new FileOutputStream(file);
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
out.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | private static void unpackFile(InputStream in, File file) {
byte[] buffer = new byte[4096];
try {
OutputStream out = new FileOutputStream(file);
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
out.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"private",
"static",
"void",
"unpackFile",
"(",
"InputStream",
"in",
",",
"File",
"file",
")",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"4096",
"]",
";",
"try",
"{",
"OutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"file",
"... | Write the contents of an InputStream to a file
@param in the input stream to read
@param file the File to write to | [
"Write",
"the",
"contents",
"of",
"an",
"InputStream",
"to",
"a",
"file"
] | train | https://github.com/eirbjo/jetty-console/blob/5bd32ecab12837394dd45fd15c51c3934afcd76b/jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java#L319-L332 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/TypeAdapterHelper.java | TypeAdapterHelper.detectSourceType | public static String detectSourceType(Element element, String adapterClazz) {
TypeElement a = BaseProcessor.elementUtils.getTypeElement(adapterClazz);
for (Element i : BaseProcessor.elementUtils.getAllMembers(a)) {
if (i.getKind() == ElementKind.METHOD && "toJava".equals(i.getSimpleName().toString())) {
ExecutableElement method = (ExecutableElement) i;
return TypeUtility.typeName(method.getReturnType()).toString();
}
}
AssertKripton.fail("In '%s', class '%s' can not be used as type adapter", element, adapterClazz);
return null;
} | java | public static String detectSourceType(Element element, String adapterClazz) {
TypeElement a = BaseProcessor.elementUtils.getTypeElement(adapterClazz);
for (Element i : BaseProcessor.elementUtils.getAllMembers(a)) {
if (i.getKind() == ElementKind.METHOD && "toJava".equals(i.getSimpleName().toString())) {
ExecutableElement method = (ExecutableElement) i;
return TypeUtility.typeName(method.getReturnType()).toString();
}
}
AssertKripton.fail("In '%s', class '%s' can not be used as type adapter", element, adapterClazz);
return null;
} | [
"public",
"static",
"String",
"detectSourceType",
"(",
"Element",
"element",
",",
"String",
"adapterClazz",
")",
"{",
"TypeElement",
"a",
"=",
"BaseProcessor",
".",
"elementUtils",
".",
"getTypeElement",
"(",
"adapterClazz",
")",
";",
"for",
"(",
"Element",
"i",... | Detect source type.
@param element the element
@param adapterClazz the adapter clazz
@return the string | [
"Detect",
"source",
"type",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/TypeAdapterHelper.java#L51-L62 |
webmetrics/browsermob-proxy | src/main/java/cz/mallat/uasparser/UASparser.java | UASparser.copyType | private void copyType(UserAgentInfo retObj, Long idBrowser) {
try {
lock.lock();
BrowserEntry be = browserMap.get(idBrowser);
if (be != null) {
Long type = be.getType();
if (type != null) {
String typeString = browserTypeMap.get(type);
if (typeString != null) {
retObj.setTyp(typeString);
}
}
}
} finally {
lock.unlock();
}
} | java | private void copyType(UserAgentInfo retObj, Long idBrowser) {
try {
lock.lock();
BrowserEntry be = browserMap.get(idBrowser);
if (be != null) {
Long type = be.getType();
if (type != null) {
String typeString = browserTypeMap.get(type);
if (typeString != null) {
retObj.setTyp(typeString);
}
}
}
} finally {
lock.unlock();
}
} | [
"private",
"void",
"copyType",
"(",
"UserAgentInfo",
"retObj",
",",
"Long",
"idBrowser",
")",
"{",
"try",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"BrowserEntry",
"be",
"=",
"browserMap",
".",
"get",
"(",
"idBrowser",
")",
";",
"if",
"(",
"be",
"!=",
... | Sets the source type, if possible
@param retObj
@param idBrowser | [
"Sets",
"the",
"source",
"type",
"if",
"possible"
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/cz/mallat/uasparser/UASparser.java#L182-L199 |
elvishew/xLog | library/src/main/java/com/elvishew/xlog/Logger.java | Logger.println | private void println(int logLevel, String msg, Throwable tr) {
if (logLevel < logConfiguration.logLevel) {
return;
}
printlnInternal(logLevel, ((msg == null || msg.length() == 0)
? "" : (msg + SystemCompat.lineSeparator))
+ logConfiguration.throwableFormatter.format(tr));
} | java | private void println(int logLevel, String msg, Throwable tr) {
if (logLevel < logConfiguration.logLevel) {
return;
}
printlnInternal(logLevel, ((msg == null || msg.length() == 0)
? "" : (msg + SystemCompat.lineSeparator))
+ logConfiguration.throwableFormatter.format(tr));
} | [
"private",
"void",
"println",
"(",
"int",
"logLevel",
",",
"String",
"msg",
",",
"Throwable",
"tr",
")",
"{",
"if",
"(",
"logLevel",
"<",
"logConfiguration",
".",
"logLevel",
")",
"{",
"return",
";",
"}",
"printlnInternal",
"(",
"logLevel",
",",
"(",
"("... | Print a log in a new line.
@param logLevel the log level of the printing log
@param msg the message you would like to log
@param tr a throwable object to log | [
"Print",
"a",
"log",
"in",
"a",
"new",
"line",
"."
] | train | https://github.com/elvishew/xLog/blob/c6fb95555ce619d3e527f5ba6c45d4d247c5a838/library/src/main/java/com/elvishew/xlog/Logger.java#L542-L549 |
buschmais/extended-objects | neo4j/remote/src/main/java/com/buschmais/xo/neo4j/remote/impl/datastore/RemoteDatastoreEntityManager.java | RemoteDatastoreEntityManager.initializeEntity | private void initializeEntity(Collection<? extends TypeMetadata> types, NodeState nodeState) {
for (TypeMetadata type : types) {
Collection<TypeMetadata> superTypes = type.getSuperTypes();
initializeEntity(superTypes, nodeState);
for (MethodMetadata<?, ?> methodMetadata : type.getProperties()) {
if (methodMetadata instanceof AbstractRelationPropertyMethodMetadata) {
AbstractRelationPropertyMethodMetadata<?> relationPropertyMethodMetadata = (AbstractRelationPropertyMethodMetadata) methodMetadata;
RelationTypeMetadata<RelationshipMetadata<RemoteRelationshipType>> relationshipMetadata = relationPropertyMethodMetadata
.getRelationshipMetadata();
RemoteRelationshipType relationshipType = relationshipMetadata.getDatastoreMetadata().getDiscriminator();
RelationTypeMetadata.Direction direction = relationPropertyMethodMetadata.getDirection();
RemoteDirection remoteDirection;
switch (direction) {
case FROM:
remoteDirection = RemoteDirection.OUTGOING;
break;
case TO:
remoteDirection = RemoteDirection.INCOMING;
break;
default:
throw new XOException("Unsupported direction: " + direction);
}
if (nodeState.getRelationships(remoteDirection, relationshipType) == null) {
nodeState.setRelationships(remoteDirection, relationshipType, new StateTracker<>(new LinkedHashSet<>()));
}
}
}
}
} | java | private void initializeEntity(Collection<? extends TypeMetadata> types, NodeState nodeState) {
for (TypeMetadata type : types) {
Collection<TypeMetadata> superTypes = type.getSuperTypes();
initializeEntity(superTypes, nodeState);
for (MethodMetadata<?, ?> methodMetadata : type.getProperties()) {
if (methodMetadata instanceof AbstractRelationPropertyMethodMetadata) {
AbstractRelationPropertyMethodMetadata<?> relationPropertyMethodMetadata = (AbstractRelationPropertyMethodMetadata) methodMetadata;
RelationTypeMetadata<RelationshipMetadata<RemoteRelationshipType>> relationshipMetadata = relationPropertyMethodMetadata
.getRelationshipMetadata();
RemoteRelationshipType relationshipType = relationshipMetadata.getDatastoreMetadata().getDiscriminator();
RelationTypeMetadata.Direction direction = relationPropertyMethodMetadata.getDirection();
RemoteDirection remoteDirection;
switch (direction) {
case FROM:
remoteDirection = RemoteDirection.OUTGOING;
break;
case TO:
remoteDirection = RemoteDirection.INCOMING;
break;
default:
throw new XOException("Unsupported direction: " + direction);
}
if (nodeState.getRelationships(remoteDirection, relationshipType) == null) {
nodeState.setRelationships(remoteDirection, relationshipType, new StateTracker<>(new LinkedHashSet<>()));
}
}
}
}
} | [
"private",
"void",
"initializeEntity",
"(",
"Collection",
"<",
"?",
"extends",
"TypeMetadata",
">",
"types",
",",
"NodeState",
"nodeState",
")",
"{",
"for",
"(",
"TypeMetadata",
"type",
":",
"types",
")",
"{",
"Collection",
"<",
"TypeMetadata",
">",
"superType... | Initializes all relation properties of the given node state with empty
collections.
@param types
The types.
@param nodeState
The state of the entity. | [
"Initializes",
"all",
"relation",
"properties",
"of",
"the",
"given",
"node",
"state",
"with",
"empty",
"collections",
"."
] | train | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/neo4j/remote/src/main/java/com/buschmais/xo/neo4j/remote/impl/datastore/RemoteDatastoreEntityManager.java#L106-L134 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.updateServiceInstanceStatus | public void updateServiceInstanceStatus(String serviceName, String instanceId, OperationalStatus status){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.UpdateServiceInstanceStatus);
UpdateServiceInstanceStatusProtocol p = new UpdateServiceInstanceStatusProtocol(serviceName, instanceId, status);
connection.submitRequest(header, p, null);
} | java | public void updateServiceInstanceStatus(String serviceName, String instanceId, OperationalStatus status){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.UpdateServiceInstanceStatus);
UpdateServiceInstanceStatusProtocol p = new UpdateServiceInstanceStatusProtocol(serviceName, instanceId, status);
connection.submitRequest(header, p, null);
} | [
"public",
"void",
"updateServiceInstanceStatus",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
",",
"OperationalStatus",
"status",
")",
"{",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
"(",
")",
";",
"header",
".",
"setType",
"(",
"Proto... | Update ServiceInstance status.
@param serviceName
the service name.
@param instanceId
the instanceId.
@param status
the OeperationalStatus. | [
"Update",
"ServiceInstance",
"status",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L401-L407 |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/SchemaImpl.java | SchemaImpl.lookupCreateMode | private Mode lookupCreateMode(String name) {
if (name == null)
return null;
name = name.trim();
Mode mode = (Mode)modeMap.get(name);
if (mode == null) {
mode = new Mode(name, defaultBaseMode);
modeMap.put(name, mode);
}
return mode;
} | java | private Mode lookupCreateMode(String name) {
if (name == null)
return null;
name = name.trim();
Mode mode = (Mode)modeMap.get(name);
if (mode == null) {
mode = new Mode(name, defaultBaseMode);
modeMap.put(name, mode);
}
return mode;
} | [
"private",
"Mode",
"lookupCreateMode",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
"null",
";",
"name",
"=",
"name",
".",
"trim",
"(",
")",
";",
"Mode",
"mode",
"=",
"(",
"Mode",
")",
"modeMap",
".",
"get",
"(",... | Gets a mode with the given name from the mode map.
If not present then it creates a new mode extending the default base mode.
@param name The mode to look for or create if it does not exist.
@return Always a not null mode. | [
"Gets",
"a",
"mode",
"with",
"the",
"given",
"name",
"from",
"the",
"mode",
"map",
".",
"If",
"not",
"present",
"then",
"it",
"creates",
"a",
"new",
"mode",
"extending",
"the",
"default",
"base",
"mode",
"."
] | train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/SchemaImpl.java#L1244-L1254 |
wcm-io/wcm-io-handler | commons/src/main/java/io/wcm/handler/commons/dom/AbstractHtmlElementFactory.java | AbstractHtmlElementFactory.createImage | public Image createImage(String src, String alt) {
return this.add(new Image(src, alt));
} | java | public Image createImage(String src, String alt) {
return this.add(new Image(src, alt));
} | [
"public",
"Image",
"createImage",
"(",
"String",
"src",
",",
"String",
"alt",
")",
"{",
"return",
"this",
".",
"add",
"(",
"new",
"Image",
"(",
"src",
",",
"alt",
")",
")",
";",
"}"
] | Creates and adds imgage (img) element.
@param src Html "src" attribute.
@param alt Html "alt" attribute.
@return Html element. | [
"Creates",
"and",
"adds",
"imgage",
"(",
"img",
")",
"element",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/commons/src/main/java/io/wcm/handler/commons/dom/AbstractHtmlElementFactory.java#L137-L139 |
aws/aws-sdk-java | aws-java-sdk-discovery/src/main/java/com/amazonaws/services/applicationdiscovery/model/ContinuousExportDescription.java | ContinuousExportDescription.withSchemaStorageConfig | public ContinuousExportDescription withSchemaStorageConfig(java.util.Map<String, String> schemaStorageConfig) {
setSchemaStorageConfig(schemaStorageConfig);
return this;
} | java | public ContinuousExportDescription withSchemaStorageConfig(java.util.Map<String, String> schemaStorageConfig) {
setSchemaStorageConfig(schemaStorageConfig);
return this;
} | [
"public",
"ContinuousExportDescription",
"withSchemaStorageConfig",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"schemaStorageConfig",
")",
"{",
"setSchemaStorageConfig",
"(",
"schemaStorageConfig",
")",
";",
"return",
"this",
";",
"}"
] | <p>
An object which describes how the data is stored.
</p>
<ul>
<li>
<p>
<code>databaseName</code> - the name of the Glue database used to store the schema.
</p>
</li>
</ul>
@param schemaStorageConfig
An object which describes how the data is stored.</p>
<ul>
<li>
<p>
<code>databaseName</code> - the name of the Glue database used to store the schema.
</p>
</li>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"An",
"object",
"which",
"describes",
"how",
"the",
"data",
"is",
"stored",
".",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"<p",
">",
"<code",
">",
"databaseName<",
"/",
"code",
">",
"-",
"the",
"name",
"of",
"the",
"Glue",
"database",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-discovery/src/main/java/com/amazonaws/services/applicationdiscovery/model/ContinuousExportDescription.java#L1207-L1210 |
MGunlogson/CuckooFilter4J | src/main/java/com/github/mgunlogson/cuckoofilter4j/SegmentedBucketLocker.java | SegmentedBucketLocker.lockBucketsRead | void lockBucketsRead(long i1, long i2) {
int bucket1LockIdx = getBucketLock(i1);
int bucket2LockIdx = getBucketLock(i2);
// always lock segments in same order to avoid deadlocks
if (bucket1LockIdx < bucket2LockIdx) {
lockAry[bucket1LockIdx].readLock();
lockAry[bucket2LockIdx].readLock();
} else if (bucket1LockIdx > bucket2LockIdx) {
lockAry[bucket2LockIdx].readLock();
lockAry[bucket1LockIdx].readLock();
}
// if we get here both indexes are on same segment so only lock once!!!
else {
lockAry[bucket1LockIdx].readLock();
}
} | java | void lockBucketsRead(long i1, long i2) {
int bucket1LockIdx = getBucketLock(i1);
int bucket2LockIdx = getBucketLock(i2);
// always lock segments in same order to avoid deadlocks
if (bucket1LockIdx < bucket2LockIdx) {
lockAry[bucket1LockIdx].readLock();
lockAry[bucket2LockIdx].readLock();
} else if (bucket1LockIdx > bucket2LockIdx) {
lockAry[bucket2LockIdx].readLock();
lockAry[bucket1LockIdx].readLock();
}
// if we get here both indexes are on same segment so only lock once!!!
else {
lockAry[bucket1LockIdx].readLock();
}
} | [
"void",
"lockBucketsRead",
"(",
"long",
"i1",
",",
"long",
"i2",
")",
"{",
"int",
"bucket1LockIdx",
"=",
"getBucketLock",
"(",
"i1",
")",
";",
"int",
"bucket2LockIdx",
"=",
"getBucketLock",
"(",
"i2",
")",
";",
"// always lock segments in same order to avoid deadl... | Locks segments corresponding to bucket indexes in specific order to prevent deadlocks | [
"Locks",
"segments",
"corresponding",
"to",
"bucket",
"indexes",
"in",
"specific",
"order",
"to",
"prevent",
"deadlocks"
] | train | https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/SegmentedBucketLocker.java#L83-L98 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java | AbstractProfileIndexWriter.addProfilePackagesIndex | protected void addProfilePackagesIndex(Content body, String profileName) {
addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary",
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Profile_Summary"),
configuration.getText("doclet.profiles")), body, profileName);
} | java | protected void addProfilePackagesIndex(Content body, String profileName) {
addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary",
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Profile_Summary"),
configuration.getText("doclet.profiles")), body, profileName);
} | [
"protected",
"void",
"addProfilePackagesIndex",
"(",
"Content",
"body",
",",
"String",
"profileName",
")",
"{",
"addProfilePackagesIndexContents",
"(",
"profiles",
",",
"\"doclet.Profile_Summary\"",
",",
"configuration",
".",
"getText",
"(",
"\"doclet.Member_Table_Summary\"... | Adds the frame or non-frame profile packages index to the documentation tree.
@param body the document tree to which the index will be added
@param profileName the name of the profile being documented | [
"Adds",
"the",
"frame",
"or",
"non",
"-",
"frame",
"profile",
"packages",
"index",
"to",
"the",
"documentation",
"tree",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java#L178-L183 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/PayMchAPI.java | PayMchAPI.toolsAuthcodetoopenid | public static AuthcodetoopenidResult toolsAuthcodetoopenid(Authcodetoopenid authcodetoopenid,String key){
Map<String,String> map = MapUtil.objectToMap(authcodetoopenid);
String sign = SignatureUtil.generateSign(map,authcodetoopenid.getSign_type(),key);
authcodetoopenid.setSign(sign);
String shorturlXML = XMLConverUtil.convertToXML(authcodetoopenid);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(xmlHeader)
.setUri(baseURI()+ "/tools/authcodetoopenid")
.setEntity(new StringEntity(shorturlXML,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeXmlResult(httpUriRequest,AuthcodetoopenidResult.class,authcodetoopenid.getSign_type(),key);
} | java | public static AuthcodetoopenidResult toolsAuthcodetoopenid(Authcodetoopenid authcodetoopenid,String key){
Map<String,String> map = MapUtil.objectToMap(authcodetoopenid);
String sign = SignatureUtil.generateSign(map,authcodetoopenid.getSign_type(),key);
authcodetoopenid.setSign(sign);
String shorturlXML = XMLConverUtil.convertToXML(authcodetoopenid);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(xmlHeader)
.setUri(baseURI()+ "/tools/authcodetoopenid")
.setEntity(new StringEntity(shorturlXML,Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeXmlResult(httpUriRequest,AuthcodetoopenidResult.class,authcodetoopenid.getSign_type(),key);
} | [
"public",
"static",
"AuthcodetoopenidResult",
"toolsAuthcodetoopenid",
"(",
"Authcodetoopenid",
"authcodetoopenid",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"MapUtil",
".",
"objectToMap",
"(",
"authcodetoopenid",
")",
"... | 刷卡支付 授权码查询OPENID接口
@param authcodetoopenid authcodetoopenid
@param key key
@return AuthcodetoopenidResult | [
"刷卡支付",
"授权码查询OPENID接口"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/PayMchAPI.java#L393-L404 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/EventManager.java | EventManager.addListener | public void addListener(InstallEventListener listener, String notificationType) {
if (listener == null || notificationType == null)
return;
if (notificationType.isEmpty())
return;
if (listenersMap == null) {
listenersMap = new HashMap<String, Collection<InstallEventListener>>();
}
Collection<InstallEventListener> listeners = listenersMap.get(notificationType);
if (listeners == null) {
listeners = new ArrayList<InstallEventListener>(1);
listenersMap.put(notificationType, listeners);
}
listeners.add(listener);
} | java | public void addListener(InstallEventListener listener, String notificationType) {
if (listener == null || notificationType == null)
return;
if (notificationType.isEmpty())
return;
if (listenersMap == null) {
listenersMap = new HashMap<String, Collection<InstallEventListener>>();
}
Collection<InstallEventListener> listeners = listenersMap.get(notificationType);
if (listeners == null) {
listeners = new ArrayList<InstallEventListener>(1);
listenersMap.put(notificationType, listeners);
}
listeners.add(listener);
} | [
"public",
"void",
"addListener",
"(",
"InstallEventListener",
"listener",
",",
"String",
"notificationType",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
"||",
"notificationType",
"==",
"null",
")",
"return",
";",
"if",
"(",
"notificationType",
".",
"isEmpty",... | Adds an install event listener to the listenersMap with a specified notification type
@param listener InstallEventListener to add
@param notificationType Notification type of listener | [
"Adds",
"an",
"install",
"event",
"listener",
"to",
"the",
"listenersMap",
"with",
"a",
"specified",
"notification",
"type"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/EventManager.java#L35-L49 |
qiniu/java-sdk | src/main/java/com/qiniu/storage/BucketManager.java | BucketManager.asynFetch | public Response asynFetch(String url, String bucket, String key) throws QiniuException {
String requesturl = configuration.apiHost(auth.accessKey, bucket) + "/sisyphus/fetch";
StringMap stringMap = new StringMap().put("url", url).put("bucket", bucket).putNotNull("key", key);
byte[] bodyByte = Json.encode(stringMap).getBytes(Constants.UTF_8);
return client.post(requesturl, bodyByte,
auth.authorizationV2(requesturl, "POST", bodyByte, "application/json"), Client.JsonMime);
} | java | public Response asynFetch(String url, String bucket, String key) throws QiniuException {
String requesturl = configuration.apiHost(auth.accessKey, bucket) + "/sisyphus/fetch";
StringMap stringMap = new StringMap().put("url", url).put("bucket", bucket).putNotNull("key", key);
byte[] bodyByte = Json.encode(stringMap).getBytes(Constants.UTF_8);
return client.post(requesturl, bodyByte,
auth.authorizationV2(requesturl, "POST", bodyByte, "application/json"), Client.JsonMime);
} | [
"public",
"Response",
"asynFetch",
"(",
"String",
"url",
",",
"String",
"bucket",
",",
"String",
"key",
")",
"throws",
"QiniuException",
"{",
"String",
"requesturl",
"=",
"configuration",
".",
"apiHost",
"(",
"auth",
".",
"accessKey",
",",
"bucket",
")",
"+"... | 异步第三方资源抓取 从指定 URL 抓取资源,并将该资源存储到指定空间中。每次只抓取一个文件,抓取时可以指定保存空间名和最终资源名。
主要对于大文件进行抓取
https://developer.qiniu.com/kodo/api/4097/asynch-fetch
@param url 待抓取的文件链接,支持设置多个,以';'分隔
@param bucket 文件抓取后保存的空间
@param key 文件抓取后保存的文件名
@return Response
@throws QiniuException | [
"异步第三方资源抓取",
"从指定",
"URL",
"抓取资源,并将该资源存储到指定空间中。每次只抓取一个文件,抓取时可以指定保存空间名和最终资源名。",
"主要对于大文件进行抓取",
"https",
":",
"//",
"developer",
".",
"qiniu",
".",
"com",
"/",
"kodo",
"/",
"api",
"/",
"4097",
"/",
"asynch",
"-",
"fetch"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L473-L479 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getSummonerSpell | public Future<SummonerSpell> getSummonerSpell(int id, SpellData data, String version, String locale) {
return new DummyFuture<>(handler.getSummonerSpell(id, data, version, locale));
} | java | public Future<SummonerSpell> getSummonerSpell(int id, SpellData data, String version, String locale) {
return new DummyFuture<>(handler.getSummonerSpell(id, data, version, locale));
} | [
"public",
"Future",
"<",
"SummonerSpell",
">",
"getSummonerSpell",
"(",
"int",
"id",
",",
"SpellData",
"data",
",",
"String",
"version",
",",
"String",
"locale",
")",
"{",
"return",
"new",
"DummyFuture",
"<>",
"(",
"handler",
".",
"getSummonerSpell",
"(",
"i... | <p>
Retrieve a specific summoner spell
</p>
This method does not count towards the rate limit and is not affected by the throttle
@param id The id of the spell
@param data Additional information to retrieve
@param version Data dragon version for returned data
@param locale Locale code for returned data
@return The spell
@see <a href=https://developer.riotgames.com/api/methods#!/649/2167>Official API documentation</a> | [
"<p",
">",
"Retrieve",
"a",
"specific",
"summoner",
"spell",
"<",
"/",
"p",
">",
"This",
"method",
"does",
"not",
"count",
"towards",
"the",
"rate",
"limit",
"and",
"is",
"not",
"affected",
"by",
"the",
"throttle"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L825-L827 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/Utils.java | Utils.parseDouble | public static double parseDouble(String val, double defValue){
if(TextUtils.isEmpty(val)) return defValue;
try{
return Double.parseDouble(val);
}catch(NumberFormatException e){
return defValue;
}
} | java | public static double parseDouble(String val, double defValue){
if(TextUtils.isEmpty(val)) return defValue;
try{
return Double.parseDouble(val);
}catch(NumberFormatException e){
return defValue;
}
} | [
"public",
"static",
"double",
"parseDouble",
"(",
"String",
"val",
",",
"double",
"defValue",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"val",
")",
")",
"return",
"defValue",
";",
"try",
"{",
"return",
"Double",
".",
"parseDouble",
"(",
"val... | Parse a double from a String in a safe manner
@param val the string to parse
@param defValue the default value to return in parsing fails
@return the parsed double, or default value | [
"Parse",
"a",
"double",
"from",
"a",
"String",
"in",
"a",
"safe",
"manner"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L294-L301 |
jacobtabak/Fragment-Switcher | sample/src/main/java/me/tabak/fragmentswitcher/sample/DrawerActivity.java | DrawerActivity.initializeList | private void initializeList() {
mListView = (ListView) findViewById(R.id.drawer_list);
mListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
mListView.setAdapter(mListAdapter);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
mFragmentSwitcher.setCurrentItem(position);
mDrawerLayout.closeDrawer(Gravity.START);
}
});
} | java | private void initializeList() {
mListView = (ListView) findViewById(R.id.drawer_list);
mListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
mListView.setAdapter(mListAdapter);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
mFragmentSwitcher.setCurrentItem(position);
mDrawerLayout.closeDrawer(Gravity.START);
}
});
} | [
"private",
"void",
"initializeList",
"(",
")",
"{",
"mListView",
"=",
"(",
"ListView",
")",
"findViewById",
"(",
"R",
".",
"id",
".",
"drawer_list",
")",
";",
"mListAdapter",
"=",
"new",
"ArrayAdapter",
"<",
"String",
">",
"(",
"this",
",",
"android",
".... | Initializes the list that controls which fragment will be shown. | [
"Initializes",
"the",
"list",
"that",
"controls",
"which",
"fragment",
"will",
"be",
"shown",
"."
] | train | https://github.com/jacobtabak/Fragment-Switcher/blob/9d4cd33d68057ebfb8c5910cd49c65fb6bdfdbed/sample/src/main/java/me/tabak/fragmentswitcher/sample/DrawerActivity.java#L79-L90 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/GridFTPClient.java | GridFTPClient.changeModificationTime | public void changeModificationTime(int year, int month, int day, int hour, int min, int sec, String file)
throws IOException, ServerException {
DecimalFormat df2 = new DecimalFormat("00");
DecimalFormat df4 = new DecimalFormat("0000");
String arguments = df4.format(year) + df2.format(month) + df2.format(day) +
df2.format(hour) + df2.format(min) + df2.format(sec) + " " + file;
Command cmd = new Command("SITE UTIME", arguments);
try {
controlChannel.execute(cmd);
}catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
} | java | public void changeModificationTime(int year, int month, int day, int hour, int min, int sec, String file)
throws IOException, ServerException {
DecimalFormat df2 = new DecimalFormat("00");
DecimalFormat df4 = new DecimalFormat("0000");
String arguments = df4.format(year) + df2.format(month) + df2.format(day) +
df2.format(hour) + df2.format(min) + df2.format(sec) + " " + file;
Command cmd = new Command("SITE UTIME", arguments);
try {
controlChannel.execute(cmd);
}catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(urce);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
} | [
"public",
"void",
"changeModificationTime",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
",",
"int",
"hour",
",",
"int",
"min",
",",
"int",
"sec",
",",
"String",
"file",
")",
"throws",
"IOException",
",",
"ServerException",
"{",
"DecimalForm... | Change the modification time of a file.
@param year Modifcation year
@param month Modification month (1-12)
@param day Modification day (1-31)
@param hour Modification hour (0-23)
@param min Modification minutes (0-59)
@param sec Modification seconds (0-59)
@param file file whose modification time should be changed
@throws IOException
@throws ServerException if an error occurred. | [
"Change",
"the",
"modification",
"time",
"of",
"a",
"file",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/GridFTPClient.java#L1111-L1127 |
gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java | ElementService.viewShouldNotShowElement | public void viewShouldNotShowElement(String viewName, String elementName) throws IllegalAccessException,
InterruptedException {
boolean pass = false;
long startOfLookup = System.currentTimeMillis();
int timeoutInMillies = getSeleniumManager().getTimeout() * 1000;
while (!pass) {
WebElement found = getElementFromReferencedView(viewName, elementName);
try {
pass = !found.isDisplayed();
} catch (NoSuchElementException e) {
pass = true;
}
if (!pass) {
Thread.sleep(100);
}
if (System.currentTimeMillis() - startOfLookup > timeoutInMillies) {
String foundLocator = getElementLocatorFromReferencedView(viewName, elementName);
fail("The element \"" + foundLocator + "\" referenced by \"" + elementName + "\" on view/page \"" + viewName + "\" is still found where it is not expected after " + getSeleniumManager().getTimeout() + " seconds.");
break;
}
}
} | java | public void viewShouldNotShowElement(String viewName, String elementName) throws IllegalAccessException,
InterruptedException {
boolean pass = false;
long startOfLookup = System.currentTimeMillis();
int timeoutInMillies = getSeleniumManager().getTimeout() * 1000;
while (!pass) {
WebElement found = getElementFromReferencedView(viewName, elementName);
try {
pass = !found.isDisplayed();
} catch (NoSuchElementException e) {
pass = true;
}
if (!pass) {
Thread.sleep(100);
}
if (System.currentTimeMillis() - startOfLookup > timeoutInMillies) {
String foundLocator = getElementLocatorFromReferencedView(viewName, elementName);
fail("The element \"" + foundLocator + "\" referenced by \"" + elementName + "\" on view/page \"" + viewName + "\" is still found where it is not expected after " + getSeleniumManager().getTimeout() + " seconds.");
break;
}
}
} | [
"public",
"void",
"viewShouldNotShowElement",
"(",
"String",
"viewName",
",",
"String",
"elementName",
")",
"throws",
"IllegalAccessException",
",",
"InterruptedException",
"{",
"boolean",
"pass",
"=",
"false",
";",
"long",
"startOfLookup",
"=",
"System",
".",
"curr... | The referenced view should not show the element identified by elementName
@param viewName
@param elementName
@throws IllegalAccessException
@throws InterruptedException | [
"The",
"referenced",
"view",
"should",
"not",
"show",
"the",
"element",
"identified",
"by",
"elementName"
] | train | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java#L488-L514 |
mpetazzoni/ttorrent | ttorrent-client/src/main/java/com/turn/ttorrent/client/SharedTorrent.java | SharedTorrent.handlePieceSent | @Override
public void handlePieceSent(SharingPeer peer, Piece piece) {
logger.trace("Completed upload of {} to {}.", piece, peer);
myTorrentStatistic.addUploaded(piece.size());
} | java | @Override
public void handlePieceSent(SharingPeer peer, Piece piece) {
logger.trace("Completed upload of {} to {}.", piece, peer);
myTorrentStatistic.addUploaded(piece.size());
} | [
"@",
"Override",
"public",
"void",
"handlePieceSent",
"(",
"SharingPeer",
"peer",
",",
"Piece",
"piece",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Completed upload of {} to {}.\"",
",",
"piece",
",",
"peer",
")",
";",
"myTorrentStatistic",
".",
"addUploaded",
"(... | Piece upload completion handler.
<p/>
<p>
When a piece has been sent to a peer, we just record that we sent that
many bytes. If the piece is valid on the peer's side, it will send us a
HAVE message and we'll record that the piece is available on the peer at
that moment (see <code>handlePieceAvailability()</code>).
</p>
@param peer The peer we got this piece from.
@param piece The piece in question. | [
"Piece",
"upload",
"completion",
"handler",
".",
"<p",
"/",
">",
"<p",
">",
"When",
"a",
"piece",
"has",
"been",
"sent",
"to",
"a",
"peer",
"we",
"just",
"record",
"that",
"we",
"sent",
"that",
"many",
"bytes",
".",
"If",
"the",
"piece",
"is",
"valid... | train | https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-client/src/main/java/com/turn/ttorrent/client/SharedTorrent.java#L646-L650 |
mlhartme/mork | src/main/java/net/oneandone/mork/reflect/Method.java | Method.forName | public static Selection forName(Class cl, String name) {
java.lang.reflect.Method[] all;
int i;
List<Function> lst;
Function fn;
all = cl.getDeclaredMethods();
lst = new ArrayList<Function>();
for (i = 0; i < all.length; i++) {
if (name.equals(all[i].getName())) {
fn = create(all[i]);
if (fn != null) {
lst.add(fn);
}
}
}
return new Selection(lst);
} | java | public static Selection forName(Class cl, String name) {
java.lang.reflect.Method[] all;
int i;
List<Function> lst;
Function fn;
all = cl.getDeclaredMethods();
lst = new ArrayList<Function>();
for (i = 0; i < all.length; i++) {
if (name.equals(all[i].getName())) {
fn = create(all[i]);
if (fn != null) {
lst.add(fn);
}
}
}
return new Selection(lst);
} | [
"public",
"static",
"Selection",
"forName",
"(",
"Class",
"cl",
",",
"String",
"name",
")",
"{",
"java",
".",
"lang",
".",
"reflect",
".",
"Method",
"[",
"]",
"all",
";",
"int",
"i",
";",
"List",
"<",
"Function",
">",
"lst",
";",
"Function",
"fn",
... | Gets all valid Methods from the specified class with the
specified name.
@param cl Class to look at
@param name the Function name to look for
@return retrieves all Methods found | [
"Gets",
"all",
"valid",
"Methods",
"from",
"the",
"specified",
"class",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/reflect/Method.java#L67-L84 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java | CmsCloneModuleThread.alterPrefix | private String alterPrefix(String word, String oldPrefix, String newPrefix) {
if (word.startsWith(oldPrefix)) {
return word.replaceFirst(oldPrefix, newPrefix);
}
return (newPrefix + word);
} | java | private String alterPrefix(String word, String oldPrefix, String newPrefix) {
if (word.startsWith(oldPrefix)) {
return word.replaceFirst(oldPrefix, newPrefix);
}
return (newPrefix + word);
} | [
"private",
"String",
"alterPrefix",
"(",
"String",
"word",
",",
"String",
"oldPrefix",
",",
"String",
"newPrefix",
")",
"{",
"if",
"(",
"word",
".",
"startsWith",
"(",
"oldPrefix",
")",
")",
"{",
"return",
"word",
".",
"replaceFirst",
"(",
"oldPrefix",
","... | Manipulates a string by cutting of a prefix, if present, and adding a new prefix.
@param word the string to be manipulated
@param oldPrefix the old prefix that should be replaced
@param newPrefix the new prefix that is added
@return the manipulated string | [
"Manipulates",
"a",
"string",
"by",
"cutting",
"of",
"a",
"prefix",
"if",
"present",
"and",
"adding",
"a",
"new",
"prefix",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java#L477-L483 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpd/MPDUtility.java | MPDUtility.fileHexDump | public static final void fileHexDump(String fileName, byte[] data)
{
try
{
FileOutputStream os = new FileOutputStream(fileName);
os.write(hexdump(data, true, 16, "").getBytes());
os.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
} | java | public static final void fileHexDump(String fileName, byte[] data)
{
try
{
FileOutputStream os = new FileOutputStream(fileName);
os.write(hexdump(data, true, 16, "").getBytes());
os.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
} | [
"public",
"static",
"final",
"void",
"fileHexDump",
"(",
"String",
"fileName",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"try",
"{",
"FileOutputStream",
"os",
"=",
"new",
"FileOutputStream",
"(",
"fileName",
")",
";",
"os",
".",
"write",
"(",
"hexdump",
"... | Writes a hex dump to a file for a large byte array.
@param fileName output file name
@param data target data | [
"Writes",
"a",
"hex",
"dump",
"to",
"a",
"file",
"for",
"a",
"large",
"byte",
"array",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPDUtility.java#L465-L478 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/AppEventsLogger.java | AppEventsLogger.logSdkEvent | public void logSdkEvent(String eventName, Double valueToSum, Bundle parameters) {
logEvent(eventName, valueToSum, parameters, true);
} | java | public void logSdkEvent(String eventName, Double valueToSum, Bundle parameters) {
logEvent(eventName, valueToSum, parameters, true);
} | [
"public",
"void",
"logSdkEvent",
"(",
"String",
"eventName",
",",
"Double",
"valueToSum",
",",
"Bundle",
"parameters",
")",
"{",
"logEvent",
"(",
"eventName",
",",
"valueToSum",
",",
"parameters",
",",
"true",
")",
";",
"}"
] | This method is intended only for internal use by the Facebook SDK and other use is unsupported. | [
"This",
"method",
"is",
"intended",
"only",
"for",
"internal",
"use",
"by",
"the",
"Facebook",
"SDK",
"and",
"other",
"use",
"is",
"unsupported",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/AppEventsLogger.java#L564-L566 |
CloudBees-community/cloudbees-log4j-extras | src/main/java/com/cloudbees/log4j/jmx/Log4jConfigurer.java | Log4jConfigurer.setLoggerLevel | public void setLoggerLevel(@Nonnull String loggerName, @Nullable String level) {
logger.info("setLoggerLevel(" + loggerName + "," + level + ")");
try {
Level levelAsObject = Level.toLevel(level);
LogManager.getLogger(loggerName).setLevel(levelAsObject);
} catch (RuntimeException e) {
logger.warn("Exception setting logger " + loggerName + " to level " + level, e);
throw e;
}
} | java | public void setLoggerLevel(@Nonnull String loggerName, @Nullable String level) {
logger.info("setLoggerLevel(" + loggerName + "," + level + ")");
try {
Level levelAsObject = Level.toLevel(level);
LogManager.getLogger(loggerName).setLevel(levelAsObject);
} catch (RuntimeException e) {
logger.warn("Exception setting logger " + loggerName + " to level " + level, e);
throw e;
}
} | [
"public",
"void",
"setLoggerLevel",
"(",
"@",
"Nonnull",
"String",
"loggerName",
",",
"@",
"Nullable",
"String",
"level",
")",
"{",
"logger",
".",
"info",
"(",
"\"setLoggerLevel(\"",
"+",
"loggerName",
"+",
"\",\"",
"+",
"level",
"+",
"\")\"",
")",
";",
"t... | Set the level of the given logger.
@param loggerName name of the logger to set
@param level new level. <code>null</code> or unknown level will set logger level to <code>null</code>
@see Logger#setLevel(org.apache.log4j.Level) | [
"Set",
"the",
"level",
"of",
"the",
"given",
"logger",
"."
] | train | https://github.com/CloudBees-community/cloudbees-log4j-extras/blob/cd204b9a4c02d69ff9adc4dbda65f90fc0de98f7/src/main/java/com/cloudbees/log4j/jmx/Log4jConfigurer.java#L131-L140 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/common/internal/RenderingUtils.java | RenderingUtils.getFontMetrics | public static FontMetrics getFontMetrics(JComponent c, Graphics g) {
if (getFontMetricsMethod != null) {
try {
return (FontMetrics) getFontMetricsMethod.invoke(null, new Object[]{c, g});
} catch (IllegalArgumentException e) {
// Use the fallback
} catch (IllegalAccessException e) {
// Use the fallback
} catch (InvocationTargetException e) {
// Use the fallback
}
}
return c.getFontMetrics(g.getFont());
} | java | public static FontMetrics getFontMetrics(JComponent c, Graphics g) {
if (getFontMetricsMethod != null) {
try {
return (FontMetrics) getFontMetricsMethod.invoke(null, new Object[]{c, g});
} catch (IllegalArgumentException e) {
// Use the fallback
} catch (IllegalAccessException e) {
// Use the fallback
} catch (InvocationTargetException e) {
// Use the fallback
}
}
return c.getFontMetrics(g.getFont());
} | [
"public",
"static",
"FontMetrics",
"getFontMetrics",
"(",
"JComponent",
"c",
",",
"Graphics",
"g",
")",
"{",
"if",
"(",
"getFontMetricsMethod",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"(",
"FontMetrics",
")",
"getFontMetricsMethod",
".",
"invoke",
"(",
... | Returns the FontMetrics for the current Font of the passed in Graphics. This method is used
when a Graphics is available, typically when painting. If a Graphics is not available the
JComponent method of the same name should be used.
<p>
Callers should pass in a non-null JComponent, the exception to this is if a JComponent is not
readily available at the time of painting.
<p>
This does not necessarily return the FontMetrics from the Graphics.
@param c JComponent requesting FontMetrics, may be null
@param g Graphics Graphics
@return the FontMetrics | [
"Returns",
"the",
"FontMetrics",
"for",
"the",
"current",
"Font",
"of",
"the",
"passed",
"in",
"Graphics",
".",
"This",
"method",
"is",
"used",
"when",
"a",
"Graphics",
"is",
"available",
"typically",
"when",
"painting",
".",
"If",
"a",
"Graphics",
"is",
"... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/internal/RenderingUtils.java#L169-L182 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listIntentsAsync | public Observable<List<IntentClassifier>> listIntentsAsync(UUID appId, String versionId, ListIntentsOptionalParameter listIntentsOptionalParameter) {
return listIntentsWithServiceResponseAsync(appId, versionId, listIntentsOptionalParameter).map(new Func1<ServiceResponse<List<IntentClassifier>>, List<IntentClassifier>>() {
@Override
public List<IntentClassifier> call(ServiceResponse<List<IntentClassifier>> response) {
return response.body();
}
});
} | java | public Observable<List<IntentClassifier>> listIntentsAsync(UUID appId, String versionId, ListIntentsOptionalParameter listIntentsOptionalParameter) {
return listIntentsWithServiceResponseAsync(appId, versionId, listIntentsOptionalParameter).map(new Func1<ServiceResponse<List<IntentClassifier>>, List<IntentClassifier>>() {
@Override
public List<IntentClassifier> call(ServiceResponse<List<IntentClassifier>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"IntentClassifier",
">",
">",
"listIntentsAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListIntentsOptionalParameter",
"listIntentsOptionalParameter",
")",
"{",
"return",
"listIntentsWithServiceResponseAsync",
"(... | Gets information about the intent models.
@param appId The application ID.
@param versionId The version ID.
@param listIntentsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<IntentClassifier> object | [
"Gets",
"information",
"about",
"the",
"intent",
"models",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L781-L788 |
ppiastucki/recast4j | detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java | PathCorridor.moveTargetPosition | public boolean moveTargetPosition(float[] npos, NavMeshQuery navquery, QueryFilter filter) {
// Move along navmesh and update new position.
Result<MoveAlongSurfaceResult> masResult = navquery.moveAlongSurface(m_path.get(m_path.size() - 1), m_target,
npos, filter);
if (masResult.succeeded()) {
m_path = mergeCorridorEndMoved(m_path, masResult.result.getVisited());
// TODO: should we do that?
// Adjust the position to stay on top of the navmesh.
/*
* float h = m_target[1]; navquery->getPolyHeight(m_path[m_npath-1],
* result, &h); result[1] = h;
*/
vCopy(m_target, masResult.result.getResultPos());
return true;
}
return false;
} | java | public boolean moveTargetPosition(float[] npos, NavMeshQuery navquery, QueryFilter filter) {
// Move along navmesh and update new position.
Result<MoveAlongSurfaceResult> masResult = navquery.moveAlongSurface(m_path.get(m_path.size() - 1), m_target,
npos, filter);
if (masResult.succeeded()) {
m_path = mergeCorridorEndMoved(m_path, masResult.result.getVisited());
// TODO: should we do that?
// Adjust the position to stay on top of the navmesh.
/*
* float h = m_target[1]; navquery->getPolyHeight(m_path[m_npath-1],
* result, &h); result[1] = h;
*/
vCopy(m_target, masResult.result.getResultPos());
return true;
}
return false;
} | [
"public",
"boolean",
"moveTargetPosition",
"(",
"float",
"[",
"]",
"npos",
",",
"NavMeshQuery",
"navquery",
",",
"QueryFilter",
"filter",
")",
"{",
"// Move along navmesh and update new position.",
"Result",
"<",
"MoveAlongSurfaceResult",
">",
"masResult",
"=",
"navquer... | Moves the target from the curent location to the desired location, adjusting the corridor as needed to reflect
the change. Behavior: - The movement is constrained to the surface of the navigation mesh. - The corridor is
automatically adjusted (shorted or lengthened) in order to remain valid. - The new target will be located in the
adjusted corridor's last polygon.
The expected use case is that the desired target will be 'near' the current corridor. What is considered 'near'
depends on local polygon density, query search extents, etc. The resulting target will differ from the desired
target if the desired target is not on the navigation mesh, or it can't be reached using a local search.
@param npos
The desired new target position. [(x, y, z)]
@param navquery
The query object used to build the corridor.
@param filter
The filter to apply to the operation. | [
"Moves",
"the",
"target",
"from",
"the",
"curent",
"location",
"to",
"the",
"desired",
"location",
"adjusting",
"the",
"corridor",
"as",
"needed",
"to",
"reflect",
"the",
"change",
".",
"Behavior",
":",
"-",
"The",
"movement",
"is",
"constrained",
"to",
"the... | train | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java#L417-L433 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/ApkParser.java | ApkParser.compXmlString | private String compXmlString(byte[] xml, int sitOff, int stOff, int strInd) {
if (strInd < 0) return null;
int strOff = stOff + LEW(xml, sitOff + strInd * 4);
return compXmlStringAt(xml, strOff);
} | java | private String compXmlString(byte[] xml, int sitOff, int stOff, int strInd) {
if (strInd < 0) return null;
int strOff = stOff + LEW(xml, sitOff + strInd * 4);
return compXmlStringAt(xml, strOff);
} | [
"private",
"String",
"compXmlString",
"(",
"byte",
"[",
"]",
"xml",
",",
"int",
"sitOff",
",",
"int",
"stOff",
",",
"int",
"strInd",
")",
"{",
"if",
"(",
"strInd",
"<",
"0",
")",
"return",
"null",
";",
"int",
"strOff",
"=",
"stOff",
"+",
"LEW",
"("... | <p>Get a {@link String} of the value stored in StringTable format at offset strOff, as
calculated from an initial starting point and a number of words to traverse.
</p>
@param xml The {@link Byte} array to be processed.
@param sitOff An {@link Integer} value indicating the initial offset within the supplied
{@link Byte} array.
@param stOff An {@link Integer} value indicating the initial offset of the supplied array.
@param strInd An {@link Integer} value indicating the string index to use in the LEW calculation.
@return A call to {@link #compXmlStringAt(byte[], int)}, with the result of the offset calculation
of this method as the {@link Integer} parameter. | [
"<p",
">",
"Get",
"a",
"{",
"@link",
"String",
"}",
"of",
"the",
"value",
"stored",
"in",
"StringTable",
"format",
"at",
"offset",
"strOff",
"as",
"calculated",
"from",
"an",
"initial",
"starting",
"point",
"and",
"a",
"number",
"of",
"words",
"to",
"tra... | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ApkParser.java#L246-L250 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/process/ProcessFaxClientSpi.java | ProcessFaxClientSpi.updateFaxJob | protected void updateFaxJob(FaxJob faxJob,ProcessOutput processOutput,FaxActionType faxActionType)
{
if(this.processOutputHandler!=null)
{
//update fax job
this.processOutputHandler.updateFaxJob(this,faxJob,processOutput,faxActionType);
}
} | java | protected void updateFaxJob(FaxJob faxJob,ProcessOutput processOutput,FaxActionType faxActionType)
{
if(this.processOutputHandler!=null)
{
//update fax job
this.processOutputHandler.updateFaxJob(this,faxJob,processOutput,faxActionType);
}
} | [
"protected",
"void",
"updateFaxJob",
"(",
"FaxJob",
"faxJob",
",",
"ProcessOutput",
"processOutput",
",",
"FaxActionType",
"faxActionType",
")",
"{",
"if",
"(",
"this",
".",
"processOutputHandler",
"!=",
"null",
")",
"{",
"//update fax job",
"this",
".",
"processO... | Updates the fax job based on the data from the process output.
@param faxJob
The fax job object
@param processOutput
The process output
@param faxActionType
The fax action type | [
"Updates",
"the",
"fax",
"job",
"based",
"on",
"the",
"data",
"from",
"the",
"process",
"output",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/process/ProcessFaxClientSpi.java#L579-L586 |
foundation-runtime/service-directory | 1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/HeartbeatDirectoryRegistrationService.java | HeartbeatDirectoryRegistrationService.getCachedServiceInstance | private CachedProviderServiceInstance getCachedServiceInstance(
String serviceName, String providerAddress) {
ServiceInstanceId id = new ServiceInstanceId(serviceName, providerAddress);
return getCacheServiceInstances().get(id);
} | java | private CachedProviderServiceInstance getCachedServiceInstance(
String serviceName, String providerAddress) {
ServiceInstanceId id = new ServiceInstanceId(serviceName, providerAddress);
return getCacheServiceInstances().get(id);
} | [
"private",
"CachedProviderServiceInstance",
"getCachedServiceInstance",
"(",
"String",
"serviceName",
",",
"String",
"providerAddress",
")",
"{",
"ServiceInstanceId",
"id",
"=",
"new",
"ServiceInstanceId",
"(",
"serviceName",
",",
"providerAddress",
")",
";",
"return",
... | Get the Cached ProvidedServiceInstance by serviceName and providerAddress.
It is thread safe.
@param serviceName
the serviceName
@param providerAddress
the providerAddress
@return
the CachedProviderServiceInstance | [
"Get",
"the",
"Cached",
"ProvidedServiceInstance",
"by",
"serviceName",
"and",
"providerAddress",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/registration/HeartbeatDirectoryRegistrationService.java#L361-L367 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/ArrayUtils.java | ArrayUtils.getFirst | @NullSafe
@SafeVarargs
public static <T> T getFirst(T... array) {
return getFirst(array, null);
} | java | @NullSafe
@SafeVarargs
public static <T> T getFirst(T... array) {
return getFirst(array, null);
} | [
"@",
"NullSafe",
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"T",
"getFirst",
"(",
"T",
"...",
"array",
")",
"{",
"return",
"getFirst",
"(",
"array",
",",
"null",
")",
";",
"}"
] | Returns the first element (at index 0) in the {@code array}.
@param <T> {@link Class} type of elements in the array.
@param array array from which to extract the first element.
@return the first element in the array or {@literal null}
if the {@code array} is {@literal null} or empty.
@see #getFirst(Object[], Object) | [
"Returns",
"the",
"first",
"element",
"(",
"at",
"index",
"0",
")",
"in",
"the",
"{",
"@code",
"array",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L453-L457 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.multAddTransB | public static void multAddTransB(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c )
{
MatrixMatrixMult_DDRM.multAddTransB(a,b,c);
} | java | public static void multAddTransB(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c )
{
MatrixMatrixMult_DDRM.multAddTransB(a,b,c);
} | [
"public",
"static",
"void",
"multAddTransB",
"(",
"DMatrix1Row",
"a",
",",
"DMatrix1Row",
"b",
",",
"DMatrix1Row",
"c",
")",
"{",
"MatrixMatrixMult_DDRM",
".",
"multAddTransB",
"(",
"a",
",",
"b",
",",
"c",
")",
";",
"}"
] | <p>
Performs the following operation:<br>
<br>
c = c + a * b<sup>T</sup> <br>
c<sub>ij</sub> = c<sub>ij</sub> + ∑<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>jk</sub>}
</p>
@param a The left matrix in the multiplication operation. Not modified.
@param b The right matrix in the multiplication operation. Not modified.
@param c Where the results of the operation are stored. Modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"c",
"=",
"c",
"+",
"a",
"*",
"b<sup",
">",
"T<",
"/",
"sup",
">",
"<br",
">",
"c<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"c<sub",
">",
"ij<",
"/",
"sub",
">... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L435-L438 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.setPassword | public void setPassword(String username, String newPassword) throws CmsException {
m_securityManager.setPassword(m_context, username, newPassword);
} | java | public void setPassword(String username, String newPassword) throws CmsException {
m_securityManager.setPassword(m_context, username, newPassword);
} | [
"public",
"void",
"setPassword",
"(",
"String",
"username",
",",
"String",
"newPassword",
")",
"throws",
"CmsException",
"{",
"m_securityManager",
".",
"setPassword",
"(",
"m_context",
",",
"username",
",",
"newPassword",
")",
";",
"}"
] | Sets the password for a user.<p>
@param username the name of the user
@param newPassword the new password
@throws CmsException if operation was not successful | [
"Sets",
"the",
"password",
"for",
"a",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3840-L3843 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ling/Sentence.java | Sentence.listToString | public static <T> String listToString(List<T> list, final boolean justValue) {
return listToString(list, justValue, null);
} | java | public static <T> String listToString(List<T> list, final boolean justValue) {
return listToString(list, justValue, null);
} | [
"public",
"static",
"<",
"T",
">",
"String",
"listToString",
"(",
"List",
"<",
"T",
">",
"list",
",",
"final",
"boolean",
"justValue",
")",
"{",
"return",
"listToString",
"(",
"list",
",",
"justValue",
",",
"null",
")",
";",
"}"
] | Returns the sentence as a string with a space between words.
Designed to work robustly, even if the elements stored in the
'Sentence' are not of type Label.
This one uses the default separators for any word type that uses
separators, such as TaggedWord.
@param justValue If <code>true</code> and the elements are of type
<code>Label</code>, return just the
<code>value()</code> of the <code>Label</code> of each word;
otherwise,
call the <code>toString()</code> method on each item.
@return The sentence in String form | [
"Returns",
"the",
"sentence",
"as",
"a",
"string",
"with",
"a",
"space",
"between",
"words",
".",
"Designed",
"to",
"work",
"robustly",
"even",
"if",
"the",
"elements",
"stored",
"in",
"the",
"Sentence",
"are",
"not",
"of",
"type",
"Label",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ling/Sentence.java#L146-L148 |
indeedeng/util | urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java | ParseUtils.urlDecodeInto | public static void urlDecodeInto(CharSequence input, int start, int end, StringBuilder result) {
urlDecodeInto(input, start, end, result, false);
} | java | public static void urlDecodeInto(CharSequence input, int start, int end, StringBuilder result) {
urlDecodeInto(input, start, end, result, false);
} | [
"public",
"static",
"void",
"urlDecodeInto",
"(",
"CharSequence",
"input",
",",
"int",
"start",
",",
"int",
"end",
",",
"StringBuilder",
"result",
")",
"{",
"urlDecodeInto",
"(",
"input",
",",
"start",
",",
"end",
",",
"result",
",",
"false",
")",
";",
"... | /* URL decode CharSequence @param input into result given start and end offsets
Assumes UTF-8 encoding
Avoids creating intermediate String objects unlike UrlDecoder in java. | [
"/",
"*",
"URL",
"decode",
"CharSequence"
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java#L209-L211 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/Utils.java | Utils.truncateTo | public static String truncateTo(String string, int maxLength) {
if (string.length() <= maxLength) {
return string;
}
return string.substring(0, maxLength);
} | java | public static String truncateTo(String string, int maxLength) {
if (string.length() <= maxLength) {
return string;
}
return string.substring(0, maxLength);
} | [
"public",
"static",
"String",
"truncateTo",
"(",
"String",
"string",
",",
"int",
"maxLength",
")",
"{",
"if",
"(",
"string",
".",
"length",
"(",
")",
"<=",
"maxLength",
")",
"{",
"return",
"string",
";",
"}",
"return",
"string",
".",
"substring",
"(",
... | Ensure that the given string is no longer than the given max length, truncating it
if necessary. If string.length() is <= maxLength, the same string is returned.
Otherwise, a substring of the first maxLength characters is returned.
@param string String to test.
@param maxLength Maximum length.
@return Same or truncated string as described above. | [
"Ensure",
"that",
"the",
"given",
"string",
"is",
"no",
"longer",
"than",
"the",
"given",
"max",
"length",
"truncating",
"it",
"if",
"necessary",
".",
"If",
"string",
".",
"length",
"()",
"is",
"<",
";",
"=",
"maxLength",
"the",
"same",
"string",
"is",... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L2005-L2010 |
mozilla/rhino | src/org/mozilla/javascript/Parser.java | Parser.arrayComprehension | private AstNode arrayComprehension(AstNode result, int pos)
throws IOException
{
List<ArrayComprehensionLoop> loops =
new ArrayList<ArrayComprehensionLoop>();
while (peekToken() == Token.FOR) {
loops.add(arrayComprehensionLoop());
}
int ifPos = -1;
ConditionData data = null;
if (peekToken() == Token.IF) {
consumeToken();
ifPos = ts.tokenBeg - pos;
data = condition();
}
mustMatchToken(Token.RB, "msg.no.bracket.arg", true);
ArrayComprehension pn = new ArrayComprehension(pos, ts.tokenEnd - pos);
pn.setResult(result);
pn.setLoops(loops);
if (data != null) {
pn.setIfPosition(ifPos);
pn.setFilter(data.condition);
pn.setFilterLp(data.lp - pos);
pn.setFilterRp(data.rp - pos);
}
return pn;
} | java | private AstNode arrayComprehension(AstNode result, int pos)
throws IOException
{
List<ArrayComprehensionLoop> loops =
new ArrayList<ArrayComprehensionLoop>();
while (peekToken() == Token.FOR) {
loops.add(arrayComprehensionLoop());
}
int ifPos = -1;
ConditionData data = null;
if (peekToken() == Token.IF) {
consumeToken();
ifPos = ts.tokenBeg - pos;
data = condition();
}
mustMatchToken(Token.RB, "msg.no.bracket.arg", true);
ArrayComprehension pn = new ArrayComprehension(pos, ts.tokenEnd - pos);
pn.setResult(result);
pn.setLoops(loops);
if (data != null) {
pn.setIfPosition(ifPos);
pn.setFilter(data.condition);
pn.setFilterLp(data.lp - pos);
pn.setFilterRp(data.rp - pos);
}
return pn;
} | [
"private",
"AstNode",
"arrayComprehension",
"(",
"AstNode",
"result",
",",
"int",
"pos",
")",
"throws",
"IOException",
"{",
"List",
"<",
"ArrayComprehensionLoop",
">",
"loops",
"=",
"new",
"ArrayList",
"<",
"ArrayComprehensionLoop",
">",
"(",
")",
";",
"while",
... | Parse a JavaScript 1.7 Array comprehension.
@param result the first expression after the opening left-bracket
@param pos start of LB token that begins the array comprehension
@return the array comprehension or an error node | [
"Parse",
"a",
"JavaScript",
"1",
".",
"7",
"Array",
"comprehension",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L3323-L3349 |
apereo/cas | core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/RegisteredServiceAccessStrategyUtils.java | RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed | public static void ensureServiceAccessIsAllowed(final String service, final RegisteredService registeredService) {
if (registeredService == null) {
val msg = String.format("Unauthorized Service Access. Service [%s] is not found in service registry.", service);
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
val msg = String.format("Unauthorized Service Access. Service [%s] is not enabled in service registry.", service);
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!ensureServiceIsNotExpired(registeredService)) {
val msg = String.format("Expired Service Access. Service [%s] has been expired", service);
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_EXPIRED_SERVICE, msg);
}
} | java | public static void ensureServiceAccessIsAllowed(final String service, final RegisteredService registeredService) {
if (registeredService == null) {
val msg = String.format("Unauthorized Service Access. Service [%s] is not found in service registry.", service);
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
val msg = String.format("Unauthorized Service Access. Service [%s] is not enabled in service registry.", service);
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!ensureServiceIsNotExpired(registeredService)) {
val msg = String.format("Expired Service Access. Service [%s] has been expired", service);
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_EXPIRED_SERVICE, msg);
}
} | [
"public",
"static",
"void",
"ensureServiceAccessIsAllowed",
"(",
"final",
"String",
"service",
",",
"final",
"RegisteredService",
"registeredService",
")",
"{",
"if",
"(",
"registeredService",
"==",
"null",
")",
"{",
"val",
"msg",
"=",
"String",
".",
"format",
"... | Ensure service access is allowed.
@param service the service
@param registeredService the registered service | [
"Ensure",
"service",
"access",
"is",
"allowed",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/RegisteredServiceAccessStrategyUtils.java#L50-L66 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java | ContentSpecParser.parseLevelLine | protected Level parseLevelLine(final ParserData parserData, final String line, int lineNumber) throws ParsingException {
String tempInput[] = StringUtilities.split(line, ':', 2);
// Remove the whitespace from each value in the split array
tempInput = CollectionUtilities.trimStringArray(tempInput);
if (tempInput.length >= 1) {
final LevelType levelType = LevelType.getLevelType(tempInput[0]);
Level retValue = null;
try {
retValue = parseLevel(parserData, lineNumber, levelType, line);
} catch (ParsingException e) {
log.error(e.getMessage());
// Create a basic level so the rest of the spec can be processed
retValue = createEmptyLevelFromType(lineNumber, levelType, line);
retValue.setUniqueId("L" + lineNumber);
}
parserData.getLevels().put(retValue.getUniqueId(), retValue);
return retValue;
} else {
throw new ParsingException(format(ProcessorConstants.ERROR_LEVEL_FORMAT_MSG, lineNumber, line));
}
} | java | protected Level parseLevelLine(final ParserData parserData, final String line, int lineNumber) throws ParsingException {
String tempInput[] = StringUtilities.split(line, ':', 2);
// Remove the whitespace from each value in the split array
tempInput = CollectionUtilities.trimStringArray(tempInput);
if (tempInput.length >= 1) {
final LevelType levelType = LevelType.getLevelType(tempInput[0]);
Level retValue = null;
try {
retValue = parseLevel(parserData, lineNumber, levelType, line);
} catch (ParsingException e) {
log.error(e.getMessage());
// Create a basic level so the rest of the spec can be processed
retValue = createEmptyLevelFromType(lineNumber, levelType, line);
retValue.setUniqueId("L" + lineNumber);
}
parserData.getLevels().put(retValue.getUniqueId(), retValue);
return retValue;
} else {
throw new ParsingException(format(ProcessorConstants.ERROR_LEVEL_FORMAT_MSG, lineNumber, line));
}
} | [
"protected",
"Level",
"parseLevelLine",
"(",
"final",
"ParserData",
"parserData",
",",
"final",
"String",
"line",
",",
"int",
"lineNumber",
")",
"throws",
"ParsingException",
"{",
"String",
"tempInput",
"[",
"]",
"=",
"StringUtilities",
".",
"split",
"(",
"line"... | Processes a line that represents the start of a Content Specification Level. This method creates the level based on the data in
the line and then changes the current processing level to the new level.
@param parserData
@param line The line to be processed as a level.
@return True if the line was processed without errors, otherwise false. | [
"Processes",
"a",
"line",
"that",
"represents",
"the",
"start",
"of",
"a",
"Content",
"Specification",
"Level",
".",
"This",
"method",
"creates",
"the",
"level",
"based",
"on",
"the",
"data",
"in",
"the",
"line",
"and",
"then",
"changes",
"the",
"current",
... | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L608-L631 |
WASdev/standards.jsr352.jbatch | com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/impl/SplitControllerImpl.java | SplitControllerImpl.buildSubJobBatchWorkUnits | private void buildSubJobBatchWorkUnits() {
List<Flow> flows = this.split.getFlows();
parallelBatchWorkUnits = new ArrayList<BatchFlowInSplitWorkUnit>();
// Build all sub jobs from flows in split
synchronized (subJobs) {
for (Flow flow : flows) {
subJobs.add(PartitionedStepBuilder.buildFlowInSplitSubJob(jobContext, this.split, flow));
}
// Go back to earlier idea that we may have seen this id before, and need a special "always restart" behavior
// for split-flows.
for (JSLJob job : subJobs) {
int count = batchKernel.getJobInstanceCount(job.getId());
FlowInSplitBuilderConfig config = new FlowInSplitBuilderConfig(job, completedWorkQueue, rootJobExecutionId);
if (count == 0) {
parallelBatchWorkUnits.add(batchKernel.buildNewFlowInSplitWorkUnit(config));
} else if (count == 1) {
parallelBatchWorkUnits.add(batchKernel.buildOnRestartFlowInSplitWorkUnit(config));
} else {
throw new IllegalStateException("There is an inconsistency somewhere in the internal subjob creation");
}
}
}
} | java | private void buildSubJobBatchWorkUnits() {
List<Flow> flows = this.split.getFlows();
parallelBatchWorkUnits = new ArrayList<BatchFlowInSplitWorkUnit>();
// Build all sub jobs from flows in split
synchronized (subJobs) {
for (Flow flow : flows) {
subJobs.add(PartitionedStepBuilder.buildFlowInSplitSubJob(jobContext, this.split, flow));
}
// Go back to earlier idea that we may have seen this id before, and need a special "always restart" behavior
// for split-flows.
for (JSLJob job : subJobs) {
int count = batchKernel.getJobInstanceCount(job.getId());
FlowInSplitBuilderConfig config = new FlowInSplitBuilderConfig(job, completedWorkQueue, rootJobExecutionId);
if (count == 0) {
parallelBatchWorkUnits.add(batchKernel.buildNewFlowInSplitWorkUnit(config));
} else if (count == 1) {
parallelBatchWorkUnits.add(batchKernel.buildOnRestartFlowInSplitWorkUnit(config));
} else {
throw new IllegalStateException("There is an inconsistency somewhere in the internal subjob creation");
}
}
}
} | [
"private",
"void",
"buildSubJobBatchWorkUnits",
"(",
")",
"{",
"List",
"<",
"Flow",
">",
"flows",
"=",
"this",
".",
"split",
".",
"getFlows",
"(",
")",
";",
"parallelBatchWorkUnits",
"=",
"new",
"ArrayList",
"<",
"BatchFlowInSplitWorkUnit",
">",
"(",
")",
";... | Note we restart all flows. There is no concept of "the flow completed". It is only steps
within the flows that may have already completed and so may not have needed to be rerun. | [
"Note",
"we",
"restart",
"all",
"flows",
".",
"There",
"is",
"no",
"concept",
"of",
"the",
"flow",
"completed",
".",
"It",
"is",
"only",
"steps",
"within",
"the",
"flows",
"that",
"may",
"have",
"already",
"completed",
"and",
"so",
"may",
"not",
"have",
... | train | https://github.com/WASdev/standards.jsr352.jbatch/blob/e267e79dccd4f0bd4bf9c2abc41a8a47b65be28f/com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/impl/SplitControllerImpl.java#L138-L163 |
aboutsip/sipstack | sipstack-netty-codec-sip/src/main/java/io/sipstack/netty/codec/sip/AbstractConnection.java | AbstractConnection.toByteBuf | protected ByteBuf toByteBuf(final SipMessage msg) {
try {
final Buffer b = msg.toBuffer();
final int capacity = b.capacity() + 2;
final ByteBuf buffer = this.channel.alloc().buffer(capacity, capacity);
for (int i = 0; i < b.getReadableBytes(); ++i) {
buffer.writeByte(b.getByte(i));
}
buffer.writeByte(SipParser.CR);
buffer.writeByte(SipParser.LF);
return buffer;
} catch (final IOException e) {
// shouldn't be possible since the underlying buffer
// from the msg is backed by a byte-array.
// TODO: do something appropriate other than this
throw new RuntimeException("Unable to convert SipMessage to a ByteBuf due to IOException", e);
}
} | java | protected ByteBuf toByteBuf(final SipMessage msg) {
try {
final Buffer b = msg.toBuffer();
final int capacity = b.capacity() + 2;
final ByteBuf buffer = this.channel.alloc().buffer(capacity, capacity);
for (int i = 0; i < b.getReadableBytes(); ++i) {
buffer.writeByte(b.getByte(i));
}
buffer.writeByte(SipParser.CR);
buffer.writeByte(SipParser.LF);
return buffer;
} catch (final IOException e) {
// shouldn't be possible since the underlying buffer
// from the msg is backed by a byte-array.
// TODO: do something appropriate other than this
throw new RuntimeException("Unable to convert SipMessage to a ByteBuf due to IOException", e);
}
} | [
"protected",
"ByteBuf",
"toByteBuf",
"(",
"final",
"SipMessage",
"msg",
")",
"{",
"try",
"{",
"final",
"Buffer",
"b",
"=",
"msg",
".",
"toBuffer",
"(",
")",
";",
"final",
"int",
"capacity",
"=",
"b",
".",
"capacity",
"(",
")",
"+",
"2",
";",
"final",... | All {@link Connection}s needs to convert the msg to a {@link ByteBuf}
before writing it to the {@link ChannelHandlerContext}.
@param msg
the {@link SipMessage} to convert.
@return the resulting {@link ByteBuf} | [
"All",
"{",
"@link",
"Connection",
"}",
"s",
"needs",
"to",
"convert",
"the",
"msg",
"to",
"a",
"{",
"@link",
"ByteBuf",
"}",
"before",
"writing",
"it",
"to",
"the",
"{",
"@link",
"ChannelHandlerContext",
"}",
"."
] | train | https://github.com/aboutsip/sipstack/blob/33f2db1d580738f0385687b0429fab0630118f42/sipstack-netty-codec-sip/src/main/java/io/sipstack/netty/codec/sip/AbstractConnection.java#L119-L137 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java | ActionInterceptorContext.setOverrideForward | public void setOverrideForward( InterceptorForward fwd, ActionInterceptor interceptor )
{
setResultOverride( fwd, interceptor );
//
// If there was no original forward (i.e., this is happening before the action was invoked), create a
// pseudo-forward out of the original request.
//
if ( _originalForward == null ) _originalForward = new OriginalForward( getRequest() );
//
// Store this context in the request.
//
getRequest().setAttribute( ACTIVE_INTERCEPTOR_CONTEXT_ATTR, this );
} | java | public void setOverrideForward( InterceptorForward fwd, ActionInterceptor interceptor )
{
setResultOverride( fwd, interceptor );
//
// If there was no original forward (i.e., this is happening before the action was invoked), create a
// pseudo-forward out of the original request.
//
if ( _originalForward == null ) _originalForward = new OriginalForward( getRequest() );
//
// Store this context in the request.
//
getRequest().setAttribute( ACTIVE_INTERCEPTOR_CONTEXT_ATTR, this );
} | [
"public",
"void",
"setOverrideForward",
"(",
"InterceptorForward",
"fwd",
",",
"ActionInterceptor",
"interceptor",
")",
"{",
"setResultOverride",
"(",
"fwd",
",",
"interceptor",
")",
";",
"//",
"// If there was no original forward (i.e., this is happening before the action was ... | Set an {@link InterceptorForward} that changes the destination URI of the intercepted action. If the
InterceptorForward points to a nested page flow, then {@link ActionInterceptor#afterNestedIntercept} will be
called before the nested page flow returns to the original page flow. | [
"Set",
"an",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java#L97-L111 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/TileWriter.java | TileWriter.isSymbolicDirectoryLink | private boolean isSymbolicDirectoryLink(final File pParentDirectory, final File pDirectory) {
try {
final String canonicalParentPath1 = pParentDirectory.getCanonicalPath();
final String canonicalParentPath2 = pDirectory.getCanonicalFile().getParent();
return !canonicalParentPath1.equals(canonicalParentPath2);
} catch (final IOException e) {
return true;
} catch (final NoSuchElementException e) {
// See: http://code.google.com/p/android/issues/detail?id=4961
// See: http://code.google.com/p/android/issues/detail?id=5807
return true;
}
} | java | private boolean isSymbolicDirectoryLink(final File pParentDirectory, final File pDirectory) {
try {
final String canonicalParentPath1 = pParentDirectory.getCanonicalPath();
final String canonicalParentPath2 = pDirectory.getCanonicalFile().getParent();
return !canonicalParentPath1.equals(canonicalParentPath2);
} catch (final IOException e) {
return true;
} catch (final NoSuchElementException e) {
// See: http://code.google.com/p/android/issues/detail?id=4961
// See: http://code.google.com/p/android/issues/detail?id=5807
return true;
}
} | [
"private",
"boolean",
"isSymbolicDirectoryLink",
"(",
"final",
"File",
"pParentDirectory",
",",
"final",
"File",
"pDirectory",
")",
"{",
"try",
"{",
"final",
"String",
"canonicalParentPath1",
"=",
"pParentDirectory",
".",
"getCanonicalPath",
"(",
")",
";",
"final",
... | Checks to see if it appears that a directory is a symbolic link. It does this by comparing
the canonical path of the parent directory and the parent directory of the directory's
canonical path. If they are equal, then they come from the same true parent. If not, then
pDirectory is a symbolic link. If we get an exception, we err on the side of caution and
return "true" expecting the calculateDirectorySize to now skip further processing since
something went goofy. | [
"Checks",
"to",
"see",
"if",
"it",
"appears",
"that",
"a",
"directory",
"is",
"a",
"symbolic",
"link",
".",
"It",
"does",
"this",
"by",
"comparing",
"the",
"canonical",
"path",
"of",
"the",
"parent",
"directory",
"and",
"the",
"parent",
"directory",
"of",
... | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/TileWriter.java#L229-L242 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/EpicsApi.java | EpicsApi.updateEpic | public Epic updateEpic(Object groupIdOrPath, Integer epicIid, Epic epic) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("title", epic.getTitle(), true)
.withParam("labels", epic.getLabels())
.withParam("description", epic.getDescription())
.withParam("start_date", epic.getStartDate())
.withParam("end_date", epic.getEndDate());
Response response = put(Response.Status.OK, formData.asMap(),
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid);
return (response.readEntity(Epic.class));
} | java | public Epic updateEpic(Object groupIdOrPath, Integer epicIid, Epic epic) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("title", epic.getTitle(), true)
.withParam("labels", epic.getLabels())
.withParam("description", epic.getDescription())
.withParam("start_date", epic.getStartDate())
.withParam("end_date", epic.getEndDate());
Response response = put(Response.Status.OK, formData.asMap(),
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid);
return (response.readEntity(Epic.class));
} | [
"public",
"Epic",
"updateEpic",
"(",
"Object",
"groupIdOrPath",
",",
"Integer",
"epicIid",
",",
"Epic",
"epic",
")",
"throws",
"GitLabApiException",
"{",
"Form",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"title\"",
",",
"epic"... | Updates an epic using the information contained in the provided Epic instance. Only the following
fields from the Epic instance are used:
<pre><code>
title - the title of the epic (optional)
labels - comma separated list of labels (optional)
description - the description of the epic (optional)
startDate - the start date of the epic (optional)
endDate - the end date of the epic (optional)
</code></pre>
<pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_iid</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param epicIid the IID of the epic to update
@param epic the Epic instance with update information
@return an Epic instance containing info on the updated epic
@throws GitLabApiException if any exception occurs | [
"Updates",
"an",
"epic",
"using",
"the",
"information",
"contained",
"in",
"the",
"provided",
"Epic",
"instance",
".",
"Only",
"the",
"following",
"fields",
"from",
"the",
"Epic",
"instance",
"are",
"used",
":",
"<pre",
">",
"<code",
">",
"title",
"-",
"th... | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/EpicsApi.java#L318-L328 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.fireCDATAEvent | protected void fireCDATAEvent(char[] chars, int start, int length)
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CDATA, chars, start,length);
}
} | java | protected void fireCDATAEvent(char[] chars, int start, int length)
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CDATA, chars, start,length);
}
} | [
"protected",
"void",
"fireCDATAEvent",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"m_tracer",
"!=",
"null",
")",
"{",
"flushMyWriter",
"(... | Report the CDATA trace event
@param chars content of CDATA
@param start starting index of characters to output
@param length number of characters to output | [
"Report",
"the",
"CDATA",
"trace",
"event"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L1045-L1053 |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java | NameHelper.getFieldName | public String getFieldName(String propertyName, JsonNode node) {
if (node != null && node.has("javaName")) {
propertyName = node.get("javaName").textValue();
}
return propertyName;
} | java | public String getFieldName(String propertyName, JsonNode node) {
if (node != null && node.has("javaName")) {
propertyName = node.get("javaName").textValue();
}
return propertyName;
} | [
"public",
"String",
"getFieldName",
"(",
"String",
"propertyName",
",",
"JsonNode",
"node",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
"&&",
"node",
".",
"has",
"(",
"\"javaName\"",
")",
")",
"{",
"propertyName",
"=",
"node",
".",
"get",
"(",
"\"javaName... | Get name of the field generated from property.
@param propertyName
@param node
@return | [
"Get",
"name",
"of",
"the",
"field",
"generated",
"from",
"property",
"."
] | train | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java#L166-L173 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java | GVRPose.setLocalRotation | public boolean setLocalRotation(int boneindex, float x, float y, float z, float w)
{
if (mSkeleton.isLocked(boneindex))
return false;
Bone bone = mBones[boneindex];
bone.setLocalRotation(x, y, z, w);
if (mSkeleton.getParentBoneIndex(boneindex) < 0)
{
bone.WorldMatrix.set(bone.LocalMatrix);
}
else
{
mNeedSync = true;
}
bone.Changed = LOCAL_ROT;
if (sDebug)
{
Log.d("BONE", "setLocalRotation: %s %s", mSkeleton.getBoneName(boneindex), bone.toString());
}
return true;
} | java | public boolean setLocalRotation(int boneindex, float x, float y, float z, float w)
{
if (mSkeleton.isLocked(boneindex))
return false;
Bone bone = mBones[boneindex];
bone.setLocalRotation(x, y, z, w);
if (mSkeleton.getParentBoneIndex(boneindex) < 0)
{
bone.WorldMatrix.set(bone.LocalMatrix);
}
else
{
mNeedSync = true;
}
bone.Changed = LOCAL_ROT;
if (sDebug)
{
Log.d("BONE", "setLocalRotation: %s %s", mSkeleton.getBoneName(boneindex), bone.toString());
}
return true;
} | [
"public",
"boolean",
"setLocalRotation",
"(",
"int",
"boneindex",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
",",
"float",
"w",
")",
"{",
"if",
"(",
"mSkeleton",
".",
"isLocked",
"(",
"boneindex",
")",
")",
"return",
"false",
";",
"Bone",... | Sets the local rotation for the designated bone.
<p>
All bones in the skeleton start out at the origin oriented along the bone axis (usually 0,0,1).
The pose orients and positions each bone in the skeleton with respect to this initial state.
The local bone matrix expresses the orientation and position of the bone relative
to it's parent. This function sets the rotation component of that matrix from a quaternion.
The position of the bone is unaffected.
@param boneindex zero based index of bone to rotate.
@param x,y,z,w quaternion with the rotation for the named bone.
@see #setLocalRotations
@see #setWorldRotations
@see #setWorldMatrix
@see GVRSkeleton#setBoneAxis | [
"Sets",
"the",
"local",
"rotation",
"for",
"the",
"designated",
"bone",
".",
"<p",
">",
"All",
"bones",
"in",
"the",
"skeleton",
"start",
"out",
"at",
"the",
"origin",
"oriented",
"along",
"the",
"bone",
"axis",
"(",
"usually",
"0",
"0",
"1",
")",
".",... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L615-L637 |
logic-ng/LogicNG | src/main/java/org/logicng/formulas/FormulaFactory.java | FormulaFactory.constructClause | private Formula constructClause(final LinkedHashSet<Literal> literals) {
if (literals.isEmpty())
return this.falsum();
if (literals.size() == 1)
return literals.iterator().next();
Map<LinkedHashSet<? extends Formula>, Or> opOrMap = this.orsN;
switch (literals.size()) {
case 2:
opOrMap = this.ors2;
break;
case 3:
opOrMap = this.ors3;
break;
case 4:
opOrMap = this.ors4;
break;
default:
break;
}
Or tempOr = opOrMap.get(literals);
if (tempOr != null)
return tempOr;
tempOr = new Or(literals, this, true);
opOrMap.put(literals, tempOr);
return tempOr;
} | java | private Formula constructClause(final LinkedHashSet<Literal> literals) {
if (literals.isEmpty())
return this.falsum();
if (literals.size() == 1)
return literals.iterator().next();
Map<LinkedHashSet<? extends Formula>, Or> opOrMap = this.orsN;
switch (literals.size()) {
case 2:
opOrMap = this.ors2;
break;
case 3:
opOrMap = this.ors3;
break;
case 4:
opOrMap = this.ors4;
break;
default:
break;
}
Or tempOr = opOrMap.get(literals);
if (tempOr != null)
return tempOr;
tempOr = new Or(literals, this, true);
opOrMap.put(literals, tempOr);
return tempOr;
} | [
"private",
"Formula",
"constructClause",
"(",
"final",
"LinkedHashSet",
"<",
"Literal",
">",
"literals",
")",
"{",
"if",
"(",
"literals",
".",
"isEmpty",
"(",
")",
")",
"return",
"this",
".",
"falsum",
"(",
")",
";",
"if",
"(",
"literals",
".",
"size",
... | Creates a new clause.
@param literals the literals
@return a new clause | [
"Creates",
"a",
"new",
"clause",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L650-L675 |
Omertron/api-rottentomatoes | src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java | RottenTomatoesApi.getInTheaters | public List<RTMovie> getInTheaters(String country) throws RottenTomatoesException {
return getInTheaters(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT);
} | java | public List<RTMovie> getInTheaters(String country) throws RottenTomatoesException {
return getInTheaters(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT);
} | [
"public",
"List",
"<",
"RTMovie",
">",
"getInTheaters",
"(",
"String",
"country",
")",
"throws",
"RottenTomatoesException",
"{",
"return",
"getInTheaters",
"(",
"country",
",",
"DEFAULT_PAGE",
",",
"DEFAULT_PAGE_LIMIT",
")",
";",
"}"
] | Retrieves movies currently in theaters
@param country Provides localized data for the selected country
@return
@throws RottenTomatoesException | [
"Retrieves",
"movies",
"currently",
"in",
"theaters"
] | train | https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L218-L220 |
greatman/craftconomy3 | src/main/java/com/greatmancode/craftconomy3/Common.java | Common.writeLog | public void writeLog(LogInfo info, Cause cause, String causeReason, Account account, double amount, Currency currency, String worldName) {
if (getMainConfig().getBoolean("System.Logging.Enabled")) {
getStorageHandler().getStorageEngine().saveLog(info, cause, causeReason, account, amount, currency, worldName);
}
} | java | public void writeLog(LogInfo info, Cause cause, String causeReason, Account account, double amount, Currency currency, String worldName) {
if (getMainConfig().getBoolean("System.Logging.Enabled")) {
getStorageHandler().getStorageEngine().saveLog(info, cause, causeReason, account, amount, currency, worldName);
}
} | [
"public",
"void",
"writeLog",
"(",
"LogInfo",
"info",
",",
"Cause",
"cause",
",",
"String",
"causeReason",
",",
"Account",
"account",
",",
"double",
"amount",
",",
"Currency",
"currency",
",",
"String",
"worldName",
")",
"{",
"if",
"(",
"getMainConfig",
"(",... | Write a transaction to the Log.
@param info The type of transaction to log.
@param cause The cause of the transaction.
@param causeReason The reason of the cause
@param account The account being impacted by the change
@param amount The amount of money in this transaction.
@param currency The currency associated with this transaction
@param worldName The world name associated with this transaction | [
"Write",
"a",
"transaction",
"to",
"the",
"Log",
"."
] | train | https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/Common.java#L503-L507 |
jenkinsci/favorite-plugin | src/main/java/hudson/plugins/favorite/Favorites.java | Favorites.removeFavorite | public static void removeFavorite(@Nonnull User user, @Nonnull Item item) throws FavoriteException {
try {
if (isFavorite(user, item)) {
FavoriteUserProperty fup = user.getProperty(FavoriteUserProperty.class);
fup.removeFavorite(item.getFullName());
FavoriteListener.fireOnRemoveFavourite(item, user);
} else {
throw new FavoriteException("Favourite is already unset for User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">");
}
} catch (IOException e) {
throw new FavoriteException("Could not remove Favorite. User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">", e);
}
} | java | public static void removeFavorite(@Nonnull User user, @Nonnull Item item) throws FavoriteException {
try {
if (isFavorite(user, item)) {
FavoriteUserProperty fup = user.getProperty(FavoriteUserProperty.class);
fup.removeFavorite(item.getFullName());
FavoriteListener.fireOnRemoveFavourite(item, user);
} else {
throw new FavoriteException("Favourite is already unset for User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">");
}
} catch (IOException e) {
throw new FavoriteException("Could not remove Favorite. User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">", e);
}
} | [
"public",
"static",
"void",
"removeFavorite",
"(",
"@",
"Nonnull",
"User",
"user",
",",
"@",
"Nonnull",
"Item",
"item",
")",
"throws",
"FavoriteException",
"{",
"try",
"{",
"if",
"(",
"isFavorite",
"(",
"user",
",",
"item",
")",
")",
"{",
"FavoriteUserProp... | Remove an item as a favorite for a user
Fires {@link FavoriteListener#fireOnRemoveFavourite(Item, User)}
@param user to remove the favorite from
@param item to favorite
@throws FavoriteException | [
"Remove",
"an",
"item",
"as",
"a",
"favorite",
"for",
"a",
"user",
"Fires",
"{"
] | train | https://github.com/jenkinsci/favorite-plugin/blob/4ce9b195b4d888190fe12c92d546d64f22728c22/src/main/java/hudson/plugins/favorite/Favorites.java#L93-L105 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/core/GraphsHandler.java | GraphsHandler.addModuleToGraph | private void addModuleToGraph(final DbModule module, final AbstractGraph graph, final int depth) {
if (graph.isTreated(graph.getId(module))) {
return;
}
final String moduleElementId = graph.getId(module);
graph.addElement(moduleElementId, module.getVersion(), depth == 0);
if (filters.getDepthHandler().shouldGoDeeper(depth)) {
for (final DbDependency dep : DataUtils.getAllDbDependencies(module)) {
if(filters.shouldBeInReport(dep)){
addDependencyToGraph(dep, graph, depth + 1, moduleElementId);
}
}
}
} | java | private void addModuleToGraph(final DbModule module, final AbstractGraph graph, final int depth) {
if (graph.isTreated(graph.getId(module))) {
return;
}
final String moduleElementId = graph.getId(module);
graph.addElement(moduleElementId, module.getVersion(), depth == 0);
if (filters.getDepthHandler().shouldGoDeeper(depth)) {
for (final DbDependency dep : DataUtils.getAllDbDependencies(module)) {
if(filters.shouldBeInReport(dep)){
addDependencyToGraph(dep, graph, depth + 1, moduleElementId);
}
}
}
} | [
"private",
"void",
"addModuleToGraph",
"(",
"final",
"DbModule",
"module",
",",
"final",
"AbstractGraph",
"graph",
",",
"final",
"int",
"depth",
")",
"{",
"if",
"(",
"graph",
".",
"isTreated",
"(",
"graph",
".",
"getId",
"(",
"module",
")",
")",
")",
"{"... | Manage the artifact add to the Module AbstractGraph
@param graph
@param depth | [
"Manage",
"the",
"artifact",
"add",
"to",
"the",
"Module",
"AbstractGraph"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/GraphsHandler.java#L64-L79 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/URI.java | URI.setHost | public void setHost(String p_host) throws MalformedURIException
{
if (p_host == null || p_host.trim().length() == 0)
{
m_host = p_host;
m_userinfo = null;
m_port = -1;
}
else if (!isWellFormedAddress(p_host))
{
throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
}
m_host = p_host;
} | java | public void setHost(String p_host) throws MalformedURIException
{
if (p_host == null || p_host.trim().length() == 0)
{
m_host = p_host;
m_userinfo = null;
m_port = -1;
}
else if (!isWellFormedAddress(p_host))
{
throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
}
m_host = p_host;
} | [
"public",
"void",
"setHost",
"(",
"String",
"p_host",
")",
"throws",
"MalformedURIException",
"{",
"if",
"(",
"p_host",
"==",
"null",
"||",
"p_host",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"m_host",
"=",
"p_host",
";",
"... | Set the host for this URI. If null is passed in, the userinfo
field is also set to null and the port is set to -1.
@param p_host the host for this URI
@throws MalformedURIException if p_host is not a valid IP
address or DNS hostname. | [
"Set",
"the",
"host",
"for",
"this",
"URI",
".",
"If",
"null",
"is",
"passed",
"in",
"the",
"userinfo",
"field",
"is",
"also",
"set",
"to",
"null",
"and",
"the",
"port",
"is",
"set",
"to",
"-",
"1",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/URI.java#L1118-L1133 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/internal/CopyCallable.java | CopyCallable.copyInParts | private void copyInParts() throws Exception {
multipartUploadId = initiateMultipartUpload(copyObjectRequest);
long optimalPartSize = getOptimalPartSize(metadata.getContentLength());
try {
CopyPartRequestFactory requestFactory = new CopyPartRequestFactory(
copyObjectRequest, multipartUploadId, optimalPartSize,
metadata.getContentLength());
copyPartsInParallel(requestFactory);
} catch (Exception e) {
publishProgress(listenerChain, ProgressEventType.TRANSFER_FAILED_EVENT);
abortMultipartCopy();
throw new RuntimeException("Unable to perform multipart copy", e);
}
} | java | private void copyInParts() throws Exception {
multipartUploadId = initiateMultipartUpload(copyObjectRequest);
long optimalPartSize = getOptimalPartSize(metadata.getContentLength());
try {
CopyPartRequestFactory requestFactory = new CopyPartRequestFactory(
copyObjectRequest, multipartUploadId, optimalPartSize,
metadata.getContentLength());
copyPartsInParallel(requestFactory);
} catch (Exception e) {
publishProgress(listenerChain, ProgressEventType.TRANSFER_FAILED_EVENT);
abortMultipartCopy();
throw new RuntimeException("Unable to perform multipart copy", e);
}
} | [
"private",
"void",
"copyInParts",
"(",
")",
"throws",
"Exception",
"{",
"multipartUploadId",
"=",
"initiateMultipartUpload",
"(",
"copyObjectRequest",
")",
";",
"long",
"optimalPartSize",
"=",
"getOptimalPartSize",
"(",
"metadata",
".",
"getContentLength",
"(",
")",
... | Performs the copy of an Amazon S3 object from source bucket to
destination bucket as multiple copy part requests. The information about
the part to be copied is specified in the request as a byte range
(first-last)
@throws Exception
Any Exception that occurs while carrying out the request. | [
"Performs",
"the",
"copy",
"of",
"an",
"Amazon",
"S3",
"object",
"from",
"source",
"bucket",
"to",
"destination",
"bucket",
"as",
"multiple",
"copy",
"part",
"requests",
".",
"The",
"information",
"about",
"the",
"part",
"to",
"be",
"copied",
"is",
"specifie... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/internal/CopyCallable.java#L167-L182 |
SimiaCryptus/utilities | java-util/src/main/java/com/simiacryptus/util/binary/bitset/CountTreeBitsCollection.java | CountTreeBitsCollection.readBranchCounts | protected BranchCounts readBranchCounts(final BitInputStream in,
final Bits code, final long size) throws IOException {
final BranchCounts branchCounts = new BranchCounts(code, size);
final CodeType currentCodeType = this.getType(code);
long maximum = size;
// Get terminals
if (currentCodeType == CodeType.Unknown) {
branchCounts.terminals = this.readTerminalCount(in, maximum);
}
else if (currentCodeType == CodeType.Terminal) {
branchCounts.terminals = size;
}
else {
branchCounts.terminals = 0;
}
maximum -= branchCounts.terminals;
// Get zero-suffixed primary
if (maximum > 0) {
assert Thread.currentThread().getStackTrace().length < 100;
branchCounts.zeroCount = this.readZeroBranchSize(in, maximum, code);
}
maximum -= branchCounts.zeroCount;
branchCounts.oneCount = maximum;
return branchCounts;
} | java | protected BranchCounts readBranchCounts(final BitInputStream in,
final Bits code, final long size) throws IOException {
final BranchCounts branchCounts = new BranchCounts(code, size);
final CodeType currentCodeType = this.getType(code);
long maximum = size;
// Get terminals
if (currentCodeType == CodeType.Unknown) {
branchCounts.terminals = this.readTerminalCount(in, maximum);
}
else if (currentCodeType == CodeType.Terminal) {
branchCounts.terminals = size;
}
else {
branchCounts.terminals = 0;
}
maximum -= branchCounts.terminals;
// Get zero-suffixed primary
if (maximum > 0) {
assert Thread.currentThread().getStackTrace().length < 100;
branchCounts.zeroCount = this.readZeroBranchSize(in, maximum, code);
}
maximum -= branchCounts.zeroCount;
branchCounts.oneCount = maximum;
return branchCounts;
} | [
"protected",
"BranchCounts",
"readBranchCounts",
"(",
"final",
"BitInputStream",
"in",
",",
"final",
"Bits",
"code",
",",
"final",
"long",
"size",
")",
"throws",
"IOException",
"{",
"final",
"BranchCounts",
"branchCounts",
"=",
"new",
"BranchCounts",
"(",
"code",
... | Read branch counts branch counts.
@param in the in
@param code the code
@param size the size
@return the branch counts
@throws IOException the io exception | [
"Read",
"branch",
"counts",
"branch",
"counts",
"."
] | train | https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/bitset/CountTreeBitsCollection.java#L191-L217 |
lastaflute/lasta-thymeleaf | src/main/java/org/lastaflute/thymeleaf/ThymeleafHtmlRenderer.java | ThymeleafHtmlRenderer.checkRegisteredDataUsingReservedWord | protected void checkRegisteredDataUsingReservedWord(ActionRuntime runtime, WebContext context, String varKey) {
if (isSuppressRegisteredDataUsingReservedWordCheck()) {
return;
}
if (context.getVariableNames().contains(varKey)) {
throwThymeleafRegisteredDataUsingReservedWordException(runtime, context, varKey);
}
} | java | protected void checkRegisteredDataUsingReservedWord(ActionRuntime runtime, WebContext context, String varKey) {
if (isSuppressRegisteredDataUsingReservedWordCheck()) {
return;
}
if (context.getVariableNames().contains(varKey)) {
throwThymeleafRegisteredDataUsingReservedWordException(runtime, context, varKey);
}
} | [
"protected",
"void",
"checkRegisteredDataUsingReservedWord",
"(",
"ActionRuntime",
"runtime",
",",
"WebContext",
"context",
",",
"String",
"varKey",
")",
"{",
"if",
"(",
"isSuppressRegisteredDataUsingReservedWordCheck",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
... | Thymeleaf's reserved words are already checked in Thymeleaf process so no check them here | [
"Thymeleaf",
"s",
"reserved",
"words",
"are",
"already",
"checked",
"in",
"Thymeleaf",
"process",
"so",
"no",
"check",
"them",
"here"
] | train | https://github.com/lastaflute/lasta-thymeleaf/blob/d340a6e7eeddfcc9177052958c383fecd4a7fefa/src/main/java/org/lastaflute/thymeleaf/ThymeleafHtmlRenderer.java#L178-L185 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WWindow.java | WWindow.preparePaintComponent | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
// Check if window in request (might not have gone through handle request, eg Step error)
boolean targeted = isPresent(request);
setTargeted(targeted);
if (getState() == ACTIVE_STATE && isTargeted()) {
getComponentModel().wrappedContent.preparePaint(request);
}
} | java | @Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
// Check if window in request (might not have gone through handle request, eg Step error)
boolean targeted = isPresent(request);
setTargeted(targeted);
if (getState() == ACTIVE_STATE && isTargeted()) {
getComponentModel().wrappedContent.preparePaint(request);
}
} | [
"@",
"Override",
"protected",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"super",
".",
"preparePaintComponent",
"(",
"request",
")",
";",
"// Check if window in request (might not have gone through handle request, eg Step error)",
"boolean",
... | Override preparePaintComponent to clear the scratch map before the window content is being painted.
@param request the request being responded to. | [
"Override",
"preparePaintComponent",
"to",
"clear",
"the",
"scratch",
"map",
"before",
"the",
"window",
"content",
"is",
"being",
"painted",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WWindow.java#L409-L420 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.encryptAsync | public Observable<KeyOperationResult> encryptAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value) {
return encryptWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value).map(new Func1<ServiceResponse<KeyOperationResult>, KeyOperationResult>() {
@Override
public KeyOperationResult call(ServiceResponse<KeyOperationResult> response) {
return response.body();
}
});
} | java | public Observable<KeyOperationResult> encryptAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value) {
return encryptWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value).map(new Func1<ServiceResponse<KeyOperationResult>, KeyOperationResult>() {
@Override
public KeyOperationResult call(ServiceResponse<KeyOperationResult> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"KeyOperationResult",
">",
"encryptAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"String",
"keyVersion",
",",
"JsonWebKeyEncryptionAlgorithm",
"algorithm",
",",
"byte",
"[",
"]",
"value",
")",
"{",
"return",
"en... | Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault.
The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. The ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be performed using public portion of the key. This operation is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation requires the keys/encypt permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@param keyVersion The version of the key.
@param algorithm algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'
@param value the Base64Url value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the KeyOperationResult object | [
"Encrypts",
"an",
"arbitrary",
"sequence",
"of",
"bytes",
"using",
"an",
"encryption",
"key",
"that",
"is",
"stored",
"in",
"a",
"key",
"vault",
".",
"The",
"ENCRYPT",
"operation",
"encrypts",
"an",
"arbitrary",
"sequence",
"of",
"bytes",
"using",
"an",
"enc... | 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#L2179-L2186 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/protocol/LocatedBlocks.java | LocatedBlocks.setLastBlockSize | public synchronized void setLastBlockSize(long blockId, long blockSize) {
assert blocks.size() > 0;
LocatedBlock last = blocks.get(blocks.size() - 1);
if (underConstruction && blockSize > last.getBlockSize()) {
assert blockId == last.getBlock().getBlockId();
this.setFileLength(this.getFileLength() + blockSize - last.getBlockSize());
last.setBlockSize(blockSize);
if (LOG.isDebugEnabled()) {
LOG.debug("DFSClient setting last block " + last + " to length "
+ blockSize + " filesize is now " + getFileLength());
}
}
} | java | public synchronized void setLastBlockSize(long blockId, long blockSize) {
assert blocks.size() > 0;
LocatedBlock last = blocks.get(blocks.size() - 1);
if (underConstruction && blockSize > last.getBlockSize()) {
assert blockId == last.getBlock().getBlockId();
this.setFileLength(this.getFileLength() + blockSize - last.getBlockSize());
last.setBlockSize(blockSize);
if (LOG.isDebugEnabled()) {
LOG.debug("DFSClient setting last block " + last + " to length "
+ blockSize + " filesize is now " + getFileLength());
}
}
} | [
"public",
"synchronized",
"void",
"setLastBlockSize",
"(",
"long",
"blockId",
",",
"long",
"blockSize",
")",
"{",
"assert",
"blocks",
".",
"size",
"(",
")",
">",
"0",
";",
"LocatedBlock",
"last",
"=",
"blocks",
".",
"get",
"(",
"blocks",
".",
"size",
"("... | If file is under construction, set block size of the last block. It updates
file length in the same time. | [
"If",
"file",
"is",
"under",
"construction",
"set",
"block",
"size",
"of",
"the",
"last",
"block",
".",
"It",
"updates",
"file",
"length",
"in",
"the",
"same",
"time",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/LocatedBlocks.java#L132-L145 |
graylog-labs/syslog4j-graylog2 | src/main/java/org/graylog2/syslog4j/util/Base64.java | Base64.encodeToFile | public static boolean encodeToFile(byte[] dataToEncode, String filename) {
boolean success = false;
Base64.OutputStream bos = null;
try {
bos = new Base64.OutputStream(
new java.io.FileOutputStream(filename), Base64.ENCODE);
bos.write(dataToEncode);
success = true;
} // end try
catch (java.io.IOException e) {
success = false;
} // end catch: IOException
finally {
try {
if (bos != null) bos.close();
} catch (Exception e) {
}
} // end finally
return success;
} | java | public static boolean encodeToFile(byte[] dataToEncode, String filename) {
boolean success = false;
Base64.OutputStream bos = null;
try {
bos = new Base64.OutputStream(
new java.io.FileOutputStream(filename), Base64.ENCODE);
bos.write(dataToEncode);
success = true;
} // end try
catch (java.io.IOException e) {
success = false;
} // end catch: IOException
finally {
try {
if (bos != null) bos.close();
} catch (Exception e) {
}
} // end finally
return success;
} | [
"public",
"static",
"boolean",
"encodeToFile",
"(",
"byte",
"[",
"]",
"dataToEncode",
",",
"String",
"filename",
")",
"{",
"boolean",
"success",
"=",
"false",
";",
"Base64",
".",
"OutputStream",
"bos",
"=",
"null",
";",
"try",
"{",
"bos",
"=",
"new",
"Ba... | Convenience method for encoding data to a file.
@param dataToEncode byte array of data to encode in base64 form
@param filename Filename for saving encoded data
@return <tt>true</tt> if successful, <tt>false</tt> otherwise
@since 2.1 | [
"Convenience",
"method",
"for",
"encoding",
"data",
"to",
"a",
"file",
"."
] | train | https://github.com/graylog-labs/syslog4j-graylog2/blob/374bc20d77c3aaa36a68bec5125dd82ce0a88aab/src/main/java/org/graylog2/syslog4j/util/Base64.java#L1091-L1112 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java | DataService.isContainResponse | private boolean isContainResponse(IntuitMessage intuitMessage, int idx)
{
List<AttachableResponse> response = ((IntuitResponse) intuitMessage.getResponseElements().getResponse()).getAttachableResponse();
if(null == response) { return false; }
if(0 >= response.size() ) { return false; }
if(idx >= response.size() ) { return false; }
return true;
} | java | private boolean isContainResponse(IntuitMessage intuitMessage, int idx)
{
List<AttachableResponse> response = ((IntuitResponse) intuitMessage.getResponseElements().getResponse()).getAttachableResponse();
if(null == response) { return false; }
if(0 >= response.size() ) { return false; }
if(idx >= response.size() ) { return false; }
return true;
} | [
"private",
"boolean",
"isContainResponse",
"(",
"IntuitMessage",
"intuitMessage",
",",
"int",
"idx",
")",
"{",
"List",
"<",
"AttachableResponse",
">",
"response",
"=",
"(",
"(",
"IntuitResponse",
")",
"intuitMessage",
".",
"getResponseElements",
"(",
")",
".",
"... | verifies availability of an object in response
@param intuitMessage
@param idx
@return | [
"verifies",
"availability",
"of",
"an",
"object",
"in",
"response"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L491-L498 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/ArchiveFileFactory.java | ArchiveFileFactory.registerArchiveFileProvider | public static void registerArchiveFileProvider(Class<? extends IArchiveFile> provider, String fileExtension){
extensionMap.put(fileExtension, provider);
} | java | public static void registerArchiveFileProvider(Class<? extends IArchiveFile> provider, String fileExtension){
extensionMap.put(fileExtension, provider);
} | [
"public",
"static",
"void",
"registerArchiveFileProvider",
"(",
"Class",
"<",
"?",
"extends",
"IArchiveFile",
">",
"provider",
",",
"String",
"fileExtension",
")",
"{",
"extensionMap",
".",
"put",
"(",
"fileExtension",
",",
"provider",
")",
";",
"}"
] | Registers a custom archive file provider
@param provider
@param fileExtension without the dot
@since 5.0 | [
"Registers",
"a",
"custom",
"archive",
"file",
"provider"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/ArchiveFileFactory.java#L43-L45 |
jenkinsci/jenkins | core/src/main/java/hudson/model/AbstractProject.java | AbstractProject.scheduleBuild | public boolean scheduleBuild(int quietPeriod, Cause c, Action... actions) {
return scheduleBuild2(quietPeriod,c,actions)!=null;
} | java | public boolean scheduleBuild(int quietPeriod, Cause c, Action... actions) {
return scheduleBuild2(quietPeriod,c,actions)!=null;
} | [
"public",
"boolean",
"scheduleBuild",
"(",
"int",
"quietPeriod",
",",
"Cause",
"c",
",",
"Action",
"...",
"actions",
")",
"{",
"return",
"scheduleBuild2",
"(",
"quietPeriod",
",",
"c",
",",
"actions",
")",
"!=",
"null",
";",
"}"
] | Schedules a build.
Important: the actions should be persistable without outside references (e.g. don't store
references to this project). To provide parameters for a parameterized project, add a ParametersAction. If
no ParametersAction is provided for such a project, one will be created with the default parameter values.
@param quietPeriod the quiet period to observer
@param c the cause for this build which should be recorded
@param actions a list of Actions that will be added to the build
@return whether the build was actually scheduled | [
"Schedules",
"a",
"build",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractProject.java#L795-L797 |
Bearded-Hen/Android-Bootstrap | AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapProgressBar.java | BootstrapProgressBar.createTile | private static Bitmap createTile(float h, Paint stripePaint, Paint progressPaint) {
Bitmap bm = Bitmap.createBitmap((int) h * 2, (int) h, ARGB_8888);
Canvas tile = new Canvas(bm);
float x = 0;
Path path = new Path();
path.moveTo(x, 0);
path.lineTo(x, h);
path.lineTo(h, h);
tile.drawPath(path, stripePaint); // draw striped triangle
path.reset();
path.moveTo(x, 0);
path.lineTo(x + h, h);
path.lineTo(x + (h * 2), h);
path.lineTo(x + h, 0);
tile.drawPath(path, progressPaint); // draw progress parallelogram
x += h;
path.reset();
path.moveTo(x, 0);
path.lineTo(x + h, 0);
path.lineTo(x + h, h);
tile.drawPath(path, stripePaint); // draw striped triangle (completing tile)
return bm;
} | java | private static Bitmap createTile(float h, Paint stripePaint, Paint progressPaint) {
Bitmap bm = Bitmap.createBitmap((int) h * 2, (int) h, ARGB_8888);
Canvas tile = new Canvas(bm);
float x = 0;
Path path = new Path();
path.moveTo(x, 0);
path.lineTo(x, h);
path.lineTo(h, h);
tile.drawPath(path, stripePaint); // draw striped triangle
path.reset();
path.moveTo(x, 0);
path.lineTo(x + h, h);
path.lineTo(x + (h * 2), h);
path.lineTo(x + h, 0);
tile.drawPath(path, progressPaint); // draw progress parallelogram
x += h;
path.reset();
path.moveTo(x, 0);
path.lineTo(x + h, 0);
path.lineTo(x + h, h);
tile.drawPath(path, stripePaint); // draw striped triangle (completing tile)
return bm;
} | [
"private",
"static",
"Bitmap",
"createTile",
"(",
"float",
"h",
",",
"Paint",
"stripePaint",
",",
"Paint",
"progressPaint",
")",
"{",
"Bitmap",
"bm",
"=",
"Bitmap",
".",
"createBitmap",
"(",
"(",
"int",
")",
"h",
"*",
"2",
",",
"(",
"int",
")",
"h",
... | Creates a Bitmap which is a tile of the progress bar background
@param h the view height
@return a bitmap of the progress bar background | [
"Creates",
"a",
"Bitmap",
"which",
"is",
"a",
"tile",
"of",
"the",
"progress",
"bar",
"background"
] | train | https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapProgressBar.java#L374-L401 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseByteObj | @Nullable
public static Byte parseByteObj (@Nullable final String sStr, @Nullable final Byte aDefault)
{
return parseByteObj (sStr, DEFAULT_RADIX, aDefault);
} | java | @Nullable
public static Byte parseByteObj (@Nullable final String sStr, @Nullable final Byte aDefault)
{
return parseByteObj (sStr, DEFAULT_RADIX, aDefault);
} | [
"@",
"Nullable",
"public",
"static",
"Byte",
"parseByteObj",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"Byte",
"aDefault",
")",
"{",
"return",
"parseByteObj",
"(",
"sStr",
",",
"DEFAULT_RADIX",
",",
"aDefault",
")",
";",... | Parse the given {@link String} as {@link Byte} with radix
{@value #DEFAULT_RADIX}.
@param sStr
The String to parse. May be <code>null</code>.
@param aDefault
The default value to be returned if the passed string could not be
converted to a valid value. May be <code>null</code>.
@return <code>aDefault</code> if the string does not represent a valid
value. | [
"Parse",
"the",
"given",
"{",
"@link",
"String",
"}",
"as",
"{",
"@link",
"Byte",
"}",
"with",
"radix",
"{",
"@value",
"#DEFAULT_RADIX",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L414-L418 |
marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java | MarkLogicClientImpl.performGraphQuery | public InputStream performGraphQuery(String queryString, SPARQLQueryBindingSet bindings, InputStreamHandle handle, Transaction tx, boolean includeInferred, String baseURI) throws JsonProcessingException {
SPARQLQueryDefinition qdef = sparqlManager.newQueryDefinition(queryString);
if(notNull(baseURI) && !baseURI.isEmpty()){ qdef.setBaseUri(baseURI);}
if (notNull(ruleset)) {qdef.setRulesets(ruleset);}
if (notNull(getConstrainingQueryDefinition())){
qdef.setConstrainingQueryDefinition(getConstrainingQueryDefinition());
qdef.setDirectory(getConstrainingQueryDefinition().getDirectory());
qdef.setCollections(getConstrainingQueryDefinition().getCollections());
qdef.setResponseTransform(getConstrainingQueryDefinition().getResponseTransform());
qdef.setOptionsName(getConstrainingQueryDefinition().getOptionsName());
}
if(notNull(graphPerms)){ qdef.setUpdatePermissions(graphPerms);}
qdef.setIncludeDefaultRulesets(includeInferred);
sparqlManager.executeDescribe(qdef, handle, tx);
return new BufferedInputStream(handle.get());
} | java | public InputStream performGraphQuery(String queryString, SPARQLQueryBindingSet bindings, InputStreamHandle handle, Transaction tx, boolean includeInferred, String baseURI) throws JsonProcessingException {
SPARQLQueryDefinition qdef = sparqlManager.newQueryDefinition(queryString);
if(notNull(baseURI) && !baseURI.isEmpty()){ qdef.setBaseUri(baseURI);}
if (notNull(ruleset)) {qdef.setRulesets(ruleset);}
if (notNull(getConstrainingQueryDefinition())){
qdef.setConstrainingQueryDefinition(getConstrainingQueryDefinition());
qdef.setDirectory(getConstrainingQueryDefinition().getDirectory());
qdef.setCollections(getConstrainingQueryDefinition().getCollections());
qdef.setResponseTransform(getConstrainingQueryDefinition().getResponseTransform());
qdef.setOptionsName(getConstrainingQueryDefinition().getOptionsName());
}
if(notNull(graphPerms)){ qdef.setUpdatePermissions(graphPerms);}
qdef.setIncludeDefaultRulesets(includeInferred);
sparqlManager.executeDescribe(qdef, handle, tx);
return new BufferedInputStream(handle.get());
} | [
"public",
"InputStream",
"performGraphQuery",
"(",
"String",
"queryString",
",",
"SPARQLQueryBindingSet",
"bindings",
",",
"InputStreamHandle",
"handle",
",",
"Transaction",
"tx",
",",
"boolean",
"includeInferred",
",",
"String",
"baseURI",
")",
"throws",
"JsonProcessin... | executes GraphQuery
@param queryString
@param bindings
@param handle
@param tx
@param includeInferred
@param baseURI
@return
@throws JsonProcessingException | [
"executes",
"GraphQuery"
] | train | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L201-L216 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java | JNStorage.getSyncLogDestFile | File getSyncLogDestFile(long segmentTxId, long endTxId) {
String name = NNStorage.getFinalizedEditsFileName(segmentTxId, endTxId);
return new File(sd.getCurrentDir(), name);
} | java | File getSyncLogDestFile(long segmentTxId, long endTxId) {
String name = NNStorage.getFinalizedEditsFileName(segmentTxId, endTxId);
return new File(sd.getCurrentDir(), name);
} | [
"File",
"getSyncLogDestFile",
"(",
"long",
"segmentTxId",
",",
"long",
"endTxId",
")",
"{",
"String",
"name",
"=",
"NNStorage",
".",
"getFinalizedEditsFileName",
"(",
"segmentTxId",
",",
"endTxId",
")",
";",
"return",
"new",
"File",
"(",
"sd",
".",
"getCurrent... | Get name for destination file used for log syncing, after a journal node
crashed. | [
"Get",
"name",
"for",
"destination",
"file",
"used",
"for",
"log",
"syncing",
"after",
"a",
"journal",
"node",
"crashed",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java#L155-L158 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/constraint/Type.java | Type.satisfies | @Override
public boolean satisfies(Match match, int... ind)
{
assert ind.length == 1;
return clazz.isAssignableFrom(match.get(ind[0]).getModelInterface());
} | java | @Override
public boolean satisfies(Match match, int... ind)
{
assert ind.length == 1;
return clazz.isAssignableFrom(match.get(ind[0]).getModelInterface());
} | [
"@",
"Override",
"public",
"boolean",
"satisfies",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"assert",
"ind",
".",
"length",
"==",
"1",
";",
"return",
"clazz",
".",
"isAssignableFrom",
"(",
"match",
".",
"get",
"(",
"ind",
"[",
"0",
... | Checks if the element is assignable to a variable of the desired type.
@param match current pattern match
@param ind mapped indices
@return true if the element is assignable to a variable of the desired type | [
"Checks",
"if",
"the",
"element",
"is",
"assignable",
"to",
"a",
"variable",
"of",
"the",
"desired",
"type",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/Type.java#L34-L40 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/IndexCache.java | IndexCache.getIndexInformation | public IndexRecord getIndexInformation(String mapId, int reduce,
Path fileName) throws IOException {
IndexInformation info = cache.get(mapId);
if (info == null) {
info = readIndexFileToCache(fileName, mapId);
} else {
synchronized (info) {
while (null == info.mapSpillRecord) {
try {
info.wait();
} catch (InterruptedException e) {
throw new IOException("Interrupted waiting for construction", e);
}
}
}
LOG.debug("IndexCache HIT: MapId " + mapId + " found");
}
if (info.mapSpillRecord.size() == 0 ||
info.mapSpillRecord.size() < reduce) {
throw new IOException("Invalid request " +
" Map Id = " + mapId + " Reducer = " + reduce +
" Index Info Length = " + info.mapSpillRecord.size());
}
return info.mapSpillRecord.getIndex(reduce);
} | java | public IndexRecord getIndexInformation(String mapId, int reduce,
Path fileName) throws IOException {
IndexInformation info = cache.get(mapId);
if (info == null) {
info = readIndexFileToCache(fileName, mapId);
} else {
synchronized (info) {
while (null == info.mapSpillRecord) {
try {
info.wait();
} catch (InterruptedException e) {
throw new IOException("Interrupted waiting for construction", e);
}
}
}
LOG.debug("IndexCache HIT: MapId " + mapId + " found");
}
if (info.mapSpillRecord.size() == 0 ||
info.mapSpillRecord.size() < reduce) {
throw new IOException("Invalid request " +
" Map Id = " + mapId + " Reducer = " + reduce +
" Index Info Length = " + info.mapSpillRecord.size());
}
return info.mapSpillRecord.getIndex(reduce);
} | [
"public",
"IndexRecord",
"getIndexInformation",
"(",
"String",
"mapId",
",",
"int",
"reduce",
",",
"Path",
"fileName",
")",
"throws",
"IOException",
"{",
"IndexInformation",
"info",
"=",
"cache",
".",
"get",
"(",
"mapId",
")",
";",
"if",
"(",
"info",
"==",
... | This method gets the index information for the given mapId and reduce.
It reads the index file into cache if it is not already present.
@param mapId
@param reduce
@param fileName The file to read the index information from if it is not
already present in the cache
@return The Index Information
@throws IOException | [
"This",
"method",
"gets",
"the",
"index",
"information",
"for",
"the",
"given",
"mapId",
"and",
"reduce",
".",
"It",
"reads",
"the",
"index",
"file",
"into",
"cache",
"if",
"it",
"is",
"not",
"already",
"present",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/IndexCache.java#L59-L86 |
graphhopper/map-matching | matching-core/src/main/java/com/graphhopper/matching/util/Distributions.java | Distributions.logNormalDistribution | public static double logNormalDistribution(double sigma, double x) {
return Math.log(1.0 / (sqrt(2.0 * PI) * sigma)) + (-0.5 * pow(x / sigma, 2));
} | java | public static double logNormalDistribution(double sigma, double x) {
return Math.log(1.0 / (sqrt(2.0 * PI) * sigma)) + (-0.5 * pow(x / sigma, 2));
} | [
"public",
"static",
"double",
"logNormalDistribution",
"(",
"double",
"sigma",
",",
"double",
"x",
")",
"{",
"return",
"Math",
".",
"log",
"(",
"1.0",
"/",
"(",
"sqrt",
"(",
"2.0",
"*",
"PI",
")",
"*",
"sigma",
")",
")",
"+",
"(",
"-",
"0.5",
"*",
... | Use this function instead of Math.log(normalDistribution(sigma, x)) to avoid an
arithmetic underflow for very small probabilities. | [
"Use",
"this",
"function",
"instead",
"of",
"Math",
".",
"log",
"(",
"normalDistribution",
"(",
"sigma",
"x",
"))",
"to",
"avoid",
"an",
"arithmetic",
"underflow",
"for",
"very",
"small",
"probabilities",
"."
] | train | https://github.com/graphhopper/map-matching/blob/32cd83f14cb990c2be83c8781f22dfb59e0dbeb4/matching-core/src/main/java/com/graphhopper/matching/util/Distributions.java#L38-L40 |
knowm/XChange | xchange-anx/src/main/java/org/knowm/xchange/anx/v2/ANXAdapters.java | ANXAdapters.adaptTrades | public static Trades adaptTrades(List<ANXTrade> anxTrades) {
List<Trade> tradesList = new ArrayList<>();
long latestTid = 0;
for (ANXTrade anxTrade : anxTrades) {
long tid = anxTrade.getTid();
if (tid > latestTid) {
latestTid = tid;
}
tradesList.add(adaptTrade(anxTrade));
}
return new Trades(tradesList, latestTid, TradeSortType.SortByID);
} | java | public static Trades adaptTrades(List<ANXTrade> anxTrades) {
List<Trade> tradesList = new ArrayList<>();
long latestTid = 0;
for (ANXTrade anxTrade : anxTrades) {
long tid = anxTrade.getTid();
if (tid > latestTid) {
latestTid = tid;
}
tradesList.add(adaptTrade(anxTrade));
}
return new Trades(tradesList, latestTid, TradeSortType.SortByID);
} | [
"public",
"static",
"Trades",
"adaptTrades",
"(",
"List",
"<",
"ANXTrade",
">",
"anxTrades",
")",
"{",
"List",
"<",
"Trade",
">",
"tradesList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"long",
"latestTid",
"=",
"0",
";",
"for",
"(",
"ANXTrade",
"a... | Adapts ANXTrade's to a Trades Object
@param anxTrades
@return | [
"Adapts",
"ANXTrade",
"s",
"to",
"a",
"Trades",
"Object"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-anx/src/main/java/org/knowm/xchange/anx/v2/ANXAdapters.java#L207-L219 |
ysc/QuestionAnsweringSystem | deep-qa-web/src/main/java/org/apdplat/qa/api/AskServlet.java | AskServlet.processRequest | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/json;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
String questionStr = request.getParameter("q");
String n = request.getParameter("n");
int topN = -1;
if(n != null && StringUtils.isNumeric(n)){
topN = Integer.parseInt(n);
}
Question question = null;
List<CandidateAnswer> candidateAnswers = null;
if (questionStr != null && questionStr.trim().length() > 3) {
question = SharedQuestionAnsweringSystem.getInstance().answerQuestion(questionStr);
if (question != null) {
candidateAnswers = question.getAllCandidateAnswer();
}
}
LOG.info("问题:"+questionStr);
try (PrintWriter out = response.getWriter()) {
String json = JsonGenerator.generate(candidateAnswers, topN);
out.println(json);
LOG.info("答案:"+json);
}
} | java | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/json;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
String questionStr = request.getParameter("q");
String n = request.getParameter("n");
int topN = -1;
if(n != null && StringUtils.isNumeric(n)){
topN = Integer.parseInt(n);
}
Question question = null;
List<CandidateAnswer> candidateAnswers = null;
if (questionStr != null && questionStr.trim().length() > 3) {
question = SharedQuestionAnsweringSystem.getInstance().answerQuestion(questionStr);
if (question != null) {
candidateAnswers = question.getAllCandidateAnswer();
}
}
LOG.info("问题:"+questionStr);
try (PrintWriter out = response.getWriter()) {
String json = JsonGenerator.generate(candidateAnswers, topN);
out.println(json);
LOG.info("答案:"+json);
}
} | [
"protected",
"void",
"processRequest",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"response",
".",
"setContentType",
"(",
"\"application/json;charset=UTF-8\"",
")",
";",
"respon... | Processes requests for both HTTP <code>GET</code> and <code>POST</code>
methods.
@param request servlet request
@param response servlet response
@throws ServletException if a servlet-specific error occurs
@throws IOException if an I/O error occurs | [
"Processes",
"requests",
"for",
"both",
"HTTP",
"<code",
">",
"GET<",
"/",
"code",
">",
"and",
"<code",
">",
"POST<",
"/",
"code",
">",
"methods",
"."
] | train | https://github.com/ysc/QuestionAnsweringSystem/blob/83f43625f1e0c2f4b72ebca7b0d8282fdf77c997/deep-qa-web/src/main/java/org/apdplat/qa/api/AskServlet.java#L55-L81 |
stephenc/redmine-java-api | src/main/java/org/redmine/ta/RedmineManager.java | RedmineManager.unwrapIO | private void unwrapIO(RedmineException orig, String tag) throws IOException {
Throwable e = orig;
while (e != null) {
if (e instanceof MarkedIOException) {
final MarkedIOException marked = (MarkedIOException) e;
if (tag.equals(marked.getTag()))
throw marked.getIOException();
}
e = e.getCause();
}
} | java | private void unwrapIO(RedmineException orig, String tag) throws IOException {
Throwable e = orig;
while (e != null) {
if (e instanceof MarkedIOException) {
final MarkedIOException marked = (MarkedIOException) e;
if (tag.equals(marked.getTag()))
throw marked.getIOException();
}
e = e.getCause();
}
} | [
"private",
"void",
"unwrapIO",
"(",
"RedmineException",
"orig",
",",
"String",
"tag",
")",
"throws",
"IOException",
"{",
"Throwable",
"e",
"=",
"orig",
";",
"while",
"(",
"e",
"!=",
"null",
")",
"{",
"if",
"(",
"e",
"instanceof",
"MarkedIOException",
")",
... | Unwraps an IO.
@param e
exception to unwrap.
@param tag
target tag.
@throws IOException
@throws RedmineException | [
"Unwraps",
"an",
"IO",
"."
] | train | https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/RedmineManager.java#L721-L731 |
aws/aws-sdk-java | aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/UploadMetadata.java | UploadMetadata.withSignedHeaders | public UploadMetadata withSignedHeaders(java.util.Map<String, String> signedHeaders) {
setSignedHeaders(signedHeaders);
return this;
} | java | public UploadMetadata withSignedHeaders(java.util.Map<String, String> signedHeaders) {
setSignedHeaders(signedHeaders);
return this;
} | [
"public",
"UploadMetadata",
"withSignedHeaders",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"signedHeaders",
")",
"{",
"setSignedHeaders",
"(",
"signedHeaders",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The signed headers.
</p>
@param signedHeaders
The signed headers.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"signed",
"headers",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/UploadMetadata.java#L119-L122 |
rzwitserloot/lombok | src/core/lombok/core/AST.java | AST.replaceStatementInNode | protected boolean replaceStatementInNode(N statement, N oldN, N newN) {
for (FieldAccess fa : fieldsOf(statement.getClass())) {
if (replaceStatementInField(fa, statement, oldN, newN)) return true;
}
return false;
} | java | protected boolean replaceStatementInNode(N statement, N oldN, N newN) {
for (FieldAccess fa : fieldsOf(statement.getClass())) {
if (replaceStatementInField(fa, statement, oldN, newN)) return true;
}
return false;
} | [
"protected",
"boolean",
"replaceStatementInNode",
"(",
"N",
"statement",
",",
"N",
"oldN",
",",
"N",
"newN",
")",
"{",
"for",
"(",
"FieldAccess",
"fa",
":",
"fieldsOf",
"(",
"statement",
".",
"getClass",
"(",
")",
")",
")",
"{",
"if",
"(",
"replaceStatem... | Uses reflection to find the given direct child on the given statement, and replace it with a new child. | [
"Uses",
"reflection",
"to",
"find",
"the",
"given",
"direct",
"child",
"on",
"the",
"given",
"statement",
"and",
"replace",
"it",
"with",
"a",
"new",
"child",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/AST.java#L299-L305 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/FTPClient.java | FTPClient.getLastModified | public Date getLastModified(String filename)
throws IOException, ServerException {
if (filename == null) {
throw new IllegalArgumentException("Required argument missing");
}
Command cmd = new Command("MDTM", filename);
Reply reply = null;
try {
reply = controlChannel.execute(cmd);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(
urce,
"Server refused changing transfer mode");
}
if (dateFormat == null) {
dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
}
try {
return dateFormat.parse(reply.getMessage());
} catch (ParseException e) {
throw ServerException.embedFTPReplyParseException(
new FTPReplyParseException(
0,
"Invalid file modification time reply: " + reply));
}
} | java | public Date getLastModified(String filename)
throws IOException, ServerException {
if (filename == null) {
throw new IllegalArgumentException("Required argument missing");
}
Command cmd = new Command("MDTM", filename);
Reply reply = null;
try {
reply = controlChannel.execute(cmd);
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
} catch (UnexpectedReplyCodeException urce) {
throw ServerException.embedUnexpectedReplyCodeException(
urce,
"Server refused changing transfer mode");
}
if (dateFormat == null) {
dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
}
try {
return dateFormat.parse(reply.getMessage());
} catch (ParseException e) {
throw ServerException.embedFTPReplyParseException(
new FTPReplyParseException(
0,
"Invalid file modification time reply: " + reply));
}
} | [
"public",
"Date",
"getLastModified",
"(",
"String",
"filename",
")",
"throws",
"IOException",
",",
"ServerException",
"{",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Required argument missing\"",
")",
";",
"}... | Returns last modification time of the specifed file.
@param filename filename get the last modification time for.
@return the time and date of the last modification.
@exception ServerException if the file does not exist or
an error occured. | [
"Returns",
"last",
"modification",
"time",
"of",
"the",
"specifed",
"file",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L171-L201 |
bThink-BGU/BPjs | src/main/java/il/ac/bgu/cs/bp/bpjs/model/BThreadSyncSnapshot.java | BThreadSyncSnapshot.copyWith | public BThreadSyncSnapshot copyWith(Object aContinuation, SyncStatement aStatement) {
BThreadSyncSnapshot retVal = new BThreadSyncSnapshot(name, entryPoint);
retVal.continuation = aContinuation;
retVal.setInterruptHandler(interruptHandler);
retVal.syncStatement = aStatement;
aStatement.setBthread(retVal);
return retVal;
} | java | public BThreadSyncSnapshot copyWith(Object aContinuation, SyncStatement aStatement) {
BThreadSyncSnapshot retVal = new BThreadSyncSnapshot(name, entryPoint);
retVal.continuation = aContinuation;
retVal.setInterruptHandler(interruptHandler);
retVal.syncStatement = aStatement;
aStatement.setBthread(retVal);
return retVal;
} | [
"public",
"BThreadSyncSnapshot",
"copyWith",
"(",
"Object",
"aContinuation",
",",
"SyncStatement",
"aStatement",
")",
"{",
"BThreadSyncSnapshot",
"retVal",
"=",
"new",
"BThreadSyncSnapshot",
"(",
"name",
",",
"entryPoint",
")",
";",
"retVal",
".",
"continuation",
"=... | Creates the next snapshot of the BThread in a given run.
@param aContinuation The BThread's continuation for the next sync.
@param aStatement The BThread's statement for the next sync.
@return a copy of {@code this} with updated continuation and statement. | [
"Creates",
"the",
"next",
"snapshot",
"of",
"the",
"BThread",
"in",
"a",
"given",
"run",
"."
] | train | https://github.com/bThink-BGU/BPjs/blob/2d388365a27ad79ded108eaf98a35a7ef292ae1f/src/main/java/il/ac/bgu/cs/bp/bpjs/model/BThreadSyncSnapshot.java#L81-L89 |
jankotek/mapdb | src/main/java/org/mapdb/io/DataIO.java | DataIO.packInt | static public void packInt(DataOutput out, int value) throws IOException {
// Optimize for the common case where value is small. This is particular important where our caller
// is SerializerBase.SER_STRING.serialize because most chars will be ASCII characters and hence in this range.
// credit Max Bolingbroke https://github.com/jankotek/MapDB/pull/489
int shift = (value & ~0x7F); //reuse variable
if (shift != 0) {
//$DELAY$
shift = 31-Integer.numberOfLeadingZeros(value);
shift -= shift%7; // round down to nearest multiple of 7
while(shift!=0){
out.writeByte((byte) ((value>>>shift) & 0x7F));
//$DELAY$
shift-=7;
}
}
//$DELAY$
out.writeByte((byte) ((value & 0x7F)|0x80));
} | java | static public void packInt(DataOutput out, int value) throws IOException {
// Optimize for the common case where value is small. This is particular important where our caller
// is SerializerBase.SER_STRING.serialize because most chars will be ASCII characters and hence in this range.
// credit Max Bolingbroke https://github.com/jankotek/MapDB/pull/489
int shift = (value & ~0x7F); //reuse variable
if (shift != 0) {
//$DELAY$
shift = 31-Integer.numberOfLeadingZeros(value);
shift -= shift%7; // round down to nearest multiple of 7
while(shift!=0){
out.writeByte((byte) ((value>>>shift) & 0x7F));
//$DELAY$
shift-=7;
}
}
//$DELAY$
out.writeByte((byte) ((value & 0x7F)|0x80));
} | [
"static",
"public",
"void",
"packInt",
"(",
"DataOutput",
"out",
",",
"int",
"value",
")",
"throws",
"IOException",
"{",
"// Optimize for the common case where value is small. This is particular important where our caller",
"// is SerializerBase.SER_STRING.serialize because most chars ... | Pack int into an output stream.
It will occupy 1-5 bytes depending on value (lower values occupy smaller space)
@param out DataOutput to put value into
@param value to be serialized, must be non-negative
@throws java.io.IOException in case of IO error | [
"Pack",
"int",
"into",
"an",
"output",
"stream",
".",
"It",
"will",
"occupy",
"1",
"-",
"5",
"bytes",
"depending",
"on",
"value",
"(",
"lower",
"values",
"occupy",
"smaller",
"space",
")"
] | train | https://github.com/jankotek/mapdb/blob/dfd873b2b9cc4e299228839c100adf93a98f1903/src/main/java/org/mapdb/io/DataIO.java#L201-L219 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/MessageBirdClient.java | MessageBirdClient.createTranscription | public TranscriptionResponse createTranscription(String callID, String legId, String recordingId, String language)
throws UnauthorizedException, GeneralException {
if (callID == null) {
throw new IllegalArgumentException("Voice call ID must be specified.");
}
if (legId == null) {
throw new IllegalArgumentException("Leg ID must be specified.");
}
if (recordingId == null) {
throw new IllegalArgumentException("Recording ID must be specified.");
}
if (language == null) {
throw new IllegalArgumentException("Language must be specified.");
}
if (!Arrays.asList(supportedLanguages).contains(language)) {
throw new IllegalArgumentException("Your language is not allowed.");
}
String url = String.format(
"%s%s/%s%s/%s%s/%s%s",
VOICE_CALLS_BASE_URL,
VOICECALLSPATH,
callID,
LEGSPATH,
legId,
RECORDINGPATH,
recordingId,
TRANSCRIPTIONPATH);
return messageBirdService.sendPayLoad(url, language, TranscriptionResponse.class);
} | java | public TranscriptionResponse createTranscription(String callID, String legId, String recordingId, String language)
throws UnauthorizedException, GeneralException {
if (callID == null) {
throw new IllegalArgumentException("Voice call ID must be specified.");
}
if (legId == null) {
throw new IllegalArgumentException("Leg ID must be specified.");
}
if (recordingId == null) {
throw new IllegalArgumentException("Recording ID must be specified.");
}
if (language == null) {
throw new IllegalArgumentException("Language must be specified.");
}
if (!Arrays.asList(supportedLanguages).contains(language)) {
throw new IllegalArgumentException("Your language is not allowed.");
}
String url = String.format(
"%s%s/%s%s/%s%s/%s%s",
VOICE_CALLS_BASE_URL,
VOICECALLSPATH,
callID,
LEGSPATH,
legId,
RECORDINGPATH,
recordingId,
TRANSCRIPTIONPATH);
return messageBirdService.sendPayLoad(url, language, TranscriptionResponse.class);
} | [
"public",
"TranscriptionResponse",
"createTranscription",
"(",
"String",
"callID",
",",
"String",
"legId",
",",
"String",
"recordingId",
",",
"String",
"language",
")",
"throws",
"UnauthorizedException",
",",
"GeneralException",
"{",
"if",
"(",
"callID",
"==",
"null... | Function to view recording by call id , leg id and recording id
@param callID Voice call ID
@param legId Leg ID
@param recordingId Recording ID
@param language Language
@return TranscriptionResponseList
@throws UnauthorizedException if client is unauthorized
@throws GeneralException general exception | [
"Function",
"to",
"view",
"recording",
"by",
"call",
"id",
"leg",
"id",
"and",
"recording",
"id"
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L1084-L1118 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/UriEscaper.java | UriEscaper.escapeQueryParam | public static String escapeQueryParam(final String queryParam, final boolean strict) {
return (strict ? STRICT_ESCAPER : ESCAPER).escapeQueryParam(queryParam);
} | java | public static String escapeQueryParam(final String queryParam, final boolean strict) {
return (strict ? STRICT_ESCAPER : ESCAPER).escapeQueryParam(queryParam);
} | [
"public",
"static",
"String",
"escapeQueryParam",
"(",
"final",
"String",
"queryParam",
",",
"final",
"boolean",
"strict",
")",
"{",
"return",
"(",
"strict",
"?",
"STRICT_ESCAPER",
":",
"ESCAPER",
")",
".",
"escapeQueryParam",
"(",
"queryParam",
")",
";",
"}"
... | Escapes a string as a URI query parameter (same as a strict query, but also escaping & and =)
@param queryParam the parameter to escape
@param strict whether or not to do strict escaping
@return the escaped string | [
"Escapes",
"a",
"string",
"as",
"a",
"URI",
"query",
"parameter",
"(",
"same",
"as",
"a",
"strict",
"query",
"but",
"also",
"escaping",
"&",
"and",
"=",
")"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/UriEscaper.java#L260-L262 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.rnnSetPreviousState | public void rnnSetPreviousState(int layer, Map<String, INDArray> state) {
rnnSetPreviousState(layers[layer].conf().getLayer().getLayerName(), state);
} | java | public void rnnSetPreviousState(int layer, Map<String, INDArray> state) {
rnnSetPreviousState(layers[layer].conf().getLayer().getLayerName(), state);
} | [
"public",
"void",
"rnnSetPreviousState",
"(",
"int",
"layer",
",",
"Map",
"<",
"String",
",",
"INDArray",
">",
"state",
")",
"{",
"rnnSetPreviousState",
"(",
"layers",
"[",
"layer",
"]",
".",
"conf",
"(",
")",
".",
"getLayer",
"(",
")",
".",
"getLayerNam... | Set the state of the RNN layer, for use in {@link #rnnTimeStep(INDArray...)}
@param layer The number/index of the layer.
@param state The state to set the specified layer to | [
"Set",
"the",
"state",
"of",
"the",
"RNN",
"layer",
"for",
"use",
"in",
"{",
"@link",
"#rnnTimeStep",
"(",
"INDArray",
"...",
")",
"}"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3505-L3507 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java | XmlStringBuilder.appendOptionalAttribute | public void appendOptionalAttribute(final String name, final boolean flag, final Object value) {
if (flag) {
appendAttribute(name, value);
}
} | java | public void appendOptionalAttribute(final String name, final boolean flag, final Object value) {
if (flag) {
appendAttribute(name, value);
}
} | [
"public",
"void",
"appendOptionalAttribute",
"(",
"final",
"String",
"name",
",",
"final",
"boolean",
"flag",
",",
"final",
"Object",
"value",
")",
"{",
"if",
"(",
"flag",
")",
"{",
"appendAttribute",
"(",
"name",
",",
"value",
")",
";",
"}",
"}"
] | <p>
If the flag is true, add an xml attribute name+value pair to the end of this XmlStringBuilder
<p>
Eg. name="value"
</p>
@param name the name of the boolean attribute to be added.
@param flag should this attribute be set.
@param value the value of the attribute. | [
"<p",
">",
"If",
"the",
"flag",
"is",
"true",
"add",
"an",
"xml",
"attribute",
"name",
"+",
"value",
"pair",
"to",
"the",
"end",
"of",
"this",
"XmlStringBuilder",
"<p",
">",
"Eg",
".",
"name",
"=",
"value",
"<",
"/",
"p",
">"
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java#L267-L271 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractTreeTableDataModel.java | AbstractTreeTableDataModel.getValueAt | @Override
public final Object getValueAt(final int row, final int col) {
TableTreeNode rowNode = getNodeAtLine(row);
return getValueAt(rowNode, col);
} | java | @Override
public final Object getValueAt(final int row, final int col) {
TableTreeNode rowNode = getNodeAtLine(row);
return getValueAt(rowNode, col);
} | [
"@",
"Override",
"public",
"final",
"Object",
"getValueAt",
"(",
"final",
"int",
"row",
",",
"final",
"int",
"col",
")",
"{",
"TableTreeNode",
"rowNode",
"=",
"getNodeAtLine",
"(",
"row",
")",
";",
"return",
"getValueAt",
"(",
"rowNode",
",",
"col",
")",
... | Retrieves the value at the given row and column. This implementation delegates to
{@link #getValueAt(TableTreeNode, int)}, which subclasses must implement.
@param row the row index
@param col the column index.
@return the value for the specified cell. | [
"Retrieves",
"the",
"value",
"at",
"the",
"given",
"row",
"and",
"column",
".",
"This",
"implementation",
"delegates",
"to",
"{",
"@link",
"#getValueAt",
"(",
"TableTreeNode",
"int",
")",
"}",
"which",
"subclasses",
"must",
"implement",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractTreeTableDataModel.java#L69-L73 |
aws/aws-sdk-java | aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/UpdateUserPoolRequest.java | UpdateUserPoolRequest.withUserPoolTags | public UpdateUserPoolRequest withUserPoolTags(java.util.Map<String, String> userPoolTags) {
setUserPoolTags(userPoolTags);
return this;
} | java | public UpdateUserPoolRequest withUserPoolTags(java.util.Map<String, String> userPoolTags) {
setUserPoolTags(userPoolTags);
return this;
} | [
"public",
"UpdateUserPoolRequest",
"withUserPoolTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"userPoolTags",
")",
"{",
"setUserPoolTags",
"(",
"userPoolTags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage
user pools in different ways, such as by purpose, owner, environment, or other criteria.
</p>
@param userPoolTags
The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and
manage user pools in different ways, such as by purpose, owner, environment, or other criteria.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tag",
"keys",
"and",
"values",
"to",
"assign",
"to",
"the",
"user",
"pool",
".",
"A",
"tag",
"is",
"a",
"label",
"that",
"you",
"can",
"use",
"to",
"categorize",
"and",
"manage",
"user",
"pools",
"in",
"different",
"ways",
"such",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/UpdateUserPoolRequest.java#L986-L989 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java | ChannelHelper.read | public static final long read(ReadableByteChannel channel, ByteBuffer[] dsts, int offset, int length) throws IOException
{
long res = 0;
for (int ii=0;ii<length;ii++)
{
ByteBuffer bb = dsts[ii+offset];
if (bb.hasRemaining())
{
int rc = channel.read(bb);
if (rc == -1)
{
if (res == 0)
{
return -1;
}
else
{
return res;
}
}
res += rc;
if (bb.hasRemaining())
{
break;
}
}
}
return res;
} | java | public static final long read(ReadableByteChannel channel, ByteBuffer[] dsts, int offset, int length) throws IOException
{
long res = 0;
for (int ii=0;ii<length;ii++)
{
ByteBuffer bb = dsts[ii+offset];
if (bb.hasRemaining())
{
int rc = channel.read(bb);
if (rc == -1)
{
if (res == 0)
{
return -1;
}
else
{
return res;
}
}
res += rc;
if (bb.hasRemaining())
{
break;
}
}
}
return res;
} | [
"public",
"static",
"final",
"long",
"read",
"(",
"ReadableByteChannel",
"channel",
",",
"ByteBuffer",
"[",
"]",
"dsts",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"long",
"res",
"=",
"0",
";",
"for",
"(",
"int",
"ii",... | ScatteringChannel support
@param channel
@param dsts
@param offset
@param length
@return
@throws IOException | [
"ScatteringChannel",
"support"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L187-L215 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/GroupsApi.java | GroupsApi.listGroupUsers | public UsersResponse listGroupUsers(String accountId, String groupId) throws ApiException {
return listGroupUsers(accountId, groupId, null);
} | java | public UsersResponse listGroupUsers(String accountId, String groupId) throws ApiException {
return listGroupUsers(accountId, groupId, null);
} | [
"public",
"UsersResponse",
"listGroupUsers",
"(",
"String",
"accountId",
",",
"String",
"groupId",
")",
"throws",
"ApiException",
"{",
"return",
"listGroupUsers",
"(",
"accountId",
",",
"groupId",
",",
"null",
")",
";",
"}"
] | Gets a list of users in a group.
Retrieves a list of users in a group.
@param accountId The external account number (int) or account ID Guid. (required)
@param groupId The ID of the group being accessed. (required)
@return UsersResponse | [
"Gets",
"a",
"list",
"of",
"users",
"in",
"a",
"group",
".",
"Retrieves",
"a",
"list",
"of",
"users",
"in",
"a",
"group",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/GroupsApi.java#L315-L317 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/BindPath.java | BindPath.addListeners | public void addListeners(PropertyChangeListener listener, Object newObject, Set updateSet) {
removeListeners();
if (newObject != null) {
// check for local synthetics
TriggerBinding syntheticTrigger = getSyntheticTriggerBinding(newObject);
MetaClass mc = InvokerHelper.getMetaClass(newObject);
if (syntheticTrigger != null) {
PropertyBinding psb = new PropertyBinding(newObject, propertyName);
PropertyChangeProxyTargetBinding proxytb = new PropertyChangeProxyTargetBinding(newObject, propertyName, listener);
syntheticFullBinding = syntheticTrigger.createBinding(psb, proxytb);
syntheticFullBinding.bind();
updateSet.add(newObject);
} else if (!mc.respondsTo(newObject, "addPropertyChangeListener", NAME_PARAMS).isEmpty()) {
InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", new Object[] {propertyName, listener});
localListener = listener;
updateSet.add(newObject);
} else if (!mc.respondsTo(newObject, "addPropertyChangeListener", GLOBAL_PARAMS).isEmpty()) {
InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", listener);
globalListener = listener;
updateSet.add(newObject);
}
}
currentObject = newObject;
} | java | public void addListeners(PropertyChangeListener listener, Object newObject, Set updateSet) {
removeListeners();
if (newObject != null) {
// check for local synthetics
TriggerBinding syntheticTrigger = getSyntheticTriggerBinding(newObject);
MetaClass mc = InvokerHelper.getMetaClass(newObject);
if (syntheticTrigger != null) {
PropertyBinding psb = new PropertyBinding(newObject, propertyName);
PropertyChangeProxyTargetBinding proxytb = new PropertyChangeProxyTargetBinding(newObject, propertyName, listener);
syntheticFullBinding = syntheticTrigger.createBinding(psb, proxytb);
syntheticFullBinding.bind();
updateSet.add(newObject);
} else if (!mc.respondsTo(newObject, "addPropertyChangeListener", NAME_PARAMS).isEmpty()) {
InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", new Object[] {propertyName, listener});
localListener = listener;
updateSet.add(newObject);
} else if (!mc.respondsTo(newObject, "addPropertyChangeListener", GLOBAL_PARAMS).isEmpty()) {
InvokerHelper.invokeMethod(newObject, "addPropertyChangeListener", listener);
globalListener = listener;
updateSet.add(newObject);
}
}
currentObject = newObject;
} | [
"public",
"void",
"addListeners",
"(",
"PropertyChangeListener",
"listener",
",",
"Object",
"newObject",
",",
"Set",
"updateSet",
")",
"{",
"removeListeners",
"(",
")",
";",
"if",
"(",
"newObject",
"!=",
"null",
")",
"{",
"// check for local synthetics",
"TriggerB... | Add listeners to a specific object. Updates the bould flags and update set
@param listener This listener to attach.
@param newObject The object we should read our property off of.
@param updateSet The list of objects we have added listeners to | [
"Add",
"listeners",
"to",
"a",
"specific",
"object",
".",
"Updates",
"the",
"bould",
"flags",
"and",
"update",
"set"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/BindPath.java#L155-L179 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/DeterministicHierarchy.java | DeterministicHierarchy.get | public DeterministicKey get(List<ChildNumber> path, boolean relativePath, boolean create) {
ImmutableList<ChildNumber> absolutePath = relativePath
? ImmutableList.<ChildNumber>builder().addAll(rootPath).addAll(path).build()
: ImmutableList.copyOf(path);
if (!keys.containsKey(absolutePath)) {
if (!create)
throw new IllegalArgumentException(String.format(Locale.US, "No key found for %s path %s.",
relativePath ? "relative" : "absolute", HDUtils.formatPath(path)));
checkArgument(absolutePath.size() > 0, "Can't derive the master key: nothing to derive from.");
DeterministicKey parent = get(absolutePath.subList(0, absolutePath.size() - 1), false, true);
putKey(HDKeyDerivation.deriveChildKey(parent, absolutePath.get(absolutePath.size() - 1)));
}
return keys.get(absolutePath);
} | java | public DeterministicKey get(List<ChildNumber> path, boolean relativePath, boolean create) {
ImmutableList<ChildNumber> absolutePath = relativePath
? ImmutableList.<ChildNumber>builder().addAll(rootPath).addAll(path).build()
: ImmutableList.copyOf(path);
if (!keys.containsKey(absolutePath)) {
if (!create)
throw new IllegalArgumentException(String.format(Locale.US, "No key found for %s path %s.",
relativePath ? "relative" : "absolute", HDUtils.formatPath(path)));
checkArgument(absolutePath.size() > 0, "Can't derive the master key: nothing to derive from.");
DeterministicKey parent = get(absolutePath.subList(0, absolutePath.size() - 1), false, true);
putKey(HDKeyDerivation.deriveChildKey(parent, absolutePath.get(absolutePath.size() - 1)));
}
return keys.get(absolutePath);
} | [
"public",
"DeterministicKey",
"get",
"(",
"List",
"<",
"ChildNumber",
">",
"path",
",",
"boolean",
"relativePath",
",",
"boolean",
"create",
")",
"{",
"ImmutableList",
"<",
"ChildNumber",
">",
"absolutePath",
"=",
"relativePath",
"?",
"ImmutableList",
".",
"<",
... | Returns a key for the given path, optionally creating it.
@param path the path to the key
@param relativePath whether the path is relative to the root path
@param create whether the key corresponding to path should be created (with any necessary ancestors) if it doesn't exist already
@return next newly created key using the child derivation function
@throws IllegalArgumentException if create is false and the path was not found. | [
"Returns",
"a",
"key",
"for",
"the",
"given",
"path",
"optionally",
"creating",
"it",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicHierarchy.java#L83-L96 |
wuman/orientdb-android | commons/src/main/java/com/orientechnologies/common/collection/OMVRBTree.java | OMVRBTree.buildFromSorted | private void buildFromSorted(final int size, final Iterator<?> it, final java.io.ObjectInputStream str, final V defaultVal)
throws java.io.IOException, ClassNotFoundException {
setSize(size);
root = buildFromSorted(0, 0, size - 1, computeRedLevel(size), it, str, defaultVal);
} | java | private void buildFromSorted(final int size, final Iterator<?> it, final java.io.ObjectInputStream str, final V defaultVal)
throws java.io.IOException, ClassNotFoundException {
setSize(size);
root = buildFromSorted(0, 0, size - 1, computeRedLevel(size), it, str, defaultVal);
} | [
"private",
"void",
"buildFromSorted",
"(",
"final",
"int",
"size",
",",
"final",
"Iterator",
"<",
"?",
">",
"it",
",",
"final",
"java",
".",
"io",
".",
"ObjectInputStream",
"str",
",",
"final",
"V",
"defaultVal",
")",
"throws",
"java",
".",
"io",
".",
... | Linear time tree building algorithm from sorted data. Can accept keys and/or values from iterator or stream. This leads to too
many parameters, but seems better than alternatives. The four formats that this method accepts are:
1) An iterator of Map.Entries. (it != null, defaultVal == null). 2) An iterator of keys. (it != null, defaultVal != null). 3) A
stream of alternating serialized keys and values. (it == null, defaultVal == null). 4) A stream of serialized keys. (it ==
null, defaultVal != null).
It is assumed that the comparator of the OMVRBTree is already set prior to calling this method.
@param size
the number of keys (or key-value pairs) to be read from the iterator or stream
@param it
If non-null, new entries are created from entries or keys read from this iterator.
@param str
If non-null, new entries are created from keys and possibly values read from this stream in serialized form. Exactly
one of it and str should be non-null.
@param defaultVal
if non-null, this default value is used for each value in the map. If null, each value is read from iterator or
stream, as described above.
@throws IOException
propagated from stream reads. This cannot occur if str is null.
@throws ClassNotFoundException
propagated from readObject. This cannot occur if str is null. | [
"Linear",
"time",
"tree",
"building",
"algorithm",
"from",
"sorted",
"data",
".",
"Can",
"accept",
"keys",
"and",
"/",
"or",
"values",
"from",
"iterator",
"or",
"stream",
".",
"This",
"leads",
"to",
"too",
"many",
"parameters",
"but",
"seems",
"better",
"t... | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/collection/OMVRBTree.java#L2667-L2671 |
osiam/connector4java | src/main/java/org/osiam/client/OsiamConnector.java | OsiamConnector.createUser | public User createUser(User user, AccessToken accessToken) {
return getUserService().createUser(user, accessToken);
} | java | public User createUser(User user, AccessToken accessToken) {
return getUserService().createUser(user, accessToken);
} | [
"public",
"User",
"createUser",
"(",
"User",
"user",
",",
"AccessToken",
"accessToken",
")",
"{",
"return",
"getUserService",
"(",
")",
".",
"createUser",
"(",
"user",
",",
"accessToken",
")",
";",
"}"
] | saves the given {@link User} to the OSIAM DB.
@param user user to be saved
@param accessToken the OSIAM access token from for the current session
@return the same user Object like the given but with filled metadata and a new valid id
@throws UnauthorizedException if the request could not be authorized.
@throws ConflictException if the User could not be created
@throws ForbiddenException if the scope doesn't allow this request
@throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized
@throws IllegalStateException if OSIAM's endpoint(s) are not properly configured | [
"saves",
"the",
"given",
"{",
"@link",
"User",
"}",
"to",
"the",
"OSIAM",
"DB",
"."
] | train | https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L454-L456 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.deleteLogEntries | public void deleteLogEntries(CmsDbContext dbc, CmsLogFilter filter) throws CmsException {
updateLog(dbc);
m_projectDriver.deleteLog(dbc, filter);
} | java | public void deleteLogEntries(CmsDbContext dbc, CmsLogFilter filter) throws CmsException {
updateLog(dbc);
m_projectDriver.deleteLog(dbc, filter);
} | [
"public",
"void",
"deleteLogEntries",
"(",
"CmsDbContext",
"dbc",
",",
"CmsLogFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"updateLog",
"(",
"dbc",
")",
";",
"m_projectDriver",
".",
"deleteLog",
"(",
"dbc",
",",
"filter",
")",
";",
"}"
] | Deletes all log entries matching the given filter.<p>
@param dbc the current db context
@param filter the filter to use for deletion
@throws CmsException if something goes wrong
@see CmsSecurityManager#deleteLogEntries(CmsRequestContext, CmsLogFilter) | [
"Deletes",
"all",
"log",
"entries",
"matching",
"the",
"given",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2557-L2561 |
lkwg82/enforcer-rules | src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java | AbstractVersionEnforcer.containsVersion | public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
{
boolean matched = false;
ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion();
if ( recommendedVersion == null )
{
@SuppressWarnings( "unchecked" )
List<Restriction> restrictions = allowedRange.getRestrictions();
for ( Restriction restriction : restrictions )
{
if ( restriction.containsVersion( theVersion ) )
{
matched = true;
break;
}
}
}
else
{
// only singular versions ever have a recommendedVersion
@SuppressWarnings( "unchecked" )
int compareTo = recommendedVersion.compareTo( theVersion );
matched = ( compareTo <= 0 );
}
return matched;
} | java | public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
{
boolean matched = false;
ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion();
if ( recommendedVersion == null )
{
@SuppressWarnings( "unchecked" )
List<Restriction> restrictions = allowedRange.getRestrictions();
for ( Restriction restriction : restrictions )
{
if ( restriction.containsVersion( theVersion ) )
{
matched = true;
break;
}
}
}
else
{
// only singular versions ever have a recommendedVersion
@SuppressWarnings( "unchecked" )
int compareTo = recommendedVersion.compareTo( theVersion );
matched = ( compareTo <= 0 );
}
return matched;
} | [
"public",
"static",
"boolean",
"containsVersion",
"(",
"VersionRange",
"allowedRange",
",",
"ArtifactVersion",
"theVersion",
")",
"{",
"boolean",
"matched",
"=",
"false",
";",
"ArtifactVersion",
"recommendedVersion",
"=",
"allowedRange",
".",
"getRecommendedVersion",
"(... | Copied from Artifact.VersionRange. This is tweaked to handle singular ranges properly. Currently the default
containsVersion method assumes a singular version means allow everything. This method assumes that "2.0.4" ==
"[2.0.4,)"
@param allowedRange range of allowed versions.
@param theVersion the version to be checked.
@return true if the version is contained by the range. | [
"Copied",
"from",
"Artifact",
".",
"VersionRange",
".",
"This",
"is",
"tweaked",
"to",
"handle",
"singular",
"ranges",
"properly",
".",
"Currently",
"the",
"default",
"containsVersion",
"method",
"assumes",
"a",
"singular",
"version",
"means",
"allow",
"everything... | train | https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java#L127-L152 |
pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java | Ledgers.openRead | static LedgerHandle openRead(long ledgerId, BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException {
try {
return Exceptions.handleInterruptedCall(
() -> bookKeeper.openLedgerNoRecovery(ledgerId, LEDGER_DIGEST_TYPE, config.getBKPassword()));
} catch (BKException bkEx) {
throw new DurableDataLogException(String.format("Unable to open-read ledger %d.", ledgerId), bkEx);
}
} | java | static LedgerHandle openRead(long ledgerId, BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException {
try {
return Exceptions.handleInterruptedCall(
() -> bookKeeper.openLedgerNoRecovery(ledgerId, LEDGER_DIGEST_TYPE, config.getBKPassword()));
} catch (BKException bkEx) {
throw new DurableDataLogException(String.format("Unable to open-read ledger %d.", ledgerId), bkEx);
}
} | [
"static",
"LedgerHandle",
"openRead",
"(",
"long",
"ledgerId",
",",
"BookKeeper",
"bookKeeper",
",",
"BookKeeperConfig",
"config",
")",
"throws",
"DurableDataLogException",
"{",
"try",
"{",
"return",
"Exceptions",
".",
"handleInterruptedCall",
"(",
"(",
")",
"->",
... | Opens a ledger for reading. This operation does not fence out the ledger.
@param ledgerId The Id of the Ledger to open.
@param bookKeeper A references to the BookKeeper client to use.
@param config Configuration to use.
@return A LedgerHandle for the newly opened ledger.
@throws DurableDataLogException If an exception occurred. The causing exception is wrapped inside it. | [
"Opens",
"a",
"ledger",
"for",
"reading",
".",
"This",
"operation",
"does",
"not",
"fence",
"out",
"the",
"ledger",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java#L88-L95 |
jenetics/jenetics | jenetics/src/main/java/io/jenetics/internal/math/random.java | random.nextInt | public static int nextInt(final IntRange range, final Random random) {
return range.size() == 1
? range.getMin()
: nextInt(range.getMin(), range.getMax(), random);
} | java | public static int nextInt(final IntRange range, final Random random) {
return range.size() == 1
? range.getMin()
: nextInt(range.getMin(), range.getMax(), random);
} | [
"public",
"static",
"int",
"nextInt",
"(",
"final",
"IntRange",
"range",
",",
"final",
"Random",
"random",
")",
"{",
"return",
"range",
".",
"size",
"(",
")",
"==",
"1",
"?",
"range",
".",
"getMin",
"(",
")",
":",
"nextInt",
"(",
"range",
".",
"getMi... | Returns a pseudo-random, uniformly distributed int value between origin
(included) and bound (excluded).
@param range the allowed integer range
@param random the random engine to use for calculating the random
int value
@return a random integer greater than or equal to {@code min} and
less than or equal to {@code max}
@throws IllegalArgumentException if {@code range.getMin() >= range.getMax()} | [
"Returns",
"a",
"pseudo",
"-",
"random",
"uniformly",
"distributed",
"int",
"value",
"between",
"origin",
"(",
"included",
")",
"and",
"bound",
"(",
"excluded",
")",
"."
] | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/math/random.java#L112-L116 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java | ExpressRouteConnectionsInner.listAsync | public Observable<ExpressRouteConnectionListInner> listAsync(String resourceGroupName, String expressRouteGatewayName) {
return listWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName).map(new Func1<ServiceResponse<ExpressRouteConnectionListInner>, ExpressRouteConnectionListInner>() {
@Override
public ExpressRouteConnectionListInner call(ServiceResponse<ExpressRouteConnectionListInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteConnectionListInner> listAsync(String resourceGroupName, String expressRouteGatewayName) {
return listWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName).map(new Func1<ServiceResponse<ExpressRouteConnectionListInner>, ExpressRouteConnectionListInner>() {
@Override
public ExpressRouteConnectionListInner call(ServiceResponse<ExpressRouteConnectionListInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteConnectionListInner",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRouteGatewayName",
")",
... | Lists ExpressRouteConnections.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteConnectionListInner object | [
"Lists",
"ExpressRouteConnections",
"."
] | 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/ExpressRouteConnectionsInner.java#L557-L564 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/validation/RelsValidator.java | RelsValidator.checkBadAssertion | private void checkBadAssertion(String nsURI, String localName, String qName)
throws SAXException {
if (m_dsId.equals(RELS_EXT)
&& (nsURI.equals(DC.uri) || nsURI.equals(OAI_DC.uri))) {
throw new SAXException("RelsExtValidator:"
+ " The RELS-EXT datastream has improper"
+ " relationship assertion: " + qName + ".\n"
+ " No Dublin Core assertions allowed"
+ " in Fedora relationship metadata.");
} else if (nsURI.equals(MODEL.uri)) {
if ((m_dsId.equals(RELS_INT)
&& !localName.equals(MODEL.DOWNLOAD_FILENAME.localName) )
||
(m_dsId.equals(RELS_EXT)
&& !localName.equals(MODEL.HAS_SERVICE.localName)
&& !localName.equals(MODEL.IS_CONTRACTOR_OF.localName)
&& !localName.equals(MODEL.HAS_MODEL.localName)
&& !localName.equals(MODEL.IS_DEPLOYMENT_OF.localName)
)) {
throw new SAXException("RelsExtValidator:"
+ " Disallowed predicate in " + m_dsId + ": "
+ qName
+ "\n"
+ " The only predicates from the fedora-model namespace"
+ " allowed in RELS-EXT are "
+ MODEL.HAS_SERVICE.localName + ", "
+ MODEL.IS_CONTRACTOR_OF.localName + ", "
+ MODEL.HAS_MODEL.localName + ", "
+ MODEL.IS_DEPLOYMENT_OF.localName + ". The only predicate allowed "
+ "in RELS-INT is "
+ MODEL.DOWNLOAD_FILENAME.localName +"."
);
}
} else if (nsURI.equals(VIEW.uri)) {
throw new SAXException("RelsExtValidator:"
+ " Disallowed predicate in RELS-EXT: " + qName + "\n"
+ " The fedora-view namespace is reserved by Fedora.");
}
} | java | private void checkBadAssertion(String nsURI, String localName, String qName)
throws SAXException {
if (m_dsId.equals(RELS_EXT)
&& (nsURI.equals(DC.uri) || nsURI.equals(OAI_DC.uri))) {
throw new SAXException("RelsExtValidator:"
+ " The RELS-EXT datastream has improper"
+ " relationship assertion: " + qName + ".\n"
+ " No Dublin Core assertions allowed"
+ " in Fedora relationship metadata.");
} else if (nsURI.equals(MODEL.uri)) {
if ((m_dsId.equals(RELS_INT)
&& !localName.equals(MODEL.DOWNLOAD_FILENAME.localName) )
||
(m_dsId.equals(RELS_EXT)
&& !localName.equals(MODEL.HAS_SERVICE.localName)
&& !localName.equals(MODEL.IS_CONTRACTOR_OF.localName)
&& !localName.equals(MODEL.HAS_MODEL.localName)
&& !localName.equals(MODEL.IS_DEPLOYMENT_OF.localName)
)) {
throw new SAXException("RelsExtValidator:"
+ " Disallowed predicate in " + m_dsId + ": "
+ qName
+ "\n"
+ " The only predicates from the fedora-model namespace"
+ " allowed in RELS-EXT are "
+ MODEL.HAS_SERVICE.localName + ", "
+ MODEL.IS_CONTRACTOR_OF.localName + ", "
+ MODEL.HAS_MODEL.localName + ", "
+ MODEL.IS_DEPLOYMENT_OF.localName + ". The only predicate allowed "
+ "in RELS-INT is "
+ MODEL.DOWNLOAD_FILENAME.localName +"."
);
}
} else if (nsURI.equals(VIEW.uri)) {
throw new SAXException("RelsExtValidator:"
+ " Disallowed predicate in RELS-EXT: " + qName + "\n"
+ " The fedora-view namespace is reserved by Fedora.");
}
} | [
"private",
"void",
"checkBadAssertion",
"(",
"String",
"nsURI",
",",
"String",
"localName",
",",
"String",
"qName",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"m_dsId",
".",
"equals",
"(",
"RELS_EXT",
")",
"&&",
"(",
"nsURI",
".",
"equals",
"(",
"DC",
... | checkBadAssertion: checks that the DC and fedora-view namespace are not
being used in RELS-EXT, and that if fedora-model is used, the localName
is hasService, hasModel, isDeploymentOf, or isContractorOf. Also ensures
that fedora-model:hasContentModel is only used once.
@param nsURI
the namespace URI of the predicate being evaluated
@param localName
the local name of the predicate being evaluated
@param qName
the qualified name of the predicate being evaluated | [
"checkBadAssertion",
":",
"checks",
"that",
"the",
"DC",
"and",
"fedora",
"-",
"view",
"namespace",
"are",
"not",
"being",
"used",
"in",
"RELS",
"-",
"EXT",
"and",
"that",
"if",
"fedora",
"-",
"model",
"is",
"used",
"the",
"localName",
"is",
"hasService",
... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/validation/RelsValidator.java#L312-L351 |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRConfigBuilder.java | TupleMRConfigBuilder.initializeComparators | public static void initializeComparators(Configuration conf, TupleMRConfig groupConfig) {
TupleMRConfigBuilder.initializeComparators(conf, groupConfig.getCommonCriteria());
for (Criteria criteria : groupConfig.getSpecificOrderBys()) {
if (criteria != null) {
TupleMRConfigBuilder.initializeComparators(conf, criteria);
}
}
} | java | public static void initializeComparators(Configuration conf, TupleMRConfig groupConfig) {
TupleMRConfigBuilder.initializeComparators(conf, groupConfig.getCommonCriteria());
for (Criteria criteria : groupConfig.getSpecificOrderBys()) {
if (criteria != null) {
TupleMRConfigBuilder.initializeComparators(conf, criteria);
}
}
} | [
"public",
"static",
"void",
"initializeComparators",
"(",
"Configuration",
"conf",
",",
"TupleMRConfig",
"groupConfig",
")",
"{",
"TupleMRConfigBuilder",
".",
"initializeComparators",
"(",
"conf",
",",
"groupConfig",
".",
"getCommonCriteria",
"(",
")",
")",
";",
"fo... | Initializes the custom comparator instances inside the given config
criterias, calling the {@link Configurable#setConf(Configuration)} method. | [
"Initializes",
"the",
"custom",
"comparator",
"instances",
"inside",
"the",
"given",
"config",
"criterias",
"calling",
"the",
"{"
] | train | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRConfigBuilder.java#L434-L441 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java | ObjectArrayList.binarySearchFromTo | public int binarySearchFromTo(Object key, int from, int to) {
int low = from;
int high = to;
while (low <= high) {
int mid =(low + high)/2;
Object midVal = elements[mid];
int cmp = ((Comparable)midVal).compareTo(key);
if (cmp < 0) low = mid + 1;
else if (cmp > 0) high = mid - 1;
else return mid; // key found
}
return -(low + 1); // key not found.
} | java | public int binarySearchFromTo(Object key, int from, int to) {
int low = from;
int high = to;
while (low <= high) {
int mid =(low + high)/2;
Object midVal = elements[mid];
int cmp = ((Comparable)midVal).compareTo(key);
if (cmp < 0) low = mid + 1;
else if (cmp > 0) high = mid - 1;
else return mid; // key found
}
return -(low + 1); // key not found.
} | [
"public",
"int",
"binarySearchFromTo",
"(",
"Object",
"key",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"int",
"low",
"=",
"from",
";",
"int",
"high",
"=",
"to",
";",
"while",
"(",
"low",
"<=",
"high",
")",
"{",
"int",
"mid",
"=",
"(",
"low"... | Searches the receiver for the specified value using
the binary search algorithm. The receiver must be sorted into ascending order
according to the <i>natural ordering</i> of its elements (as by the sort method)
prior to making this call.
If it is not sorted, the results are undefined: in particular, the call
may enter an infinite loop. If the receiver contains multiple elements
equal to the specified object, there is no guarantee which instance
will be found.
@param key the value to be searched for.
@param from the leftmost search position, inclusive.
@param to the rightmost search position, inclusive.
@return index of the search key, if it is contained in the receiver;
otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>. The <i>insertion
point</i> is defined as the the point at which the value would
be inserted into the receiver: the index of the first
element greater than the key, or <tt>receiver.size()</tt>, if all
elements in the receiver are less than the specified key. Note
that this guarantees that the return value will be >= 0 if
and only if the key is found.
@see Comparable
@see java.util.Arrays | [
"Searches",
"the",
"receiver",
"for",
"the",
"specified",
"value",
"using",
"the",
"binary",
"search",
"algorithm",
".",
"The",
"receiver",
"must",
"be",
"sorted",
"into",
"ascending",
"order",
"according",
"to",
"the",
"<i",
">",
"natural",
"ordering<",
"/",
... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java#L178-L192 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.