repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/CommonDatabaseMetaData.java | CommonDatabaseMetaData.getSuperTables | public ResultSet getSuperTables(final String catalog, final String schemaPattern, final String tableNamePattern) throws SQLException {
log.info("getting empty result set, get super tables");
return getEmptyResultSet();
} | java | public ResultSet getSuperTables(final String catalog, final String schemaPattern, final String tableNamePattern) throws SQLException {
log.info("getting empty result set, get super tables");
return getEmptyResultSet();
} | [
"public",
"ResultSet",
"getSuperTables",
"(",
"final",
"String",
"catalog",
",",
"final",
"String",
"schemaPattern",
",",
"final",
"String",
"tableNamePattern",
")",
"throws",
"SQLException",
"{",
"log",
".",
"info",
"(",
"\"getting empty result set, get super tables\""... | Retrieves a description of the table hierarchies defined in a particular schema in this database.
<p/>
<P>Only supertable information for tables matching the catalog, schema and table name are returned. The table
name parameter may be a fully- qualified name, in which case, the catalog and schemaPattern parameters are
ignored. If a table does not have a super table, it is not listed here. Supertables have to be defined in the
same catalog and schema as the sub tables. Therefore, the type description does not need to include this
information for the supertable.
<p/>
<P>Each type description has the following columns: <OL> <LI><B>TABLE_CAT</B> String => the type's catalog (may
be <code>null</code>) <LI><B>TABLE_SCHEM</B> String => type's schema (may be <code>null</code>)
<LI><B>TABLE_NAME</B> String => type name <LI><B>SUPERTABLE_NAME</B> String => the direct super type's name
</OL>
<p/>
<P><B>Note:</B> If the driver does not support type hierarchies, an empty result set is returned.
@param catalog a catalog name; "" retrieves those without a catalog; <code>null</code> means drop
catalog name from the selection criteria
@param schemaPattern a schema name pattern; "" retrieves those without a schema
@param tableNamePattern a table name pattern; may be a fully-qualified name
@return a <code>ResultSet</code> object in which each row is a type description
@throws java.sql.SQLException if a database access error occurs
@see #getSearchStringEscape
@since 1.4 | [
"Retrieves",
"a",
"description",
"of",
"the",
"table",
"hierarchies",
"defined",
"in",
"a",
"particular",
"schema",
"in",
"this",
"database",
".",
"<p",
"/",
">",
"<P",
">",
"Only",
"supertable",
"information",
"for",
"tables",
"matching",
"the",
"catalog",
... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/CommonDatabaseMetaData.java#L2329-L2332 |
alkacon/opencms-core | src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBUpdateOU.java | CmsUpdateDBUpdateOU.findOUColumn | protected boolean findOUColumn(CmsSetupDb dbCon, String table, String ouColumn) {
System.out.println(new Exception().getStackTrace()[0].toString());
return dbCon.hasTableOrColumn(table, ouColumn);
} | java | protected boolean findOUColumn(CmsSetupDb dbCon, String table, String ouColumn) {
System.out.println(new Exception().getStackTrace()[0].toString());
return dbCon.hasTableOrColumn(table, ouColumn);
} | [
"protected",
"boolean",
"findOUColumn",
"(",
"CmsSetupDb",
"dbCon",
",",
"String",
"table",
",",
"String",
"ouColumn",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"new",
"Exception",
"(",
")",
".",
"getStackTrace",
"(",
")",
"[",
"0",
"]",
".",
... | Checks if the column USER_OU is found in the resultset.<p>
@param dbCon the db connection interface
@param table the table to check
@param ouColumn the type of OU to find (e.g. USER_OU or GROUP_OU)
@return true if the column is in the result set, false if not | [
"Checks",
"if",
"the",
"column",
"USER_OU",
"is",
"found",
"in",
"the",
"resultset",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBUpdateOU.java#L109-L113 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java | DependencyBundlingAnalyzer.fileNameMatch | private boolean fileNameMatch(Dependency dependency1, Dependency dependency2) {
if (dependency1 == null || dependency1.getFileName() == null
|| dependency2 == null || dependency2.getFileName() == null) {
return false;
}
final String fileName1 = dependency1.getActualFile().getName();
final String fileName2 = dependency2.getActualFile().getName();
//version check
final DependencyVersion version1 = DependencyVersionUtil.parseVersion(fileName1);
final DependencyVersion version2 = DependencyVersionUtil.parseVersion(fileName2);
if (version1 != null && version2 != null && !version1.equals(version2)) {
return false;
}
//filename check
final Matcher match1 = STARTING_TEXT_PATTERN.matcher(fileName1);
final Matcher match2 = STARTING_TEXT_PATTERN.matcher(fileName2);
if (match1.find() && match2.find()) {
return match1.group().equals(match2.group());
}
return false;
} | java | private boolean fileNameMatch(Dependency dependency1, Dependency dependency2) {
if (dependency1 == null || dependency1.getFileName() == null
|| dependency2 == null || dependency2.getFileName() == null) {
return false;
}
final String fileName1 = dependency1.getActualFile().getName();
final String fileName2 = dependency2.getActualFile().getName();
//version check
final DependencyVersion version1 = DependencyVersionUtil.parseVersion(fileName1);
final DependencyVersion version2 = DependencyVersionUtil.parseVersion(fileName2);
if (version1 != null && version2 != null && !version1.equals(version2)) {
return false;
}
//filename check
final Matcher match1 = STARTING_TEXT_PATTERN.matcher(fileName1);
final Matcher match2 = STARTING_TEXT_PATTERN.matcher(fileName2);
if (match1.find() && match2.find()) {
return match1.group().equals(match2.group());
}
return false;
} | [
"private",
"boolean",
"fileNameMatch",
"(",
"Dependency",
"dependency1",
",",
"Dependency",
"dependency2",
")",
"{",
"if",
"(",
"dependency1",
"==",
"null",
"||",
"dependency1",
".",
"getFileName",
"(",
")",
"==",
"null",
"||",
"dependency2",
"==",
"null",
"||... | Returns true if the file names (and version if it exists) of the two
dependencies are sufficiently similar.
@param dependency1 a dependency2 to compare
@param dependency2 a dependency2 to compare
@return true if the identifiers in the two supplied dependencies are
equal | [
"Returns",
"true",
"if",
"the",
"file",
"names",
"(",
"and",
"version",
"if",
"it",
"exists",
")",
"of",
"the",
"two",
"dependencies",
"are",
"sufficiently",
"similar",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java#L224-L247 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java | DocTreeScanner.visitDeprecated | @Override
public R visitDeprecated(DeprecatedTree node, P p) {
return scan(node.getBody(), p);
} | java | @Override
public R visitDeprecated(DeprecatedTree node, P p) {
return scan(node.getBody(), p);
} | [
"@",
"Override",
"public",
"R",
"visitDeprecated",
"(",
"DeprecatedTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"scan",
"(",
"node",
".",
"getBody",
"(",
")",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"scans",
"the",
"children",
"in",
"left",
"to",
"right",
"order",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L169-L172 |
intellimate/Izou | src/main/java/org/intellimate/izou/system/file/FileManager.java | FileManager.registerFileDir | public void registerFileDir(Path dir, String fileType, ReloadableFile reloadableFile) throws IOException {
WatchKey key = dir.register(watcher, ENTRY_MODIFY);
List<FileInfo> fileInfos = addOnMap.get(key);
if(fileInfos != null) {
fileInfos.add(new FileInfo(dir, fileType, reloadableFile));
} else {
fileInfos = new ArrayList<>();
fileInfos.add(new FileInfo(dir, fileType, reloadableFile));
addOnMap.put(key, fileInfos);
}
} | java | public void registerFileDir(Path dir, String fileType, ReloadableFile reloadableFile) throws IOException {
WatchKey key = dir.register(watcher, ENTRY_MODIFY);
List<FileInfo> fileInfos = addOnMap.get(key);
if(fileInfos != null) {
fileInfos.add(new FileInfo(dir, fileType, reloadableFile));
} else {
fileInfos = new ArrayList<>();
fileInfos.add(new FileInfo(dir, fileType, reloadableFile));
addOnMap.put(key, fileInfos);
}
} | [
"public",
"void",
"registerFileDir",
"(",
"Path",
"dir",
",",
"String",
"fileType",
",",
"ReloadableFile",
"reloadableFile",
")",
"throws",
"IOException",
"{",
"WatchKey",
"key",
"=",
"dir",
".",
"register",
"(",
"watcher",
",",
"ENTRY_MODIFY",
")",
";",
"List... | Use this method to register a file with the watcherService
@param dir directory of file
@param fileType the name/extension of the file
IMPORTANT: Please try to always enter the full name with extension of the file (Ex: "test.txt"),
it would be best if the fileType is the full file name, and that the file name is clearly
distinguishable from other files.
For example, the property files are stored with the ID of the addon they belong too. That way
every property file is easily distinguishable.
@param reloadableFile object of interface that file belongs to
@throws IOException exception thrown by watcher service | [
"Use",
"this",
"method",
"to",
"register",
"a",
"file",
"with",
"the",
"watcherService"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/system/file/FileManager.java#L60-L71 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java | DiagnosticsInner.executeSiteAnalysisSlot | public DiagnosticAnalysisInner executeSiteAnalysisSlot(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, String slot) {
return executeSiteAnalysisSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName, slot).toBlocking().single().body();
} | java | public DiagnosticAnalysisInner executeSiteAnalysisSlot(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, String slot) {
return executeSiteAnalysisSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName, slot).toBlocking().single().body();
} | [
"public",
"DiagnosticAnalysisInner",
"executeSiteAnalysisSlot",
"(",
"String",
"resourceGroupName",
",",
"String",
"siteName",
",",
"String",
"diagnosticCategory",
",",
"String",
"analysisName",
",",
"String",
"slot",
")",
"{",
"return",
"executeSiteAnalysisSlotWithServiceR... | Execute Analysis.
Execute Analysis.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param diagnosticCategory Category Name
@param analysisName Analysis Resource Name
@param slot Slot Name
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DiagnosticAnalysisInner object if successful. | [
"Execute",
"Analysis",
".",
"Execute",
"Analysis",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1846-L1848 |
anotheria/moskito | moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java | AbstractInterceptor.createAccumulator | private void createAccumulator(String producerId, Accumulate annotation, String accName, String statsName) {
if (annotation != null && producerId != null && !producerId.isEmpty() &&
accName!=null && !accName.isEmpty() && statsName != null && !statsName.isEmpty()){
AccumulatorDefinition definition = new AccumulatorDefinition();
if (annotation.name().length() > 0) {
definition.setName(annotation.name());
}else{
definition.setName(accName);
}
definition.setIntervalName(annotation.intervalName());
definition.setProducerName(producerId);
definition.setStatName(statsName);
definition.setValueName(annotation.valueName());
definition.setTimeUnit(annotation.timeUnit());
AccumulatorRepository.getInstance().createAccumulator(definition);
}
} | java | private void createAccumulator(String producerId, Accumulate annotation, String accName, String statsName) {
if (annotation != null && producerId != null && !producerId.isEmpty() &&
accName!=null && !accName.isEmpty() && statsName != null && !statsName.isEmpty()){
AccumulatorDefinition definition = new AccumulatorDefinition();
if (annotation.name().length() > 0) {
definition.setName(annotation.name());
}else{
definition.setName(accName);
}
definition.setIntervalName(annotation.intervalName());
definition.setProducerName(producerId);
definition.setStatName(statsName);
definition.setValueName(annotation.valueName());
definition.setTimeUnit(annotation.timeUnit());
AccumulatorRepository.getInstance().createAccumulator(definition);
}
} | [
"private",
"void",
"createAccumulator",
"(",
"String",
"producerId",
",",
"Accumulate",
"annotation",
",",
"String",
"accName",
",",
"String",
"statsName",
")",
"{",
"if",
"(",
"annotation",
"!=",
"null",
"&&",
"producerId",
"!=",
"null",
"&&",
"!",
"producerI... | Create accumulator and register it.
@param producerId id of the producer
@param annotation Accumulate annotation
@param accName Accumulator name
@param statsName Statistics name | [
"Create",
"accumulator",
"and",
"register",
"it",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java#L226-L243 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INodeDirectoryWithQuota.java | INodeDirectoryWithQuota.verifyQuota | void verifyQuota(long nsDelta, long dsDelta) throws QuotaExceededException {
long newCount = nsCount + nsDelta;
long newDiskspace = diskspace + dsDelta;
if (nsDelta>0 || dsDelta>0) {
if (nsQuota >= 0 && nsQuota < newCount) {
throw new NSQuotaExceededException(nsQuota, newCount);
}
if (dsQuota >= 0 && dsQuota < newDiskspace) {
throw new DSQuotaExceededException(dsQuota, newDiskspace);
}
}
} | java | void verifyQuota(long nsDelta, long dsDelta) throws QuotaExceededException {
long newCount = nsCount + nsDelta;
long newDiskspace = diskspace + dsDelta;
if (nsDelta>0 || dsDelta>0) {
if (nsQuota >= 0 && nsQuota < newCount) {
throw new NSQuotaExceededException(nsQuota, newCount);
}
if (dsQuota >= 0 && dsQuota < newDiskspace) {
throw new DSQuotaExceededException(dsQuota, newDiskspace);
}
}
} | [
"void",
"verifyQuota",
"(",
"long",
"nsDelta",
",",
"long",
"dsDelta",
")",
"throws",
"QuotaExceededException",
"{",
"long",
"newCount",
"=",
"nsCount",
"+",
"nsDelta",
";",
"long",
"newDiskspace",
"=",
"diskspace",
"+",
"dsDelta",
";",
"if",
"(",
"nsDelta",
... | Verify if the namespace count disk space satisfies the quota restriction
@throws QuotaExceededException if the given quota is less than the count | [
"Verify",
"if",
"the",
"namespace",
"count",
"disk",
"space",
"satisfies",
"the",
"quota",
"restriction"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INodeDirectoryWithQuota.java#L141-L152 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java | ClusterJoinManager.answerWhoisMasterQuestion | public void answerWhoisMasterQuestion(JoinMessage joinMessage, Connection connection) {
if (!ensureValidConfiguration(joinMessage)) {
return;
}
if (clusterService.isJoined()) {
if (!checkIfJoinRequestFromAnExistingMember(joinMessage, connection)) {
sendMasterAnswer(joinMessage.getAddress());
}
} else {
if (logger.isFineEnabled()) {
logger.fine(format("Received a master question from %s,"
+ " but this node is not master itself or doesn't have a master yet!", joinMessage.getAddress()));
}
}
} | java | public void answerWhoisMasterQuestion(JoinMessage joinMessage, Connection connection) {
if (!ensureValidConfiguration(joinMessage)) {
return;
}
if (clusterService.isJoined()) {
if (!checkIfJoinRequestFromAnExistingMember(joinMessage, connection)) {
sendMasterAnswer(joinMessage.getAddress());
}
} else {
if (logger.isFineEnabled()) {
logger.fine(format("Received a master question from %s,"
+ " but this node is not master itself or doesn't have a master yet!", joinMessage.getAddress()));
}
}
} | [
"public",
"void",
"answerWhoisMasterQuestion",
"(",
"JoinMessage",
"joinMessage",
",",
"Connection",
"connection",
")",
"{",
"if",
"(",
"!",
"ensureValidConfiguration",
"(",
"joinMessage",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"clusterService",
".",
"isJ... | Respond to a {@link WhoisMasterOp}.
@param joinMessage the {@code JoinMessage} from the request.
@param connection the connection to operation caller, to which response will be sent.
@see WhoisMasterOp | [
"Respond",
"to",
"a",
"{",
"@link",
"WhoisMasterOp",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java#L571-L586 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.unescapeUriFragmentId | public static String unescapeUriFragmentId(final String text, final String encoding) {
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
return UriEscapeUtil.unescape(text, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding);
} | java | public static String unescapeUriFragmentId(final String text, final String encoding) {
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
return UriEscapeUtil.unescape(text, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding);
} | [
"public",
"static",
"String",
"unescapeUriFragmentId",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"encoding",
")",
"{",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'encoding' cannot be null... | <p>
Perform am URI fragment identifier <strong>unescape</strong> operation
on a <tt>String</tt> input.
</p>
<p>
This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input,
even for those characters that do not need to be percent-encoded in this context (unreserved characters
can be percent-encoded even if/when this is not required, though it is not generally considered a
good practice).
</p>
<p>
This method will use specified <tt>encoding</tt> in order to determine the characters specified in the
percent-encoded byte sequences.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be unescaped.
@param encoding the encoding to be used for unescaping.
@return The unescaped result <tt>String</tt>. As a memory-performance improvement, will return the exact
same object as the <tt>text</tt> input argument if no unescaping modifications were required (and
no additional <tt>String</tt> objects will be created during processing). Will
return <tt>null</tt> if input is <tt>null</tt>. | [
"<p",
">",
"Perform",
"am",
"URI",
"fragment",
"identifier",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"will",
"unesc... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1763-L1768 |
kite-sdk/kite | kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/SchemaUtil.java | SchemaUtil.fieldSchema | public static Schema fieldSchema(Schema schema, String name) {
Schema nested = unwrapNullable(schema);
List<String> levels = Lists.newArrayList();
for (String level : NAME_SPLITTER.split(name)) {
levels.add(level);
ValidationException.check(Schema.Type.RECORD == schema.getType(),
"Cannot get schema for %s: %s is not a record schema: %s",
name, NAME_JOINER.join(levels), nested.toString(true));
Schema.Field field = nested.getField(level);
ValidationException.check(field != null,
"Cannot get schema for %s: %s is not a field",
name, NAME_JOINER.join(levels));
nested = unwrapNullable(field.schema());
}
return nested;
} | java | public static Schema fieldSchema(Schema schema, String name) {
Schema nested = unwrapNullable(schema);
List<String> levels = Lists.newArrayList();
for (String level : NAME_SPLITTER.split(name)) {
levels.add(level);
ValidationException.check(Schema.Type.RECORD == schema.getType(),
"Cannot get schema for %s: %s is not a record schema: %s",
name, NAME_JOINER.join(levels), nested.toString(true));
Schema.Field field = nested.getField(level);
ValidationException.check(field != null,
"Cannot get schema for %s: %s is not a field",
name, NAME_JOINER.join(levels));
nested = unwrapNullable(field.schema());
}
return nested;
} | [
"public",
"static",
"Schema",
"fieldSchema",
"(",
"Schema",
"schema",
",",
"String",
"name",
")",
"{",
"Schema",
"nested",
"=",
"unwrapNullable",
"(",
"schema",
")",
";",
"List",
"<",
"String",
">",
"levels",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
... | Returns the nested {@link Schema} for the given field name.
@param schema a record Schema
@param name a String field name
@return the nested Schema for the field | [
"Returns",
"the",
"nested",
"{",
"@link",
"Schema",
"}",
"for",
"the",
"given",
"field",
"name",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/SchemaUtil.java#L232-L247 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java | KeyAreaInfo.addKeyField | public void addKeyField(Field field, boolean bKeyOrder)
{ // Get the field with this seq
if (m_vKeyFieldList.size() == 0)
m_bKeyOrder = bKeyOrder;
m_vKeyFieldList.add(field); // init the key field seq
} | java | public void addKeyField(Field field, boolean bKeyOrder)
{ // Get the field with this seq
if (m_vKeyFieldList.size() == 0)
m_bKeyOrder = bKeyOrder;
m_vKeyFieldList.add(field); // init the key field seq
} | [
"public",
"void",
"addKeyField",
"(",
"Field",
"field",
",",
"boolean",
"bKeyOrder",
")",
"{",
"// Get the field with this seq",
"if",
"(",
"m_vKeyFieldList",
".",
"size",
"(",
")",
"==",
"0",
")",
"m_bKeyOrder",
"=",
"bKeyOrder",
";",
"m_vKeyFieldList",
".",
... | Add this field to this Key Area.
@param field The field to add.
@param bKeyArea The order (ascending/descending). | [
"Add",
"this",
"field",
"to",
"this",
"Key",
"Area",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java#L146-L151 |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java | ZipFileContainer.placeExtractionGuard | private ExtractionGuard placeExtractionGuard(String path) {
boolean isPrimary;
CountDownLatch completionLatch;
synchronized( extractionsLock ) {
completionLatch = extractionLocks.get(path);
if ( completionLatch != null ) {
isPrimary = false;
} else {
isPrimary = true;
completionLatch = new CountDownLatch(1);
extractionLocks.put(path, completionLatch);
}
}
return new ExtractionGuard(path, isPrimary, completionLatch);
} | java | private ExtractionGuard placeExtractionGuard(String path) {
boolean isPrimary;
CountDownLatch completionLatch;
synchronized( extractionsLock ) {
completionLatch = extractionLocks.get(path);
if ( completionLatch != null ) {
isPrimary = false;
} else {
isPrimary = true;
completionLatch = new CountDownLatch(1);
extractionLocks.put(path, completionLatch);
}
}
return new ExtractionGuard(path, isPrimary, completionLatch);
} | [
"private",
"ExtractionGuard",
"placeExtractionGuard",
"(",
"String",
"path",
")",
"{",
"boolean",
"isPrimary",
";",
"CountDownLatch",
"completionLatch",
";",
"synchronized",
"(",
"extractionsLock",
")",
"{",
"completionLatch",
"=",
"extractionLocks",
".",
"get",
"(",
... | Make sure a completion latch exists for a specified path.
Create and store one if necessary.
Answer the completion latch encapsulated in an extraction latch,
which brings together the completion latch with the path and
with a setting of whether the extraction is a primary (doing
the extraction) or secondary (waiting for the primary to do the
extraction).
@param path The path which is being extracted.
@return An extraction latch for the path which encapsulates
the extraction state (primary or secondary), the path,
and the completion latch for the extraction. | [
"Make",
"sure",
"a",
"completion",
"latch",
"exists",
"for",
"a",
"specified",
"path",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L1401-L1420 |
diffplug/durian | src/com/diffplug/common/base/TreeQuery.java | TreeQuery.copyRootOut | public static <T, CopyType> CopyType copyRootOut(TreeDef<T> def, T root, BiFunction<T, CopyType, CopyType> mapper) {
List<T> children = def.childrenOf(root);
CopyType copyRoot = mapper.apply(root, null);
copyMutableRecurse(def, root, children, copyRoot, mapper);
return copyRoot;
} | java | public static <T, CopyType> CopyType copyRootOut(TreeDef<T> def, T root, BiFunction<T, CopyType, CopyType> mapper) {
List<T> children = def.childrenOf(root);
CopyType copyRoot = mapper.apply(root, null);
copyMutableRecurse(def, root, children, copyRoot, mapper);
return copyRoot;
} | [
"public",
"static",
"<",
"T",
",",
"CopyType",
">",
"CopyType",
"copyRootOut",
"(",
"TreeDef",
"<",
"T",
">",
"def",
",",
"T",
"root",
",",
"BiFunction",
"<",
"T",
",",
"CopyType",
",",
"CopyType",
">",
"mapper",
")",
"{",
"List",
"<",
"T",
">",
"c... | Copies the given tree of T to CopyType, starting at the root node
of the tree and moving out to the leaf nodes, which generally requires
CopyType to be mutable (if you want CopyType nodes to know who their
children are).
@param def defines the structure of the tree
@param root root of the tree
@param nodeMapper given an unmapped node, and a parent CopyType which has already been mapped, return a mapped node.
This function must have the side effect that the returned node should be added as a child of its
parent node.
@return a CopyType with the same contents as the source tree | [
"Copies",
"the",
"given",
"tree",
"of",
"T",
"to",
"CopyType",
"starting",
"at",
"the",
"root",
"node",
"of",
"the",
"tree",
"and",
"moving",
"out",
"to",
"the",
"leaf",
"nodes",
"which",
"generally",
"requires",
"CopyType",
"to",
"be",
"mutable",
"(",
"... | train | https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L107-L112 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/logging/MyfacesLogger.java | MyfacesLogger.createMyfacesLogger | private static MyfacesLogger createMyfacesLogger(String name, String resourceBundleName)
{
if (name == null)
{
throw new IllegalArgumentException(_LOG.getMessage(
"LOGGER_NAME_REQUIRED"));
}
Logger log = Logger.getLogger(name, resourceBundleName);
return new MyfacesLogger(log);
} | java | private static MyfacesLogger createMyfacesLogger(String name, String resourceBundleName)
{
if (name == null)
{
throw new IllegalArgumentException(_LOG.getMessage(
"LOGGER_NAME_REQUIRED"));
}
Logger log = Logger.getLogger(name, resourceBundleName);
return new MyfacesLogger(log);
} | [
"private",
"static",
"MyfacesLogger",
"createMyfacesLogger",
"(",
"String",
"name",
",",
"String",
"resourceBundleName",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"_LOG",
".",
"getMessage",
"(",
"\"LOGG... | Find or create a logger for a named subsystem. If a logger has
already been created with the given name it is returned. Otherwise
a new logger is created.
<p>
If a new logger is created its log level will be configured
based on the LogManager and it will configured to also send logging
output to its parent loggers Handlers. It will be registered in
the LogManager global namespace.
<p>
If the named Logger already exists and does not yet have a
localization resource bundle then the given resource bundle
name is used. If the named Logger already exists and has
a different resource bundle name then an IllegalArgumentException
is thrown.
<p>
@param name A name for the logger. This should
be a dot-separated name and should normally
be based on the package name or class name
of the subsystem, such as java.net
or javax.swing
@param resourceBundleName name of ResourceBundle to be used for localizing
messages for this logger.
@return a suitable Logger
@throws MissingResourceException if the named ResourceBundle cannot be found.
@throws IllegalArgumentException if the Logger already exists and uses
a different resource bundle name. | [
"Find",
"or",
"create",
"a",
"logger",
"for",
"a",
"named",
"subsystem",
".",
"If",
"a",
"logger",
"has",
"already",
"been",
"created",
"with",
"the",
"given",
"name",
"it",
"is",
"returned",
".",
"Otherwise",
"a",
"new",
"logger",
"is",
"created",
".",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/logging/MyfacesLogger.java#L199-L210 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.createTableIfNotExists | public static boolean createTableIfNotExists(final Connection conn, final String tableName, final String schema) {
if (doesTableExist(conn, tableName)) {
return false;
}
try {
execute(conn, schema);
return true;
} catch (SQLException e) {
return false;
}
} | java | public static boolean createTableIfNotExists(final Connection conn, final String tableName, final String schema) {
if (doesTableExist(conn, tableName)) {
return false;
}
try {
execute(conn, schema);
return true;
} catch (SQLException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"createTableIfNotExists",
"(",
"final",
"Connection",
"conn",
",",
"final",
"String",
"tableName",
",",
"final",
"String",
"schema",
")",
"{",
"if",
"(",
"doesTableExist",
"(",
"conn",
",",
"tableName",
")",
")",
"{",
"return",
... | Returns {@code true} if succeed to create table, otherwise {@code false} is returned.
@param conn
@param tableName
@param schema
@return | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"succeed",
"to",
"create",
"table",
"otherwise",
"{",
"@code",
"false",
"}",
"is",
"returned",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L1666-L1678 |
Red5/red5-server-common | src/main/java/org/red5/server/ClientRegistry.java | ClientRegistry.newClient | public IClient newClient(Object[] params) throws ClientNotFoundException, ClientRejectedException {
// derive client id from the connection params or use next
String id = nextId();
IClient client = new Client(id, this);
addClient(id, client);
return client;
} | java | public IClient newClient(Object[] params) throws ClientNotFoundException, ClientRejectedException {
// derive client id from the connection params or use next
String id = nextId();
IClient client = new Client(id, this);
addClient(id, client);
return client;
} | [
"public",
"IClient",
"newClient",
"(",
"Object",
"[",
"]",
"params",
")",
"throws",
"ClientNotFoundException",
",",
"ClientRejectedException",
"{",
"// derive client id from the connection params or use next\r",
"String",
"id",
"=",
"nextId",
"(",
")",
";",
"IClient",
"... | Return client from next id with given params
@param params
Client params
@return Client object
@throws ClientNotFoundException
if client not found
@throws ClientRejectedException
if client rejected | [
"Return",
"client",
"from",
"next",
"id",
"with",
"given",
"params"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/ClientRegistry.java#L195-L201 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/CollectionPrinter.java | CollectionPrinter.mapToJSONString | public static String mapToJSONString(Map<?, ?> map) {
if (map == null || map.size() == 0) {
return "{}";
}
StringBuilder sb = new StringBuilder("{");
for (Object o : map.entrySet()) {
Entry<?, ?> e = (Entry<?, ?>) o;
buildAppendString(sb, e.getKey()).append('=');
buildAppendString(sb, e.getValue()).append(',').append(' ');
}
return sb.delete(sb.length() - 2, sb.length()).append('}').toString();
} | java | public static String mapToJSONString(Map<?, ?> map) {
if (map == null || map.size() == 0) {
return "{}";
}
StringBuilder sb = new StringBuilder("{");
for (Object o : map.entrySet()) {
Entry<?, ?> e = (Entry<?, ?>) o;
buildAppendString(sb, e.getKey()).append('=');
buildAppendString(sb, e.getValue()).append(',').append(' ');
}
return sb.delete(sb.length() - 2, sb.length()).append('}').toString();
} | [
"public",
"static",
"String",
"mapToJSONString",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
")",
"{",
"if",
"(",
"map",
"==",
"null",
"||",
"map",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"\"{}\"",
";",
"}",
"StringBuilder",
"sb",
"... | Map to json string string.
@param map the map
@return the string | [
"Map",
"to",
"json",
"string",
"string",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/CollectionPrinter.java#L52-L63 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/MultimapJoiner.java | MultimapJoiner.appendTo | public <A extends Appendable> A appendTo(A appendable, Map<?, ? extends Collection<?>> map) throws IOException {
return appendTo(appendable, map.entrySet());
} | java | public <A extends Appendable> A appendTo(A appendable, Map<?, ? extends Collection<?>> map) throws IOException {
return appendTo(appendable, map.entrySet());
} | [
"public",
"<",
"A",
"extends",
"Appendable",
">",
"A",
"appendTo",
"(",
"A",
"appendable",
",",
"Map",
"<",
"?",
",",
"?",
"extends",
"Collection",
"<",
"?",
">",
">",
"map",
")",
"throws",
"IOException",
"{",
"return",
"appendTo",
"(",
"appendable",
"... | Appends the string representation of each entry of {@code map}, using the previously configured separator and
key-value separator, to {@code appendable}. | [
"Appends",
"the",
"string",
"representation",
"of",
"each",
"entry",
"of",
"{"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/MultimapJoiner.java#L53-L55 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addStringValue | protected void addStringValue(Document doc, String fieldName, Object internalValue, boolean tokenized)
{
addStringValue(doc, fieldName, internalValue, tokenized, true, DEFAULT_BOOST, true);
} | java | protected void addStringValue(Document doc, String fieldName, Object internalValue, boolean tokenized)
{
addStringValue(doc, fieldName, internalValue, tokenized, true, DEFAULT_BOOST, true);
} | [
"protected",
"void",
"addStringValue",
"(",
"Document",
"doc",
",",
"String",
"fieldName",
",",
"Object",
"internalValue",
",",
"boolean",
"tokenized",
")",
"{",
"addStringValue",
"(",
"doc",
",",
"fieldName",
",",
"internalValue",
",",
"tokenized",
",",
"true",... | Adds the string value to the document both as the named field and
optionally for full text indexing if <code>tokenized</code> is
<code>true</code>.
@param doc The document to which to add the field
@param fieldName The name of the field to add
@param internalValue The value for the field to add to the document.
@param tokenized If <code>true</code> the string is also tokenized
and fulltext indexed. | [
"Adds",
"the",
"string",
"value",
"to",
"the",
"document",
"both",
"as",
"the",
"named",
"field",
"and",
"optionally",
"for",
"full",
"text",
"indexing",
"if",
"<code",
">",
"tokenized<",
"/",
"code",
">",
"is",
"<code",
">",
"true<",
"/",
"code",
">",
... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L824-L827 |
JodaOrg/joda-money | src/main/java/org/joda/money/BigMoney.java | BigMoney.convertRetainScale | public BigMoney convertRetainScale(CurrencyUnit currency, BigDecimal conversionMultipler, RoundingMode roundingMode) {
return convertedTo(currency, conversionMultipler).withScale(getScale(), roundingMode);
} | java | public BigMoney convertRetainScale(CurrencyUnit currency, BigDecimal conversionMultipler, RoundingMode roundingMode) {
return convertedTo(currency, conversionMultipler).withScale(getScale(), roundingMode);
} | [
"public",
"BigMoney",
"convertRetainScale",
"(",
"CurrencyUnit",
"currency",
",",
"BigDecimal",
"conversionMultipler",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"convertedTo",
"(",
"currency",
",",
"conversionMultipler",
")",
".",
"withScale",
"(",
"get... | Returns a copy of this monetary value converted into another currency
using the specified conversion rate, with a rounding mode used to adjust
the decimal places in the result.
<p>
The result will have the same scale as this instance even though it will
be in a different currency.
<p>
This instance is immutable and unaffected by this method.
@param currency the new currency, not null
@param conversionMultipler the conversion factor between the currencies, not null
@param roundingMode the rounding mode to use to bring the decimal places back in line, not null
@return the new multiplied instance, never null
@throws IllegalArgumentException if the currency is the same as this currency and the
conversion is not one; or if the conversion multiplier is negative
@throws ArithmeticException if the rounding fails | [
"Returns",
"a",
"copy",
"of",
"this",
"monetary",
"value",
"converted",
"into",
"another",
"currency",
"using",
"the",
"specified",
"conversion",
"rate",
"with",
"a",
"rounding",
"mode",
"used",
"to",
"adjust",
"the",
"decimal",
"places",
"in",
"the",
"result"... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/BigMoney.java#L1545-L1547 |
Azure/azure-sdk-for-java | cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java | AccountsInner.getByResourceGroupAsync | public Observable<CognitiveServicesAccountInner> getByResourceGroupAsync(String resourceGroupName, String accountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<CognitiveServicesAccountInner>, CognitiveServicesAccountInner>() {
@Override
public CognitiveServicesAccountInner call(ServiceResponse<CognitiveServicesAccountInner> response) {
return response.body();
}
});
} | java | public Observable<CognitiveServicesAccountInner> getByResourceGroupAsync(String resourceGroupName, String accountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<CognitiveServicesAccountInner>, CognitiveServicesAccountInner>() {
@Override
public CognitiveServicesAccountInner call(ServiceResponse<CognitiveServicesAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CognitiveServicesAccountInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",... | Returns a Cognitive Services account specified by the parameters.
@param resourceGroupName The name of the resource group within the user's subscription.
@param accountName The name of Cognitive Services account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CognitiveServicesAccountInner object | [
"Returns",
"a",
"Cognitive",
"Services",
"account",
"specified",
"by",
"the",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java#L524-L531 |
Coveros/selenified | src/main/java/com/coveros/selenified/utilities/Reporter.java | Reporter.getActual | private String getActual(String actual, double timeTook) {
if (timeTook > 0) {
String lowercase = actual.substring(0, 1).toLowerCase();
actual = "After waiting for " + timeTook + " seconds, " + lowercase + actual.substring(1);
}
return actual;
} | java | private String getActual(String actual, double timeTook) {
if (timeTook > 0) {
String lowercase = actual.substring(0, 1).toLowerCase();
actual = "After waiting for " + timeTook + " seconds, " + lowercase + actual.substring(1);
}
return actual;
} | [
"private",
"String",
"getActual",
"(",
"String",
"actual",
",",
"double",
"timeTook",
")",
"{",
"if",
"(",
"timeTook",
">",
"0",
")",
"{",
"String",
"lowercase",
"=",
"actual",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toLowerCase",
"(",
")",
... | Helper to recordStep, which takes in some result, and appends a time waited, if
appropriate. If timeTook is greater than zero, some time was waited along with
the action, and the returned result will reflect that
@param actual - the actual outcome from the check
@param timeTook - how long something took to run, provide 0 if it was an immediate check, and actual
will be returned unaltered
@return String: the actual response, prepended with a wait time if appropriate | [
"Helper",
"to",
"recordStep",
"which",
"takes",
"in",
"some",
"result",
"and",
"appends",
"a",
"time",
"waited",
"if",
"appropriate",
".",
"If",
"timeTook",
"is",
"greater",
"than",
"zero",
"some",
"time",
"was",
"waited",
"along",
"with",
"the",
"action",
... | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/utilities/Reporter.java#L362-L368 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.refundInvoice | @Deprecated
public Invoice refundInvoice(final String invoiceId, List<AdjustmentRefund> lineItems, final RefundMethod method) {
final InvoiceRefund invoiceRefund = new InvoiceRefund();
invoiceRefund.setRefundMethod(method);
invoiceRefund.setLineItems(lineItems);
return refundInvoice(invoiceId, invoiceRefund);
} | java | @Deprecated
public Invoice refundInvoice(final String invoiceId, List<AdjustmentRefund> lineItems, final RefundMethod method) {
final InvoiceRefund invoiceRefund = new InvoiceRefund();
invoiceRefund.setRefundMethod(method);
invoiceRefund.setLineItems(lineItems);
return refundInvoice(invoiceId, invoiceRefund);
} | [
"@",
"Deprecated",
"public",
"Invoice",
"refundInvoice",
"(",
"final",
"String",
"invoiceId",
",",
"List",
"<",
"AdjustmentRefund",
">",
"lineItems",
",",
"final",
"RefundMethod",
"method",
")",
"{",
"final",
"InvoiceRefund",
"invoiceRefund",
"=",
"new",
"InvoiceR... | Refund an invoice given some line items
<p/>
Returns the refunded invoice
@deprecated Please use refundInvoice(String, InvoiceRefund)
@param invoiceId The id of the invoice to refund
@param lineItems The list of adjustment refund objects
@param method If credit line items exist on the invoice, this parameter specifies which refund method to use first
@return the refunded invoice | [
"Refund",
"an",
"invoice",
"given",
"some",
"line",
"items",
"<p",
"/",
">",
"Returns",
"the",
"refunded",
"invoice"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1149-L1156 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobsInner.java | DscCompilationJobsInner.getStreamAsync | public Observable<JobStreamInner> getStreamAsync(String resourceGroupName, String automationAccountName, UUID jobId, String jobStreamId) {
return getStreamWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, jobStreamId).map(new Func1<ServiceResponse<JobStreamInner>, JobStreamInner>() {
@Override
public JobStreamInner call(ServiceResponse<JobStreamInner> response) {
return response.body();
}
});
} | java | public Observable<JobStreamInner> getStreamAsync(String resourceGroupName, String automationAccountName, UUID jobId, String jobStreamId) {
return getStreamWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, jobStreamId).map(new Func1<ServiceResponse<JobStreamInner>, JobStreamInner>() {
@Override
public JobStreamInner call(ServiceResponse<JobStreamInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobStreamInner",
">",
"getStreamAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"UUID",
"jobId",
",",
"String",
"jobStreamId",
")",
"{",
"return",
"getStreamWithServiceResponseAsync",
"(",
"resourceG... | Retrieve the job stream identified by job stream id.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job id.
@param jobStreamId The job stream id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobStreamInner object | [
"Retrieve",
"the",
"job",
"stream",
"identified",
"by",
"job",
"stream",
"id",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobsInner.java#L559-L566 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsClientCollectionUtil.java | CmsClientCollectionUtil.updateMapAndRemoveNulls | public static <A, B> void updateMapAndRemoveNulls(Map<A, B> source, Map<A, B> target) {
assert source != target;
for (Map.Entry<A, B> entry : source.entrySet()) {
A key = entry.getKey();
B value = entry.getValue();
if (value != null) {
target.put(key, value);
} else {
target.remove(key);
}
}
} | java | public static <A, B> void updateMapAndRemoveNulls(Map<A, B> source, Map<A, B> target) {
assert source != target;
for (Map.Entry<A, B> entry : source.entrySet()) {
A key = entry.getKey();
B value = entry.getValue();
if (value != null) {
target.put(key, value);
} else {
target.remove(key);
}
}
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"void",
"updateMapAndRemoveNulls",
"(",
"Map",
"<",
"A",
",",
"B",
">",
"source",
",",
"Map",
"<",
"A",
",",
"B",
">",
"target",
")",
"{",
"assert",
"source",
"!=",
"target",
";",
"for",
"(",
"Map",
".... | Copies entries from one map to another and deletes those entries in the target map for which
the value in the source map is null.<p>
@param <A> the key type of the map
@param <B> the value type of the map
@param source the source map
@param target the target map | [
"Copies",
"entries",
"from",
"one",
"map",
"to",
"another",
"and",
"deletes",
"those",
"entries",
"in",
"the",
"target",
"map",
"for",
"which",
"the",
"value",
"in",
"the",
"source",
"map",
"is",
"null",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsClientCollectionUtil.java#L135-L147 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.existsAsync | public Observable<Boolean> existsAsync(String poolId, PoolExistsOptions poolExistsOptions) {
return existsWithServiceResponseAsync(poolId, poolExistsOptions).map(new Func1<ServiceResponseWithHeaders<Boolean, PoolExistsHeaders>, Boolean>() {
@Override
public Boolean call(ServiceResponseWithHeaders<Boolean, PoolExistsHeaders> response) {
return response.body();
}
});
} | java | public Observable<Boolean> existsAsync(String poolId, PoolExistsOptions poolExistsOptions) {
return existsWithServiceResponseAsync(poolId, poolExistsOptions).map(new Func1<ServiceResponseWithHeaders<Boolean, PoolExistsHeaders>, Boolean>() {
@Override
public Boolean call(ServiceResponseWithHeaders<Boolean, PoolExistsHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Boolean",
">",
"existsAsync",
"(",
"String",
"poolId",
",",
"PoolExistsOptions",
"poolExistsOptions",
")",
"{",
"return",
"existsWithServiceResponseAsync",
"(",
"poolId",
",",
"poolExistsOptions",
")",
".",
"map",
"(",
"new",
"Func1",
... | Gets basic properties of a pool.
@param poolId The ID of the pool to get.
@param poolExistsOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Boolean object | [
"Gets",
"basic",
"properties",
"of",
"a",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L1495-L1502 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/QueryByCriteria.java | QueryByCriteria.addPathClass | public void addPathClass(String aPath, Class aClass)
{
List pathClasses = (List) m_pathClasses.get(aPath);
if(pathClasses == null)
{
setPathClass(aPath, aClass);
}
else
{
pathClasses.add(aClass);
}
} | java | public void addPathClass(String aPath, Class aClass)
{
List pathClasses = (List) m_pathClasses.get(aPath);
if(pathClasses == null)
{
setPathClass(aPath, aClass);
}
else
{
pathClasses.add(aClass);
}
} | [
"public",
"void",
"addPathClass",
"(",
"String",
"aPath",
",",
"Class",
"aClass",
")",
"{",
"List",
"pathClasses",
"=",
"(",
"List",
")",
"m_pathClasses",
".",
"get",
"(",
"aPath",
")",
";",
"if",
"(",
"pathClasses",
"==",
"null",
")",
"{",
"setPathClass... | Add a hint Class for a path. Used for relationships to extents.<br>
SqlStatment will use these hint classes when resolving the path.
Without these hints SqlStatment will use the base class the
relationship points to ie: Article instead of CdArticle.
@param aPath the path segment ie: allArticlesInGroup
@param aClass the Class ie: CdArticle
@see org.apache.ojb.broker.QueryTest#testInversePathExpression() | [
"Add",
"a",
"hint",
"Class",
"for",
"a",
"path",
".",
"Used",
"for",
"relationships",
"to",
"extents",
".",
"<br",
">",
"SqlStatment",
"will",
"use",
"these",
"hint",
"classes",
"when",
"resolving",
"the",
"path",
".",
"Without",
"these",
"hints",
"SqlStat... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/QueryByCriteria.java#L191-L202 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureMetric.java | SceneStructureMetric.connectViewToCamera | public void connectViewToCamera( int viewIndex , int cameraIndex ) {
if( views[viewIndex].camera != -1 )
throw new RuntimeException("View has already been assigned a camera");
views[viewIndex].camera = cameraIndex;
} | java | public void connectViewToCamera( int viewIndex , int cameraIndex ) {
if( views[viewIndex].camera != -1 )
throw new RuntimeException("View has already been assigned a camera");
views[viewIndex].camera = cameraIndex;
} | [
"public",
"void",
"connectViewToCamera",
"(",
"int",
"viewIndex",
",",
"int",
"cameraIndex",
")",
"{",
"if",
"(",
"views",
"[",
"viewIndex",
"]",
".",
"camera",
"!=",
"-",
"1",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"View has already been assigned a cam... | Specifies that the view uses the specified camera
@param viewIndex index of view
@param cameraIndex index of camera | [
"Specifies",
"that",
"the",
"view",
"uses",
"the",
"specified",
"camera"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureMetric.java#L183-L187 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/validate/PropertySchema.java | PropertySchema.performValidation | @Override
protected void performValidation(String path, Object value, List<ValidationResult> results) {
path = path == null || path.length() == 0 ? _name : path + "." + _name;
super.performValidation(path, value, results);
performTypeValidation(path, _type, value, results);
} | java | @Override
protected void performValidation(String path, Object value, List<ValidationResult> results) {
path = path == null || path.length() == 0 ? _name : path + "." + _name;
super.performValidation(path, value, results);
performTypeValidation(path, _type, value, results);
} | [
"@",
"Override",
"protected",
"void",
"performValidation",
"(",
"String",
"path",
",",
"Object",
"value",
",",
"List",
"<",
"ValidationResult",
">",
"results",
")",
"{",
"path",
"=",
"path",
"==",
"null",
"||",
"path",
".",
"length",
"(",
")",
"==",
"0",... | Validates a given value against the schema and configured validation rules.
@param path a dot notation path to the value.
@param value a value to be validated.
@param results a list with validation results to add new results. | [
"Validates",
"a",
"given",
"value",
"against",
"the",
"schema",
"and",
"configured",
"validation",
"rules",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/validate/PropertySchema.java#L90-L96 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java | DocBookBuildUtilities.setUniqueIdReferences | private static void setUniqueIdReferences(final Node node, final String id, final String fixedId) {
final NamedNodeMap attributes = node.getAttributes();
if (attributes != null) {
for (int i = 0; i < attributes.getLength(); ++i) {
final Attr attr = (Attr) attributes.item(i);
// Ignore id attributes, as we only care about references (ie linkend)
if (!(attr.getName().equalsIgnoreCase("id") || attr.getName().equalsIgnoreCase("xml:id"))) {
final String attributeValue = attr.getValue();
if (attributeValue.equals(id)) {
attributes.item(i).setNodeValue(fixedId);
}
}
}
}
final NodeList elements = node.getChildNodes();
for (int i = 0; i < elements.getLength(); ++i) {
setUniqueIdReferences(elements.item(i), id, fixedId);
}
} | java | private static void setUniqueIdReferences(final Node node, final String id, final String fixedId) {
final NamedNodeMap attributes = node.getAttributes();
if (attributes != null) {
for (int i = 0; i < attributes.getLength(); ++i) {
final Attr attr = (Attr) attributes.item(i);
// Ignore id attributes, as we only care about references (ie linkend)
if (!(attr.getName().equalsIgnoreCase("id") || attr.getName().equalsIgnoreCase("xml:id"))) {
final String attributeValue = attr.getValue();
if (attributeValue.equals(id)) {
attributes.item(i).setNodeValue(fixedId);
}
}
}
}
final NodeList elements = node.getChildNodes();
for (int i = 0; i < elements.getLength(); ++i) {
setUniqueIdReferences(elements.item(i), id, fixedId);
}
} | [
"private",
"static",
"void",
"setUniqueIdReferences",
"(",
"final",
"Node",
"node",
",",
"final",
"String",
"id",
",",
"final",
"String",
"fixedId",
")",
"{",
"final",
"NamedNodeMap",
"attributes",
"=",
"node",
".",
"getAttributes",
"(",
")",
";",
"if",
"(",... | ID attributes modified in the setUniqueIds() method may have been referenced
locally in the XML. When an ID is updated, and attribute that referenced
that ID is also updated.
@param node The node to check for attributes
@param id The old ID attribute value
@param fixedId The new ID attribute | [
"ID",
"attributes",
"modified",
"in",
"the",
"setUniqueIds",
"()",
"method",
"may",
"have",
"been",
"referenced",
"locally",
"in",
"the",
"XML",
".",
"When",
"an",
"ID",
"is",
"updated",
"and",
"attribute",
"that",
"referenced",
"that",
"ID",
"is",
"also",
... | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L159-L178 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java | MapComposedElement.getPointAt | @Pure
public Point2d getPointAt(int groupIndex, int indexInGroup) {
final int startIndex = firstInGroup(groupIndex);
// Besure that the member's index is in the group index's range
final int groupMemberCount = getPointCountInGroup(groupIndex);
if (indexInGroup < 0) {
throw new IndexOutOfBoundsException(indexInGroup + "<0"); //$NON-NLS-1$
}
if (indexInGroup >= groupMemberCount) {
throw new IndexOutOfBoundsException(indexInGroup + ">=" + groupMemberCount); //$NON-NLS-1$
}
return new Point2d(
this.pointCoordinates[startIndex + indexInGroup * 2],
this.pointCoordinates[startIndex + indexInGroup * 2 + 1]);
} | java | @Pure
public Point2d getPointAt(int groupIndex, int indexInGroup) {
final int startIndex = firstInGroup(groupIndex);
// Besure that the member's index is in the group index's range
final int groupMemberCount = getPointCountInGroup(groupIndex);
if (indexInGroup < 0) {
throw new IndexOutOfBoundsException(indexInGroup + "<0"); //$NON-NLS-1$
}
if (indexInGroup >= groupMemberCount) {
throw new IndexOutOfBoundsException(indexInGroup + ">=" + groupMemberCount); //$NON-NLS-1$
}
return new Point2d(
this.pointCoordinates[startIndex + indexInGroup * 2],
this.pointCoordinates[startIndex + indexInGroup * 2 + 1]);
} | [
"@",
"Pure",
"public",
"Point2d",
"getPointAt",
"(",
"int",
"groupIndex",
",",
"int",
"indexInGroup",
")",
"{",
"final",
"int",
"startIndex",
"=",
"firstInGroup",
"(",
"groupIndex",
")",
";",
"// Besure that the member's index is in the group index's range",
"final",
... | Replies the specified point at the given index in the specified group.
@param groupIndex is the index of the group
@param indexInGroup is the index of the point in the group (0 for the
first point of the group...).
@return the point
@throws IndexOutOfBoundsException in case of error. | [
"Replies",
"the",
"specified",
"point",
"at",
"the",
"given",
"index",
"in",
"the",
"specified",
"group",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L890-L906 |
crawljax/crawljax | core/src/main/java/com/crawljax/stateabstractions/visual/imagehashes/DHash.java | DHash.getDHash | public String getDHash(String object) {
/* OpenCV does not work if you have encoded URLs (e.g., %20 instead of space in the path)
* This fixes the following error:
* CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.3) ...
* error: (-215:Assertion failed) !ssize.empty() in function 'resize'
*/
try {
object = new URI(object).getPath();
} catch (URISyntaxException e) {
e.printStackTrace();
}
/*
* 1. Convert to grayscale. The first step is to convert the input image to grayscale and
* discard any color information. Discarding color enables us to: (1) Hash the image faster
* since we only have to examine one channel (2) Match images that are identical but have
* slightly altered color spaces (since color information has been removed). If, for
* whatever reason, one is interested in keeping the color information, he can run the
* hashing algorithm on each channel independently and then combine at the end (although
* this will result in a 3x larger hash).
*/
Mat objectImage = Imgcodecs.imread(object, Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);
/*
* 2. Resize image. We squash the image down to 9×8 and ignore aspect ratio to ensure that
* the resulting image hash will match similar photos regardless of their initial spatial
* dimensions. Why 9×8? We are implementing difference hash. The difference hash algorithm
* works by computing the difference (i.e., relative gradients) between adjacent pixels. If
* we take an input image with 9 pixels per row and compute the difference between adjacent
* column pixels, we end up with 8 differences. Eight rows of eight differences (i.e., 8×8)
* is 64 which will become our 64-bit hash.
*/
Mat resized = new Mat();
int size = 8;
Imgproc.resize(objectImage, resized, new Size(size + 1, size));
/*
* 3. Compute the difference image. The difference hash algorithm works by computing the
* difference (i.e., relative gradients) between adjacent pixels. In practice we don't
* actually have to compute the difference — we can apply a “greater than” test (or “less
* than”, it doesn't really matter as long as the same operation is consistently used).
*/
String hash = "";
for (int i = 0; i < resized.rows(); i++) {
for (int j = 0; j < resized.cols() - 1; j++) {
double[] pixel_left = resized.get(i, j);
double[] pixel_right = resized.get(i, j + 1);
hash += (pixel_left[0] > pixel_right[0] ? "1" : "0");
}
}
LOG.info("DHash: " + hash);
return hash;
} | java | public String getDHash(String object) {
/* OpenCV does not work if you have encoded URLs (e.g., %20 instead of space in the path)
* This fixes the following error:
* CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.3) ...
* error: (-215:Assertion failed) !ssize.empty() in function 'resize'
*/
try {
object = new URI(object).getPath();
} catch (URISyntaxException e) {
e.printStackTrace();
}
/*
* 1. Convert to grayscale. The first step is to convert the input image to grayscale and
* discard any color information. Discarding color enables us to: (1) Hash the image faster
* since we only have to examine one channel (2) Match images that are identical but have
* slightly altered color spaces (since color information has been removed). If, for
* whatever reason, one is interested in keeping the color information, he can run the
* hashing algorithm on each channel independently and then combine at the end (although
* this will result in a 3x larger hash).
*/
Mat objectImage = Imgcodecs.imread(object, Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);
/*
* 2. Resize image. We squash the image down to 9×8 and ignore aspect ratio to ensure that
* the resulting image hash will match similar photos regardless of their initial spatial
* dimensions. Why 9×8? We are implementing difference hash. The difference hash algorithm
* works by computing the difference (i.e., relative gradients) between adjacent pixels. If
* we take an input image with 9 pixels per row and compute the difference between adjacent
* column pixels, we end up with 8 differences. Eight rows of eight differences (i.e., 8×8)
* is 64 which will become our 64-bit hash.
*/
Mat resized = new Mat();
int size = 8;
Imgproc.resize(objectImage, resized, new Size(size + 1, size));
/*
* 3. Compute the difference image. The difference hash algorithm works by computing the
* difference (i.e., relative gradients) between adjacent pixels. In practice we don't
* actually have to compute the difference — we can apply a “greater than” test (or “less
* than”, it doesn't really matter as long as the same operation is consistently used).
*/
String hash = "";
for (int i = 0; i < resized.rows(); i++) {
for (int j = 0; j < resized.cols() - 1; j++) {
double[] pixel_left = resized.get(i, j);
double[] pixel_right = resized.get(i, j + 1);
hash += (pixel_left[0] > pixel_right[0] ? "1" : "0");
}
}
LOG.info("DHash: " + hash);
return hash;
} | [
"public",
"String",
"getDHash",
"(",
"String",
"object",
")",
"{",
"/* OpenCV does not work if you have encoded URLs (e.g., %20 instead of space in the path)\n\t\t * This fixes the following error:\n\t\t * CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.3) ...\n\t\t * error: (-21... | /* Returns the difference hashing (DHash for short) of the image. | [
"/",
"*",
"Returns",
"the",
"difference",
"hashing",
"(",
"DHash",
"for",
"short",
")",
"of",
"the",
"image",
"."
] | train | https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/stateabstractions/visual/imagehashes/DHash.java#L29-L88 |
structr/structr | structr-core/src/main/java/org/structr/common/geo/GeoHelper.java | GeoHelper.geocode | public static GeoCodingResult geocode(final String street, final String house, String postalCode, final String city, final String state, final String country) throws FrameworkException {
final String language = Settings.GeocodingLanguage.getValue();
final String cacheKey = cacheKey(street, house, postalCode, city, state, country, language);
GeoCodingResult result = geoCache.get(cacheKey);
if (result == null) {
GeoCodingProvider provider = getGeoCodingProvider();
if (provider != null) {
try {
result = provider.geocode(street, house, postalCode, city, state, country, language);
if (result != null) {
// store in cache
geoCache.put(cacheKey, result);
}
} catch (IOException ioex) {
// IOException, try again next time
logger.warn("Unable to obtain geocoding result using provider {}: {}", new Object[] { provider.getClass().getName(), ioex.getMessage() });
}
}
}
return result;
} | java | public static GeoCodingResult geocode(final String street, final String house, String postalCode, final String city, final String state, final String country) throws FrameworkException {
final String language = Settings.GeocodingLanguage.getValue();
final String cacheKey = cacheKey(street, house, postalCode, city, state, country, language);
GeoCodingResult result = geoCache.get(cacheKey);
if (result == null) {
GeoCodingProvider provider = getGeoCodingProvider();
if (provider != null) {
try {
result = provider.geocode(street, house, postalCode, city, state, country, language);
if (result != null) {
// store in cache
geoCache.put(cacheKey, result);
}
} catch (IOException ioex) {
// IOException, try again next time
logger.warn("Unable to obtain geocoding result using provider {}: {}", new Object[] { provider.getClass().getName(), ioex.getMessage() });
}
}
}
return result;
} | [
"public",
"static",
"GeoCodingResult",
"geocode",
"(",
"final",
"String",
"street",
",",
"final",
"String",
"house",
",",
"String",
"postalCode",
",",
"final",
"String",
"city",
",",
"final",
"String",
"state",
",",
"final",
"String",
"country",
")",
"throws",... | Tries do find a geo location for the given address using the GeoCodingProvider
specified in the configuration file.
@param country the country to search for, may be null
@param state the state to search for, may be null
@param city the city to search for, may be null
@param street the street to search for, may be null
@param house the house to search for, may be null
@return the geolocation of the given address, or null
@throws FrameworkException | [
"Tries",
"do",
"find",
"a",
"geo",
"location",
"for",
"the",
"given",
"address",
"using",
"the",
"GeoCodingProvider",
"specified",
"in",
"the",
"configuration",
"file",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/geo/GeoHelper.java#L99-L129 |
threerings/narya | core/src/main/java/com/threerings/bureau/server/BureauRegistry.java | BureauRegistry.setCommandGenerator | public void setCommandGenerator (
String bureauType, final CommandGenerator cmdGenerator, int timeout)
{
setLauncher(bureauType, new Launcher() {
public void launchBureau (String bureauId, String token)
throws IOException {
ProcessBuilder builder = new ProcessBuilder(
cmdGenerator.createCommand(bureauId, token));
builder.redirectErrorStream(true);
Process process = builder.start();
// log the output of the process and prefix with bureau id
new BureauLogRedirector(bureauId, process.getInputStream());
}
@Override
public String toString () {
return "DefaultLauncher for " + cmdGenerator;
}
}, timeout);
} | java | public void setCommandGenerator (
String bureauType, final CommandGenerator cmdGenerator, int timeout)
{
setLauncher(bureauType, new Launcher() {
public void launchBureau (String bureauId, String token)
throws IOException {
ProcessBuilder builder = new ProcessBuilder(
cmdGenerator.createCommand(bureauId, token));
builder.redirectErrorStream(true);
Process process = builder.start();
// log the output of the process and prefix with bureau id
new BureauLogRedirector(bureauId, process.getInputStream());
}
@Override
public String toString () {
return "DefaultLauncher for " + cmdGenerator;
}
}, timeout);
} | [
"public",
"void",
"setCommandGenerator",
"(",
"String",
"bureauType",
",",
"final",
"CommandGenerator",
"cmdGenerator",
",",
"int",
"timeout",
")",
"{",
"setLauncher",
"(",
"bureauType",
",",
"new",
"Launcher",
"(",
")",
"{",
"public",
"void",
"launchBureau",
"(... | Registers a command generator for a given type. When an agent is started and no bureaus are
running, the <code>bureauType</code> is used to determine the <code>CommandGenerator</code>
instance to call. If the launched bureau does not connect within the given number of
milliseconds, it will be logged as an error and future attempts to launch the bureau
will try launching the command again.
@param bureauType the type of bureau that will be launched
@param cmdGenerator the generator to be used for bureaus of <code>bureauType</code>
@param timeout milliseconds to wait for the bureau or 0 to wait forever | [
"Registers",
"a",
"command",
"generator",
"for",
"a",
"given",
"type",
".",
"When",
"an",
"agent",
"is",
"started",
"and",
"no",
"bureaus",
"are",
"running",
"the",
"<code",
">",
"bureauType<",
"/",
"code",
">",
"is",
"used",
"to",
"determine",
"the",
"<... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/bureau/server/BureauRegistry.java#L187-L206 |
lets-blade/blade | src/main/java/com/blade/kit/ConvertKit.java | ConvertKit.string2OutputStream | public static OutputStream string2OutputStream(final String string, final String charsetName) {
if (string == null || isSpace(charsetName)) return null;
try {
return bytes2OutputStream(string.getBytes(charsetName));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
} | java | public static OutputStream string2OutputStream(final String string, final String charsetName) {
if (string == null || isSpace(charsetName)) return null;
try {
return bytes2OutputStream(string.getBytes(charsetName));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
} | [
"public",
"static",
"OutputStream",
"string2OutputStream",
"(",
"final",
"String",
"string",
",",
"final",
"String",
"charsetName",
")",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"isSpace",
"(",
"charsetName",
")",
")",
"return",
"null",
";",
"try",
"{",... | string转outputStream按编码
@param string 字符串
@param charsetName 编码格式
@return 输入流 | [
"string转outputStream按编码"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ConvertKit.java#L389-L397 |
ludovicianul/selenium-on-steroids | src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java | WebDriverHelper.selectOptionFromDropdownByValue | public void selectOptionFromDropdownByValue(final By by, final String value) {
Select select = new Select(driver.findElement(by));
select.selectByValue(value);
} | java | public void selectOptionFromDropdownByValue(final By by, final String value) {
Select select = new Select(driver.findElement(by));
select.selectByValue(value);
} | [
"public",
"void",
"selectOptionFromDropdownByValue",
"(",
"final",
"By",
"by",
",",
"final",
"String",
"value",
")",
"{",
"Select",
"select",
"=",
"new",
"Select",
"(",
"driver",
".",
"findElement",
"(",
"by",
")",
")",
";",
"select",
".",
"selectByValue",
... | Select a value from a drop down list based on the actual value, NOT
DISPLAYED TEXT.
@param by
the method of identifying the drop-down
@param value
the value to select | [
"Select",
"a",
"value",
"from",
"a",
"drop",
"down",
"list",
"based",
"on",
"the",
"actual",
"value",
"NOT",
"DISPLAYED",
"TEXT",
"."
] | train | https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L605-L608 |
phax/ph-css | ph-css/src/main/java/com/helger/css/writer/CSSCompressor.java | CSSCompressor.getRewrittenCSS | @Nonnull
public static String getRewrittenCSS (@Nonnull final String sOriginalCSS, @Nonnull final CSSWriterSettings aSettings)
{
ValueEnforcer.notNull (sOriginalCSS, "OriginalCSS");
ValueEnforcer.notNull (aSettings, "Settings");
final CascadingStyleSheet aCSS = CSSReader.readFromString (sOriginalCSS, aSettings.getVersion ());
if (aCSS != null)
{
try
{
return new CSSWriter (aSettings).getCSSAsString (aCSS);
}
catch (final Exception ex)
{
LOGGER.warn ("Failed to write optimized CSS!", ex);
}
}
return sOriginalCSS;
} | java | @Nonnull
public static String getRewrittenCSS (@Nonnull final String sOriginalCSS, @Nonnull final CSSWriterSettings aSettings)
{
ValueEnforcer.notNull (sOriginalCSS, "OriginalCSS");
ValueEnforcer.notNull (aSettings, "Settings");
final CascadingStyleSheet aCSS = CSSReader.readFromString (sOriginalCSS, aSettings.getVersion ());
if (aCSS != null)
{
try
{
return new CSSWriter (aSettings).getCSSAsString (aCSS);
}
catch (final Exception ex)
{
LOGGER.warn ("Failed to write optimized CSS!", ex);
}
}
return sOriginalCSS;
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getRewrittenCSS",
"(",
"@",
"Nonnull",
"final",
"String",
"sOriginalCSS",
",",
"@",
"Nonnull",
"final",
"CSSWriterSettings",
"aSettings",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sOriginalCSS",
",",
"\"Origina... | Get the rewritten version of the passed CSS code. This is done by
interpreting the CSS and than writing it again with the passed settings.
This can e.g. be used to create a compressed version of a CSS.
@param sOriginalCSS
The original CSS code to be compressed.
@param aSettings
The CSS writer settings to use. The version is used to read the
original CSS.
@return If compression failed because the CSS is invalid or whatsoever, the
original CSS is returned, else the rewritten version is returned. | [
"Get",
"the",
"rewritten",
"version",
"of",
"the",
"passed",
"CSS",
"code",
".",
"This",
"is",
"done",
"by",
"interpreting",
"the",
"CSS",
"and",
"than",
"writing",
"it",
"again",
"with",
"the",
"passed",
"settings",
".",
"This",
"can",
"e",
".",
"g",
... | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/writer/CSSCompressor.java#L98-L117 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java | DiscreteDistributions.negativeBinomial | public static double negativeBinomial(int n, int r, double p) {
//tested its validity with http://www.mathcelebrity.com/binomialneg.php
if(n<0 || r<0 || p<0) {
throw new IllegalArgumentException("All the parameters must be positive.");
}
n = Math.max(n,r);//obvisouly the total number of tries must be larger than the number of required successes
double probability = Arithmetics.combination(n-1, r-1)*Math.pow(1-p,n-r)*Math.pow(p,r);
return probability;
} | java | public static double negativeBinomial(int n, int r, double p) {
//tested its validity with http://www.mathcelebrity.com/binomialneg.php
if(n<0 || r<0 || p<0) {
throw new IllegalArgumentException("All the parameters must be positive.");
}
n = Math.max(n,r);//obvisouly the total number of tries must be larger than the number of required successes
double probability = Arithmetics.combination(n-1, r-1)*Math.pow(1-p,n-r)*Math.pow(p,r);
return probability;
} | [
"public",
"static",
"double",
"negativeBinomial",
"(",
"int",
"n",
",",
"int",
"r",
",",
"double",
"p",
")",
"{",
"//tested its validity with http://www.mathcelebrity.com/binomialneg.php",
"if",
"(",
"n",
"<",
"0",
"||",
"r",
"<",
"0",
"||",
"p",
"<",
"0",
"... | Returns the probability of requiring n tries to achieve r successes with probability of success p
@param n
@param r
@param p
@return | [
"Returns",
"the",
"probability",
"of",
"requiring",
"n",
"tries",
"to",
"achieve",
"r",
"successes",
"with",
"probability",
"of",
"success",
"p"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java#L191-L201 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeValueForRoadType | public static void setPreferredAttributeValueForRoadType(RoadType type, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final String sysDef = getSystemDefault(type);
if (value == null || "".equals(value) || sysDef.equalsIgnoreCase(value)) { //$NON-NLS-1$
prefs.remove("ROAD_TYPE_VALUE_" + type.name()); //$NON-NLS-1$
} else {
prefs.put("ROAD_TYPE_VALUE_" + type.name(), value); //$NON-NLS-1$
}
}
} | java | public static void setPreferredAttributeValueForRoadType(RoadType type, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final String sysDef = getSystemDefault(type);
if (value == null || "".equals(value) || sysDef.equalsIgnoreCase(value)) { //$NON-NLS-1$
prefs.remove("ROAD_TYPE_VALUE_" + type.name()); //$NON-NLS-1$
} else {
prefs.put("ROAD_TYPE_VALUE_" + type.name(), value); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredAttributeValueForRoadType",
"(",
"RoadType",
"type",
",",
"String",
"value",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",... | Set the preferred value of road type
used in the attributes for the types of the roads.
@param type a type
@param value is the preferred name for the types of the roads. | [
"Set",
"the",
"preferred",
"value",
"of",
"road",
"type",
"used",
"in",
"the",
"attributes",
"for",
"the",
"types",
"of",
"the",
"roads",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L720-L730 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.millisToZone | public static Expression millisToZone(Expression expression, String timeZoneName, String format) {
if (format == null || format.isEmpty()) {
return x("MILLIS_TO_ZONE(" + expression.toString() + ", \"" + timeZoneName + "\")");
}
return x("MILLIS_TO_ZONE(" + expression.toString() + ", \"" + timeZoneName + "\"" +
", \"" + format + "\")");
} | java | public static Expression millisToZone(Expression expression, String timeZoneName, String format) {
if (format == null || format.isEmpty()) {
return x("MILLIS_TO_ZONE(" + expression.toString() + ", \"" + timeZoneName + "\")");
}
return x("MILLIS_TO_ZONE(" + expression.toString() + ", \"" + timeZoneName + "\"" +
", \"" + format + "\")");
} | [
"public",
"static",
"Expression",
"millisToZone",
"(",
"Expression",
"expression",
",",
"String",
"timeZoneName",
",",
"String",
"format",
")",
"{",
"if",
"(",
"format",
"==",
"null",
"||",
"format",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"x",
"(",
... | Returned expression results in a convertion of the UNIX time stamp to a string in the named time zone. | [
"Returned",
"expression",
"results",
"in",
"a",
"convertion",
"of",
"the",
"UNIX",
"time",
"stamp",
"to",
"a",
"string",
"in",
"the",
"named",
"time",
"zone",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L269-L275 |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/JDBCUtil.java | JDBCUtil.getColumnDefaultValue | public static String getColumnDefaultValue (Connection conn, String table, String column)
throws SQLException
{
ResultSet rs = getColumnMetaData(conn, table, column);
try {
return rs.getString("COLUMN_DEF");
} finally {
rs.close();
}
} | java | public static String getColumnDefaultValue (Connection conn, String table, String column)
throws SQLException
{
ResultSet rs = getColumnMetaData(conn, table, column);
try {
return rs.getString("COLUMN_DEF");
} finally {
rs.close();
}
} | [
"public",
"static",
"String",
"getColumnDefaultValue",
"(",
"Connection",
"conn",
",",
"String",
"table",
",",
"String",
"column",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"rs",
"=",
"getColumnMetaData",
"(",
"conn",
",",
"table",
",",
"column",
")",
"... | Returns a string representation of the default value for the specified column in the
specified table. This may be null. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"default",
"value",
"for",
"the",
"specified",
"column",
"in",
"the",
"specified",
"table",
".",
"This",
"may",
"be",
"null",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/JDBCUtil.java#L466-L475 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java | MavenModelScannerPlugin.addActivation | private void addActivation(MavenProfileDescriptor mavenProfileDescriptor, Activation activation, Store store) {
if (null == activation) {
return;
}
MavenProfileActivationDescriptor profileActivationDescriptor = store.create(MavenProfileActivationDescriptor.class);
mavenProfileDescriptor.setActivation(profileActivationDescriptor);
profileActivationDescriptor.setJdk(activation.getJdk());
profileActivationDescriptor.setActiveByDefault(activation.isActiveByDefault());
ActivationFile activationFile = activation.getFile();
if (null != activationFile) {
MavenActivationFileDescriptor activationFileDescriptor = store.create(MavenActivationFileDescriptor.class);
profileActivationDescriptor.setActivationFile(activationFileDescriptor);
activationFileDescriptor.setExists(activationFile.getExists());
activationFileDescriptor.setMissing(activationFile.getMissing());
}
ActivationOS os = activation.getOs();
if (null != os) {
MavenActivationOSDescriptor osDescriptor = store.create(MavenActivationOSDescriptor.class);
profileActivationDescriptor.setActivationOS(osDescriptor);
osDescriptor.setArch(os.getArch());
osDescriptor.setFamily(os.getFamily());
osDescriptor.setName(os.getName());
osDescriptor.setVersion(os.getVersion());
}
ActivationProperty property = activation.getProperty();
if (null != property) {
PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
profileActivationDescriptor.setProperty(propertyDescriptor);
propertyDescriptor.setName(property.getName());
propertyDescriptor.setValue(property.getValue());
}
} | java | private void addActivation(MavenProfileDescriptor mavenProfileDescriptor, Activation activation, Store store) {
if (null == activation) {
return;
}
MavenProfileActivationDescriptor profileActivationDescriptor = store.create(MavenProfileActivationDescriptor.class);
mavenProfileDescriptor.setActivation(profileActivationDescriptor);
profileActivationDescriptor.setJdk(activation.getJdk());
profileActivationDescriptor.setActiveByDefault(activation.isActiveByDefault());
ActivationFile activationFile = activation.getFile();
if (null != activationFile) {
MavenActivationFileDescriptor activationFileDescriptor = store.create(MavenActivationFileDescriptor.class);
profileActivationDescriptor.setActivationFile(activationFileDescriptor);
activationFileDescriptor.setExists(activationFile.getExists());
activationFileDescriptor.setMissing(activationFile.getMissing());
}
ActivationOS os = activation.getOs();
if (null != os) {
MavenActivationOSDescriptor osDescriptor = store.create(MavenActivationOSDescriptor.class);
profileActivationDescriptor.setActivationOS(osDescriptor);
osDescriptor.setArch(os.getArch());
osDescriptor.setFamily(os.getFamily());
osDescriptor.setName(os.getName());
osDescriptor.setVersion(os.getVersion());
}
ActivationProperty property = activation.getProperty();
if (null != property) {
PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
profileActivationDescriptor.setProperty(propertyDescriptor);
propertyDescriptor.setName(property.getName());
propertyDescriptor.setValue(property.getValue());
}
} | [
"private",
"void",
"addActivation",
"(",
"MavenProfileDescriptor",
"mavenProfileDescriptor",
",",
"Activation",
"activation",
",",
"Store",
"store",
")",
"{",
"if",
"(",
"null",
"==",
"activation",
")",
"{",
"return",
";",
"}",
"MavenProfileActivationDescriptor",
"p... | Adds activation information for the given profile.
@param mavenProfileDescriptor
The profile descriptor.
@param activation
The activation information.
@param store
The database. | [
"Adds",
"activation",
"information",
"for",
"the",
"given",
"profile",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L191-L224 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/parser/impl/GeldKarteParser.java | GeldKarteParser.readEfBetrag | protected void readEfBetrag(final Application pApplication) throws CommunicationException {
// 00 B2 01 C4 00
byte[] data = template.get().getProvider()
.transceive(new CommandApdu(CommandEnum.READ_RECORD, 0x01, 0xC4, 0).toBytes());
// Check response
if (ResponseUtils.isSucceed(data)) {
pApplication.setAmount(Float.parseFloat(String.format("%02x%02x%02x", data[0], data[1], data[2]))/100.0f);
}
} | java | protected void readEfBetrag(final Application pApplication) throws CommunicationException {
// 00 B2 01 C4 00
byte[] data = template.get().getProvider()
.transceive(new CommandApdu(CommandEnum.READ_RECORD, 0x01, 0xC4, 0).toBytes());
// Check response
if (ResponseUtils.isSucceed(data)) {
pApplication.setAmount(Float.parseFloat(String.format("%02x%02x%02x", data[0], data[1], data[2]))/100.0f);
}
} | [
"protected",
"void",
"readEfBetrag",
"(",
"final",
"Application",
"pApplication",
")",
"throws",
"CommunicationException",
"{",
"// 00 B2 01 C4 00",
"byte",
"[",
"]",
"data",
"=",
"template",
".",
"get",
"(",
")",
".",
"getProvider",
"(",
")",
".",
"transceive",... | read EF_BETRAG
@param pApplication EMV application
@throws CommunicationException communication error | [
"read",
"EF_BETRAG"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/impl/GeldKarteParser.java#L178-L186 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/tasks/net/ThreadBoundJschLogger.java | ThreadBoundJschLogger.setThreadLogger | private void setThreadLogger(PluginLogger logger, int loggingLevel) {
pluginLogger.set(logger);
logLevel.set(loggingLevel);
JSch.setLogger(this);
} | java | private void setThreadLogger(PluginLogger logger, int loggingLevel) {
pluginLogger.set(logger);
logLevel.set(loggingLevel);
JSch.setLogger(this);
} | [
"private",
"void",
"setThreadLogger",
"(",
"PluginLogger",
"logger",
",",
"int",
"loggingLevel",
")",
"{",
"pluginLogger",
".",
"set",
"(",
"logger",
")",
";",
"logLevel",
".",
"set",
"(",
"loggingLevel",
")",
";",
"JSch",
".",
"setLogger",
"(",
"this",
")... | Set the thread-inherited logger with a loglevel on Jsch
@param logger logger
@param loggingLevel level | [
"Set",
"the",
"thread",
"-",
"inherited",
"logger",
"with",
"a",
"loglevel",
"on",
"Jsch"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/tasks/net/ThreadBoundJschLogger.java#L89-L93 |
apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/LauncherUtils.java | LauncherUtils.getSchedulerInstance | public IScheduler getSchedulerInstance(Config config, Config runtime)
throws SchedulerException {
String schedulerClass = Context.schedulerClass(config);
IScheduler scheduler;
try {
// create an instance of scheduler
scheduler = ReflectionUtils.newInstance(schedulerClass);
} catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
throw new SchedulerException(String.format("Failed to instantiate scheduler using class '%s'",
schedulerClass));
}
scheduler.initialize(config, runtime);
return scheduler;
} | java | public IScheduler getSchedulerInstance(Config config, Config runtime)
throws SchedulerException {
String schedulerClass = Context.schedulerClass(config);
IScheduler scheduler;
try {
// create an instance of scheduler
scheduler = ReflectionUtils.newInstance(schedulerClass);
} catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
throw new SchedulerException(String.format("Failed to instantiate scheduler using class '%s'",
schedulerClass));
}
scheduler.initialize(config, runtime);
return scheduler;
} | [
"public",
"IScheduler",
"getSchedulerInstance",
"(",
"Config",
"config",
",",
"Config",
"runtime",
")",
"throws",
"SchedulerException",
"{",
"String",
"schedulerClass",
"=",
"Context",
".",
"schedulerClass",
"(",
"config",
")",
";",
"IScheduler",
"scheduler",
";",
... | Creates and initializes scheduler instance
@return initialized scheduler instances | [
"Creates",
"and",
"initializes",
"scheduler",
"instance"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/LauncherUtils.java#L117-L131 |
samskivert/pythagoras | src/main/java/pythagoras/d/RectangularShape.java | RectangularShape.setFrameFromDiagonal | public void setFrameFromDiagonal (XY p1, XY p2) {
setFrameFromDiagonal(p1.x(), p1.y(), p2.x(), p2.y());
} | java | public void setFrameFromDiagonal (XY p1, XY p2) {
setFrameFromDiagonal(p1.x(), p1.y(), p2.x(), p2.y());
} | [
"public",
"void",
"setFrameFromDiagonal",
"(",
"XY",
"p1",
",",
"XY",
"p2",
")",
"{",
"setFrameFromDiagonal",
"(",
"p1",
".",
"x",
"(",
")",
",",
"p1",
".",
"y",
"(",
")",
",",
"p2",
".",
"x",
"(",
")",
",",
"p2",
".",
"y",
"(",
")",
")",
";"... | Sets the location and size of the framing rectangle of this shape based on the supplied
diagonal line. | [
"Sets",
"the",
"location",
"and",
"size",
"of",
"the",
"framing",
"rectangle",
"of",
"this",
"shape",
"based",
"on",
"the",
"supplied",
"diagonal",
"line",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/RectangularShape.java#L60-L62 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyFinder.java | DependencyFinder.getArtifactFile | public static File getArtifactFile(AbstractWisdomMojo mojo, String artifactId, String type) {
File file = getArtifactFileFromProjectDependencies(mojo, artifactId, type);
if (file == null) {
file = getArtifactFileFromPluginDependencies(mojo, artifactId, type);
}
return file;
} | java | public static File getArtifactFile(AbstractWisdomMojo mojo, String artifactId, String type) {
File file = getArtifactFileFromProjectDependencies(mojo, artifactId, type);
if (file == null) {
file = getArtifactFileFromPluginDependencies(mojo, artifactId, type);
}
return file;
} | [
"public",
"static",
"File",
"getArtifactFile",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"String",
"artifactId",
",",
"String",
"type",
")",
"{",
"File",
"file",
"=",
"getArtifactFileFromProjectDependencies",
"(",
"mojo",
",",
"artifactId",
",",
"type",
")",
";",
... | Gets the file of the dependency with the given artifact id from the project dependencies and if not found from
the plugin dependencies. This method also check the extension.
@param mojo the mojo
@param artifactId the name of the artifact to find
@param type the extension of the artifact to find
@return the artifact file, null if not found | [
"Gets",
"the",
"file",
"of",
"the",
"dependency",
"with",
"the",
"given",
"artifact",
"id",
"from",
"the",
"project",
"dependencies",
"and",
"if",
"not",
"found",
"from",
"the",
"plugin",
"dependencies",
".",
"This",
"method",
"also",
"check",
"the",
"extens... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyFinder.java#L97-L103 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java | CertificatesInner.listByIotHub | public CertificateListDescriptionInner listByIotHub(String resourceGroupName, String resourceName) {
return listByIotHubWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | java | public CertificateListDescriptionInner listByIotHub(String resourceGroupName, String resourceName) {
return listByIotHubWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | [
"public",
"CertificateListDescriptionInner",
"listByIotHub",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"listByIotHubWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"toBlocking",
"(",
")",
"."... | Get the certificate list.
Returns the list of certificates.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorDetailsException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateListDescriptionInner object if successful. | [
"Get",
"the",
"certificate",
"list",
".",
"Returns",
"the",
"list",
"of",
"certificates",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java#L97-L99 |
JavaMoney/jsr354-api | src/main/java/javax/money/CurrencyQueryBuilder.java | CurrencyQueryBuilder.setCountries | public CurrencyQueryBuilder setCountries(Locale... countries) {
return set(CurrencyQuery.KEY_QUERY_COUNTRIES, Arrays.asList(countries));
} | java | public CurrencyQueryBuilder setCountries(Locale... countries) {
return set(CurrencyQuery.KEY_QUERY_COUNTRIES, Arrays.asList(countries));
} | [
"public",
"CurrencyQueryBuilder",
"setCountries",
"(",
"Locale",
"...",
"countries",
")",
"{",
"return",
"set",
"(",
"CurrencyQuery",
".",
"KEY_QUERY_COUNTRIES",
",",
"Arrays",
".",
"asList",
"(",
"countries",
")",
")",
";",
"}"
] | Sets the country for which currencies should be requested.
@param countries The ISO countries.
@return the query for chaining. | [
"Sets",
"the",
"country",
"for",
"which",
"currencies",
"should",
"be",
"requested",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/CurrencyQueryBuilder.java#L58-L60 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/CacheHashMap.java | CacheHashMap.createSessionAttributeKey | @Trivial
private static final String createSessionAttributeKey(String sessionId, String attributeId) {
return new StringBuilder(sessionId.length() + 1 + attributeId.length())
.append(sessionId)
.append('.')
.append(attributeId)
.toString();
} | java | @Trivial
private static final String createSessionAttributeKey(String sessionId, String attributeId) {
return new StringBuilder(sessionId.length() + 1 + attributeId.length())
.append(sessionId)
.append('.')
.append(attributeId)
.toString();
} | [
"@",
"Trivial",
"private",
"static",
"final",
"String",
"createSessionAttributeKey",
"(",
"String",
"sessionId",
",",
"String",
"attributeId",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
"sessionId",
".",
"length",
"(",
")",
"+",
"1",
"+",
"attributeId",
... | Create a key for a session attribute, of the form: SessionId.AttributeId
@param sessionId the session id
@param attributeId the session attribute
@return the key | [
"Create",
"a",
"key",
"for",
"a",
"session",
"attribute",
"of",
"the",
"form",
":",
"SessionId",
".",
"AttributeId"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/CacheHashMap.java#L255-L262 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbCertifications.java | TmdbCertifications.getMoviesCertification | public ResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.CERTIFICATION).subMethod(MethodSub.MOVIE_LIST).buildUrl();
String webpage = httpTools.getRequest(url);
try {
JsonNode node = MAPPER.readTree(webpage);
Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
});
return new ResultsMap<>(results);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie certifications", url, ex);
}
} | java | public ResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException {
URL url = new ApiUrl(apiKey, MethodBase.CERTIFICATION).subMethod(MethodSub.MOVIE_LIST).buildUrl();
String webpage = httpTools.getRequest(url);
try {
JsonNode node = MAPPER.readTree(webpage);
Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
});
return new ResultsMap<>(results);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie certifications", url, ex);
}
} | [
"public",
"ResultsMap",
"<",
"String",
",",
"List",
"<",
"Certification",
">",
">",
"getMoviesCertification",
"(",
")",
"throws",
"MovieDbException",
"{",
"URL",
"url",
"=",
"new",
"ApiUrl",
"(",
"apiKey",
",",
"MethodBase",
".",
"CERTIFICATION",
")",
".",
"... | Get a list of movies certification.
@return
@throws MovieDbException | [
"Get",
"a",
"list",
"of",
"movies",
"certification",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbCertifications.java#L60-L72 |
spring-projects/spring-security-oauth | spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/client/CoreOAuthConsumerSupport.java | CoreOAuthConsumerSupport.configureURLForProtectedAccess | protected URL configureURLForProtectedAccess(URL url, OAuthConsumerToken requestToken, ProtectedResourceDetails details, String httpMethod, Map<String, String> additionalParameters) {
String file;
if (!"POST".equalsIgnoreCase(httpMethod) && !"PUT".equalsIgnoreCase(httpMethod) && !details.isAcceptsAuthorizationHeader()) {
StringBuilder fileb = new StringBuilder(url.getPath());
String queryString = getOAuthQueryString(details, requestToken, url, httpMethod, additionalParameters);
fileb.append('?').append(queryString);
file = fileb.toString();
}
else {
file = url.getFile();
}
try {
if ("http".equalsIgnoreCase(url.getProtocol())) {
URLStreamHandler streamHandler = getStreamHandlerFactory().getHttpStreamHandler(details, requestToken, this, httpMethod, additionalParameters);
return new URL(url.getProtocol(), url.getHost(), url.getPort(), file, streamHandler);
}
else if ("https".equalsIgnoreCase(url.getProtocol())) {
URLStreamHandler streamHandler = getStreamHandlerFactory().getHttpsStreamHandler(details, requestToken, this, httpMethod, additionalParameters);
return new URL(url.getProtocol(), url.getHost(), url.getPort(), file, streamHandler);
}
else {
throw new OAuthRequestFailedException("Unsupported OAuth protocol: " + url.getProtocol());
}
}
catch (MalformedURLException e) {
throw new IllegalStateException(e);
}
} | java | protected URL configureURLForProtectedAccess(URL url, OAuthConsumerToken requestToken, ProtectedResourceDetails details, String httpMethod, Map<String, String> additionalParameters) {
String file;
if (!"POST".equalsIgnoreCase(httpMethod) && !"PUT".equalsIgnoreCase(httpMethod) && !details.isAcceptsAuthorizationHeader()) {
StringBuilder fileb = new StringBuilder(url.getPath());
String queryString = getOAuthQueryString(details, requestToken, url, httpMethod, additionalParameters);
fileb.append('?').append(queryString);
file = fileb.toString();
}
else {
file = url.getFile();
}
try {
if ("http".equalsIgnoreCase(url.getProtocol())) {
URLStreamHandler streamHandler = getStreamHandlerFactory().getHttpStreamHandler(details, requestToken, this, httpMethod, additionalParameters);
return new URL(url.getProtocol(), url.getHost(), url.getPort(), file, streamHandler);
}
else if ("https".equalsIgnoreCase(url.getProtocol())) {
URLStreamHandler streamHandler = getStreamHandlerFactory().getHttpsStreamHandler(details, requestToken, this, httpMethod, additionalParameters);
return new URL(url.getProtocol(), url.getHost(), url.getPort(), file, streamHandler);
}
else {
throw new OAuthRequestFailedException("Unsupported OAuth protocol: " + url.getProtocol());
}
}
catch (MalformedURLException e) {
throw new IllegalStateException(e);
}
} | [
"protected",
"URL",
"configureURLForProtectedAccess",
"(",
"URL",
"url",
",",
"OAuthConsumerToken",
"requestToken",
",",
"ProtectedResourceDetails",
"details",
",",
"String",
"httpMethod",
",",
"Map",
"<",
"String",
",",
"String",
">",
"additionalParameters",
")",
"{"... | Internal use of configuring the URL for protected access, the resource details already having been loaded.
@param url The URL.
@param requestToken The request token.
@param details The details.
@param httpMethod The http method.
@param additionalParameters Any additional request parameters.
@return The configured URL. | [
"Internal",
"use",
"of",
"configuring",
"the",
"URL",
"for",
"protected",
"access",
"the",
"resource",
"details",
"already",
"having",
"been",
"loaded",
"."
] | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/client/CoreOAuthConsumerSupport.java#L272-L300 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/util/NetworkUtil.java | NetworkUtil.checkMethod | private static Boolean checkMethod(NetworkInterface iface, Method toCheck) {
if (toCheck != null) {
try {
return (Boolean) toCheck.invoke(iface, (Object[]) null);
} catch (IllegalAccessException e) {
return false;
} catch (InvocationTargetException e) {
return false;
}
}
// Cannot check, hence we assume that is true
return true;
} | java | private static Boolean checkMethod(NetworkInterface iface, Method toCheck) {
if (toCheck != null) {
try {
return (Boolean) toCheck.invoke(iface, (Object[]) null);
} catch (IllegalAccessException e) {
return false;
} catch (InvocationTargetException e) {
return false;
}
}
// Cannot check, hence we assume that is true
return true;
} | [
"private",
"static",
"Boolean",
"checkMethod",
"(",
"NetworkInterface",
"iface",
",",
"Method",
"toCheck",
")",
"{",
"if",
"(",
"toCheck",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"(",
"Boolean",
")",
"toCheck",
".",
"invoke",
"(",
"iface",
",",
"("... | Call a method and return the result as boolean. In case of problems, return false. | [
"Call",
"a",
"method",
"and",
"return",
"the",
"result",
"as",
"boolean",
".",
"In",
"case",
"of",
"problems",
"return",
"false",
"."
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/util/NetworkUtil.java#L221-L233 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/TimestampPool.java | TimestampPool.getOrAddToCache | public Timestamp getOrAddToCache(Timestamp newValue, boolean hard)
{
if (newValue == null || newValue instanceof CachedImmutableTimestamp || newValue == NullDataTimestamp.getInstance())
{
return newValue;
}
return (Timestamp) weakPool.getIfAbsentPut(newValue, hard);
} | java | public Timestamp getOrAddToCache(Timestamp newValue, boolean hard)
{
if (newValue == null || newValue instanceof CachedImmutableTimestamp || newValue == NullDataTimestamp.getInstance())
{
return newValue;
}
return (Timestamp) weakPool.getIfAbsentPut(newValue, hard);
} | [
"public",
"Timestamp",
"getOrAddToCache",
"(",
"Timestamp",
"newValue",
",",
"boolean",
"hard",
")",
"{",
"if",
"(",
"newValue",
"==",
"null",
"||",
"newValue",
"instanceof",
"CachedImmutableTimestamp",
"||",
"newValue",
"==",
"NullDataTimestamp",
".",
"getInstance"... | return the pooled value
@param newValue the value to look up in the pool and add if not there
@return the pooled value | [
"return",
"the",
"pooled",
"value"
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/TimestampPool.java#L59-L66 |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/CapsuleLauncher.java | CapsuleLauncher.newCapsule | public Capsule newCapsule(String mode, Path wrappedJar) {
final String oldMode = properties.getProperty(PROP_MODE);
final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(capsuleClass.getClassLoader());
try {
setProperty(PROP_MODE, mode);
final Constructor<?> ctor = accessible(capsuleClass.getDeclaredConstructor(Path.class));
final Object capsule = ctor.newInstance(jarFile);
if (wrappedJar != null) {
final Method setTarget = accessible(capsuleClass.getDeclaredMethod("setTarget", Path.class));
setTarget.invoke(capsule, wrappedJar);
}
return wrap(capsule);
} catch (ReflectiveOperationException e) {
throw new RuntimeException("Could not create capsule instance.", e);
} finally {
setProperty(PROP_MODE, oldMode);
Thread.currentThread().setContextClassLoader(oldCl);
}
} | java | public Capsule newCapsule(String mode, Path wrappedJar) {
final String oldMode = properties.getProperty(PROP_MODE);
final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(capsuleClass.getClassLoader());
try {
setProperty(PROP_MODE, mode);
final Constructor<?> ctor = accessible(capsuleClass.getDeclaredConstructor(Path.class));
final Object capsule = ctor.newInstance(jarFile);
if (wrappedJar != null) {
final Method setTarget = accessible(capsuleClass.getDeclaredMethod("setTarget", Path.class));
setTarget.invoke(capsule, wrappedJar);
}
return wrap(capsule);
} catch (ReflectiveOperationException e) {
throw new RuntimeException("Could not create capsule instance.", e);
} finally {
setProperty(PROP_MODE, oldMode);
Thread.currentThread().setContextClassLoader(oldCl);
}
} | [
"public",
"Capsule",
"newCapsule",
"(",
"String",
"mode",
",",
"Path",
"wrappedJar",
")",
"{",
"final",
"String",
"oldMode",
"=",
"properties",
".",
"getProperty",
"(",
"PROP_MODE",
")",
";",
"final",
"ClassLoader",
"oldCl",
"=",
"Thread",
".",
"currentThread"... | Creates a new capsule
@param mode the capsule mode, or {@code null} for the default mode
@param wrappedJar a path to a capsule JAR that will be launched (wrapped) by the empty capsule in {@code jarFile}
or {@code null} if no wrapped capsule is wanted
@return the capsule. | [
"Creates",
"a",
"new",
"capsule"
] | train | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/CapsuleLauncher.java#L137-L159 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MapLayer.java | MapLayer.fireLayerAttributeChangedEvent | public void fireLayerAttributeChangedEvent(String attributeName, Object oldValue, Object newValue) {
if (isEventFirable()) {
final AttributeChangeEvent.Type eType;
if (oldValue == null && newValue != null) {
eType = AttributeChangeEvent.Type.ADDITION;
} else if (oldValue != null && newValue == null) {
eType = AttributeChangeEvent.Type.REMOVAL;
} else {
eType = AttributeChangeEvent.Type.VALUE_UPDATE;
}
final AttributeChangeEvent e = new AttributeChangeEvent(
this,
eType,
attributeName,
new AttributeValueImpl(oldValue),
attributeName,
new AttributeValueImpl(newValue));
final MapLayerAttributeChangeEvent le = new MapLayerAttributeChangeEvent(this, e);
fireLayerAttributeChangedEvent(le);
}
} | java | public void fireLayerAttributeChangedEvent(String attributeName, Object oldValue, Object newValue) {
if (isEventFirable()) {
final AttributeChangeEvent.Type eType;
if (oldValue == null && newValue != null) {
eType = AttributeChangeEvent.Type.ADDITION;
} else if (oldValue != null && newValue == null) {
eType = AttributeChangeEvent.Type.REMOVAL;
} else {
eType = AttributeChangeEvent.Type.VALUE_UPDATE;
}
final AttributeChangeEvent e = new AttributeChangeEvent(
this,
eType,
attributeName,
new AttributeValueImpl(oldValue),
attributeName,
new AttributeValueImpl(newValue));
final MapLayerAttributeChangeEvent le = new MapLayerAttributeChangeEvent(this, e);
fireLayerAttributeChangedEvent(le);
}
} | [
"public",
"void",
"fireLayerAttributeChangedEvent",
"(",
"String",
"attributeName",
",",
"Object",
"oldValue",
",",
"Object",
"newValue",
")",
"{",
"if",
"(",
"isEventFirable",
"(",
")",
")",
"{",
"final",
"AttributeChangeEvent",
".",
"Type",
"eType",
";",
"if",... | Forward to the parent layer the event that indicates the content of a child layer was changed.
Only the {@link MapLayerListener} and the container are notified.
@param attributeName is the name of the changed attribute.
@param oldValue is the old value of the attribute.
@param newValue is the new value of the attribute. | [
"Forward",
"to",
"the",
"parent",
"layer",
"the",
"event",
"that",
"indicates",
"the",
"content",
"of",
"a",
"child",
"layer",
"was",
"changed",
".",
"Only",
"the",
"{",
"@link",
"MapLayerListener",
"}",
"and",
"the",
"container",
"are",
"notified",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MapLayer.java#L339-L359 |
payneteasy/superfly | superfly-service/src/main/java/com/payneteasy/superfly/spring/velocity/VelocityEngineFactory.java | VelocityEngineFactory.setVelocityPropertiesMap | public void setVelocityPropertiesMap(Map<String, Object> velocityPropertiesMap) {
if (velocityPropertiesMap != null) {
this.velocityProperties.putAll(velocityPropertiesMap);
}
} | java | public void setVelocityPropertiesMap(Map<String, Object> velocityPropertiesMap) {
if (velocityPropertiesMap != null) {
this.velocityProperties.putAll(velocityPropertiesMap);
}
} | [
"public",
"void",
"setVelocityPropertiesMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"velocityPropertiesMap",
")",
"{",
"if",
"(",
"velocityPropertiesMap",
"!=",
"null",
")",
"{",
"this",
".",
"velocityProperties",
".",
"putAll",
"(",
"velocityPropertiesMa... | Set Velocity properties as Map, to allow for non-String values
like "ds.resource.loader.instance".
@see #setVelocityProperties | [
"Set",
"Velocity",
"properties",
"as",
"Map",
"to",
"allow",
"for",
"non",
"-",
"String",
"values",
"like",
"ds",
".",
"resource",
".",
"loader",
".",
"instance",
"."
] | train | https://github.com/payneteasy/superfly/blob/4cad6d0f8e951a61f3c302c49b13a51d179076f8/superfly-service/src/main/java/com/payneteasy/superfly/spring/velocity/VelocityEngineFactory.java#L123-L127 |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java | AbstractMoskitoAspect.createClassLevelAccumulators | private void createClassLevelAccumulators(final OnDemandStatsProducer<S> producer, final Class producerClass) {
//several @AccumulateWithSubClasses in accumulators holder
final AccumulatesWithSubClasses accWSCAnnotationHolder = AnnotationUtils.findAnnotation(producerClass, AccumulatesWithSubClasses.class);
if (accWSCAnnotationHolder != null) {
createAccumulators(producer, producerClass, accWSCAnnotationHolder.value());
}
//If there is no @AccumulatesWithSubClasses annotation but @Accumulate is present
final AccumulateWithSubClasses accumulateWSC = AnnotationUtils.findAnnotation(producerClass, AccumulateWithSubClasses.class);
createAccumulators(producer, producerClass, accumulateWSC);
//several @Accumulate in accumulators holder
final Accumulates accAnnotationHolder = AnnotationUtils.findAnnotation(producerClass, Accumulates.class);
if (accAnnotationHolder != null) {
createAccumulators(producer, null, accAnnotationHolder.value());
}
//If there is no @Accumulates annotation but @Accumulate is present
final Accumulate annotation = AnnotationUtils.findAnnotation(producerClass, Accumulate.class);
createAccumulators(producer, null, annotation);
} | java | private void createClassLevelAccumulators(final OnDemandStatsProducer<S> producer, final Class producerClass) {
//several @AccumulateWithSubClasses in accumulators holder
final AccumulatesWithSubClasses accWSCAnnotationHolder = AnnotationUtils.findAnnotation(producerClass, AccumulatesWithSubClasses.class);
if (accWSCAnnotationHolder != null) {
createAccumulators(producer, producerClass, accWSCAnnotationHolder.value());
}
//If there is no @AccumulatesWithSubClasses annotation but @Accumulate is present
final AccumulateWithSubClasses accumulateWSC = AnnotationUtils.findAnnotation(producerClass, AccumulateWithSubClasses.class);
createAccumulators(producer, producerClass, accumulateWSC);
//several @Accumulate in accumulators holder
final Accumulates accAnnotationHolder = AnnotationUtils.findAnnotation(producerClass, Accumulates.class);
if (accAnnotationHolder != null) {
createAccumulators(producer, null, accAnnotationHolder.value());
}
//If there is no @Accumulates annotation but @Accumulate is present
final Accumulate annotation = AnnotationUtils.findAnnotation(producerClass, Accumulate.class);
createAccumulators(producer, null, annotation);
} | [
"private",
"void",
"createClassLevelAccumulators",
"(",
"final",
"OnDemandStatsProducer",
"<",
"S",
">",
"producer",
",",
"final",
"Class",
"producerClass",
")",
"{",
"//several @AccumulateWithSubClasses in accumulators holder",
"final",
"AccumulatesWithSubClasses",
"accWSCAnno... | Create accumulators for class.
@param producer
{@link OnDemandStatsProducer}
@param producerClass
producer class | [
"Create",
"accumulators",
"for",
"class",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java#L232-L253 |
jtablesaw/tablesaw | core/src/main/java/tech/tablesaw/io/fixed/FixedWidthReader.java | FixedWidthReader.detectColumnTypes | public ColumnType[] detectColumnTypes(Reader reader, FixedWidthReadOptions options) {
boolean header = options.header();
int linesToSkip = header ? 1 : 0;
AbstractParser<?> parser = fixedWidthParser(options);
try {
return getTypes(reader, options, linesToSkip, parser);
} finally {
parser.stopParsing();
// we don't close the reader since we didn't create it
}
} | java | public ColumnType[] detectColumnTypes(Reader reader, FixedWidthReadOptions options) {
boolean header = options.header();
int linesToSkip = header ? 1 : 0;
AbstractParser<?> parser = fixedWidthParser(options);
try {
return getTypes(reader, options, linesToSkip, parser);
} finally {
parser.stopParsing();
// we don't close the reader since we didn't create it
}
} | [
"public",
"ColumnType",
"[",
"]",
"detectColumnTypes",
"(",
"Reader",
"reader",
",",
"FixedWidthReadOptions",
"options",
")",
"{",
"boolean",
"header",
"=",
"options",
".",
"header",
"(",
")",
";",
"int",
"linesToSkip",
"=",
"header",
"?",
"1",
":",
"0",
"... | Estimates and returns the type for each column in the delimited text file {@code file}
<p>
The type is determined by checking a sample of the data in the file. Because only a sample of the data is
checked,
the types may be incorrect. If that is the case a Parse Exception will be thrown.
<p>
The method {@code printColumnTypes()} can be used to print a list of the detected columns that can be
corrected and
used to explicitly specify the correct column types. | [
"Estimates",
"and",
"returns",
"the",
"type",
"for",
"each",
"column",
"in",
"the",
"delimited",
"text",
"file",
"{"
] | train | https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/io/fixed/FixedWidthReader.java#L145-L158 |
tomasbjerre/git-changelog-lib | src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java | GitChangelogApi.withCustomIssue | public GitChangelogApi withCustomIssue(
final String name, final String pattern, final String link, final String title) {
this.settings.addCustomIssue(new SettingsIssue(name, pattern, link, title));
return this;
} | java | public GitChangelogApi withCustomIssue(
final String name, final String pattern, final String link, final String title) {
this.settings.addCustomIssue(new SettingsIssue(name, pattern, link, title));
return this;
} | [
"public",
"GitChangelogApi",
"withCustomIssue",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"pattern",
",",
"final",
"String",
"link",
",",
"final",
"String",
"title",
")",
"{",
"this",
".",
"settings",
".",
"addCustomIssue",
"(",
"new",
"SettingsI... | Custom issues are added to support any kind of issue management, perhaps something that is
internal to your project. See {@link SettingsIssue}. | [
"Custom",
"issues",
"are",
"added",
"to",
"support",
"any",
"kind",
"of",
"issue",
"management",
"perhaps",
"something",
"that",
"is",
"internal",
"to",
"your",
"project",
".",
"See",
"{"
] | train | https://github.com/tomasbjerre/git-changelog-lib/blob/e6b26d29592a57bd53fe98fbe4a56d8c2267a192/src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java#L156-L160 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.initialize | public void initialize(URI name, Configuration conf) throws IOException {
statistics = getStatistics(name.getScheme(), getClass());
} | java | public void initialize(URI name, Configuration conf) throws IOException {
statistics = getStatistics(name.getScheme(), getClass());
} | [
"public",
"void",
"initialize",
"(",
"URI",
"name",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"statistics",
"=",
"getStatistics",
"(",
"name",
".",
"getScheme",
"(",
")",
",",
"getClass",
"(",
")",
")",
";",
"}"
] | Called after a new FileSystem instance is constructed.
@param name a uri whose authority section names the host, port, etc.
for this FileSystem
@param conf the configuration | [
"Called",
"after",
"a",
"new",
"FileSystem",
"instance",
"is",
"constructed",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L141-L143 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/connection/HttpConnection.java | HttpConnection.getConnection | protected HttpURLConnection getConnection() {
try {
HttpURLConnection connection;
if (proxy != null) {
connection = (HttpURLConnection) sentryUrl.openConnection(proxy);
} else {
connection = (HttpURLConnection) sentryUrl.openConnection();
}
if (bypassSecurity && connection instanceof HttpsURLConnection) {
((HttpsURLConnection) connection).setHostnameVerifier(NAIVE_VERIFIER);
}
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setConnectTimeout(connectionTimeout);
connection.setReadTimeout(readTimeout);
connection.setRequestProperty(USER_AGENT, SentryEnvironment.getSentryName());
connection.setRequestProperty(SENTRY_AUTH, getAuthHeader());
if (marshaller.getContentType() != null) {
connection.setRequestProperty("Content-Type", marshaller.getContentType());
}
if (marshaller.getContentEncoding() != null) {
connection.setRequestProperty("Content-Encoding", marshaller.getContentEncoding());
}
return connection;
} catch (IOException e) {
throw new IllegalStateException("Couldn't set up a connection to the Sentry server.", e);
}
} | java | protected HttpURLConnection getConnection() {
try {
HttpURLConnection connection;
if (proxy != null) {
connection = (HttpURLConnection) sentryUrl.openConnection(proxy);
} else {
connection = (HttpURLConnection) sentryUrl.openConnection();
}
if (bypassSecurity && connection instanceof HttpsURLConnection) {
((HttpsURLConnection) connection).setHostnameVerifier(NAIVE_VERIFIER);
}
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setConnectTimeout(connectionTimeout);
connection.setReadTimeout(readTimeout);
connection.setRequestProperty(USER_AGENT, SentryEnvironment.getSentryName());
connection.setRequestProperty(SENTRY_AUTH, getAuthHeader());
if (marshaller.getContentType() != null) {
connection.setRequestProperty("Content-Type", marshaller.getContentType());
}
if (marshaller.getContentEncoding() != null) {
connection.setRequestProperty("Content-Encoding", marshaller.getContentEncoding());
}
return connection;
} catch (IOException e) {
throw new IllegalStateException("Couldn't set up a connection to the Sentry server.", e);
}
} | [
"protected",
"HttpURLConnection",
"getConnection",
"(",
")",
"{",
"try",
"{",
"HttpURLConnection",
"connection",
";",
"if",
"(",
"proxy",
"!=",
"null",
")",
"{",
"connection",
"=",
"(",
"HttpURLConnection",
")",
"sentryUrl",
".",
"openConnection",
"(",
"proxy",
... | Opens a connection to the Sentry API allowing to send new events.
@return an HTTP connection to Sentry. | [
"Opens",
"a",
"connection",
"to",
"the",
"Sentry",
"API",
"allowing",
"to",
"send",
"new",
"events",
"."
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/connection/HttpConnection.java#L127-L158 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/xtend-gen/org/eclipse/xtext/xbase/validation/UniqueClassNameValidator.java | UniqueClassNameValidator.addIssue | protected void addIssue(final JvmDeclaredType type, final String fileName) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("The type ");
String _simpleName = type.getSimpleName();
_builder.append(_simpleName);
_builder.append(" is already defined");
{
if ((fileName != null)) {
_builder.append(" in ");
_builder.append(fileName);
}
}
_builder.append(".");
final String message = _builder.toString();
final EObject sourceElement = this.associations.getPrimarySourceElement(type);
if ((sourceElement == null)) {
this.addIssue(message, type, IssueCodes.DUPLICATE_TYPE);
} else {
final EStructuralFeature feature = sourceElement.eClass().getEStructuralFeature("name");
this.addIssue(message, sourceElement, feature, IssueCodes.DUPLICATE_TYPE);
}
} | java | protected void addIssue(final JvmDeclaredType type, final String fileName) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("The type ");
String _simpleName = type.getSimpleName();
_builder.append(_simpleName);
_builder.append(" is already defined");
{
if ((fileName != null)) {
_builder.append(" in ");
_builder.append(fileName);
}
}
_builder.append(".");
final String message = _builder.toString();
final EObject sourceElement = this.associations.getPrimarySourceElement(type);
if ((sourceElement == null)) {
this.addIssue(message, type, IssueCodes.DUPLICATE_TYPE);
} else {
final EStructuralFeature feature = sourceElement.eClass().getEStructuralFeature("name");
this.addIssue(message, sourceElement, feature, IssueCodes.DUPLICATE_TYPE);
}
} | [
"protected",
"void",
"addIssue",
"(",
"final",
"JvmDeclaredType",
"type",
",",
"final",
"String",
"fileName",
")",
"{",
"StringConcatenation",
"_builder",
"=",
"new",
"StringConcatenation",
"(",
")",
";",
"_builder",
".",
"append",
"(",
"\"The type \"",
")",
";"... | Marks a type as already defined.
@param type - the type to mark already defined.
@param fileName - a file where the type is already defined.
If fileName is null this information will not be part of the message. | [
"Marks",
"a",
"type",
"as",
"already",
"defined",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/xtend-gen/org/eclipse/xtext/xbase/validation/UniqueClassNameValidator.java#L138-L159 |
spring-cloud/spring-cloud-netflix | spring-cloud-netflix-ribbon/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonUtils.java | RibbonUtils.updateToHttpsIfNeeded | public static URI updateToHttpsIfNeeded(URI uri, IClientConfig config,
ServerIntrospector serverIntrospector, Server server) {
return updateToSecureConnectionIfNeeded(uri, config, serverIntrospector, server);
} | java | public static URI updateToHttpsIfNeeded(URI uri, IClientConfig config,
ServerIntrospector serverIntrospector, Server server) {
return updateToSecureConnectionIfNeeded(uri, config, serverIntrospector, server);
} | [
"public",
"static",
"URI",
"updateToHttpsIfNeeded",
"(",
"URI",
"uri",
",",
"IClientConfig",
"config",
",",
"ServerIntrospector",
"serverIntrospector",
",",
"Server",
"server",
")",
"{",
"return",
"updateToSecureConnectionIfNeeded",
"(",
"uri",
",",
"config",
",",
"... | Replace the scheme to https if needed. If the uri doesn't start with https and
{@link #isSecure(IClientConfig, ServerIntrospector, Server)} is true, update the
scheme. This assumes the uri is already encoded to avoid double encoding.
@param uri to modify if required
@param config Ribbon {@link IClientConfig} configuration
@param serverIntrospector used to verify if the server provides secure connections
@param server to verify
@return {@link URI} updated to https if necessary
@deprecated use {@link #updateToSecureConnectionIfNeeded} | [
"Replace",
"the",
"scheme",
"to",
"https",
"if",
"needed",
".",
"If",
"the",
"uri",
"doesn",
"t",
"start",
"with",
"https",
"and",
"{"
] | train | https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-ribbon/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonUtils.java#L120-L123 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Reflector.java | Reflector.getProperty | public static Object getProperty(Object obj, String prop) throws PageException {
Object rtn = getField(obj, prop, NULL);// NULL is used because the field can contain null as well
if (rtn != NULL) return rtn;
char first = prop.charAt(0);
if (first >= '0' && first <= '9') throw new ApplicationException("there is no property with name [" + prop + "] found in [" + Caster.toTypeName(obj) + "]");
return callGetter(obj, prop);
} | java | public static Object getProperty(Object obj, String prop) throws PageException {
Object rtn = getField(obj, prop, NULL);// NULL is used because the field can contain null as well
if (rtn != NULL) return rtn;
char first = prop.charAt(0);
if (first >= '0' && first <= '9') throw new ApplicationException("there is no property with name [" + prop + "] found in [" + Caster.toTypeName(obj) + "]");
return callGetter(obj, prop);
} | [
"public",
"static",
"Object",
"getProperty",
"(",
"Object",
"obj",
",",
"String",
"prop",
")",
"throws",
"PageException",
"{",
"Object",
"rtn",
"=",
"getField",
"(",
"obj",
",",
"prop",
",",
"NULL",
")",
";",
"// NULL is used because the field can contain null as ... | to get a visible Propety (Field or Getter) of a object
@param obj Object to invoke
@param prop property to call
@return property value
@throws PageException | [
"to",
"get",
"a",
"visible",
"Propety",
"(",
"Field",
"or",
"Getter",
")",
"of",
"a",
"object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1197-L1205 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java | JPAUtils.findJoinedType | public static <T, K> Join<T, K> findJoinedType(CriteriaQuery<T> query, Class<T> rootClass, Class<K> joinClass) {
Root<T> root = findRoot(query, rootClass);
return findJoinedType(root, rootClass, joinClass);
} | java | public static <T, K> Join<T, K> findJoinedType(CriteriaQuery<T> query, Class<T> rootClass, Class<K> joinClass) {
Root<T> root = findRoot(query, rootClass);
return findJoinedType(root, rootClass, joinClass);
} | [
"public",
"static",
"<",
"T",
",",
"K",
">",
"Join",
"<",
"T",
",",
"K",
">",
"findJoinedType",
"(",
"CriteriaQuery",
"<",
"T",
">",
"query",
",",
"Class",
"<",
"T",
">",
"rootClass",
",",
"Class",
"<",
"K",
">",
"joinClass",
")",
"{",
"Root",
"<... | Find Joined Root of type clazz
@param <T>
@param query the criteria query
@param rootClass the root class
@param joinClass the join class
@return the Join | [
"Find",
"Joined",
"Root",
"of",
"type",
"clazz"
] | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java#L138-L141 |
apereo/cas | core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java | PolicyBasedAuthenticationManager.authenticateAndResolvePrincipal | protected void authenticateAndResolvePrincipal(final AuthenticationBuilder builder,
final Credential credential,
final PrincipalResolver resolver,
final AuthenticationHandler handler) throws GeneralSecurityException, PreventedException {
publishEvent(new CasAuthenticationTransactionStartedEvent(this, credential));
val result = handler.authenticate(credential);
val authenticationHandlerName = handler.getName();
builder.addSuccess(authenticationHandlerName, result);
LOGGER.debug("Authentication handler [{}] successfully authenticated [{}]", authenticationHandlerName, credential);
publishEvent(new CasAuthenticationTransactionSuccessfulEvent(this, credential));
var principal = result.getPrincipal();
val resolverName = resolver != null ? resolver.getName(): "N/A";
if (resolver == null) {
LOGGER.debug("No principal resolution is configured for [{}]. Falling back to handler principal [{}]", authenticationHandlerName, principal);
} else {
principal = resolvePrincipal(handler, resolver, credential, principal);
if (principal == null) {
if (this.principalResolutionFailureFatal) {
LOGGER.warn("Principal resolution handled by [{}] produced a null principal for: [{}]"
+ "CAS is configured to treat principal resolution failures as fatal.", resolverName, credential);
throw new UnresolvedPrincipalException();
}
LOGGER.warn("Principal resolution handled by [{}] produced a null principal. "
+ "This is likely due to misconfiguration or missing attributes; CAS will attempt to use the principal "
+ "produced by the authentication handler, if any.", resolver.getClass().getSimpleName());
}
}
if (principal == null) {
LOGGER.warn("Principal resolution for authentication by [{}] produced a null principal.", authenticationHandlerName);
} else {
builder.setPrincipal(principal);
}
LOGGER.debug("Final principal resolved for this authentication event is [{}]", principal);
publishEvent(new CasAuthenticationPrincipalResolvedEvent(this, principal));
} | java | protected void authenticateAndResolvePrincipal(final AuthenticationBuilder builder,
final Credential credential,
final PrincipalResolver resolver,
final AuthenticationHandler handler) throws GeneralSecurityException, PreventedException {
publishEvent(new CasAuthenticationTransactionStartedEvent(this, credential));
val result = handler.authenticate(credential);
val authenticationHandlerName = handler.getName();
builder.addSuccess(authenticationHandlerName, result);
LOGGER.debug("Authentication handler [{}] successfully authenticated [{}]", authenticationHandlerName, credential);
publishEvent(new CasAuthenticationTransactionSuccessfulEvent(this, credential));
var principal = result.getPrincipal();
val resolverName = resolver != null ? resolver.getName(): "N/A";
if (resolver == null) {
LOGGER.debug("No principal resolution is configured for [{}]. Falling back to handler principal [{}]", authenticationHandlerName, principal);
} else {
principal = resolvePrincipal(handler, resolver, credential, principal);
if (principal == null) {
if (this.principalResolutionFailureFatal) {
LOGGER.warn("Principal resolution handled by [{}] produced a null principal for: [{}]"
+ "CAS is configured to treat principal resolution failures as fatal.", resolverName, credential);
throw new UnresolvedPrincipalException();
}
LOGGER.warn("Principal resolution handled by [{}] produced a null principal. "
+ "This is likely due to misconfiguration or missing attributes; CAS will attempt to use the principal "
+ "produced by the authentication handler, if any.", resolver.getClass().getSimpleName());
}
}
if (principal == null) {
LOGGER.warn("Principal resolution for authentication by [{}] produced a null principal.", authenticationHandlerName);
} else {
builder.setPrincipal(principal);
}
LOGGER.debug("Final principal resolved for this authentication event is [{}]", principal);
publishEvent(new CasAuthenticationPrincipalResolvedEvent(this, principal));
} | [
"protected",
"void",
"authenticateAndResolvePrincipal",
"(",
"final",
"AuthenticationBuilder",
"builder",
",",
"final",
"Credential",
"credential",
",",
"final",
"PrincipalResolver",
"resolver",
",",
"final",
"AuthenticationHandler",
"handler",
")",
"throws",
"GeneralSecuri... | Authenticate and resolve principal.
@param builder the builder
@param credential the credential
@param resolver the resolver
@param handler the handler
@throws GeneralSecurityException the general security exception
@throws PreventedException the prevented exception | [
"Authenticate",
"and",
"resolve",
"principal",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java#L191-L230 |
infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/TransactionalSharedLuceneLock.java | TransactionalSharedLuceneLock.commitTransactions | private void commitTransactions() throws IOException {
try {
tm.commit();
}
catch (Exception e) {
log.unableToCommitTransaction(e);
throw new IOException("SharedLuceneLock could not commit a transaction", e);
}
if (trace) {
log.tracef("Batch transaction committed for index: %s", indexName);
}
} | java | private void commitTransactions() throws IOException {
try {
tm.commit();
}
catch (Exception e) {
log.unableToCommitTransaction(e);
throw new IOException("SharedLuceneLock could not commit a transaction", e);
}
if (trace) {
log.tracef("Batch transaction committed for index: %s", indexName);
}
} | [
"private",
"void",
"commitTransactions",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"tm",
".",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"unableToCommitTransaction",
"(",
"e",
")",
";",
"throw",
"new",
... | Commits the existing transaction.
It's illegal to call this if a transaction was not started.
@throws IOException wraps Infinispan exceptions to adapt to Lucene's API | [
"Commits",
"the",
"existing",
"transaction",
".",
"It",
"s",
"illegal",
"to",
"call",
"this",
"if",
"a",
"transaction",
"was",
"not",
"started",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/TransactionalSharedLuceneLock.java#L128-L139 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageSender.java | RemoteMessageSender.init | public void init(RemoteTask server, BaseMessageQueue baseMessageQueue)
throws RemoteException
{
super.init(baseMessageQueue);
m_sendQueue = server.createRemoteSendQueue(baseMessageQueue.getQueueName(), baseMessageQueue.getQueueType());
} | java | public void init(RemoteTask server, BaseMessageQueue baseMessageQueue)
throws RemoteException
{
super.init(baseMessageQueue);
m_sendQueue = server.createRemoteSendQueue(baseMessageQueue.getQueueName(), baseMessageQueue.getQueueType());
} | [
"public",
"void",
"init",
"(",
"RemoteTask",
"server",
",",
"BaseMessageQueue",
"baseMessageQueue",
")",
"throws",
"RemoteException",
"{",
"super",
".",
"init",
"(",
"baseMessageQueue",
")",
";",
"m_sendQueue",
"=",
"server",
".",
"createRemoteSendQueue",
"(",
"ba... | Creates new MessageSender.
@param server The remote server.
@param baseMessageQueue My parent message queue. | [
"Creates",
"new",
"MessageSender",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageSender.java#L55-L60 |
real-logic/agrona | agrona/src/main/java/org/agrona/IoUtil.java | IoUtil.checkFileExists | public static void checkFileExists(final File file, final String name)
{
if (!file.exists())
{
final String msg = "missing file for " + name + " : " + file.getAbsolutePath();
throw new IllegalStateException(msg);
}
} | java | public static void checkFileExists(final File file, final String name)
{
if (!file.exists())
{
final String msg = "missing file for " + name + " : " + file.getAbsolutePath();
throw new IllegalStateException(msg);
}
} | [
"public",
"static",
"void",
"checkFileExists",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"final",
"String",
"msg",
"=",
"\"missing file for \"",
"+",
"name",
"+",
... | Check that a file exists and throw an exception if not.
@param file to check existence of.
@param name to associate for the exception | [
"Check",
"that",
"a",
"file",
"exists",
"and",
"throw",
"an",
"exception",
"if",
"not",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/IoUtil.java#L425-L432 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java | ConstructorBuilder.buildSignature | public void buildSignature(XMLNode node, Content constructorDocTree) {
constructorDocTree.addContent(writer.getSignature(currentConstructor));
} | java | public void buildSignature(XMLNode node, Content constructorDocTree) {
constructorDocTree.addContent(writer.getSignature(currentConstructor));
} | [
"public",
"void",
"buildSignature",
"(",
"XMLNode",
"node",
",",
"Content",
"constructorDocTree",
")",
"{",
"constructorDocTree",
".",
"addContent",
"(",
"writer",
".",
"getSignature",
"(",
"currentConstructor",
")",
")",
";",
"}"
] | Build the signature.
@param node the XML element that specifies which components to document
@param constructorDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"signature",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java#L179-L181 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/Strings.java | Strings.removeWord | public static String removeWord(final String host, final String word, final String delimiter) {
if (host.indexOf(word) == -1) {
return host;
} else {
int beginIndex = host.indexOf(word);
int endIndex = beginIndex + word.length();
if (beginIndex == 0) { return host.substring(endIndex + 1); }
if (endIndex == host.length()) {
return host.substring(0, beginIndex - delimiter.length());
} else {
String before = host.substring(0, beginIndex);
String after = host.substring(endIndex + 1);
return before + after;
}
}
} | java | public static String removeWord(final String host, final String word, final String delimiter) {
if (host.indexOf(word) == -1) {
return host;
} else {
int beginIndex = host.indexOf(word);
int endIndex = beginIndex + word.length();
if (beginIndex == 0) { return host.substring(endIndex + 1); }
if (endIndex == host.length()) {
return host.substring(0, beginIndex - delimiter.length());
} else {
String before = host.substring(0, beginIndex);
String after = host.substring(endIndex + 1);
return before + after;
}
}
} | [
"public",
"static",
"String",
"removeWord",
"(",
"final",
"String",
"host",
",",
"final",
"String",
"word",
",",
"final",
"String",
"delimiter",
")",
"{",
"if",
"(",
"host",
".",
"indexOf",
"(",
"word",
")",
"==",
"-",
"1",
")",
"{",
"return",
"host",
... | <p>
removeWord.
</p>
@param host
a {@link java.lang.String} object.
@param word
a {@link java.lang.String} object.
@param delimiter
a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"<p",
">",
"removeWord",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L648-L663 |
infinispan/infinispan | core/src/main/java/org/infinispan/distribution/ch/impl/ScatteredConsistentHashFactory.java | ScatteredConsistentHashFactory.union | @Override
public ScatteredConsistentHash union(ScatteredConsistentHash dch1, ScatteredConsistentHash dch2) {
return dch1.union(dch2);
} | java | @Override
public ScatteredConsistentHash union(ScatteredConsistentHash dch1, ScatteredConsistentHash dch2) {
return dch1.union(dch2);
} | [
"@",
"Override",
"public",
"ScatteredConsistentHash",
"union",
"(",
"ScatteredConsistentHash",
"dch1",
",",
"ScatteredConsistentHash",
"dch2",
")",
"{",
"return",
"dch1",
".",
"union",
"(",
"dch2",
")",
";",
"}"
] | Merges two consistent hash objects that have the same number of segments, numOwners and hash function.
For each segment, the primary owner of the first CH has priority, the other primary owners become backups. | [
"Merges",
"two",
"consistent",
"hash",
"objects",
"that",
"have",
"the",
"same",
"number",
"of",
"segments",
"numOwners",
"and",
"hash",
"function",
".",
"For",
"each",
"segment",
"the",
"primary",
"owner",
"of",
"the",
"first",
"CH",
"has",
"priority",
"the... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/distribution/ch/impl/ScatteredConsistentHashFactory.java#L101-L104 |
devnied/Bit-lib4j | src/main/java/fr/devnied/bitlib/BitUtils.java | BitUtils.setNextInteger | public void setNextInteger(final int pValue, final int pLength) {
if (pLength > Integer.SIZE) {
throw new IllegalArgumentException("Integer overflow with length > 32");
}
setNextValue(pValue, pLength, Integer.SIZE - 1);
} | java | public void setNextInteger(final int pValue, final int pLength) {
if (pLength > Integer.SIZE) {
throw new IllegalArgumentException("Integer overflow with length > 32");
}
setNextValue(pValue, pLength, Integer.SIZE - 1);
} | [
"public",
"void",
"setNextInteger",
"(",
"final",
"int",
"pValue",
",",
"final",
"int",
"pLength",
")",
"{",
"if",
"(",
"pLength",
">",
"Integer",
".",
"SIZE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Integer overflow with length > 32\"",
")... | Add Integer to the current position with the specified size
Be careful with java integer bit sign
@param pValue
the value to set
@param pLength
the length of the integer | [
"Add",
"Integer",
"to",
"the",
"current",
"position",
"with",
"the",
"specified",
"size"
] | train | https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BitUtils.java#L629-L636 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java | AbstractEJBRuntime.countInterfaces | private int countInterfaces(BeanMetaData bmd, boolean local) // F743-23167
{
// Note that these variables must be kept in sync with bindInterfaces.
String homeInterfaceClassName = local ? bmd.localHomeInterfaceClassName : bmd.homeInterfaceClassName;
boolean hasLocalBean = local && bmd.ivLocalBean;
String[] businessInterfaceNames = local ? bmd.ivBusinessLocalInterfaceClassNames : bmd.ivBusinessRemoteInterfaceClassNames;
int result = (homeInterfaceClassName == null ? 0 : 1) +
(hasLocalBean ? 1 : 0) +
(businessInterfaceNames == null ? 0 : businessInterfaceNames.length);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "countInterfaces: " + bmd.j2eeName + ", local=" + local + ", result=" + result);
return result;
} | java | private int countInterfaces(BeanMetaData bmd, boolean local) // F743-23167
{
// Note that these variables must be kept in sync with bindInterfaces.
String homeInterfaceClassName = local ? bmd.localHomeInterfaceClassName : bmd.homeInterfaceClassName;
boolean hasLocalBean = local && bmd.ivLocalBean;
String[] businessInterfaceNames = local ? bmd.ivBusinessLocalInterfaceClassNames : bmd.ivBusinessRemoteInterfaceClassNames;
int result = (homeInterfaceClassName == null ? 0 : 1) +
(hasLocalBean ? 1 : 0) +
(businessInterfaceNames == null ? 0 : businessInterfaceNames.length);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "countInterfaces: " + bmd.j2eeName + ", local=" + local + ", result=" + result);
return result;
} | [
"private",
"int",
"countInterfaces",
"(",
"BeanMetaData",
"bmd",
",",
"boolean",
"local",
")",
"// F743-23167",
"{",
"// Note that these variables must be kept in sync with bindInterfaces.",
"String",
"homeInterfaceClassName",
"=",
"local",
"?",
"bmd",
".",
"localHomeInterfac... | Determine the number of remote or local interfaces exposed by a bean.
@param bmd the bean
@param local <tt>true</tt> if local interfaces should be counted, or
<tt>false</tt> if remote interfaces should be counted
@return the number of remote or local interfaces | [
"Determine",
"the",
"number",
"of",
"remote",
"or",
"local",
"interfaces",
"exposed",
"by",
"a",
"bean",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java#L874-L888 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java | ClusterJoinManager.validateJoinRequest | private boolean validateJoinRequest(JoinRequest joinRequest, Address target) {
if (clusterService.isMaster()) {
try {
node.getNodeExtension().validateJoinRequest(joinRequest);
} catch (Exception e) {
logger.warning(e.getMessage());
nodeEngine.getOperationService().send(new BeforeJoinCheckFailureOp(e.getMessage()), target);
return false;
}
}
return true;
} | java | private boolean validateJoinRequest(JoinRequest joinRequest, Address target) {
if (clusterService.isMaster()) {
try {
node.getNodeExtension().validateJoinRequest(joinRequest);
} catch (Exception e) {
logger.warning(e.getMessage());
nodeEngine.getOperationService().send(new BeforeJoinCheckFailureOp(e.getMessage()), target);
return false;
}
}
return true;
} | [
"private",
"boolean",
"validateJoinRequest",
"(",
"JoinRequest",
"joinRequest",
",",
"Address",
"target",
")",
"{",
"if",
"(",
"clusterService",
".",
"isMaster",
"(",
")",
")",
"{",
"try",
"{",
"node",
".",
"getNodeExtension",
"(",
")",
".",
"validateJoinReque... | Invoked from master node while executing a join request to validate it, delegating to
{@link com.hazelcast.instance.NodeExtension#validateJoinRequest(JoinMessage)} | [
"Invoked",
"from",
"master",
"node",
"while",
"executing",
"a",
"join",
"request",
"to",
"validate",
"it",
"delegating",
"to",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java#L386-L397 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java | AbstractHibernateCriteriaBuilder.groupProperty | public org.grails.datastore.mapping.query.api.ProjectionList groupProperty(String propertyName, String alias) {
final PropertyProjection proj = Projections.groupProperty(calculatePropertyName(propertyName));
addProjectionToList(proj, alias);
return this;
} | java | public org.grails.datastore.mapping.query.api.ProjectionList groupProperty(String propertyName, String alias) {
final PropertyProjection proj = Projections.groupProperty(calculatePropertyName(propertyName));
addProjectionToList(proj, alias);
return this;
} | [
"public",
"org",
".",
"grails",
".",
"datastore",
".",
"mapping",
".",
"query",
".",
"api",
".",
"ProjectionList",
"groupProperty",
"(",
"String",
"propertyName",
",",
"String",
"alias",
")",
"{",
"final",
"PropertyProjection",
"proj",
"=",
"Projections",
".",... | Adds a projection that allows the criteria's result to be grouped by a property
@param propertyName The name of the property
@param alias The alias to use | [
"Adds",
"a",
"projection",
"that",
"allows",
"the",
"criteria",
"s",
"result",
"to",
"be",
"grouped",
"by",
"a",
"property"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L451-L455 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPOptimizer.java | AFPOptimizer.updateScore | public static void updateScore(FatCatParameters params, AFPChain afpChain)
{
int i, j, bknow, bkold, g1, g2;
afpChain.setConn(0d);
afpChain.setDVar(0d);
int blockNum = afpChain.getBlockNum();
int alignScoreUpdate = 0;
double[] blockScore = afpChain.getBlockScore();
int[] blockGap = afpChain.getBlockGap();
int[] blockSize =afpChain.getBlockSize();
int[] afpChainList = afpChain.getAfpChainList();
List<AFP>afpSet = afpChain.getAfpSet();
int[] block2Afp = afpChain.getBlock2Afp();
double torsionPenalty = params.getTorsionPenalty();
bkold = 0;
for(i = 0; i < blockNum; i ++) {
blockScore[i] = 0;
blockGap[i] = 0;
for(j = 0; j < blockSize[i]; j ++) {
bknow = afpChainList[block2Afp[i] + j];
if(j == 0) {
blockScore[i] = afpSet.get(bknow).getScore();
}
else {
AFPChainer.afpPairConn(bkold, bknow, params, afpChain); //note: j, i
Double conn = afpChain.getConn();
blockScore[i] += afpSet.get(bknow).getScore() + conn;
g1 = afpSet.get(bknow).getP1() - afpSet.get(bkold).getP1() - afpSet.get(bkold).getFragLen();
g2 = afpSet.get(bknow).getP2() - afpSet.get(bkold).getP2() - afpSet.get(bkold).getFragLen();
blockGap[i] += (g1 > g2)?g1:g2;
}
bkold = bknow;
}
alignScoreUpdate += blockScore[i];
}
if(blockNum >= 2) {
alignScoreUpdate += (blockNum - 1) * torsionPenalty;
}
afpChain.setBlockGap(blockGap);
afpChain.setAlignScoreUpdate(alignScoreUpdate);
afpChain.setBlockScore(blockScore);
afpChain.setBlockSize(blockSize);
afpChain.setAfpChainList(afpChainList);
afpChain.setBlock2Afp(block2Afp);
} | java | public static void updateScore(FatCatParameters params, AFPChain afpChain)
{
int i, j, bknow, bkold, g1, g2;
afpChain.setConn(0d);
afpChain.setDVar(0d);
int blockNum = afpChain.getBlockNum();
int alignScoreUpdate = 0;
double[] blockScore = afpChain.getBlockScore();
int[] blockGap = afpChain.getBlockGap();
int[] blockSize =afpChain.getBlockSize();
int[] afpChainList = afpChain.getAfpChainList();
List<AFP>afpSet = afpChain.getAfpSet();
int[] block2Afp = afpChain.getBlock2Afp();
double torsionPenalty = params.getTorsionPenalty();
bkold = 0;
for(i = 0; i < blockNum; i ++) {
blockScore[i] = 0;
blockGap[i] = 0;
for(j = 0; j < blockSize[i]; j ++) {
bknow = afpChainList[block2Afp[i] + j];
if(j == 0) {
blockScore[i] = afpSet.get(bknow).getScore();
}
else {
AFPChainer.afpPairConn(bkold, bknow, params, afpChain); //note: j, i
Double conn = afpChain.getConn();
blockScore[i] += afpSet.get(bknow).getScore() + conn;
g1 = afpSet.get(bknow).getP1() - afpSet.get(bkold).getP1() - afpSet.get(bkold).getFragLen();
g2 = afpSet.get(bknow).getP2() - afpSet.get(bkold).getP2() - afpSet.get(bkold).getFragLen();
blockGap[i] += (g1 > g2)?g1:g2;
}
bkold = bknow;
}
alignScoreUpdate += blockScore[i];
}
if(blockNum >= 2) {
alignScoreUpdate += (blockNum - 1) * torsionPenalty;
}
afpChain.setBlockGap(blockGap);
afpChain.setAlignScoreUpdate(alignScoreUpdate);
afpChain.setBlockScore(blockScore);
afpChain.setBlockSize(blockSize);
afpChain.setAfpChainList(afpChainList);
afpChain.setBlock2Afp(block2Afp);
} | [
"public",
"static",
"void",
"updateScore",
"(",
"FatCatParameters",
"params",
",",
"AFPChain",
"afpChain",
")",
"{",
"int",
"i",
",",
"j",
",",
"bknow",
",",
"bkold",
",",
"g1",
",",
"g2",
";",
"afpChain",
".",
"setConn",
"(",
"0d",
")",
";",
"afpChain... | to update the chaining score after block delete and merge processed
the blockScore value is important for significance evaluation | [
"to",
"update",
"the",
"chaining",
"score",
"after",
"block",
"delete",
"and",
"merge",
"processed",
"the",
"blockScore",
"value",
"is",
"important",
"for",
"significance",
"evaluation"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPOptimizer.java#L209-L260 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/annotation/AnnotationValue.java | AnnotationValue.getAnnotation | public @Nonnull final <T extends Annotation> Optional<AnnotationValue<T>> getAnnotation(String member, Class<T> type) {
return getAnnotations(member, type).stream().findFirst();
} | java | public @Nonnull final <T extends Annotation> Optional<AnnotationValue<T>> getAnnotation(String member, Class<T> type) {
return getAnnotations(member, type).stream().findFirst();
} | [
"public",
"@",
"Nonnull",
"final",
"<",
"T",
"extends",
"Annotation",
">",
"Optional",
"<",
"AnnotationValue",
"<",
"T",
">",
">",
"getAnnotation",
"(",
"String",
"member",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"getAnnotations",
"(",
"... | Gets a list of {@link AnnotationValue} for the given member.
@param member The member
@param type The type
@param <T> The type
@throws IllegalStateException If no member is available that conforms to the given name and type
@return The result | [
"Gets",
"a",
"list",
"of",
"{",
"@link",
"AnnotationValue",
"}",
"for",
"the",
"given",
"member",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/annotation/AnnotationValue.java#L264-L266 |
Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java | CustomHeadersInterceptor.replaceHeader | public CustomHeadersInterceptor replaceHeader(String name, String value) {
this.headers.put(name, new ArrayList<String>());
this.headers.get(name).add(value);
return this;
} | java | public CustomHeadersInterceptor replaceHeader(String name, String value) {
this.headers.put(name, new ArrayList<String>());
this.headers.get(name).add(value);
return this;
} | [
"public",
"CustomHeadersInterceptor",
"replaceHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"this",
".",
"headers",
".",
"put",
"(",
"name",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
")",
";",
"this",
".",
"headers",
".",... | Add a single header key-value pair. If one with the name already exists,
it gets replaced.
@param name the name of the header.
@param value the value of the header.
@return the interceptor instance itself. | [
"Add",
"a",
"single",
"header",
"key",
"-",
"value",
"pair",
".",
"If",
"one",
"with",
"the",
"name",
"already",
"exists",
"it",
"gets",
"replaced",
"."
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java#L64-L68 |
jhalterman/failsafe | src/main/java/net/jodah/failsafe/CircuitBreaker.java | CircuitBreaker.withSuccessThreshold | public synchronized CircuitBreaker<R> withSuccessThreshold(int successes, int executions) {
Assert.isTrue(successes >= 1, "successes must be greater than or equal to 1");
Assert.isTrue(executions >= 1, "executions must be greater than or equal to 1");
Assert.isTrue(executions >= successes, "executions must be greater than or equal to successes");
this.successThreshold = new Ratio(successes, executions);
state.get().setSuccessThreshold(successThreshold);
return this;
} | java | public synchronized CircuitBreaker<R> withSuccessThreshold(int successes, int executions) {
Assert.isTrue(successes >= 1, "successes must be greater than or equal to 1");
Assert.isTrue(executions >= 1, "executions must be greater than or equal to 1");
Assert.isTrue(executions >= successes, "executions must be greater than or equal to successes");
this.successThreshold = new Ratio(successes, executions);
state.get().setSuccessThreshold(successThreshold);
return this;
} | [
"public",
"synchronized",
"CircuitBreaker",
"<",
"R",
">",
"withSuccessThreshold",
"(",
"int",
"successes",
",",
"int",
"executions",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"successes",
">=",
"1",
",",
"\"successes must be greater than or equal to 1\"",
")",
";",
... | Sets the ratio of successive successful executions that must occur when in a half-open state in order to close the
circuit. For example: 5, 10 would close the circuit if 5 out of the last 10 executions were successful. The circuit
will not be closed until at least the given number of {@code executions} have taken place.
@param successes The number of successful executions that must occur in order to open the circuit
@param executions The number of executions to measure the {@code successes} against
@throws IllegalArgumentException if {@code successes} < 1, {@code executions} < 1, or {@code successes} is >
{@code executions} | [
"Sets",
"the",
"ratio",
"of",
"successive",
"successful",
"executions",
"that",
"must",
"occur",
"when",
"in",
"a",
"half",
"-",
"open",
"state",
"in",
"order",
"to",
"close",
"the",
"circuit",
".",
"For",
"example",
":",
"5",
"10",
"would",
"close",
"th... | train | https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/CircuitBreaker.java#L343-L350 |
att/AAF | authz/authz-gui/src/main/java/com/att/authz/gui/AuthGUI.java | AuthGUI.startDME2 | public void startDME2(Properties props) throws DME2Exception, CadiException {
DME2Manager dme2 = new DME2Manager("AAF GUI DME2Manager", props);
DME2ServiceHolder svcHolder;
List<DME2ServletHolder> slist = new ArrayList<DME2ServletHolder>();
svcHolder = new DME2ServiceHolder();
String serviceName = env.getProperty("DMEServiceName",null);
if(serviceName!=null) {
svcHolder.setServiceURI(serviceName);
svcHolder.setManager(dme2);
svcHolder.setContext("/");
DME2ServletHolder srvHolder = new DME2ServletHolder(this, new String[]{"/gui"});
srvHolder.setContextPath("/*");
slist.add(srvHolder);
EnumSet<RequestDispatcherType> edlist = EnumSet.of(
RequestDispatcherType.REQUEST,
RequestDispatcherType.FORWARD,
RequestDispatcherType.ASYNC
);
///////////////////////
// Apply Filters
///////////////////////
List<DME2FilterHolder> flist = new ArrayList<DME2FilterHolder>();
// Secure all GUI interactions with AuthzTransFilter
flist.add(new DME2FilterHolder(new AuthzTransFilter(env, aafCon, new AAFTrustChecker(
env.getProperty(Config.CADI_TRUST_PROP, Config.CADI_USER_CHAIN),
Define.ROOT_NS + ".mechid|"+Define.ROOT_COMPANY+"|trust"
)),"/gui/*", edlist));
// Don't need security for display Artifacts or login page
AuthzTransOnlyFilter atof;
flist.add(new DME2FilterHolder(atof =new AuthzTransOnlyFilter(env),"/theme/*", edlist));
flist.add(new DME2FilterHolder(atof,"/js/*", edlist));
flist.add(new DME2FilterHolder(atof,"/login/*", edlist));
svcHolder.setFilters(flist);
svcHolder.setServletHolders(slist);
DME2Server dme2svr = dme2.getServer();
// dme2svr.setGracefulShutdownTimeMs(1000);
env.init().log("Starting AAF GUI with Jetty/DME2 server...");
dme2svr.start();
DME2ServerProperties dsprops = dme2svr.getServerProperties();
try {
// if(env.getProperty("NO_REGISTER",null)!=null)
dme2.bindService(svcHolder);
env.init().log("DME2 is available as HTTP"+(dsprops.isSslEnable()?"/S":""),"on port:",dsprops.getPort());
while(true) { // Per DME2 Examples...
Thread.sleep(5000);
}
} catch(InterruptedException e) {
env.init().log("AAF Jetty Server interrupted!");
} catch(Exception e) { // Error binding service doesn't seem to stop DME2 or Process
env.init().log(e,"DME2 Initialization Error");
dme2svr.stop();
System.exit(1);
}
} else {
env.init().log("Properties must contain DMEServiceName");
}
} | java | public void startDME2(Properties props) throws DME2Exception, CadiException {
DME2Manager dme2 = new DME2Manager("AAF GUI DME2Manager", props);
DME2ServiceHolder svcHolder;
List<DME2ServletHolder> slist = new ArrayList<DME2ServletHolder>();
svcHolder = new DME2ServiceHolder();
String serviceName = env.getProperty("DMEServiceName",null);
if(serviceName!=null) {
svcHolder.setServiceURI(serviceName);
svcHolder.setManager(dme2);
svcHolder.setContext("/");
DME2ServletHolder srvHolder = new DME2ServletHolder(this, new String[]{"/gui"});
srvHolder.setContextPath("/*");
slist.add(srvHolder);
EnumSet<RequestDispatcherType> edlist = EnumSet.of(
RequestDispatcherType.REQUEST,
RequestDispatcherType.FORWARD,
RequestDispatcherType.ASYNC
);
///////////////////////
// Apply Filters
///////////////////////
List<DME2FilterHolder> flist = new ArrayList<DME2FilterHolder>();
// Secure all GUI interactions with AuthzTransFilter
flist.add(new DME2FilterHolder(new AuthzTransFilter(env, aafCon, new AAFTrustChecker(
env.getProperty(Config.CADI_TRUST_PROP, Config.CADI_USER_CHAIN),
Define.ROOT_NS + ".mechid|"+Define.ROOT_COMPANY+"|trust"
)),"/gui/*", edlist));
// Don't need security for display Artifacts or login page
AuthzTransOnlyFilter atof;
flist.add(new DME2FilterHolder(atof =new AuthzTransOnlyFilter(env),"/theme/*", edlist));
flist.add(new DME2FilterHolder(atof,"/js/*", edlist));
flist.add(new DME2FilterHolder(atof,"/login/*", edlist));
svcHolder.setFilters(flist);
svcHolder.setServletHolders(slist);
DME2Server dme2svr = dme2.getServer();
// dme2svr.setGracefulShutdownTimeMs(1000);
env.init().log("Starting AAF GUI with Jetty/DME2 server...");
dme2svr.start();
DME2ServerProperties dsprops = dme2svr.getServerProperties();
try {
// if(env.getProperty("NO_REGISTER",null)!=null)
dme2.bindService(svcHolder);
env.init().log("DME2 is available as HTTP"+(dsprops.isSslEnable()?"/S":""),"on port:",dsprops.getPort());
while(true) { // Per DME2 Examples...
Thread.sleep(5000);
}
} catch(InterruptedException e) {
env.init().log("AAF Jetty Server interrupted!");
} catch(Exception e) { // Error binding service doesn't seem to stop DME2 or Process
env.init().log(e,"DME2 Initialization Error");
dme2svr.stop();
System.exit(1);
}
} else {
env.init().log("Properties must contain DMEServiceName");
}
} | [
"public",
"void",
"startDME2",
"(",
"Properties",
"props",
")",
"throws",
"DME2Exception",
",",
"CadiException",
"{",
"DME2Manager",
"dme2",
"=",
"new",
"DME2Manager",
"(",
"\"AAF GUI DME2Manager\"",
",",
"props",
")",
";",
"DME2ServiceHolder",
"svcHolder",
";",
"... | Start up AuthzAPI as DME2 Service
@param env
@param props
@throws DME2Exception
@throws CadiException | [
"Start",
"up",
"AuthzAPI",
"as",
"DME2",
"Service"
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-gui/src/main/java/com/att/authz/gui/AuthGUI.java#L204-L271 |
aaberg/sql2o | core/src/main/java/org/sql2o/Query.java | Query.addParameter | public Query addParameter(String name, final Object ... values) {
if(values == null) {
throw new NullPointerException("Array parameter cannot be null");
}
addParameterInternal(name, new ParameterSetter(values.length) {
@Override
public void setParameter(int paramIdx, PreparedStatement statement) throws SQLException {
if(values.length == 0) {
getConnection().getSql2o().getQuirks().setParameter(statement, paramIdx, (Object) null);
} else {
for (Object value : values) {
getConnection().getSql2o().getQuirks().setParameter(statement, paramIdx++, value);
}
}
}
});
return this;
} | java | public Query addParameter(String name, final Object ... values) {
if(values == null) {
throw new NullPointerException("Array parameter cannot be null");
}
addParameterInternal(name, new ParameterSetter(values.length) {
@Override
public void setParameter(int paramIdx, PreparedStatement statement) throws SQLException {
if(values.length == 0) {
getConnection().getSql2o().getQuirks().setParameter(statement, paramIdx, (Object) null);
} else {
for (Object value : values) {
getConnection().getSql2o().getQuirks().setParameter(statement, paramIdx++, value);
}
}
}
});
return this;
} | [
"public",
"Query",
"addParameter",
"(",
"String",
"name",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Array parameter cannot be null\"",
")",
";",
"}",
"addPara... | Set an array parameter.<br>
For example:
<pre>
createQuery("SELECT * FROM user WHERE id IN(:ids)")
.addParameter("ids", 4, 5, 6)
.executeAndFetch(...)
</pre>
will generate the query : <code>SELECT * FROM user WHERE id IN(4,5,6)</code><br>
<br>
It is not possible to use array parameters with a batch <code>PreparedStatement</code>:
since the text query passed to the <code>PreparedStatement</code> depends on the number of parameters in the array,
array parameters are incompatible with batch mode.<br>
<br>
If the values array is empty, <code>null</code> will be set to the array parameter:
<code>SELECT * FROM user WHERE id IN(NULL)</code>
@throws NullPointerException if values parameter is null | [
"Set",
"an",
"array",
"parameter",
".",
"<br",
">",
"For",
"example",
":",
"<pre",
">",
"createQuery",
"(",
"SELECT",
"*",
"FROM",
"user",
"WHERE",
"id",
"IN",
"(",
":",
"ids",
")",
")",
".",
"addParameter",
"(",
"ids",
"4",
"5",
"6",
")",
".",
"... | train | https://github.com/aaberg/sql2o/blob/01d3490a6d2440cf60f973d23508ac4ed57a8e20/core/src/main/java/org/sql2o/Query.java#L350-L368 |
keenlabs/KeenClient-Java | core/src/main/java/io/keen/client/java/FileEventStore.java | FileEventStore.getCollectionDir | private File getCollectionDir(String projectId, String eventCollection) throws IOException {
File collectionDir = new File(getProjectDir(projectId, true), eventCollection);
if (!collectionDir.exists()) {
KeenLogging.log("Cache directory for event collection '" + eventCollection +
"' doesn't exist. Creating it.");
if (!collectionDir.mkdirs()) {
throw new IOException("Could not create collection cache directory '" +
collectionDir.getAbsolutePath() + "'");
}
}
return collectionDir;
} | java | private File getCollectionDir(String projectId, String eventCollection) throws IOException {
File collectionDir = new File(getProjectDir(projectId, true), eventCollection);
if (!collectionDir.exists()) {
KeenLogging.log("Cache directory for event collection '" + eventCollection +
"' doesn't exist. Creating it.");
if (!collectionDir.mkdirs()) {
throw new IOException("Could not create collection cache directory '" +
collectionDir.getAbsolutePath() + "'");
}
}
return collectionDir;
} | [
"private",
"File",
"getCollectionDir",
"(",
"String",
"projectId",
",",
"String",
"eventCollection",
")",
"throws",
"IOException",
"{",
"File",
"collectionDir",
"=",
"new",
"File",
"(",
"getProjectDir",
"(",
"projectId",
",",
"true",
")",
",",
"eventCollection",
... | Gets the directory for events in the given collection. Creates the directory (and any
necessary parents) if it does not exist already.
@param projectId The project ID.
@param eventCollection The name of the event collection.
@return The directory for events in the collection. | [
"Gets",
"the",
"directory",
"for",
"events",
"in",
"the",
"given",
"collection",
".",
"Creates",
"the",
"directory",
"(",
"and",
"any",
"necessary",
"parents",
")",
"if",
"it",
"does",
"not",
"exist",
"already",
"."
] | train | https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/FileEventStore.java#L296-L307 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java | TypeConverter.convertToInt | public static int convertToInt (@Nonnull final Object aSrcValue)
{
if (aSrcValue == null)
throw new TypeConverterException (int.class, EReason.NULL_SOURCE_NOT_ALLOWED);
final Integer aValue = convert (aSrcValue, Integer.class);
return aValue.intValue ();
} | java | public static int convertToInt (@Nonnull final Object aSrcValue)
{
if (aSrcValue == null)
throw new TypeConverterException (int.class, EReason.NULL_SOURCE_NOT_ALLOWED);
final Integer aValue = convert (aSrcValue, Integer.class);
return aValue.intValue ();
} | [
"public",
"static",
"int",
"convertToInt",
"(",
"@",
"Nonnull",
"final",
"Object",
"aSrcValue",
")",
"{",
"if",
"(",
"aSrcValue",
"==",
"null",
")",
"throw",
"new",
"TypeConverterException",
"(",
"int",
".",
"class",
",",
"EReason",
".",
"NULL_SOURCE_NOT_ALLOW... | Convert the passed source value to int
@param aSrcValue
The source value. May not be <code>null</code>.
@return The converted value.
@throws TypeConverterException
if the source value is <code>null</code> or if no converter was
found or if the converter returned a <code>null</code> object.
@throws RuntimeException
If the converter itself throws an exception
@see TypeConverterProviderBestMatch | [
"Convert",
"the",
"passed",
"source",
"value",
"to",
"int"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L314-L320 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/StatementExecutor.java | StatementExecutor.buildIterator | public SelectIterator<T, ID> buildIterator(BaseDaoImpl<T, ID> classDao, ConnectionSource connectionSource,
int resultFlags, ObjectCache objectCache) throws SQLException {
prepareQueryForAll();
return buildIterator(classDao, connectionSource, preparedQueryForAll, objectCache, resultFlags);
} | java | public SelectIterator<T, ID> buildIterator(BaseDaoImpl<T, ID> classDao, ConnectionSource connectionSource,
int resultFlags, ObjectCache objectCache) throws SQLException {
prepareQueryForAll();
return buildIterator(classDao, connectionSource, preparedQueryForAll, objectCache, resultFlags);
} | [
"public",
"SelectIterator",
"<",
"T",
",",
"ID",
">",
"buildIterator",
"(",
"BaseDaoImpl",
"<",
"T",
",",
"ID",
">",
"classDao",
",",
"ConnectionSource",
"connectionSource",
",",
"int",
"resultFlags",
",",
"ObjectCache",
"objectCache",
")",
"throws",
"SQLExcepti... | Create and return a SelectIterator for the class using the default mapped query for all statement. | [
"Create",
"and",
"return",
"a",
"SelectIterator",
"for",
"the",
"class",
"using",
"the",
"default",
"mapped",
"query",
"for",
"all",
"statement",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L214-L218 |
google/closure-templates | java/src/com/google/template/soy/data/UnsafeSanitizedContentOrdainer.java | UnsafeSanitizedContentOrdainer.ordainAsSafe | public static SanitizedContent ordainAsSafe(String value, ContentKind kind, @Nullable Dir dir) {
if (kind == ContentKind.TEXT) {
if (dir != null) {
throw new IllegalArgumentException("TEXT objects don't support contend directions.");
}
return UnsanitizedString.create(value);
}
return SanitizedContent.create(value, kind, dir);
} | java | public static SanitizedContent ordainAsSafe(String value, ContentKind kind, @Nullable Dir dir) {
if (kind == ContentKind.TEXT) {
if (dir != null) {
throw new IllegalArgumentException("TEXT objects don't support contend directions.");
}
return UnsanitizedString.create(value);
}
return SanitizedContent.create(value, kind, dir);
} | [
"public",
"static",
"SanitizedContent",
"ordainAsSafe",
"(",
"String",
"value",
",",
"ContentKind",
"kind",
",",
"@",
"Nullable",
"Dir",
"dir",
")",
"{",
"if",
"(",
"kind",
"==",
"ContentKind",
".",
"TEXT",
")",
"{",
"if",
"(",
"dir",
"!=",
"null",
")",
... | Faithfully assumes the provided value is "safe" and marks it not to be re-escaped. Also assumes
the provided direction; null means unknown and thus to be estimated when necessary.
<p>When you "ordain" a string as safe content, it means that Soy will NOT re-escape or validate
the contents if printed in the relevant context. You can use this to insert known-safe HTML
into a template via a parameter.
<p>This doesn't do a lot of strict checking, but makes it easier to differentiate safe
constants in your code. | [
"Faithfully",
"assumes",
"the",
"provided",
"value",
"is",
"safe",
"and",
"marks",
"it",
"not",
"to",
"be",
"re",
"-",
"escaped",
".",
"Also",
"assumes",
"the",
"provided",
"direction",
";",
"null",
"means",
"unknown",
"and",
"thus",
"to",
"be",
"estimated... | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/UnsafeSanitizedContentOrdainer.java#L75-L83 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/commitlog/CommitLog.java | CommitLog.discardCompletedSegments | public void discardCompletedSegments(final UUID cfId, final ReplayPosition context)
{
logger.debug("discard completed log segments for {}, column family {}", context, cfId);
// Go thru the active segment files, which are ordered oldest to newest, marking the
// flushed CF as clean, until we reach the segment file containing the ReplayPosition passed
// in the arguments. Any segments that become unused after they are marked clean will be
// recycled or discarded.
for (Iterator<CommitLogSegment> iter = allocator.getActiveSegments().iterator(); iter.hasNext();)
{
CommitLogSegment segment = iter.next();
segment.markClean(cfId, context);
if (segment.isUnused())
{
logger.debug("Commit log segment {} is unused", segment);
allocator.recycleSegment(segment);
}
else
{
logger.debug("Not safe to delete{} commit log segment {}; dirty is {}",
(iter.hasNext() ? "" : " active"), segment, segment.dirtyString());
}
// Don't mark or try to delete any newer segments once we've reached the one containing the
// position of the flush.
if (segment.contains(context))
break;
}
} | java | public void discardCompletedSegments(final UUID cfId, final ReplayPosition context)
{
logger.debug("discard completed log segments for {}, column family {}", context, cfId);
// Go thru the active segment files, which are ordered oldest to newest, marking the
// flushed CF as clean, until we reach the segment file containing the ReplayPosition passed
// in the arguments. Any segments that become unused after they are marked clean will be
// recycled or discarded.
for (Iterator<CommitLogSegment> iter = allocator.getActiveSegments().iterator(); iter.hasNext();)
{
CommitLogSegment segment = iter.next();
segment.markClean(cfId, context);
if (segment.isUnused())
{
logger.debug("Commit log segment {} is unused", segment);
allocator.recycleSegment(segment);
}
else
{
logger.debug("Not safe to delete{} commit log segment {}; dirty is {}",
(iter.hasNext() ? "" : " active"), segment, segment.dirtyString());
}
// Don't mark or try to delete any newer segments once we've reached the one containing the
// position of the flush.
if (segment.contains(context))
break;
}
} | [
"public",
"void",
"discardCompletedSegments",
"(",
"final",
"UUID",
"cfId",
",",
"final",
"ReplayPosition",
"context",
")",
"{",
"logger",
".",
"debug",
"(",
"\"discard completed log segments for {}, column family {}\"",
",",
"context",
",",
"cfId",
")",
";",
"// Go t... | Modifies the per-CF dirty cursors of any commit log segments for the column family according to the position
given. Discards any commit log segments that are no longer used.
@param cfId the column family ID that was flushed
@param context the replay position of the flush | [
"Modifies",
"the",
"per",
"-",
"CF",
"dirty",
"cursors",
"of",
"any",
"commit",
"log",
"segments",
"for",
"the",
"column",
"family",
"according",
"to",
"the",
"position",
"given",
".",
"Discards",
"any",
"commit",
"log",
"segments",
"that",
"are",
"no",
"l... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLog.java#L263-L292 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java | ProbeManagerImpl.removeListenerByProbe | boolean removeListenerByProbe(ProbeImpl probe, ProbeListener listener) {
boolean deactivatedProbe = false;
Set<ProbeListener> listeners = listenersByProbe.get(probe);
if (listeners != null) {
listeners.remove(listener);
if (listeners.isEmpty()) {
deactivateProbe(probe);
deactivatedProbe = true;
}
}
return deactivatedProbe;
} | java | boolean removeListenerByProbe(ProbeImpl probe, ProbeListener listener) {
boolean deactivatedProbe = false;
Set<ProbeListener> listeners = listenersByProbe.get(probe);
if (listeners != null) {
listeners.remove(listener);
if (listeners.isEmpty()) {
deactivateProbe(probe);
deactivatedProbe = true;
}
}
return deactivatedProbe;
} | [
"boolean",
"removeListenerByProbe",
"(",
"ProbeImpl",
"probe",
",",
"ProbeListener",
"listener",
")",
"{",
"boolean",
"deactivatedProbe",
"=",
"false",
";",
"Set",
"<",
"ProbeListener",
">",
"listeners",
"=",
"listenersByProbe",
".",
"get",
"(",
"probe",
")",
";... | Remove the specified listener from the collection of listeners associated
with the specified probe.
@param probe the probe that fired for the listener
@param listener the listener that was driven by the probe
@return true if removing the listener caused the probe to become disabled | [
"Remove",
"the",
"specified",
"listener",
"from",
"the",
"collection",
"of",
"listeners",
"associated",
"with",
"the",
"specified",
"probe",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java#L710-L723 |
aws/aws-sdk-java | aws-java-sdk-iotjobsdataplane/src/main/java/com/amazonaws/services/iotjobsdataplane/model/UpdateJobExecutionRequest.java | UpdateJobExecutionRequest.withStatusDetails | public UpdateJobExecutionRequest withStatusDetails(java.util.Map<String, String> statusDetails) {
setStatusDetails(statusDetails);
return this;
} | java | public UpdateJobExecutionRequest withStatusDetails(java.util.Map<String, String> statusDetails) {
setStatusDetails(statusDetails);
return this;
} | [
"public",
"UpdateJobExecutionRequest",
"withStatusDetails",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"statusDetails",
")",
"{",
"setStatusDetails",
"(",
"statusDetails",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the
statusDetails are unchanged.
</p>
@param statusDetails
Optional. A collection of name/value pairs that describe the status of the job execution. If not
specified, the statusDetails are unchanged.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Optional",
".",
"A",
"collection",
"of",
"name",
"/",
"value",
"pairs",
"that",
"describe",
"the",
"status",
"of",
"the",
"job",
"execution",
".",
"If",
"not",
"specified",
"the",
"statusDetails",
"are",
"unchanged",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iotjobsdataplane/src/main/java/com/amazonaws/services/iotjobsdataplane/model/UpdateJobExecutionRequest.java#L282-L285 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/MoveOnChangeHandler.java | MoveOnChangeHandler.moveSourceToDest | public int moveSourceToDest(boolean bDisplayOption, int iMoveMode)
{
if (m_fldSource instanceof BaseField)
return ((BaseField)m_fldDest.getField()).moveFieldToThis((BaseField)m_fldSource, bDisplayOption, iMoveMode); // Move dependent field to here
else
return m_fldDest.setString(m_fldSource.getString(), bDisplayOption, iMoveMode); // Move dependent field to here
} | java | public int moveSourceToDest(boolean bDisplayOption, int iMoveMode)
{
if (m_fldSource instanceof BaseField)
return ((BaseField)m_fldDest.getField()).moveFieldToThis((BaseField)m_fldSource, bDisplayOption, iMoveMode); // Move dependent field to here
else
return m_fldDest.setString(m_fldSource.getString(), bDisplayOption, iMoveMode); // Move dependent field to here
} | [
"public",
"int",
"moveSourceToDest",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"m_fldSource",
"instanceof",
"BaseField",
")",
"return",
"(",
"(",
"BaseField",
")",
"m_fldDest",
".",
"getField",
"(",
")",
")",
".",
"moveF... | Do the physical move operation.
@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). | [
"Do",
"the",
"physical",
"move",
"operation",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MoveOnChangeHandler.java#L196-L202 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java | GeometryTools.shiftReactionVertical | public static Rectangle2D shiftReactionVertical(IReaction reaction, Rectangle2D bounds, Rectangle2D last, double gap) {
// determine if the reactions are overlapping
if (last.getMaxY() + gap >= bounds.getMinY()) {
double yShift = bounds.getHeight() + last.getHeight() + gap;
Vector2d shift = new Vector2d(0, yShift);
List<IAtomContainer> containers = ReactionManipulator.getAllAtomContainers(reaction);
for (IAtomContainer container : containers) {
translate2D(container, shift);
}
return new Rectangle2D.Double(bounds.getX(), bounds.getY() + yShift, bounds.getWidth(), bounds.getHeight());
} else {
// the reactions were not overlapping
return bounds;
}
} | java | public static Rectangle2D shiftReactionVertical(IReaction reaction, Rectangle2D bounds, Rectangle2D last, double gap) {
// determine if the reactions are overlapping
if (last.getMaxY() + gap >= bounds.getMinY()) {
double yShift = bounds.getHeight() + last.getHeight() + gap;
Vector2d shift = new Vector2d(0, yShift);
List<IAtomContainer> containers = ReactionManipulator.getAllAtomContainers(reaction);
for (IAtomContainer container : containers) {
translate2D(container, shift);
}
return new Rectangle2D.Double(bounds.getX(), bounds.getY() + yShift, bounds.getWidth(), bounds.getHeight());
} else {
// the reactions were not overlapping
return bounds;
}
} | [
"public",
"static",
"Rectangle2D",
"shiftReactionVertical",
"(",
"IReaction",
"reaction",
",",
"Rectangle2D",
"bounds",
",",
"Rectangle2D",
"last",
",",
"double",
"gap",
")",
"{",
"// determine if the reactions are overlapping",
"if",
"(",
"last",
".",
"getMaxY",
"(",... | Shift the containers in a reaction vertically upwards to not overlap
with the reference Rectangle2D. The shift is such that the given
gap is realized, but only if the reactions are actually overlapping.
@param reaction the reaction to shift
@param bounds the bounds of the reaction to shift
@param last the bounds of the last reaction
@return the Rectangle2D of the shifted reaction | [
"Shift",
"the",
"containers",
"in",
"a",
"reaction",
"vertically",
"upwards",
"to",
"not",
"overlap",
"with",
"the",
"reference",
"Rectangle2D",
".",
"The",
"shift",
"is",
"such",
"that",
"the",
"given",
"gap",
"is",
"realized",
"but",
"only",
"if",
"the",
... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L1709-L1723 |
cdapio/tephra | tephra-hbase-compat-1.0/src/main/java/co/cask/tephra/hbase10/coprocessor/TransactionFilters.java | TransactionFilters.getVisibilityFilter | public static Filter getVisibilityFilter(Transaction tx, Map<byte[], Long> ttlByFamily, boolean allowEmptyValues,
ScanType scanType) {
return new CellSkipFilter(new TransactionVisibilityFilter(tx, ttlByFamily, allowEmptyValues, scanType, null));
} | java | public static Filter getVisibilityFilter(Transaction tx, Map<byte[], Long> ttlByFamily, boolean allowEmptyValues,
ScanType scanType) {
return new CellSkipFilter(new TransactionVisibilityFilter(tx, ttlByFamily, allowEmptyValues, scanType, null));
} | [
"public",
"static",
"Filter",
"getVisibilityFilter",
"(",
"Transaction",
"tx",
",",
"Map",
"<",
"byte",
"[",
"]",
",",
"Long",
">",
"ttlByFamily",
",",
"boolean",
"allowEmptyValues",
",",
"ScanType",
"scanType",
")",
"{",
"return",
"new",
"CellSkipFilter",
"("... | Creates a new {@link org.apache.hadoop.hbase.filter.Filter} for returning data only from visible transactions.
@param tx the current transaction to apply. Only data visible to this transaction will be returned.
@param ttlByFamily map of time-to-live (TTL) (in milliseconds) by column family name
@param allowEmptyValues if {@code true} cells with empty {@code byte[]} values will be returned, if {@code false}
these will be interpreted as "delete" markers and the column will be filtered out
@param scanType the type of scan operation being performed | [
"Creates",
"a",
"new",
"{",
"@link",
"org",
".",
"apache",
".",
"hadoop",
".",
"hbase",
".",
"filter",
".",
"Filter",
"}",
"for",
"returning",
"data",
"only",
"from",
"visible",
"transactions",
"."
] | train | https://github.com/cdapio/tephra/blob/082c56c15c6ece15002631ff6f89206a00d8915c/tephra-hbase-compat-1.0/src/main/java/co/cask/tephra/hbase10/coprocessor/TransactionFilters.java#L39-L42 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/table/FilterableTableExample.java | FilterableTableExample.buildColumnHeader | private WDecoratedLabel buildColumnHeader(final String text, final WMenu menu) {
WDecoratedLabel label = new WDecoratedLabel(null, new WText(text), menu);
return label;
} | java | private WDecoratedLabel buildColumnHeader(final String text, final WMenu menu) {
WDecoratedLabel label = new WDecoratedLabel(null, new WText(text), menu);
return label;
} | [
"private",
"WDecoratedLabel",
"buildColumnHeader",
"(",
"final",
"String",
"text",
",",
"final",
"WMenu",
"menu",
")",
"{",
"WDecoratedLabel",
"label",
"=",
"new",
"WDecoratedLabel",
"(",
"null",
",",
"new",
"WText",
"(",
"text",
")",
",",
"menu",
")",
";",
... | Helper to create the table column heading's WDecoratedLabel.
@param text The readable text content of the column header
@param menu The WMenu we want in this column header.
@return WDecoratedLabel used to create a column heading. | [
"Helper",
"to",
"create",
"the",
"table",
"column",
"heading",
"s",
"WDecoratedLabel",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/table/FilterableTableExample.java#L152-L155 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AFPAlignmentDisplay.java | AFPAlignmentDisplay.getBlockNrForAlignPos | public static int getBlockNrForAlignPos(AFPChain afpChain, int aligPos){
// moved here from DisplayAFP;
int blockNum = afpChain.getBlockNum();
int[] optLen = afpChain.getOptLen();
int[][][] optAln = afpChain.getOptAln();
int len = 0;
int p1b=0;
int p2b=0;
for(int i = 0; i < blockNum; i ++) {
for(int j = 0; j < optLen[i]; j ++) {
int p1 = optAln[i][0][j];
int p2 = optAln[i][1][j];
if (len != 0) {
// check for gapped region
int lmax = (p1 - p1b - 1)>(p2 - p2b - 1)?(p1 - p1b - 1):(p2 - p2b - 1);
for(int k = 0; k < lmax; k ++) {
len++;
}
}
p1b = p1;
p2b = p2;
if ( len >= aligPos) {
return i;
}
len++;
}
}
return blockNum;
} | java | public static int getBlockNrForAlignPos(AFPChain afpChain, int aligPos){
// moved here from DisplayAFP;
int blockNum = afpChain.getBlockNum();
int[] optLen = afpChain.getOptLen();
int[][][] optAln = afpChain.getOptAln();
int len = 0;
int p1b=0;
int p2b=0;
for(int i = 0; i < blockNum; i ++) {
for(int j = 0; j < optLen[i]; j ++) {
int p1 = optAln[i][0][j];
int p2 = optAln[i][1][j];
if (len != 0) {
// check for gapped region
int lmax = (p1 - p1b - 1)>(p2 - p2b - 1)?(p1 - p1b - 1):(p2 - p2b - 1);
for(int k = 0; k < lmax; k ++) {
len++;
}
}
p1b = p1;
p2b = p2;
if ( len >= aligPos) {
return i;
}
len++;
}
}
return blockNum;
} | [
"public",
"static",
"int",
"getBlockNrForAlignPos",
"(",
"AFPChain",
"afpChain",
",",
"int",
"aligPos",
")",
"{",
"// moved here from DisplayAFP;",
"int",
"blockNum",
"=",
"afpChain",
".",
"getBlockNum",
"(",
")",
";",
"int",
"[",
"]",
"optLen",
"=",
"afpChain",... | get the block number for an aligned position
@param afpChain
@param aligPos
@return | [
"get",
"the",
"block",
"number",
"for",
"an",
"aligned",
"position"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AFPAlignmentDisplay.java#L449-L489 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java | CPDisplayLayoutPersistenceImpl.removeByUUID_G | @Override
public CPDisplayLayout removeByUUID_G(String uuid, long groupId)
throws NoSuchCPDisplayLayoutException {
CPDisplayLayout cpDisplayLayout = findByUUID_G(uuid, groupId);
return remove(cpDisplayLayout);
} | java | @Override
public CPDisplayLayout removeByUUID_G(String uuid, long groupId)
throws NoSuchCPDisplayLayoutException {
CPDisplayLayout cpDisplayLayout = findByUUID_G(uuid, groupId);
return remove(cpDisplayLayout);
} | [
"@",
"Override",
"public",
"CPDisplayLayout",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCPDisplayLayoutException",
"{",
"CPDisplayLayout",
"cpDisplayLayout",
"=",
"findByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"re... | Removes the cp display layout where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the cp display layout that was removed | [
"Removes",
"the",
"cp",
"display",
"layout",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java#L811-L817 |
docker-java/docker-java | src/main/java/com/github/dockerjava/core/util/FilePathUtil.java | FilePathUtil.relativize | public static String relativize(Path baseDir, Path file) {
String path = baseDir.toUri().relativize(file.toUri()).getPath();
if (!"/".equals(baseDir.getFileSystem().getSeparator())) {
// For windows
return path.replace(baseDir.getFileSystem().getSeparator(), "/");
} else {
return path;
}
} | java | public static String relativize(Path baseDir, Path file) {
String path = baseDir.toUri().relativize(file.toUri()).getPath();
if (!"/".equals(baseDir.getFileSystem().getSeparator())) {
// For windows
return path.replace(baseDir.getFileSystem().getSeparator(), "/");
} else {
return path;
}
} | [
"public",
"static",
"String",
"relativize",
"(",
"Path",
"baseDir",
",",
"Path",
"file",
")",
"{",
"String",
"path",
"=",
"baseDir",
".",
"toUri",
"(",
")",
".",
"relativize",
"(",
"file",
".",
"toUri",
"(",
")",
")",
".",
"getPath",
"(",
")",
";",
... | Return the relative path. Path elements are separated with / char.
@param baseDir
a parent directory of {@code file}
@param file
the file to get the relative path
@return the relative path | [
"Return",
"the",
"relative",
"path",
".",
"Path",
"elements",
"are",
"separated",
"with",
"/",
"char",
"."
] | train | https://github.com/docker-java/docker-java/blob/c5c89327108abdc50aa41d7711d4743b8bac75fe/src/main/java/com/github/dockerjava/core/util/FilePathUtil.java#L43-L51 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.pack | public static void pack(File sourceDir, File targetZip, NameMapper mapper, int compressionLevel) {
log.debug("Compressing '{}' into '{}'.", sourceDir, targetZip);
if (!sourceDir.exists()) {
throw new ZipException("Given file '" + sourceDir + "' doesn't exist!");
}
ZipOutputStream out = null;
try {
out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(targetZip)));
out.setLevel(compressionLevel);
pack(sourceDir, out, mapper, "", true);
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
finally {
IOUtils.closeQuietly(out);
}
} | java | public static void pack(File sourceDir, File targetZip, NameMapper mapper, int compressionLevel) {
log.debug("Compressing '{}' into '{}'.", sourceDir, targetZip);
if (!sourceDir.exists()) {
throw new ZipException("Given file '" + sourceDir + "' doesn't exist!");
}
ZipOutputStream out = null;
try {
out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(targetZip)));
out.setLevel(compressionLevel);
pack(sourceDir, out, mapper, "", true);
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
finally {
IOUtils.closeQuietly(out);
}
} | [
"public",
"static",
"void",
"pack",
"(",
"File",
"sourceDir",
",",
"File",
"targetZip",
",",
"NameMapper",
"mapper",
",",
"int",
"compressionLevel",
")",
"{",
"log",
".",
"debug",
"(",
"\"Compressing '{}' into '{}'.\"",
",",
"sourceDir",
",",
"targetZip",
")",
... | Compresses the given directory and all its sub-directories into a ZIP file.
<p>
The ZIP file must not be a directory and its parent directory must exist.
@param sourceDir
root directory.
@param targetZip
ZIP file that will be created or overwritten.
@param mapper
call-back for renaming the entries.
@param compressionLevel
compression level | [
"Compresses",
"the",
"given",
"directory",
"and",
"all",
"its",
"sub",
"-",
"directories",
"into",
"a",
"ZIP",
"file",
".",
"<p",
">",
"The",
"ZIP",
"file",
"must",
"not",
"be",
"a",
"directory",
"and",
"its",
"parent",
"directory",
"must",
"exist",
"."
... | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1603-L1620 |
bullhorn/sdk-rest | src/main/java/com/bullhornsdk/data/api/helper/RestJsonConverter.java | RestJsonConverter.jsonToEntityUnwrapRoot | public <T> T jsonToEntityUnwrapRoot(String jsonString, Class<T> type) {
return jsonToEntity(jsonString, type, this.objectMapperWrapped);
} | java | public <T> T jsonToEntityUnwrapRoot(String jsonString, Class<T> type) {
return jsonToEntity(jsonString, type, this.objectMapperWrapped);
} | [
"public",
"<",
"T",
">",
"T",
"jsonToEntityUnwrapRoot",
"(",
"String",
"jsonString",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"jsonToEntity",
"(",
"jsonString",
",",
"type",
",",
"this",
".",
"objectMapperWrapped",
")",
";",
"}"
] | Converts a jsonString to an object of type T. Unwraps from root, most often this means that the "data" tag is ignored and
that the entity is created from within that data tag.
@param jsonString
the returned json from the api call.
@param type
the type to convert to
@return a type T | [
"Converts",
"a",
"jsonString",
"to",
"an",
"object",
"of",
"type",
"T",
".",
"Unwraps",
"from",
"root",
"most",
"often",
"this",
"means",
"that",
"the",
"data",
"tag",
"is",
"ignored",
"and",
"that",
"the",
"entity",
"is",
"created",
"from",
"within",
"t... | train | https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/helper/RestJsonConverter.java#L79-L81 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.