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 |
|---|---|---|---|---|---|---|---|---|---|---|
algolia/instantsearch-android | ui/src/main/java/com/algolia/instantsearch/ui/helpers/InstantSearch.java | InstantSearch.registerSearchView | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public void registerSearchView(@NonNull final Activity activity, @NonNull Menu menu, int id) {
searchMenu = menu;
searchMenuId = id;
final SearchViewFacade actionView = new SearchViewFacade(menu, id);
registerSearchView(activity, actionView);
} | java | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public void registerSearchView(@NonNull final Activity activity, @NonNull Menu menu, int id) {
searchMenu = menu;
searchMenuId = id;
final SearchViewFacade actionView = new SearchViewFacade(menu, id);
registerSearchView(activity, actionView);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"// For library users",
"public",
"void",
"registerSearchView",
"(",
"@",
"NonNull",
"final",
"Activity",
"activity",
",",
"@",
"NonNull",
"Menu",
"menu",
",",
"int",
"id",
")",
... | Registers the Search Widget of an Activity's Menu to trigger search requests on text change, replacing the current one if any.
@param activity The searchable Activity, see {@link android.app.SearchableInfo}.
@param menu The Menu that contains a search item.
@param id The identifier of the menu's search item. | [
"Registers",
"the",
"Search",
"Widget",
"of",
"an",
"Activity",
"s",
"Menu",
"to",
"trigger",
"search",
"requests",
"on",
"text",
"change",
"replacing",
"the",
"current",
"one",
"if",
"any",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/helpers/InstantSearch.java#L189-L195 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/ReferenceField.java | ReferenceField.syncReference | public void syncReference(Record record)
{
this.setReferenceRecord(record);
BaseField recordKeyField = (BaseField)record.getCounterField();
if ((recordKeyField.isNull()) && (!this.isNull())
&& (!record.isModified())
&& (record.getEditMode() != DBConstants.EDIT_CURRENT)
&& (record.getEditMode() != DBConstants.EDIT_IN_PROGRESS)
&& ((record.getOpenMode() & DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY) == 0))
{
recordKeyField.moveFieldToThis(this, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Start with this field's value if you arn't going to mess up the record
recordKeyField.setModified(false);
}
else
this.setReference(record, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
// If the screen field is changed, make sure the passed in header record's key field is changed to match.
MoveOnChangeHandler listener = (MoveOnChangeHandler)this.getListener(MoveOnChangeHandler.class.getName());
if ((listener == null)
|| (listener.getDestField() != recordKeyField))
this.addListener(new MoveOnChangeHandler(recordKeyField, null));
// If the record is externally selected, sync the record's key with the screenfield
MoveOnValidHandler listener2 = (MoveOnValidHandler)record.getListener(MoveOnValidHandler.class.getName());
if ((listener2 == null)
|| (listener2.getSourceField() != recordKeyField))
record.addListener(new MoveOnValidHandler(this, recordKeyField));
MainReadOnlyHandler listener3 = (MainReadOnlyHandler)recordKeyField.getListener(MainReadOnlyHandler.class.getName());
if (listener3 == null)
recordKeyField.addListener(new MainReadOnlyHandler(null));
} | java | public void syncReference(Record record)
{
this.setReferenceRecord(record);
BaseField recordKeyField = (BaseField)record.getCounterField();
if ((recordKeyField.isNull()) && (!this.isNull())
&& (!record.isModified())
&& (record.getEditMode() != DBConstants.EDIT_CURRENT)
&& (record.getEditMode() != DBConstants.EDIT_IN_PROGRESS)
&& ((record.getOpenMode() & DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY) == 0))
{
recordKeyField.moveFieldToThis(this, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Start with this field's value if you arn't going to mess up the record
recordKeyField.setModified(false);
}
else
this.setReference(record, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
// If the screen field is changed, make sure the passed in header record's key field is changed to match.
MoveOnChangeHandler listener = (MoveOnChangeHandler)this.getListener(MoveOnChangeHandler.class.getName());
if ((listener == null)
|| (listener.getDestField() != recordKeyField))
this.addListener(new MoveOnChangeHandler(recordKeyField, null));
// If the record is externally selected, sync the record's key with the screenfield
MoveOnValidHandler listener2 = (MoveOnValidHandler)record.getListener(MoveOnValidHandler.class.getName());
if ((listener2 == null)
|| (listener2.getSourceField() != recordKeyField))
record.addListener(new MoveOnValidHandler(this, recordKeyField));
MainReadOnlyHandler listener3 = (MainReadOnlyHandler)recordKeyField.getListener(MainReadOnlyHandler.class.getName());
if (listener3 == null)
recordKeyField.addListener(new MainReadOnlyHandler(null));
} | [
"public",
"void",
"syncReference",
"(",
"Record",
"record",
")",
"{",
"this",
".",
"setReferenceRecord",
"(",
"record",
")",
";",
"BaseField",
"recordKeyField",
"=",
"(",
"BaseField",
")",
"record",
".",
"getCounterField",
"(",
")",
";",
"if",
"(",
"(",
"r... | Synchronize this refernce field with this record.
Adds the behaviors to sync this field and the record.
Used for popup screenfields where the referencerecord has a detail to display on change.
@param record The reference record to synchronize. | [
"Synchronize",
"this",
"refernce",
"field",
"with",
"this",
"record",
".",
"Adds",
"the",
"behaviors",
"to",
"sync",
"this",
"field",
"and",
"the",
"record",
".",
"Used",
"for",
"popup",
"screenfields",
"where",
"the",
"referencerecord",
"has",
"a",
"detail",
... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L214-L242 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/models/History.java | History.addExtraInfo | public void addExtraInfo(String key, Object value) {
// Turn extraInfo into map
Map<String, Object> infoMap = (HashMap<String, Object>)getMapFromJSON(extraInfo);
// Add value
infoMap.put(key, value);
// Turn back into string
extraInfo = getJSONFromMap(infoMap);
} | java | public void addExtraInfo(String key, Object value) {
// Turn extraInfo into map
Map<String, Object> infoMap = (HashMap<String, Object>)getMapFromJSON(extraInfo);
// Add value
infoMap.put(key, value);
// Turn back into string
extraInfo = getJSONFromMap(infoMap);
} | [
"public",
"void",
"addExtraInfo",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"// Turn extraInfo into map",
"Map",
"<",
"String",
",",
"Object",
">",
"infoMap",
"=",
"(",
"HashMap",
"<",
"String",
",",
"Object",
">",
")",
"getMapFromJSON",
"(",
... | Add key value pair to extra info
@param key Key of new item
@param value New value to add | [
"Add",
"key",
"value",
"pair",
"to",
"extra",
"info"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/models/History.java#L409-L417 |
craigwblake/redline | src/main/java/org/redline_rpm/Util.java | Util.empty | public static void empty( WritableByteChannel out, ByteBuffer buffer) throws IOException {
while ( buffer.hasRemaining()) out.write( buffer);
} | java | public static void empty( WritableByteChannel out, ByteBuffer buffer) throws IOException {
while ( buffer.hasRemaining()) out.write( buffer);
} | [
"public",
"static",
"void",
"empty",
"(",
"WritableByteChannel",
"out",
",",
"ByteBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"while",
"(",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"out",
".",
"write",
"(",
"buffer",
")",
";",
"}"
] | Empties the contents of the given buffer into the
writable channel provided. The buffer will be copied
to the channel in it's entirety.
@param out the channel to write to
@param buffer the buffer to write out to the channel
@throws IOException if an IO error occurs | [
"Empties",
"the",
"contents",
"of",
"the",
"given",
"buffer",
"into",
"the",
"writable",
"channel",
"provided",
".",
"The",
"buffer",
"will",
"be",
"copied",
"to",
"the",
"channel",
"in",
"it",
"s",
"entirety",
"."
] | train | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Util.java#L89-L91 |
code4everything/util | src/main/java/com/zhazhapan/util/BeanUtils.java | BeanUtils.deserialize | public static <T> T deserialize(String file, Class<T> clazz) throws IOException, ClassNotFoundException {
return TypeUtils.castToJavaBean(deserialize(file), clazz);
} | java | public static <T> T deserialize(String file, Class<T> clazz) throws IOException, ClassNotFoundException {
return TypeUtils.castToJavaBean(deserialize(file), clazz);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"deserialize",
"(",
"String",
"file",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"return",
"TypeUtils",
".",
"castToJavaBean",
"(",
"deserialize",
"(",
"file... | 反序列化对象
@param file 对象文件
@param clazz 类
@param <T> 类型
@return 反序列化后的对象
@throws IOException 异常
@throws ClassNotFoundException 异常
@since 1.0.8 | [
"反序列化对象"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/BeanUtils.java#L138-L140 |
akquinet/needle | src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java | ReflectionUtil.getFieldValue | public static Object getFieldValue(final Object object, final String fieldName) {
return getFieldValue(object, object.getClass(), fieldName);
} | java | public static Object getFieldValue(final Object object, final String fieldName) {
return getFieldValue(object, object.getClass(), fieldName);
} | [
"public",
"static",
"Object",
"getFieldValue",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"fieldName",
")",
"{",
"return",
"getFieldValue",
"(",
"object",
",",
"object",
".",
"getClass",
"(",
")",
",",
"fieldName",
")",
";",
"}"
] | Get the value of a given field on a given object via reflection.
@param object
-- target object of field access
@param fieldName
-- name of the field
@return -- the value of the represented field in object; primitive values
are wrapped in an appropriate object before being returned | [
"Get",
"the",
"value",
"of",
"a",
"given",
"field",
"on",
"a",
"given",
"object",
"via",
"reflection",
"."
] | train | https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java#L276-L278 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java | QueryParameters.updateValue | public QueryParameters updateValue(String key, Object value) {
this.values.put(processKey(key), value);
return this;
} | java | public QueryParameters updateValue(String key, Object value) {
this.values.put(processKey(key), value);
return this;
} | [
"public",
"QueryParameters",
"updateValue",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"this",
".",
"values",
".",
"put",
"(",
"processKey",
"(",
"key",
")",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Updates value of specified key
@param key Key
@param value Value
@return this instance of QueryParameters | [
"Updates",
"value",
"of",
"specified",
"key"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java#L331-L335 |
stephanrauh/AngularFaces | AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/i18n/I18n.java | I18n.slurp | public static String slurp(final InputStream is, final int bufferSize) {
final char[] buffer = new char[bufferSize];
final StringBuilder out = new StringBuilder();
try {
final Reader in = new InputStreamReader(is, "UTF-8");
try {
for (;;) {
int rsz = in.read(buffer, 0, buffer.length);
if (rsz < 0)
break;
out.append(buffer, 0, rsz);
}
} finally {
in.close();
}
} catch (UnsupportedEncodingException ex) {
/* ... */
} catch (IOException ex) {
/* ... */
}
return out.toString();
} | java | public static String slurp(final InputStream is, final int bufferSize) {
final char[] buffer = new char[bufferSize];
final StringBuilder out = new StringBuilder();
try {
final Reader in = new InputStreamReader(is, "UTF-8");
try {
for (;;) {
int rsz = in.read(buffer, 0, buffer.length);
if (rsz < 0)
break;
out.append(buffer, 0, rsz);
}
} finally {
in.close();
}
} catch (UnsupportedEncodingException ex) {
/* ... */
} catch (IOException ex) {
/* ... */
}
return out.toString();
} | [
"public",
"static",
"String",
"slurp",
"(",
"final",
"InputStream",
"is",
",",
"final",
"int",
"bufferSize",
")",
"{",
"final",
"char",
"[",
"]",
"buffer",
"=",
"new",
"char",
"[",
"bufferSize",
"]",
";",
"final",
"StringBuilder",
"out",
"=",
"new",
"Str... | copied from http://stackoverflow.com/questions/309424/read-convert-an-inputstream-to-a-string
@param is file to be read
@param bufferSize size of the buffer used to read the file
@return file content as String | [
"copied",
"from",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"309424",
"/",
"read",
"-",
"convert",
"-",
"an",
"-",
"inputstream",
"-",
"to",
"-",
"a",
"-",
"string"
] | train | https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/i18n/I18n.java#L145-L166 |
javalite/activejdbc | javalite-common/src/main/java/org/javalite/common/Base64.java | Base64.getMimeEncoder | public static Encoder getMimeEncoder(int lineLength, byte[] lineSeparator) {
a(lineSeparator).shouldNotBeNull();
int[] base64 = Decoder.fromBase64;
for (byte b : lineSeparator) {
if (base64[b & 0xff] != -1)
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
if (lineLength <= 0) {
return Encoder.RFC4648;
}
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
} | java | public static Encoder getMimeEncoder(int lineLength, byte[] lineSeparator) {
a(lineSeparator).shouldNotBeNull();
int[] base64 = Decoder.fromBase64;
for (byte b : lineSeparator) {
if (base64[b & 0xff] != -1)
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
if (lineLength <= 0) {
return Encoder.RFC4648;
}
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
} | [
"public",
"static",
"Encoder",
"getMimeEncoder",
"(",
"int",
"lineLength",
",",
"byte",
"[",
"]",
"lineSeparator",
")",
"{",
"a",
"(",
"lineSeparator",
")",
".",
"shouldNotBeNull",
"(",
")",
";",
"int",
"[",
"]",
"base64",
"=",
"Decoder",
".",
"fromBase64"... | Returns a {@link Encoder} that encodes using the
<a href="#mime">MIME</a> type base64 encoding scheme
with specified line length and line separators.
@param lineLength
the length of each output line (rounded down to nearest multiple
of 4). If {@code lineLength <= 0} the output will not be separated
in lines
@param lineSeparator
the line separator for each output line
@return A Base64 encoder.
@throws IllegalArgumentException if {@code lineSeparator} includes any
character of "The Base64 Alphabet" as specified in Table 1 of
RFC 2045. | [
"Returns",
"a",
"{",
"@link",
"Encoder",
"}",
"that",
"encodes",
"using",
"the",
"<a",
"href",
"=",
"#mime",
">",
"MIME<",
"/",
"a",
">",
"type",
"base64",
"encoding",
"scheme",
"with",
"specified",
"line",
"length",
"and",
"line",
"separators",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Base64.java#L112-L124 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/requests/RestAction.java | RestAction.queueAfter | public ScheduledFuture<?> queueAfter(long delay, TimeUnit unit, Consumer<? super T> success, ScheduledExecutorService executor)
{
return queueAfter(delay, unit, success, null, executor);
} | java | public ScheduledFuture<?> queueAfter(long delay, TimeUnit unit, Consumer<? super T> success, ScheduledExecutorService executor)
{
return queueAfter(delay, unit, success, null, executor);
} | [
"public",
"ScheduledFuture",
"<",
"?",
">",
"queueAfter",
"(",
"long",
"delay",
",",
"TimeUnit",
"unit",
",",
"Consumer",
"<",
"?",
"super",
"T",
">",
"success",
",",
"ScheduledExecutorService",
"executor",
")",
"{",
"return",
"queueAfter",
"(",
"delay",
","... | Schedules a call to {@link #queue(java.util.function.Consumer)} to be executed after the specified {@code delay}.
<br>This is an <b>asynchronous</b> operation that will return a
{@link java.util.concurrent.ScheduledFuture ScheduledFuture} representing the task.
<p>This operation gives no access to the failure callback.
<br>Use {@link #queueAfter(long, java.util.concurrent.TimeUnit, java.util.function.Consumer, java.util.function.Consumer)} to access
the failure consumer for {@link #queue(java.util.function.Consumer, java.util.function.Consumer)}!
<p>The specified {@link java.util.concurrent.ScheduledExecutorService ScheduledExecutorService} is used for this operation.
@param delay
The delay after which this computation should be executed, negative to execute immediately
@param unit
The {@link java.util.concurrent.TimeUnit TimeUnit} to convert the specified {@code delay}
@param success
The success {@link java.util.function.Consumer Consumer} that should be called
once the {@link #queue(java.util.function.Consumer)} operation completes successfully.
@param executor
The Non-null {@link java.util.concurrent.ScheduledExecutorService ScheduledExecutorService} that should be used
to schedule this operation
@throws java.lang.IllegalArgumentException
If the provided TimeUnit or ScheduledExecutorService is {@code null}
@return {@link java.util.concurrent.ScheduledFuture ScheduledFuture}
representing the delayed operation | [
"Schedules",
"a",
"call",
"to",
"{",
"@link",
"#queue",
"(",
"java",
".",
"util",
".",
"function",
".",
"Consumer",
")",
"}",
"to",
"be",
"executed",
"after",
"the",
"specified",
"{",
"@code",
"delay",
"}",
".",
"<br",
">",
"This",
"is",
"an",
"<b",
... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/RestAction.java#L694-L697 |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readWBS | private void readWBS(ChildTaskContainer parent, Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Integer taskID = row.getInteger("TASK_ID");
Task task = readTask(parent, taskID);
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readWBS(task, childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | java | private void readWBS(ChildTaskContainer parent, Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Integer taskID = row.getInteger("TASK_ID");
Task task = readTask(parent, taskID);
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readWBS(task, childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | [
"private",
"void",
"readWBS",
"(",
"ChildTaskContainer",
"parent",
",",
"Integer",
"id",
")",
"{",
"Integer",
"currentID",
"=",
"id",
";",
"Table",
"table",
"=",
"getTable",
"(",
"\"WBSTAB\"",
")",
";",
"while",
"(",
"currentID",
".",
"intValue",
"(",
")",... | Recursively read the WBS structure from a PEP file.
@param parent parent container for tasks
@param id initial WBS ID | [
"Recursively",
"read",
"the",
"WBS",
"structure",
"from",
"a",
"PEP",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L300-L317 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getNearestBusHub | @Pure
public BusHub getNearestBusHub(double x, double y) {
double distance = Double.POSITIVE_INFINITY;
BusHub bestHub = null;
double dist;
for (final BusHub hub : this.validBusHubs) {
dist = hub.distance(x, y);
if (dist < distance) {
distance = dist;
bestHub = hub;
}
}
return bestHub;
} | java | @Pure
public BusHub getNearestBusHub(double x, double y) {
double distance = Double.POSITIVE_INFINITY;
BusHub bestHub = null;
double dist;
for (final BusHub hub : this.validBusHubs) {
dist = hub.distance(x, y);
if (dist < distance) {
distance = dist;
bestHub = hub;
}
}
return bestHub;
} | [
"@",
"Pure",
"public",
"BusHub",
"getNearestBusHub",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"double",
"distance",
"=",
"Double",
".",
"POSITIVE_INFINITY",
";",
"BusHub",
"bestHub",
"=",
"null",
";",
"double",
"dist",
";",
"for",
"(",
"final",
... | Replies the nearest bus hub to the given point.
@param x x coordinate.
@param y y coordinate.
@return the nearest bus hub or <code>null</code> if none was found. | [
"Replies",
"the",
"nearest",
"bus",
"hub",
"to",
"the",
"given",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1371-L1386 |
aws/aws-sdk-java | aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/internal/JacksonUtils.java | JacksonUtils.jsonToString | public static String jsonToString(JsonNode node) {
try {
return node == null ? null : MAPPER.writeValueAsString(node);
} catch (JsonProcessingException e) {
throw new SdkClientException("Could not serialize JSON", e);
}
} | java | public static String jsonToString(JsonNode node) {
try {
return node == null ? null : MAPPER.writeValueAsString(node);
} catch (JsonProcessingException e) {
throw new SdkClientException("Could not serialize JSON", e);
}
} | [
"public",
"static",
"String",
"jsonToString",
"(",
"JsonNode",
"node",
")",
"{",
"try",
"{",
"return",
"node",
"==",
"null",
"?",
"null",
":",
"MAPPER",
".",
"writeValueAsString",
"(",
"node",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"e",
")... | Converts a {@link JsonNode} into a string.
@param node Node to convert.
@return String of JSON document. | [
"Converts",
"a",
"{",
"@link",
"JsonNode",
"}",
"into",
"a",
"string",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/internal/JacksonUtils.java#L50-L56 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java | TimeZone.getCanonicalID | public static String getCanonicalID(String id, boolean[] isSystemID) {
String canonicalID = null;
boolean systemTzid = false;
if (id != null && id.length() != 0) {
if (id.equals(TimeZone.UNKNOWN_ZONE_ID)) {
// special case - Etc/Unknown is a canonical ID, but not system ID
canonicalID = TimeZone.UNKNOWN_ZONE_ID;
systemTzid = false;
} else {
canonicalID = ZoneMeta.getCanonicalCLDRID(id);
if (canonicalID != null) {
systemTzid = true;
} else {
canonicalID = ZoneMeta.getCustomID(id);
}
}
}
if (isSystemID != null) {
isSystemID[0] = systemTzid;
}
return canonicalID;
} | java | public static String getCanonicalID(String id, boolean[] isSystemID) {
String canonicalID = null;
boolean systemTzid = false;
if (id != null && id.length() != 0) {
if (id.equals(TimeZone.UNKNOWN_ZONE_ID)) {
// special case - Etc/Unknown is a canonical ID, but not system ID
canonicalID = TimeZone.UNKNOWN_ZONE_ID;
systemTzid = false;
} else {
canonicalID = ZoneMeta.getCanonicalCLDRID(id);
if (canonicalID != null) {
systemTzid = true;
} else {
canonicalID = ZoneMeta.getCustomID(id);
}
}
}
if (isSystemID != null) {
isSystemID[0] = systemTzid;
}
return canonicalID;
} | [
"public",
"static",
"String",
"getCanonicalID",
"(",
"String",
"id",
",",
"boolean",
"[",
"]",
"isSystemID",
")",
"{",
"String",
"canonicalID",
"=",
"null",
";",
"boolean",
"systemTzid",
"=",
"false",
";",
"if",
"(",
"id",
"!=",
"null",
"&&",
"id",
".",
... | <strong>[icu]</strong> Returns the canonical system time zone ID or the normalized
custom time zone ID for the given time zone ID.
@param id The input time zone ID to be canonicalized.
@param isSystemID When non-null boolean array is specified and
the given ID is a known system time zone ID, true is set to <code>isSystemID[0]</code>
@return The canonical system time zone ID or the custom time zone ID
in normalized format for the given time zone ID. When the given time zone ID
is neither a known system time zone ID nor a valid custom time zone ID,
null is returned. | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"the",
"canonical",
"system",
"time",
"zone",
"ID",
"or",
"the",
"normalized",
"custom",
"time",
"zone",
"ID",
"for",
"the",
"given",
"time",
"zone",
"ID",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L1023-L1044 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumMap.java | EnumMap.put | public V put(K key, V value) {
typeCheck(key);
int index = key.ordinal();
Object oldValue = vals[index];
vals[index] = maskNull(value);
if (oldValue == null)
size++;
return unmaskNull(oldValue);
} | java | public V put(K key, V value) {
typeCheck(key);
int index = key.ordinal();
Object oldValue = vals[index];
vals[index] = maskNull(value);
if (oldValue == null)
size++;
return unmaskNull(oldValue);
} | [
"public",
"V",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"typeCheck",
"(",
"key",
")",
";",
"int",
"index",
"=",
"key",
".",
"ordinal",
"(",
")",
";",
"Object",
"oldValue",
"=",
"vals",
"[",
"index",
"]",
";",
"vals",
"[",
"index",
"... | Associates the specified value with the specified key in this map.
If the map previously contained a mapping for this key, the old
value is replaced.
@param key the key with which the specified value is to be associated
@param value the value to be associated with the specified key
@return the previous value associated with specified key, or
<tt>null</tt> if there was no mapping for key. (A <tt>null</tt>
return can also indicate that the map previously associated
<tt>null</tt> with the specified key.)
@throws NullPointerException if the specified key is null | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"this",
"map",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"this",
"key",
"the",
"old",
"value",
"is",
"replaced",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumMap.java#L277-L286 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/execution/impl/RuntimeJobExecution.java | RuntimeJobExecution.publishEvent | private void publishEvent(WSJobInstance objectToPublish, String eventToPublish) {
if (getBatchEventsPublisher() != null) {
getBatchEventsPublisher().publishJobInstanceEvent(objectToPublish, eventToPublish, correlationId);
}
} | java | private void publishEvent(WSJobInstance objectToPublish, String eventToPublish) {
if (getBatchEventsPublisher() != null) {
getBatchEventsPublisher().publishJobInstanceEvent(objectToPublish, eventToPublish, correlationId);
}
} | [
"private",
"void",
"publishEvent",
"(",
"WSJobInstance",
"objectToPublish",
",",
"String",
"eventToPublish",
")",
"{",
"if",
"(",
"getBatchEventsPublisher",
"(",
")",
"!=",
"null",
")",
"{",
"getBatchEventsPublisher",
"(",
")",
".",
"publishJobInstanceEvent",
"(",
... | Publish event for this job instance
@param jobInstance
@param eventToBePublished | [
"Publish",
"event",
"for",
"this",
"job",
"instance"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/execution/impl/RuntimeJobExecution.java#L150-L155 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java | HexUtil.appendHexString | public static void appendHexString(StringBuilder buffer, byte[] bytes) {
assertNotNull(buffer);
if (bytes == null) {
return; // do nothing (a noop)
}
appendHexString(buffer, bytes, 0, bytes.length);
} | java | public static void appendHexString(StringBuilder buffer, byte[] bytes) {
assertNotNull(buffer);
if (bytes == null) {
return; // do nothing (a noop)
}
appendHexString(buffer, bytes, 0, bytes.length);
} | [
"public",
"static",
"void",
"appendHexString",
"(",
"StringBuilder",
"buffer",
",",
"byte",
"[",
"]",
"bytes",
")",
"{",
"assertNotNull",
"(",
"buffer",
")",
";",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"return",
";",
"// do nothing (a noop)",
"}",
"ap... | Appends a byte array to a StringBuilder with each byte in a "Big Endian"
hexidecimal format. For example, a byte 0x34 will be appended as a
String in format "34". A byte array of { 0x34, 035 } would append "3435".
@param buffer The StringBuilder the byte array in hexidecimal format
will be appended to. If the buffer is null, this method will throw
a NullPointerException.
@param bytes The byte array that will be converted to a hexidecimal String.
If the byte array is null, this method will append nothing (a noop) | [
"Appends",
"a",
"byte",
"array",
"to",
"a",
"StringBuilder",
"with",
"each",
"byte",
"in",
"a",
"Big",
"Endian",
"hexidecimal",
"format",
".",
"For",
"example",
"a",
"byte",
"0x34",
"will",
"be",
"appended",
"as",
"a",
"String",
"in",
"format",
"34",
"."... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L86-L92 |
tracee/tracee | core/src/main/java/io/tracee/transport/SoapHeaderTransport.java | SoapHeaderTransport.renderSoapHeader | public void renderSoapHeader(final Map<String, String> context, final Result result) {
renderSoapHeader(RESULT_MARSHALLER, context, result);
} | java | public void renderSoapHeader(final Map<String, String> context, final Result result) {
renderSoapHeader(RESULT_MARSHALLER, context, result);
} | [
"public",
"void",
"renderSoapHeader",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"context",
",",
"final",
"Result",
"result",
")",
"{",
"renderSoapHeader",
"(",
"RESULT_MARSHALLER",
",",
"context",
",",
"result",
")",
";",
"}"
] | Renders a given context map into a given result that should be the TPIC header node. | [
"Renders",
"a",
"given",
"context",
"map",
"into",
"a",
"given",
"result",
"that",
"should",
"be",
"the",
"TPIC",
"header",
"node",
"."
] | train | https://github.com/tracee/tracee/blob/15a68e435248f57757beb8ceac6db5b7f6035bb3/core/src/main/java/io/tracee/transport/SoapHeaderTransport.java#L112-L114 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java | UndoUtils.richTextUndoManager | public static <PS, SEG, S> UndoManager<List<RichTextChange<PS, SEG, S>>> richTextUndoManager(
GenericStyledArea<PS, SEG, S> area) {
return richTextUndoManager(area, UndoManagerFactory.unlimitedHistoryFactory());
} | java | public static <PS, SEG, S> UndoManager<List<RichTextChange<PS, SEG, S>>> richTextUndoManager(
GenericStyledArea<PS, SEG, S> area) {
return richTextUndoManager(area, UndoManagerFactory.unlimitedHistoryFactory());
} | [
"public",
"static",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"UndoManager",
"<",
"List",
"<",
"RichTextChange",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
">",
">",
"richTextUndoManager",
"(",
"GenericStyledArea",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"area"... | Returns an UndoManager with an unlimited history that can undo/redo {@link RichTextChange}s. New changes
emitted from the stream will not be merged with the previous change
after {@link #DEFAULT_PREVENT_MERGE_DELAY} | [
"Returns",
"an",
"UndoManager",
"with",
"an",
"unlimited",
"history",
"that",
"can",
"undo",
"/",
"redo",
"{"
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java#L51-L54 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java | MerkleTreeUtil.getRightMostLeafUnderNode | static int getRightMostLeafUnderNode(int nodeOrder, int depth) {
if (isLeaf(nodeOrder, depth)) {
return nodeOrder;
}
int levelOfNode = getLevelOfNode(nodeOrder);
int distanceFromLeafLevel = depth - levelOfNode - 1;
int leftMostLeafUnderNode = getLeftMostLeafUnderNode(nodeOrder, depth);
int leavesOfSubtreeUnderNode = getNodesOnLevel(distanceFromLeafLevel);
return leftMostLeafUnderNode + leavesOfSubtreeUnderNode - 1;
} | java | static int getRightMostLeafUnderNode(int nodeOrder, int depth) {
if (isLeaf(nodeOrder, depth)) {
return nodeOrder;
}
int levelOfNode = getLevelOfNode(nodeOrder);
int distanceFromLeafLevel = depth - levelOfNode - 1;
int leftMostLeafUnderNode = getLeftMostLeafUnderNode(nodeOrder, depth);
int leavesOfSubtreeUnderNode = getNodesOnLevel(distanceFromLeafLevel);
return leftMostLeafUnderNode + leavesOfSubtreeUnderNode - 1;
} | [
"static",
"int",
"getRightMostLeafUnderNode",
"(",
"int",
"nodeOrder",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"isLeaf",
"(",
"nodeOrder",
",",
"depth",
")",
")",
"{",
"return",
"nodeOrder",
";",
"}",
"int",
"levelOfNode",
"=",
"getLevelOfNode",
"(",
"no... | Returns the breadth-first order of the rightmost leaf in the
subtree selected by {@code nodeOrder} as the root of the subtree
@param nodeOrder The order of the node as the root of the subtree
@param depth The depth of the tree
@return the breadth-first order of the rightmost leaf under the
provided node | [
"Returns",
"the",
"breadth",
"-",
"first",
"order",
"of",
"the",
"rightmost",
"leaf",
"in",
"the",
"subtree",
"selected",
"by",
"{",
"@code",
"nodeOrder",
"}",
"as",
"the",
"root",
"of",
"the",
"subtree"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java#L294-L305 |
dickschoeller/gedbrowser | geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/persistence/GeoCodeLoader.java | GeoCodeLoader.load | public final void load(final InputStream istream) {
load(istream, (name, modernName) -> {
final GeoCodeItem gci = gcc.get(name);
if (gci == null || !gci.getModernPlaceName().equals(modernName)) {
final GeoCodeItem item = new GeoCodeItem(name, modernName);
gcc.add(item);
return item;
}
return gci;
});
} | java | public final void load(final InputStream istream) {
load(istream, (name, modernName) -> {
final GeoCodeItem gci = gcc.get(name);
if (gci == null || !gci.getModernPlaceName().equals(modernName)) {
final GeoCodeItem item = new GeoCodeItem(name, modernName);
gcc.add(item);
return item;
}
return gci;
});
} | [
"public",
"final",
"void",
"load",
"(",
"final",
"InputStream",
"istream",
")",
"{",
"load",
"(",
"istream",
",",
"(",
"name",
",",
"modernName",
")",
"->",
"{",
"final",
"GeoCodeItem",
"gci",
"=",
"gcc",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",... | Read places from an input stream. The format is | separated. It may
contain just a historical place name or both historical and modern
places names.
@param istream the input stream | [
"Read",
"places",
"from",
"an",
"input",
"stream",
".",
"The",
"format",
"is",
"|",
"separated",
".",
"It",
"may",
"contain",
"just",
"a",
"historical",
"place",
"name",
"or",
"both",
"historical",
"and",
"modern",
"places",
"names",
"."
] | train | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/persistence/GeoCodeLoader.java#L53-L63 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java | ProxyUtils.createServiceInstance | public static <T> T createServiceInstance(T impl, String name, String category, String subsystem, boolean attachLoggers, Class<T> interf, Class<?>... additionalInterfaces){
return createInstance(impl,
name,
category,
subsystem,
new ServiceStatsCallHandler(),
new ServiceStatsFactory(),
attachLoggers,
interf,
additionalInterfaces);
} | java | public static <T> T createServiceInstance(T impl, String name, String category, String subsystem, boolean attachLoggers, Class<T> interf, Class<?>... additionalInterfaces){
return createInstance(impl,
name,
category,
subsystem,
new ServiceStatsCallHandler(),
new ServiceStatsFactory(),
attachLoggers,
interf,
additionalInterfaces);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createServiceInstance",
"(",
"T",
"impl",
",",
"String",
"name",
",",
"String",
"category",
",",
"String",
"subsystem",
",",
"boolean",
"attachLoggers",
",",
"Class",
"<",
"T",
">",
"interf",
",",
"Class",
"<",
"?... | Creates a monitored proxy instance for a service. Service in this context means, that the ServiceStatsCallHandler and ServiceStatsFactory are used.
@param <T> the server interface.
@param impl the implementation of T.
@param name name for this instance.
@param category category of this instance.
@param subsystem subsystem of this instance.
@param attachLoggers if true loggers are attached.
@param interf class of T, main interface of the service.
@param additionalInterfaces additional helper interfaces, that should be supported as well.
@return a newly created proxy of type T. | [
"Creates",
"a",
"monitored",
"proxy",
"instance",
"for",
"a",
"service",
".",
"Service",
"in",
"this",
"context",
"means",
"that",
"the",
"ServiceStatsCallHandler",
"and",
"ServiceStatsFactory",
"are",
"used",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java#L99-L109 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/markdown/Emitter.java | Emitter.addLinkRef | public void addLinkRef (@Nonnull final String sKey, final LinkRef aLinkRef)
{
m_aLinkRefs.put (sKey.toLowerCase (Locale.US), aLinkRef);
} | java | public void addLinkRef (@Nonnull final String sKey, final LinkRef aLinkRef)
{
m_aLinkRefs.put (sKey.toLowerCase (Locale.US), aLinkRef);
} | [
"public",
"void",
"addLinkRef",
"(",
"@",
"Nonnull",
"final",
"String",
"sKey",
",",
"final",
"LinkRef",
"aLinkRef",
")",
"{",
"m_aLinkRefs",
".",
"put",
"(",
"sKey",
".",
"toLowerCase",
"(",
"Locale",
".",
"US",
")",
",",
"aLinkRef",
")",
";",
"}"
] | Adds a LinkRef to this set of LinkRefs.
@param sKey
The key/id.
@param aLinkRef
The LinkRef. | [
"Adds",
"a",
"LinkRef",
"to",
"this",
"set",
"of",
"LinkRefs",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/markdown/Emitter.java#L103-L106 |
playn/playn | core/src/playn/core/Surface.java | Surface.startClipped | public boolean startClipped (int x, int y, int width, int height) {
batch.flush(); // flush any pending unclipped calls
Rectangle r = pushScissorState(x, target.flip() ? target.height()-y-height : y, width, height);
batch.gl.glScissor(r.x, r.y, r.width, r.height);
if (scissorDepth == 1) batch.gl.glEnable(GL20.GL_SCISSOR_TEST);
batch.gl.checkError("startClipped");
return !r.isEmpty();
} | java | public boolean startClipped (int x, int y, int width, int height) {
batch.flush(); // flush any pending unclipped calls
Rectangle r = pushScissorState(x, target.flip() ? target.height()-y-height : y, width, height);
batch.gl.glScissor(r.x, r.y, r.width, r.height);
if (scissorDepth == 1) batch.gl.glEnable(GL20.GL_SCISSOR_TEST);
batch.gl.checkError("startClipped");
return !r.isEmpty();
} | [
"public",
"boolean",
"startClipped",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"batch",
".",
"flush",
"(",
")",
";",
"// flush any pending unclipped calls",
"Rectangle",
"r",
"=",
"pushScissorState",
"(",
"x",
"... | Starts a series of drawing commands that are clipped to the specified rectangle (in view
coordinates, not OpenGL coordinates). Thus must be followed by a call to {@link #endClipped}
when the clipped drawing commands are done.
@return whether the resulting clip rectangle is non-empty. <em>Note:</em> the caller may wish
to skip their drawing if this returns false, but they must still call {@link #endClipped}. | [
"Starts",
"a",
"series",
"of",
"drawing",
"commands",
"that",
"are",
"clipped",
"to",
"the",
"specified",
"rectangle",
"(",
"in",
"view",
"coordinates",
"not",
"OpenGL",
"coordinates",
")",
".",
"Thus",
"must",
"be",
"followed",
"by",
"a",
"call",
"to",
"{... | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Surface.java#L137-L144 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureDefinitionUtils.java | FeatureDefinitionUtils.loadAttributes | static ImmutableAttributes loadAttributes(String repoType, File featureFile, ProvisioningDetails details) throws IOException {
// This will throw exceptions if required attributes mismatch or are missing
details.ensureValid();
// retrieve the symbolic name and feature manifest version
String symbolicName = details.getNameAttribute(null);
int featureVersion = details.getIBMFeatureVersion();
// Directive names are name attributes, but end with a colon
Visibility visibility = Visibility.fromString(details.getNameAttribute("visibility:"));
boolean isSingleton = Boolean.parseBoolean(details.getNameAttribute("singleton:"));
// ignore short name for features that are not public
String shortName = (visibility != Visibility.PUBLIC ? null : details.getMainAttributeValue(SHORT_NAME));
// retrieve the feature/subsystem version
Version version = VersionUtility.stringToVersion(details.getMainAttributeValue(VERSION));
// retrieve the app restart header
AppForceRestart appRestart = AppForceRestart.fromString(details.getMainAttributeValue(IBM_APP_FORCE_RESTART));
String subsystemType = details.getMainAttributeValue(TYPE);
String value = details.getCachedRawHeader(IBM_PROVISION_CAPABILITY);
boolean isAutoFeature = value != null && SubsystemContentType.FEATURE_TYPE.getValue().equals(subsystemType);
value = details.getCachedRawHeader(IBM_API_SERVICE);
boolean hasApiServices = value != null;
value = details.getCachedRawHeader(IBM_API_PACKAGE);
boolean hasApiPackages = value != null;
value = details.getCachedRawHeader(IBM_SPI_PACKAGE);
boolean hasSpiPackages = value != null;
EnumSet<ProcessType> processTypes = ProcessType.fromString(details.getCachedRawHeader(IBM_PROCESS_TYPES));
ImmutableAttributes iAttr = new ImmutableAttributes(emptyIfNull(repoType),
symbolicName,
nullIfEmpty(shortName),
featureVersion,
visibility,
appRestart,
version,
featureFile,
featureFile == null ? -1 : featureFile.lastModified(),
featureFile == null ? -1 : featureFile.length(),
isAutoFeature, hasApiServices,
hasApiPackages, hasSpiPackages, isSingleton,
processTypes);
// Link the details object and immutable attributes (used for diagnostic purposes:
// the immutable attribute values are necessary for meaningful error messages)
details.setImmutableAttributes(iAttr);
return iAttr;
} | java | static ImmutableAttributes loadAttributes(String repoType, File featureFile, ProvisioningDetails details) throws IOException {
// This will throw exceptions if required attributes mismatch or are missing
details.ensureValid();
// retrieve the symbolic name and feature manifest version
String symbolicName = details.getNameAttribute(null);
int featureVersion = details.getIBMFeatureVersion();
// Directive names are name attributes, but end with a colon
Visibility visibility = Visibility.fromString(details.getNameAttribute("visibility:"));
boolean isSingleton = Boolean.parseBoolean(details.getNameAttribute("singleton:"));
// ignore short name for features that are not public
String shortName = (visibility != Visibility.PUBLIC ? null : details.getMainAttributeValue(SHORT_NAME));
// retrieve the feature/subsystem version
Version version = VersionUtility.stringToVersion(details.getMainAttributeValue(VERSION));
// retrieve the app restart header
AppForceRestart appRestart = AppForceRestart.fromString(details.getMainAttributeValue(IBM_APP_FORCE_RESTART));
String subsystemType = details.getMainAttributeValue(TYPE);
String value = details.getCachedRawHeader(IBM_PROVISION_CAPABILITY);
boolean isAutoFeature = value != null && SubsystemContentType.FEATURE_TYPE.getValue().equals(subsystemType);
value = details.getCachedRawHeader(IBM_API_SERVICE);
boolean hasApiServices = value != null;
value = details.getCachedRawHeader(IBM_API_PACKAGE);
boolean hasApiPackages = value != null;
value = details.getCachedRawHeader(IBM_SPI_PACKAGE);
boolean hasSpiPackages = value != null;
EnumSet<ProcessType> processTypes = ProcessType.fromString(details.getCachedRawHeader(IBM_PROCESS_TYPES));
ImmutableAttributes iAttr = new ImmutableAttributes(emptyIfNull(repoType),
symbolicName,
nullIfEmpty(shortName),
featureVersion,
visibility,
appRestart,
version,
featureFile,
featureFile == null ? -1 : featureFile.lastModified(),
featureFile == null ? -1 : featureFile.length(),
isAutoFeature, hasApiServices,
hasApiPackages, hasSpiPackages, isSingleton,
processTypes);
// Link the details object and immutable attributes (used for diagnostic purposes:
// the immutable attribute values are necessary for meaningful error messages)
details.setImmutableAttributes(iAttr);
return iAttr;
} | [
"static",
"ImmutableAttributes",
"loadAttributes",
"(",
"String",
"repoType",
",",
"File",
"featureFile",
",",
"ProvisioningDetails",
"details",
")",
"throws",
"IOException",
"{",
"// This will throw exceptions if required attributes mismatch or are missing",
"details",
".",
"e... | Create the ImmutableAttributes based on the contents read from a subsystem
manifest.
@param details ManifestDetails containing manifest parser and accessor methods
for retrieving information from the manifest.
@return new ImmutableAttributes | [
"Create",
"the",
"ImmutableAttributes",
"based",
"on",
"the",
"contents",
"read",
"from",
"a",
"subsystem",
"manifest",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureDefinitionUtils.java#L261-L318 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java | PathBuilder.get | public StringPath get(StringPath path) {
StringPath newPath = getString(toString(path));
return addMetadataOf(newPath, path);
} | java | public StringPath get(StringPath path) {
StringPath newPath = getString(toString(path));
return addMetadataOf(newPath, path);
} | [
"public",
"StringPath",
"get",
"(",
"StringPath",
"path",
")",
"{",
"StringPath",
"newPath",
"=",
"getString",
"(",
"toString",
"(",
"path",
")",
")",
";",
"return",
"addMetadataOf",
"(",
"newPath",
",",
"path",
")",
";",
"}"
] | Create a new String typed path
@param path existing path
@return property path | [
"Create",
"a",
"new",
"String",
"typed",
"path"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java#L478-L481 |
elki-project/elki | elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/strategies/split/AngTanLinearSplit.java | AngTanLinearSplit.computeOverlap | protected <E extends SpatialComparable, A> double computeOverlap(A entries, ArrayAdapter<E, A> getter, long[] assign) {
ModifiableHyperBoundingBox mbr1 = null, mbr2 = null;
for(int i = 0; i < getter.size(entries); i++) {
E e = getter.get(entries, i);
if(BitsUtil.get(assign, i)) {
if(mbr1 == null) {
mbr1 = new ModifiableHyperBoundingBox(e);
}
else {
mbr1.extend(e);
}
}
else {
if(mbr2 == null) {
mbr2 = new ModifiableHyperBoundingBox(e);
}
else {
mbr2.extend(e);
}
}
}
if(mbr1 == null || mbr2 == null) {
throw new AbortException("Invalid state in split: one of the sets is empty.");
}
return SpatialUtil.overlap(mbr1, mbr2);
} | java | protected <E extends SpatialComparable, A> double computeOverlap(A entries, ArrayAdapter<E, A> getter, long[] assign) {
ModifiableHyperBoundingBox mbr1 = null, mbr2 = null;
for(int i = 0; i < getter.size(entries); i++) {
E e = getter.get(entries, i);
if(BitsUtil.get(assign, i)) {
if(mbr1 == null) {
mbr1 = new ModifiableHyperBoundingBox(e);
}
else {
mbr1.extend(e);
}
}
else {
if(mbr2 == null) {
mbr2 = new ModifiableHyperBoundingBox(e);
}
else {
mbr2.extend(e);
}
}
}
if(mbr1 == null || mbr2 == null) {
throw new AbortException("Invalid state in split: one of the sets is empty.");
}
return SpatialUtil.overlap(mbr1, mbr2);
} | [
"protected",
"<",
"E",
"extends",
"SpatialComparable",
",",
"A",
">",
"double",
"computeOverlap",
"(",
"A",
"entries",
",",
"ArrayAdapter",
"<",
"E",
",",
"A",
">",
"getter",
",",
"long",
"[",
"]",
"assign",
")",
"{",
"ModifiableHyperBoundingBox",
"mbr1",
... | Compute overlap of assignment
@param entries Entries
@param getter Entry accessor
@param assign Assignment
@return Overlap amount | [
"Compute",
"overlap",
"of",
"assignment"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/strategies/split/AngTanLinearSplit.java#L150-L175 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.feed_publishActionOfUser | public boolean feed_publishActionOfUser(CharSequence title, CharSequence body,
Collection<IFeedImage> images)
throws FacebookException, IOException {
return feedHandler(FacebookMethod.FEED_PUBLISH_ACTION_OF_USER, title, body, images, null);
} | java | public boolean feed_publishActionOfUser(CharSequence title, CharSequence body,
Collection<IFeedImage> images)
throws FacebookException, IOException {
return feedHandler(FacebookMethod.FEED_PUBLISH_ACTION_OF_USER, title, body, images, null);
} | [
"public",
"boolean",
"feed_publishActionOfUser",
"(",
"CharSequence",
"title",
",",
"CharSequence",
"body",
",",
"Collection",
"<",
"IFeedImage",
">",
"images",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"feedHandler",
"(",
"FacebookMethod"... | Publish the notification of an action taken by a user to newsfeed.
@param title the title of the feed story (up to 60 characters, excluding tags)
@param body (optional) the body of the feed story (up to 200 characters, excluding tags)
@param images (optional) up to four pairs of image URLs and (possibly null) link URLs
@return whether the story was successfully published; false in case of permission error
@see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishActionOfUser">
Developers Wiki: Feed.publishActionOfUser</a> | [
"Publish",
"the",
"notification",
"of",
"an",
"action",
"taken",
"by",
"a",
"user",
"to",
"newsfeed",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L286-L290 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkDataUtils.java | SparkDataUtils.createFileBatchesLocal | public static void createFileBatchesLocal(File inputDirectory, boolean recursive, File outputDirectory, int batchSize) throws IOException {
createFileBatchesLocal(inputDirectory, null, recursive, outputDirectory, batchSize);
} | java | public static void createFileBatchesLocal(File inputDirectory, boolean recursive, File outputDirectory, int batchSize) throws IOException {
createFileBatchesLocal(inputDirectory, null, recursive, outputDirectory, batchSize);
} | [
"public",
"static",
"void",
"createFileBatchesLocal",
"(",
"File",
"inputDirectory",
",",
"boolean",
"recursive",
",",
"File",
"outputDirectory",
",",
"int",
"batchSize",
")",
"throws",
"IOException",
"{",
"createFileBatchesLocal",
"(",
"inputDirectory",
",",
"null",
... | See {@link #createFileBatchesLocal(File, String[], boolean, File, int)}.<br>
The directory filtering (extensions arg) is null when calling this method. | [
"See",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkDataUtils.java#L49-L51 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/view/ViewQueryResponseMapper.java | ViewQueryResponseMapper.mapToViewResult | public static Observable<AsyncViewResult> mapToViewResult(final AsyncBucket bucket, final ViewQuery query,
final ViewQueryResponse response) {
return response
.info()
.singleOrDefault(null)
.map(new ByteBufToJsonObject())
.map(new BuildViewResult(bucket, query, response));
} | java | public static Observable<AsyncViewResult> mapToViewResult(final AsyncBucket bucket, final ViewQuery query,
final ViewQueryResponse response) {
return response
.info()
.singleOrDefault(null)
.map(new ByteBufToJsonObject())
.map(new BuildViewResult(bucket, query, response));
} | [
"public",
"static",
"Observable",
"<",
"AsyncViewResult",
">",
"mapToViewResult",
"(",
"final",
"AsyncBucket",
"bucket",
",",
"final",
"ViewQuery",
"query",
",",
"final",
"ViewQueryResponse",
"response",
")",
"{",
"return",
"response",
".",
"info",
"(",
")",
"."... | Maps a raw {@link ViewQueryResponse} into a {@link AsyncViewResult}.
@param bucket reference to the bucket.
@param query the original query object.
@param response the response from the server.
@return a converted {@link AsyncViewResult}. | [
"Maps",
"a",
"raw",
"{",
"@link",
"ViewQueryResponse",
"}",
"into",
"a",
"{",
"@link",
"AsyncViewResult",
"}",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/view/ViewQueryResponseMapper.java#L60-L68 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2016_06_27_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2016_06_27_preview/implementation/RegistriesInner.java | RegistriesInner.regenerateCredentials | public RegistryCredentialsInner regenerateCredentials(String resourceGroupName, String registryName) {
return regenerateCredentialsWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | java | public RegistryCredentialsInner regenerateCredentials(String resourceGroupName, String registryName) {
return regenerateCredentialsWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | [
"public",
"RegistryCredentialsInner",
"regenerateCredentials",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
")",
"{",
"return",
"regenerateCredentialsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
")",
".",
"toBlocking",
"(",
... | Regenerates the administrator login credentials for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegistryCredentialsInner object if successful. | [
"Regenerates",
"the",
"administrator",
"login",
"credentials",
"for",
"the",
"specified",
"container",
"registry",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2016_06_27_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2016_06_27_preview/implementation/RegistriesInner.java#L877-L879 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/summary/TextRankSentence.java | TextRankSentence.getTopSentenceList | public static List<String> getTopSentenceList(String document, int size)
{
return getTopSentenceList(document, size, default_sentence_separator);
} | java | public static List<String> getTopSentenceList(String document, int size)
{
return getTopSentenceList(document, size, default_sentence_separator);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getTopSentenceList",
"(",
"String",
"document",
",",
"int",
"size",
")",
"{",
"return",
"getTopSentenceList",
"(",
"document",
",",
"size",
",",
"default_sentence_separator",
")",
";",
"}"
] | 一句话调用接口
@param document 目标文档
@param size 需要的关键句的个数
@return 关键句列表 | [
"一句话调用接口"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/summary/TextRankSentence.java#L227-L230 |
bremersee/sms | src/main/java/org/bremersee/sms/GoyyaSmsService.java | GoyyaSmsService.createHttpURLConnection | protected HttpURLConnection createHttpURLConnection(final String url) throws IOException {
URL sendUrl = new URL(url);
HttpURLConnection con;
if (StringUtils.isNotBlank(proxyHost) && proxyPort != null) {
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
con = (HttpURLConnection) sendUrl.openConnection(proxy);
if (StringUtils.isNotBlank(proxyUsername)) {
String passwd = proxyPassword != null ? proxyPassword : "";
String authValue = proxyUsername + ":" + passwd;
String headerValue = Base64.encodeBase64String(authValue.getBytes(
StandardCharsets.UTF_8));
con.setRequestProperty("Proxy-Authorization", "Basic " + headerValue);
}
} else {
con = (HttpURLConnection) sendUrl.openConnection();
}
try {
if (url.toLowerCase().startsWith("https")) {
HttpsURLConnection secCon = (HttpsURLConnection) con;
secCon.setHostnameVerifier(createAllHostnamesVerifier());
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, createTrustAllManagers(), new SecureRandom());
secCon.setSSLSocketFactory(sc.getSocketFactory());
}
} catch (NoSuchAlgorithmException | KeyManagementException e) {
throw new IOException(e);
}
return con;
} | java | protected HttpURLConnection createHttpURLConnection(final String url) throws IOException {
URL sendUrl = new URL(url);
HttpURLConnection con;
if (StringUtils.isNotBlank(proxyHost) && proxyPort != null) {
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
con = (HttpURLConnection) sendUrl.openConnection(proxy);
if (StringUtils.isNotBlank(proxyUsername)) {
String passwd = proxyPassword != null ? proxyPassword : "";
String authValue = proxyUsername + ":" + passwd;
String headerValue = Base64.encodeBase64String(authValue.getBytes(
StandardCharsets.UTF_8));
con.setRequestProperty("Proxy-Authorization", "Basic " + headerValue);
}
} else {
con = (HttpURLConnection) sendUrl.openConnection();
}
try {
if (url.toLowerCase().startsWith("https")) {
HttpsURLConnection secCon = (HttpsURLConnection) con;
secCon.setHostnameVerifier(createAllHostnamesVerifier());
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, createTrustAllManagers(), new SecureRandom());
secCon.setSSLSocketFactory(sc.getSocketFactory());
}
} catch (NoSuchAlgorithmException | KeyManagementException e) {
throw new IOException(e);
}
return con;
} | [
"protected",
"HttpURLConnection",
"createHttpURLConnection",
"(",
"final",
"String",
"url",
")",
"throws",
"IOException",
"{",
"URL",
"sendUrl",
"=",
"new",
"URL",
"(",
"url",
")",
";",
"HttpURLConnection",
"con",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank"... | Creates the URL connection.
@param url the URL
@return the URL connection
@throws IOException if creation of the URL connection fails | [
"Creates",
"the",
"URL",
"connection",
"."
] | train | https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/GoyyaSmsService.java#L411-L448 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java | Utils.readFileContentQuietly | public static String readFileContentQuietly( File file, Logger logger ) {
String result = "";
try {
if( file != null && file.exists())
result = readFileContent( file );
} catch( Exception e ) {
logger.severe( "File " + file + " could not be read." );
logException( logger, e );
}
return result;
} | java | public static String readFileContentQuietly( File file, Logger logger ) {
String result = "";
try {
if( file != null && file.exists())
result = readFileContent( file );
} catch( Exception e ) {
logger.severe( "File " + file + " could not be read." );
logException( logger, e );
}
return result;
} | [
"public",
"static",
"String",
"readFileContentQuietly",
"(",
"File",
"file",
",",
"Logger",
"logger",
")",
"{",
"String",
"result",
"=",
"\"\"",
";",
"try",
"{",
"if",
"(",
"file",
"!=",
"null",
"&&",
"file",
".",
"exists",
"(",
")",
")",
"result",
"="... | Reads a text file content and returns it as a string.
<p>
The file is tried to be read with UTF-8 encoding.
If it fails, the default system encoding is used.
</p>
@param file the file whose content must be loaded (can be null)
@param logger a logger (not null)
@return the file content or the empty string if an error occurred | [
"Reads",
"a",
"text",
"file",
"content",
"and",
"returns",
"it",
"as",
"a",
"string",
".",
"<p",
">",
"The",
"file",
"is",
"tried",
"to",
"be",
"read",
"with",
"UTF",
"-",
"8",
"encoding",
".",
"If",
"it",
"fails",
"the",
"default",
"system",
"encodi... | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L464-L477 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java | InMemoryDocumentSessionOperations.trackEntity | @SuppressWarnings("unchecked")
public <T> T trackEntity(Class<T> clazz, DocumentInfo documentFound) {
return (T) trackEntity(clazz, documentFound.getId(), documentFound.getDocument(), documentFound.getMetadata(), noTracking);
} | java | @SuppressWarnings("unchecked")
public <T> T trackEntity(Class<T> clazz, DocumentInfo documentFound) {
return (T) trackEntity(clazz, documentFound.getId(), documentFound.getDocument(), documentFound.getMetadata(), noTracking);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"trackEntity",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"DocumentInfo",
"documentFound",
")",
"{",
"return",
"(",
"T",
")",
"trackEntity",
"(",
"clazz",
",",
"documentFound... | Tracks the entity inside the unit of work
@param <T> entity class
@param clazz entity class
@param documentFound Document info
@return tracked entity | [
"Tracks",
"the",
"entity",
"inside",
"the",
"unit",
"of",
"work"
] | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/InMemoryDocumentSessionOperations.java#L501-L504 |
fabric8io/fabric8-forge | addons/fabric8-camel-maven-plugin/src/main/java/io/fabric8/forge/camel/maven/EndpointHelper.java | EndpointHelper.matchPattern | public static boolean matchPattern(String name, String pattern) {
if (name == null || pattern == null) {
return false;
}
if (name.equals(pattern)) {
// exact match
return true;
}
if (matchWildcard(name, pattern)) {
return true;
}
if (matchRegex(name, pattern)) {
return true;
}
// no match
return false;
} | java | public static boolean matchPattern(String name, String pattern) {
if (name == null || pattern == null) {
return false;
}
if (name.equals(pattern)) {
// exact match
return true;
}
if (matchWildcard(name, pattern)) {
return true;
}
if (matchRegex(name, pattern)) {
return true;
}
// no match
return false;
} | [
"public",
"static",
"boolean",
"matchPattern",
"(",
"String",
"name",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"pattern",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"name",
".",
"equals",
"(",
"p... | Matches the name with the given pattern.
<p/>
The match rules are applied in this order:
<ul>
<li>exact match, returns true</li>
<li>wildcard match (pattern ends with a * and the name starts with the pattern), returns true</li>
<li>regular expression match, returns true</li>
<li>otherwise returns false</li>
</ul>
@param name the name
@param pattern a pattern to match
@return <tt>true</tt> if match, <tt>false</tt> otherwise. | [
"Matches",
"the",
"name",
"with",
"the",
"given",
"pattern",
".",
"<p",
"/",
">",
"The",
"match",
"rules",
"are",
"applied",
"in",
"this",
"order",
":",
"<ul",
">",
"<li",
">",
"exact",
"match",
"returns",
"true<",
"/",
"li",
">",
"<li",
">",
"wildca... | train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/fabric8-camel-maven-plugin/src/main/java/io/fabric8/forge/camel/maven/EndpointHelper.java#L37-L57 |
square/dagger | core/src/main/java/dagger/internal/Linker.java | Linker.createBinding | private Binding<?> createBinding(String key, Object requiredBy, ClassLoader classLoader,
boolean mustHaveInjections) {
String builtInBindingsKey = Keys.getBuiltInBindingsKey(key);
if (builtInBindingsKey != null) {
return new BuiltInBinding<Object>(key, requiredBy, classLoader, builtInBindingsKey);
}
String lazyKey = Keys.getLazyKey(key);
if (lazyKey != null) {
return new LazyBinding<Object>(key, requiredBy, classLoader, lazyKey);
}
String className = Keys.getClassName(key);
if (className == null) {
throw new InvalidBindingException(key,
"is a generic class or an array and can only be bound with concrete type parameter(s) "
+ "in a @Provides method.");
}
if (Keys.isAnnotated(key)) {
throw new InvalidBindingException(key,
"is a @Qualifier-annotated type and must be bound by a @Provides method.");
}
Binding<?> binding =
plugin.getAtInjectBinding(key, className, classLoader, mustHaveInjections);
if (binding != null) {
return binding;
}
throw new InvalidBindingException(className, "could not be bound with key " + key);
} | java | private Binding<?> createBinding(String key, Object requiredBy, ClassLoader classLoader,
boolean mustHaveInjections) {
String builtInBindingsKey = Keys.getBuiltInBindingsKey(key);
if (builtInBindingsKey != null) {
return new BuiltInBinding<Object>(key, requiredBy, classLoader, builtInBindingsKey);
}
String lazyKey = Keys.getLazyKey(key);
if (lazyKey != null) {
return new LazyBinding<Object>(key, requiredBy, classLoader, lazyKey);
}
String className = Keys.getClassName(key);
if (className == null) {
throw new InvalidBindingException(key,
"is a generic class or an array and can only be bound with concrete type parameter(s) "
+ "in a @Provides method.");
}
if (Keys.isAnnotated(key)) {
throw new InvalidBindingException(key,
"is a @Qualifier-annotated type and must be bound by a @Provides method.");
}
Binding<?> binding =
plugin.getAtInjectBinding(key, className, classLoader, mustHaveInjections);
if (binding != null) {
return binding;
}
throw new InvalidBindingException(className, "could not be bound with key " + key);
} | [
"private",
"Binding",
"<",
"?",
">",
"createBinding",
"(",
"String",
"key",
",",
"Object",
"requiredBy",
",",
"ClassLoader",
"classLoader",
",",
"boolean",
"mustHaveInjections",
")",
"{",
"String",
"builtInBindingsKey",
"=",
"Keys",
".",
"getBuiltInBindingsKey",
"... | Returns a binding for the key in {@code deferred}. The type of binding
to be created depends on the key's type:
<ul>
<li>Injections of {@code Provider<Foo>}, {@code MembersInjector<Bar>}, and
{@code Lazy<Blah>} will delegate to the bindings of {@code Foo}, {@code Bar}, and
{@code Blah} respectively.
<li>Injections of raw types will use the injectable constructors of those classes.
<li>Any other injection types require @Provides bindings and will error out.
</ul> | [
"Returns",
"a",
"binding",
"for",
"the",
"key",
"in",
"{"
] | train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/core/src/main/java/dagger/internal/Linker.java#L208-L235 |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/api/PalDB.java | PalDB.createReader | public static StoreReader createReader(InputStream stream, Configuration config) {
return StoreImpl.createReader(stream, config);
} | java | public static StoreReader createReader(InputStream stream, Configuration config) {
return StoreImpl.createReader(stream, config);
} | [
"public",
"static",
"StoreReader",
"createReader",
"(",
"InputStream",
"stream",
",",
"Configuration",
"config",
")",
"{",
"return",
"StoreImpl",
".",
"createReader",
"(",
"stream",
",",
"config",
")",
";",
"}"
] | Creates a store reader from the specified <code>stream</code>.
<p>
The reader will read the stream and write its content to a temporary file when this method is called. This is
specifically suited for stream coming from the JAR as a resource. The stream will be closed by this method.
@param stream an input stream on a PalDB store file
@param config configuration
@return a store reader | [
"Creates",
"a",
"store",
"reader",
"from",
"the",
"specified",
"<code",
">",
"stream<",
"/",
"code",
">",
".",
"<p",
">",
"The",
"reader",
"will",
"read",
"the",
"stream",
"and",
"write",
"its",
"content",
"to",
"a",
"temporary",
"file",
"when",
"this",
... | train | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/api/PalDB.java#L72-L74 |
EsotericSoftware/kryo | src/com/esotericsoftware/kryo/serializers/ExternalizableSerializer.java | ExternalizableSerializer.hasInheritableReplaceMethod | static private boolean hasInheritableReplaceMethod (Class type, String methodName) {
Method method = null;
Class current = type;
while (current != null) {
try {
method = current.getDeclaredMethod(methodName);
break;
} catch (NoSuchMethodException ex) {
current = current.getSuperclass();
}
}
return ((method != null) && (method.getReturnType() == Object.class));
} | java | static private boolean hasInheritableReplaceMethod (Class type, String methodName) {
Method method = null;
Class current = type;
while (current != null) {
try {
method = current.getDeclaredMethod(methodName);
break;
} catch (NoSuchMethodException ex) {
current = current.getSuperclass();
}
}
return ((method != null) && (method.getReturnType() == Object.class));
} | [
"static",
"private",
"boolean",
"hasInheritableReplaceMethod",
"(",
"Class",
"type",
",",
"String",
"methodName",
")",
"{",
"Method",
"method",
"=",
"null",
";",
"Class",
"current",
"=",
"type",
";",
"while",
"(",
"current",
"!=",
"null",
")",
"{",
"try",
... | /* find out if there are any pesky serialization extras on this class | [
"/",
"*",
"find",
"out",
"if",
"there",
"are",
"any",
"pesky",
"serialization",
"extras",
"on",
"this",
"class"
] | train | https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/src/com/esotericsoftware/kryo/serializers/ExternalizableSerializer.java#L121-L133 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/SessionProtocolNegotiationCache.java | SessionProtocolNegotiationCache.setUnsupported | public static void setUnsupported(SocketAddress remoteAddress, SessionProtocol protocol) {
final String key = key(remoteAddress);
final CacheEntry e = getOrCreate(key);
if (e.addUnsupported(protocol)) {
logger.debug("Updated: '{}' does not support {}", key, e);
}
} | java | public static void setUnsupported(SocketAddress remoteAddress, SessionProtocol protocol) {
final String key = key(remoteAddress);
final CacheEntry e = getOrCreate(key);
if (e.addUnsupported(protocol)) {
logger.debug("Updated: '{}' does not support {}", key, e);
}
} | [
"public",
"static",
"void",
"setUnsupported",
"(",
"SocketAddress",
"remoteAddress",
",",
"SessionProtocol",
"protocol",
")",
"{",
"final",
"String",
"key",
"=",
"key",
"(",
"remoteAddress",
")",
";",
"final",
"CacheEntry",
"e",
"=",
"getOrCreate",
"(",
"key",
... | Updates the cache with the information that the specified {@code remoteAddress} does not support
the specified {@link SessionProtocol}. | [
"Updates",
"the",
"cache",
"with",
"the",
"information",
"that",
"the",
"specified",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/SessionProtocolNegotiationCache.java#L85-L92 |
phax/ph-ebinterface | src/main/java/com/helger/ebinterface/visualization/VisualizationManager.java | VisualizationManager.visualizeToFile | @Nullable
public static ESuccess visualizeToFile (@Nonnull final EEbInterfaceVersion eVersion,
@Nonnull final Source aSource,
@Nonnull final File aDestinationFile)
{
return visualize (eVersion, aSource, TransformResultFactory.create (aDestinationFile));
} | java | @Nullable
public static ESuccess visualizeToFile (@Nonnull final EEbInterfaceVersion eVersion,
@Nonnull final Source aSource,
@Nonnull final File aDestinationFile)
{
return visualize (eVersion, aSource, TransformResultFactory.create (aDestinationFile));
} | [
"@",
"Nullable",
"public",
"static",
"ESuccess",
"visualizeToFile",
"(",
"@",
"Nonnull",
"final",
"EEbInterfaceVersion",
"eVersion",
",",
"@",
"Nonnull",
"final",
"Source",
"aSource",
",",
"@",
"Nonnull",
"final",
"File",
"aDestinationFile",
")",
"{",
"return",
... | Visualize a source to a file for a certain ebInterface version.
@param eVersion
ebInterface version to use. May not be <code>null</code>.
@param aSource
Source. May not be <code>null</code>.
@param aDestinationFile
The file to write the result to. May not be <code>null</code>.
@return {@link ESuccess} | [
"Visualize",
"a",
"source",
"to",
"a",
"file",
"for",
"a",
"certain",
"ebInterface",
"version",
"."
] | train | https://github.com/phax/ph-ebinterface/blob/e3d2381f25c2fdfcc98acff2509bf5f33752d087/src/main/java/com/helger/ebinterface/visualization/VisualizationManager.java#L184-L190 |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Img.java | Img.interpolateARGB | public int interpolateARGB(final double xNormalized, final double yNormalized){
double xF = xNormalized * (getWidth()-1);
double yF = yNormalized * (getHeight()-1);
int x = (int)xF;
int y = (int)yF;
int c00 = getValue(x, y);
int c01 = getValue(x, (y+1 < getHeight() ? y+1:y));
int c10 = getValue((x+1 < getWidth() ? x+1:x), y);
int c11 = getValue((x+1 < getWidth() ? x+1:x), (y+1 < getHeight() ? y+1:y));
return interpolateColors(c00, c01, c10, c11, xF-x, yF-y);
} | java | public int interpolateARGB(final double xNormalized, final double yNormalized){
double xF = xNormalized * (getWidth()-1);
double yF = yNormalized * (getHeight()-1);
int x = (int)xF;
int y = (int)yF;
int c00 = getValue(x, y);
int c01 = getValue(x, (y+1 < getHeight() ? y+1:y));
int c10 = getValue((x+1 < getWidth() ? x+1:x), y);
int c11 = getValue((x+1 < getWidth() ? x+1:x), (y+1 < getHeight() ? y+1:y));
return interpolateColors(c00, c01, c10, c11, xF-x, yF-y);
} | [
"public",
"int",
"interpolateARGB",
"(",
"final",
"double",
"xNormalized",
",",
"final",
"double",
"yNormalized",
")",
"{",
"double",
"xF",
"=",
"xNormalized",
"*",
"(",
"getWidth",
"(",
")",
"-",
"1",
")",
";",
"double",
"yF",
"=",
"yNormalized",
"*",
"... | Returns a bilinearly interpolated ARGB value of the image for the
specified normalized position (x and y within [0,1]). Position {0,0}
denotes the image's origin (top left corner), position {1,1} denotes the
opposite corner (pixel at {width-1, height-1}).
<p>
An ArrayIndexOutOfBoundsException may be thrown for x and y greater than 1
or less than 0.
@param xNormalized coordinate within [0,1]
@param yNormalized coordinate within [0,1]
@throws ArrayIndexOutOfBoundsException when a resulting index is out of
the data array's bounds, which can only happen for x and y values less
than 0 or greater than 1.
@return bilinearly interpolated ARGB value.
@since 1.0 | [
"Returns",
"a",
"bilinearly",
"interpolated",
"ARGB",
"value",
"of",
"the",
"image",
"for",
"the",
"specified",
"normalized",
"position",
"(",
"x",
"and",
"y",
"within",
"[",
"0",
"1",
"]",
")",
".",
"Position",
"{",
"0",
"0",
"}",
"denotes",
"the",
"i... | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Img.java#L330-L340 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/shared/CmsClientSitemapEntry.java | CmsClientSitemapEntry.setSubEntries | public void setSubEntries(List<CmsClientSitemapEntry> children, I_CmsSitemapController controller) {
m_childrenLoadedInitially = true;
m_subEntries.clear();
if (children != null) {
m_subEntries.addAll(children);
for (CmsClientSitemapEntry child : children) {
child.updateSitePath(CmsStringUtil.joinPaths(m_sitePath, child.getName()), controller);
}
}
} | java | public void setSubEntries(List<CmsClientSitemapEntry> children, I_CmsSitemapController controller) {
m_childrenLoadedInitially = true;
m_subEntries.clear();
if (children != null) {
m_subEntries.addAll(children);
for (CmsClientSitemapEntry child : children) {
child.updateSitePath(CmsStringUtil.joinPaths(m_sitePath, child.getName()), controller);
}
}
} | [
"public",
"void",
"setSubEntries",
"(",
"List",
"<",
"CmsClientSitemapEntry",
">",
"children",
",",
"I_CmsSitemapController",
"controller",
")",
"{",
"m_childrenLoadedInitially",
"=",
"true",
";",
"m_subEntries",
".",
"clear",
"(",
")",
";",
"if",
"(",
"children",... | Sets the children.<p>
@param children the children to set
@param controller a sitemap controller instance | [
"Sets",
"the",
"children",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/shared/CmsClientSitemapEntry.java#L1034-L1045 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/history/HistoryStore.java | HistoryStore.initHistoryUpdaters | private void initHistoryUpdaters() {
historyUpdaters.put(RequestType.EXEC,
new HistoryUpdater<JmxExecRequest>() {
/** {@inheritDoc} */
public void updateHistory(JSONObject pJson,JmxExecRequest request, long pTimestamp) {
HistoryEntry entry = historyStore.get(new HistoryKey(request));
if (entry != null) {
synchronized(entry) {
pJson.put(KEY_HISTORY,entry.jsonifyValues());
entry.add(pJson.get(KEY_VALUE),pTimestamp);
}
}
}
});
historyUpdaters.put(RequestType.WRITE,
new HistoryUpdater<JmxWriteRequest>() {
/** {@inheritDoc} */
public void updateHistory(JSONObject pJson,JmxWriteRequest request, long pTimestamp) {
HistoryEntry entry = historyStore.get(new HistoryKey(request));
if (entry != null) {
synchronized(entry) {
pJson.put(KEY_HISTORY,entry.jsonifyValues());
entry.add(request.getValue(),pTimestamp);
}
}
}
});
historyUpdaters.put(RequestType.READ,
new HistoryUpdater<JmxReadRequest>() {
/** {@inheritDoc} */
public void updateHistory(JSONObject pJson,JmxReadRequest request, long pTimestamp) {
updateReadHistory(request,pJson,pTimestamp);
}
});
} | java | private void initHistoryUpdaters() {
historyUpdaters.put(RequestType.EXEC,
new HistoryUpdater<JmxExecRequest>() {
/** {@inheritDoc} */
public void updateHistory(JSONObject pJson,JmxExecRequest request, long pTimestamp) {
HistoryEntry entry = historyStore.get(new HistoryKey(request));
if (entry != null) {
synchronized(entry) {
pJson.put(KEY_HISTORY,entry.jsonifyValues());
entry.add(pJson.get(KEY_VALUE),pTimestamp);
}
}
}
});
historyUpdaters.put(RequestType.WRITE,
new HistoryUpdater<JmxWriteRequest>() {
/** {@inheritDoc} */
public void updateHistory(JSONObject pJson,JmxWriteRequest request, long pTimestamp) {
HistoryEntry entry = historyStore.get(new HistoryKey(request));
if (entry != null) {
synchronized(entry) {
pJson.put(KEY_HISTORY,entry.jsonifyValues());
entry.add(request.getValue(),pTimestamp);
}
}
}
});
historyUpdaters.put(RequestType.READ,
new HistoryUpdater<JmxReadRequest>() {
/** {@inheritDoc} */
public void updateHistory(JSONObject pJson,JmxReadRequest request, long pTimestamp) {
updateReadHistory(request,pJson,pTimestamp);
}
});
} | [
"private",
"void",
"initHistoryUpdaters",
"(",
")",
"{",
"historyUpdaters",
".",
"put",
"(",
"RequestType",
".",
"EXEC",
",",
"new",
"HistoryUpdater",
"<",
"JmxExecRequest",
">",
"(",
")",
"{",
"/** {@inheritDoc} */",
"public",
"void",
"updateHistory",
"(",
"JSO... | A set of updaters which are dispatched to for certain request types | [
"A",
"set",
"of",
"updaters",
"which",
"are",
"dispatched",
"to",
"for",
"certain",
"request",
"types"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/history/HistoryStore.java#L188-L223 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/ngmf/util/cosu/luca/ParameterData.java | ParameterData.setLowerAndUpperBounds | public void setLowerAndUpperBounds(double lower, double upper) {
if (data == null) {
return;
}
this.originalLowerBound = lower;
this.originalUpperBound = upper;
if (originalLowerBound < min) {
offset = Math.abs(originalLowerBound) + 10;
} else {
offset = Math.abs(min) + 10;
}
if (calibrationType == MEAN) {
lowerBound = (originalLowerBound + offset) * (mean + offset) / (min + offset) - offset;
upperBound = (originalUpperBound + offset) * (mean + offset) / (max + offset) - offset;
} else {
lowerBound = originalLowerBound;
upperBound = originalUpperBound;
}
hasBounds = true;
setDeviation();
} | java | public void setLowerAndUpperBounds(double lower, double upper) {
if (data == null) {
return;
}
this.originalLowerBound = lower;
this.originalUpperBound = upper;
if (originalLowerBound < min) {
offset = Math.abs(originalLowerBound) + 10;
} else {
offset = Math.abs(min) + 10;
}
if (calibrationType == MEAN) {
lowerBound = (originalLowerBound + offset) * (mean + offset) / (min + offset) - offset;
upperBound = (originalUpperBound + offset) * (mean + offset) / (max + offset) - offset;
} else {
lowerBound = originalLowerBound;
upperBound = originalUpperBound;
}
hasBounds = true;
setDeviation();
} | [
"public",
"void",
"setLowerAndUpperBounds",
"(",
"double",
"lower",
",",
"double",
"upper",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
";",
"}",
"this",
".",
"originalLowerBound",
"=",
"lower",
";",
"this",
".",
"originalUpperBound",
"=... | Set the lower and upper bounds, and the actual bounds are determined. | [
"Set",
"the",
"lower",
"and",
"upper",
"bounds",
"and",
"the",
"actual",
"bounds",
"are",
"determined",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/cosu/luca/ParameterData.java#L229-L251 |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java | DescriptorProperties.putIndexedFixedProperties | public void putIndexedFixedProperties(String key, List<String> subKeys, List<List<String>> subKeyValues) {
checkNotNull(key);
checkNotNull(subKeys);
checkNotNull(subKeyValues);
for (int idx = 0; idx < subKeyValues.size(); idx++) {
final List<String> values = subKeyValues.get(idx);
if (values == null || values.size() != subKeys.size()) {
throw new ValidationException("Values must have same arity as keys.");
}
for (int keyIdx = 0; keyIdx < values.size(); keyIdx++) {
put(key + '.' + idx + '.' + subKeys.get(keyIdx), values.get(keyIdx));
}
}
} | java | public void putIndexedFixedProperties(String key, List<String> subKeys, List<List<String>> subKeyValues) {
checkNotNull(key);
checkNotNull(subKeys);
checkNotNull(subKeyValues);
for (int idx = 0; idx < subKeyValues.size(); idx++) {
final List<String> values = subKeyValues.get(idx);
if (values == null || values.size() != subKeys.size()) {
throw new ValidationException("Values must have same arity as keys.");
}
for (int keyIdx = 0; keyIdx < values.size(); keyIdx++) {
put(key + '.' + idx + '.' + subKeys.get(keyIdx), values.get(keyIdx));
}
}
} | [
"public",
"void",
"putIndexedFixedProperties",
"(",
"String",
"key",
",",
"List",
"<",
"String",
">",
"subKeys",
",",
"List",
"<",
"List",
"<",
"String",
">",
">",
"subKeyValues",
")",
"{",
"checkNotNull",
"(",
"key",
")",
";",
"checkNotNull",
"(",
"subKey... | Adds an indexed sequence of properties (with sub-properties) under a common key.
<p>For example:
<pre>
schema.fields.0.type = INT, schema.fields.0.name = test
schema.fields.1.type = LONG, schema.fields.1.name = test2
</pre>
<p>The arity of each subKeyValues must match the arity of propertyKeys. | [
"Adds",
"an",
"indexed",
"sequence",
"of",
"properties",
"(",
"with",
"sub",
"-",
"properties",
")",
"under",
"a",
"common",
"key",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java#L202-L215 |
logic-ng/LogicNG | src/main/java/org/logicng/formulas/FormulaFactory.java | FormulaFactory.addFormulaOr | private void addFormulaOr(final LinkedHashSet<Formula> ops, final Formula f) {
if (f.type == FALSE) {
this.formulaAdditionResult[0] = true;
this.formulaAdditionResult[1] = true;
} else if (f.type == TRUE || containsComplement(ops, f)) {
this.formulaAdditionResult[0] = false;
this.formulaAdditionResult[1] = false;
} else {
ops.add(f);
this.formulaAdditionResult[0] = true;
this.formulaAdditionResult[1] = f.type == LITERAL;
}
} | java | private void addFormulaOr(final LinkedHashSet<Formula> ops, final Formula f) {
if (f.type == FALSE) {
this.formulaAdditionResult[0] = true;
this.formulaAdditionResult[1] = true;
} else if (f.type == TRUE || containsComplement(ops, f)) {
this.formulaAdditionResult[0] = false;
this.formulaAdditionResult[1] = false;
} else {
ops.add(f);
this.formulaAdditionResult[0] = true;
this.formulaAdditionResult[1] = f.type == LITERAL;
}
} | [
"private",
"void",
"addFormulaOr",
"(",
"final",
"LinkedHashSet",
"<",
"Formula",
">",
"ops",
",",
"final",
"Formula",
"f",
")",
"{",
"if",
"(",
"f",
".",
"type",
"==",
"FALSE",
")",
"{",
"this",
".",
"formulaAdditionResult",
"[",
"0",
"]",
"=",
"true"... | Adds a given formula to a list of operands. If the formula is the neutral element for the respective n-ary
operation it will be skipped. If a complementary formula is already present in the list of operands or the
formula is the dual element, {@code false} is stored as first element of the result array,
otherwise {@code true} is the first element of the result array. If the added formula was a literal, the second
element in the result array is {@code true}, {@code false} otherwise.
@param ops the list of operands
@param f the formula | [
"Adds",
"a",
"given",
"formula",
"to",
"a",
"list",
"of",
"operands",
".",
"If",
"the",
"formula",
"is",
"the",
"neutral",
"element",
"for",
"the",
"respective",
"n",
"-",
"ary",
"operation",
"it",
"will",
"be",
"skipped",
".",
"If",
"a",
"complementary"... | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L954-L966 |
lestard/advanced-bindings | src/main/java/eu/lestard/advanced_bindings/api/StringBindings.java | StringBindings.transforming | public static StringBinding transforming(ObservableValue<String> text, Function<String, String> transformer) {
return Bindings.createStringBinding(()
-> {
Function<String, String> func = transformer == null ? Function.identity() : transformer;
return text.getValue() == null ? "" : func.apply(text.getValue());
}, text);
} | java | public static StringBinding transforming(ObservableValue<String> text, Function<String, String> transformer) {
return Bindings.createStringBinding(()
-> {
Function<String, String> func = transformer == null ? Function.identity() : transformer;
return text.getValue() == null ? "" : func.apply(text.getValue());
}, text);
} | [
"public",
"static",
"StringBinding",
"transforming",
"(",
"ObservableValue",
"<",
"String",
">",
"text",
",",
"Function",
"<",
"String",
",",
"String",
">",
"transformer",
")",
"{",
"return",
"Bindings",
".",
"createStringBinding",
"(",
"(",
")",
"->",
"{",
... | Creates a string binding that contains the value of the given observable string transformed using the supplied
function.
If the given observable string has a value of `null` the created binding will contain an empty string.
If the given function has a value of `null` {@link Function#identity()} will be used instead.
@param text
the source string that will used for the conversion.
@param transformer
a non-interfering, stateless function to apply to the source string.
@return a binding containing the transformed string. | [
"Creates",
"a",
"string",
"binding",
"that",
"contains",
"the",
"value",
"of",
"the",
"given",
"observable",
"string",
"transformed",
"using",
"the",
"supplied",
"function",
"."
] | train | https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/StringBindings.java#L220-L226 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/Tuple.java | Tuple.isBindingCompatible | private static boolean isBindingCompatible( Tuple tuple, VarBindingDef binding)
{
VarValueDef currentValue = tuple.getBinding( binding.getVarDef());
return (currentValue == null || currentValue.equals( binding.getValueDef()));
} | java | private static boolean isBindingCompatible( Tuple tuple, VarBindingDef binding)
{
VarValueDef currentValue = tuple.getBinding( binding.getVarDef());
return (currentValue == null || currentValue.equals( binding.getValueDef()));
} | [
"private",
"static",
"boolean",
"isBindingCompatible",
"(",
"Tuple",
"tuple",
",",
"VarBindingDef",
"binding",
")",
"{",
"VarValueDef",
"currentValue",
"=",
"tuple",
".",
"getBinding",
"(",
"binding",
".",
"getVarDef",
"(",
")",
")",
";",
"return",
"(",
"curre... | Returns true if the given binding can be added to the give tuple. | [
"Returns",
"true",
"if",
"the",
"given",
"binding",
"can",
"be",
"added",
"to",
"the",
"give",
"tuple",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/Tuple.java#L93-L97 |
etnetera/seb | src/main/java/cz/etnetera/seb/listener/SebListener.java | SebListener.saveFile | protected void saveFile(SebEvent event, File file, String name, String extension) {
event.saveFile(file, getListenerFileName(name), extension);
} | java | protected void saveFile(SebEvent event, File file, String name, String extension) {
event.saveFile(file, getListenerFileName(name), extension);
} | [
"protected",
"void",
"saveFile",
"(",
"SebEvent",
"event",
",",
"File",
"file",
",",
"String",
"name",
",",
"String",
"extension",
")",
"{",
"event",
".",
"saveFile",
"(",
"file",
",",
"getListenerFileName",
"(",
"name",
")",
",",
"extension",
")",
";",
... | Save file into output file with given name and extension.
@param event
@param file
@param name
@param extension | [
"Save",
"file",
"into",
"output",
"file",
"with",
"given",
"name",
"and",
"extension",
"."
] | train | https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/listener/SebListener.java#L461-L463 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/HttpChannelUtils.java | HttpChannelUtils.getEnglishString | static public String getEnglishString(byte[] data, int start, int end) {
int len = end - start;
if (0 >= len || null == data) {
return null;
}
char chars[] = new char[len];
for (int i = start; i < end; i++) {
chars[i] = (char) (data[i] & 0xff);
}
return new String(chars);
} | java | static public String getEnglishString(byte[] data, int start, int end) {
int len = end - start;
if (0 >= len || null == data) {
return null;
}
char chars[] = new char[len];
for (int i = start; i < end; i++) {
chars[i] = (char) (data[i] & 0xff);
}
return new String(chars);
} | [
"static",
"public",
"String",
"getEnglishString",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"len",
"=",
"end",
"-",
"start",
";",
"if",
"(",
"0",
">=",
"len",
"||",
"null",
"==",
"data",
")",
"{",
"re... | Utility method to get the ISO English string from the given bytes.
@param data
@param start
@param end
@return String | [
"Utility",
"method",
"to",
"get",
"the",
"ISO",
"English",
"string",
"from",
"the",
"given",
"bytes",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/channel/HttpChannelUtils.java#L172-L182 |
BioPAX/Paxtools | normalizer/src/main/java/org/biopax/paxtools/normalizer/MiriamLink.java | MiriamLink.getIdentifiersOrgURI | public static String getIdentifiersOrgURI(String name, String id)
{
String url = null;
Datatype datatype = getDatatype(name);
String db = datatype.getName();
if(checkRegExp(id, db)) {
uris:
for(Uris uris : datatype.getUris()) {
for(Uri uri : uris.getUri()) {
if(uri.getValue().startsWith("http://identifiers.org/")) {
url = uri.getValue() + id;
break uris;
}
}
}
} else
throw new IllegalArgumentException(
"ID pattern mismatch. db=" + db + ", id=" + id
+ ", regexp: " + datatype.getPattern());
return url;
} | java | public static String getIdentifiersOrgURI(String name, String id)
{
String url = null;
Datatype datatype = getDatatype(name);
String db = datatype.getName();
if(checkRegExp(id, db)) {
uris:
for(Uris uris : datatype.getUris()) {
for(Uri uri : uris.getUri()) {
if(uri.getValue().startsWith("http://identifiers.org/")) {
url = uri.getValue() + id;
break uris;
}
}
}
} else
throw new IllegalArgumentException(
"ID pattern mismatch. db=" + db + ", id=" + id
+ ", regexp: " + datatype.getPattern());
return url;
} | [
"public",
"static",
"String",
"getIdentifiersOrgURI",
"(",
"String",
"name",
",",
"String",
"id",
")",
"{",
"String",
"url",
"=",
"null",
";",
"Datatype",
"datatype",
"=",
"getDatatype",
"(",
"name",
")",
";",
"String",
"db",
"=",
"datatype",
".",
"getName... | Gets the Identifiers.org URI/URL of the entity (example: "http://identifiers.org/obo.go/GO:0045202").
@param name - name, URI/URL, or ID of a data type (examples: "ChEBI", "MIR:00000005")
@param id identifier of an entity within the data type (examples: "GO:0045202", "P62158")
@return Identifiers.org URL for the id
@throws IllegalArgumentException when datatype not found | [
"Gets",
"the",
"Identifiers",
".",
"org",
"URI",
"/",
"URL",
"of",
"the",
"entity",
"(",
"example",
":",
"http",
":",
"//",
"identifiers",
".",
"org",
"/",
"obo",
".",
"go",
"/",
"GO",
":",
"0045202",
")",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/normalizer/src/main/java/org/biopax/paxtools/normalizer/MiriamLink.java#L569-L590 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateMobile | public static <T extends CharSequence> T validateMobile(T value, String errorMsg) throws ValidateException {
if (false == isMobile(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateMobile(T value, String errorMsg) throws ValidateException {
if (false == isMobile(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateMobile",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isMobile",
"(",
"value",
")",
")",
"{",
"throw",
"new",
... | 验证是否为手机号码(中国)
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为手机号码(中国)"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L677-L682 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/TimeZoneNames.java | TimeZoneNames.getDisplayName | public static String getDisplayName(String[][] zoneStrings, String id, boolean daylight, int style) {
String[] needle = new String[] { id };
int index = Arrays.binarySearch(zoneStrings, needle, ZONE_STRINGS_COMPARATOR);
if (index >= 0) {
String[] row = zoneStrings[index];
if (daylight) {
return (style == TimeZone.LONG) ? row[LONG_NAME_DST] : row[SHORT_NAME_DST];
} else {
return (style == TimeZone.LONG) ? row[LONG_NAME] : row[SHORT_NAME];
}
}
return null;
} | java | public static String getDisplayName(String[][] zoneStrings, String id, boolean daylight, int style) {
String[] needle = new String[] { id };
int index = Arrays.binarySearch(zoneStrings, needle, ZONE_STRINGS_COMPARATOR);
if (index >= 0) {
String[] row = zoneStrings[index];
if (daylight) {
return (style == TimeZone.LONG) ? row[LONG_NAME_DST] : row[SHORT_NAME_DST];
} else {
return (style == TimeZone.LONG) ? row[LONG_NAME] : row[SHORT_NAME];
}
}
return null;
} | [
"public",
"static",
"String",
"getDisplayName",
"(",
"String",
"[",
"]",
"[",
"]",
"zoneStrings",
",",
"String",
"id",
",",
"boolean",
"daylight",
",",
"int",
"style",
")",
"{",
"String",
"[",
"]",
"needle",
"=",
"new",
"String",
"[",
"]",
"{",
"id",
... | Returns the appropriate string from 'zoneStrings'. Used with getZoneStrings. | [
"Returns",
"the",
"appropriate",
"string",
"from",
"zoneStrings",
".",
"Used",
"with",
"getZoneStrings",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/TimeZoneNames.java#L114-L126 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java | NetworkConfig.createAllOrganizations | private void createAllOrganizations(Map<String, JsonObject> foundCertificateAuthorities) throws NetworkConfigurationException {
// Sanity check
if (organizations != null) {
throw new NetworkConfigurationException("INTERNAL ERROR: organizations has already been initialized!");
}
organizations = new HashMap<>();
// organizations is a JSON object containing a nested object for each Org
JsonObject jsonOrganizations = getJsonObject(jsonConfig, "organizations");
if (jsonOrganizations != null) {
for (Entry<String, JsonValue> entry : jsonOrganizations.entrySet()) {
String orgName = entry.getKey();
JsonObject jsonOrg = getJsonValueAsObject(entry.getValue());
if (jsonOrg == null) {
throw new NetworkConfigurationException(format("Error loading config. Invalid Organization entry: %s", orgName));
}
OrgInfo org = createOrg(orgName, jsonOrg, foundCertificateAuthorities);
organizations.put(orgName, org);
}
}
} | java | private void createAllOrganizations(Map<String, JsonObject> foundCertificateAuthorities) throws NetworkConfigurationException {
// Sanity check
if (organizations != null) {
throw new NetworkConfigurationException("INTERNAL ERROR: organizations has already been initialized!");
}
organizations = new HashMap<>();
// organizations is a JSON object containing a nested object for each Org
JsonObject jsonOrganizations = getJsonObject(jsonConfig, "organizations");
if (jsonOrganizations != null) {
for (Entry<String, JsonValue> entry : jsonOrganizations.entrySet()) {
String orgName = entry.getKey();
JsonObject jsonOrg = getJsonValueAsObject(entry.getValue());
if (jsonOrg == null) {
throw new NetworkConfigurationException(format("Error loading config. Invalid Organization entry: %s", orgName));
}
OrgInfo org = createOrg(orgName, jsonOrg, foundCertificateAuthorities);
organizations.put(orgName, org);
}
}
} | [
"private",
"void",
"createAllOrganizations",
"(",
"Map",
"<",
"String",
",",
"JsonObject",
">",
"foundCertificateAuthorities",
")",
"throws",
"NetworkConfigurationException",
"{",
"// Sanity check",
"if",
"(",
"organizations",
"!=",
"null",
")",
"{",
"throw",
"new",
... | Creates JsonObjects representing all the Organizations defined in the config file | [
"Creates",
"JsonObjects",
"representing",
"all",
"the",
"Organizations",
"defined",
"in",
"the",
"config",
"file"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java#L591-L618 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingEndpointsInner.java | StreamingEndpointsInner.listAsync | public Observable<Page<StreamingEndpointInner>> listAsync(final String resourceGroupName, final String accountName) {
return listWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<StreamingEndpointInner>>, Page<StreamingEndpointInner>>() {
@Override
public Page<StreamingEndpointInner> call(ServiceResponse<Page<StreamingEndpointInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<StreamingEndpointInner>> listAsync(final String resourceGroupName, final String accountName) {
return listWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<StreamingEndpointInner>>, Page<StreamingEndpointInner>>() {
@Override
public Page<StreamingEndpointInner> call(ServiceResponse<Page<StreamingEndpointInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"StreamingEndpointInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountNa... | List StreamingEndpoints.
Lists the StreamingEndpoints in the account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<StreamingEndpointInner> object | [
"List",
"StreamingEndpoints",
".",
"Lists",
"the",
"StreamingEndpoints",
"in",
"the",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingEndpointsInner.java#L181-L189 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getInterpolatedString | public String getInterpolatedString(String name, String defaultValue) {
String value = getString(name, defaultValue);
return interpolateString(value);
} | java | public String getInterpolatedString(String name, String defaultValue) {
String value = getString(name, defaultValue);
return interpolateString(value);
} | [
"public",
"String",
"getInterpolatedString",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"defaultValue",
")",
";",
"return",
"interpolateString",
"(",
"value",
")",
";",
"}"
] | Returns a string value that has been interpolated from System Properties
and Environment Variables using the ${name} or @{name} syntax.
@param name
@param defaultValue
@return an interpolated string | [
"Returns",
"a",
"string",
"value",
"that",
"has",
"been",
"interpolated",
"from",
"System",
"Properties",
"and",
"Environment",
"Variables",
"using",
"the",
"$",
"{",
"name",
"}",
"or",
"@",
"{",
"name",
"}",
"syntax",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L463-L466 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java | GenericLogicDiscoverer.findServicesProducingSome | @Override
public Map<URI, MatchResult> findServicesProducingSome(Set<URI> outputTypes) {
return findServicesProducingSome(outputTypes, LogicConceptMatchType.Plugin);
} | java | @Override
public Map<URI, MatchResult> findServicesProducingSome(Set<URI> outputTypes) {
return findServicesProducingSome(outputTypes, LogicConceptMatchType.Plugin);
} | [
"@",
"Override",
"public",
"Map",
"<",
"URI",
",",
"MatchResult",
">",
"findServicesProducingSome",
"(",
"Set",
"<",
"URI",
">",
"outputTypes",
")",
"{",
"return",
"findServicesProducingSome",
"(",
"outputTypes",
",",
"LogicConceptMatchType",
".",
"Plugin",
")",
... | Discover registered services that produce some (i.e., at least one) of the types of output provided. That is, all
those for which at least one output can be matched to the output types provided.
@param outputTypes the types of output to be produced
@return a Set containing all the matching services. If there are no solutions, the Set should be empty, not null. | [
"Discover",
"registered",
"services",
"that",
"produce",
"some",
"(",
"i",
".",
"e",
".",
"at",
"least",
"one",
")",
"of",
"the",
"types",
"of",
"output",
"provided",
".",
"That",
"is",
"all",
"those",
"for",
"which",
"at",
"least",
"one",
"output",
"c... | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L418-L421 |
stevespringett/Alpine | alpine/src/main/java/alpine/persistence/AlpineQueryManager.java | AlpineQueryManager.addUserToTeam | public boolean addUserToTeam(final UserPrincipal user, final Team team) {
List<Team> teams = user.getTeams();
boolean found = false;
if (teams == null) {
teams = new ArrayList<>();
}
for (final Team t: teams) {
if (team.getUuid().equals(t.getUuid())) {
found = true;
}
}
if (!found) {
pm.currentTransaction().begin();
teams.add(team);
user.setTeams(teams);
pm.currentTransaction().commit();
return true;
}
return false;
} | java | public boolean addUserToTeam(final UserPrincipal user, final Team team) {
List<Team> teams = user.getTeams();
boolean found = false;
if (teams == null) {
teams = new ArrayList<>();
}
for (final Team t: teams) {
if (team.getUuid().equals(t.getUuid())) {
found = true;
}
}
if (!found) {
pm.currentTransaction().begin();
teams.add(team);
user.setTeams(teams);
pm.currentTransaction().commit();
return true;
}
return false;
} | [
"public",
"boolean",
"addUserToTeam",
"(",
"final",
"UserPrincipal",
"user",
",",
"final",
"Team",
"team",
")",
"{",
"List",
"<",
"Team",
">",
"teams",
"=",
"user",
".",
"getTeams",
"(",
")",
";",
"boolean",
"found",
"=",
"false",
";",
"if",
"(",
"team... | Associates a UserPrincipal to a Team.
@param user The user to bind
@param team The team to bind
@return true if operation was successful, false if not. This is not an indication of team association,
an unsuccessful return value may be due to the team or user not existing, or a binding that already
exists between the two.
@since 1.0.0 | [
"Associates",
"a",
"UserPrincipal",
"to",
"a",
"Team",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L393-L412 |
openengsb/openengsb | components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java | AbstractEDBService.performCommit | private Long performCommit(JPACommit commit) throws EDBException {
synchronized (entityManager) {
long timestamp = System.currentTimeMillis();
try {
beginTransaction();
persistCommitChanges(commit, timestamp);
commitTransaction();
} catch (Exception ex) {
try {
rollbackTransaction();
} catch (Exception e) {
throw new EDBException("Failed to rollback transaction to EDB", e);
}
throw new EDBException("Failed to commit transaction to EDB", ex);
}
return timestamp;
}
} | java | private Long performCommit(JPACommit commit) throws EDBException {
synchronized (entityManager) {
long timestamp = System.currentTimeMillis();
try {
beginTransaction();
persistCommitChanges(commit, timestamp);
commitTransaction();
} catch (Exception ex) {
try {
rollbackTransaction();
} catch (Exception e) {
throw new EDBException("Failed to rollback transaction to EDB", e);
}
throw new EDBException("Failed to commit transaction to EDB", ex);
}
return timestamp;
}
} | [
"private",
"Long",
"performCommit",
"(",
"JPACommit",
"commit",
")",
"throws",
"EDBException",
"{",
"synchronized",
"(",
"entityManager",
")",
"{",
"long",
"timestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"beginTransaction",
"(",
... | Does the actual commit work (JPA related actions) and returns the timestamp when the commit was done. Throws an
EDBException if an error occurs. | [
"Does",
"the",
"actual",
"commit",
"work",
"(",
"JPA",
"related",
"actions",
")",
"and",
"returns",
"the",
"timestamp",
"when",
"the",
"commit",
"was",
"done",
".",
"Throws",
"an",
"EDBException",
"if",
"an",
"error",
"occurs",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java#L90-L107 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java | ValueListMap.addValueToKey | public void addValueToKey(K key, V value) {
this.addValuesToKey(key, Collections.singletonList(value));
} | java | public void addValueToKey(K key, V value) {
this.addValuesToKey(key, Collections.singletonList(value));
} | [
"public",
"void",
"addValueToKey",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"this",
".",
"addValuesToKey",
"(",
"key",
",",
"Collections",
".",
"singletonList",
"(",
"value",
")",
")",
";",
"}"
] | Add a value to the map under the existing key or creating a new key if it does not
yet exist.
@param key the key to associate the values with
@param value the value to add to the key | [
"Add",
"a",
"value",
"to",
"the",
"map",
"under",
"the",
"existing",
"key",
"or",
"creating",
"a",
"new",
"key",
"if",
"it",
"does",
"not",
"yet",
"exist",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java#L55-L57 |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.updateServer | void updateServer(ServerHeartbeat server, UpdateServerHeartbeat update)
{
if (server.isSelf()) {
return;
}
String externalId = update.getExternalId();
updateExternal(server, externalId);
// XXX: validation
server.setSeedIndex(update.getSeedIndex());
if (server.onHeartbeatUpdate(update)) {
if (server.isUp()) {
onServerStart(server);
}
else {
onServerStop(server);
}
}
} | java | void updateServer(ServerHeartbeat server, UpdateServerHeartbeat update)
{
if (server.isSelf()) {
return;
}
String externalId = update.getExternalId();
updateExternal(server, externalId);
// XXX: validation
server.setSeedIndex(update.getSeedIndex());
if (server.onHeartbeatUpdate(update)) {
if (server.isUp()) {
onServerStart(server);
}
else {
onServerStop(server);
}
}
} | [
"void",
"updateServer",
"(",
"ServerHeartbeat",
"server",
",",
"UpdateServerHeartbeat",
"update",
")",
"{",
"if",
"(",
"server",
".",
"isSelf",
"(",
")",
")",
"{",
"return",
";",
"}",
"String",
"externalId",
"=",
"update",
".",
"getExternalId",
"(",
")",
"... | Update a server with a heartbeat update.
@param server the server to be updated
@param update the new update information | [
"Update",
"a",
"server",
"with",
"a",
"heartbeat",
"update",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L712-L733 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java | CPFriendlyURLEntryPersistenceImpl.findAll | @Override
public List<CPFriendlyURLEntry> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CPFriendlyURLEntry> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPFriendlyURLEntry",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp friendly url entries.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPFriendlyURLEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of cp friendly url entries
@param end the upper bound of the range of cp friendly url entries (not inclusive)
@return the range of cp friendly url entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"friendly",
"url",
"entries",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L5834-L5837 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.getArgumentForCallOrNew | static Node getArgumentForCallOrNew(Node call, int index) {
checkState(isCallOrNew(call));
return getNthSibling(call.getSecondChild(), index);
} | java | static Node getArgumentForCallOrNew(Node call, int index) {
checkState(isCallOrNew(call));
return getNthSibling(call.getSecondChild(), index);
} | [
"static",
"Node",
"getArgumentForCallOrNew",
"(",
"Node",
"call",
",",
"int",
"index",
")",
"{",
"checkState",
"(",
"isCallOrNew",
"(",
"call",
")",
")",
";",
"return",
"getNthSibling",
"(",
"call",
".",
"getSecondChild",
"(",
")",
",",
"index",
")",
";",
... | Given the new or call, this returns the nth
argument of the call or null if no such argument exists. | [
"Given",
"the",
"new",
"or",
"call",
"this",
"returns",
"the",
"nth",
"argument",
"of",
"the",
"call",
"or",
"null",
"if",
"no",
"such",
"argument",
"exists",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L5220-L5223 |
digipost/signature-api-client-java | src/main/java/no/digipost/signature/client/direct/DirectClient.java | DirectClient.getStatus | public DirectJobStatusResponse getStatus(StatusReference statusReference) {
XMLDirectSignatureJobStatusResponse xmlSignatureJobStatusResponse = client.sendSignatureJobStatusRequest(statusReference.getStatusUrl());
return fromJaxb(xmlSignatureJobStatusResponse, null);
} | java | public DirectJobStatusResponse getStatus(StatusReference statusReference) {
XMLDirectSignatureJobStatusResponse xmlSignatureJobStatusResponse = client.sendSignatureJobStatusRequest(statusReference.getStatusUrl());
return fromJaxb(xmlSignatureJobStatusResponse, null);
} | [
"public",
"DirectJobStatusResponse",
"getStatus",
"(",
"StatusReference",
"statusReference",
")",
"{",
"XMLDirectSignatureJobStatusResponse",
"xmlSignatureJobStatusResponse",
"=",
"client",
".",
"sendSignatureJobStatusRequest",
"(",
"statusReference",
".",
"getStatusUrl",
"(",
... | Get the current status for the given {@link StatusReference}, which references the status for a specific job.
When processing of the status is complete (e.g. retrieving {@link #getPAdES(PAdESReference) PAdES} and/or
{@link #getXAdES(XAdESReference) XAdES} documents for a {@link DirectJobStatus#COMPLETED_SUCCESSFULLY completed} job
where all signers have {@link SignerStatus#SIGNED signed} their documents),
the returned status must be {@link #confirm(DirectJobStatusResponse) confirmed}.
@param statusReference the reference to the status of a specific job.
@return the {@link DirectJobStatusResponse} for the job referenced by the given {@link StatusReference},
never {@code null}. | [
"Get",
"the",
"current",
"status",
"for",
"the",
"given",
"{",
"@link",
"StatusReference",
"}",
"which",
"references",
"the",
"status",
"for",
"a",
"specific",
"job",
".",
"When",
"processing",
"of",
"the",
"status",
"is",
"complete",
"(",
"e",
".",
"g",
... | train | https://github.com/digipost/signature-api-client-java/blob/246207571641fbac6beda5ffc585eec188825c45/src/main/java/no/digipost/signature/client/direct/DirectClient.java#L58-L61 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.updateNote | public GitlabNote updateNote(GitlabMergeRequest mergeRequest, Integer noteId, String body) throws IOException {
Query query = new Query()
.appendIf("body", body);
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() +
GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabNote.URL + "/" + noteId + query.toString();
return retrieve().method(PUT).to(tailUrl, GitlabNote.class);
} | java | public GitlabNote updateNote(GitlabMergeRequest mergeRequest, Integer noteId, String body) throws IOException {
Query query = new Query()
.appendIf("body", body);
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() +
GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabNote.URL + "/" + noteId + query.toString();
return retrieve().method(PUT).to(tailUrl, GitlabNote.class);
} | [
"public",
"GitlabNote",
"updateNote",
"(",
"GitlabMergeRequest",
"mergeRequest",
",",
"Integer",
"noteId",
",",
"String",
"body",
")",
"throws",
"IOException",
"{",
"Query",
"query",
"=",
"new",
"Query",
"(",
")",
".",
"appendIf",
"(",
"\"body\"",
",",
"body",... | Update a Merge Request Note
@param mergeRequest The merge request
@param noteId The id of the note
@param body The content of the note
@return the Gitlab Note
@throws IOException on gitlab api call error | [
"Update",
"a",
"Merge",
"Request",
"Note"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2267-L2275 |
xwiki/xwiki-rendering | xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/impl/WikiScannerUtil.java | WikiScannerUtil.extractSubstring | public static String extractSubstring(String str, String open, String close)
{
return extractSubstring(str, open, close, DEFAULT_ESCAPECHAR, true);
} | java | public static String extractSubstring(String str, String open, String close)
{
return extractSubstring(str, open, close, DEFAULT_ESCAPECHAR, true);
} | [
"public",
"static",
"String",
"extractSubstring",
"(",
"String",
"str",
",",
"String",
"open",
",",
"String",
"close",
")",
"{",
"return",
"extractSubstring",
"(",
"str",
",",
"open",
",",
"close",
",",
"DEFAULT_ESCAPECHAR",
",",
"true",
")",
";",
"}"
] | Extracts and returns a substring of the given string starting from the
given open sequence and finishing by the specified close sequence. This
method unescapes all symbols prefixed by the given escape symbol.
@param str from this string the substring framed by the specified open
and close sequence will be returned
@param open the start substring sequence
@param close the closing substring sequence
@return a substring of the given string starting from the given open
sequence and finishing by the specified close sequence | [
"Extracts",
"and",
"returns",
"a",
"substring",
"of",
"the",
"given",
"string",
"starting",
"from",
"the",
"given",
"open",
"sequence",
"and",
"finishing",
"by",
"the",
"specified",
"close",
"sequence",
".",
"This",
"method",
"unescapes",
"all",
"symbols",
"pr... | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/impl/WikiScannerUtil.java#L51-L54 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_game_ipOnGame_GET | public OvhGameMitigation ip_game_ipOnGame_GET(String ip, String ipOnGame) throws IOException {
String qPath = "/ip/{ip}/game/{ipOnGame}";
StringBuilder sb = path(qPath, ip, ipOnGame);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhGameMitigation.class);
} | java | public OvhGameMitigation ip_game_ipOnGame_GET(String ip, String ipOnGame) throws IOException {
String qPath = "/ip/{ip}/game/{ipOnGame}";
StringBuilder sb = path(qPath, ip, ipOnGame);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhGameMitigation.class);
} | [
"public",
"OvhGameMitigation",
"ip_game_ipOnGame_GET",
"(",
"String",
"ip",
",",
"String",
"ipOnGame",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/game/{ipOnGame}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
",",... | Get this object properties
REST: GET /ip/{ip}/game/{ipOnGame}
@param ip [required]
@param ipOnGame [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L391-L396 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/descriptivestatistics/Ranks.java | Ranks._buildRankArrays | private static void _buildRankArrays(FlatDataList flatDataCollection, AssociativeArray tiesCounter, Map<Object, Double> key2AvgRank) {
for (Object value : flatDataCollection) {
Object count = tiesCounter.get(value);
if (count == null) {
count = 0;
}
tiesCounter.put(value, ((Number) count).intValue() + 1);
}
tiesCounter.overwrite(MapMethods.<Object, Object>sortNumberMapByKeyAscending(tiesCounter.entrySet()));
int itemCounter = 0;
Iterator<Map.Entry<Object, Object>> it = tiesCounter.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Object, Object> entry = it.next();
Object key = entry.getKey();
double count = TypeInference.toDouble(entry.getValue());
if (count <= 1.0) {
it.remove();
}
double avgRank = ((itemCounter + 1) + (itemCounter + count)) / 2.0;
key2AvgRank.put(key, avgRank);
itemCounter += count;
}
} | java | private static void _buildRankArrays(FlatDataList flatDataCollection, AssociativeArray tiesCounter, Map<Object, Double> key2AvgRank) {
for (Object value : flatDataCollection) {
Object count = tiesCounter.get(value);
if (count == null) {
count = 0;
}
tiesCounter.put(value, ((Number) count).intValue() + 1);
}
tiesCounter.overwrite(MapMethods.<Object, Object>sortNumberMapByKeyAscending(tiesCounter.entrySet()));
int itemCounter = 0;
Iterator<Map.Entry<Object, Object>> it = tiesCounter.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Object, Object> entry = it.next();
Object key = entry.getKey();
double count = TypeInference.toDouble(entry.getValue());
if (count <= 1.0) {
it.remove();
}
double avgRank = ((itemCounter + 1) + (itemCounter + count)) / 2.0;
key2AvgRank.put(key, avgRank);
itemCounter += count;
}
} | [
"private",
"static",
"void",
"_buildRankArrays",
"(",
"FlatDataList",
"flatDataCollection",
",",
"AssociativeArray",
"tiesCounter",
",",
"Map",
"<",
"Object",
",",
"Double",
">",
"key2AvgRank",
")",
"{",
"for",
"(",
"Object",
"value",
":",
"flatDataCollection",
")... | Internal method used by getRanksFromValues() to produce the tiesCounter
and key2AvgRank arrays.
@param flatDataCollection
@param tiesCounter
@param key2AvgRank | [
"Internal",
"method",
"used",
"by",
"getRanksFromValues",
"()",
"to",
"produce",
"the",
"tiesCounter",
"and",
"key2AvgRank",
"arrays",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/descriptivestatistics/Ranks.java#L81-L103 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/ExcelUtils.java | ExcelUtils.readExcel2Objects | public <T> List<T> readExcel2Objects(InputStream is, Class<T> clazz, int offsetLine,
int limitLine, int sheetIndex)
throws Excel4JException, IOException, InvalidFormatException {
try (Workbook workbook = WorkbookFactory.create(is)) {
return readExcel2ObjectsHandler(workbook, clazz, offsetLine, limitLine, sheetIndex);
}
} | java | public <T> List<T> readExcel2Objects(InputStream is, Class<T> clazz, int offsetLine,
int limitLine, int sheetIndex)
throws Excel4JException, IOException, InvalidFormatException {
try (Workbook workbook = WorkbookFactory.create(is)) {
return readExcel2ObjectsHandler(workbook, clazz, offsetLine, limitLine, sheetIndex);
}
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"readExcel2Objects",
"(",
"InputStream",
"is",
",",
"Class",
"<",
"T",
">",
"clazz",
",",
"int",
"offsetLine",
",",
"int",
"limitLine",
",",
"int",
"sheetIndex",
")",
"throws",
"Excel4JException",
",",
"IOE... | 读取Excel操作基于注解映射成绑定的java对象
@param is 待导出Excel的数据流
@param clazz 待绑定的类(绑定属性注解{@link com.github.crab2died.annotation.ExcelField})
@param offsetLine Excel表头行(默认是0)
@param limitLine 最大读取行数(默认表尾)
@param sheetIndex Sheet索引(默认0)
@param <T> 绑定的数据类
@return 返回转换为设置绑定的java对象集合
@throws Excel4JException 异常
@throws IOException 异常
@throws InvalidFormatException 异常
@author Crab2Died | [
"读取Excel操作基于注解映射成绑定的java对象"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L150-L157 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/chrono/JapaneseDate.java | JapaneseDate.ofYearDay | static JapaneseDate ofYearDay(JapaneseEra era, int yearOfEra, int dayOfYear) {
Jdk8Methods.requireNonNull(era, "era");
if (yearOfEra < 1) {
throw new DateTimeException("Invalid YearOfEra: " + yearOfEra);
}
LocalDate eraStartDate = era.startDate();
LocalDate eraEndDate = era.endDate();
if (yearOfEra == 1) {
dayOfYear += eraStartDate.getDayOfYear() - 1;
if (dayOfYear > eraStartDate.lengthOfYear()) {
throw new DateTimeException("DayOfYear exceeds maximum allowed in the first year of era " + era);
}
}
int yearOffset = eraStartDate.getYear() - 1;
LocalDate isoDate = LocalDate.ofYearDay(yearOfEra + yearOffset, dayOfYear);
if (isoDate.isBefore(eraStartDate) || isoDate.isAfter(eraEndDate)) {
throw new DateTimeException("Requested date is outside bounds of era " + era);
}
return new JapaneseDate(era, yearOfEra, isoDate);
} | java | static JapaneseDate ofYearDay(JapaneseEra era, int yearOfEra, int dayOfYear) {
Jdk8Methods.requireNonNull(era, "era");
if (yearOfEra < 1) {
throw new DateTimeException("Invalid YearOfEra: " + yearOfEra);
}
LocalDate eraStartDate = era.startDate();
LocalDate eraEndDate = era.endDate();
if (yearOfEra == 1) {
dayOfYear += eraStartDate.getDayOfYear() - 1;
if (dayOfYear > eraStartDate.lengthOfYear()) {
throw new DateTimeException("DayOfYear exceeds maximum allowed in the first year of era " + era);
}
}
int yearOffset = eraStartDate.getYear() - 1;
LocalDate isoDate = LocalDate.ofYearDay(yearOfEra + yearOffset, dayOfYear);
if (isoDate.isBefore(eraStartDate) || isoDate.isAfter(eraEndDate)) {
throw new DateTimeException("Requested date is outside bounds of era " + era);
}
return new JapaneseDate(era, yearOfEra, isoDate);
} | [
"static",
"JapaneseDate",
"ofYearDay",
"(",
"JapaneseEra",
"era",
",",
"int",
"yearOfEra",
",",
"int",
"dayOfYear",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"era",
",",
"\"era\"",
")",
";",
"if",
"(",
"yearOfEra",
"<",
"1",
")",
"{",
"throw",
... | Obtains a {@code JapaneseDate} representing a date in the Japanese calendar
system from the era, year-of-era and day-of-year fields.
<p>
This returns a {@code JapaneseDate} with the specified fields.
The day must be valid for the year, otherwise an exception will be thrown.
The Japanese day-of-year is reset when the era changes.
@param era the Japanese era, not null
@param yearOfEra the Japanese year-of-era
@param dayOfYear the Japanese day-of-year, from 1 to 31
@return the date in Japanese calendar system, not null
@throws DateTimeException if the value of any field is out of range,
or if the day-of-year is invalid for the year | [
"Obtains",
"a",
"{",
"@code",
"JapaneseDate",
"}",
"representing",
"a",
"date",
"in",
"the",
"Japanese",
"calendar",
"system",
"from",
"the",
"era",
"year",
"-",
"of",
"-",
"era",
"and",
"day",
"-",
"of",
"-",
"year",
"fields",
".",
"<p",
">",
"This",
... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/JapaneseDate.java#L213-L232 |
OpenTSDB/opentsdb | src/rollup/RollupConfig.java | RollupConfig.ensureTablesExist | public void ensureTablesExist(final TSDB tsdb) {
final List<Deferred<Object>> deferreds =
new ArrayList<Deferred<Object>>(forward_intervals.size() * 2);
for (RollupInterval interval : forward_intervals.values()) {
deferreds.add(tsdb.getClient()
.ensureTableExists(interval.getTemporalTable()));
deferreds.add(tsdb.getClient()
.ensureTableExists(interval.getGroupbyTable()));
}
try {
Deferred.group(deferreds).joinUninterruptibly();
} catch (DeferredGroupException e) {
throw new RuntimeException(e.getCause());
} catch (InterruptedException e) {
LOG.warn("Interrupted", e);
Thread.currentThread().interrupt();
} catch (Exception e) {
throw new RuntimeException("Unexpected exception", e);
}
} | java | public void ensureTablesExist(final TSDB tsdb) {
final List<Deferred<Object>> deferreds =
new ArrayList<Deferred<Object>>(forward_intervals.size() * 2);
for (RollupInterval interval : forward_intervals.values()) {
deferreds.add(tsdb.getClient()
.ensureTableExists(interval.getTemporalTable()));
deferreds.add(tsdb.getClient()
.ensureTableExists(interval.getGroupbyTable()));
}
try {
Deferred.group(deferreds).joinUninterruptibly();
} catch (DeferredGroupException e) {
throw new RuntimeException(e.getCause());
} catch (InterruptedException e) {
LOG.warn("Interrupted", e);
Thread.currentThread().interrupt();
} catch (Exception e) {
throw new RuntimeException("Unexpected exception", e);
}
} | [
"public",
"void",
"ensureTablesExist",
"(",
"final",
"TSDB",
"tsdb",
")",
"{",
"final",
"List",
"<",
"Deferred",
"<",
"Object",
">",
">",
"deferreds",
"=",
"new",
"ArrayList",
"<",
"Deferred",
"<",
"Object",
">",
">",
"(",
"forward_intervals",
".",
"size",... | Makes sure each of the rollup tables exists
@param tsdb The TSDB to use for fetching the HBase client | [
"Makes",
"sure",
"each",
"of",
"the",
"rollup",
"tables",
"exists"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/rollup/RollupConfig.java#L226-L247 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/hypergraph/depparse/HyperDepParser.java | HyperDepParser.insideOutsideO2AllGraSingleRoot | public static EdgeScores insideOutsideO2AllGraSingleRoot(DependencyScorer scorer, Algebra s) {
return insideOutside02AllGra(scorer, s, true);
} | java | public static EdgeScores insideOutsideO2AllGraSingleRoot(DependencyScorer scorer, Algebra s) {
return insideOutside02AllGra(scorer, s, true);
} | [
"public",
"static",
"EdgeScores",
"insideOutsideO2AllGraSingleRoot",
"(",
"DependencyScorer",
"scorer",
",",
"Algebra",
"s",
")",
"{",
"return",
"insideOutside02AllGra",
"(",
"scorer",
",",
"s",
",",
"true",
")",
";",
"}"
] | Runs inside outside on an all-grandparents hypergraph and returns the edge marginals in the real semiring. | [
"Runs",
"inside",
"outside",
"on",
"an",
"all",
"-",
"grandparents",
"hypergraph",
"and",
"returns",
"the",
"edge",
"marginals",
"in",
"the",
"real",
"semiring",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/hypergraph/depparse/HyperDepParser.java#L146-L148 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java | JobScheduler.getTrigger | private Trigger getTrigger(JobKey jobKey, Properties jobProps) {
// Build a trigger for the job with the given cron-style schedule
return TriggerBuilder.newTrigger()
.withIdentity(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY),
Strings.nullToEmpty(jobProps.getProperty(ConfigurationKeys.JOB_GROUP_KEY)))
.forJob(jobKey)
.withSchedule(CronScheduleBuilder.cronSchedule(jobProps.getProperty(ConfigurationKeys.JOB_SCHEDULE_KEY)))
.build();
} | java | private Trigger getTrigger(JobKey jobKey, Properties jobProps) {
// Build a trigger for the job with the given cron-style schedule
return TriggerBuilder.newTrigger()
.withIdentity(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY),
Strings.nullToEmpty(jobProps.getProperty(ConfigurationKeys.JOB_GROUP_KEY)))
.forJob(jobKey)
.withSchedule(CronScheduleBuilder.cronSchedule(jobProps.getProperty(ConfigurationKeys.JOB_SCHEDULE_KEY)))
.build();
} | [
"private",
"Trigger",
"getTrigger",
"(",
"JobKey",
"jobKey",
",",
"Properties",
"jobProps",
")",
"{",
"// Build a trigger for the job with the given cron-style schedule",
"return",
"TriggerBuilder",
".",
"newTrigger",
"(",
")",
".",
"withIdentity",
"(",
"jobProps",
".",
... | Get a {@link org.quartz.Trigger} from the given job configuration properties. | [
"Get",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java#L572-L580 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.ortho2D | public Matrix4x3d ortho2D(double left, double right, double bottom, double top) {
return ortho2D(left, right, bottom, top, this);
} | java | public Matrix4x3d ortho2D(double left, double right, double bottom, double top) {
return ortho2D(left, right, bottom, top, this);
} | [
"public",
"Matrix4x3d",
"ortho2D",
"(",
"double",
"left",
",",
"double",
"right",
",",
"double",
"bottom",
",",
"double",
"top",
")",
"{",
"return",
"ortho2D",
"(",
"left",
",",
"right",
",",
"bottom",
",",
"top",
",",
"this",
")",
";",
"}"
] | Apply an orthographic projection transformation for a right-handed coordinate system to this matrix.
<p>
This method is equivalent to calling {@link #ortho(double, double, double, double, double, double) ortho()} with
<code>zNear=-1</code> and <code>zFar=+1</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to an orthographic projection without post-multiplying it,
use {@link #setOrtho2D(double, double, double, double) setOrtho2D()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #ortho(double, double, double, double, double, double)
@see #setOrtho2D(double, double, double, double)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@return this | [
"Apply",
"an",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"to",
"this",
"matrix",
".",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
"{",
"@link",
"#ortho",
"(",
"double",
"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L7594-L7596 |
frostwire/frostwire-jlibtorrent | src/main/java/com/frostwire/jlibtorrent/TorrentHandle.java | TorrentHandle.addPiece | public void addPiece(int piece, byte[] data, add_piece_flags_t flags) {
th.add_piece_bytes(piece, Vectors.bytes2byte_vector(data), flags);
} | java | public void addPiece(int piece, byte[] data, add_piece_flags_t flags) {
th.add_piece_bytes(piece, Vectors.bytes2byte_vector(data), flags);
} | [
"public",
"void",
"addPiece",
"(",
"int",
"piece",
",",
"byte",
"[",
"]",
"data",
",",
"add_piece_flags_t",
"flags",
")",
"{",
"th",
".",
"add_piece_bytes",
"(",
"piece",
",",
"Vectors",
".",
"bytes2byte_vector",
"(",
"data",
")",
",",
"flags",
")",
";",... | This function will write {@code data} to the storage as piece {@code piece},
as if it had been downloaded from a peer. {@code data} is expected to
point to a buffer of as many bytes as the size of the specified piece.
The data in the buffer is copied and passed on to the disk IO thread
to be written at a later point.
<p>
By default, data that's already been downloaded is not overwritten by
this buffer. If you trust this data to be correct (and pass the piece
hash check) you may pass the overwrite_existing flag. This will
instruct libtorrent to overwrite any data that may already have been
downloaded with this data.
<p>
Since the data is written asynchronously, you may know that is passed
or failed the hash check by waiting for
{@link com.frostwire.jlibtorrent.alerts.PieceFinishedAlert} or
{@link com.frostwire.jlibtorrent.alerts.HashFailedAlert}.
@param piece the piece index
@param data the piece data
@param flags flags | [
"This",
"function",
"will",
"write",
"{",
"@code",
"data",
"}",
"to",
"the",
"storage",
"as",
"piece",
"{",
"@code",
"piece",
"}",
"as",
"if",
"it",
"had",
"been",
"downloaded",
"from",
"a",
"peer",
".",
"{",
"@code",
"data",
"}",
"is",
"expected",
"... | train | https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/TorrentHandle.java#L89-L91 |
lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/expression/var/VariableImpl.java | VariableImpl.isNamed | private static boolean isNamed(String funcName, Argument[] args) throws TransformerException {
if (ArrayUtil.isEmpty(args)) return false;
boolean named = false;
for (int i = 0; i < args.length; i++) {
if (args[i] instanceof NamedArgument) named = true;
else if (named) throw new TransformerException("invalid argument for function " + funcName + ", you can not mix named and unnamed arguments", args[i].getStart());
}
return named;
} | java | private static boolean isNamed(String funcName, Argument[] args) throws TransformerException {
if (ArrayUtil.isEmpty(args)) return false;
boolean named = false;
for (int i = 0; i < args.length; i++) {
if (args[i] instanceof NamedArgument) named = true;
else if (named) throw new TransformerException("invalid argument for function " + funcName + ", you can not mix named and unnamed arguments", args[i].getStart());
}
return named;
} | [
"private",
"static",
"boolean",
"isNamed",
"(",
"String",
"funcName",
",",
"Argument",
"[",
"]",
"args",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"args",
")",
")",
"return",
"false",
";",
"boolean",
"named",
... | check if the arguments are named arguments or regular arguments, throws a exception when mixed
@param funcName
@param args
@param line
@return
@throws TransformerException | [
"check",
"if",
"the",
"arguments",
"are",
"named",
"arguments",
"or",
"regular",
"arguments",
"throws",
"a",
"exception",
"when",
"mixed"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/expression/var/VariableImpl.java#L793-L802 |
Alluxio/alluxio | integration/fuse/src/main/java/alluxio/fuse/AlluxioFuseUtils.java | AlluxioFuseUtils.getIdInfo | private static long getIdInfo(String option, String username) {
String output;
try {
output = ShellUtils.execCommand("id", option, username).trim();
} catch (IOException e) {
LOG.error("Failed to get id from {} with option {}", username, option);
return -1;
}
return Long.parseLong(output);
} | java | private static long getIdInfo(String option, String username) {
String output;
try {
output = ShellUtils.execCommand("id", option, username).trim();
} catch (IOException e) {
LOG.error("Failed to get id from {} with option {}", username, option);
return -1;
}
return Long.parseLong(output);
} | [
"private",
"static",
"long",
"getIdInfo",
"(",
"String",
"option",
",",
"String",
"username",
")",
"{",
"String",
"output",
";",
"try",
"{",
"output",
"=",
"ShellUtils",
".",
"execCommand",
"(",
"\"id\"",
",",
"option",
",",
"username",
")",
".",
"trim",
... | Runs the "id" command with the given options on the passed username.
@param option option to pass to id (either -u or -g)
@param username the username on which to run the command
@return the uid (-u) or gid (-g) of username | [
"Runs",
"the",
"id",
"command",
"with",
"the",
"given",
"options",
"on",
"the",
"passed",
"username",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/integration/fuse/src/main/java/alluxio/fuse/AlluxioFuseUtils.java#L153-L162 |
apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java | SupervisorManager.possiblyStopAndRemoveSupervisorInternal | private boolean possiblyStopAndRemoveSupervisorInternal(String id, boolean writeTombstone)
{
Pair<Supervisor, SupervisorSpec> pair = supervisors.get(id);
if (pair == null) {
return false;
}
if (writeTombstone) {
metadataSupervisorManager.insert(
id,
new NoopSupervisorSpec(null, pair.rhs.getDataSources())
); // where NoopSupervisorSpec is a tombstone
}
pair.lhs.stop(true);
supervisors.remove(id);
return true;
} | java | private boolean possiblyStopAndRemoveSupervisorInternal(String id, boolean writeTombstone)
{
Pair<Supervisor, SupervisorSpec> pair = supervisors.get(id);
if (pair == null) {
return false;
}
if (writeTombstone) {
metadataSupervisorManager.insert(
id,
new NoopSupervisorSpec(null, pair.rhs.getDataSources())
); // where NoopSupervisorSpec is a tombstone
}
pair.lhs.stop(true);
supervisors.remove(id);
return true;
} | [
"private",
"boolean",
"possiblyStopAndRemoveSupervisorInternal",
"(",
"String",
"id",
",",
"boolean",
"writeTombstone",
")",
"{",
"Pair",
"<",
"Supervisor",
",",
"SupervisorSpec",
">",
"pair",
"=",
"supervisors",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"pa... | Stops a supervisor with a given id and then removes it from the list.
<p/>
Caller should have acquired [lock] before invoking this method to avoid contention with other threads that may be
starting, stopping, suspending and resuming supervisors.
@return true if a supervisor was stopped, false if there was no supervisor with this id | [
"Stops",
"a",
"supervisor",
"with",
"a",
"given",
"id",
"and",
"then",
"removes",
"it",
"from",
"the",
"list",
".",
"<p",
"/",
">",
"Caller",
"should",
"have",
"acquired",
"[",
"lock",
"]",
"before",
"invoking",
"this",
"method",
"to",
"avoid",
"contenti... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java#L235-L252 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java | XMLReaderAdapter.processingInstruction | public void processingInstruction (String target, String data)
throws SAXException
{
if (documentHandler != null)
documentHandler.processingInstruction(target, data);
} | java | public void processingInstruction (String target, String data)
throws SAXException
{
if (documentHandler != null)
documentHandler.processingInstruction(target, data);
} | [
"public",
"void",
"processingInstruction",
"(",
"String",
"target",
",",
"String",
"data",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"documentHandler",
"!=",
"null",
")",
"documentHandler",
".",
"processingInstruction",
"(",
"target",
",",
"data",
")",
";",... | Adapt a SAX2 processing instruction event.
@param target The processing instruction target.
@param data The remainder of the processing instruction
@exception org.xml.sax.SAXException The client may raise a
processing exception.
@see org.xml.sax.ContentHandler#processingInstruction | [
"Adapt",
"a",
"SAX2",
"processing",
"instruction",
"event",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java#L402-L407 |
greenmail-mail-test/greenmail | greenmail-core/src/main/java/com/icegreen/greenmail/imap/ImapResponse.java | ImapResponse.commandComplete | public void commandComplete(ImapCommand command, String responseCode) {
tag();
message(OK);
responseCode(responseCode);
commandName(command);
message("completed.");
end();
} | java | public void commandComplete(ImapCommand command, String responseCode) {
tag();
message(OK);
responseCode(responseCode);
commandName(command);
message("completed.");
end();
} | [
"public",
"void",
"commandComplete",
"(",
"ImapCommand",
"command",
",",
"String",
"responseCode",
")",
"{",
"tag",
"(",
")",
";",
"message",
"(",
"OK",
")",
";",
"responseCode",
"(",
"responseCode",
")",
";",
"commandName",
"(",
"command",
")",
";",
"mess... | Writes a standard tagged OK response on completion of a command,
with a response code (eg READ-WRITE)
Response is writen as:
<pre> a01 OK [responseCode] COMMAND_NAME completed.</pre>
@param command The ImapCommand which was completed.
@param responseCode A string response code to send to the client. | [
"Writes",
"a",
"standard",
"tagged",
"OK",
"response",
"on",
"completion",
"of",
"a",
"command",
"with",
"a",
"response",
"code",
"(",
"eg",
"READ",
"-",
"WRITE",
")",
"Response",
"is",
"writen",
"as",
":",
"<pre",
">",
"a01",
"OK",
"[",
"responseCode",
... | train | https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/imap/ImapResponse.java#L53-L60 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/network/tunnelip_stats.java | tunnelip_stats.get | public static tunnelip_stats get(nitro_service service, String tunnelip) throws Exception{
tunnelip_stats obj = new tunnelip_stats();
obj.set_tunnelip(tunnelip);
tunnelip_stats response = (tunnelip_stats) obj.stat_resource(service);
return response;
} | java | public static tunnelip_stats get(nitro_service service, String tunnelip) throws Exception{
tunnelip_stats obj = new tunnelip_stats();
obj.set_tunnelip(tunnelip);
tunnelip_stats response = (tunnelip_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"tunnelip_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"tunnelip",
")",
"throws",
"Exception",
"{",
"tunnelip_stats",
"obj",
"=",
"new",
"tunnelip_stats",
"(",
")",
";",
"obj",
".",
"set_tunnelip",
"(",
"tunnelip",
")",
";... | Use this API to fetch statistics of tunnelip_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"tunnelip_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/network/tunnelip_stats.java#L209-L214 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.getParticipants | public void getParticipants(@NonNull final String conversationId, @Nullable Callback<ComapiResult<List<Participant>>> callback) {
adapter.adapt(getParticipants(conversationId), callback);
} | java | public void getParticipants(@NonNull final String conversationId, @Nullable Callback<ComapiResult<List<Participant>>> callback) {
adapter.adapt(getParticipants(conversationId), callback);
} | [
"public",
"void",
"getParticipants",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
",",
"@",
"Nullable",
"Callback",
"<",
"ComapiResult",
"<",
"List",
"<",
"Participant",
">",
">",
">",
"callback",
")",
"{",
"adapter",
".",
"adapt",
"(",
"getPart... | Returns observable to add a participant to.
@param conversationId ID of a conversation to add a participant to.
@param callback Callback to deliver new session instance. | [
"Returns",
"observable",
"to",
"add",
"a",
"participant",
"to",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L655-L657 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java | ExpressRouteCircuitsInner.listRoutesTableSummaryAsync | public Observable<ExpressRouteCircuitsRoutesTableSummaryListResultInner> listRoutesTableSummaryAsync(String resourceGroupName, String circuitName, String peeringName, String devicePath) {
return listRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCircuitsRoutesTableSummaryListResultInner>, ExpressRouteCircuitsRoutesTableSummaryListResultInner>() {
@Override
public ExpressRouteCircuitsRoutesTableSummaryListResultInner call(ServiceResponse<ExpressRouteCircuitsRoutesTableSummaryListResultInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCircuitsRoutesTableSummaryListResultInner> listRoutesTableSummaryAsync(String resourceGroupName, String circuitName, String peeringName, String devicePath) {
return listRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCircuitsRoutesTableSummaryListResultInner>, ExpressRouteCircuitsRoutesTableSummaryListResultInner>() {
@Override
public ExpressRouteCircuitsRoutesTableSummaryListResultInner call(ServiceResponse<ExpressRouteCircuitsRoutesTableSummaryListResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCircuitsRoutesTableSummaryListResultInner",
">",
"listRoutesTableSummaryAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"String",
"peeringName",
",",
"String",
"devicePath",
")",
"{",
"return",
"listRo... | Gets the currently advertised routes table summary associated with the express route circuit in a resource group.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param peeringName The name of the peering.
@param devicePath The path of the device.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Gets",
"the",
"currently",
"advertised",
"routes",
"table",
"summary",
"associated",
"with",
"the",
"express",
"route",
"circuit",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L1267-L1274 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java | ConstantsSummaryBuilder.buildPackageHeader | public void buildPackageHeader(XMLNode node, Content summariesTree) {
PackageElement abbrevPkg = configuration.workArounds.getAbbreviatedPackageElement(currentPackage);
if (!printedPackageHeaders.contains(abbrevPkg)) {
writer.addPackageName(currentPackage, summariesTree, first);
printedPackageHeaders.add(abbrevPkg);
}
} | java | public void buildPackageHeader(XMLNode node, Content summariesTree) {
PackageElement abbrevPkg = configuration.workArounds.getAbbreviatedPackageElement(currentPackage);
if (!printedPackageHeaders.contains(abbrevPkg)) {
writer.addPackageName(currentPackage, summariesTree, first);
printedPackageHeaders.add(abbrevPkg);
}
} | [
"public",
"void",
"buildPackageHeader",
"(",
"XMLNode",
"node",
",",
"Content",
"summariesTree",
")",
"{",
"PackageElement",
"abbrevPkg",
"=",
"configuration",
".",
"workArounds",
".",
"getAbbreviatedPackageElement",
"(",
"currentPackage",
")",
";",
"if",
"(",
"!",
... | Build the header for the given package.
@param node the XML element that specifies which components to document
@param summariesTree the tree to which the package header will be added | [
"Build",
"the",
"header",
"for",
"the",
"given",
"package",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java#L205-L211 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/concurrency/InterruptionChecker.java | InterruptionChecker.getCause | public static Throwable getCause(final Throwable throwable) {
// Unwrap possibly-nested ExecutionExceptions to get to root cause
Throwable cause = throwable;
while (cause instanceof ExecutionException) {
cause = cause.getCause();
}
return cause != null ? cause : new ExecutionException("ExecutionException with unknown cause", null);
} | java | public static Throwable getCause(final Throwable throwable) {
// Unwrap possibly-nested ExecutionExceptions to get to root cause
Throwable cause = throwable;
while (cause instanceof ExecutionException) {
cause = cause.getCause();
}
return cause != null ? cause : new ExecutionException("ExecutionException with unknown cause", null);
} | [
"public",
"static",
"Throwable",
"getCause",
"(",
"final",
"Throwable",
"throwable",
")",
"{",
"// Unwrap possibly-nested ExecutionExceptions to get to root cause",
"Throwable",
"cause",
"=",
"throwable",
";",
"while",
"(",
"cause",
"instanceof",
"ExecutionException",
")",
... | Get the cause of an {@link ExecutionException}.
@param throwable
the Throwable
@return the cause | [
"Get",
"the",
"cause",
"of",
"an",
"{",
"@link",
"ExecutionException",
"}",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/concurrency/InterruptionChecker.java#L82-L89 |
landawn/AbacusUtil | src/com/landawn/abacus/util/ExceptionalStream.java | ExceptionalStream.rows | public static <T> ExceptionalStream<T, SQLException> rows(final Class<T> targetClass, final ResultSet resultSet) {
N.checkArgNotNull(targetClass, "targetClass");
N.checkArgNotNull(resultSet, "resultSet");
final Try.BiFunction<ResultSet, List<String>, T, SQLException> recordGetter = new Try.BiFunction<ResultSet, List<String>, T, SQLException>() {
private final BiRecordGetter<T, RuntimeException> biRecordGetter = BiRecordGetter.to(targetClass);
@Override
public T apply(ResultSet resultSet, List<String> columnLabels) throws SQLException {
return biRecordGetter.apply(resultSet, columnLabels);
}
};
return rows(resultSet, recordGetter);
} | java | public static <T> ExceptionalStream<T, SQLException> rows(final Class<T> targetClass, final ResultSet resultSet) {
N.checkArgNotNull(targetClass, "targetClass");
N.checkArgNotNull(resultSet, "resultSet");
final Try.BiFunction<ResultSet, List<String>, T, SQLException> recordGetter = new Try.BiFunction<ResultSet, List<String>, T, SQLException>() {
private final BiRecordGetter<T, RuntimeException> biRecordGetter = BiRecordGetter.to(targetClass);
@Override
public T apply(ResultSet resultSet, List<String> columnLabels) throws SQLException {
return biRecordGetter.apply(resultSet, columnLabels);
}
};
return rows(resultSet, recordGetter);
} | [
"public",
"static",
"<",
"T",
">",
"ExceptionalStream",
"<",
"T",
",",
"SQLException",
">",
"rows",
"(",
"final",
"Class",
"<",
"T",
">",
"targetClass",
",",
"final",
"ResultSet",
"resultSet",
")",
"{",
"N",
".",
"checkArgNotNull",
"(",
"targetClass",
",",... | It's user's responsibility to close the input <code>resultSet</code> after the stream is finished.
@param targetClass Array/List/Map or Entity with getter/setter methods.
@param resultSet
@return | [
"It",
"s",
"user",
"s",
"responsibility",
"to",
"close",
"the",
"input",
"<code",
">",
"resultSet<",
"/",
"code",
">",
"after",
"the",
"stream",
"is",
"finished",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ExceptionalStream.java#L530-L544 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java | ZonedDateTime.plus | @Override
public ZonedDateTime plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
if (unit.isDateBased()) {
return resolveLocal(dateTime.plus(amountToAdd, unit));
} else {
return resolveInstant(dateTime.plus(amountToAdd, unit));
}
}
return unit.addTo(this, amountToAdd);
} | java | @Override
public ZonedDateTime plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
if (unit.isDateBased()) {
return resolveLocal(dateTime.plus(amountToAdd, unit));
} else {
return resolveInstant(dateTime.plus(amountToAdd, unit));
}
}
return unit.addTo(this, amountToAdd);
} | [
"@",
"Override",
"public",
"ZonedDateTime",
"plus",
"(",
"long",
"amountToAdd",
",",
"TemporalUnit",
"unit",
")",
"{",
"if",
"(",
"unit",
"instanceof",
"ChronoUnit",
")",
"{",
"if",
"(",
"unit",
".",
"isDateBased",
"(",
")",
")",
"{",
"return",
"resolveLoc... | Returns a copy of this date-time with the specified amount added.
<p>
This returns a {@code ZonedDateTime}, based on this one, with the amount
in terms of the unit added. If it is not possible to add the amount, because the
unit is not supported or for some other reason, an exception is thrown.
<p>
If the field is a {@link ChronoUnit} then the addition is implemented here.
The zone is not part of the calculation and will be unchanged in the result.
The calculation for date and time units differ.
<p>
Date units operate on the local time-line.
The period is first added to the local date-time, then converted back
to a zoned date-time using the zone ID.
The conversion uses {@link #ofLocal(LocalDateTime, ZoneId, ZoneOffset)}
with the offset before the addition.
<p>
Time units operate on the instant time-line.
The period is first added to the local date-time, then converted back to
a zoned date-time using the zone ID.
The conversion uses {@link #ofInstant(LocalDateTime, ZoneOffset, ZoneId)}
with the offset before the addition.
<p>
If the field is not a {@code ChronoUnit}, then the result of this method
is obtained by invoking {@code TemporalUnit.addTo(Temporal, long)}
passing {@code this} as the argument. In this case, the unit determines
whether and how to perform the addition.
<p>
This instance is immutable and unaffected by this method call.
@param amountToAdd the amount of the unit to add to the result, may be negative
@param unit the unit of the amount to add, not null
@return a {@code ZonedDateTime} based on this date-time with the specified amount added, not null
@throws DateTimeException if the addition cannot be made
@throws UnsupportedTemporalTypeException if the unit is not supported
@throws ArithmeticException if numeric overflow occurs | [
"Returns",
"a",
"copy",
"of",
"this",
"date",
"-",
"time",
"with",
"the",
"specified",
"amount",
"added",
".",
"<p",
">",
"This",
"returns",
"a",
"{",
"@code",
"ZonedDateTime",
"}",
"based",
"on",
"this",
"one",
"with",
"the",
"amount",
"in",
"terms",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java#L1592-L1602 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.removeAttachment | public com.cloudant.client.api.model.Response removeAttachment(Object object, String attachmentName) {
Response couchDbResponse = db.removeAttachment(object, attachmentName);
com.cloudant.client.api.model.Response response = new com.cloudant.client.api.model
.Response(couchDbResponse);
return response;
} | java | public com.cloudant.client.api.model.Response removeAttachment(Object object, String attachmentName) {
Response couchDbResponse = db.removeAttachment(object, attachmentName);
com.cloudant.client.api.model.Response response = new com.cloudant.client.api.model
.Response(couchDbResponse);
return response;
} | [
"public",
"com",
".",
"cloudant",
".",
"client",
".",
"api",
".",
"model",
".",
"Response",
"removeAttachment",
"(",
"Object",
"object",
",",
"String",
"attachmentName",
")",
"{",
"Response",
"couchDbResponse",
"=",
"db",
".",
"removeAttachment",
"(",
"object"... | Removes an attachment from the specified document.
<p>The object must have the correct {@code _id} and {@code _rev} values.</p>
<P>Example usage:</P>
<pre>
{@code
//get a Bar object from the database
Bar bar = db.find(Bar.class, "exampleId");
String attachmentName = "example.jpg";
//now remove the remote Bar attachment
Response response = db.removeAttachment(bar, attachmentName);
}
</pre>
@param object the document to remove as an object
@param attachmentName the attachment name to remove
@return {@link com.cloudant.client.api.model.Response}
@throws NoDocumentException If the document is not found in the database.
@throws DocumentConflictException If a conflict is detected during the removal.
@see <a
href="https://console.bluemix.net/docs/services/Cloudant/api/attachments.html#delete"
target="_blank">Documents - delete</a> | [
"Removes",
"an",
"attachment",
"from",
"the",
"specified",
"document",
".",
"<p",
">",
"The",
"object",
"must",
"have",
"the",
"correct",
"{",
"@code",
"_id",
"}",
"and",
"{",
"@code",
"_rev",
"}",
"values",
".",
"<",
"/",
"p",
">",
"<P",
">",
"Examp... | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L1315-L1320 |
lucee/Lucee | core/src/main/java/lucee/runtime/tag/Lock.java | Lock.setScope | public void setScope(String scope) throws ApplicationException {
scope = scope.toLowerCase().trim();
if (scope.equals("server")) this.scope = SCOPE_SERVER;
else if (scope.equals("application")) this.scope = SCOPE_APPLICATION;
else if (scope.equals("session")) this.scope = SCOPE_SESSION;
else if (scope.equals("request")) this.scope = SCOPE_REQUEST;
else throw new ApplicationException("invalid value [" + scope + "] for attribute [scope] from tag [lock]", "valid values are [server,application,session]");
} | java | public void setScope(String scope) throws ApplicationException {
scope = scope.toLowerCase().trim();
if (scope.equals("server")) this.scope = SCOPE_SERVER;
else if (scope.equals("application")) this.scope = SCOPE_APPLICATION;
else if (scope.equals("session")) this.scope = SCOPE_SESSION;
else if (scope.equals("request")) this.scope = SCOPE_REQUEST;
else throw new ApplicationException("invalid value [" + scope + "] for attribute [scope] from tag [lock]", "valid values are [server,application,session]");
} | [
"public",
"void",
"setScope",
"(",
"String",
"scope",
")",
"throws",
"ApplicationException",
"{",
"scope",
"=",
"scope",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"scope",
".",
"equals",
"(",
"\"server\"",
")",
")",
"this",
"... | set the value scope Specifies the scope as one of the following: Application, Server, or Session.
This attribute is mutually exclusive with the name attribute.
@param scope value to set
@throws ApplicationException | [
"set",
"the",
"value",
"scope",
"Specifies",
"the",
"scope",
"as",
"one",
"of",
"the",
"following",
":",
"Application",
"Server",
"or",
"Session",
".",
"This",
"attribute",
"is",
"mutually",
"exclusive",
"with",
"the",
"name",
"attribute",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Lock.java#L168-L176 |
auth0/Lock.Android | lib/src/main/java/com/auth0/android/lock/views/ViewUtils.java | ViewUtils.getRoundedBackground | static ShapeDrawable getRoundedBackground(@NonNull View view, @ColorInt int color, @Corners int corners) {
int r = view.getResources().getDimensionPixelSize(R.dimen.com_auth0_lock_widget_corner_radius);
float[] outerR = new float[0];
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
boolean languageRTL = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
if (languageRTL) {
//noinspection WrongConstant
corners = -corners;
}
}
switch (corners) {
case ONLY_LEFT:
outerR = new float[]{r, r, 0, 0, 0, 0, r, r};
break;
case ONLY_RIGHT:
outerR = new float[]{0, 0, r, r, r, r, 0, 0};
break;
case ALL:
outerR = new float[]{r, r, r, r, r, r, r, r};
break;
}
RoundRectShape rr = new RoundRectShape(outerR, null, null);
ShapeDrawable drawable = new ShapeDrawable(rr);
drawable.getPaint().setColor(color);
return drawable;
} | java | static ShapeDrawable getRoundedBackground(@NonNull View view, @ColorInt int color, @Corners int corners) {
int r = view.getResources().getDimensionPixelSize(R.dimen.com_auth0_lock_widget_corner_radius);
float[] outerR = new float[0];
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
boolean languageRTL = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
if (languageRTL) {
//noinspection WrongConstant
corners = -corners;
}
}
switch (corners) {
case ONLY_LEFT:
outerR = new float[]{r, r, 0, 0, 0, 0, r, r};
break;
case ONLY_RIGHT:
outerR = new float[]{0, 0, r, r, r, r, 0, 0};
break;
case ALL:
outerR = new float[]{r, r, r, r, r, r, r, r};
break;
}
RoundRectShape rr = new RoundRectShape(outerR, null, null);
ShapeDrawable drawable = new ShapeDrawable(rr);
drawable.getPaint().setColor(color);
return drawable;
} | [
"static",
"ShapeDrawable",
"getRoundedBackground",
"(",
"@",
"NonNull",
"View",
"view",
",",
"@",
"ColorInt",
"int",
"color",
",",
"@",
"Corners",
"int",
"corners",
")",
"{",
"int",
"r",
"=",
"view",
".",
"getResources",
"(",
")",
".",
"getDimensionPixelSize... | Generates a rounded drawable with the given background color and the specified corners.
@param view a valid View context
@param color the color to use as background.
@param corners the rounded corners this drawable will have. Can be one of ONLY_LEFT, ONLY_RIGHT, ALL
@return the rounded drawable. | [
"Generates",
"a",
"rounded",
"drawable",
"with",
"the",
"given",
"background",
"color",
"and",
"the",
"specified",
"corners",
"."
] | train | https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/ViewUtils.java#L87-L113 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_ripe_GET | public OvhRipeInfos ip_ripe_GET(String ip) throws IOException {
String qPath = "/ip/{ip}/ripe";
StringBuilder sb = path(qPath, ip);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRipeInfos.class);
} | java | public OvhRipeInfos ip_ripe_GET(String ip) throws IOException {
String qPath = "/ip/{ip}/ripe";
StringBuilder sb = path(qPath, ip);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRipeInfos.class);
} | [
"public",
"OvhRipeInfos",
"ip_ripe_GET",
"(",
"String",
"ip",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/ripe\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"q... | Get this object properties
REST: GET /ip/{ip}/ripe
@param ip [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L168-L173 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_alerting_id_alert_alertId_GET | public OvhAlertingAlert project_serviceName_alerting_id_alert_alertId_GET(String serviceName, String id, Long alertId) throws IOException {
String qPath = "/cloud/project/{serviceName}/alerting/{id}/alert/{alertId}";
StringBuilder sb = path(qPath, serviceName, id, alertId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAlertingAlert.class);
} | java | public OvhAlertingAlert project_serviceName_alerting_id_alert_alertId_GET(String serviceName, String id, Long alertId) throws IOException {
String qPath = "/cloud/project/{serviceName}/alerting/{id}/alert/{alertId}";
StringBuilder sb = path(qPath, serviceName, id, alertId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAlertingAlert.class);
} | [
"public",
"OvhAlertingAlert",
"project_serviceName_alerting_id_alert_alertId_GET",
"(",
"String",
"serviceName",
",",
"String",
"id",
",",
"Long",
"alertId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/alerting/{id}/alert/{alertId}... | Get this object properties
REST: GET /cloud/project/{serviceName}/alerting/{id}/alert/{alertId}
@param serviceName [required] The project id
@param id [required] Alerting unique UUID
@param alertId [required] Alert id | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2196-L2201 |
cdk/cdk | app/depict/src/main/java/org/openscience/cdk/depict/Abbreviations.java | Abbreviations.matchExact | private IQueryAtomContainer matchExact(IAtomContainer mol) {
final IChemObjectBuilder bldr = mol.getBuilder();
final IQueryAtomContainer qry = new QueryAtomContainer(mol.getBuilder());
final Map<IAtom, IAtom> atmmap = new HashMap<>();
for (IAtom atom : mol.atoms()) {
IAtom qatom = matchExact(mol, atom);
if (qatom != null) {
atmmap.put(atom, qatom);
qry.addAtom(qatom);
}
}
for (IBond bond : mol.bonds()) {
final IAtom beg = atmmap.get(bond.getBegin());
final IAtom end = atmmap.get(bond.getEnd());
// attach bond skipped
if (beg == null || end == null)
continue;
IQueryBond qbond = new QueryBond(beg, end, Expr.Type.TRUE);
qry.addBond(qbond);
}
return qry;
} | java | private IQueryAtomContainer matchExact(IAtomContainer mol) {
final IChemObjectBuilder bldr = mol.getBuilder();
final IQueryAtomContainer qry = new QueryAtomContainer(mol.getBuilder());
final Map<IAtom, IAtom> atmmap = new HashMap<>();
for (IAtom atom : mol.atoms()) {
IAtom qatom = matchExact(mol, atom);
if (qatom != null) {
atmmap.put(atom, qatom);
qry.addAtom(qatom);
}
}
for (IBond bond : mol.bonds()) {
final IAtom beg = atmmap.get(bond.getBegin());
final IAtom end = atmmap.get(bond.getEnd());
// attach bond skipped
if (beg == null || end == null)
continue;
IQueryBond qbond = new QueryBond(beg, end, Expr.Type.TRUE);
qry.addBond(qbond);
}
return qry;
} | [
"private",
"IQueryAtomContainer",
"matchExact",
"(",
"IAtomContainer",
"mol",
")",
"{",
"final",
"IChemObjectBuilder",
"bldr",
"=",
"mol",
".",
"getBuilder",
"(",
")",
";",
"final",
"IQueryAtomContainer",
"qry",
"=",
"new",
"QueryAtomContainer",
"(",
"mol",
".",
... | Internal - create a query atom container that exactly matches the molecule provided.
Similar to {@link org.openscience.cdk.isomorphism.matchers.QueryAtomContainerCreator}
but we can't access SMARTS query classes from that module (cdk-isomorphism).
@param mol molecule
@return query container
@see org.openscience.cdk.isomorphism.matchers.QueryAtomContainerCreator | [
"Internal",
"-",
"create",
"a",
"query",
"atom",
"container",
"that",
"exactly",
"matches",
"the",
"molecule",
"provided",
".",
"Similar",
"to",
"{",
"@link",
"org",
".",
"openscience",
".",
"cdk",
".",
"isomorphism",
".",
"matchers",
".",
"QueryAtomContainerC... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/Abbreviations.java#L729-L755 |
google/auto | common/src/main/java/com/google/auto/common/GeneratedAnnotationSpecs.java | GeneratedAnnotationSpecs.generatedAnnotationSpec | @Deprecated
public static Optional<AnnotationSpec> generatedAnnotationSpec(
Elements elements, Class<?> processorClass) {
return generatedAnnotationSpecBuilder(elements, processorClass)
.map(AnnotationSpec.Builder::build);
} | java | @Deprecated
public static Optional<AnnotationSpec> generatedAnnotationSpec(
Elements elements, Class<?> processorClass) {
return generatedAnnotationSpecBuilder(elements, processorClass)
.map(AnnotationSpec.Builder::build);
} | [
"@",
"Deprecated",
"public",
"static",
"Optional",
"<",
"AnnotationSpec",
">",
"generatedAnnotationSpec",
"(",
"Elements",
"elements",
",",
"Class",
"<",
"?",
">",
"processorClass",
")",
"{",
"return",
"generatedAnnotationSpecBuilder",
"(",
"elements",
",",
"process... | Returns {@code @Generated("processorClass"} if either {@code
javax.annotation.processing.Generated} or {@code javax.annotation.Generated} is {@linkplain
GeneratedAnnotations#generatedAnnotation(Elements) available at compile time}.
@deprecated prefer {@link #generatedAnnotationSpec(Elements, SourceVersion, Class)} | [
"Returns",
"{",
"@code",
"@Generated",
"(",
"processorClass",
"}",
"if",
"either",
"{",
"@code",
"javax",
".",
"annotation",
".",
"processing",
".",
"Generated",
"}",
"or",
"{",
"@code",
"javax",
".",
"annotation",
".",
"Generated",
"}",
"is",
"{",
"@linkp... | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/common/src/main/java/com/google/auto/common/GeneratedAnnotationSpecs.java#L36-L41 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/DoubleArrayList.java | DoubleArrayList.binarySearchFromTo | public int binarySearchFromTo(double key, int from, int to) {
//return cern.colt.Sorting.binarySearchFromTo(this.elements,key,from,to);
return java.util.Arrays.binarySearch(this.elements,key);
} | java | public int binarySearchFromTo(double key, int from, int to) {
//return cern.colt.Sorting.binarySearchFromTo(this.elements,key,from,to);
return java.util.Arrays.binarySearch(this.elements,key);
} | [
"public",
"int",
"binarySearchFromTo",
"(",
"double",
"key",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"//return cern.colt.Sorting.binarySearchFromTo(this.elements,key,from,to);\r",
"return",
"java",
".",
"util",
".",
"Arrays",
".",
"binarySearch",
"(",
"this",
... | Searches the receiver for the specified value using
the binary search algorithm. The receiver must <strong>must</strong> be
sorted (as by the sort method) prior to making this call. If
it is not sorted, the results are undefined: in particular, the call
may enter an infinite loop. If the receiver contains multiple elements
equal to the specified object, there is no guarantee which instance
will be found.
@param key the value to be searched for.
@param from the leftmost search position, inclusive.
@param to the rightmost search position, inclusive.
@return index of the search key, if it is contained in the receiver;
otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>. The <i>insertion
point</i> is defined as the the point at which the value would
be inserted into the receiver: the index of the first
element greater than the key, or <tt>receiver.size()</tt>, if all
elements in the receiver are less than the specified key. Note
that this guarantees that the return value will be >= 0 if
and only if the key is found.
@see cern.colt.Sorting
@see java.util.Arrays | [
"Searches",
"the",
"receiver",
"for",
"the",
"specified",
"value",
"using",
"the",
"binary",
"search",
"algorithm",
".",
"The",
"receiver",
"must",
"<strong",
">",
"must<",
"/",
"strong",
">",
"be",
"sorted",
"(",
"as",
"by",
"the",
"sort",
"method",
")",
... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/DoubleArrayList.java#L105-L108 |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/ValueLineChart.java | ValueLineChart.onSizeChanged | @Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mUsableGraphHeight = (int) (mGraphHeight - mGraphHeightPadding);
onDataChanged();
if(mUseCustomLegend) {
onLegendDataChanged();
}
} | java | @Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mUsableGraphHeight = (int) (mGraphHeight - mGraphHeightPadding);
onDataChanged();
if(mUseCustomLegend) {
onLegendDataChanged();
}
} | [
"@",
"Override",
"protected",
"void",
"onSizeChanged",
"(",
"int",
"w",
",",
"int",
"h",
",",
"int",
"oldw",
",",
"int",
"oldh",
")",
"{",
"super",
".",
"onSizeChanged",
"(",
"w",
",",
"h",
",",
"oldw",
",",
"oldh",
")",
";",
"mUsableGraphHeight",
"=... | This is called during layout when the size of this view has changed. If
you were just added to the view hierarchy, you're called with the old
values of 0.
@param w Current width of this view.
@param h Current height of this view.
@param oldw Old width of this view.
@param oldh Old height of this view. | [
"This",
"is",
"called",
"during",
"layout",
"when",
"the",
"size",
"of",
"this",
"view",
"has",
"changed",
".",
"If",
"you",
"were",
"just",
"added",
"to",
"the",
"view",
"hierarchy",
"you",
"re",
"called",
"with",
"the",
"old",
"values",
"of",
"0",
".... | train | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/charts/ValueLineChart.java#L604-L614 |
eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleSelfLink | private void handleSelfLink(EntityBuilder builder, String resolvedUri) {
if (StringUtils.isBlank(resolvedUri)) {
return;
}
Link link = LinkBuilder.newInstance().setRelationship(Link.RELATIONSHIP_SELF).setHref(resolvedUri).build();
builder.addLink(link);
} | java | private void handleSelfLink(EntityBuilder builder, String resolvedUri) {
if (StringUtils.isBlank(resolvedUri)) {
return;
}
Link link = LinkBuilder.newInstance().setRelationship(Link.RELATIONSHIP_SELF).setHref(resolvedUri).build();
builder.addLink(link);
} | [
"private",
"void",
"handleSelfLink",
"(",
"EntityBuilder",
"builder",
",",
"String",
"resolvedUri",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"resolvedUri",
")",
")",
"{",
"return",
";",
"}",
"Link",
"link",
"=",
"LinkBuilder",
".",
"newInstan... | Add the self link to the entity.
@param builder assumed not <code>null</code>.
@param resolvedUri the token resolved uri. Assumed not blank. | [
"Add",
"the",
"self",
"link",
"to",
"the",
"entity",
"."
] | train | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L579-L585 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSetSpanner.java | UnicodeSetSpanner.countIn | public int countIn(CharSequence sequence, CountMethod countMethod, SpanCondition spanCondition) {
int count = 0;
int start = 0;
SpanCondition skipSpan = spanCondition == SpanCondition.NOT_CONTAINED ? SpanCondition.SIMPLE
: SpanCondition.NOT_CONTAINED;
final int length = sequence.length();
OutputInt spanCount = null;
while (start != length) {
int endOfSpan = unicodeSet.span(sequence, start, skipSpan);
if (endOfSpan == length) {
break;
}
if (countMethod == CountMethod.WHOLE_SPAN) {
start = unicodeSet.span(sequence, endOfSpan, spanCondition);
count += 1;
} else {
if (spanCount == null) {
spanCount = new OutputInt();
}
start = unicodeSet.spanAndCount(sequence, endOfSpan, spanCondition, spanCount);
count += spanCount.value;
}
}
return count;
} | java | public int countIn(CharSequence sequence, CountMethod countMethod, SpanCondition spanCondition) {
int count = 0;
int start = 0;
SpanCondition skipSpan = spanCondition == SpanCondition.NOT_CONTAINED ? SpanCondition.SIMPLE
: SpanCondition.NOT_CONTAINED;
final int length = sequence.length();
OutputInt spanCount = null;
while (start != length) {
int endOfSpan = unicodeSet.span(sequence, start, skipSpan);
if (endOfSpan == length) {
break;
}
if (countMethod == CountMethod.WHOLE_SPAN) {
start = unicodeSet.span(sequence, endOfSpan, spanCondition);
count += 1;
} else {
if (spanCount == null) {
spanCount = new OutputInt();
}
start = unicodeSet.spanAndCount(sequence, endOfSpan, spanCondition, spanCount);
count += spanCount.value;
}
}
return count;
} | [
"public",
"int",
"countIn",
"(",
"CharSequence",
"sequence",
",",
"CountMethod",
"countMethod",
",",
"SpanCondition",
"spanCondition",
")",
"{",
"int",
"count",
"=",
"0",
";",
"int",
"start",
"=",
"0",
";",
"SpanCondition",
"skipSpan",
"=",
"spanCondition",
"=... | Returns the number of matching characters found in a character sequence.
The code alternates spans; see the class doc for {@link UnicodeSetSpanner} for a note about boundary conditions.
@param sequence
the sequence to count characters in
@param countMethod
whether to treat an entire span as a match, or individual elements as matches
@param spanCondition
the spanCondition to use. SIMPLE or CONTAINED means only count the elements in the span;
NOT_CONTAINED is the reverse.
<br><b>WARNING: </b> when a UnicodeSet contains strings, there may be unexpected behavior in edge cases.
@return the count. Zero if there are none. | [
"Returns",
"the",
"number",
"of",
"matching",
"characters",
"found",
"in",
"a",
"character",
"sequence",
".",
"The",
"code",
"alternates",
"spans",
";",
"see",
"the",
"class",
"doc",
"for",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSetSpanner.java#L148-L172 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.moveFromLocalFile | public void moveFromLocalFile(Path src, Path dst)
throws IOException {
copyFromLocalFile(true, true, false, src, dst);
} | java | public void moveFromLocalFile(Path src, Path dst)
throws IOException {
copyFromLocalFile(true, true, false, src, dst);
} | [
"public",
"void",
"moveFromLocalFile",
"(",
"Path",
"src",
",",
"Path",
"dst",
")",
"throws",
"IOException",
"{",
"copyFromLocalFile",
"(",
"true",
",",
"true",
",",
"false",
",",
"src",
",",
"dst",
")",
";",
"}"
] | The src file is on the local disk. Add it to FS at
the given dst name, removing the source afterwards. | [
"The",
"src",
"file",
"is",
"on",
"the",
"local",
"disk",
".",
"Add",
"it",
"to",
"FS",
"at",
"the",
"given",
"dst",
"name",
"removing",
"the",
"source",
"afterwards",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1641-L1644 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.