repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/JDBCUtilities.java | JDBCUtilities.getRowCount | public static int getRowCount(Connection connection, String tableReference) throws SQLException {
Statement st = connection.createStatement();
int rowCount = 0;
try {
ResultSet rs = st.executeQuery(String.format("select count(*) rowcount from %s", TableLocation.parse(tableReference)));
try {
if(rs.next()) {
rowCount = rs.getInt(1);
}
} finally {
rs.close();
}
}finally {
st.close();
}
return rowCount;
} | java | public static int getRowCount(Connection connection, String tableReference) throws SQLException {
Statement st = connection.createStatement();
int rowCount = 0;
try {
ResultSet rs = st.executeQuery(String.format("select count(*) rowcount from %s", TableLocation.parse(tableReference)));
try {
if(rs.next()) {
rowCount = rs.getInt(1);
}
} finally {
rs.close();
}
}finally {
st.close();
}
return rowCount;
} | [
"public",
"static",
"int",
"getRowCount",
"(",
"Connection",
"connection",
",",
"String",
"tableReference",
")",
"throws",
"SQLException",
"{",
"Statement",
"st",
"=",
"connection",
".",
"createStatement",
"(",
")",
";",
"int",
"rowCount",
"=",
"0",
";",
"try"... | Fetch the row count of a table.
@param connection Active connection.
@param tableReference Table reference
@return Row count
@throws SQLException If the table does not exists, or sql request fail. | [
"Fetch",
"the",
"row",
"count",
"of",
"a",
"table",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/JDBCUtilities.java#L177-L193 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.createRandomAccessFile | public static RandomAccessFile createRandomAccessFile(Path path, FileMode mode) {
return createRandomAccessFile(path.toFile(), mode);
} | java | public static RandomAccessFile createRandomAccessFile(Path path, FileMode mode) {
return createRandomAccessFile(path.toFile(), mode);
} | [
"public",
"static",
"RandomAccessFile",
"createRandomAccessFile",
"(",
"Path",
"path",
",",
"FileMode",
"mode",
")",
"{",
"return",
"createRandomAccessFile",
"(",
"path",
".",
"toFile",
"(",
")",
",",
"mode",
")",
";",
"}"
] | 创建{@link RandomAccessFile}
@param path 文件Path
@param mode 模式,见{@link FileMode}
@return {@link RandomAccessFile}
@since 4.5.2 | [
"创建",
"{",
"@link",
"RandomAccessFile",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3445-L3447 |
pravega/pravega | controller/src/main/java/io/pravega/controller/util/ZKUtils.java | ZKUtils.createPathIfNotExists | public static void createPathIfNotExists(final CuratorFramework client, final String basePath,
final byte[] initData) {
Preconditions.checkNotNull(client, "client");
Preconditions.checkNotNull(basePath, "basePath");
Preconditions.checkNotNull(initData, "initData");
try {
if (client.checkExists().forPath(basePath) == null) {
client.create().creatingParentsIfNeeded().forPath(basePath, initData);
}
} catch (KeeperException.NodeExistsException e) {
log.debug("Path exists {}, ignoring exception", basePath);
} catch (Exception e) {
throw new RuntimeException("Exception while creating znode: " + basePath, e);
}
} | java | public static void createPathIfNotExists(final CuratorFramework client, final String basePath,
final byte[] initData) {
Preconditions.checkNotNull(client, "client");
Preconditions.checkNotNull(basePath, "basePath");
Preconditions.checkNotNull(initData, "initData");
try {
if (client.checkExists().forPath(basePath) == null) {
client.create().creatingParentsIfNeeded().forPath(basePath, initData);
}
} catch (KeeperException.NodeExistsException e) {
log.debug("Path exists {}, ignoring exception", basePath);
} catch (Exception e) {
throw new RuntimeException("Exception while creating znode: " + basePath, e);
}
} | [
"public",
"static",
"void",
"createPathIfNotExists",
"(",
"final",
"CuratorFramework",
"client",
",",
"final",
"String",
"basePath",
",",
"final",
"byte",
"[",
"]",
"initData",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"client",
",",
"\"client\"",
")"... | Creates the znode if is doesn't already exist in zookeeper.
@param client The curator client to access zookeeper.
@param basePath The znode path string.
@param initData Initialize the znode using the supplied data if not already created.
@throws RuntimeException If checking or creating path on zookeeper fails. | [
"Creates",
"the",
"znode",
"if",
"is",
"doesn",
"t",
"already",
"exist",
"in",
"zookeeper",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/util/ZKUtils.java#L33-L48 |
SeleniumHQ/selenium | java/server/src/org/openqa/selenium/remote/server/xdrpc/CrossDomainRpcLoader.java | CrossDomainRpcLoader.loadRpc | public CrossDomainRpc loadRpc(HttpServletRequest request) throws IOException {
Charset encoding;
try {
String enc = request.getCharacterEncoding();
encoding = Charset.forName(enc);
} catch (IllegalArgumentException | NullPointerException e) {
encoding = UTF_8;
}
// We tend to look at the input stream, rather than the reader.
try (InputStream in = request.getInputStream();
Reader reader = new InputStreamReader(in, encoding);
JsonInput jsonInput = json.newInput(reader)) {
Map<String, Object> read = jsonInput.read(MAP_TYPE);
return new CrossDomainRpc(
getField(read, Field.METHOD),
getField(read, Field.PATH),
getField(read, Field.DATA));
} catch (JsonException e) {
throw new IllegalArgumentException(
"Failed to parse JSON request: " + e.getMessage(), e);
}
} | java | public CrossDomainRpc loadRpc(HttpServletRequest request) throws IOException {
Charset encoding;
try {
String enc = request.getCharacterEncoding();
encoding = Charset.forName(enc);
} catch (IllegalArgumentException | NullPointerException e) {
encoding = UTF_8;
}
// We tend to look at the input stream, rather than the reader.
try (InputStream in = request.getInputStream();
Reader reader = new InputStreamReader(in, encoding);
JsonInput jsonInput = json.newInput(reader)) {
Map<String, Object> read = jsonInput.read(MAP_TYPE);
return new CrossDomainRpc(
getField(read, Field.METHOD),
getField(read, Field.PATH),
getField(read, Field.DATA));
} catch (JsonException e) {
throw new IllegalArgumentException(
"Failed to parse JSON request: " + e.getMessage(), e);
}
} | [
"public",
"CrossDomainRpc",
"loadRpc",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"IOException",
"{",
"Charset",
"encoding",
";",
"try",
"{",
"String",
"enc",
"=",
"request",
".",
"getCharacterEncoding",
"(",
")",
";",
"encoding",
"=",
"Charset",
".",
... | Parses the request for a CrossDomainRpc.
@param request The request to parse.
@return The parsed RPC.
@throws IOException If an error occurs reading from the request.
@throws IllegalArgumentException If an occurs while parsing the request
data. | [
"Parses",
"the",
"request",
"for",
"a",
"CrossDomainRpc",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/xdrpc/CrossDomainRpcLoader.java#L52-L75 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/IdGenerator.java | IdGenerator.onSequenceGenerator | private Object onSequenceGenerator(EntityMetadata m, Client<?> client, IdDiscriptor keyValue, Object e)
{
Object seqgenerator = getAutoGenClazz(client);
if (seqgenerator instanceof SequenceGenerator)
{
Object generatedId = ((SequenceGenerator) seqgenerator).generate(
keyValue.getSequenceDiscriptor(), client, m.getIdAttribute().getJavaType().getSimpleName());
try
{
generatedId = PropertyAccessorHelper.fromSourceToTargetClass(m.getIdAttribute().getJavaType(),
generatedId.getClass(), generatedId);
PropertyAccessorHelper.setId(e, m, generatedId);
return generatedId;
}
catch (IllegalArgumentException iae)
{
log.error("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType());
throw new KunderaException("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType(),
iae);
}
}
throw new IllegalArgumentException(GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE
+ " Strategy not supported by this client :" + client.getClass().getName());
} | java | private Object onSequenceGenerator(EntityMetadata m, Client<?> client, IdDiscriptor keyValue, Object e)
{
Object seqgenerator = getAutoGenClazz(client);
if (seqgenerator instanceof SequenceGenerator)
{
Object generatedId = ((SequenceGenerator) seqgenerator).generate(
keyValue.getSequenceDiscriptor(), client, m.getIdAttribute().getJavaType().getSimpleName());
try
{
generatedId = PropertyAccessorHelper.fromSourceToTargetClass(m.getIdAttribute().getJavaType(),
generatedId.getClass(), generatedId);
PropertyAccessorHelper.setId(e, m, generatedId);
return generatedId;
}
catch (IllegalArgumentException iae)
{
log.error("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType());
throw new KunderaException("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType(),
iae);
}
}
throw new IllegalArgumentException(GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE
+ " Strategy not supported by this client :" + client.getClass().getName());
} | [
"private",
"Object",
"onSequenceGenerator",
"(",
"EntityMetadata",
"m",
",",
"Client",
"<",
"?",
">",
"client",
",",
"IdDiscriptor",
"keyValue",
",",
"Object",
"e",
")",
"{",
"Object",
"seqgenerator",
"=",
"getAutoGenClazz",
"(",
"client",
")",
";",
"if",
"(... | Generate Id when given sequence generation strategy.
@param m
@param client
@param keyValue
@param e | [
"Generate",
"Id",
"when",
"given",
"sequence",
"generation",
"strategy",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/IdGenerator.java#L170-L193 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.ensureProjectMember | private static void ensureProjectMember(ProjectMetadata project, User user) {
requireNonNull(project, "project");
requireNonNull(user, "user");
checkArgument(project.members().values().stream().anyMatch(member -> member.login().equals(user.id())),
user.id() + " is not a member of the project " + project.name());
} | java | private static void ensureProjectMember(ProjectMetadata project, User user) {
requireNonNull(project, "project");
requireNonNull(user, "user");
checkArgument(project.members().values().stream().anyMatch(member -> member.login().equals(user.id())),
user.id() + " is not a member of the project " + project.name());
} | [
"private",
"static",
"void",
"ensureProjectMember",
"(",
"ProjectMetadata",
"project",
",",
"User",
"user",
")",
"{",
"requireNonNull",
"(",
"project",
",",
"\"project\"",
")",
";",
"requireNonNull",
"(",
"user",
",",
"\"user\"",
")",
";",
"checkArgument",
"(",
... | Ensures that the specified {@code user} is a member of the specified {@code project}. | [
"Ensures",
"that",
"the",
"specified",
"{"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L860-L866 |
apache/incubator-atlas | webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java | EntityREST.addClassifications | @POST
@Path("/guid/{guid}/classifications")
@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
@Produces(Servlets.JSON_MEDIA_TYPE)
public void addClassifications(@PathParam("guid") final String guid, List<AtlasClassification> classifications) throws AtlasBaseException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.addClassifications(" + guid + ")");
}
if (StringUtils.isEmpty(guid)) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
}
entitiesStore.addClassifications(guid, classifications);
} finally {
AtlasPerfTracer.log(perf);
}
} | java | @POST
@Path("/guid/{guid}/classifications")
@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
@Produces(Servlets.JSON_MEDIA_TYPE)
public void addClassifications(@PathParam("guid") final String guid, List<AtlasClassification> classifications) throws AtlasBaseException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.addClassifications(" + guid + ")");
}
if (StringUtils.isEmpty(guid)) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
}
entitiesStore.addClassifications(guid, classifications);
} finally {
AtlasPerfTracer.log(perf);
}
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"/guid/{guid}/classifications\"",
")",
"@",
"Consumes",
"(",
"{",
"Servlets",
".",
"JSON_MEDIA_TYPE",
",",
"MediaType",
".",
"APPLICATION_JSON",
"}",
")",
"@",
"Produces",
"(",
"Servlets",
".",
"JSON_MEDIA_TYPE",
")",
"public",
... | Adds classifications to an existing entity represented by a guid.
@param guid globally unique identifier for the entity | [
"Adds",
"classifications",
"to",
"an",
"existing",
"entity",
"represented",
"by",
"a",
"guid",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java#L328-L348 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/process/ProcessCommunicatorImpl.java | ProcessCommunicatorImpl.extractGroupASDU | private static void extractGroupASDU(byte[] apdu, DPTXlator t)
{
if (apdu.length < 2)
throw new KNXIllegalArgumentException("minimum APDU length is 2 bytes");
t.setData(apdu, apdu.length == 2 ? 1 : 2);
} | java | private static void extractGroupASDU(byte[] apdu, DPTXlator t)
{
if (apdu.length < 2)
throw new KNXIllegalArgumentException("minimum APDU length is 2 bytes");
t.setData(apdu, apdu.length == 2 ? 1 : 2);
} | [
"private",
"static",
"void",
"extractGroupASDU",
"(",
"byte",
"[",
"]",
"apdu",
",",
"DPTXlator",
"t",
")",
"{",
"if",
"(",
"apdu",
".",
"length",
"<",
"2",
")",
"throw",
"new",
"KNXIllegalArgumentException",
"(",
"\"minimum APDU length is 2 bytes\"",
")",
";"... | Extracts the service data unit of an application layer protocol data unit into a
DPT translator.
<p>
The whole service data unit is taken as data for translation. If the length of the
supplied <code>apdu</code> is 2, a compact group APDU format layout is assumed.<br>
On return of this method, the supplied translator contains the DPT items from the
ASDU.
@param apdu application layer protocol data unit, 2 <= apdu.length
@param t the DPT translator to fill with the ASDU | [
"Extracts",
"the",
"service",
"data",
"unit",
"of",
"an",
"application",
"layer",
"protocol",
"data",
"unit",
"into",
"a",
"DPT",
"translator",
".",
"<p",
">",
"The",
"whole",
"service",
"data",
"unit",
"is",
"taken",
"as",
"data",
"for",
"translation",
".... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/process/ProcessCommunicatorImpl.java#L550-L555 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java | JobScheduler.scheduleJob | public void scheduleJob(Properties jobProps, JobListener jobListener)
throws JobException {
try {
scheduleJob(jobProps, jobListener, Maps.<String, Object>newHashMap(), GobblinJob.class);
} catch (JobException | RuntimeException exc) {
LOG.error("Could not schedule job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY, "Unknown job"), exc);
}
} | java | public void scheduleJob(Properties jobProps, JobListener jobListener)
throws JobException {
try {
scheduleJob(jobProps, jobListener, Maps.<String, Object>newHashMap(), GobblinJob.class);
} catch (JobException | RuntimeException exc) {
LOG.error("Could not schedule job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY, "Unknown job"), exc);
}
} | [
"public",
"void",
"scheduleJob",
"(",
"Properties",
"jobProps",
",",
"JobListener",
"jobListener",
")",
"throws",
"JobException",
"{",
"try",
"{",
"scheduleJob",
"(",
"jobProps",
",",
"jobListener",
",",
"Maps",
".",
"<",
"String",
",",
"Object",
">",
"newHash... | Schedule a job.
<p>
This method calls the Quartz scheduler to scheduler the job.
</p>
@param jobProps Job configuration properties
@param jobListener {@link JobListener} used for callback,
can be <em>null</em> if no callback is needed.
@throws JobException when there is anything wrong
with scheduling the job | [
"Schedule",
"a",
"job",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java#L236-L243 |
lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/ParseDateExtensions.java | ParseDateExtensions.parseToString | public static String parseToString(final String date, final String currentformat,
final String newFormat) throws ParseException
{
final Date currentDate = parseToDate(date, currentformat);
return parseToString(currentDate, newFormat);
} | java | public static String parseToString(final String date, final String currentformat,
final String newFormat) throws ParseException
{
final Date currentDate = parseToDate(date, currentformat);
return parseToString(currentDate, newFormat);
} | [
"public",
"static",
"String",
"parseToString",
"(",
"final",
"String",
"date",
",",
"final",
"String",
"currentformat",
",",
"final",
"String",
"newFormat",
")",
"throws",
"ParseException",
"{",
"final",
"Date",
"currentDate",
"=",
"parseToDate",
"(",
"date",
",... | The Method parseToString(String, String, String) formats the given Date as string from the
current Format to the new given Format. For Example:<br>
<br>
<code> String expected = "20120810";<br>
String actual = ParseDateUtils.parseToString(
ParseDateUtils.parseToDate("10.08.2012", "dd.MM.yyyy"), "yyyyMMdd");
</code><br>
<br>
The output is:20120810
@param date
The date as String object that shell be parsed to the new format
@param currentformat
The current format from the date
@param newFormat
The new format for the output date as String object
@return The formated String in the new date format
@throws ParseException
occurs when their are problems with parsing the String to Date. | [
"The",
"Method",
"parseToString",
"(",
"String",
"String",
"String",
")",
"formats",
"the",
"given",
"Date",
"as",
"string",
"from",
"the",
"current",
"Format",
"to",
"the",
"new",
"given",
"Format",
".",
"For",
"Example",
":",
"<br",
">",
"<br",
">",
"<... | train | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/ParseDateExtensions.java#L210-L215 |
awslabs/jsii | packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java | JsiiObject.jsiiSet | protected final void jsiiSet(final String property, @Nullable final Object value) {
engine.getClient().setPropertyValue(this.objRef, property, JsiiObjectMapper.valueToTree(value));
} | java | protected final void jsiiSet(final String property, @Nullable final Object value) {
engine.getClient().setPropertyValue(this.objRef, property, JsiiObjectMapper.valueToTree(value));
} | [
"protected",
"final",
"void",
"jsiiSet",
"(",
"final",
"String",
"property",
",",
"@",
"Nullable",
"final",
"Object",
"value",
")",
"{",
"engine",
".",
"getClient",
"(",
")",
".",
"setPropertyValue",
"(",
"this",
".",
"objRef",
",",
"property",
",",
"JsiiO... | Sets a property value of an object.
@param property The name of the property.
@param value The property value. | [
"Sets",
"a",
"property",
"value",
"of",
"an",
"object",
"."
] | train | https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L129-L131 |
voldemort/voldemort | src/java/voldemort/cluster/failuredetector/AbstractFailureDetector.java | AbstractFailureDetector.setAvailable | private boolean setAvailable(NodeStatus nodeStatus, boolean isAvailable) {
synchronized(nodeStatus) {
boolean previous = nodeStatus.isAvailable();
nodeStatus.setAvailable(isAvailable);
nodeStatus.setLastChecked(getConfig().getTime().getMilliseconds());
return previous;
}
} | java | private boolean setAvailable(NodeStatus nodeStatus, boolean isAvailable) {
synchronized(nodeStatus) {
boolean previous = nodeStatus.isAvailable();
nodeStatus.setAvailable(isAvailable);
nodeStatus.setLastChecked(getConfig().getTime().getMilliseconds());
return previous;
}
} | [
"private",
"boolean",
"setAvailable",
"(",
"NodeStatus",
"nodeStatus",
",",
"boolean",
"isAvailable",
")",
"{",
"synchronized",
"(",
"nodeStatus",
")",
"{",
"boolean",
"previous",
"=",
"nodeStatus",
".",
"isAvailable",
"(",
")",
";",
"nodeStatus",
".",
"setAvail... | We need to distinguish the case where we're newly available and the case
where we're already available. So we check the node status before we
update it and return it to the caller.
@param isAvailable True to set to available, false to make unavailable
@return Previous value of isAvailable | [
"We",
"need",
"to",
"distinguish",
"the",
"case",
"where",
"we",
"re",
"newly",
"available",
"and",
"the",
"case",
"where",
"we",
"re",
"already",
"available",
".",
"So",
"we",
"check",
"the",
"node",
"status",
"before",
"we",
"update",
"it",
"and",
"ret... | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/cluster/failuredetector/AbstractFailureDetector.java#L273-L282 |
undertow-io/undertow | core/src/main/java/io/undertow/util/DateUtils.java | DateUtils.handleIfUnmodifiedSince | public static boolean handleIfUnmodifiedSince(final HttpServerExchange exchange, final Date lastModified) {
return handleIfUnmodifiedSince(exchange.getRequestHeaders().getFirst(Headers.IF_UNMODIFIED_SINCE), lastModified);
} | java | public static boolean handleIfUnmodifiedSince(final HttpServerExchange exchange, final Date lastModified) {
return handleIfUnmodifiedSince(exchange.getRequestHeaders().getFirst(Headers.IF_UNMODIFIED_SINCE), lastModified);
} | [
"public",
"static",
"boolean",
"handleIfUnmodifiedSince",
"(",
"final",
"HttpServerExchange",
"exchange",
",",
"final",
"Date",
"lastModified",
")",
"{",
"return",
"handleIfUnmodifiedSince",
"(",
"exchange",
".",
"getRequestHeaders",
"(",
")",
".",
"getFirst",
"(",
... | Handles the if-unmodified-since header. returns true if the request should proceed, false otherwise
@param exchange the exchange
@param lastModified The last modified date
@return | [
"Handles",
"the",
"if",
"-",
"unmodified",
"-",
"since",
"header",
".",
"returns",
"true",
"if",
"the",
"request",
"should",
"proceed",
"false",
"otherwise"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/DateUtils.java#L212-L214 |
cdk/cdk | storage/io/src/main/java/org/openscience/cdk/io/cml/CMLErrorHandler.java | CMLErrorHandler.print | private void print(String level, SAXParseException exception) {
if (level.equals("warning")) {
logger.warn("** " + level + ": " + exception.getMessage());
logger.warn(" URI = " + exception.getSystemId());
logger.warn(" line = " + exception.getLineNumber());
} else {
logger.error("** " + level + ": " + exception.getMessage());
logger.error(" URI = " + exception.getSystemId());
logger.error(" line = " + exception.getLineNumber());
}
} | java | private void print(String level, SAXParseException exception) {
if (level.equals("warning")) {
logger.warn("** " + level + ": " + exception.getMessage());
logger.warn(" URI = " + exception.getSystemId());
logger.warn(" line = " + exception.getLineNumber());
} else {
logger.error("** " + level + ": " + exception.getMessage());
logger.error(" URI = " + exception.getSystemId());
logger.error(" line = " + exception.getLineNumber());
}
} | [
"private",
"void",
"print",
"(",
"String",
"level",
",",
"SAXParseException",
"exception",
")",
"{",
"if",
"(",
"level",
".",
"equals",
"(",
"\"warning\"",
")",
")",
"{",
"logger",
".",
"warn",
"(",
"\"** \"",
"+",
"level",
"+",
"\": \"",
"+",
"exception... | Internal procedure that outputs an SAXParseException with a significance level
to the cdk.tools.LoggingTool logger.
@param level significance level
@param exception Exception to output | [
"Internal",
"procedure",
"that",
"outputs",
"an",
"SAXParseException",
"with",
"a",
"significance",
"level",
"to",
"the",
"cdk",
".",
"tools",
".",
"LoggingTool",
"logger",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLErrorHandler.java#L63-L73 |
amzn/ion-java | src/com/amazon/ion/impl/IonBinary.java | IonBinary.unsignedLongToBigInteger | public static BigInteger unsignedLongToBigInteger(int signum, long val)
{
byte[] magnitude = {
(byte) ((val >> 56) & 0xFF),
(byte) ((val >> 48) & 0xFF),
(byte) ((val >> 40) & 0xFF),
(byte) ((val >> 32) & 0xFF),
(byte) ((val >> 24) & 0xFF),
(byte) ((val >> 16) & 0xFF),
(byte) ((val >> 8) & 0xFF),
(byte) (val & 0xFF),
};
return new BigInteger(signum, magnitude);
} | java | public static BigInteger unsignedLongToBigInteger(int signum, long val)
{
byte[] magnitude = {
(byte) ((val >> 56) & 0xFF),
(byte) ((val >> 48) & 0xFF),
(byte) ((val >> 40) & 0xFF),
(byte) ((val >> 32) & 0xFF),
(byte) ((val >> 24) & 0xFF),
(byte) ((val >> 16) & 0xFF),
(byte) ((val >> 8) & 0xFF),
(byte) (val & 0xFF),
};
return new BigInteger(signum, magnitude);
} | [
"public",
"static",
"BigInteger",
"unsignedLongToBigInteger",
"(",
"int",
"signum",
",",
"long",
"val",
")",
"{",
"byte",
"[",
"]",
"magnitude",
"=",
"{",
"(",
"byte",
")",
"(",
"(",
"val",
">>",
"56",
")",
"&",
"0xFF",
")",
",",
"(",
"byte",
")",
... | Utility method to convert an unsigned magnitude stored as a long to a {@link BigInteger}. | [
"Utility",
"method",
"to",
"convert",
"an",
"unsigned",
"magnitude",
"stored",
"as",
"a",
"long",
"to",
"a",
"{"
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonBinary.java#L897-L910 |
kennycason/kumo | kumo-core/src/main/java/com/kennycason/kumo/ParallelLayeredWordCloud.java | ParallelLayeredWordCloud.build | @Override
public void build(final int layer, final List<WordFrequency> wordFrequencies) {
final Future<?> completionFuture = executorservice.submit(() -> {
LOGGER.info("Starting to build WordCloud Layer {} in new Thread", layer);
super.build(layer, wordFrequencies);
});
executorFutures.add(completionFuture);
} | java | @Override
public void build(final int layer, final List<WordFrequency> wordFrequencies) {
final Future<?> completionFuture = executorservice.submit(() -> {
LOGGER.info("Starting to build WordCloud Layer {} in new Thread", layer);
super.build(layer, wordFrequencies);
});
executorFutures.add(completionFuture);
} | [
"@",
"Override",
"public",
"void",
"build",
"(",
"final",
"int",
"layer",
",",
"final",
"List",
"<",
"WordFrequency",
">",
"wordFrequencies",
")",
"{",
"final",
"Future",
"<",
"?",
">",
"completionFuture",
"=",
"executorservice",
".",
"submit",
"(",
"(",
"... | constructs the wordcloud specified by layer using the given
wordfrequencies.<br>
This is a non-blocking call.
@param layer
Wordcloud Layer
@param wordFrequencies
the WordFrequencies to use as input | [
"constructs",
"the",
"wordcloud",
"specified",
"by",
"layer",
"using",
"the",
"given",
"wordfrequencies",
".",
"<br",
">",
"This",
"is",
"a",
"non",
"-",
"blocking",
"call",
"."
] | train | https://github.com/kennycason/kumo/blob/bc577f468f162dbaf61c327a2d4f1989c61c57a0/kumo-core/src/main/java/com/kennycason/kumo/ParallelLayeredWordCloud.java#L40-L48 |
tango-controls/JTango | client/src/main/java/org/tango/client/database/Database.java | Database.setDeviceProperties | @Override
public void setDeviceProperties(final String deviceName, final Map<String, String[]> properties) throws DevFailed {
cache.setDeviceProperties(deviceName, properties);
} | java | @Override
public void setDeviceProperties(final String deviceName, final Map<String, String[]> properties) throws DevFailed {
cache.setDeviceProperties(deviceName, properties);
} | [
"@",
"Override",
"public",
"void",
"setDeviceProperties",
"(",
"final",
"String",
"deviceName",
",",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"properties",
")",
"throws",
"DevFailed",
"{",
"cache",
".",
"setDeviceProperties",
"(",
"deviceNa... | Set values of device properties. (execute DbPutDeviceProperty on DB device)
@param deviceName
The device name
@param properties
The properties names and their values
@throws DevFailed | [
"Set",
"values",
"of",
"device",
"properties",
".",
"(",
"execute",
"DbPutDeviceProperty",
"on",
"DB",
"device",
")"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/Database.java#L144-L147 |
weld/core | impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironmentFactory.java | BeanDeployerEnvironmentFactory.newConcurrentEnvironment | public static BeanDeployerEnvironment newConcurrentEnvironment(BeanManagerImpl manager) {
return new BeanDeployerEnvironment(Collections.newSetFromMap(new ConcurrentHashMap<SlimAnnotatedTypeContext<?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>()), SetMultimap.<Class<?>, AbstractClassBean<?>> newConcurrentSetMultimap(),
Collections.newSetFromMap(new ConcurrentHashMap<ProducerField<?, ?>, Boolean>()),
SetMultimap.<WeldMethodKey, ProducerMethod<?, ?>> newConcurrentSetMultimap(),
Collections.newSetFromMap(new ConcurrentHashMap<RIBean<?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<ObserverInitializationContext<?, ?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<DisposalMethod<?, ?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<DisposalMethod<?, ?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<DecoratorImpl<?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<InterceptorImpl<?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<Type, Boolean>()), manager);
} | java | public static BeanDeployerEnvironment newConcurrentEnvironment(BeanManagerImpl manager) {
return new BeanDeployerEnvironment(Collections.newSetFromMap(new ConcurrentHashMap<SlimAnnotatedTypeContext<?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>()), SetMultimap.<Class<?>, AbstractClassBean<?>> newConcurrentSetMultimap(),
Collections.newSetFromMap(new ConcurrentHashMap<ProducerField<?, ?>, Boolean>()),
SetMultimap.<WeldMethodKey, ProducerMethod<?, ?>> newConcurrentSetMultimap(),
Collections.newSetFromMap(new ConcurrentHashMap<RIBean<?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<ObserverInitializationContext<?, ?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<DisposalMethod<?, ?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<DisposalMethod<?, ?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<DecoratorImpl<?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<InterceptorImpl<?>, Boolean>()),
Collections.newSetFromMap(new ConcurrentHashMap<Type, Boolean>()), manager);
} | [
"public",
"static",
"BeanDeployerEnvironment",
"newConcurrentEnvironment",
"(",
"BeanManagerImpl",
"manager",
")",
"{",
"return",
"new",
"BeanDeployerEnvironment",
"(",
"Collections",
".",
"newSetFromMap",
"(",
"new",
"ConcurrentHashMap",
"<",
"SlimAnnotatedTypeContext",
"<... | Creates a new threadsafe BeanDeployerEnvironment instance. These instances are used by {@link ConcurrentBeanDeployer} during bootstrap. | [
"Creates",
"a",
"new",
"threadsafe",
"BeanDeployerEnvironment",
"instance",
".",
"These",
"instances",
"are",
"used",
"by",
"{"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironmentFactory.java#L47-L59 |
Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java | ChannelUpdateHandler.handleChannelCategory | private void handleChannelCategory(JsonNode jsonChannel) {
long channelCategoryId = jsonChannel.get("id").asLong();
api.getChannelCategoryById(channelCategoryId).map(ChannelCategoryImpl.class::cast).ifPresent(channel -> {
boolean oldNsfwFlag = channel.isNsfw();
boolean newNsfwFlag = jsonChannel.get("nsfw").asBoolean();
if (oldNsfwFlag != newNsfwFlag) {
channel.setNsfwFlag(newNsfwFlag);
ServerChannelChangeNsfwFlagEvent event =
new ServerChannelChangeNsfwFlagEventImpl(channel, newNsfwFlag, oldNsfwFlag);
api.getEventDispatcher().dispatchServerChannelChangeNsfwFlagEvent(
(DispatchQueueSelector) channel.getServer(), channel, channel.getServer(), null, event);
}
});
} | java | private void handleChannelCategory(JsonNode jsonChannel) {
long channelCategoryId = jsonChannel.get("id").asLong();
api.getChannelCategoryById(channelCategoryId).map(ChannelCategoryImpl.class::cast).ifPresent(channel -> {
boolean oldNsfwFlag = channel.isNsfw();
boolean newNsfwFlag = jsonChannel.get("nsfw").asBoolean();
if (oldNsfwFlag != newNsfwFlag) {
channel.setNsfwFlag(newNsfwFlag);
ServerChannelChangeNsfwFlagEvent event =
new ServerChannelChangeNsfwFlagEventImpl(channel, newNsfwFlag, oldNsfwFlag);
api.getEventDispatcher().dispatchServerChannelChangeNsfwFlagEvent(
(DispatchQueueSelector) channel.getServer(), channel, channel.getServer(), null, event);
}
});
} | [
"private",
"void",
"handleChannelCategory",
"(",
"JsonNode",
"jsonChannel",
")",
"{",
"long",
"channelCategoryId",
"=",
"jsonChannel",
".",
"get",
"(",
"\"id\"",
")",
".",
"asLong",
"(",
")",
";",
"api",
".",
"getChannelCategoryById",
"(",
"channelCategoryId",
"... | Handles a channel category update.
@param jsonChannel The channel data. | [
"Handles",
"a",
"channel",
"category",
"update",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java#L251-L265 |
mlhartme/mork | src/main/java/net/oneandone/mork/grammar/Ebnf.java | Ebnf.translate | public static Grammar translate(Rule[] rules, StringArrayList symbolTable) throws ActionException {
int i;
Ebnf builder;
Grammar tmp;
Grammar buffer;
int firstHelper;
int lastHelper;
firstHelper = symbolTable.size();
buffer = new Grammar(rules[0].getLeft(), symbolTable);
builder = new Ebnf(firstHelper);
for (i = 0; i < rules.length; i++) {
tmp = (Grammar) rules[i].getRight().visit(builder);
buffer.addProduction(new int[]{rules[i].getLeft(), tmp.getStart()});
buffer.addProductions(tmp);
buffer.expandSymbol(tmp.getStart());
buffer.removeProductions(tmp.getStart());
}
lastHelper = builder.getHelper() - 1;
buffer.removeDuplicateSymbols(firstHelper, lastHelper);
buffer.removeDuplicateRules();
buffer.packSymbols(firstHelper, lastHelper + 1);
return buffer;
} | java | public static Grammar translate(Rule[] rules, StringArrayList symbolTable) throws ActionException {
int i;
Ebnf builder;
Grammar tmp;
Grammar buffer;
int firstHelper;
int lastHelper;
firstHelper = symbolTable.size();
buffer = new Grammar(rules[0].getLeft(), symbolTable);
builder = new Ebnf(firstHelper);
for (i = 0; i < rules.length; i++) {
tmp = (Grammar) rules[i].getRight().visit(builder);
buffer.addProduction(new int[]{rules[i].getLeft(), tmp.getStart()});
buffer.addProductions(tmp);
buffer.expandSymbol(tmp.getStart());
buffer.removeProductions(tmp.getStart());
}
lastHelper = builder.getHelper() - 1;
buffer.removeDuplicateSymbols(firstHelper, lastHelper);
buffer.removeDuplicateRules();
buffer.packSymbols(firstHelper, lastHelper + 1);
return buffer;
} | [
"public",
"static",
"Grammar",
"translate",
"(",
"Rule",
"[",
"]",
"rules",
",",
"StringArrayList",
"symbolTable",
")",
"throws",
"ActionException",
"{",
"int",
"i",
";",
"Ebnf",
"builder",
";",
"Grammar",
"tmp",
";",
"Grammar",
"buffer",
";",
"int",
"firstH... | helper symbols are added without gaps, starting with freeHelper. | [
"helper",
"symbols",
"are",
"added",
"without",
"gaps",
"starting",
"with",
"freeHelper",
"."
] | train | https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/grammar/Ebnf.java#L30-L53 |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ClassSourceVisitor.java | ClassSourceVisitor.containsAnnotation | private boolean containsAnnotation(List<AnnotationExpr> annos, String annotationName) {
for (AnnotationExpr anno : annos) {
if (anno.getName().getName().equals(annotationName)) {
return true;
}
}
return false;
} | java | private boolean containsAnnotation(List<AnnotationExpr> annos, String annotationName) {
for (AnnotationExpr anno : annos) {
if (anno.getName().getName().equals(annotationName)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"containsAnnotation",
"(",
"List",
"<",
"AnnotationExpr",
">",
"annos",
",",
"String",
"annotationName",
")",
"{",
"for",
"(",
"AnnotationExpr",
"anno",
":",
"annos",
")",
"{",
"if",
"(",
"anno",
".",
"getName",
"(",
")",
".",
"getNam... | Check if the list of annotation contains the annotation of given name.
@param annos, the annotation list
@param annotationName, the annotation name
@return <code>true</code> if the annotation list contains the given annotation. | [
"Check",
"if",
"the",
"list",
"of",
"annotation",
"contains",
"the",
"annotation",
"of",
"given",
"name",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ClassSourceVisitor.java#L112-L119 |
h2oai/h2o-3 | h2o-core/src/main/java/water/KeySnapshot.java | KeySnapshot.localSnapshot | public static KeySnapshot localSnapshot(boolean homeOnly){
Object [] kvs = H2O.STORE.raw_array();
ArrayList<KeyInfo> res = new ArrayList<>();
for(int i = 2; i < kvs.length; i+= 2){
Object ok = kvs[i];
if( !(ok instanceof Key ) ) continue; // Ignore tombstones and Primes and null's
Key key = (Key )ok;
if(!key.user_allowed())continue;
if(homeOnly && !key.home())continue;
// Raw array can contain regular and also wrapped values into Prime marker class:
// - if we see Value object, create instance of KeyInfo
// - if we do not see Value object directly (it can be wrapped in Prime marker class),
// try to unwrap it via calling STORE.get (~H2O.get) and then
// look at wrapped value again.
Value val = Value.STORE_get(key);
if( val == null ) continue;
res.add(new KeyInfo(key,val));
}
final KeyInfo [] arr = res.toArray(new KeyInfo[res.size()]);
Arrays.sort(arr);
return new KeySnapshot(arr);
} | java | public static KeySnapshot localSnapshot(boolean homeOnly){
Object [] kvs = H2O.STORE.raw_array();
ArrayList<KeyInfo> res = new ArrayList<>();
for(int i = 2; i < kvs.length; i+= 2){
Object ok = kvs[i];
if( !(ok instanceof Key ) ) continue; // Ignore tombstones and Primes and null's
Key key = (Key )ok;
if(!key.user_allowed())continue;
if(homeOnly && !key.home())continue;
// Raw array can contain regular and also wrapped values into Prime marker class:
// - if we see Value object, create instance of KeyInfo
// - if we do not see Value object directly (it can be wrapped in Prime marker class),
// try to unwrap it via calling STORE.get (~H2O.get) and then
// look at wrapped value again.
Value val = Value.STORE_get(key);
if( val == null ) continue;
res.add(new KeyInfo(key,val));
}
final KeyInfo [] arr = res.toArray(new KeyInfo[res.size()]);
Arrays.sort(arr);
return new KeySnapshot(arr);
} | [
"public",
"static",
"KeySnapshot",
"localSnapshot",
"(",
"boolean",
"homeOnly",
")",
"{",
"Object",
"[",
"]",
"kvs",
"=",
"H2O",
".",
"STORE",
".",
"raw_array",
"(",
")",
";",
"ArrayList",
"<",
"KeyInfo",
">",
"res",
"=",
"new",
"ArrayList",
"<>",
"(",
... | Get the user keys from this node only.
@param homeOnly - exclude the non-local (cached) keys if set
@return KeySnapshot containing keys from the local K/V. | [
"Get",
"the",
"user",
"keys",
"from",
"this",
"node",
"only",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/KeySnapshot.java#L140-L161 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java | Apptentive.setPushNotificationIntegration | public static void setPushNotificationIntegration(final int pushProvider, final String token) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
// Store the push stuff globally
SharedPreferences prefs = ApptentiveInternal.getInstance().getGlobalSharedPrefs();
prefs.edit().putInt(Constants.PREF_KEY_PUSH_PROVIDER, pushProvider)
.putString(Constants.PREF_KEY_PUSH_TOKEN, token)
.apply();
// Also set it on the active Conversation, if there is one.
conversation.setPushIntegration(pushProvider, token);
return true;
}
}, "set push notification integration");
} | java | public static void setPushNotificationIntegration(final int pushProvider, final String token) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
// Store the push stuff globally
SharedPreferences prefs = ApptentiveInternal.getInstance().getGlobalSharedPrefs();
prefs.edit().putInt(Constants.PREF_KEY_PUSH_PROVIDER, pushProvider)
.putString(Constants.PREF_KEY_PUSH_TOKEN, token)
.apply();
// Also set it on the active Conversation, if there is one.
conversation.setPushIntegration(pushProvider, token);
return true;
}
}, "set push notification integration");
} | [
"public",
"static",
"void",
"setPushNotificationIntegration",
"(",
"final",
"int",
"pushProvider",
",",
"final",
"String",
"token",
")",
"{",
"dispatchConversationTask",
"(",
"new",
"ConversationDispatchTask",
"(",
")",
"{",
"@",
"Override",
"protected",
"boolean",
... | Sends push provider information to our server to allow us to send pushes to this device when
you reply to your customers. Only one push provider is allowed to be active at a time, so you
should only call this method once. Please see our
<a href="http://www.apptentive.com/docs/android/integration/#push-notifications">integration guide</a> for
instructions.
@param pushProvider One of the following:
<ul>
<li>{@link #PUSH_PROVIDER_APPTENTIVE}</li>
<li>{@link #PUSH_PROVIDER_PARSE}</li>
<li>{@link #PUSH_PROVIDER_URBAN_AIRSHIP}</li>
<li>{@link #PUSH_PROVIDER_AMAZON_AWS_SNS}</li>
</ul>
@param token The push provider token you receive from your push provider. The format is push provider specific.
<dl>
<dt>Apptentive</dt>
<dd>If you are using Apptentive to send pushes directly to GCM or FCM, pass in the GCM/FCM Registration ID, which you can
<a href="https://github.com/googlesamples/google-services/blob/73f8a4fcfc93da08a40b96df3537bb9b6ef1b0fa/android/gcm/app/src/main/java/gcm/play/android/samples/com/gcmquickstart/RegistrationIntentService.java#L51">access like this</a>.
</dd>
<dt>Parse</dt>
<dd>The Parse <a href="https://parse.com/docs/android/guide#push-notifications">deviceToken</a></dd>
<dt>Urban Airship</dt>
<dd>The Urban Airship Channel ID, which you can
<a href="https://github.com/urbanairship/android-samples/blob/8ad77e5e81a1b0507c6a2c45a5c30a1e2da851e9/PushSample/src/com/urbanairship/push/sample/IntentReceiver.java#L43">access like this</a>.
</dd>
<dt>Amazon AWS SNS</dt>
<dd>The GCM Registration ID, which you can <a href="http://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html#registration-id-gcm">access like this</a>.</dd>
</dl> | [
"Sends",
"push",
"provider",
"information",
"to",
"our",
"server",
"to",
"allow",
"us",
"to",
"send",
"pushes",
"to",
"this",
"device",
"when",
"you",
"reply",
"to",
"your",
"customers",
".",
"Only",
"one",
"push",
"provider",
"is",
"allowed",
"to",
"be",
... | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L469-L484 |
voldemort/voldemort | src/java/voldemort/store/StoreUtils.java | StoreUtils.assertValidNode | public static void assertValidNode(MetadataStore metadataStore, Integer nodeId) {
if(!metadataStore.getCluster().hasNodeWithId(nodeId)) {
throw new InvalidMetadataException("NodeId " + nodeId + " is not or no longer in this cluster");
}
} | java | public static void assertValidNode(MetadataStore metadataStore, Integer nodeId) {
if(!metadataStore.getCluster().hasNodeWithId(nodeId)) {
throw new InvalidMetadataException("NodeId " + nodeId + " is not or no longer in this cluster");
}
} | [
"public",
"static",
"void",
"assertValidNode",
"(",
"MetadataStore",
"metadataStore",
",",
"Integer",
"nodeId",
")",
"{",
"if",
"(",
"!",
"metadataStore",
".",
"getCluster",
"(",
")",
".",
"hasNodeWithId",
"(",
"nodeId",
")",
")",
"{",
"throw",
"new",
"Inval... | Check if the the nodeId is present in the cluster managed by the metadata store
or throw an exception.
@param nodeId The nodeId to check existence of | [
"Check",
"if",
"the",
"the",
"nodeId",
"is",
"present",
"in",
"the",
"cluster",
"managed",
"by",
"the",
"metadata",
"store",
"or",
"throw",
"an",
"exception",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L154-L158 |
wmdietl/jsr308-langtools | src/share/classes/javax/lang/model/util/SimpleTypeVisitor8.java | SimpleTypeVisitor8.visitIntersection | @Override
public R visitIntersection(IntersectionType t, P p){
return defaultAction(t, p);
} | java | @Override
public R visitIntersection(IntersectionType t, P p){
return defaultAction(t, p);
} | [
"@",
"Override",
"public",
"R",
"visitIntersection",
"(",
"IntersectionType",
"t",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"t",
",",
"p",
")",
";",
"}"
] | This implementation visits an {@code IntersectionType} by calling
{@code defaultAction}.
@param t {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"This",
"implementation",
"visits",
"an",
"{",
"@code",
"IntersectionType",
"}",
"by",
"calling",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/javax/lang/model/util/SimpleTypeVisitor8.java#L111-L114 |
westnordost/osmapi | src/main/java/de/westnordost/osmapi/traces/GpsTracesDao.java | GpsTracesDao.update | public void update(
long id, GpsTraceDetails.Visibility visibility, String description, List<String> tags)
{
checkFieldLength("Description", description);
checkTagsLength(tags);
GpsTraceWriter writer = new GpsTraceWriter(id, visibility, description, tags);
osm.makeAuthenticatedRequest(GPX + "/" + id, "PUT", writer);
} | java | public void update(
long id, GpsTraceDetails.Visibility visibility, String description, List<String> tags)
{
checkFieldLength("Description", description);
checkTagsLength(tags);
GpsTraceWriter writer = new GpsTraceWriter(id, visibility, description, tags);
osm.makeAuthenticatedRequest(GPX + "/" + id, "PUT", writer);
} | [
"public",
"void",
"update",
"(",
"long",
"id",
",",
"GpsTraceDetails",
".",
"Visibility",
"visibility",
",",
"String",
"description",
",",
"List",
"<",
"String",
">",
"tags",
")",
"{",
"checkFieldLength",
"(",
"\"Description\"",
",",
"description",
")",
";",
... | Change the visibility, description and tags of a GPS trace. description and tags may be null
if there should be none.
@throws OsmNotFoundException if the trace with the given id does not exist
@throws OsmAuthorizationException if this application is not authorized to write traces
(Permission.WRITE_GPS_TRACES)
OR if the trace in question is not the user's own trace
@throws IllegalArgumentException if the length of the description or any one single tag
is more than 256 characters | [
"Change",
"the",
"visibility",
"description",
"and",
"tags",
"of",
"a",
"GPS",
"trace",
".",
"description",
"and",
"tags",
"may",
"be",
"null",
"if",
"there",
"should",
"be",
"none",
"."
] | train | https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/traces/GpsTracesDao.java#L131-L140 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java | X509CertSelector.addSubjectAlternativeNameInternal | private void addSubjectAlternativeNameInternal(int type, Object name)
throws IOException {
// First, ensure that the name parses
GeneralNameInterface tempName = makeGeneralNameInterface(type, name);
if (subjectAlternativeNames == null) {
subjectAlternativeNames = new HashSet<List<?>>();
}
if (subjectAlternativeGeneralNames == null) {
subjectAlternativeGeneralNames = new HashSet<GeneralNameInterface>();
}
List<Object> list = new ArrayList<Object>(2);
list.add(Integer.valueOf(type));
list.add(name);
subjectAlternativeNames.add(list);
subjectAlternativeGeneralNames.add(tempName);
} | java | private void addSubjectAlternativeNameInternal(int type, Object name)
throws IOException {
// First, ensure that the name parses
GeneralNameInterface tempName = makeGeneralNameInterface(type, name);
if (subjectAlternativeNames == null) {
subjectAlternativeNames = new HashSet<List<?>>();
}
if (subjectAlternativeGeneralNames == null) {
subjectAlternativeGeneralNames = new HashSet<GeneralNameInterface>();
}
List<Object> list = new ArrayList<Object>(2);
list.add(Integer.valueOf(type));
list.add(name);
subjectAlternativeNames.add(list);
subjectAlternativeGeneralNames.add(tempName);
} | [
"private",
"void",
"addSubjectAlternativeNameInternal",
"(",
"int",
"type",
",",
"Object",
"name",
")",
"throws",
"IOException",
"{",
"// First, ensure that the name parses",
"GeneralNameInterface",
"tempName",
"=",
"makeGeneralNameInterface",
"(",
"type",
",",
"name",
")... | A private method that adds a name (String or byte array) to the
subjectAlternativeNames criterion. The {@code X509Certificate}
must contain the specified subjectAlternativeName.
@param type the name type (0-8, as specified in
RFC 3280, section 4.2.1.7)
@param name the name in string or byte array form
@throws IOException if a parsing error occurs | [
"A",
"private",
"method",
"that",
"adds",
"a",
"name",
"(",
"String",
"or",
"byte",
"array",
")",
"to",
"the",
"subjectAlternativeNames",
"criterion",
".",
"The",
"{",
"@code",
"X509Certificate",
"}",
"must",
"contain",
"the",
"specified",
"subjectAlternativeNam... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java#L814-L829 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/StringField.java | StringField.setString | public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
int iMaxLength = this.getMaxLength();
if (strString != null) if (strString.length() > iMaxLength)
strString = strString.substring(0, iMaxLength);
if (strString == null)
strString = Constants.BLANK; // To set a null internally, you must call setData directly
return this.setData(strString, bDisplayOption, iMoveMode);
} | java | public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
int iMaxLength = this.getMaxLength();
if (strString != null) if (strString.length() > iMaxLength)
strString = strString.substring(0, iMaxLength);
if (strString == null)
strString = Constants.BLANK; // To set a null internally, you must call setData directly
return this.setData(strString, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"setString",
"(",
"String",
"strString",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"// init this field override for other value",
"{",
"int",
"iMaxLength",
"=",
"this",
".",
"getMaxLength",
"(",
")",
";",
"if",
"(",
"strStrin... | Convert and move string to this field.
Data is already in string format, so just move it!
@param bState the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code. | [
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
".",
"Data",
"is",
"already",
"in",
"string",
"format",
"so",
"just",
"move",
"it!"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/StringField.java#L153-L161 |
finmath/finmath-lib | src/main/java6/net/finmath/montecarlo/assetderivativevaluation/products/AsianOption.java | AsianOption.getValue | @Override
public RandomVariableInterface getValue(double evaluationTime, AssetModelMonteCarloSimulationInterface model) throws CalculationException {
// Calculate average
RandomVariableInterface average = model.getRandomVariableForConstant(0.0);
for(double time : timesForAveraging) {
RandomVariableInterface underlying = model.getAssetValue(time, underlyingIndex);
average = average.add(underlying);
}
average = average.div(timesForAveraging.getNumberOfTimes());
// The payoff: values = max(underlying - strike, 0)
RandomVariableInterface values = average.sub(strike).floor(0.0);
// Discounting...
RandomVariableInterface numeraireAtMaturity = model.getNumeraire(maturity);
RandomVariableInterface monteCarloWeights = model.getMonteCarloWeights(maturity);
values = values.div(numeraireAtMaturity).mult(monteCarloWeights);
// ...to evaluation time.
RandomVariableInterface numeraireAtEvalTime = model.getNumeraire(evaluationTime);
RandomVariableInterface monteCarloProbabilitiesAtEvalTime = model.getMonteCarloWeights(evaluationTime);
values = values.mult(numeraireAtEvalTime).div(monteCarloProbabilitiesAtEvalTime);
return values;
} | java | @Override
public RandomVariableInterface getValue(double evaluationTime, AssetModelMonteCarloSimulationInterface model) throws CalculationException {
// Calculate average
RandomVariableInterface average = model.getRandomVariableForConstant(0.0);
for(double time : timesForAveraging) {
RandomVariableInterface underlying = model.getAssetValue(time, underlyingIndex);
average = average.add(underlying);
}
average = average.div(timesForAveraging.getNumberOfTimes());
// The payoff: values = max(underlying - strike, 0)
RandomVariableInterface values = average.sub(strike).floor(0.0);
// Discounting...
RandomVariableInterface numeraireAtMaturity = model.getNumeraire(maturity);
RandomVariableInterface monteCarloWeights = model.getMonteCarloWeights(maturity);
values = values.div(numeraireAtMaturity).mult(monteCarloWeights);
// ...to evaluation time.
RandomVariableInterface numeraireAtEvalTime = model.getNumeraire(evaluationTime);
RandomVariableInterface monteCarloProbabilitiesAtEvalTime = model.getMonteCarloWeights(evaluationTime);
values = values.mult(numeraireAtEvalTime).div(monteCarloProbabilitiesAtEvalTime);
return values;
} | [
"@",
"Override",
"public",
"RandomVariableInterface",
"getValue",
"(",
"double",
"evaluationTime",
",",
"AssetModelMonteCarloSimulationInterface",
"model",
")",
"throws",
"CalculationException",
"{",
"// Calculate average",
"RandomVariableInterface",
"average",
"=",
"model",
... | This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"This",
"method",
"returns",
"the",
"value",
"random",
"variable",
"of",
"the",
"product",
"within",
"the",
"specified",
"model",
"evaluated",
"at",
"a",
"given",
"evalutationTime",
".",
"Note",
":",
"For",
"a",
"lattice",
"this",
"is",
"often",
"the",
"valu... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/assetderivativevaluation/products/AsianOption.java#L76-L100 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.java | ShortTypeHandling.castToEnum | public static Enum castToEnum(Object object, Class<? extends Enum> type) {
if (object==null) return null;
if (type.isInstance(object)) return (Enum) object;
if (object instanceof String || object instanceof GString) {
return Enum.valueOf(type, object.toString());
}
throw new GroovyCastException(object, type);
} | java | public static Enum castToEnum(Object object, Class<? extends Enum> type) {
if (object==null) return null;
if (type.isInstance(object)) return (Enum) object;
if (object instanceof String || object instanceof GString) {
return Enum.valueOf(type, object.toString());
}
throw new GroovyCastException(object, type);
} | [
"public",
"static",
"Enum",
"castToEnum",
"(",
"Object",
"object",
",",
"Class",
"<",
"?",
"extends",
"Enum",
">",
"type",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"type",
".",
"isInstance",
"(",
"object",
"... | this class requires that the supplied enum is not fitting a
Collection case for casting | [
"this",
"class",
"requires",
"that",
"the",
"supplied",
"enum",
"is",
"not",
"fitting",
"a",
"Collection",
"case",
"for",
"casting"
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.java#L52-L59 |
RestComm/jss7 | m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UARouteManagement.java | M3UARouteManagement.removeRoute | protected void removeRoute(int dpc, int opc, int si, String asName) throws Exception {
AsImpl asImpl = null;
for (FastList.Node<As> n = this.m3uaManagement.appServers.head(), end = this.m3uaManagement.appServers.tail(); (n = n
.getNext()) != end;) {
if (n.getValue().getName().compareTo(asName) == 0) {
asImpl = (AsImpl) n.getValue();
break;
}
}
if (asImpl == null) {
throw new Exception(String.format(M3UAOAMMessages.NO_AS_FOUND, asName));
}
String key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(opc).append(KEY_SEPARATOR).append(si))
.toString();
RouteAsImpl asArray = route.get(key);
if (asArray == null) {
throw new Exception(String.format("No AS=%s configured for dpc=%d opc=%d si=%d", asImpl.getName(), dpc, opc, si));
}
asArray.removeRoute(dpc, opc, si, asImpl);
this.removeAsFromDPC(dpc, asImpl);
//Final check to remove RouteAs
if(!asArray.hasAs()){
route.remove(key);
}
this.m3uaManagement.store();
} | java | protected void removeRoute(int dpc, int opc, int si, String asName) throws Exception {
AsImpl asImpl = null;
for (FastList.Node<As> n = this.m3uaManagement.appServers.head(), end = this.m3uaManagement.appServers.tail(); (n = n
.getNext()) != end;) {
if (n.getValue().getName().compareTo(asName) == 0) {
asImpl = (AsImpl) n.getValue();
break;
}
}
if (asImpl == null) {
throw new Exception(String.format(M3UAOAMMessages.NO_AS_FOUND, asName));
}
String key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(opc).append(KEY_SEPARATOR).append(si))
.toString();
RouteAsImpl asArray = route.get(key);
if (asArray == null) {
throw new Exception(String.format("No AS=%s configured for dpc=%d opc=%d si=%d", asImpl.getName(), dpc, opc, si));
}
asArray.removeRoute(dpc, opc, si, asImpl);
this.removeAsFromDPC(dpc, asImpl);
//Final check to remove RouteAs
if(!asArray.hasAs()){
route.remove(key);
}
this.m3uaManagement.store();
} | [
"protected",
"void",
"removeRoute",
"(",
"int",
"dpc",
",",
"int",
"opc",
",",
"int",
"si",
",",
"String",
"asName",
")",
"throws",
"Exception",
"{",
"AsImpl",
"asImpl",
"=",
"null",
";",
"for",
"(",
"FastList",
".",
"Node",
"<",
"As",
">",
"n",
"=",... | Removes the {@link AsImpl} from key (combination of DPC:OPC:Si)
@param dpc
@param opc
@param si
@param asName
@throws Exception If no As found, or this As is not serving this key | [
"Removes",
"the",
"{",
"@link",
"AsImpl",
"}",
"from",
"key",
"(",
"combination",
"of",
"DPC",
":",
"OPC",
":",
"Si",
")"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UARouteManagement.java#L233-L265 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/BoundingBox.java | BoundingBox.fromCoordinates | @Deprecated
public static BoundingBox fromCoordinates(
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double west,
@FloatRange(from = MIN_LATITUDE, to = GeoJsonConstants.MAX_LATITUDE) double south,
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double east,
@FloatRange(from = MIN_LATITUDE, to = GeoJsonConstants.MAX_LATITUDE) double north) {
return fromLngLats(west, south, east, north);
} | java | @Deprecated
public static BoundingBox fromCoordinates(
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double west,
@FloatRange(from = MIN_LATITUDE, to = GeoJsonConstants.MAX_LATITUDE) double south,
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double east,
@FloatRange(from = MIN_LATITUDE, to = GeoJsonConstants.MAX_LATITUDE) double north) {
return fromLngLats(west, south, east, north);
} | [
"@",
"Deprecated",
"public",
"static",
"BoundingBox",
"fromCoordinates",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_LONGITUDE",
",",
"to",
"=",
"GeoJsonConstants",
".",
"MAX_LONGITUDE",
")",
"double",
"west",
",",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_... | Define a new instance of this class by passing in four coordinates in the same order they would
appear in the serialized GeoJson form. Limits are placed on the minimum and maximum coordinate
values which can exist and comply with the GeoJson spec.
@param west the left side of the bounding box when the map is facing due north
@param south the bottom side of the bounding box when the map is facing due north
@param east the right side of the bounding box when the map is facing due north
@param north the top side of the bounding box when the map is facing due north
@return a new instance of this class defined by the provided coordinates
@since 3.0.0
@deprecated As of 3.1.0, use {@link #fromLngLats} instead. | [
"Define",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"passing",
"in",
"four",
"coordinates",
"in",
"the",
"same",
"order",
"they",
"would",
"appear",
"in",
"the",
"serialized",
"GeoJson",
"form",
".",
"Limits",
"are",
"placed",
"on",
"the",
"mini... | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/BoundingBox.java#L83-L90 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/TemplatesApi.java | TemplatesApi.updateDocument | public EnvelopeDocument updateDocument(String accountId, String templateId, String documentId, EnvelopeDefinition envelopeDefinition) throws ApiException {
return updateDocument(accountId, templateId, documentId, envelopeDefinition, null);
} | java | public EnvelopeDocument updateDocument(String accountId, String templateId, String documentId, EnvelopeDefinition envelopeDefinition) throws ApiException {
return updateDocument(accountId, templateId, documentId, envelopeDefinition, null);
} | [
"public",
"EnvelopeDocument",
"updateDocument",
"(",
"String",
"accountId",
",",
"String",
"templateId",
",",
"String",
"documentId",
",",
"EnvelopeDefinition",
"envelopeDefinition",
")",
"throws",
"ApiException",
"{",
"return",
"updateDocument",
"(",
"accountId",
",",
... | Adds a document to a template document.
Adds the specified document to an existing template document.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@param documentId The ID of the document being accessed. (required)
@param envelopeDefinition (optional)
@return EnvelopeDocument | [
"Adds",
"a",
"document",
"to",
"a",
"template",
"document",
".",
"Adds",
"the",
"specified",
"document",
"to",
"an",
"existing",
"template",
"document",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L2954-L2956 |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRVerify.java | LRVerify.VerifyStrings | public static boolean VerifyStrings(String signature, String message, String publicKey) throws LRException
{
// Check that none of the inputs are null
if (signature == null || message == null || publicKey == null)
{
throw new LRException(LRException.NULL_FIELD);
}
// Convert all inputs into input streams
InputStream isSignature = null;
InputStream isMessage = null;
InputStream isPublicKey = null;
try
{
isSignature = new ByteArrayInputStream(signature.getBytes());
isMessage = new ByteArrayInputStream(message.getBytes());
isPublicKey = new ByteArrayInputStream(publicKey.getBytes());
}
catch (Exception e)
{
throw new LRException(LRException.INPUT_STREAM_FAILED);
}
// Feed the input streams into the primary verify function
return Verify(isSignature, isMessage, isPublicKey);
} | java | public static boolean VerifyStrings(String signature, String message, String publicKey) throws LRException
{
// Check that none of the inputs are null
if (signature == null || message == null || publicKey == null)
{
throw new LRException(LRException.NULL_FIELD);
}
// Convert all inputs into input streams
InputStream isSignature = null;
InputStream isMessage = null;
InputStream isPublicKey = null;
try
{
isSignature = new ByteArrayInputStream(signature.getBytes());
isMessage = new ByteArrayInputStream(message.getBytes());
isPublicKey = new ByteArrayInputStream(publicKey.getBytes());
}
catch (Exception e)
{
throw new LRException(LRException.INPUT_STREAM_FAILED);
}
// Feed the input streams into the primary verify function
return Verify(isSignature, isMessage, isPublicKey);
} | [
"public",
"static",
"boolean",
"VerifyStrings",
"(",
"String",
"signature",
",",
"String",
"message",
",",
"String",
"publicKey",
")",
"throws",
"LRException",
"{",
"// Check that none of the inputs are null",
"if",
"(",
"signature",
"==",
"null",
"||",
"message",
"... | Converts input strings to input streams for the main verify function
@param signature String of the signature
@param message String of the message
@param publicKey String of the public key
@return true if signing is verified, false if not
@throws LRException NULL_FIELD if any field is null, INPUT_STREAM_FAILED if any field cannot be converted to an input stream | [
"Converts",
"input",
"strings",
"to",
"input",
"streams",
"for",
"the",
"main",
"verify",
"function"
] | train | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRVerify.java#L69-L95 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/DevicesStatusApi.java | DevicesStatusApi.getDeviceStatusAsync | public com.squareup.okhttp.Call getDeviceStatusAsync(String deviceId, Boolean includeSnapshot, Boolean includeSnapshotTimestamp, final ApiCallback<DeviceStatus> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getDeviceStatusValidateBeforeCall(deviceId, includeSnapshot, includeSnapshotTimestamp, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<DeviceStatus>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call getDeviceStatusAsync(String deviceId, Boolean includeSnapshot, Boolean includeSnapshotTimestamp, final ApiCallback<DeviceStatus> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getDeviceStatusValidateBeforeCall(deviceId, includeSnapshot, includeSnapshotTimestamp, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<DeviceStatus>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"getDeviceStatusAsync",
"(",
"String",
"deviceId",
",",
"Boolean",
"includeSnapshot",
",",
"Boolean",
"includeSnapshotTimestamp",
",",
"final",
"ApiCallback",
"<",
"DeviceStatus",
">",
"callback",
")",
... | Get Device Status (asynchronously)
Get Device Status
@param deviceId Device ID. (required)
@param includeSnapshot Include device snapshot into the response (optional)
@param includeSnapshotTimestamp Include device snapshot timestamp into the response (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"Get",
"Device",
"Status",
"(",
"asynchronously",
")",
"Get",
"Device",
"Status"
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesStatusApi.java#L162-L187 |
h2oai/h2o-3 | h2o-algos/src/main/java/hex/tree/Score.java | Score.makeModelMetrics | private ModelMetrics makeModelMetrics(SharedTreeModel model, Frame fr, Frame adaptedFr, Frame preds) {
ModelMetrics mm;
if (model._output.nclasses() == 2 && _computeGainsLift) {
assert preds != null : "Predictions were pre-created";
mm = _mb.makeModelMetrics(model, fr, adaptedFr, preds);
} else {
boolean calculatePreds = preds == null && model._parms._distribution == DistributionFamily.huber;
// FIXME: PUBDEV-4992 we should avoid doing full scoring!
if (calculatePreds) {
Log.warn("Going to calculate predictions from scratch. This can be expensive for large models! See PUBDEV-4992");
preds = model.score(fr);
}
mm = _mb.makeModelMetrics(model, fr, null, preds);
if (calculatePreds && (preds != null))
preds.remove();
}
return mm;
} | java | private ModelMetrics makeModelMetrics(SharedTreeModel model, Frame fr, Frame adaptedFr, Frame preds) {
ModelMetrics mm;
if (model._output.nclasses() == 2 && _computeGainsLift) {
assert preds != null : "Predictions were pre-created";
mm = _mb.makeModelMetrics(model, fr, adaptedFr, preds);
} else {
boolean calculatePreds = preds == null && model._parms._distribution == DistributionFamily.huber;
// FIXME: PUBDEV-4992 we should avoid doing full scoring!
if (calculatePreds) {
Log.warn("Going to calculate predictions from scratch. This can be expensive for large models! See PUBDEV-4992");
preds = model.score(fr);
}
mm = _mb.makeModelMetrics(model, fr, null, preds);
if (calculatePreds && (preds != null))
preds.remove();
}
return mm;
} | [
"private",
"ModelMetrics",
"makeModelMetrics",
"(",
"SharedTreeModel",
"model",
",",
"Frame",
"fr",
",",
"Frame",
"adaptedFr",
",",
"Frame",
"preds",
")",
"{",
"ModelMetrics",
"mm",
";",
"if",
"(",
"model",
".",
"_output",
".",
"nclasses",
"(",
")",
"==",
... | Run after the doAll scoring to convert the MetricsBuilder to a ModelMetrics | [
"Run",
"after",
"the",
"doAll",
"scoring",
"to",
"convert",
"the",
"MetricsBuilder",
"to",
"a",
"ModelMetrics"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/tree/Score.java#L142-L159 |
metamx/extendedset | src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java | PairSet.indexOf | @Override
public int indexOf(Pair<T, I> element) {
return matrix.indexOf(
transactionToIndex(element.transaction),
itemToIndex(element.item));
} | java | @Override
public int indexOf(Pair<T, I> element) {
return matrix.indexOf(
transactionToIndex(element.transaction),
itemToIndex(element.item));
} | [
"@",
"Override",
"public",
"int",
"indexOf",
"(",
"Pair",
"<",
"T",
",",
"I",
">",
"element",
")",
"{",
"return",
"matrix",
".",
"indexOf",
"(",
"transactionToIndex",
"(",
"element",
".",
"transaction",
")",
",",
"itemToIndex",
"(",
"element",
".",
"item... | Provides position of element within the set.
<p>
It returns -1 if the element does not exist within the set.
@param element
element of the set
@return the element position | [
"Provides",
"position",
"of",
"element",
"within",
"the",
"set",
".",
"<p",
">",
"It",
"returns",
"-",
"1",
"if",
"the",
"element",
"does",
"not",
"exist",
"within",
"the",
"set",
"."
] | train | https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L779-L784 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/adwords/lib/utils/logging/ReportServiceLogger.java | ReportServiceLogger.appendMapAsString | private StringBuilder appendMapAsString(StringBuilder messageBuilder, Map<String, Object> map) {
for (Entry<String, Object> mapEntry : map.entrySet()) {
Object headerValue = mapEntry.getValue();
// Perform a case-insensitive check if the header should be scrubbed.
if (SCRUBBED_HEADERS.contains(mapEntry.getKey().toLowerCase())) {
headerValue = REDACTED_HEADER;
}
messageBuilder.append(String.format("%s: %s%n", mapEntry.getKey(), headerValue));
}
return messageBuilder;
} | java | private StringBuilder appendMapAsString(StringBuilder messageBuilder, Map<String, Object> map) {
for (Entry<String, Object> mapEntry : map.entrySet()) {
Object headerValue = mapEntry.getValue();
// Perform a case-insensitive check if the header should be scrubbed.
if (SCRUBBED_HEADERS.contains(mapEntry.getKey().toLowerCase())) {
headerValue = REDACTED_HEADER;
}
messageBuilder.append(String.format("%s: %s%n", mapEntry.getKey(), headerValue));
}
return messageBuilder;
} | [
"private",
"StringBuilder",
"appendMapAsString",
"(",
"StringBuilder",
"messageBuilder",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"Object",
">",
"mapEntry",
":",
"map",
".",
"entrySet",
"(",
"... | Converts the map of key/value pairs to a multi-line string (one line per key). Masks sensitive
information for a predefined set of header keys.
@param map a non-null Map
@return a non-null String | [
"Converts",
"the",
"map",
"of",
"key",
"/",
"value",
"pairs",
"to",
"a",
"multi",
"-",
"line",
"string",
"(",
"one",
"line",
"per",
"key",
")",
".",
"Masks",
"sensitive",
"information",
"for",
"a",
"predefined",
"set",
"of",
"header",
"keys",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/adwords/lib/utils/logging/ReportServiceLogger.java#L180-L190 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSetSpanner.java | UnicodeSetSpanner.replaceFrom | public String replaceFrom(CharSequence sequence, CharSequence replacement) {
return replaceFrom(sequence, replacement, CountMethod.MIN_ELEMENTS, SpanCondition.SIMPLE);
} | java | public String replaceFrom(CharSequence sequence, CharSequence replacement) {
return replaceFrom(sequence, replacement, CountMethod.MIN_ELEMENTS, SpanCondition.SIMPLE);
} | [
"public",
"String",
"replaceFrom",
"(",
"CharSequence",
"sequence",
",",
"CharSequence",
"replacement",
")",
"{",
"return",
"replaceFrom",
"(",
"sequence",
",",
"replacement",
",",
"CountMethod",
".",
"MIN_ELEMENTS",
",",
"SpanCondition",
".",
"SIMPLE",
")",
";",
... | Replace all matching spans in sequence by the replacement,
counting by CountMethod.MIN_ELEMENTS using SpanCondition.SIMPLE.
The code alternates spans; see the class doc for {@link UnicodeSetSpanner} for a note about boundary conditions.
@param sequence
charsequence to replace matching spans in.
@param replacement
replacement sequence. To delete, use ""
@return modified string. | [
"Replace",
"all",
"matching",
"spans",
"in",
"sequence",
"by",
"the",
"replacement",
"counting",
"by",
"CountMethod",
".",
"MIN_ELEMENTS",
"using",
"SpanCondition",
".",
"SIMPLE",
".",
"The",
"code",
"alternates",
"spans",
";",
"see",
"the",
"class",
"doc",
"f... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSetSpanner.java#L208-L210 |
icode/ameba | src/main/java/ameba/message/jackson/internal/JacksonUtils.java | JacksonUtils.configureGenerator | public static void configureGenerator(UriInfo uriInfo, JsonGenerator generator, boolean isDev) {
MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
String pretty = params.getFirst("pretty");
if ("false".equalsIgnoreCase(pretty)) {
generator.setPrettyPrinter(null);
} else if (pretty != null && !"false".equalsIgnoreCase(pretty) || isDev) {
generator.useDefaultPrettyPrinter();
}
String unicode = params.getFirst("unicode");
if (unicode != null && !"false".equalsIgnoreCase(unicode)) {
generator.enable(JsonGenerator.Feature.ESCAPE_NON_ASCII);
}
} | java | public static void configureGenerator(UriInfo uriInfo, JsonGenerator generator, boolean isDev) {
MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
String pretty = params.getFirst("pretty");
if ("false".equalsIgnoreCase(pretty)) {
generator.setPrettyPrinter(null);
} else if (pretty != null && !"false".equalsIgnoreCase(pretty) || isDev) {
generator.useDefaultPrettyPrinter();
}
String unicode = params.getFirst("unicode");
if (unicode != null && !"false".equalsIgnoreCase(unicode)) {
generator.enable(JsonGenerator.Feature.ESCAPE_NON_ASCII);
}
} | [
"public",
"static",
"void",
"configureGenerator",
"(",
"UriInfo",
"uriInfo",
",",
"JsonGenerator",
"generator",
",",
"boolean",
"isDev",
")",
"{",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"params",
"=",
"uriInfo",
".",
"getQueryParameters",
"(",
")",... | <p>configureGenerator.</p>
@param uriInfo a {@link javax.ws.rs.core.UriInfo} object.
@param generator a {@link com.fasterxml.jackson.core.JsonGenerator} object.
@param isDev a boolean. | [
"<p",
">",
"configureGenerator",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/message/jackson/internal/JacksonUtils.java#L116-L128 |
jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.getIntegerProperty | public Integer getIntegerProperty(String pstrSection, String pstrProp)
{
Integer intRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) intRet = new Integer(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return intRet;
} | java | public Integer getIntegerProperty(String pstrSection, String pstrProp)
{
Integer intRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) intRet = new Integer(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return intRet;
} | [
"public",
"Integer",
"getIntegerProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
")",
"{",
"Integer",
"intRet",
"=",
"null",
";",
"String",
"strVal",
"=",
"null",
";",
"INIProperty",
"objProp",
"=",
"null",
";",
"INISection",
"objSec",
"=",
... | Returns the specified integer property from the specified section.
@param pstrSection the INI section name.
@param pstrProp the property to be retrieved.
@return the integer property value. | [
"Returns",
"the",
"specified",
"integer",
"property",
"from",
"the",
"specified",
"section",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L180-L209 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagDecorate.java | CmsJspTagDecorate.decorateTagAction | public String decorateTagAction(String content, String configFile, String locale, ServletRequest req) {
try {
Locale loc = null;
CmsFlexController controller = CmsFlexController.getController(req);
if (CmsStringUtil.isEmpty(locale)) {
loc = controller.getCmsObject().getRequestContext().getLocale();
} else {
loc = CmsLocaleManager.getLocale(locale);
}
// read the decorator configurator class
CmsProperty decoratorClass = controller.getCmsObject().readPropertyObject(
configFile,
PROPERTY_CATEGORY,
false);
String decoratorClassName = decoratorClass.getValue();
if (CmsStringUtil.isEmpty(decoratorClassName)) {
decoratorClassName = DEFAULT_DECORATOR_CONFIGURATION;
}
String encoding = controller.getCmsObject().getRequestContext().getEncoding();
// use the correct decorator configurator and initialize it
I_CmsDecoratorConfiguration config = (I_CmsDecoratorConfiguration)Class.forName(
decoratorClassName).newInstance();
config.init(controller.getCmsObject(), configFile, loc);
CmsHtmlDecorator decorator = new CmsHtmlDecorator(controller.getCmsObject(), config);
decorator.setNoAutoCloseTags(m_noAutoCloseTags);
return decorator.doDecoration(content, encoding);
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "decoration"), e);
}
return content;
}
} | java | public String decorateTagAction(String content, String configFile, String locale, ServletRequest req) {
try {
Locale loc = null;
CmsFlexController controller = CmsFlexController.getController(req);
if (CmsStringUtil.isEmpty(locale)) {
loc = controller.getCmsObject().getRequestContext().getLocale();
} else {
loc = CmsLocaleManager.getLocale(locale);
}
// read the decorator configurator class
CmsProperty decoratorClass = controller.getCmsObject().readPropertyObject(
configFile,
PROPERTY_CATEGORY,
false);
String decoratorClassName = decoratorClass.getValue();
if (CmsStringUtil.isEmpty(decoratorClassName)) {
decoratorClassName = DEFAULT_DECORATOR_CONFIGURATION;
}
String encoding = controller.getCmsObject().getRequestContext().getEncoding();
// use the correct decorator configurator and initialize it
I_CmsDecoratorConfiguration config = (I_CmsDecoratorConfiguration)Class.forName(
decoratorClassName).newInstance();
config.init(controller.getCmsObject(), configFile, loc);
CmsHtmlDecorator decorator = new CmsHtmlDecorator(controller.getCmsObject(), config);
decorator.setNoAutoCloseTags(m_noAutoCloseTags);
return decorator.doDecoration(content, encoding);
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "decoration"), e);
}
return content;
}
} | [
"public",
"String",
"decorateTagAction",
"(",
"String",
"content",
",",
"String",
"configFile",
",",
"String",
"locale",
",",
"ServletRequest",
"req",
")",
"{",
"try",
"{",
"Locale",
"loc",
"=",
"null",
";",
"CmsFlexController",
"controller",
"=",
"CmsFlexContro... | Internal action method.<p>
DEcorates a HTMl content block.<p>
@param content the content to be decorated
@param configFile the config file
@param locale the locale to use for decoration or NOLOCALE if not locale should be used
@param req the current request
@return the decorated content | [
"Internal",
"action",
"method",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagDecorate.java#L92-L129 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/dispatcher/internal/HttpDispatcher.java | HttpDispatcher.isTrusted | public boolean isTrusted(String hostAddr, String headerName) {
if (!wcTrusted) {
return false;
}
if (HttpHeaderKeys.isSensitivePrivateHeader(headerName)) {
// if this is a sensitive private header, check trustedSensitiveHeaderOrigin values
return isTrustedForSensitiveHeaders(hostAddr);
}
if (!usePrivateHeaders) {
// trustedHeaderOrigin list is explicitly set to "none"
return isTrustedForSensitiveHeaders(hostAddr);
}
if (restrictPrivateHeaderOrigin == null) {
// trustedHeaderOrigin list is set to "*"
return true;
} else {
// check trustedHeaderOrigin for given host IP
boolean trustedOrigin = restrictPrivateHeaderOrigin.contains(hostAddr.toLowerCase());
if (!trustedOrigin) {
// if hostAddr is not in trustedHeaderOrigin, allow trustedSensitiveHeaderOrigin to override trust
trustedOrigin = isTrustedForSensitiveHeaders(hostAddr);
}
return trustedOrigin;
}
} | java | public boolean isTrusted(String hostAddr, String headerName) {
if (!wcTrusted) {
return false;
}
if (HttpHeaderKeys.isSensitivePrivateHeader(headerName)) {
// if this is a sensitive private header, check trustedSensitiveHeaderOrigin values
return isTrustedForSensitiveHeaders(hostAddr);
}
if (!usePrivateHeaders) {
// trustedHeaderOrigin list is explicitly set to "none"
return isTrustedForSensitiveHeaders(hostAddr);
}
if (restrictPrivateHeaderOrigin == null) {
// trustedHeaderOrigin list is set to "*"
return true;
} else {
// check trustedHeaderOrigin for given host IP
boolean trustedOrigin = restrictPrivateHeaderOrigin.contains(hostAddr.toLowerCase());
if (!trustedOrigin) {
// if hostAddr is not in trustedHeaderOrigin, allow trustedSensitiveHeaderOrigin to override trust
trustedOrigin = isTrustedForSensitiveHeaders(hostAddr);
}
return trustedOrigin;
}
} | [
"public",
"boolean",
"isTrusted",
"(",
"String",
"hostAddr",
",",
"String",
"headerName",
")",
"{",
"if",
"(",
"!",
"wcTrusted",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"HttpHeaderKeys",
".",
"isSensitivePrivateHeader",
"(",
"headerName",
")",
")",... | Check to see if the source host address is one we allow for specification of private headers
This takes into account the hosts defined in trustedHeaderOrigin and trustedSensitiveHeaderOrigin. Note,
trustedSensitiveHeaderOrigin takes precedence over trustedHeaderOrigin; so if trustedHeaderOrigin="none"
while trustedSensitiveHeaderOrigin="*", non-sensitive headers will still be trusted for all hosts.
@param hostAddr The source host address
@return true if hostAddr is a trusted source of private headers | [
"Check",
"to",
"see",
"if",
"the",
"source",
"host",
"address",
"is",
"one",
"we",
"allow",
"for",
"specification",
"of",
"private",
"headers"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/dispatcher/internal/HttpDispatcher.java#L442-L466 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | DOM2DTM.dispatchToEvents | public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch)
throws org.xml.sax.SAXException
{
TreeWalker treeWalker = m_walker;
ContentHandler prevCH = treeWalker.getContentHandler();
if(null != prevCH)
{
treeWalker = new TreeWalker(null);
}
treeWalker.setContentHandler(ch);
try
{
Node node = getNode(nodeHandle);
treeWalker.traverseFragment(node);
}
finally
{
treeWalker.setContentHandler(null);
}
} | java | public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch)
throws org.xml.sax.SAXException
{
TreeWalker treeWalker = m_walker;
ContentHandler prevCH = treeWalker.getContentHandler();
if(null != prevCH)
{
treeWalker = new TreeWalker(null);
}
treeWalker.setContentHandler(ch);
try
{
Node node = getNode(nodeHandle);
treeWalker.traverseFragment(node);
}
finally
{
treeWalker.setContentHandler(null);
}
} | [
"public",
"void",
"dispatchToEvents",
"(",
"int",
"nodeHandle",
",",
"org",
".",
"xml",
".",
"sax",
".",
"ContentHandler",
"ch",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"TreeWalker",
"treeWalker",
"=",
"m_walker",
";",
"Cont... | Directly create SAX parser events from a subtree.
@param nodeHandle The node ID.
@param ch A non-null reference to a ContentHandler.
@throws org.xml.sax.SAXException | [
"Directly",
"create",
"SAX",
"parser",
"events",
"from",
"a",
"subtree",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java#L1712-L1733 |
kiegroup/droolsjbpm-integration | kie-server-parent/kie-server-controller/kie-server-controller-client/src/main/java/org/kie/server/controller/client/KieServerControllerClientFactory.java | KieServerControllerClientFactory.newRestClient | public static KieServerControllerClient newRestClient(final String controllerUrl,
final String login,
final String password) {
return new RestKieServerControllerClient(controllerUrl,
login,
password);
} | java | public static KieServerControllerClient newRestClient(final String controllerUrl,
final String login,
final String password) {
return new RestKieServerControllerClient(controllerUrl,
login,
password);
} | [
"public",
"static",
"KieServerControllerClient",
"newRestClient",
"(",
"final",
"String",
"controllerUrl",
",",
"final",
"String",
"login",
",",
"final",
"String",
"password",
")",
"{",
"return",
"new",
"RestKieServerControllerClient",
"(",
"controllerUrl",
",",
"logi... | Creates a new Kie Controller Client using REST based service
@param controllerUrl the URL to the server (e.g.: "http://localhost:8080/kie-server-controller/rest/controller")
@param login user login
@param password user password
@return client instance | [
"Creates",
"a",
"new",
"Kie",
"Controller",
"Client",
"using",
"REST",
"based",
"service"
] | train | https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-controller/kie-server-controller-client/src/main/java/org/kie/server/controller/client/KieServerControllerClientFactory.java#L38-L44 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/reteoo/TraitObjectTypeNode.java | TraitObjectTypeNode.sameAndNotCoveredByDescendants | private boolean sameAndNotCoveredByDescendants( TraitProxy proxy, BitSet typeMask ) {
boolean isSameType = typeMask.equals( proxy._getTypeCode() );
if ( isSameType ) {
TraitTypeMap<String,Thing<?>,?> ttm = (TraitTypeMap<String,Thing<?>,?>) proxy.getObject()._getTraitMap();
Collection<Thing<?>> descs = ttm.lowerDescendants( typeMask );
// we have to exclude the "mock" bottom proxy
if ( descs == null || descs.isEmpty() ) {
return true;
} else {
for ( Thing sub : descs ) {
TraitType tt = (TraitType) sub;
if ( tt != proxy && tt._hasTypeCode( typeMask ) ) {
return false;
}
}
return true;
}
} else {
return false;
}
} | java | private boolean sameAndNotCoveredByDescendants( TraitProxy proxy, BitSet typeMask ) {
boolean isSameType = typeMask.equals( proxy._getTypeCode() );
if ( isSameType ) {
TraitTypeMap<String,Thing<?>,?> ttm = (TraitTypeMap<String,Thing<?>,?>) proxy.getObject()._getTraitMap();
Collection<Thing<?>> descs = ttm.lowerDescendants( typeMask );
// we have to exclude the "mock" bottom proxy
if ( descs == null || descs.isEmpty() ) {
return true;
} else {
for ( Thing sub : descs ) {
TraitType tt = (TraitType) sub;
if ( tt != proxy && tt._hasTypeCode( typeMask ) ) {
return false;
}
}
return true;
}
} else {
return false;
}
} | [
"private",
"boolean",
"sameAndNotCoveredByDescendants",
"(",
"TraitProxy",
"proxy",
",",
"BitSet",
"typeMask",
")",
"{",
"boolean",
"isSameType",
"=",
"typeMask",
".",
"equals",
"(",
"proxy",
".",
"_getTypeCode",
"(",
")",
")",
";",
"if",
"(",
"isSameType",
")... | Edge case: due to the way traits are encoded, consider this hierarchy:
A B
C
D
On don/insertion of C, C may be vetoed by its parents, but might have been
already covered by one of its descendants (D) | [
"Edge",
"case",
":",
"due",
"to",
"the",
"way",
"traits",
"are",
"encoded",
"consider",
"this",
"hierarchy",
":",
"A",
"B",
"C",
"D",
"On",
"don",
"/",
"insertion",
"of",
"C",
"C",
"may",
"be",
"vetoed",
"by",
"its",
"parents",
"but",
"might",
"have"... | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/reteoo/TraitObjectTypeNode.java#L98-L118 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplBoolean_CustomFieldSerializer.java | OWLLiteralImplBoolean_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplBoolean instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplBoolean instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLLiteralImplBoolean",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplBoolean_CustomFieldSerializer.java#L64-L67 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/util/Util.java | Util.uriEncode | public static String uriEncode(String value, boolean encodeSlash) {
try {
StringBuilder builder = new StringBuilder();
for (byte b : value.getBytes(AipClientConst.DEFAULT_ENCODING)) {
if (URI_UNRESERVED_CHARACTERS.get(b & 0xFF)) {
builder.append((char) b);
} else {
builder.append(PERCENT_ENCODED_STRINGS[b & 0xFF]);
}
}
String encodeString = builder.toString();
if (!encodeSlash) {
return encodeString.replace("%2F", "/");
}
return encodeString;
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} | java | public static String uriEncode(String value, boolean encodeSlash) {
try {
StringBuilder builder = new StringBuilder();
for (byte b : value.getBytes(AipClientConst.DEFAULT_ENCODING)) {
if (URI_UNRESERVED_CHARACTERS.get(b & 0xFF)) {
builder.append((char) b);
} else {
builder.append(PERCENT_ENCODED_STRINGS[b & 0xFF]);
}
}
String encodeString = builder.toString();
if (!encodeSlash) {
return encodeString.replace("%2F", "/");
}
return encodeString;
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"String",
"uriEncode",
"(",
"String",
"value",
",",
"boolean",
"encodeSlash",
")",
"{",
"try",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"byte",
"b",
":",
"value",
".",
"getBytes",
"(",
"... | Normalize a string for use in BCE web service APIs. The normalization algorithm is:
<ol>
<li>Convert the string into a UTF-8 byte array.</li>
<li>Encode all octets into percent-encoding, except all URI unreserved characters per the RFC 3986.</li>
</ol>
All letters used in the percent-encoding are in uppercase.
@param value the string to normalize.
@param encodeSlash if encode '/'
@return the normalized string. | [
"Normalize",
"a",
"string",
"for",
"use",
"in",
"BCE",
"web",
"service",
"APIs",
".",
"The",
"normalization",
"algorithm",
"is",
":",
"<ol",
">",
"<li",
">",
"Convert",
"the",
"string",
"into",
"a",
"UTF",
"-",
"8",
"byte",
"array",
".",
"<",
"/",
"l... | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/util/Util.java#L90-L108 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/ConverterUtil.java | ConverterUtil.strToInt | public static Integer strToInt(String _str, Integer _default) {
if (_str == null) {
return _default;
}
if (TypeUtil.isInteger(_str, true)) {
return Integer.valueOf(_str);
} else {
return _default;
}
} | java | public static Integer strToInt(String _str, Integer _default) {
if (_str == null) {
return _default;
}
if (TypeUtil.isInteger(_str, true)) {
return Integer.valueOf(_str);
} else {
return _default;
}
} | [
"public",
"static",
"Integer",
"strToInt",
"(",
"String",
"_str",
",",
"Integer",
"_default",
")",
"{",
"if",
"(",
"_str",
"==",
"null",
")",
"{",
"return",
"_default",
";",
"}",
"if",
"(",
"TypeUtil",
".",
"isInteger",
"(",
"_str",
",",
"true",
")",
... | Convert given String to Integer, returns _default if String is not an integer.
@param _str
@param _default
@return _str as Integer or _default value | [
"Convert",
"given",
"String",
"to",
"Integer",
"returns",
"_default",
"if",
"String",
"is",
"not",
"an",
"integer",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/ConverterUtil.java#L25-L34 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/kg/AipKnowledgeGraphic.java | AipKnowledgeGraphic.getTaskInfo | public JSONObject getTaskInfo(int id, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("id", id);
if (options != null) {
request.addBody(options);
}
request.setUri(KnowledgeGraphicConsts.TASK_INFO);
postOperation(request);
return requestServer(request);
} | java | public JSONObject getTaskInfo(int id, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("id", id);
if (options != null) {
request.addBody(options);
}
request.setUri(KnowledgeGraphicConsts.TASK_INFO);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"getTaskInfo",
"(",
"int",
"id",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"request",
".",
"... | 获取任务详情接口
根据任务id获取单个任务的详细信息
@param id - 任务ID
@param options - 可选参数对象,key: value都为string类型
options - options列表:
@return JSONObject | [
"获取任务详情接口",
"根据任务id获取单个任务的详细信息"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/kg/AipKnowledgeGraphic.java#L99-L110 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java | AbstractCasWebflowConfigurer.createStateModelBinding | public void createStateModelBinding(final TransitionableState state, final String modelName, final Class modelType) {
state.getAttributes().put("model", createExpression(modelName, modelType));
} | java | public void createStateModelBinding(final TransitionableState state, final String modelName, final Class modelType) {
state.getAttributes().put("model", createExpression(modelName, modelType));
} | [
"public",
"void",
"createStateModelBinding",
"(",
"final",
"TransitionableState",
"state",
",",
"final",
"String",
"modelName",
",",
"final",
"Class",
"modelType",
")",
"{",
"state",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"\"model\"",
",",
"createExpre... | Create state model binding.
@param state the state
@param modelName the model name
@param modelType the model type | [
"Create",
"state",
"model",
"binding",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L620-L622 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Signature.java | Signature.replaceArg | public Signature replaceArg(String oldName, String newName, Class<?> newType) {
int offset = argOffset(oldName);
String[] newArgNames = argNames;
if (!oldName.equals(newName)) {
newArgNames = Arrays.copyOf(argNames, argNames.length);
newArgNames[offset] = newName;
}
Class<?> oldType = methodType.parameterType(offset);
MethodType newMethodType = methodType;
if (!oldType.equals(newType)) newMethodType = methodType.changeParameterType(offset, newType);
return new Signature(newMethodType, newArgNames);
} | java | public Signature replaceArg(String oldName, String newName, Class<?> newType) {
int offset = argOffset(oldName);
String[] newArgNames = argNames;
if (!oldName.equals(newName)) {
newArgNames = Arrays.copyOf(argNames, argNames.length);
newArgNames[offset] = newName;
}
Class<?> oldType = methodType.parameterType(offset);
MethodType newMethodType = methodType;
if (!oldType.equals(newType)) newMethodType = methodType.changeParameterType(offset, newType);
return new Signature(newMethodType, newArgNames);
} | [
"public",
"Signature",
"replaceArg",
"(",
"String",
"oldName",
",",
"String",
"newName",
",",
"Class",
"<",
"?",
">",
"newType",
")",
"{",
"int",
"offset",
"=",
"argOffset",
"(",
"oldName",
")",
";",
"String",
"[",
"]",
"newArgNames",
"=",
"argNames",
";... | Replace the named argument with a new name and type.
@param oldName the old name of the argument
@param newName the new name of the argument; can be the same as old
@param newType the new type of the argument; can be the same as old
@return a new signature with the modified argument | [
"Replace",
"the",
"named",
"argument",
"with",
"a",
"new",
"name",
"and",
"type",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L397-L412 |
authorjapps/zerocode | core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java | BasicHttpClient.createFileUploadRequestBuilder | public RequestBuilder createFileUploadRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) throws IOException {
Map<String, Object> fileFieldNameValueMap = getFileFieldNameValue(reqBodyAsString);
List<String> fileFieldsList = (List<String>) fileFieldNameValueMap.get(FILES_FIELD);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
/*
* Allow fileFieldsList to be null.
* fileFieldsList can be null if multipart/form-data is sent without any files
* Refer Issue #168 - Raised and fixed by santhoshTpixler
*/
if(fileFieldsList != null) {
buildAllFilesToUpload(fileFieldsList, multipartEntityBuilder);
}
buildOtherRequestParams(fileFieldNameValueMap, multipartEntityBuilder);
buildMultiPartBoundary(fileFieldNameValueMap, multipartEntityBuilder);
return createUploadRequestBuilder(httpUrl, methodName, multipartEntityBuilder);
} | java | public RequestBuilder createFileUploadRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) throws IOException {
Map<String, Object> fileFieldNameValueMap = getFileFieldNameValue(reqBodyAsString);
List<String> fileFieldsList = (List<String>) fileFieldNameValueMap.get(FILES_FIELD);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
/*
* Allow fileFieldsList to be null.
* fileFieldsList can be null if multipart/form-data is sent without any files
* Refer Issue #168 - Raised and fixed by santhoshTpixler
*/
if(fileFieldsList != null) {
buildAllFilesToUpload(fileFieldsList, multipartEntityBuilder);
}
buildOtherRequestParams(fileFieldNameValueMap, multipartEntityBuilder);
buildMultiPartBoundary(fileFieldNameValueMap, multipartEntityBuilder);
return createUploadRequestBuilder(httpUrl, methodName, multipartEntityBuilder);
} | [
"public",
"RequestBuilder",
"createFileUploadRequestBuilder",
"(",
"String",
"httpUrl",
",",
"String",
"methodName",
",",
"String",
"reqBodyAsString",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"fileFieldNameValueMap",
"=",
"getFileFi... | This is the http request builder for file uploads, using Apache Http Client. In case you want to build
or prepare the requests differently, you can override this method.
Note-
With file uploads you can send more headers too from the testcase to the server, except "Content-Type" because
this is reserved for "multipart/form-data" which the client sends to server during the file uploads. You can
also send more request-params and "boundary" from the test cases if needed. The boundary defaults to an unique
string of local-date-time-stamp if not provided in the request.
You can override this method via @UseHttpClient(YourCustomHttpClient.class)
@param httpUrl
@param methodName
@param reqBodyAsString
@return
@throws IOException | [
"This",
"is",
"the",
"http",
"request",
"builder",
"for",
"file",
"uploads",
"using",
"Apache",
"Http",
"Client",
".",
"In",
"case",
"you",
"want",
"to",
"build",
"or",
"prepare",
"the",
"requests",
"differently",
"you",
"can",
"override",
"this",
"method",
... | train | https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java#L340-L361 |
EdwardRaff/JSAT | JSAT/src/jsat/utils/IntSortedSet.java | IntSortedSet.batch_insert | private void batch_insert(Collection<Integer> set, boolean parallel)
{
for(int i : set)
store[size++] = i;
if(parallel)
Arrays.parallelSort(store, 0, size);
else
Arrays.sort(store, 0, size);
} | java | private void batch_insert(Collection<Integer> set, boolean parallel)
{
for(int i : set)
store[size++] = i;
if(parallel)
Arrays.parallelSort(store, 0, size);
else
Arrays.sort(store, 0, size);
} | [
"private",
"void",
"batch_insert",
"(",
"Collection",
"<",
"Integer",
">",
"set",
",",
"boolean",
"parallel",
")",
"{",
"for",
"(",
"int",
"i",
":",
"set",
")",
"store",
"[",
"size",
"++",
"]",
"=",
"i",
";",
"if",
"(",
"parallel",
")",
"Arrays",
"... | more efficient insertion of many items by placing them all into the
backing store, and then doing one large sort.
@param set
@param parallel | [
"more",
"efficient",
"insertion",
"of",
"many",
"items",
"by",
"placing",
"them",
"all",
"into",
"the",
"backing",
"store",
"and",
"then",
"doing",
"one",
"large",
"sort",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntSortedSet.java#L71-L79 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/dynamic/RedisCommandFactory.java | RedisCommandFactory.getCommands | public <T extends Commands> T getCommands(Class<T> commandInterface) {
LettuceAssert.notNull(commandInterface, "Redis Command Interface must not be null");
RedisCommandsMetadata metadata = new DefaultRedisCommandsMetadata(commandInterface);
InvocationProxyFactory factory = new InvocationProxyFactory();
factory.addInterface(commandInterface);
BatchAwareCommandLookupStrategy lookupStrategy = new BatchAwareCommandLookupStrategy(
new CompositeCommandLookupStrategy(), metadata);
factory.addInterceptor(new DefaultMethodInvokingInterceptor());
factory.addInterceptor(new CommandFactoryExecutorMethodInterceptor(metadata, lookupStrategy));
return factory.createProxy(commandInterface.getClassLoader());
} | java | public <T extends Commands> T getCommands(Class<T> commandInterface) {
LettuceAssert.notNull(commandInterface, "Redis Command Interface must not be null");
RedisCommandsMetadata metadata = new DefaultRedisCommandsMetadata(commandInterface);
InvocationProxyFactory factory = new InvocationProxyFactory();
factory.addInterface(commandInterface);
BatchAwareCommandLookupStrategy lookupStrategy = new BatchAwareCommandLookupStrategy(
new CompositeCommandLookupStrategy(), metadata);
factory.addInterceptor(new DefaultMethodInvokingInterceptor());
factory.addInterceptor(new CommandFactoryExecutorMethodInterceptor(metadata, lookupStrategy));
return factory.createProxy(commandInterface.getClassLoader());
} | [
"public",
"<",
"T",
"extends",
"Commands",
">",
"T",
"getCommands",
"(",
"Class",
"<",
"T",
">",
"commandInterface",
")",
"{",
"LettuceAssert",
".",
"notNull",
"(",
"commandInterface",
",",
"\"Redis Command Interface must not be null\"",
")",
";",
"RedisCommandsMeta... | Returns a Redis Commands interface instance for the given interface.
@param commandInterface must not be {@literal null}.
@param <T> command interface type.
@return the implemented Redis Commands interface. | [
"Returns",
"a",
"Redis",
"Commands",
"interface",
"instance",
"for",
"the",
"given",
"interface",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/RedisCommandFactory.java#L179-L195 |
biojava/biojava | biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java | ChromosomeMappingTools.getCDSExonRanges | public static List<Range<Integer>> getCDSExonRanges(GeneChromosomePosition chromPos){
if ( chromPos.getOrientation() == '+')
return getCDSExonRangesForward(chromPos,CDS);
return getCDSExonRangesReverse(chromPos,CDS);
} | java | public static List<Range<Integer>> getCDSExonRanges(GeneChromosomePosition chromPos){
if ( chromPos.getOrientation() == '+')
return getCDSExonRangesForward(chromPos,CDS);
return getCDSExonRangesReverse(chromPos,CDS);
} | [
"public",
"static",
"List",
"<",
"Range",
"<",
"Integer",
">",
">",
"getCDSExonRanges",
"(",
"GeneChromosomePosition",
"chromPos",
")",
"{",
"if",
"(",
"chromPos",
".",
"getOrientation",
"(",
")",
"==",
"'",
"'",
")",
"return",
"getCDSExonRangesForward",
"(",
... | Extracts the exon boundaries in CDS coordinates. (needs to be divided by 3 to get AA positions)
@param chromPos
@return | [
"Extracts",
"the",
"exon",
"boundaries",
"in",
"CDS",
"coordinates",
".",
"(",
"needs",
"to",
"be",
"divided",
"by",
"3",
"to",
"get",
"AA",
"positions",
")"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L577-L581 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.toFile | public static void toFile(String templateFileName, VelocityContext context, String destPath) {
assertInit();
toFile(Velocity.getTemplate(templateFileName), context, destPath);
} | java | public static void toFile(String templateFileName, VelocityContext context, String destPath) {
assertInit();
toFile(Velocity.getTemplate(templateFileName), context, destPath);
} | [
"public",
"static",
"void",
"toFile",
"(",
"String",
"templateFileName",
",",
"VelocityContext",
"context",
",",
"String",
"destPath",
")",
"{",
"assertInit",
"(",
")",
";",
"toFile",
"(",
"Velocity",
".",
"getTemplate",
"(",
"templateFileName",
")",
",",
"con... | 生成文件,使用默认引擎
@param templateFileName 模板文件名
@param context 模板上下文
@param destPath 目标路径(绝对) | [
"生成文件,使用默认引擎"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L152-L156 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java | JaxWsUtils.getPortQName | private static QName getPortQName(ClassInfo classInfo, String namespace, String wsName, String wsPortName, String suffix) {
String portName;
if (wsPortName != null && !wsPortName.isEmpty()) {
portName = wsPortName.trim();
} else {
if (wsName != null && !wsName.isEmpty()) {
portName = wsName.trim();
} else {
String qualifiedName = classInfo.getQualifiedName();
int lastDotIndex = qualifiedName.lastIndexOf(".");
portName = (lastDotIndex == -1 ? qualifiedName : qualifiedName.substring(lastDotIndex + 1));
}
portName = portName + suffix;
}
return new QName(namespace, portName);
} | java | private static QName getPortQName(ClassInfo classInfo, String namespace, String wsName, String wsPortName, String suffix) {
String portName;
if (wsPortName != null && !wsPortName.isEmpty()) {
portName = wsPortName.trim();
} else {
if (wsName != null && !wsName.isEmpty()) {
portName = wsName.trim();
} else {
String qualifiedName = classInfo.getQualifiedName();
int lastDotIndex = qualifiedName.lastIndexOf(".");
portName = (lastDotIndex == -1 ? qualifiedName : qualifiedName.substring(lastDotIndex + 1));
}
portName = portName + suffix;
}
return new QName(namespace, portName);
} | [
"private",
"static",
"QName",
"getPortQName",
"(",
"ClassInfo",
"classInfo",
",",
"String",
"namespace",
",",
"String",
"wsName",
",",
"String",
"wsPortName",
",",
"String",
"suffix",
")",
"{",
"String",
"portName",
";",
"if",
"(",
"wsPortName",
"!=",
"null",
... | Get portName.
1.declared portName in web service annotation
2.name in web service annotation + Port
3.service class name + Port.
From specification:
The portName element of the WebService annotation, if present, MUST be used to derive the port name to use in WSDL.
In the absence of a portName element, an implementation MUST use the value of the name element of the WebService annotation, if present, suffixed with “Port”.
Otherwise, an implementation MUST use the simple name of the class annotated with WebService suffixed with “Port”.
@param classInfo
@param namespace
@param wsPortName
@param suffix
@return | [
"Get",
"portName",
".",
"1",
".",
"declared",
"portName",
"in",
"web",
"service",
"annotation",
"2",
".",
"name",
"in",
"web",
"service",
"annotation",
"+",
"Port",
"3",
".",
"service",
"class",
"name",
"+",
"Port",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java#L407-L422 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.intersectRaySphere | public static boolean intersectRaySphere(Rayf ray, Spheref sphere, Vector2f result) {
return intersectRaySphere(ray.oX, ray.oY, ray.oZ, ray.dX, ray.dY, ray.dZ, sphere.x, sphere.y, sphere.z, sphere.r*sphere.r, result);
} | java | public static boolean intersectRaySphere(Rayf ray, Spheref sphere, Vector2f result) {
return intersectRaySphere(ray.oX, ray.oY, ray.oZ, ray.dX, ray.dY, ray.dZ, sphere.x, sphere.y, sphere.z, sphere.r*sphere.r, result);
} | [
"public",
"static",
"boolean",
"intersectRaySphere",
"(",
"Rayf",
"ray",
",",
"Spheref",
"sphere",
",",
"Vector2f",
"result",
")",
"{",
"return",
"intersectRaySphere",
"(",
"ray",
".",
"oX",
",",
"ray",
".",
"oY",
",",
"ray",
".",
"oZ",
",",
"ray",
".",
... | Test whether the given ray intersects the given sphere,
and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near
and far) of intersections into the given <code>result</code> vector.
<p>
This method returns <code>true</code> for a ray whose origin lies inside the sphere.
<p>
Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>
@param ray
the ray
@param sphere
the sphere
@param result
a vector that will contain the values of the parameter <i>t</i> in the ray equation
<i>p(t) = origin + t * dir</i> for both points (near, far) of intersections with the sphere
@return <code>true</code> if the ray intersects the sphere; <code>false</code> otherwise | [
"Test",
"whether",
"the",
"given",
"ray",
"intersects",
"the",
"given",
"sphere",
"and",
"store",
"the",
"values",
"of",
"the",
"parameter",
"<i",
">",
"t<",
"/",
"i",
">",
"in",
"the",
"ray",
"equation",
"<i",
">",
"p",
"(",
"t",
")",
"=",
"origin",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L2134-L2136 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_exchangeLite_options_isEmailAvailable_GET | public Boolean packName_exchangeLite_options_isEmailAvailable_GET(String packName, String email) throws IOException {
String qPath = "/pack/xdsl/{packName}/exchangeLite/options/isEmailAvailable";
StringBuilder sb = path(qPath, packName);
query(sb, "email", email);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, Boolean.class);
} | java | public Boolean packName_exchangeLite_options_isEmailAvailable_GET(String packName, String email) throws IOException {
String qPath = "/pack/xdsl/{packName}/exchangeLite/options/isEmailAvailable";
StringBuilder sb = path(qPath, packName);
query(sb, "email", email);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, Boolean.class);
} | [
"public",
"Boolean",
"packName_exchangeLite_options_isEmailAvailable_GET",
"(",
"String",
"packName",
",",
"String",
"email",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/exchangeLite/options/isEmailAvailable\"",
";",
"StringBuilder",
"sb"... | Check if the email address is available for service creation
REST: GET /pack/xdsl/{packName}/exchangeLite/options/isEmailAvailable
@param email [required] Email
@param packName [required] The internal name of your pack | [
"Check",
"if",
"the",
"email",
"address",
"is",
"available",
"for",
"service",
"creation"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L604-L610 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | FSDirectory.getFullPathName | private static String getFullPathName(INode[] inodes, int pos) {
StringBuilder fullPathName = new StringBuilder();
for (int i=1; i<=pos; i++) {
fullPathName.append(Path.SEPARATOR_CHAR).append(inodes[i].getLocalName());
}
return fullPathName.toString();
} | java | private static String getFullPathName(INode[] inodes, int pos) {
StringBuilder fullPathName = new StringBuilder();
for (int i=1; i<=pos; i++) {
fullPathName.append(Path.SEPARATOR_CHAR).append(inodes[i].getLocalName());
}
return fullPathName.toString();
} | [
"private",
"static",
"String",
"getFullPathName",
"(",
"INode",
"[",
"]",
"inodes",
",",
"int",
"pos",
")",
"{",
"StringBuilder",
"fullPathName",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"pos",
";",
... | Return the name of the path represented by inodes at [0, pos] | [
"Return",
"the",
"name",
"of",
"the",
"path",
"represented",
"by",
"inodes",
"at",
"[",
"0",
"pos",
"]"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2184-L2190 |
TrueNight/Utils | safe-typeface/src/main/java/xyz/truenight/safetypeface/SafeTypeface.java | SafeTypeface.createFromAsset | public static Typeface createFromAsset(AssetManager mgr, String path) {
Typeface typeface = TYPEFACES.get(path);
if (typeface != null) {
return typeface;
} else {
typeface = Typeface.createFromAsset(mgr, path);
TYPEFACES.put(path, typeface);
return typeface;
}
} | java | public static Typeface createFromAsset(AssetManager mgr, String path) {
Typeface typeface = TYPEFACES.get(path);
if (typeface != null) {
return typeface;
} else {
typeface = Typeface.createFromAsset(mgr, path);
TYPEFACES.put(path, typeface);
return typeface;
}
} | [
"public",
"static",
"Typeface",
"createFromAsset",
"(",
"AssetManager",
"mgr",
",",
"String",
"path",
")",
"{",
"Typeface",
"typeface",
"=",
"TYPEFACES",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"typeface",
"!=",
"null",
")",
"{",
"return",
"typeface"... | Create a new typeface from the specified font data.
@param mgr The application's asset manager
@param path The file name of the font data in the assets directory
@return The new typeface. | [
"Create",
"a",
"new",
"typeface",
"from",
"the",
"specified",
"font",
"data",
"."
] | train | https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/safe-typeface/src/main/java/xyz/truenight/safetypeface/SafeTypeface.java#L40-L49 |
eyp/serfj | src/main/java/net/sf/serfj/ServletHelper.java | ServletHelper.signatureStrategy | private Object signatureStrategy(UrlInfo urlInfo, ResponseHelper responseHelper) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException,
InstantiationException, NoSuchMethodException {
Class<?> clazz = Class.forName(urlInfo.getController());
Object result = null;
// action(ResponseHelper, Map<String,Object>)
Method method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { ResponseHelper.class, Map.class });
if (method != null) {
LOGGER.debug("Calling {}.{}(ResponseHelper, Map<String,Object>)", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(method);
result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper, responseHelper.getParams());
} else {
// action(ResponseHelper)
method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { ResponseHelper.class });
if (method != null) {
LOGGER.debug("Calling {}.{}(ResponseHelper)", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(method);
result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper);
} else {
// action(Map<String,Object>)
method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { Map.class });
if (method != null) {
LOGGER.debug("Calling {}.{}(Map<String,Object>)", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(method);
result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper.getParams());
} else {
// action()
method = clazz.getMethod(urlInfo.getAction(), new Class[] {});
LOGGER.debug("Calling {}.{}()", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(method);
result = this.invokeAction(clazz.newInstance(), method, urlInfo);
}
}
}
return result;
} | java | private Object signatureStrategy(UrlInfo urlInfo, ResponseHelper responseHelper) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException,
InstantiationException, NoSuchMethodException {
Class<?> clazz = Class.forName(urlInfo.getController());
Object result = null;
// action(ResponseHelper, Map<String,Object>)
Method method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { ResponseHelper.class, Map.class });
if (method != null) {
LOGGER.debug("Calling {}.{}(ResponseHelper, Map<String,Object>)", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(method);
result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper, responseHelper.getParams());
} else {
// action(ResponseHelper)
method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { ResponseHelper.class });
if (method != null) {
LOGGER.debug("Calling {}.{}(ResponseHelper)", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(method);
result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper);
} else {
// action(Map<String,Object>)
method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { Map.class });
if (method != null) {
LOGGER.debug("Calling {}.{}(Map<String,Object>)", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(method);
result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper.getParams());
} else {
// action()
method = clazz.getMethod(urlInfo.getAction(), new Class[] {});
LOGGER.debug("Calling {}.{}()", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(method);
result = this.invokeAction(clazz.newInstance(), method, urlInfo);
}
}
}
return result;
} | [
"private",
"Object",
"signatureStrategy",
"(",
"UrlInfo",
"urlInfo",
",",
"ResponseHelper",
"responseHelper",
")",
"throws",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"InstantiationException",
",",
"NoSuchMethodException",
... | Invokes URL's action using SIGNATURE strategy. It means that controller's
method could have these signatures:
- action(ResponseHelper, Map<String,Object>). - action(ResponseHelper). -
action(Map<String,Object>). - action().
@param urlInfo
Information of REST's URL.
@param responseHelper
ResponseHelper object to inject into the controller.
@throws ClassNotFoundException
if controller's class doesn't exist.
@throws NoSuchMethodException
if doesn't exist a method for action required in the URL.
@throws IllegalArgumentException
if controller's method has different arguments that this
method tries to pass to it.
@throws IllegalAccessException
if the controller or its method are not accessibles-
@throws InvocationTargetException
if the controller's method raise an exception.
@throws InstantiationException
if it isn't possible to instantiate the controller. | [
"Invokes",
"URL",
"s",
"action",
"using",
"SIGNATURE",
"strategy",
".",
"It",
"means",
"that",
"controller",
"s",
"method",
"could",
"have",
"these",
"signatures",
":"
] | train | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ServletHelper.java#L211-L245 |
mgm-tp/jfunk | jfunk-common/src/main/java/com/mgmtp/jfunk/common/cli/CliUtils.java | CliUtils.executeCommandLine | public static CliOutput executeCommandLine(final Commandline cli, final String loggerName, final String logMessagePrefix,
final InputStream inputStream, final int timeoutInSeconds) {
try {
String cliString = CommandLineUtils.toString(cli.getShellCommandline());
LOGGER.info("Executing command-line: {}", cliString);
LoggingStreamConsumer stdOut = new LoggingStreamConsumer(loggerName, logMessagePrefix, false);
LoggingStreamConsumer stdErr = new LoggingStreamConsumer(loggerName, logMessagePrefix, true);
int exitCode = CommandLineUtils.executeCommandLine(cli, inputStream, stdOut, stdErr, timeoutInSeconds);
return new CliOutput(stdOut.getOutput(), stdErr.getOutput(), exitCode);
} catch (CommandLineException ex) {
throw new CliException("Error executing command-line process.", ex);
}
} | java | public static CliOutput executeCommandLine(final Commandline cli, final String loggerName, final String logMessagePrefix,
final InputStream inputStream, final int timeoutInSeconds) {
try {
String cliString = CommandLineUtils.toString(cli.getShellCommandline());
LOGGER.info("Executing command-line: {}", cliString);
LoggingStreamConsumer stdOut = new LoggingStreamConsumer(loggerName, logMessagePrefix, false);
LoggingStreamConsumer stdErr = new LoggingStreamConsumer(loggerName, logMessagePrefix, true);
int exitCode = CommandLineUtils.executeCommandLine(cli, inputStream, stdOut, stdErr, timeoutInSeconds);
return new CliOutput(stdOut.getOutput(), stdErr.getOutput(), exitCode);
} catch (CommandLineException ex) {
throw new CliException("Error executing command-line process.", ex);
}
} | [
"public",
"static",
"CliOutput",
"executeCommandLine",
"(",
"final",
"Commandline",
"cli",
",",
"final",
"String",
"loggerName",
",",
"final",
"String",
"logMessagePrefix",
",",
"final",
"InputStream",
"inputStream",
",",
"final",
"int",
"timeoutInSeconds",
")",
"{"... | Executes the specified command line and blocks until the process has finished or till the
timeout is reached. The output of the process is captured, returned, as well as logged with
info (stdout) and error (stderr) level, respectively.
@param cli
the command line
@param loggerName
the name of the logger to use (passed to {@link LoggerFactory#getLogger(String)});
if {@code null} this class' name is used
@param logMessagePrefix
if non-{@code null} consumed lines are prefix with this string
@param inputStream
the process input to read from, must be thread safe
@param timeoutInSeconds
a positive integer to specify timeout, zero and negative integers for no timeout
@return the process' output | [
"Executes",
"the",
"specified",
"command",
"line",
"and",
"blocks",
"until",
"the",
"process",
"has",
"finished",
"or",
"till",
"the",
"timeout",
"is",
"reached",
".",
"The",
"output",
"of",
"the",
"process",
"is",
"captured",
"returned",
"as",
"well",
"as",... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/cli/CliUtils.java#L153-L167 |
ontop/ontop | core/model/src/main/java/it/unibz/inf/ontop/dbschema/QuotedID.java | QuotedID.createIdFromDatabaseRecord | public static QuotedID createIdFromDatabaseRecord(QuotedIDFactory idfac, String s) {
// ID is as though it is quoted -- DB stores names as is
return new QuotedID(s, idfac.getIDQuotationString());
} | java | public static QuotedID createIdFromDatabaseRecord(QuotedIDFactory idfac, String s) {
// ID is as though it is quoted -- DB stores names as is
return new QuotedID(s, idfac.getIDQuotationString());
} | [
"public",
"static",
"QuotedID",
"createIdFromDatabaseRecord",
"(",
"QuotedIDFactory",
"idfac",
",",
"String",
"s",
")",
"{",
"// ID is as though it is quoted -- DB stores names as is ",
"return",
"new",
"QuotedID",
"(",
"s",
",",
"idfac",
".",
"getIDQuotationString",
"(",... | creates attribute ID from the database record (as though it is a quoted name)
@param s
@return | [
"creates",
"attribute",
"ID",
"from",
"the",
"database",
"record",
"(",
"as",
"though",
"it",
"is",
"a",
"quoted",
"name",
")"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/dbschema/QuotedID.java#L74-L77 |
cubedtear/aritzh | aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java | Configuration.getBoolean | public boolean getBoolean(String category, String key) {
String value = this.getProperty(category, key);
return Boolean.parseBoolean(value) || "on".equalsIgnoreCase(value);
} | java | public boolean getBoolean(String category, String key) {
String value = this.getProperty(category, key);
return Boolean.parseBoolean(value) || "on".equalsIgnoreCase(value);
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"category",
",",
"String",
"key",
")",
"{",
"String",
"value",
"=",
"this",
".",
"getProperty",
"(",
"category",
",",
"key",
")",
";",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"value",
")",
"||",
"\... | Same as {@link Configuration#getProperty(String, String)}, but a boolean is parsed.
@param category The category of the property
@param key The key (identifier) of the property
@return {@code true} if the property can be parsed to boolean, or equals (ignoring case) {@code "on"} | [
"Same",
"as",
"{",
"@link",
"Configuration#getProperty",
"(",
"String",
"String",
")",
"}",
"but",
"a",
"boolean",
"is",
"parsed",
"."
] | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java#L273-L276 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByImageUrl | public Iterable<DConnection> queryByImageUrl(java.lang.String imageUrl) {
return queryByField(null, DConnectionMapper.Field.IMAGEURL.getFieldName(), imageUrl);
} | java | public Iterable<DConnection> queryByImageUrl(java.lang.String imageUrl) {
return queryByField(null, DConnectionMapper.Field.IMAGEURL.getFieldName(), imageUrl);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByImageUrl",
"(",
"java",
".",
"lang",
".",
"String",
"imageUrl",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"IMAGEURL",
".",
"getFieldName",
"(",
")",
",... | query-by method for field imageUrl
@param imageUrl the specified attribute
@return an Iterable of DConnections for the specified imageUrl | [
"query",
"-",
"by",
"method",
"for",
"field",
"imageUrl"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L97-L99 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/filter/StartSearchFilter.java | StartSearchFilter.fakeTheDate | public void fakeTheDate()
{
int ecErrorCode;
BaseField fldToCompare = m_fldToCompare; // Cache this in case it is changed
if (m_fldToCompare.isNull())
return; // Don't convert the date if this is NULL!
if (m_fldFakeDate == null)
m_fldFakeDate = new DateField(null, FAKE_DATE, DBConstants.DEFAULT_FIELD_LENGTH, FAKE_DATE, null); //m_FieldToCompare->GetFile()->GetField(kBkFakeDate);
m_fldToCompare = m_fldFakeDate;
ecErrorCode = m_fldToCompare.moveFieldToThis(fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Convert the date
boolean bOldState = fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(false); // Disable the reselect listener for a second
if ((ecErrorCode == DBConstants.NORMAL_RETURN) && (((NumberField)m_fldToCompare).getValue() != 0))
fldToCompare.moveFieldToThis(m_fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Reformat and display the date
else
{
fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field
m_fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field
}
fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(bOldState); // Reenable the reselect listener for a second
} | java | public void fakeTheDate()
{
int ecErrorCode;
BaseField fldToCompare = m_fldToCompare; // Cache this in case it is changed
if (m_fldToCompare.isNull())
return; // Don't convert the date if this is NULL!
if (m_fldFakeDate == null)
m_fldFakeDate = new DateField(null, FAKE_DATE, DBConstants.DEFAULT_FIELD_LENGTH, FAKE_DATE, null); //m_FieldToCompare->GetFile()->GetField(kBkFakeDate);
m_fldToCompare = m_fldFakeDate;
ecErrorCode = m_fldToCompare.moveFieldToThis(fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Convert the date
boolean bOldState = fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(false); // Disable the reselect listener for a second
if ((ecErrorCode == DBConstants.NORMAL_RETURN) && (((NumberField)m_fldToCompare).getValue() != 0))
fldToCompare.moveFieldToThis(m_fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Reformat and display the date
else
{
fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field
m_fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field
}
fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(bOldState); // Reenable the reselect listener for a second
} | [
"public",
"void",
"fakeTheDate",
"(",
")",
"{",
"int",
"ecErrorCode",
";",
"BaseField",
"fldToCompare",
"=",
"m_fldToCompare",
";",
"// Cache this in case it is changed",
"if",
"(",
"m_fldToCompare",
".",
"isNull",
"(",
")",
")",
"return",
";",
"// Don't convert the... | If the current key starts with a date, convert the search field to a date and compare. | [
"If",
"the",
"current",
"key",
"starts",
"with",
"a",
"date",
"convert",
"the",
"search",
"field",
"to",
"a",
"date",
"and",
"compare",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/filter/StartSearchFilter.java#L126-L145 |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrIndex.java | CmsSolrIndex.select | public void select(ServletResponse response, CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows)
throws Exception {
throwExceptionIfSafetyRestrictionsAreViolated(cms, query, false);
boolean isOnline = cms.getRequestContext().getCurrentProject().isOnlineProject();
CmsResourceFilter filter = isOnline ? null : CmsResourceFilter.IGNORE_EXPIRATION;
search(cms, query, ignoreMaxRows, response, false, filter);
} | java | public void select(ServletResponse response, CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows)
throws Exception {
throwExceptionIfSafetyRestrictionsAreViolated(cms, query, false);
boolean isOnline = cms.getRequestContext().getCurrentProject().isOnlineProject();
CmsResourceFilter filter = isOnline ? null : CmsResourceFilter.IGNORE_EXPIRATION;
search(cms, query, ignoreMaxRows, response, false, filter);
} | [
"public",
"void",
"select",
"(",
"ServletResponse",
"response",
",",
"CmsObject",
"cms",
",",
"CmsSolrQuery",
"query",
",",
"boolean",
"ignoreMaxRows",
")",
"throws",
"Exception",
"{",
"throwExceptionIfSafetyRestrictionsAreViolated",
"(",
"cms",
",",
"query",
",",
"... | Writes the response into the writer.<p>
NOTE: Currently not available for HTTP server.<p>
@param response the servlet response
@param cms the CMS object to use for search
@param query the Solr query
@param ignoreMaxRows if to return unlimited results
@throws Exception if there is no embedded server | [
"Writes",
"the",
"response",
"into",
"the",
"writer",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L1329-L1337 |
googlemaps/google-maps-services-java | src/main/java/com/google/maps/GeocodingApiRequest.java | GeocodingApiRequest.bounds | public GeocodingApiRequest bounds(LatLng southWestBound, LatLng northEastBound) {
return param("bounds", join('|', southWestBound, northEastBound));
} | java | public GeocodingApiRequest bounds(LatLng southWestBound, LatLng northEastBound) {
return param("bounds", join('|', southWestBound, northEastBound));
} | [
"public",
"GeocodingApiRequest",
"bounds",
"(",
"LatLng",
"southWestBound",
",",
"LatLng",
"northEastBound",
")",
"{",
"return",
"param",
"(",
"\"bounds\"",
",",
"join",
"(",
"'",
"'",
",",
"southWestBound",
",",
"northEastBound",
")",
")",
";",
"}"
] | Sets the bounding box of the viewport within which to bias geocode results more prominently.
This parameter will only influence, not fully restrict, results from the geocoder.
<p>For more information see <a
href="https://developers.google.com/maps/documentation/geocoding/intro?hl=pl#Viewports">
Viewport Biasing</a>.
@param southWestBound The South West bound of the bounding box.
@param northEastBound The North East bound of the bounding box.
@return Returns this {@code GeocodingApiRequest} for call chaining. | [
"Sets",
"the",
"bounding",
"box",
"of",
"the",
"viewport",
"within",
"which",
"to",
"bias",
"geocode",
"results",
"more",
"prominently",
".",
"This",
"parameter",
"will",
"only",
"influence",
"not",
"fully",
"restrict",
"results",
"from",
"the",
"geocoder",
".... | train | https://github.com/googlemaps/google-maps-services-java/blob/23d20d1930f80e310d856d2da51d72ee0db4476b/src/main/java/com/google/maps/GeocodingApiRequest.java#L99-L101 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java | ExpressionUtils.eq | public static <D> Predicate eq(Expression<D> left, Expression<? extends D> right) {
return predicate(Ops.EQ, left, right);
} | java | public static <D> Predicate eq(Expression<D> left, Expression<? extends D> right) {
return predicate(Ops.EQ, left, right);
} | [
"public",
"static",
"<",
"D",
">",
"Predicate",
"eq",
"(",
"Expression",
"<",
"D",
">",
"left",
",",
"Expression",
"<",
"?",
"extends",
"D",
">",
"right",
")",
"{",
"return",
"predicate",
"(",
"Ops",
".",
"EQ",
",",
"left",
",",
"right",
")",
";",
... | Create a {@code left == right} expression
@param <D> type of expressions
@param left lhs of expression
@param right rhs of expression
@return left == right | [
"Create",
"a",
"{",
"@code",
"left",
"==",
"right",
"}",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L481-L483 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java | Widget.findChildByNameInAllGroups | private static Widget findChildByNameInAllGroups(final String name,
List<Widget> groups) {
if (groups.isEmpty()) {
return null;
}
ArrayList<Widget> groupChildren = new ArrayList<>();
Widget result;
for (Widget group : groups) {
// Search the immediate children of 'groups' for a match, rathering
// the children that are GroupWidgets themselves.
result = findChildByNameInOneGroup(name, group, groupChildren);
if (result != null) {
return result;
}
}
// No match; Search the children that are GroupWidgets.
return findChildByNameInAllGroups(name, groupChildren);
} | java | private static Widget findChildByNameInAllGroups(final String name,
List<Widget> groups) {
if (groups.isEmpty()) {
return null;
}
ArrayList<Widget> groupChildren = new ArrayList<>();
Widget result;
for (Widget group : groups) {
// Search the immediate children of 'groups' for a match, rathering
// the children that are GroupWidgets themselves.
result = findChildByNameInOneGroup(name, group, groupChildren);
if (result != null) {
return result;
}
}
// No match; Search the children that are GroupWidgets.
return findChildByNameInAllGroups(name, groupChildren);
} | [
"private",
"static",
"Widget",
"findChildByNameInAllGroups",
"(",
"final",
"String",
"name",
",",
"List",
"<",
"Widget",
">",
"groups",
")",
"{",
"if",
"(",
"groups",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"ArrayList",
"<",
"Widg... | Performs a breadth-first search of the {@link GroupWidget GroupWidgets}
in {@code groups} for a {@link Widget} with the specified
{@link Widget#getName() name}.
@param name
The name of the {@code Widget} to find.
@param groups
The {@code GroupWidgets} to search.
@return The first {@code Widget} with the specified name or {@code null}
if no child of {@code groups} has that name. | [
"Performs",
"a",
"breadth",
"-",
"first",
"search",
"of",
"the",
"{",
"@link",
"GroupWidget",
"GroupWidgets",
"}",
"in",
"{",
"@code",
"groups",
"}",
"for",
"a",
"{",
"@link",
"Widget",
"}",
"with",
"the",
"specified",
"{",
"@link",
"Widget#getName",
"()",... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L2634-L2653 |
JDBDT/jdbdt | src/main/java/org/jdbdt/DataSource.java | DataSource.executeQuery | final DataSet executeQuery(CallInfo callInfo, boolean takeSnapshot) {
DataSet data = new DataSet(this);
return db.access(callInfo, () -> {
try (WrappedStatement ws = db.compile(getSQLForQuery())) {
proceedWithQuery(ws.getStatement(), data);
if (takeSnapshot) {
setSnapshot(data);
db.logSnapshot(callInfo, data);
} else {
db.logQuery(callInfo, data);
}
}
return data;
});
} | java | final DataSet executeQuery(CallInfo callInfo, boolean takeSnapshot) {
DataSet data = new DataSet(this);
return db.access(callInfo, () -> {
try (WrappedStatement ws = db.compile(getSQLForQuery())) {
proceedWithQuery(ws.getStatement(), data);
if (takeSnapshot) {
setSnapshot(data);
db.logSnapshot(callInfo, data);
} else {
db.logQuery(callInfo, data);
}
}
return data;
});
} | [
"final",
"DataSet",
"executeQuery",
"(",
"CallInfo",
"callInfo",
",",
"boolean",
"takeSnapshot",
")",
"{",
"DataSet",
"data",
"=",
"new",
"DataSet",
"(",
"this",
")",
";",
"return",
"db",
".",
"access",
"(",
"callInfo",
",",
"(",
")",
"->",
"{",
"try",
... | Execute query.
@param callInfo Call info.
@param takeSnapshot Indicates that a snapshot should be taken.
@return Result of query. | [
"Execute",
"query",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DataSource.java#L226-L240 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java | BlobServicesInner.setServicePropertiesAsync | public Observable<BlobServicePropertiesInner> setServicePropertiesAsync(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) {
return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<BlobServicePropertiesInner>, BlobServicePropertiesInner>() {
@Override
public BlobServicePropertiesInner call(ServiceResponse<BlobServicePropertiesInner> response) {
return response.body();
}
});
} | java | public Observable<BlobServicePropertiesInner> setServicePropertiesAsync(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) {
return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<BlobServicePropertiesInner>, BlobServicePropertiesInner>() {
@Override
public BlobServicePropertiesInner call(ServiceResponse<BlobServicePropertiesInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BlobServicePropertiesInner",
">",
"setServicePropertiesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"BlobServicePropertiesInner",
"parameters",
")",
"{",
"return",
"setServicePropertiesWithServiceResponseAsync",
"(... | Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BlobServicePropertiesInner object | [
"Sets",
"the",
"properties",
"of",
"a",
"storage",
"account’s",
"Blob",
"service",
"including",
"properties",
"for",
"Storage",
"Analytics",
"and",
"CORS",
"(",
"Cross",
"-",
"Origin",
"Resource",
"Sharing",
")",
"rules",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/BlobServicesInner.java#L105-L112 |
mcxiaoke/Android-Next | core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java | IOUtils.readStringFromRaw | public static String readStringFromRaw(Context context, int resId) throws IOException {
if (context == null) {
return null;
}
StringBuilder s = new StringBuilder();
InputStreamReader in = new InputStreamReader(context.getResources().openRawResource(resId));
BufferedReader br = new BufferedReader(in);
String line;
while ((line = br.readLine()) != null) {
s.append(line);
}
return s.toString();
} | java | public static String readStringFromRaw(Context context, int resId) throws IOException {
if (context == null) {
return null;
}
StringBuilder s = new StringBuilder();
InputStreamReader in = new InputStreamReader(context.getResources().openRawResource(resId));
BufferedReader br = new BufferedReader(in);
String line;
while ((line = br.readLine()) != null) {
s.append(line);
}
return s.toString();
} | [
"public",
"static",
"String",
"readStringFromRaw",
"(",
"Context",
"context",
",",
"int",
"resId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringBuilder",
"s",
"=",
"new",
"StringBuilder",... | get content from a raw resource. This can only be used with resources whose value is the name of an
asset files -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and
color resources.
@param context
@param resId The resource identifier to open, as generated by the appt tool.
@return | [
"get",
"content",
"from",
"a",
"raw",
"resource",
".",
"This",
"can",
"only",
"be",
"used",
"with",
"resources",
"whose",
"value",
"is",
"the",
"name",
"of",
"an",
"asset",
"files",
"--",
"that",
"is",
"it",
"can",
"be",
"used",
"to",
"open",
"drawable... | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java#L1086-L1099 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java | KeyAgreement.generateSecret | public final int generateSecret(byte[] sharedSecret, int offset)
throws IllegalStateException, ShortBufferException
{
chooseFirstProvider();
return spi.engineGenerateSecret(sharedSecret, offset);
} | java | public final int generateSecret(byte[] sharedSecret, int offset)
throws IllegalStateException, ShortBufferException
{
chooseFirstProvider();
return spi.engineGenerateSecret(sharedSecret, offset);
} | [
"public",
"final",
"int",
"generateSecret",
"(",
"byte",
"[",
"]",
"sharedSecret",
",",
"int",
"offset",
")",
"throws",
"IllegalStateException",
",",
"ShortBufferException",
"{",
"chooseFirstProvider",
"(",
")",
";",
"return",
"spi",
".",
"engineGenerateSecret",
"... | Generates the shared secret, and places it into the buffer
<code>sharedSecret</code>, beginning at <code>offset</code> inclusive.
<p>If the <code>sharedSecret</code> buffer is too small to hold the
result, a <code>ShortBufferException</code> is thrown.
In this case, this call should be repeated with a larger output buffer.
<p>This method resets this <code>KeyAgreement</code> object, so that it
can be reused for further key agreements. Unless this key agreement is
reinitialized with one of the <code>init</code> methods, the same
private information and algorithm parameters will be used for
subsequent key agreements.
@param sharedSecret the buffer for the shared secret
@param offset the offset in <code>sharedSecret</code> where the
shared secret will be stored
@return the number of bytes placed into <code>sharedSecret</code>
@exception IllegalStateException if this key agreement has not been
completed yet
@exception ShortBufferException if the given output buffer is too small
to hold the secret | [
"Generates",
"the",
"shared",
"secret",
"and",
"places",
"it",
"into",
"the",
"buffer",
"<code",
">",
"sharedSecret<",
"/",
"code",
">",
"beginning",
"at",
"<code",
">",
"offset<",
"/",
"code",
">",
"inclusive",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java#L607-L612 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/types/TimecodeRange.java | TimecodeRange.merge | public static TimecodeRange merge(TimecodeRange a, TimecodeRange b)
{
final Timecode start = TimecodeComparator.min(a.getStart(), b.getStart());
final Timecode end = TimecodeComparator.max(a.getEnd(), b.getEnd());
return new TimecodeRange(start, end);
} | java | public static TimecodeRange merge(TimecodeRange a, TimecodeRange b)
{
final Timecode start = TimecodeComparator.min(a.getStart(), b.getStart());
final Timecode end = TimecodeComparator.max(a.getEnd(), b.getEnd());
return new TimecodeRange(start, end);
} | [
"public",
"static",
"TimecodeRange",
"merge",
"(",
"TimecodeRange",
"a",
",",
"TimecodeRange",
"b",
")",
"{",
"final",
"Timecode",
"start",
"=",
"TimecodeComparator",
".",
"min",
"(",
"a",
".",
"getStart",
"(",
")",
",",
"b",
".",
"getStart",
"(",
")",
"... | Produce a new Timecode range which includes all timecodes from <code>a</code> and <code>b</code>. This may result in
coverage
of additional timecodes if the two ranges do not overlap.
@param a
@param b
@return | [
"Produce",
"a",
"new",
"Timecode",
"range",
"which",
"includes",
"all",
"timecodes",
"from",
"<code",
">",
"a<",
"/",
"code",
">",
"and",
"<code",
">",
"b<",
"/",
"code",
">",
".",
"This",
"may",
"result",
"in",
"coverage",
"of",
"additional",
"timecodes... | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/TimecodeRange.java#L183-L189 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/svd/implicitqr/SvdImplicitQrAlgorithm_DDRM.java | SvdImplicitQrAlgorithm_DDRM.performImplicitSingleStep | public void performImplicitSingleStep(double scale , double lambda , boolean byAngle) {
createBulge(x1,lambda,scale,byAngle);
for( int i = x1; i < x2-1 && bulge != 0.0; i++ ) {
removeBulgeLeft(i,true);
if( bulge == 0 )
break;
removeBulgeRight(i);
}
if( bulge != 0 )
removeBulgeLeft(x2-1,false);
incrementSteps();
} | java | public void performImplicitSingleStep(double scale , double lambda , boolean byAngle) {
createBulge(x1,lambda,scale,byAngle);
for( int i = x1; i < x2-1 && bulge != 0.0; i++ ) {
removeBulgeLeft(i,true);
if( bulge == 0 )
break;
removeBulgeRight(i);
}
if( bulge != 0 )
removeBulgeLeft(x2-1,false);
incrementSteps();
} | [
"public",
"void",
"performImplicitSingleStep",
"(",
"double",
"scale",
",",
"double",
"lambda",
",",
"boolean",
"byAngle",
")",
"{",
"createBulge",
"(",
"x1",
",",
"lambda",
",",
"scale",
",",
"byAngle",
")",
";",
"for",
"(",
"int",
"i",
"=",
"x1",
";",
... | Given the lambda value perform an implicit QR step on the matrix.
B^T*B-lambda*I
@param lambda Stepping factor. | [
"Given",
"the",
"lambda",
"value",
"perform",
"an",
"implicit",
"QR",
"step",
"on",
"the",
"matrix",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/svd/implicitqr/SvdImplicitQrAlgorithm_DDRM.java#L356-L370 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsSqlManager.java | CmsSqlManager.readQuery | public String readQuery(CmsProject project, String queryKey) {
return readQuery(project.getUuid(), queryKey);
} | java | public String readQuery(CmsProject project, String queryKey) {
return readQuery(project.getUuid(), queryKey);
} | [
"public",
"String",
"readQuery",
"(",
"CmsProject",
"project",
",",
"String",
"queryKey",
")",
"{",
"return",
"readQuery",
"(",
"project",
".",
"getUuid",
"(",
")",
",",
"queryKey",
")",
";",
"}"
] | Searches for the SQL query with the specified key and CmsProject.<p>
@param project the specified CmsProject
@param queryKey the key of the SQL query
@return the the SQL query in this property list with the specified key | [
"Searches",
"for",
"the",
"SQL",
"query",
"with",
"the",
"specified",
"key",
"and",
"CmsProject",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsSqlManager.java#L313-L316 |
f2prateek/dart | henson/src/main/java/dart/henson/Bundler.java | Bundler.put | public Bundler put(String key, String value) {
delegate.putString(key, value);
return this;
} | java | public Bundler put(String key, String value) {
delegate.putString(key, value);
return this;
} | [
"public",
"Bundler",
"put",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"delegate",
".",
"putString",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a String value into the mapping of the underlying Bundle, replacing any existing value
for the given key. Either key or value may be null.
@param key a String, or null
@param value a String, or null
@return this bundler instance to chain method calls | [
"Inserts",
"a",
"String",
"value",
"into",
"the",
"mapping",
"of",
"the",
"underlying",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L166-L169 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java | HttpConversionUtil.parseStatus | public static HttpResponseStatus parseStatus(CharSequence status) throws Http2Exception {
HttpResponseStatus result;
try {
result = parseLine(status);
if (result == HttpResponseStatus.SWITCHING_PROTOCOLS) {
throw connectionError(PROTOCOL_ERROR, "Invalid HTTP/2 status code '%d'", result.code());
}
} catch (Http2Exception e) {
throw e;
} catch (Throwable t) {
throw connectionError(PROTOCOL_ERROR, t,
"Unrecognized HTTP status code '%s' encountered in translation to HTTP/1.x", status);
}
return result;
} | java | public static HttpResponseStatus parseStatus(CharSequence status) throws Http2Exception {
HttpResponseStatus result;
try {
result = parseLine(status);
if (result == HttpResponseStatus.SWITCHING_PROTOCOLS) {
throw connectionError(PROTOCOL_ERROR, "Invalid HTTP/2 status code '%d'", result.code());
}
} catch (Http2Exception e) {
throw e;
} catch (Throwable t) {
throw connectionError(PROTOCOL_ERROR, t,
"Unrecognized HTTP status code '%s' encountered in translation to HTTP/1.x", status);
}
return result;
} | [
"public",
"static",
"HttpResponseStatus",
"parseStatus",
"(",
"CharSequence",
"status",
")",
"throws",
"Http2Exception",
"{",
"HttpResponseStatus",
"result",
";",
"try",
"{",
"result",
"=",
"parseLine",
"(",
"status",
")",
";",
"if",
"(",
"result",
"==",
"HttpRe... | Apply HTTP/2 rules while translating status code to {@link HttpResponseStatus}
@param status The status from an HTTP/2 frame
@return The HTTP/1.x status
@throws Http2Exception If there is a problem translating from HTTP/2 to HTTP/1.x | [
"Apply",
"HTTP",
"/",
"2",
"rules",
"while",
"translating",
"status",
"code",
"to",
"{",
"@link",
"HttpResponseStatus",
"}"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L184-L198 |
Azure/azure-sdk-for-java | loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/LogAnalyticsDataClientImpl.java | LogAnalyticsDataClientImpl.queryAsync | public ServiceFuture<QueryResults> queryAsync(String workspaceId, QueryBody body, final ServiceCallback<QueryResults> serviceCallback) {
return ServiceFuture.fromResponse(queryWithServiceResponseAsync(workspaceId, body), serviceCallback);
} | java | public ServiceFuture<QueryResults> queryAsync(String workspaceId, QueryBody body, final ServiceCallback<QueryResults> serviceCallback) {
return ServiceFuture.fromResponse(queryWithServiceResponseAsync(workspaceId, body), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"QueryResults",
">",
"queryAsync",
"(",
"String",
"workspaceId",
",",
"QueryBody",
"body",
",",
"final",
"ServiceCallback",
"<",
"QueryResults",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
... | Execute an Analytics query.
Executes an Analytics query for data. [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an example for using POST with an Analytics query.
@param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the Azure portal.
@param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/)
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Execute",
"an",
"Analytics",
"query",
".",
"Executes",
"an",
"Analytics",
"query",
"for",
"data",
".",
"[",
"Here",
"]",
"(",
"https",
":",
"//",
"dev",
".",
"loganalytics",
".",
"io",
"/",
"documentation",
"/",
"Using",
"-",
"the",
"-",
"API",
")",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/LogAnalyticsDataClientImpl.java#L209-L211 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toQueryColumn | public static QueryColumn toQueryColumn(Object o) throws PageException {
if (o instanceof QueryColumn) return (QueryColumn) o;
throw new CasterException(o, "querycolumn");
} | java | public static QueryColumn toQueryColumn(Object o) throws PageException {
if (o instanceof QueryColumn) return (QueryColumn) o;
throw new CasterException(o, "querycolumn");
} | [
"public",
"static",
"QueryColumn",
"toQueryColumn",
"(",
"Object",
"o",
")",
"throws",
"PageException",
"{",
"if",
"(",
"o",
"instanceof",
"QueryColumn",
")",
"return",
"(",
"QueryColumn",
")",
"o",
";",
"throw",
"new",
"CasterException",
"(",
"o",
",",
"\"q... | converts a object to a QueryColumn, if possible
@param o
@return
@throws PageException | [
"converts",
"a",
"object",
"to",
"a",
"QueryColumn",
"if",
"possible"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L2985-L2988 |
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.beginGetBgpPeerStatus | public BgpPeerStatusListResultInner beginGetBgpPeerStatus(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetBgpPeerStatusWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body();
} | java | public BgpPeerStatusListResultInner beginGetBgpPeerStatus(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetBgpPeerStatusWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body();
} | [
"public",
"BgpPeerStatusListResultInner",
"beginGetBgpPeerStatus",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"beginGetBgpPeerStatusWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName",
")",
... | The GetBgpPeerStatus operation retrieves the status of all 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
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BgpPeerStatusListResultInner object if successful. | [
"The",
"GetBgpPeerStatus",
"operation",
"retrieves",
"the",
"status",
"of",
"all",
"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#L2089-L2091 |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java | LoggingFraction.customFormatter | public LoggingFraction customFormatter(String name, String module, String className) {
return customFormatter(name, module, className, null);
} | java | public LoggingFraction customFormatter(String name, String module, String className) {
return customFormatter(name, module, className, null);
} | [
"public",
"LoggingFraction",
"customFormatter",
"(",
"String",
"name",
",",
"String",
"module",
",",
"String",
"className",
")",
"{",
"return",
"customFormatter",
"(",
"name",
",",
"module",
",",
"className",
",",
"null",
")",
";",
"}"
] | Add a CustomFormatter to this logger
@param name the name of the formatter
@param module the module that the logging handler depends on
@param className the logging handler class to be used
@return This fraction. | [
"Add",
"a",
"CustomFormatter",
"to",
"this",
"logger"
] | train | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/logging/api/src/main/java/org/wildfly/swarm/logging/LoggingFraction.java#L140-L142 |
rhuss/jolokia | agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/ToolsClassFinder.java | ToolsClassFinder.createClassLoader | private static ClassLoader createClassLoader(File toolsJar) throws MalformedURLException {
final URL urls[] = new URL[] {toolsJar.toURI().toURL() };
if (System.getSecurityManager() == null) {
return new URLClassLoader(urls, getParentClassLoader());
} else {
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
/** {@inheritDoc} */
public ClassLoader run() {
return new URLClassLoader(urls, getParentClassLoader());
}
});
}
} | java | private static ClassLoader createClassLoader(File toolsJar) throws MalformedURLException {
final URL urls[] = new URL[] {toolsJar.toURI().toURL() };
if (System.getSecurityManager() == null) {
return new URLClassLoader(urls, getParentClassLoader());
} else {
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
/** {@inheritDoc} */
public ClassLoader run() {
return new URLClassLoader(urls, getParentClassLoader());
}
});
}
} | [
"private",
"static",
"ClassLoader",
"createClassLoader",
"(",
"File",
"toolsJar",
")",
"throws",
"MalformedURLException",
"{",
"final",
"URL",
"urls",
"[",
"]",
"=",
"new",
"URL",
"[",
"]",
"{",
"toolsJar",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
... | Create a classloader and respect a security manager if installed | [
"Create",
"a",
"classloader",
"and",
"respect",
"a",
"security",
"manager",
"if",
"installed"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/ToolsClassFinder.java#L99-L111 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.domain_zone_new_GET | public OvhOrder domain_zone_new_GET(Boolean minimized, String zoneName) throws IOException {
String qPath = "/order/domain/zone/new";
StringBuilder sb = path(qPath);
query(sb, "minimized", minimized);
query(sb, "zoneName", zoneName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder domain_zone_new_GET(Boolean minimized, String zoneName) throws IOException {
String qPath = "/order/domain/zone/new";
StringBuilder sb = path(qPath);
query(sb, "minimized", minimized);
query(sb, "zoneName", zoneName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"domain_zone_new_GET",
"(",
"Boolean",
"minimized",
",",
"String",
"zoneName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/domain/zone/new\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query",
... | Get prices and contracts information
REST: GET /order/domain/zone/new
@param minimized [required] Create only mandatory records
@param zoneName [required] Name of the zone to create | [
"Get",
"prices",
"and",
"contracts",
"information"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6005-L6012 |
bpsm/edn-java | src/main/java/us/bpsm/edn/Keyword.java | Keyword.newKeyword | public static Keyword newKeyword(String prefix, String name) {
return newKeyword(newSymbol(prefix, name));
} | java | public static Keyword newKeyword(String prefix, String name) {
return newKeyword(newSymbol(prefix, name));
} | [
"public",
"static",
"Keyword",
"newKeyword",
"(",
"String",
"prefix",
",",
"String",
"name",
")",
"{",
"return",
"newKeyword",
"(",
"newSymbol",
"(",
"prefix",
",",
"name",
")",
")",
";",
"}"
] | Provide a Keyword with the given prefix and name.
<p>
Keywords are interned, which means that any two keywords which are equal
(by value) will also be identical (by reference).
@param prefix
An empty String or a non-empty String obeying the restrictions
specified by edn. Never null.
@param name
A non-empty string obeying the restrictions specified by edn.
Never null.
@return a Keyword, never null. | [
"Provide",
"a",
"Keyword",
"with",
"the",
"given",
"prefix",
"and",
"name",
".",
"<p",
">",
"Keywords",
"are",
"interned",
"which",
"means",
"that",
"any",
"two",
"keywords",
"which",
"are",
"equal",
"(",
"by",
"value",
")",
"will",
"also",
"be",
"identi... | train | https://github.com/bpsm/edn-java/blob/c5dfdb77431da1aca3c257599b237a21575629b2/src/main/java/us/bpsm/edn/Keyword.java#L58-L60 |
ontop/ontop | engine/system/core/src/main/java/it/unibz/inf/ontop/utils/querymanager/QueryController.java | QueryController.createGroup | public void createGroup(String groupId) throws Exception {
if (getElementPosition(groupId) == -1) {
QueryControllerGroup group = new QueryControllerGroup(groupId);
entities.add(group);
fireElementAdded(group);
}
else {
throw new Exception("The name is already taken, either by a query group or a query item");
}
} | java | public void createGroup(String groupId) throws Exception {
if (getElementPosition(groupId) == -1) {
QueryControllerGroup group = new QueryControllerGroup(groupId);
entities.add(group);
fireElementAdded(group);
}
else {
throw new Exception("The name is already taken, either by a query group or a query item");
}
} | [
"public",
"void",
"createGroup",
"(",
"String",
"groupId",
")",
"throws",
"Exception",
"{",
"if",
"(",
"getElementPosition",
"(",
"groupId",
")",
"==",
"-",
"1",
")",
"{",
"QueryControllerGroup",
"group",
"=",
"new",
"QueryControllerGroup",
"(",
"groupId",
")"... | Creates a new group and adds it to the vector QueryControllerEntity | [
"Creates",
"a",
"new",
"group",
"and",
"adds",
"it",
"to",
"the",
"vector",
"QueryControllerEntity"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/system/core/src/main/java/it/unibz/inf/ontop/utils/querymanager/QueryController.java#L64-L73 |
HotelsDotCom/corc | corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java | OrcFile.sourcePrepare | @Override
public void sourcePrepare(FlowProcess<? extends Configuration> flowProcess, SourceCall<Corc, RecordReader> sourceCall)
throws IOException {
sourceCall.setContext((Corc) sourceCall.getInput().createValue());
} | java | @Override
public void sourcePrepare(FlowProcess<? extends Configuration> flowProcess, SourceCall<Corc, RecordReader> sourceCall)
throws IOException {
sourceCall.setContext((Corc) sourceCall.getInput().createValue());
} | [
"@",
"Override",
"public",
"void",
"sourcePrepare",
"(",
"FlowProcess",
"<",
"?",
"extends",
"Configuration",
">",
"flowProcess",
",",
"SourceCall",
"<",
"Corc",
",",
"RecordReader",
">",
"sourceCall",
")",
"throws",
"IOException",
"{",
"sourceCall",
".",
"setCo... | Creates an {@link Corc} instance and stores it in the context to be reused for all rows. | [
"Creates",
"an",
"{"
] | train | https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java#L160-L164 |
apereo/cas | support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSamlObjectBuilder.java | AbstractSamlObjectBuilder.signSamlResponse | public static String signSamlResponse(final String samlResponse, final PrivateKey privateKey, final PublicKey publicKey) {
val doc = constructDocumentFromXml(samlResponse);
if (doc != null) {
val signedElement = signSamlElement(doc.getRootElement(),
privateKey, publicKey);
doc.setRootElement((org.jdom.Element) signedElement.detach());
return new XMLOutputter().outputString(doc);
}
throw new IllegalArgumentException("Error signing SAML Response: Null document");
} | java | public static String signSamlResponse(final String samlResponse, final PrivateKey privateKey, final PublicKey publicKey) {
val doc = constructDocumentFromXml(samlResponse);
if (doc != null) {
val signedElement = signSamlElement(doc.getRootElement(),
privateKey, publicKey);
doc.setRootElement((org.jdom.Element) signedElement.detach());
return new XMLOutputter().outputString(doc);
}
throw new IllegalArgumentException("Error signing SAML Response: Null document");
} | [
"public",
"static",
"String",
"signSamlResponse",
"(",
"final",
"String",
"samlResponse",
",",
"final",
"PrivateKey",
"privateKey",
",",
"final",
"PublicKey",
"publicKey",
")",
"{",
"val",
"doc",
"=",
"constructDocumentFromXml",
"(",
"samlResponse",
")",
";",
"if"... | Sign SAML response.
@param samlResponse the SAML response
@param privateKey the private key
@param publicKey the public key
@return the response | [
"Sign",
"SAML",
"response",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSamlObjectBuilder.java#L107-L117 |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MkColCommand.java | MkColCommand.addMixins | private void addMixins(Node node, List<String> mixinTypes)
{
for (int i = 0; i < mixinTypes.size(); i++)
{
String curMixinType = mixinTypes.get(i);
try
{
node.addMixin(curMixinType);
}
catch (Exception exc)
{
log.error("Can't add mixin [" + curMixinType + "]", exc);
}
}
} | java | private void addMixins(Node node, List<String> mixinTypes)
{
for (int i = 0; i < mixinTypes.size(); i++)
{
String curMixinType = mixinTypes.get(i);
try
{
node.addMixin(curMixinType);
}
catch (Exception exc)
{
log.error("Can't add mixin [" + curMixinType + "]", exc);
}
}
} | [
"private",
"void",
"addMixins",
"(",
"Node",
"node",
",",
"List",
"<",
"String",
">",
"mixinTypes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mixinTypes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"curMixinType",
... | Adds mixins to node.
@param node node.
@param mixinTypes mixin types. | [
"Adds",
"mixins",
"to",
"node",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MkColCommand.java#L158-L172 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/json/JsonWriter.java | JsonWriter.keyLiteral | public JsonWriter keyLiteral(CharSequence key) {
startKey();
if (key == null) {
throw new IllegalArgumentException("Expected map key, but got null.");
}
writer.write(key.toString());
writer.write(':');
return this;
} | java | public JsonWriter keyLiteral(CharSequence key) {
startKey();
if (key == null) {
throw new IllegalArgumentException("Expected map key, but got null.");
}
writer.write(key.toString());
writer.write(':');
return this;
} | [
"public",
"JsonWriter",
"keyLiteral",
"(",
"CharSequence",
"key",
")",
"{",
"startKey",
"(",
")",
";",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expected map key, but got null.\"",
")",
";",
"}",
"writer",
".... | Write the string key without quoting or escaping.
@param key The raw string key.
@return The JSON Writer. | [
"Write",
"the",
"string",
"key",
"without",
"quoting",
"or",
"escaping",
"."
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/json/JsonWriter.java#L297-L307 |
mjiderhamn/classloader-leak-prevention | classloader-leak-prevention/classloader-leak-prevention-servlet/src/main/java/se/jiderhamn/classloader/leak/prevention/ClassLoaderLeakPreventorListener.java | ClassLoaderLeakPreventorListener.getIntInitParameter | protected static int getIntInitParameter(ServletContext servletContext, String parameterName, int defaultValue) {
final String parameterString = servletContext.getInitParameter(parameterName);
if(parameterString != null && parameterString.trim().length() > 0) {
try {
return Integer.parseInt(parameterString);
}
catch (NumberFormatException e) {
// Do nothing, return default value
}
}
return defaultValue;
} | java | protected static int getIntInitParameter(ServletContext servletContext, String parameterName, int defaultValue) {
final String parameterString = servletContext.getInitParameter(parameterName);
if(parameterString != null && parameterString.trim().length() > 0) {
try {
return Integer.parseInt(parameterString);
}
catch (NumberFormatException e) {
// Do nothing, return default value
}
}
return defaultValue;
} | [
"protected",
"static",
"int",
"getIntInitParameter",
"(",
"ServletContext",
"servletContext",
",",
"String",
"parameterName",
",",
"int",
"defaultValue",
")",
"{",
"final",
"String",
"parameterString",
"=",
"servletContext",
".",
"getInitParameter",
"(",
"parameterName"... | Parse init parameter for integer value, returning default if not found or invalid | [
"Parse",
"init",
"parameter",
"for",
"integer",
"value",
"returning",
"default",
"if",
"not",
"found",
"or",
"invalid"
] | train | https://github.com/mjiderhamn/classloader-leak-prevention/blob/eea8e3cef64f8096dbbb87552df0a1bd272bcb63/classloader-leak-prevention/classloader-leak-prevention-servlet/src/main/java/se/jiderhamn/classloader/leak/prevention/ClassLoaderLeakPreventorListener.java#L255-L266 |
landawn/AbacusUtil | src/com/landawn/abacus/util/SQLExecutor.java | SQLExecutor.getDBSequence | public DBSequence getDBSequence(final String tableName, final String seqName, final long startVal, final int seqBufferSize) {
return new DBSequence(this, tableName, seqName, startVal, seqBufferSize);
} | java | public DBSequence getDBSequence(final String tableName, final String seqName, final long startVal, final int seqBufferSize) {
return new DBSequence(this, tableName, seqName, startVal, seqBufferSize);
} | [
"public",
"DBSequence",
"getDBSequence",
"(",
"final",
"String",
"tableName",
",",
"final",
"String",
"seqName",
",",
"final",
"long",
"startVal",
",",
"final",
"int",
"seqBufferSize",
")",
"{",
"return",
"new",
"DBSequence",
"(",
"this",
",",
"tableName",
","... | Supports global sequence by db table.
@param tableName
@param seqName
@param startVal
@param seqBufferSize the numbers to allocate/reserve from database table when cached numbers are used up.
@return | [
"Supports",
"global",
"sequence",
"by",
"db",
"table",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/SQLExecutor.java#L3233-L3235 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java | JsonTextSequences.fromObject | public static HttpResponse fromObject(HttpHeaders headers, @Nullable Object content) {
return fromObject(headers, content, HttpHeaders.EMPTY_HEADERS, defaultMapper);
} | java | public static HttpResponse fromObject(HttpHeaders headers, @Nullable Object content) {
return fromObject(headers, content, HttpHeaders.EMPTY_HEADERS, defaultMapper);
} | [
"public",
"static",
"HttpResponse",
"fromObject",
"(",
"HttpHeaders",
"headers",
",",
"@",
"Nullable",
"Object",
"content",
")",
"{",
"return",
"fromObject",
"(",
"headers",
",",
"content",
",",
"HttpHeaders",
".",
"EMPTY_HEADERS",
",",
"defaultMapper",
")",
";"... | Creates a new JSON Text Sequences of the specified {@code content}.
@param headers the HTTP headers supposed to send
@param content the object supposed to send as contents | [
"Creates",
"a",
"new",
"JSON",
"Text",
"Sequences",
"of",
"the",
"specified",
"{",
"@code",
"content",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java#L228-L230 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addInlineComment | public void addInlineComment(Element element, DocTree tag, Content htmltree) {
CommentHelper ch = utils.getCommentHelper(element);
List<? extends DocTree> description = ch.getDescription(configuration, tag);
addCommentTags(element, tag, description, false, false, htmltree);
} | java | public void addInlineComment(Element element, DocTree tag, Content htmltree) {
CommentHelper ch = utils.getCommentHelper(element);
List<? extends DocTree> description = ch.getDescription(configuration, tag);
addCommentTags(element, tag, description, false, false, htmltree);
} | [
"public",
"void",
"addInlineComment",
"(",
"Element",
"element",
",",
"DocTree",
"tag",
",",
"Content",
"htmltree",
")",
"{",
"CommentHelper",
"ch",
"=",
"utils",
".",
"getCommentHelper",
"(",
"element",
")",
";",
"List",
"<",
"?",
"extends",
"DocTree",
">",... | Add the inline comment.
@param element the Element for which the inline comment will be added
@param tag the inline tag to be added
@param htmltree the content tree to which the comment will be added | [
"Add",
"the",
"inline",
"comment",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1622-L1626 |
alkacon/opencms-core | src/org/opencms/ade/detailpage/CmsDetailPageResourceHandler.java | CmsDetailPageResourceHandler.isValidDetailPage | protected boolean isValidDetailPage(CmsObject cms, CmsResource page, CmsResource detailRes) {
if (OpenCms.getSystemInfo().isRestrictDetailContents()) {
// in 'restrict detail contents mode', do not allow detail contents from a real site on a detail page of a different real site
CmsSite pageSite = OpenCms.getSiteManager().getSiteForRootPath(page.getRootPath());
CmsSite detailSite = OpenCms.getSiteManager().getSiteForRootPath(detailRes.getRootPath());
if ((pageSite != null)
&& (detailSite != null)
&& !pageSite.getSiteRoot().equals(detailSite.getSiteRoot())) {
return false;
}
}
return OpenCms.getADEManager().isDetailPage(cms, page);
} | java | protected boolean isValidDetailPage(CmsObject cms, CmsResource page, CmsResource detailRes) {
if (OpenCms.getSystemInfo().isRestrictDetailContents()) {
// in 'restrict detail contents mode', do not allow detail contents from a real site on a detail page of a different real site
CmsSite pageSite = OpenCms.getSiteManager().getSiteForRootPath(page.getRootPath());
CmsSite detailSite = OpenCms.getSiteManager().getSiteForRootPath(detailRes.getRootPath());
if ((pageSite != null)
&& (detailSite != null)
&& !pageSite.getSiteRoot().equals(detailSite.getSiteRoot())) {
return false;
}
}
return OpenCms.getADEManager().isDetailPage(cms, page);
} | [
"protected",
"boolean",
"isValidDetailPage",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"page",
",",
"CmsResource",
"detailRes",
")",
"{",
"if",
"(",
"OpenCms",
".",
"getSystemInfo",
"(",
")",
".",
"isRestrictDetailContents",
"(",
")",
")",
"{",
"// in 'restri... | Checks whether the given detail page is valid for the given resource.<p>
@param cms the CMS context
@param page the detail page
@param detailRes the detail resource
@return true if the given detail page is valid | [
"Checks",
"whether",
"the",
"given",
"detail",
"page",
"is",
"valid",
"for",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/detailpage/CmsDetailPageResourceHandler.java#L214-L227 |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.removeFromSet | public void removeFromSet (String setName, Comparable<?> key)
{
requestEntryRemove(setName, getSet(setName), key);
} | java | public void removeFromSet (String setName, Comparable<?> key)
{
requestEntryRemove(setName, getSet(setName), key);
} | [
"public",
"void",
"removeFromSet",
"(",
"String",
"setName",
",",
"Comparable",
"<",
"?",
">",
"key",
")",
"{",
"requestEntryRemove",
"(",
"setName",
",",
"getSet",
"(",
"setName",
")",
",",
"key",
")",
";",
"}"
] | Request to have the specified key removed from the specified DSet. | [
"Request",
"to",
"have",
"the",
"specified",
"key",
"removed",
"from",
"the",
"specified",
"DSet",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L283-L286 |
google/error-prone-javac | src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java | Util.detectJdiExitEvent | public static void detectJdiExitEvent(VirtualMachine vm, Consumer<String> unbiddenExitHandler) {
if (vm.canBeModified()) {
new JdiEventHandler(vm, unbiddenExitHandler).start();
}
} | java | public static void detectJdiExitEvent(VirtualMachine vm, Consumer<String> unbiddenExitHandler) {
if (vm.canBeModified()) {
new JdiEventHandler(vm, unbiddenExitHandler).start();
}
} | [
"public",
"static",
"void",
"detectJdiExitEvent",
"(",
"VirtualMachine",
"vm",
",",
"Consumer",
"<",
"String",
">",
"unbiddenExitHandler",
")",
"{",
"if",
"(",
"vm",
".",
"canBeModified",
"(",
")",
")",
"{",
"new",
"JdiEventHandler",
"(",
"vm",
",",
"unbidde... | Monitor the JDI event stream for {@link com.sun.jdi.event.VMDeathEvent}
and {@link com.sun.jdi.event.VMDisconnectEvent}. If encountered, invokes
{@code unbiddenExitHandler}.
@param vm the virtual machine to check
@param unbiddenExitHandler the handler, which will accept the exit
information | [
"Monitor",
"the",
"JDI",
"event",
"stream",
"for",
"{",
"@link",
"com",
".",
"sun",
".",
"jdi",
".",
"event",
".",
"VMDeathEvent",
"}",
"and",
"{",
"@link",
"com",
".",
"sun",
".",
"jdi",
".",
"event",
".",
"VMDisconnectEvent",
"}",
".",
"If",
"encou... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java#L213-L217 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.