repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedConnection.java | MemcachedConnection.setTimeout | private static void setTimeout(final Operation op, final boolean isTimeout) {
Logger logger = LoggerFactory.getLogger(MemcachedConnection.class);
try {
if (op == null || op.isTimedOutUnsent()) {
return;
}
MemcachedNode node = op.getHandlingNode();
if (node != null) {
node.setContinuousTimeout(isTimeout);
}
} catch (Exception e) {
logger.error(e.getMessage());
}
} | java | private static void setTimeout(final Operation op, final boolean isTimeout) {
Logger logger = LoggerFactory.getLogger(MemcachedConnection.class);
try {
if (op == null || op.isTimedOutUnsent()) {
return;
}
MemcachedNode node = op.getHandlingNode();
if (node != null) {
node.setContinuousTimeout(isTimeout);
}
} catch (Exception e) {
logger.error(e.getMessage());
}
} | [
"private",
"static",
"void",
"setTimeout",
"(",
"final",
"Operation",
"op",
",",
"final",
"boolean",
"isTimeout",
")",
"{",
"Logger",
"logger",
"=",
"LoggerFactory",
".",
"getLogger",
"(",
"MemcachedConnection",
".",
"class",
")",
";",
"try",
"{",
"if",
"(",... | Set the continuous timeout on an operation.
Ignore operations which have no handling nodes set yet (which may happen before nodes are properly
authenticated).
@param op the operation to use.
@param isTimeout is timed out or not. | [
"Set",
"the",
"continuous",
"timeout",
"on",
"an",
"operation",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedConnection.java#L1424-L1439 |
alkacon/opencms-core | src/org/opencms/workplace/tools/CmsToolManager.java | CmsToolManager.jspForwardPage | public void jspForwardPage(CmsWorkplace wp, String pagePath, Map<String, String[]> params)
throws IOException, ServletException {
Map<String, String[]> newParams = createToolParams(wp, pagePath, params);
if (pagePath.indexOf("?") > 0) {
pagePath = pagePath.substring(0, pagePath.indexOf("?"));
}
wp.setForwarded(true);
// forward to the requested page uri
CmsRequestUtil.forwardRequest(
wp.getJsp().link(pagePath),
CmsRequestUtil.createParameterMap(newParams),
wp.getJsp().getRequest(),
wp.getJsp().getResponse());
} | java | public void jspForwardPage(CmsWorkplace wp, String pagePath, Map<String, String[]> params)
throws IOException, ServletException {
Map<String, String[]> newParams = createToolParams(wp, pagePath, params);
if (pagePath.indexOf("?") > 0) {
pagePath = pagePath.substring(0, pagePath.indexOf("?"));
}
wp.setForwarded(true);
// forward to the requested page uri
CmsRequestUtil.forwardRequest(
wp.getJsp().link(pagePath),
CmsRequestUtil.createParameterMap(newParams),
wp.getJsp().getRequest(),
wp.getJsp().getResponse());
} | [
"public",
"void",
"jspForwardPage",
"(",
"CmsWorkplace",
"wp",
",",
"String",
"pagePath",
",",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"params",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"Map",
"<",
"String",
",",
"String",
"[... | Redirects to the given page with the given parameters.<p>
@param wp the workplace object
@param pagePath the path to the page to redirect to
@param params the parameters to send
@throws IOException in case of errors during forwarding
@throws ServletException in case of errors during forwarding | [
"Redirects",
"to",
"the",
"given",
"page",
"with",
"the",
"given",
"parameters",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolManager.java#L475-L490 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java | DFSUtil.getAddresses | public static List<InetSocketAddress> getAddresses(Configuration conf,
String defaultAddress, String... keys) {
return getAddresses(conf, getNameServiceIds(conf), defaultAddress, keys);
} | java | public static List<InetSocketAddress> getAddresses(Configuration conf,
String defaultAddress, String... keys) {
return getAddresses(conf, getNameServiceIds(conf), defaultAddress, keys);
} | [
"public",
"static",
"List",
"<",
"InetSocketAddress",
">",
"getAddresses",
"(",
"Configuration",
"conf",
",",
"String",
"defaultAddress",
",",
"String",
"...",
"keys",
")",
"{",
"return",
"getAddresses",
"(",
"conf",
",",
"getNameServiceIds",
"(",
"conf",
")",
... | Returns list of InetSocketAddress for a given set of keys.
@param conf configuration
@param defaultAddress default address to return in case key is not found
@param keys Set of keys to look for in the order of preference
@return list of InetSocketAddress corresponding to the key | [
"Returns",
"list",
"of",
"InetSocketAddress",
"for",
"a",
"given",
"set",
"of",
"keys",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L491-L494 |
apereo/cas | core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/factory/DefaultTicketFactory.java | DefaultTicketFactory.addTicketFactory | public DefaultTicketFactory addTicketFactory(final @NonNull Class<? extends Ticket> ticketClass, final @NonNull TicketFactory factory) {
this.factoryMap.put(ticketClass.getCanonicalName(), factory);
return this;
} | java | public DefaultTicketFactory addTicketFactory(final @NonNull Class<? extends Ticket> ticketClass, final @NonNull TicketFactory factory) {
this.factoryMap.put(ticketClass.getCanonicalName(), factory);
return this;
} | [
"public",
"DefaultTicketFactory",
"addTicketFactory",
"(",
"final",
"@",
"NonNull",
"Class",
"<",
"?",
"extends",
"Ticket",
">",
"ticketClass",
",",
"final",
"@",
"NonNull",
"TicketFactory",
"factory",
")",
"{",
"this",
".",
"factoryMap",
".",
"put",
"(",
"tic... | Add ticket factory.
@param ticketClass the ticket class
@param factory the factory
@return the default ticket factory | [
"Add",
"ticket",
"factory",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/factory/DefaultTicketFactory.java#L34-L37 |
haifengl/smile | plot/src/main/java/smile/plot/Graphics.java | Graphics.drawRectBaseRatio | public void drawRectBaseRatio(double[] topLeft, double[] rightBottom) {
if (!(projection instanceof Projection2D)) {
throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles.");
}
int[] sc = projection.screenProjectionBaseRatio(topLeft);
int[] sc2 = projection.screenProjectionBaseRatio(rightBottom);
g2d.drawRect(sc[0], sc[1], sc2[0] - sc[0], sc2[1] - sc[1]);
} | java | public void drawRectBaseRatio(double[] topLeft, double[] rightBottom) {
if (!(projection instanceof Projection2D)) {
throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles.");
}
int[] sc = projection.screenProjectionBaseRatio(topLeft);
int[] sc2 = projection.screenProjectionBaseRatio(rightBottom);
g2d.drawRect(sc[0], sc[1], sc2[0] - sc[0], sc2[1] - sc[1]);
} | [
"public",
"void",
"drawRectBaseRatio",
"(",
"double",
"[",
"]",
"topLeft",
",",
"double",
"[",
"]",
"rightBottom",
")",
"{",
"if",
"(",
"!",
"(",
"projection",
"instanceof",
"Projection2D",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
... | Draw the outline of the specified rectangle. The logical coordinates
are proportional to the base coordinates. | [
"Draw",
"the",
"outline",
"of",
"the",
"specified",
"rectangle",
".",
"The",
"logical",
"coordinates",
"are",
"proportional",
"to",
"the",
"base",
"coordinates",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L533-L542 |
windup/windup | rules-java/api/src/main/java/org/jboss/windup/rules/apps/mavenize/MavenizationService.java | MavenizationService.mavenizeApp | void mavenizeApp(ProjectModel projectModel)
{
LOG.info("Mavenizing ProjectModel " + projectModel.toPrettyString());
MavenizationContext mavCtx = new MavenizationContext();
mavCtx.graphContext = grCtx;
WindupConfigurationModel config = grCtx.getUnique(WindupConfigurationModel.class);
mavCtx.mavenizedBaseDir = config.getOutputPath().asFile().toPath().resolve(OUTPUT_SUBDIR_MAVENIZED);
mavCtx.unifiedGroupId = new ModuleAnalysisHelper(grCtx).deriveGroupId(projectModel);
mavCtx.unifiedAppName = normalizeDirName(projectModel.getName());
mavCtx.unifiedVersion = "1.0";
// 1) create the overall structure - a parent, and a BOM.
// Root pom.xml ( serves as a parent pom.xml in our resulting structure).
mavCtx.rootPom = new Pom(new MavenCoord(mavCtx.getUnifiedGroupId(), mavCtx.getUnifiedAppName() + "-parent", mavCtx.getUnifiedVersion()));
mavCtx.rootPom.role = Pom.ModuleRole.PARENT;
mavCtx.rootPom.name = projectModel.getName() + " - Parent";
mavCtx.rootPom.description = "Parent of " + projectModel.getName();
mavCtx.rootPom.root = true;
final String bomArtifactId = mavCtx.getUnifiedAppName() + "-bom";
// BOM
Pom bom = new Pom(new MavenCoord(mavCtx.getUnifiedGroupId(), bomArtifactId, mavCtx.getUnifiedVersion()));
bom.bom = getTargetTechnologies().contains("eap7")
? MavenizeRuleProvider.JBOSS_BOM_JAVAEE7_WITH_ALL
: MavenizeRuleProvider.JBOSS_BOM_JAVAEE6_WITH_ALL;
bom.role = Pom.ModuleRole.BOM;
bom.parent = new Pom(MavenizeRuleProvider.JBOSS_PARENT);
bom.description = "Bill of Materials. See https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html";
bom.name = projectModel.getName() + " - BOM";
mavCtx.getRootPom().submodules.put(bomArtifactId, bom);
mavCtx.bom = bom;
// BOM - dependencyManagement dependencies
for( ArchiveCoordinateModel dep : grCtx.getUnique(GlobalBomModel.class).getDependencies() ){
LOG.info("Adding dep to BOM: " + dep.toPrettyString());
bom.dependencies.add(new SimpleDependency(Dependency.Role.LIBRARY, MavenCoord.from(dep)));
}
// 2) Recursively add the modules.
mavCtx.rootAppPom = mavenizeModule(mavCtx, projectModel, null);
// TODO: MIGR-236 Sort the modules.
///mavCtx.rootPom.submodules = sortSubmodulesToReflectDependencies(mavCtx.rootAppPom);
// 3) Write the pom.xml's.
new MavenStructureRenderer(mavCtx).createMavenProjectDirectoryTree();
} | java | void mavenizeApp(ProjectModel projectModel)
{
LOG.info("Mavenizing ProjectModel " + projectModel.toPrettyString());
MavenizationContext mavCtx = new MavenizationContext();
mavCtx.graphContext = grCtx;
WindupConfigurationModel config = grCtx.getUnique(WindupConfigurationModel.class);
mavCtx.mavenizedBaseDir = config.getOutputPath().asFile().toPath().resolve(OUTPUT_SUBDIR_MAVENIZED);
mavCtx.unifiedGroupId = new ModuleAnalysisHelper(grCtx).deriveGroupId(projectModel);
mavCtx.unifiedAppName = normalizeDirName(projectModel.getName());
mavCtx.unifiedVersion = "1.0";
// 1) create the overall structure - a parent, and a BOM.
// Root pom.xml ( serves as a parent pom.xml in our resulting structure).
mavCtx.rootPom = new Pom(new MavenCoord(mavCtx.getUnifiedGroupId(), mavCtx.getUnifiedAppName() + "-parent", mavCtx.getUnifiedVersion()));
mavCtx.rootPom.role = Pom.ModuleRole.PARENT;
mavCtx.rootPom.name = projectModel.getName() + " - Parent";
mavCtx.rootPom.description = "Parent of " + projectModel.getName();
mavCtx.rootPom.root = true;
final String bomArtifactId = mavCtx.getUnifiedAppName() + "-bom";
// BOM
Pom bom = new Pom(new MavenCoord(mavCtx.getUnifiedGroupId(), bomArtifactId, mavCtx.getUnifiedVersion()));
bom.bom = getTargetTechnologies().contains("eap7")
? MavenizeRuleProvider.JBOSS_BOM_JAVAEE7_WITH_ALL
: MavenizeRuleProvider.JBOSS_BOM_JAVAEE6_WITH_ALL;
bom.role = Pom.ModuleRole.BOM;
bom.parent = new Pom(MavenizeRuleProvider.JBOSS_PARENT);
bom.description = "Bill of Materials. See https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html";
bom.name = projectModel.getName() + " - BOM";
mavCtx.getRootPom().submodules.put(bomArtifactId, bom);
mavCtx.bom = bom;
// BOM - dependencyManagement dependencies
for( ArchiveCoordinateModel dep : grCtx.getUnique(GlobalBomModel.class).getDependencies() ){
LOG.info("Adding dep to BOM: " + dep.toPrettyString());
bom.dependencies.add(new SimpleDependency(Dependency.Role.LIBRARY, MavenCoord.from(dep)));
}
// 2) Recursively add the modules.
mavCtx.rootAppPom = mavenizeModule(mavCtx, projectModel, null);
// TODO: MIGR-236 Sort the modules.
///mavCtx.rootPom.submodules = sortSubmodulesToReflectDependencies(mavCtx.rootAppPom);
// 3) Write the pom.xml's.
new MavenStructureRenderer(mavCtx).createMavenProjectDirectoryTree();
} | [
"void",
"mavenizeApp",
"(",
"ProjectModel",
"projectModel",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Mavenizing ProjectModel \"",
"+",
"projectModel",
".",
"toPrettyString",
"(",
")",
")",
";",
"MavenizationContext",
"mavCtx",
"=",
"new",
"MavenizationContext",
"(",
... | For the given application (Windup input), creates a stub of Mavenized project.
<p>
The resulting structure is: (+--- is "module", +~~~ is a dependency)
<pre>
Parent POM
+--- BOM
+~~~ JBoss EAP BOM
+--- JAR submodule
+~~~ library JARs
+--- WAR
+~~~ library JARs
+~~~ JAR submodule
+--- EAR
+~~~ library JAR
+~~~ JAR submodule
+~~~ WAR submodule
</pre> | [
"For",
"the",
"given",
"application",
"(",
"Windup",
"input",
")",
"creates",
"a",
"stub",
"of",
"Mavenized",
"project",
".",
"<p",
">",
"The",
"resulting",
"structure",
"is",
":",
"(",
"+",
"---",
"is",
"module",
"+",
"~~~",
"is",
"a",
"dependency",
"... | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/mavenize/MavenizationService.java#L62-L110 |
floragunncom/search-guard | src/main/java/com/floragunn/searchguard/support/WildcardMatcher.java | WildcardMatcher.checkRegionMatches | private static boolean checkRegionMatches(final String str, final int strStartIndex, final String search) {
return str.regionMatches(false, strStartIndex, search, 0, search.length());
} | java | private static boolean checkRegionMatches(final String str, final int strStartIndex, final String search) {
return str.regionMatches(false, strStartIndex, search, 0, search.length());
} | [
"private",
"static",
"boolean",
"checkRegionMatches",
"(",
"final",
"String",
"str",
",",
"final",
"int",
"strStartIndex",
",",
"final",
"String",
"search",
")",
"{",
"return",
"str",
".",
"regionMatches",
"(",
"false",
",",
"strStartIndex",
",",
"search",
","... | Checks if one string contains another at a specific index using the case-sensitivity rule.
<p>
This method mimics parts of {@link String#regionMatches(boolean, int, String, int, int)}
but takes case-sensitivity into account.
@param str the string to check, not null
@param strStartIndex the index to start at in str
@param search the start to search for, not null
@return true if equal using the case rules
@throws NullPointerException if either string is null | [
"Checks",
"if",
"one",
"string",
"contains",
"another",
"at",
"a",
"specific",
"index",
"using",
"the",
"case",
"-",
"sensitivity",
"rule",
".",
"<p",
">",
"This",
"method",
"mimics",
"parts",
"of",
"{",
"@link",
"String#regionMatches",
"(",
"boolean",
"int"... | train | https://github.com/floragunncom/search-guard/blob/f9828004e11dc0e4b6da4dead1fafcf3be8f7f6d/src/main/java/com/floragunn/searchguard/support/WildcardMatcher.java#L623-L625 |
d-michail/jheaps | src/main/java/org/jheaps/monotone/AbstractRadixHeap.java | AbstractRadixHeap.insert | @Override
@ConstantTime(amortized = true)
public void insert(K key) {
if (key == null) {
throw new IllegalArgumentException("Null keys not permitted");
}
if (compare(key, maxKey) > 0) {
throw new IllegalArgumentException("Key is more than the maximum allowed key");
}
if (compare(key, lastDeletedKey) < 0) {
throw new IllegalArgumentException("Invalid key. Monotone heap.");
}
int b = computeBucket(key, lastDeletedKey);
buckets[b].add(key);
// update current minimum cache
if (currentMin == null || compare(key, currentMin) < 0) {
currentMin = key;
currentMinBucket = b;
currentMinPos = buckets[b].size() - 1;
}
size++;
} | java | @Override
@ConstantTime(amortized = true)
public void insert(K key) {
if (key == null) {
throw new IllegalArgumentException("Null keys not permitted");
}
if (compare(key, maxKey) > 0) {
throw new IllegalArgumentException("Key is more than the maximum allowed key");
}
if (compare(key, lastDeletedKey) < 0) {
throw new IllegalArgumentException("Invalid key. Monotone heap.");
}
int b = computeBucket(key, lastDeletedKey);
buckets[b].add(key);
// update current minimum cache
if (currentMin == null || compare(key, currentMin) < 0) {
currentMin = key;
currentMinBucket = b;
currentMinPos = buckets[b].size() - 1;
}
size++;
} | [
"@",
"Override",
"@",
"ConstantTime",
"(",
"amortized",
"=",
"true",
")",
"public",
"void",
"insert",
"(",
"K",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null keys not permitted\"",
")",
... | {@inheritDoc}
@throws IllegalArgumentException
if the key is null
@throws IllegalArgumentException
if the key is less than the minimum allowed key
@throws IllegalArgumentException
if the key is more than the maximum allowed key
@throws IllegalArgumentException
if the key is less than the last deleted key (or the minimum
key allowed if no key has been deleted) | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/monotone/AbstractRadixHeap.java#L119-L143 |
tango-controls/JTango | server/src/main/java/org/tango/server/build/CommandBuilder.java | CommandBuilder.build | public void build(final DeviceImpl device, final Object businessObject, final Method m, final boolean isOnDeviceImpl)
throws DevFailed {
xlogger.entry();
final Command annot = m.getAnnotation(Command.class);
// retrieve parameter type
final Class<?>[] paramTypeTable = m.getParameterTypes();
if (paramTypeTable.length > 1) {
throw DevFailedUtils.newDevFailed("INIT_FAILED", "Command can have only one parameter");
}
Class<?> paramType;
if (paramTypeTable.length == 0) {
paramType = Void.class;
} else {
paramType = paramTypeTable[0];
}
// retrieve returned type
final Class<?> returnedType = m.getReturnType();
// logger
// .debug("get returned type of cmd {}", returnedType
// .getCanonicalName());
String cmdName;
if ("".equals(annot.name())) {
cmdName = m.getName();
} else {
cmdName = annot.name();
}
logger.debug("Has a command: {} type {}", cmdName, paramType.getCanonicalName());
final CommandConfiguration config = new CommandConfiguration(cmdName, paramType, returnedType,
annot.inTypeDesc(), annot.outTypeDesc(), DispLevel.from_int(annot.displayLevel()), annot.isPolled(),
annot.pollingPeriod());
ReflectCommandBehavior behavior = null;
if (isOnDeviceImpl) {
behavior = new ReflectCommandBehavior(m, device, config);
} else {
behavior = new ReflectCommandBehavior(m, businessObject, config);
}
final CommandImpl command = new CommandImpl(behavior, device.getName());
BuilderUtils.setStateMachine(m, command);
device.addCommand(command);
xlogger.exit();
} | java | public void build(final DeviceImpl device, final Object businessObject, final Method m, final boolean isOnDeviceImpl)
throws DevFailed {
xlogger.entry();
final Command annot = m.getAnnotation(Command.class);
// retrieve parameter type
final Class<?>[] paramTypeTable = m.getParameterTypes();
if (paramTypeTable.length > 1) {
throw DevFailedUtils.newDevFailed("INIT_FAILED", "Command can have only one parameter");
}
Class<?> paramType;
if (paramTypeTable.length == 0) {
paramType = Void.class;
} else {
paramType = paramTypeTable[0];
}
// retrieve returned type
final Class<?> returnedType = m.getReturnType();
// logger
// .debug("get returned type of cmd {}", returnedType
// .getCanonicalName());
String cmdName;
if ("".equals(annot.name())) {
cmdName = m.getName();
} else {
cmdName = annot.name();
}
logger.debug("Has a command: {} type {}", cmdName, paramType.getCanonicalName());
final CommandConfiguration config = new CommandConfiguration(cmdName, paramType, returnedType,
annot.inTypeDesc(), annot.outTypeDesc(), DispLevel.from_int(annot.displayLevel()), annot.isPolled(),
annot.pollingPeriod());
ReflectCommandBehavior behavior = null;
if (isOnDeviceImpl) {
behavior = new ReflectCommandBehavior(m, device, config);
} else {
behavior = new ReflectCommandBehavior(m, businessObject, config);
}
final CommandImpl command = new CommandImpl(behavior, device.getName());
BuilderUtils.setStateMachine(m, command);
device.addCommand(command);
xlogger.exit();
} | [
"public",
"void",
"build",
"(",
"final",
"DeviceImpl",
"device",
",",
"final",
"Object",
"businessObject",
",",
"final",
"Method",
"m",
",",
"final",
"boolean",
"isOnDeviceImpl",
")",
"throws",
"DevFailed",
"{",
"xlogger",
".",
"entry",
"(",
")",
";",
"final... | Create a Tango command {@link Command}
@param device
@param businessObject
@param m
@param isOnDeviceImpl
@throws DevFailed | [
"Create",
"a",
"Tango",
"command",
"{",
"@link",
"Command",
"}"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/CommandBuilder.java#L63-L105 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/Constraint.java | Constraint.findFkRef | RowIterator findFkRef(Session session, Object[] row, boolean delete) {
if (row == null || ArrayUtil.hasNull(row, core.mainCols)) {
return core.refIndex.emptyIterator();
}
PersistentStore store = session.sessionData.getRowStore(core.refTable);
return core.refIndex.findFirstRow(session, store, row, core.mainCols);
} | java | RowIterator findFkRef(Session session, Object[] row, boolean delete) {
if (row == null || ArrayUtil.hasNull(row, core.mainCols)) {
return core.refIndex.emptyIterator();
}
PersistentStore store = session.sessionData.getRowStore(core.refTable);
return core.refIndex.findFirstRow(session, store, row, core.mainCols);
} | [
"RowIterator",
"findFkRef",
"(",
"Session",
"session",
",",
"Object",
"[",
"]",
"row",
",",
"boolean",
"delete",
")",
"{",
"if",
"(",
"row",
"==",
"null",
"||",
"ArrayUtil",
".",
"hasNull",
"(",
"row",
",",
"core",
".",
"mainCols",
")",
")",
"{",
"re... | New method to find any referencing row for a foreign key (finds row in
child table). If ON DELETE CASCADE is specified for this constraint, then
the method finds the first row among the rows of the table ordered by the
index and doesn't throw. Without ON DELETE CASCADE, the method attempts
to finds any row that exists. If no
row is found, null is returned. (fredt@users)
@param session Session
@param row array of objects for a database row
@param delete should we allow 'ON DELETE CASCADE' or 'ON UPDATE CASCADE'
@return iterator
@ | [
"New",
"method",
"to",
"find",
"any",
"referencing",
"row",
"for",
"a",
"foreign",
"key",
"(",
"finds",
"row",
"in",
"child",
"table",
")",
".",
"If",
"ON",
"DELETE",
"CASCADE",
"is",
"specified",
"for",
"this",
"constraint",
"then",
"the",
"method",
"fi... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Constraint.java#L905-L914 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/OptionsApi.java | OptionsApi.optionsGet | public OptionsGetResponseSuccess optionsGet(String personDbid, String agentGroupDbid) throws ApiException {
ApiResponse<OptionsGetResponseSuccess> resp = optionsGetWithHttpInfo(personDbid, agentGroupDbid);
return resp.getData();
} | java | public OptionsGetResponseSuccess optionsGet(String personDbid, String agentGroupDbid) throws ApiException {
ApiResponse<OptionsGetResponseSuccess> resp = optionsGetWithHttpInfo(personDbid, agentGroupDbid);
return resp.getData();
} | [
"public",
"OptionsGetResponseSuccess",
"optionsGet",
"(",
"String",
"personDbid",
",",
"String",
"agentGroupDbid",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"OptionsGetResponseSuccess",
">",
"resp",
"=",
"optionsGetWithHttpInfo",
"(",
"personDbid",
",",
"a... | Receive exist options.
The GET operation will fetch CloudCluster/Options and merges it with person and sgent groups annexes.
@param personDbid DBID of a person. Options will be merged with the Person's annex and annexes of it's agent groups. Mutual with agent_group_dbid. (optional)
@param agentGroupDbid DBID of a person. Options will be merged with the Agent Groups's annex. Mutual with person_dbid. (optional)
@return OptionsGetResponseSuccess
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Receive",
"exist",
"options",
".",
"The",
"GET",
"operation",
"will",
"fetch",
"CloudCluster",
"/",
"Options",
"and",
"merges",
"it",
"with",
"person",
"and",
"sgent",
"groups",
"annexes",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/OptionsApi.java#L135-L138 |
ben-manes/caffeine | jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java | EventDispatcher.publishUpdated | public void publishUpdated(Cache<K, V> cache, K key, V oldValue, V newValue) {
publish(cache, EventType.UPDATED, key, oldValue, newValue, /* quiet */ false);
} | java | public void publishUpdated(Cache<K, V> cache, K key, V oldValue, V newValue) {
publish(cache, EventType.UPDATED, key, oldValue, newValue, /* quiet */ false);
} | [
"public",
"void",
"publishUpdated",
"(",
"Cache",
"<",
"K",
",",
"V",
">",
"cache",
",",
"K",
"key",
",",
"V",
"oldValue",
",",
"V",
"newValue",
")",
"{",
"publish",
"(",
"cache",
",",
"EventType",
".",
"UPDATED",
",",
"key",
",",
"oldValue",
",",
... | Publishes a update event for the entry to all of the interested listeners.
@param cache the cache where the entry was updated
@param key the entry's key
@param oldValue the entry's old value
@param newValue the entry's new value | [
"Publishes",
"a",
"update",
"event",
"for",
"the",
"entry",
"to",
"all",
"of",
"the",
"interested",
"listeners",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L125-L127 |
xcesco/kripton | kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java | StringUtils.ifNotEmptyAppend | public static String ifNotEmptyAppend(String chekString, String value) {
if (hasText(chekString)) {
return value+chekString;
} else {
return "";
}
} | java | public static String ifNotEmptyAppend(String chekString, String value) {
if (hasText(chekString)) {
return value+chekString;
} else {
return "";
}
} | [
"public",
"static",
"String",
"ifNotEmptyAppend",
"(",
"String",
"chekString",
",",
"String",
"value",
")",
"{",
"if",
"(",
"hasText",
"(",
"chekString",
")",
")",
"{",
"return",
"value",
"+",
"chekString",
";",
"}",
"else",
"{",
"return",
"\"\"",
";",
"... | <p>
If <code>checkString</code> has text, returns value+checkString. Otherwise
empty string was returned
</p>
@param chekString the chek string
@param value the value
@return the string | [
"<p",
">",
"If",
"<code",
">",
"checkString<",
"/",
"code",
">",
"has",
"text",
"returns",
"value",
"+",
"checkString",
".",
"Otherwise",
"empty",
"string",
"was",
"returned",
"<",
"/",
"p",
">"
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java#L249-L255 |
google/error-prone-javac | src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java | JShellTool.fluff | @Override
public void fluff(String format, Object... args) {
if (showFluff()) {
hard(format, args);
}
} | java | @Override
public void fluff(String format, Object... args) {
if (showFluff()) {
hard(format, args);
}
} | [
"@",
"Override",
"public",
"void",
"fluff",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"showFluff",
"(",
")",
")",
"{",
"hard",
"(",
"format",
",",
"args",
")",
";",
"}",
"}"
] | Optional output
@param format printf format
@param args printf args | [
"Optional",
"output"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L697-L702 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroupConditionBuilder.java | RolloutGroupConditionBuilder.errorAction | public RolloutGroupConditionBuilder errorAction(final RolloutGroupErrorAction action, final String expression) {
conditions.setErrorAction(action);
conditions.setErrorActionExp(expression);
return this;
} | java | public RolloutGroupConditionBuilder errorAction(final RolloutGroupErrorAction action, final String expression) {
conditions.setErrorAction(action);
conditions.setErrorActionExp(expression);
return this;
} | [
"public",
"RolloutGroupConditionBuilder",
"errorAction",
"(",
"final",
"RolloutGroupErrorAction",
"action",
",",
"final",
"String",
"expression",
")",
"{",
"conditions",
".",
"setErrorAction",
"(",
"action",
")",
";",
"conditions",
".",
"setErrorActionExp",
"(",
"expr... | Sets the error action and expression on the builder.
@param action
the error action
@param expression
the error expression
@return the builder itself | [
"Sets",
"the",
"error",
"action",
"and",
"expression",
"on",
"the",
"builder",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroupConditionBuilder.java#L86-L90 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java | CmsInlineEditOverlay.setSelectPosition | private void setSelectPosition(int posX, int posY, int height, int width) {
int useWidth = Window.getClientWidth();
int bodyWidth = RootPanel.getBodyElement().getClientWidth() + RootPanel.getBodyElement().getOffsetLeft();
if (bodyWidth > useWidth) {
useWidth = bodyWidth;
}
int useHeight = Window.getClientHeight();
int bodyHeight = RootPanel.getBodyElement().getClientHeight() + RootPanel.getBodyElement().getOffsetTop();
if (bodyHeight > useHeight) {
useHeight = bodyHeight;
}
m_overlayLeftStyle.setWidth(posX - m_offset, Unit.PX);
m_overlayLeftStyle.setHeight(useHeight, Unit.PX);
m_borderLeftStyle.setHeight(height + (4 * m_offset), Unit.PX);
m_borderLeftStyle.setTop(posY - (2 * m_offset), Unit.PX);
m_borderLeftStyle.setLeft(posX - (2 * m_offset), Unit.PX);
m_overlayTopStyle.setLeft(posX - m_offset, Unit.PX);
m_overlayTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
m_overlayTopStyle.setHeight(posY - m_offset, Unit.PX);
m_borderTopStyle.setLeft(posX - m_offset, Unit.PX);
m_borderTopStyle.setTop(posY - (2 * m_offset), Unit.PX);
if (m_hasButtonBar) {
m_borderTopStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
} else {
m_borderTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
}
m_overlayBottomStyle.setLeft(posX - m_offset, Unit.PX);
m_overlayBottomStyle.setWidth(width + m_offset + m_offset, Unit.PX);
m_overlayBottomStyle.setHeight(useHeight - posY - height - m_offset, Unit.PX);
m_overlayBottomStyle.setTop(posY + height + m_offset, Unit.PX);
m_borderBottomStyle.setLeft(posX - m_offset, Unit.PX);
m_borderBottomStyle.setTop((posY + height) + m_offset, Unit.PX);
if (m_hasButtonBar) {
m_borderBottomStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
} else {
m_borderBottomStyle.setWidth(width + (2 * m_offset), Unit.PX);
}
m_overlayRightStyle.setLeft(posX + width + m_offset, Unit.PX);
m_overlayRightStyle.setWidth(useWidth - posX - width - m_offset, Unit.PX);
m_overlayRightStyle.setHeight(useHeight, Unit.PX);
m_borderRightStyle.setHeight(height + (4 * m_offset), Unit.PX);
m_borderRightStyle.setTop(posY - (2 * m_offset), Unit.PX);
if (m_hasButtonBar) {
m_borderRightStyle.setLeft(posX + width + m_offset + BUTTON_BAR_WIDTH, Unit.PX);
} else {
m_borderRightStyle.setLeft(posX + width + m_offset, Unit.PX);
}
m_buttonBar.getStyle().setTop(posY - m_offset, Unit.PX);
m_buttonBar.getStyle().setHeight(height + (2 * m_offset), Unit.PX);
m_buttonBar.getStyle().setLeft(posX + width + m_offset + 1, Unit.PX);
} | java | private void setSelectPosition(int posX, int posY, int height, int width) {
int useWidth = Window.getClientWidth();
int bodyWidth = RootPanel.getBodyElement().getClientWidth() + RootPanel.getBodyElement().getOffsetLeft();
if (bodyWidth > useWidth) {
useWidth = bodyWidth;
}
int useHeight = Window.getClientHeight();
int bodyHeight = RootPanel.getBodyElement().getClientHeight() + RootPanel.getBodyElement().getOffsetTop();
if (bodyHeight > useHeight) {
useHeight = bodyHeight;
}
m_overlayLeftStyle.setWidth(posX - m_offset, Unit.PX);
m_overlayLeftStyle.setHeight(useHeight, Unit.PX);
m_borderLeftStyle.setHeight(height + (4 * m_offset), Unit.PX);
m_borderLeftStyle.setTop(posY - (2 * m_offset), Unit.PX);
m_borderLeftStyle.setLeft(posX - (2 * m_offset), Unit.PX);
m_overlayTopStyle.setLeft(posX - m_offset, Unit.PX);
m_overlayTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
m_overlayTopStyle.setHeight(posY - m_offset, Unit.PX);
m_borderTopStyle.setLeft(posX - m_offset, Unit.PX);
m_borderTopStyle.setTop(posY - (2 * m_offset), Unit.PX);
if (m_hasButtonBar) {
m_borderTopStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
} else {
m_borderTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
}
m_overlayBottomStyle.setLeft(posX - m_offset, Unit.PX);
m_overlayBottomStyle.setWidth(width + m_offset + m_offset, Unit.PX);
m_overlayBottomStyle.setHeight(useHeight - posY - height - m_offset, Unit.PX);
m_overlayBottomStyle.setTop(posY + height + m_offset, Unit.PX);
m_borderBottomStyle.setLeft(posX - m_offset, Unit.PX);
m_borderBottomStyle.setTop((posY + height) + m_offset, Unit.PX);
if (m_hasButtonBar) {
m_borderBottomStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
} else {
m_borderBottomStyle.setWidth(width + (2 * m_offset), Unit.PX);
}
m_overlayRightStyle.setLeft(posX + width + m_offset, Unit.PX);
m_overlayRightStyle.setWidth(useWidth - posX - width - m_offset, Unit.PX);
m_overlayRightStyle.setHeight(useHeight, Unit.PX);
m_borderRightStyle.setHeight(height + (4 * m_offset), Unit.PX);
m_borderRightStyle.setTop(posY - (2 * m_offset), Unit.PX);
if (m_hasButtonBar) {
m_borderRightStyle.setLeft(posX + width + m_offset + BUTTON_BAR_WIDTH, Unit.PX);
} else {
m_borderRightStyle.setLeft(posX + width + m_offset, Unit.PX);
}
m_buttonBar.getStyle().setTop(posY - m_offset, Unit.PX);
m_buttonBar.getStyle().setHeight(height + (2 * m_offset), Unit.PX);
m_buttonBar.getStyle().setLeft(posX + width + m_offset + 1, Unit.PX);
} | [
"private",
"void",
"setSelectPosition",
"(",
"int",
"posX",
",",
"int",
"posY",
",",
"int",
"height",
",",
"int",
"width",
")",
"{",
"int",
"useWidth",
"=",
"Window",
".",
"getClientWidth",
"(",
")",
";",
"int",
"bodyWidth",
"=",
"RootPanel",
".",
"getBo... | Sets position and size of the overlay area.<p>
@param posX the new X position
@param posY the new Y position
@param height the new height
@param width the new width | [
"Sets",
"position",
"and",
"size",
"of",
"the",
"overlay",
"area",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java#L451-L511 |
temyers/cucumber-jvm-parallel-plugin | src/main/java/com/github/timm/cucumber/generate/GenerateRunnersMojo.java | GenerateRunnersMojo.overrideParametersWithCucumberOptions | private OverriddenCucumberOptionsParameters overrideParametersWithCucumberOptions() throws MojoExecutionException {
try {
final OverriddenCucumberOptionsParameters overriddenParameters =
new OverriddenCucumberOptionsParameters()
.setTags(tags)
.setGlue(glue)
.setStrict(strict)
.setPlugins(parseFormatAndPlugins(format, plugins == null ? new ArrayList<Plugin>() : plugins))
.setMonochrome(monochrome);
if (cucumberOptions != null && cucumberOptions.length() > 0) {
final RuntimeOptions options = new RuntimeOptions(cucumberOptions);
overriddenParameters
.overrideTags(options.getFilters())
.overrideGlue(options.getGlue())
.overridePlugins(parsePlugins(options.getPluginNames()))
.overrideStrict(options.isStrict())
.overrideMonochrome(options.isMonochrome());
}
return overriddenParameters;
} catch (IllegalArgumentException e) {
throw new MojoExecutionException(this, "Invalid parameter. ", e.getMessage());
}
} | java | private OverriddenCucumberOptionsParameters overrideParametersWithCucumberOptions() throws MojoExecutionException {
try {
final OverriddenCucumberOptionsParameters overriddenParameters =
new OverriddenCucumberOptionsParameters()
.setTags(tags)
.setGlue(glue)
.setStrict(strict)
.setPlugins(parseFormatAndPlugins(format, plugins == null ? new ArrayList<Plugin>() : plugins))
.setMonochrome(monochrome);
if (cucumberOptions != null && cucumberOptions.length() > 0) {
final RuntimeOptions options = new RuntimeOptions(cucumberOptions);
overriddenParameters
.overrideTags(options.getFilters())
.overrideGlue(options.getGlue())
.overridePlugins(parsePlugins(options.getPluginNames()))
.overrideStrict(options.isStrict())
.overrideMonochrome(options.isMonochrome());
}
return overriddenParameters;
} catch (IllegalArgumentException e) {
throw new MojoExecutionException(this, "Invalid parameter. ", e.getMessage());
}
} | [
"private",
"OverriddenCucumberOptionsParameters",
"overrideParametersWithCucumberOptions",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"try",
"{",
"final",
"OverriddenCucumberOptionsParameters",
"overriddenParameters",
"=",
"new",
"OverriddenCucumberOptionsParameters",
"(",
... | Overrides the parameters with cucumber.options if they have been specified. Plugins have
somewhat limited support. | [
"Overrides",
"the",
"parameters",
"with",
"cucumber",
".",
"options",
"if",
"they",
"have",
"been",
"specified",
".",
"Plugins",
"have",
"somewhat",
"limited",
"support",
"."
] | train | https://github.com/temyers/cucumber-jvm-parallel-plugin/blob/931628fc1e2822be667ec216e10e706993974aa4/src/main/java/com/github/timm/cucumber/generate/GenerateRunnersMojo.java#L238-L264 |
javers/javers | javers-core/src/main/java/org/javers/core/JaversBuilder.java | JaversBuilder.registerValue | public <T> JaversBuilder registerValue(Class<T> valueClass, CustomValueComparator<T> customValueComparator) {
argumentsAreNotNull(valueClass, customValueComparator);
if (!clientsClassDefinitions.containsKey(valueClass)){
registerType(new ValueDefinition(valueClass));
}
ValueDefinition def = getClassDefinition(valueClass);
def.setCustomValueComparator(customValueComparator);
return this;
} | java | public <T> JaversBuilder registerValue(Class<T> valueClass, CustomValueComparator<T> customValueComparator) {
argumentsAreNotNull(valueClass, customValueComparator);
if (!clientsClassDefinitions.containsKey(valueClass)){
registerType(new ValueDefinition(valueClass));
}
ValueDefinition def = getClassDefinition(valueClass);
def.setCustomValueComparator(customValueComparator);
return this;
} | [
"public",
"<",
"T",
">",
"JaversBuilder",
"registerValue",
"(",
"Class",
"<",
"T",
">",
"valueClass",
",",
"CustomValueComparator",
"<",
"T",
">",
"customValueComparator",
")",
"{",
"argumentsAreNotNull",
"(",
"valueClass",
",",
"customValueComparator",
")",
";",
... | Registers a {@link ValueType} with a custom comparator to be used instead of
default {@link Object#equals(Object)}.
<br/><br/>
Given comparator is used when given Value type is:
<ul>
<li/>simple property
<li/>List item
<li/>Array item
<li/>Map value
</ul>
Since this comparator is not aligned with {@link Object#hashCode()},
it <b>is not used </b> when given Value type is:
<ul>
<li/>Map key
<li/>Set item
</ul>
For example, BigDecimals are (by default) ValueTypes
compared using {@link java.math.BigDecimal#equals(Object)}.
If you want to compare them in the smarter way, ignoring trailing zeros:
<pre>
javersBuilder.registerValue(BigDecimal.class, (a,b) -> a.compareTo(b) == 0);
</pre>
@see <a href="http://javers.org/documentation/domain-configuration/#ValueType">http://javers.org/documentation/domain-configuration/#ValueType</a>
@since 3.3 | [
"Registers",
"a",
"{",
"@link",
"ValueType",
"}",
"with",
"a",
"custom",
"comparator",
"to",
"be",
"used",
"instead",
"of",
"default",
"{",
"@link",
"Object#equals",
"(",
"Object",
")",
"}",
".",
"<br",
"/",
">",
"<br",
"/",
">"
] | train | https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/JaversBuilder.java#L376-L386 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java | MapIterate.forEachKey | public static <K, V> void forEachKey(Map<K, V> map, Procedure<? super K> procedure)
{
if (map == null)
{
throw new IllegalArgumentException("Cannot perform a forEachKey on null");
}
if (MapIterate.notEmpty(map))
{
if (map instanceof UnsortedMapIterable)
{
((MapIterable<K, V>) map).forEachKey(procedure);
}
else
{
IterableIterate.forEach(map.keySet(), procedure);
}
}
} | java | public static <K, V> void forEachKey(Map<K, V> map, Procedure<? super K> procedure)
{
if (map == null)
{
throw new IllegalArgumentException("Cannot perform a forEachKey on null");
}
if (MapIterate.notEmpty(map))
{
if (map instanceof UnsortedMapIterable)
{
((MapIterable<K, V>) map).forEachKey(procedure);
}
else
{
IterableIterate.forEach(map.keySet(), procedure);
}
}
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"forEachKey",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Procedure",
"<",
"?",
"super",
"K",
">",
"procedure",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"throw",
"new",
"Ille... | For each key of the map, {@code procedure} is evaluated with the key as the parameter. | [
"For",
"each",
"key",
"of",
"the",
"map",
"{"
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L793-L811 |
joniles/mpxj | src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java | UniversalProjectReader.readProjectFile | private ProjectFile readProjectFile(ProjectReader reader, InputStream stream) throws MPXJException
{
addListeners(reader);
return reader.read(stream);
} | java | private ProjectFile readProjectFile(ProjectReader reader, InputStream stream) throws MPXJException
{
addListeners(reader);
return reader.read(stream);
} | [
"private",
"ProjectFile",
"readProjectFile",
"(",
"ProjectReader",
"reader",
",",
"InputStream",
"stream",
")",
"throws",
"MPXJException",
"{",
"addListeners",
"(",
"reader",
")",
";",
"return",
"reader",
".",
"read",
"(",
"stream",
")",
";",
"}"
] | Adds listeners and reads from a stream.
@param reader reader for file type
@param stream schedule data
@return ProjectFile instance | [
"Adds",
"listeners",
"and",
"reads",
"from",
"a",
"stream",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L353-L357 |
m-m-m/util | cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java | CliState.requireMode | protected CliModeObject requireMode(String id, Object annotationContainer) {
CliModeObject modeObject = getMode(id);
if (modeObject == null) {
CliStyleHandling handling = getCliStyle().modeUndefined();
if (handling != CliStyleHandling.OK) {
handling.handle(LOG, new CliModeUndefinedException(id, annotationContainer));
}
CliModeContainer modeContainer = new CliModeContainer(id);
addMode(modeContainer);
modeObject = modeContainer;
}
return modeObject;
} | java | protected CliModeObject requireMode(String id, Object annotationContainer) {
CliModeObject modeObject = getMode(id);
if (modeObject == null) {
CliStyleHandling handling = getCliStyle().modeUndefined();
if (handling != CliStyleHandling.OK) {
handling.handle(LOG, new CliModeUndefinedException(id, annotationContainer));
}
CliModeContainer modeContainer = new CliModeContainer(id);
addMode(modeContainer);
modeObject = modeContainer;
}
return modeObject;
} | [
"protected",
"CliModeObject",
"requireMode",
"(",
"String",
"id",
",",
"Object",
"annotationContainer",
")",
"{",
"CliModeObject",
"modeObject",
"=",
"getMode",
"(",
"id",
")",
";",
"if",
"(",
"modeObject",
"==",
"null",
")",
"{",
"CliStyleHandling",
"handling",... | This method is like {@link #getMode(String)} but also {@link net.sf.mmm.util.cli.api.CliStyle#modeUndefined()
handles} the case that a {@link net.sf.mmm.util.cli.api.CliMode} may be undefined.
@param id is the {@link net.sf.mmm.util.cli.api.CliMode#id() ID} of the requested
{@link net.sf.mmm.util.cli.api.CliMode}.
@param annotationContainer is the {@link CliArgumentContainer} or {@link CliOptionContainer}.
@return the requested {@link CliModeObject}. | [
"This",
"method",
"is",
"like",
"{",
"@link",
"#getMode",
"(",
"String",
")",
"}",
"but",
"also",
"{",
"@link",
"net",
".",
"sf",
".",
"mmm",
".",
"util",
".",
"cli",
".",
"api",
".",
"CliStyle#modeUndefined",
"()",
"handles",
"}",
"the",
"case",
"th... | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java#L307-L320 |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/bodyparsers/BodyParserJson.java | BodyParserJson.invoke | @Override
public <T> T invoke(byte[] bytes, Class<T> classOfT) {
T t = null;
try {
t = json.mapper().readValue(bytes, classOfT);
} catch (IOException e) {
LOGGER.error(ERROR, e);
}
return t;
} | java | @Override
public <T> T invoke(byte[] bytes, Class<T> classOfT) {
T t = null;
try {
t = json.mapper().readValue(bytes, classOfT);
} catch (IOException e) {
LOGGER.error(ERROR, e);
}
return t;
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"invoke",
"(",
"byte",
"[",
"]",
"bytes",
",",
"Class",
"<",
"T",
">",
"classOfT",
")",
"{",
"T",
"t",
"=",
"null",
";",
"try",
"{",
"t",
"=",
"json",
".",
"mapper",
"(",
")",
".",
"readValue",
"... | Builds an instance of {@literal T} from the request payload.
@param bytes the payload.
@param classOfT The class we expect
@param <T> the type of the object
@return the build object, {@literal null} if the object cannot be built. | [
"Builds",
"an",
"instance",
"of",
"{",
"@literal",
"T",
"}",
"from",
"the",
"request",
"payload",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/bodyparsers/BodyParserJson.java#L102-L112 |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/ConnectionPropertyFileScannerPlugin.java | ConnectionPropertyFileScannerPlugin.loadDriver | private void loadDriver(String driver) throws IOException {
if (driver != null) {
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
throw new IOException(driver + " cannot be loaded, skipping scan of schema.", e);
}
}
} | java | private void loadDriver(String driver) throws IOException {
if (driver != null) {
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
throw new IOException(driver + " cannot be loaded, skipping scan of schema.", e);
}
}
} | [
"private",
"void",
"loadDriver",
"(",
"String",
"driver",
")",
"throws",
"IOException",
"{",
"if",
"(",
"driver",
"!=",
"null",
")",
"{",
"try",
"{",
"Class",
".",
"forName",
"(",
"driver",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",... | Load a class, e.g. the JDBC driver.
@param driver
The class name. | [
"Load",
"a",
"class",
"e",
".",
"g",
".",
"the",
"JDBC",
"driver",
"."
] | train | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/ConnectionPropertyFileScannerPlugin.java#L108-L116 |
undertow-io/undertow | parser-generator/src/main/java/io/undertow/annotationprocessor/AbstractParserGenerator.java | AbstractParserGenerator.stateNotFound | private static void stateNotFound(final CodeAttribute c, final TableSwitchBuilder builder) {
c.branchEnd(builder.getDefaultBranchEnd().get());
c.newInstruction(RuntimeException.class);
c.dup();
c.ldc("Invalid character");
c.invokespecial(RuntimeException.class.getName(), "<init>", "(Ljava/lang/String;)V");
c.athrow();
} | java | private static void stateNotFound(final CodeAttribute c, final TableSwitchBuilder builder) {
c.branchEnd(builder.getDefaultBranchEnd().get());
c.newInstruction(RuntimeException.class);
c.dup();
c.ldc("Invalid character");
c.invokespecial(RuntimeException.class.getName(), "<init>", "(Ljava/lang/String;)V");
c.athrow();
} | [
"private",
"static",
"void",
"stateNotFound",
"(",
"final",
"CodeAttribute",
"c",
",",
"final",
"TableSwitchBuilder",
"builder",
")",
"{",
"c",
".",
"branchEnd",
"(",
"builder",
".",
"getDefaultBranchEnd",
"(",
")",
".",
"get",
"(",
")",
")",
";",
"c",
"."... | Throws an exception when an invalid state is hit in a tableswitch | [
"Throws",
"an",
"exception",
"when",
"an",
"invalid",
"state",
"is",
"hit",
"in",
"a",
"tableswitch"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/parser-generator/src/main/java/io/undertow/annotationprocessor/AbstractParserGenerator.java#L709-L716 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/jaxp/XPathFactoryImpl.java | XPathFactoryImpl.setFeature | public void setFeature(String name, boolean value)
throws XPathFactoryConfigurationException {
// feature name cannot be null
if (name == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_FEATURE_NAME_NULL,
new Object[] { CLASS_NAME, new Boolean( value) } );
throw new NullPointerException( fmsg );
}
// secure processing?
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
featureSecureProcessing = value;
// all done processing feature
return;
}
// unknown feature
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_FEATURE_UNKNOWN,
new Object[] { name, CLASS_NAME, new Boolean(value) } );
throw new XPathFactoryConfigurationException( fmsg );
} | java | public void setFeature(String name, boolean value)
throws XPathFactoryConfigurationException {
// feature name cannot be null
if (name == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_FEATURE_NAME_NULL,
new Object[] { CLASS_NAME, new Boolean( value) } );
throw new NullPointerException( fmsg );
}
// secure processing?
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
featureSecureProcessing = value;
// all done processing feature
return;
}
// unknown feature
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_FEATURE_UNKNOWN,
new Object[] { name, CLASS_NAME, new Boolean(value) } );
throw new XPathFactoryConfigurationException( fmsg );
} | [
"public",
"void",
"setFeature",
"(",
"String",
"name",
",",
"boolean",
"value",
")",
"throws",
"XPathFactoryConfigurationException",
"{",
"// feature name cannot be null",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"String",
"fmsg",
"=",
"XSLMessages",
".",
"creat... | <p>Set a feature for this <code>XPathFactory</code> and
<code>XPath</code>s created by this factory.</p>
<p>
Feature names are fully qualified {@link java.net.URI}s.
Implementations may define their own features.
An {@link XPathFactoryConfigurationException} is thrown if this
<code>XPathFactory</code> or the <code>XPath</code>s
it creates cannot support the feature.
It is possible for an <code>XPathFactory</code> to expose a feature
value but be unable to change its state.
</p>
<p>See {@link javax.xml.xpath.XPathFactory} for full documentation
of specific features.</p>
@param name Feature name.
@param value Is feature state <code>true</code> or <code>false</code>.
@throws XPathFactoryConfigurationException if this
<code>XPathFactory</code> or the <code>XPath</code>s
it creates cannot support this feature.
@throws NullPointerException if <code>name</code> is
<code>null</code>. | [
"<p",
">",
"Set",
"a",
"feature",
"for",
"this",
"<code",
">",
"XPathFactory<",
"/",
"code",
">",
"and",
"<code",
">",
"XPath<",
"/",
"code",
">",
"s",
"created",
"by",
"this",
"factory",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/jaxp/XPathFactoryImpl.java#L136-L161 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java | DocTreeScanner.visitSince | @Override
public R visitSince(SinceTree node, P p) {
return scan(node.getBody(), p);
} | java | @Override
public R visitSince(SinceTree node, P p) {
return scan(node.getBody(), p);
} | [
"@",
"Override",
"public",
"R",
"visitSince",
"(",
"SinceTree",
"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#L423-L426 |
alkacon/opencms-core | src/org/opencms/main/CmsSessionManager.java | CmsSessionManager.killSession | public void killSession(CmsObject cms, CmsUser user) throws CmsException {
OpenCms.getRoleManager().checkRole(cms, CmsRole.ACCOUNT_MANAGER);
List<CmsSessionInfo> infos = getSessionInfos(user.getId());
for (CmsSessionInfo info : infos) {
m_sessionStorageProvider.remove(info.getSessionId());
}
} | java | public void killSession(CmsObject cms, CmsUser user) throws CmsException {
OpenCms.getRoleManager().checkRole(cms, CmsRole.ACCOUNT_MANAGER);
List<CmsSessionInfo> infos = getSessionInfos(user.getId());
for (CmsSessionInfo info : infos) {
m_sessionStorageProvider.remove(info.getSessionId());
}
} | [
"public",
"void",
"killSession",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
")",
"throws",
"CmsException",
"{",
"OpenCms",
".",
"getRoleManager",
"(",
")",
".",
"checkRole",
"(",
"cms",
",",
"CmsRole",
".",
"ACCOUNT_MANAGER",
")",
";",
"List",
"<",
"... | Kills all sessions for the given user.<p>
@param cms the current CMS context
@param user the user for whom the sessions should be killed
@throws CmsException if something goes wrong | [
"Kills",
"all",
"sessions",
"for",
"the",
"given",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSessionManager.java#L305-L312 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/query/Criteria.java | Criteria.fuzzy | public Criteria fuzzy(String s, float levenshteinDistance) {
if (!Float.isNaN(levenshteinDistance) && (levenshteinDistance < 0 || levenshteinDistance > 1)) {
throw new InvalidDataAccessApiUsageException("Levenshtein Distance has to be within its bounds (0.0 - 1.0).");
}
predicates.add(new Predicate(OperationKey.FUZZY, new Object[] { s, Float.valueOf(levenshteinDistance) }));
return this;
} | java | public Criteria fuzzy(String s, float levenshteinDistance) {
if (!Float.isNaN(levenshteinDistance) && (levenshteinDistance < 0 || levenshteinDistance > 1)) {
throw new InvalidDataAccessApiUsageException("Levenshtein Distance has to be within its bounds (0.0 - 1.0).");
}
predicates.add(new Predicate(OperationKey.FUZZY, new Object[] { s, Float.valueOf(levenshteinDistance) }));
return this;
} | [
"public",
"Criteria",
"fuzzy",
"(",
"String",
"s",
",",
"float",
"levenshteinDistance",
")",
"{",
"if",
"(",
"!",
"Float",
".",
"isNaN",
"(",
"levenshteinDistance",
")",
"&&",
"(",
"levenshteinDistance",
"<",
"0",
"||",
"levenshteinDistance",
">",
"1",
")",
... | Crates new {@link Predicate} with trailing {@code ~} followed by levensteinDistance
@param s
@param levenshteinDistance
@return | [
"Crates",
"new",
"{",
"@link",
"Predicate",
"}",
"with",
"trailing",
"{",
"@code",
"~",
"}",
"followed",
"by",
"levensteinDistance"
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L341-L347 |
apache/incubator-heron | heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java | SchedulerStateManagerAdaptor.getMetricsCacheLocation | public TopologyMaster.MetricsCacheLocation getMetricsCacheLocation(String topologyName) {
return awaitResult(delegate.getMetricsCacheLocation(null, topologyName));
} | java | public TopologyMaster.MetricsCacheLocation getMetricsCacheLocation(String topologyName) {
return awaitResult(delegate.getMetricsCacheLocation(null, topologyName));
} | [
"public",
"TopologyMaster",
".",
"MetricsCacheLocation",
"getMetricsCacheLocation",
"(",
"String",
"topologyName",
")",
"{",
"return",
"awaitResult",
"(",
"delegate",
".",
"getMetricsCacheLocation",
"(",
"null",
",",
"topologyName",
")",
")",
";",
"}"
] | Get the metricscache location for the given topology
@return MetricsCacheLocation | [
"Get",
"the",
"metricscache",
"location",
"for",
"the",
"given",
"topology"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L265-L267 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/Plan.java | Plan.registerCachedFile | public void registerCachedFile(String filePath, String name) throws IOException {
if (!this.cacheFile.containsKey(name)) {
try {
URI u = new URI(filePath);
if (!u.getPath().startsWith("/")) {
u = new URI(new File(filePath).getAbsolutePath());
}
FileSystem fs = FileSystem.get(u);
if (fs.exists(new Path(u.getPath()))) {
this.cacheFile.put(name, u.toString());
} else {
throw new RuntimeException("File " + u.toString() + " doesn't exist.");
}
} catch (URISyntaxException ex) {
throw new RuntimeException("Invalid path: " + filePath, ex);
}
} else {
throw new RuntimeException("cache file " + name + "already exists!");
}
} | java | public void registerCachedFile(String filePath, String name) throws IOException {
if (!this.cacheFile.containsKey(name)) {
try {
URI u = new URI(filePath);
if (!u.getPath().startsWith("/")) {
u = new URI(new File(filePath).getAbsolutePath());
}
FileSystem fs = FileSystem.get(u);
if (fs.exists(new Path(u.getPath()))) {
this.cacheFile.put(name, u.toString());
} else {
throw new RuntimeException("File " + u.toString() + " doesn't exist.");
}
} catch (URISyntaxException ex) {
throw new RuntimeException("Invalid path: " + filePath, ex);
}
} else {
throw new RuntimeException("cache file " + name + "already exists!");
}
} | [
"public",
"void",
"registerCachedFile",
"(",
"String",
"filePath",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"this",
".",
"cacheFile",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"try",
"{",
"URI",
"u",
"=",
"new",
"... | register cache files in program level
@param filePath The files must be stored in a place that can be accessed from all workers (most commonly HDFS)
@param name user defined name of that file
@throws java.io.IOException | [
"register",
"cache",
"files",
"in",
"program",
"level"
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/Plan.java#L308-L327 |
carewebframework/carewebframework-vista | org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java | FMDate.setCalendar | private long setCalendar(Calendar cal, int part, long value, long div) {
cal.set(part, (int) (value % div));
return value / div;
} | java | private long setCalendar(Calendar cal, int part, long value, long div) {
cal.set(part, (int) (value % div));
return value / div;
} | [
"private",
"long",
"setCalendar",
"(",
"Calendar",
"cal",
",",
"int",
"part",
",",
"long",
"value",
",",
"long",
"div",
")",
"{",
"cal",
".",
"set",
"(",
"part",
",",
"(",
"int",
")",
"(",
"value",
"%",
"div",
")",
")",
";",
"return",
"value",
"/... | Sets a calendar component based on the input value. Meant to be called successively, with the
return value used as the input value for the next call, to extract lower digits from the
input value to be set into the calendar component.
@param cal Calendar component.
@param part Calendar component to be set.
@param value Current value.
@param div Modulus for value to be extracted.
@return Original value divided by modulus. | [
"Sets",
"a",
"calendar",
"component",
"based",
"on",
"the",
"input",
"value",
".",
"Meant",
"to",
"be",
"called",
"successively",
"with",
"the",
"return",
"value",
"used",
"as",
"the",
"input",
"value",
"for",
"the",
"next",
"call",
"to",
"extract",
"lower... | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java#L149-L152 |
ModeShape/modeshape | sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/AbstractJavaMetadata.java | AbstractJavaMetadata.processPrimitiveType | protected FieldMetadata processPrimitiveType( FieldDeclaration fieldDeclaration ) {
PrimitiveType primitiveType = (PrimitiveType)fieldDeclaration.getType();
FieldMetadata primitiveFieldMetadata = FieldMetadata.primitiveType(primitiveType.getPrimitiveTypeCode().toString());
primitiveFieldMetadata.setName(getFieldName(fieldDeclaration));
// modifiers
processModifiersOfFieldDeclaration(fieldDeclaration, primitiveFieldMetadata);
// variables
processVariablesOfVariableDeclarationFragment(fieldDeclaration, primitiveFieldMetadata);
return primitiveFieldMetadata;
} | java | protected FieldMetadata processPrimitiveType( FieldDeclaration fieldDeclaration ) {
PrimitiveType primitiveType = (PrimitiveType)fieldDeclaration.getType();
FieldMetadata primitiveFieldMetadata = FieldMetadata.primitiveType(primitiveType.getPrimitiveTypeCode().toString());
primitiveFieldMetadata.setName(getFieldName(fieldDeclaration));
// modifiers
processModifiersOfFieldDeclaration(fieldDeclaration, primitiveFieldMetadata);
// variables
processVariablesOfVariableDeclarationFragment(fieldDeclaration, primitiveFieldMetadata);
return primitiveFieldMetadata;
} | [
"protected",
"FieldMetadata",
"processPrimitiveType",
"(",
"FieldDeclaration",
"fieldDeclaration",
")",
"{",
"PrimitiveType",
"primitiveType",
"=",
"(",
"PrimitiveType",
")",
"fieldDeclaration",
".",
"getType",
"(",
")",
";",
"FieldMetadata",
"primitiveFieldMetadata",
"="... | Process the primitive type of a {@link FieldDeclaration}.
@param fieldDeclaration - the field declaration.
@return PrimitiveFieldMetadata. | [
"Process",
"the",
"primitive",
"type",
"of",
"a",
"{",
"@link",
"FieldDeclaration",
"}",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/AbstractJavaMetadata.java#L633-L643 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/Version.java | Version.with | public Version with(Qualifier qualifier, int qualifierNumber) {
this.qualifier = defaultIfNull(qualifier, Qualifier.UNDEFINED);
this.qualifierNumber = Math.max(qualifierNumber, 0);
return this;
} | java | public Version with(Qualifier qualifier, int qualifierNumber) {
this.qualifier = defaultIfNull(qualifier, Qualifier.UNDEFINED);
this.qualifierNumber = Math.max(qualifierNumber, 0);
return this;
} | [
"public",
"Version",
"with",
"(",
"Qualifier",
"qualifier",
",",
"int",
"qualifierNumber",
")",
"{",
"this",
".",
"qualifier",
"=",
"defaultIfNull",
"(",
"qualifier",
",",
"Qualifier",
".",
"UNDEFINED",
")",
";",
"this",
".",
"qualifierNumber",
"=",
"Math",
... | Sets the {@link Version.Qualifier} for this {@link Version}.
@param qualifier {@link Version.Qualifier}.
@param qualifierNumber {@link Version.Qualifier} number.
@return this {@link Version} reference. | [
"Sets",
"the",
"{",
"@link",
"Version",
".",
"Qualifier",
"}",
"for",
"this",
"{",
"@link",
"Version",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Version.java#L616-L620 |
openengsb/openengsb | components/ekb/graphdb-orient/src/main/java/org/openengsb/core/ekb/graph/orient/internal/OrientModelGraph.java | OrientModelGraph.alreadyVisited | private boolean alreadyVisited(ODocument neighbor, ODocument[] steps) {
for (ODocument step : steps) {
ODocument out = graph.getOutVertex(step);
if (out.equals(neighbor)) {
return true;
}
}
return false;
} | java | private boolean alreadyVisited(ODocument neighbor, ODocument[] steps) {
for (ODocument step : steps) {
ODocument out = graph.getOutVertex(step);
if (out.equals(neighbor)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"alreadyVisited",
"(",
"ODocument",
"neighbor",
",",
"ODocument",
"[",
"]",
"steps",
")",
"{",
"for",
"(",
"ODocument",
"step",
":",
"steps",
")",
"{",
"ODocument",
"out",
"=",
"graph",
".",
"getOutVertex",
"(",
"step",
")",
";",
"i... | Checks if a model is already visited in the path search algorithm. Needed for the loop detection. | [
"Checks",
"if",
"a",
"model",
"is",
"already",
"visited",
"in",
"the",
"path",
"search",
"algorithm",
".",
"Needed",
"for",
"the",
"loop",
"detection",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/graphdb-orient/src/main/java/org/openengsb/core/ekb/graph/orient/internal/OrientModelGraph.java#L362-L370 |
ag-gipp/MathMLTools | mathml-gold/src/main/java/com/formulasearchengine/mathmltools/gold/GoldUtils.java | GoldUtils.writeGoldFile | public static void writeGoldFile(Path outputPath, JsonGouldiBean goldEntry) {
try {
try {
Files.createFile(outputPath);
} catch (FileAlreadyExistsException e) {
LOG.warn("File already exists!");
}
try (Writer out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outputPath.toFile()), "UTF-8"))) {
out.write(goldEntry.toString());
}
} catch (IOException e) {
LOG.error(e);
throw new RuntimeException(e);
}
} | java | public static void writeGoldFile(Path outputPath, JsonGouldiBean goldEntry) {
try {
try {
Files.createFile(outputPath);
} catch (FileAlreadyExistsException e) {
LOG.warn("File already exists!");
}
try (Writer out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outputPath.toFile()), "UTF-8"))) {
out.write(goldEntry.toString());
}
} catch (IOException e) {
LOG.error(e);
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"writeGoldFile",
"(",
"Path",
"outputPath",
",",
"JsonGouldiBean",
"goldEntry",
")",
"{",
"try",
"{",
"try",
"{",
"Files",
".",
"createFile",
"(",
"outputPath",
")",
";",
"}",
"catch",
"(",
"FileAlreadyExistsException",
"e",
")",
... | Writes a gouldi entry to the given path. Note that if the file already exists, it will be
overwritten and logging a warning message.
@param outputPath where the gouldi entry will be stored
@param goldEntry the gouldi entry as java object
@throws IOException | [
"Writes",
"a",
"gouldi",
"entry",
"to",
"the",
"given",
"path",
".",
"Note",
"that",
"if",
"the",
"file",
"already",
"exists",
"it",
"will",
"be",
"overwritten",
"and",
"logging",
"a",
"warning",
"message",
"."
] | train | https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-gold/src/main/java/com/formulasearchengine/mathmltools/gold/GoldUtils.java#L42-L57 |
JodaOrg/joda-money | src/main/java/org/joda/money/BigMoney.java | BigMoney.ofScale | public static BigMoney ofScale(CurrencyUnit currency, BigDecimal amount, int scale, RoundingMode roundingMode) {
MoneyUtils.checkNotNull(currency, "CurrencyUnit must not be null");
MoneyUtils.checkNotNull(amount, "Amount must not be null");
MoneyUtils.checkNotNull(roundingMode, "RoundingMode must not be null");
amount = amount.setScale(scale, roundingMode);
return BigMoney.of(currency, amount);
} | java | public static BigMoney ofScale(CurrencyUnit currency, BigDecimal amount, int scale, RoundingMode roundingMode) {
MoneyUtils.checkNotNull(currency, "CurrencyUnit must not be null");
MoneyUtils.checkNotNull(amount, "Amount must not be null");
MoneyUtils.checkNotNull(roundingMode, "RoundingMode must not be null");
amount = amount.setScale(scale, roundingMode);
return BigMoney.of(currency, amount);
} | [
"public",
"static",
"BigMoney",
"ofScale",
"(",
"CurrencyUnit",
"currency",
",",
"BigDecimal",
"amount",
",",
"int",
"scale",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"MoneyUtils",
".",
"checkNotNull",
"(",
"currency",
",",
"\"CurrencyUnit must not be null\"",
... | Obtains an instance of {@code BigMoney} from a {@code double} using a
well-defined conversion, rounding as necessary.
<p>
This allows you to create an instance with a specific currency and amount.
If the amount has a scale in excess of the scale of the currency then the excess
fractional digits are rounded using the rounding mode.
The result will have a minimum scale of zero.
@param currency the currency, not null
@param amount the amount of money, not null
@param scale the scale to use, zero or positive
@param roundingMode the rounding mode to use, not null
@return the new instance, never null
@throws ArithmeticException if the rounding fails | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"BigMoney",
"}",
"from",
"a",
"{",
"@code",
"double",
"}",
"using",
"a",
"well",
"-",
"defined",
"conversion",
"rounding",
"as",
"necessary",
".",
"<p",
">",
"This",
"allows",
"you",
"to",
"create",
"an",
... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/BigMoney.java#L151-L157 |
intellimate/Izou | src/main/java/org/intellimate/izou/system/sound/SoundManager.java | SoundManager.requestPermanent | public void requestPermanent(AddOnModel addOnModel, Identification source, boolean nonJava) {
debug("requesting permanent for addon: " + addOnModel);
boolean notUsing = isUsing.compareAndSet(false, true);
if (!notUsing) {
debug("already used by " + permanentAddOn);
synchronized (permanentUserReadWriteLock) {
if (permanentAddOn != null && permanentAddOn.equals(addOnModel)) {
if (knownIdentification == null)
knownIdentification = source;
return;
} else {
endPermanent(permanentAddOn);
addAsPermanent(addOnModel, source, nonJava);
}
}
} else {
addAsPermanent(addOnModel, source, nonJava);
}
} | java | public void requestPermanent(AddOnModel addOnModel, Identification source, boolean nonJava) {
debug("requesting permanent for addon: " + addOnModel);
boolean notUsing = isUsing.compareAndSet(false, true);
if (!notUsing) {
debug("already used by " + permanentAddOn);
synchronized (permanentUserReadWriteLock) {
if (permanentAddOn != null && permanentAddOn.equals(addOnModel)) {
if (knownIdentification == null)
knownIdentification = source;
return;
} else {
endPermanent(permanentAddOn);
addAsPermanent(addOnModel, source, nonJava);
}
}
} else {
addAsPermanent(addOnModel, source, nonJava);
}
} | [
"public",
"void",
"requestPermanent",
"(",
"AddOnModel",
"addOnModel",
",",
"Identification",
"source",
",",
"boolean",
"nonJava",
")",
"{",
"debug",
"(",
"\"requesting permanent for addon: \"",
"+",
"addOnModel",
")",
";",
"boolean",
"notUsing",
"=",
"isUsing",
"."... | tries to register the AddonModel as permanent
@param addOnModel the AddonModel to register
@param source the Source which requested the usage
@param nonJava true if it is not using java to play sounds | [
"tries",
"to",
"register",
"the",
"AddonModel",
"as",
"permanent"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/system/sound/SoundManager.java#L244-L262 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_acl_GET | public ArrayList<String> project_serviceName_acl_GET(String serviceName, OvhAclTypeEnum type) throws IOException {
String qPath = "/cloud/project/{serviceName}/acl";
StringBuilder sb = path(qPath, serviceName);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> project_serviceName_acl_GET(String serviceName, OvhAclTypeEnum type) throws IOException {
String qPath = "/cloud/project/{serviceName}/acl";
StringBuilder sb = path(qPath, serviceName);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"project_serviceName_acl_GET",
"(",
"String",
"serviceName",
",",
"OvhAclTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/acl\"",
";",
"StringBuilder",
"sb",
"=",
"... | Get ACL on your cloud project
REST: GET /cloud/project/{serviceName}/acl
@param type [required] Filter the value of type property (=)
@param serviceName [required] The project id | [
"Get",
"ACL",
"on",
"your",
"cloud",
"project"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L347-L353 |
SimiaCryptus/utilities | java-util/src/main/java/com/simiacryptus/util/Util.java | Util.cacheFile | public static File cacheFile(@javax.annotation.Nonnull final String url, @javax.annotation.Nonnull final String file) throws IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
if (!new File(file).exists()) {
IOUtils.copy(get(url), new FileOutputStream(file));
}
return new File(file);
} | java | public static File cacheFile(@javax.annotation.Nonnull final String url, @javax.annotation.Nonnull final String file) throws IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
if (!new File(file).exists()) {
IOUtils.copy(get(url), new FileOutputStream(file));
}
return new File(file);
} | [
"public",
"static",
"File",
"cacheFile",
"(",
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"final",
"String",
"url",
",",
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"final",
"String",
"file",
")",
"throws",
"IOException",
",",
"NoSuchAlgorithmExcepti... | Cache file file.
@param url the url
@param file the file
@return the file
@throws IOException the io exception
@throws NoSuchAlgorithmException the no such algorithm exception
@throws KeyStoreException the key store exception
@throws KeyManagementException the key management exception | [
"Cache",
"file",
"file",
"."
] | train | https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/Util.java#L200-L205 |
xmlunit/xmlunit | xmlunit-assertj/src/main/java/org/xmlunit/assertj/SingleNodeAssert.java | SingleNodeAssert.hasAttribute | public SingleNodeAssert hasAttribute(String attributeName, String attributeValue) {
isNotNull();
final Map.Entry<QName, String> attribute = attributeForName(attributeName);
if (attribute == null || !attribute.getValue().equals(attributeValue)) {
throwAssertionError(shouldHaveAttributeWithValue(actual.getNodeName(), attributeName, attributeValue));
}
return this;
} | java | public SingleNodeAssert hasAttribute(String attributeName, String attributeValue) {
isNotNull();
final Map.Entry<QName, String> attribute = attributeForName(attributeName);
if (attribute == null || !attribute.getValue().equals(attributeValue)) {
throwAssertionError(shouldHaveAttributeWithValue(actual.getNodeName(), attributeName, attributeValue));
}
return this;
} | [
"public",
"SingleNodeAssert",
"hasAttribute",
"(",
"String",
"attributeName",
",",
"String",
"attributeValue",
")",
"{",
"isNotNull",
"(",
")",
";",
"final",
"Map",
".",
"Entry",
"<",
"QName",
",",
"String",
">",
"attribute",
"=",
"attributeForName",
"(",
"att... | Verifies that node has attribute with given name and value.
@throws AssertionError if the actual node is {@code null}.
@throws AssertionError if node has not attribute with given name and value. | [
"Verifies",
"that",
"node",
"has",
"attribute",
"with",
"given",
"name",
"and",
"value",
"."
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-assertj/src/main/java/org/xmlunit/assertj/SingleNodeAssert.java#L70-L79 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listHierarchicalEntitiesAsync | public Observable<List<HierarchicalEntityExtractor>> listHierarchicalEntitiesAsync(UUID appId, String versionId, ListHierarchicalEntitiesOptionalParameter listHierarchicalEntitiesOptionalParameter) {
return listHierarchicalEntitiesWithServiceResponseAsync(appId, versionId, listHierarchicalEntitiesOptionalParameter).map(new Func1<ServiceResponse<List<HierarchicalEntityExtractor>>, List<HierarchicalEntityExtractor>>() {
@Override
public List<HierarchicalEntityExtractor> call(ServiceResponse<List<HierarchicalEntityExtractor>> response) {
return response.body();
}
});
} | java | public Observable<List<HierarchicalEntityExtractor>> listHierarchicalEntitiesAsync(UUID appId, String versionId, ListHierarchicalEntitiesOptionalParameter listHierarchicalEntitiesOptionalParameter) {
return listHierarchicalEntitiesWithServiceResponseAsync(appId, versionId, listHierarchicalEntitiesOptionalParameter).map(new Func1<ServiceResponse<List<HierarchicalEntityExtractor>>, List<HierarchicalEntityExtractor>>() {
@Override
public List<HierarchicalEntityExtractor> call(ServiceResponse<List<HierarchicalEntityExtractor>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"HierarchicalEntityExtractor",
">",
">",
"listHierarchicalEntitiesAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListHierarchicalEntitiesOptionalParameter",
"listHierarchicalEntitiesOptionalParameter",
")",
"{",
"retu... | Gets information about the hierarchical entity models.
@param appId The application ID.
@param versionId The version ID.
@param listHierarchicalEntitiesOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<HierarchicalEntityExtractor> object | [
"Gets",
"information",
"about",
"the",
"hierarchical",
"entity",
"models",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1400-L1407 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.addPostConstruct | @SuppressWarnings("unused")
@Internal
@UsedByGeneratedCode
protected final AbstractBeanDefinition addPostConstruct(Class declaringType,
String method,
@Nullable Argument[] arguments,
@Nullable AnnotationMetadata annotationMetadata,
boolean requiresReflection) {
return addInjectionPointInternal(declaringType, method, arguments, annotationMetadata, requiresReflection, this.postConstructMethods);
} | java | @SuppressWarnings("unused")
@Internal
@UsedByGeneratedCode
protected final AbstractBeanDefinition addPostConstruct(Class declaringType,
String method,
@Nullable Argument[] arguments,
@Nullable AnnotationMetadata annotationMetadata,
boolean requiresReflection) {
return addInjectionPointInternal(declaringType, method, arguments, annotationMetadata, requiresReflection, this.postConstructMethods);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"@",
"Internal",
"@",
"UsedByGeneratedCode",
"protected",
"final",
"AbstractBeanDefinition",
"addPostConstruct",
"(",
"Class",
"declaringType",
",",
"String",
"method",
",",
"@",
"Nullable",
"Argument",
"[",
"]",
"arg... | Adds a post construct method definition.
@param declaringType The declaring type
@param method The method
@param arguments The arguments
@param annotationMetadata The annotation metadata
@param requiresReflection Whether the method requires reflection
@return This bean definition | [
"Adds",
"a",
"post",
"construct",
"method",
"definition",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L542-L551 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/VisualContext.java | VisualContext.updateForGraphics | public void updateForGraphics(NodeData style, Graphics2D g)
{
if (style != null) update(style);
updateGraphics(g);
fm = g.getFontMetrics();
//update the width units
//em has been updated in update()
FontRenderContext frc = new FontRenderContext(null, false, false);
TextLayout layout = new TextLayout("x", font, frc);
ex = layout.getBounds().getHeight();
ch = fm.charWidth('0');
} | java | public void updateForGraphics(NodeData style, Graphics2D g)
{
if (style != null) update(style);
updateGraphics(g);
fm = g.getFontMetrics();
//update the width units
//em has been updated in update()
FontRenderContext frc = new FontRenderContext(null, false, false);
TextLayout layout = new TextLayout("x", font, frc);
ex = layout.getBounds().getHeight();
ch = fm.charWidth('0');
} | [
"public",
"void",
"updateForGraphics",
"(",
"NodeData",
"style",
",",
"Graphics2D",
"g",
")",
"{",
"if",
"(",
"style",
"!=",
"null",
")",
"update",
"(",
"style",
")",
";",
"updateGraphics",
"(",
"g",
")",
";",
"fm",
"=",
"g",
".",
"getFontMetrics",
"("... | Updates this context according to the given style. Moreover given Graphics is updated
to this style and used for taking the font metrics.
@param style the style data to be used
@param g Graphics to be updated and used | [
"Updates",
"this",
"context",
"according",
"to",
"the",
"given",
"style",
".",
"Moreover",
"given",
"Graphics",
"is",
"updated",
"to",
"this",
"style",
"and",
"used",
"for",
"taking",
"the",
"font",
"metrics",
"."
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/VisualContext.java#L390-L404 |
apache/incubator-atlas | notification/src/main/java/org/apache/atlas/hook/AtlasHook.java | AtlasHook.getUser | public static String getUser(String userName, UserGroupInformation ugi) {
if (StringUtils.isNotEmpty(userName)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Returning userName {}", userName);
}
return userName;
}
if (ugi != null && StringUtils.isNotEmpty(ugi.getShortUserName())) {
if (LOG.isDebugEnabled()) {
LOG.debug("Returning ugi.getShortUserName {}", userName);
}
return ugi.getShortUserName();
}
try {
return UserGroupInformation.getCurrentUser().getShortUserName();
} catch (IOException e) {
LOG.warn("Failed for UserGroupInformation.getCurrentUser() ", e);
return System.getProperty("user.name");
}
} | java | public static String getUser(String userName, UserGroupInformation ugi) {
if (StringUtils.isNotEmpty(userName)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Returning userName {}", userName);
}
return userName;
}
if (ugi != null && StringUtils.isNotEmpty(ugi.getShortUserName())) {
if (LOG.isDebugEnabled()) {
LOG.debug("Returning ugi.getShortUserName {}", userName);
}
return ugi.getShortUserName();
}
try {
return UserGroupInformation.getCurrentUser().getShortUserName();
} catch (IOException e) {
LOG.warn("Failed for UserGroupInformation.getCurrentUser() ", e);
return System.getProperty("user.name");
}
} | [
"public",
"static",
"String",
"getUser",
"(",
"String",
"userName",
",",
"UserGroupInformation",
"ugi",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"userName",
")",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"L... | Returns the user. Order of preference:
1. Given userName
2. ugi.getShortUserName()
3. UserGroupInformation.getCurrentUser().getShortUserName()
4. System.getProperty("user.name") | [
"Returns",
"the",
"user",
".",
"Order",
"of",
"preference",
":",
"1",
".",
"Given",
"userName",
"2",
".",
"ugi",
".",
"getShortUserName",
"()",
"3",
".",
"UserGroupInformation",
".",
"getCurrentUser",
"()",
".",
"getShortUserName",
"()",
"4",
".",
"System",
... | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java#L195-L216 |
kiswanij/jk-util | src/main/java/com/jk/util/cache/simple/JKCacheUtil.java | JKCacheUtil.buildDynamicKey | public static String buildDynamicKey(final Object[] paramNames, final Object[] paramValues) {
return Arrays.toString(paramNames).concat(Arrays.toString(paramValues));
} | java | public static String buildDynamicKey(final Object[] paramNames, final Object[] paramValues) {
return Arrays.toString(paramNames).concat(Arrays.toString(paramValues));
} | [
"public",
"static",
"String",
"buildDynamicKey",
"(",
"final",
"Object",
"[",
"]",
"paramNames",
",",
"final",
"Object",
"[",
"]",
"paramValues",
")",
"{",
"return",
"Arrays",
".",
"toString",
"(",
"paramNames",
")",
".",
"concat",
"(",
"Arrays",
".",
"toS... | Builds the dynamic key.
@param paramNames the param names
@param paramValues the param values
@return the string | [
"Builds",
"the",
"dynamic",
"key",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/cache/simple/JKCacheUtil.java#L36-L38 |
citrusframework/citrus | modules/citrus-ssh/src/main/java/com/consol/citrus/ssh/SshCommand.java | SshCommand.copyToStream | private void copyToStream(String txt, OutputStream stream) throws IOException {
if (txt != null) {
stream.write(txt.getBytes());
}
} | java | private void copyToStream(String txt, OutputStream stream) throws IOException {
if (txt != null) {
stream.write(txt.getBytes());
}
} | [
"private",
"void",
"copyToStream",
"(",
"String",
"txt",
",",
"OutputStream",
"stream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"txt",
"!=",
"null",
")",
"{",
"stream",
".",
"write",
"(",
"txt",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"}"
] | Copy character sequence to outbput stream.
@param txt
@param stream
@throws IOException | [
"Copy",
"character",
"sequence",
"to",
"outbput",
"stream",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ssh/src/main/java/com/consol/citrus/ssh/SshCommand.java#L135-L139 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJHelper.java | IfmapJHelper.loadKeyStore | private static KeyStore loadKeyStore(InputStream is, String pass)
throws InitializationException, KeyStoreException,
NoSuchAlgorithmException, CertificateException, IOException {
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(is, pass.toCharArray());
return ks;
} | java | private static KeyStore loadKeyStore(InputStream is, String pass)
throws InitializationException, KeyStoreException,
NoSuchAlgorithmException, CertificateException, IOException {
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(is, pass.toCharArray());
return ks;
} | [
"private",
"static",
"KeyStore",
"loadKeyStore",
"(",
"InputStream",
"is",
",",
"String",
"pass",
")",
"throws",
"InitializationException",
",",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
",",
"IOException",
"{",
"KeyStore",
"ks",... | Helper to load a {@link KeyStore} instance.
@param is {@link InputStream} representing contents of a keyStore
@param pass the password of the keyStore
@return an instance of the new loaded {@link KeyStore}
@throws NoSuchAlgorithmException
@throws CertificateException
@throws IOException
@throws KeyStoreException | [
"Helper",
"to",
"load",
"a",
"{",
"@link",
"KeyStore",
"}",
"instance",
"."
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJHelper.java#L201-L207 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/clustering/criterion/BaseFunction.java | BaseFunction.modifiedMagnitude | protected static double modifiedMagnitude(DoubleVector c, DoubleVector v) {
return Math.sqrt(modifiedMagnitudeSqrd(c, v));
} | java | protected static double modifiedMagnitude(DoubleVector c, DoubleVector v) {
return Math.sqrt(modifiedMagnitudeSqrd(c, v));
} | [
"protected",
"static",
"double",
"modifiedMagnitude",
"(",
"DoubleVector",
"c",
",",
"DoubleVector",
"v",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"modifiedMagnitudeSqrd",
"(",
"c",
",",
"v",
")",
")",
";",
"}"
] | Returns the magnitude of {@code c} as if {@code v} was added to the the
vector. We do this because it would be more costly, garbage collection
wise, to create a new vector for each alternate cluster and * vector. | [
"Returns",
"the",
"magnitude",
"of",
"{"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/clustering/criterion/BaseFunction.java#L378-L380 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/VoiceApi.java | VoiceApi.switchToBargeIn | public ApiSuccessResponse switchToBargeIn(String id, MonitoringScopeData monitoringScopeData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = switchToBargeInWithHttpInfo(id, monitoringScopeData);
return resp.getData();
} | java | public ApiSuccessResponse switchToBargeIn(String id, MonitoringScopeData monitoringScopeData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = switchToBargeInWithHttpInfo(id, monitoringScopeData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"switchToBargeIn",
"(",
"String",
"id",
",",
"MonitoringScopeData",
"monitoringScopeData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"switchToBargeInWithHttpInfo",
"(",
"id",
",",
"mon... | Switch to barge-in
Switch to the barge-in monitoring mode. If the agent is currently on a call and T-Server is configured to allow barge-in, the supervisor is immediately added to the call. Both the monitored agent and the customer are able to hear and speak with the supervisor. If the target agent is not on a call at the time of the request, the supervisor is brought into the call when the agent receives a new call.
@param id The connection ID of the call being monitored. (required)
@param monitoringScopeData (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Switch",
"to",
"barge",
"-",
"in",
"Switch",
"to",
"the",
"barge",
"-",
"in",
"monitoring",
"mode",
".",
"If",
"the",
"agent",
"is",
"currently",
"on",
"a",
"call",
"and",
"T",
"-",
"Server",
"is",
"configured",
"to",
"allow",
"barge",
"-",
"in",
"t... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L4972-L4975 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java | KeyManagementServiceClient.createKeyRing | public final KeyRing createKeyRing(LocationName parent, String keyRingId, KeyRing keyRing) {
CreateKeyRingRequest request =
CreateKeyRingRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setKeyRingId(keyRingId)
.setKeyRing(keyRing)
.build();
return createKeyRing(request);
} | java | public final KeyRing createKeyRing(LocationName parent, String keyRingId, KeyRing keyRing) {
CreateKeyRingRequest request =
CreateKeyRingRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setKeyRingId(keyRingId)
.setKeyRing(keyRing)
.build();
return createKeyRing(request);
} | [
"public",
"final",
"KeyRing",
"createKeyRing",
"(",
"LocationName",
"parent",
",",
"String",
"keyRingId",
",",
"KeyRing",
"keyRing",
")",
"{",
"CreateKeyRingRequest",
"request",
"=",
"CreateKeyRingRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"pare... | Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.
<p>Sample code:
<pre><code>
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
String keyRingId = "";
KeyRing keyRing = KeyRing.newBuilder().build();
KeyRing response = keyManagementServiceClient.createKeyRing(parent, keyRingId, keyRing);
}
</code></pre>
@param parent Required. The resource name of the location associated with the
[KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
@param keyRingId Required. It must be unique within a location and match the regular expression
`[a-zA-Z0-9_-]{1,63}`
@param keyRing A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Create",
"a",
"new",
"[",
"KeyRing",
"]",
"[",
"google",
".",
"cloud",
".",
"kms",
".",
"v1",
".",
"KeyRing",
"]",
"in",
"a",
"given",
"Project",
"and",
"Location",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java#L883-L892 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/system/exec/AbstractProcessTracker.java | AbstractProcessTracker.waitForExit | public int waitForExit(final Deadline deadline, final int expected)
{
final int code = waitForExit(deadline);
if (code == Integer.MIN_VALUE)
throw new RuntimeException("Unexpected timeout while waiting for exit and expecting code " + expected,
new TimeoutException("waitForExit timed out"));
else if (code != expected)
throw new RuntimeException("Unexpected code: wanted " + expected + " but got " + code);
else
return code;
} | java | public int waitForExit(final Deadline deadline, final int expected)
{
final int code = waitForExit(deadline);
if (code == Integer.MIN_VALUE)
throw new RuntimeException("Unexpected timeout while waiting for exit and expecting code " + expected,
new TimeoutException("waitForExit timed out"));
else if (code != expected)
throw new RuntimeException("Unexpected code: wanted " + expected + " but got " + code);
else
return code;
} | [
"public",
"int",
"waitForExit",
"(",
"final",
"Deadline",
"deadline",
",",
"final",
"int",
"expected",
")",
"{",
"final",
"int",
"code",
"=",
"waitForExit",
"(",
"deadline",
")",
";",
"if",
"(",
"code",
"==",
"Integer",
".",
"MIN_VALUE",
")",
"throw",
"n... | Wait until <code>deadline</code> for the process to exit, expecting the return code to be <code>expected</code>. If the
output is not <code>expected</code> (or if the operation times out) then a RuntimeException is thrown<br />
In the event of a timeout the process is not terminated
@param deadline
@param expected
@return the exit code of the process
@throws RuntimeException
if a timeout occurrs or if the return code was not what was expected | [
"Wait",
"until",
"<code",
">",
"deadline<",
"/",
"code",
">",
"for",
"the",
"process",
"to",
"exit",
"expecting",
"the",
"return",
"code",
"to",
"be",
"<code",
">",
"expected<",
"/",
"code",
">",
".",
"If",
"the",
"output",
"is",
"not",
"<code",
">",
... | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/system/exec/AbstractProcessTracker.java#L129-L140 |
Metatavu/edelphi | rest/src/main/java/fi/metatavu/edelphi/rest/AbstractApi.java | AbstractApi.createOk | protected Response createOk(Object entity, Long totalHits) {
return Response
.status(Response.Status.OK)
.entity(entity)
.header("Total-Results", totalHits)
.build();
} | java | protected Response createOk(Object entity, Long totalHits) {
return Response
.status(Response.Status.OK)
.entity(entity)
.header("Total-Results", totalHits)
.build();
} | [
"protected",
"Response",
"createOk",
"(",
"Object",
"entity",
",",
"Long",
"totalHits",
")",
"{",
"return",
"Response",
".",
"status",
"(",
"Response",
".",
"Status",
".",
"OK",
")",
".",
"entity",
"(",
"entity",
")",
".",
"header",
"(",
"\"Total-Results\"... | Constructs ok response
@param entity payload
@param totalHits total hits
@return response | [
"Constructs",
"ok",
"response"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/rest/src/main/java/fi/metatavu/edelphi/rest/AbstractApi.java#L134-L140 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/history/diff/A_CmsAttributeDiff.java | A_CmsAttributeDiff.readResource | public static CmsResource readResource(CmsObject cms, CmsHistoryResourceBean bean) throws CmsException {
CmsHistoryVersion versionBean = bean.getVersion();
if (versionBean.getVersionNumber() != null) {
return (CmsResource)(cms.readResource(bean.getStructureId(), versionBean.getVersionNumber().intValue()));
} else {
if (versionBean.isOnline()) {
CmsObject onlineCms = OpenCms.initCmsObject(cms);
onlineCms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID));
return onlineCms.readResource(bean.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION);
} else {
return cms.readResource(bean.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION);
}
}
} | java | public static CmsResource readResource(CmsObject cms, CmsHistoryResourceBean bean) throws CmsException {
CmsHistoryVersion versionBean = bean.getVersion();
if (versionBean.getVersionNumber() != null) {
return (CmsResource)(cms.readResource(bean.getStructureId(), versionBean.getVersionNumber().intValue()));
} else {
if (versionBean.isOnline()) {
CmsObject onlineCms = OpenCms.initCmsObject(cms);
onlineCms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID));
return onlineCms.readResource(bean.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION);
} else {
return cms.readResource(bean.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION);
}
}
} | [
"public",
"static",
"CmsResource",
"readResource",
"(",
"CmsObject",
"cms",
",",
"CmsHistoryResourceBean",
"bean",
")",
"throws",
"CmsException",
"{",
"CmsHistoryVersion",
"versionBean",
"=",
"bean",
".",
"getVersion",
"(",
")",
";",
"if",
"(",
"versionBean",
".",... | Reads a historical resource for a history resource bean.<p>
@param cms the CMS context
@param bean the history resource bean
@return the historical resource
@throws CmsException if something goes wrong | [
"Reads",
"a",
"historical",
"resource",
"for",
"a",
"history",
"resource",
"bean",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/history/diff/A_CmsAttributeDiff.java#L116-L130 |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.getStringValue | public static String getStringValue(Name name, String key) {
return (String) getValue(name, key);
} | java | public static String getStringValue(Name name, String key) {
return (String) getValue(name, key);
} | [
"public",
"static",
"String",
"getStringValue",
"(",
"Name",
"name",
",",
"String",
"key",
")",
"{",
"return",
"(",
"String",
")",
"getValue",
"(",
"name",
",",
"key",
")",
";",
"}"
] | Get the value of the Rdn with the requested key in the supplied Name as a String.
@param name the Name in which to search for the key.
@param key the attribute key to search for.
@return the String value of the rdn corresponding to the <b>first</b> occurrence of the requested key.
@throws NoSuchElementException if no corresponding entry is found.
@throws ClassCastException if the value of the requested component is not a String.
@since 2.0 | [
"Get",
"the",
"value",
"of",
"the",
"Rdn",
"with",
"the",
"requested",
"key",
"in",
"the",
"supplied",
"Name",
"as",
"a",
"String",
"."
] | train | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L598-L600 |
ModeShape/modeshape | index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsClient.java | EsClient.deleteDocument | public boolean deleteDocument(String name, String type, String id) throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpDelete delete = new HttpDelete(String.format("http://%s:%d/%s/%s/%s", host, port, name, type, id));
try {
return client.execute(delete).getStatusLine().getStatusCode() == HttpStatus.SC_OK;
} finally {
delete.releaseConnection();
}
} | java | public boolean deleteDocument(String name, String type, String id) throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpDelete delete = new HttpDelete(String.format("http://%s:%d/%s/%s/%s", host, port, name, type, id));
try {
return client.execute(delete).getStatusLine().getStatusCode() == HttpStatus.SC_OK;
} finally {
delete.releaseConnection();
}
} | [
"public",
"boolean",
"deleteDocument",
"(",
"String",
"name",
",",
"String",
"type",
",",
"String",
"id",
")",
"throws",
"IOException",
"{",
"CloseableHttpClient",
"client",
"=",
"HttpClients",
".",
"createDefault",
"(",
")",
";",
"HttpDelete",
"delete",
"=",
... | Deletes document.
@param name index name.
@param type index type.
@param id document id
@return true if it was deleted.
@throws IOException | [
"Deletes",
"document",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsClient.java#L179-L187 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/ComponentAPI.java | ComponentAPI.clear_quota | public static BaseResult clear_quota(String component_access_token, String component_appid) {
String json = String.format("{\"component_appid\":\"%s\"}", component_appid);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/cgi-bin/component/clear_quota")
.addParameter("component_access_token", API.componentAccessToken(component_access_token))
.setEntity(new StringEntity(json, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest, BaseResult.class);
} | java | public static BaseResult clear_quota(String component_access_token, String component_appid) {
String json = String.format("{\"component_appid\":\"%s\"}", component_appid);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/cgi-bin/component/clear_quota")
.addParameter("component_access_token", API.componentAccessToken(component_access_token))
.setEntity(new StringEntity(json, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest, BaseResult.class);
} | [
"public",
"static",
"BaseResult",
"clear_quota",
"(",
"String",
"component_access_token",
",",
"String",
"component_appid",
")",
"{",
"String",
"json",
"=",
"String",
".",
"format",
"(",
"\"{\\\"component_appid\\\":\\\"%s\\\"}\"",
",",
"component_appid",
")",
";",
"Ht... | 第三方平台对其所有API调用次数清零
@param component_access_token 调用接口凭据
@param component_appid 第三方平台APPID
@return result
@since 2.8.2 | [
"第三方平台对其所有API调用次数清零"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ComponentAPI.java#L273-L282 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.importData | public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final PreparedStatement stmt) throws UncheckedSQLException {
return importData(dataset, selectColumnNames, 0, dataset.size(), stmt);
} | java | public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final PreparedStatement stmt) throws UncheckedSQLException {
return importData(dataset, selectColumnNames, 0, dataset.size(), stmt);
} | [
"public",
"static",
"int",
"importData",
"(",
"final",
"DataSet",
"dataset",
",",
"final",
"Collection",
"<",
"String",
">",
"selectColumnNames",
",",
"final",
"PreparedStatement",
"stmt",
")",
"throws",
"UncheckedSQLException",
"{",
"return",
"importData",
"(",
"... | Imports the data from <code>DataSet</code> to database.
@param dataset
@param selectColumnNames
@param stmt the column order in the sql must be consistent with the column order in the DataSet.
@return
@throws UncheckedSQLException | [
"Imports",
"the",
"data",
"from",
"<code",
">",
"DataSet<",
"/",
"code",
">",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2189-L2191 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java | Value.int64Array | public static Value int64Array(@Nullable long[] v) {
return int64Array(v, 0, v == null ? 0 : v.length);
} | java | public static Value int64Array(@Nullable long[] v) {
return int64Array(v, 0, v == null ? 0 : v.length);
} | [
"public",
"static",
"Value",
"int64Array",
"(",
"@",
"Nullable",
"long",
"[",
"]",
"v",
")",
"{",
"return",
"int64Array",
"(",
"v",
",",
"0",
",",
"v",
"==",
"null",
"?",
"0",
":",
"v",
".",
"length",
")",
";",
"}"
] | Returns an {@code ARRAY<INT64>} value.
@param v the source of element values, which may be null to produce a value for which {@code
isNull()} is {@code true} | [
"Returns",
"an",
"{",
"@code",
"ARRAY<INT64",
">",
"}",
"value",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java#L224-L226 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.beginGetLearnedRoutesAsync | public Observable<GatewayRouteListResultInner> beginGetLearnedRoutesAsync(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<GatewayRouteListResultInner>, GatewayRouteListResultInner>() {
@Override
public GatewayRouteListResultInner call(ServiceResponse<GatewayRouteListResultInner> response) {
return response.body();
}
});
} | java | public Observable<GatewayRouteListResultInner> beginGetLearnedRoutesAsync(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<GatewayRouteListResultInner>, GatewayRouteListResultInner>() {
@Override
public GatewayRouteListResultInner call(ServiceResponse<GatewayRouteListResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"GatewayRouteListResultInner",
">",
"beginGetLearnedRoutesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"beginGetLearnedRoutesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vi... | This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the GatewayRouteListResultInner object | [
"This",
"operation",
"retrieves",
"a",
"list",
"of",
"routes",
"the",
"virtual",
"network",
"gateway",
"has",
"learned",
"including",
"routes",
"learned",
"from",
"BGP",
"peers",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2432-L2439 |
Jasig/uPortal | uPortal-events/src/main/java/org/apereo/portal/events/tincan/providers/DefaultTinCanAPIProvider.java | DefaultTinCanAPIProvider.buildRequestURI | private URI buildRequestURI(String pathFragment, List<? extends NameValuePair> params) {
try {
String queryString = "";
if (params != null && !params.isEmpty()) {
queryString = "?" + URLEncodedUtils.format(params, "UTF-8");
}
URI fullURI = new URI(LRSUrl + pathFragment + queryString);
return fullURI;
} catch (URISyntaxException e) {
throw new RuntimeException("Error creating request URI", e);
}
} | java | private URI buildRequestURI(String pathFragment, List<? extends NameValuePair> params) {
try {
String queryString = "";
if (params != null && !params.isEmpty()) {
queryString = "?" + URLEncodedUtils.format(params, "UTF-8");
}
URI fullURI = new URI(LRSUrl + pathFragment + queryString);
return fullURI;
} catch (URISyntaxException e) {
throw new RuntimeException("Error creating request URI", e);
}
} | [
"private",
"URI",
"buildRequestURI",
"(",
"String",
"pathFragment",
",",
"List",
"<",
"?",
"extends",
"NameValuePair",
">",
"params",
")",
"{",
"try",
"{",
"String",
"queryString",
"=",
"\"\"",
";",
"if",
"(",
"params",
"!=",
"null",
"&&",
"!",
"params",
... | Build a URI for the REST request.
<p>Note: this converts to URI instead of using a string because the activities/state API
requires you to pass JSON as a GET parameter. The {...} confuses the RestTemplate path
parameter handling. By converting to URI, I skip that.
@param pathFragment The path fragment relative to the LRS REST base URL
@param params The list of GET parameters to encode. May be null.
@return The full URI to the LMS REST endpoint | [
"Build",
"a",
"URI",
"for",
"the",
"REST",
"request",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-events/src/main/java/org/apereo/portal/events/tincan/providers/DefaultTinCanAPIProvider.java#L412-L424 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/res/XMLMessages.java | XMLMessages.createXMLMessage | public static final String createXMLMessage(String msgKey, Object args[])
{
// BEGIN android-changed
// don't localize exceptions
return createMsg(XMLBundle, msgKey, args);
// END android-changed
} | java | public static final String createXMLMessage(String msgKey, Object args[])
{
// BEGIN android-changed
// don't localize exceptions
return createMsg(XMLBundle, msgKey, args);
// END android-changed
} | [
"public",
"static",
"final",
"String",
"createXMLMessage",
"(",
"String",
"msgKey",
",",
"Object",
"args",
"[",
"]",
")",
"{",
"// BEGIN android-changed",
"// don't localize exceptions",
"return",
"createMsg",
"(",
"XMLBundle",
",",
"msgKey",
",",
"args",
")",
... | Creates a message from the specified key and replacement
arguments, localized to the given locale.
@param msgKey The key for the message text.
@param args The arguments to be used as replacement text
in the message created.
@return The formatted message string. | [
"Creates",
"a",
"message",
"from",
"the",
"specified",
"key",
"and",
"replacement",
"arguments",
"localized",
"to",
"the",
"given",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/res/XMLMessages.java#L77-L83 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java | IDNA.convertIDNToASCII | @Deprecated
public static StringBuffer convertIDNToASCII(UCharacterIterator src, int options)
throws StringPrepParseException{
return convertIDNToASCII(src.getText(), options);
} | java | @Deprecated
public static StringBuffer convertIDNToASCII(UCharacterIterator src, int options)
throws StringPrepParseException{
return convertIDNToASCII(src.getText(), options);
} | [
"@",
"Deprecated",
"public",
"static",
"StringBuffer",
"convertIDNToASCII",
"(",
"UCharacterIterator",
"src",
",",
"int",
"options",
")",
"throws",
"StringPrepParseException",
"{",
"return",
"convertIDNToASCII",
"(",
"src",
".",
"getText",
"(",
")",
",",
"options",
... | IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC.
This operation is done on complete domain names, e.g: "www.example.com".
It is important to note that this operation can fail. If it fails, then the input
domain name cannot be used as an Internationalized Domain Name and the application
should have methods defined to deal with the failure.
<b>Note:</b> IDNA RFC specifies that a conformant application should divide a domain name
into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each,
and then convert. This function does not offer that level of granularity. The options once
set will apply to all labels in the domain name
@param src The input string as UCharacterIterator to be processed
@param options A bit set of options:
- IDNA.DEFAULT Use default options, i.e., do not process unassigned code points
and do not use STD3 ASCII rules
If unassigned code points are found the operation fails with
ParseException.
- IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations
If this option is set, the unassigned code points are in the input
are treated as normal Unicode code points.
- IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions
If this option is set and the input does not satisfy STD3 rules,
the operation will fail with ParseException
@return StringBuffer the converted String
@deprecated ICU 55 Use UTS 46 instead via {@link #getUTS46Instance(int)}.
@hide original deprecated declaration | [
"IDNA2003",
":",
"Convenience",
"function",
"that",
"implements",
"the",
"IDNToASCII",
"operation",
"as",
"defined",
"in",
"the",
"IDNA",
"RFC",
".",
"This",
"operation",
"is",
"done",
"on",
"complete",
"domain",
"names",
"e",
".",
"g",
":",
"www",
".",
"e... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java#L579-L583 |
amaembo/streamex | src/main/java/one/util/streamex/LongStreamEx.java | LongStreamEx.foldLeft | public long foldLeft(long seed, LongBinaryOperator accumulator) {
long[] box = new long[] { seed };
forEachOrdered(t -> box[0] = accumulator.applyAsLong(box[0], t));
return box[0];
} | java | public long foldLeft(long seed, LongBinaryOperator accumulator) {
long[] box = new long[] { seed };
forEachOrdered(t -> box[0] = accumulator.applyAsLong(box[0], t));
return box[0];
} | [
"public",
"long",
"foldLeft",
"(",
"long",
"seed",
",",
"LongBinaryOperator",
"accumulator",
")",
"{",
"long",
"[",
"]",
"box",
"=",
"new",
"long",
"[",
"]",
"{",
"seed",
"}",
";",
"forEachOrdered",
"(",
"t",
"->",
"box",
"[",
"0",
"]",
"=",
"accumul... | Folds the elements of this stream using the provided seed object and
accumulation function, going left to right. This is equivalent to:
<pre>
{@code
long result = seed;
for (long element : this stream)
result = accumulator.apply(result, element)
return result;
}
</pre>
<p>
This is a terminal operation.
<p>
This method cannot take all the advantages of parallel streams as it must
process elements strictly left to right. If your accumulator function is
associative, consider using {@link #reduce(long, LongBinaryOperator)}
method.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the same thread.
@param seed the starting value
@param accumulator a
<a href="package-summary.html#NonInterference">non-interfering
</a>, <a href="package-summary.html#Statelessness">stateless</a>
function for incorporating an additional element into a result
@return the result of the folding
@see #reduce(long, LongBinaryOperator)
@see #foldLeft(LongBinaryOperator)
@since 0.4.0 | [
"Folds",
"the",
"elements",
"of",
"this",
"stream",
"using",
"the",
"provided",
"seed",
"object",
"and",
"accumulation",
"function",
"going",
"left",
"to",
"right",
".",
"This",
"is",
"equivalent",
"to",
":"
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L753-L757 |
infinispan/infinispan | core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java | AtomicMapLookup.getFineGrainedAtomicMap | public static <MK, K, V> FineGrainedAtomicMap<K, V> getFineGrainedAtomicMap(Cache<MK, ?> cache, MK key) {
return getFineGrainedAtomicMap(cache, key, true);
} | java | public static <MK, K, V> FineGrainedAtomicMap<K, V> getFineGrainedAtomicMap(Cache<MK, ?> cache, MK key) {
return getFineGrainedAtomicMap(cache, key, true);
} | [
"public",
"static",
"<",
"MK",
",",
"K",
",",
"V",
">",
"FineGrainedAtomicMap",
"<",
"K",
",",
"V",
">",
"getFineGrainedAtomicMap",
"(",
"Cache",
"<",
"MK",
",",
"?",
">",
"cache",
",",
"MK",
"key",
")",
"{",
"return",
"getFineGrainedAtomicMap",
"(",
"... | Retrieves a fine grained atomic map from a given cache, stored under a given key. If a fine grained atomic map did
not exist, one is created and registered in an atomic fashion.
@param cache underlying cache
@param key key under which the atomic map exists
@param <MK> key param of the cache
@param <K> key param of the AtomicMap
@param <V> value param of the AtomicMap
@return an AtomicMap | [
"Retrieves",
"a",
"fine",
"grained",
"atomic",
"map",
"from",
"a",
"given",
"cache",
"stored",
"under",
"a",
"given",
"key",
".",
"If",
"a",
"fine",
"grained",
"atomic",
"map",
"did",
"not",
"exist",
"one",
"is",
"created",
"and",
"registered",
"in",
"an... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java#L48-L50 |
apache/incubator-gobblin | gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/TeradataBufferedInserter.java | TeradataBufferedInserter.getColumnPosSqlTypes | private Map<Integer, Integer> getColumnPosSqlTypes() {
try {
final Map<Integer, Integer> columnPosSqlTypes = Maps.newHashMap();
ParameterMetaData pMetaData = this.insertPstmtForFixedBatch.getParameterMetaData();
for (int i = 1; i <= pMetaData.getParameterCount(); i++) {
columnPosSqlTypes.put(i, pMetaData.getParameterType(i));
}
return columnPosSqlTypes;
} catch (SQLException e) {
throw new RuntimeException("Cannot retrieve columns types for batch insert", e);
}
} | java | private Map<Integer, Integer> getColumnPosSqlTypes() {
try {
final Map<Integer, Integer> columnPosSqlTypes = Maps.newHashMap();
ParameterMetaData pMetaData = this.insertPstmtForFixedBatch.getParameterMetaData();
for (int i = 1; i <= pMetaData.getParameterCount(); i++) {
columnPosSqlTypes.put(i, pMetaData.getParameterType(i));
}
return columnPosSqlTypes;
} catch (SQLException e) {
throw new RuntimeException("Cannot retrieve columns types for batch insert", e);
}
} | [
"private",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"getColumnPosSqlTypes",
"(",
")",
"{",
"try",
"{",
"final",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"columnPosSqlTypes",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"ParameterMetaData",
"pMetaData... | Creates a mapping between column positions and their data types
@return A map containing the position of the columns along with their data type as value | [
"Creates",
"a",
"mapping",
"between",
"column",
"positions",
"and",
"their",
"data",
"types"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/TeradataBufferedInserter.java#L108-L119 |
aws/aws-sdk-java | aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java | SimpleDBUtils.encodeZeroPadding | public static String encodeZeroPadding(long number, int maxNumDigits) {
String longString = Long.toString(number);
int numZeroes = maxNumDigits - longString.length();
StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length());
for (int i = 0; i < numZeroes; i++) {
strBuffer.insert(i, '0');
}
strBuffer.append(longString);
return strBuffer.toString();
} | java | public static String encodeZeroPadding(long number, int maxNumDigits) {
String longString = Long.toString(number);
int numZeroes = maxNumDigits - longString.length();
StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length());
for (int i = 0; i < numZeroes; i++) {
strBuffer.insert(i, '0');
}
strBuffer.append(longString);
return strBuffer.toString();
} | [
"public",
"static",
"String",
"encodeZeroPadding",
"(",
"long",
"number",
",",
"int",
"maxNumDigits",
")",
"{",
"String",
"longString",
"=",
"Long",
".",
"toString",
"(",
"number",
")",
";",
"int",
"numZeroes",
"=",
"maxNumDigits",
"-",
"longString",
".",
"l... | Encodes positive long value into a string by zero-padding the value up to the specified
number of digits.
@param number
positive long to be encoded
@param maxNumDigits
maximum number of digits in the largest value in the data set
@return string representation of the zero-padded long | [
"Encodes",
"positive",
"long",
"value",
"into",
"a",
"string",
"by",
"zero",
"-",
"padding",
"the",
"value",
"up",
"to",
"the",
"specified",
"number",
"of",
"digits",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java#L64-L73 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/CPI.java | CPI.setColumnsMap | public static void setColumnsMap(Record record, Map<String, Object> columns) {
record.setColumnsMap(columns);
} | java | public static void setColumnsMap(Record record, Map<String, Object> columns) {
record.setColumnsMap(columns);
} | [
"public",
"static",
"void",
"setColumnsMap",
"(",
"Record",
"record",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"columns",
")",
"{",
"record",
".",
"setColumnsMap",
"(",
"columns",
")",
";",
"}"
] | Return the columns map of the record
@param record the Record object
@return the columns map of the record
public static final Map<String, Object> getColumns(Record record) {
return record.getColumns();
} | [
"Return",
"the",
"columns",
"map",
"of",
"the",
"record"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/CPI.java#L79-L81 |
GoogleCloudPlatform/appengine-plugins-core | src/main/java/com/google/cloud/tools/managedcloudsdk/install/DownloaderFactory.java | DownloaderFactory.newDownloader | public Downloader newDownloader(URL source, Path destination, ProgressListener progressListener) {
return new Downloader(source, destination, userAgentString, progressListener);
} | java | public Downloader newDownloader(URL source, Path destination, ProgressListener progressListener) {
return new Downloader(source, destination, userAgentString, progressListener);
} | [
"public",
"Downloader",
"newDownloader",
"(",
"URL",
"source",
",",
"Path",
"destination",
",",
"ProgressListener",
"progressListener",
")",
"{",
"return",
"new",
"Downloader",
"(",
"source",
",",
"destination",
",",
"userAgentString",
",",
"progressListener",
")",
... | Returns a new {@link Downloader} implementation.
@param source URL of file to download (remote)
@param destination Path on local file system to save the file
@param progressListener Progress feedback handler
@return a {@link Downloader} instance | [
"Returns",
"a",
"new",
"{",
"@link",
"Downloader",
"}",
"implementation",
"."
] | train | https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/d22e9fa1103522409ab6fdfbf68c4a5a0bc5b97d/src/main/java/com/google/cloud/tools/managedcloudsdk/install/DownloaderFactory.java#L46-L48 |
Jsondb/jsondb-core | src/main/java/io/jsondb/Util.java | Util.deepCopy | protected static Object deepCopy(Object fromBean) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
XMLEncoder out = new XMLEncoder(bos);
out.writeObject(fromBean);
out.close();
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
XMLDecoder in = new XMLDecoder(bis, null, null, JsonDBTemplate.class.getClassLoader());
Object toBean = in.readObject();
in.close();
return toBean;
} | java | protected static Object deepCopy(Object fromBean) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
XMLEncoder out = new XMLEncoder(bos);
out.writeObject(fromBean);
out.close();
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
XMLDecoder in = new XMLDecoder(bis, null, null, JsonDBTemplate.class.getClassLoader());
Object toBean = in.readObject();
in.close();
return toBean;
} | [
"protected",
"static",
"Object",
"deepCopy",
"(",
"Object",
"fromBean",
")",
"{",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"XMLEncoder",
"out",
"=",
"new",
"XMLEncoder",
"(",
"bos",
")",
";",
"out",
".",
"writeObject"... | A utility method that creates a deep clone of the specified object.
There is no other way of doing this reliably.
@param fromBean java bean to be cloned.
@return a new java bean cloned from fromBean. | [
"A",
"utility",
"method",
"that",
"creates",
"a",
"deep",
"clone",
"of",
"the",
"specified",
"object",
".",
"There",
"is",
"no",
"other",
"way",
"of",
"doing",
"this",
"reliably",
"."
] | train | https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/Util.java#L177-L188 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java | ServerSentEvents.fromPublisher | public static <T> HttpResponse fromPublisher(HttpHeaders headers,
Publisher<T> contentPublisher,
HttpHeaders trailingHeaders,
Function<? super T, ? extends ServerSentEvent> converter) {
requireNonNull(headers, "headers");
requireNonNull(contentPublisher, "contentPublisher");
requireNonNull(trailingHeaders, "trailingHeaders");
requireNonNull(converter, "converter");
return streamingFrom(contentPublisher, sanitizeHeaders(headers), trailingHeaders,
o -> toHttpData(converter, o));
} | java | public static <T> HttpResponse fromPublisher(HttpHeaders headers,
Publisher<T> contentPublisher,
HttpHeaders trailingHeaders,
Function<? super T, ? extends ServerSentEvent> converter) {
requireNonNull(headers, "headers");
requireNonNull(contentPublisher, "contentPublisher");
requireNonNull(trailingHeaders, "trailingHeaders");
requireNonNull(converter, "converter");
return streamingFrom(contentPublisher, sanitizeHeaders(headers), trailingHeaders,
o -> toHttpData(converter, o));
} | [
"public",
"static",
"<",
"T",
">",
"HttpResponse",
"fromPublisher",
"(",
"HttpHeaders",
"headers",
",",
"Publisher",
"<",
"T",
">",
"contentPublisher",
",",
"HttpHeaders",
"trailingHeaders",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"Server... | Creates a new Server-Sent Events stream from the specified {@link Publisher} and {@code converter}.
@param headers the HTTP headers supposed to send
@param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents
@param trailingHeaders the trailing HTTP headers supposed to send
@param converter the converter which converts published objects into {@link ServerSentEvent}s | [
"Creates",
"a",
"new",
"Server",
"-",
"Sent",
"Events",
"stream",
"from",
"the",
"specified",
"{",
"@link",
"Publisher",
"}",
"and",
"{",
"@code",
"converter",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java#L151-L161 |
ksclarke/vertx-pairtree | src/main/java/info/freelibrary/pairtree/s3/S3Client.java | S3Client.createGetRequest | public S3ClientRequest createGetRequest(final String aBucket, final String aKey,
final Handler<HttpClientResponse> aHandler) {
final HttpClientRequest httpRequest = myHTTPClient.get(PATH_SEP + aBucket + PATH_SEP + aKey, aHandler);
return new S3ClientRequest("GET", aBucket, aKey, httpRequest, myAccessKey, mySecretKey, mySessionToken);
} | java | public S3ClientRequest createGetRequest(final String aBucket, final String aKey,
final Handler<HttpClientResponse> aHandler) {
final HttpClientRequest httpRequest = myHTTPClient.get(PATH_SEP + aBucket + PATH_SEP + aKey, aHandler);
return new S3ClientRequest("GET", aBucket, aKey, httpRequest, myAccessKey, mySecretKey, mySessionToken);
} | [
"public",
"S3ClientRequest",
"createGetRequest",
"(",
"final",
"String",
"aBucket",
",",
"final",
"String",
"aKey",
",",
"final",
"Handler",
"<",
"HttpClientResponse",
">",
"aHandler",
")",
"{",
"final",
"HttpClientRequest",
"httpRequest",
"=",
"myHTTPClient",
".",
... | Creates an S3 GET request.
<p>
<code>create GET -> request Object</code>
</p>
@param aBucket An S3 bucket
@param aKey An S3 key
@param aHandler A response handler
@return A S3 client GET request | [
"Creates",
"an",
"S3",
"GET",
"request",
".",
"<p",
">",
"<code",
">",
"create",
"GET",
"-",
">",
";",
"request",
"Object<",
"/",
"code",
">",
"<",
"/",
"p",
">"
] | train | https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/s3/S3Client.java#L285-L289 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java | GossipDigestSynVerbHandler.doSort | private void doSort(List<GossipDigest> gDigestList)
{
/* Construct a map of endpoint to GossipDigest. */
Map<InetAddress, GossipDigest> epToDigestMap = new HashMap<InetAddress, GossipDigest>();
for (GossipDigest gDigest : gDigestList)
{
epToDigestMap.put(gDigest.getEndpoint(), gDigest);
}
/*
* These digests have their maxVersion set to the difference of the version
* of the local EndpointState and the version found in the GossipDigest.
*/
List<GossipDigest> diffDigests = new ArrayList<GossipDigest>(gDigestList.size());
for (GossipDigest gDigest : gDigestList)
{
InetAddress ep = gDigest.getEndpoint();
EndpointState epState = Gossiper.instance.getEndpointStateForEndpoint(ep);
int version = (epState != null) ? Gossiper.instance.getMaxEndpointStateVersion(epState) : 0;
int diffVersion = Math.abs(version - gDigest.getMaxVersion());
diffDigests.add(new GossipDigest(ep, gDigest.getGeneration(), diffVersion));
}
gDigestList.clear();
Collections.sort(diffDigests);
int size = diffDigests.size();
/*
* Report the digests in descending order. This takes care of the endpoints
* that are far behind w.r.t this local endpoint
*/
for (int i = size - 1; i >= 0; --i)
{
gDigestList.add(epToDigestMap.get(diffDigests.get(i).getEndpoint()));
}
} | java | private void doSort(List<GossipDigest> gDigestList)
{
/* Construct a map of endpoint to GossipDigest. */
Map<InetAddress, GossipDigest> epToDigestMap = new HashMap<InetAddress, GossipDigest>();
for (GossipDigest gDigest : gDigestList)
{
epToDigestMap.put(gDigest.getEndpoint(), gDigest);
}
/*
* These digests have their maxVersion set to the difference of the version
* of the local EndpointState and the version found in the GossipDigest.
*/
List<GossipDigest> diffDigests = new ArrayList<GossipDigest>(gDigestList.size());
for (GossipDigest gDigest : gDigestList)
{
InetAddress ep = gDigest.getEndpoint();
EndpointState epState = Gossiper.instance.getEndpointStateForEndpoint(ep);
int version = (epState != null) ? Gossiper.instance.getMaxEndpointStateVersion(epState) : 0;
int diffVersion = Math.abs(version - gDigest.getMaxVersion());
diffDigests.add(new GossipDigest(ep, gDigest.getGeneration(), diffVersion));
}
gDigestList.clear();
Collections.sort(diffDigests);
int size = diffDigests.size();
/*
* Report the digests in descending order. This takes care of the endpoints
* that are far behind w.r.t this local endpoint
*/
for (int i = size - 1; i >= 0; --i)
{
gDigestList.add(epToDigestMap.get(diffDigests.get(i).getEndpoint()));
}
} | [
"private",
"void",
"doSort",
"(",
"List",
"<",
"GossipDigest",
">",
"gDigestList",
")",
"{",
"/* Construct a map of endpoint to GossipDigest. */",
"Map",
"<",
"InetAddress",
",",
"GossipDigest",
">",
"epToDigestMap",
"=",
"new",
"HashMap",
"<",
"InetAddress",
",",
"... | /*
First construct a map whose key is the endpoint in the GossipDigest and the value is the
GossipDigest itself. Then build a list of version differences i.e difference between the
version in the GossipDigest and the version in the local state for a given InetAddress.
Sort this list. Now loop through the sorted list and retrieve the GossipDigest corresponding
to the endpoint from the map that was initially constructed. | [
"/",
"*",
"First",
"construct",
"a",
"map",
"whose",
"key",
"is",
"the",
"endpoint",
"in",
"the",
"GossipDigest",
"and",
"the",
"value",
"is",
"the",
"GossipDigest",
"itself",
".",
"Then",
"build",
"a",
"list",
"of",
"version",
"differences",
"i",
".",
"... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java#L95-L129 |
andriusvelykis/reflow-maven-skin | reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/SkinConfigTool.java | SkinConfigTool.isValue | public boolean isValue(String property, String value) {
return value != null && value.equals(value(property));
} | java | public boolean isValue(String property, String value) {
return value != null && value.equals(value(property));
} | [
"public",
"boolean",
"isValue",
"(",
"String",
"property",
",",
"String",
"value",
")",
"{",
"return",
"value",
"!=",
"null",
"&&",
"value",
".",
"equals",
"(",
"value",
"(",
"property",
")",
")",
";",
"}"
] | A convenience method to check if the {@code property} is set to a specific value.
@param property
the property of interest
@param value
the property value to check
@return {@code true} if the configuration value is set either in page or globally, and is
equal to {@code value}.
@see #get(String)
@since 1.0 | [
"A",
"convenience",
"method",
"to",
"check",
"if",
"the",
"{",
"@code",
"property",
"}",
"is",
"set",
"to",
"a",
"specific",
"value",
"."
] | train | https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/SkinConfigTool.java#L341-L343 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java | PathNormalizer.joinPaths | public static String joinPaths(String prefix, String path, boolean generatedPath) {
String result = null;
if (generatedPath) {
result = joinDomainToPath(prefix, path);
} else {
result = joinPaths(prefix, path);
}
return result;
} | java | public static String joinPaths(String prefix, String path, boolean generatedPath) {
String result = null;
if (generatedPath) {
result = joinDomainToPath(prefix, path);
} else {
result = joinPaths(prefix, path);
}
return result;
} | [
"public",
"static",
"String",
"joinPaths",
"(",
"String",
"prefix",
",",
"String",
"path",
",",
"boolean",
"generatedPath",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"generatedPath",
")",
"{",
"result",
"=",
"joinDomainToPath",
"(",
"prefix"... | Normalizes two paths and joins them as a single path.
@param prefix
@param path
@return the joined path | [
"Normalizes",
"two",
"paths",
"and",
"joins",
"them",
"as",
"a",
"single",
"path",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L294-L303 |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONGetter.java | JSONGetter.getBean | public <T> T getBean(K key, Class<T> beanType) {
final JSONObject obj = getJSONObject(key);
return (null == obj) ? null : obj.toBean(beanType);
} | java | public <T> T getBean(K key, Class<T> beanType) {
final JSONObject obj = getJSONObject(key);
return (null == obj) ? null : obj.toBean(beanType);
} | [
"public",
"<",
"T",
">",
"T",
"getBean",
"(",
"K",
"key",
",",
"Class",
"<",
"T",
">",
"beanType",
")",
"{",
"final",
"JSONObject",
"obj",
"=",
"getJSONObject",
"(",
"key",
")",
";",
"return",
"(",
"null",
"==",
"obj",
")",
"?",
"null",
":",
"obj... | 从JSON中直接获取Bean对象<br>
先获取JSONObject对象,然后转为Bean对象
@param <T> Bean类型
@param key KEY
@param beanType Bean类型
@return Bean对象,如果值为null或者非JSONObject类型,返回null
@since 3.1.1 | [
"从JSON中直接获取Bean对象<br",
">",
"先获取JSONObject对象,然后转为Bean对象"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONGetter.java#L95-L98 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java | CommerceSubscriptionEntryPersistenceImpl.findByG_U | @Override
public List<CommerceSubscriptionEntry> findByG_U(long groupId, long userId,
int start, int end) {
return findByG_U(groupId, userId, start, end, null);
} | java | @Override
public List<CommerceSubscriptionEntry> findByG_U(long groupId, long userId,
int start, int end) {
return findByG_U(groupId, userId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceSubscriptionEntry",
">",
"findByG_U",
"(",
"long",
"groupId",
",",
"long",
"userId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByG_U",
"(",
"groupId",
",",
"userId",
",",
"start",
",",... | Returns a range of all the commerce subscription entries where groupId = ? and userId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceSubscriptionEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param userId the user ID
@param start the lower bound of the range of commerce subscription entries
@param end the upper bound of the range of commerce subscription entries (not inclusive)
@return the range of matching commerce subscription entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"subscription",
"entries",
"where",
"groupId",
"=",
"?",
";",
"and",
"userId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java#L2598-L2602 |
mgm-tp/jfunk | jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java | MathRandom.getInt | public int getInt(final int min, final int max) {
return min(min, max) + getInt(abs(max - min));
} | java | public int getInt(final int min, final int max) {
return min(min, max) + getInt(abs(max - min));
} | [
"public",
"int",
"getInt",
"(",
"final",
"int",
"min",
",",
"final",
"int",
"max",
")",
"{",
"return",
"min",
"(",
"min",
",",
"max",
")",
"+",
"getInt",
"(",
"abs",
"(",
"max",
"-",
"min",
")",
")",
";",
"}"
] | Returns a random integer number in the range of [min, max].
@param min
minimum value for generated number
@param max
maximum value for generated number | [
"Returns",
"a",
"random",
"integer",
"number",
"in",
"the",
"range",
"of",
"[",
"min",
"max",
"]",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java#L93-L95 |
mgormley/optimize | src/main/java/edu/jhu/hlt/optimize/function/Bounds.java | Bounds.transformRangeLinearly | public double transformRangeLinearly(double l, double u, int i, double d){
return (B[i]-A[i])/(u-l)*(d-u)+B[i];
} | java | public double transformRangeLinearly(double l, double u, int i, double d){
return (B[i]-A[i])/(u-l)*(d-u)+B[i];
} | [
"public",
"double",
"transformRangeLinearly",
"(",
"double",
"l",
",",
"double",
"u",
",",
"int",
"i",
",",
"double",
"d",
")",
"{",
"return",
"(",
"B",
"[",
"i",
"]",
"-",
"A",
"[",
"i",
"]",
")",
"/",
"(",
"u",
"-",
"l",
")",
"*",
"(",
"d",... | Maps d \in [l,u] to transformed(d), such that
transformed(d) \in [A[i], B[i]]. The transform is
just a linear one. It does *NOT* check for +/- infinity. | [
"Maps",
"d",
"\\",
"in",
"[",
"l",
"u",
"]",
"to",
"transformed",
"(",
"d",
")",
"such",
"that",
"transformed",
"(",
"d",
")",
"\\",
"in",
"[",
"A",
"[",
"i",
"]",
"B",
"[",
"i",
"]]",
".",
"The",
"transform",
"is",
"just",
"a",
"linear",
"on... | train | https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/function/Bounds.java#L91-L93 |
jamesagnew/hapi-fhir | hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Split.java | Split.apply | @Override
public Object apply(Object value, Object... params) {
String original = super.asString(value);
String delimiter = super.asString(super.get(0, params));
return original.split("(?<!^)" + Pattern.quote(delimiter));
} | java | @Override
public Object apply(Object value, Object... params) {
String original = super.asString(value);
String delimiter = super.asString(super.get(0, params));
return original.split("(?<!^)" + Pattern.quote(delimiter));
} | [
"@",
"Override",
"public",
"Object",
"apply",
"(",
"Object",
"value",
",",
"Object",
"...",
"params",
")",
"{",
"String",
"original",
"=",
"super",
".",
"asString",
"(",
"value",
")",
";",
"String",
"delimiter",
"=",
"super",
".",
"asString",
"(",
"super... | /*
split(input, delimiter = ' ')
Split a string on a matching pattern
E.g. {{ "a~b" | split:'~' | first }} #=> 'a' | [
"/",
"*",
"split",
"(",
"input",
"delimiter",
"=",
")"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Split.java#L14-L22 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/view/DefaultAliasedCumulatives.java | DefaultAliasedCumulatives.addDim | @Override
public void addDim(int c, int[] cUse, IntVar[] dUse, int[] alias) {
capacities.add(c);
cUsages.add(cUse);
dUsages.add(dUse);
aliases.add(alias);
} | java | @Override
public void addDim(int c, int[] cUse, IntVar[] dUse, int[] alias) {
capacities.add(c);
cUsages.add(cUse);
dUsages.add(dUse);
aliases.add(alias);
} | [
"@",
"Override",
"public",
"void",
"addDim",
"(",
"int",
"c",
",",
"int",
"[",
"]",
"cUse",
",",
"IntVar",
"[",
"]",
"dUse",
",",
"int",
"[",
"]",
"alias",
")",
"{",
"capacities",
".",
"add",
"(",
"c",
")",
";",
"cUsages",
".",
"add",
"(",
"cUs... | Add a constraint
@param c the cumulative capacity of the aliased resources
@param cUse the usage of each of the c-slices
@param dUse the usage of each of the d-slices
@param alias the resource identifiers that compose the alias | [
"Add",
"a",
"constraint"
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/view/DefaultAliasedCumulatives.java#L68-L74 |
kumuluz/kumuluzee | tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java | EeClassLoader.definePackage | private void definePackage(String className, JarEntryInfo jarEntryInfo) throws IllegalArgumentException {
int index = className.lastIndexOf('.');
String packageName = index > 0 ? className.substring(0, index) : "";
if (getPackage(packageName) == null) {
JarFileInfo jarFileInfo = jarEntryInfo.getJarFileInfo();
definePackage(
packageName, jarFileInfo.getSpecificationTitle(), jarFileInfo.getSpecificationVersion(),
jarFileInfo.getSpecificationVendor(), jarFileInfo.getImplementationTitle(),
jarFileInfo.getImplementationVersion(), jarFileInfo.getImplementationVendor(),
jarFileInfo.getSealURL()
);
}
} | java | private void definePackage(String className, JarEntryInfo jarEntryInfo) throws IllegalArgumentException {
int index = className.lastIndexOf('.');
String packageName = index > 0 ? className.substring(0, index) : "";
if (getPackage(packageName) == null) {
JarFileInfo jarFileInfo = jarEntryInfo.getJarFileInfo();
definePackage(
packageName, jarFileInfo.getSpecificationTitle(), jarFileInfo.getSpecificationVersion(),
jarFileInfo.getSpecificationVendor(), jarFileInfo.getImplementationTitle(),
jarFileInfo.getImplementationVersion(), jarFileInfo.getImplementationVendor(),
jarFileInfo.getSealURL()
);
}
} | [
"private",
"void",
"definePackage",
"(",
"String",
"className",
",",
"JarEntryInfo",
"jarEntryInfo",
")",
"throws",
"IllegalArgumentException",
"{",
"int",
"index",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"String",
"packageName",
"=",
"ind... | The default <code>ClassLoader.defineClass()</code> does not create package
for the loaded class and leaves it null. Each package referenced by this
class loader must be created only once before the
<code>ClassLoader.defineClass()</code> call.
The base class <code>ClassLoader</code> keeps cache with created packages
for reuse.
@param className class to load.
@throws IllegalArgumentException
If package name duplicates an existing package either in this
class loader or one of its ancestors. | [
"The",
"default",
"<code",
">",
"ClassLoader",
".",
"defineClass",
"()",
"<",
"/",
"code",
">",
"does",
"not",
"create",
"package",
"for",
"the",
"loaded",
"class",
"and",
"leaves",
"it",
"null",
".",
"Each",
"package",
"referenced",
"by",
"this",
"class",... | train | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java#L651-L663 |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java | TimePickerDialog.setTimeInterval | @SuppressWarnings("SameParameterValue")
public void setTimeInterval(@IntRange(from=1, to=24) int hourInterval,
@IntRange(from=1, to=60) int minuteInterval) {
setTimeInterval(hourInterval, minuteInterval, 60);
} | java | @SuppressWarnings("SameParameterValue")
public void setTimeInterval(@IntRange(from=1, to=24) int hourInterval,
@IntRange(from=1, to=60) int minuteInterval) {
setTimeInterval(hourInterval, minuteInterval, 60);
} | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"public",
"void",
"setTimeInterval",
"(",
"@",
"IntRange",
"(",
"from",
"=",
"1",
",",
"to",
"=",
"24",
")",
"int",
"hourInterval",
",",
"@",
"IntRange",
"(",
"from",
"=",
"1",
",",
"to",
"=",
... | Set the interval for selectable times in the TimePickerDialog
This is a convenience wrapper around setSelectableTimes
The interval for all three time components can be set independently
If you are not using the seconds / minutes picker, set the respective item to 60 for
better performance.
@param hourInterval The interval between 2 selectable hours ([1,24])
@param minuteInterval The interval between 2 selectable minutes ([1,60]) | [
"Set",
"the",
"interval",
"for",
"selectable",
"times",
"in",
"the",
"TimePickerDialog",
"This",
"is",
"a",
"convenience",
"wrapper",
"around",
"setSelectableTimes",
"The",
"interval",
"for",
"all",
"three",
"time",
"components",
"can",
"be",
"set",
"independently... | train | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java#L458-L462 |
telly/groundy | library/src/main/java/com/telly/groundy/GroundyManager.java | GroundyManager.cancelTaskById | public static void cancelTaskById(Context context, final long id, final int reason,
final SingleCancelListener cancelListener,
Class<? extends GroundyService> groundyServiceClass) {
if (id <= 0) {
throw new IllegalStateException("id must be greater than zero");
}
new GroundyServiceConnection(context, groundyServiceClass) {
@Override
protected void onGroundyServiceBound(GroundyService.GroundyServiceBinder binder) {
int result = binder.cancelTaskById(id, reason);
if (cancelListener != null) {
cancelListener.onCancelResult(id, result);
}
}
}.start();
} | java | public static void cancelTaskById(Context context, final long id, final int reason,
final SingleCancelListener cancelListener,
Class<? extends GroundyService> groundyServiceClass) {
if (id <= 0) {
throw new IllegalStateException("id must be greater than zero");
}
new GroundyServiceConnection(context, groundyServiceClass) {
@Override
protected void onGroundyServiceBound(GroundyService.GroundyServiceBinder binder) {
int result = binder.cancelTaskById(id, reason);
if (cancelListener != null) {
cancelListener.onCancelResult(id, result);
}
}
}.start();
} | [
"public",
"static",
"void",
"cancelTaskById",
"(",
"Context",
"context",
",",
"final",
"long",
"id",
",",
"final",
"int",
"reason",
",",
"final",
"SingleCancelListener",
"cancelListener",
",",
"Class",
"<",
"?",
"extends",
"GroundyService",
">",
"groundyServiceCla... | Cancels all tasks of the specified group w/ the specified reason.
@param context used to interact with the service
@param id the value to cancel
@param cancelListener callback for cancel result | [
"Cancels",
"all",
"tasks",
"of",
"the",
"specified",
"group",
"w",
"/",
"the",
"specified",
"reason",
"."
] | train | https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/GroundyManager.java#L99-L114 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java | WebDriverTool.executeScript | public Object executeScript(final String script, final Object... args) {
LOGGER.info("executeScript: {}", new ToStringBuilder(this, LoggingToStringStyle.INSTANCE).append("script", script).append("args", args));
return ((JavascriptExecutor) webDriver).executeScript(script, args);
} | java | public Object executeScript(final String script, final Object... args) {
LOGGER.info("executeScript: {}", new ToStringBuilder(this, LoggingToStringStyle.INSTANCE).append("script", script).append("args", args));
return ((JavascriptExecutor) webDriver).executeScript(script, args);
} | [
"public",
"Object",
"executeScript",
"(",
"final",
"String",
"script",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"executeScript: {}\"",
",",
"new",
"ToStringBuilder",
"(",
"this",
",",
"LoggingToStringStyle",
".",
"INSTANCE",... | Execute JavaScript in the context of the currently selected frame or window.
@see JavascriptExecutor#executeScript(String, Object...)
@param script
The JavaScript to execute
@param args
The arguments to the script. May be empty
@return One of Boolean, Long, String, List or WebElement. Or null. | [
"Execute",
"JavaScript",
"in",
"the",
"context",
"of",
"the",
"currently",
"selected",
"frame",
"or",
"window",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L733-L736 |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/DateTimePickerUtils.java | DateTimePickerUtils.tryAccessibilityAnnounce | @SuppressLint("NewApi")
public static void tryAccessibilityAnnounce(View view, CharSequence text) {
if (isJellybeanOrLater() && view != null && text != null) {
view.announceForAccessibility(text);
}
} | java | @SuppressLint("NewApi")
public static void tryAccessibilityAnnounce(View view, CharSequence text) {
if (isJellybeanOrLater() && view != null && text != null) {
view.announceForAccessibility(text);
}
} | [
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"public",
"static",
"void",
"tryAccessibilityAnnounce",
"(",
"View",
"view",
",",
"CharSequence",
"text",
")",
"{",
"if",
"(",
"isJellybeanOrLater",
"(",
")",
"&&",
"view",
"!=",
"null",
"&&",
"text",
"!=",
"null"... | Try to speak the specified text, for accessibility. Only available on JB or later.
@param text Text to announce. | [
"Try",
"to",
"speak",
"the",
"specified",
"text",
"for",
"accessibility",
".",
"Only",
"available",
"on",
"JB",
"or",
"later",
"."
] | train | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/DateTimePickerUtils.java#L71-L76 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.andNotLikePattern | public ZealotKhala andNotLikePattern(String field, String pattern) {
return this.doLikePattern(ZealotConst.AND_PREFIX, field, pattern, true, false);
} | java | public ZealotKhala andNotLikePattern(String field, String pattern) {
return this.doLikePattern(ZealotConst.AND_PREFIX, field, pattern, true, false);
} | [
"public",
"ZealotKhala",
"andNotLikePattern",
"(",
"String",
"field",
",",
"String",
"pattern",
")",
"{",
"return",
"this",
".",
"doLikePattern",
"(",
"ZealotConst",
".",
"AND_PREFIX",
",",
"field",
",",
"pattern",
",",
"true",
",",
"false",
")",
";",
"}"
] | 根据指定的模式字符串生成带" AND "前缀的" NOT LIKE "模糊查询的SQL片段.
<p>示例:传入 {"b.title", "Java%"} 两个参数,生成的SQL片段为:" AND b.title NOT LIKE 'Java%' "</p>
@param field 数据库字段
@param pattern 模式字符串
@return ZealotKhala实例 | [
"根据指定的模式字符串生成带",
"AND",
"前缀的",
"NOT",
"LIKE",
"模糊查询的SQL片段",
".",
"<p",
">",
"示例:传入",
"{",
"b",
".",
"title",
"Java%",
"}",
"两个参数,生成的SQL片段为:",
"AND",
"b",
".",
"title",
"NOT",
"LIKE",
"Java%",
"<",
"/",
"p",
">"
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1144-L1146 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/client/gui/component/container/UITabGroup.java | UITabGroup.attachTo | public UITabGroup attachTo(UIContainer container, boolean displace)
{
attachedContainer = container;
if (activeTab != null)
activeTab.setActive(true);
switch (tabPosition)
{
case TOP:
setPosition(Position.above(this, container, -2));
break;
case BOTTOM:
setPosition(Position.below(this, container, -2));
break;
case LEFT:
setPosition(Position.leftOf(this, container, -2));
break;
case RIGHT:
setPosition(Position.rightOf(this, container, -2));
break;
}
for (UIContainer tabContainer : listTabs.values())
setupTabContainer(tabContainer);
calculateTabPosition();
if (activeTab != null)
{
UITab tab = activeTab;
activeTab = null;
setActiveTab(tab);
}
if (displace)
{
attachedContainer.setPosition(new AttachedContainerPosition(attachedContainer.position()));
attachedContainer.setSize(new AttachedContainerSize(attachedContainer.size()));
}
return this;
} | java | public UITabGroup attachTo(UIContainer container, boolean displace)
{
attachedContainer = container;
if (activeTab != null)
activeTab.setActive(true);
switch (tabPosition)
{
case TOP:
setPosition(Position.above(this, container, -2));
break;
case BOTTOM:
setPosition(Position.below(this, container, -2));
break;
case LEFT:
setPosition(Position.leftOf(this, container, -2));
break;
case RIGHT:
setPosition(Position.rightOf(this, container, -2));
break;
}
for (UIContainer tabContainer : listTabs.values())
setupTabContainer(tabContainer);
calculateTabPosition();
if (activeTab != null)
{
UITab tab = activeTab;
activeTab = null;
setActiveTab(tab);
}
if (displace)
{
attachedContainer.setPosition(new AttachedContainerPosition(attachedContainer.position()));
attachedContainer.setSize(new AttachedContainerSize(attachedContainer.size()));
}
return this;
} | [
"public",
"UITabGroup",
"attachTo",
"(",
"UIContainer",
"container",
",",
"boolean",
"displace",
")",
"{",
"attachedContainer",
"=",
"container",
";",
"if",
"(",
"activeTab",
"!=",
"null",
")",
"activeTab",
".",
"setActive",
"(",
"true",
")",
";",
"switch",
... | Attach this {@link UITabGroup} to a {@link UIContainer}.
@param container the container to attach to.
@param displace if true, moves and resize the UIContainer to make place for the UITabGroup
@return this {@link UITab} | [
"Attach",
"this",
"{",
"@link",
"UITabGroup",
"}",
"to",
"a",
"{",
"@link",
"UIContainer",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/component/container/UITabGroup.java#L299-L340 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.updateTagAsync | public Observable<Tag> updateTagAsync(UUID projectId, UUID tagId, Tag updatedTag) {
return updateTagWithServiceResponseAsync(projectId, tagId, updatedTag).map(new Func1<ServiceResponse<Tag>, Tag>() {
@Override
public Tag call(ServiceResponse<Tag> response) {
return response.body();
}
});
} | java | public Observable<Tag> updateTagAsync(UUID projectId, UUID tagId, Tag updatedTag) {
return updateTagWithServiceResponseAsync(projectId, tagId, updatedTag).map(new Func1<ServiceResponse<Tag>, Tag>() {
@Override
public Tag call(ServiceResponse<Tag> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Tag",
">",
"updateTagAsync",
"(",
"UUID",
"projectId",
",",
"UUID",
"tagId",
",",
"Tag",
"updatedTag",
")",
"{",
"return",
"updateTagWithServiceResponseAsync",
"(",
"projectId",
",",
"tagId",
",",
"updatedTag",
")",
".",
"map",
"(... | Update a tag.
@param projectId The project id
@param tagId The id of the target tag
@param updatedTag The updated tag model
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Tag object | [
"Update",
"a",
"tag",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L630-L637 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/data/AnyValueMap.java | AnyValueMap.getAsTypeWithDefault | public <T> T getAsTypeWithDefault(Class<T> type, String key, T defaultValue) {
Object value = getAsObject(key);
return TypeConverter.toTypeWithDefault(type, value, defaultValue);
} | java | public <T> T getAsTypeWithDefault(Class<T> type, String key, T defaultValue) {
Object value = getAsObject(key);
return TypeConverter.toTypeWithDefault(type, value, defaultValue);
} | [
"public",
"<",
"T",
">",
"T",
"getAsTypeWithDefault",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"key",
",",
"T",
"defaultValue",
")",
"{",
"Object",
"value",
"=",
"getAsObject",
"(",
"key",
")",
";",
"return",
"TypeConverter",
".",
"toTypeWithD... | Converts map element into a value defined by specied typecode. If conversion
is not possible it returns default value.
@param type the Class type that defined the type of the result
@param key a key of element to get.
@param defaultValue the default value
@return element value defined by the typecode or default value if conversion
is not supported.
@see TypeConverter#toTypeWithDefault(Class, Object, Object) | [
"Converts",
"map",
"element",
"into",
"a",
"value",
"defined",
"by",
"specied",
"typecode",
".",
"If",
"conversion",
"is",
"not",
"possible",
"it",
"returns",
"default",
"value",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L495-L498 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper.isPurableOperation | boolean isPurableOperation(XtendFunction operation, ISideEffectContext context) {
if (isUnpureOperationPrototype(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForNotPureOperation(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForPureOperation(operation)) {
return true;
}
if (context == null) {
return !hasSideEffects(
getInferredPrototype(operation),
operation.getExpression());
}
final Boolean result = internalHasSideEffects(operation.getExpression(), context);
return result == null || !result.booleanValue();
} | java | boolean isPurableOperation(XtendFunction operation, ISideEffectContext context) {
if (isUnpureOperationPrototype(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForNotPureOperation(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForPureOperation(operation)) {
return true;
}
if (context == null) {
return !hasSideEffects(
getInferredPrototype(operation),
operation.getExpression());
}
final Boolean result = internalHasSideEffects(operation.getExpression(), context);
return result == null || !result.booleanValue();
} | [
"boolean",
"isPurableOperation",
"(",
"XtendFunction",
"operation",
",",
"ISideEffectContext",
"context",
")",
"{",
"if",
"(",
"isUnpureOperationPrototype",
"(",
"operation",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"nameValidator",
".... | Replies if the given is purable in the given context.
@param operation the operation to test.
@param context the context.
@return {@code true} if the operation could be marked as pure. | [
"Replies",
"if",
"the",
"given",
"is",
"purable",
"in",
"the",
"given",
"context",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L178-L195 |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.fromNode | public static QName fromNode(final Node nd) {
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
ns = "";
}
return new QName(ns, nd.getLocalName());
} | java | public static QName fromNode(final Node nd) {
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
ns = "";
}
return new QName(ns, nd.getLocalName());
} | [
"public",
"static",
"QName",
"fromNode",
"(",
"final",
"Node",
"nd",
")",
"{",
"String",
"ns",
"=",
"nd",
".",
"getNamespaceURI",
"(",
")",
";",
"if",
"(",
"ns",
"==",
"null",
")",
"{",
"/* It appears a node can have a NULL namespace but a QName has a zero length\... | Return a QName for the node
@param nd
@return boolean true for match | [
"Return",
"a",
"QName",
"for",
"the",
"node"
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L509-L519 |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/security/KeyProvider.java | KeyProvider.getSecretKey | public SecretKey getSecretKey(String alias, String password) {
Key key = getKey(alias, password);
if (key instanceof PrivateKey) {
return (SecretKey) key;
} else {
throw new IllegalStateException(format("Key with alias '%s' was not a secret key, but was: %s",
alias, key.getClass().getSimpleName()));
}
} | java | public SecretKey getSecretKey(String alias, String password) {
Key key = getKey(alias, password);
if (key instanceof PrivateKey) {
return (SecretKey) key;
} else {
throw new IllegalStateException(format("Key with alias '%s' was not a secret key, but was: %s",
alias, key.getClass().getSimpleName()));
}
} | [
"public",
"SecretKey",
"getSecretKey",
"(",
"String",
"alias",
",",
"String",
"password",
")",
"{",
"Key",
"key",
"=",
"getKey",
"(",
"alias",
",",
"password",
")",
";",
"if",
"(",
"key",
"instanceof",
"PrivateKey",
")",
"{",
"return",
"(",
"SecretKey",
... | Gets a symmetric encryption secret key from the key store
@param alias key alias
@param password key password
@return the secret key | [
"Gets",
"a",
"symmetric",
"encryption",
"secret",
"key",
"from",
"the",
"key",
"store"
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/security/KeyProvider.java#L71-L79 |
aboutsip/pkts | pkts-core/src/main/java/io/pkts/Pcap.java | Pcap.openStream | public static Pcap openStream(final InputStream is) throws IOException {
final Buffer stream = Buffers.wrap(is);
final PcapGlobalHeader header = PcapGlobalHeader.parse(stream);
return new Pcap(header, stream);
} | java | public static Pcap openStream(final InputStream is) throws IOException {
final Buffer stream = Buffers.wrap(is);
final PcapGlobalHeader header = PcapGlobalHeader.parse(stream);
return new Pcap(header, stream);
} | [
"public",
"static",
"Pcap",
"openStream",
"(",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"final",
"Buffer",
"stream",
"=",
"Buffers",
".",
"wrap",
"(",
"is",
")",
";",
"final",
"PcapGlobalHeader",
"header",
"=",
"PcapGlobalHeader",
".",
... | Capture packets from the input stream
@param is
@return
@throws IOException | [
"Capture",
"packets",
"from",
"the",
"input",
"stream"
] | train | https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-core/src/main/java/io/pkts/Pcap.java#L121-L125 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java | EmbeddedNeo4jEntityQueries.updateEmbeddedColumn | public void updateEmbeddedColumn(GraphDatabaseService executionEngine, Object[] keyValues, String embeddedColumn, Object value) {
String query = getUpdateEmbeddedColumnQuery( keyValues, embeddedColumn );
Map<String, Object> params = params( ArrayHelper.concat( keyValues, value, value ) );
executionEngine.execute( query, params );
} | java | public void updateEmbeddedColumn(GraphDatabaseService executionEngine, Object[] keyValues, String embeddedColumn, Object value) {
String query = getUpdateEmbeddedColumnQuery( keyValues, embeddedColumn );
Map<String, Object> params = params( ArrayHelper.concat( keyValues, value, value ) );
executionEngine.execute( query, params );
} | [
"public",
"void",
"updateEmbeddedColumn",
"(",
"GraphDatabaseService",
"executionEngine",
",",
"Object",
"[",
"]",
"keyValues",
",",
"String",
"embeddedColumn",
",",
"Object",
"value",
")",
"{",
"String",
"query",
"=",
"getUpdateEmbeddedColumnQuery",
"(",
"keyValues",... | Update the value of an embedded node property.
@param executionEngine the {@link GraphDatabaseService} used to run the query
@param keyValues the columns representing the identifier in the entity owning the embedded
@param embeddedColumn the column on the embedded node (dot-separated properties)
@param value the new value for the property | [
"Update",
"the",
"value",
"of",
"an",
"embedded",
"node",
"property",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java#L167-L171 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ProcessorUtils.java | ProcessorUtils.createLooseArchiveEntryConfig | public static ArchiveEntryConfig createLooseArchiveEntryConfig(LooseConfig looseConfig, File looseFile, BootstrapConfig bootProps,
String archiveEntryPrefix, boolean isUsr) throws IOException {
File usrRoot = bootProps.getUserRoot();
int len = usrRoot.getAbsolutePath().length();
String entryPath = null;
if (archiveEntryPrefix.equalsIgnoreCase(PackageProcessor.PACKAGE_ARCHIVE_PREFIX) || !isUsr) {
entryPath = archiveEntryPrefix + BootstrapConstants.LOC_AREA_NAME_USR + looseFile.getAbsolutePath().substring(len);
} else {
entryPath = archiveEntryPrefix + looseFile.getAbsolutePath().substring(len);
}
entryPath = entryPath.replace("\\", "/");
entryPath = entryPath.replace("//", "/");
entryPath = entryPath.substring(0, entryPath.length() - 4); // trim the .xml
File archiveFile = processArchive(looseFile.getName(), looseConfig, true, bootProps);
return new FileEntryConfig(entryPath, archiveFile);
} | java | public static ArchiveEntryConfig createLooseArchiveEntryConfig(LooseConfig looseConfig, File looseFile, BootstrapConfig bootProps,
String archiveEntryPrefix, boolean isUsr) throws IOException {
File usrRoot = bootProps.getUserRoot();
int len = usrRoot.getAbsolutePath().length();
String entryPath = null;
if (archiveEntryPrefix.equalsIgnoreCase(PackageProcessor.PACKAGE_ARCHIVE_PREFIX) || !isUsr) {
entryPath = archiveEntryPrefix + BootstrapConstants.LOC_AREA_NAME_USR + looseFile.getAbsolutePath().substring(len);
} else {
entryPath = archiveEntryPrefix + looseFile.getAbsolutePath().substring(len);
}
entryPath = entryPath.replace("\\", "/");
entryPath = entryPath.replace("//", "/");
entryPath = entryPath.substring(0, entryPath.length() - 4); // trim the .xml
File archiveFile = processArchive(looseFile.getName(), looseConfig, true, bootProps);
return new FileEntryConfig(entryPath, archiveFile);
} | [
"public",
"static",
"ArchiveEntryConfig",
"createLooseArchiveEntryConfig",
"(",
"LooseConfig",
"looseConfig",
",",
"File",
"looseFile",
",",
"BootstrapConfig",
"bootProps",
",",
"String",
"archiveEntryPrefix",
",",
"boolean",
"isUsr",
")",
"throws",
"IOException",
"{",
... | Using the method to create Loose config's Archive entry config
@param looseConfig
@param looseFile
@param bootProps
@return
@throws IOException | [
"Using",
"the",
"method",
"to",
"create",
"Loose",
"config",
"s",
"Archive",
"entry",
"config"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ProcessorUtils.java#L188-L206 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java | Calc.vectorProduct | public static final Atom vectorProduct(Atom a , Atom b){
Atom c = new AtomImpl();
c.setX( a.getY() * b.getZ() - a.getZ() * b.getY() ) ;
c.setY( a.getZ() * b.getX() - a.getX() * b.getZ() ) ;
c.setZ( a.getX() * b.getY() - a.getY() * b.getX() ) ;
return c ;
} | java | public static final Atom vectorProduct(Atom a , Atom b){
Atom c = new AtomImpl();
c.setX( a.getY() * b.getZ() - a.getZ() * b.getY() ) ;
c.setY( a.getZ() * b.getX() - a.getX() * b.getZ() ) ;
c.setZ( a.getX() * b.getY() - a.getY() * b.getX() ) ;
return c ;
} | [
"public",
"static",
"final",
"Atom",
"vectorProduct",
"(",
"Atom",
"a",
",",
"Atom",
"b",
")",
"{",
"Atom",
"c",
"=",
"new",
"AtomImpl",
"(",
")",
";",
"c",
".",
"setX",
"(",
"a",
".",
"getY",
"(",
")",
"*",
"b",
".",
"getZ",
"(",
")",
"-",
"... | Vector product (cross product).
@param a
an Atom object
@param b
an Atom object
@return an Atom object | [
"Vector",
"product",
"(",
"cross",
"product",
")",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L151-L159 |
kkopacz/agiso-core | bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/DateUtils.java | DateUtils.getRandomDate | public static Date getRandomDate(Date begin, Date end) {
return getRandomDate(begin, end, r);
} | java | public static Date getRandomDate(Date begin, Date end) {
return getRandomDate(begin, end, r);
} | [
"public",
"static",
"Date",
"getRandomDate",
"(",
"Date",
"begin",
",",
"Date",
"end",
")",
"{",
"return",
"getRandomDate",
"(",
"begin",
",",
"end",
",",
"r",
")",
";",
"}"
] | Pobiera pseudolosową datę z określonego przedziału czasowego.
@param begin Data początkowa.
@param end Data końcowa.
@return Losowo wygenerowana data. | [
"Pobiera",
"pseudolosową",
"datę",
"z",
"określonego",
"przedziału",
"czasowego",
"."
] | train | https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/DateUtils.java#L195-L197 |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/BasicCacheEntry.java | BasicCacheEntry.checkFixity | @Override
public Collection<URI> checkFixity(final Collection<String> algorithms) throws UnsupportedAlgorithmException {
try (InputStream binaryStream = this.getInputStream()) {
final Map<String, DigestInputStream> digestInputStreams = new HashMap<>();
InputStream digestStream = binaryStream;
for (String digestAlg : algorithms) {
try {
digestStream = new DigestInputStream(digestStream, MessageDigest.getInstance(digestAlg));
digestInputStreams.put(digestAlg, (DigestInputStream)digestStream);
} catch (NoSuchAlgorithmException e) {
throw new UnsupportedAlgorithmException("Unsupported digest algorithm: " + digestAlg);
}
}
// calculate the digest by consuming the stream
while (digestStream.read(devNull) != -1) { }
return digestInputStreams.entrySet().stream()
.map(entry -> ContentDigest.asURI(entry.getKey(), entry.getValue().getMessageDigest().digest()))
.collect(Collectors.toSet());
} catch (final IOException e) {
LOGGER.debug("Got error closing input stream: {}", e);
throw new RepositoryRuntimeException(e);
}
} | java | @Override
public Collection<URI> checkFixity(final Collection<String> algorithms) throws UnsupportedAlgorithmException {
try (InputStream binaryStream = this.getInputStream()) {
final Map<String, DigestInputStream> digestInputStreams = new HashMap<>();
InputStream digestStream = binaryStream;
for (String digestAlg : algorithms) {
try {
digestStream = new DigestInputStream(digestStream, MessageDigest.getInstance(digestAlg));
digestInputStreams.put(digestAlg, (DigestInputStream)digestStream);
} catch (NoSuchAlgorithmException e) {
throw new UnsupportedAlgorithmException("Unsupported digest algorithm: " + digestAlg);
}
}
// calculate the digest by consuming the stream
while (digestStream.read(devNull) != -1) { }
return digestInputStreams.entrySet().stream()
.map(entry -> ContentDigest.asURI(entry.getKey(), entry.getValue().getMessageDigest().digest()))
.collect(Collectors.toSet());
} catch (final IOException e) {
LOGGER.debug("Got error closing input stream: {}", e);
throw new RepositoryRuntimeException(e);
}
} | [
"@",
"Override",
"public",
"Collection",
"<",
"URI",
">",
"checkFixity",
"(",
"final",
"Collection",
"<",
"String",
">",
"algorithms",
")",
"throws",
"UnsupportedAlgorithmException",
"{",
"try",
"(",
"InputStream",
"binaryStream",
"=",
"this",
".",
"getInputStream... | Calculate fixity with list of digest algorithms of a CacheEntry by piping it through
a simple fixity-calculating InputStream
@param algorithms the digest algorithms to be used
@return the checksums for the digest algorithms
@throws UnsupportedAlgorithmException exception | [
"Calculate",
"fixity",
"with",
"list",
"of",
"digest",
"algorithms",
"of",
"a",
"CacheEntry",
"by",
"piping",
"it",
"through",
"a",
"simple",
"fixity",
"-",
"calculating",
"InputStream"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/BasicCacheEntry.java#L98-L125 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java | LoaderUtil.newCheckedInstanceOfProperty | public static <T> T newCheckedInstanceOfProperty(final String propertyName, final Class<T> clazz)
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException,
IllegalAccessException {
final String className = PropertiesUtil.getProperties().getStringProperty(propertyName);
if (className == null) {
return null;
}
return newCheckedInstanceOf(className, clazz);
} | java | public static <T> T newCheckedInstanceOfProperty(final String propertyName, final Class<T> clazz)
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException,
IllegalAccessException {
final String className = PropertiesUtil.getProperties().getStringProperty(propertyName);
if (className == null) {
return null;
}
return newCheckedInstanceOf(className, clazz);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newCheckedInstanceOfProperty",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"InvocationTargetException",
",... | Loads and instantiates a class given by a property name.
@param propertyName The property name to look up a class name for.
@param clazz The class to cast it to.
@param <T> The type to cast it to.
@return new instance of the class given in the property or {@code null} if the property was unset.
@throws ClassNotFoundException if the class isn't available to the usual ClassLoaders
@throws IllegalAccessException if the class can't be instantiated through a public constructor
@throws InstantiationException if there was an exception whilst instantiating the class
@throws NoSuchMethodException if there isn't a no-args constructor on the class
@throws InvocationTargetException if there was an exception whilst constructing the class
@throws ClassCastException if the constructed object isn't type compatible with {@code T}
@since 2.5 | [
"Loads",
"and",
"instantiates",
"a",
"class",
"given",
"by",
"a",
"property",
"name",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java#L219-L227 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.hasAnnotation | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalMissingAnnotationException.class })
public static Annotation hasAnnotation(@Nonnull final Class<?> clazz, @Nonnull final Class<? extends Annotation> annotation) {
Check.notNull(clazz, "clazz");
Check.notNull(annotation, "annotation");
if (!clazz.isAnnotationPresent(annotation)) {
throw new IllegalMissingAnnotationException(annotation, clazz);
}
return clazz.getAnnotation(annotation);
} | java | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalMissingAnnotationException.class })
public static Annotation hasAnnotation(@Nonnull final Class<?> clazz, @Nonnull final Class<? extends Annotation> annotation) {
Check.notNull(clazz, "clazz");
Check.notNull(annotation, "annotation");
if (!clazz.isAnnotationPresent(annotation)) {
throw new IllegalMissingAnnotationException(annotation, clazz);
}
return clazz.getAnnotation(annotation);
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"{",
"IllegalNullArgumentException",
".",
"class",
",",
"IllegalMissingAnnotationException",
".",
"class",
"}",
")",
"public",
"static",
"Annotation",
"hasAnnotation",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"?",
">... | Ensures that a passed class has an annotation of a specific type
@param clazz
the class that must have a required annotation
@param annotation
the type of annotation that is required on the class
@return the given annotation which is present on the checked class
@throws IllegalMissingAnnotationException
if the passed annotation is not annotated at the given class | [
"Ensures",
"that",
"a",
"passed",
"class",
"has",
"an",
"annotation",
"of",
"a",
"specific",
"type"
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1117-L1127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.