repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
hawtio/hawtio | hawtio-log/src/main/java/io/hawt/log/support/Objects.java | Objects.compare | @SuppressWarnings("unchecked")
public static int compare(Object a, Object b) {
if (a == b) {
return 0;
}
if (a == null) {
return -1;
}
if (b == null) {
return 1;
}
if (a instanceof Comparable) {
Comparable comparable = (Comparable)a;
return comparable.compareTo(b);
}
int answer = a.getClass().getName().compareTo(b.getClass().getName());
if (answer == 0) {
answer = a.hashCode() - b.hashCode();
}
return answer;
} | java | @SuppressWarnings("unchecked")
public static int compare(Object a, Object b) {
if (a == b) {
return 0;
}
if (a == null) {
return -1;
}
if (b == null) {
return 1;
}
if (a instanceof Comparable) {
Comparable comparable = (Comparable)a;
return comparable.compareTo(b);
}
int answer = a.getClass().getName().compareTo(b.getClass().getName());
if (answer == 0) {
answer = a.hashCode() - b.hashCode();
}
return answer;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"int",
"compare",
"(",
"Object",
"a",
",",
"Object",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"b",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"ret... | A helper method for performing an ordered comparison on the objects
handling nulls and objects which do not handle sorting gracefully
@param a the first object
@param b the second object | [
"A",
"helper",
"method",
"for",
"performing",
"an",
"ordered",
"comparison",
"on",
"the",
"objects",
"handling",
"nulls",
"and",
"objects",
"which",
"do",
"not",
"handle",
"sorting",
"gracefully"
] | train | https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/hawtio-log/src/main/java/io/hawt/log/support/Objects.java#L26-L46 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.getFieldValue | @SuppressWarnings("unchecked")
public static <T> T getFieldValue(Object object, String fieldName)
{
if(object instanceof Class<?>) {
return getFieldValue(null, (Class<?>)object, fieldName, null, false);
}
Class<?> clazz = object.getClass();
try {
Field f = clazz.getDeclaredField(fieldName);
f.setAccessible(true);
return (T)f.get(Modifier.isStatic(f.getModifiers()) ? null : object);
}
catch(java.lang.NoSuchFieldException e) {
throw new NoSuchBeingException("Missing field |%s| from |%s|.", fieldName, clazz);
}
catch(IllegalAccessException e) {
throw new BugError(e);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T getFieldValue(Object object, String fieldName)
{
if(object instanceof Class<?>) {
return getFieldValue(null, (Class<?>)object, fieldName, null, false);
}
Class<?> clazz = object.getClass();
try {
Field f = clazz.getDeclaredField(fieldName);
f.setAccessible(true);
return (T)f.get(Modifier.isStatic(f.getModifiers()) ? null : object);
}
catch(java.lang.NoSuchFieldException e) {
throw new NoSuchBeingException("Missing field |%s| from |%s|.", fieldName, clazz);
}
catch(IllegalAccessException e) {
throw new BugError(e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getFieldValue",
"(",
"Object",
"object",
",",
"String",
"fieldName",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"return",
"ge... | Get instance or class field value. Retrieve named field value from given instance; if <code>object</code> argument
is a {@link Class} retrieve class static field.
@param object instance or class to retrieve field value from,
@param fieldName field name.
@param <T> field value type.
@return instance or class field value.
@throws NullPointerException if object argument is null.
@throws NoSuchBeingException if field is missing.
@throws BugError if <code>object</code> is a class and field is not static or if <code>object</code> is an instance
and field is static. | [
"Get",
"instance",
"or",
"class",
"field",
"value",
".",
"Retrieve",
"named",
"field",
"value",
"from",
"given",
"instance",
";",
"if",
"<code",
">",
"object<",
"/",
"code",
">",
"argument",
"is",
"a",
"{",
"@link",
"Class",
"}",
"retrieve",
"class",
"st... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L711-L730 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java | WSKeyStore.getKeyStore | public KeyStore getKeyStore(boolean reinitialize, boolean createIfNotPresent) throws Exception {
if (myKeyStore == null || reinitialize) {
myKeyStore = do_getKeyStore(reinitialize, createIfNotPresent);
}
return myKeyStore;
} | java | public KeyStore getKeyStore(boolean reinitialize, boolean createIfNotPresent) throws Exception {
if (myKeyStore == null || reinitialize) {
myKeyStore = do_getKeyStore(reinitialize, createIfNotPresent);
}
return myKeyStore;
} | [
"public",
"KeyStore",
"getKeyStore",
"(",
"boolean",
"reinitialize",
",",
"boolean",
"createIfNotPresent",
")",
"throws",
"Exception",
"{",
"if",
"(",
"myKeyStore",
"==",
"null",
"||",
"reinitialize",
")",
"{",
"myKeyStore",
"=",
"do_getKeyStore",
"(",
"reinitiali... | Get the key store wrapped by this object.
@param reinitialize
@param createIfNotPresent
@return KeyStore
@throws Exception | [
"Get",
"the",
"key",
"store",
"wrapped",
"by",
"this",
"object",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java#L909-L915 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/IoFilterManager.java | IoFilterManager.installIoFilter_Task | public Task installIoFilter_Task(String vibUrl, ComputeResource compRes) throws AlreadyExists, InvalidArgument, RuntimeFault, RemoteException {
return new Task(getServerConnection(), getVimService().installIoFilter_Task(getMOR(), vibUrl, compRes.getMOR()));
} | java | public Task installIoFilter_Task(String vibUrl, ComputeResource compRes) throws AlreadyExists, InvalidArgument, RuntimeFault, RemoteException {
return new Task(getServerConnection(), getVimService().installIoFilter_Task(getMOR(), vibUrl, compRes.getMOR()));
} | [
"public",
"Task",
"installIoFilter_Task",
"(",
"String",
"vibUrl",
",",
"ComputeResource",
"compRes",
")",
"throws",
"AlreadyExists",
",",
"InvalidArgument",
",",
"RuntimeFault",
",",
"RemoteException",
"{",
"return",
"new",
"Task",
"(",
"getServerConnection",
"(",
... | Install an IO Filter on a compute resource. IO Filters can only be installed on a cluster.
@param vibUrl
- The URL that points to the IO Filter VIB package.
@param compRes
- The compute resource to install the IO Filter on. "compRes" must be a cluster.
@return - This method returns a Task object with which to monitor the operation. The task is set to success if
the filter is installed on all the hosts in the compute resource successfully. If the task fails, first
check error to see the error. If the error indicates that installation has failed on the hosts, use
QueryIoFilterIssues to get the detailed errors occured during installation on each host. The dynamic
privilege check ensures that the user must have Host.Config.Patch privilege for all the hosts in the
compute resource.
@throws AlreadyExists
- Thrown if another VIB with the same name and vendor has been installed.
@throws InvalidArgument
- Thrown if "compRes" is a standalone host.
@throws RuntimeFault
- Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example,
a communication error.
@throws RemoteException | [
"Install",
"an",
"IO",
"Filter",
"on",
"a",
"compute",
"resource",
".",
"IO",
"Filters",
"can",
"only",
"be",
"installed",
"on",
"a",
"cluster",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/IoFilterManager.java#L69-L71 |
alkacon/opencms-core | src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBCmsUsers.java | CmsUpdateDBCmsUsers.writeAdditionalUserInfo | protected void writeAdditionalUserInfo(CmsSetupDb dbCon, String id, Map<String, Object> additionalInfo) {
Iterator<Map.Entry<String, Object>> entries = additionalInfo.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, Object> entry = entries.next();
if ((entry.getKey() != null) && (entry.getValue() != null)) {
// Write the additional user information to the database
writeUserInfo(dbCon, id, entry.getKey(), entry.getValue());
}
}
} | java | protected void writeAdditionalUserInfo(CmsSetupDb dbCon, String id, Map<String, Object> additionalInfo) {
Iterator<Map.Entry<String, Object>> entries = additionalInfo.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, Object> entry = entries.next();
if ((entry.getKey() != null) && (entry.getValue() != null)) {
// Write the additional user information to the database
writeUserInfo(dbCon, id, entry.getKey(), entry.getValue());
}
}
} | [
"protected",
"void",
"writeAdditionalUserInfo",
"(",
"CmsSetupDb",
"dbCon",
",",
"String",
"id",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"additionalInfo",
")",
"{",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
">",
"entri... | Writes the additional user infos to the database.<p>
@param dbCon the db connection interface
@param id the user id
@param additionalInfo the additional info of the user | [
"Writes",
"the",
"additional",
"user",
"infos",
"to",
"the",
"database",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBCmsUsers.java#L349-L359 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.escapeUriQueryParam | public static String escapeUriQueryParam(final String text, final String encoding) {
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
return UriEscapeUtil.escape(text, UriEscapeUtil.UriEscapeType.QUERY_PARAM, encoding);
} | java | public static String escapeUriQueryParam(final String text, final String encoding) {
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
return UriEscapeUtil.escape(text, UriEscapeUtil.UriEscapeType.QUERY_PARAM, encoding);
} | [
"public",
"static",
"String",
"escapeUriQueryParam",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"encoding",
")",
"{",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'encoding' cannot be null\"... | <p>
Perform am URI query parameter (name or value) <strong>escape</strong> operation
on a <tt>String</tt> input.
</p>
<p>
The following are the only allowed chars in an URI query parameter (will not be escaped):
</p>
<ul>
<li><tt>A-Z a-z 0-9</tt></li>
<li><tt>- . _ ~</tt></li>
<li><tt>! $ ' ( ) * , ;</tt></li>
<li><tt>: @</tt></li>
<li><tt>/ ?</tt></li>
</ul>
<p>
All other chars will be escaped by converting them to the sequence of bytes that
represents them in the specified <em>encoding</em> and then representing each byte
in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be escaped.
@param encoding the encoding to be used for escaping.
@return The escaped result <tt>String</tt>. As a memory-performance improvement, will return the exact
same object as the <tt>text</tt> input argument if no escaping modifications were required (and
no additional <tt>String</tt> objects will be created during processing). Will
return <tt>null</tt> if input is <tt>null</tt>. | [
"<p",
">",
"Perform",
"am",
"URI",
"query",
"parameter",
"(",
"name",
"or",
"value",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">",
"... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L327-L332 |
mcaserta/spring-crypto-utils | src/main/java/com/springcryptoutils/core/cipher/symmetric/CiphererWithStaticKeyImpl.java | CiphererWithStaticKeyImpl.setInitializationVector | public void setInitializationVector(String initializationVector) {
try {
this.initializationVectorSpec = new IvParameterSpec(Base64.decodeBase64(initializationVector.getBytes("UTF-8")));
} catch (UnsupportedEncodingException e) {
throw new SymmetricEncryptionException("UTF-8 is an unsupported encoding on this platform", e);
}
} | java | public void setInitializationVector(String initializationVector) {
try {
this.initializationVectorSpec = new IvParameterSpec(Base64.decodeBase64(initializationVector.getBytes("UTF-8")));
} catch (UnsupportedEncodingException e) {
throw new SymmetricEncryptionException("UTF-8 is an unsupported encoding on this platform", e);
}
} | [
"public",
"void",
"setInitializationVector",
"(",
"String",
"initializationVector",
")",
"{",
"try",
"{",
"this",
".",
"initializationVectorSpec",
"=",
"new",
"IvParameterSpec",
"(",
"Base64",
".",
"decodeBase64",
"(",
"initializationVector",
".",
"getBytes",
"(",
"... | A base64 encoded representation of the raw byte array containing the
initialization vector.
@param initializationVector the initialization vector
@throws SymmetricEncryptionException on runtime errors | [
"A",
"base64",
"encoded",
"representation",
"of",
"the",
"raw",
"byte",
"array",
"containing",
"the",
"initialization",
"vector",
"."
] | train | https://github.com/mcaserta/spring-crypto-utils/blob/1dbf6211542fb1e3f9297941d691e7e89cc72c46/src/main/java/com/springcryptoutils/core/cipher/symmetric/CiphererWithStaticKeyImpl.java#L90-L96 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/KeyRange.java | KeyRange.openOpen | public static KeyRange openOpen(Key start, Key end) {
return new KeyRange(checkNotNull(start), Endpoint.OPEN, checkNotNull(end), Endpoint.OPEN);
} | java | public static KeyRange openOpen(Key start, Key end) {
return new KeyRange(checkNotNull(start), Endpoint.OPEN, checkNotNull(end), Endpoint.OPEN);
} | [
"public",
"static",
"KeyRange",
"openOpen",
"(",
"Key",
"start",
",",
"Key",
"end",
")",
"{",
"return",
"new",
"KeyRange",
"(",
"checkNotNull",
"(",
"start",
")",
",",
"Endpoint",
".",
"OPEN",
",",
"checkNotNull",
"(",
"end",
")",
",",
"Endpoint",
".",
... | Returns a key range from {@code start} exclusive to {@code end} exclusive. | [
"Returns",
"a",
"key",
"range",
"from",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/KeyRange.java#L162-L164 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/values/JcCollection.java | JcCollection.get | @SuppressWarnings("unchecked")
public T get(int index) {
T ret;
if (JcRelation.class.equals(type)) {
ret = (T) new JcRelation(null, this, OPERATOR.Collection.GET);
} else if (JcNode.class.equals(type)) {
ret = (T) new JcNode(null, this, OPERATOR.Collection.GET);
} else {
ret = (T) new JcValue(null, this, OPERATOR.Collection.GET);
}
ret.setHint(ValueAccess.hintKey_opValue, index);
QueryRecorder.recordInvocationConditional(this, "get", ret, QueryRecorder.literal(index));
return ret;
} | java | @SuppressWarnings("unchecked")
public T get(int index) {
T ret;
if (JcRelation.class.equals(type)) {
ret = (T) new JcRelation(null, this, OPERATOR.Collection.GET);
} else if (JcNode.class.equals(type)) {
ret = (T) new JcNode(null, this, OPERATOR.Collection.GET);
} else {
ret = (T) new JcValue(null, this, OPERATOR.Collection.GET);
}
ret.setHint(ValueAccess.hintKey_opValue, index);
QueryRecorder.recordInvocationConditional(this, "get", ret, QueryRecorder.literal(index));
return ret;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"get",
"(",
"int",
"index",
")",
"{",
"T",
"ret",
";",
"if",
"(",
"JcRelation",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"{",
"ret",
"=",
"(",
"T",
")",
"new",
"JcRelatio... | <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>access the element of the collection at the given index, return a <b>JcProperty</b></i></div>
<br/> | [
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"24px",
";",
"color",
":",
"red",
">",
"<b",
">",
"<i",
">",
"<u",
">",
"JCYPHER<",
"/",
"u",
">",
"<",
"/",
"i",
">",
"<",
"/",
"b",
">",
"<",
"/",
"div",
">",
"<div",
... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcCollection.java#L111-L124 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.listRecipients | public Recipients listRecipients(String accountId, String envelopeId) throws ApiException {
return listRecipients(accountId, envelopeId, null);
} | java | public Recipients listRecipients(String accountId, String envelopeId) throws ApiException {
return listRecipients(accountId, envelopeId, null);
} | [
"public",
"Recipients",
"listRecipients",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
")",
"throws",
"ApiException",
"{",
"return",
"listRecipients",
"(",
"accountId",
",",
"envelopeId",
",",
"null",
")",
";",
"}"
] | Gets the status of recipients for an envelope.
Retrieves the status of all recipients in a single envelope and identifies the current recipient in the routing list. The `currentRoutingOrder` property of the response contains the `routingOrder` value of the current recipient indicating that the envelope has been sent to the recipient, but the recipient has not completed their actions.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@return Recipients | [
"Gets",
"the",
"status",
"of",
"recipients",
"for",
"an",
"envelope",
".",
"Retrieves",
"the",
"status",
"of",
"all",
"recipients",
"in",
"a",
"single",
"envelope",
"and",
"identifies",
"the",
"current",
"recipient",
"in",
"the",
"routing",
"list",
".",
"The... | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L3736-L3738 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java | CsvBeanReader.readIntoBean | private <T> T readIntoBean(final T bean, final String[] nameMapping, final CellProcessor[] processors)
throws IOException {
if( readRow() ) {
if( nameMapping.length != length() ) {
throw new IllegalArgumentException(String.format(
"the nameMapping array and the number of columns read "
+ "should be the same size (nameMapping length = %d, columns = %d)", nameMapping.length,
length()));
}
if( processors == null ) {
processedColumns.clear();
processedColumns.addAll(getColumns());
} else {
executeProcessors(processedColumns, processors);
}
return populateBean(bean, nameMapping);
}
return null; // EOF
} | java | private <T> T readIntoBean(final T bean, final String[] nameMapping, final CellProcessor[] processors)
throws IOException {
if( readRow() ) {
if( nameMapping.length != length() ) {
throw new IllegalArgumentException(String.format(
"the nameMapping array and the number of columns read "
+ "should be the same size (nameMapping length = %d, columns = %d)", nameMapping.length,
length()));
}
if( processors == null ) {
processedColumns.clear();
processedColumns.addAll(getColumns());
} else {
executeProcessors(processedColumns, processors);
}
return populateBean(bean, nameMapping);
}
return null; // EOF
} | [
"private",
"<",
"T",
">",
"T",
"readIntoBean",
"(",
"final",
"T",
"bean",
",",
"final",
"String",
"[",
"]",
"nameMapping",
",",
"final",
"CellProcessor",
"[",
"]",
"processors",
")",
"throws",
"IOException",
"{",
"if",
"(",
"readRow",
"(",
")",
")",
"{... | Reads a row of a CSV file and populates the bean, using the supplied name mapping to map column values to the
appropriate fields. If processors are supplied then they are used, otherwise the raw String values will be used.
@param bean
the bean to populate
@param nameMapping
the name mapping array
@param processors
the (optional) cell processors
@return the populated bean, or null if EOF was reached
@throws IllegalArgumentException
if nameMapping.length != number of CSV columns read
@throws IOException
if an I/O error occurred
@throws NullPointerException
if bean or nameMapping are null
@throws SuperCsvConstraintViolationException
if a CellProcessor constraint failed
@throws SuperCsvException
if there was a general exception while reading/processing
@throws SuperCsvReflectionException
if there was an reflection exception while mapping the values to the bean | [
"Reads",
"a",
"row",
"of",
"a",
"CSV",
"file",
"and",
"populates",
"the",
"bean",
"using",
"the",
"supplied",
"name",
"mapping",
"to",
"map",
"column",
"values",
"to",
"the",
"appropriate",
"fields",
".",
"If",
"processors",
"are",
"supplied",
"then",
"the... | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java#L259-L281 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_coupon_DELETE | public void cart_cartId_coupon_DELETE(String cartId, String coupon) throws IOException {
String qPath = "/order/cart/{cartId}/coupon";
StringBuilder sb = path(qPath, cartId);
query(sb, "coupon", coupon);
execN(qPath, "DELETE", sb.toString(), null);
} | java | public void cart_cartId_coupon_DELETE(String cartId, String coupon) throws IOException {
String qPath = "/order/cart/{cartId}/coupon";
StringBuilder sb = path(qPath, cartId);
query(sb, "coupon", coupon);
execN(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"cart_cartId_coupon_DELETE",
"(",
"String",
"cartId",
",",
"String",
"coupon",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/coupon\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"cartId",
")"... | Delete a coupon from cart
REST: DELETE /order/cart/{cartId}/coupon
@param cartId [required] Cart identifier
@param coupon [required] Coupon identifier | [
"Delete",
"a",
"coupon",
"from",
"cart"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L10018-L10023 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java | GeometryDeserializer.asPoint | private Point asPoint(List coords, CrsId crsId) throws IOException {
if (coords != null && coords.size() >= 2) {
ArrayList<List> coordinates = new ArrayList<List>();
coordinates.add(coords);
return new Point(getPointSequence(coordinates, crsId));
} else {
throw new IOException("A point must has exactly one coordinate (an x, a y and possibly a z value). Additional numbers in the coordinate are permitted but ignored.");
}
} | java | private Point asPoint(List coords, CrsId crsId) throws IOException {
if (coords != null && coords.size() >= 2) {
ArrayList<List> coordinates = new ArrayList<List>();
coordinates.add(coords);
return new Point(getPointSequence(coordinates, crsId));
} else {
throw new IOException("A point must has exactly one coordinate (an x, a y and possibly a z value). Additional numbers in the coordinate are permitted but ignored.");
}
} | [
"private",
"Point",
"asPoint",
"(",
"List",
"coords",
",",
"CrsId",
"crsId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"coords",
"!=",
"null",
"&&",
"coords",
".",
"size",
"(",
")",
">=",
"2",
")",
"{",
"ArrayList",
"<",
"List",
">",
"coordinates",... | Parses the JSON as a point geometry.
@param coords the coordinates (a list with an x and y value)
@param crsId
@return An instance of point
@throws IOException if the given json does not correspond to a point or can not be parsed to a point. | [
"Parses",
"the",
"JSON",
"as",
"a",
"point",
"geometry",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java#L283-L291 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/TextBuilder.java | TextBuilder.styledLink | public TextBuilder styledLink(final String text, final TextStyle ts, final File file) {
this.curParagraphBuilder.styledLink(text, ts, file);
return this;
} | java | public TextBuilder styledLink(final String text, final TextStyle ts, final File file) {
this.curParagraphBuilder.styledLink(text, ts, file);
return this;
} | [
"public",
"TextBuilder",
"styledLink",
"(",
"final",
"String",
"text",
",",
"final",
"TextStyle",
"ts",
",",
"final",
"File",
"file",
")",
"{",
"this",
".",
"curParagraphBuilder",
".",
"styledLink",
"(",
"text",
",",
"ts",
",",
"file",
")",
";",
"return",
... | Create a styled link in the current paragraph.
@param text the text
@param ts the style
@param file the destination
@return this for fluent style | [
"Create",
"a",
"styled",
"link",
"in",
"the",
"current",
"paragraph",
"."
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TextBuilder.java#L153-L156 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java | ZooKeeperMasterModel.getJob | @Override
public Job getJob(final JobId id) {
log.debug("getting job: {}", id);
final ZooKeeperClient client = provider.get("getJobId");
return getJob(client, id);
} | java | @Override
public Job getJob(final JobId id) {
log.debug("getting job: {}", id);
final ZooKeeperClient client = provider.get("getJobId");
return getJob(client, id);
} | [
"@",
"Override",
"public",
"Job",
"getJob",
"(",
"final",
"JobId",
"id",
")",
"{",
"log",
".",
"debug",
"(",
"\"getting job: {}\"",
",",
"id",
")",
";",
"final",
"ZooKeeperClient",
"client",
"=",
"provider",
".",
"get",
"(",
"\"getJobId\"",
")",
";",
"re... | Returns the job configuration for the job specified by {@code id} as a
{@link Job} object. A return value of null indicates the job doesn't exist. | [
"Returns",
"the",
"job",
"configuration",
"for",
"the",
"job",
"specified",
"by",
"{"
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1334-L1339 |
fuzzylite/jfuzzylite | jfuzzylite/src/main/java/com/fuzzylite/imex/FldExporter.java | FldExporter.toFile | public void toFile(File file, Engine engine, int values, ScopeOfValues scope) throws IOException {
toFile(file, engine, values, scope, engine.getInputVariables());
} | java | public void toFile(File file, Engine engine, int values, ScopeOfValues scope) throws IOException {
toFile(file, engine, values, scope, engine.getInputVariables());
} | [
"public",
"void",
"toFile",
"(",
"File",
"file",
",",
"Engine",
"engine",
",",
"int",
"values",
",",
"ScopeOfValues",
"scope",
")",
"throws",
"IOException",
"{",
"toFile",
"(",
"file",
",",
"engine",
",",
"values",
",",
"scope",
",",
"engine",
".",
"getI... | Saves the engine as a FuzzyLite Dataset into the specified file
@param file is file to save the dataset into
@param engine is the engine to export
@param values is the number of values to export
@param scope indicates the scope of the values
@throws IOException if any error occurs upon writing to the file | [
"Saves",
"the",
"engine",
"as",
"a",
"FuzzyLite",
"Dataset",
"into",
"the",
"specified",
"file"
] | train | https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/imex/FldExporter.java#L296-L298 |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/OperationDialog.java | OperationDialog.setValue | public void setValue(String propName, Object value) {
for (RequestProp prop : props) {
if (prop.getName().equals(propName)) {
JComponent valComp = prop.getValueComponent();
if (valComp instanceof JTextComponent) {
((JTextComponent)valComp).setText(value.toString());
}
if (valComp instanceof AbstractButton) {
((AbstractButton)valComp).setSelected((Boolean)value);
}
if (valComp instanceof JComboBox) {
((JComboBox)valComp).setSelectedItem(value);
}
return;
}
}
} | java | public void setValue(String propName, Object value) {
for (RequestProp prop : props) {
if (prop.getName().equals(propName)) {
JComponent valComp = prop.getValueComponent();
if (valComp instanceof JTextComponent) {
((JTextComponent)valComp).setText(value.toString());
}
if (valComp instanceof AbstractButton) {
((AbstractButton)valComp).setSelected((Boolean)value);
}
if (valComp instanceof JComboBox) {
((JComboBox)valComp).setSelectedItem(value);
}
return;
}
}
} | [
"public",
"void",
"setValue",
"(",
"String",
"propName",
",",
"Object",
"value",
")",
"{",
"for",
"(",
"RequestProp",
"prop",
":",
"props",
")",
"{",
"if",
"(",
"prop",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"propName",
")",
")",
"{",
"JCompon... | Set the value of the underlying component. Note that this will
not work for ListEditor components. Also, note that for a JComboBox,
The value object must have the same identity as an object in the drop-down.
@param propName The DMR property name to set.
@param value The value. | [
"Set",
"the",
"value",
"of",
"the",
"underlying",
"component",
".",
"Note",
"that",
"this",
"will",
"not",
"work",
"for",
"ListEditor",
"components",
".",
"Also",
"note",
"that",
"for",
"a",
"JComboBox",
"The",
"value",
"object",
"must",
"have",
"the",
"sa... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/OperationDialog.java#L120-L136 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java | IPAddress.matchesWithMask | public boolean matchesWithMask(IPAddress other, IPAddress mask) {
return getSection().matchesWithMask(other.getSection(), mask.getSection());
} | java | public boolean matchesWithMask(IPAddress other, IPAddress mask) {
return getSection().matchesWithMask(other.getSection(), mask.getSection());
} | [
"public",
"boolean",
"matchesWithMask",
"(",
"IPAddress",
"other",
",",
"IPAddress",
"mask",
")",
"{",
"return",
"getSection",
"(",
")",
".",
"matchesWithMask",
"(",
"other",
".",
"getSection",
"(",
")",
",",
"mask",
".",
"getSection",
"(",
")",
")",
";",
... | Applies the mask to this address and then compares values with the given address
@param mask
@param other
@return | [
"Applies",
"the",
"mask",
"to",
"this",
"address",
"and",
"then",
"compares",
"values",
"with",
"the",
"given",
"address"
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java#L592-L594 |
code4everything/util | src/main/java/com/zhazhapan/util/FileExecutor.java | FileExecutor.watchFile | public static void watchFile(String file, SimpleHutoolWatcher watcher, boolean shouldFirstExecute) {
if (shouldFirstExecute) {
watcher.doSomething();
}
SimpleWatcher simpleWatcher = new SimpleWatcher() {
@Override
public void onModify(WatchEvent<?> event, Path currentPath) {
watcher.onModify(event, currentPath);
watcher.doSomething();
}
};
try (WatchMonitor monitor = WatchMonitor.createAll(file, simpleWatcher)) {
monitor.start();
}
} | java | public static void watchFile(String file, SimpleHutoolWatcher watcher, boolean shouldFirstExecute) {
if (shouldFirstExecute) {
watcher.doSomething();
}
SimpleWatcher simpleWatcher = new SimpleWatcher() {
@Override
public void onModify(WatchEvent<?> event, Path currentPath) {
watcher.onModify(event, currentPath);
watcher.doSomething();
}
};
try (WatchMonitor monitor = WatchMonitor.createAll(file, simpleWatcher)) {
monitor.start();
}
} | [
"public",
"static",
"void",
"watchFile",
"(",
"String",
"file",
",",
"SimpleHutoolWatcher",
"watcher",
",",
"boolean",
"shouldFirstExecute",
")",
"{",
"if",
"(",
"shouldFirstExecute",
")",
"{",
"watcher",
".",
"doSomething",
"(",
")",
";",
"}",
"SimpleWatcher",
... | 监听文件
@param file 待监听的文件
@param watcher {@link SimpleHutoolWatcher}
@param shouldFirstExecute 第一次是否执行 {@link SimpleHutoolWatcher#doSomething()}
@since 1.1.1 | [
"监听文件"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L51-L65 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/SandboxStyleStructureProvider.java | SandboxStyleStructureProvider.getAllPDBIDs | public List<String> getAllPDBIDs() throws IOException{
File f = new File(path);
if ( ! f.isDirectory())
throw new IOException("Path " + path + " is not a directory!");
String[] dirName = f.list();
List<String>pdbIds = new ArrayList<String>();
for (String dir : dirName) {
File d2= new File(f,dir);
if ( ! d2.isDirectory())
continue;
String[] pdbDirs = d2.list();
for (String pdbId : pdbDirs) {
if ( ! pdbIds.contains(pdbId))
pdbIds.add(pdbId);
}
}
return pdbIds;
} | java | public List<String> getAllPDBIDs() throws IOException{
File f = new File(path);
if ( ! f.isDirectory())
throw new IOException("Path " + path + " is not a directory!");
String[] dirName = f.list();
List<String>pdbIds = new ArrayList<String>();
for (String dir : dirName) {
File d2= new File(f,dir);
if ( ! d2.isDirectory())
continue;
String[] pdbDirs = d2.list();
for (String pdbId : pdbDirs) {
if ( ! pdbIds.contains(pdbId))
pdbIds.add(pdbId);
}
}
return pdbIds;
} | [
"public",
"List",
"<",
"String",
">",
"getAllPDBIDs",
"(",
")",
"throws",
"IOException",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"!",
"f",
".",
"isDirectory",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"Path ... | Returns a list of all PDB IDs that are available in this installation
@return a list of PDB IDs | [
"Returns",
"a",
"list",
"of",
"all",
"PDB",
"IDs",
"that",
"are",
"available",
"in",
"this",
"installation"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SandboxStyleStructureProvider.java#L182-L205 |
real-logic/simple-binary-encoding | sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppUtil.java | CppUtil.formatByteOrderEncoding | public static String formatByteOrderEncoding(final ByteOrder byteOrder, final PrimitiveType primitiveType)
{
switch (primitiveType.size())
{
case 2:
return "SBE_" + byteOrder + "_ENCODE_16";
case 4:
return "SBE_" + byteOrder + "_ENCODE_32";
case 8:
return "SBE_" + byteOrder + "_ENCODE_64";
default:
return "";
}
} | java | public static String formatByteOrderEncoding(final ByteOrder byteOrder, final PrimitiveType primitiveType)
{
switch (primitiveType.size())
{
case 2:
return "SBE_" + byteOrder + "_ENCODE_16";
case 4:
return "SBE_" + byteOrder + "_ENCODE_32";
case 8:
return "SBE_" + byteOrder + "_ENCODE_64";
default:
return "";
}
} | [
"public",
"static",
"String",
"formatByteOrderEncoding",
"(",
"final",
"ByteOrder",
"byteOrder",
",",
"final",
"PrimitiveType",
"primitiveType",
")",
"{",
"switch",
"(",
"primitiveType",
".",
"size",
"(",
")",
")",
"{",
"case",
"2",
":",
"return",
"\"SBE_\"",
... | Return the Cpp98 formatted byte order encoding string to use for a given byte order and primitiveType
@param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token}
@param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token}
@return the string formatted as the byte ordering encoding | [
"Return",
"the",
"Cpp98",
"formatted",
"byte",
"order",
"encoding",
"string",
"to",
"use",
"for",
"a",
"given",
"byte",
"order",
"and",
"primitiveType"
] | train | https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppUtil.java#L125-L141 |
facebookarchive/hadoop-20 | src/contrib/streaming/src/java/org/apache/hadoop/streaming/UTF8ByteArrayUtils.java | UTF8ByteArrayUtils.findTab | @Deprecated
public static int findTab(byte [] utf, int start, int length) {
return StreamKeyValUtil.findTab(utf, start, length);
} | java | @Deprecated
public static int findTab(byte [] utf, int start, int length) {
return StreamKeyValUtil.findTab(utf, start, length);
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"findTab",
"(",
"byte",
"[",
"]",
"utf",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"return",
"StreamKeyValUtil",
".",
"findTab",
"(",
"utf",
",",
"start",
",",
"length",
")",
";",
"}"
] | Find the first occured tab in a UTF-8 encoded string
@param utf a byte array containing a UTF-8 encoded string
@param start starting offset
@param length no. of bytes
@return position that first tab occures otherwise -1
@deprecated use {@link StreamKeyValUtil#findTab(byte[], int, int)} | [
"Find",
"the",
"first",
"occured",
"tab",
"in",
"a",
"UTF",
"-",
"8",
"encoded",
"string"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/streaming/src/java/org/apache/hadoop/streaming/UTF8ByteArrayUtils.java#L41-L44 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/service/ArchiveService.java | ArchiveService.createDockerBuildArchive | public File createDockerBuildArchive(ImageConfiguration imageConfig, MojoParameters params)
throws MojoExecutionException {
return createDockerBuildArchive(imageConfig, params, null);
} | java | public File createDockerBuildArchive(ImageConfiguration imageConfig, MojoParameters params)
throws MojoExecutionException {
return createDockerBuildArchive(imageConfig, params, null);
} | [
"public",
"File",
"createDockerBuildArchive",
"(",
"ImageConfiguration",
"imageConfig",
",",
"MojoParameters",
"params",
")",
"throws",
"MojoExecutionException",
"{",
"return",
"createDockerBuildArchive",
"(",
"imageConfig",
",",
"params",
",",
"null",
")",
";",
"}"
] | Create the tar file container the source for building an image. This tar can be used directly for
uploading to a Docker daemon for creating the image
@param imageConfig the image configuration
@param params mojo params for the project
@return file for holding the sources
@throws MojoExecutionException if during creation of the tar an error occurs. | [
"Create",
"the",
"tar",
"file",
"container",
"the",
"source",
"for",
"building",
"an",
"image",
".",
"This",
"tar",
"can",
"be",
"used",
"directly",
"for",
"uploading",
"to",
"a",
"Docker",
"daemon",
"for",
"creating",
"the",
"image"
] | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/service/ArchiveService.java#L58-L61 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateStorageAccount | public StorageBundle updateStorageAccount(String vaultBaseUrl, String storageAccountName, String activeKeyName, Boolean autoRegenerateKey, String regenerationPeriod, StorageAccountAttributes storageAccountAttributes, Map<String, String> tags) {
return updateStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, activeKeyName, autoRegenerateKey, regenerationPeriod, storageAccountAttributes, tags).toBlocking().single().body();
} | java | public StorageBundle updateStorageAccount(String vaultBaseUrl, String storageAccountName, String activeKeyName, Boolean autoRegenerateKey, String regenerationPeriod, StorageAccountAttributes storageAccountAttributes, Map<String, String> tags) {
return updateStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, activeKeyName, autoRegenerateKey, regenerationPeriod, storageAccountAttributes, tags).toBlocking().single().body();
} | [
"public",
"StorageBundle",
"updateStorageAccount",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"activeKeyName",
",",
"Boolean",
"autoRegenerateKey",
",",
"String",
"regenerationPeriod",
",",
"StorageAccountAttributes",
"storageAccountAtt... | Updates the specified attributes associated with the given storage account. This operation requires the storage/set/update permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param activeKeyName The current active storage account key name.
@param autoRegenerateKey whether keyvault should manage the storage account for the user.
@param regenerationPeriod The key regeneration time duration specified in ISO-8601 format.
@param storageAccountAttributes The attributes of the storage account.
@param tags Application specific metadata in the form of key-value pairs.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the StorageBundle object if successful. | [
"Updates",
"the",
"specified",
"attributes",
"associated",
"with",
"the",
"given",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"set",
"/",
"update",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10186-L10188 |
google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java | ArrayMap.setValueAt | public V setValueAt(int index, V value) {
index = (index << 1) + 1;
V old = (V)mArray[index];
mArray[index] = value;
return old;
} | java | public V setValueAt(int index, V value) {
index = (index << 1) + 1;
V old = (V)mArray[index];
mArray[index] = value;
return old;
} | [
"public",
"V",
"setValueAt",
"(",
"int",
"index",
",",
"V",
"value",
")",
"{",
"index",
"=",
"(",
"index",
"<<",
"1",
")",
"+",
"1",
";",
"V",
"old",
"=",
"(",
"V",
")",
"mArray",
"[",
"index",
"]",
";",
"mArray",
"[",
"index",
"]",
"=",
"val... | Set the value at a given index in the array.
@param index The desired index, must be between 0 and {@link #size()}-1.
@param value The new value to store at this index.
@return Returns the previous value at the given index. | [
"Set",
"the",
"value",
"at",
"a",
"given",
"index",
"in",
"the",
"array",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java#L396-L401 |
mnlipp/jgrapes | examples/src/org/jgrapes/http/demo/httpserver/WsEchoServer.java | WsEchoServer.onGet | @RequestHandler(patterns = "/ws/echo", priority = 100)
public void onGet(Request.In.Get event, IOSubchannel channel)
throws InterruptedException {
final HttpRequest request = event.httpRequest();
if (!request.findField(
HttpField.UPGRADE, Converters.STRING_LIST)
.map(f -> f.value().containsIgnoreCase("websocket"))
.orElse(false)) {
return;
}
openChannels.add(channel);
channel.respond(new ProtocolSwitchAccepted(event, "websocket"));
event.stop();
} | java | @RequestHandler(patterns = "/ws/echo", priority = 100)
public void onGet(Request.In.Get event, IOSubchannel channel)
throws InterruptedException {
final HttpRequest request = event.httpRequest();
if (!request.findField(
HttpField.UPGRADE, Converters.STRING_LIST)
.map(f -> f.value().containsIgnoreCase("websocket"))
.orElse(false)) {
return;
}
openChannels.add(channel);
channel.respond(new ProtocolSwitchAccepted(event, "websocket"));
event.stop();
} | [
"@",
"RequestHandler",
"(",
"patterns",
"=",
"\"/ws/echo\"",
",",
"priority",
"=",
"100",
")",
"public",
"void",
"onGet",
"(",
"Request",
".",
"In",
".",
"Get",
"event",
",",
"IOSubchannel",
"channel",
")",
"throws",
"InterruptedException",
"{",
"final",
"Ht... | Handle `GET` requests.
@param event the event
@param channel the channel
@throws InterruptedException the interrupted exception | [
"Handle",
"GET",
"requests",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/examples/src/org/jgrapes/http/demo/httpserver/WsEchoServer.java#L65-L78 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/AppliedDiscountUrl.java | AppliedDiscountUrl.removeCouponUrl | public static MozuUrl removeCouponUrl(String checkoutId, String couponCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/coupons/{couponcode}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("couponCode", couponCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl removeCouponUrl(String checkoutId, String couponCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/coupons/{couponcode}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("couponCode", couponCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"removeCouponUrl",
"(",
"String",
"checkoutId",
",",
"String",
"couponCode",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checkoutId}/coupons/{couponcode}\"",
")",
";",
"formatter",
".",... | Get Resource Url for RemoveCoupon
@param checkoutId The unique identifier of the checkout.
@param couponCode Code associated with the coupon to remove from the cart.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"RemoveCoupon"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/AppliedDiscountUrl.java#L50-L56 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java | LogViewer.createLevelByString | private Level createLevelByString(String levelString) throws IllegalArgumentException {
try {
return Level.parse(levelString.toUpperCase());
//return WsLevel.parse(levelString.toUpperCase());
} catch (Exception npe) {
throw new IllegalArgumentException(getLocalizedParmString("CWTRA0013E", new Object[] { levelString }));
}
} | java | private Level createLevelByString(String levelString) throws IllegalArgumentException {
try {
return Level.parse(levelString.toUpperCase());
//return WsLevel.parse(levelString.toUpperCase());
} catch (Exception npe) {
throw new IllegalArgumentException(getLocalizedParmString("CWTRA0013E", new Object[] { levelString }));
}
} | [
"private",
"Level",
"createLevelByString",
"(",
"String",
"levelString",
")",
"throws",
"IllegalArgumentException",
"{",
"try",
"{",
"return",
"Level",
".",
"parse",
"(",
"levelString",
".",
"toUpperCase",
"(",
")",
")",
";",
"//return WsLevel.parse(levelString.toUppe... | This method creates a java.util.Level object from a string with the level name.
@param levelString
- a String representing the name of the Level.
@return a Level object | [
"This",
"method",
"creates",
"a",
"java",
".",
"util",
".",
"Level",
"object",
"from",
"a",
"string",
"with",
"the",
"level",
"name",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L1409-L1417 |
pedrovgs/Renderers | renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java | RendererBuilder.isRecyclable | private boolean isRecyclable(View convertView, T content) {
boolean isRecyclable = false;
if (convertView != null && convertView.getTag() != null) {
Class prototypeClass = getPrototypeClass(content);
validatePrototypeClass(prototypeClass);
isRecyclable = prototypeClass.equals(convertView.getTag().getClass());
}
return isRecyclable;
} | java | private boolean isRecyclable(View convertView, T content) {
boolean isRecyclable = false;
if (convertView != null && convertView.getTag() != null) {
Class prototypeClass = getPrototypeClass(content);
validatePrototypeClass(prototypeClass);
isRecyclable = prototypeClass.equals(convertView.getTag().getClass());
}
return isRecyclable;
} | [
"private",
"boolean",
"isRecyclable",
"(",
"View",
"convertView",
",",
"T",
"content",
")",
"{",
"boolean",
"isRecyclable",
"=",
"false",
";",
"if",
"(",
"convertView",
"!=",
"null",
"&&",
"convertView",
".",
"getTag",
"(",
")",
"!=",
"null",
")",
"{",
"... | Check if one Renderer is recyclable getting it from the convertView's tag and checking the
class used.
@param convertView to get the renderer if is not null.
@param content used to get the prototype class.
@return true if the renderer is recyclable. | [
"Check",
"if",
"one",
"Renderer",
"is",
"recyclable",
"getting",
"it",
"from",
"the",
"convertView",
"s",
"tag",
"and",
"checking",
"the",
"class",
"used",
"."
] | train | https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RendererBuilder.java#L314-L322 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/user/UserClient.java | UserClient.addFriends | public ResponseWrapper addFriends(String username, String... users)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
Preconditions.checkArgument(null != users && users.length > 0, "friend list should not be empty");
JsonArray array = new JsonArray();
for (String user : users) {
array.add(new JsonPrimitive(user));
}
return _httpClient.sendPost(_baseUrl + userPath + "/" + username + "/friends", array.toString());
} | java | public ResponseWrapper addFriends(String username, String... users)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
Preconditions.checkArgument(null != users && users.length > 0, "friend list should not be empty");
JsonArray array = new JsonArray();
for (String user : users) {
array.add(new JsonPrimitive(user));
}
return _httpClient.sendPost(_baseUrl + userPath + "/" + username + "/friends", array.toString());
} | [
"public",
"ResponseWrapper",
"addFriends",
"(",
"String",
"username",
",",
"String",
"...",
"users",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"Preconditions",
".",
"chec... | Add friends to username
@param username Necessary
@param users username to be add
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Add",
"friends",
"to",
"username"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L283-L294 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.WSG84_L2 | @Pure
public static Point2d WSG84_L2(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2_N,
LAMBERT_2_C,
LAMBERT_2_XS,
LAMBERT_2_YS);
} | java | @Pure
public static Point2d WSG84_L2(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2_N,
LAMBERT_2_C,
LAMBERT_2_XS,
LAMBERT_2_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"WSG84_L2",
"(",
"double",
"lambda",
",",
"double",
"phi",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"WSG84_NTFLamdaPhi",
"(",
"lambda",
",",
"phi",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfLa... | This function convert WSG84 GPS coordinate to France Lambert II coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert II coordinates. | [
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"France",
"Lambert",
"II",
"coordinate",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1079-L1088 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java | VirtualNetworkGatewayConnectionsInner.beginUpdateTagsAsync | public Observable<VirtualNetworkGatewayConnectionListEntityInner> beginUpdateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner>, VirtualNetworkGatewayConnectionListEntityInner>() {
@Override
public VirtualNetworkGatewayConnectionListEntityInner call(ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualNetworkGatewayConnectionListEntityInner> beginUpdateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner>, VirtualNetworkGatewayConnectionListEntityInner>() {
@Override
public VirtualNetworkGatewayConnectionListEntityInner call(ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualNetworkGatewayConnectionListEntityInner",
">",
"beginUpdateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayConnectionName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",... | Updates a virtual network gateway connection tags.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualNetworkGatewayConnectionListEntityInner object | [
"Updates",
"a",
"virtual",
"network",
"gateway",
"connection",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L792-L799 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/ResourceMonitor.java | ResourceMonitor.addResourceChangeListener | public void addResourceChangeListener(ResourceChangeListener pListener,
Object pResourceId, long pPeriod) throws IOException {
// Create the task
ResourceMonitorTask task = new ResourceMonitorTask(pListener, pResourceId);
// Get unique Id
Object resourceId = getResourceId(pResourceId, pListener);
// Remove the old task for this Id, if any, and register the new one
synchronized (timerEntries) {
removeListenerInternal(resourceId);
timerEntries.put(resourceId, task);
}
timer.schedule(task, pPeriod, pPeriod);
} | java | public void addResourceChangeListener(ResourceChangeListener pListener,
Object pResourceId, long pPeriod) throws IOException {
// Create the task
ResourceMonitorTask task = new ResourceMonitorTask(pListener, pResourceId);
// Get unique Id
Object resourceId = getResourceId(pResourceId, pListener);
// Remove the old task for this Id, if any, and register the new one
synchronized (timerEntries) {
removeListenerInternal(resourceId);
timerEntries.put(resourceId, task);
}
timer.schedule(task, pPeriod, pPeriod);
} | [
"public",
"void",
"addResourceChangeListener",
"(",
"ResourceChangeListener",
"pListener",
",",
"Object",
"pResourceId",
",",
"long",
"pPeriod",
")",
"throws",
"IOException",
"{",
"// Create the task",
"ResourceMonitorTask",
"task",
"=",
"new",
"ResourceMonitorTask",
"(",... | Add a monitored {@code Resource} with a {@code ResourceChangeListener}.
The {@code reourceId} might be a {@code File} a {@code URL} or a
{@code String} containing a file path, or a path to a resource in the
class path. Note that class path resources are resolved using the
given {@code ResourceChangeListener}'s {@code ClassLoader}, then
the current {@code Thread}'s context class loader, if not found.
@param pListener pListener to notify when the file changed.
@param pResourceId id of the resource to monitor (a {@code File}
a {@code URL} or a {@code String} containing a file path).
@param pPeriod polling pPeriod in milliseconds.
@see ClassLoader#getResource(String) | [
"Add",
"a",
"monitored",
"{",
"@code",
"Resource",
"}",
"with",
"a",
"{",
"@code",
"ResourceChangeListener",
"}",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/ResourceMonitor.java#L89-L104 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getAllContinentMapID | public void getAllContinentMapID(int continentID, int floorID, int regionID, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllContinentMapIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID)).enqueue(callback);
} | java | public void getAllContinentMapID(int continentID, int floorID, int regionID, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllContinentMapIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID)).enqueue(callback);
} | [
"public",
"void",
"getAllContinentMapID",
"(",
"int",
"continentID",
",",
"int",
"floorID",
",",
"int",
"regionID",
",",
"Callback",
"<",
"List",
"<",
"Integer",
">",
">",
"callback",
")",
"throws",
"NullPointerException",
"{",
"gw2API",
".",
"getAllContinentMap... | For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param continentID {@link Continent#id}
@param floorID {@link ContinentFloor#id}
@param regionID {@link ContinentRegion#id}
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see ContinentMap continents map info | [
"For",
"more",
"info",
"on",
"continents",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"continents",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"use... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1108-L1110 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java | SDMath.confusionMatrix | public SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred, DataType dataType) {
validateInteger("confusionMatrix", "labels", labels);
validateInteger("confusionMatrix", "prediction", pred);
SDVariable result = f().confusionMatrix(labels, pred, dataType);
return updateVariableNameAndReference(result, name);
} | java | public SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred, DataType dataType) {
validateInteger("confusionMatrix", "labels", labels);
validateInteger("confusionMatrix", "prediction", pred);
SDVariable result = f().confusionMatrix(labels, pred, dataType);
return updateVariableNameAndReference(result, name);
} | [
"public",
"SDVariable",
"confusionMatrix",
"(",
"String",
"name",
",",
"SDVariable",
"labels",
",",
"SDVariable",
"pred",
",",
"DataType",
"dataType",
")",
"{",
"validateInteger",
"(",
"\"confusionMatrix\"",
",",
"\"labels\"",
",",
"labels",
")",
";",
"validateInt... | Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
which are represented as integer values. This version assumes the number of classes is 1 + max(max(labels), max(pred))<br>
For example, if labels = [0, 1, 1] and predicted = [0, 2, 1] then output is:<br>
[1, 0, 0]<br>
[0, 1, 1]<br>
[0, 0, 0]<br>
@param name Name of the output variable
@param labels Labels - 1D array of integer values representing label values
@param pred Predictions - 1D array of integer values representing predictions. Same length as labels
@return Output variable (2D, shape [numClasses, numClasses}) | [
"Compute",
"the",
"2d",
"confusion",
"matrix",
"of",
"size",
"[",
"numClasses",
"numClasses",
"]",
"from",
"a",
"pair",
"of",
"labels",
"and",
"predictions",
"both",
"of",
"which",
"are",
"represented",
"as",
"integer",
"values",
".",
"This",
"version",
"ass... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L493-L498 |
app55/app55-java | src/support/java/org/apache/harmony/beans/Command.java | Command.doBeforeRun | private int doBeforeRun(Map<String, Command> references) throws Exception
{
if (status == Command.INITIALIZED)
{
for (int i = 0; i < commands.size(); ++i)
{
Command cmd = commands.elementAt(i);
// XXX is this correct?
if (cmd.isExecutable())
{
arguments.add(cmd);
}
else
{
operations.add(cmd);
}
}
return Command.CHILDREN_FILTERED;
}
return status;
} | java | private int doBeforeRun(Map<String, Command> references) throws Exception
{
if (status == Command.INITIALIZED)
{
for (int i = 0; i < commands.size(); ++i)
{
Command cmd = commands.elementAt(i);
// XXX is this correct?
if (cmd.isExecutable())
{
arguments.add(cmd);
}
else
{
operations.add(cmd);
}
}
return Command.CHILDREN_FILTERED;
}
return status;
} | [
"private",
"int",
"doBeforeRun",
"(",
"Map",
"<",
"String",
",",
"Command",
">",
"references",
")",
"throws",
"Exception",
"{",
"if",
"(",
"status",
"==",
"Command",
".",
"INITIALIZED",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"comm... | put command in one of two collections - arguments or operations | [
"put",
"command",
"in",
"one",
"of",
"two",
"collections",
"-",
"arguments",
"or",
"operations"
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/org/apache/harmony/beans/Command.java#L227-L248 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java | ReferenceCountedOpenSslContext.setPrivateKeyMethod | @UnstableApi
public final void setPrivateKeyMethod(OpenSslPrivateKeyMethod method) {
ObjectUtil.checkNotNull(method, "method");
Lock writerLock = ctxLock.writeLock();
writerLock.lock();
try {
SSLContext.setPrivateKeyMethod(ctx, new PrivateKeyMethod(engineMap, method));
} finally {
writerLock.unlock();
}
} | java | @UnstableApi
public final void setPrivateKeyMethod(OpenSslPrivateKeyMethod method) {
ObjectUtil.checkNotNull(method, "method");
Lock writerLock = ctxLock.writeLock();
writerLock.lock();
try {
SSLContext.setPrivateKeyMethod(ctx, new PrivateKeyMethod(engineMap, method));
} finally {
writerLock.unlock();
}
} | [
"@",
"UnstableApi",
"public",
"final",
"void",
"setPrivateKeyMethod",
"(",
"OpenSslPrivateKeyMethod",
"method",
")",
"{",
"ObjectUtil",
".",
"checkNotNull",
"(",
"method",
",",
"\"method\"",
")",
";",
"Lock",
"writerLock",
"=",
"ctxLock",
".",
"writeLock",
"(",
... | Set the {@link OpenSslPrivateKeyMethod} to use. This allows to offload private-key operations
if needed.
This method is currently only supported when {@code BoringSSL} is used.
@param method method to use. | [
"Set",
"the",
"{",
"@link",
"OpenSslPrivateKeyMethod",
"}",
"to",
"use",
".",
"This",
"allows",
"to",
"offload",
"private",
"-",
"key",
"operations",
"if",
"needed",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java#L532-L542 |
ben-manes/caffeine | simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/S4WindowTinyLfuPolicy.java | S4WindowTinyLfuPolicy.policies | public static Set<Policy> policies(Config config) {
S4WindowTinyLfuSettings settings = new S4WindowTinyLfuSettings(config);
return settings.percentMain().stream()
.map(percentMain -> new S4WindowTinyLfuPolicy(percentMain, settings))
.collect(toSet());
} | java | public static Set<Policy> policies(Config config) {
S4WindowTinyLfuSettings settings = new S4WindowTinyLfuSettings(config);
return settings.percentMain().stream()
.map(percentMain -> new S4WindowTinyLfuPolicy(percentMain, settings))
.collect(toSet());
} | [
"public",
"static",
"Set",
"<",
"Policy",
">",
"policies",
"(",
"Config",
"config",
")",
"{",
"S4WindowTinyLfuSettings",
"settings",
"=",
"new",
"S4WindowTinyLfuSettings",
"(",
"config",
")",
";",
"return",
"settings",
".",
"percentMain",
"(",
")",
".",
"strea... | Returns all variations of this policy based on the configuration parameters. | [
"Returns",
"all",
"variations",
"of",
"this",
"policy",
"based",
"on",
"the",
"configuration",
"parameters",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/S4WindowTinyLfuPolicy.java#L73-L78 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cardinality/impl/CardinalityEstimatorContainerCollector.java | CardinalityEstimatorContainerCollector.onIteration | @Override
protected void onIteration(String containerName, CardinalityEstimatorContainer container) {
CardinalityEstimatorConfig cardinalityEstimatorConfig = config.findCardinalityEstimatorConfig(containerName);
containerNames.put(container, containerName);
containerPolicies.put(container, cardinalityEstimatorConfig.getMergePolicyConfig());
} | java | @Override
protected void onIteration(String containerName, CardinalityEstimatorContainer container) {
CardinalityEstimatorConfig cardinalityEstimatorConfig = config.findCardinalityEstimatorConfig(containerName);
containerNames.put(container, containerName);
containerPolicies.put(container, cardinalityEstimatorConfig.getMergePolicyConfig());
} | [
"@",
"Override",
"protected",
"void",
"onIteration",
"(",
"String",
"containerName",
",",
"CardinalityEstimatorContainer",
"container",
")",
"{",
"CardinalityEstimatorConfig",
"cardinalityEstimatorConfig",
"=",
"config",
".",
"findCardinalityEstimatorConfig",
"(",
"containerN... | The {@link CardinalityEstimatorContainer} doesn't know its name or configuration, so we create these lookup maps.
This is cheaper than storing this information permanently in the container. | [
"The",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cardinality/impl/CardinalityEstimatorContainerCollector.java#L48-L54 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/LocalWeightedHistogramRotRect.java | LocalWeightedHistogramRotRect.squareToImageSample | protected void squareToImageSample(float x, float y, RectangleRotate_F32 region) {
// -1 because it starts counting at 0. otherwise width+1 samples are made
x *= region.width-1;
y *= region.height-1;
imageX = x*c - y*s + region.cx;
imageY = x*s + y*c + region.cy;
} | java | protected void squareToImageSample(float x, float y, RectangleRotate_F32 region) {
// -1 because it starts counting at 0. otherwise width+1 samples are made
x *= region.width-1;
y *= region.height-1;
imageX = x*c - y*s + region.cx;
imageY = x*s + y*c + region.cy;
} | [
"protected",
"void",
"squareToImageSample",
"(",
"float",
"x",
",",
"float",
"y",
",",
"RectangleRotate_F32",
"region",
")",
"{",
"// -1 because it starts counting at 0. otherwise width+1 samples are made",
"x",
"*=",
"region",
".",
"width",
"-",
"1",
";",
"y",
"*=",... | Converts a point from square coordinates into image coordinates | [
"Converts",
"a",
"point",
"from",
"square",
"coordinates",
"into",
"image",
"coordinates"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/LocalWeightedHistogramRotRect.java#L246-L253 |
google/error-prone | check_api/src/main/java/com/google/errorprone/dataflow/DataFlow.java | DataFlow.expressionDataflow | @Nullable
public static <A extends AbstractValue<A>, S extends Store<S>, T extends TransferFunction<A, S>>
A expressionDataflow(TreePath exprPath, Context context, T transfer) {
final Tree leaf = exprPath.getLeaf();
Preconditions.checkArgument(
leaf instanceof ExpressionTree,
"Leaf of exprPath must be of type ExpressionTree, but was %s",
leaf.getClass().getName());
final ExpressionTree expr = (ExpressionTree) leaf;
final TreePath enclosingMethodPath = findEnclosingMethodOrLambdaOrInitializer(exprPath);
if (enclosingMethodPath == null) {
// expression is not part of a method, lambda, or initializer
return null;
}
final Tree method = enclosingMethodPath.getLeaf();
if (method instanceof MethodTree && ((MethodTree) method).getBody() == null) {
// expressions can occur in abstract methods, for example {@code Map.Entry} in:
//
// abstract Set<Map.Entry<K, V>> entries();
return null;
}
return methodDataflow(enclosingMethodPath, context, transfer).getAnalysis().getValue(expr);
} | java | @Nullable
public static <A extends AbstractValue<A>, S extends Store<S>, T extends TransferFunction<A, S>>
A expressionDataflow(TreePath exprPath, Context context, T transfer) {
final Tree leaf = exprPath.getLeaf();
Preconditions.checkArgument(
leaf instanceof ExpressionTree,
"Leaf of exprPath must be of type ExpressionTree, but was %s",
leaf.getClass().getName());
final ExpressionTree expr = (ExpressionTree) leaf;
final TreePath enclosingMethodPath = findEnclosingMethodOrLambdaOrInitializer(exprPath);
if (enclosingMethodPath == null) {
// expression is not part of a method, lambda, or initializer
return null;
}
final Tree method = enclosingMethodPath.getLeaf();
if (method instanceof MethodTree && ((MethodTree) method).getBody() == null) {
// expressions can occur in abstract methods, for example {@code Map.Entry} in:
//
// abstract Set<Map.Entry<K, V>> entries();
return null;
}
return methodDataflow(enclosingMethodPath, context, transfer).getAnalysis().getValue(expr);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"A",
"extends",
"AbstractValue",
"<",
"A",
">",
",",
"S",
"extends",
"Store",
"<",
"S",
">",
",",
"T",
"extends",
"TransferFunction",
"<",
"A",
",",
"S",
">",
">",
"A",
"expressionDataflow",
"(",
"TreePath",
"e... | Runs the {@code transfer} dataflow analysis to compute the abstract value of the expression
which is the leaf of {@code exprPath}.
<p>The expression must be part of a method, lambda, or initializer (inline field initializer or
initializer block). Example of an expression outside of such constructs is the identifier in an
import statement.
<p>Note that for intializers, each inline field initializer or initializer block is treated
separately. I.e., we don't merge all initializers into one virtual block for dataflow.
@return dataflow result for the given expression or {@code null} if the expression is not part
of a method, lambda or initializer | [
"Runs",
"the",
"{",
"@code",
"transfer",
"}",
"dataflow",
"analysis",
"to",
"compute",
"the",
"abstract",
"value",
"of",
"the",
"expression",
"which",
"is",
"the",
"leaf",
"of",
"{",
"@code",
"exprPath",
"}",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/dataflow/DataFlow.java#L203-L228 |
ggrandes/kvstore | src/main/java/org/javastack/kvstore/structures/btree/BplusTree.java | BplusTree.findOptimalNodeOrder | private int findOptimalNodeOrder(final Node<K, V> node) {
int low = MIN_B_ORDER; // minimal b-order
int high = (blockSize / node.getStructEstimateSize(1)) << 2; // estimate high b-order
while (low <= high) {
int mid = ((low + high) >>> 1);
mid += (1 - (mid % 2));
int nodeSize = node.getStructEstimateSize(mid);
if (log.isDebugEnabled()) {
log.debug(this.getClass().getName() + "::findOptimalNodeOrder(" + node.getClass().getName()
+ ") blockSize=" + blockSize + " nodeSize=" + nodeSize + " b_low=" + low
+ " b_order=" + mid + " b_high=" + high);
}
if (nodeSize < blockSize) {
low = mid + 2;
} else if (nodeSize > blockSize) {
high = mid - 2;
} else {
return mid;
}
}
return low - 2;
} | java | private int findOptimalNodeOrder(final Node<K, V> node) {
int low = MIN_B_ORDER; // minimal b-order
int high = (blockSize / node.getStructEstimateSize(1)) << 2; // estimate high b-order
while (low <= high) {
int mid = ((low + high) >>> 1);
mid += (1 - (mid % 2));
int nodeSize = node.getStructEstimateSize(mid);
if (log.isDebugEnabled()) {
log.debug(this.getClass().getName() + "::findOptimalNodeOrder(" + node.getClass().getName()
+ ") blockSize=" + blockSize + " nodeSize=" + nodeSize + " b_low=" + low
+ " b_order=" + mid + " b_high=" + high);
}
if (nodeSize < blockSize) {
low = mid + 2;
} else if (nodeSize > blockSize) {
high = mid - 2;
} else {
return mid;
}
}
return low - 2;
} | [
"private",
"int",
"findOptimalNodeOrder",
"(",
"final",
"Node",
"<",
"K",
",",
"V",
">",
"node",
")",
"{",
"int",
"low",
"=",
"MIN_B_ORDER",
";",
"// minimal b-order",
"int",
"high",
"=",
"(",
"blockSize",
"/",
"node",
".",
"getStructEstimateSize",
"(",
"1... | Find b-order for a blockSize of this tree
@param node of type Leaf or Integernal
@return integer with b-order | [
"Find",
"b",
"-",
"order",
"for",
"a",
"blockSize",
"of",
"this",
"tree"
] | train | https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/structures/btree/BplusTree.java#L340-L364 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/stats/StatsInterface.java | StatsInterface.getPhotostreamStats | public Stats getPhotostreamStats(Date date) throws FlickrException {
return getStats(METHOD_GET_PHOTOSTREAM_STATS, null, null, date);
} | java | public Stats getPhotostreamStats(Date date) throws FlickrException {
return getStats(METHOD_GET_PHOTOSTREAM_STATS, null, null, date);
} | [
"public",
"Stats",
"getPhotostreamStats",
"(",
"Date",
"date",
")",
"throws",
"FlickrException",
"{",
"return",
"getStats",
"(",
"METHOD_GET_PHOTOSTREAM_STATS",
",",
"null",
",",
"null",
",",
"date",
")",
";",
"}"
] | Get the number of views, comments and favorites on a photostream for a given date.
@param date
(Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will
automatically be rounded down to the start of the day.
@see "http://www.flickr.com/services/api/flickr.stats.getPhotostreamStats.htm" | [
"Get",
"the",
"number",
"of",
"views",
"comments",
"and",
"favorites",
"on",
"a",
"photostream",
"for",
"a",
"given",
"date",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L301-L303 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java | SDVariable.normmax | public SDVariable normmax(String name, boolean keepDims, int... dimensions){
return sameDiff.normmax(name, this, keepDims, dimensions);
} | java | public SDVariable normmax(String name, boolean keepDims, int... dimensions){
return sameDiff.normmax(name, this, keepDims, dimensions);
} | [
"public",
"SDVariable",
"normmax",
"(",
"String",
"name",
",",
"boolean",
"keepDims",
",",
"int",
"...",
"dimensions",
")",
"{",
"return",
"sameDiff",
".",
"normmax",
"(",
"name",
",",
"this",
",",
"keepDims",
",",
"dimensions",
")",
";",
"}"
] | Max norm (infinity norm) reduction operation: The output contains the max norm for each tensor/subset along the
specified dimensions:<br>
{@code out = max(abs(x[i]))}<br>
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1. This can be useful for later broadcast operations (such as subtracting
the mean along a dimension).<br>
Example: if input has shape [a,b,c] and dimensions=[1] then output has shape:
keepDims = true: [a,1,c]<br>
keepDims = false: [a,c]
@param name Output variable name
@param keepDims If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions
@param dimensions dimensions to reduce over
@return Output variable | [
"Max",
"norm",
"(",
"infinity",
"norm",
")",
"reduction",
"operation",
":",
"The",
"output",
"contains",
"the",
"max",
"norm",
"for",
"each",
"tensor",
"/",
"subset",
"along",
"the",
"specified",
"dimensions",
":",
"<br",
">",
"{",
"@code",
"out",
"=",
"... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L1630-L1632 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.removeChatRoomMembers | public ResponseWrapper removeChatRoomMembers(long roomId, Members members)
throws APIConnectionException, APIRequestException {
return _chatRoomClient.removeChatRoomMembers(roomId, members);
} | java | public ResponseWrapper removeChatRoomMembers(long roomId, Members members)
throws APIConnectionException, APIRequestException {
return _chatRoomClient.removeChatRoomMembers(roomId, members);
} | [
"public",
"ResponseWrapper",
"removeChatRoomMembers",
"(",
"long",
"roomId",
",",
"Members",
"members",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_chatRoomClient",
".",
"removeChatRoomMembers",
"(",
"roomId",
",",
"members",
")... | remove members from chat room
@param roomId chat room id
@param members {@link Members}
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"remove",
"members",
"from",
"chat",
"room"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L932-L935 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java | InMemoryLockMapImpl.getWriter | public LockEntry getWriter(Object obj)
{
PersistenceBroker broker = getBroker();
Identity oid = new Identity(obj, broker);
return getWriter(oid);
} | java | public LockEntry getWriter(Object obj)
{
PersistenceBroker broker = getBroker();
Identity oid = new Identity(obj, broker);
return getWriter(oid);
} | [
"public",
"LockEntry",
"getWriter",
"(",
"Object",
"obj",
")",
"{",
"PersistenceBroker",
"broker",
"=",
"getBroker",
"(",
")",
";",
"Identity",
"oid",
"=",
"new",
"Identity",
"(",
"obj",
",",
"broker",
")",
";",
"return",
"getWriter",
"(",
"oid",
")",
";... | returns the LockEntry for the Writer of object obj.
If now writer exists, null is returned. | [
"returns",
"the",
"LockEntry",
"for",
"the",
"Writer",
"of",
"object",
"obj",
".",
"If",
"now",
"writer",
"exists",
"null",
"is",
"returned",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java#L62-L67 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/WriterUtils.java | WriterUtils.getDataPublisherFinalDir | public static Path getDataPublisherFinalDir(State state, int numBranches, int branchId) {
String dataPublisherFinalDirKey =
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.DATA_PUBLISHER_FINAL_DIR, numBranches, branchId);
Preconditions.checkArgument(state.contains(dataPublisherFinalDirKey),
"Missing required property " + dataPublisherFinalDirKey);
if (state.getPropAsBoolean(ConfigurationKeys.DATA_PUBLISHER_APPEND_EXTRACT_TO_FINAL_DIR,
ConfigurationKeys.DEFAULT_DATA_PUBLISHER_APPEND_EXTRACT_TO_FINAL_DIR)) {
return new Path(state.getProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.DATA_PUBLISHER_FINAL_DIR, numBranches, branchId)),
WriterUtils.getWriterFilePath(state, numBranches, branchId));
} else {
return new Path(state.getProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.DATA_PUBLISHER_FINAL_DIR, numBranches, branchId)));
}
} | java | public static Path getDataPublisherFinalDir(State state, int numBranches, int branchId) {
String dataPublisherFinalDirKey =
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.DATA_PUBLISHER_FINAL_DIR, numBranches, branchId);
Preconditions.checkArgument(state.contains(dataPublisherFinalDirKey),
"Missing required property " + dataPublisherFinalDirKey);
if (state.getPropAsBoolean(ConfigurationKeys.DATA_PUBLISHER_APPEND_EXTRACT_TO_FINAL_DIR,
ConfigurationKeys.DEFAULT_DATA_PUBLISHER_APPEND_EXTRACT_TO_FINAL_DIR)) {
return new Path(state.getProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.DATA_PUBLISHER_FINAL_DIR, numBranches, branchId)),
WriterUtils.getWriterFilePath(state, numBranches, branchId));
} else {
return new Path(state.getProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.DATA_PUBLISHER_FINAL_DIR, numBranches, branchId)));
}
} | [
"public",
"static",
"Path",
"getDataPublisherFinalDir",
"(",
"State",
"state",
",",
"int",
"numBranches",
",",
"int",
"branchId",
")",
"{",
"String",
"dataPublisherFinalDirKey",
"=",
"ForkOperatorUtils",
".",
"getPropertyNameForBranch",
"(",
"ConfigurationKeys",
".",
... | Get the {@link Path} corresponding the to the directory a given {@link org.apache.gobblin.publisher.BaseDataPublisher} should
commits its output data. The final output data directory is determined by combining the
{@link ConfigurationKeys#DATA_PUBLISHER_FINAL_DIR} and the {@link ConfigurationKeys#WRITER_FILE_PATH}.
@param state is the {@link State} corresponding to a specific {@link org.apache.gobblin.writer.DataWriter}.
@param numBranches is the total number of branches for the given {@link State}.
@param branchId is the id for the specific branch that the {@link org.apache.gobblin.publisher.BaseDataPublisher} will publish.
@return a {@link Path} specifying the directory where the {@link org.apache.gobblin.publisher.BaseDataPublisher} will publish. | [
"Get",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/WriterUtils.java#L128-L143 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.setDefaultColorspace | public void setDefaultColorspace(PdfName name, PdfObject obj) {
PageResources prs = getPageResources();
prs.addDefaultColor(name, obj);
} | java | public void setDefaultColorspace(PdfName name, PdfObject obj) {
PageResources prs = getPageResources();
prs.addDefaultColor(name, obj);
} | [
"public",
"void",
"setDefaultColorspace",
"(",
"PdfName",
"name",
",",
"PdfObject",
"obj",
")",
"{",
"PageResources",
"prs",
"=",
"getPageResources",
"(",
")",
";",
"prs",
".",
"addDefaultColor",
"(",
"name",
",",
"obj",
")",
";",
"}"
] | Sets the default colorspace.
@param name the name of the colorspace. It can be <CODE>PdfName.DEFAULTGRAY</CODE>, <CODE>PdfName.DEFAULTRGB</CODE>
or <CODE>PdfName.DEFAULTCMYK</CODE>
@param obj the colorspace. A <CODE>null</CODE> or <CODE>PdfNull</CODE> removes any colorspace with the same name | [
"Sets",
"the",
"default",
"colorspace",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L3014-L3017 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/VarSetBuilder.java | VarSetBuilder.hasIf | public VarSetBuilder hasIf( String name, Object value)
{
return
value != null
? has( name, value)
: this;
} | java | public VarSetBuilder hasIf( String name, Object value)
{
return
value != null
? has( name, value)
: this;
} | [
"public",
"VarSetBuilder",
"hasIf",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"return",
"value",
"!=",
"null",
"?",
"has",
"(",
"name",
",",
"value",
")",
":",
"this",
";",
"}"
] | Adds a variable set annotation if the given value is non-null | [
"Adds",
"a",
"variable",
"set",
"annotation",
"if",
"the",
"given",
"value",
"is",
"non",
"-",
"null"
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/VarSetBuilder.java#L125-L131 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/KR.java | KR.checkKhatriRaoArguments | private static void checkKhatriRaoArguments(Matrix A, Matrix B) {
if (A.numColumns() != B.numColumns())
throw new IndexOutOfBoundsException(
"A.numColumns != B.numColumns (" + A.numColumns() + " != "
+ B.numColumns() + ")");
} | java | private static void checkKhatriRaoArguments(Matrix A, Matrix B) {
if (A.numColumns() != B.numColumns())
throw new IndexOutOfBoundsException(
"A.numColumns != B.numColumns (" + A.numColumns() + " != "
+ B.numColumns() + ")");
} | [
"private",
"static",
"void",
"checkKhatriRaoArguments",
"(",
"Matrix",
"A",
",",
"Matrix",
"B",
")",
"{",
"if",
"(",
"A",
".",
"numColumns",
"(",
")",
"!=",
"B",
".",
"numColumns",
"(",
")",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"A.numCo... | Tests if the matrices have an equal number of columns.
@param A
@param B | [
"Tests",
"if",
"the",
"matrices",
"have",
"an",
"equal",
"number",
"of",
"columns",
"."
] | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/KR.java#L41-L46 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/PropertiesField.java | PropertiesField.setupDefaultView | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
ScreenComponent screenField = null;
if (ScreenModel.SWING_TYPE.equalsIgnoreCase(targetScreen.getViewType()))
{
Record recPropertiesInput = Record.makeRecordFromClassName(PropertiesInput.THICK_CLASS, this.getRecord().getRecordOwner());
((PropertiesInputModel)recPropertiesInput).setPropertiesField(this);
screenField = recPropertiesInput.makeScreen(itsLocation, targetScreen, iDisplayFieldDesc | ScreenConstants.DISPLAY_MODE, this.getMapKeyDescriptions());
boolean bAllowAppending = (this.getMapKeyDescriptions() == null);
((GridScreenParent)screenField).setAppending(bAllowAppending);
this.addListener(new SyncFieldToPropertiesRecord(recPropertiesInput));
recPropertiesInput.addListener(new SyncPropertiesRecordToField(this));
// No need to add FreeOnFree Handler, since PropertiesInput is owned by the new screen
ScreenLoc descLocation = targetScreen.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR);
String strDisplay = converter.getFieldDesc();
if ((strDisplay != null) && (strDisplay.length() > 0))
{
properties = new HashMap<String,Object>();
properties.put(ScreenModel.DISPLAY_STRING, strDisplay);
createScreenComponent(ScreenModel.STATIC_STRING, descLocation, targetScreen, null, iDisplayFieldDesc, properties);
}
}
else
{
screenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
properties = new HashMap<String,Object>();
properties.put(ScreenModel.FIELD, this);
properties.put(ScreenModel.COMMAND, ScreenModel.EDIT);
properties.put(ScreenModel.IMAGE, ScreenModel.EDIT);
ScreenComponent sScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties);
sScreenField.setRequestFocusEnabled(false);
}
return screenField;
} | java | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
ScreenComponent screenField = null;
if (ScreenModel.SWING_TYPE.equalsIgnoreCase(targetScreen.getViewType()))
{
Record recPropertiesInput = Record.makeRecordFromClassName(PropertiesInput.THICK_CLASS, this.getRecord().getRecordOwner());
((PropertiesInputModel)recPropertiesInput).setPropertiesField(this);
screenField = recPropertiesInput.makeScreen(itsLocation, targetScreen, iDisplayFieldDesc | ScreenConstants.DISPLAY_MODE, this.getMapKeyDescriptions());
boolean bAllowAppending = (this.getMapKeyDescriptions() == null);
((GridScreenParent)screenField).setAppending(bAllowAppending);
this.addListener(new SyncFieldToPropertiesRecord(recPropertiesInput));
recPropertiesInput.addListener(new SyncPropertiesRecordToField(this));
// No need to add FreeOnFree Handler, since PropertiesInput is owned by the new screen
ScreenLoc descLocation = targetScreen.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR);
String strDisplay = converter.getFieldDesc();
if ((strDisplay != null) && (strDisplay.length() > 0))
{
properties = new HashMap<String,Object>();
properties.put(ScreenModel.DISPLAY_STRING, strDisplay);
createScreenComponent(ScreenModel.STATIC_STRING, descLocation, targetScreen, null, iDisplayFieldDesc, properties);
}
}
else
{
screenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
properties = new HashMap<String,Object>();
properties.put(ScreenModel.FIELD, this);
properties.put(ScreenModel.COMMAND, ScreenModel.EDIT);
properties.put(ScreenModel.IMAGE, ScreenModel.EDIT);
ScreenComponent sScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties);
sScreenField.setRequestFocusEnabled(false);
}
return screenField;
} | [
"public",
"ScreenComponent",
"setupDefaultView",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"Convert",
"converter",
",",
"int",
"iDisplayFieldDesc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"ScreenComp... | Set up the default screen control for this field.
@param itsLocation Location of this component on screen (ie., GridBagConstraint).
@param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
@param converter The converter to set the screenfield to.
@param iDisplayFieldDesc Display the label? (optional).
@return Return the component or ScreenField that is created for this field. | [
"Set",
"up",
"the",
"default",
"screen",
"control",
"for",
"this",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L307-L340 |
tweea/matrixjavalib-main-common | src/main/java/net/matrix/util/Collections3.java | Collections3.extractToList | public static List extractToList(final Collection collection, final String propertyName) {
List list = new ArrayList(collection.size());
try {
for (Object obj : collection) {
list.add(PropertyUtils.getProperty(obj, propertyName));
}
} catch (ReflectiveOperationException e) {
throw new ReflectionRuntimeException(e);
}
return list;
} | java | public static List extractToList(final Collection collection, final String propertyName) {
List list = new ArrayList(collection.size());
try {
for (Object obj : collection) {
list.add(PropertyUtils.getProperty(obj, propertyName));
}
} catch (ReflectiveOperationException e) {
throw new ReflectionRuntimeException(e);
}
return list;
} | [
"public",
"static",
"List",
"extractToList",
"(",
"final",
"Collection",
"collection",
",",
"final",
"String",
"propertyName",
")",
"{",
"List",
"list",
"=",
"new",
"ArrayList",
"(",
"collection",
".",
"size",
"(",
")",
")",
";",
"try",
"{",
"for",
"(",
... | 提取集合中的对象的一个属性(通过 Getter 函数),组合成 List。
@param collection
来源集合
@param propertyName
要提取的属性名
@return 属性列表 | [
"提取集合中的对象的一个属性(通过",
"Getter",
"函数),组合成",
"List。"
] | train | https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/util/Collections3.java#L63-L75 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java | PAbstractObject.getString | @Override
public final String getString(final String key) {
String result = optString(key);
if (result == null) {
throw new ObjectMissingException(this, key);
}
return result;
} | java | @Override
public final String getString(final String key) {
String result = optString(key);
if (result == null) {
throw new ObjectMissingException(this, key);
}
return result;
} | [
"@",
"Override",
"public",
"final",
"String",
"getString",
"(",
"final",
"String",
"key",
")",
"{",
"String",
"result",
"=",
"optString",
"(",
"key",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"ObjectMissingException",
"(",
"t... | Get a property as a string or throw an exception.
@param key the property name | [
"Get",
"a",
"property",
"as",
"a",
"string",
"or",
"throw",
"an",
"exception",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L24-L31 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.optionsAsync | public CompletableFuture<Object> optionsAsync(@DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> options(closure), getExecutor());
} | java | public CompletableFuture<Object> optionsAsync(@DelegatesTo(HttpConfig.class) final Closure closure) {
return CompletableFuture.supplyAsync(() -> options(closure), getExecutor());
} | [
"public",
"CompletableFuture",
"<",
"Object",
">",
"optionsAsync",
"(",
"@",
"DelegatesTo",
"(",
"HttpConfig",
".",
"class",
")",
"final",
"Closure",
"closure",
")",
"{",
"return",
"CompletableFuture",
".",
"supplyAsync",
"(",
"(",
")",
"->",
"options",
"(",
... | Executes an asynchronous OPTIONS request on the configured URI (asynchronous alias to the `options(Closure)` method), with additional configuration
provided by the configuration closure.
[source,groovy]
----
def http = HttpBuilder.configure {
request.uri = 'http://localhost:10101'
}
http.optionsAsync(){
request.uri.path = '/something'
}
----
The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface.
The response will not contain content unless the `response.when()` method closure provides it based on the response headers.
@param closure the additional configuration closure (delegated to {@link HttpConfig})
@return the resulting content | [
"Executes",
"an",
"asynchronous",
"OPTIONS",
"request",
"on",
"the",
"configured",
"URI",
"(",
"asynchronous",
"alias",
"to",
"the",
"options",
"(",
"Closure",
")",
"method",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configuration",
"... | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1902-L1904 |
infinispan/infinispan | core/src/main/java/org/infinispan/container/offheap/OffHeapConcurrentMap.java | OffHeapConcurrentMap.performGet | private long performGet(long bucketHeadAddress, WrappedBytes k) {
long address = bucketHeadAddress;
while (address != 0) {
long nextAddress = offHeapEntryFactory.getNext(address);
if (offHeapEntryFactory.equalsKey(address, k)) {
break;
} else {
address = nextAddress;
}
}
return address;
} | java | private long performGet(long bucketHeadAddress, WrappedBytes k) {
long address = bucketHeadAddress;
while (address != 0) {
long nextAddress = offHeapEntryFactory.getNext(address);
if (offHeapEntryFactory.equalsKey(address, k)) {
break;
} else {
address = nextAddress;
}
}
return address;
} | [
"private",
"long",
"performGet",
"(",
"long",
"bucketHeadAddress",
",",
"WrappedBytes",
"k",
")",
"{",
"long",
"address",
"=",
"bucketHeadAddress",
";",
"while",
"(",
"address",
"!=",
"0",
")",
"{",
"long",
"nextAddress",
"=",
"offHeapEntryFactory",
".",
"getN... | Gets the actual address for the given key in the given bucket or 0 if it isn't present or expired
@param bucketHeadAddress the starting address of the address hash
@param k the key to retrieve the address for it if matches
@return the address matching the key or 0 | [
"Gets",
"the",
"actual",
"address",
"for",
"the",
"given",
"key",
"in",
"the",
"given",
"bucket",
"or",
"0",
"if",
"it",
"isn",
"t",
"present",
"or",
"expired"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/container/offheap/OffHeapConcurrentMap.java#L291-L302 |
forge/core | maven/impl-projects/src/main/java/org/jboss/forge/addon/maven/projects/util/NativeSystemCall.java | NativeSystemCall.execFromPath | public static int execFromPath(final String command, final String[] parms, final OutputStream out,
final DirectoryResource path) throws IOException
{
Assert.notNull(command, "Command must not be null.");
Assert.notNull(path, "Directory path must not be null.");
Assert.notNull(out, "OutputStream must not be null.");
try
{
String[] commandTokens = parms == null ? new String[1] : new String[parms.length + 1];
commandTokens[0] = command;
if (commandTokens.length > 1)
{
System.arraycopy(parms, 0, commandTokens, 1, parms.length);
}
ProcessBuilder builder = new ProcessBuilder(commandTokens);
builder.directory(path.getUnderlyingResourceObject());
builder.redirectErrorStream(true);
Process p = builder.start();
InputStream stdout = p.getInputStream();
Thread outThread = new Thread(new Receiver(stdout, out));
outThread.start();
outThread.join();
return p.waitFor();
}
catch (InterruptedException e)
{
e.printStackTrace();
return -1;
}
} | java | public static int execFromPath(final String command, final String[] parms, final OutputStream out,
final DirectoryResource path) throws IOException
{
Assert.notNull(command, "Command must not be null.");
Assert.notNull(path, "Directory path must not be null.");
Assert.notNull(out, "OutputStream must not be null.");
try
{
String[] commandTokens = parms == null ? new String[1] : new String[parms.length + 1];
commandTokens[0] = command;
if (commandTokens.length > 1)
{
System.arraycopy(parms, 0, commandTokens, 1, parms.length);
}
ProcessBuilder builder = new ProcessBuilder(commandTokens);
builder.directory(path.getUnderlyingResourceObject());
builder.redirectErrorStream(true);
Process p = builder.start();
InputStream stdout = p.getInputStream();
Thread outThread = new Thread(new Receiver(stdout, out));
outThread.start();
outThread.join();
return p.waitFor();
}
catch (InterruptedException e)
{
e.printStackTrace();
return -1;
}
} | [
"public",
"static",
"int",
"execFromPath",
"(",
"final",
"String",
"command",
",",
"final",
"String",
"[",
"]",
"parms",
",",
"final",
"OutputStream",
"out",
",",
"final",
"DirectoryResource",
"path",
")",
"throws",
"IOException",
"{",
"Assert",
".",
"notNull"... | Execute a native system command as if it were run from the given path.
@param command the system command to execute
@param parms the command parameters
@param out a print writer to which command output will be streamed
@param path the path from which to execute the command
@return 0 on successful completion, any other return code denotes failure | [
"Execute",
"a",
"native",
"system",
"command",
"as",
"if",
"it",
"were",
"run",
"from",
"the",
"given",
"path",
"."
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/maven/impl-projects/src/main/java/org/jboss/forge/addon/maven/projects/util/NativeSystemCall.java#L34-L69 |
haifengl/smile | interpolation/src/main/java/smile/interpolation/CubicSplineInterpolation1D.java | CubicSplineInterpolation1D.sety2 | private void sety2(double[] x, double[] y) {
double p, qn, sig, un;
double[] u = new double[n - 1];
y2[0] = u[0] = 0.0;
for (int i = 1; i < n - 1; i++) {
sig = (x[i] - x[i - 1]) / (x[i + 1] - x[i - 1]);
p = sig * y2[i - 1] + 2.0;
y2[i] = (sig - 1.0) / p;
u[i] = (y[i + 1] - y[i]) / (x[i + 1] - x[i]) - (y[i] - y[i - 1]) / (x[i] - x[i - 1]);
u[i] = (6.0 * u[i] / (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p;
}
qn = un = 0.0;
y2[n - 1] = (un - qn * u[n - 2]) / (qn * y2[n - 2] + 1.0);
for (int k = n - 2; k >= 0; k--) {
y2[k] = y2[k] * y2[k + 1] + u[k];
}
} | java | private void sety2(double[] x, double[] y) {
double p, qn, sig, un;
double[] u = new double[n - 1];
y2[0] = u[0] = 0.0;
for (int i = 1; i < n - 1; i++) {
sig = (x[i] - x[i - 1]) / (x[i + 1] - x[i - 1]);
p = sig * y2[i - 1] + 2.0;
y2[i] = (sig - 1.0) / p;
u[i] = (y[i + 1] - y[i]) / (x[i + 1] - x[i]) - (y[i] - y[i - 1]) / (x[i] - x[i - 1]);
u[i] = (6.0 * u[i] / (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p;
}
qn = un = 0.0;
y2[n - 1] = (un - qn * u[n - 2]) / (qn * y2[n - 2] + 1.0);
for (int k = n - 2; k >= 0; k--) {
y2[k] = y2[k] * y2[k + 1] + u[k];
}
} | [
"private",
"void",
"sety2",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"double",
"p",
",",
"qn",
",",
"sig",
",",
"un",
";",
"double",
"[",
"]",
"u",
"=",
"new",
"double",
"[",
"n",
"-",
"1",
"]",
";",
"y2",
"[",
... | Calculate the second derivatives of the interpolating function at the
tabulated points. At the endpoints, we use a natural spline
with zero second derivative on that boundary. | [
"Calculate",
"the",
"second",
"derivatives",
"of",
"the",
"interpolating",
"function",
"at",
"the",
"tabulated",
"points",
".",
"At",
"the",
"endpoints",
"we",
"use",
"a",
"natural",
"spline",
"with",
"zero",
"second",
"derivative",
"on",
"that",
"boundary",
"... | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/interpolation/src/main/java/smile/interpolation/CubicSplineInterpolation1D.java#L73-L92 |
BlueBrain/bluima | modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java | diff_match_patch.diff_main | public LinkedList<Diff> diff_main(String text1, String text2,
boolean checklines) {
// Set a deadline by which time the diff must be complete.
long deadline;
if (Diff_Timeout <= 0) {
deadline = Long.MAX_VALUE;
} else {
deadline = System.currentTimeMillis()
+ (long) (Diff_Timeout * 1000);
}
return diff_main(text1, text2, checklines, deadline);
} | java | public LinkedList<Diff> diff_main(String text1, String text2,
boolean checklines) {
// Set a deadline by which time the diff must be complete.
long deadline;
if (Diff_Timeout <= 0) {
deadline = Long.MAX_VALUE;
} else {
deadline = System.currentTimeMillis()
+ (long) (Diff_Timeout * 1000);
}
return diff_main(text1, text2, checklines, deadline);
} | [
"public",
"LinkedList",
"<",
"Diff",
">",
"diff_main",
"(",
"String",
"text1",
",",
"String",
"text2",
",",
"boolean",
"checklines",
")",
"{",
"// Set a deadline by which time the diff must be complete.",
"long",
"deadline",
";",
"if",
"(",
"Diff_Timeout",
"<=",
"0"... | Find the differences between two texts.
@param text1
Old string to be diffed.
@param text2
New string to be diffed.
@param checklines
Speedup flag. If false, then don't run a line-level diff first
to identify the changed areas. If true, then run a faster
slightly less optimal diff.
@return Linked List of Diff objects. | [
"Find",
"the",
"differences",
"between",
"two",
"texts",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java#L147-L158 |
EMCECS/nfs-client-java | src/main/java/com/emc/ecs/nfsclient/network/NetMgr.java | NetMgr.sendAndWait | public Xdr sendAndWait(String serverIP, int port, boolean usePrivilegedPort, Xdr xdrRequest, int timeout) throws RpcException {
InetSocketAddress key = InetSocketAddress.createUnresolved(serverIP, port);
Map<InetSocketAddress, Connection> connectionMap = usePrivilegedPort ? _privilegedConnectionMap : _connectionMap;
Connection connection = connectionMap.get(key);
if (connection == null) {
connection = new Connection(serverIP, port, usePrivilegedPort);
connectionMap.put(key, connection);
connection.connect();
}
return connection.sendAndWait(timeout, xdrRequest);
} | java | public Xdr sendAndWait(String serverIP, int port, boolean usePrivilegedPort, Xdr xdrRequest, int timeout) throws RpcException {
InetSocketAddress key = InetSocketAddress.createUnresolved(serverIP, port);
Map<InetSocketAddress, Connection> connectionMap = usePrivilegedPort ? _privilegedConnectionMap : _connectionMap;
Connection connection = connectionMap.get(key);
if (connection == null) {
connection = new Connection(serverIP, port, usePrivilegedPort);
connectionMap.put(key, connection);
connection.connect();
}
return connection.sendAndWait(timeout, xdrRequest);
} | [
"public",
"Xdr",
"sendAndWait",
"(",
"String",
"serverIP",
",",
"int",
"port",
",",
"boolean",
"usePrivilegedPort",
",",
"Xdr",
"xdrRequest",
",",
"int",
"timeout",
")",
"throws",
"RpcException",
"{",
"InetSocketAddress",
"key",
"=",
"InetSocketAddress",
".",
"c... | Basic RPC call functionality only. Send the request, creating a new
connection as necessary, and return the raw Xdr returned.
@param serverIP
The endpoint of the server being called.
@param port
The remote host port being called for this operation.
@param usePrivilegedPort
<ul>
<li>If <code>true</code>, use a privileged local port (below
1024) for RPC communication.</li>
<li>If <code>false</code>, use any non-privileged local port
for RPC communication.</li>
</ul>
@param xdrRequest
The Xdr data for the request.
@param timeout
The timeout in seconds.
@return The Xdr data for the response.
@throws RpcException | [
"Basic",
"RPC",
"call",
"functionality",
"only",
".",
"Send",
"the",
"request",
"creating",
"a",
"new",
"connection",
"as",
"necessary",
"and",
"return",
"the",
"raw",
"Xdr",
"returned",
"."
] | train | https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/network/NetMgr.java#L117-L129 |
MenoData/Time4J | base/src/main/java/net/time4j/clock/NetTimeConnector.java | NetTimeConnector.connect | public final void connect() throws IOException {
try {
Moment moment = this.doConnect();
long localMicros = SystemClock.MONOTONIC.realTimeInMicros();
final ConnectionResult cr = this.result;
long currentOffset = (
(cr == null)
? Long.MIN_VALUE : cr.getActualOffset(localMicros));
this.result =
new ConnectionResult(
moment,
localMicros,
currentOffset,
this.getNetTimeConfiguration().getClockShiftWindow()
);
} catch (ParseException pe) {
throw new IOException("Cannot read server reply.", pe);
}
} | java | public final void connect() throws IOException {
try {
Moment moment = this.doConnect();
long localMicros = SystemClock.MONOTONIC.realTimeInMicros();
final ConnectionResult cr = this.result;
long currentOffset = (
(cr == null)
? Long.MIN_VALUE : cr.getActualOffset(localMicros));
this.result =
new ConnectionResult(
moment,
localMicros,
currentOffset,
this.getNetTimeConfiguration().getClockShiftWindow()
);
} catch (ParseException pe) {
throw new IOException("Cannot read server reply.", pe);
}
} | [
"public",
"final",
"void",
"connect",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Moment",
"moment",
"=",
"this",
".",
"doConnect",
"(",
")",
";",
"long",
"localMicros",
"=",
"SystemClock",
".",
"MONOTONIC",
".",
"realTimeInMicros",
"(",
")",
";",... | /*[deutsch]
<p>Fragt einen Server nach der aktuellen Uhrzeit ab. </p>
<p>Das Ergebnis kann dann mit Hilfe der Methode {@code currentTime()}
abgelesen werden, welche auf dem durch die letzte Abfrage gewonnenen
Netzwerk-Offset basiert. Somit findet eine Verbindung zum Server nur
hier und nicht in der besagten Zeitermittlungsmethode statt. </p>
@throws IOException bei Verbindungsfehlern oder inkonsistenten Antworten
@see #currentTime() | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Fragt",
"einen",
"Server",
"nach",
"der",
"aktuellen",
"Uhrzeit",
"ab",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/clock/NetTimeConnector.java#L210-L231 |
awltech/org.parallelj | parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/util/Classes.java | Classes.findField | public static Field findField(Class<?> type, String name) {
while (type != null) {
for (Field field : type.getDeclaredFields()) {
if (field.getName().equals(name)) {
return field;
}
}
type = type.getSuperclass();
}
return null;
} | java | public static Field findField(Class<?> type, String name) {
while (type != null) {
for (Field field : type.getDeclaredFields()) {
if (field.getName().equals(name)) {
return field;
}
}
type = type.getSuperclass();
}
return null;
} | [
"public",
"static",
"Field",
"findField",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"name",
")",
"{",
"while",
"(",
"type",
"!=",
"null",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"type",
".",
"getDeclaredFields",
"(",
")",
")",
"{",
"... | Find a field in a class (and its ancestors) with a given name.
@param type
the class
@param name
the name
@return the field. <code>null</code> if not found. | [
"Find",
"a",
"field",
"in",
"a",
"class",
"(",
"and",
"its",
"ancestors",
")",
"with",
"a",
"given",
"name",
"."
] | train | https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/util/Classes.java#L78-L88 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java | DiagnosticsInner.listSiteDiagnosticCategoriesSlotWithServiceResponseAsync | public Observable<ServiceResponse<Page<DiagnosticCategoryInner>>> listSiteDiagnosticCategoriesSlotWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String slot) {
return listSiteDiagnosticCategoriesSlotSinglePageAsync(resourceGroupName, siteName, slot)
.concatMap(new Func1<ServiceResponse<Page<DiagnosticCategoryInner>>, Observable<ServiceResponse<Page<DiagnosticCategoryInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DiagnosticCategoryInner>>> call(ServiceResponse<Page<DiagnosticCategoryInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listSiteDiagnosticCategoriesSlotNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<DiagnosticCategoryInner>>> listSiteDiagnosticCategoriesSlotWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String slot) {
return listSiteDiagnosticCategoriesSlotSinglePageAsync(resourceGroupName, siteName, slot)
.concatMap(new Func1<ServiceResponse<Page<DiagnosticCategoryInner>>, Observable<ServiceResponse<Page<DiagnosticCategoryInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DiagnosticCategoryInner>>> call(ServiceResponse<Page<DiagnosticCategoryInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listSiteDiagnosticCategoriesSlotNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DiagnosticCategoryInner",
">",
">",
">",
"listSiteDiagnosticCategoriesSlotWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"siteName",
",",
"final",
"String",... | Get Diagnostics Categories.
Get Diagnostics Categories.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param slot Slot Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DiagnosticCategoryInner> object | [
"Get",
"Diagnostics",
"Categories",
".",
"Get",
"Diagnostics",
"Categories",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1412-L1424 |
LearnLib/learnlib | algorithms/active/ttt-vpda/src/main/java/de/learnlib/algorithms/ttt/vpda/TTTLearnerVPDA.java | TTTLearnerVPDA.finalizeDiscriminator | private void finalizeDiscriminator(DTNode<I> blockRoot, Splitter<I> splitter) {
assert blockRoot.isBlockRoot();
ContextPair<I> newDiscr = splitter.getNewDiscriminator();
if (!blockRoot.getDiscriminator().equals(newDiscr)) {
ContextPair<I> finalDiscriminator = prepareSplit(blockRoot, splitter);
Map<Boolean, DTNode<I>> repChildren = new HashMap<>();
for (Boolean label : blockRoot.getSplitData().getLabels()) {
repChildren.put(label, extractSubtree(blockRoot, label));
}
blockRoot.replaceChildren(repChildren);
blockRoot.setDiscriminator(finalDiscriminator);
} else {
LOGGER.debug("Weird..");
}
declareFinal(blockRoot);
} | java | private void finalizeDiscriminator(DTNode<I> blockRoot, Splitter<I> splitter) {
assert blockRoot.isBlockRoot();
ContextPair<I> newDiscr = splitter.getNewDiscriminator();
if (!blockRoot.getDiscriminator().equals(newDiscr)) {
ContextPair<I> finalDiscriminator = prepareSplit(blockRoot, splitter);
Map<Boolean, DTNode<I>> repChildren = new HashMap<>();
for (Boolean label : blockRoot.getSplitData().getLabels()) {
repChildren.put(label, extractSubtree(blockRoot, label));
}
blockRoot.replaceChildren(repChildren);
blockRoot.setDiscriminator(finalDiscriminator);
} else {
LOGGER.debug("Weird..");
}
declareFinal(blockRoot);
} | [
"private",
"void",
"finalizeDiscriminator",
"(",
"DTNode",
"<",
"I",
">",
"blockRoot",
",",
"Splitter",
"<",
"I",
">",
"splitter",
")",
"{",
"assert",
"blockRoot",
".",
"isBlockRoot",
"(",
")",
";",
"ContextPair",
"<",
"I",
">",
"newDiscr",
"=",
"splitter"... | Finalize a discriminator. Given a block root and a {@link Splitter}, replace the discriminator at the block root
by the one derived from the splitter, and update the discrimination tree accordingly.
@param blockRoot
the block root whose discriminator to finalize
@param splitter
the splitter to use for finalization | [
"Finalize",
"a",
"discriminator",
".",
"Given",
"a",
"block",
"root",
"and",
"a",
"{",
"@link",
"Splitter",
"}",
"replace",
"the",
"discriminator",
"at",
"the",
"block",
"root",
"by",
"the",
"one",
"derived",
"from",
"the",
"splitter",
"and",
"update",
"th... | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/ttt-vpda/src/main/java/de/learnlib/algorithms/ttt/vpda/TTTLearnerVPDA.java#L299-L318 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/DefaultPushNotificationMessage.java | DefaultPushNotificationMessage.withData | public DefaultPushNotificationMessage withData(java.util.Map<String, String> data) {
setData(data);
return this;
} | java | public DefaultPushNotificationMessage withData(java.util.Map<String, String> data) {
setData(data);
return this;
} | [
"public",
"DefaultPushNotificationMessage",
"withData",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"{",
"setData",
"(",
"data",
")",
";",
"return",
"this",
";",
"}"
] | The data payload used for a silent push. This payload is added to the notifications' data.pinpoint.jsonBody'
object
@param data
The data payload used for a silent push. This payload is added to the notifications'
data.pinpoint.jsonBody' object
@return Returns a reference to this object so that method calls can be chained together. | [
"The",
"data",
"payload",
"used",
"for",
"a",
"silent",
"push",
".",
"This",
"payload",
"is",
"added",
"to",
"the",
"notifications",
"data",
".",
"pinpoint",
".",
"jsonBody",
"object"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/DefaultPushNotificationMessage.java#L228-L231 |
code4everything/util | src/main/java/com/zhazhapan/util/common/interceptor/ToStringMethodInterceptor.java | ToStringMethodInterceptor.intercept | @Override
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
return methodProxy.invokeSuper(o, objects);
} | java | @Override
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
return methodProxy.invokeSuper(o, objects);
} | [
"@",
"Override",
"public",
"Object",
"intercept",
"(",
"Object",
"o",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"objects",
",",
"MethodProxy",
"methodProxy",
")",
"throws",
"Throwable",
"{",
"return",
"methodProxy",
".",
"invokeSuper",
"(",
"o",
",",... | 此方法实现了cglib的动态代理
@param o {@link Object}
@param method {@link Method}
@param objects {@link Object[]}
@param methodProxy {@link MethodProxy}
@return {@link Object}
@throws Throwable 异常 | [
"此方法实现了cglib的动态代理"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/common/interceptor/ToStringMethodInterceptor.java#L29-L32 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/stats/JMStats.java | JMStats.roundWithPlace | public static double roundWithPlace(double doubleNumber, int place) {
double pow = pow(10, place);
return Math.round(doubleNumber / pow) * pow;
} | java | public static double roundWithPlace(double doubleNumber, int place) {
double pow = pow(10, place);
return Math.round(doubleNumber / pow) * pow;
} | [
"public",
"static",
"double",
"roundWithPlace",
"(",
"double",
"doubleNumber",
",",
"int",
"place",
")",
"{",
"double",
"pow",
"=",
"pow",
"(",
"10",
",",
"place",
")",
";",
"return",
"Math",
".",
"round",
"(",
"doubleNumber",
"/",
"pow",
")",
"*",
"po... | Round with place double.
@param doubleNumber the double number
@param place the place
@return the double | [
"Round",
"with",
"place",
"double",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L269-L273 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetMethodResult.java | GetMethodResult.withRequestModels | public GetMethodResult withRequestModels(java.util.Map<String, String> requestModels) {
setRequestModels(requestModels);
return this;
} | java | public GetMethodResult withRequestModels(java.util.Map<String, String> requestModels) {
setRequestModels(requestModels);
return this;
} | [
"public",
"GetMethodResult",
"withRequestModels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestModels",
")",
"{",
"setRequestModels",
"(",
"requestModels",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A key-value map specifying data schemas, represented by <a>Model</a> resources, (as the mapped value) of the
request payloads of given content types (as the mapping key).
</p>
@param requestModels
A key-value map specifying data schemas, represented by <a>Model</a> resources, (as the mapped value) of
the request payloads of given content types (as the mapping key).
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"key",
"-",
"value",
"map",
"specifying",
"data",
"schemas",
"represented",
"by",
"<a",
">",
"Model<",
"/",
"a",
">",
"resources",
"(",
"as",
"the",
"mapped",
"value",
")",
"of",
"the",
"request",
"payloads",
"of",
"given",
"content",
"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetMethodResult.java#L614-L617 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java | TreeUtil.findNode | public static Treenode findNode(Treeview tree, String path, boolean create, Class<? extends Treenode> clazz) {
return findNode(tree, path, create, clazz, MatchMode.CASE_INSENSITIVE);
} | java | public static Treenode findNode(Treeview tree, String path, boolean create, Class<? extends Treenode> clazz) {
return findNode(tree, path, create, clazz, MatchMode.CASE_INSENSITIVE);
} | [
"public",
"static",
"Treenode",
"findNode",
"(",
"Treeview",
"tree",
",",
"String",
"path",
",",
"boolean",
"create",
",",
"Class",
"<",
"?",
"extends",
"Treenode",
">",
"clazz",
")",
"{",
"return",
"findNode",
"(",
"tree",
",",
"path",
",",
"create",
",... | Returns the tree item associated with the specified \-delimited path.
@param tree Tree to search.
@param path \-delimited path to search. Search is not case sensitive.
@param create If true, tree nodes are created if they do not already exist.
@param clazz Class of Treenode to create.
@return The tree item corresponding to the specified path, or null if not found. | [
"Returns",
"the",
"tree",
"item",
"associated",
"with",
"the",
"specified",
"\\",
"-",
"delimited",
"path",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java#L76-L78 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/FileWatcher.java | FileWatcher.addWatcher | @Deprecated
public void addWatcher(Path file, Watcher watcher) {
addWatcher(file, (Listener) watcher);
} | java | @Deprecated
public void addWatcher(Path file, Watcher watcher) {
addWatcher(file, (Listener) watcher);
} | [
"@",
"Deprecated",
"public",
"void",
"addWatcher",
"(",
"Path",
"file",
",",
"Watcher",
"watcher",
")",
"{",
"addWatcher",
"(",
"file",
",",
"(",
"Listener",
")",
"watcher",
")",
";",
"}"
] | Start watching file path and notify watcher for updates on that file.
@param file The file path to watch.
@param watcher The watcher to be notified. | [
"Start",
"watching",
"file",
"path",
"and",
"notify",
"watcher",
"for",
"updates",
"on",
"that",
"file",
"."
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/FileWatcher.java#L187-L190 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/component/StringProcessChain.java | StringProcessChain.replacIgnoreCase | public StringProcessChain replacIgnoreCase(final String target, final String replacement) {
StringBuilder result = new StringBuilder();
String temp = source;
int indexOfIgnoreCase = 0;
while (true) {
indexOfIgnoreCase = StringUtils.indexOfIgnoreCase(temp, target);
if (indexOfIgnoreCase == StringUtils.INDEX_OF_NOT_FOUND) {
result.append(temp);
break;
}
result.append(temp.substring(0, indexOfIgnoreCase));
result.append(replacement);
temp = temp.substring(indexOfIgnoreCase + target.length());
}
source = result.toString();
return this;
} | java | public StringProcessChain replacIgnoreCase(final String target, final String replacement) {
StringBuilder result = new StringBuilder();
String temp = source;
int indexOfIgnoreCase = 0;
while (true) {
indexOfIgnoreCase = StringUtils.indexOfIgnoreCase(temp, target);
if (indexOfIgnoreCase == StringUtils.INDEX_OF_NOT_FOUND) {
result.append(temp);
break;
}
result.append(temp.substring(0, indexOfIgnoreCase));
result.append(replacement);
temp = temp.substring(indexOfIgnoreCase + target.length());
}
source = result.toString();
return this;
} | [
"public",
"StringProcessChain",
"replacIgnoreCase",
"(",
"final",
"String",
"target",
",",
"final",
"String",
"replacement",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"temp",
"=",
"source",
";",
"int",
"indexOfIgn... | Replaces each substring of given source string that matches the given
regular expression ignore case sensitive with the given replacement.<br>
@param target target string want to be replaces.
@param replacement string of replace to.
@return a new string has been replaced each substring of given source
string that matches the given regular expression ignore case
sensitive with the given replacement. | [
"Replaces",
"each",
"substring",
"of",
"given",
"source",
"string",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"ignore",
"case",
"sensitive",
"with",
"the",
"given",
"replacement",
".",
"<br",
">"
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/component/StringProcessChain.java#L64-L81 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxAPIConnection.java | BoxAPIConnection.getAuthorizationURL | public static URL getAuthorizationURL(String clientID, URI redirectUri, String state, List<String> scopes) {
URLTemplate template = new URLTemplate(AUTHORIZATION_URL);
QueryStringBuilder queryBuilder = new QueryStringBuilder().appendParam("client_id", clientID)
.appendParam("response_type", "code")
.appendParam("redirect_uri", redirectUri.toString())
.appendParam("state", state);
if (scopes != null && !scopes.isEmpty()) {
StringBuilder builder = new StringBuilder();
int size = scopes.size() - 1;
int i = 0;
while (i < size) {
builder.append(scopes.get(i));
builder.append(" ");
i++;
}
builder.append(scopes.get(i));
queryBuilder.appendParam("scope", builder.toString());
}
return template.buildWithQuery("", queryBuilder.toString());
} | java | public static URL getAuthorizationURL(String clientID, URI redirectUri, String state, List<String> scopes) {
URLTemplate template = new URLTemplate(AUTHORIZATION_URL);
QueryStringBuilder queryBuilder = new QueryStringBuilder().appendParam("client_id", clientID)
.appendParam("response_type", "code")
.appendParam("redirect_uri", redirectUri.toString())
.appendParam("state", state);
if (scopes != null && !scopes.isEmpty()) {
StringBuilder builder = new StringBuilder();
int size = scopes.size() - 1;
int i = 0;
while (i < size) {
builder.append(scopes.get(i));
builder.append(" ");
i++;
}
builder.append(scopes.get(i));
queryBuilder.appendParam("scope", builder.toString());
}
return template.buildWithQuery("", queryBuilder.toString());
} | [
"public",
"static",
"URL",
"getAuthorizationURL",
"(",
"String",
"clientID",
",",
"URI",
"redirectUri",
",",
"String",
"state",
",",
"List",
"<",
"String",
">",
"scopes",
")",
"{",
"URLTemplate",
"template",
"=",
"new",
"URLTemplate",
"(",
"AUTHORIZATION_URL",
... | Return the authorization URL which is used to perform the authorization_code based OAuth2 flow.
@param clientID the client ID to use with the connection.
@param redirectUri the URL to which Box redirects the browser when authentication completes.
@param state the text string that you choose.
Box sends the same string to your redirect URL when authentication is complete.
@param scopes this optional parameter identifies the Box scopes available
to the application once it's authenticated.
@return the authorization URL | [
"Return",
"the",
"authorization",
"URL",
"which",
"is",
"used",
"to",
"perform",
"the",
"authorization_code",
"based",
"OAuth2",
"flow",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxAPIConnection.java#L162-L184 |
overturetool/overture | ide/ui/src/main/java/org/overture/ide/ui/property/VdmBuildPathPropertyPage.java | VdmBuildPathPropertyPage.createPushButton | public static Button createPushButton(Composite parent, String label,
Image image)
{
Button button = new Button(parent, SWT.PUSH);
button.setFont(parent.getFont());
if (image != null)
{
button.setImage(image);
}
if (label != null)
{
button.setText(label);
}
GridData gd = new GridData();
button.setLayoutData(gd);
return button;
} | java | public static Button createPushButton(Composite parent, String label,
Image image)
{
Button button = new Button(parent, SWT.PUSH);
button.setFont(parent.getFont());
if (image != null)
{
button.setImage(image);
}
if (label != null)
{
button.setText(label);
}
GridData gd = new GridData();
button.setLayoutData(gd);
return button;
} | [
"public",
"static",
"Button",
"createPushButton",
"(",
"Composite",
"parent",
",",
"String",
"label",
",",
"Image",
"image",
")",
"{",
"Button",
"button",
"=",
"new",
"Button",
"(",
"parent",
",",
"SWT",
".",
"PUSH",
")",
";",
"button",
".",
"setFont",
"... | Creates and returns a new push button with the given label and/or image.
@param parent
parent control
@param label
button label or <code>null</code>
@param image
image of <code>null</code>
@return a new push button | [
"Creates",
"and",
"returns",
"a",
"new",
"push",
"button",
"with",
"the",
"given",
"label",
"and",
"/",
"or",
"image",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/property/VdmBuildPathPropertyPage.java#L284-L301 |
ggrandes/packer | src/main/java/org/javastack/packer/Packer.java | Packer.useHMAC | public Packer useHMAC(final String hMacAlg, final String passphrase) throws NoSuchAlgorithmException,
InvalidKeyException {
hMac = Mac.getInstance(hMacAlg); // "HmacSHA256"
hMac.init(new SecretKeySpec(passphrase.getBytes(charsetUTF8), hMacAlg));
return this;
} | java | public Packer useHMAC(final String hMacAlg, final String passphrase) throws NoSuchAlgorithmException,
InvalidKeyException {
hMac = Mac.getInstance(hMacAlg); // "HmacSHA256"
hMac.init(new SecretKeySpec(passphrase.getBytes(charsetUTF8), hMacAlg));
return this;
} | [
"public",
"Packer",
"useHMAC",
"(",
"final",
"String",
"hMacAlg",
",",
"final",
"String",
"passphrase",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
"{",
"hMac",
"=",
"Mac",
".",
"getInstance",
"(",
"hMacAlg",
")",
";",
"// \"HmacSHA256\"... | Sets the usage of Hash-MAC for authentication (default no)
@param hMacAlg
HMAC algorithm (HmacSHA1, HmacSHA256,...)
@param passphrase
shared secret
@return
@throws NoSuchAlgorithmException
@throws InvalidKeyException
@see {@link javax.crypto.Mac#getInstance(String)}
@see <a
href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunJCEProvider">JCE
Provider</a> | [
"Sets",
"the",
"usage",
"of",
"Hash",
"-",
"MAC",
"for",
"authentication",
"(",
"default",
"no",
")"
] | train | https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L300-L305 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.putAndEncrypt | public JsonObject putAndEncrypt(final String name, final Object value, String providerName) {
addValueEncryptionInfo(name, providerName, true);
if (this == value) {
throw new IllegalArgumentException("Cannot put self");
} else if (value == JsonValue.NULL) {
putNull(name);
} else if (checkType(value)) {
content.put(name, value);
} else {
throw new IllegalArgumentException("Unsupported type for JsonObject: " + value.getClass());
}
return this;
} | java | public JsonObject putAndEncrypt(final String name, final Object value, String providerName) {
addValueEncryptionInfo(name, providerName, true);
if (this == value) {
throw new IllegalArgumentException("Cannot put self");
} else if (value == JsonValue.NULL) {
putNull(name);
} else if (checkType(value)) {
content.put(name, value);
} else {
throw new IllegalArgumentException("Unsupported type for JsonObject: " + value.getClass());
}
return this;
} | [
"public",
"JsonObject",
"putAndEncrypt",
"(",
"final",
"String",
"name",
",",
"final",
"Object",
"value",
",",
"String",
"providerName",
")",
"{",
"addValueEncryptionInfo",
"(",
"name",
",",
"providerName",
",",
"true",
")",
";",
"if",
"(",
"this",
"==",
"va... | Stores the {@link Object} value as encrypted identified by the field name.
Note that the value is checked and a {@link IllegalArgumentException} is thrown if not supported.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchbase is
subject to the Couchbase Inc. Enterprise Subscription License Agreement
at https://www.couchbase.com/ESLA-11132015.
@param name the name of the JSON field.
@param value the value of the JSON field.
@param providerName Crypto provider name for encryption.
@return the {@link JsonObject}. | [
"Stores",
"the",
"{",
"@link",
"Object",
"}",
"value",
"as",
"encrypted",
"identified",
"by",
"the",
"field",
"name",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L231-L243 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java | JsonUtil.getObject | public static JsonObject getObject(JsonObject object, String field) {
final JsonValue value = object.get(field);
throwExceptionIfNull(value, field);
return value.asObject();
} | java | public static JsonObject getObject(JsonObject object, String field) {
final JsonValue value = object.get(field);
throwExceptionIfNull(value, field);
return value.asObject();
} | [
"public",
"static",
"JsonObject",
"getObject",
"(",
"JsonObject",
"object",
",",
"String",
"field",
")",
"{",
"final",
"JsonValue",
"value",
"=",
"object",
".",
"get",
"(",
"field",
")",
";",
"throwExceptionIfNull",
"(",
"value",
",",
"field",
")",
";",
"r... | Returns a field in a Json object as an object.
Throws IllegalArgumentException if the field value is null.
@param object the Json object
@param field the field in the Json object to return
@return the Json field value as a Json object | [
"Returns",
"a",
"field",
"in",
"a",
"Json",
"object",
"as",
"an",
"object",
".",
"Throws",
"IllegalArgumentException",
"if",
"the",
"field",
"value",
"is",
"null",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L261-L265 |
alkacon/opencms-core | src/org/opencms/main/CmsSessionManager.java | CmsSessionManager.switchUserFromSession | public String switchUserFromSession(CmsObject cms, HttpServletRequest req, CmsUser user, CmsSessionInfo sessionInfo)
throws CmsException {
// only user with root administrator role are allowed to switch the user
OpenCms.getRoleManager().checkRole(cms, CmsRole.ADMINISTRATOR.forOrgUnit(user.getOuFqn()));
CmsSessionInfo info = getSessionInfo(req);
HttpSession session = req.getSession(false);
if ((info == null) || (session == null)) {
throw new CmsException(Messages.get().container(Messages.ERR_NO_SESSIONINFO_SESSION_0));
}
if (!OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ELEMENT_AUTHOR)) {
throw new CmsSecurityException(Messages.get().container(Messages.ERR_NO_WORKPLACE_PERMISSIONS_0));
}
// get the user settings for the given user and set the start project and the site root
CmsUserSettings settings = new CmsUserSettings(user);
String ouFqn = user.getOuFqn();
CmsProject userProject;
String userSiteRoot;
if (sessionInfo == null) {
userProject = cms.readProject(
ouFqn + OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartProject());
try {
userProject = cms.readProject(settings.getStartProject());
} catch (Exception e) {
// ignore, use default
}
CmsObject cloneCms = OpenCms.initCmsObject(cms, new CmsContextInfo(user.getName()));
userSiteRoot = CmsWorkplace.getStartSiteRoot(cloneCms, settings);
} else {
userProject = cms.readProject(sessionInfo.getProject());
userSiteRoot = sessionInfo.getSiteRoot();
}
CmsRequestContext context = new CmsRequestContext(
user,
userProject,
null,
cms.getRequestContext().getRequestMatcher(),
userSiteRoot,
cms.getRequestContext().isSecureRequest(),
null,
null,
null,
0,
null,
null,
ouFqn);
// delete the stored workplace settings, so the session has to receive them again
session.removeAttribute(CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
// create a new CmsSessionInfo and store it inside the session map
CmsSessionInfo newInfo = new CmsSessionInfo(context, info.getSessionId(), info.getMaxInactiveInterval());
addSessionInfo(newInfo);
// set the site root, project and ou fqn to current cms context
cms.getRequestContext().setSiteRoot(userSiteRoot);
cms.getRequestContext().setCurrentProject(userProject);
cms.getRequestContext().setOuFqn(user.getOuFqn());
String directEditTarget = CmsLoginHelper.getDirectEditPath(cms, new CmsUserSettings(user), false);
return directEditTarget != null
? OpenCms.getLinkManager().substituteLink(cms, directEditTarget, userSiteRoot)
: null;
} | java | public String switchUserFromSession(CmsObject cms, HttpServletRequest req, CmsUser user, CmsSessionInfo sessionInfo)
throws CmsException {
// only user with root administrator role are allowed to switch the user
OpenCms.getRoleManager().checkRole(cms, CmsRole.ADMINISTRATOR.forOrgUnit(user.getOuFqn()));
CmsSessionInfo info = getSessionInfo(req);
HttpSession session = req.getSession(false);
if ((info == null) || (session == null)) {
throw new CmsException(Messages.get().container(Messages.ERR_NO_SESSIONINFO_SESSION_0));
}
if (!OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ELEMENT_AUTHOR)) {
throw new CmsSecurityException(Messages.get().container(Messages.ERR_NO_WORKPLACE_PERMISSIONS_0));
}
// get the user settings for the given user and set the start project and the site root
CmsUserSettings settings = new CmsUserSettings(user);
String ouFqn = user.getOuFqn();
CmsProject userProject;
String userSiteRoot;
if (sessionInfo == null) {
userProject = cms.readProject(
ouFqn + OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartProject());
try {
userProject = cms.readProject(settings.getStartProject());
} catch (Exception e) {
// ignore, use default
}
CmsObject cloneCms = OpenCms.initCmsObject(cms, new CmsContextInfo(user.getName()));
userSiteRoot = CmsWorkplace.getStartSiteRoot(cloneCms, settings);
} else {
userProject = cms.readProject(sessionInfo.getProject());
userSiteRoot = sessionInfo.getSiteRoot();
}
CmsRequestContext context = new CmsRequestContext(
user,
userProject,
null,
cms.getRequestContext().getRequestMatcher(),
userSiteRoot,
cms.getRequestContext().isSecureRequest(),
null,
null,
null,
0,
null,
null,
ouFqn);
// delete the stored workplace settings, so the session has to receive them again
session.removeAttribute(CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
// create a new CmsSessionInfo and store it inside the session map
CmsSessionInfo newInfo = new CmsSessionInfo(context, info.getSessionId(), info.getMaxInactiveInterval());
addSessionInfo(newInfo);
// set the site root, project and ou fqn to current cms context
cms.getRequestContext().setSiteRoot(userSiteRoot);
cms.getRequestContext().setCurrentProject(userProject);
cms.getRequestContext().setOuFqn(user.getOuFqn());
String directEditTarget = CmsLoginHelper.getDirectEditPath(cms, new CmsUserSettings(user), false);
return directEditTarget != null
? OpenCms.getLinkManager().substituteLink(cms, directEditTarget, userSiteRoot)
: null;
} | [
"public",
"String",
"switchUserFromSession",
"(",
"CmsObject",
"cms",
",",
"HttpServletRequest",
"req",
",",
"CmsUser",
"user",
",",
"CmsSessionInfo",
"sessionInfo",
")",
"throws",
"CmsException",
"{",
"// only user with root administrator role are allowed to switch the user",
... | Switches the current user to the given user. The session info is rebuild as if the given user
performs a login at the workplace.
@param cms the current CmsObject
@param req the current request
@param user the user to switch to
@param sessionInfo to switch to a currently logged in user using the same session state
@return the direct edit target if available
@throws CmsException if something goes wrong | [
"Switches",
"the",
"current",
"user",
"to",
"the",
"given",
"user",
".",
"The",
"session",
"info",
"is",
"rebuild",
"as",
"if",
"the",
"given",
"user",
"performs",
"a",
"login",
"at",
"the",
"workplace",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSessionManager.java#L469-L535 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java | RedisInner.forceRebootAsync | public Observable<RedisForceRebootResponseInner> forceRebootAsync(String resourceGroupName, String name, RedisRebootParameters parameters) {
return forceRebootWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<RedisForceRebootResponseInner>, RedisForceRebootResponseInner>() {
@Override
public RedisForceRebootResponseInner call(ServiceResponse<RedisForceRebootResponseInner> response) {
return response.body();
}
});
} | java | public Observable<RedisForceRebootResponseInner> forceRebootAsync(String resourceGroupName, String name, RedisRebootParameters parameters) {
return forceRebootWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<RedisForceRebootResponseInner>, RedisForceRebootResponseInner>() {
@Override
public RedisForceRebootResponseInner call(ServiceResponse<RedisForceRebootResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RedisForceRebootResponseInner",
">",
"forceRebootAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"RedisRebootParameters",
"parameters",
")",
"{",
"return",
"forceRebootWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss.
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@param parameters Specifies which Redis node(s) to reboot.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RedisForceRebootResponseInner object | [
"Reboot",
"specified",
"Redis",
"node",
"(",
"s",
")",
".",
"This",
"operation",
"requires",
"write",
"permission",
"to",
"the",
"cache",
"resource",
".",
"There",
"can",
"be",
"potential",
"data",
"loss",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L1271-L1278 |
Domo42/saga-lib | saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/SagaLibModule.java | SagaLibModule.bindIfNotNull | private <T> void bindIfNotNull(final Class<T> interfaceType, @Nullable final Class<? extends T> implementationType, final Scope scope) {
if (implementationType != null) {
bind(interfaceType).to(implementationType).in(scope);
}
} | java | private <T> void bindIfNotNull(final Class<T> interfaceType, @Nullable final Class<? extends T> implementationType, final Scope scope) {
if (implementationType != null) {
bind(interfaceType).to(implementationType).in(scope);
}
} | [
"private",
"<",
"T",
">",
"void",
"bindIfNotNull",
"(",
"final",
"Class",
"<",
"T",
">",
"interfaceType",
",",
"@",
"Nullable",
"final",
"Class",
"<",
"?",
"extends",
"T",
">",
"implementationType",
",",
"final",
"Scope",
"scope",
")",
"{",
"if",
"(",
... | Perform binding to interface only if implementation type is not null. | [
"Perform",
"binding",
"to",
"interface",
"only",
"if",
"implementation",
"type",
"is",
"not",
"null",
"."
] | train | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/SagaLibModule.java#L164-L168 |
alkacon/opencms-core | src-setup/org/opencms/setup/ui/CmsSetupErrorDialog.java | CmsSetupErrorDialog.showErrorDialog | public static void showErrorDialog(String message, Throwable t, Runnable onClose) {
Window window = prepareWindow(DialogWidth.wide);
window.setCaption("Error");
window.setContent(
new CmsSetupErrorDialog(message, message + "\n\n" + ExceptionUtils.getStackTrace(t), onClose, window));
A_CmsUI.get().addWindow(window);
} | java | public static void showErrorDialog(String message, Throwable t, Runnable onClose) {
Window window = prepareWindow(DialogWidth.wide);
window.setCaption("Error");
window.setContent(
new CmsSetupErrorDialog(message, message + "\n\n" + ExceptionUtils.getStackTrace(t), onClose, window));
A_CmsUI.get().addWindow(window);
} | [
"public",
"static",
"void",
"showErrorDialog",
"(",
"String",
"message",
",",
"Throwable",
"t",
",",
"Runnable",
"onClose",
")",
"{",
"Window",
"window",
"=",
"prepareWindow",
"(",
"DialogWidth",
".",
"wide",
")",
";",
"window",
".",
"setCaption",
"(",
"\"Er... | Shows the error dialog.<p>
@param message the error message
@param t the error to be displayed
@param onClose executed on close | [
"Shows",
"the",
"error",
"dialog",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/CmsSetupErrorDialog.java#L181-L188 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.updateMediaResource | public UpdateMediaResourceResponse updateMediaResource(UpdateMediaResourceRequest request) {
InternalRequest internalRequest =
createRequest(HttpMethodName.PUT, request, PATH_MEDIA, request.getMediaId());
internalRequest.addParameter(PARA_ATTRIBUTES, null);
return invokeHttpClient(internalRequest, UpdateMediaResourceResponse.class);
} | java | public UpdateMediaResourceResponse updateMediaResource(UpdateMediaResourceRequest request) {
InternalRequest internalRequest =
createRequest(HttpMethodName.PUT, request, PATH_MEDIA, request.getMediaId());
internalRequest.addParameter(PARA_ATTRIBUTES, null);
return invokeHttpClient(internalRequest, UpdateMediaResourceResponse.class);
} | [
"public",
"UpdateMediaResourceResponse",
"updateMediaResource",
"(",
"UpdateMediaResourceRequest",
"request",
")",
"{",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"HttpMethodName",
".",
"PUT",
",",
"request",
",",
"PATH_MEDIA",
",",
"request",
".",
... | Update the title and description for the specific media resource managed by VOD service.
<p>
The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair.
@param request The request wrapper object containing all options.
@return empty response will be returned | [
"Update",
"the",
"title",
"and",
"description",
"for",
"the",
"specific",
"media",
"resource",
"managed",
"by",
"VOD",
"service",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L649-L655 |
micronaut-projects/micronaut-core | cli/src/main/groovy/io/micronaut/cli/io/support/AntPathMatcher.java | AntPathMatcher.extractPathWithinPattern | public String extractPathWithinPattern(String pattern, String path) {
String[] patternParts = tokenize(pattern);
String[] pathParts = tokenize(path);
StringBuilder builder = new StringBuilder();
// Add any path parts that have a wildcarded pattern part.
int puts = 0;
for (int i = 0; i < patternParts.length; i++) {
String patternPart = patternParts[i];
if ((patternPart.indexOf('*') > -1 || patternPart.indexOf('?') > -1) && pathParts.length >= i + 1) {
if (puts > 0 || (i == 0 && !pattern.startsWith(pathSeparator))) {
builder.append(pathSeparator);
}
builder.append(pathParts[i]);
puts++;
}
}
// Append any trailing path parts.
for (int i = patternParts.length; i < pathParts.length; i++) {
if (puts > 0 || i > 0) {
builder.append(pathSeparator);
}
builder.append(pathParts[i]);
}
return builder.toString();
} | java | public String extractPathWithinPattern(String pattern, String path) {
String[] patternParts = tokenize(pattern);
String[] pathParts = tokenize(path);
StringBuilder builder = new StringBuilder();
// Add any path parts that have a wildcarded pattern part.
int puts = 0;
for (int i = 0; i < patternParts.length; i++) {
String patternPart = patternParts[i];
if ((patternPart.indexOf('*') > -1 || patternPart.indexOf('?') > -1) && pathParts.length >= i + 1) {
if (puts > 0 || (i == 0 && !pattern.startsWith(pathSeparator))) {
builder.append(pathSeparator);
}
builder.append(pathParts[i]);
puts++;
}
}
// Append any trailing path parts.
for (int i = patternParts.length; i < pathParts.length; i++) {
if (puts > 0 || i > 0) {
builder.append(pathSeparator);
}
builder.append(pathParts[i]);
}
return builder.toString();
} | [
"public",
"String",
"extractPathWithinPattern",
"(",
"String",
"pattern",
",",
"String",
"path",
")",
"{",
"String",
"[",
"]",
"patternParts",
"=",
"tokenize",
"(",
"pattern",
")",
";",
"String",
"[",
"]",
"pathParts",
"=",
"tokenize",
"(",
"path",
")",
";... | Given a pattern and a full path, determine the pattern-mapped part. <p>For example: <ul>
<li>'<code>/docs/cvs/commit.html</code>' and '<code>/docs/cvs/commit.html</code> -> ''</li>
<li>'<code>/docs/*</code>' and '<code>/docs/cvs/commit</code> -> '<code>cvs/commit</code>'</li>
<li>'<code>/docs/cvs/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>commit.html</code>'</li>
<li>'<code>/docs/**</code>' and '<code>/docs/cvs/commit</code> -> '<code>cvs/commit</code>'</li>
<li>'<code>/docs/**\/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>cvs/commit.html</code>'</li>
<li>'<code>/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>docs/cvs/commit.html</code>'</li>
<li>'<code>*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>/docs/cvs/commit.html</code>'</li>
<li>'<code>*</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>/docs/cvs/commit.html</code>'</li> </ul>
<p>Assumes that {@link #match} returns <code>true</code> for '<code>pattern</code>' and '<code>path</code>', but
does <strong>not</strong> enforce this.
@param pattern The pattern
@param path The path
@return The pattern-mapped part | [
"Given",
"a",
"pattern",
"and",
"a",
"full",
"path",
"determine",
"the",
"pattern",
"-",
"mapped",
"part",
".",
"<p",
">",
"For",
"example",
":",
"<ul",
">",
"<li",
">",
"<code",
">",
"/",
"docs",
"/",
"cvs",
"/",
"commit",
".",
"html<",
"/",
"code... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/io/support/AntPathMatcher.java#L265-L293 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceAccess.java | SyntheticStorableReferenceAccess.isConsistent | public boolean isConsistent(Storable reference, S master) throws FetchException {
try {
return (Boolean) mIsConsistentMethod.invoke(reference, master);
} catch (Exception e) {
ThrowUnchecked.fireFirstDeclaredCause(e, FetchException.class);
// Not reached.
return false;
}
} | java | public boolean isConsistent(Storable reference, S master) throws FetchException {
try {
return (Boolean) mIsConsistentMethod.invoke(reference, master);
} catch (Exception e) {
ThrowUnchecked.fireFirstDeclaredCause(e, FetchException.class);
// Not reached.
return false;
}
} | [
"public",
"boolean",
"isConsistent",
"(",
"Storable",
"reference",
",",
"S",
"master",
")",
"throws",
"FetchException",
"{",
"try",
"{",
"return",
"(",
"Boolean",
")",
"mIsConsistentMethod",
".",
"invoke",
"(",
"reference",
",",
"master",
")",
";",
"}",
"cat... | Returns true if the properties of the given reference match those
contained in the master, excluding any version property. This will
always return true after a call to copyFromMaster.
@param reference reference whose properties will be tested
@param master source of property values | [
"Returns",
"true",
"if",
"the",
"properties",
"of",
"the",
"given",
"reference",
"match",
"those",
"contained",
"in",
"the",
"master",
"excluding",
"any",
"version",
"property",
".",
"This",
"will",
"always",
"return",
"true",
"after",
"a",
"call",
"to",
"co... | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceAccess.java#L144-L152 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ChunkedIntArray.java | ChunkedIntArray.writeEntry | void writeEntry(int position, int offset, int value) throws ArrayIndexOutOfBoundsException
{
/*
try
{
fastArray[( position*slotsize)+offset] = value;
}
catch(ArrayIndexOutOfBoundsException aioobe)
*/
{
if (offset >= slotsize)
throw new ArrayIndexOutOfBoundsException(XMLMessages.createXMLMessage(XMLErrorResources.ER_OFFSET_BIGGER_THAN_SLOT, null)); //"Offset bigger than slot");
position*=slotsize;
int chunkpos = position >> lowbits;
int slotpos = position & lowmask;
int[] chunk = chunks.elementAt(chunkpos);
chunk[slotpos + offset] = value; // ATOMIC!
}
} | java | void writeEntry(int position, int offset, int value) throws ArrayIndexOutOfBoundsException
{
/*
try
{
fastArray[( position*slotsize)+offset] = value;
}
catch(ArrayIndexOutOfBoundsException aioobe)
*/
{
if (offset >= slotsize)
throw new ArrayIndexOutOfBoundsException(XMLMessages.createXMLMessage(XMLErrorResources.ER_OFFSET_BIGGER_THAN_SLOT, null)); //"Offset bigger than slot");
position*=slotsize;
int chunkpos = position >> lowbits;
int slotpos = position & lowmask;
int[] chunk = chunks.elementAt(chunkpos);
chunk[slotpos + offset] = value; // ATOMIC!
}
} | [
"void",
"writeEntry",
"(",
"int",
"position",
",",
"int",
"offset",
",",
"int",
"value",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"/*\n try\n {\n fastArray[( position*slotsize)+offset] = value;\n }\n catch(ArrayIndexOutOfBoundsException aioobe)\n */",
... | Overwrite the integer found at a specific record and column.
Used to back-patch existing records, most often changing their
"next sibling" reference from 0 (unknown) to something meaningful
@param position int Record number
@param offset int Column number
@param value int New contents | [
"Overwrite",
"the",
"integer",
"found",
"at",
"a",
"specific",
"record",
"and",
"column",
".",
"Used",
"to",
"back",
"-",
"patch",
"existing",
"records",
"most",
"often",
"changing",
"their",
"next",
"sibling",
"reference",
"from",
"0",
"(",
"unknown",
")",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ChunkedIntArray.java#L192-L210 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java | AhoCorasickDoubleArrayTrie.load | public void load(ObjectInputStream in, V[] value) throws IOException, ClassNotFoundException
{
base = (int[]) in.readObject();
check = (int[]) in.readObject();
fail = (int[]) in.readObject();
output = (int[][]) in.readObject();
l = (int[]) in.readObject();
v = value;
} | java | public void load(ObjectInputStream in, V[] value) throws IOException, ClassNotFoundException
{
base = (int[]) in.readObject();
check = (int[]) in.readObject();
fail = (int[]) in.readObject();
output = (int[][]) in.readObject();
l = (int[]) in.readObject();
v = value;
} | [
"public",
"void",
"load",
"(",
"ObjectInputStream",
"in",
",",
"V",
"[",
"]",
"value",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"base",
"=",
"(",
"int",
"[",
"]",
")",
"in",
".",
"readObject",
"(",
")",
";",
"check",
"=",
"(",
... | 载入
@param in 一个ObjectInputStream
@param value 值(持久化的时候并没有持久化值,现在需要额外提供)
@throws IOException
@throws ClassNotFoundException | [
"载入"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java#L230-L238 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/GroupPermissionDao.java | GroupPermissionDao.selectByGroupIds | public List<GroupPermissionDto> selectByGroupIds(DbSession dbSession, String organizationUuid, List<Integer> groupIds, @Nullable Long projectId) {
return executeLargeInputs(groupIds, groups -> mapper(dbSession).selectByGroupIds(organizationUuid, groups, projectId));
} | java | public List<GroupPermissionDto> selectByGroupIds(DbSession dbSession, String organizationUuid, List<Integer> groupIds, @Nullable Long projectId) {
return executeLargeInputs(groupIds, groups -> mapper(dbSession).selectByGroupIds(organizationUuid, groups, projectId));
} | [
"public",
"List",
"<",
"GroupPermissionDto",
">",
"selectByGroupIds",
"(",
"DbSession",
"dbSession",
",",
"String",
"organizationUuid",
",",
"List",
"<",
"Integer",
">",
"groupIds",
",",
"@",
"Nullable",
"Long",
"projectId",
")",
"{",
"return",
"executeLargeInputs... | Select global or project permission of given groups and organization. Anyone virtual group is supported
through the value "zero" (0L) in {@code groupIds}. | [
"Select",
"global",
"or",
"project",
"permission",
"of",
"given",
"groups",
"and",
"organization",
".",
"Anyone",
"virtual",
"group",
"is",
"supported",
"through",
"the",
"value",
"zero",
"(",
"0L",
")",
"in",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/GroupPermissionDao.java#L64-L66 |
netty/netty-tcnative | openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSL.java | SSL.setCipherSuites | @Deprecated
public static boolean setCipherSuites(long ssl, String ciphers)
throws Exception {
return setCipherSuites(ssl, ciphers, false);
} | java | @Deprecated
public static boolean setCipherSuites(long ssl, String ciphers)
throws Exception {
return setCipherSuites(ssl, ciphers, false);
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"setCipherSuites",
"(",
"long",
"ssl",
",",
"String",
"ciphers",
")",
"throws",
"Exception",
"{",
"return",
"setCipherSuites",
"(",
"ssl",
",",
"ciphers",
",",
"false",
")",
";",
"}"
] | Returns the cipher suites available for negotiation in SSL handshake.
<p>
This complex directive uses a colon-separated cipher-spec string consisting
of OpenSSL cipher specifications to configure the Cipher Suite the client
is permitted to negotiate in the SSL handshake phase. Notice that this
directive can be used both in per-server and per-directory context.
In per-server context it applies to the standard SSL handshake when a
connection is established. In per-directory context it forces a SSL
renegotiation with the reconfigured Cipher Suite after the HTTP request
was read but before the HTTP response is sent.
@param ssl the SSL instance (SSL *)
@param ciphers an SSL cipher specification
@return {@code true} if successful
@throws Exception if an error happened
@deprecated Use {@link #setCipherSuites(long, String, boolean)} | [
"Returns",
"the",
"cipher",
"suites",
"available",
"for",
"negotiation",
"in",
"SSL",
"handshake",
".",
"<p",
">",
"This",
"complex",
"directive",
"uses",
"a",
"colon",
"-",
"separated",
"cipher",
"-",
"spec",
"string",
"consisting",
"of",
"OpenSSL",
"cipher",... | train | https://github.com/netty/netty-tcnative/blob/4a5d7330c6c36cff2bebbb465571cab1cf7a4063/openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSL.java#L512-L516 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java | LabAccountsInner.createOrUpdateAsync | public Observable<LabAccountInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, LabAccountInner labAccount) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labAccount).map(new Func1<ServiceResponse<LabAccountInner>, LabAccountInner>() {
@Override
public LabAccountInner call(ServiceResponse<LabAccountInner> response) {
return response.body();
}
});
} | java | public Observable<LabAccountInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, LabAccountInner labAccount) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labAccount).map(new Func1<ServiceResponse<LabAccountInner>, LabAccountInner>() {
@Override
public LabAccountInner call(ServiceResponse<LabAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LabAccountInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"LabAccountInner",
"labAccount",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
","... | Create or replace an existing Lab Account.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labAccount Represents a lab account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LabAccountInner object | [
"Create",
"or",
"replace",
"an",
"existing",
"Lab",
"Account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java#L803-L810 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java | RsaKey.fromJsonWebKey | public static RsaKey fromJsonWebKey(JsonWebKey jwk, boolean includePrivateParameters, Provider provider) {
if (jwk.kid() != null) {
return new RsaKey(jwk.kid(), jwk.toRSA(includePrivateParameters, provider));
} else {
throw new IllegalArgumentException("Json Web Key must have a kid");
}
} | java | public static RsaKey fromJsonWebKey(JsonWebKey jwk, boolean includePrivateParameters, Provider provider) {
if (jwk.kid() != null) {
return new RsaKey(jwk.kid(), jwk.toRSA(includePrivateParameters, provider));
} else {
throw new IllegalArgumentException("Json Web Key must have a kid");
}
} | [
"public",
"static",
"RsaKey",
"fromJsonWebKey",
"(",
"JsonWebKey",
"jwk",
",",
"boolean",
"includePrivateParameters",
",",
"Provider",
"provider",
")",
"{",
"if",
"(",
"jwk",
".",
"kid",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"new",
"RsaKey",
"(",
"jw... | Converts JSON web key to RsaKey and include the private key if set to true.
@param provider the Java security provider.
@param includePrivateParameters true if the RSA key pair should include the private key. False otherwise.
@return RsaKey | [
"Converts",
"JSON",
"web",
"key",
"to",
"RsaKey",
"and",
"include",
"the",
"private",
"key",
"if",
"set",
"to",
"true",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java#L165-L171 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/AgeLimitCheckValidator.java | AgeLimitCheckValidator.isValid | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
if (pvalue == null) {
return true;
}
final Date value;
if (pvalue instanceof Date) {
value = (Date) pvalue;
} else if (pvalue instanceof Calendar) {
value = ((Calendar) pvalue).getTime();
} else if (pvalue instanceof HasGetTime) {
value = ((HasGetTime) pvalue).getTime();
} else {
throw new IllegalArgumentException(
"Object for validation with AgeLimitCheckValidator must be of type "
+ "Date, Calendar or HasGetTime.");
}
final Date dateLimit =
DateUtils.truncate(DateUtils.addYears(new Date(), 0 - minYears), Calendar.DAY_OF_MONTH);
final Date birthday = DateUtils.truncate(value, Calendar.DAY_OF_MONTH);
return !dateLimit.before(birthday);
} | java | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
if (pvalue == null) {
return true;
}
final Date value;
if (pvalue instanceof Date) {
value = (Date) pvalue;
} else if (pvalue instanceof Calendar) {
value = ((Calendar) pvalue).getTime();
} else if (pvalue instanceof HasGetTime) {
value = ((HasGetTime) pvalue).getTime();
} else {
throw new IllegalArgumentException(
"Object for validation with AgeLimitCheckValidator must be of type "
+ "Date, Calendar or HasGetTime.");
}
final Date dateLimit =
DateUtils.truncate(DateUtils.addYears(new Date(), 0 - minYears), Calendar.DAY_OF_MONTH);
final Date birthday = DateUtils.truncate(value, Calendar.DAY_OF_MONTH);
return !dateLimit.before(birthday);
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"Object",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"if",
"(",
"pvalue",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"final",
"Date",
"value",
... | {@inheritDoc} check if given object is valid.
@see javax.validation.ConstraintValidator#isValid(Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"object",
"is",
"valid",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/AgeLimitCheckValidator.java#L58-L79 |
thymeleaf/thymeleaf-spring | thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/dialect/SpringStandardDialect.java | SpringStandardDialect.createSpringStandardProcessorsSet | public static Set<IProcessor> createSpringStandardProcessorsSet(
final String dialectPrefix, final boolean renderHiddenMarkersBeforeCheckboxes) {
/*
* It is important that we create new instances here because, if there are
* several dialects in the TemplateEngine that extend StandardDialect, they should
* not be returning the exact same instances for their processors in order
* to allow specific instances to be directly linked with their owner dialect.
*/
final Set<IProcessor> standardProcessors = StandardDialect.createStandardProcessorsSet(dialectPrefix);
final Set<IProcessor> processors = new LinkedHashSet<IProcessor>(40);
/*
* REMOVE STANDARD PROCESSORS THAT WE WILL REPLACE
*/
for (final IProcessor standardProcessor : standardProcessors) {
// There are several processors we need to remove from the Standard Dialect set
if (!(standardProcessor instanceof StandardObjectTagProcessor) &&
!(standardProcessor instanceof StandardActionTagProcessor) &&
!(standardProcessor instanceof StandardHrefTagProcessor) &&
!(standardProcessor instanceof StandardMethodTagProcessor) &&
!(standardProcessor instanceof StandardSrcTagProcessor) &&
!(standardProcessor instanceof StandardValueTagProcessor)) {
processors.add(standardProcessor);
} else if (standardProcessor.getTemplateMode() != TemplateMode.HTML) {
// We only want to remove from the StandardDialect the HTML versions of the attribute processors
processors.add(standardProcessor);
}
}
/*
* ATTRIBUTE TAG PROCESSORS
*/
processors.add(new SpringActionTagProcessor(dialectPrefix));
processors.add(new SpringHrefTagProcessor(dialectPrefix));
processors.add(new SpringMethodTagProcessor(dialectPrefix));
processors.add(new SpringSrcTagProcessor(dialectPrefix));
processors.add(new SpringValueTagProcessor(dialectPrefix));
processors.add(new SpringObjectTagProcessor(dialectPrefix));
processors.add(new SpringErrorsTagProcessor(dialectPrefix));
processors.add(new SpringUErrorsTagProcessor(dialectPrefix));
processors.add(new SpringInputGeneralFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputPasswordFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputCheckboxFieldTagProcessor(dialectPrefix, renderHiddenMarkersBeforeCheckboxes));
processors.add(new SpringInputRadioFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputFileFieldTagProcessor(dialectPrefix));
processors.add(new SpringSelectFieldTagProcessor(dialectPrefix));
processors.add(new SpringOptionInSelectFieldTagProcessor(dialectPrefix));
processors.add(new SpringOptionFieldTagProcessor(dialectPrefix));
processors.add(new SpringTextareaFieldTagProcessor(dialectPrefix));
processors.add(new SpringErrorClassTagProcessor(dialectPrefix));
return processors;
} | java | public static Set<IProcessor> createSpringStandardProcessorsSet(
final String dialectPrefix, final boolean renderHiddenMarkersBeforeCheckboxes) {
/*
* It is important that we create new instances here because, if there are
* several dialects in the TemplateEngine that extend StandardDialect, they should
* not be returning the exact same instances for their processors in order
* to allow specific instances to be directly linked with their owner dialect.
*/
final Set<IProcessor> standardProcessors = StandardDialect.createStandardProcessorsSet(dialectPrefix);
final Set<IProcessor> processors = new LinkedHashSet<IProcessor>(40);
/*
* REMOVE STANDARD PROCESSORS THAT WE WILL REPLACE
*/
for (final IProcessor standardProcessor : standardProcessors) {
// There are several processors we need to remove from the Standard Dialect set
if (!(standardProcessor instanceof StandardObjectTagProcessor) &&
!(standardProcessor instanceof StandardActionTagProcessor) &&
!(standardProcessor instanceof StandardHrefTagProcessor) &&
!(standardProcessor instanceof StandardMethodTagProcessor) &&
!(standardProcessor instanceof StandardSrcTagProcessor) &&
!(standardProcessor instanceof StandardValueTagProcessor)) {
processors.add(standardProcessor);
} else if (standardProcessor.getTemplateMode() != TemplateMode.HTML) {
// We only want to remove from the StandardDialect the HTML versions of the attribute processors
processors.add(standardProcessor);
}
}
/*
* ATTRIBUTE TAG PROCESSORS
*/
processors.add(new SpringActionTagProcessor(dialectPrefix));
processors.add(new SpringHrefTagProcessor(dialectPrefix));
processors.add(new SpringMethodTagProcessor(dialectPrefix));
processors.add(new SpringSrcTagProcessor(dialectPrefix));
processors.add(new SpringValueTagProcessor(dialectPrefix));
processors.add(new SpringObjectTagProcessor(dialectPrefix));
processors.add(new SpringErrorsTagProcessor(dialectPrefix));
processors.add(new SpringUErrorsTagProcessor(dialectPrefix));
processors.add(new SpringInputGeneralFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputPasswordFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputCheckboxFieldTagProcessor(dialectPrefix, renderHiddenMarkersBeforeCheckboxes));
processors.add(new SpringInputRadioFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputFileFieldTagProcessor(dialectPrefix));
processors.add(new SpringSelectFieldTagProcessor(dialectPrefix));
processors.add(new SpringOptionInSelectFieldTagProcessor(dialectPrefix));
processors.add(new SpringOptionFieldTagProcessor(dialectPrefix));
processors.add(new SpringTextareaFieldTagProcessor(dialectPrefix));
processors.add(new SpringErrorClassTagProcessor(dialectPrefix));
return processors;
} | [
"public",
"static",
"Set",
"<",
"IProcessor",
">",
"createSpringStandardProcessorsSet",
"(",
"final",
"String",
"dialectPrefix",
",",
"final",
"boolean",
"renderHiddenMarkersBeforeCheckboxes",
")",
"{",
"/*\n * It is important that we create new instances here because, if t... | <p>
Create a the set of SpringStandard processors, all of them freshly instanced.
</p>
@param dialectPrefix the prefix established for the Standard Dialect, needed for initialization
@param renderHiddenMarkersBeforeCheckboxes {@code true} if hidden markers should be rendered
before the checkboxes, {@code false} if not.
@return the set of SpringStandard processors.
@since 3.0.10 | [
"<p",
">",
"Create",
"a",
"the",
"set",
"of",
"SpringStandard",
"processors",
"all",
"of",
"them",
"freshly",
"instanced",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/thymeleaf/thymeleaf-spring/blob/9aa15a19017a0938e57646e3deefb8a90ab78dcb/thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/dialect/SpringStandardDialect.java#L360-L419 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.fillUniform | public static void fillUniform(GrayS64 img, Random rand , long min , long max) {
long range = max-min;
long[] data = img.data;
for (int y = 0; y < img.height; y++) {
int index = img.getStartIndex() + y * img.getStride();
for (int x = 0; x < img.width; x++) {
data[index++] = rand.nextInt((int)range)+min;
}
}
} | java | public static void fillUniform(GrayS64 img, Random rand , long min , long max) {
long range = max-min;
long[] data = img.data;
for (int y = 0; y < img.height; y++) {
int index = img.getStartIndex() + y * img.getStride();
for (int x = 0; x < img.width; x++) {
data[index++] = rand.nextInt((int)range)+min;
}
}
} | [
"public",
"static",
"void",
"fillUniform",
"(",
"GrayS64",
"img",
",",
"Random",
"rand",
",",
"long",
"min",
",",
"long",
"max",
")",
"{",
"long",
"range",
"=",
"max",
"-",
"min",
";",
"long",
"[",
"]",
"data",
"=",
"img",
".",
"data",
";",
"for",
... | Sets each value in the image to a value drawn from an uniform distribution that has a range of min ≤ X < max.
@param img Image which is to be filled. Modified,
@param rand Random number generator
@param min Minimum value of the distribution, inclusive
@param max Maximum value of the distribution, exclusive | [
"Sets",
"each",
"value",
"in",
"the",
"image",
"to",
"a",
"value",
"drawn",
"from",
"an",
"uniform",
"distribution",
"that",
"has",
"a",
"range",
"of",
"min",
"&le",
";",
"X",
"<",
";",
"max",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L1916-L1927 |
alexvasilkov/GestureViews | library/src/main/java/com/alexvasilkov/gestures/GestureControllerForPager.java | GestureControllerForPager.scrollBy | private float scrollBy(@NonNull MotionEvent event, float dx) {
if (isSkipViewPager || isViewPagerDisabled) {
return dx;
}
final State state = getState();
getStateController().getMovementArea(state, tmpRectF);
float pagerDx = splitPagerScroll(dx, state, tmpRectF);
pagerDx = skipPagerMovement(pagerDx, state, tmpRectF);
float viewDx = dx - pagerDx;
// Applying pager scroll
boolean shouldFixViewX = isViewPagerInterceptedScroll && viewPagerX == 0;
int actualX = performViewPagerScroll(event, pagerDx);
viewPagerX += actualX;
if (shouldFixViewX) { // Adding back scroll not handled by ViewPager
viewDx += Math.round(pagerDx) - actualX;
}
// Returning altered scroll left for image
return viewDx;
} | java | private float scrollBy(@NonNull MotionEvent event, float dx) {
if (isSkipViewPager || isViewPagerDisabled) {
return dx;
}
final State state = getState();
getStateController().getMovementArea(state, tmpRectF);
float pagerDx = splitPagerScroll(dx, state, tmpRectF);
pagerDx = skipPagerMovement(pagerDx, state, tmpRectF);
float viewDx = dx - pagerDx;
// Applying pager scroll
boolean shouldFixViewX = isViewPagerInterceptedScroll && viewPagerX == 0;
int actualX = performViewPagerScroll(event, pagerDx);
viewPagerX += actualX;
if (shouldFixViewX) { // Adding back scroll not handled by ViewPager
viewDx += Math.round(pagerDx) - actualX;
}
// Returning altered scroll left for image
return viewDx;
} | [
"private",
"float",
"scrollBy",
"(",
"@",
"NonNull",
"MotionEvent",
"event",
",",
"float",
"dx",
")",
"{",
"if",
"(",
"isSkipViewPager",
"||",
"isViewPagerDisabled",
")",
"{",
"return",
"dx",
";",
"}",
"final",
"State",
"state",
"=",
"getState",
"(",
")",
... | /*
Scrolls ViewPager if view reached bounds. Returns distance at which view can be actually
scrolled. Here we will split given distance (dX) into movement of ViewPager and movement
of view itself. | [
"/",
"*",
"Scrolls",
"ViewPager",
"if",
"view",
"reached",
"bounds",
".",
"Returns",
"distance",
"at",
"which",
"view",
"can",
"be",
"actually",
"scrolled",
".",
"Here",
"we",
"will",
"split",
"given",
"distance",
"(",
"dX",
")",
"into",
"movement",
"of",
... | train | https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/GestureControllerForPager.java#L220-L242 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java | BlockDataHandler.getData | public static <T> T getData(String identifier, IBlockAccess world, BlockPos pos)
{
ChunkData<T> chunkData = instance.<T> chunkData(identifier, instance.world(world), pos);
return chunkData != null ? chunkData.getData(pos) : null;
} | java | public static <T> T getData(String identifier, IBlockAccess world, BlockPos pos)
{
ChunkData<T> chunkData = instance.<T> chunkData(identifier, instance.world(world), pos);
return chunkData != null ? chunkData.getData(pos) : null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getData",
"(",
"String",
"identifier",
",",
"IBlockAccess",
"world",
",",
"BlockPos",
"pos",
")",
"{",
"ChunkData",
"<",
"T",
">",
"chunkData",
"=",
"instance",
".",
"<",
"T",
">",
"chunkData",
"(",
"identifier",
... | Gets the custom data stored at the {@link BlockPos} for the specified identifier.
@param <T> the generic type
@param identifier the identifier
@param world the world
@param pos the pos
@return the data | [
"Gets",
"the",
"custom",
"data",
"stored",
"at",
"the",
"{",
"@link",
"BlockPos",
"}",
"for",
"the",
"specified",
"identifier",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java#L290-L294 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java | CQLTranslator.appendColumnValue | private boolean appendColumnValue(StringBuilder builder, Object valueObj, Field column)
{
Object value = PropertyAccessorHelper.getObject(valueObj, column);
boolean isPresent = false;
isPresent = appendValue(builder, column.getType(), value, isPresent, false);
return isPresent;
} | java | private boolean appendColumnValue(StringBuilder builder, Object valueObj, Field column)
{
Object value = PropertyAccessorHelper.getObject(valueObj, column);
boolean isPresent = false;
isPresent = appendValue(builder, column.getType(), value, isPresent, false);
return isPresent;
} | [
"private",
"boolean",
"appendColumnValue",
"(",
"StringBuilder",
"builder",
",",
"Object",
"valueObj",
",",
"Field",
"column",
")",
"{",
"Object",
"value",
"=",
"PropertyAccessorHelper",
".",
"getObject",
"(",
"valueObj",
",",
"column",
")",
";",
"boolean",
"isP... | Appends column value with parametrised builder object. Returns true if
value is present.
@param builder
the builder
@param valueObj
the value obj
@param column
the column
@return true if value is not null,else false. | [
"Appends",
"column",
"value",
"with",
"parametrised",
"builder",
"object",
".",
"Returns",
"true",
"if",
"value",
"is",
"present",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java#L1080-L1086 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_siteBuilderStart_options_domains_GET | public ArrayList<OvhSiteBuilderDomain> packName_siteBuilderStart_options_domains_GET(String packName) throws IOException {
String qPath = "/pack/xdsl/{packName}/siteBuilderStart/options/domains";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t9);
} | java | public ArrayList<OvhSiteBuilderDomain> packName_siteBuilderStart_options_domains_GET(String packName) throws IOException {
String qPath = "/pack/xdsl/{packName}/siteBuilderStart/options/domains";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t9);
} | [
"public",
"ArrayList",
"<",
"OvhSiteBuilderDomain",
">",
"packName_siteBuilderStart_options_domains_GET",
"(",
"String",
"packName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/siteBuilderStart/options/domains\"",
";",
"StringBuilder",
"s... | Get the available domains
REST: GET /pack/xdsl/{packName}/siteBuilderStart/options/domains
@param packName [required] The internal name of your pack | [
"Get",
"the",
"available",
"domains"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L432-L437 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/map/MapView.java | MapView.getWorldToPanTransformation | public Matrix getWorldToPanTransformation() {
if (viewState.getScale() > 0) {
double dX = -(viewState.getPanX() * viewState.getScale());
double dY = viewState.getPanY() * viewState.getScale();
return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
} | java | public Matrix getWorldToPanTransformation() {
if (viewState.getScale() > 0) {
double dX = -(viewState.getPanX() * viewState.getScale());
double dY = viewState.getPanY() * viewState.getScale();
return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
} | [
"public",
"Matrix",
"getWorldToPanTransformation",
"(",
")",
"{",
"if",
"(",
"viewState",
".",
"getScale",
"(",
")",
">",
"0",
")",
"{",
"double",
"dX",
"=",
"-",
"(",
"viewState",
".",
"getPanX",
"(",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
... | Return the world-to-pan space translation matrix.
@return transformation matrix | [
"Return",
"the",
"world",
"-",
"to",
"-",
"pan",
"space",
"translation",
"matrix",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L169-L176 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/nosql/BaseNoSqlDao.java | BaseNoSqlDao.invalidateCacheEntry | protected void invalidateCacheEntry(String spaceId, String key, Object data) {
if (isCacheEnabled()) {
putToCache(getCacheName(), calcCacheKey(spaceId, key), data);
}
} | java | protected void invalidateCacheEntry(String spaceId, String key, Object data) {
if (isCacheEnabled()) {
putToCache(getCacheName(), calcCacheKey(spaceId, key), data);
}
} | [
"protected",
"void",
"invalidateCacheEntry",
"(",
"String",
"spaceId",
",",
"String",
"key",
",",
"Object",
"data",
")",
"{",
"if",
"(",
"isCacheEnabled",
"(",
")",
")",
"{",
"putToCache",
"(",
"getCacheName",
"(",
")",
",",
"calcCacheKey",
"(",
"spaceId",
... | Invalidate a cache entry due to updated content.
@param spaceId
@param key
@param data | [
"Invalidate",
"a",
"cache",
"entry",
"due",
"to",
"updated",
"content",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/nosql/BaseNoSqlDao.java#L64-L68 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AliasChainValidator.java | AliasChainValidator.validate | public void validate(String destName, String busName) throws SINotPossibleInCurrentConfigurationException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "validate", new Object[] { destName, busName });
if (collector.contains(destName, busName))
{
// Throw out exception detailing loop
// Add the destination name which has triggered the exception to the end
// of the list, making the problem obvious.
String chainText = toStringPlus(destName, busName);
CompoundName firstInChain = getFirstInChain();
String nlsMessage = nls.getFormattedMessage(
"ALIAS_CIRCULAR_DEPENDENCY_ERROR_CWSIP0621",
new Object[] { firstInChain, chainText, busName },
null);
SINotPossibleInCurrentConfigurationException e
= new SINotPossibleInCurrentConfigurationException(nlsMessage);
SibTr.exception(tc, e);
if (tc.isEntryEnabled())
SibTr.exit(tc, "validate", nlsMessage);
throw e;
}
collector.add(destName, busName);
if (tc.isEntryEnabled())
SibTr.exit(tc, "validate");
} | java | public void validate(String destName, String busName) throws SINotPossibleInCurrentConfigurationException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "validate", new Object[] { destName, busName });
if (collector.contains(destName, busName))
{
// Throw out exception detailing loop
// Add the destination name which has triggered the exception to the end
// of the list, making the problem obvious.
String chainText = toStringPlus(destName, busName);
CompoundName firstInChain = getFirstInChain();
String nlsMessage = nls.getFormattedMessage(
"ALIAS_CIRCULAR_DEPENDENCY_ERROR_CWSIP0621",
new Object[] { firstInChain, chainText, busName },
null);
SINotPossibleInCurrentConfigurationException e
= new SINotPossibleInCurrentConfigurationException(nlsMessage);
SibTr.exception(tc, e);
if (tc.isEntryEnabled())
SibTr.exit(tc, "validate", nlsMessage);
throw e;
}
collector.add(destName, busName);
if (tc.isEntryEnabled())
SibTr.exit(tc, "validate");
} | [
"public",
"void",
"validate",
"(",
"String",
"destName",
",",
"String",
"busName",
")",
"throws",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"validate\"",
... | Check that the given destination, busname combination has not been seen
before when resolving an alias. If it has not been seen, we add it to the
map for checking next time.
@param destName
@param busName
@throws SINotPossibleInCurrentConfigurationException Thrown if a loop has
been detected. | [
"Check",
"that",
"the",
"given",
"destination",
"busname",
"combination",
"has",
"not",
"been",
"seen",
"before",
"when",
"resolving",
"an",
"alias",
".",
"If",
"it",
"has",
"not",
"been",
"seen",
"we",
"add",
"it",
"to",
"the",
"map",
"for",
"checking",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/AliasChainValidator.java#L76-L110 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/SegmentMetadataUpdateTransaction.java | SegmentMetadataUpdateTransaction.preProcessAsTargetSegment | void preProcessAsTargetSegment(MergeSegmentOperation operation, SegmentMetadataUpdateTransaction sourceMetadata)
throws StreamSegmentSealedException, StreamSegmentNotSealedException, MetadataUpdateException {
ensureSegmentId(operation);
if (this.sealed) {
// We do not allow merging into sealed Segments.
throw new StreamSegmentSealedException(this.name);
}
// Check that the Source has been properly sealed and has its length set.
if (!sourceMetadata.isSealed()) {
throw new StreamSegmentNotSealedException(this.name);
}
long transLength = operation.getLength();
if (transLength < 0) {
throw new MetadataUpdateException(this.containerId,
"MergeSegmentOperation does not have its Source Segment Length set: " + operation.toString());
}
if (!this.recoveryMode) {
// Assign entry Segment offset and update Segment offset afterwards.
operation.setStreamSegmentOffset(this.length);
}
} | java | void preProcessAsTargetSegment(MergeSegmentOperation operation, SegmentMetadataUpdateTransaction sourceMetadata)
throws StreamSegmentSealedException, StreamSegmentNotSealedException, MetadataUpdateException {
ensureSegmentId(operation);
if (this.sealed) {
// We do not allow merging into sealed Segments.
throw new StreamSegmentSealedException(this.name);
}
// Check that the Source has been properly sealed and has its length set.
if (!sourceMetadata.isSealed()) {
throw new StreamSegmentNotSealedException(this.name);
}
long transLength = operation.getLength();
if (transLength < 0) {
throw new MetadataUpdateException(this.containerId,
"MergeSegmentOperation does not have its Source Segment Length set: " + operation.toString());
}
if (!this.recoveryMode) {
// Assign entry Segment offset and update Segment offset afterwards.
operation.setStreamSegmentOffset(this.length);
}
} | [
"void",
"preProcessAsTargetSegment",
"(",
"MergeSegmentOperation",
"operation",
",",
"SegmentMetadataUpdateTransaction",
"sourceMetadata",
")",
"throws",
"StreamSegmentSealedException",
",",
"StreamSegmentNotSealedException",
",",
"MetadataUpdateException",
"{",
"ensureSegmentId",
... | Pre-processes the given MergeSegmentOperation as a Target Segment (where it will be merged into).
After this method returns, the operation will have its TargetSegmentOffset set to the length of the Target Segment.
@param operation The operation to pre-process.
@param sourceMetadata The metadata for the Stream Segment to merge.
@throws StreamSegmentSealedException If the target Segment is already sealed.
@throws StreamSegmentNotSealedException If the source Segment is not sealed.
@throws MetadataUpdateException If the operation cannot be processed because of the current state of the metadata.
@throws IllegalArgumentException If the operation is for a different Segment. | [
"Pre",
"-",
"processes",
"the",
"given",
"MergeSegmentOperation",
"as",
"a",
"Target",
"Segment",
"(",
"where",
"it",
"will",
"be",
"merged",
"into",
")",
".",
"After",
"this",
"method",
"returns",
"the",
"operation",
"will",
"have",
"its",
"TargetSegmentOffse... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/SegmentMetadataUpdateTransaction.java#L366-L390 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/animation/transformation/Scale.java | Scale.from | protected Scale from(float x, float y, float z)
{
fromX = x;
fromY = y;
fromZ = z;
return this;
} | java | protected Scale from(float x, float y, float z)
{
fromX = x;
fromY = y;
fromZ = z;
return this;
} | [
"protected",
"Scale",
"from",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"fromX",
"=",
"x",
";",
"fromY",
"=",
"y",
";",
"fromZ",
"=",
"z",
";",
"return",
"this",
";",
"}"
] | Sets the starting scale.
@param x the x
@param y the y
@param z the z
@return the scale | [
"Sets",
"the",
"starting",
"scale",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/Scale.java#L89-L95 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.