repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.findPermissions | public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName,
User user) {
requireNonNull(user, "user");
if (user.isAdmin()) {
return CompletableFuture.completedFuture(PerRolePermissions.ALL_PERMISSION);
}
if (user instanceof UserWithToken) {
return findPermissions(projectName, repoName, ((UserWithToken) user).token().appId());
} else {
return findPermissions0(projectName, repoName, user);
}
} | java | public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName,
User user) {
requireNonNull(user, "user");
if (user.isAdmin()) {
return CompletableFuture.completedFuture(PerRolePermissions.ALL_PERMISSION);
}
if (user instanceof UserWithToken) {
return findPermissions(projectName, repoName, ((UserWithToken) user).token().appId());
} else {
return findPermissions0(projectName, repoName, user);
}
} | [
"public",
"CompletableFuture",
"<",
"Collection",
"<",
"Permission",
">",
">",
"findPermissions",
"(",
"String",
"projectName",
",",
"String",
"repoName",
",",
"User",
"user",
")",
"{",
"requireNonNull",
"(",
"user",
",",
"\"user\"",
")",
";",
"if",
"(",
"us... | Finds {@link Permission}s which belong to the specified {@link User} or {@link UserWithToken}
from the specified {@code repoName} in the specified {@code projectName}. | [
"Finds",
"{"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L585-L596 |
nextreports/nextreports-engine | src/ro/nextreports/engine/queryexec/util/QueryResultPrinter.java | QueryResultPrinter.overwrite | static void overwrite(StringBuffer sb, int pos, String s) {
int len = s.length();
for (int i = 0; i < len; i++) {
sb.setCharAt(pos + i, s.charAt(i));
}
} | java | static void overwrite(StringBuffer sb, int pos, String s) {
int len = s.length();
for (int i = 0; i < len; i++) {
sb.setCharAt(pos + i, s.charAt(i));
}
} | [
"static",
"void",
"overwrite",
"(",
"StringBuffer",
"sb",
",",
"int",
"pos",
",",
"String",
"s",
")",
"{",
"int",
"len",
"=",
"s",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",... | This utility method is used when printing the table of results. | [
"This",
"utility",
"method",
"is",
"used",
"when",
"printing",
"the",
"table",
"of",
"results",
"."
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/queryexec/util/QueryResultPrinter.java#L154-L159 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/AbstractReplicatorConfiguration.java | AbstractReplicatorConfiguration.setHeaders | @NonNull
public ReplicatorConfiguration setHeaders(Map<String, String> headers) {
if (readonly) { throw new IllegalStateException("ReplicatorConfiguration is readonly mode."); }
this.headers = new HashMap<>(headers);
return getReplicatorConfiguration();
} | java | @NonNull
public ReplicatorConfiguration setHeaders(Map<String, String> headers) {
if (readonly) { throw new IllegalStateException("ReplicatorConfiguration is readonly mode."); }
this.headers = new HashMap<>(headers);
return getReplicatorConfiguration();
} | [
"@",
"NonNull",
"public",
"ReplicatorConfiguration",
"setHeaders",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"if",
"(",
"readonly",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"ReplicatorConfiguration is readonly mode.\"",
")"... | Sets the extra HTTP headers to send in all requests to the remote target.
@param headers The HTTP Headers.
@return The self object. | [
"Sets",
"the",
"extra",
"HTTP",
"headers",
"to",
"send",
"in",
"all",
"requests",
"to",
"the",
"remote",
"target",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/AbstractReplicatorConfiguration.java#L194-L199 |
ocelotds/ocelot | ocelot-dashboard/src/main/java/org/ocelotds/dashboard/services/ServiceTools.java | ServiceTools.getTemplateOfMap | String getTemplateOfMap(Type[] actualTypeArguments, IJsonMarshaller jsonMarshaller) {
StringBuilder res = new StringBuilder("{");
boolean first = true;
for (Type actualTypeArgument : actualTypeArguments) {
if (!first) {
res.append(":");
}
res.append(_getTemplateOfType(actualTypeArgument, jsonMarshaller));
first = false;
}
res.append("}");
return res.toString();
} | java | String getTemplateOfMap(Type[] actualTypeArguments, IJsonMarshaller jsonMarshaller) {
StringBuilder res = new StringBuilder("{");
boolean first = true;
for (Type actualTypeArgument : actualTypeArguments) {
if (!first) {
res.append(":");
}
res.append(_getTemplateOfType(actualTypeArgument, jsonMarshaller));
first = false;
}
res.append("}");
return res.toString();
} | [
"String",
"getTemplateOfMap",
"(",
"Type",
"[",
"]",
"actualTypeArguments",
",",
"IJsonMarshaller",
"jsonMarshaller",
")",
"{",
"StringBuilder",
"res",
"=",
"new",
"StringBuilder",
"(",
"\"{\"",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Type... | Get template of map class from generic type
@param actualTypeArguments
@return | [
"Get",
"template",
"of",
"map",
"class",
"from",
"generic",
"type"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-dashboard/src/main/java/org/ocelotds/dashboard/services/ServiceTools.java#L283-L295 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java | ApiOvhEmailpro.service_domain_GET | public ArrayList<String> service_domain_GET(String service, OvhObjectStateEnum state) throws IOException {
String qPath = "/email/pro/{service}/domain";
StringBuilder sb = path(qPath, service);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<String> service_domain_GET(String service, OvhObjectStateEnum state) throws IOException {
String qPath = "/email/pro/{service}/domain";
StringBuilder sb = path(qPath, service);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"service_domain_GET",
"(",
"String",
"service",
",",
"OvhObjectStateEnum",
"state",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/pro/{service}/domain\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",... | Domains associated to this service
REST: GET /email/pro/{service}/domain
@param state [required] Filter the value of state property (=)
@param service [required] The internal name of your pro organization
API beta | [
"Domains",
"associated",
"to",
"this",
"service"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L728-L734 |
hal/core | gui/src/main/java/org/jboss/as/console/client/widgets/CollapsibleSplitLayoutPanel.java | CollapsibleSplitLayoutPanel.setWidgetToggleDisplayAllowed | public void setWidgetToggleDisplayAllowed(Widget child, boolean allowed) {
assertIsChild(child);
Splitter splitter = getAssociatedSplitter(child);
// The splitter is null for the center element.
if (splitter != null) {
splitter.setToggleDisplayAllowed(allowed);
}
} | java | public void setWidgetToggleDisplayAllowed(Widget child, boolean allowed) {
assertIsChild(child);
Splitter splitter = getAssociatedSplitter(child);
// The splitter is null for the center element.
if (splitter != null) {
splitter.setToggleDisplayAllowed(allowed);
}
} | [
"public",
"void",
"setWidgetToggleDisplayAllowed",
"(",
"Widget",
"child",
",",
"boolean",
"allowed",
")",
"{",
"assertIsChild",
"(",
"child",
")",
";",
"Splitter",
"splitter",
"=",
"getAssociatedSplitter",
"(",
"child",
")",
";",
"// The splitter is null for the cent... | Sets whether or not double-clicking on the splitter should toggle the
display of the widget.
@param child the child whose display toggling will be allowed or not.
@param allowed whether or not display toggling is allowed for this widget | [
"Sets",
"whether",
"or",
"not",
"double",
"-",
"clicking",
"on",
"the",
"splitter",
"should",
"toggle",
"the",
"display",
"of",
"the",
"widget",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/widgets/CollapsibleSplitLayoutPanel.java#L456-L463 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/PausableScheduledThreadPoolExecutor.java | PausableScheduledThreadPoolExecutor.submit | @Override
public <T> Future<T> submit(Runnable task, T result) {
return schedule(Executors.callable(task, result), getDefaultDelayForTask(), TimeUnit.MILLISECONDS);
} | java | @Override
public <T> Future<T> submit(Runnable task, T result) {
return schedule(Executors.callable(task, result), getDefaultDelayForTask(), TimeUnit.MILLISECONDS);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"submit",
"(",
"Runnable",
"task",
",",
"T",
"result",
")",
"{",
"return",
"schedule",
"(",
"Executors",
".",
"callable",
"(",
"task",
",",
"result",
")",
",",
"getDefaultDelayForTask",
... | {@inheritDoc}
<p>
Overridden to schedule with default delay, when non zero.
@throws RejectedExecutionException {@inheritDoc}
@throws NullPointerException {@inheritDoc}
@see #setIncrementalDefaultDelay(boolean)
@see #schedule(Runnable, long, TimeUnit)
@see #setDefaultDelay(long, TimeUnit) | [
"{",
"@inheritDoc",
"}",
"<p",
">",
"Overridden",
"to",
"schedule",
"with",
"default",
"delay",
"when",
"non",
"zero",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/PausableScheduledThreadPoolExecutor.java#L252-L255 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java | CopySource.serializeCopyableDataset | public static void serializeCopyableDataset(State state, CopyableDatasetMetadata copyableDataset) {
state.setProp(SERIALIZED_COPYABLE_DATASET, copyableDataset.serialize());
} | java | public static void serializeCopyableDataset(State state, CopyableDatasetMetadata copyableDataset) {
state.setProp(SERIALIZED_COPYABLE_DATASET, copyableDataset.serialize());
} | [
"public",
"static",
"void",
"serializeCopyableDataset",
"(",
"State",
"state",
",",
"CopyableDatasetMetadata",
"copyableDataset",
")",
"{",
"state",
".",
"setProp",
"(",
"SERIALIZED_COPYABLE_DATASET",
",",
"copyableDataset",
".",
"serialize",
"(",
")",
")",
";",
"}"... | Serialize a {@link CopyableDataset} into a {@link State} at {@link #SERIALIZED_COPYABLE_DATASET} | [
"Serialize",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java#L535-L537 |
tommyettinger/RegExodus | src/main/java/regexodus/ds/CharArrayList.java | CharArrayList.objectUnwrap | private static <K> int objectUnwrap(final Iterator<? extends K> i, final K array[]) {
int j = array.length, offset = 0;
while (j-- != 0 && i.hasNext())
array[offset++] = i.next();
return array.length - j - 1;
} | java | private static <K> int objectUnwrap(final Iterator<? extends K> i, final K array[]) {
int j = array.length, offset = 0;
while (j-- != 0 && i.hasNext())
array[offset++] = i.next();
return array.length - j - 1;
} | [
"private",
"static",
"<",
"K",
">",
"int",
"objectUnwrap",
"(",
"final",
"Iterator",
"<",
"?",
"extends",
"K",
">",
"i",
",",
"final",
"K",
"array",
"[",
"]",
")",
"{",
"int",
"j",
"=",
"array",
".",
"length",
",",
"offset",
"=",
"0",
";",
"while... | Unwraps an iterator into an array starting at a given offset for a given number of elements.
<br>This method iterates over the given type-specific iterator and stores the elements returned, up to a maximum of <code>length</code>, in the given array starting at <code>offset</code>. The
number of actually unwrapped elements is returned (it may be less than <code>max</code> if the iterator emits less than <code>max</code> elements).
@param i a type-specific iterator.
@param array an array to contain the output of the iterator.
@return the number of elements unwrapped. | [
"Unwraps",
"an",
"iterator",
"into",
"an",
"array",
"starting",
"at",
"a",
"given",
"offset",
"for",
"a",
"given",
"number",
"of",
"elements",
".",
"<br",
">",
"This",
"method",
"iterates",
"over",
"the",
"given",
"type",
"-",
"specific",
"iterator",
"and"... | train | https://github.com/tommyettinger/RegExodus/blob/d4af9bb7c132c5f9d29f45b76121f93b2f89de16/src/main/java/regexodus/ds/CharArrayList.java#L925-L930 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java | TarEntry.getDirectoryEntries | public TarEntry[] getDirectoryEntries() throws InvalidHeaderException {
if (this.file == null || !this.file.isDirectory()) {
return new TarEntry[0];
}
String[] list = this.file.list();
TarEntry[] result = new TarEntry[list.length];
for (int i = 0; i < list.length; ++i) {
result[i] = new TarEntry(new File(this.file, list[i]));
}
return result;
} | java | public TarEntry[] getDirectoryEntries() throws InvalidHeaderException {
if (this.file == null || !this.file.isDirectory()) {
return new TarEntry[0];
}
String[] list = this.file.list();
TarEntry[] result = new TarEntry[list.length];
for (int i = 0; i < list.length; ++i) {
result[i] = new TarEntry(new File(this.file, list[i]));
}
return result;
} | [
"public",
"TarEntry",
"[",
"]",
"getDirectoryEntries",
"(",
")",
"throws",
"InvalidHeaderException",
"{",
"if",
"(",
"this",
".",
"file",
"==",
"null",
"||",
"!",
"this",
".",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"new",
"TarEntry",
"... | If this entry represents a file, and the file is a directory, return an array of TarEntries for this entry's
children.
@return An array of TarEntry's for this entry's children. | [
"If",
"this",
"entry",
"represents",
"a",
"file",
"and",
"the",
"file",
"is",
"a",
"directory",
"return",
"an",
"array",
"of",
"TarEntries",
"for",
"this",
"entry",
"s",
"children",
"."
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarEntry.java#L594-L608 |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/interpreter/collection/CollectionInterpreter.java | CollectionInterpreter.executeRow | private void executeRow(Example valuesRow, Example headers, Fixture rowFixtureAdapter)
{
valuesRow.annotate( Annotations.right() );
Statistics rowStats = new Statistics();
for (int i = 0; i != valuesRow.remainings(); ++i)
{
Example cell = valuesRow.at( i );
if (i < headers.remainings())
{
// We can do the cast because #parseColumn returns an ExpectedColumn
ExpectedColumn column = (ExpectedColumn) columns[i];
try
{
chekOneCell(rowFixtureAdapter, rowStats, cell, column);
}
catch (Exception e)
{
cell.annotate( exception( e ) );
stats.exception();
}
}
else
{
cell.annotate( ignored( cell.getContent() ) );
}
}
applyRowStatistic(rowStats);
} | java | private void executeRow(Example valuesRow, Example headers, Fixture rowFixtureAdapter)
{
valuesRow.annotate( Annotations.right() );
Statistics rowStats = new Statistics();
for (int i = 0; i != valuesRow.remainings(); ++i)
{
Example cell = valuesRow.at( i );
if (i < headers.remainings())
{
// We can do the cast because #parseColumn returns an ExpectedColumn
ExpectedColumn column = (ExpectedColumn) columns[i];
try
{
chekOneCell(rowFixtureAdapter, rowStats, cell, column);
}
catch (Exception e)
{
cell.annotate( exception( e ) );
stats.exception();
}
}
else
{
cell.annotate( ignored( cell.getContent() ) );
}
}
applyRowStatistic(rowStats);
} | [
"private",
"void",
"executeRow",
"(",
"Example",
"valuesRow",
",",
"Example",
"headers",
",",
"Fixture",
"rowFixtureAdapter",
")",
"{",
"valuesRow",
".",
"annotate",
"(",
"Annotations",
".",
"right",
"(",
")",
")",
";",
"Statistics",
"rowStats",
"=",
"new",
... | <p>executeRow.</p>
@param valuesRow a {@link com.greenpepper.Example} object.
@param headers a {@link com.greenpepper.Example} object.
@param rowFixtureAdapter a {@link com.greenpepper.reflect.Fixture} object. | [
"<p",
">",
"executeRow",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/interpreter/collection/CollectionInterpreter.java#L118-L149 |
alkacon/opencms-core | src/org/opencms/main/CmsShellCommands.java | CmsShellCommands.setLoginMessage | public void setLoginMessage(String messageText, boolean loginDisabled) throws CmsRoleViolationException {
CmsLoginMessage message = new CmsLoginMessage(0, 0, messageText, loginDisabled);
OpenCms.getLoginManager().setLoginMessage(m_cms, message);
OpenCms.writeConfiguration(CmsVariablesConfiguration.class);
} | java | public void setLoginMessage(String messageText, boolean loginDisabled) throws CmsRoleViolationException {
CmsLoginMessage message = new CmsLoginMessage(0, 0, messageText, loginDisabled);
OpenCms.getLoginManager().setLoginMessage(m_cms, message);
OpenCms.writeConfiguration(CmsVariablesConfiguration.class);
} | [
"public",
"void",
"setLoginMessage",
"(",
"String",
"messageText",
",",
"boolean",
"loginDisabled",
")",
"throws",
"CmsRoleViolationException",
"{",
"CmsLoginMessage",
"message",
"=",
"new",
"CmsLoginMessage",
"(",
"0",
",",
"0",
",",
"messageText",
",",
"loginDisab... | Sets the login message.<p>
@param messageText the message text
@param loginDisabled true if login should be disabled
@throws CmsRoleViolationException when this is not called with the correct privileges | [
"Sets",
"the",
"login",
"message",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1554-L1559 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java | StreamSegmentReadIndex.checkReadAvailability | private ReadAvailability checkReadAvailability(long offset, boolean lastOffsetInclusive) {
// We can only read at a particular offset if:
// * The offset is not before the Segment's StartOffset
// AND
// * The segment is not sealed (we are allowed to do a future read) OR
// * The segment is sealed and we are not trying to read at or beyond the last offset (based on input).
if (offset < this.metadata.getStartOffset()) {
return ReadAvailability.BeforeStartOffset;
} else if (this.metadata.isSealed()) {
return offset < (this.metadata.getLength() + (lastOffsetInclusive ? 1 : 0))
? ReadAvailability.Available
: ReadAvailability.BeyondLastOffset;
}
// Offset is in a valid range.
return ReadAvailability.Available;
} | java | private ReadAvailability checkReadAvailability(long offset, boolean lastOffsetInclusive) {
// We can only read at a particular offset if:
// * The offset is not before the Segment's StartOffset
// AND
// * The segment is not sealed (we are allowed to do a future read) OR
// * The segment is sealed and we are not trying to read at or beyond the last offset (based on input).
if (offset < this.metadata.getStartOffset()) {
return ReadAvailability.BeforeStartOffset;
} else if (this.metadata.isSealed()) {
return offset < (this.metadata.getLength() + (lastOffsetInclusive ? 1 : 0))
? ReadAvailability.Available
: ReadAvailability.BeyondLastOffset;
}
// Offset is in a valid range.
return ReadAvailability.Available;
} | [
"private",
"ReadAvailability",
"checkReadAvailability",
"(",
"long",
"offset",
",",
"boolean",
"lastOffsetInclusive",
")",
"{",
"// We can only read at a particular offset if:",
"// * The offset is not before the Segment's StartOffset",
"// AND",
"// * The segment is not sealed (we are a... | Determines the availability of reading at a particular offset, given the state of a segment.
@param offset The offset to check.
@param lastOffsetInclusive If true, it will consider the last offset of the segment as a valid offset, otherwise
it will only validate offsets before the last offset in the segment.
@return A ReadAvailability based on the Segment's current state and the given offset. This will return Available
unless the given offset is before the Segment's StartOffset or beyond its Length and the Segment is Sealed. | [
"Determines",
"the",
"availability",
"of",
"reading",
"at",
"a",
"particular",
"offset",
"given",
"the",
"state",
"of",
"a",
"segment",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java#L707-L723 |
sarxos/webcam-capture | webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java | Webcam.getImage | public BufferedImage getImage() {
if (!isReady()) {
return null;
}
long t1 = 0;
long t2 = 0;
if (asynchronous) {
return updater.getImage();
} else {
// get image
t1 = System.currentTimeMillis();
BufferedImage image = transform(new WebcamGetImageTask(driver, device).getImage());
t2 = System.currentTimeMillis();
if (image == null) {
return null;
}
// get FPS
if (device instanceof WebcamDevice.FPSSource) {
fps = ((WebcamDevice.FPSSource) device).getFPS();
} else {
// +1 to avoid division by zero
fps = (4 * fps + 1000 / (t2 - t1 + 1)) / 5;
}
// notify webcam listeners about new image available
notifyWebcamImageAcquired(image);
return image;
}
} | java | public BufferedImage getImage() {
if (!isReady()) {
return null;
}
long t1 = 0;
long t2 = 0;
if (asynchronous) {
return updater.getImage();
} else {
// get image
t1 = System.currentTimeMillis();
BufferedImage image = transform(new WebcamGetImageTask(driver, device).getImage());
t2 = System.currentTimeMillis();
if (image == null) {
return null;
}
// get FPS
if (device instanceof WebcamDevice.FPSSource) {
fps = ((WebcamDevice.FPSSource) device).getFPS();
} else {
// +1 to avoid division by zero
fps = (4 * fps + 1000 / (t2 - t1 + 1)) / 5;
}
// notify webcam listeners about new image available
notifyWebcamImageAcquired(image);
return image;
}
} | [
"public",
"BufferedImage",
"getImage",
"(",
")",
"{",
"if",
"(",
"!",
"isReady",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"long",
"t1",
"=",
"0",
";",
"long",
"t2",
"=",
"0",
";",
"if",
"(",
"asynchronous",
")",
"{",
"return",
"updater",
"... | Capture image from webcam and return it. Will return image object or null if webcam is closed
or has been already disposed by JVM.<br>
<br>
<b>IMPORTANT NOTE!!!</b><br>
<br>
There are two possible behaviors of what webcam should do when you try to get image and
webcam is actually closed. Normally it will return null, but there is a special flag which
can be statically set to switch all webcams to auto open mode. In this mode, webcam will be
automatically open, when you try to get image from closed webcam. Please be aware of some
side effects! In case of multi-threaded applications, there is no guarantee that one thread
will not try to open webcam even if it was manually closed in different thread.
@return Captured image or null if webcam is closed or disposed by JVM | [
"Capture",
"image",
"from",
"webcam",
"and",
"return",
"it",
".",
"Will",
"return",
"image",
"object",
"or",
"null",
"if",
"webcam",
"is",
"closed",
"or",
"has",
"been",
"already",
"disposed",
"by",
"JVM",
".",
"<br",
">",
"<br",
">",
"<b",
">",
"IMPOR... | train | https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java#L645-L683 |
apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/common/io/NativeIO.java | NativeIO.trySkipCache | public static void trySkipCache(int fd, long offset, long len)
{
if (!initialized || !fadvisePossible || fd < 0) {
return;
}
try {
// we ignore the return value as this is just best effort to avoid the cache
posix_fadvise(fd, offset, len, POSIX_FADV_DONTNEED);
}
catch (UnsupportedOperationException uoe) {
log.warn(uoe, "posix_fadvise is not supported");
fadvisePossible = false;
}
catch (UnsatisfiedLinkError ule) {
// if JNA is unavailable just skipping Direct I/O
// instance of this class will act like normal RandomAccessFile
log.warn(ule, "Unsatisfied Link error: posix_fadvise failed on file descriptor [%d], offset [%d]",
fd, offset);
fadvisePossible = false;
}
catch (Exception e) {
// This is best effort anyway so lets just log that there was an
// exception and forget
log.warn(e, "Unknown exception: posix_fadvise failed on file descriptor [%d], offset [%d]",
fd, offset);
}
} | java | public static void trySkipCache(int fd, long offset, long len)
{
if (!initialized || !fadvisePossible || fd < 0) {
return;
}
try {
// we ignore the return value as this is just best effort to avoid the cache
posix_fadvise(fd, offset, len, POSIX_FADV_DONTNEED);
}
catch (UnsupportedOperationException uoe) {
log.warn(uoe, "posix_fadvise is not supported");
fadvisePossible = false;
}
catch (UnsatisfiedLinkError ule) {
// if JNA is unavailable just skipping Direct I/O
// instance of this class will act like normal RandomAccessFile
log.warn(ule, "Unsatisfied Link error: posix_fadvise failed on file descriptor [%d], offset [%d]",
fd, offset);
fadvisePossible = false;
}
catch (Exception e) {
// This is best effort anyway so lets just log that there was an
// exception and forget
log.warn(e, "Unknown exception: posix_fadvise failed on file descriptor [%d], offset [%d]",
fd, offset);
}
} | [
"public",
"static",
"void",
"trySkipCache",
"(",
"int",
"fd",
",",
"long",
"offset",
",",
"long",
"len",
")",
"{",
"if",
"(",
"!",
"initialized",
"||",
"!",
"fadvisePossible",
"||",
"fd",
"<",
"0",
")",
"{",
"return",
";",
"}",
"try",
"{",
"// we ign... | Remove pages from the file system page cache when they wont
be accessed again
@param fd The file descriptor of the source file.
@param offset The offset within the file.
@param len The length to be flushed. | [
"Remove",
"pages",
"from",
"the",
"file",
"system",
"page",
"cache",
"when",
"they",
"wont",
"be",
"accessed",
"again"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/io/NativeIO.java#L131-L157 |
grails/grails-core | grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java | WebUtils.resolveView | public static View resolveView(HttpServletRequest request, String viewName, String controllerName, ViewResolver viewResolver) throws Exception {
GrailsWebRequest webRequest = GrailsWebRequest.lookup(request);
Locale locale = webRequest != null ? webRequest.getLocale() : Locale.getDefault() ;
return viewResolver.resolveViewName(addViewPrefix(viewName, controllerName), locale);
} | java | public static View resolveView(HttpServletRequest request, String viewName, String controllerName, ViewResolver viewResolver) throws Exception {
GrailsWebRequest webRequest = GrailsWebRequest.lookup(request);
Locale locale = webRequest != null ? webRequest.getLocale() : Locale.getDefault() ;
return viewResolver.resolveViewName(addViewPrefix(viewName, controllerName), locale);
} | [
"public",
"static",
"View",
"resolveView",
"(",
"HttpServletRequest",
"request",
",",
"String",
"viewName",
",",
"String",
"controllerName",
",",
"ViewResolver",
"viewResolver",
")",
"throws",
"Exception",
"{",
"GrailsWebRequest",
"webRequest",
"=",
"GrailsWebRequest",
... | Resolves a view for the given view name and controller name
@param request The request
@param viewName The view name
@param controllerName The controller name
@param viewResolver The resolver
@return A View or null
@throws Exception Thrown if an error occurs | [
"Resolves",
"a",
"view",
"for",
"the",
"given",
"view",
"name",
"and",
"controller",
"name"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java#L191-L195 |
openbase/jul | extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java | TimestampProcessor.updateTimestampWithCurrentTime | public static <M extends MessageOrBuilder> M updateTimestampWithCurrentTime(final M messageOrBuilder, final Logger logger) {
try {
return updateTimestampWithCurrentTime(messageOrBuilder);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return messageOrBuilder;
}
} | java | public static <M extends MessageOrBuilder> M updateTimestampWithCurrentTime(final M messageOrBuilder, final Logger logger) {
try {
return updateTimestampWithCurrentTime(messageOrBuilder);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return messageOrBuilder;
}
} | [
"public",
"static",
"<",
"M",
"extends",
"MessageOrBuilder",
">",
"M",
"updateTimestampWithCurrentTime",
"(",
"final",
"M",
"messageOrBuilder",
",",
"final",
"Logger",
"logger",
")",
"{",
"try",
"{",
"return",
"updateTimestampWithCurrentTime",
"(",
"messageOrBuilder",... | Method updates the timestamp field of the given message with the current time.
In case of an error the original message is returned.
@param <M> the message type of the message to update.
@param messageOrBuilder the message
@param logger the logger which is used for printing the exception stack in case something went wrong.
@return the updated message or the original one in case of errors. | [
"Method",
"updates",
"the",
"timestamp",
"field",
"of",
"the",
"given",
"message",
"with",
"the",
"current",
"time",
".",
"In",
"case",
"of",
"an",
"error",
"the",
"original",
"message",
"is",
"returned",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java#L232-L239 |
jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Assert.java | Assert.notEmpty | public static void notEmpty(Object[] array, String message) {
if (Objects.isEmpty(array)) {
throw new IllegalArgumentException(message);
}
} | java | public static void notEmpty(Object[] array, String message) {
if (Objects.isEmpty(array)) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"Object",
"[",
"]",
"array",
",",
"String",
"message",
")",
"{",
"if",
"(",
"Objects",
".",
"isEmpty",
"(",
"array",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
... | Assert that an array has elements; that is, it must not be
<code>null</code> and must have at least one element.
<pre class="code">Assert.notEmpty(array, "The array must have elements");</pre>
@param array the array to check
@param message the exception message to use if the assertion fails
@throws IllegalArgumentException if the object array is <code>null</code> or has no elements | [
"Assert",
"that",
"an",
"array",
"has",
"elements",
";",
"that",
"is",
"it",
"must",
"not",
"be",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"must",
"have",
"at",
"least",
"one",
"element",
".",
"<pre",
"class",
"=",
"code",
">",
"Assert",
".",
... | train | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Assert.java#L182-L186 |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/MatMulFunction.java | MatMulFunction.call | @Override
public MatMulOutput call(final MatMulInput input) throws Exception {
final int index = input.getIndex();
final Matrix<Double> leftMatrix = input.getLeftMatrix();
final Matrix<Double> rightMatrix = input.getRightMatrix();
final Matrix<Double> result = leftMatrix.multiply(rightMatrix);
return new MatMulOutput(index, result);
} | java | @Override
public MatMulOutput call(final MatMulInput input) throws Exception {
final int index = input.getIndex();
final Matrix<Double> leftMatrix = input.getLeftMatrix();
final Matrix<Double> rightMatrix = input.getRightMatrix();
final Matrix<Double> result = leftMatrix.multiply(rightMatrix);
return new MatMulOutput(index, result);
} | [
"@",
"Override",
"public",
"MatMulOutput",
"call",
"(",
"final",
"MatMulInput",
"input",
")",
"throws",
"Exception",
"{",
"final",
"int",
"index",
"=",
"input",
".",
"getIndex",
"(",
")",
";",
"final",
"Matrix",
"<",
"Double",
">",
"leftMatrix",
"=",
"inpu... | Computes multiplication of two matrices.
@param input Input which contains two matrices to multiply,
and index of the sub-matrix in the entire result.
@return Output which contains the sub-matrix and index of it in the entire result.
@throws Exception If the two matrices cannot be multiplied. | [
"Computes",
"multiplication",
"of",
"two",
"matrices",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/MatMulFunction.java#L34-L41 |
pravega/pravega | common/src/main/java/io/pravega/common/util/BitConverter.java | BitConverter.writeLong | public static int writeLong(ArrayView target, int offset, long value) {
return writeLong(target.array(), target.arrayOffset() + offset, value);
} | java | public static int writeLong(ArrayView target, int offset, long value) {
return writeLong(target.array(), target.arrayOffset() + offset, value);
} | [
"public",
"static",
"int",
"writeLong",
"(",
"ArrayView",
"target",
",",
"int",
"offset",
",",
"long",
"value",
")",
"{",
"return",
"writeLong",
"(",
"target",
".",
"array",
"(",
")",
",",
"target",
".",
"arrayOffset",
"(",
")",
"+",
"offset",
",",
"va... | Writes the given 64-bit Long to the given ArrayView at the given offset.
@param target The ArrayView to write to.
@param offset The offset within the ArrayView to write at.
@param value The value to write.
@return The number of bytes written. | [
"Writes",
"the",
"given",
"64",
"-",
"bit",
"Long",
"to",
"the",
"given",
"ArrayView",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L171-L173 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/Transition.java | Transition.excludeChildren | @NonNull
public Transition excludeChildren(@Nullable View target, boolean exclude) {
mTargetChildExcludes = excludeObject(mTargetChildExcludes, target, exclude);
return this;
} | java | @NonNull
public Transition excludeChildren(@Nullable View target, boolean exclude) {
mTargetChildExcludes = excludeObject(mTargetChildExcludes, target, exclude);
return this;
} | [
"@",
"NonNull",
"public",
"Transition",
"excludeChildren",
"(",
"@",
"Nullable",
"View",
"target",
",",
"boolean",
"exclude",
")",
"{",
"mTargetChildExcludes",
"=",
"excludeObject",
"(",
"mTargetChildExcludes",
",",
"target",
",",
"exclude",
")",
";",
"return",
... | Whether to add the children of given target to the list of target children
to exclude from this transition. The <code>exclude</code> parameter specifies
whether the target should be added to or removed from the excluded list.
<p/>
<p>Excluding targets is a general mechanism for allowing transitions to run on
a view hierarchy while skipping target views that should not be part of
the transition. For example, you may want to avoid animating children
of a specific ListView or Spinner. Views can be excluded either by their
id, or by their instance reference, or by the Class of that view
(eg, {@link Spinner}).</p>
@param target The target to ignore when running this transition.
@param exclude Whether to add the target to or remove the target from the
current list of excluded targets.
@return This transition object.
@see #excludeTarget(View, boolean)
@see #excludeChildren(int, boolean)
@see #excludeChildren(Class, boolean) | [
"Whether",
"to",
"add",
"the",
"children",
"of",
"given",
"target",
"to",
"the",
"list",
"of",
"target",
"children",
"to",
"exclude",
"from",
"this",
"transition",
".",
"The",
"<code",
">",
"exclude<",
"/",
"code",
">",
"parameter",
"specifies",
"whether",
... | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/Transition.java#L1251-L1255 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/extras/Poi.java | Poi.setLat | public void setLat(final int LAT_DEG, final double LAT_MIN) {
this.lat = convert(LAT_DEG, LAT_MIN);
this.LOCATION.setLocation(this.lat, this.lon);
adjustDirection();
} | java | public void setLat(final int LAT_DEG, final double LAT_MIN) {
this.lat = convert(LAT_DEG, LAT_MIN);
this.LOCATION.setLocation(this.lat, this.lon);
adjustDirection();
} | [
"public",
"void",
"setLat",
"(",
"final",
"int",
"LAT_DEG",
",",
"final",
"double",
"LAT_MIN",
")",
"{",
"this",
".",
"lat",
"=",
"convert",
"(",
"LAT_DEG",
",",
"LAT_MIN",
")",
";",
"this",
".",
"LOCATION",
".",
"setLocation",
"(",
"this",
".",
"lat",... | Sets the latitude of the poi in the format
7° 20.123'
@param LAT_DEG
@param LAT_MIN | [
"Sets",
"the",
"latitude",
"of",
"the",
"poi",
"in",
"the",
"format",
"7°",
"20",
".",
"123"
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Poi.java#L285-L289 |
jtmelton/appsensor | analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java | AggregateEventAnalysisEngine.findMostRecentAttackTime | protected DateTime findMostRecentAttackTime(Event triggerEvent, Rule rule) {
DateTime newest = DateUtils.epoch();
SearchCriteria criteria = new SearchCriteria().
setUser(new User(triggerEvent.getUser().getUsername())).
setRule(rule).
setDetectionSystemIds(appSensorServer.getConfiguration().getRelatedDetectionSystems(triggerEvent.getDetectionSystem()));
Collection<Attack> attacks = appSensorServer.getAttackStore().findAttacks(criteria);
for (Attack attack : attacks) {
if (attack.getRule().guidMatches(rule)) {
if (DateUtils.fromString(attack.getTimestamp()).isAfter(newest)) {
newest = DateUtils.fromString(attack.getTimestamp());
}
}
}
return newest;
} | java | protected DateTime findMostRecentAttackTime(Event triggerEvent, Rule rule) {
DateTime newest = DateUtils.epoch();
SearchCriteria criteria = new SearchCriteria().
setUser(new User(triggerEvent.getUser().getUsername())).
setRule(rule).
setDetectionSystemIds(appSensorServer.getConfiguration().getRelatedDetectionSystems(triggerEvent.getDetectionSystem()));
Collection<Attack> attacks = appSensorServer.getAttackStore().findAttacks(criteria);
for (Attack attack : attacks) {
if (attack.getRule().guidMatches(rule)) {
if (DateUtils.fromString(attack.getTimestamp()).isAfter(newest)) {
newest = DateUtils.fromString(attack.getTimestamp());
}
}
}
return newest;
} | [
"protected",
"DateTime",
"findMostRecentAttackTime",
"(",
"Event",
"triggerEvent",
",",
"Rule",
"rule",
")",
"{",
"DateTime",
"newest",
"=",
"DateUtils",
".",
"epoch",
"(",
")",
";",
"SearchCriteria",
"criteria",
"=",
"new",
"SearchCriteria",
"(",
")",
".",
"s... | Finds the most recent {@link Attack} from the {@link Rule} being evaluated.
@param triggerEvent the {@link Event} that triggered the {@link Rule}
@param rule the {@link Rule} being evaluated
@return a {@link DateTime} of the most recent attack related to the {@link Rule} | [
"Finds",
"the",
"most",
"recent",
"{",
"@link",
"Attack",
"}",
"from",
"the",
"{",
"@link",
"Rule",
"}",
"being",
"evaluated",
"."
] | train | https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java#L301-L320 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java | PAbstractObject.getObject | @Override
public final PObject getObject(final String key) {
PObject result = optObject(key);
if (result == null) {
throw new ObjectMissingException(this, key);
}
return result;
} | java | @Override
public final PObject getObject(final String key) {
PObject result = optObject(key);
if (result == null) {
throw new ObjectMissingException(this, key);
}
return result;
} | [
"@",
"Override",
"public",
"final",
"PObject",
"getObject",
"(",
"final",
"String",
"key",
")",
"{",
"PObject",
"result",
"=",
"optObject",
"(",
"key",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"ObjectMissingException",
"(",
... | Get a property as a object or throw exception.
@param key the property name | [
"Get",
"a",
"property",
"as",
"a",
"object",
"or",
"throw",
"exception",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L180-L187 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java | TransformerHandlerImpl.setResult | public void setResult(Result result) throws IllegalArgumentException
{
if (null == result)
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"result should not be null");
try
{
// ContentHandler handler =
// m_transformer.createResultContentHandler(result);
// m_transformer.setContentHandler(handler);
SerializationHandler xoh =
m_transformer.createSerializationHandler(result);
m_transformer.setSerializationHandler(xoh);
}
catch (javax.xml.transform.TransformerException te)
{
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_COULD_NOT_BE_SET, null)); //"result could not be set");
}
m_result = result;
} | java | public void setResult(Result result) throws IllegalArgumentException
{
if (null == result)
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"result should not be null");
try
{
// ContentHandler handler =
// m_transformer.createResultContentHandler(result);
// m_transformer.setContentHandler(handler);
SerializationHandler xoh =
m_transformer.createSerializationHandler(result);
m_transformer.setSerializationHandler(xoh);
}
catch (javax.xml.transform.TransformerException te)
{
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_COULD_NOT_BE_SET, null)); //"result could not be set");
}
m_result = result;
} | [
"public",
"void",
"setResult",
"(",
"Result",
"result",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"null",
"==",
"result",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"XSLMessages",
".",
"createMessage",
"(",
"XSLTErrorResources",
".",
"E... | Enables the user of the TransformerHandler to set the
to set the Result for the transformation.
@param result A Result instance, should not be null.
@throws IllegalArgumentException if result is invalid for some reason. | [
"Enables",
"the",
"user",
"of",
"the",
"TransformerHandler",
"to",
"set",
"the",
"to",
"set",
"the",
"Result",
"for",
"the",
"transformation",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerHandlerImpl.java#L174-L195 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java | JSONHelpers.optJSONObject | public static <P extends Enum<P>> JSONObject optJSONObject(final JSONObject json, P e) {
return json.optJSONObject(e.name());
} | java | public static <P extends Enum<P>> JSONObject optJSONObject(final JSONObject json, P e) {
return json.optJSONObject(e.name());
} | [
"public",
"static",
"<",
"P",
"extends",
"Enum",
"<",
"P",
">",
">",
"JSONObject",
"optJSONObject",
"(",
"final",
"JSONObject",
"json",
",",
"P",
"e",
")",
"{",
"return",
"json",
".",
"optJSONObject",
"(",
"e",
".",
"name",
"(",
")",
")",
";",
"}"
] | Returns the value mapped by enum if it exists and is a {@link JSONObject}. If the value does
not exist returns {@code null}.
@param json {@link JSONObject} to get data from
@param e {@link Enum} labeling the data to get
@return A {@code JSONObject} if the mapping exists; {@code null} otherwise | [
"Returns",
"the",
"value",
"mapped",
"by",
"enum",
"if",
"it",
"exists",
"and",
"is",
"a",
"{",
"@link",
"JSONObject",
"}",
".",
"If",
"the",
"value",
"does",
"not",
"exist",
"returns",
"{",
"@code",
"null",
"}",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L399-L401 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java | ExtensionFactory.getExtensionAuthor | public ExtensionAuthor getExtensionAuthor(String name, String url)
{
return getExtensionAuthor(new DefaultExtensionAuthor(name, url));
} | java | public ExtensionAuthor getExtensionAuthor(String name, String url)
{
return getExtensionAuthor(new DefaultExtensionAuthor(name, url));
} | [
"public",
"ExtensionAuthor",
"getExtensionAuthor",
"(",
"String",
"name",
",",
"String",
"url",
")",
"{",
"return",
"getExtensionAuthor",
"(",
"new",
"DefaultExtensionAuthor",
"(",
"name",
",",
"url",
")",
")",
";",
"}"
] | Store and return a weak reference equals to the passed {@link ExtensionAuthor}.
@param name the name of the author
@param url the url of the author public profile
@return unique instance of {@link ExtensionAuthor} equals to the passed one | [
"Store",
"and",
"return",
"a",
"weak",
"reference",
"equals",
"to",
"the",
"passed",
"{",
"@link",
"ExtensionAuthor",
"}",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java#L110-L113 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsRenameImages.java | CmsRenameImages.buildImageInformation | public String buildImageInformation() {
// count all image resources of the gallery folder
int count = 0;
try {
int imageId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypeImage.getStaticTypeName()).getTypeId();
CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireType(imageId);
List<CmsResource> images = getCms().readResources(getParamResource(), filter, false);
count = images.size();
} catch (CmsException e) {
// ignore this exception
}
Object[] args = new Object[] {getParamResource(), new Integer(count)};
return key(Messages.GUI_RENAMEIMAGES_INFO_IMAGECOUNT_2, args);
} | java | public String buildImageInformation() {
// count all image resources of the gallery folder
int count = 0;
try {
int imageId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypeImage.getStaticTypeName()).getTypeId();
CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireType(imageId);
List<CmsResource> images = getCms().readResources(getParamResource(), filter, false);
count = images.size();
} catch (CmsException e) {
// ignore this exception
}
Object[] args = new Object[] {getParamResource(), new Integer(count)};
return key(Messages.GUI_RENAMEIMAGES_INFO_IMAGECOUNT_2, args);
} | [
"public",
"String",
"buildImageInformation",
"(",
")",
"{",
"// count all image resources of the gallery folder",
"int",
"count",
"=",
"0",
";",
"try",
"{",
"int",
"imageId",
"=",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"getResourceType",
"(",
"CmsResou... | Returns information about the image count of the selected gallery folder.<p>
@return information about the image count of the selected gallery folder | [
"Returns",
"information",
"about",
"the",
"image",
"count",
"of",
"the",
"selected",
"gallery",
"folder",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsRenameImages.java#L158-L174 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java | VirtualMachinesInner.getByResourceGroupAsync | public Observable<VirtualMachineInner> getByResourceGroupAsync(String resourceGroupName, String vmName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() {
@Override
public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualMachineInner> getByResourceGroupAsync(String resourceGroupName, String vmName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() {
@Override
public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualMachineInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmName",
")",
".",
"map",
"... | Retrieves information about the model view or the instance view of a virtual machine.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualMachineInner object | [
"Retrieves",
"information",
"about",
"the",
"model",
"view",
"or",
"the",
"instance",
"view",
"of",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L903-L910 |
netty/netty | common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java | SystemPropertyUtil.getLong | public static long getLong(String key, long def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim();
try {
return Long.parseLong(value);
} catch (Exception e) {
// Ignore
}
logger.warn(
"Unable to parse the long integer system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | java | public static long getLong(String key, long def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim();
try {
return Long.parseLong(value);
} catch (Exception e) {
// Ignore
}
logger.warn(
"Unable to parse the long integer system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | [
"public",
"static",
"long",
"getLong",
"(",
"String",
"key",
",",
"long",
"def",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"def",
";",
"}",
"value",
"=",
"value",
".",
"tr... | Returns the value of the Java system property with the specified
{@code key}, while falling back to the specified default value if
the property access fails.
@return the property value.
{@code def} if there's no such property or if an access to the
specified property is not allowed. | [
"Returns",
"the",
"value",
"of",
"the",
"Java",
"system",
"property",
"with",
"the",
"specified",
"{",
"@code",
"key",
"}",
"while",
"falling",
"back",
"to",
"the",
"specified",
"default",
"value",
"if",
"the",
"property",
"access",
"fails",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java#L164-L183 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUESubspace.java | CLIQUESubspace.rightNeighbor | protected CLIQUEUnit rightNeighbor(CLIQUEUnit unit, int dim) {
for(CLIQUEUnit u : denseUnits) {
if(u.containsRightNeighbor(unit, dim)) {
return u;
}
}
return null;
} | java | protected CLIQUEUnit rightNeighbor(CLIQUEUnit unit, int dim) {
for(CLIQUEUnit u : denseUnits) {
if(u.containsRightNeighbor(unit, dim)) {
return u;
}
}
return null;
} | [
"protected",
"CLIQUEUnit",
"rightNeighbor",
"(",
"CLIQUEUnit",
"unit",
",",
"int",
"dim",
")",
"{",
"for",
"(",
"CLIQUEUnit",
"u",
":",
"denseUnits",
")",
"{",
"if",
"(",
"u",
".",
"containsRightNeighbor",
"(",
"unit",
",",
"dim",
")",
")",
"{",
"return"... | Returns the right neighbor of the given unit in the specified dimension.
@param unit the unit to determine the right neighbor for
@param dim the dimension
@return the right neighbor of the given unit in the specified dimension | [
"Returns",
"the",
"right",
"neighbor",
"of",
"the",
"given",
"unit",
"in",
"the",
"specified",
"dimension",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUESubspace.java#L162-L169 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java | MapBasedXPathFunctionResolver.removeFunction | @Nonnull
public EChange removeFunction (@Nonnull final QName aName, @Nonnegative final int nArity)
{
final XPathFunctionKey aKey = new XPathFunctionKey (aName, nArity);
return removeFunction (aKey);
} | java | @Nonnull
public EChange removeFunction (@Nonnull final QName aName, @Nonnegative final int nArity)
{
final XPathFunctionKey aKey = new XPathFunctionKey (aName, nArity);
return removeFunction (aKey);
} | [
"@",
"Nonnull",
"public",
"EChange",
"removeFunction",
"(",
"@",
"Nonnull",
"final",
"QName",
"aName",
",",
"@",
"Nonnegative",
"final",
"int",
"nArity",
")",
"{",
"final",
"XPathFunctionKey",
"aKey",
"=",
"new",
"XPathFunctionKey",
"(",
"aName",
",",
"nArity"... | Remove the function with the specified name.
@param aName
The name to be removed. May not be <code>null</code>.
@param nArity
The number of parameters of the function. Must be ≥ 0.
@return {@link EChange} | [
"Remove",
"the",
"function",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java#L152-L157 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java | ByteConverter.int4 | public static int int4(byte[] bytes, int idx) {
return
((bytes[idx] & 255) << 24)
+ ((bytes[idx + 1] & 255) << 16)
+ ((bytes[idx + 2] & 255) << 8)
+ ((bytes[idx + 3] & 255));
} | java | public static int int4(byte[] bytes, int idx) {
return
((bytes[idx] & 255) << 24)
+ ((bytes[idx + 1] & 255) << 16)
+ ((bytes[idx + 2] & 255) << 8)
+ ((bytes[idx + 3] & 255));
} | [
"public",
"static",
"int",
"int4",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"idx",
")",
"{",
"return",
"(",
"(",
"bytes",
"[",
"idx",
"]",
"&",
"255",
")",
"<<",
"24",
")",
"+",
"(",
"(",
"bytes",
"[",
"idx",
"+",
"1",
"]",
"&",
"255",
"... | Parses an int value from the byte array.
@param bytes The byte array to parse.
@param idx The starting index of the parse in the byte array.
@return parsed int value. | [
"Parses",
"an",
"int",
"value",
"from",
"the",
"byte",
"array",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java#L45-L51 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.listDataLakeStoreAccountsWithServiceResponseAsync | public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> listDataLakeStoreAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName) {
return listDataLakeStoreAccountsSinglePageAsync(resourceGroupName, accountName)
.concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listDataLakeStoreAccountsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> listDataLakeStoreAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName) {
return listDataLakeStoreAccountsSinglePageAsync(resourceGroupName, accountName)
.concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listDataLakeStoreAccountsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DataLakeStoreAccountInfoInner",
">",
">",
">",
"listDataLakeStoreAccountsWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
")",
"{",
"return",
... | Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account for which to list Data Lake Store accounts.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DataLakeStoreAccountInfoInner> object | [
"Gets",
"the",
"first",
"page",
"of",
"Data",
"Lake",
"Store",
"accounts",
"linked",
"to",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
".",
"The",
"response",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1581-L1593 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectITemplateArraySupertype | void expectITemplateArraySupertype(Node n, JSType type, String msg) {
if (!getNativeType(I_TEMPLATE_ARRAY_TYPE).isSubtypeOf(type)) {
mismatch(n, msg, type, I_TEMPLATE_ARRAY_TYPE);
}
} | java | void expectITemplateArraySupertype(Node n, JSType type, String msg) {
if (!getNativeType(I_TEMPLATE_ARRAY_TYPE).isSubtypeOf(type)) {
mismatch(n, msg, type, I_TEMPLATE_ARRAY_TYPE);
}
} | [
"void",
"expectITemplateArraySupertype",
"(",
"Node",
"n",
",",
"JSType",
"type",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"!",
"getNativeType",
"(",
"I_TEMPLATE_ARRAY_TYPE",
")",
".",
"isSubtypeOf",
"(",
"type",
")",
")",
"{",
"mismatch",
"(",
"n",
",",... | Expect the type to be an ITemplateArray or supertype of ITemplateArray. | [
"Expect",
"the",
"type",
"to",
"be",
"an",
"ITemplateArray",
"or",
"supertype",
"of",
"ITemplateArray",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L353-L357 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/splitter/DistcpFileSplitter.java | DistcpFileSplitter.mergeSplits | private static WorkUnitState mergeSplits(FileSystem fs, CopyableFile file, Collection<WorkUnitState> workUnits,
Path parentPath) throws IOException {
log.info(String.format("File %s was written in %d parts. Merging.", file.getDestination(), workUnits.size()));
Path[] parts = new Path[workUnits.size()];
for (WorkUnitState workUnit : workUnits) {
if (!isSplitWorkUnit(workUnit)) {
throw new IOException("Not a split work unit.");
}
Split split = getSplit(workUnit).get();
parts[split.getSplitNumber()] = new Path(parentPath, split.getPartName());
}
Path target = new Path(parentPath, file.getDestination().getName());
fs.rename(parts[0], target);
fs.concat(target, Arrays.copyOfRange(parts, 1, parts.length));
WorkUnitState finalWorkUnit = workUnits.iterator().next();
finalWorkUnit.removeProp(SPLIT_KEY);
return finalWorkUnit;
} | java | private static WorkUnitState mergeSplits(FileSystem fs, CopyableFile file, Collection<WorkUnitState> workUnits,
Path parentPath) throws IOException {
log.info(String.format("File %s was written in %d parts. Merging.", file.getDestination(), workUnits.size()));
Path[] parts = new Path[workUnits.size()];
for (WorkUnitState workUnit : workUnits) {
if (!isSplitWorkUnit(workUnit)) {
throw new IOException("Not a split work unit.");
}
Split split = getSplit(workUnit).get();
parts[split.getSplitNumber()] = new Path(parentPath, split.getPartName());
}
Path target = new Path(parentPath, file.getDestination().getName());
fs.rename(parts[0], target);
fs.concat(target, Arrays.copyOfRange(parts, 1, parts.length));
WorkUnitState finalWorkUnit = workUnits.iterator().next();
finalWorkUnit.removeProp(SPLIT_KEY);
return finalWorkUnit;
} | [
"private",
"static",
"WorkUnitState",
"mergeSplits",
"(",
"FileSystem",
"fs",
",",
"CopyableFile",
"file",
",",
"Collection",
"<",
"WorkUnitState",
">",
"workUnits",
",",
"Path",
"parentPath",
")",
"throws",
"IOException",
"{",
"log",
".",
"info",
"(",
"String",... | Merges all the splits for a given file.
Should be called on the target/destination file system (after blocks have been copied to targetFs).
@param fs {@link FileSystem} where file parts exist.
@param file {@link CopyableFile} to merge.
@param workUnits {@link WorkUnitState}s for all parts of this file.
@param parentPath {@link Path} where the parts of the file are located.
@return a {@link WorkUnit} equivalent to the distcp work unit if the file had not been split.
@throws IOException | [
"Merges",
"all",
"the",
"splits",
"for",
"a",
"given",
"file",
".",
"Should",
"be",
"called",
"on",
"the",
"target",
"/",
"destination",
"file",
"system",
"(",
"after",
"blocks",
"have",
"been",
"copied",
"to",
"targetFs",
")",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/splitter/DistcpFileSplitter.java#L186-L207 |
theHilikus/JRoboCom | jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/Player.java | Player.startRobot | public void startRobot(Robot newRobot) {
newRobot.getData().setActiveState(DEFAULT_START_STATE);
Thread newThread = new Thread(robotsThreads, newRobot, "Bot-" + newRobot.getSerialNumber());
newThread.start(); // jumpstarts the robot
} | java | public void startRobot(Robot newRobot) {
newRobot.getData().setActiveState(DEFAULT_START_STATE);
Thread newThread = new Thread(robotsThreads, newRobot, "Bot-" + newRobot.getSerialNumber());
newThread.start(); // jumpstarts the robot
} | [
"public",
"void",
"startRobot",
"(",
"Robot",
"newRobot",
")",
"{",
"newRobot",
".",
"getData",
"(",
")",
".",
"setActiveState",
"(",
"DEFAULT_START_STATE",
")",
";",
"Thread",
"newThread",
"=",
"new",
"Thread",
"(",
"robotsThreads",
",",
"newRobot",
",",
"\... | Starts the thread of a robot in the player's thread group
@param newRobot the robot to start | [
"Starts",
"the",
"thread",
"of",
"a",
"robot",
"in",
"the",
"player",
"s",
"thread",
"group"
] | train | https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/Player.java#L207-L212 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageutils/TiffUtil.java | TiffUtil.readOrientationFromTIFF | public static int readOrientationFromTIFF(InputStream is, int length) throws IOException {
// read tiff header
TiffHeader tiffHeader = new TiffHeader();
length = readTiffHeader(is, length, tiffHeader);
// move to the first IFD
// offset is relative to the beginning of the TIFF data
// and we already consumed the first 8 bytes of header
int toSkip = tiffHeader.firstIfdOffset - 8;
if (length == 0 || toSkip > length) {
return 0;
}
is.skip(toSkip);
length -= toSkip;
// move to the entry with orientation tag
length = moveToTiffEntryWithTag(is, length, tiffHeader.isLittleEndian, TIFF_TAG_ORIENTATION);
// read orientation
return getOrientationFromTiffEntry(is, length, tiffHeader.isLittleEndian);
} | java | public static int readOrientationFromTIFF(InputStream is, int length) throws IOException {
// read tiff header
TiffHeader tiffHeader = new TiffHeader();
length = readTiffHeader(is, length, tiffHeader);
// move to the first IFD
// offset is relative to the beginning of the TIFF data
// and we already consumed the first 8 bytes of header
int toSkip = tiffHeader.firstIfdOffset - 8;
if (length == 0 || toSkip > length) {
return 0;
}
is.skip(toSkip);
length -= toSkip;
// move to the entry with orientation tag
length = moveToTiffEntryWithTag(is, length, tiffHeader.isLittleEndian, TIFF_TAG_ORIENTATION);
// read orientation
return getOrientationFromTiffEntry(is, length, tiffHeader.isLittleEndian);
} | [
"public",
"static",
"int",
"readOrientationFromTIFF",
"(",
"InputStream",
"is",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"// read tiff header",
"TiffHeader",
"tiffHeader",
"=",
"new",
"TiffHeader",
"(",
")",
";",
"length",
"=",
"readTiffHeader",
"(... | Reads orientation information from TIFF data.
@param is the input stream of TIFF data
@param length length of the TIFF data
@return orientation information (1/3/6/8 on success, 0 if not found) | [
"Reads",
"orientation",
"information",
"from",
"TIFF",
"data",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageutils/TiffUtil.java#L54-L74 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.ByteArray | public JBBPDslBuilder ByteArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.BYTE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder ByteArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.BYTE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"ByteArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BYTE_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";... | Add named byte array which size calculated through expression.
@param name name of the array, it can be null for anonymous fields
@param sizeExpression expression to be used to calculate array length, must not be null or empty.
@return the builder instance, must not be null | [
"Add",
"named",
"byte",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L871-L876 |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.hasChildScope | public boolean hasChildScope(ScopeType type, String name) {
log.debug("Has child scope? {} in {}", name, this);
return children.getBasicScope(type, name) != null;
} | java | public boolean hasChildScope(ScopeType type, String name) {
log.debug("Has child scope? {} in {}", name, this);
return children.getBasicScope(type, name) != null;
} | [
"public",
"boolean",
"hasChildScope",
"(",
"ScopeType",
"type",
",",
"String",
"name",
")",
"{",
"log",
".",
"debug",
"(",
"\"Has child scope? {} in {}\"",
",",
"name",
",",
"this",
")",
";",
"return",
"children",
".",
"getBasicScope",
"(",
"type",
",",
"nam... | Check whether scope has child scope with given name and type
@param type Child scope type
@param name Child scope name
@return true if scope has child node with given name and type, false otherwise | [
"Check",
"whether",
"scope",
"has",
"child",
"scope",
"with",
"given",
"name",
"and",
"type"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L818-L821 |
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.restartDyno | public void restartDyno(String appName, String dynoId) {
connection.execute(new DynoRestart(appName, dynoId), apiKey);
} | java | public void restartDyno(String appName, String dynoId) {
connection.execute(new DynoRestart(appName, dynoId), apiKey);
} | [
"public",
"void",
"restartDyno",
"(",
"String",
"appName",
",",
"String",
"dynoId",
")",
"{",
"connection",
".",
"execute",
"(",
"new",
"DynoRestart",
"(",
"appName",
",",
"dynoId",
")",
",",
"apiKey",
")",
";",
"}"
] | Restarts a single dyno
@param appName See {@link #listApps} for a list of apps that can be used.
@param dynoId the unique identifier of the dyno to restart | [
"Restarts",
"a",
"single",
"dyno"
] | train | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L470-L472 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java | TmdbTV.getTVAlternativeTitles | public ResultList<AlternativeTitle> getTVAlternativeTitles(int tvID) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters);
WrapperGenericList<AlternativeTitle> wrapper = processWrapper(getTypeReference(AlternativeTitle.class), url, "alternative titles");
return wrapper.getResultsList();
} | java | public ResultList<AlternativeTitle> getTVAlternativeTitles(int tvID) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters);
WrapperGenericList<AlternativeTitle> wrapper = processWrapper(getTypeReference(AlternativeTitle.class), url, "alternative titles");
return wrapper.getResultsList();
} | [
"public",
"ResultList",
"<",
"AlternativeTitle",
">",
"getTVAlternativeTitles",
"(",
"int",
"tvID",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
... | Get the alternative titles for a specific show ID.
@param tvID
@return
@throws com.omertron.themoviedbapi.MovieDbException | [
"Get",
"the",
"alternative",
"titles",
"for",
"a",
"specific",
"show",
"ID",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java#L130-L137 |
jenkinsci/jenkins | core/src/main/java/hudson/os/SU.java | SU.start | public static VirtualChannel start(final TaskListener listener, final String rootUsername, final String rootPassword) throws IOException, InterruptedException {
if(File.pathSeparatorChar==';') // on Windows
return newLocalChannel(); // TODO: perhaps use RunAs to run as an Administrator?
String os = Util.fixNull(System.getProperty("os.name"));
if(os.equals("Linux"))
return new UnixSu() {
protected String sudoExe() {
return "sudo";
}
protected Process sudoWithPass(ArgumentListBuilder args) throws IOException {
args.prepend(sudoExe(),"-S");
listener.getLogger().println("$ "+Util.join(args.toList()," "));
ProcessBuilder pb = new ProcessBuilder(args.toCommandArray());
Process p = pb.start();
// TODO: use -p to detect prompt
// TODO: detect if the password didn't work
PrintStream ps = new PrintStream(p.getOutputStream());
ps.println(rootPassword);
ps.println(rootPassword);
ps.println(rootPassword);
return p;
}
}.start(listener,rootPassword);
if(os.equals("SunOS"))
return new UnixSu() {
protected String sudoExe() {
return "/usr/bin/pfexec";
}
protected Process sudoWithPass(ArgumentListBuilder args) throws IOException {
listener.getLogger().println("Running with embedded_su");
ProcessBuilder pb = new ProcessBuilder(args.prepend(sudoExe()).toCommandArray());
return EmbeddedSu.startWithSu(rootUsername, rootPassword, pb);
}
// in solaris, pfexec never asks for a password, so username==null means
// we won't be using password. this helps disambiguate empty password
}.start(listener,rootUsername==null?null:rootPassword);
// TODO: Mac?
// unsupported platform, take a chance
return newLocalChannel();
} | java | public static VirtualChannel start(final TaskListener listener, final String rootUsername, final String rootPassword) throws IOException, InterruptedException {
if(File.pathSeparatorChar==';') // on Windows
return newLocalChannel(); // TODO: perhaps use RunAs to run as an Administrator?
String os = Util.fixNull(System.getProperty("os.name"));
if(os.equals("Linux"))
return new UnixSu() {
protected String sudoExe() {
return "sudo";
}
protected Process sudoWithPass(ArgumentListBuilder args) throws IOException {
args.prepend(sudoExe(),"-S");
listener.getLogger().println("$ "+Util.join(args.toList()," "));
ProcessBuilder pb = new ProcessBuilder(args.toCommandArray());
Process p = pb.start();
// TODO: use -p to detect prompt
// TODO: detect if the password didn't work
PrintStream ps = new PrintStream(p.getOutputStream());
ps.println(rootPassword);
ps.println(rootPassword);
ps.println(rootPassword);
return p;
}
}.start(listener,rootPassword);
if(os.equals("SunOS"))
return new UnixSu() {
protected String sudoExe() {
return "/usr/bin/pfexec";
}
protected Process sudoWithPass(ArgumentListBuilder args) throws IOException {
listener.getLogger().println("Running with embedded_su");
ProcessBuilder pb = new ProcessBuilder(args.prepend(sudoExe()).toCommandArray());
return EmbeddedSu.startWithSu(rootUsername, rootPassword, pb);
}
// in solaris, pfexec never asks for a password, so username==null means
// we won't be using password. this helps disambiguate empty password
}.start(listener,rootUsername==null?null:rootPassword);
// TODO: Mac?
// unsupported platform, take a chance
return newLocalChannel();
} | [
"public",
"static",
"VirtualChannel",
"start",
"(",
"final",
"TaskListener",
"listener",
",",
"final",
"String",
"rootUsername",
",",
"final",
"String",
"rootPassword",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"File",
".",
"pathSe... | Returns a {@link VirtualChannel} that's connected to the privilege-escalated environment.
@param listener
What this method is doing (such as what process it's invoking) will be sent here.
@return
Never null. This may represent a channel to a separate JVM, or just {@link LocalChannel}.
Close this channel and the SU environment will be shut down. | [
"Returns",
"a",
"{",
"@link",
"VirtualChannel",
"}",
"that",
"s",
"connected",
"to",
"the",
"privilege",
"-",
"escalated",
"environment",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/os/SU.java#L73-L118 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.readResource | public I_CmsHistoryResource readResource(CmsRequestContext context, CmsResource resource, int version)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
I_CmsHistoryResource result = null;
try {
result = m_driverManager.readResource(dbc, resource, version);
} catch (CmsException e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_READING_RESOURCE_VERSION_2,
dbc.removeSiteRoot(resource.getRootPath()),
new Integer(version)),
e);
} finally {
dbc.clear();
}
return result;
} | java | public I_CmsHistoryResource readResource(CmsRequestContext context, CmsResource resource, int version)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
I_CmsHistoryResource result = null;
try {
result = m_driverManager.readResource(dbc, resource, version);
} catch (CmsException e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_READING_RESOURCE_VERSION_2,
dbc.removeSiteRoot(resource.getRootPath()),
new Integer(version)),
e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"I_CmsHistoryResource",
"readResource",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
",",
"int",
"version",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")"... | Reads the historical resource entry for the given resource with the given version number.<p>
@param context the current request context
@param resource the resource to be read the version for
@param version the version number to retrieve
@return the resource that was read
@throws CmsException if the resource could not be read for any reason
@see CmsObject#readFile(CmsResource)
@see CmsObject#restoreResourceVersion(CmsUUID, int)
@see CmsObject#readResource(CmsUUID, int) | [
"Reads",
"the",
"historical",
"resource",
"entry",
"for",
"the",
"given",
"resource",
"with",
"the",
"given",
"version",
"number",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4966-L4985 |
grpc/grpc-java | alts/src/main/java/io/grpc/alts/internal/NettyTsiHandshaker.java | NettyTsiHandshaker.createFrameProtector | TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator alloc) {
unwrapper = null;
return internalHandshaker.createFrameProtector(maxFrameSize, alloc);
} | java | TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator alloc) {
unwrapper = null;
return internalHandshaker.createFrameProtector(maxFrameSize, alloc);
} | [
"TsiFrameProtector",
"createFrameProtector",
"(",
"int",
"maxFrameSize",
",",
"ByteBufAllocator",
"alloc",
")",
"{",
"unwrapper",
"=",
"null",
";",
"return",
"internalHandshaker",
".",
"createFrameProtector",
"(",
"maxFrameSize",
",",
"alloc",
")",
";",
"}"
] | Creates a frame protector from a completed handshake. No other methods may be called after the
frame protector is created.
@param maxFrameSize the requested max frame size, the callee is free to ignore.
@return a new {@link io.grpc.alts.internal.TsiFrameProtector}. | [
"Creates",
"a",
"frame",
"protector",
"from",
"a",
"completed",
"handshake",
".",
"No",
"other",
"methods",
"may",
"be",
"called",
"after",
"the",
"frame",
"protector",
"is",
"created",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/NettyTsiHandshaker.java#L137-L140 |
prestodb/presto | presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java | UnscaledDecimal128Arithmetic.scaleUpFiveDestructive | private static void scaleUpFiveDestructive(Slice decimal, int fiveScale)
{
while (fiveScale > 0) {
int powerFive = Math.min(fiveScale, MAX_POWER_OF_FIVE_INT);
fiveScale -= powerFive;
int multiplier = POWERS_OF_FIVES_INT[powerFive];
multiplyDestructive(decimal, multiplier);
}
} | java | private static void scaleUpFiveDestructive(Slice decimal, int fiveScale)
{
while (fiveScale > 0) {
int powerFive = Math.min(fiveScale, MAX_POWER_OF_FIVE_INT);
fiveScale -= powerFive;
int multiplier = POWERS_OF_FIVES_INT[powerFive];
multiplyDestructive(decimal, multiplier);
}
} | [
"private",
"static",
"void",
"scaleUpFiveDestructive",
"(",
"Slice",
"decimal",
",",
"int",
"fiveScale",
")",
"{",
"while",
"(",
"fiveScale",
">",
"0",
")",
"{",
"int",
"powerFive",
"=",
"Math",
".",
"min",
"(",
"fiveScale",
",",
"MAX_POWER_OF_FIVE_INT",
")"... | Scale up the value for 5**fiveScale (decimal := decimal * 5**fiveScale). | [
"Scale",
"up",
"the",
"value",
"for",
"5",
"**",
"fiveScale",
"(",
"decimal",
":",
"=",
"decimal",
"*",
"5",
"**",
"fiveScale",
")",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java#L867-L875 |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.mapAsString | public static <K, V> String mapAsString(Map<K, V> map, String sepItem, String sepKeyval) {
StringBuffer string = new StringBuffer(128);
Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<K, V> entry = it.next();
string.append(entry.getKey());
string.append(sepKeyval);
string.append(entry.getValue());
if (it.hasNext()) {
string.append(sepItem);
}
}
return string.toString();
} | java | public static <K, V> String mapAsString(Map<K, V> map, String sepItem, String sepKeyval) {
StringBuffer string = new StringBuffer(128);
Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<K, V> entry = it.next();
string.append(entry.getKey());
string.append(sepKeyval);
string.append(entry.getValue());
if (it.hasNext()) {
string.append(sepItem);
}
}
return string.toString();
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"String",
"mapAsString",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"String",
"sepItem",
",",
"String",
"sepKeyval",
")",
"{",
"StringBuffer",
"string",
"=",
"new",
"StringBuffer",
"(",
"128",
")",
"... | Returns a string representation for the given map using the given separators.<p>
@param <K> type of map keys
@param <V> type of map values
@param map the map to write
@param sepItem the item separator string
@param sepKeyval the key-value pair separator string
@return the string representation for the given map | [
"Returns",
"a",
"string",
"representation",
"for",
"the",
"given",
"map",
"using",
"the",
"given",
"separators",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1314-L1328 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java | Preconditions.checkPreconditionL | public static long checkPreconditionL(
final long value,
final LongPredicate predicate,
final LongFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
final Violations violations = singleViolation(failedPredicate(e));
throw new PreconditionViolationException(
failedMessage(Long.valueOf(value), violations), e, violations.count());
}
return innerCheckL(value, ok, describer);
} | java | public static long checkPreconditionL(
final long value,
final LongPredicate predicate,
final LongFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
final Violations violations = singleViolation(failedPredicate(e));
throw new PreconditionViolationException(
failedMessage(Long.valueOf(value), violations), e, violations.count());
}
return innerCheckL(value, ok, describer);
} | [
"public",
"static",
"long",
"checkPreconditionL",
"(",
"final",
"long",
"value",
",",
"final",
"LongPredicate",
"predicate",
",",
"final",
"LongFunction",
"<",
"String",
">",
"describer",
")",
"{",
"final",
"boolean",
"ok",
";",
"try",
"{",
"ok",
"=",
"predi... | A {@code long} specialized version of {@link #checkPrecondition(Object,
Predicate, Function)}
@param value The value
@param predicate The predicate
@param describer The describer of the predicate
@return value
@throws PreconditionViolationException If the predicate is false | [
"A",
"{",
"@code",
"long",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkPrecondition",
"(",
"Object",
"Predicate",
"Function",
")",
"}"
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java#L449-L464 |
bwkimmel/jdcp | jdcp-server/src/main/java/ca/eandb/jdcp/server/JobServer.java | JobServer.handleJobExecutionException | private void handleJobExecutionException(JobExecutionException e, UUID jobId) {
logger.error("Exception thrown from job " + jobId.toString(), e);
removeScheduledJob(jobId, false);
} | java | private void handleJobExecutionException(JobExecutionException e, UUID jobId) {
logger.error("Exception thrown from job " + jobId.toString(), e);
removeScheduledJob(jobId, false);
} | [
"private",
"void",
"handleJobExecutionException",
"(",
"JobExecutionException",
"e",
",",
"UUID",
"jobId",
")",
"{",
"logger",
".",
"error",
"(",
"\"Exception thrown from job \"",
"+",
"jobId",
".",
"toString",
"(",
")",
",",
"e",
")",
";",
"removeScheduledJob",
... | Handles a <code>JobExcecutionException</code> thrown by a job managed
by this server.
@param e The <code>JobExecutionException</code> that was thrown by the
job.
@param jobId The <code>UUID</code> identifying the job that threw the
exception. | [
"Handles",
"a",
"<code",
">",
"JobExcecutionException<",
"/",
"code",
">",
"thrown",
"by",
"a",
"job",
"managed",
"by",
"this",
"server",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/JobServer.java#L537-L540 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/tools/ProcComm.java | ProcComm.main | public static void main(String[] args)
{
try {
final ProcComm pc = new ProcComm(args, null);
// use a log writer for the console (System.out), setting the user
// specified log level, if any
pc.w = new ConsoleWriter(pc.options.containsKey("verbose"));
if (pc.options.containsKey("read") == pc.options.containsKey("write"))
throw new IllegalArgumentException("do either read or write");
try {
pc.run(null);
pc.readWrite();
}
finally {
pc.quit();
}
}
catch (final Throwable t) {
if (t.getMessage() != null)
System.out.println(t.getMessage());
}
} | java | public static void main(String[] args)
{
try {
final ProcComm pc = new ProcComm(args, null);
// use a log writer for the console (System.out), setting the user
// specified log level, if any
pc.w = new ConsoleWriter(pc.options.containsKey("verbose"));
if (pc.options.containsKey("read") == pc.options.containsKey("write"))
throw new IllegalArgumentException("do either read or write");
try {
pc.run(null);
pc.readWrite();
}
finally {
pc.quit();
}
}
catch (final Throwable t) {
if (t.getMessage() != null)
System.out.println(t.getMessage());
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"final",
"ProcComm",
"pc",
"=",
"new",
"ProcComm",
"(",
"args",
",",
"null",
")",
";",
"// use a log writer for the console (System.out), setting the user\r",
"// specified ... | Entry point for running ProcComm.
<p>
An IP host or port identifier has to be supplied, specifying the endpoint for the
KNX network access.<br>
To show the usage message of this tool on the console, supply the command line
option -help (or -h).<br>
Command line options are treated case sensitive. Available options for the
communication connection:
<ul>
<li><code>-help -h</code> show help message</li>
<li><code>-version</code> show tool/library version and exit</li>
<li><code>-verbose -v</code> enable verbose status output</li>
<li><code>-localhost</code> <i>id</i> local IP/host name</li>
<li><code>-localport</code> <i>number</i> local UDP port (default system
assigned)</li>
<li><code>-port -p</code> <i>number</i> UDP port on host (default 3671)</li>
<li><code>-nat -n</code> enable Network Address Translation</li>
<li><code>-routing</code> use KNXnet/IP routing</li>
<li><code>-serial -s</code> use FT1.2 serial communication</li>
<li><code>-medium -m</code> <i>id</i> KNX medium [tp0|tp1|p110|p132|rf]
(defaults to tp1)</li>
</ul>
Available commands for process communication:
<ul>
<li><code>read</code> <i>DPT KNX-address</i> read from group
address, using DPT value format</li>
<li><code>write</code> <i>DPT value KNX-address</i> write
to group address, using DPT value format</li>
</ul>
For the more common datapoint types (DPTs) the following name aliases can be used
instead of the general DPT number string:
<ul>
<li><code>switch</code> for DPT 1.001</li>
<li><code>bool</code> for DPT 1.002</li>
<li><code>string</code> for DPT 16.001</li>
<li><code>float</code> for DPT 9.002</li>
<li><code>ucount</code> for DPT 5.010</li>
<li><code>angle</code> for DPT 5.003</li>
</ul>
@param args command line options for process communication | [
"Entry",
"point",
"for",
"running",
"ProcComm",
".",
"<p",
">",
"An",
"IP",
"host",
"or",
"port",
"identifier",
"has",
"to",
"be",
"supplied",
"specifying",
"the",
"endpoint",
"for",
"the",
"KNX",
"network",
"access",
".",
"<br",
">",
"To",
"show",
"the"... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/tools/ProcComm.java#L169-L190 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleAssociatePoints.java | ExampleAssociatePoints.describeImage | private void describeImage(T input, List<Point2D_F64> points, FastQueue<TD> descs )
{
detDesc.detect(input);
for( int i = 0; i < detDesc.getNumberOfFeatures(); i++ ) {
points.add( detDesc.getLocation(i).copy() );
descs.grow().setTo(detDesc.getDescription(i));
}
} | java | private void describeImage(T input, List<Point2D_F64> points, FastQueue<TD> descs )
{
detDesc.detect(input);
for( int i = 0; i < detDesc.getNumberOfFeatures(); i++ ) {
points.add( detDesc.getLocation(i).copy() );
descs.grow().setTo(detDesc.getDescription(i));
}
} | [
"private",
"void",
"describeImage",
"(",
"T",
"input",
",",
"List",
"<",
"Point2D_F64",
">",
"points",
",",
"FastQueue",
"<",
"TD",
">",
"descs",
")",
"{",
"detDesc",
".",
"detect",
"(",
"input",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i"... | Detects features inside the two images and computes descriptions at those points. | [
"Detects",
"features",
"inside",
"the",
"two",
"images",
"and",
"computes",
"descriptions",
"at",
"those",
"points",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleAssociatePoints.java#L109-L117 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxTrash.java | BoxTrash.getFileInfo | public BoxFile.Info getFileInfo(String fileID) {
URL url = FILE_INFO_URL_TEMPLATE.build(this.api.getBaseURL(), fileID);
BoxAPIRequest request = new BoxAPIRequest(this.api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject jsonObject = JsonObject.readFrom(response.getJSON());
BoxFile file = new BoxFile(this.api, jsonObject.get("id").asString());
return file.new Info(response.getJSON());
} | java | public BoxFile.Info getFileInfo(String fileID) {
URL url = FILE_INFO_URL_TEMPLATE.build(this.api.getBaseURL(), fileID);
BoxAPIRequest request = new BoxAPIRequest(this.api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject jsonObject = JsonObject.readFrom(response.getJSON());
BoxFile file = new BoxFile(this.api, jsonObject.get("id").asString());
return file.new Info(response.getJSON());
} | [
"public",
"BoxFile",
".",
"Info",
"getFileInfo",
"(",
"String",
"fileID",
")",
"{",
"URL",
"url",
"=",
"FILE_INFO_URL_TEMPLATE",
".",
"build",
"(",
"this",
".",
"api",
".",
"getBaseURL",
"(",
")",
",",
"fileID",
")",
";",
"BoxAPIRequest",
"request",
"=",
... | Gets information about a trashed file.
@param fileID the ID of the trashed file.
@return info about the trashed file. | [
"Gets",
"information",
"about",
"a",
"trashed",
"file",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxTrash.java#L157-L165 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java | TernaryPatcher.pre | public static void pre(OpcodeStack stack, int opcode) {
if (sawGOTO) {
return;
}
sawGOTO = (opcode == Const.GOTO) || (opcode == Const.GOTO_W);
if (sawGOTO) {
int depth = stack.getStackDepth();
if (depth > 0) {
userValues.clear();
for (int i = 0; i < depth; i++) {
OpcodeStack.Item item = stack.getStackItem(i);
userValues.add(item.getUserValue());
}
}
}
} | java | public static void pre(OpcodeStack stack, int opcode) {
if (sawGOTO) {
return;
}
sawGOTO = (opcode == Const.GOTO) || (opcode == Const.GOTO_W);
if (sawGOTO) {
int depth = stack.getStackDepth();
if (depth > 0) {
userValues.clear();
for (int i = 0; i < depth; i++) {
OpcodeStack.Item item = stack.getStackItem(i);
userValues.add(item.getUserValue());
}
}
}
} | [
"public",
"static",
"void",
"pre",
"(",
"OpcodeStack",
"stack",
",",
"int",
"opcode",
")",
"{",
"if",
"(",
"sawGOTO",
")",
"{",
"return",
";",
"}",
"sawGOTO",
"=",
"(",
"opcode",
"==",
"Const",
".",
"GOTO",
")",
"||",
"(",
"opcode",
"==",
"Const",
... | called before the execution of the parent OpcodeStack.sawOpcode() to save user values if the opcode is a GOTO or GOTO_W.
@param stack
the OpcodeStack with the items containing user values
@param opcode
the opcode currently seen | [
"called",
"before",
"the",
"execution",
"of",
"the",
"parent",
"OpcodeStack",
".",
"sawOpcode",
"()",
"to",
"save",
"user",
"values",
"if",
"the",
"opcode",
"is",
"a",
"GOTO",
"or",
"GOTO_W",
"."
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java#L51-L66 |
alkacon/opencms-core | src/org/opencms/site/CmsSiteManagerImpl.java | CmsSiteManagerImpl.setSiteMatcherSites | private void setSiteMatcherSites(Map<CmsSiteMatcher, CmsSite> siteMatcherSites) {
m_siteMatcherSites = Collections.unmodifiableMap(siteMatcherSites);
m_siteMatchers = Collections.unmodifiableList(new ArrayList<CmsSiteMatcher>(m_siteMatcherSites.keySet()));
} | java | private void setSiteMatcherSites(Map<CmsSiteMatcher, CmsSite> siteMatcherSites) {
m_siteMatcherSites = Collections.unmodifiableMap(siteMatcherSites);
m_siteMatchers = Collections.unmodifiableList(new ArrayList<CmsSiteMatcher>(m_siteMatcherSites.keySet()));
} | [
"private",
"void",
"setSiteMatcherSites",
"(",
"Map",
"<",
"CmsSiteMatcher",
",",
"CmsSite",
">",
"siteMatcherSites",
")",
"{",
"m_siteMatcherSites",
"=",
"Collections",
".",
"unmodifiableMap",
"(",
"siteMatcherSites",
")",
";",
"m_siteMatchers",
"=",
"Collections",
... | Sets the class member variables {@link #m_siteMatcherSites} and {@link #m_siteMatchers}
from the provided map of configured site matchers.<p>
@param siteMatcherSites the site matches to set | [
"Sets",
"the",
"class",
"member",
"variables",
"{",
"@link",
"#m_siteMatcherSites",
"}",
"and",
"{",
"@link",
"#m_siteMatchers",
"}",
"from",
"the",
"provided",
"map",
"of",
"configured",
"site",
"matchers",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L1802-L1806 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.onSetComment | private void onSetComment(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String comment = cfProperties.getProperty(CassandraConstants.COMMENT);
if (comment != null)
{
if (builder != null)
{
String comment_Str = CQLTranslator.getKeyword(CassandraConstants.COMMENT);
builder.append(comment_Str);
builder.append(CQLTranslator.EQ_CLAUSE);
builder.append(CQLTranslator.QUOTE_STR);
builder.append(comment);
builder.append(CQLTranslator.QUOTE_STR);
builder.append(CQLTranslator.AND_CLAUSE);
}
else
{
cfDef.setComment(comment);
}
}
} | java | private void onSetComment(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String comment = cfProperties.getProperty(CassandraConstants.COMMENT);
if (comment != null)
{
if (builder != null)
{
String comment_Str = CQLTranslator.getKeyword(CassandraConstants.COMMENT);
builder.append(comment_Str);
builder.append(CQLTranslator.EQ_CLAUSE);
builder.append(CQLTranslator.QUOTE_STR);
builder.append(comment);
builder.append(CQLTranslator.QUOTE_STR);
builder.append(CQLTranslator.AND_CLAUSE);
}
else
{
cfDef.setComment(comment);
}
}
} | [
"private",
"void",
"onSetComment",
"(",
"CfDef",
"cfDef",
",",
"Properties",
"cfProperties",
",",
"StringBuilder",
"builder",
")",
"{",
"String",
"comment",
"=",
"cfProperties",
".",
"getProperty",
"(",
"CassandraConstants",
".",
"COMMENT",
")",
";",
"if",
"(",
... | On set comment.
@param cfDef
the cf def
@param cfProperties
the cf properties
@param builder
the builder | [
"On",
"set",
"comment",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2564-L2585 |
tcurdt/jdeb | src/main/java/org/vafer/jdeb/ControlBuilder.java | ControlBuilder.createPackageControlFile | public BinaryPackageControlFile createPackageControlFile(File file, BigInteger pDataSize) throws IOException, ParseException {
FilteredFile controlFile = new FilteredFile(new FileInputStream(file), resolver);
BinaryPackageControlFile packageControlFile = new BinaryPackageControlFile(controlFile.toString());
if (packageControlFile.get("Distribution") == null) {
packageControlFile.set("Distribution", "unknown");
}
if (packageControlFile.get("Urgency") == null) {
packageControlFile.set("Urgency", "low");
}
packageControlFile.set("Installed-Size", pDataSize.divide(BigInteger.valueOf(1024)).toString());
// override the Version if the DEBVERSION environment variable is defined
final String debVersion = System.getenv("DEBVERSION");
if (debVersion != null) {
packageControlFile.set("Version", debVersion);
console.debug("Using version'" + debVersion + "' from the environment variables.");
}
// override the Maintainer field if the DEBFULLNAME and DEBEMAIL environment variables are defined
final String debFullName = System.getenv("DEBFULLNAME");
final String debEmail = System.getenv("DEBEMAIL");
if (debFullName != null && debEmail != null) {
final String maintainer = debFullName + " <" + debEmail + ">";
packageControlFile.set("Maintainer", maintainer);
console.debug("Using maintainer '" + maintainer + "' from the environment variables.");
}
return packageControlFile;
} | java | public BinaryPackageControlFile createPackageControlFile(File file, BigInteger pDataSize) throws IOException, ParseException {
FilteredFile controlFile = new FilteredFile(new FileInputStream(file), resolver);
BinaryPackageControlFile packageControlFile = new BinaryPackageControlFile(controlFile.toString());
if (packageControlFile.get("Distribution") == null) {
packageControlFile.set("Distribution", "unknown");
}
if (packageControlFile.get("Urgency") == null) {
packageControlFile.set("Urgency", "low");
}
packageControlFile.set("Installed-Size", pDataSize.divide(BigInteger.valueOf(1024)).toString());
// override the Version if the DEBVERSION environment variable is defined
final String debVersion = System.getenv("DEBVERSION");
if (debVersion != null) {
packageControlFile.set("Version", debVersion);
console.debug("Using version'" + debVersion + "' from the environment variables.");
}
// override the Maintainer field if the DEBFULLNAME and DEBEMAIL environment variables are defined
final String debFullName = System.getenv("DEBFULLNAME");
final String debEmail = System.getenv("DEBEMAIL");
if (debFullName != null && debEmail != null) {
final String maintainer = debFullName + " <" + debEmail + ">";
packageControlFile.set("Maintainer", maintainer);
console.debug("Using maintainer '" + maintainer + "' from the environment variables.");
}
return packageControlFile;
} | [
"public",
"BinaryPackageControlFile",
"createPackageControlFile",
"(",
"File",
"file",
",",
"BigInteger",
"pDataSize",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"FilteredFile",
"controlFile",
"=",
"new",
"FilteredFile",
"(",
"new",
"FileInputStream",
"("... | Creates a package control file from the specified file and adds the
<tt>Date</tt>, <tt>Distribution</tt> and <tt>Urgency</tt> fields if missing.
The <tt>Installed-Size</tt> field is also initialized to the actual size of
the package. The <tt>Maintainer</tt> field is overridden by the <tt>DEBEMAIL</tt>
and <tt>DEBFULLNAME</tt> environment variables if defined.
@param file the control file
@param pDataSize the size of the installed package | [
"Creates",
"a",
"package",
"control",
"file",
"from",
"the",
"specified",
"file",
"and",
"adds",
"the",
"<tt",
">",
"Date<",
"/",
"tt",
">",
"<tt",
">",
"Distribution<",
"/",
"tt",
">",
"and",
"<tt",
">",
"Urgency<",
"/",
"tt",
">",
"fields",
"if",
"... | train | https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/ControlBuilder.java#L173-L206 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java | Visualizer.createEntropyImage | public BufferedImage createEntropyImage(File file) throws IOException {
resetAvailabilityFlags();
this.data = new PEData(null, null, null, null, null, file);
image = new BufferedImage(fileWidth, height, IMAGE_TYPE);
final int MIN_WINDOW_SIZE = 100;
// bytes to be read at once to calculate local entropy
final int windowSize = Math.max(MIN_WINDOW_SIZE, pixelSize);
final int windowHalfSize = (int) Math.round(windowSize / (double) 2);
final long minLength = withMinLength(0);
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
// read until EOF with windowSized steps
for (long address = 0; address <= file.length(); address += minLength) {
// the start of the window (windowHalf to the left)
long start = (address - windowHalfSize < 0) ? 0 : address
- windowHalfSize;
raf.seek(start);
// cut byte number if EOF reached, otherwise read full window
int bytesToRead = (int) Math.min(file.length() - start,
windowSize);
byte[] bytes = new byte[bytesToRead];
raf.readFully(bytes);
/* calculate and draw entropy square pixel for this window */
double entropy = ShannonEntropy.entropy(bytes);
Color color = getColorForEntropy(entropy);
drawPixels(color, address, minLength);
}
}
drawVisOverlay(true);
return image;
} | java | public BufferedImage createEntropyImage(File file) throws IOException {
resetAvailabilityFlags();
this.data = new PEData(null, null, null, null, null, file);
image = new BufferedImage(fileWidth, height, IMAGE_TYPE);
final int MIN_WINDOW_SIZE = 100;
// bytes to be read at once to calculate local entropy
final int windowSize = Math.max(MIN_WINDOW_SIZE, pixelSize);
final int windowHalfSize = (int) Math.round(windowSize / (double) 2);
final long minLength = withMinLength(0);
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
// read until EOF with windowSized steps
for (long address = 0; address <= file.length(); address += minLength) {
// the start of the window (windowHalf to the left)
long start = (address - windowHalfSize < 0) ? 0 : address
- windowHalfSize;
raf.seek(start);
// cut byte number if EOF reached, otherwise read full window
int bytesToRead = (int) Math.min(file.length() - start,
windowSize);
byte[] bytes = new byte[bytesToRead];
raf.readFully(bytes);
/* calculate and draw entropy square pixel for this window */
double entropy = ShannonEntropy.entropy(bytes);
Color color = getColorForEntropy(entropy);
drawPixels(color, address, minLength);
}
}
drawVisOverlay(true);
return image;
} | [
"public",
"BufferedImage",
"createEntropyImage",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"resetAvailabilityFlags",
"(",
")",
";",
"this",
".",
"data",
"=",
"new",
"PEData",
"(",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",... | Creates an image of the local entropies of this file.
@param file
the PE file
@return image of local entropies
@throws IOException
if file can not be read | [
"Creates",
"an",
"image",
"of",
"the",
"local",
"entropies",
"of",
"this",
"file",
"."
] | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L245-L274 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeUtf8Map | public static File writeUtf8Map(Map<?, ?> map, File file, String kvSeparator, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.CHARSET_UTF_8).writeMap(map, kvSeparator, isAppend);
} | java | public static File writeUtf8Map(Map<?, ?> map, File file, String kvSeparator, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.CHARSET_UTF_8).writeMap(map, kvSeparator, isAppend);
} | [
"public",
"static",
"File",
"writeUtf8Map",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"File",
"file",
",",
"String",
"kvSeparator",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"fi... | 将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔
@param map Map
@param file 文件
@param kvSeparator 键和值之间的分隔符,如果传入null使用默认分隔符" = "
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常
@since 4.0.5 | [
"将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3086-L3088 |
anotheria/moskito | moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java | AbstractInterceptor.getStats | protected final T getStats(OnDemandStatsProducer producer, String name) {
try {
return getStatsClass().cast(producer.getStats(name));
} catch (ClassCastException e) {
LOGGER.error("getStats(): Unexpected stats type", e);
} catch (OnDemandStatsProducerException e) {
LOGGER.error("getStats(): Failed to get stats for name=" + name, e);
}
return null;
} | java | protected final T getStats(OnDemandStatsProducer producer, String name) {
try {
return getStatsClass().cast(producer.getStats(name));
} catch (ClassCastException e) {
LOGGER.error("getStats(): Unexpected stats type", e);
} catch (OnDemandStatsProducerException e) {
LOGGER.error("getStats(): Failed to get stats for name=" + name, e);
}
return null;
} | [
"protected",
"final",
"T",
"getStats",
"(",
"OnDemandStatsProducer",
"producer",
",",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"getStatsClass",
"(",
")",
".",
"cast",
"(",
"producer",
".",
"getStats",
"(",
"name",
")",
")",
";",
"}",
"catch",
"(... | Returns stats for producer.
@param producer {@link OnDemandStatsProducer}
@param name stats name
@return stats for producer | [
"Returns",
"stats",
"for",
"producer",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-integration/moskito-cdi/src/main/java/net/anotheria/moskito/integration/cdi/AbstractInterceptor.java#L104-L114 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java | ArrayUtil.indexOf | public static int indexOf(String ele, String[] arr)
{
if ( arr == null ) {
return -1;
}
for ( int i = 0; i < arr.length; i++ ) {
if ( arr[i].equals(ele) ) {
return i;
}
}
return -1;
} | java | public static int indexOf(String ele, String[] arr)
{
if ( arr == null ) {
return -1;
}
for ( int i = 0; i < arr.length; i++ ) {
if ( arr[i].equals(ele) ) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"String",
"ele",
",",
"String",
"[",
"]",
"arr",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length... | check and search the specified element in the Array
@param ele
@param arr
@return int | [
"check",
"and",
"search",
"the",
"specified",
"element",
"in",
"the",
"Array"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L42-L55 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/QuickSelect.java | QuickSelect.selectIncludingZeros | public static double selectIncludingZeros(final double[] arr, final int pivot) {
final int arrSize = arr.length;
final int adj = pivot - 1;
return select(arr, 0, arrSize - 1, adj);
} | java | public static double selectIncludingZeros(final double[] arr, final int pivot) {
final int arrSize = arr.length;
final int adj = pivot - 1;
return select(arr, 0, arrSize - 1, adj);
} | [
"public",
"static",
"double",
"selectIncludingZeros",
"(",
"final",
"double",
"[",
"]",
"arr",
",",
"final",
"int",
"pivot",
")",
"{",
"final",
"int",
"arrSize",
"=",
"arr",
".",
"length",
";",
"final",
"int",
"adj",
"=",
"pivot",
"-",
"1",
";",
"retur... | Gets the 1-based kth order statistic from the array including any zero values in the
array. Warning! This changes the ordering of elements in the given array!
@param arr The hash array.
@param pivot The 1-based index of the value that is chosen as the pivot for the array.
After the operation all values below this 1-based index will be less than this value
and all values above this index will be greater. The 0-based index of the pivot will be
pivot-1.
@return The value of the smallest (N)th element including zeros, where N is 1-based. | [
"Gets",
"the",
"1",
"-",
"based",
"kth",
"order",
"statistic",
"from",
"the",
"array",
"including",
"any",
"zero",
"values",
"in",
"the",
"array",
".",
"Warning!",
"This",
"changes",
"the",
"ordering",
"of",
"elements",
"in",
"the",
"given",
"array!"
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuickSelect.java#L163-L167 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java | TableInfo.of | public static TableInfo of(TableId tableId, TableDefinition definition) {
return newBuilder(tableId, definition).build();
} | java | public static TableInfo of(TableId tableId, TableDefinition definition) {
return newBuilder(tableId, definition).build();
} | [
"public",
"static",
"TableInfo",
"of",
"(",
"TableId",
"tableId",
",",
"TableDefinition",
"definition",
")",
"{",
"return",
"newBuilder",
"(",
"tableId",
",",
"definition",
")",
".",
"build",
"(",
")",
";",
"}"
] | Returns a {@code TableInfo} object given table identity and definition. Use {@link
StandardTableDefinition} to create simple BigQuery table. Use {@link ViewDefinition} to create
a BigQuery view. Use {@link ExternalTableDefinition} to create a BigQuery a table backed by
external data. | [
"Returns",
"a",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java#L457-L459 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java | CommerceWarehouseItemPersistenceImpl.fetchByCWI_CPIU | @Override
public CommerceWarehouseItem fetchByCWI_CPIU(long commerceWarehouseId,
String CPInstanceUuid) {
return fetchByCWI_CPIU(commerceWarehouseId, CPInstanceUuid, true);
} | java | @Override
public CommerceWarehouseItem fetchByCWI_CPIU(long commerceWarehouseId,
String CPInstanceUuid) {
return fetchByCWI_CPIU(commerceWarehouseId, CPInstanceUuid, true);
} | [
"@",
"Override",
"public",
"CommerceWarehouseItem",
"fetchByCWI_CPIU",
"(",
"long",
"commerceWarehouseId",
",",
"String",
"CPInstanceUuid",
")",
"{",
"return",
"fetchByCWI_CPIU",
"(",
"commerceWarehouseId",
",",
"CPInstanceUuid",
",",
"true",
")",
";",
"}"
] | Returns the commerce warehouse item where commerceWarehouseId = ? and CPInstanceUuid = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param commerceWarehouseId the commerce warehouse ID
@param CPInstanceUuid the cp instance uuid
@return the matching commerce warehouse item, or <code>null</code> if a matching commerce warehouse item could not be found | [
"Returns",
"the",
"commerce",
"warehouse",
"item",
"where",
"commerceWarehouseId",
"=",
"?",
";",
"and",
"CPInstanceUuid",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses"... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java#L677-L681 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/AbstractConverter.java | AbstractConverter.convertQuietly | public T convertQuietly(Object value, T defaultValue) {
try {
return convert(value, defaultValue);
} catch (Exception e) {
return defaultValue;
}
} | java | public T convertQuietly(Object value, T defaultValue) {
try {
return convert(value, defaultValue);
} catch (Exception e) {
return defaultValue;
}
} | [
"public",
"T",
"convertQuietly",
"(",
"Object",
"value",
",",
"T",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"convert",
"(",
"value",
",",
"defaultValue",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"defaultValue",
";",
"}",
... | 不抛异常转换<br>
当转换失败时返回默认值
@param value 被转换的值
@param defaultValue 默认值
@return 转换后的值
@since 4.5.7 | [
"不抛异常转换<br",
">",
"当转换失败时返回默认值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/AbstractConverter.java#L28-L34 |
bbottema/outlook-message-parser | src/main/java/org/simplejavamail/outlookmessageparser/OutlookMessageParser.java | OutlookMessageParser.checkDirectoryDocumentEntry | private void checkDirectoryDocumentEntry(final DocumentEntry de, final OutlookMessage msg)
throws IOException {
if (de.getName().startsWith(PROPS_KEY)) {
//TODO: parse properties stream
final List<DocumentEntry> deList = getDocumentEntriesFromPropertiesStream(de);
for (final DocumentEntry deFromProps : deList) {
final OutlookMessageProperty msgProp = getMessagePropertyFromDocumentEntry(deFromProps);
msg.setProperty(msgProp);
}
} else {
msg.setProperty(getMessagePropertyFromDocumentEntry(de));
}
} | java | private void checkDirectoryDocumentEntry(final DocumentEntry de, final OutlookMessage msg)
throws IOException {
if (de.getName().startsWith(PROPS_KEY)) {
//TODO: parse properties stream
final List<DocumentEntry> deList = getDocumentEntriesFromPropertiesStream(de);
for (final DocumentEntry deFromProps : deList) {
final OutlookMessageProperty msgProp = getMessagePropertyFromDocumentEntry(deFromProps);
msg.setProperty(msgProp);
}
} else {
msg.setProperty(getMessagePropertyFromDocumentEntry(de));
}
} | [
"private",
"void",
"checkDirectoryDocumentEntry",
"(",
"final",
"DocumentEntry",
"de",
",",
"final",
"OutlookMessage",
"msg",
")",
"throws",
"IOException",
"{",
"if",
"(",
"de",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"PROPS_KEY",
")",
")",
"{",
"/... | Parses a directory document entry which can either be a simple entry or
a stream that has to be split up into multiple document entries again.
The parsed information is put into the {@link OutlookMessage} object.
@param de The current node in the .msg file.
@param msg The resulting {@link OutlookMessage} object.
@throws IOException Thrown if the .msg file could not be parsed. | [
"Parses",
"a",
"directory",
"document",
"entry",
"which",
"can",
"either",
"be",
"a",
"simple",
"entry",
"or",
"a",
"stream",
"that",
"has",
"to",
"be",
"split",
"up",
"into",
"multiple",
"document",
"entries",
"again",
".",
"The",
"parsed",
"information",
... | train | https://github.com/bbottema/outlook-message-parser/blob/ea7d59da33c8a62dfc2e0aa64d2f8f7c903ccb0e/src/main/java/org/simplejavamail/outlookmessageparser/OutlookMessageParser.java#L210-L222 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/bytebuffer/WsByteBufferUtils.java | WsByteBufferUtils.asInt | public static final int asInt(WsByteBuffer buff, int position, int limit) {
return asInt(asByteArray(buff, position, limit));
} | java | public static final int asInt(WsByteBuffer buff, int position, int limit) {
return asInt(asByteArray(buff, position, limit));
} | [
"public",
"static",
"final",
"int",
"asInt",
"(",
"WsByteBuffer",
"buff",
",",
"int",
"position",
",",
"int",
"limit",
")",
"{",
"return",
"asInt",
"(",
"asByteArray",
"(",
"buff",
",",
"position",
",",
"limit",
")",
")",
";",
"}"
] | Convert a buffer to an int using the starting position and ending limit.
@param buff
@param position
@param limit
@return int | [
"Convert",
"a",
"buffer",
"to",
"an",
"int",
"using",
"the",
"starting",
"position",
"and",
"ending",
"limit",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/bytebuffer/WsByteBufferUtils.java#L234-L236 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/factory/sfm/FactoryVisualOdometry.java | FactoryVisualOdometry.stereoQuadPnP | public static <T extends ImageGray<T>,Desc extends TupleDesc>
StereoVisualOdometry<T> stereoQuadPnP( double inlierPixelTol ,
double epipolarPixelTol ,
double maxDistanceF2F,
double maxAssociationError,
int ransacIterations ,
int refineIterations ,
DetectDescribeMulti<T,Desc> detector,
Class<T> imageType )
{
EstimateNofPnP pnp = FactoryMultiView.pnp_N(EnumPNP.P3P_FINSTERWALDER, -1);
DistanceFromModelMultiView<Se3_F64,Point2D3D> distanceMono = new PnPDistanceReprojectionSq();
PnPStereoDistanceReprojectionSq distanceStereo = new PnPStereoDistanceReprojectionSq();
PnPStereoEstimator pnpStereo = new PnPStereoEstimator(pnp,distanceMono,0);
ModelManagerSe3_F64 manager = new ModelManagerSe3_F64();
EstimatorToGenerator<Se3_F64,Stereo2D3D> generator = new EstimatorToGenerator<>(pnpStereo);
// euclidean error squared from left + right images
double ransacTOL = 2*inlierPixelTol * inlierPixelTol;
ModelMatcher<Se3_F64, Stereo2D3D> motion =
new Ransac<>(2323, manager, generator, distanceStereo, ransacIterations, ransacTOL);
RefinePnPStereo refinePnP = null;
if( refineIterations > 0 ) {
refinePnP = new PnPStereoRefineRodrigues(1e-12,refineIterations);
}
Class<Desc> descType = detector.getDescriptionType();
ScoreAssociation<Desc> scorer = FactoryAssociation.defaultScore(descType);
// TODO need a better way to keep track of what error is squared and not
AssociateDescription2D<Desc> assocSame;
if( maxDistanceF2F > 0 ) {
AssociateMaxDistanceNaive<Desc> a = new AssociateMaxDistanceNaive<>(scorer, true, maxAssociationError);
a.setSquaredDistance(true);
a.setMaxDistance(maxDistanceF2F);
assocSame = a;
} else {
assocSame = new AssociateDescTo2D<>(FactoryAssociation.greedy(scorer, maxAssociationError, true));
}
AssociateStereo2D<Desc> associateStereo = new AssociateStereo2D<>(scorer, epipolarPixelTol, descType);
Triangulate2ViewsMetric triangulate = FactoryMultiView.triangulate2ViewMetric(
new ConfigTriangulation(ConfigTriangulation.Type.GEOMETRIC));
associateStereo.setMaxScoreThreshold(maxAssociationError);
VisOdomQuadPnP<T,Desc> alg = new VisOdomQuadPnP<>(
detector, assocSame, associateStereo, triangulate, motion, refinePnP);
return new WrapVisOdomQuadPnP<>(alg, refinePnP, associateStereo, distanceStereo, distanceMono, imageType);
} | java | public static <T extends ImageGray<T>,Desc extends TupleDesc>
StereoVisualOdometry<T> stereoQuadPnP( double inlierPixelTol ,
double epipolarPixelTol ,
double maxDistanceF2F,
double maxAssociationError,
int ransacIterations ,
int refineIterations ,
DetectDescribeMulti<T,Desc> detector,
Class<T> imageType )
{
EstimateNofPnP pnp = FactoryMultiView.pnp_N(EnumPNP.P3P_FINSTERWALDER, -1);
DistanceFromModelMultiView<Se3_F64,Point2D3D> distanceMono = new PnPDistanceReprojectionSq();
PnPStereoDistanceReprojectionSq distanceStereo = new PnPStereoDistanceReprojectionSq();
PnPStereoEstimator pnpStereo = new PnPStereoEstimator(pnp,distanceMono,0);
ModelManagerSe3_F64 manager = new ModelManagerSe3_F64();
EstimatorToGenerator<Se3_F64,Stereo2D3D> generator = new EstimatorToGenerator<>(pnpStereo);
// euclidean error squared from left + right images
double ransacTOL = 2*inlierPixelTol * inlierPixelTol;
ModelMatcher<Se3_F64, Stereo2D3D> motion =
new Ransac<>(2323, manager, generator, distanceStereo, ransacIterations, ransacTOL);
RefinePnPStereo refinePnP = null;
if( refineIterations > 0 ) {
refinePnP = new PnPStereoRefineRodrigues(1e-12,refineIterations);
}
Class<Desc> descType = detector.getDescriptionType();
ScoreAssociation<Desc> scorer = FactoryAssociation.defaultScore(descType);
// TODO need a better way to keep track of what error is squared and not
AssociateDescription2D<Desc> assocSame;
if( maxDistanceF2F > 0 ) {
AssociateMaxDistanceNaive<Desc> a = new AssociateMaxDistanceNaive<>(scorer, true, maxAssociationError);
a.setSquaredDistance(true);
a.setMaxDistance(maxDistanceF2F);
assocSame = a;
} else {
assocSame = new AssociateDescTo2D<>(FactoryAssociation.greedy(scorer, maxAssociationError, true));
}
AssociateStereo2D<Desc> associateStereo = new AssociateStereo2D<>(scorer, epipolarPixelTol, descType);
Triangulate2ViewsMetric triangulate = FactoryMultiView.triangulate2ViewMetric(
new ConfigTriangulation(ConfigTriangulation.Type.GEOMETRIC));
associateStereo.setMaxScoreThreshold(maxAssociationError);
VisOdomQuadPnP<T,Desc> alg = new VisOdomQuadPnP<>(
detector, assocSame, associateStereo, triangulate, motion, refinePnP);
return new WrapVisOdomQuadPnP<>(alg, refinePnP, associateStereo, distanceStereo, distanceMono, imageType);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
",",
"Desc",
"extends",
"TupleDesc",
">",
"StereoVisualOdometry",
"<",
"T",
">",
"stereoQuadPnP",
"(",
"double",
"inlierPixelTol",
",",
"double",
"epipolarPixelTol",
",",
"double",
"maxDistance... | Stereo visual odometry which uses the two most recent stereo observations (total of four views) to estimate
motion.
@see VisOdomQuadPnP
@param inlierPixelTol Pixel tolerance for RANSAC inliers - Euclidean distance
@param epipolarPixelTol Feature association tolerance in pixels.
@param maxDistanceF2F Maximum allowed distance between two features in pixels
@param maxAssociationError Maxium error between two features when associating.
@param ransacIterations Number of iterations RANSAC will perform
@param refineIterations Number of refinement iterations
@param detector Which feature detector to use
@param imageType Type of input image | [
"Stereo",
"visual",
"odometry",
"which",
"uses",
"the",
"two",
"most",
"recent",
"stereo",
"observations",
"(",
"total",
"of",
"four",
"views",
")",
"to",
"estimate",
"motion",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/factory/sfm/FactoryVisualOdometry.java#L357-L411 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/RuleInformation.java | RuleInformation.ignoreForIncompleteSentences | public static boolean ignoreForIncompleteSentences(String ruleId, Language lang) {
return rules.contains(new Key(lang.getShortCode(), ruleId));
} | java | public static boolean ignoreForIncompleteSentences(String ruleId, Language lang) {
return rules.contains(new Key(lang.getShortCode(), ruleId));
} | [
"public",
"static",
"boolean",
"ignoreForIncompleteSentences",
"(",
"String",
"ruleId",
",",
"Language",
"lang",
")",
"{",
"return",
"rules",
".",
"contains",
"(",
"new",
"Key",
"(",
"lang",
".",
"getShortCode",
"(",
")",
",",
"ruleId",
")",
")",
";",
"}"
... | Whether this rule should be ignored when the sentence isn't finished yet.
@since 4.4 | [
"Whether",
"this",
"rule",
"should",
"be",
"ignored",
"when",
"the",
"sentence",
"isn",
"t",
"finished",
"yet",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/RuleInformation.java#L65-L67 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/validation/SARLUIStrings.java | SARLUIStrings.parametersToStyledString | protected StyledString parametersToStyledString(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName) {
return getParameterStyledString(elements, isVarArgs, includeName, this.keywords, this.annotationFinder, this);
} | java | protected StyledString parametersToStyledString(Iterable<? extends JvmFormalParameter> elements, boolean isVarArgs, boolean includeName) {
return getParameterStyledString(elements, isVarArgs, includeName, this.keywords, this.annotationFinder, this);
} | [
"protected",
"StyledString",
"parametersToStyledString",
"(",
"Iterable",
"<",
"?",
"extends",
"JvmFormalParameter",
">",
"elements",
",",
"boolean",
"isVarArgs",
",",
"boolean",
"includeName",
")",
"{",
"return",
"getParameterStyledString",
"(",
"elements",
",",
"isV... | Replies the styled string representation of the parameters.
@param elements the parameters.
@param isVarArgs indicates if the last parameter is variadic.
@param includeName indicates if the names are included.
@return the styled string.
@since 0.6 | [
"Replies",
"the",
"styled",
"string",
"representation",
"of",
"the",
"parameters",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/validation/SARLUIStrings.java#L113-L115 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java | FieldDescriptorConstraints.checkAnonymous | private void checkAnonymous(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
String access = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ACCESS);
if (!"anonymous".equals(access))
{
throw new ConstraintException("The access property of the field "+fieldDef.getName()+" defined in class "+fieldDef.getOwner().getName()+" cannot be changed");
}
if ((fieldDef.getName() == null) || (fieldDef.getName().length() == 0))
{
throw new ConstraintException("An anonymous field defined in class "+fieldDef.getOwner().getName()+" has no name");
}
} | java | private void checkAnonymous(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
String access = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ACCESS);
if (!"anonymous".equals(access))
{
throw new ConstraintException("The access property of the field "+fieldDef.getName()+" defined in class "+fieldDef.getOwner().getName()+" cannot be changed");
}
if ((fieldDef.getName() == null) || (fieldDef.getName().length() == 0))
{
throw new ConstraintException("An anonymous field defined in class "+fieldDef.getOwner().getName()+" has no name");
}
} | [
"private",
"void",
"checkAnonymous",
"(",
"FieldDescriptorDef",
"fieldDef",
",",
"String",
"checkLevel",
")",
"throws",
"ConstraintException",
"{",
"if",
"(",
"CHECKLEVEL_NONE",
".",
"equals",
"(",
"checkLevel",
")",
")",
"{",
"return",
";",
"}",
"String",
"acce... | Checks anonymous fields.
@param fieldDef The field descriptor
@param checkLevel The current check level (this constraint is checked in basic and strict)
@exception ConstraintException If the constraint has been violated | [
"Checks",
"anonymous",
"fields",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java#L420-L438 |
groovy/groovy-core | src/main/groovy/lang/GroovyClassLoader.java | GroovyClassLoader.parseClass | public Class parseClass(GroovyCodeSource codeSource, boolean shouldCacheSource) throws CompilationFailedException {
synchronized (sourceCache) {
Class answer = sourceCache.get(codeSource.getName());
if (answer != null) return answer;
answer = doParseClass(codeSource);
if (shouldCacheSource) sourceCache.put(codeSource.getName(), answer);
return answer;
}
} | java | public Class parseClass(GroovyCodeSource codeSource, boolean shouldCacheSource) throws CompilationFailedException {
synchronized (sourceCache) {
Class answer = sourceCache.get(codeSource.getName());
if (answer != null) return answer;
answer = doParseClass(codeSource);
if (shouldCacheSource) sourceCache.put(codeSource.getName(), answer);
return answer;
}
} | [
"public",
"Class",
"parseClass",
"(",
"GroovyCodeSource",
"codeSource",
",",
"boolean",
"shouldCacheSource",
")",
"throws",
"CompilationFailedException",
"{",
"synchronized",
"(",
"sourceCache",
")",
"{",
"Class",
"answer",
"=",
"sourceCache",
".",
"get",
"(",
"code... | Parses the given code source into a Java class. If there is a class file
for the given code source, then no parsing is done, instead the cached class is returned.
@param shouldCacheSource if true then the generated class will be stored in the source cache
@return the main class defined in the given script | [
"Parses",
"the",
"given",
"code",
"source",
"into",
"a",
"Java",
"class",
".",
"If",
"there",
"is",
"a",
"class",
"file",
"for",
"the",
"given",
"code",
"source",
"then",
"no",
"parsing",
"is",
"done",
"instead",
"the",
"cached",
"class",
"is",
"returned... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/GroovyClassLoader.java#L265-L273 |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/iter/RecurrenceIteratorFactory.java | RecurrenceIteratorFactory.join | public static RecurrenceIterator join(RecurrenceIterator first, RecurrenceIterator... rest) {
List<RecurrenceIterator> all = new ArrayList<RecurrenceIterator>();
all.add(first);
all.addAll(Arrays.asList(rest));
return new CompoundIteratorImpl(all, Collections.<RecurrenceIterator> emptyList());
} | java | public static RecurrenceIterator join(RecurrenceIterator first, RecurrenceIterator... rest) {
List<RecurrenceIterator> all = new ArrayList<RecurrenceIterator>();
all.add(first);
all.addAll(Arrays.asList(rest));
return new CompoundIteratorImpl(all, Collections.<RecurrenceIterator> emptyList());
} | [
"public",
"static",
"RecurrenceIterator",
"join",
"(",
"RecurrenceIterator",
"first",
",",
"RecurrenceIterator",
"...",
"rest",
")",
"{",
"List",
"<",
"RecurrenceIterator",
">",
"all",
"=",
"new",
"ArrayList",
"<",
"RecurrenceIterator",
">",
"(",
")",
";",
"all"... | Generates a recurrence iterator that iterates over the union of the given
recurrence iterators.
@param first the first recurrence iterator
@param rest the other recurrence iterators
@return the union iterator | [
"Generates",
"a",
"recurrence",
"iterator",
"that",
"iterates",
"over",
"the",
"union",
"of",
"the",
"given",
"recurrence",
"iterators",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/RecurrenceIteratorFactory.java#L461-L466 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java | CmsFocalPointController.updateImage | public void updateImage(FlowPanel container, Image previewImage) {
if (!ENABLED) {
return;
}
String path = m_imageInfoProvider.get().getResourcePath();
if (CmsClientStringUtil.checkIsPathOrLinkToSvg(path)) {
return;
}
m_image = previewImage;
clearImagePoint();
m_savedFocalPoint = m_imageInfoProvider.get().getFocalPoint();
m_focalPoint = m_savedFocalPoint;
m_container = container;
previewImage.addLoadHandler(new LoadHandler() {
@SuppressWarnings("synthetic-access")
public void onLoad(LoadEvent event) {
updateScaling();
updatePoint();
}
});
} | java | public void updateImage(FlowPanel container, Image previewImage) {
if (!ENABLED) {
return;
}
String path = m_imageInfoProvider.get().getResourcePath();
if (CmsClientStringUtil.checkIsPathOrLinkToSvg(path)) {
return;
}
m_image = previewImage;
clearImagePoint();
m_savedFocalPoint = m_imageInfoProvider.get().getFocalPoint();
m_focalPoint = m_savedFocalPoint;
m_container = container;
previewImage.addLoadHandler(new LoadHandler() {
@SuppressWarnings("synthetic-access")
public void onLoad(LoadEvent event) {
updateScaling();
updatePoint();
}
});
} | [
"public",
"void",
"updateImage",
"(",
"FlowPanel",
"container",
",",
"Image",
"previewImage",
")",
"{",
"if",
"(",
"!",
"ENABLED",
")",
"{",
"return",
";",
"}",
"String",
"path",
"=",
"m_imageInfoProvider",
".",
"get",
"(",
")",
".",
"getResourcePath",
"("... | Updates the image.<p>
@param container the parent widget for the image
@param previewImage the image | [
"Updates",
"the",
"image",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java#L224-L249 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java | LongExtensions.operator_modulo | @Pure
@Inline(value="($1 % $2)", constantExpression=true)
public static double operator_modulo(long a, double b) {
return a % b;
} | java | @Pure
@Inline(value="($1 % $2)", constantExpression=true)
public static double operator_modulo(long a, double b) {
return a % b;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"($1 % $2)\"",
",",
"constantExpression",
"=",
"true",
")",
"public",
"static",
"double",
"operator_modulo",
"(",
"long",
"a",
",",
"double",
"b",
")",
"{",
"return",
"a",
"%",
"b",
";",
"}"
] | The binary <code>modulo</code> operator. This is the equivalent to the Java <code>%</code> operator.
@param a a long.
@param b a double.
@return <code>a%b</code>
@since 2.3 | [
"The",
"binary",
"<code",
">",
"modulo<",
"/",
"code",
">",
"operator",
".",
"This",
"is",
"the",
"equivalent",
"to",
"the",
"Java",
"<code",
">",
"%<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java#L306-L310 |
ptgoetz/storm-hbase | src/main/java/org/apache/storm/hbase/common/ColumnList.java | ColumnList.addCounter | public ColumnList addCounter(byte[] family, byte[] qualifier, long incr){
counters().add(new Counter(family, qualifier, incr));
return this;
} | java | public ColumnList addCounter(byte[] family, byte[] qualifier, long incr){
counters().add(new Counter(family, qualifier, incr));
return this;
} | [
"public",
"ColumnList",
"addCounter",
"(",
"byte",
"[",
"]",
"family",
",",
"byte",
"[",
"]",
"qualifier",
",",
"long",
"incr",
")",
"{",
"counters",
"(",
")",
".",
"add",
"(",
"new",
"Counter",
"(",
"family",
",",
"qualifier",
",",
"incr",
")",
")",... | Add an HBase counter column.
@param family
@param qualifier
@param incr
@return | [
"Add",
"an",
"HBase",
"counter",
"column",
"."
] | train | https://github.com/ptgoetz/storm-hbase/blob/509e41514bb92ef65dba1449bbd935557dc8193c/src/main/java/org/apache/storm/hbase/common/ColumnList.java#L151-L154 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/Event.java | Event.withAttributes | public Event withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public Event withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"Event",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | Custom attributes that are associated with the event you're adding or updating.
@param attributes
Custom attributes that are associated with the event you're adding or updating.
@return Returns a reference to this object so that method calls can be chained together. | [
"Custom",
"attributes",
"that",
"are",
"associated",
"with",
"the",
"event",
"you",
"re",
"adding",
"or",
"updating",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/Event.java#L181-L184 |
apereo/cas | support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java | OAuth20Utils.checkResponseTypes | public static boolean checkResponseTypes(final String type, final OAuth20ResponseTypes... expectedTypes) {
LOGGER.debug("Response type: [{}]", type);
val checked = Stream.of(expectedTypes).anyMatch(t -> OAuth20Utils.isResponseType(type, t));
if (!checked) {
LOGGER.error("Unsupported response type: [{}]", type);
}
return checked;
} | java | public static boolean checkResponseTypes(final String type, final OAuth20ResponseTypes... expectedTypes) {
LOGGER.debug("Response type: [{}]", type);
val checked = Stream.of(expectedTypes).anyMatch(t -> OAuth20Utils.isResponseType(type, t));
if (!checked) {
LOGGER.error("Unsupported response type: [{}]", type);
}
return checked;
} | [
"public",
"static",
"boolean",
"checkResponseTypes",
"(",
"final",
"String",
"type",
",",
"final",
"OAuth20ResponseTypes",
"...",
"expectedTypes",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Response type: [{}]\"",
",",
"type",
")",
";",
"val",
"checked",
"=",
"St... | Check the response type against expected response types.
@param type the current response type
@param expectedTypes the expected response types
@return whether the response type is supported | [
"Check",
"the",
"response",
"type",
"against",
"expected",
"response",
"types",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java#L406-L413 |
netkicorp/java-wns-resolver | src/main/java/com/netki/tlsa/CertChainValidator.java | CertChainValidator.validateKeyChain | public boolean validateKeyChain(X509Certificate client, KeyStore keyStore) throws KeyStoreException, CertificateException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException {
X509Certificate[] certs = new X509Certificate[keyStore.size()];
int i = 0;
Enumeration<String> alias = keyStore.aliases();
while (alias.hasMoreElements()) {
certs[i++] = (X509Certificate) keyStore.getCertificate(alias.nextElement());
}
return validateKeyChain(client, certs);
} | java | public boolean validateKeyChain(X509Certificate client, KeyStore keyStore) throws KeyStoreException, CertificateException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException {
X509Certificate[] certs = new X509Certificate[keyStore.size()];
int i = 0;
Enumeration<String> alias = keyStore.aliases();
while (alias.hasMoreElements()) {
certs[i++] = (X509Certificate) keyStore.getCertificate(alias.nextElement());
}
return validateKeyChain(client, certs);
} | [
"public",
"boolean",
"validateKeyChain",
"(",
"X509Certificate",
"client",
",",
"KeyStore",
"keyStore",
")",
"throws",
"KeyStoreException",
",",
"CertificateException",
",",
"InvalidAlgorithmParameterException",
",",
"NoSuchAlgorithmException",
",",
"NoSuchProviderException",
... | Validate keychain
@param client is the client X509Certificate
@param keyStore containing all trusted certificate
@return true if validation until root certificate success, false otherwise
@throws KeyStoreException KeyStore is invalid
@throws CertificateException Certificate is Invalid
@throws InvalidAlgorithmParameterException Algorithm Parameter is Invalid
@throws NoSuchAlgorithmException Algorithm Does Not Exist
@throws NoSuchProviderException No Such Security Provider Exists | [
"Validate",
"keychain"
] | train | https://github.com/netkicorp/java-wns-resolver/blob/a7aad04d96c03feb05536aef189617beb4f011bc/src/main/java/com/netki/tlsa/CertChainValidator.java#L27-L39 |
awslabs/dynamodb-janusgraph-storage-backend | src/main/java/com/amazon/janusgraph/diskstorage/dynamodb/DynamoDbStoreTransaction.java | DynamoDbStoreTransaction.contains | public boolean contains(final AbstractDynamoDbStore store, final StaticBuffer key, final StaticBuffer column) {
return expectedValues.containsKey(store)
&& expectedValues.get(store).containsKey(key)
&& expectedValues.get(store).get(key).containsKey(column);
} | java | public boolean contains(final AbstractDynamoDbStore store, final StaticBuffer key, final StaticBuffer column) {
return expectedValues.containsKey(store)
&& expectedValues.get(store).containsKey(key)
&& expectedValues.get(store).get(key).containsKey(column);
} | [
"public",
"boolean",
"contains",
"(",
"final",
"AbstractDynamoDbStore",
"store",
",",
"final",
"StaticBuffer",
"key",
",",
"final",
"StaticBuffer",
"column",
")",
"{",
"return",
"expectedValues",
".",
"containsKey",
"(",
"store",
")",
"&&",
"expectedValues",
".",
... | Determins whether a particular key and column are part of this transaction
@param key key to check for existence
@param column column to check for existence
@return true if both the key and column combination are in this transaction and false otherwise. | [
"Determins",
"whether",
"a",
"particular",
"key",
"and",
"column",
"are",
"part",
"of",
"this",
"transaction"
] | train | https://github.com/awslabs/dynamodb-janusgraph-storage-backend/blob/e7ba180d2c40d8ea777e320d9a542725a5229fc0/src/main/java/com/amazon/janusgraph/diskstorage/dynamodb/DynamoDbStoreTransaction.java#L87-L91 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/FieldUpdater.java | FieldUpdater.createFieldUpdater | public static FieldUpdater createFieldUpdater(ObjectUpdater objUpdater, DBObject dbObj, String fieldName) {
if (fieldName.charAt(0) == '_') {
if (fieldName.equals(CommonDefs.ID_FIELD)) {
return new IDFieldUpdater(objUpdater, dbObj);
} else {
// Allow but skip all other system fields (e.g., "_table")
return new NullFieldUpdater(objUpdater, dbObj, fieldName);
}
}
TableDefinition tableDef = objUpdater.getTableDef();
if (tableDef.isLinkField(fieldName)) {
return new LinkFieldUpdater(objUpdater, dbObj, fieldName);
} else {
Utils.require(FieldDefinition.isValidFieldName(fieldName), "Invalid field name: %s", fieldName);
return new ScalarFieldUpdater(objUpdater, dbObj, fieldName);
}
} | java | public static FieldUpdater createFieldUpdater(ObjectUpdater objUpdater, DBObject dbObj, String fieldName) {
if (fieldName.charAt(0) == '_') {
if (fieldName.equals(CommonDefs.ID_FIELD)) {
return new IDFieldUpdater(objUpdater, dbObj);
} else {
// Allow but skip all other system fields (e.g., "_table")
return new NullFieldUpdater(objUpdater, dbObj, fieldName);
}
}
TableDefinition tableDef = objUpdater.getTableDef();
if (tableDef.isLinkField(fieldName)) {
return new LinkFieldUpdater(objUpdater, dbObj, fieldName);
} else {
Utils.require(FieldDefinition.isValidFieldName(fieldName), "Invalid field name: %s", fieldName);
return new ScalarFieldUpdater(objUpdater, dbObj, fieldName);
}
} | [
"public",
"static",
"FieldUpdater",
"createFieldUpdater",
"(",
"ObjectUpdater",
"objUpdater",
",",
"DBObject",
"dbObj",
",",
"String",
"fieldName",
")",
"{",
"if",
"(",
"fieldName",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"{",
"if",
"(",
"fieldN... | Create a FieldUpdater that will handle updates for the given object and field.
@param tableDef {@link TableDefinition} of table in which object resides.
@param dbObj {@link DBObject} of object being added, updated, or deleted.
@param fieldName Name of field the new FieldUpdater will handle. Can be the
_ID field, a declared or undeclared scalar field, or a link
field.
@return A FieldUpdater that can perform updates for the given object
and field. | [
"Create",
"a",
"FieldUpdater",
"that",
"will",
"handle",
"updates",
"for",
"the",
"given",
"object",
"and",
"field",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/FieldUpdater.java#L54-L70 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/index/composites/CompositesIndex.java | CompositesIndex.getIndexComparator | public static CellNameType getIndexComparator(CFMetaData baseMetadata, ColumnDefinition cfDef)
{
if (cfDef.type.isCollection() && cfDef.type.isMultiCell())
{
switch (((CollectionType)cfDef.type).kind)
{
case LIST:
return CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef);
case SET:
return CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef);
case MAP:
return cfDef.hasIndexOption(SecondaryIndex.INDEX_KEYS_OPTION_NAME)
? CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef)
: CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef);
}
}
switch (cfDef.kind)
{
case CLUSTERING_COLUMN:
return CompositesIndexOnClusteringKey.buildIndexComparator(baseMetadata, cfDef);
case REGULAR:
return CompositesIndexOnRegular.buildIndexComparator(baseMetadata, cfDef);
case PARTITION_KEY:
return CompositesIndexOnPartitionKey.buildIndexComparator(baseMetadata, cfDef);
//case COMPACT_VALUE:
// return CompositesIndexOnCompactValue.buildIndexComparator(baseMetadata, cfDef);
}
throw new AssertionError();
} | java | public static CellNameType getIndexComparator(CFMetaData baseMetadata, ColumnDefinition cfDef)
{
if (cfDef.type.isCollection() && cfDef.type.isMultiCell())
{
switch (((CollectionType)cfDef.type).kind)
{
case LIST:
return CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef);
case SET:
return CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef);
case MAP:
return cfDef.hasIndexOption(SecondaryIndex.INDEX_KEYS_OPTION_NAME)
? CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef)
: CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef);
}
}
switch (cfDef.kind)
{
case CLUSTERING_COLUMN:
return CompositesIndexOnClusteringKey.buildIndexComparator(baseMetadata, cfDef);
case REGULAR:
return CompositesIndexOnRegular.buildIndexComparator(baseMetadata, cfDef);
case PARTITION_KEY:
return CompositesIndexOnPartitionKey.buildIndexComparator(baseMetadata, cfDef);
//case COMPACT_VALUE:
// return CompositesIndexOnCompactValue.buildIndexComparator(baseMetadata, cfDef);
}
throw new AssertionError();
} | [
"public",
"static",
"CellNameType",
"getIndexComparator",
"(",
"CFMetaData",
"baseMetadata",
",",
"ColumnDefinition",
"cfDef",
")",
"{",
"if",
"(",
"cfDef",
".",
"type",
".",
"isCollection",
"(",
")",
"&&",
"cfDef",
".",
"type",
".",
"isMultiCell",
"(",
")",
... | Check SecondaryIndex.getIndexComparator if you want to know why this is static | [
"Check",
"SecondaryIndex",
".",
"getIndexComparator",
"if",
"you",
"want",
"to",
"know",
"why",
"this",
"is",
"static"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/index/composites/CompositesIndex.java#L91-L120 |
uniform-java/uniform | src/main/java/net/uniform/impl/ElementWithOptions.java | ElementWithOptions.addOptionToGroup | public ElementWithOptions addOptionToGroup(Option option, String groupId) {
if (option == null) {
throw new IllegalArgumentException("Option cannot be null");
}
for (OptionGroup group : optionGroups.values()) {
if (group.hasValue(option.getValue())) {
throw new IllegalArgumentException("The value '" + option.getValue() + "' is already present in this element");
}
}
OptionGroup group = optionGroups.get(groupId);
if (group == null) {
group = new OptionGroup(groupId, null);
this.addOptionGroup(group);
}
group.addOption(option);
return this;
} | java | public ElementWithOptions addOptionToGroup(Option option, String groupId) {
if (option == null) {
throw new IllegalArgumentException("Option cannot be null");
}
for (OptionGroup group : optionGroups.values()) {
if (group.hasValue(option.getValue())) {
throw new IllegalArgumentException("The value '" + option.getValue() + "' is already present in this element");
}
}
OptionGroup group = optionGroups.get(groupId);
if (group == null) {
group = new OptionGroup(groupId, null);
this.addOptionGroup(group);
}
group.addOption(option);
return this;
} | [
"public",
"ElementWithOptions",
"addOptionToGroup",
"(",
"Option",
"option",
",",
"String",
"groupId",
")",
"{",
"if",
"(",
"option",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Option cannot be null\"",
")",
";",
"}",
"for",
"(",... | Adds an option to the group of this element with the given id. If the group is not found, it's created with null text.
@param option New option with unique value in this element
@param groupId Id of the option group
@return This element | [
"Adds",
"an",
"option",
"to",
"the",
"group",
"of",
"this",
"element",
"with",
"the",
"given",
"id",
".",
"If",
"the",
"group",
"is",
"not",
"found",
"it",
"s",
"created",
"with",
"null",
"text",
"."
] | train | https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L106-L127 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java | SDNN.batchNorm | public SDVariable batchNorm(SDVariable input, SDVariable mean,
SDVariable variance, SDVariable gamma,
SDVariable beta, double epsilon, int... axis) {
return batchNorm(null, input, mean, variance, gamma, beta, true, true, epsilon, axis);
} | java | public SDVariable batchNorm(SDVariable input, SDVariable mean,
SDVariable variance, SDVariable gamma,
SDVariable beta, double epsilon, int... axis) {
return batchNorm(null, input, mean, variance, gamma, beta, true, true, epsilon, axis);
} | [
"public",
"SDVariable",
"batchNorm",
"(",
"SDVariable",
"input",
",",
"SDVariable",
"mean",
",",
"SDVariable",
"variance",
",",
"SDVariable",
"gamma",
",",
"SDVariable",
"beta",
",",
"double",
"epsilon",
",",
"int",
"...",
"axis",
")",
"{",
"return",
"batchNor... | Batch norm operation.
@see #batchNorm(String, SDVariable, SDVariable, SDVariable, SDVariable, SDVariable, double, int...) | [
"Batch",
"norm",
"operation",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L31-L35 |
jpelzer/pelzer-util | src/main/java/com/pelzer/util/json/JSONUtil.java | JSONUtil.fromJSON | public static JSONObject fromJSON(String json) {
int index1 = json.lastIndexOf("\"_i\":\"");
if (index1 < 0)
throw new JsonParseException("Unable to find _i key.");
index1 += 6;
int index2 = json.indexOf("\"", index1 + 1);
if (index2 < 0)
throw new JsonParseException("Unable to find end of _i value.");
String id = json.substring(index1, index2);
Class<? extends JSONObject> clazz = registrations.get(id);
if (clazz == null){
// See if the id is a full classname
try{
clazz = (Class<? extends JSONObject>) Class.forName(id);
registrations.put(id, clazz);
}catch(ClassNotFoundException ex){
throw new JsonParseException("No registration for JSONObject message.identifier:" + id);
}
}
return fromJSON(json, clazz);
} | java | public static JSONObject fromJSON(String json) {
int index1 = json.lastIndexOf("\"_i\":\"");
if (index1 < 0)
throw new JsonParseException("Unable to find _i key.");
index1 += 6;
int index2 = json.indexOf("\"", index1 + 1);
if (index2 < 0)
throw new JsonParseException("Unable to find end of _i value.");
String id = json.substring(index1, index2);
Class<? extends JSONObject> clazz = registrations.get(id);
if (clazz == null){
// See if the id is a full classname
try{
clazz = (Class<? extends JSONObject>) Class.forName(id);
registrations.put(id, clazz);
}catch(ClassNotFoundException ex){
throw new JsonParseException("No registration for JSONObject message.identifier:" + id);
}
}
return fromJSON(json, clazz);
} | [
"public",
"static",
"JSONObject",
"fromJSON",
"(",
"String",
"json",
")",
"{",
"int",
"index1",
"=",
"json",
".",
"lastIndexOf",
"(",
"\"\\\"_i\\\":\\\"\"",
")",
";",
"if",
"(",
"index1",
"<",
"0",
")",
"throw",
"new",
"JsonParseException",
"(",
"\"Unable to... | Parses the given JSON and looks for the "_i" key, which is then looked up
against calls to {@link #register(JSONObject)}, and then returns the result
of {@link #fromJSON(String, Class)} | [
"Parses",
"the",
"given",
"JSON",
"and",
"looks",
"for",
"the",
"_i",
"key",
"which",
"is",
"then",
"looked",
"up",
"against",
"calls",
"to",
"{"
] | train | https://github.com/jpelzer/pelzer-util/blob/ec14f2573fd977d1442dba5d1507a264f5ea9aa6/src/main/java/com/pelzer/util/json/JSONUtil.java#L40-L60 |
google/closure-compiler | src/com/google/javascript/jscomp/Es6ToEs3Util.java | Es6ToEs3Util.createType | static JSType createType(boolean shouldCreate, JSTypeRegistry registry, JSTypeNative typeName) {
if (!shouldCreate) {
return null;
}
return registry.getNativeType(typeName);
} | java | static JSType createType(boolean shouldCreate, JSTypeRegistry registry, JSTypeNative typeName) {
if (!shouldCreate) {
return null;
}
return registry.getNativeType(typeName);
} | [
"static",
"JSType",
"createType",
"(",
"boolean",
"shouldCreate",
",",
"JSTypeRegistry",
"registry",
",",
"JSTypeNative",
"typeName",
")",
"{",
"if",
"(",
"!",
"shouldCreate",
")",
"{",
"return",
"null",
";",
"}",
"return",
"registry",
".",
"getNativeType",
"(... | Returns the JSType as specified by the typeName.
Returns null if shouldCreate is false. | [
"Returns",
"the",
"JSType",
"as",
"specified",
"by",
"the",
"typeName",
".",
"Returns",
"null",
"if",
"shouldCreate",
"is",
"false",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6ToEs3Util.java#L108-L113 |
xmlunit/xmlunit | xmlunit-core/src/main/java/org/xmlunit/diff/RecursiveXPathBuilder.java | RecursiveXPathBuilder.setNamespaceContext | public void setNamespaceContext(Map<String, String> prefix2uri) {
this.prefix2uri = prefix2uri == null
? Collections.<String, String> emptyMap()
: Collections.unmodifiableMap(prefix2uri);
} | java | public void setNamespaceContext(Map<String, String> prefix2uri) {
this.prefix2uri = prefix2uri == null
? Collections.<String, String> emptyMap()
: Collections.unmodifiableMap(prefix2uri);
} | [
"public",
"void",
"setNamespaceContext",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"prefix2uri",
")",
"{",
"this",
".",
"prefix2uri",
"=",
"prefix2uri",
"==",
"null",
"?",
"Collections",
".",
"<",
"String",
",",
"String",
">",
"emptyMap",
"(",
")",
... | Establish a namespace context that will be used in for the
XPath.
<p>Without a namespace context (or with an empty context) the
XPath expressions will only use local names for elements and
attributes.</p>
@param prefix2uri maps from prefix to namespace URI. | [
"Establish",
"a",
"namespace",
"context",
"that",
"will",
"be",
"used",
"in",
"for",
"the",
"XPath",
"."
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/RecursiveXPathBuilder.java#L45-L49 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.replaceAll | public StrBuilder replaceAll(final char search, final char replace) {
if (search != replace) {
for (int i = 0; i < size; i++) {
if (buffer[i] == search) {
buffer[i] = replace;
}
}
}
return this;
} | java | public StrBuilder replaceAll(final char search, final char replace) {
if (search != replace) {
for (int i = 0; i < size; i++) {
if (buffer[i] == search) {
buffer[i] = replace;
}
}
}
return this;
} | [
"public",
"StrBuilder",
"replaceAll",
"(",
"final",
"char",
"search",
",",
"final",
"char",
"replace",
")",
"{",
"if",
"(",
"search",
"!=",
"replace",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"i... | Replaces the search character with the replace character
throughout the builder.
@param search the search character
@param replace the replace character
@return this, to enable chaining | [
"Replaces",
"the",
"search",
"character",
"with",
"the",
"replace",
"character",
"throughout",
"the",
"builder",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1967-L1976 |
alkacon/opencms-core | src/org/opencms/ui/components/codemirror/CmsCodeMirror.java | CmsCodeMirror.registerUndoRedo | public void registerUndoRedo(Button undo, Button redo) {
if (getState().m_enableUndoRedo) {
throw new RuntimeException("Undo/redo already registered.");
}
undo.setId(HTML_ID_PREFIX + m_componentId + "-undo");
redo.setId(HTML_ID_PREFIX + m_componentId + "-redo");
getState().m_enableUndoRedo = true;
markAsDirty();
} | java | public void registerUndoRedo(Button undo, Button redo) {
if (getState().m_enableUndoRedo) {
throw new RuntimeException("Undo/redo already registered.");
}
undo.setId(HTML_ID_PREFIX + m_componentId + "-undo");
redo.setId(HTML_ID_PREFIX + m_componentId + "-redo");
getState().m_enableUndoRedo = true;
markAsDirty();
} | [
"public",
"void",
"registerUndoRedo",
"(",
"Button",
"undo",
",",
"Button",
"redo",
")",
"{",
"if",
"(",
"getState",
"(",
")",
".",
"m_enableUndoRedo",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Undo/redo already registered.\"",
")",
";",
"}",
"undo... | Registers the given buttons as undo redo buttons.<p>
@param undo the undo button
@param redo the redo button | [
"Registers",
"the",
"given",
"buttons",
"as",
"undo",
"redo",
"buttons",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/codemirror/CmsCodeMirror.java#L564-L573 |
hawkular/hawkular-apm | client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java | RuleHelper.createInOutputStream | public OutputStream createInOutputStream(OutputStream os, String linkId) {
return new InstrumentedOutputStream(collector(), Direction.In, os, linkId);
} | java | public OutputStream createInOutputStream(OutputStream os, String linkId) {
return new InstrumentedOutputStream(collector(), Direction.In, os, linkId);
} | [
"public",
"OutputStream",
"createInOutputStream",
"(",
"OutputStream",
"os",
",",
"String",
"linkId",
")",
"{",
"return",
"new",
"InstrumentedOutputStream",
"(",
"collector",
"(",
")",
",",
"Direction",
".",
"In",
",",
"os",
",",
"linkId",
")",
";",
"}"
] | This method returns an instrumented proxy output stream, to wrap
the supplied output stream, which will record the written data. The
optional link id can be used to initiate a link with the specified
id (and disassociate the trace from the current thread).
@param os The original output stream
@param linkId The optional link id
@return The instrumented output stream | [
"This",
"method",
"returns",
"an",
"instrumented",
"proxy",
"output",
"stream",
"to",
"wrap",
"the",
"supplied",
"output",
"stream",
"which",
"will",
"record",
"the",
"written",
"data",
".",
"The",
"optional",
"link",
"id",
"can",
"be",
"used",
"to",
"initia... | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java#L606-L608 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/MultiMap.java | MultiMap.addValues | public void addValues(Object name, String[] values)
{
Object lo = super.get(name);
Object ln = LazyList.addCollection(lo,Arrays.asList(values));
if (lo!=ln)
super.put(name,ln);
} | java | public void addValues(Object name, String[] values)
{
Object lo = super.get(name);
Object ln = LazyList.addCollection(lo,Arrays.asList(values));
if (lo!=ln)
super.put(name,ln);
} | [
"public",
"void",
"addValues",
"(",
"Object",
"name",
",",
"String",
"[",
"]",
"values",
")",
"{",
"Object",
"lo",
"=",
"super",
".",
"get",
"(",
"name",
")",
";",
"Object",
"ln",
"=",
"LazyList",
".",
"addCollection",
"(",
"lo",
",",
"Arrays",
".",
... | Add values to multi valued entry.
If the entry is single valued, it is converted to the first
value of a multi valued entry.
@param name The entry key.
@param values The String array of multiple values. | [
"Add",
"values",
"to",
"multi",
"valued",
"entry",
".",
"If",
"the",
"entry",
"is",
"single",
"valued",
"it",
"is",
"converted",
"to",
"the",
"first",
"value",
"of",
"a",
"multi",
"valued",
"entry",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/MultiMap.java#L213-L219 |
highsource/hyperjaxb3 | ejb/plugin/src/main/java/org/jvnet/hyperjaxb3/xjc/reader/TypeUtil.java | TypeUtil.getAssignableTypes | private static void getAssignableTypes( JClass t, Set<JClass> s ) {
if(!s.add(t))
return;
// TODO
// if (t.fullName().equals(Equals.class.getName()) ||
// t.fullName().equals(HashCode.class.getName()) ||
// t.fullName().equals(ToString.class.getName()) ||
// t.fullName().equals(CopyTo.class.getName())
// )
// add its raw type
s.add(t.erasure());
// if this type is added for the first time,
// recursively process the super class.
JClass _super = t._extends();
if(_super!=null)
getAssignableTypes(_super,s);
// recursively process all implemented interfaces
Iterator<JClass> itr = t._implements();
while(itr.hasNext())
{
getAssignableTypes(itr.next(),s);
}
} | java | private static void getAssignableTypes( JClass t, Set<JClass> s ) {
if(!s.add(t))
return;
// TODO
// if (t.fullName().equals(Equals.class.getName()) ||
// t.fullName().equals(HashCode.class.getName()) ||
// t.fullName().equals(ToString.class.getName()) ||
// t.fullName().equals(CopyTo.class.getName())
// )
// add its raw type
s.add(t.erasure());
// if this type is added for the first time,
// recursively process the super class.
JClass _super = t._extends();
if(_super!=null)
getAssignableTypes(_super,s);
// recursively process all implemented interfaces
Iterator<JClass> itr = t._implements();
while(itr.hasNext())
{
getAssignableTypes(itr.next(),s);
}
} | [
"private",
"static",
"void",
"getAssignableTypes",
"(",
"JClass",
"t",
",",
"Set",
"<",
"JClass",
">",
"s",
")",
"{",
"if",
"(",
"!",
"s",
".",
"add",
"(",
"t",
")",
")",
"return",
";",
"// TODO",
"// if (t.fullName().equals(Equals.class.getName()) ||",... | Returns the set of all classes/interfaces that a given type
implements/extends, including itself.
For example, if you pass java.io.FilterInputStream, then the returned
set will contain java.lang.Object, java.lang.InputStream, and
java.lang.FilterInputStream. | [
"Returns",
"the",
"set",
"of",
"all",
"classes",
"/",
"interfaces",
"that",
"a",
"given",
"type",
"implements",
"/",
"extends",
"including",
"itself",
"."
] | train | https://github.com/highsource/hyperjaxb3/blob/c645d1628b8c26a844858d221fc9affe9c18543e/ejb/plugin/src/main/java/org/jvnet/hyperjaxb3/xjc/reader/TypeUtil.java#L213-L240 |
trustathsh/ifmapj | src/main/java/util/DomHelpers.java | DomHelpers.toDocument | public static Document toDocument(String s, Charset c) throws MarshalException {
byte[] bytes = c == null ? s.getBytes() : s.getBytes(c);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
return toDocument(bais);
} | java | public static Document toDocument(String s, Charset c) throws MarshalException {
byte[] bytes = c == null ? s.getBytes() : s.getBytes(c);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
return toDocument(bais);
} | [
"public",
"static",
"Document",
"toDocument",
"(",
"String",
"s",
",",
"Charset",
"c",
")",
"throws",
"MarshalException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"c",
"==",
"null",
"?",
"s",
".",
"getBytes",
"(",
")",
":",
"s",
".",
"getBytes",
"(",
"c"... | Marshal a {@link Document} from {@link String} with XML data
@param s string containing XML data
@param c charset used for encoding the string
@return {@link Document} containg the XML data
@throws MarshalException | [
"Marshal",
"a",
"{",
"@link",
"Document",
"}",
"from",
"{",
"@link",
"String",
"}",
"with",
"XML",
"data"
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/util/DomHelpers.java#L470-L476 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/FontSelector.java | FontSelector.addFont | public void addFont(Font font) {
if (font.getBaseFont() != null) {
fonts.add(font);
return;
}
BaseFont bf = font.getCalculatedBaseFont(true);
Font f2 = new Font(bf, font.getSize(), font.getCalculatedStyle(), font.getColor());
fonts.add(f2);
} | java | public void addFont(Font font) {
if (font.getBaseFont() != null) {
fonts.add(font);
return;
}
BaseFont bf = font.getCalculatedBaseFont(true);
Font f2 = new Font(bf, font.getSize(), font.getCalculatedStyle(), font.getColor());
fonts.add(f2);
} | [
"public",
"void",
"addFont",
"(",
"Font",
"font",
")",
"{",
"if",
"(",
"font",
".",
"getBaseFont",
"(",
")",
"!=",
"null",
")",
"{",
"fonts",
".",
"add",
"(",
"font",
")",
";",
"return",
";",
"}",
"BaseFont",
"bf",
"=",
"font",
".",
"getCalculatedB... | Adds a <CODE>Font</CODE> to be searched for valid characters.
@param font the <CODE>Font</CODE> | [
"Adds",
"a",
"<CODE",
">",
"Font<",
"/",
"CODE",
">",
"to",
"be",
"searched",
"for",
"valid",
"characters",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/FontSelector.java#L72-L80 |
sockeqwe/sqlbrite-dao | objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java | ObjectMappableProcessor.generateRxMappingMethod | private FieldSpec generateRxMappingMethod(ObjectMappableAnnotatedClass clazz) {
String objectVarName = "item";
String cursorVarName = "cursor";
TypeName elementType = ClassName.get(clazz.getElement().asType());
// new Func1<Cursor, ListsItem>()
CodeBlock.Builder initBlockBuilder = CodeBlock.builder()
.add("new $L<$L, $L>() {\n", Func1.class.getSimpleName(), Cursor.class.getSimpleName(),
elementType)
.indent()
.add("@Override public $L call($L cursor) {\n", elementType, Cursor.class.getSimpleName())
.indent();
// assign the columns indexes
generateColumnIndexCode(initBlockBuilder, clazz.getColumnAnnotatedElements(), cursorVarName);
// Instantiate element
initBlockBuilder.addStatement("$T $L = new $T()", elementType, objectVarName, elementType);
// read cursor into element variable
for (ColumnAnnotateable e : clazz.getColumnAnnotatedElements()) {
String indexVaName = e.getColumnName() + "Index";
initBlockBuilder.beginControlFlow("if ($L >= 0)", indexVaName);
e.generateAssignStatement(initBlockBuilder, objectVarName, cursorVarName, indexVaName);
initBlockBuilder.endControlFlow();
}
initBlockBuilder.addStatement("return $L", objectVarName)
.unindent()
.add("}\n") // end call () method
.unindent()
.add("}") // end anonymous class
.build();
ParameterizedTypeName fieldType =
ParameterizedTypeName.get(ClassName.get(Func1.class), ClassName.get(Cursor.class),
elementType);
return FieldSpec.builder(fieldType, "MAPPER", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
.initializer(initBlockBuilder.build())
.build();
} | java | private FieldSpec generateRxMappingMethod(ObjectMappableAnnotatedClass clazz) {
String objectVarName = "item";
String cursorVarName = "cursor";
TypeName elementType = ClassName.get(clazz.getElement().asType());
// new Func1<Cursor, ListsItem>()
CodeBlock.Builder initBlockBuilder = CodeBlock.builder()
.add("new $L<$L, $L>() {\n", Func1.class.getSimpleName(), Cursor.class.getSimpleName(),
elementType)
.indent()
.add("@Override public $L call($L cursor) {\n", elementType, Cursor.class.getSimpleName())
.indent();
// assign the columns indexes
generateColumnIndexCode(initBlockBuilder, clazz.getColumnAnnotatedElements(), cursorVarName);
// Instantiate element
initBlockBuilder.addStatement("$T $L = new $T()", elementType, objectVarName, elementType);
// read cursor into element variable
for (ColumnAnnotateable e : clazz.getColumnAnnotatedElements()) {
String indexVaName = e.getColumnName() + "Index";
initBlockBuilder.beginControlFlow("if ($L >= 0)", indexVaName);
e.generateAssignStatement(initBlockBuilder, objectVarName, cursorVarName, indexVaName);
initBlockBuilder.endControlFlow();
}
initBlockBuilder.addStatement("return $L", objectVarName)
.unindent()
.add("}\n") // end call () method
.unindent()
.add("}") // end anonymous class
.build();
ParameterizedTypeName fieldType =
ParameterizedTypeName.get(ClassName.get(Func1.class), ClassName.get(Cursor.class),
elementType);
return FieldSpec.builder(fieldType, "MAPPER", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
.initializer(initBlockBuilder.build())
.build();
} | [
"private",
"FieldSpec",
"generateRxMappingMethod",
"(",
"ObjectMappableAnnotatedClass",
"clazz",
")",
"{",
"String",
"objectVarName",
"=",
"\"item\"",
";",
"String",
"cursorVarName",
"=",
"\"cursor\"",
";",
"TypeName",
"elementType",
"=",
"ClassName",
".",
"get",
"(",... | Generates the field that can be used as RxJava method
@param clazz The {@link ObjectMappableAnnotatedClass}
@return MethodSpec | [
"Generates",
"the",
"field",
"that",
"can",
"be",
"used",
"as",
"RxJava",
"method"
] | train | https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java#L172-L216 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.listFirewallRulesWithServiceResponseAsync | public Observable<ServiceResponse<Page<FirewallRuleInner>>> listFirewallRulesWithServiceResponseAsync(final String resourceGroupName, final String accountName) {
return listFirewallRulesSinglePageAsync(resourceGroupName, accountName)
.concatMap(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Observable<ServiceResponse<Page<FirewallRuleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<FirewallRuleInner>>> call(ServiceResponse<Page<FirewallRuleInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listFirewallRulesNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<FirewallRuleInner>>> listFirewallRulesWithServiceResponseAsync(final String resourceGroupName, final String accountName) {
return listFirewallRulesSinglePageAsync(resourceGroupName, accountName)
.concatMap(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Observable<ServiceResponse<Page<FirewallRuleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<FirewallRuleInner>>> call(ServiceResponse<Page<FirewallRuleInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listFirewallRulesNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"FirewallRuleInner",
">",
">",
">",
"listFirewallRulesWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
")",
"{",
"return",
"listFirewallRulesS... | Lists the Data Lake Store firewall rules within the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account.
@param accountName The name of the Data Lake Store account from which to get the firewall rules.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FirewallRuleInner> object | [
"Lists",
"the",
"Data",
"Lake",
"Store",
"firewall",
"rules",
"within",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L392-L404 |
amsa-code/risky | ais/src/main/java/au/gov/amsa/util/nmea/NmeaMessageParser.java | NmeaMessageParser.parse | public NmeaMessage parse(String line) {
LinkedHashMap<String, String> tags = Maps.newLinkedHashMap();
String remaining;
if (line.startsWith("\\")) {
int tagFinish = line.lastIndexOf('\\', line.length() - 1);
if (tagFinish == -1)
throw new NmeaMessageParseException(
"no matching \\ symbol to finish tag block: " + line);
if (tagFinish == 0)
throw new NmeaMessageParseException("tag block is empty or not terminated");
tags = extractTags(line.substring(1, tagFinish));
remaining = line.substring(tagFinish + 1);
} else
remaining = line;
String[] items;
String checksum;
if (remaining.length() > 0) {
if (!remaining.contains("*"))
throw new NmeaMessageParseException("checksum delimiter * not found");
items = getNmeaItems(remaining);
// TODO validate message using checksum
checksum = line.substring(line.indexOf('*') + 1);
} else {
items = new String[] {};
// TODO decide what value to put here
checksum = "";
}
return new NmeaMessage(tags, Arrays.asList(items), checksum);
} | java | public NmeaMessage parse(String line) {
LinkedHashMap<String, String> tags = Maps.newLinkedHashMap();
String remaining;
if (line.startsWith("\\")) {
int tagFinish = line.lastIndexOf('\\', line.length() - 1);
if (tagFinish == -1)
throw new NmeaMessageParseException(
"no matching \\ symbol to finish tag block: " + line);
if (tagFinish == 0)
throw new NmeaMessageParseException("tag block is empty or not terminated");
tags = extractTags(line.substring(1, tagFinish));
remaining = line.substring(tagFinish + 1);
} else
remaining = line;
String[] items;
String checksum;
if (remaining.length() > 0) {
if (!remaining.contains("*"))
throw new NmeaMessageParseException("checksum delimiter * not found");
items = getNmeaItems(remaining);
// TODO validate message using checksum
checksum = line.substring(line.indexOf('*') + 1);
} else {
items = new String[] {};
// TODO decide what value to put here
checksum = "";
}
return new NmeaMessage(tags, Arrays.asList(items), checksum);
} | [
"public",
"NmeaMessage",
"parse",
"(",
"String",
"line",
")",
"{",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"tags",
"=",
"Maps",
".",
"newLinkedHashMap",
"(",
")",
";",
"String",
"remaining",
";",
"if",
"(",
"line",
".",
"startsWith",
"(",
"\"... | Return an {@link NmeaMessage} from the given NMEA line.
@param line
@return | [
"Return",
"an",
"{",
"@link",
"NmeaMessage",
"}",
"from",
"the",
"given",
"NMEA",
"line",
"."
] | train | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/util/nmea/NmeaMessageParser.java#L26-L57 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/Query.java | Query.main3 | public static void main3(String args[]) {
String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver";
String url = "jdbc:db2:sample";
String user = "batra";
String pass = "varunbatra";
String querystring = "Select * from batra.employee";
String fn;
String ln;
String bd;
String sal;
try {
ConnectionProperties cp = new ConnectionProperties(dbDriver, url, user, pass);
Query query = new Query(cp, querystring);
QueryResults qs = query.execute();
System.out.println("Number of rows = " + qs.size());
Enumeration e = qs.getRows();
while (e.hasMoreElements()) {
QueryRow qr = (QueryRow) e.nextElement();
fn = qr.getValue("FIRSTNME");
ln = qr.getValue("LASTNAME");
bd = qr.getValue("BIRTHDATE");
sal = qr.getValue("SALARY");
System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal);
} // while
/*
while (qs.next())
{
fn = qs.getValue("FIRSTNME");
ln = qs.getValue("LASTNAME");
bd = qs.getValue("BIRTHDATE");
sal = qs.getValue("SALARY");
System.out.println(fn + " " + ln +
" birthdate " + bd +
" salary " + sal);
}
qs.setCurrRow(5);
fn = qs.getValue("FIRSTNME");
ln = qs.getValue("LASTNAME");
bd = qs.getValue("BIRTHDATE");
sal = qs.getValue("SALARY");
System.out.println(fn + " " + ln +
" birthdate " + bd +
" salary " + sal);
*/
} // try
catch (Exception e) {
//com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.main3", "414");
System.out.println("Exception:: " + e.getMessage());
}
System.out.println("All is Fine!!!!!");
} | java | public static void main3(String args[]) {
String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver";
String url = "jdbc:db2:sample";
String user = "batra";
String pass = "varunbatra";
String querystring = "Select * from batra.employee";
String fn;
String ln;
String bd;
String sal;
try {
ConnectionProperties cp = new ConnectionProperties(dbDriver, url, user, pass);
Query query = new Query(cp, querystring);
QueryResults qs = query.execute();
System.out.println("Number of rows = " + qs.size());
Enumeration e = qs.getRows();
while (e.hasMoreElements()) {
QueryRow qr = (QueryRow) e.nextElement();
fn = qr.getValue("FIRSTNME");
ln = qr.getValue("LASTNAME");
bd = qr.getValue("BIRTHDATE");
sal = qr.getValue("SALARY");
System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal);
} // while
/*
while (qs.next())
{
fn = qs.getValue("FIRSTNME");
ln = qs.getValue("LASTNAME");
bd = qs.getValue("BIRTHDATE");
sal = qs.getValue("SALARY");
System.out.println(fn + " " + ln +
" birthdate " + bd +
" salary " + sal);
}
qs.setCurrRow(5);
fn = qs.getValue("FIRSTNME");
ln = qs.getValue("LASTNAME");
bd = qs.getValue("BIRTHDATE");
sal = qs.getValue("SALARY");
System.out.println(fn + " " + ln +
" birthdate " + bd +
" salary " + sal);
*/
} // try
catch (Exception e) {
//com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.main3", "414");
System.out.println("Exception:: " + e.getMessage());
}
System.out.println("All is Fine!!!!!");
} | [
"public",
"static",
"void",
"main3",
"(",
"String",
"args",
"[",
"]",
")",
"{",
"String",
"dbDriver",
"=",
"\"COM.ibm.db2.jdbc.app.DB2Driver\"",
";",
"String",
"url",
"=",
"\"jdbc:db2:sample\"",
";",
"String",
"user",
"=",
"\"batra\"",
";",
"String",
"pass",
"... | This method was created in VisualAge.
@param args java.lang.String[] | [
"This",
"method",
"was",
"created",
"in",
"VisualAge",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/Query.java#L365-L420 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.logFoundJars | protected boolean logFoundJars(Vector v, String desc)
{
if ((null == v) || (v.size() < 1))
return false;
boolean errors = false;
logMsg("#---- BEGIN Listing XML-related jars in: " + desc + " ----");
for (int i = 0; i < v.size(); i++)
{
Hashtable subhash = (Hashtable) v.elementAt(i);
for (Enumeration keys = subhash.keys();
keys.hasMoreElements();
/* no increment portion */
)
{
Object key = keys.nextElement();
String keyStr = (String) key;
try
{
if (keyStr.startsWith(ERROR))
{
errors = true;
}
logMsg(keyStr + "=" + subhash.get(keyStr));
}
catch (Exception e)
{
errors = true;
logMsg("Reading-" + key + "= threw: " + e.toString());
}
}
}
logMsg("#----- END Listing XML-related jars in: " + desc + " -----");
return errors;
} | java | protected boolean logFoundJars(Vector v, String desc)
{
if ((null == v) || (v.size() < 1))
return false;
boolean errors = false;
logMsg("#---- BEGIN Listing XML-related jars in: " + desc + " ----");
for (int i = 0; i < v.size(); i++)
{
Hashtable subhash = (Hashtable) v.elementAt(i);
for (Enumeration keys = subhash.keys();
keys.hasMoreElements();
/* no increment portion */
)
{
Object key = keys.nextElement();
String keyStr = (String) key;
try
{
if (keyStr.startsWith(ERROR))
{
errors = true;
}
logMsg(keyStr + "=" + subhash.get(keyStr));
}
catch (Exception e)
{
errors = true;
logMsg("Reading-" + key + "= threw: " + e.toString());
}
}
}
logMsg("#----- END Listing XML-related jars in: " + desc + " -----");
return errors;
} | [
"protected",
"boolean",
"logFoundJars",
"(",
"Vector",
"v",
",",
"String",
"desc",
")",
"{",
"if",
"(",
"(",
"null",
"==",
"v",
")",
"||",
"(",
"v",
".",
"size",
"(",
")",
"<",
"1",
")",
")",
"return",
"false",
";",
"boolean",
"errors",
"=",
"fal... | Print out report of .jars found in a classpath.
Takes the information encoded from a checkPathForJars()
call and dumps it out to our PrintWriter.
@param v Vector of Hashtables of .jar file info
@param desc description to print out in header
@return false if OK, true if any .jars were reported
as having errors
@see #checkPathForJars(String, String[]) | [
"Print",
"out",
"report",
"of",
".",
"jars",
"found",
"in",
"a",
"classpath",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L353-L394 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/RedisChannelHandler.java | RedisChannelHandler.setTimeout | @Deprecated
public void setTimeout(long timeout, TimeUnit unit) {
setTimeout(Duration.ofNanos(unit.toNanos(timeout)));
} | java | @Deprecated
public void setTimeout(long timeout, TimeUnit unit) {
setTimeout(Duration.ofNanos(unit.toNanos(timeout)));
} | [
"@",
"Deprecated",
"public",
"void",
"setTimeout",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"setTimeout",
"(",
"Duration",
".",
"ofNanos",
"(",
"unit",
".",
"toNanos",
"(",
"timeout",
")",
")",
")",
";",
"}"
] | Set the command timeout for this connection.
@param timeout Command timeout.
@param unit Unit of time for the timeout.
@deprecated since 5.0, use {@link #setTimeout(Duration)} | [
"Set",
"the",
"command",
"timeout",
"for",
"this",
"connection",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/RedisChannelHandler.java#L111-L114 |
shrinkwrap/resolver | maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenRepositorySystem.java | MavenRepositorySystem.resolveArtifact | public ArtifactResult resolveArtifact(final RepositorySystemSession session, final ArtifactRequest request)
throws ArtifactResolutionException {
return system.resolveArtifact(session, request);
} | java | public ArtifactResult resolveArtifact(final RepositorySystemSession session, final ArtifactRequest request)
throws ArtifactResolutionException {
return system.resolveArtifact(session, request);
} | [
"public",
"ArtifactResult",
"resolveArtifact",
"(",
"final",
"RepositorySystemSession",
"session",
",",
"final",
"ArtifactRequest",
"request",
")",
"throws",
"ArtifactResolutionException",
"{",
"return",
"system",
".",
"resolveArtifact",
"(",
"session",
",",
"request",
... | Resolves an artifact
@param session The current Maven session
@param request The request to be computed
@return The artifact
@throws ArtifactResolutionException If the artifact could not be fetched | [
"Resolves",
"an",
"artifact"
] | train | https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenRepositorySystem.java#L133-L136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.