repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java | SyntheticStorableReferenceBuilder.copyFromMaster | @Deprecated
public void copyFromMaster(Storable indexEntry, S master) throws FetchException {
getReferenceAccess().copyFromMaster(indexEntry, master);
} | java | @Deprecated
public void copyFromMaster(Storable indexEntry, S master) throws FetchException {
getReferenceAccess().copyFromMaster(indexEntry, master);
} | [
"@",
"Deprecated",
"public",
"void",
"copyFromMaster",
"(",
"Storable",
"indexEntry",
",",
"S",
"master",
")",
"throws",
"FetchException",
"{",
"getReferenceAccess",
"(",
")",
".",
"copyFromMaster",
"(",
"indexEntry",
",",
"master",
")",
";",
"}"
] | Sets all the properties of the given index entry, using the applicable
properties of the given master.
@param indexEntry index entry whose properties will be set
@param master source of property values
@deprecated call getReferenceAccess | [
"Sets",
"all",
"the",
"properties",
"of",
"the",
"given",
"index",
"entry",
"using",
"the",
"applicable",
"properties",
"of",
"the",
"given",
"master",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java#L366-L369 |
michel-kraemer/gradle-download-task | src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java | DownloadAction.performDownload | private void performDownload(HttpResponse response, File destFile)
throws IOException {
HttpEntity entity = response.getEntity();
if (entity == null) {
return;
}
//get content length
long contentLength = entity.getContentLength();
if (contentLength >= 0) {
size = toLengthText(contentLength);
}
processedBytes = 0;
loggedKb = 0;
//open stream and start downloading
InputStream is = entity.getContent();
streamAndMove(is, destFile);
} | java | private void performDownload(HttpResponse response, File destFile)
throws IOException {
HttpEntity entity = response.getEntity();
if (entity == null) {
return;
}
//get content length
long contentLength = entity.getContentLength();
if (contentLength >= 0) {
size = toLengthText(contentLength);
}
processedBytes = 0;
loggedKb = 0;
//open stream and start downloading
InputStream is = entity.getContent();
streamAndMove(is, destFile);
} | [
"private",
"void",
"performDownload",
"(",
"HttpResponse",
"response",
",",
"File",
"destFile",
")",
"throws",
"IOException",
"{",
"HttpEntity",
"entity",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"return"... | Save an HTTP response to a file
@param response the response to save
@param destFile the destination file
@throws IOException if the response could not be downloaded | [
"Save",
"an",
"HTTP",
"response",
"to",
"a",
"file"
] | train | https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L297-L316 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.serviceName_activateZone_POST | public void serviceName_activateZone_POST(String serviceName, Boolean minimized) throws IOException {
String qPath = "/domain/{serviceName}/activateZone";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "minimized", minimized);
exec(qPath, "POST", sb.toString(), o);
} | java | public void serviceName_activateZone_POST(String serviceName, Boolean minimized) throws IOException {
String qPath = "/domain/{serviceName}/activateZone";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "minimized", minimized);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"serviceName_activateZone_POST",
"(",
"String",
"serviceName",
",",
"Boolean",
"minimized",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/{serviceName}/activateZone\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",... | Activate the DNS zone for this domain
REST: POST /domain/{serviceName}/activateZone
@param minimized [required] Create only mandatory records
@param serviceName [required] The internal name of your domain | [
"Activate",
"the",
"DNS",
"zone",
"for",
"this",
"domain"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1346-L1352 |
alexcojocaru/elasticsearch-maven-plugin | src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/util/ProcessUtil.java | ProcessUtil.getElasticsearchPid | public static String getElasticsearchPid(String baseDir)
{
try
{
String pid = new String(Files.readAllBytes(Paths.get(baseDir, "pid")));
return pid;
}
catch (IOException e)
{
throw new IllegalStateException(
String.format(
"Cannot read the PID of the Elasticsearch process from the pid file in directory '%s'",
baseDir),
e);
}
} | java | public static String getElasticsearchPid(String baseDir)
{
try
{
String pid = new String(Files.readAllBytes(Paths.get(baseDir, "pid")));
return pid;
}
catch (IOException e)
{
throw new IllegalStateException(
String.format(
"Cannot read the PID of the Elasticsearch process from the pid file in directory '%s'",
baseDir),
e);
}
} | [
"public",
"static",
"String",
"getElasticsearchPid",
"(",
"String",
"baseDir",
")",
"{",
"try",
"{",
"String",
"pid",
"=",
"new",
"String",
"(",
"Files",
".",
"readAllBytes",
"(",
"Paths",
".",
"get",
"(",
"baseDir",
",",
"\"pid\"",
")",
")",
")",
";",
... | Read the ES PID from the pid file and return it.
@param baseDir the base directory where the pid file is
@return | [
"Read",
"the",
"ES",
"PID",
"from",
"the",
"pid",
"file",
"and",
"return",
"it",
"."
] | train | https://github.com/alexcojocaru/elasticsearch-maven-plugin/blob/c283053cf99dc6b6d411b58629364b6aae62b7f8/src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/util/ProcessUtil.java#L97-L112 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/MetaFieldUtil.java | MetaFieldUtil.toMetaFieldInfoArray | public static MetaFieldInfo[] toMetaFieldInfoArray(Class type, Object obj, String stringForNullValues, boolean ignoreAnnotatedName, boolean recursive) {
return internalToMetaFieldInfoArray(type, obj, null, null, stringForNullValues, ignoreAnnotatedName, recursive);
} | java | public static MetaFieldInfo[] toMetaFieldInfoArray(Class type, Object obj, String stringForNullValues, boolean ignoreAnnotatedName, boolean recursive) {
return internalToMetaFieldInfoArray(type, obj, null, null, stringForNullValues, ignoreAnnotatedName, recursive);
} | [
"public",
"static",
"MetaFieldInfo",
"[",
"]",
"toMetaFieldInfoArray",
"(",
"Class",
"type",
",",
"Object",
"obj",
",",
"String",
"stringForNullValues",
",",
"boolean",
"ignoreAnnotatedName",
",",
"boolean",
"recursive",
")",
"{",
"return",
"internalToMetaFieldInfoArr... | Returns a new MetaFieldInfo array of all Fields annotated with MetaField
in the object type. The object must be an instance of the type, otherwise
this method may throw a runtime exception. Optionally, this method can
recursively search the object to provide a deep view of the entire class.
@param type The class type of the object
@param obj The runtime instance of the object to search. It must be an
instance of the type. If its a subclass of the type, this method
will only return MetaFields of the type passed in.
@param stringForNullValues If a field is null, this is the string to swap
in as the String value vs. "null" showing up.
@param ignoreAnnotatedName Whether to ignore the name of the MetaField
and always return the field name instead. If false, this method will
use the annotated name if it exists, otherwise it'll use the field name.
@param recursive If true, this method will recursively search any fields
to see if they also contain MetaField annotations. If they do, this
method will include those in its returned array.
@return The MetaFieldInfo array | [
"Returns",
"a",
"new",
"MetaFieldInfo",
"array",
"of",
"all",
"Fields",
"annotated",
"with",
"MetaField",
"in",
"the",
"object",
"type",
".",
"The",
"object",
"must",
"be",
"an",
"instance",
"of",
"the",
"type",
"otherwise",
"this",
"method",
"may",
"throw",... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/MetaFieldUtil.java#L138-L140 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.warnv | public void warnv(Throwable t, String format, Object... params) {
doLog(Level.WARN, FQCN, format, params, t);
} | java | public void warnv(Throwable t, String format, Object... params) {
doLog(Level.WARN, FQCN, format, params, t);
} | [
"public",
"void",
"warnv",
"(",
"Throwable",
"t",
",",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"doLog",
"(",
"Level",
".",
"WARN",
",",
"FQCN",
",",
"format",
",",
"params",
",",
"t",
")",
";",
"}"
] | Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
@param t the throwable
@param format the message format string
@param params the parameters | [
"Issue",
"a",
"log",
"message",
"with",
"a",
"level",
"of",
"WARN",
"using",
"{",
"@link",
"java",
".",
"text",
".",
"MessageFormat",
"}",
"-",
"style",
"formatting",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1343-L1345 |
google/closure-compiler | src/com/google/javascript/jscomp/graph/LinkedDirectedGraph.java | LinkedDirectedGraph.isConnectedInDirection | @Override
public boolean isConnectedInDirection(N n1, E edgeValue, N n2) {
return isConnectedInDirection(n1, Predicates.equalTo(edgeValue), n2);
} | java | @Override
public boolean isConnectedInDirection(N n1, E edgeValue, N n2) {
return isConnectedInDirection(n1, Predicates.equalTo(edgeValue), n2);
} | [
"@",
"Override",
"public",
"boolean",
"isConnectedInDirection",
"(",
"N",
"n1",
",",
"E",
"edgeValue",
",",
"N",
"n2",
")",
"{",
"return",
"isConnectedInDirection",
"(",
"n1",
",",
"Predicates",
".",
"equalTo",
"(",
"edgeValue",
")",
",",
"n2",
")",
";",
... | DiGraphNode look ups can be expensive for a large graph operation, prefer the
version below that takes DiGraphNodes, if you have them available. | [
"DiGraphNode",
"look",
"ups",
"can",
"be",
"expensive",
"for",
"a",
"large",
"graph",
"operation",
"prefer",
"the",
"version",
"below",
"that",
"takes",
"DiGraphNodes",
"if",
"you",
"have",
"them",
"available",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/LinkedDirectedGraph.java#L235-L238 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.toSpreadMap | public static SpreadMap toSpreadMap(List self) {
if (self == null)
throw new GroovyRuntimeException("Fail to convert List to SpreadMap, because it is null.");
else if (self.size() % 2 != 0)
throw new GroovyRuntimeException("Fail to convert List to SpreadMap, because it's size is not even.");
else
return new SpreadMap(self);
} | java | public static SpreadMap toSpreadMap(List self) {
if (self == null)
throw new GroovyRuntimeException("Fail to convert List to SpreadMap, because it is null.");
else if (self.size() % 2 != 0)
throw new GroovyRuntimeException("Fail to convert List to SpreadMap, because it's size is not even.");
else
return new SpreadMap(self);
} | [
"public",
"static",
"SpreadMap",
"toSpreadMap",
"(",
"List",
"self",
")",
"{",
"if",
"(",
"self",
"==",
"null",
")",
"throw",
"new",
"GroovyRuntimeException",
"(",
"\"Fail to convert List to SpreadMap, because it is null.\"",
")",
";",
"else",
"if",
"(",
"self",
"... | Creates a spreadable map from this list.
<p>
@param self a list
@return a newly created SpreadMap
@see groovy.lang.SpreadMap#SpreadMap(java.util.List)
@see #toSpreadMap(java.util.Map)
@since 1.8.0 | [
"Creates",
"a",
"spreadable",
"map",
"from",
"this",
"list",
".",
"<p",
">"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8559-L8566 |
Alluxio/alluxio | underfs/oss/src/main/java/alluxio/underfs/oss/OSSUnderFileSystem.java | OSSUnderFileSystem.createInstance | public static OSSUnderFileSystem createInstance(AlluxioURI uri,
UnderFileSystemConfiguration conf, AlluxioConfiguration alluxioConf) throws Exception {
String bucketName = UnderFileSystemUtils.getBucketName(uri);
Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_ACCESS_KEY),
"Property %s is required to connect to OSS", PropertyKey.OSS_ACCESS_KEY);
Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_SECRET_KEY),
"Property %s is required to connect to OSS", PropertyKey.OSS_SECRET_KEY);
Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_ENDPOINT_KEY),
"Property %s is required to connect to OSS", PropertyKey.OSS_ENDPOINT_KEY);
String accessId = conf.get(PropertyKey.OSS_ACCESS_KEY);
String accessKey = conf.get(PropertyKey.OSS_SECRET_KEY);
String endPoint = conf.get(PropertyKey.OSS_ENDPOINT_KEY);
ClientConfiguration ossClientConf = initializeOSSClientConfig(alluxioConf);
OSSClient ossClient = new OSSClient(endPoint, accessId, accessKey, ossClientConf);
return new OSSUnderFileSystem(uri, ossClient, bucketName, conf, alluxioConf);
} | java | public static OSSUnderFileSystem createInstance(AlluxioURI uri,
UnderFileSystemConfiguration conf, AlluxioConfiguration alluxioConf) throws Exception {
String bucketName = UnderFileSystemUtils.getBucketName(uri);
Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_ACCESS_KEY),
"Property %s is required to connect to OSS", PropertyKey.OSS_ACCESS_KEY);
Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_SECRET_KEY),
"Property %s is required to connect to OSS", PropertyKey.OSS_SECRET_KEY);
Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_ENDPOINT_KEY),
"Property %s is required to connect to OSS", PropertyKey.OSS_ENDPOINT_KEY);
String accessId = conf.get(PropertyKey.OSS_ACCESS_KEY);
String accessKey = conf.get(PropertyKey.OSS_SECRET_KEY);
String endPoint = conf.get(PropertyKey.OSS_ENDPOINT_KEY);
ClientConfiguration ossClientConf = initializeOSSClientConfig(alluxioConf);
OSSClient ossClient = new OSSClient(endPoint, accessId, accessKey, ossClientConf);
return new OSSUnderFileSystem(uri, ossClient, bucketName, conf, alluxioConf);
} | [
"public",
"static",
"OSSUnderFileSystem",
"createInstance",
"(",
"AlluxioURI",
"uri",
",",
"UnderFileSystemConfiguration",
"conf",
",",
"AlluxioConfiguration",
"alluxioConf",
")",
"throws",
"Exception",
"{",
"String",
"bucketName",
"=",
"UnderFileSystemUtils",
".",
"getBu... | Constructs a new instance of {@link OSSUnderFileSystem}.
@param uri the {@link AlluxioURI} for this UFS
@param conf the configuration for this UFS
@param alluxioConf Alluxio configuration
@return the created {@link OSSUnderFileSystem} instance | [
"Constructs",
"a",
"new",
"instance",
"of",
"{",
"@link",
"OSSUnderFileSystem",
"}",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/oss/src/main/java/alluxio/underfs/oss/OSSUnderFileSystem.java#L69-L86 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java | MsgDestEncodingUtilsImpl.convertPropertyToType | final static Object convertPropertyToType(String longPropertyName, String stringValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "convertPropertyToType", new Object[]{longPropertyName, stringValue});
// If the value is null or already a String we won't have anything to do
Object decodedObject = stringValue;
// The only non-String types we have are Integer & Long, so deal with them
Class requiredType = getPropertyType(longPropertyName);
if (requiredType == Integer.class) {
decodedObject = Integer.valueOf(stringValue);
}
else if (requiredType == Long.class) {
decodedObject = Long.valueOf(stringValue);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "convertPropertyToType");
return decodedObject;
} | java | final static Object convertPropertyToType(String longPropertyName, String stringValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "convertPropertyToType", new Object[]{longPropertyName, stringValue});
// If the value is null or already a String we won't have anything to do
Object decodedObject = stringValue;
// The only non-String types we have are Integer & Long, so deal with them
Class requiredType = getPropertyType(longPropertyName);
if (requiredType == Integer.class) {
decodedObject = Integer.valueOf(stringValue);
}
else if (requiredType == Long.class) {
decodedObject = Long.valueOf(stringValue);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "convertPropertyToType");
return decodedObject;
} | [
"final",
"static",
"Object",
"convertPropertyToType",
"(",
"String",
"longPropertyName",
",",
"String",
"stringValue",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
... | convertPropertyToType
Convert a property from its stringified form into an Object of the appropriate
type. Called by URIDestinationCreator.
@param longPropertyName The long name of the property
@param stringValue The stringified property value
@return Object Description of returned value | [
"convertPropertyToType",
"Convert",
"a",
"property",
"from",
"its",
"stringified",
"form",
"into",
"an",
"Object",
"of",
"the",
"appropriate",
"type",
".",
"Called",
"by",
"URIDestinationCreator",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L332-L349 |
ironjacamar/ironjacamar | deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java | AbstractResourceAdapterDeployer.hasFailuresLevel | protected boolean hasFailuresLevel(Collection<Failure> failures, int severity)
{
if (failures != null)
{
for (Failure failure : failures)
{
if (failure.getSeverity() == severity)
{
return true;
}
}
}
return false;
} | java | protected boolean hasFailuresLevel(Collection<Failure> failures, int severity)
{
if (failures != null)
{
for (Failure failure : failures)
{
if (failure.getSeverity() == severity)
{
return true;
}
}
}
return false;
} | [
"protected",
"boolean",
"hasFailuresLevel",
"(",
"Collection",
"<",
"Failure",
">",
"failures",
",",
"int",
"severity",
")",
"{",
"if",
"(",
"failures",
"!=",
"null",
")",
"{",
"for",
"(",
"Failure",
"failure",
":",
"failures",
")",
"{",
"if",
"(",
"fail... | Check for failures at a certain level
@param failures failures failures The failures
@param severity severity severity The level
@return True if a failure is found with the specified severity; otherwise false | [
"Check",
"for",
"failures",
"at",
"a",
"certain",
"level"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java#L1510-L1523 |
windup/windup | rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/ast/ignore/JavaClassIgnoreResolver.java | JavaClassIgnoreResolver.singletonInstance | public static JavaClassIgnoreResolver singletonInstance()
{
if (defaultInstance == null)
{
TrieStructureTypeRelation<String,String> relation = new TrieStructureTypeRelation<String,String>() {
@Override public String getStringToSearchFromSearchType(String search)
{
return search;
}
@Override public String getStringPrefixToSaveSaveType(String save)
{
/**
* At least for now javaclass-ignore does not contain anything except the prefix
*/
return save;
}
@Override public boolean checkIfMatchFound(String saved, String searched)
{
return searched.startsWith(saved);
}
};
defaultInstance = new JavaClassIgnoreResolver(relation);
}
return defaultInstance;
} | java | public static JavaClassIgnoreResolver singletonInstance()
{
if (defaultInstance == null)
{
TrieStructureTypeRelation<String,String> relation = new TrieStructureTypeRelation<String,String>() {
@Override public String getStringToSearchFromSearchType(String search)
{
return search;
}
@Override public String getStringPrefixToSaveSaveType(String save)
{
/**
* At least for now javaclass-ignore does not contain anything except the prefix
*/
return save;
}
@Override public boolean checkIfMatchFound(String saved, String searched)
{
return searched.startsWith(saved);
}
};
defaultInstance = new JavaClassIgnoreResolver(relation);
}
return defaultInstance;
} | [
"public",
"static",
"JavaClassIgnoreResolver",
"singletonInstance",
"(",
")",
"{",
"if",
"(",
"defaultInstance",
"==",
"null",
")",
"{",
"TrieStructureTypeRelation",
"<",
"String",
",",
"String",
">",
"relation",
"=",
"new",
"TrieStructureTypeRelation",
"<",
"String... | Gets the default instance of the {@link JavaClassIgnoreResolver}. This is not thread safe. | [
"Gets",
"the",
"default",
"instance",
"of",
"the",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/ast/ignore/JavaClassIgnoreResolver.java#L18-L45 |
jayantk/jklol | src/com/jayantkrish/jklol/util/IntegerArrayIterator.java | IntegerArrayIterator.createFromKeyPrefix | public static IntegerArrayIterator createFromKeyPrefix(int[] dimensionSizes, int[] keyPrefix) {
int[] sizesForIteration = new int[dimensionSizes.length - keyPrefix.length];
for (int i = keyPrefix.length; i < dimensionSizes.length; i++) {
sizesForIteration[i - keyPrefix.length] = dimensionSizes[i];
}
return new IntegerArrayIterator(sizesForIteration, keyPrefix);
} | java | public static IntegerArrayIterator createFromKeyPrefix(int[] dimensionSizes, int[] keyPrefix) {
int[] sizesForIteration = new int[dimensionSizes.length - keyPrefix.length];
for (int i = keyPrefix.length; i < dimensionSizes.length; i++) {
sizesForIteration[i - keyPrefix.length] = dimensionSizes[i];
}
return new IntegerArrayIterator(sizesForIteration, keyPrefix);
} | [
"public",
"static",
"IntegerArrayIterator",
"createFromKeyPrefix",
"(",
"int",
"[",
"]",
"dimensionSizes",
",",
"int",
"[",
"]",
"keyPrefix",
")",
"{",
"int",
"[",
"]",
"sizesForIteration",
"=",
"new",
"int",
"[",
"dimensionSizes",
".",
"length",
"-",
"keyPref... | Creates an iterator over all assignments to the final
{@code dimensionSizes.length - keyPrefix.length} dimensions in
{@code dimensionSizes}.
@param dimensionSizes
@param keyPrefix
@return | [
"Creates",
"an",
"iterator",
"over",
"all",
"assignments",
"to",
"the",
"final",
"{",
"@code",
"dimensionSizes",
".",
"length",
"-",
"keyPrefix",
".",
"length",
"}",
"dimensions",
"in",
"{",
"@code",
"dimensionSizes",
"}",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/IntegerArrayIterator.java#L52-L58 |
facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/RaidShell.java | RaidShell.findMissingParityFiles | private void findMissingParityFiles(String[] args, int startIndex) {
boolean restoreReplication = false;
Path root = null;
for (int i = startIndex; i < args.length; i++) {
String arg = args[i];
if (arg.equals("-r")) {
restoreReplication = true;
} else {
root = new Path(arg);
}
}
if (root == null) {
throw new IllegalArgumentException("Too few arguments");
}
try {
FileSystem fs = root.getFileSystem(conf);
// Make sure default uri is the same as root
conf.set(FileSystem.FS_DEFAULT_NAME_KEY, fs.getUri().toString());
MissingParityFiles mParFiles = new MissingParityFiles(conf, restoreReplication);
mParFiles.findMissingParityFiles(root, System.out);
} catch (IOException ex) {
System.err.println("findMissingParityFiles: " + ex);
}
} | java | private void findMissingParityFiles(String[] args, int startIndex) {
boolean restoreReplication = false;
Path root = null;
for (int i = startIndex; i < args.length; i++) {
String arg = args[i];
if (arg.equals("-r")) {
restoreReplication = true;
} else {
root = new Path(arg);
}
}
if (root == null) {
throw new IllegalArgumentException("Too few arguments");
}
try {
FileSystem fs = root.getFileSystem(conf);
// Make sure default uri is the same as root
conf.set(FileSystem.FS_DEFAULT_NAME_KEY, fs.getUri().toString());
MissingParityFiles mParFiles = new MissingParityFiles(conf, restoreReplication);
mParFiles.findMissingParityFiles(root, System.out);
} catch (IOException ex) {
System.err.println("findMissingParityFiles: " + ex);
}
} | [
"private",
"void",
"findMissingParityFiles",
"(",
"String",
"[",
"]",
"args",
",",
"int",
"startIndex",
")",
"{",
"boolean",
"restoreReplication",
"=",
"false",
";",
"Path",
"root",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"startIndex",
";",
"i",
"... | Find the files that do not have a corresponding parity file and have replication
factor less that 3
args[] contains the root where we need to check | [
"Find",
"the",
"files",
"that",
"do",
"not",
"have",
"a",
"corresponding",
"parity",
"file",
"and",
"have",
"replication",
"factor",
"less",
"that",
"3",
"args",
"[]",
"contains",
"the",
"root",
"where",
"we",
"need",
"to",
"check"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidShell.java#L416-L439 |
dmerkushov/log-helper | src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java | LogHelperDebug.printError | public static void printError (String message, Throwable throwable, boolean force) {
if (isDebugEnabled () || force) {
StringBuilder outputBuilder = new StringBuilder ();
outputBuilder.append (message).append ("\nThrowable:\n");
outputBuilder.append (DefaultFormatter.getFullThrowableMsg (throwable));
String fullMessage = outputBuilder.toString ();
printError (fullMessage, force);
}
} | java | public static void printError (String message, Throwable throwable, boolean force) {
if (isDebugEnabled () || force) {
StringBuilder outputBuilder = new StringBuilder ();
outputBuilder.append (message).append ("\nThrowable:\n");
outputBuilder.append (DefaultFormatter.getFullThrowableMsg (throwable));
String fullMessage = outputBuilder.toString ();
printError (fullMessage, force);
}
} | [
"public",
"static",
"void",
"printError",
"(",
"String",
"message",
",",
"Throwable",
"throwable",
",",
"boolean",
"force",
")",
"{",
"if",
"(",
"isDebugEnabled",
"(",
")",
"||",
"force",
")",
"{",
"StringBuilder",
"outputBuilder",
"=",
"new",
"StringBuilder",... | Print a message to <code>System.err</code>, with an every-line prefix: "log-helper ERROR: ", and specifying a full stack trace of a {@link java.lang.Throwable Throwable}
@param message
@param throwable
@param force <code>true</code> if we need to override the debug enabled flag (i.e. the message is REALLY important), <code>false</code> otherwise | [
"Print",
"a",
"message",
"to",
"<code",
">",
"System",
".",
"err<",
"/",
"code",
">",
"with",
"an",
"every",
"-",
"line",
"prefix",
":",
"log",
"-",
"helper",
"ERROR",
":",
"and",
"specifying",
"a",
"full",
"stack",
"trace",
"of",
"a",
"{"
] | train | https://github.com/dmerkushov/log-helper/blob/3b7d3d30faa7f1437b27cd07c10fa579a995de23/src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java#L77-L85 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.broadcastStaleCacheData | public void broadcastStaleCacheData (String cache, Streamable data)
{
_nodeobj.setCacheData(new NodeObject.CacheData(cache, data));
} | java | public void broadcastStaleCacheData (String cache, Streamable data)
{
_nodeobj.setCacheData(new NodeObject.CacheData(cache, data));
} | [
"public",
"void",
"broadcastStaleCacheData",
"(",
"String",
"cache",
",",
"Streamable",
"data",
")",
"{",
"_nodeobj",
".",
"setCacheData",
"(",
"new",
"NodeObject",
".",
"CacheData",
"(",
"cache",
",",
"data",
")",
")",
";",
"}"
] | Called when cached data has changed on the local server and needs to inform our peers. | [
"Called",
"when",
"cached",
"data",
"has",
"changed",
"on",
"the",
"local",
"server",
"and",
"needs",
"to",
"inform",
"our",
"peers",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1002-L1005 |
alkacon/opencms-core | src/org/opencms/i18n/CmsEncoder.java | CmsEncoder.escapeWBlanks | public static String escapeWBlanks(String source, String encoding) {
if (CmsStringUtil.isEmpty(source)) {
return source;
}
StringBuffer ret = new StringBuffer(source.length() * 2);
// URLEncode the text string
// this produces a very similar encoding to JavaSscript encoding,
// except the blank which is not encoded into "%20" instead of "+"
String enc = encode(source, encoding);
for (int z = 0; z < enc.length(); z++) {
char c = enc.charAt(z);
if (c == '+') {
ret.append("%20");
} else {
ret.append(c);
}
}
return ret.toString();
} | java | public static String escapeWBlanks(String source, String encoding) {
if (CmsStringUtil.isEmpty(source)) {
return source;
}
StringBuffer ret = new StringBuffer(source.length() * 2);
// URLEncode the text string
// this produces a very similar encoding to JavaSscript encoding,
// except the blank which is not encoded into "%20" instead of "+"
String enc = encode(source, encoding);
for (int z = 0; z < enc.length(); z++) {
char c = enc.charAt(z);
if (c == '+') {
ret.append("%20");
} else {
ret.append(c);
}
}
return ret.toString();
} | [
"public",
"static",
"String",
"escapeWBlanks",
"(",
"String",
"source",
",",
"String",
"encoding",
")",
"{",
"if",
"(",
"CmsStringUtil",
".",
"isEmpty",
"(",
"source",
")",
")",
"{",
"return",
"source",
";",
"}",
"StringBuffer",
"ret",
"=",
"new",
"StringB... | Encodes a String in a way similar JavaScript "encodeURIcomponent" function.<p>
Multiple blanks are encoded _multiply_ with <code>%20</code>.<p>
@param source The text to be encoded
@param encoding the encoding type
@return The encoded String | [
"Encodes",
"a",
"String",
"in",
"a",
"way",
"similar",
"JavaScript",
"encodeURIcomponent",
"function",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L698-L719 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.fundamentalToProjective | public static DMatrixRMaj fundamentalToProjective(DMatrixRMaj F , Point3D_F64 e2, Vector3D_F64 v , double lambda ) {
FundamentalToProjective f2p = new FundamentalToProjective();
DMatrixRMaj P = new DMatrixRMaj(3,4);
f2p.twoView(F,e2,v,lambda,P);
return P;
} | java | public static DMatrixRMaj fundamentalToProjective(DMatrixRMaj F , Point3D_F64 e2, Vector3D_F64 v , double lambda ) {
FundamentalToProjective f2p = new FundamentalToProjective();
DMatrixRMaj P = new DMatrixRMaj(3,4);
f2p.twoView(F,e2,v,lambda,P);
return P;
} | [
"public",
"static",
"DMatrixRMaj",
"fundamentalToProjective",
"(",
"DMatrixRMaj",
"F",
",",
"Point3D_F64",
"e2",
",",
"Vector3D_F64",
"v",
",",
"double",
"lambda",
")",
"{",
"FundamentalToProjective",
"f2p",
"=",
"new",
"FundamentalToProjective",
"(",
")",
";",
"D... | <p>
Given a fundamental matrix a pair of camera matrices P and P1' are extracted. The camera matrices
are 3 by 4 and used to project a 3D homogenous point onto the image plane. These camera matrices will only
be known up to a projective transform, thus there are multiple solutions, The canonical camera
matrix is defined as: <br>
<pre>
P=[I|0] and P'= [M|-M*t] = [[e']*F + e'*v^t | lambda*e']
</pre>
where e' is the epipole F<sup>T</sup>e' = 0, [e'] is the cross product matrix for the enclosed vector,
v is an arbitrary 3-vector and lambda is a non-zero scalar.
</p>
<p>
NOTE: Additional information is needed to upgrade this projective transform into a metric transform.
</p>
<p>
Page 256 in R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003
</p>
@see #extractEpipoles
@see FundamentalToProjective
@param F (Input) A fundamental matrix
@param e2 (Input) Left epipole of fundamental matrix, F<sup>T</sup>*e2 = 0.
@param v (Input) Arbitrary 3-vector. Just pick some value, say (0,0,0).
@param lambda (Input) A non zero scalar. Try one.
@return The canonical camera (projection) matrix P' (3 by 4) Known up to a projective transform. | [
"<p",
">",
"Given",
"a",
"fundamental",
"matrix",
"a",
"pair",
"of",
"camera",
"matrices",
"P",
"and",
"P1",
"are",
"extracted",
".",
"The",
"camera",
"matrices",
"are",
"3",
"by",
"4",
"and",
"used",
"to",
"project",
"a",
"3D",
"homogenous",
"point",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L876-L882 |
virgo47/javasimon | examples/src/main/java/org/javasimon/examples/MultithreadedStopwatchLoad.java | MultithreadedStopwatchLoad.main | public static void main(String[] args) throws InterruptedException {
ExampleUtils.fillManagerWithSimons(100000);
final ExecutorService executorService = Executors.newFixedThreadPool(1000);
StopwatchSample[] results = BenchmarkUtils.run(1, 2,
new BenchmarkUtils.Task("1") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 1, executorService).execute();
}
},
new BenchmarkUtils.Task("2") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 2, executorService).execute();
}
},
new BenchmarkUtils.Task("3") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 3, executorService).execute();
}
},
new BenchmarkUtils.Task("4") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 4, executorService).execute();
}
},
new BenchmarkUtils.Task("5") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 5, executorService).execute();
}
},
new BenchmarkUtils.Task("100") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 100, executorService).execute();
}
}
);
executorService.shutdown();
System.out.println("\nGoogle Chart avg:\n" +
GoogleChartImageGenerator.barChart("Multithreaded test", results));
} | java | public static void main(String[] args) throws InterruptedException {
ExampleUtils.fillManagerWithSimons(100000);
final ExecutorService executorService = Executors.newFixedThreadPool(1000);
StopwatchSample[] results = BenchmarkUtils.run(1, 2,
new BenchmarkUtils.Task("1") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 1, executorService).execute();
}
},
new BenchmarkUtils.Task("2") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 2, executorService).execute();
}
},
new BenchmarkUtils.Task("3") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 3, executorService).execute();
}
},
new BenchmarkUtils.Task("4") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 4, executorService).execute();
}
},
new BenchmarkUtils.Task("5") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 5, executorService).execute();
}
},
new BenchmarkUtils.Task("100") {
@Override
public void perform() throws Exception {
new MultithreadedTester(TOTAL_TASK_RUNS, 100, executorService).execute();
}
}
);
executorService.shutdown();
System.out.println("\nGoogle Chart avg:\n" +
GoogleChartImageGenerator.barChart("Multithreaded test", results));
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"InterruptedException",
"{",
"ExampleUtils",
".",
"fillManagerWithSimons",
"(",
"100000",
")",
";",
"final",
"ExecutorService",
"executorService",
"=",
"Executors",
".",
"newFixedT... | Entry point of the demo application.
@param args command line arguments
@throws InterruptedException when sleep is interrupted | [
"Entry",
"point",
"of",
"the",
"demo",
"application",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/examples/src/main/java/org/javasimon/examples/MultithreadedStopwatchLoad.java#L34-L79 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/MoveOnChangeHandler.java | MoveOnChangeHandler.fieldChanged | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = this.moveIt(bDisplayOption, iMoveMode);
if (iErrorCode != DBConstants.NORMAL_RETURN)
if (this.getOwner() != m_fldSource)
if (this.getOwner() != m_fldDest)
iErrorCode = DBConstants.NORMAL_RETURN; // If the source and dest are unrelated this this, don't return an error (and revert this field)
if (iErrorCode == DBConstants.NORMAL_RETURN)
iErrorCode = super.fieldChanged(bDisplayOption, iMoveMode);
return iErrorCode;
} | java | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = this.moveIt(bDisplayOption, iMoveMode);
if (iErrorCode != DBConstants.NORMAL_RETURN)
if (this.getOwner() != m_fldSource)
if (this.getOwner() != m_fldDest)
iErrorCode = DBConstants.NORMAL_RETURN; // If the source and dest are unrelated this this, don't return an error (and revert this field)
if (iErrorCode == DBConstants.NORMAL_RETURN)
iErrorCode = super.fieldChanged(bDisplayOption, iMoveMode);
return iErrorCode;
} | [
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"iErrorCode",
"=",
"this",
".",
"moveIt",
"(",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"if",
"(",
"iErrorCode",
"!=",
"DBConstants",
".",
"NORM... | The Field has Changed.
Move the source field to the destination field.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay). | [
"The",
"Field",
"has",
"Changed",
".",
"Move",
"the",
"source",
"field",
"to",
"the",
"destination",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MoveOnChangeHandler.java#L160-L170 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/URLPackageScanner.java | URLPackageScanner.newInstance | public static URLPackageScanner newInstance(boolean addRecursively, final ClassLoader classLoader,
final Callback callback, final String packageName) {
Validate.notNull(packageName, "Package name must be specified");
Validate.notNull(addRecursively, "AddRecursively must be specified");
Validate.notNull(classLoader, "ClassLoader must be specified");
Validate.notNull(callback, "Callback must be specified");
return new URLPackageScanner(packageName, addRecursively, classLoader, callback);
} | java | public static URLPackageScanner newInstance(boolean addRecursively, final ClassLoader classLoader,
final Callback callback, final String packageName) {
Validate.notNull(packageName, "Package name must be specified");
Validate.notNull(addRecursively, "AddRecursively must be specified");
Validate.notNull(classLoader, "ClassLoader must be specified");
Validate.notNull(callback, "Callback must be specified");
return new URLPackageScanner(packageName, addRecursively, classLoader, callback);
} | [
"public",
"static",
"URLPackageScanner",
"newInstance",
"(",
"boolean",
"addRecursively",
",",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"Callback",
"callback",
",",
"final",
"String",
"packageName",
")",
"{",
"Validate",
".",
"notNull",
"(",
"packageName... | Factory method to create an instance of URLPackageScanner.
@param addRecursively flag to add child packages
@param classLoader class loader that will have classes added
@param callback Callback to invoke when a matching class is found
@param packageName Package that will be scanned
@return new instance of URLPackageScanner | [
"Factory",
"method",
"to",
"create",
"an",
"instance",
"of",
"URLPackageScanner",
"."
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/URLPackageScanner.java#L79-L87 |
joniles/mpxj | src/main/java/net/sf/mpxj/planner/PlannerWriter.java | PlannerWriter.writePredecessors | private void writePredecessors(Task mpxjTask, net.sf.mpxj.planner.schema.Task plannerTask)
{
Predecessors plannerPredecessors = m_factory.createPredecessors();
plannerTask.setPredecessors(plannerPredecessors);
List<Predecessor> predecessorList = plannerPredecessors.getPredecessor();
int id = 0;
List<Relation> predecessors = mpxjTask.getPredecessors();
for (Relation rel : predecessors)
{
Integer taskUniqueID = rel.getTargetTask().getUniqueID();
Predecessor plannerPredecessor = m_factory.createPredecessor();
plannerPredecessor.setId(getIntegerString(++id));
plannerPredecessor.setPredecessorId(getIntegerString(taskUniqueID));
plannerPredecessor.setLag(getDurationString(rel.getLag()));
plannerPredecessor.setType(RELATIONSHIP_TYPES.get(rel.getType()));
predecessorList.add(plannerPredecessor);
m_eventManager.fireRelationWrittenEvent(rel);
}
} | java | private void writePredecessors(Task mpxjTask, net.sf.mpxj.planner.schema.Task plannerTask)
{
Predecessors plannerPredecessors = m_factory.createPredecessors();
plannerTask.setPredecessors(plannerPredecessors);
List<Predecessor> predecessorList = plannerPredecessors.getPredecessor();
int id = 0;
List<Relation> predecessors = mpxjTask.getPredecessors();
for (Relation rel : predecessors)
{
Integer taskUniqueID = rel.getTargetTask().getUniqueID();
Predecessor plannerPredecessor = m_factory.createPredecessor();
plannerPredecessor.setId(getIntegerString(++id));
plannerPredecessor.setPredecessorId(getIntegerString(taskUniqueID));
plannerPredecessor.setLag(getDurationString(rel.getLag()));
plannerPredecessor.setType(RELATIONSHIP_TYPES.get(rel.getType()));
predecessorList.add(plannerPredecessor);
m_eventManager.fireRelationWrittenEvent(rel);
}
} | [
"private",
"void",
"writePredecessors",
"(",
"Task",
"mpxjTask",
",",
"net",
".",
"sf",
".",
"mpxj",
".",
"planner",
".",
"schema",
".",
"Task",
"plannerTask",
")",
"{",
"Predecessors",
"plannerPredecessors",
"=",
"m_factory",
".",
"createPredecessors",
"(",
"... | This method writes predecessor data to a Planner file.
We have to deal with a slight anomaly in this method that is introduced
by the MPX file format. It would be possible for someone to create an
MPX file with both the predecessor list and the unique ID predecessor
list populated... which means that we must process both and avoid adding
duplicate predecessors. Also interesting to note is that MSP98 populates
the predecessor list, not the unique ID predecessor list, as you might
expect.
@param mpxjTask MPXJ task instance
@param plannerTask planner task instance | [
"This",
"method",
"writes",
"predecessor",
"data",
"to",
"a",
"Planner",
"file",
".",
"We",
"have",
"to",
"deal",
"with",
"a",
"slight",
"anomaly",
"in",
"this",
"method",
"that",
"is",
"introduced",
"by",
"the",
"MPX",
"file",
"format",
".",
"It",
"woul... | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/planner/PlannerWriter.java#L510-L529 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java | VirtualNetworkRulesInner.updateAsync | public Observable<VirtualNetworkRuleInner> updateAsync(String resourceGroupName, String accountName, String virtualNetworkRuleName, UpdateVirtualNetworkRuleParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() {
@Override
public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualNetworkRuleInner> updateAsync(String resourceGroupName, String accountName, String virtualNetworkRuleName, UpdateVirtualNetworkRuleParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() {
@Override
public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualNetworkRuleInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"virtualNetworkRuleName",
",",
"UpdateVirtualNetworkRuleParameters",
"parameters",
")",
"{",
"return",
"updateWithSer... | Updates the specified virtual network rule.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@param virtualNetworkRuleName The name of the virtual network rule to update.
@param parameters Parameters supplied to update the virtual network rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualNetworkRuleInner object | [
"Updates",
"the",
"specified",
"virtual",
"network",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java#L538-L545 |
libgdx/box2dlights | src/box2dLight/RayHandler.java | RayHandler.useCustomViewport | public void useCustomViewport(int x, int y, int width, int height) {
customViewport = true;
viewportX = x;
viewportY = y;
viewportWidth = width;
viewportHeight = height;
} | java | public void useCustomViewport(int x, int y, int width, int height) {
customViewport = true;
viewportX = x;
viewportY = y;
viewportWidth = width;
viewportHeight = height;
} | [
"public",
"void",
"useCustomViewport",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"customViewport",
"=",
"true",
";",
"viewportX",
"=",
"x",
";",
"viewportY",
"=",
"y",
";",
"viewportWidth",
"=",
"width",
";"... | Sets rendering to custom viewport with specified position and size
<p>Note: you will be responsible for update of viewport via this method
in case of any changes (on resize) | [
"Sets",
"rendering",
"to",
"custom",
"viewport",
"with",
"specified",
"position",
"and",
"size",
"<p",
">",
"Note",
":",
"you",
"will",
"be",
"responsible",
"for",
"update",
"of",
"viewport",
"via",
"this",
"method",
"in",
"case",
"of",
"any",
"changes",
"... | train | https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L594-L600 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsADESessionCache.java | CmsADESessionCache.getTemplateBean | public TemplateBean getTemplateBean(String uri, boolean safe) {
TemplateBean templateBean = m_templateBeanCache.get(uri);
if ((templateBean != null) || !safe) {
return templateBean;
}
return new TemplateBean("", "");
} | java | public TemplateBean getTemplateBean(String uri, boolean safe) {
TemplateBean templateBean = m_templateBeanCache.get(uri);
if ((templateBean != null) || !safe) {
return templateBean;
}
return new TemplateBean("", "");
} | [
"public",
"TemplateBean",
"getTemplateBean",
"(",
"String",
"uri",
",",
"boolean",
"safe",
")",
"{",
"TemplateBean",
"templateBean",
"=",
"m_templateBeanCache",
".",
"get",
"(",
"uri",
")",
";",
"if",
"(",
"(",
"templateBean",
"!=",
"null",
")",
"||",
"!",
... | Gets the cached template bean for a given container page uri.<p>
@param uri the container page uri
@param safe if true, return a valid template bean even if it hasn't been cached before
@return the template bean | [
"Gets",
"the",
"cached",
"template",
"bean",
"for",
"a",
"given",
"container",
"page",
"uri",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADESessionCache.java#L371-L378 |
baratine/baratine | web/src/main/java/com/caucho/v5/io/SocketStream.java | SocketStream.readTimeout | @Override
public int readTimeout(byte []buf, int offset, int length, long timeout)
throws IOException
{
Socket s = _s;
if (s == null) {
return -1;
}
int oldTimeout = s.getSoTimeout();
s.setSoTimeout((int) timeout);
try {
int result = read(buf, offset, length);
if (result >= 0) {
return result;
}
else if (_is == null || _is.available() < 0) {
return -1;
}
else {
return ReadStream.READ_TIMEOUT;
}
} finally {
s.setSoTimeout(oldTimeout);
}
} | java | @Override
public int readTimeout(byte []buf, int offset, int length, long timeout)
throws IOException
{
Socket s = _s;
if (s == null) {
return -1;
}
int oldTimeout = s.getSoTimeout();
s.setSoTimeout((int) timeout);
try {
int result = read(buf, offset, length);
if (result >= 0) {
return result;
}
else if (_is == null || _is.available() < 0) {
return -1;
}
else {
return ReadStream.READ_TIMEOUT;
}
} finally {
s.setSoTimeout(oldTimeout);
}
} | [
"@",
"Override",
"public",
"int",
"readTimeout",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
",",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"Socket",
"s",
"=",
"_s",
";",
"if",
"(",
"s",
"==",
"null",
")",
... | Reads bytes from the socket.
@param buf byte buffer receiving the bytes
@param offset offset into the buffer
@param length number of bytes to read
@return number of bytes read or -1
@exception throws ClientDisconnectException if the connection is dropped | [
"Reads",
"bytes",
"from",
"the",
"socket",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/SocketStream.java#L242-L270 |
mnlipp/jgrapes | examples/src/org/jgrapes/http/demo/httpserver/FormProcessor.java | FormProcessor.onInput | @Handler
public void onInput(Input<ByteBuffer> event, IOSubchannel channel)
throws InterruptedException, UnsupportedEncodingException {
Optional<FormContext> ctx = channel.associated(this, FormContext.class);
if (!ctx.isPresent()) {
return;
}
ctx.get().fieldDecoder.addData(event.data());
if (!event.isEndOfRecord()) {
return;
}
long invocations = (Long) ctx.get().session.computeIfAbsent(
"invocations", key -> {
return 0L;
});
ctx.get().session.put("invocations", invocations + 1);
HttpResponse response = ctx.get().request.response().get();
response.setStatus(HttpStatus.OK);
response.setHasPayload(true);
response.setField(HttpField.CONTENT_TYPE,
MediaType.builder().setType("text", "plain")
.setParameter("charset", "utf-8").build());
String data = "First name: "
+ ctx.get().fieldDecoder.fields().get("firstname")
+ "\r\n" + "Last name: "
+ ctx.get().fieldDecoder.fields().get("lastname")
+ "\r\n" + "Previous invocations: " + invocations;
channel.respond(new Response(response));
ManagedBuffer<ByteBuffer> out = channel.byteBufferPool().acquire();
out.backingBuffer().put(data.getBytes("utf-8"));
channel.respond(Output.fromSink(out, true));
} | java | @Handler
public void onInput(Input<ByteBuffer> event, IOSubchannel channel)
throws InterruptedException, UnsupportedEncodingException {
Optional<FormContext> ctx = channel.associated(this, FormContext.class);
if (!ctx.isPresent()) {
return;
}
ctx.get().fieldDecoder.addData(event.data());
if (!event.isEndOfRecord()) {
return;
}
long invocations = (Long) ctx.get().session.computeIfAbsent(
"invocations", key -> {
return 0L;
});
ctx.get().session.put("invocations", invocations + 1);
HttpResponse response = ctx.get().request.response().get();
response.setStatus(HttpStatus.OK);
response.setHasPayload(true);
response.setField(HttpField.CONTENT_TYPE,
MediaType.builder().setType("text", "plain")
.setParameter("charset", "utf-8").build());
String data = "First name: "
+ ctx.get().fieldDecoder.fields().get("firstname")
+ "\r\n" + "Last name: "
+ ctx.get().fieldDecoder.fields().get("lastname")
+ "\r\n" + "Previous invocations: " + invocations;
channel.respond(new Response(response));
ManagedBuffer<ByteBuffer> out = channel.byteBufferPool().acquire();
out.backingBuffer().put(data.getBytes("utf-8"));
channel.respond(Output.fromSink(out, true));
} | [
"@",
"Handler",
"public",
"void",
"onInput",
"(",
"Input",
"<",
"ByteBuffer",
">",
"event",
",",
"IOSubchannel",
"channel",
")",
"throws",
"InterruptedException",
",",
"UnsupportedEncodingException",
"{",
"Optional",
"<",
"FormContext",
">",
"ctx",
"=",
"channel",... | Hanlde input.
@param event the event
@param channel the channel
@throws InterruptedException the interrupted exception
@throws UnsupportedEncodingException the unsupported encoding exception | [
"Hanlde",
"input",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/examples/src/org/jgrapes/http/demo/httpserver/FormProcessor.java#L108-L141 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.getDatanode | public DatanodeDescriptor getDatanode(DatanodeID nodeID) throws IOException {
UnregisteredDatanodeException e = null;
DatanodeDescriptor node = datanodeMap.get(nodeID.getStorageID());
if (node == null) {
return null;
}
if (!node.getName().equals(nodeID.getName())) {
e = new UnregisteredDatanodeException(nodeID, node);
NameNode.stateChangeLog.fatal("BLOCK* NameSystem.getDatanode: "
+ e.getLocalizedMessage());
throw e;
}
return node;
} | java | public DatanodeDescriptor getDatanode(DatanodeID nodeID) throws IOException {
UnregisteredDatanodeException e = null;
DatanodeDescriptor node = datanodeMap.get(nodeID.getStorageID());
if (node == null) {
return null;
}
if (!node.getName().equals(nodeID.getName())) {
e = new UnregisteredDatanodeException(nodeID, node);
NameNode.stateChangeLog.fatal("BLOCK* NameSystem.getDatanode: "
+ e.getLocalizedMessage());
throw e;
}
return node;
} | [
"public",
"DatanodeDescriptor",
"getDatanode",
"(",
"DatanodeID",
"nodeID",
")",
"throws",
"IOException",
"{",
"UnregisteredDatanodeException",
"e",
"=",
"null",
";",
"DatanodeDescriptor",
"node",
"=",
"datanodeMap",
".",
"get",
"(",
"nodeID",
".",
"getStorageID",
"... | Get data node by storage ID.
@param nodeID
@return DatanodeDescriptor or null if the node is not found.
@throws IOException | [
"Get",
"data",
"node",
"by",
"storage",
"ID",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8417-L8430 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java | FileOperations.getFilePropertiesFromTask | public FileProperties getFilePropertiesFromTask(String jobId, String taskId, String fileName) throws BatchErrorException, IOException {
return getFilePropertiesFromTask(jobId, taskId, fileName, null);
} | java | public FileProperties getFilePropertiesFromTask(String jobId, String taskId, String fileName) throws BatchErrorException, IOException {
return getFilePropertiesFromTask(jobId, taskId, fileName, null);
} | [
"public",
"FileProperties",
"getFilePropertiesFromTask",
"(",
"String",
"jobId",
",",
"String",
"taskId",
",",
"String",
"fileName",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"return",
"getFilePropertiesFromTask",
"(",
"jobId",
",",
"taskId",
",",... | Gets information about a file from the specified task's directory on its compute node.
@param jobId The ID of the job containing the task.
@param taskId The ID of the task.
@param fileName The name of the file to retrieve.
@return A {@link FileProperties} instance containing information about the file.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Gets",
"information",
"about",
"a",
"file",
"from",
"the",
"specified",
"task",
"s",
"directory",
"on",
"its",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L330-L332 |
denisneuling/apitrary.jar | apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java | ClassUtil.getValueOf | @SuppressWarnings("unchecked")
public static <T> T getValueOf(Field field, Object reference, Class<?> referenceClazz, Class<T> valueType) {
try {
field.setAccessible(true);
Object toReturn = (T) field.get(reference);
if (String.class.isInstance(valueType.getClass()) && !String.class.isInstance(toReturn.getClass())) {
toReturn = toReturn.toString();
}
return (T) toReturn;
} catch (Exception e) {
log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
return null;
}
} | java | @SuppressWarnings("unchecked")
public static <T> T getValueOf(Field field, Object reference, Class<?> referenceClazz, Class<T> valueType) {
try {
field.setAccessible(true);
Object toReturn = (T) field.get(reference);
if (String.class.isInstance(valueType.getClass()) && !String.class.isInstance(toReturn.getClass())) {
toReturn = toReturn.toString();
}
return (T) toReturn;
} catch (Exception e) {
log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getValueOf",
"(",
"Field",
"field",
",",
"Object",
"reference",
",",
"Class",
"<",
"?",
">",
"referenceClazz",
",",
"Class",
"<",
"T",
">",
"valueType",
")",
"{"... | <p>
getValueOf.
</p>
@param field
a {@link java.lang.reflect.Field} object.
@param valueType
a {@link java.lang.Class} object.
@param <T>
a T object.
@return a T object. | [
"<p",
">",
"getValueOf",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java#L185-L198 |
victims/victims-lib-java | src/main/java/com/redhat/victims/fingerprint/ClassFile.java | ClassFile.constantValue | public static String constantValue(int index, ConstantPool cp) {
Constant type = cp.getConstant(index);
if (type != null) {
switch (type.getTag()) {
case Constants.CONSTANT_Class:
ConstantClass cls = (ConstantClass) type;
return constantValue(cls.getNameIndex(), cp);
case Constants.CONSTANT_Double:
ConstantDouble dbl = (ConstantDouble) type;
return String.valueOf(dbl.getBytes());
case Constants.CONSTANT_Fieldref:
ConstantFieldref fieldRef = (ConstantFieldref) type;
return constantValue(fieldRef.getClassIndex(), cp) + " "
+ constantValue(fieldRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_Float:
ConstantFloat flt = (ConstantFloat) type;
return String.valueOf(flt.getBytes());
case Constants.CONSTANT_Integer:
ConstantInteger integer = (ConstantInteger) type;
return String.valueOf(integer.getBytes());
case Constants.CONSTANT_InterfaceMethodref:
ConstantInterfaceMethodref intRef = (ConstantInterfaceMethodref) type;
return constantValue(intRef.getClassIndex(), cp) + " "
+ constantValue(intRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_Long:
ConstantLong lng = (ConstantLong) type;
return String.valueOf(lng.getBytes());
case Constants.CONSTANT_Methodref:
ConstantMethodref methRef = (ConstantMethodref) type;
return constantValue(methRef.getClassIndex(), cp) + " "
+ constantValue(methRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_NameAndType:
ConstantNameAndType nameType = (ConstantNameAndType) type;
return nameType.getName(cp) + " " + nameType.getSignature(cp);
case Constants.CONSTANT_String:
ConstantString str = (ConstantString) type;
return str.getBytes(cp);
case Constants.CONSTANT_Utf8:
ConstantUtf8 utf8 = (ConstantUtf8) type;
return utf8.getBytes();
}
}
return "";
} | java | public static String constantValue(int index, ConstantPool cp) {
Constant type = cp.getConstant(index);
if (type != null) {
switch (type.getTag()) {
case Constants.CONSTANT_Class:
ConstantClass cls = (ConstantClass) type;
return constantValue(cls.getNameIndex(), cp);
case Constants.CONSTANT_Double:
ConstantDouble dbl = (ConstantDouble) type;
return String.valueOf(dbl.getBytes());
case Constants.CONSTANT_Fieldref:
ConstantFieldref fieldRef = (ConstantFieldref) type;
return constantValue(fieldRef.getClassIndex(), cp) + " "
+ constantValue(fieldRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_Float:
ConstantFloat flt = (ConstantFloat) type;
return String.valueOf(flt.getBytes());
case Constants.CONSTANT_Integer:
ConstantInteger integer = (ConstantInteger) type;
return String.valueOf(integer.getBytes());
case Constants.CONSTANT_InterfaceMethodref:
ConstantInterfaceMethodref intRef = (ConstantInterfaceMethodref) type;
return constantValue(intRef.getClassIndex(), cp) + " "
+ constantValue(intRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_Long:
ConstantLong lng = (ConstantLong) type;
return String.valueOf(lng.getBytes());
case Constants.CONSTANT_Methodref:
ConstantMethodref methRef = (ConstantMethodref) type;
return constantValue(methRef.getClassIndex(), cp) + " "
+ constantValue(methRef.getNameAndTypeIndex(), cp);
case Constants.CONSTANT_NameAndType:
ConstantNameAndType nameType = (ConstantNameAndType) type;
return nameType.getName(cp) + " " + nameType.getSignature(cp);
case Constants.CONSTANT_String:
ConstantString str = (ConstantString) type;
return str.getBytes(cp);
case Constants.CONSTANT_Utf8:
ConstantUtf8 utf8 = (ConstantUtf8) type;
return utf8.getBytes();
}
}
return "";
} | [
"public",
"static",
"String",
"constantValue",
"(",
"int",
"index",
",",
"ConstantPool",
"cp",
")",
"{",
"Constant",
"type",
"=",
"cp",
".",
"getConstant",
"(",
"index",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"switch",
"(",
"type",
".",
... | Resolves a constants value from the constant pool to the lowest form it
can be represented by. E.g. String, Integer, Float, etc.
@author gcmurphy
@param index
@param cp
@return | [
"Resolves",
"a",
"constants",
"value",
"from",
"the",
"constant",
"pool",
"to",
"the",
"lowest",
"form",
"it",
"can",
"be",
"represented",
"by",
".",
"E",
".",
"g",
".",
"String",
"Integer",
"Float",
"etc",
"."
] | train | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/fingerprint/ClassFile.java#L76-L129 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getCertificateIssuersWithServiceResponseAsync | public Observable<ServiceResponse<Page<CertificateIssuerItem>>> getCertificateIssuersWithServiceResponseAsync(final String vaultBaseUrl, final Integer maxresults) {
return getCertificateIssuersSinglePageAsync(vaultBaseUrl, maxresults)
.concatMap(new Func1<ServiceResponse<Page<CertificateIssuerItem>>, Observable<ServiceResponse<Page<CertificateIssuerItem>>>>() {
@Override
public Observable<ServiceResponse<Page<CertificateIssuerItem>>> call(ServiceResponse<Page<CertificateIssuerItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getCertificateIssuersNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<CertificateIssuerItem>>> getCertificateIssuersWithServiceResponseAsync(final String vaultBaseUrl, final Integer maxresults) {
return getCertificateIssuersSinglePageAsync(vaultBaseUrl, maxresults)
.concatMap(new Func1<ServiceResponse<Page<CertificateIssuerItem>>, Observable<ServiceResponse<Page<CertificateIssuerItem>>>>() {
@Override
public Observable<ServiceResponse<Page<CertificateIssuerItem>>> call(ServiceResponse<Page<CertificateIssuerItem>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getCertificateIssuersNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"CertificateIssuerItem",
">",
">",
">",
"getCertificateIssuersWithServiceResponseAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"Integer",
"maxresults",
")",
"{",
"return",
"getCertificateI... | List certificate issuers for a specified key vault.
The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. This operation requires the certificates/manageissuers/getissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CertificateIssuerItem> object | [
"List",
"certificate",
"issuers",
"for",
"a",
"specified",
"key",
"vault",
".",
"The",
"GetCertificateIssuers",
"operation",
"returns",
"the",
"set",
"of",
"certificate",
"issuer",
"resources",
"in",
"the",
"specified",
"key",
"vault",
".",
"This",
"operation",
... | 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#L5836-L5848 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.waitForView | public boolean waitForView(int id, int minimumNumberOfMatches, int timeout){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "waitForView("+id+", "+minimumNumberOfMatches+", "+timeout+")");
}
return waitForView(id, minimumNumberOfMatches, timeout, true);
} | java | public boolean waitForView(int id, int minimumNumberOfMatches, int timeout){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "waitForView("+id+", "+minimumNumberOfMatches+", "+timeout+")");
}
return waitForView(id, minimumNumberOfMatches, timeout, true);
} | [
"public",
"boolean",
"waitForView",
"(",
"int",
"id",
",",
"int",
"minimumNumberOfMatches",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"waitForView(\... | Waits for a View matching the specified resource id.
@param id the R.id of the {@link View} to wait for
@param minimumNumberOfMatches the minimum number of matches that are expected to be found. {@code 0} means any number of matches
@param timeout the amount of time in milliseconds to wait
@return {@code true} if the {@link View} is displayed and {@code false} if it is not displayed before the timeout | [
"Waits",
"for",
"a",
"View",
"matching",
"the",
"specified",
"resource",
"id",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L468-L474 |
ginere/ginere-base | src/main/java/eu/ginere/base/util/file/FileUtils.java | FileUtils.copyFromFileToFile | public static void copyFromFileToFile(File source, File dest) throws IOException{
try {
FileInputStream in = new FileInputStream(source);
FileOutputStream out = new FileOutputStream(dest);
try {
FileChannel canalFuente = in.getChannel();
FileChannel canalDestino = out.getChannel();
canalFuente.transferTo(0, canalFuente.size(), canalDestino);
} catch (IOException e) {
throw new IOException("copiando ficheros orig:'" + source.getAbsolutePath()
+ "' destino:'" + dest.getAbsolutePath() + "'", e);
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
// try {
// in.close();
// } catch (IOException e) {
// }
// try {
// out.close();
// } catch (IOException e) {
// }
}
} catch (FileNotFoundException e) {
throw new IOException("copiando ficheros orig:'" + source.getAbsolutePath()
+ "' destino:'" + dest.getAbsolutePath() + "'", e);
}
} | java | public static void copyFromFileToFile(File source, File dest) throws IOException{
try {
FileInputStream in = new FileInputStream(source);
FileOutputStream out = new FileOutputStream(dest);
try {
FileChannel canalFuente = in.getChannel();
FileChannel canalDestino = out.getChannel();
canalFuente.transferTo(0, canalFuente.size(), canalDestino);
} catch (IOException e) {
throw new IOException("copiando ficheros orig:'" + source.getAbsolutePath()
+ "' destino:'" + dest.getAbsolutePath() + "'", e);
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
// try {
// in.close();
// } catch (IOException e) {
// }
// try {
// out.close();
// } catch (IOException e) {
// }
}
} catch (FileNotFoundException e) {
throw new IOException("copiando ficheros orig:'" + source.getAbsolutePath()
+ "' destino:'" + dest.getAbsolutePath() + "'", e);
}
} | [
"public",
"static",
"void",
"copyFromFileToFile",
"(",
"File",
"source",
",",
"File",
"dest",
")",
"throws",
"IOException",
"{",
"try",
"{",
"FileInputStream",
"in",
"=",
"new",
"FileInputStream",
"(",
"source",
")",
";",
"FileOutputStream",
"out",
"=",
"new",... | Copia el contenido de un fichero a otro en caso de error lanza una excepcion.
@param source
@param dest
@throws IOException | [
"Copia",
"el",
"contenido",
"de",
"un",
"fichero",
"a",
"otro",
"en",
"caso",
"de",
"error",
"lanza",
"una",
"excepcion",
"."
] | train | https://github.com/ginere/ginere-base/blob/b1cc1c5834bd8a31df475c6f3fc0ee51273c5a24/src/main/java/eu/ginere/base/util/file/FileUtils.java#L522-L549 |
kiswanij/jk-util | src/main/java/com/jk/util/time/JKTimeObject.java | JKTimeObject.toTimeObject | public JKTimeObject toTimeObject(Date date, Date time) {
JKTimeObject fsTimeObject = new JKTimeObject();
Calendar timeInstance = Calendar.getInstance();
timeInstance.setTimeInMillis(time.getTime());
fsTimeObject.setHour(timeInstance.get(Calendar.HOUR_OF_DAY));
fsTimeObject.setMunite(timeInstance.get(Calendar.MINUTE));
Calendar dateInstance = Calendar.getInstance();
dateInstance.setTime(date);
fsTimeObject.setYear(dateInstance.get(Calendar.YEAR));
fsTimeObject.setMonth(dateInstance.get(Calendar.MONTH));
fsTimeObject.setDay(dateInstance.get(Calendar.DAY_OF_MONTH));
return fsTimeObject;
} | java | public JKTimeObject toTimeObject(Date date, Date time) {
JKTimeObject fsTimeObject = new JKTimeObject();
Calendar timeInstance = Calendar.getInstance();
timeInstance.setTimeInMillis(time.getTime());
fsTimeObject.setHour(timeInstance.get(Calendar.HOUR_OF_DAY));
fsTimeObject.setMunite(timeInstance.get(Calendar.MINUTE));
Calendar dateInstance = Calendar.getInstance();
dateInstance.setTime(date);
fsTimeObject.setYear(dateInstance.get(Calendar.YEAR));
fsTimeObject.setMonth(dateInstance.get(Calendar.MONTH));
fsTimeObject.setDay(dateInstance.get(Calendar.DAY_OF_MONTH));
return fsTimeObject;
} | [
"public",
"JKTimeObject",
"toTimeObject",
"(",
"Date",
"date",
",",
"Date",
"time",
")",
"{",
"JKTimeObject",
"fsTimeObject",
"=",
"new",
"JKTimeObject",
"(",
")",
";",
"Calendar",
"timeInstance",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"timeInstan... | To time object.
@param date the date
@param time the time
@return the JK time object | [
"To",
"time",
"object",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/time/JKTimeObject.java#L95-L108 |
phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/JAXBContextCache.java | JAXBContextCache.getFromCache | @Nullable
public JAXBContext getFromCache (@Nonnull final Class <?> aClass, @Nullable final ClassLoader aClassLoader)
{
ValueEnforcer.notNull (aClass, "Class");
final Package aPackage = aClass.getPackage ();
if (aPackage.getAnnotation (XmlSchema.class) != null)
{
// Redirect to cached version
return getFromCache (aPackage, aClassLoader);
}
// E.g. an internal class - try anyway!
if (GlobalDebug.isDebugMode ())
LOGGER.info ("Creating JAXB context for class " + aClass.getName ());
if (aClassLoader != null)
LOGGER.warn ("Package " +
aPackage.getName () +
" does not seem to be JAXB generated. Therefore a new JAXBContext is created and the provided ClassLoader is ignored!");
try
{
// Using the version with a ClassLoader would require an
// ObjectFactory.class or an jaxb.index file in the same package!
return JAXBContext.newInstance (aClass);
}
catch (final JAXBException ex)
{
final String sMsg = "Failed to create JAXB context for class '" + aClass.getName () + "'";
LOGGER.error (sMsg + ": " + ex.getMessage ());
throw new IllegalArgumentException (sMsg, ex);
}
} | java | @Nullable
public JAXBContext getFromCache (@Nonnull final Class <?> aClass, @Nullable final ClassLoader aClassLoader)
{
ValueEnforcer.notNull (aClass, "Class");
final Package aPackage = aClass.getPackage ();
if (aPackage.getAnnotation (XmlSchema.class) != null)
{
// Redirect to cached version
return getFromCache (aPackage, aClassLoader);
}
// E.g. an internal class - try anyway!
if (GlobalDebug.isDebugMode ())
LOGGER.info ("Creating JAXB context for class " + aClass.getName ());
if (aClassLoader != null)
LOGGER.warn ("Package " +
aPackage.getName () +
" does not seem to be JAXB generated. Therefore a new JAXBContext is created and the provided ClassLoader is ignored!");
try
{
// Using the version with a ClassLoader would require an
// ObjectFactory.class or an jaxb.index file in the same package!
return JAXBContext.newInstance (aClass);
}
catch (final JAXBException ex)
{
final String sMsg = "Failed to create JAXB context for class '" + aClass.getName () + "'";
LOGGER.error (sMsg + ": " + ex.getMessage ());
throw new IllegalArgumentException (sMsg, ex);
}
} | [
"@",
"Nullable",
"public",
"JAXBContext",
"getFromCache",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"?",
">",
"aClass",
",",
"@",
"Nullable",
"final",
"ClassLoader",
"aClassLoader",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aClass",
",",
"\"Class\"",
... | Get the {@link JAXBContext} from an existing {@link Class} object. If the
class's owning package is a valid JAXB package, this method redirects to
{@link #getFromCache(Package)} otherwise a new JAXB context is created and
NOT cached.
@param aClass
The class for which the JAXB context is to be created. May not be
<code>null</code>.
@param aClassLoader
Class loader to use. May be <code>null</code> in which case the
default class loader is used.
@return May be <code>null</code>. | [
"Get",
"the",
"{",
"@link",
"JAXBContext",
"}",
"from",
"an",
"existing",
"{",
"@link",
"Class",
"}",
"object",
".",
"If",
"the",
"class",
"s",
"owning",
"package",
"is",
"a",
"valid",
"JAXB",
"package",
"this",
"method",
"redirects",
"to",
"{",
"@link",... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBContextCache.java#L169-L202 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryNodeTypeManager.java | RepositoryNodeTypeManager.registerNodeType | JcrNodeType registerNodeType( NodeTypeDefinition ntd )
throws InvalidNodeTypeDefinitionException, NodeTypeExistsException, RepositoryException {
return registerNodeType(ntd, true);
} | java | JcrNodeType registerNodeType( NodeTypeDefinition ntd )
throws InvalidNodeTypeDefinitionException, NodeTypeExistsException, RepositoryException {
return registerNodeType(ntd, true);
} | [
"JcrNodeType",
"registerNodeType",
"(",
"NodeTypeDefinition",
"ntd",
")",
"throws",
"InvalidNodeTypeDefinitionException",
",",
"NodeTypeExistsException",
",",
"RepositoryException",
"{",
"return",
"registerNodeType",
"(",
"ntd",
",",
"true",
")",
";",
"}"
] | Registers a new node type or updates an existing node type using the specified definition and returns the resulting
{@code NodeType} object.
<p>
For details, see {@link #registerNodeTypes(Iterable)}.
</p>
@param ntd the {@code NodeTypeDefinition} to register
@return the newly registered (or updated) {@code NodeType}
@throws InvalidNodeTypeDefinitionException if the {@code NodeTypeDefinition} is invalid
@throws NodeTypeExistsException if <code>allowUpdate</code> is false and the {@code NodeTypeDefinition} specifies a node
type name that is already registered
@throws RepositoryException if another error occurs | [
"Registers",
"a",
"new",
"node",
"type",
"or",
"updates",
"an",
"existing",
"node",
"type",
"using",
"the",
"specified",
"definition",
"and",
"returns",
"the",
"resulting",
"{",
"@code",
"NodeType",
"}",
"object",
".",
"<p",
">",
"For",
"details",
"see",
"... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryNodeTypeManager.java#L360-L364 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/helper/AuthenticateUserHelper.java | AuthenticateUserHelper.createPartialSubject | protected Subject createPartialSubject(String username, AuthenticationService authenticationService, String customCacheKey) {
Subject partialSubject = null;
partialSubject = new Subject();
Hashtable<String, Object> hashtable = new Hashtable<String, Object>();
hashtable.put(AttributeNameConstants.WSCREDENTIAL_USERID, username);
// only set the property in the hashtable if the public property is not already set;
// this property allows authentication when only the username is supplied
if (!authenticationService.isAllowHashTableLoginWithIdOnly()) {
hashtable.put(AuthenticationConstants.INTERNAL_ASSERTION_KEY, Boolean.TRUE);
}
if (customCacheKey != null) {
hashtable.put(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY, customCacheKey);
}
partialSubject.getPublicCredentials().add(hashtable);
return partialSubject;
} | java | protected Subject createPartialSubject(String username, AuthenticationService authenticationService, String customCacheKey) {
Subject partialSubject = null;
partialSubject = new Subject();
Hashtable<String, Object> hashtable = new Hashtable<String, Object>();
hashtable.put(AttributeNameConstants.WSCREDENTIAL_USERID, username);
// only set the property in the hashtable if the public property is not already set;
// this property allows authentication when only the username is supplied
if (!authenticationService.isAllowHashTableLoginWithIdOnly()) {
hashtable.put(AuthenticationConstants.INTERNAL_ASSERTION_KEY, Boolean.TRUE);
}
if (customCacheKey != null) {
hashtable.put(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY, customCacheKey);
}
partialSubject.getPublicCredentials().add(hashtable);
return partialSubject;
} | [
"protected",
"Subject",
"createPartialSubject",
"(",
"String",
"username",
",",
"AuthenticationService",
"authenticationService",
",",
"String",
"customCacheKey",
")",
"{",
"Subject",
"partialSubject",
"=",
"null",
";",
"partialSubject",
"=",
"new",
"Subject",
"(",
")... | /*
Create the partial subject that can be used to authenticate the user with. | [
"/",
"*",
"Create",
"the",
"partial",
"subject",
"that",
"can",
"be",
"used",
"to",
"authenticate",
"the",
"user",
"with",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/helper/AuthenticateUserHelper.java#L67-L85 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/liquibase/changes/FixInvitations.java | FixInvitations.deleteInvitation | private void deleteInvitation(JdbcConnection connection, Long id) throws CustomChangeException {
try (PreparedStatement statement = connection.prepareStatement("DELETE FROM PANELINVITATION WHERE id = ?")) {
statement.setLong(1, id);
statement.execute();
} catch (Exception e) {
throw new CustomChangeException(e);
}
} | java | private void deleteInvitation(JdbcConnection connection, Long id) throws CustomChangeException {
try (PreparedStatement statement = connection.prepareStatement("DELETE FROM PANELINVITATION WHERE id = ?")) {
statement.setLong(1, id);
statement.execute();
} catch (Exception e) {
throw new CustomChangeException(e);
}
} | [
"private",
"void",
"deleteInvitation",
"(",
"JdbcConnection",
"connection",
",",
"Long",
"id",
")",
"throws",
"CustomChangeException",
"{",
"try",
"(",
"PreparedStatement",
"statement",
"=",
"connection",
".",
"prepareStatement",
"(",
"\"DELETE FROM PANELINVITATION WHERE ... | Deletes an invitation
@param connection connection
@param id invitation id
@throws CustomChangeException on error | [
"Deletes",
"an",
"invitation"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/liquibase/changes/FixInvitations.java#L68-L75 |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java | LongPacker.packInt | static public int packInt(DataOutput os, int value)
throws IOException {
if (value < 0) {
throw new IllegalArgumentException("negative value: v=" + value);
}
int i = 1;
while ((value & ~0x7F) != 0) {
os.write(((value & 0x7F) | 0x80));
value >>>= 7;
i++;
}
os.write((byte) value);
return i;
} | java | static public int packInt(DataOutput os, int value)
throws IOException {
if (value < 0) {
throw new IllegalArgumentException("negative value: v=" + value);
}
int i = 1;
while ((value & ~0x7F) != 0) {
os.write(((value & 0x7F) | 0x80));
value >>>= 7;
i++;
}
os.write((byte) value);
return i;
} | [
"static",
"public",
"int",
"packInt",
"(",
"DataOutput",
"os",
",",
"int",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"negative value: v=\"",
"+",
"value",
")",
";",
... | Pack non-negative int into output stream. It will occupy 1-5 bytes
depending on value (lower values occupy smaller space)
@param os the data output
@param value the value
@return the number of bytes written
@throws IOException if an error occurs with the stream | [
"Pack",
"non",
"-",
"negative",
"int",
"into",
"output",
"stream",
".",
"It",
"will",
"occupy",
"1",
"-",
"5",
"bytes",
"depending",
"on",
"value",
"(",
"lower",
"values",
"occupy",
"smaller",
"space",
")"
] | train | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java#L149-L165 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java | BlockSender.sendChunks | private int sendChunks(ByteBuffer pkt, int maxChunks, OutputStream out)
throws IOException {
// Sends multiple chunks in one packet with a single write().
int len = (int) Math.min(endOffset - offset,
(((long) bytesPerChecksum) * ((long) maxChunks)));
// truncate len so that any partial chunks will be sent as a final packet.
// this is not necessary for correctness, but partial chunks are
// ones that may be recomputed and sent via buffer copy, so try to minimize
// those bytes
if (len > bytesPerChecksum && len % bytesPerChecksum != 0) {
len -= len % bytesPerChecksum;
}
if (len == 0) {
return 0;
}
int numChunks = (len + bytesPerChecksum - 1)/bytesPerChecksum;
int packetLen = len + numChunks*checksumSize + 4;
pkt.clear();
// The packet format is documented in DFSOuputStream.Packet.getBuffer().
// Here we need to use the exact packet format since it can be received
// by both of DFSClient, or BlockReceiver in the case of replication, which
// uses the same piece of codes as receiving data from DFSOutputStream.
//
// write packet header
pkt.putInt(packetLen);
if (pktIncludeVersion) {
pkt.putInt(packetVersion);
}
pkt.putLong(offset);
pkt.putLong(seqno);
pkt.put((byte)((offset + len >= endOffset) ? 1 : 0));
//why no ByteBuf.putBoolean()?
pkt.putInt(len);
int checksumOff = pkt.position();
byte[] buf = pkt.array();
blockReader.sendChunks(out, buf, offset, checksumOff,
numChunks, len, crcUpdater, packetVersion);
if (throttler != null) { // rebalancing so throttle
throttler.throttle(packetLen);
}
return len;
} | java | private int sendChunks(ByteBuffer pkt, int maxChunks, OutputStream out)
throws IOException {
// Sends multiple chunks in one packet with a single write().
int len = (int) Math.min(endOffset - offset,
(((long) bytesPerChecksum) * ((long) maxChunks)));
// truncate len so that any partial chunks will be sent as a final packet.
// this is not necessary for correctness, but partial chunks are
// ones that may be recomputed and sent via buffer copy, so try to minimize
// those bytes
if (len > bytesPerChecksum && len % bytesPerChecksum != 0) {
len -= len % bytesPerChecksum;
}
if (len == 0) {
return 0;
}
int numChunks = (len + bytesPerChecksum - 1)/bytesPerChecksum;
int packetLen = len + numChunks*checksumSize + 4;
pkt.clear();
// The packet format is documented in DFSOuputStream.Packet.getBuffer().
// Here we need to use the exact packet format since it can be received
// by both of DFSClient, or BlockReceiver in the case of replication, which
// uses the same piece of codes as receiving data from DFSOutputStream.
//
// write packet header
pkt.putInt(packetLen);
if (pktIncludeVersion) {
pkt.putInt(packetVersion);
}
pkt.putLong(offset);
pkt.putLong(seqno);
pkt.put((byte)((offset + len >= endOffset) ? 1 : 0));
//why no ByteBuf.putBoolean()?
pkt.putInt(len);
int checksumOff = pkt.position();
byte[] buf = pkt.array();
blockReader.sendChunks(out, buf, offset, checksumOff,
numChunks, len, crcUpdater, packetVersion);
if (throttler != null) { // rebalancing so throttle
throttler.throttle(packetLen);
}
return len;
} | [
"private",
"int",
"sendChunks",
"(",
"ByteBuffer",
"pkt",
",",
"int",
"maxChunks",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"// Sends multiple chunks in one packet with a single write().",
"int",
"len",
"=",
"(",
"int",
")",
"Math",
".",
"min",... | Sends upto maxChunks chunks of data.
When blockInPosition is >= 0, assumes 'out' is a
{@link SocketOutputStream} and tries
{@link SocketOutputStream#transferToFully(FileChannel, long, int)} to
send data (and updates blockInPosition). | [
"Sends",
"upto",
"maxChunks",
"chunks",
"of",
"data",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java#L256-L307 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.createMultistepExprList | protected MultistepExprHolder createMultistepExprList(Vector paths)
{
MultistepExprHolder first = null;
int n = paths.size();
for(int i = 0; i < n; i++)
{
ExpressionOwner eo = (ExpressionOwner)paths.elementAt(i);
if(null == eo)
continue;
// Assuming location path iterators should be OK.
LocPathIterator lpi = (LocPathIterator)eo.getExpression();
int numPaths = countSteps(lpi);
if(numPaths > 1)
{
if(null == first)
first = new MultistepExprHolder(eo, numPaths, null);
else
first = first.addInSortedOrder(eo, numPaths);
}
}
if((null == first) || (first.getLength() <= 1))
return null;
else
return first;
} | java | protected MultistepExprHolder createMultistepExprList(Vector paths)
{
MultistepExprHolder first = null;
int n = paths.size();
for(int i = 0; i < n; i++)
{
ExpressionOwner eo = (ExpressionOwner)paths.elementAt(i);
if(null == eo)
continue;
// Assuming location path iterators should be OK.
LocPathIterator lpi = (LocPathIterator)eo.getExpression();
int numPaths = countSteps(lpi);
if(numPaths > 1)
{
if(null == first)
first = new MultistepExprHolder(eo, numPaths, null);
else
first = first.addInSortedOrder(eo, numPaths);
}
}
if((null == first) || (first.getLength() <= 1))
return null;
else
return first;
} | [
"protected",
"MultistepExprHolder",
"createMultistepExprList",
"(",
"Vector",
"paths",
")",
"{",
"MultistepExprHolder",
"first",
"=",
"null",
";",
"int",
"n",
"=",
"paths",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",... | For the reduction of location path parts, create a list of all
the multistep paths with more than one step, sorted by the
number of steps, with the most steps occuring earlier in the list.
If the list is only one member, don't bother returning it.
@param paths Vector of ExpressionOwner objects, which may contain null entries.
The ExpressionOwner objects must own LocPathIterator objects.
@return null if no multipart paths are found or the list is only of length 1,
otherwise the first MultistepExprHolder in a linked list of these objects. | [
"For",
"the",
"reduction",
"of",
"location",
"path",
"parts",
"create",
"a",
"list",
"of",
"all",
"the",
"multistep",
"paths",
"with",
"more",
"than",
"one",
"step",
"sorted",
"by",
"the",
"number",
"of",
"steps",
"with",
"the",
"most",
"steps",
"occuring"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L554-L580 |
alkacon/opencms-core | src/org/opencms/loader/A_CmsXmlDocumentLoader.java | A_CmsXmlDocumentLoader.setTemplateRequestAttributes | protected void setTemplateRequestAttributes(CmsTemplateLoaderFacade loaderFacade, HttpServletRequest req) {
CmsTemplateContext context = loaderFacade.getTemplateContext();
req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_CONTEXT, context);
TemplateBean templateBean = new TemplateBean(
context != null ? context.getKey() : loaderFacade.getTemplateName(),
loaderFacade.getTemplate());
templateBean.setForced((context != null) && context.isForced());
req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN, templateBean);
} | java | protected void setTemplateRequestAttributes(CmsTemplateLoaderFacade loaderFacade, HttpServletRequest req) {
CmsTemplateContext context = loaderFacade.getTemplateContext();
req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_CONTEXT, context);
TemplateBean templateBean = new TemplateBean(
context != null ? context.getKey() : loaderFacade.getTemplateName(),
loaderFacade.getTemplate());
templateBean.setForced((context != null) && context.isForced());
req.setAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN, templateBean);
} | [
"protected",
"void",
"setTemplateRequestAttributes",
"(",
"CmsTemplateLoaderFacade",
"loaderFacade",
",",
"HttpServletRequest",
"req",
")",
"{",
"CmsTemplateContext",
"context",
"=",
"loaderFacade",
".",
"getTemplateContext",
"(",
")",
";",
"req",
".",
"setAttribute",
"... | Sets request attributes that provide access to the template configuration.<p>
@param loaderFacade the template loader facade
@param req the servlet request | [
"Sets",
"request",
"attributes",
"that",
"provide",
"access",
"to",
"the",
"template",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/A_CmsXmlDocumentLoader.java#L281-L290 |
hellosign/hellosign-java-sdk | src/main/java/com/hellosign/sdk/HelloSignClient.java | HelloSignClient.getFiles | public File getFiles(String requestId, String format) throws HelloSignException {
if (format == null || format.isEmpty()) {
format = FILES_FILE_EXT;
}
String url = BASE_URI + SIGNATURE_REQUEST_FILES_URI + "/" + requestId;
String fileName = FILES_FILE_NAME + "." + format;
return httpClient.withAuth(auth).withGetParam(PARAM_FILE_TYPE_URI, format).get(url).asFile(fileName);
} | java | public File getFiles(String requestId, String format) throws HelloSignException {
if (format == null || format.isEmpty()) {
format = FILES_FILE_EXT;
}
String url = BASE_URI + SIGNATURE_REQUEST_FILES_URI + "/" + requestId;
String fileName = FILES_FILE_NAME + "." + format;
return httpClient.withAuth(auth).withGetParam(PARAM_FILE_TYPE_URI, format).get(url).asFile(fileName);
} | [
"public",
"File",
"getFiles",
"(",
"String",
"requestId",
",",
"String",
"format",
")",
"throws",
"HelloSignException",
"{",
"if",
"(",
"format",
"==",
"null",
"||",
"format",
".",
"isEmpty",
"(",
")",
")",
"{",
"format",
"=",
"FILES_FILE_EXT",
";",
"}",
... | Retrieves the file associated with a signature request.
@param requestId String signature request ID
@param format String format, see SignatureRequest for available types
@return File
@throws HelloSignException thrown if there's a problem processing the
HTTP request or the JSON response. | [
"Retrieves",
"the",
"file",
"associated",
"with",
"a",
"signature",
"request",
"."
] | train | https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/HelloSignClient.java#L771-L778 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.telephony_billingAccount_accessories_GET | public OvhOrder telephony_billingAccount_accessories_GET(String billingAccount, String[] accessories, String mondialRelayId, Boolean retractation, Long shippingContactId) throws IOException {
String qPath = "/order/telephony/{billingAccount}/accessories";
StringBuilder sb = path(qPath, billingAccount);
query(sb, "accessories", accessories);
query(sb, "mondialRelayId", mondialRelayId);
query(sb, "retractation", retractation);
query(sb, "shippingContactId", shippingContactId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder telephony_billingAccount_accessories_GET(String billingAccount, String[] accessories, String mondialRelayId, Boolean retractation, Long shippingContactId) throws IOException {
String qPath = "/order/telephony/{billingAccount}/accessories";
StringBuilder sb = path(qPath, billingAccount);
query(sb, "accessories", accessories);
query(sb, "mondialRelayId", mondialRelayId);
query(sb, "retractation", retractation);
query(sb, "shippingContactId", shippingContactId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"telephony_billingAccount_accessories_GET",
"(",
"String",
"billingAccount",
",",
"String",
"[",
"]",
"accessories",
",",
"String",
"mondialRelayId",
",",
"Boolean",
"retractation",
",",
"Long",
"shippingContactId",
")",
"throws",
"IOException",
"{... | Get prices and contracts information
REST: GET /order/telephony/{billingAccount}/accessories
@param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping contact address information entry.
@param shippingContactId [required] Shipping contact information id from /me entry point
@param retractation [required] Retractation rights if set
@param accessories [required] Accessories to order
@param billingAccount [required] The name of your billingAccount | [
"Get",
"prices",
"and",
"contracts",
"information"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6680-L6689 |
openengsb/openengsb | components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java | AbstractEDBService.updateDeletedObjectsThroughEntityManager | private void updateDeletedObjectsThroughEntityManager(List<String> oids, Long timestamp) {
for (String id : oids) {
EDBObject o = new EDBObject(id);
o.updateTimestamp(timestamp);
o.setDeleted(true);
JPAObject j = EDBUtils.convertEDBObjectToJPAObject(o);
entityManager.persist(j);
}
} | java | private void updateDeletedObjectsThroughEntityManager(List<String> oids, Long timestamp) {
for (String id : oids) {
EDBObject o = new EDBObject(id);
o.updateTimestamp(timestamp);
o.setDeleted(true);
JPAObject j = EDBUtils.convertEDBObjectToJPAObject(o);
entityManager.persist(j);
}
} | [
"private",
"void",
"updateDeletedObjectsThroughEntityManager",
"(",
"List",
"<",
"String",
">",
"oids",
",",
"Long",
"timestamp",
")",
"{",
"for",
"(",
"String",
"id",
":",
"oids",
")",
"{",
"EDBObject",
"o",
"=",
"new",
"EDBObject",
"(",
"id",
")",
";",
... | Updates all deleted objects with the timestamp, mark them as deleted and persist them through the entity manager. | [
"Updates",
"all",
"deleted",
"objects",
"with",
"the",
"timestamp",
"mark",
"them",
"as",
"deleted",
"and",
"persist",
"them",
"through",
"the",
"entity",
"manager",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java#L135-L143 |
microfocus-idol/java-content-parameter-api | src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java | FieldTextBuilder.AND | @Override
public FieldTextBuilder AND(final FieldText fieldText) {
Validate.notNull(fieldText, "FieldText should not be null");
if(fieldText == this || toString().equals(fieldText.toString())) {
return this;
}
if(isEmpty()) {
return setFieldText(fieldText);
}
if(fieldText.isEmpty()) {
return this;
}
if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) {
return setFieldText(MATCHNOTHING);
}
return binaryOperation("AND", fieldText);
} | java | @Override
public FieldTextBuilder AND(final FieldText fieldText) {
Validate.notNull(fieldText, "FieldText should not be null");
if(fieldText == this || toString().equals(fieldText.toString())) {
return this;
}
if(isEmpty()) {
return setFieldText(fieldText);
}
if(fieldText.isEmpty()) {
return this;
}
if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) {
return setFieldText(MATCHNOTHING);
}
return binaryOperation("AND", fieldText);
} | [
"@",
"Override",
"public",
"FieldTextBuilder",
"AND",
"(",
"final",
"FieldText",
"fieldText",
")",
"{",
"Validate",
".",
"notNull",
"(",
"fieldText",
",",
"\"FieldText should not be null\"",
")",
";",
"if",
"(",
"fieldText",
"==",
"this",
"||",
"toString",
"(",
... | Appends the specified fieldtext onto the builder using the AND operator. Parentheses are omitted where possible
and logical simplifications are made in certain cases:
<p>
<pre>(A AND A) {@literal =>} A</pre>
<pre>(* AND A) {@literal =>} A</pre>
<pre>(0 AND A) {@literal =>} 0</pre>
@param fieldText A fieldtext expression or specifier.
@return {@code this} | [
"Appends",
"the",
"specified",
"fieldtext",
"onto",
"the",
"builder",
"using",
"the",
"AND",
"operator",
".",
"Parentheses",
"are",
"omitted",
"where",
"possible",
"and",
"logical",
"simplifications",
"are",
"made",
"in",
"certain",
"cases",
":",
"<p",
">",
"<... | train | https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java#L128-L149 |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/BackupSessionTask.java | BackupSessionTask.doBackupSession | BackupResult doBackupSession( final MemcachedBackupSession session, final byte[] data, final byte[] attributesData ) throws InterruptedException {
if ( _log.isDebugEnabled() ) {
_log.debug( "Trying to store session in memcached: " + session.getId() );
}
try {
storeSessionInMemcached( session, data );
return new BackupResult( BackupResultStatus.SUCCESS, data, attributesData );
} catch (final ExecutionException e) {
handleException(session, e);
return new BackupResult(BackupResultStatus.FAILURE, data, null);
} catch (final TimeoutException e) {
handleException(session, e);
return new BackupResult(BackupResultStatus.FAILURE, data, null);
}
} | java | BackupResult doBackupSession( final MemcachedBackupSession session, final byte[] data, final byte[] attributesData ) throws InterruptedException {
if ( _log.isDebugEnabled() ) {
_log.debug( "Trying to store session in memcached: " + session.getId() );
}
try {
storeSessionInMemcached( session, data );
return new BackupResult( BackupResultStatus.SUCCESS, data, attributesData );
} catch (final ExecutionException e) {
handleException(session, e);
return new BackupResult(BackupResultStatus.FAILURE, data, null);
} catch (final TimeoutException e) {
handleException(session, e);
return new BackupResult(BackupResultStatus.FAILURE, data, null);
}
} | [
"BackupResult",
"doBackupSession",
"(",
"final",
"MemcachedBackupSession",
"session",
",",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"byte",
"[",
"]",
"attributesData",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"_log",
".",
"isDebugEnabled",
... | Store the provided session in memcached.
@param session the session to backup
@param data the serialized session data (session fields and session attributes).
@param attributesData just the serialized session attributes.
@return the {@link BackupResultStatus} | [
"Store",
"the",
"provided",
"session",
"in",
"memcached",
".",
"@param",
"session",
"the",
"session",
"to",
"backup",
"@param",
"data",
"the",
"serialized",
"session",
"data",
"(",
"session",
"fields",
"and",
"session",
"attributes",
")",
".",
"@param",
"attri... | train | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/BackupSessionTask.java#L192-L207 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java | DefaultFacelet.getRelativePath | private URL getRelativePath(FacesContext facesContext, String path) throws IOException
{
URL url = (URL) _relativePaths.get(path);
if (url == null)
{
url = _factory.resolveURL(facesContext, _src, path);
if (url != null)
{
ViewResource viewResource = (ViewResource) facesContext.getAttributes().get(
FaceletFactory.LAST_RESOURCE_RESOLVED);
if (viewResource != null)
{
// If a view resource has been used to resolve a resource, the cache is in
// the ResourceHandler implementation. No need to cache in _relativeLocations.
}
else
{
_relativePaths.put(path, url);
}
}
}
return url;
} | java | private URL getRelativePath(FacesContext facesContext, String path) throws IOException
{
URL url = (URL) _relativePaths.get(path);
if (url == null)
{
url = _factory.resolveURL(facesContext, _src, path);
if (url != null)
{
ViewResource viewResource = (ViewResource) facesContext.getAttributes().get(
FaceletFactory.LAST_RESOURCE_RESOLVED);
if (viewResource != null)
{
// If a view resource has been used to resolve a resource, the cache is in
// the ResourceHandler implementation. No need to cache in _relativeLocations.
}
else
{
_relativePaths.put(path, url);
}
}
}
return url;
} | [
"private",
"URL",
"getRelativePath",
"(",
"FacesContext",
"facesContext",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"(",
"URL",
")",
"_relativePaths",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"url",
"==",
"null",
"... | Delegates resolution to DefaultFaceletFactory reference. Also, caches URLs for relative paths.
@param path
a relative url path
@return URL pointing to destination
@throws IOException
if there is a problem creating the URL for the path specified | [
"Delegates",
"resolution",
"to",
"DefaultFaceletFactory",
"reference",
".",
"Also",
"caches",
"URLs",
"for",
"relative",
"paths",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java#L470-L492 |
camunda/camunda-commons | typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java | Variables.objectValue | public static ObjectValueBuilder objectValue(Object value, boolean isTransient) {
return (ObjectValueBuilder) objectValue(value).setTransient(isTransient);
} | java | public static ObjectValueBuilder objectValue(Object value, boolean isTransient) {
return (ObjectValueBuilder) objectValue(value).setTransient(isTransient);
} | [
"public",
"static",
"ObjectValueBuilder",
"objectValue",
"(",
"Object",
"value",
",",
"boolean",
"isTransient",
")",
"{",
"return",
"(",
"ObjectValueBuilder",
")",
"objectValue",
"(",
"value",
")",
".",
"setTransient",
"(",
"isTransient",
")",
";",
"}"
] | Returns a builder to create a new {@link ObjectValue} that encapsulates
the given {@code value}. | [
"Returns",
"a",
"builder",
"to",
"create",
"a",
"new",
"{"
] | train | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java#L183-L185 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/collector/CollectorJsonHelpers.java | CollectorJsonHelpers.jsonEscape3 | protected static void jsonEscape3(StringBuilder sb, String s) {
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
case '\b':
sb.append("\\b");
break;
case '\f':
sb.append("\\f");
break;
case '\n':
sb.append("\\n");
break;
case '\r':
sb.append("\\r");
break;
case '\t':
sb.append("\\t");
break;
// Fall through because we just need to add \ (escaped) before the character
case '\\':
case '\"':
case '/':
sb.append("\\");
sb.append(c);
break;
default:
sb.append(c);
}
}
} | java | protected static void jsonEscape3(StringBuilder sb, String s) {
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
case '\b':
sb.append("\\b");
break;
case '\f':
sb.append("\\f");
break;
case '\n':
sb.append("\\n");
break;
case '\r':
sb.append("\\r");
break;
case '\t':
sb.append("\\t");
break;
// Fall through because we just need to add \ (escaped) before the character
case '\\':
case '\"':
case '/':
sb.append("\\");
sb.append(c);
break;
default:
sb.append(c);
}
}
} | [
"protected",
"static",
"void",
"jsonEscape3",
"(",
"StringBuilder",
"sb",
",",
"String",
"s",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"s",
".",
"charAt... | Escape \b, \f, \n, \r, \t, ", \, / characters and appends to a string builder
@param sb String builder to append to
@param s String to escape | [
"Escape",
"\\",
"b",
"\\",
"f",
"\\",
"n",
"\\",
"r",
"\\",
"t",
"\\",
"/",
"characters",
"and",
"appends",
"to",
"a",
"string",
"builder"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/collector/CollectorJsonHelpers.java#L152-L183 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/MLLibUtil.java | MLLibUtil.toLabeledPoint | private static LabeledPoint toLabeledPoint(DataSet point) {
if (!point.getFeatures().isVector()) {
throw new IllegalArgumentException("Feature matrix must be a vector");
}
Vector features = toVector(point.getFeatures().dup());
double label = Nd4j.getBlasWrapper().iamax(point.getLabels());
return new LabeledPoint(label, features);
} | java | private static LabeledPoint toLabeledPoint(DataSet point) {
if (!point.getFeatures().isVector()) {
throw new IllegalArgumentException("Feature matrix must be a vector");
}
Vector features = toVector(point.getFeatures().dup());
double label = Nd4j.getBlasWrapper().iamax(point.getLabels());
return new LabeledPoint(label, features);
} | [
"private",
"static",
"LabeledPoint",
"toLabeledPoint",
"(",
"DataSet",
"point",
")",
"{",
"if",
"(",
"!",
"point",
".",
"getFeatures",
"(",
")",
".",
"isVector",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Feature matrix must be a vec... | Convert a dataset (feature vector) to a labeled point
@param point the point to convert
@return the labeled point derived from this dataset | [
"Convert",
"a",
"dataset",
"(",
"feature",
"vector",
")",
"to",
"a",
"labeled",
"point"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/MLLibUtil.java#L303-L312 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePolynomialMath.java | QrCodePolynomialMath.bitPolyModulus | public static int bitPolyModulus(int data , int generator , int totalBits, int dataBits) {
int errorBits = totalBits-dataBits;
for (int i = dataBits-1; i >= 0; i--) {
if( (data & (1 << (i+errorBits))) != 0 ) {
data ^= generator << i;
}
}
return data;
} | java | public static int bitPolyModulus(int data , int generator , int totalBits, int dataBits) {
int errorBits = totalBits-dataBits;
for (int i = dataBits-1; i >= 0; i--) {
if( (data & (1 << (i+errorBits))) != 0 ) {
data ^= generator << i;
}
}
return data;
} | [
"public",
"static",
"int",
"bitPolyModulus",
"(",
"int",
"data",
",",
"int",
"generator",
",",
"int",
"totalBits",
",",
"int",
"dataBits",
")",
"{",
"int",
"errorBits",
"=",
"totalBits",
"-",
"dataBits",
";",
"for",
"(",
"int",
"i",
"=",
"dataBits",
"-",... | Performs division using xcr operators on the encoded polynomials. used in BCH encoding/decoding
@param data Data being checked
@param generator Generator polynomial
@param totalBits Total number of bits in data
@param dataBits Number of data bits. Rest are error correction bits
@return Remainder after polynomial division | [
"Performs",
"division",
"using",
"xcr",
"operators",
"on",
"the",
"encoded",
"polynomials",
".",
"used",
"in",
"BCH",
"encoding",
"/",
"decoding"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePolynomialMath.java#L153-L161 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/guid/Guid.java | Guid.append | public Guid append(HasGuid... objs) throws IOException {
if (objs == null || objs.length == 0) {
return this;
}
return fromHasGuid(ArrayUtils.add(objs, new SimpleHasGuid(this)));
} | java | public Guid append(HasGuid... objs) throws IOException {
if (objs == null || objs.length == 0) {
return this;
}
return fromHasGuid(ArrayUtils.add(objs, new SimpleHasGuid(this)));
} | [
"public",
"Guid",
"append",
"(",
"HasGuid",
"...",
"objs",
")",
"throws",
"IOException",
"{",
"if",
"(",
"objs",
"==",
"null",
"||",
"objs",
".",
"length",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"return",
"fromHasGuid",
"(",
"ArrayUtils",
"."... | Creates a new {@link Guid} which is a unique, replicable representation of the pair (this, objs).
@param objs an array of {@link HasGuid}.
@return a new {@link Guid}.
@throws IOException | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/guid/Guid.java#L175-L180 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/operator/impl/mutation/NonUniformMutation.java | NonUniformMutation.doMutation | public void doMutation(double probability, DoubleSolution solution){
for (int i = 0; i < solution.getNumberOfVariables(); i++) {
if (randomGenenerator.getRandomValue() < probability) {
double rand = randomGenenerator.getRandomValue();
double tmp;
if (rand <= 0.5) {
tmp = delta(solution.getUpperBound(i) - solution.getVariableValue(i),
perturbation);
tmp += solution.getVariableValue(i);
} else {
tmp = delta(solution.getLowerBound(i) - solution.getVariableValue(i),
perturbation);
tmp += solution.getVariableValue(i);
}
if (tmp < solution.getLowerBound(i)) {
tmp = solution.getLowerBound(i);
} else if (tmp > solution.getUpperBound(i)) {
tmp = solution.getUpperBound(i);
}
solution.setVariableValue(i, tmp);
}
}
} | java | public void doMutation(double probability, DoubleSolution solution){
for (int i = 0; i < solution.getNumberOfVariables(); i++) {
if (randomGenenerator.getRandomValue() < probability) {
double rand = randomGenenerator.getRandomValue();
double tmp;
if (rand <= 0.5) {
tmp = delta(solution.getUpperBound(i) - solution.getVariableValue(i),
perturbation);
tmp += solution.getVariableValue(i);
} else {
tmp = delta(solution.getLowerBound(i) - solution.getVariableValue(i),
perturbation);
tmp += solution.getVariableValue(i);
}
if (tmp < solution.getLowerBound(i)) {
tmp = solution.getLowerBound(i);
} else if (tmp > solution.getUpperBound(i)) {
tmp = solution.getUpperBound(i);
}
solution.setVariableValue(i, tmp);
}
}
} | [
"public",
"void",
"doMutation",
"(",
"double",
"probability",
",",
"DoubleSolution",
"solution",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"solution",
".",
"getNumberOfVariables",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"randomG... | Perform the mutation operation
@param probability Mutation setProbability
@param solution The solution to mutate | [
"Perform",
"the",
"mutation",
"operation"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/operator/impl/mutation/NonUniformMutation.java#L94-L118 |
JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/function/PrecisionScaleRoundedOperator.java | PrecisionScaleRoundedOperator.of | public static PrecisionScaleRoundedOperator of(int scale, MathContext mathContext) {
requireNonNull(mathContext);
if(RoundingMode.UNNECESSARY.equals(mathContext.getRoundingMode())) {
throw new IllegalArgumentException("To create the ScaleRoundedOperator you cannot use the RoundingMode.UNNECESSARY on MathContext");
}
if(mathContext.getPrecision() <= 0) {
throw new IllegalArgumentException("To create the ScaleRoundedOperator you cannot use the zero precision on MathContext");
}
return new PrecisionScaleRoundedOperator(scale, mathContext);
} | java | public static PrecisionScaleRoundedOperator of(int scale, MathContext mathContext) {
requireNonNull(mathContext);
if(RoundingMode.UNNECESSARY.equals(mathContext.getRoundingMode())) {
throw new IllegalArgumentException("To create the ScaleRoundedOperator you cannot use the RoundingMode.UNNECESSARY on MathContext");
}
if(mathContext.getPrecision() <= 0) {
throw new IllegalArgumentException("To create the ScaleRoundedOperator you cannot use the zero precision on MathContext");
}
return new PrecisionScaleRoundedOperator(scale, mathContext);
} | [
"public",
"static",
"PrecisionScaleRoundedOperator",
"of",
"(",
"int",
"scale",
",",
"MathContext",
"mathContext",
")",
"{",
"requireNonNull",
"(",
"mathContext",
")",
";",
"if",
"(",
"RoundingMode",
".",
"UNNECESSARY",
".",
"equals",
"(",
"mathContext",
".",
"g... | Creates the rounded Operator from scale and roundingMode
@param mathContext the math context, not null.
@return the {@link MonetaryOperator} using the scale and {@link RoundingMode} used in parameter
@throws NullPointerException when the {@link MathContext} is null
@throws IllegalArgumentException if {@link MathContext#getPrecision()} is lesser than zero
@throws IllegalArgumentException if {@link MathContext#getRoundingMode()} is {@link RoundingMode#UNNECESSARY}
@see RoundingMode | [
"Creates",
"the",
"rounded",
"Operator",
"from",
"scale",
"and",
"roundingMode"
] | train | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/function/PrecisionScaleRoundedOperator.java#L77-L89 |
apereo/cas | support/cas-server-support-wsfederation-webflow/src/main/java/org/apereo/cas/web/flow/WsFederationAction.java | WsFederationAction.doExecute | @Override
protected Event doExecute(final RequestContext context) {
try {
val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context);
val wa = request.getParameter(WA);
if (StringUtils.isNotBlank(wa) && wa.equalsIgnoreCase(WSIGNIN)) {
wsFederationResponseValidator.validateWsFederationAuthenticationRequest(context);
return super.doExecute(context);
}
return wsFederationRequestBuilder.buildAuthenticationRequestEvent(context);
} catch (final Exception ex) {
LOGGER.error(ex.getMessage(), ex);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, ex.getMessage());
}
} | java | @Override
protected Event doExecute(final RequestContext context) {
try {
val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context);
val wa = request.getParameter(WA);
if (StringUtils.isNotBlank(wa) && wa.equalsIgnoreCase(WSIGNIN)) {
wsFederationResponseValidator.validateWsFederationAuthenticationRequest(context);
return super.doExecute(context);
}
return wsFederationRequestBuilder.buildAuthenticationRequestEvent(context);
} catch (final Exception ex) {
LOGGER.error(ex.getMessage(), ex);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, ex.getMessage());
}
} | [
"@",
"Override",
"protected",
"Event",
"doExecute",
"(",
"final",
"RequestContext",
"context",
")",
"{",
"try",
"{",
"val",
"request",
"=",
"WebUtils",
".",
"getHttpServletRequestFromExternalWebflowContext",
"(",
"context",
")",
";",
"val",
"wa",
"=",
"request",
... | Executes the webflow action.
@param context the context
@return the event | [
"Executes",
"the",
"webflow",
"action",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-wsfederation-webflow/src/main/java/org/apereo/cas/web/flow/WsFederationAction.java#L51-L65 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/InstanceQuery.java | InstanceQuery.executeOneCompleteStmt | protected boolean executeOneCompleteStmt(final String _complStmt)
throws EFapsException
{
final boolean ret = false;
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
AbstractObjectQuery.LOG.debug("Executing SQL: {}", _complStmt);
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
final List<Object[]> values = new ArrayList<>();
while (rs.next()) {
final long id = rs.getLong(1);
Long typeId = null;
if (getBaseType().getMainTable().getSqlColType() != null) {
typeId = rs.getLong(2);
}
values.add(new Object[]{id, typeId});
}
rs.close();
stmt.close();
for (final Object[] row: values) {
final Long id = (Long) row[0];
final Long typeId = (Long) row[1];
getValues().add(Instance.get(typeId == null ? getBaseType() : Type.get(typeId), id));
}
} catch (final SQLException e) {
throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e);
}
return ret;
} | java | protected boolean executeOneCompleteStmt(final String _complStmt)
throws EFapsException
{
final boolean ret = false;
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
AbstractObjectQuery.LOG.debug("Executing SQL: {}", _complStmt);
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
final List<Object[]> values = new ArrayList<>();
while (rs.next()) {
final long id = rs.getLong(1);
Long typeId = null;
if (getBaseType().getMainTable().getSqlColType() != null) {
typeId = rs.getLong(2);
}
values.add(new Object[]{id, typeId});
}
rs.close();
stmt.close();
for (final Object[] row: values) {
final Long id = (Long) row[0];
final Long typeId = (Long) row[1];
getValues().add(Instance.get(typeId == null ? getBaseType() : Type.get(typeId), id));
}
} catch (final SQLException e) {
throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e);
}
return ret;
} | [
"protected",
"boolean",
"executeOneCompleteStmt",
"(",
"final",
"String",
"_complStmt",
")",
"throws",
"EFapsException",
"{",
"final",
"boolean",
"ret",
"=",
"false",
";",
"ConnectionResource",
"con",
"=",
"null",
";",
"try",
"{",
"con",
"=",
"Context",
".",
"... | Execute the actual statement against the database.
@param _complStmt Statment to be executed
@return true if executed with success
@throws EFapsException on error | [
"Execute",
"the",
"actual",
"statement",
"against",
"the",
"database",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/InstanceQuery.java#L131-L164 |
Bandwidth/java-bandwidth | src/main/java/com/bandwidth/sdk/BandwidthClient.java | BandwidthClient.buildMethod | protected HttpUriRequest buildMethod(final String method, final String path, final String params) {
if (StringUtils.equalsIgnoreCase(method, HttpPost.METHOD_NAME)) {
return generatePostRequest(path, params);
} else {
throw new RuntimeException(String.format("Method %s not supported.", method));
}
} | java | protected HttpUriRequest buildMethod(final String method, final String path, final String params) {
if (StringUtils.equalsIgnoreCase(method, HttpPost.METHOD_NAME)) {
return generatePostRequest(path, params);
} else {
throw new RuntimeException(String.format("Method %s not supported.", method));
}
} | [
"protected",
"HttpUriRequest",
"buildMethod",
"(",
"final",
"String",
"method",
",",
"final",
"String",
"path",
",",
"final",
"String",
"params",
")",
"{",
"if",
"(",
"StringUtils",
".",
"equalsIgnoreCase",
"(",
"method",
",",
"HttpPost",
".",
"METHOD_NAME",
"... | Helper method that builds the request to the server.
Only POST is supported currently since we have cases in the API
like token creation that accepts empty string payload "", instead of {}
@param method the method.
@param path the path.
@param params json string.
@return the request. | [
"Helper",
"method",
"that",
"builds",
"the",
"request",
"to",
"the",
"server",
".",
"Only",
"POST",
"is",
"supported",
"currently",
"since",
"we",
"have",
"cases",
"in",
"the",
"API",
"like",
"token",
"creation",
"that",
"accepts",
"empty",
"string",
"payloa... | train | https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L595-L601 |
cdk/cdk | base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/UniqueBondMatches.java | UniqueBondMatches.toEdgeSet | private Set<Tuple> toEdgeSet(int[] mapping) {
Set<Tuple> edges = new HashSet<Tuple>(mapping.length * 2);
for (int u = 0; u < g.length; u++) {
for (int v : g[u]) {
edges.add(new Tuple(mapping[u], mapping[v]));
}
}
return edges;
} | java | private Set<Tuple> toEdgeSet(int[] mapping) {
Set<Tuple> edges = new HashSet<Tuple>(mapping.length * 2);
for (int u = 0; u < g.length; u++) {
for (int v : g[u]) {
edges.add(new Tuple(mapping[u], mapping[v]));
}
}
return edges;
} | [
"private",
"Set",
"<",
"Tuple",
">",
"toEdgeSet",
"(",
"int",
"[",
"]",
"mapping",
")",
"{",
"Set",
"<",
"Tuple",
">",
"edges",
"=",
"new",
"HashSet",
"<",
"Tuple",
">",
"(",
"mapping",
".",
"length",
"*",
"2",
")",
";",
"for",
"(",
"int",
"u",
... | Convert a mapping to a bitset.
@param mapping an atom mapping
@return a bit set of the mapped vertices (values in array) | [
"Convert",
"a",
"mapping",
"to",
"a",
"bitset",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/UniqueBondMatches.java#L83-L91 |
astrapi69/jaulp-wicket | jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java | ComponentFinder.findParent | public static Component findParent(final Component childComponent,
final Class<? extends Component> parentClass, final boolean byClassname)
{
Component parent = childComponent.getParent();
while (parent != null)
{
if (parent.getClass().equals(parentClass))
{
break;
}
parent = parent.getParent();
}
if ((parent == null) && byClassname)
{
return findParentByClassname(childComponent, parentClass);
}
return parent;
} | java | public static Component findParent(final Component childComponent,
final Class<? extends Component> parentClass, final boolean byClassname)
{
Component parent = childComponent.getParent();
while (parent != null)
{
if (parent.getClass().equals(parentClass))
{
break;
}
parent = parent.getParent();
}
if ((parent == null) && byClassname)
{
return findParentByClassname(childComponent, parentClass);
}
return parent;
} | [
"public",
"static",
"Component",
"findParent",
"(",
"final",
"Component",
"childComponent",
",",
"final",
"Class",
"<",
"?",
"extends",
"Component",
">",
"parentClass",
",",
"final",
"boolean",
"byClassname",
")",
"{",
"Component",
"parent",
"=",
"childComponent",... | Finds the first parent of the given childComponent from the given parentClass and a flag if
the search shell be continued with the class name if the search with the given parentClass
returns null.
@param childComponent
the child component
@param parentClass
the parent class
@param byClassname
the flag to search by classname if the search with given parentClass returns null.
@return the component | [
"Finds",
"the",
"first",
"parent",
"of",
"the",
"given",
"childComponent",
"from",
"the",
"given",
"parentClass",
"and",
"a",
"flag",
"if",
"the",
"search",
"shell",
"be",
"continued",
"with",
"the",
"class",
"name",
"if",
"the",
"search",
"with",
"the",
"... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java#L112-L129 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createEnumType | public EnumType createEnumType(String name, Node source, JSType elementsType) {
return new EnumType(this, name, source, elementsType);
} | java | public EnumType createEnumType(String name, Node source, JSType elementsType) {
return new EnumType(this, name, source, elementsType);
} | [
"public",
"EnumType",
"createEnumType",
"(",
"String",
"name",
",",
"Node",
"source",
",",
"JSType",
"elementsType",
")",
"{",
"return",
"new",
"EnumType",
"(",
"this",
",",
"name",
",",
"source",
",",
"elementsType",
")",
";",
"}"
] | Creates an enum type.
@param name The human-readable name associated with the enum, or null if unknown. | [
"Creates",
"an",
"enum",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1547-L1549 |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.decryptAESWithCBC | @Override
public String decryptAESWithCBC(String value, String privateKey, String salt, String iv) {
SecretKey key = generateAESKey(privateKey, salt);
byte[] decrypted = doFinal(Cipher.DECRYPT_MODE, key, iv, decodeBase64(value));
return new String(decrypted, UTF_8);
} | java | @Override
public String decryptAESWithCBC(String value, String privateKey, String salt, String iv) {
SecretKey key = generateAESKey(privateKey, salt);
byte[] decrypted = doFinal(Cipher.DECRYPT_MODE, key, iv, decodeBase64(value));
return new String(decrypted, UTF_8);
} | [
"@",
"Override",
"public",
"String",
"decryptAESWithCBC",
"(",
"String",
"value",
",",
"String",
"privateKey",
",",
"String",
"salt",
",",
"String",
"iv",
")",
"{",
"SecretKey",
"key",
"=",
"generateAESKey",
"(",
"privateKey",
",",
"salt",
")",
";",
"byte",
... | Decrypt a String with the AES encryption advanced using 'AES/CBC/PKCS5Padding'. Unlike the regular
encode/decode AES method using ECB (Electronic Codebook), it uses Cipher-block chaining (CBC). The private key
must have a length of 16 bytes, the salt and initialization vector must be valid hexadecimal Strings.
@param value An encrypted String encoded using Base64.
@param privateKey The private key
@param salt The salt (hexadecimal String)
@param iv The initialization vector (hexadecimal String)
@return The decrypted String | [
"Decrypt",
"a",
"String",
"with",
"the",
"AES",
"encryption",
"advanced",
"using",
"AES",
"/",
"CBC",
"/",
"PKCS5Padding",
".",
"Unlike",
"the",
"regular",
"encode",
"/",
"decode",
"AES",
"method",
"using",
"ECB",
"(",
"Electronic",
"Codebook",
")",
"it",
... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L169-L174 |
kiegroup/drools | kie-ci/src/main/java/org/kie/api/builder/helper/KieModuleDeploymentHelperImpl.java | KieModuleDeploymentHelperImpl.getPomText | private static String getPomText(ReleaseId releaseId, ReleaseId... dependencies) {
String pom = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n"
+ " <modelVersion>4.0.0</modelVersion>\n"
+ "\n"
+ " <groupId>" + releaseId.getGroupId() + "</groupId>\n"
+ " <artifactId>" + releaseId.getArtifactId() + "</artifactId>\n"
+ " <version>" + releaseId.getVersion() + "</version>\n" + "\n";
if (dependencies != null && dependencies.length > 0) {
pom += "<dependencies>\n";
for (ReleaseId dep : dependencies) {
pom += "<dependency>\n";
pom += " <groupId>" + dep.getGroupId() + "</groupId>\n";
pom += " <artifactId>" + dep.getArtifactId() + "</artifactId>\n";
pom += " <version>" + dep.getVersion() + "</version>\n";
pom += "</dependency>\n";
}
pom += "</dependencies>\n";
}
pom += "</project>";
return pom;
} | java | private static String getPomText(ReleaseId releaseId, ReleaseId... dependencies) {
String pom = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n"
+ " <modelVersion>4.0.0</modelVersion>\n"
+ "\n"
+ " <groupId>" + releaseId.getGroupId() + "</groupId>\n"
+ " <artifactId>" + releaseId.getArtifactId() + "</artifactId>\n"
+ " <version>" + releaseId.getVersion() + "</version>\n" + "\n";
if (dependencies != null && dependencies.length > 0) {
pom += "<dependencies>\n";
for (ReleaseId dep : dependencies) {
pom += "<dependency>\n";
pom += " <groupId>" + dep.getGroupId() + "</groupId>\n";
pom += " <artifactId>" + dep.getArtifactId() + "</artifactId>\n";
pom += " <version>" + dep.getVersion() + "</version>\n";
pom += "</dependency>\n";
}
pom += "</dependencies>\n";
}
pom += "</project>";
return pom;
} | [
"private",
"static",
"String",
"getPomText",
"(",
"ReleaseId",
"releaseId",
",",
"ReleaseId",
"...",
"dependencies",
")",
"{",
"String",
"pom",
"=",
"\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"",
"+",
"\"<project xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\" xmlns... | Create the pom that will be placed in the KJar.
@param releaseId The release (deployment) id.
@param dependencies The list of dependendencies to be added to the pom
@return A string representation of the pom. | [
"Create",
"the",
"pom",
"that",
"will",
"be",
"placed",
"in",
"the",
"KJar",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-ci/src/main/java/org/kie/api/builder/helper/KieModuleDeploymentHelperImpl.java#L365-L390 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java | EscapedFunctions2.sqlspace | public static void sqlspace(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
singleArgumentFunctionCall(buf, "repeat(' ',", "space", parsedArgs);
} | java | public static void sqlspace(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
singleArgumentFunctionCall(buf, "repeat(' ',", "space", parsedArgs);
} | [
"public",
"static",
"void",
"sqlspace",
"(",
"StringBuilder",
"buf",
",",
"List",
"<",
"?",
"extends",
"CharSequence",
">",
"parsedArgs",
")",
"throws",
"SQLException",
"{",
"singleArgumentFunctionCall",
"(",
"buf",
",",
"\"repeat(' ',\"",
",",
"\"space\"",
",",
... | space translation
@param buf The buffer to append into
@param parsedArgs arguments
@throws SQLException if something wrong happens | [
"space",
"translation"
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L293-L295 |
OSSIndex/heuristic-version | src/main/java/net/ossindex/version/VersionFactory.java | VersionFactory.getRange | public IVersionRange getRange(String[] versions) throws InvalidRangeException
{
if (versions == null) {
return null;
}
IVersionRange results = null;
for (String version : versions) {
IVersionRange range = getRange(version);
if (results == null) {
results = range;
}
else {
results = new OrRange(results, range);
}
}
return results;
} | java | public IVersionRange getRange(String[] versions) throws InvalidRangeException
{
if (versions == null) {
return null;
}
IVersionRange results = null;
for (String version : versions) {
IVersionRange range = getRange(version);
if (results == null) {
results = range;
}
else {
results = new OrRange(results, range);
}
}
return results;
} | [
"public",
"IVersionRange",
"getRange",
"(",
"String",
"[",
"]",
"versions",
")",
"throws",
"InvalidRangeException",
"{",
"if",
"(",
"versions",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"IVersionRange",
"results",
"=",
"null",
";",
"for",
"(",
"S... | Join this set of ranges together. This could result in a set, or in a
logical range. | [
"Join",
"this",
"set",
"of",
"ranges",
"together",
".",
"This",
"could",
"result",
"in",
"a",
"set",
"or",
"in",
"a",
"logical",
"range",
"."
] | train | https://github.com/OSSIndex/heuristic-version/blob/9fe33a49d74acec54ddb91de9a3c3cd2f98fba40/src/main/java/net/ossindex/version/VersionFactory.java#L200-L216 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java | HttpUtil.setKeepAlive | public static void setKeepAlive(HttpHeaders h, HttpVersion httpVersion, boolean keepAlive) {
if (httpVersion.isKeepAliveDefault()) {
if (keepAlive) {
h.remove(HttpHeaderNames.CONNECTION);
} else {
h.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
}
} else {
if (keepAlive) {
h.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
} else {
h.remove(HttpHeaderNames.CONNECTION);
}
}
} | java | public static void setKeepAlive(HttpHeaders h, HttpVersion httpVersion, boolean keepAlive) {
if (httpVersion.isKeepAliveDefault()) {
if (keepAlive) {
h.remove(HttpHeaderNames.CONNECTION);
} else {
h.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
}
} else {
if (keepAlive) {
h.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
} else {
h.remove(HttpHeaderNames.CONNECTION);
}
}
} | [
"public",
"static",
"void",
"setKeepAlive",
"(",
"HttpHeaders",
"h",
",",
"HttpVersion",
"httpVersion",
",",
"boolean",
"keepAlive",
")",
"{",
"if",
"(",
"httpVersion",
".",
"isKeepAliveDefault",
"(",
")",
")",
"{",
"if",
"(",
"keepAlive",
")",
"{",
"h",
"... | Sets the value of the {@code "Connection"} header depending on the
protocol version of the specified message. This getMethod sets or removes
the {@code "Connection"} header depending on what the default keep alive
mode of the message's protocol version is, as specified by
{@link HttpVersion#isKeepAliveDefault()}.
<ul>
<li>If the connection is kept alive by default:
<ul>
<li>set to {@code "close"} if {@code keepAlive} is {@code false}.</li>
<li>remove otherwise.</li>
</ul></li>
<li>If the connection is closed by default:
<ul>
<li>set to {@code "keep-alive"} if {@code keepAlive} is {@code true}.</li>
<li>remove otherwise.</li>
</ul></li>
</ul> | [
"Sets",
"the",
"value",
"of",
"the",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java#L116-L130 |
mongodb/stitch-android-sdk | core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/UpdateDescription.java | UpdateDescription.toUpdateDocument | public BsonDocument toUpdateDocument() {
final List<BsonElement> unsets = new ArrayList<>();
for (final String removedField : this.removedFields) {
unsets.add(new BsonElement(removedField, new BsonBoolean(true)));
}
final BsonDocument updateDocument = new BsonDocument();
if (this.updatedFields.size() > 0) {
updateDocument.append("$set", this.updatedFields);
}
if (unsets.size() > 0) {
updateDocument.append("$unset", new BsonDocument(unsets));
}
return updateDocument;
} | java | public BsonDocument toUpdateDocument() {
final List<BsonElement> unsets = new ArrayList<>();
for (final String removedField : this.removedFields) {
unsets.add(new BsonElement(removedField, new BsonBoolean(true)));
}
final BsonDocument updateDocument = new BsonDocument();
if (this.updatedFields.size() > 0) {
updateDocument.append("$set", this.updatedFields);
}
if (unsets.size() > 0) {
updateDocument.append("$unset", new BsonDocument(unsets));
}
return updateDocument;
} | [
"public",
"BsonDocument",
"toUpdateDocument",
"(",
")",
"{",
"final",
"List",
"<",
"BsonElement",
">",
"unsets",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"String",
"removedField",
":",
"this",
".",
"removedFields",
")",
"{",
"unse... | Convert this update description to an update document.
@return an update document with the appropriate $set and $unset documents. | [
"Convert",
"this",
"update",
"description",
"to",
"an",
"update",
"document",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/UpdateDescription.java#L84-L100 |
craftercms/commons | utilities/src/main/java/org/craftercms/commons/crypto/PGPUtils.java | PGPUtils.decryptData | protected static void decryptData(final PGPPrivateKey privateKey, final PGPPublicKeyEncryptedData data,
final BcKeyFingerprintCalculator calculator, final OutputStream targetStream)
throws PGPException, IOException {
PublicKeyDataDecryptorFactory decryptorFactory = new JcePublicKeyDataDecryptorFactoryBuilder().setProvider
(PROVIDER).setContentProvider(PROVIDER).build(privateKey);
InputStream content = data.getDataStream(decryptorFactory);
PGPObjectFactory plainFactory = new PGPObjectFactory(content, calculator);
Object message = plainFactory.nextObject();
if(message instanceof PGPCompressedData) {
PGPCompressedData compressedData = (PGPCompressedData) message;
PGPObjectFactory compressedFactory = new PGPObjectFactory(compressedData.getDataStream(), calculator);
message = compressedFactory.nextObject();
}
if(message instanceof PGPLiteralData) {
PGPLiteralData literalData = (PGPLiteralData) message;
try(InputStream literalStream = literalData.getInputStream()) {
IOUtils.copy(literalStream, targetStream);
}
} else if(message instanceof PGPOnePassSignatureList) {
throw new PGPException("Encrypted message contains a signed message - not literal data.");
} else {
throw new PGPException("Message is not a simple encrypted file - type unknown.");
}
if(data.isIntegrityProtected() && !data.verify()) {
throw new PGPException("Message failed integrity check");
}
} | java | protected static void decryptData(final PGPPrivateKey privateKey, final PGPPublicKeyEncryptedData data,
final BcKeyFingerprintCalculator calculator, final OutputStream targetStream)
throws PGPException, IOException {
PublicKeyDataDecryptorFactory decryptorFactory = new JcePublicKeyDataDecryptorFactoryBuilder().setProvider
(PROVIDER).setContentProvider(PROVIDER).build(privateKey);
InputStream content = data.getDataStream(decryptorFactory);
PGPObjectFactory plainFactory = new PGPObjectFactory(content, calculator);
Object message = plainFactory.nextObject();
if(message instanceof PGPCompressedData) {
PGPCompressedData compressedData = (PGPCompressedData) message;
PGPObjectFactory compressedFactory = new PGPObjectFactory(compressedData.getDataStream(), calculator);
message = compressedFactory.nextObject();
}
if(message instanceof PGPLiteralData) {
PGPLiteralData literalData = (PGPLiteralData) message;
try(InputStream literalStream = literalData.getInputStream()) {
IOUtils.copy(literalStream, targetStream);
}
} else if(message instanceof PGPOnePassSignatureList) {
throw new PGPException("Encrypted message contains a signed message - not literal data.");
} else {
throw new PGPException("Message is not a simple encrypted file - type unknown.");
}
if(data.isIntegrityProtected() && !data.verify()) {
throw new PGPException("Message failed integrity check");
}
} | [
"protected",
"static",
"void",
"decryptData",
"(",
"final",
"PGPPrivateKey",
"privateKey",
",",
"final",
"PGPPublicKeyEncryptedData",
"data",
",",
"final",
"BcKeyFingerprintCalculator",
"calculator",
",",
"final",
"OutputStream",
"targetStream",
")",
"throws",
"PGPExcepti... | Performs the decryption of the given data.
@param privateKey PGP Private Key to decrypt
@param data encrypted data
@param calculator instance of {@link BcKeyFingerprintCalculator}
@param targetStream stream to receive the decrypted data
@throws PGPException if the decryption process fails
@throws IOException if the stream write operation fails | [
"Performs",
"the",
"decryption",
"of",
"the",
"given",
"data",
"."
] | train | https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/crypto/PGPUtils.java#L250-L282 |
micronaut-projects/micronaut-core | runtime/src/main/java/io/micronaut/runtime/Micronaut.java | Micronaut.handleStartupException | protected void handleStartupException(Environment environment, Throwable exception) {
Function<Throwable, Integer> exitCodeMapper = exitHandlers.computeIfAbsent(exception.getClass(), exceptionType -> (throwable -> 1));
Integer code = exitCodeMapper.apply(exception);
if (code > 0) {
if (!environment.getActiveNames().contains(Environment.TEST)) {
if (LOG.isErrorEnabled()) {
LOG.error("Error starting Micronaut server: " + exception.getMessage(), exception);
}
System.exit(code);
}
}
throw new ApplicationStartupException("Error starting Micronaut server: " + exception.getMessage(), exception);
} | java | protected void handleStartupException(Environment environment, Throwable exception) {
Function<Throwable, Integer> exitCodeMapper = exitHandlers.computeIfAbsent(exception.getClass(), exceptionType -> (throwable -> 1));
Integer code = exitCodeMapper.apply(exception);
if (code > 0) {
if (!environment.getActiveNames().contains(Environment.TEST)) {
if (LOG.isErrorEnabled()) {
LOG.error("Error starting Micronaut server: " + exception.getMessage(), exception);
}
System.exit(code);
}
}
throw new ApplicationStartupException("Error starting Micronaut server: " + exception.getMessage(), exception);
} | [
"protected",
"void",
"handleStartupException",
"(",
"Environment",
"environment",
",",
"Throwable",
"exception",
")",
"{",
"Function",
"<",
"Throwable",
",",
"Integer",
">",
"exitCodeMapper",
"=",
"exitHandlers",
".",
"computeIfAbsent",
"(",
"exception",
".",
"getCl... | Default handling of startup exceptions.
@param environment The environment
@param exception The exception
@throws ApplicationStartupException If the server cannot be shutdown with an appropriate exist code | [
"Default",
"handling",
"of",
"startup",
"exceptions",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/runtime/Micronaut.java#L298-L310 |
rpau/javalang-compiler | src/main/java/org/walkmod/javalang/compiler/types/IndexedURLClassPath.java | IndexedURLClassPath.maybeIndexResource | private void maybeIndexResource(String relPath, URL delegate) {
if (!index.containsKey(relPath)) {
index.put(relPath, delegate);
if (relPath.endsWith(File.separator)) {
maybeIndexResource(relPath.substring(0, relPath.length() - File.separator.length()), delegate);
}
}
} | java | private void maybeIndexResource(String relPath, URL delegate) {
if (!index.containsKey(relPath)) {
index.put(relPath, delegate);
if (relPath.endsWith(File.separator)) {
maybeIndexResource(relPath.substring(0, relPath.length() - File.separator.length()), delegate);
}
}
} | [
"private",
"void",
"maybeIndexResource",
"(",
"String",
"relPath",
",",
"URL",
"delegate",
")",
"{",
"if",
"(",
"!",
"index",
".",
"containsKey",
"(",
"relPath",
")",
")",
"{",
"index",
".",
"put",
"(",
"relPath",
",",
"delegate",
")",
";",
"if",
"(",
... | Callers may request the directory itself as a resource, and may
do so with or without trailing slashes. We do this in a while-loop
in case the classpath element has multiple superfluous trailing slashes.
@param relPath relative path
@param delegate value to insert | [
"Callers",
"may",
"request",
"the",
"directory",
"itself",
"as",
"a",
"resource",
"and",
"may",
"do",
"so",
"with",
"or",
"without",
"trailing",
"slashes",
".",
"We",
"do",
"this",
"in",
"a",
"while",
"-",
"loop",
"in",
"case",
"the",
"classpath",
"eleme... | train | https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/types/IndexedURLClassPath.java#L148-L156 |
cryptomator/cryptofs | src/main/java/org/cryptomator/cryptofs/ConflictResolver.java | ConflictResolver.resolveConflictsIfNecessary | public Path resolveConflictsIfNecessary(Path ciphertextPath, String dirId) throws IOException {
String ciphertextFileName = ciphertextPath.getFileName().toString();
String basename = StringUtils.removeEnd(ciphertextFileName, LONG_NAME_FILE_EXT);
Matcher m = CIPHERTEXT_FILENAME_PATTERN.matcher(basename);
if (!m.matches() && m.find(0)) {
// no full match, but still contains base32 -> partial match
return resolveConflict(ciphertextPath, m.group(0), dirId);
} else {
// full match or no match at all -> nothing to resolve
return ciphertextPath;
}
} | java | public Path resolveConflictsIfNecessary(Path ciphertextPath, String dirId) throws IOException {
String ciphertextFileName = ciphertextPath.getFileName().toString();
String basename = StringUtils.removeEnd(ciphertextFileName, LONG_NAME_FILE_EXT);
Matcher m = CIPHERTEXT_FILENAME_PATTERN.matcher(basename);
if (!m.matches() && m.find(0)) {
// no full match, but still contains base32 -> partial match
return resolveConflict(ciphertextPath, m.group(0), dirId);
} else {
// full match or no match at all -> nothing to resolve
return ciphertextPath;
}
} | [
"public",
"Path",
"resolveConflictsIfNecessary",
"(",
"Path",
"ciphertextPath",
",",
"String",
"dirId",
")",
"throws",
"IOException",
"{",
"String",
"ciphertextFileName",
"=",
"ciphertextPath",
".",
"getFileName",
"(",
")",
".",
"toString",
"(",
")",
";",
"String"... | Checks if the name of the file represented by the given ciphertextPath is a valid ciphertext name without any additional chars.
If any unexpected chars are found on the name but it still contains an authentic ciphertext, it is considered a conflicting file.
Conflicting files will be given a new name. The caller must use the path returned by this function after invoking it, as the given ciphertextPath might be no longer valid.
@param ciphertextPath The path to a file to check.
@param dirId The directory id of the file's parent directory.
@return Either the original name if no unexpected chars have been found or a completely new path.
@throws IOException | [
"Checks",
"if",
"the",
"name",
"of",
"the",
"file",
"represented",
"by",
"the",
"given",
"ciphertextPath",
"is",
"a",
"valid",
"ciphertext",
"name",
"without",
"any",
"additional",
"chars",
".",
"If",
"any",
"unexpected",
"chars",
"are",
"found",
"on",
"the"... | train | https://github.com/cryptomator/cryptofs/blob/67fc1a4950dd1c150cd2e2c75bcabbeb7c9ac82e/src/main/java/org/cryptomator/cryptofs/ConflictResolver.java#L50-L61 |
GerdHolz/TOVAL | src/de/invation/code/toval/types/DynamicMatrix.java | DynamicMatrix.putValue | public void putValue(E row, E col, T value) {
ensureRowKey(row);
ensureColKey(col);
get(rowKeys.get(row)).set(colKeys.get(col), value);
} | java | public void putValue(E row, E col, T value) {
ensureRowKey(row);
ensureColKey(col);
get(rowKeys.get(row)).set(colKeys.get(col), value);
} | [
"public",
"void",
"putValue",
"(",
"E",
"row",
",",
"E",
"col",
",",
"T",
"value",
")",
"{",
"ensureRowKey",
"(",
"row",
")",
";",
"ensureColKey",
"(",
"col",
")",
";",
"get",
"(",
"rowKeys",
".",
"get",
"(",
"row",
")",
")",
".",
"set",
"(",
"... | Sets the matrix entry specified by the given row and col keys.<br>
This method sets the following content: Matrix[row,col]=value
@param row Row-value of indexing type
@param col Col-value of indexing type
@param value Value that has to be inserted | [
"Sets",
"the",
"matrix",
"entry",
"specified",
"by",
"the",
"given",
"row",
"and",
"col",
"keys",
".",
"<br",
">",
"This",
"method",
"sets",
"the",
"following",
"content",
":",
"Matrix",
"[",
"row",
"col",
"]",
"=",
"value"
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/DynamicMatrix.java#L51-L55 |
spotify/sparkey-java | src/main/java/com/spotify/sparkey/Sparkey.java | Sparkey.writeHash | public static void writeHash(File file, HashType hashType) throws IOException {
SparkeyWriter writer = append(file);
writer.writeHash(hashType);
writer.close();
} | java | public static void writeHash(File file, HashType hashType) throws IOException {
SparkeyWriter writer = append(file);
writer.writeHash(hashType);
writer.close();
} | [
"public",
"static",
"void",
"writeHash",
"(",
"File",
"file",
",",
"HashType",
"hashType",
")",
"throws",
"IOException",
"{",
"SparkeyWriter",
"writer",
"=",
"append",
"(",
"file",
")",
";",
"writer",
".",
"writeHash",
"(",
"hashType",
")",
";",
"writer",
... | Write (or rewrite) the index file for a given sparkey file.
@param file File base to use, the actual file endings will be set to .spi and .spl
@param hashType choice of hash type, can be 32 or 64 bits. | [
"Write",
"(",
"or",
"rewrite",
")",
"the",
"index",
"file",
"for",
"a",
"given",
"sparkey",
"file",
"."
] | train | https://github.com/spotify/sparkey-java/blob/77ed13b17b4b28f38d6e335610269fb135c3a1be/src/main/java/com/spotify/sparkey/Sparkey.java#L137-L141 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/Assert.java | Assert.areNotEqual | @NullSafe
private static boolean areNotEqual(Object obj1, Object obj2) {
return obj1 == null || !obj1.equals(obj2);
} | java | @NullSafe
private static boolean areNotEqual(Object obj1, Object obj2) {
return obj1 == null || !obj1.equals(obj2);
} | [
"@",
"NullSafe",
"private",
"static",
"boolean",
"areNotEqual",
"(",
"Object",
"obj1",
",",
"Object",
"obj2",
")",
"{",
"return",
"obj1",
"==",
"null",
"||",
"!",
"obj1",
".",
"equals",
"(",
"obj2",
")",
";",
"}"
] | Evaluate the given {@link Object objects} or equality.
@param obj1 {@link Object} to evaluate for equality with {@link Object object 1}.
@param obj2 {@link Object} to evaluate for equality with {@link Object object 2}.
@return a boolean value indicating whether the given {@link Object objects} are equal.
@see java.lang.Object#equals(Object) | [
"Evaluate",
"the",
"given",
"{",
"@link",
"Object",
"objects",
"}",
"or",
"equality",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L330-L333 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java | ImageLoader.displayImage | public void displayImage(String uri, ImageView imageView) {
displayImage(uri, new ImageViewAware(imageView), null, null, null);
} | java | public void displayImage(String uri, ImageView imageView) {
displayImage(uri, new ImageViewAware(imageView), null, null, null);
} | [
"public",
"void",
"displayImage",
"(",
"String",
"uri",
",",
"ImageView",
"imageView",
")",
"{",
"displayImage",
"(",
"uri",
",",
"new",
"ImageViewAware",
"(",
"imageView",
")",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] | Adds display image task to execution pool. Image will be set to ImageView when it's turn. <br/>
Default {@linkplain DisplayImageOptions display image options} from {@linkplain ImageLoaderConfiguration
configuration} will be used.<br />
<b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call
@param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png")
@param imageView {@link ImageView} which should display image
@throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
@throws IllegalArgumentException if passed <b>imageView</b> is null | [
"Adds",
"display",
"image",
"task",
"to",
"execution",
"pool",
".",
"Image",
"will",
"be",
"set",
"to",
"ImageView",
"when",
"it",
"s",
"turn",
".",
"<br",
"/",
">",
"Default",
"{",
"@linkplain",
"DisplayImageOptions",
"display",
"image",
"options",
"}",
"... | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L315-L317 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java | CrosstabBuilder.setRowStyles | public CrosstabBuilder setRowStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
crosstab.setRowHeaderStyle(headerStyle);
crosstab.setRowTotalheaderStyle(totalHeaderStyle);
crosstab.setRowTotalStyle(totalStyle);
return this;
} | java | public CrosstabBuilder setRowStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
crosstab.setRowHeaderStyle(headerStyle);
crosstab.setRowTotalheaderStyle(totalHeaderStyle);
crosstab.setRowTotalStyle(totalStyle);
return this;
} | [
"public",
"CrosstabBuilder",
"setRowStyles",
"(",
"Style",
"headerStyle",
",",
"Style",
"totalStyle",
",",
"Style",
"totalHeaderStyle",
")",
"{",
"crosstab",
".",
"setRowHeaderStyle",
"(",
"headerStyle",
")",
";",
"crosstab",
".",
"setRowTotalheaderStyle",
"(",
"tot... | Should be called after all rows have been created
@param headerStyle
@param totalStyle
@param totalHeaderStyle
@return | [
"Should",
"be",
"called",
"after",
"all",
"rows",
"have",
"been",
"created"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java#L385-L390 |
google/error-prone | check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java | ASTHelpers.findSuperMethod | public static Optional<MethodSymbol> findSuperMethod(MethodSymbol methodSymbol, Types types) {
return findSuperMethods(methodSymbol, types, /* skipInterfaces= */ true).findFirst();
} | java | public static Optional<MethodSymbol> findSuperMethod(MethodSymbol methodSymbol, Types types) {
return findSuperMethods(methodSymbol, types, /* skipInterfaces= */ true).findFirst();
} | [
"public",
"static",
"Optional",
"<",
"MethodSymbol",
">",
"findSuperMethod",
"(",
"MethodSymbol",
"methodSymbol",
",",
"Types",
"types",
")",
"{",
"return",
"findSuperMethods",
"(",
"methodSymbol",
",",
"types",
",",
"/* skipInterfaces= */",
"true",
")",
".",
"fin... | Finds (if it exists) first (in the class hierarchy) non-interface super method of given {@code
method}. | [
"Finds",
"(",
"if",
"it",
"exists",
")",
"first",
"(",
"in",
"the",
"class",
"hierarchy",
")",
"non",
"-",
"interface",
"super",
"method",
"of",
"given",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L584-L586 |
casmi/casmi | src/main/java/casmi/graphics/Graphics.java | Graphics.setDirectionalLight | public void setDirectionalLight(int i, Color color, boolean enableColor, Vector3D v) {
float directionalColor[] = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
float pos[] = { (float)v.getX(), (float)v.getY(), (float)v.getZ(), 0.0f };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, pos, 0);
if(enableColor) gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, directionalColor, 0);
} | java | public void setDirectionalLight(int i, Color color, boolean enableColor, Vector3D v) {
float directionalColor[] = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
float pos[] = { (float)v.getX(), (float)v.getY(), (float)v.getZ(), 0.0f };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, pos, 0);
if(enableColor) gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, directionalColor, 0);
} | [
"public",
"void",
"setDirectionalLight",
"(",
"int",
"i",
",",
"Color",
"color",
",",
"boolean",
"enableColor",
",",
"Vector3D",
"v",
")",
"{",
"float",
"directionalColor",
"[",
"]",
"=",
"{",
"(",
"float",
")",
"color",
".",
"getRed",
"(",
")",
",",
"... | Sets the color value and the position of the No.i directionalLight | [
"Sets",
"the",
"color",
"value",
"and",
"the",
"position",
"of",
"the",
"No",
".",
"i",
"directionalLight"
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/Graphics.java#L528-L540 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java | ScenarioPortrayal.addDataSerieToHistogram | public void addDataSerieToHistogram(String histogramID, double[] dataSerie, int binsCount){
if (this.histograms.containsKey(histogramID)) {
this.histograms.get(histogramID).addSeries(dataSerie, binsCount, histogramID, null);
}
} | java | public void addDataSerieToHistogram(String histogramID, double[] dataSerie, int binsCount){
if (this.histograms.containsKey(histogramID)) {
this.histograms.get(histogramID).addSeries(dataSerie, binsCount, histogramID, null);
}
} | [
"public",
"void",
"addDataSerieToHistogram",
"(",
"String",
"histogramID",
",",
"double",
"[",
"]",
"dataSerie",
",",
"int",
"binsCount",
")",
"{",
"if",
"(",
"this",
".",
"histograms",
".",
"containsKey",
"(",
"histogramID",
")",
")",
"{",
"this",
".",
"h... | Adds data to the histogram.
Given the number of bins, this will show a count on the number of
times a value is repeated. For example:
[1,2,3,1,1,3], and bins = 3
Will provide:
_
| | _
| | _ | |
_|_||_||_|_
If the number of different values is different from the number of bins,
then each bin will represent the number of values in a range, evenly distributed
between the minimum and the maximum value. For example:
[1,2,3,1,1,3], and bins = 2
Two ranges will be considered: [1,2) and [2,3].
BE ADVISED The middle value would be assigned to the upper range.
In this example, the histogram will look:
_ _
| || |
| || |
_|_||_|_
@param histogramID
@param dataSerie the data
@param binsCount the number of bins | [
"Adds",
"data",
"to",
"the",
"histogram",
".",
"Given",
"the",
"number",
"of",
"bins",
"this",
"will",
"show",
"a",
"count",
"on",
"the",
"number",
"of",
"times",
"a",
"value",
"is",
"repeated",
".",
"For",
"example",
":",
"[",
"1",
"2",
"3",
"1",
... | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L416-L420 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/util/Environment.java | Environment.setProperty | public void setProperty(String strProperty, String strValue)
{
if (strValue != null)
m_properties.put(strProperty, strValue);
else
m_properties.remove(strProperty);
} | java | public void setProperty(String strProperty, String strValue)
{
if (strValue != null)
m_properties.put(strProperty, strValue);
else
m_properties.remove(strProperty);
} | [
"public",
"void",
"setProperty",
"(",
"String",
"strProperty",
",",
"String",
"strValue",
")",
"{",
"if",
"(",
"strValue",
"!=",
"null",
")",
"m_properties",
".",
"put",
"(",
"strProperty",
",",
"strValue",
")",
";",
"else",
"m_properties",
".",
"remove",
... | Set this property.
NOTE: also looks in the default application's properties.
@param strProperty The property key.
@return The property value. | [
"Set",
"this",
"property",
".",
"NOTE",
":",
"also",
"looks",
"in",
"the",
"default",
"application",
"s",
"properties",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/Environment.java#L235-L241 |
wcm-io/wcm-io-wcm | commons/src/main/java/io/wcm/wcm/commons/util/Template.java | Template.is | public static boolean is(@NotNull Page page, @NotNull String @NotNull... templatePaths) {
if (page == null || templatePaths == null || templatePaths.length == 0) {
return false;
}
String templatePath = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class);
for (String givenTemplatePath : templatePaths) {
if (StringUtils.equals(templatePath, givenTemplatePath)) {
return true;
}
}
return false;
} | java | public static boolean is(@NotNull Page page, @NotNull String @NotNull... templatePaths) {
if (page == null || templatePaths == null || templatePaths.length == 0) {
return false;
}
String templatePath = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class);
for (String givenTemplatePath : templatePaths) {
if (StringUtils.equals(templatePath, givenTemplatePath)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"is",
"(",
"@",
"NotNull",
"Page",
"page",
",",
"@",
"NotNull",
"String",
"@",
"NotNull",
".",
".",
".",
"templatePaths",
")",
"{",
"if",
"(",
"page",
"==",
"null",
"||",
"templatePaths",
"==",
"null",
"||",
"templatePaths"... | Checks if the given page uses a specific template.
@param page AEM page
@param templatePaths Template path(s)
@return true if the page uses the template | [
"Checks",
"if",
"the",
"given",
"page",
"uses",
"a",
"specific",
"template",
"."
] | train | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/util/Template.java#L98-L109 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/util/MetaDataUtils.java | MetaDataUtils.serializeMetaData | public static String serializeMetaData(Map<String, List<String>> metaData) {
StringBuilder buf = new StringBuilder();
if (metaData != null && metaData.size() > 0) {
buf.append("<metadata xmlns=\"http://jivesoftware.com/protocol/workgroup\">");
for (String key : metaData.keySet()) {
List<String> value = metaData.get(key);
for (String v : value) {
buf.append("<value name=\"").append(key).append("\">");
buf.append(StringUtils.escapeForXmlText(v));
buf.append("</value>");
}
}
buf.append("</metadata>");
}
return buf.toString();
} | java | public static String serializeMetaData(Map<String, List<String>> metaData) {
StringBuilder buf = new StringBuilder();
if (metaData != null && metaData.size() > 0) {
buf.append("<metadata xmlns=\"http://jivesoftware.com/protocol/workgroup\">");
for (String key : metaData.keySet()) {
List<String> value = metaData.get(key);
for (String v : value) {
buf.append("<value name=\"").append(key).append("\">");
buf.append(StringUtils.escapeForXmlText(v));
buf.append("</value>");
}
}
buf.append("</metadata>");
}
return buf.toString();
} | [
"public",
"static",
"String",
"serializeMetaData",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"metaData",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"metaData",
"!=",
"null",
"&&",
"meta... | Serializes a Map of String name/value pairs into the meta-data XML format.
@param metaData the Map of meta-data as Map<String,List<String>>
@return the meta-data values in XML form. | [
"Serializes",
"a",
"Map",
"of",
"String",
"name",
"/",
"value",
"pairs",
"into",
"the",
"meta",
"-",
"data",
"XML",
"format",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/util/MetaDataUtils.java#L90-L105 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/SsrcGenerator.java | SsrcGenerator.bytesToUIntLong | static long bytesToUIntLong(byte[] bytes, int index) {
long accum = 0;
int i = 3;
for (int shiftBy = 0; shiftBy < 32; shiftBy += 8) {
accum |= ((long) (bytes[index + i] & 0xff)) << shiftBy;
i--;
}
return accum;
} | java | static long bytesToUIntLong(byte[] bytes, int index) {
long accum = 0;
int i = 3;
for (int shiftBy = 0; shiftBy < 32; shiftBy += 8) {
accum |= ((long) (bytes[index + i] & 0xff)) << shiftBy;
i--;
}
return accum;
} | [
"static",
"long",
"bytesToUIntLong",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"index",
")",
"{",
"long",
"accum",
"=",
"0",
";",
"int",
"i",
"=",
"3",
";",
"for",
"(",
"int",
"shiftBy",
"=",
"0",
";",
"shiftBy",
"<",
"32",
";",
"shiftBy",
"+="... | Combines four bytes (most significant bit first) into a 32 bit unsigned
integer.
@param bytes
@param index
of most significant byte
@return long with the 32 bit unsigned integer | [
"Combines",
"four",
"bytes",
"(",
"most",
"significant",
"bit",
"first",
")",
"into",
"a",
"32",
"bit",
"unsigned",
"integer",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/SsrcGenerator.java#L51-L59 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.homographyStereo3Pts | public static DMatrixRMaj homographyStereo3Pts( DMatrixRMaj F , AssociatedPair p1, AssociatedPair p2, AssociatedPair p3) {
HomographyInducedStereo3Pts alg = new HomographyInducedStereo3Pts();
alg.setFundamental(F,null);
if( !alg.process(p1,p2,p3) )
return null;
return alg.getHomography();
} | java | public static DMatrixRMaj homographyStereo3Pts( DMatrixRMaj F , AssociatedPair p1, AssociatedPair p2, AssociatedPair p3) {
HomographyInducedStereo3Pts alg = new HomographyInducedStereo3Pts();
alg.setFundamental(F,null);
if( !alg.process(p1,p2,p3) )
return null;
return alg.getHomography();
} | [
"public",
"static",
"DMatrixRMaj",
"homographyStereo3Pts",
"(",
"DMatrixRMaj",
"F",
",",
"AssociatedPair",
"p1",
",",
"AssociatedPair",
"p2",
",",
"AssociatedPair",
"p3",
")",
"{",
"HomographyInducedStereo3Pts",
"alg",
"=",
"new",
"HomographyInducedStereo3Pts",
"(",
"... | Computes the homography induced from a planar surface when viewed from two views using correspondences
of three points. Observations must be on the planar surface.
@see boofcv.alg.geo.h.HomographyInducedStereo3Pts
@param F Fundamental matrix
@param p1 Associated point observation
@param p2 Associated point observation
@param p3 Associated point observation
@return The homography from view 1 to view 2 or null if it fails | [
"Computes",
"the",
"homography",
"induced",
"from",
"a",
"planar",
"surface",
"when",
"viewed",
"from",
"two",
"views",
"using",
"correspondences",
"of",
"three",
"points",
".",
"Observations",
"must",
"be",
"on",
"the",
"planar",
"surface",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L534-L541 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java | ServerParams.addConfigParam | private void addConfigParam(String name, Object value) throws ConfigurationException {
if (isModuleName(name)) {
Utils.require(value instanceof Map,
"Value for module '%s' should be a map: %s", name, value.toString());
updateMap(m_params, name, value);
} else {
setLegacyParam(name, value);
}
} | java | private void addConfigParam(String name, Object value) throws ConfigurationException {
if (isModuleName(name)) {
Utils.require(value instanceof Map,
"Value for module '%s' should be a map: %s", name, value.toString());
updateMap(m_params, name, value);
} else {
setLegacyParam(name, value);
}
} | [
"private",
"void",
"addConfigParam",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"ConfigurationException",
"{",
"if",
"(",
"isModuleName",
"(",
"name",
")",
")",
"{",
"Utils",
".",
"require",
"(",
"value",
"instanceof",
"Map",
",",
"\"Value... | (e.g., DBService) or a legacy YAML file option (e.g., dbhost). | [
"(",
"e",
".",
"g",
".",
"DBService",
")",
"or",
"a",
"legacy",
"YAML",
"file",
"option",
"(",
"e",
".",
"g",
".",
"dbhost",
")",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/ServerParams.java#L490-L498 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.batchSynonyms | public JSONObject batchSynonyms(List<JSONObject> objects, boolean forwardToReplicas, boolean replaceExistingSynonyms) throws AlgoliaException {
return this.batchSynonyms(objects, forwardToReplicas, replaceExistingSynonyms, RequestOptions.empty);
} | java | public JSONObject batchSynonyms(List<JSONObject> objects, boolean forwardToReplicas, boolean replaceExistingSynonyms) throws AlgoliaException {
return this.batchSynonyms(objects, forwardToReplicas, replaceExistingSynonyms, RequestOptions.empty);
} | [
"public",
"JSONObject",
"batchSynonyms",
"(",
"List",
"<",
"JSONObject",
">",
"objects",
",",
"boolean",
"forwardToReplicas",
",",
"boolean",
"replaceExistingSynonyms",
")",
"throws",
"AlgoliaException",
"{",
"return",
"this",
".",
"batchSynonyms",
"(",
"objects",
"... | Add or Replace a list of synonyms
@param objects List of synonyms
@param forwardToReplicas Forward the operation to the replica indices
@param replaceExistingSynonyms Replace the existing synonyms with this batch | [
"Add",
"or",
"Replace",
"a",
"list",
"of",
"synonyms"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1571-L1573 |
rholder/moar-concurrent | src/main/java/com/github/rholder/moar/concurrent/StrategicExecutors.java | StrategicExecutors.newBalancingThreadPoolExecutor | public static BalancingThreadPoolExecutor newBalancingThreadPoolExecutor(int maxThreads,
float targetUtilization,
float smoothingWeight,
int balanceAfter) {
ThreadPoolExecutor tpe = new ThreadPoolExecutor(1, maxThreads, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new CallerBlocksPolicy());
return newBalancingThreadPoolExecutor(tpe, targetUtilization, smoothingWeight, balanceAfter);
} | java | public static BalancingThreadPoolExecutor newBalancingThreadPoolExecutor(int maxThreads,
float targetUtilization,
float smoothingWeight,
int balanceAfter) {
ThreadPoolExecutor tpe = new ThreadPoolExecutor(1, maxThreads, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new CallerBlocksPolicy());
return newBalancingThreadPoolExecutor(tpe, targetUtilization, smoothingWeight, balanceAfter);
} | [
"public",
"static",
"BalancingThreadPoolExecutor",
"newBalancingThreadPoolExecutor",
"(",
"int",
"maxThreads",
",",
"float",
"targetUtilization",
",",
"float",
"smoothingWeight",
",",
"int",
"balanceAfter",
")",
"{",
"ThreadPoolExecutor",
"tpe",
"=",
"new",
"ThreadPoolExe... | Return a capped {@link BalancingThreadPoolExecutor} with the given
maximum number of threads, target utilization, smoothing weight, and
balance after values.
@param maxThreads maximum number of threads to use
@param targetUtilization a float between 0.0 and 1.0 representing the
percentage of the total CPU time to be used by
this pool
@param smoothingWeight smooth out the averages of the CPU and wait time
over time such that tasks aren't too heavily
skewed with old or spiking data
@param balanceAfter balance the thread pool after this many tasks
have run | [
"Return",
"a",
"capped",
"{",
"@link",
"BalancingThreadPoolExecutor",
"}",
"with",
"the",
"given",
"maximum",
"number",
"of",
"threads",
"target",
"utilization",
"smoothing",
"weight",
"and",
"balance",
"after",
"values",
"."
] | train | https://github.com/rholder/moar-concurrent/blob/c28facbf02e628cc37266c051c23d4a7654b4eba/src/main/java/com/github/rholder/moar/concurrent/StrategicExecutors.java#L67-L73 |
netty/netty | common/src/main/java/io/netty/util/ConstantPool.java | ConstantPool.valueOf | public T valueOf(Class<?> firstNameComponent, String secondNameComponent) {
if (firstNameComponent == null) {
throw new NullPointerException("firstNameComponent");
}
if (secondNameComponent == null) {
throw new NullPointerException("secondNameComponent");
}
return valueOf(firstNameComponent.getName() + '#' + secondNameComponent);
} | java | public T valueOf(Class<?> firstNameComponent, String secondNameComponent) {
if (firstNameComponent == null) {
throw new NullPointerException("firstNameComponent");
}
if (secondNameComponent == null) {
throw new NullPointerException("secondNameComponent");
}
return valueOf(firstNameComponent.getName() + '#' + secondNameComponent);
} | [
"public",
"T",
"valueOf",
"(",
"Class",
"<",
"?",
">",
"firstNameComponent",
",",
"String",
"secondNameComponent",
")",
"{",
"if",
"(",
"firstNameComponent",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"firstNameComponent\"",
")",
";",... | Shortcut of {@link #valueOf(String) valueOf(firstNameComponent.getName() + "#" + secondNameComponent)}. | [
"Shortcut",
"of",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ConstantPool.java#L39-L48 |
peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.handleRequestRedirect | private void handleRequestRedirect(
final CrawlCandidate currentCrawlCandidate,
final String redirectedUrl) {
CrawlRequestBuilder builder = new CrawlRequestBuilder(redirectedUrl)
.setPriority(currentCrawlCandidate.getPriority());
currentCrawlCandidate.getMetadata().ifPresent(builder::setMetadata);
CrawlRequest redirectedRequest = builder.build();
crawlFrontier.feedRequest(redirectedRequest, false);
callbackManager.call(CrawlEvent.REQUEST_REDIRECT,
new RequestRedirectEvent(currentCrawlCandidate, redirectedRequest));
} | java | private void handleRequestRedirect(
final CrawlCandidate currentCrawlCandidate,
final String redirectedUrl) {
CrawlRequestBuilder builder = new CrawlRequestBuilder(redirectedUrl)
.setPriority(currentCrawlCandidate.getPriority());
currentCrawlCandidate.getMetadata().ifPresent(builder::setMetadata);
CrawlRequest redirectedRequest = builder.build();
crawlFrontier.feedRequest(redirectedRequest, false);
callbackManager.call(CrawlEvent.REQUEST_REDIRECT,
new RequestRedirectEvent(currentCrawlCandidate, redirectedRequest));
} | [
"private",
"void",
"handleRequestRedirect",
"(",
"final",
"CrawlCandidate",
"currentCrawlCandidate",
",",
"final",
"String",
"redirectedUrl",
")",
"{",
"CrawlRequestBuilder",
"builder",
"=",
"new",
"CrawlRequestBuilder",
"(",
"redirectedUrl",
")",
".",
"setPriority",
"(... | Creates a crawl request for the redirected URL, feeds it to the crawler and calls the
appropriate event callback.
@param currentCrawlCandidate the current crawl candidate
@param redirectedUrl the URL of the redirected request | [
"Creates",
"a",
"crawl",
"request",
"for",
"the",
"redirected",
"URL",
"feeds",
"it",
"to",
"the",
"crawler",
"and",
"calls",
"the",
"appropriate",
"event",
"callback",
"."
] | train | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L457-L468 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.completeConference | public void completeConference(String connId, String parentConnId) throws WorkspaceApiException {
this.completeConference(connId, parentConnId, null, null);
} | java | public void completeConference(String connId, String parentConnId) throws WorkspaceApiException {
this.completeConference(connId, parentConnId, null, null);
} | [
"public",
"void",
"completeConference",
"(",
"String",
"connId",
",",
"String",
"parentConnId",
")",
"throws",
"WorkspaceApiException",
"{",
"this",
".",
"completeConference",
"(",
"connId",
",",
"parentConnId",
",",
"null",
",",
"null",
")",
";",
"}"
] | Complete a previously initiated two-step conference identified by the provided IDs. Once completed,
the two separate calls are brought together so that all three parties are participating in the same call.
@param connId The connection ID of the consult call (established).
@param parentConnId The connection ID of the parent call (held). | [
"Complete",
"a",
"previously",
"initiated",
"two",
"-",
"step",
"conference",
"identified",
"by",
"the",
"provided",
"IDs",
".",
"Once",
"completed",
"the",
"two",
"separate",
"calls",
"are",
"brought",
"together",
"so",
"that",
"all",
"three",
"parties",
"are... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L729-L731 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/AsyncUpdateThread.java | AsyncUpdateThread.startExecutingUpdates | private void startExecutingUpdates() throws ClosedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "startExecutingUpdates");
// swap the enqueuedUnits and executingUnits.
ArrayList temp = executingUnits;
executingUnits = enqueuedUnits;
enqueuedUnits = temp;
enqueuedUnits.clear();
// enqueuedUnits is now ready to accept AsyncUpdates in enqueueWork()
executing = true;
try
{
LocalTransaction tran = tranManager.createLocalTransaction(false);
ExecutionThread thread = new ExecutionThread(executingUnits, tran);
mp.startNewSystemThread(thread);
}
catch (InterruptedException e)
{
// this object cannot recover from this exception since we don't know how much work the ExecutionThread
// has done. should not occur!
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.AsyncUpdateThread.startExecutingUpdates",
"1:222:1.28",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "startExecutingUpdates", e);
closed = true;
throw new ClosedException(e.getMessage());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "startExecutingUpdates");
} | java | private void startExecutingUpdates() throws ClosedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "startExecutingUpdates");
// swap the enqueuedUnits and executingUnits.
ArrayList temp = executingUnits;
executingUnits = enqueuedUnits;
enqueuedUnits = temp;
enqueuedUnits.clear();
// enqueuedUnits is now ready to accept AsyncUpdates in enqueueWork()
executing = true;
try
{
LocalTransaction tran = tranManager.createLocalTransaction(false);
ExecutionThread thread = new ExecutionThread(executingUnits, tran);
mp.startNewSystemThread(thread);
}
catch (InterruptedException e)
{
// this object cannot recover from this exception since we don't know how much work the ExecutionThread
// has done. should not occur!
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.AsyncUpdateThread.startExecutingUpdates",
"1:222:1.28",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "startExecutingUpdates", e);
closed = true;
throw new ClosedException(e.getMessage());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "startExecutingUpdates");
} | [
"private",
"void",
"startExecutingUpdates",
"(",
")",
"throws",
"ClosedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"startExecutin... | Internal method. Should be called from within a synchronized block. | [
"Internal",
"method",
".",
"Should",
"be",
"called",
"from",
"within",
"a",
"synchronized",
"block",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/AsyncUpdateThread.java#L179-L219 |
alkacon/opencms-core | src-modules/org/opencms/workplace/administration/CmsAdminMenu.java | CmsAdminMenu.addGroup | public void addGroup(CmsAdminMenuGroup group, float position) {
m_groupContainer.addIdentifiableObject(group.getName(), group, position);
} | java | public void addGroup(CmsAdminMenuGroup group, float position) {
m_groupContainer.addIdentifiableObject(group.getName(), group, position);
} | [
"public",
"void",
"addGroup",
"(",
"CmsAdminMenuGroup",
"group",
",",
"float",
"position",
")",
"{",
"m_groupContainer",
".",
"addIdentifiableObject",
"(",
"group",
".",
"getName",
"(",
")",
",",
"group",
",",
"position",
")",
";",
"}"
] | Adds a menu item at the given position.<p>
@param group the group
@param position the position
@see CmsIdentifiableObjectContainer#addIdentifiableObject(String, Object, float) | [
"Adds",
"a",
"menu",
"item",
"at",
"the",
"given",
"position",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/administration/CmsAdminMenu.java#L100-L103 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ddi_serviceName_changeDestination_POST | public OvhTask billingAccount_ddi_serviceName_changeDestination_POST(String billingAccount, String serviceName, String destination) throws IOException {
String qPath = "/telephony/{billingAccount}/ddi/{serviceName}/changeDestination";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "destination", destination);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask billingAccount_ddi_serviceName_changeDestination_POST(String billingAccount, String serviceName, String destination) throws IOException {
String qPath = "/telephony/{billingAccount}/ddi/{serviceName}/changeDestination";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "destination", destination);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"billingAccount_ddi_serviceName_changeDestination_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"destination",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/ddi/{serviceName}... | Change the destination of the DDI
REST: POST /telephony/{billingAccount}/ddi/{serviceName}/changeDestination
@param destination [required] The destination
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Change",
"the",
"destination",
"of",
"the",
"DDI"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8470-L8477 |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java | DatatypeConverter.getShort | public static final int getShort(InputStream is) throws IOException
{
byte[] data = new byte[2];
is.read(data);
return getShort(data, 0);
} | java | public static final int getShort(InputStream is) throws IOException
{
byte[] data = new byte[2];
is.read(data);
return getShort(data, 0);
} | [
"public",
"static",
"final",
"int",
"getShort",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"is",
".",
"read",
"(",
"data",
")",
";",
"return",
"getShort",
"(",
"data"... | Read a short int from an input stream.
@param is input stream
@return int value | [
"Read",
"a",
"short",
"int",
"from",
"an",
"input",
"stream",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L156-L161 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.extractColumn | public static DMatrix2 extractColumn( DMatrix2x2 a , int column , DMatrix2 out ) {
if( out == null) out = new DMatrix2();
switch( column ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a21;
break;
case 1:
out.a1 = a.a12;
out.a2 = a.a22;
break;
default:
throw new IllegalArgumentException("Out of bounds column. column = "+column);
}
return out;
} | java | public static DMatrix2 extractColumn( DMatrix2x2 a , int column , DMatrix2 out ) {
if( out == null) out = new DMatrix2();
switch( column ) {
case 0:
out.a1 = a.a11;
out.a2 = a.a21;
break;
case 1:
out.a1 = a.a12;
out.a2 = a.a22;
break;
default:
throw new IllegalArgumentException("Out of bounds column. column = "+column);
}
return out;
} | [
"public",
"static",
"DMatrix2",
"extractColumn",
"(",
"DMatrix2x2",
"a",
",",
"int",
"column",
",",
"DMatrix2",
"out",
")",
"{",
"if",
"(",
"out",
"==",
"null",
")",
"out",
"=",
"new",
"DMatrix2",
"(",
")",
";",
"switch",
"(",
"column",
")",
"{",
"ca... | Extracts the column from the matrix a.
@param a Input matrix
@param column Which column is to be extracted
@param out output. Storage for the extracted column. If null then a new vector will be returned.
@return The extracted column. | [
"Extracts",
"the",
"column",
"from",
"the",
"matrix",
"a",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L1181-L1196 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java | NormalizerSerializer.writeHeader | private void writeHeader(OutputStream stream, Header header) throws IOException {
DataOutputStream dos = new DataOutputStream(stream);
dos.writeUTF(HEADER);
// Write the current version
dos.writeInt(1);
// Write the normalizer opType
dos.writeUTF(header.normalizerType.toString());
// If the header contains a custom class opName, write that too
if (header.customStrategyClass != null) {
dos.writeUTF(header.customStrategyClass.getName());
}
} | java | private void writeHeader(OutputStream stream, Header header) throws IOException {
DataOutputStream dos = new DataOutputStream(stream);
dos.writeUTF(HEADER);
// Write the current version
dos.writeInt(1);
// Write the normalizer opType
dos.writeUTF(header.normalizerType.toString());
// If the header contains a custom class opName, write that too
if (header.customStrategyClass != null) {
dos.writeUTF(header.customStrategyClass.getName());
}
} | [
"private",
"void",
"writeHeader",
"(",
"OutputStream",
"stream",
",",
"Header",
"header",
")",
"throws",
"IOException",
"{",
"DataOutputStream",
"dos",
"=",
"new",
"DataOutputStream",
"(",
"stream",
")",
";",
"dos",
".",
"writeUTF",
"(",
"HEADER",
")",
";",
... | Write the data header
@param stream the output stream
@param header the header to write
@throws IOException | [
"Write",
"the",
"data",
"header"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L254-L268 |
monitorjbl/json-view | json-view/src/main/java/com/monitorjbl/json/JsonViewSerializer.java | JsonViewSerializer.registerCustomSerializer | @SuppressWarnings("unchecked")
public <T> void registerCustomSerializer(Class<T> cls, JsonSerializer<T> forType) {
if(customSerializersMap == null) {
customSerializersMap = new HashMap<>();
}
if(cls == null) {
throw new IllegalArgumentException("Class must not be null");
} else if(cls.equals(JsonView.class)) {
throw new IllegalArgumentException("Class cannot be " + JsonView.class);
} else if(customSerializersMap.containsKey(cls)) {
throw new IllegalArgumentException("Class " + cls + " already has a serializer registered (" + customSerializersMap.get(cls) + ")");
}
customSerializersMap.put(cls, (JsonSerializer<Object>) forType);
} | java | @SuppressWarnings("unchecked")
public <T> void registerCustomSerializer(Class<T> cls, JsonSerializer<T> forType) {
if(customSerializersMap == null) {
customSerializersMap = new HashMap<>();
}
if(cls == null) {
throw new IllegalArgumentException("Class must not be null");
} else if(cls.equals(JsonView.class)) {
throw new IllegalArgumentException("Class cannot be " + JsonView.class);
} else if(customSerializersMap.containsKey(cls)) {
throw new IllegalArgumentException("Class " + cls + " already has a serializer registered (" + customSerializersMap.get(cls) + ")");
}
customSerializersMap.put(cls, (JsonSerializer<Object>) forType);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"void",
"registerCustomSerializer",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"JsonSerializer",
"<",
"T",
">",
"forType",
")",
"{",
"if",
"(",
"customSerializersMap",
"==",
"null",
... | Registering custom serializer allows to the JSonView to deal with custom serializations for certains field types.<br>
This way you could register for instance a JODA serialization as a DateTimeSerializer. <br>
Thus, when JSonView find a field of that type (DateTime), it will delegate the serialization to the serializer specified.<br>
Example:<br>
<code>
JsonViewSupportFactoryBean bean = new JsonViewSupportFactoryBean( mapper );
bean.registerCustomSerializer( DateTime.class, new DateTimeSerializer() );
</code>
@param <T> Type class of the serializer
@param cls {@link Class} The class type you want to add a custom serializer
@param forType {@link JsonSerializer} The serializer you want to apply for that type | [
"Registering",
"custom",
"serializer",
"allows",
"to",
"the",
"JSonView",
"to",
"deal",
"with",
"custom",
"serializations",
"for",
"certains",
"field",
"types",
".",
"<br",
">",
"This",
"way",
"you",
"could",
"register",
"for",
"instance",
"a",
"JODA",
"serial... | train | https://github.com/monitorjbl/json-view/blob/c01505ac76e5416abe8af85c5816f60bd5d483ea/json-view/src/main/java/com/monitorjbl/json/JsonViewSerializer.java#L86-L101 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.createOrUpdateMultiRolePool | public WorkerPoolResourceInner createOrUpdateMultiRolePool(String resourceGroupName, String name, WorkerPoolResourceInner multiRolePoolEnvelope) {
return createOrUpdateMultiRolePoolWithServiceResponseAsync(resourceGroupName, name, multiRolePoolEnvelope).toBlocking().last().body();
} | java | public WorkerPoolResourceInner createOrUpdateMultiRolePool(String resourceGroupName, String name, WorkerPoolResourceInner multiRolePoolEnvelope) {
return createOrUpdateMultiRolePoolWithServiceResponseAsync(resourceGroupName, name, multiRolePoolEnvelope).toBlocking().last().body();
} | [
"public",
"WorkerPoolResourceInner",
"createOrUpdateMultiRolePool",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"WorkerPoolResourceInner",
"multiRolePoolEnvelope",
")",
"{",
"return",
"createOrUpdateMultiRolePoolWithServiceResponseAsync",
"(",
"resourceGroupName... | Create or update a multi-role pool.
Create or update a multi-role pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param multiRolePoolEnvelope Properties of the multi-role pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the WorkerPoolResourceInner object if successful. | [
"Create",
"or",
"update",
"a",
"multi",
"-",
"role",
"pool",
".",
"Create",
"or",
"update",
"a",
"multi",
"-",
"role",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L2273-L2275 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.acquireLock | public void acquireLock (final NodeObject.Lock lock, final ResultListener<String> listener)
{
// wait until any pending resolution is complete
queryLock(lock, new ChainedResultListener<String, String>(listener) {
public void requestCompleted (String result) {
if (result == null) {
if (_suboids.isEmpty()) {
lockAcquired(lock, 0L, listener);
} else {
_locks.put(lock, new LockHandler(lock, true, listener));
}
} else {
listener.requestCompleted(result);
}
}
});
} | java | public void acquireLock (final NodeObject.Lock lock, final ResultListener<String> listener)
{
// wait until any pending resolution is complete
queryLock(lock, new ChainedResultListener<String, String>(listener) {
public void requestCompleted (String result) {
if (result == null) {
if (_suboids.isEmpty()) {
lockAcquired(lock, 0L, listener);
} else {
_locks.put(lock, new LockHandler(lock, true, listener));
}
} else {
listener.requestCompleted(result);
}
}
});
} | [
"public",
"void",
"acquireLock",
"(",
"final",
"NodeObject",
".",
"Lock",
"lock",
",",
"final",
"ResultListener",
"<",
"String",
">",
"listener",
")",
"{",
"// wait until any pending resolution is complete",
"queryLock",
"(",
"lock",
",",
"new",
"ChainedResultListener... | Acquires a lock on a resource shared amongst this node's peers. If the lock is successfully
acquired, the supplied listener will receive this node's name. If another node acquires the
lock first, then the listener will receive the name of that node. | [
"Acquires",
"a",
"lock",
"on",
"a",
"resource",
"shared",
"amongst",
"this",
"node",
"s",
"peers",
".",
"If",
"the",
"lock",
"is",
"successfully",
"acquired",
"the",
"supplied",
"listener",
"will",
"receive",
"this",
"node",
"s",
"name",
".",
"If",
"anothe... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L799-L815 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.