repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
petergeneric/stdlib | guice/webapp/src/main/java/com/peterphi/std/guice/web/servlet/GuiceServlet.java | GuiceServlet.doService | protected void doService(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException
{
super.service(req, resp);
} | java | protected void doService(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException
{
super.service(req, resp);
} | [
"protected",
"void",
"doService",
"(",
"final",
"HttpServletRequest",
"req",
",",
"final",
"HttpServletResponse",
"resp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"super",
".",
"service",
"(",
"req",
",",
"resp",
")",
";",
"}"
] | Calls {@link HttpServlet#service} should a subclass need to implement that method
@param req
@param resp
@throws ServletException
@throws IOException | [
"Calls",
"{",
"@link",
"HttpServlet#service",
"}",
"should",
"a",
"subclass",
"need",
"to",
"implement",
"that",
"method"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/webapp/src/main/java/com/peterphi/std/guice/web/servlet/GuiceServlet.java#L71-L74 |
alibaba/jstorm | jstorm-ui/src/main/java/com/alibaba/jstorm/ui/utils/UIUtils.java | UIUtils.getTaskEntities | public static List<TaskEntity> getTaskEntities(TopologyInfo topologyInfo, String componentName) {
TreeMap<Integer, TaskEntity> tasks = new TreeMap<>();
for (ComponentSummary cs : topologyInfo.get_components()) {
String compName = cs.get_name();
String type = cs.get_type();
if (componentName.equals(compName)) {
for (int id : cs.get_taskIds()) {
tasks.put(id, new TaskEntity(id, compName, type));
}
}
}
for (TaskSummary ts : topologyInfo.get_tasks()) {
if (tasks.containsKey(ts.get_taskId())) {
TaskEntity te = tasks.get(ts.get_taskId());
te.setHost(ts.get_host());
te.setPort(ts.get_port());
te.setStatus(ts.get_status());
te.setUptime(ts.get_uptime());
te.setErrors(ts.get_errors());
}
}
return new ArrayList<>(tasks.values());
} | java | public static List<TaskEntity> getTaskEntities(TopologyInfo topologyInfo, String componentName) {
TreeMap<Integer, TaskEntity> tasks = new TreeMap<>();
for (ComponentSummary cs : topologyInfo.get_components()) {
String compName = cs.get_name();
String type = cs.get_type();
if (componentName.equals(compName)) {
for (int id : cs.get_taskIds()) {
tasks.put(id, new TaskEntity(id, compName, type));
}
}
}
for (TaskSummary ts : topologyInfo.get_tasks()) {
if (tasks.containsKey(ts.get_taskId())) {
TaskEntity te = tasks.get(ts.get_taskId());
te.setHost(ts.get_host());
te.setPort(ts.get_port());
te.setStatus(ts.get_status());
te.setUptime(ts.get_uptime());
te.setErrors(ts.get_errors());
}
}
return new ArrayList<>(tasks.values());
} | [
"public",
"static",
"List",
"<",
"TaskEntity",
">",
"getTaskEntities",
"(",
"TopologyInfo",
"topologyInfo",
",",
"String",
"componentName",
")",
"{",
"TreeMap",
"<",
"Integer",
",",
"TaskEntity",
">",
"tasks",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"for... | get the task entities in the specific component
@param topologyInfo topology info
@param componentName component name
@return the list of task entities | [
"get",
"the",
"task",
"entities",
"in",
"the",
"specific",
"component"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-ui/src/main/java/com/alibaba/jstorm/ui/utils/UIUtils.java#L254-L279 |
square/javapoet | src/main/java/com/squareup/javapoet/ParameterizedTypeName.java | ParameterizedTypeName.nestedClass | public ParameterizedTypeName nestedClass(String name, List<TypeName> typeArguments) {
checkNotNull(name, "name == null");
return new ParameterizedTypeName(this, rawType.nestedClass(name), typeArguments,
new ArrayList<>());
} | java | public ParameterizedTypeName nestedClass(String name, List<TypeName> typeArguments) {
checkNotNull(name, "name == null");
return new ParameterizedTypeName(this, rawType.nestedClass(name), typeArguments,
new ArrayList<>());
} | [
"public",
"ParameterizedTypeName",
"nestedClass",
"(",
"String",
"name",
",",
"List",
"<",
"TypeName",
">",
"typeArguments",
")",
"{",
"checkNotNull",
"(",
"name",
",",
"\"name == null\"",
")",
";",
"return",
"new",
"ParameterizedTypeName",
"(",
"this",
",",
"ra... | Returns a new {@link ParameterizedTypeName} instance for the specified {@code name} as nested
inside this class, with the specified {@code typeArguments}. | [
"Returns",
"a",
"new",
"{"
] | train | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/ParameterizedTypeName.java#L106-L110 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.deletePublishList | public void deletePublishList(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException {
getProjectDriver(dbc).deletePublishList(dbc, publishHistoryId);
} | java | public void deletePublishList(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException {
getProjectDriver(dbc).deletePublishList(dbc, publishHistoryId);
} | [
"public",
"void",
"deletePublishList",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"publishHistoryId",
")",
"throws",
"CmsException",
"{",
"getProjectDriver",
"(",
"dbc",
")",
".",
"deletePublishList",
"(",
"dbc",
",",
"publishHistoryId",
")",
";",
"}"
] | Deletes the publish list assigned to a publish job.<p>
@param dbc the current database context
@param publishHistoryId the history id identifying the publish job
@throws CmsException if something goes wrong | [
"Deletes",
"the",
"publish",
"list",
"assigned",
"to",
"a",
"publish",
"job",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2787-L2790 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.stripTrailingZeros | public BigDecimal stripTrailingZeros() {
if (intCompact == 0 || (intVal != null && intVal.signum() == 0)) {
return BigDecimal.ZERO;
} else if (intCompact != INFLATED) {
return createAndStripZerosToMatchScale(intCompact, scale, Long.MIN_VALUE);
} else {
return createAndStripZerosToMatchScale(intVal, scale, Long.MIN_VALUE);
}
} | java | public BigDecimal stripTrailingZeros() {
if (intCompact == 0 || (intVal != null && intVal.signum() == 0)) {
return BigDecimal.ZERO;
} else if (intCompact != INFLATED) {
return createAndStripZerosToMatchScale(intCompact, scale, Long.MIN_VALUE);
} else {
return createAndStripZerosToMatchScale(intVal, scale, Long.MIN_VALUE);
}
} | [
"public",
"BigDecimal",
"stripTrailingZeros",
"(",
")",
"{",
"if",
"(",
"intCompact",
"==",
"0",
"||",
"(",
"intVal",
"!=",
"null",
"&&",
"intVal",
".",
"signum",
"(",
")",
"==",
"0",
")",
")",
"{",
"return",
"BigDecimal",
".",
"ZERO",
";",
"}",
"els... | Returns a {@code BigDecimal} which is numerically equal to
this one but with any trailing zeros removed from the
representation. For example, stripping the trailing zeros from
the {@code BigDecimal} value {@code 600.0}, which has
[{@code BigInteger}, {@code scale}] components equals to
[6000, 1], yields {@code 6E2} with [{@code BigInteger},
{@code scale}] components equals to [6, -2]. If
this BigDecimal is numerically equal to zero, then
{@code BigDecimal.ZERO} is returned.
@return a numerically equal {@code BigDecimal} with any
trailing zeros removed.
@since 1.5 | [
"Returns",
"a",
"{",
"@code",
"BigDecimal",
"}",
"which",
"is",
"numerically",
"equal",
"to",
"this",
"one",
"but",
"with",
"any",
"trailing",
"zeros",
"removed",
"from",
"the",
"representation",
".",
"For",
"example",
"stripping",
"the",
"trailing",
"zeros",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L2596-L2604 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/random/Random.java | Random.nextDouble | public double nextDouble(double lo, double hi) {
if (lo < 0) {
if (nextInt(2) == 0)
return -nextDouble(0, -lo);
else
return nextDouble(0, hi);
} else {
return (lo + (hi - lo) * nextDouble());
}
} | java | public double nextDouble(double lo, double hi) {
if (lo < 0) {
if (nextInt(2) == 0)
return -nextDouble(0, -lo);
else
return nextDouble(0, hi);
} else {
return (lo + (hi - lo) * nextDouble());
}
} | [
"public",
"double",
"nextDouble",
"(",
"double",
"lo",
",",
"double",
"hi",
")",
"{",
"if",
"(",
"lo",
"<",
"0",
")",
"{",
"if",
"(",
"nextInt",
"(",
"2",
")",
"==",
"0",
")",
"return",
"-",
"nextDouble",
"(",
"0",
",",
"-",
"lo",
")",
";",
"... | Generate a uniform random number in the range [lo, hi)
@param lo lower limit of range
@param hi upper limit of range
@return a uniform random real in the range [lo, hi) | [
"Generate",
"a",
"uniform",
"random",
"number",
"in",
"the",
"range",
"[",
"lo",
"hi",
")"
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/random/Random.java#L92-L101 |
apereo/cas | support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java | LdapUtils.getLong | public static Long getLong(final LdapEntry ctx, final String attribute) {
return getLong(ctx, attribute, Long.MIN_VALUE);
} | java | public static Long getLong(final LdapEntry ctx, final String attribute) {
return getLong(ctx, attribute, Long.MIN_VALUE);
} | [
"public",
"static",
"Long",
"getLong",
"(",
"final",
"LdapEntry",
"ctx",
",",
"final",
"String",
"attribute",
")",
"{",
"return",
"getLong",
"(",
"ctx",
",",
"attribute",
",",
"Long",
".",
"MIN_VALUE",
")",
";",
"}"
] | Reads a Long value from the LdapEntry.
@param ctx the ldap entry
@param attribute the attribute name
@return the long value | [
"Reads",
"a",
"Long",
"value",
"from",
"the",
"LdapEntry",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L163-L165 |
kirgor/enklib | ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java | Bean.createSession | protected Session createSession() throws Exception {
Config config = configBean.getConfig();
DataSource dataSource = InitialContext.doLookup(config.getDataSourceJNDI());
return new Session(dataSource, config.getDialect());
} | java | protected Session createSession() throws Exception {
Config config = configBean.getConfig();
DataSource dataSource = InitialContext.doLookup(config.getDataSourceJNDI());
return new Session(dataSource, config.getDialect());
} | [
"protected",
"Session",
"createSession",
"(",
")",
"throws",
"Exception",
"{",
"Config",
"config",
"=",
"configBean",
".",
"getConfig",
"(",
")",
";",
"DataSource",
"dataSource",
"=",
"InitialContext",
".",
"doLookup",
"(",
"config",
".",
"getDataSourceJNDI",
"(... | Creates {@link Session} instance, connected to the database.
@throws NamingException
@throws SQLException | [
"Creates",
"{",
"@link",
"Session",
"}",
"instance",
"connected",
"to",
"the",
"database",
"."
] | train | https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L175-L179 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseMenuScreen.java | HBaseMenuScreen.printData | public boolean printData(PrintWriter out, int iHtmlAttributes)
{
boolean bFieldsFound = false;
Record recMenu = ((BaseMenuScreen)this.getScreenField()).getMainRecord();
String strCellFormat = this.getHtmlString(recMenu);
XMLParser parser = ((BaseMenuScreen)this.getScreenField()).getXMLParser(recMenu);
parser.parseHtmlData(out, strCellFormat);
parser.free();
parser = null;
return bFieldsFound;
} | java | public boolean printData(PrintWriter out, int iHtmlAttributes)
{
boolean bFieldsFound = false;
Record recMenu = ((BaseMenuScreen)this.getScreenField()).getMainRecord();
String strCellFormat = this.getHtmlString(recMenu);
XMLParser parser = ((BaseMenuScreen)this.getScreenField()).getXMLParser(recMenu);
parser.parseHtmlData(out, strCellFormat);
parser.free();
parser = null;
return bFieldsFound;
} | [
"public",
"boolean",
"printData",
"(",
"PrintWriter",
"out",
",",
"int",
"iHtmlAttributes",
")",
"{",
"boolean",
"bFieldsFound",
"=",
"false",
";",
"Record",
"recMenu",
"=",
"(",
"(",
"BaseMenuScreen",
")",
"this",
".",
"getScreenField",
"(",
")",
")",
".",
... | Code to display a Menu.
@param out The html out stream.
@param iHtmlAttributes The HTML attributes.
@return true If fields have been found.
@exception DBException File exception. | [
"Code",
"to",
"display",
"a",
"Menu",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseMenuScreen.java#L82-L92 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java | ByteOp.copyStream | public static void copyStream(InputStream is, OutputStream os, int size)
throws IOException {
byte[] buffer = new byte[size];
for (int r = -1; (r = is.read(buffer, 0, size)) != -1;) {
os.write(buffer, 0, r);
}
} | java | public static void copyStream(InputStream is, OutputStream os, int size)
throws IOException {
byte[] buffer = new byte[size];
for (int r = -1; (r = is.read(buffer, 0, size)) != -1;) {
os.write(buffer, 0, r);
}
} | [
"public",
"static",
"void",
"copyStream",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"r",
"=",
... | Write all bytes from is to os. Does not close either stream.
@param is to copy bytes from
@param os to copy bytes to
@param size number of bytes to buffer between read and write operations
@throws IOException for usual reasons | [
"Write",
"all",
"bytes",
"from",
"is",
"to",
"os",
".",
"Does",
"not",
"close",
"either",
"stream",
"."
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java#L141-L147 |
alibaba/ARouter | arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java | Postcard.withSparseParcelableArray | public Postcard withSparseParcelableArray(@Nullable String key, @Nullable SparseArray<? extends Parcelable> value) {
mBundle.putSparseParcelableArray(key, value);
return this;
} | java | public Postcard withSparseParcelableArray(@Nullable String key, @Nullable SparseArray<? extends Parcelable> value) {
mBundle.putSparseParcelableArray(key, value);
return this;
} | [
"public",
"Postcard",
"withSparseParcelableArray",
"(",
"@",
"Nullable",
"String",
"key",
",",
"@",
"Nullable",
"SparseArray",
"<",
"?",
"extends",
"Parcelable",
">",
"value",
")",
"{",
"mBundle",
".",
"putSparseParcelableArray",
"(",
"key",
",",
"value",
")",
... | Inserts a SparceArray of Parcelable values into the mapping of this
Bundle, replacing any existing value for the given key. Either key
or value may be null.
@param key a String, or null
@param value a SparseArray of Parcelable objects, or null
@return current | [
"Inserts",
"a",
"SparceArray",
"of",
"Parcelable",
"values",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L416-L419 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/Stripe.java | Stripe.retrieveSourceSynchronous | public Source retrieveSourceSynchronous(
@NonNull @Size(min = 1) String sourceId,
@NonNull @Size(min = 1) String clientSecret)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
APIException {
return retrieveSourceSynchronous(sourceId, clientSecret, null);
} | java | public Source retrieveSourceSynchronous(
@NonNull @Size(min = 1) String sourceId,
@NonNull @Size(min = 1) String clientSecret)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
APIException {
return retrieveSourceSynchronous(sourceId, clientSecret, null);
} | [
"public",
"Source",
"retrieveSourceSynchronous",
"(",
"@",
"NonNull",
"@",
"Size",
"(",
"min",
"=",
"1",
")",
"String",
"sourceId",
",",
"@",
"NonNull",
"@",
"Size",
"(",
"min",
"=",
"1",
")",
"String",
"clientSecret",
")",
"throws",
"AuthenticationException... | Retrieve an existing {@link Source} from the Stripe API. Note that this is a
synchronous method, and cannot be called on the main thread. Doing so will cause your app
to crash. This method uses the default publishable key for this {@link Stripe} instance.
@param sourceId the {@link Source#mId} field of the desired Source object
@param clientSecret the {@link Source#mClientSecret} field of the desired Source object
@return a {@link Source} if one could be found based on the input params, or {@code null} if
no such Source could be found.
@throws AuthenticationException failure to properly authenticate yourself (check your key)
@throws InvalidRequestException your request has invalid parameters
@throws APIConnectionException failure to connect to Stripe's API
@throws APIException any other type of problem (for instance, a temporary issue with
Stripe's servers) | [
"Retrieve",
"an",
"existing",
"{",
"@link",
"Source",
"}",
"from",
"the",
"Stripe",
"API",
".",
"Note",
"that",
"this",
"is",
"a",
"synchronous",
"method",
"and",
"cannot",
"be",
"called",
"on",
"the",
"main",
"thread",
".",
"Doing",
"so",
"will",
"cause... | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/Stripe.java#L784-L792 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java | CsvBeanReader.instantiateBean | private static <T> T instantiateBean(final Class<T> clazz) {
final T bean;
if( clazz.isInterface() ) {
bean = BeanInterfaceProxy.createProxy(clazz);
} else {
try {
Constructor<T> c = clazz.getDeclaredConstructor(new Class[0]);
c.setAccessible(true);
bean = c.newInstance(new Object[0]);
}
catch(InstantiationException e) {
throw new SuperCsvReflectionException(String.format(
"error instantiating bean, check that %s has a default no-args constructor", clazz.getName()), e);
}
catch(NoSuchMethodException e) {
throw new SuperCsvReflectionException(String.format(
"error instantiating bean, check that %s has a default no-args constructor", clazz.getName()), e);
}
catch(IllegalAccessException e) {
throw new SuperCsvReflectionException("error instantiating bean", e);
}
catch(InvocationTargetException e) {
throw new SuperCsvReflectionException("error instantiating bean", e);
}
}
return bean;
} | java | private static <T> T instantiateBean(final Class<T> clazz) {
final T bean;
if( clazz.isInterface() ) {
bean = BeanInterfaceProxy.createProxy(clazz);
} else {
try {
Constructor<T> c = clazz.getDeclaredConstructor(new Class[0]);
c.setAccessible(true);
bean = c.newInstance(new Object[0]);
}
catch(InstantiationException e) {
throw new SuperCsvReflectionException(String.format(
"error instantiating bean, check that %s has a default no-args constructor", clazz.getName()), e);
}
catch(NoSuchMethodException e) {
throw new SuperCsvReflectionException(String.format(
"error instantiating bean, check that %s has a default no-args constructor", clazz.getName()), e);
}
catch(IllegalAccessException e) {
throw new SuperCsvReflectionException("error instantiating bean", e);
}
catch(InvocationTargetException e) {
throw new SuperCsvReflectionException("error instantiating bean", e);
}
}
return bean;
} | [
"private",
"static",
"<",
"T",
">",
"T",
"instantiateBean",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"final",
"T",
"bean",
";",
"if",
"(",
"clazz",
".",
"isInterface",
"(",
")",
")",
"{",
"bean",
"=",
"BeanInterfaceProxy",
".",
"creat... | Instantiates the bean (or creates a proxy if it's an interface).
@param clazz
the bean class to instantiate (a proxy will be created if an interface is supplied), using the default
(no argument) constructor
@return the instantiated bean
@throws SuperCsvReflectionException
if there was a reflection exception when instantiating the bean | [
"Instantiates",
"the",
"bean",
"(",
"or",
"creates",
"a",
"proxy",
"if",
"it",
"s",
"an",
"interface",
")",
"."
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java#L92-L119 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.createMessageReceiverFromEntityPath | public static IMessageReceiver createMessageReceiverFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings) throws InterruptedException, ServiceBusException {
return Utils.completeFuture(createMessageReceiverFromEntityPathAsync(namespaceEndpointURI, entityPath, clientSettings));
} | java | public static IMessageReceiver createMessageReceiverFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings) throws InterruptedException, ServiceBusException {
return Utils.completeFuture(createMessageReceiverFromEntityPathAsync(namespaceEndpointURI, entityPath, clientSettings));
} | [
"public",
"static",
"IMessageReceiver",
"createMessageReceiverFromEntityPath",
"(",
"URI",
"namespaceEndpointURI",
",",
"String",
"entityPath",
",",
"ClientSettings",
"clientSettings",
")",
"throws",
"InterruptedException",
",",
"ServiceBusException",
"{",
"return",
"Utils",
... | Creates a message receiver to the entity using the client settings in PeekLock mode
@param namespaceEndpointURI endpoint uri of entity namespace
@param entityPath path of the entity
@param clientSettings client settings
@return IMessageReceiver instance
@throws InterruptedException if the current thread was interrupted while waiting
@throws ServiceBusException if the receiver cannot be created | [
"Creates",
"a",
"message",
"receiver",
"to",
"the",
"entity",
"using",
"the",
"client",
"settings",
"in",
"PeekLock",
"mode"
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L308-L310 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java | SignatureUtils.similarPackages | public static boolean similarPackages(String packName1, String packName2, int depth) {
if (depth == 0) {
return true;
}
String dottedPackName1 = packName1.replace('/', '.');
String dottedPackName2 = packName2.replace('/', '.');
int dot1 = dottedPackName1.indexOf('.');
int dot2 = dottedPackName2.indexOf('.');
if (dot1 < 0) {
return (dot2 < 0);
} else if (dot2 < 0) {
return false;
}
String s1 = dottedPackName1.substring(0, dot1);
String s2 = dottedPackName2.substring(0, dot2);
if (!s1.equals(s2)) {
return false;
}
return similarPackages(dottedPackName1.substring(dot1 + 1), dottedPackName2.substring(dot2 + 1), depth - 1);
} | java | public static boolean similarPackages(String packName1, String packName2, int depth) {
if (depth == 0) {
return true;
}
String dottedPackName1 = packName1.replace('/', '.');
String dottedPackName2 = packName2.replace('/', '.');
int dot1 = dottedPackName1.indexOf('.');
int dot2 = dottedPackName2.indexOf('.');
if (dot1 < 0) {
return (dot2 < 0);
} else if (dot2 < 0) {
return false;
}
String s1 = dottedPackName1.substring(0, dot1);
String s2 = dottedPackName2.substring(0, dot2);
if (!s1.equals(s2)) {
return false;
}
return similarPackages(dottedPackName1.substring(dot1 + 1), dottedPackName2.substring(dot2 + 1), depth - 1);
} | [
"public",
"static",
"boolean",
"similarPackages",
"(",
"String",
"packName1",
",",
"String",
"packName2",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"depth",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"String",
"dottedPackName1",
"=",
"packName1",
"."... | returns whether or not the two packages have the same first 'depth' parts, if they exist
@param packName1
the first package to check
@param packName2
the second package to check
@param depth
the number of package parts to check
@return if they are similar | [
"returns",
"whether",
"or",
"not",
"the",
"two",
"packages",
"have",
"the",
"same",
"first",
"depth",
"parts",
"if",
"they",
"exist"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java#L117-L141 |
jboss/jboss-jstl-api_spec | src/main/java/javax/servlet/jsp/jstl/core/Config.java | Config.get | public static Object get(HttpSession session, String name) {
Object ret = null;
if (session != null) {
try {
ret = session.getAttribute(name + SESSION_SCOPE_SUFFIX);
} catch (IllegalStateException ex) {
} // when session is invalidated
}
return ret;
} | java | public static Object get(HttpSession session, String name) {
Object ret = null;
if (session != null) {
try {
ret = session.getAttribute(name + SESSION_SCOPE_SUFFIX);
} catch (IllegalStateException ex) {
} // when session is invalidated
}
return ret;
} | [
"public",
"static",
"Object",
"get",
"(",
"HttpSession",
"session",
",",
"String",
"name",
")",
"{",
"Object",
"ret",
"=",
"null",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"try",
"{",
"ret",
"=",
"session",
".",
"getAttribute",
"(",
"name",
... | Looks up a configuration variable in the "session" scope.
<p> The lookup of configuration variables is performed as if each scope
had its own name space, that is, the same configuration variable name
in one scope does not replace one stored in a different scope.</p>
@param session Session object in which the configuration variable is to
be looked up
@param name Configuration variable name
@return The <tt>java.lang.Object</tt> associated with the configuration
variable, or null if it is not defined, if session is null, or if the session
is invalidated. | [
"Looks",
"up",
"a",
"configuration",
"variable",
"in",
"the",
"session",
"scope",
".",
"<p",
">",
"The",
"lookup",
"of",
"configuration",
"variables",
"is",
"performed",
"as",
"if",
"each",
"scope",
"had",
"its",
"own",
"name",
"space",
"that",
"is",
"the"... | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/javax/servlet/jsp/jstl/core/Config.java#L142-L151 |
aws/aws-sdk-java | aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/AwsSecurityFinding.java | AwsSecurityFinding.withProductFields | public AwsSecurityFinding withProductFields(java.util.Map<String, String> productFields) {
setProductFields(productFields);
return this;
} | java | public AwsSecurityFinding withProductFields(java.util.Map<String, String> productFields) {
setProductFields(productFields);
return this;
} | [
"public",
"AwsSecurityFinding",
"withProductFields",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"productFields",
")",
"{",
"setProductFields",
"(",
"productFields",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A data type where security findings providers can include additional solution-specific details that are not part
of the defined AwsSecurityFinding format.
</p>
@param productFields
A data type where security findings providers can include additional solution-specific details that are
not part of the defined AwsSecurityFinding format.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"data",
"type",
"where",
"security",
"findings",
"providers",
"can",
"include",
"additional",
"solution",
"-",
"specific",
"details",
"that",
"are",
"not",
"part",
"of",
"the",
"defined",
"AwsSecurityFinding",
"format",
".",
"<",
"/",
"p",
">... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/AwsSecurityFinding.java#L1134-L1137 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.removeAll | @SafeVarargs
public static double[] removeAll(final double[] a, final double... elements) {
if (N.isNullOrEmpty(a)) {
return N.EMPTY_DOUBLE_ARRAY;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final DoubleList list = DoubleList.of(a.clone());
list.removeAll(DoubleList.of(elements));
return list.trimToSize().array();
} | java | @SafeVarargs
public static double[] removeAll(final double[] a, final double... elements) {
if (N.isNullOrEmpty(a)) {
return N.EMPTY_DOUBLE_ARRAY;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final DoubleList list = DoubleList.of(a.clone());
list.removeAll(DoubleList.of(elements));
return list.trimToSize().array();
} | [
"@",
"SafeVarargs",
"public",
"static",
"double",
"[",
"]",
"removeAll",
"(",
"final",
"double",
"[",
"]",
"a",
",",
"final",
"double",
"...",
"elements",
")",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"a",
")",
")",
"{",
"return",
"N",
".",
... | Returns a new array with removes all the occurrences of specified elements from <code>a</code>
@param a
@param elements
@return
@see Collection#removeAll(Collection) | [
"Returns",
"a",
"new",
"array",
"with",
"removes",
"all",
"the",
"occurrences",
"of",
"specified",
"elements",
"from",
"<code",
">",
"a<",
"/",
"code",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L23512-L23525 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSTree.java | GBSTree.getNode | GBSNode getNode(Object newKey)
{
GBSNode p;
if (_nodePool == null)
p = new GBSNode(this, newKey);
else
{
p = _nodePool;
_nodePool = p.rightChild();
p.reset(newKey);
}
return p;
} | java | GBSNode getNode(Object newKey)
{
GBSNode p;
if (_nodePool == null)
p = new GBSNode(this, newKey);
else
{
p = _nodePool;
_nodePool = p.rightChild();
p.reset(newKey);
}
return p;
} | [
"GBSNode",
"getNode",
"(",
"Object",
"newKey",
")",
"{",
"GBSNode",
"p",
";",
"if",
"(",
"_nodePool",
"==",
"null",
")",
"p",
"=",
"new",
"GBSNode",
"(",
"this",
",",
"newKey",
")",
";",
"else",
"{",
"p",
"=",
"_nodePool",
";",
"_nodePool",
"=",
"p... | Allocate a new node for the tree.
@param newKey The initial key for the new node.
@return The new node. | [
"Allocate",
"a",
"new",
"node",
"for",
"the",
"tree",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/gbs/GBSTree.java#L344-L356 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Collectors.java | Collectors.averagingLong | @NotNull
public static <T> Collector<T, ?, Double> averagingLong(@NotNull final ToLongFunction<? super T> mapper) {
return averagingHelper(new BiConsumer<long[], T>() {
@Override
public void accept(long[] t, T u) {
t[0]++; // count
t[1] += mapper.applyAsLong(u); // sum
}
});
} | java | @NotNull
public static <T> Collector<T, ?, Double> averagingLong(@NotNull final ToLongFunction<? super T> mapper) {
return averagingHelper(new BiConsumer<long[], T>() {
@Override
public void accept(long[] t, T u) {
t[0]++; // count
t[1] += mapper.applyAsLong(u); // sum
}
});
} | [
"@",
"NotNull",
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Double",
">",
"averagingLong",
"(",
"@",
"NotNull",
"final",
"ToLongFunction",
"<",
"?",
"super",
"T",
">",
"mapper",
")",
"{",
"return",
"averagingHelper",
"(",
... | Returns a {@code Collector} that calculates average of long-valued input elements.
@param <T> the type of the input elements
@param mapper the mapping function which extracts value from element to calculate result
@return a {@code Collector}
@since 1.1.3 | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"that",
"calculates",
"average",
"of",
"long",
"-",
"valued",
"input",
"elements",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L506-L515 |
ops4j/org.ops4j.pax.logging | pax-logging-service/src/main/java/org/apache/log4j/receivers/db/DBReceiverJob.java | DBReceiverJob.getProperties | void getProperties(Connection connection, long id, LoggingEvent event)
throws SQLException {
PreparedStatement statement = connection.prepareStatement(sqlProperties);
try {
statement.setLong(1, id);
ResultSet rs = statement.executeQuery();
while (rs.next()) {
String key = rs.getString(1);
String value = rs.getString(2);
event.setProperty(key, value);
}
} finally {
statement.close();
}
} | java | void getProperties(Connection connection, long id, LoggingEvent event)
throws SQLException {
PreparedStatement statement = connection.prepareStatement(sqlProperties);
try {
statement.setLong(1, id);
ResultSet rs = statement.executeQuery();
while (rs.next()) {
String key = rs.getString(1);
String value = rs.getString(2);
event.setProperty(key, value);
}
} finally {
statement.close();
}
} | [
"void",
"getProperties",
"(",
"Connection",
"connection",
",",
"long",
"id",
",",
"LoggingEvent",
"event",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"statement",
"=",
"connection",
".",
"prepareStatement",
"(",
"sqlProperties",
")",
";",
"try",
"{",... | Retrieve the event properties from the logging_event_property table.
@param connection
@param id
@param event
@throws SQLException | [
"Retrieve",
"the",
"event",
"properties",
"from",
"the",
"logging_event_property",
"table",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/receivers/db/DBReceiverJob.java#L172-L188 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.createAllSymlink | public static void createAllSymlink(Configuration conf, File jobCacheDir, File
workDir)
throws IOException{
if ((jobCacheDir == null || !jobCacheDir.isDirectory()) ||
workDir == null || (!workDir.isDirectory())) {
return;
}
boolean createSymlink = getSymlink(conf);
if (createSymlink){
File[] list = jobCacheDir.listFiles();
for (int i=0; i < list.length; i++){
FileUtil.symLink(list[i].getAbsolutePath(),
new File(workDir, list[i].getName()).toString());
}
}
} | java | public static void createAllSymlink(Configuration conf, File jobCacheDir, File
workDir)
throws IOException{
if ((jobCacheDir == null || !jobCacheDir.isDirectory()) ||
workDir == null || (!workDir.isDirectory())) {
return;
}
boolean createSymlink = getSymlink(conf);
if (createSymlink){
File[] list = jobCacheDir.listFiles();
for (int i=0; i < list.length; i++){
FileUtil.symLink(list[i].getAbsolutePath(),
new File(workDir, list[i].getName()).toString());
}
}
} | [
"public",
"static",
"void",
"createAllSymlink",
"(",
"Configuration",
"conf",
",",
"File",
"jobCacheDir",
",",
"File",
"workDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"jobCacheDir",
"==",
"null",
"||",
"!",
"jobCacheDir",
".",
"isDirectory",
"(",... | This method create symlinks for all files in a given dir in another
directory
@param conf the configuration
@param jobCacheDir the target directory for creating symlinks
@param workDir the directory in which the symlinks are created
@throws IOException | [
"This",
"method",
"create",
"symlinks",
"for",
"all",
"files",
"in",
"a",
"given",
"dir",
"in",
"another",
"directory"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L674-L689 |
Bernardo-MG/maven-site-fixer | src/main/java/com/bernardomg/velocity/tool/SiteTool.java | SiteTool.transformImagesToFigures | public final void transformImagesToFigures(final Element root) {
final Collection<Element> images; // Image elements from the <body>
Element figure; // <figure> element
Element caption; // <figcaption> element
checkNotNull(root, "Received a null pointer as root element");
images = root.select("section img");
if (!images.isEmpty()) {
for (final Element img : images) {
figure = new Element(Tag.valueOf("figure"), "");
img.replaceWith(figure);
figure.appendChild(img);
if (img.hasAttr("alt")) {
caption = new Element(Tag.valueOf("figcaption"), "");
caption.text(img.attr("alt"));
figure.appendChild(caption);
}
}
}
} | java | public final void transformImagesToFigures(final Element root) {
final Collection<Element> images; // Image elements from the <body>
Element figure; // <figure> element
Element caption; // <figcaption> element
checkNotNull(root, "Received a null pointer as root element");
images = root.select("section img");
if (!images.isEmpty()) {
for (final Element img : images) {
figure = new Element(Tag.valueOf("figure"), "");
img.replaceWith(figure);
figure.appendChild(img);
if (img.hasAttr("alt")) {
caption = new Element(Tag.valueOf("figcaption"), "");
caption.text(img.attr("alt"));
figure.appendChild(caption);
}
}
}
} | [
"public",
"final",
"void",
"transformImagesToFigures",
"(",
"final",
"Element",
"root",
")",
"{",
"final",
"Collection",
"<",
"Element",
">",
"images",
";",
"// Image elements from the <body>",
"Element",
"figure",
";",
"// <figure> element",
"Element",
"caption",
";"... | Transforms simple {@code <img>} elements to {@code <figure>} elements.
<p>
This will wrap {@code <img>} elements with a {@code <figure>} element,
and add a {@code <figcaption>} with the contents of the image's
{@code alt} attribute, if said attribute exists.
<p>
Only {@code <img>} elements inside a {@code <section>} will be
transformed.
@param root
root element with images to transform | [
"Transforms",
"simple",
"{",
"@code",
"<img",
">",
"}",
"elements",
"to",
"{",
"@code",
"<figure",
">",
"}",
"elements",
".",
"<p",
">",
"This",
"will",
"wrap",
"{",
"@code",
"<img",
">",
"}",
"elements",
"with",
"a",
"{",
"@code",
"<figure",
">",
"}... | train | https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/SiteTool.java#L294-L316 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java | Jsr250Utils.containsMethod | private static boolean containsMethod(Method method, List<Method> methods) {
if(methods != null) {
for(Method aMethod : methods){
if(method.getName().equals(aMethod.getName())) {
return true;
}
}
}
return false;
} | java | private static boolean containsMethod(Method method, List<Method> methods) {
if(methods != null) {
for(Method aMethod : methods){
if(method.getName().equals(aMethod.getName())) {
return true;
}
}
}
return false;
} | [
"private",
"static",
"boolean",
"containsMethod",
"(",
"Method",
"method",
",",
"List",
"<",
"Method",
">",
"methods",
")",
"{",
"if",
"(",
"methods",
"!=",
"null",
")",
"{",
"for",
"(",
"Method",
"aMethod",
":",
"methods",
")",
"{",
"if",
"(",
"method... | Checks if the passed in method already exists in the list of methods. Checks for equality by the name of the method.
@param method
@param methods
@return | [
"Checks",
"if",
"the",
"passed",
"in",
"method",
"already",
"exists",
"in",
"the",
"list",
"of",
"methods",
".",
"Checks",
"for",
"equality",
"by",
"the",
"name",
"of",
"the",
"method",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L168-L177 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/impl/flexi/FlexiBean.java | FlexiBean.getInt | public int getInt(String propertyName, int defaultValue) {
Object obj = get(propertyName);
return obj != null ? ((Number) get(propertyName)).intValue() : defaultValue;
} | java | public int getInt(String propertyName, int defaultValue) {
Object obj = get(propertyName);
return obj != null ? ((Number) get(propertyName)).intValue() : defaultValue;
} | [
"public",
"int",
"getInt",
"(",
"String",
"propertyName",
",",
"int",
"defaultValue",
")",
"{",
"Object",
"obj",
"=",
"get",
"(",
"propertyName",
")",
";",
"return",
"obj",
"!=",
"null",
"?",
"(",
"(",
"Number",
")",
"get",
"(",
"propertyName",
")",
")... | Gets the value of the property as a {@code int} using a default value.
@param propertyName the property name, not empty
@param defaultValue the default value for null or invalid property
@return the value of the property
@throws ClassCastException if the value is not compatible | [
"Gets",
"the",
"value",
"of",
"the",
"property",
"as",
"a",
"{",
"@code",
"int",
"}",
"using",
"a",
"default",
"value",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/impl/flexi/FlexiBean.java#L197-L200 |
Impetus/Kundera | src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java | MongoDBClient.findGridFSDBFile | private GridFSDBFile findGridFSDBFile(EntityMetadata entityMetadata, Object key)
{
String id = ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName();
DBObject query = new BasicDBObject("metadata." + id, key);
KunderaGridFS gfs = new KunderaGridFS(mongoDb, entityMetadata.getTableName());
return gfs.findOne(query);
} | java | private GridFSDBFile findGridFSDBFile(EntityMetadata entityMetadata, Object key)
{
String id = ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName();
DBObject query = new BasicDBObject("metadata." + id, key);
KunderaGridFS gfs = new KunderaGridFS(mongoDb, entityMetadata.getTableName());
return gfs.findOne(query);
} | [
"private",
"GridFSDBFile",
"findGridFSDBFile",
"(",
"EntityMetadata",
"entityMetadata",
",",
"Object",
"key",
")",
"{",
"String",
"id",
"=",
"(",
"(",
"AbstractAttribute",
")",
"entityMetadata",
".",
"getIdAttribute",
"(",
")",
")",
".",
"getJPAColumnName",
"(",
... | Find GRIDFSDBFile.
@param entityMetadata
the entity metadata
@param key
the key
@return the grid fsdb file | [
"Find",
"GRIDFSDBFile",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L426-L432 |
datasift/datasift-java | src/main/java/com/datasift/client/ParamBuilder.java | ParamBuilder.put | public ParamBuilder put(String name, Object value) {
params.put(name, value);
return this;
} | java | public ParamBuilder put(String name, Object value) {
params.put(name, value);
return this;
} | [
"public",
"ParamBuilder",
"put",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"params",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | /*
Adds or replaces a parameter
@param name the name of the parameter
@param value the value to the parameter
@return this builder for further re-use | [
"/",
"*",
"Adds",
"or",
"replaces",
"a",
"parameter"
] | train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/ParamBuilder.java#L23-L26 |
jmxtrans/embedded-jmxtrans | src/main/java/org/jmxtrans/embedded/output/AbstractOutputWriter.java | AbstractOutputWriter.getStringSetting | protected String getStringSetting(String name, String defaultValue) {
if (settings.containsKey(name)) {
return settings.get(name).toString();
} else {
return defaultValue;
}
} | java | protected String getStringSetting(String name, String defaultValue) {
if (settings.containsKey(name)) {
return settings.get(name).toString();
} else {
return defaultValue;
}
} | [
"protected",
"String",
"getStringSetting",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"settings",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"settings",
".",
"get",
"(",
"name",
")",
".",
"toString",
"(",
")... | Return the value of the given property.
If the property is not found, the <code>defaultValue</code> is returned.
@param name name of the property
@param defaultValue default value if the property is not defined.
@return value of the property or <code>defaultValue</code> if the property is not defined. | [
"Return",
"the",
"value",
"of",
"the",
"given",
"property",
"."
] | train | https://github.com/jmxtrans/embedded-jmxtrans/blob/17224389e7d8323284cabc2a5167fc03bed6d223/src/main/java/org/jmxtrans/embedded/output/AbstractOutputWriter.java#L190-L196 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/cache/image/ImageLoader.java | ImageLoader.initialize | public static synchronized void initialize(Context context) {
if (executor == null) {
executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(DEFAULT_POOL_SIZE);
}
if (imageCache == null) {
imageCache = new ImageCache(25, expirationInMinutes, DEFAULT_POOL_SIZE);
imageCache.enableDiskCache(context, ImageCache.DISK_CACHE_SDCARD);
}
} | java | public static synchronized void initialize(Context context) {
if (executor == null) {
executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(DEFAULT_POOL_SIZE);
}
if (imageCache == null) {
imageCache = new ImageCache(25, expirationInMinutes, DEFAULT_POOL_SIZE);
imageCache.enableDiskCache(context, ImageCache.DISK_CACHE_SDCARD);
}
} | [
"public",
"static",
"synchronized",
"void",
"initialize",
"(",
"Context",
"context",
")",
"{",
"if",
"(",
"executor",
"==",
"null",
")",
"{",
"executor",
"=",
"(",
"ThreadPoolExecutor",
")",
"Executors",
".",
"newFixedThreadPool",
"(",
"DEFAULT_POOL_SIZE",
")",
... | This method must be called before any other method is invoked on this class. Please note that
when using ImageLoader as part of {@link WebImageView} or {@link WebGalleryAdapter}, then
there is no need to call this method, since those classes will already do that for you. This
method is idempotent. You may call it multiple times without any side effects.
@param context the current context | [
"This",
"method",
"must",
"be",
"called",
"before",
"any",
"other",
"method",
"is",
"invoked",
"on",
"this",
"class",
".",
"Please",
"note",
"that",
"when",
"using",
"ImageLoader",
"as",
"part",
"of",
"{",
"@link",
"WebImageView",
"}",
"or",
"{",
"@link",
... | train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/cache/image/ImageLoader.java#L74-L82 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java | VirtualMachineScaleSetVMsInner.getAsync | public Observable<VirtualMachineScaleSetVMInner> getAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInner>, VirtualMachineScaleSetVMInner>() {
@Override
public VirtualMachineScaleSetVMInner call(ServiceResponse<VirtualMachineScaleSetVMInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualMachineScaleSetVMInner> getAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInner>, VirtualMachineScaleSetVMInner>() {
@Override
public VirtualMachineScaleSetVMInner call(ServiceResponse<VirtualMachineScaleSetVMInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualMachineScaleSetVMInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"String",
"instanceId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetNa... | Gets a virtual machine from a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@param instanceId The instance ID of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualMachineScaleSetVMInner object | [
"Gets",
"a",
"virtual",
"machine",
"from",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java#L1068-L1075 |
lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/ParseDateExtensions.java | ParseDateExtensions.parseToDate | public static Date parseToDate(final String date, final String format) throws ParseException
{
final DateFormat df = new SimpleDateFormat(format);
Date parsedDate = null;
parsedDate = df.parse(date);
return parsedDate;
} | java | public static Date parseToDate(final String date, final String format) throws ParseException
{
final DateFormat df = new SimpleDateFormat(format);
Date parsedDate = null;
parsedDate = df.parse(date);
return parsedDate;
} | [
"public",
"static",
"Date",
"parseToDate",
"(",
"final",
"String",
"date",
",",
"final",
"String",
"format",
")",
"throws",
"ParseException",
"{",
"final",
"DateFormat",
"df",
"=",
"new",
"SimpleDateFormat",
"(",
"format",
")",
";",
"Date",
"parsedDate",
"=",
... | Parses the String date to a date object. For example: USA-Format is : yyyy-MM-dd
@param date
The Date as String
@param format
The Format for the Date to parse
@return The parsed Date
@throws ParseException
occurs when their are problems with parsing the String to Date. | [
"Parses",
"the",
"String",
"date",
"to",
"a",
"date",
"object",
".",
"For",
"example",
":",
"USA",
"-",
"Format",
"is",
":",
"yyyy",
"-",
"MM",
"-",
"dd"
] | train | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/ParseDateExtensions.java#L84-L90 |
Jasig/uPortal | uPortal-tenants/src/main/java/org/apereo/portal/tenants/TenantService.java | TenantService.validateAttribute | public void validateAttribute(final String key, final String value) throws Exception {
for (ITenantOperationsListener listener : tenantOperationsListeners) {
// Will throw an exception if not valid
listener.validateAttribute(key, value);
}
} | java | public void validateAttribute(final String key, final String value) throws Exception {
for (ITenantOperationsListener listener : tenantOperationsListeners) {
// Will throw an exception if not valid
listener.validateAttribute(key, value);
}
} | [
"public",
"void",
"validateAttribute",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"throws",
"Exception",
"{",
"for",
"(",
"ITenantOperationsListener",
"listener",
":",
"tenantOperationsListeners",
")",
"{",
"// Will throw an exception if not va... | Throws an exception if any {@linkITenantOperationsListener} indicates that the specified
value isn't allowable for the specified attribute.
@throws Exception
@since 4.3 | [
"Throws",
"an",
"exception",
"if",
"any",
"{",
"@linkITenantOperationsListener",
"}",
"indicates",
"that",
"the",
"specified",
"value",
"isn",
"t",
"allowable",
"for",
"the",
"specified",
"attribute",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-tenants/src/main/java/org/apereo/portal/tenants/TenantService.java#L374-L379 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java | FeatureScopes.createNestedTypeLiteralScope | protected IScope createNestedTypeLiteralScope(
EObject featureCall,
LightweightTypeReference enclosingType,
JvmDeclaredType rawEnclosingType,
IScope parent,
IFeatureScopeSession session) {
return new NestedTypeLiteralScope(parent, session, asAbstractFeatureCall(featureCall), enclosingType, rawEnclosingType);
} | java | protected IScope createNestedTypeLiteralScope(
EObject featureCall,
LightweightTypeReference enclosingType,
JvmDeclaredType rawEnclosingType,
IScope parent,
IFeatureScopeSession session) {
return new NestedTypeLiteralScope(parent, session, asAbstractFeatureCall(featureCall), enclosingType, rawEnclosingType);
} | [
"protected",
"IScope",
"createNestedTypeLiteralScope",
"(",
"EObject",
"featureCall",
",",
"LightweightTypeReference",
"enclosingType",
",",
"JvmDeclaredType",
"rawEnclosingType",
",",
"IScope",
"parent",
",",
"IFeatureScopeSession",
"session",
")",
"{",
"return",
"new",
... | Create a scope that returns nested types.
@param featureCall the feature call that is currently processed by the scoping infrastructure
@param enclosingType the enclosing type including type parameters for the nested type literal scope.
@param rawEnclosingType the raw type that is used to query the nested types.
@param parent the parent scope. Is never null.
@param session the currently known scope session. Is never null. | [
"Create",
"a",
"scope",
"that",
"returns",
"nested",
"types",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java#L600-L607 |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/Validate.java | Validate.notEmpty | public static void notEmpty(final String aString, final String argumentName) {
// Check sanity
notNull(aString, argumentName);
if (aString.length() == 0) {
throw new IllegalArgumentException(getMessage("empty", argumentName));
}
} | java | public static void notEmpty(final String aString, final String argumentName) {
// Check sanity
notNull(aString, argumentName);
if (aString.length() == 0) {
throw new IllegalArgumentException(getMessage("empty", argumentName));
}
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"final",
"String",
"aString",
",",
"final",
"String",
"argumentName",
")",
"{",
"// Check sanity",
"notNull",
"(",
"aString",
",",
"argumentName",
")",
";",
"if",
"(",
"aString",
".",
"length",
"(",
")",
"==",
"... | Validates that the supplied object is not null, and throws an IllegalArgumentException otherwise.
@param aString The string to validate for emptyness.
@param argumentName The argument name of the object to validate.
If supplied (i.e. non-{@code null}), this value is used in composing
a better exception message. | [
"Validates",
"that",
"the",
"supplied",
"object",
"is",
"not",
"null",
"and",
"throws",
"an",
"IllegalArgumentException",
"otherwise",
"."
] | train | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/Validate.java#L57-L65 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.ssReg | public static double ssReg(double[] residuals, double[] targetAttribute) {
double mean = sum(targetAttribute) / targetAttribute.length;
double ret = 0;
for (int i = 0; i < residuals.length; i++) {
ret += Math.pow(residuals[i] - mean, 2);
}
return ret;
} | java | public static double ssReg(double[] residuals, double[] targetAttribute) {
double mean = sum(targetAttribute) / targetAttribute.length;
double ret = 0;
for (int i = 0; i < residuals.length; i++) {
ret += Math.pow(residuals[i] - mean, 2);
}
return ret;
} | [
"public",
"static",
"double",
"ssReg",
"(",
"double",
"[",
"]",
"residuals",
",",
"double",
"[",
"]",
"targetAttribute",
")",
"{",
"double",
"mean",
"=",
"sum",
"(",
"targetAttribute",
")",
"/",
"targetAttribute",
".",
"length",
";",
"double",
"ret",
"=",
... | How much of the variance is explained by the regression
@param residuals error
@param targetAttribute data for target attribute
@return the sum squares of regression | [
"How",
"much",
"of",
"the",
"variance",
"is",
"explained",
"by",
"the",
"regression"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L173-L180 |
the-fascinator/plugin-subscriber-solrEventLog | src/main/java/com/googlecode/fascinator/subscriber/solrEventLog/SolrEventLogSubscriber.java | SolrEventLogSubscriber.addToIndex | private void addToIndex(Map<String, String> param) throws Exception {
String doc = writeUpdateString(param);
addToBuffer(doc);
} | java | private void addToIndex(Map<String, String> param) throws Exception {
String doc = writeUpdateString(param);
addToBuffer(doc);
} | [
"private",
"void",
"addToIndex",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"param",
")",
"throws",
"Exception",
"{",
"String",
"doc",
"=",
"writeUpdateString",
"(",
"param",
")",
";",
"addToBuffer",
"(",
"doc",
")",
";",
"}"
] | Add the event to the index
@param param : Map of key/value pairs to add to the index
@throws Exception if there was an error | [
"Add",
"the",
"event",
"to",
"the",
"index"
] | train | https://github.com/the-fascinator/plugin-subscriber-solrEventLog/blob/2c9da188887a622a6d43d33ea9099aff53a0516d/src/main/java/com/googlecode/fascinator/subscriber/solrEventLog/SolrEventLogSubscriber.java#L437-L440 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java | DeleteHandlerV1.deleteEntities | public void deleteEntities(Collection<AtlasVertex> instanceVertices) throws AtlasBaseException {
RequestContextV1 requestContext = RequestContextV1.get();
Set<AtlasVertex> deletionCandidateVertices = new HashSet<>();
for (AtlasVertex instanceVertex : instanceVertices) {
String guid = AtlasGraphUtilsV1.getIdFromVertex(instanceVertex);
AtlasEntity.Status state = AtlasGraphUtilsV1.getState(instanceVertex);
if (state == AtlasEntity.Status.DELETED) {
LOG.debug("Skipping deletion of {} as it is already deleted", guid);
continue;
}
String typeName = AtlasGraphUtilsV1.getTypeName(instanceVertex);
AtlasObjectId objId = new AtlasObjectId(guid, typeName);
if (requestContext.getDeletedEntityIds().contains(objId)) {
LOG.debug("Skipping deletion of {} as it is already deleted", guid);
continue;
}
// Get GUIDs and vertices for all deletion candidates.
Set<GraphHelper.VertexInfo> compositeVertices = getOwnedVertices(instanceVertex);
// Record all deletion candidate GUIDs in RequestContext
// and gather deletion candidate vertices.
for (GraphHelper.VertexInfo vertexInfo : compositeVertices) {
requestContext.recordEntityDelete(new AtlasObjectId(vertexInfo.getGuid(), vertexInfo.getTypeName()));
deletionCandidateVertices.add(vertexInfo.getVertex());
}
}
// Delete traits and vertices.
for (AtlasVertex deletionCandidateVertex : deletionCandidateVertices) {
deleteAllTraits(deletionCandidateVertex);
deleteTypeVertex(deletionCandidateVertex, false);
}
} | java | public void deleteEntities(Collection<AtlasVertex> instanceVertices) throws AtlasBaseException {
RequestContextV1 requestContext = RequestContextV1.get();
Set<AtlasVertex> deletionCandidateVertices = new HashSet<>();
for (AtlasVertex instanceVertex : instanceVertices) {
String guid = AtlasGraphUtilsV1.getIdFromVertex(instanceVertex);
AtlasEntity.Status state = AtlasGraphUtilsV1.getState(instanceVertex);
if (state == AtlasEntity.Status.DELETED) {
LOG.debug("Skipping deletion of {} as it is already deleted", guid);
continue;
}
String typeName = AtlasGraphUtilsV1.getTypeName(instanceVertex);
AtlasObjectId objId = new AtlasObjectId(guid, typeName);
if (requestContext.getDeletedEntityIds().contains(objId)) {
LOG.debug("Skipping deletion of {} as it is already deleted", guid);
continue;
}
// Get GUIDs and vertices for all deletion candidates.
Set<GraphHelper.VertexInfo> compositeVertices = getOwnedVertices(instanceVertex);
// Record all deletion candidate GUIDs in RequestContext
// and gather deletion candidate vertices.
for (GraphHelper.VertexInfo vertexInfo : compositeVertices) {
requestContext.recordEntityDelete(new AtlasObjectId(vertexInfo.getGuid(), vertexInfo.getTypeName()));
deletionCandidateVertices.add(vertexInfo.getVertex());
}
}
// Delete traits and vertices.
for (AtlasVertex deletionCandidateVertex : deletionCandidateVertices) {
deleteAllTraits(deletionCandidateVertex);
deleteTypeVertex(deletionCandidateVertex, false);
}
} | [
"public",
"void",
"deleteEntities",
"(",
"Collection",
"<",
"AtlasVertex",
">",
"instanceVertices",
")",
"throws",
"AtlasBaseException",
"{",
"RequestContextV1",
"requestContext",
"=",
"RequestContextV1",
".",
"get",
"(",
")",
";",
"Set",
"<",
"AtlasVertex",
">",
... | Deletes the specified entity vertices.
Deletes any traits, composite entities, and structs owned by each entity.
Also deletes all the references from/to the entity.
@param instanceVertices
@throws AtlasException | [
"Deletes",
"the",
"specified",
"entity",
"vertices",
".",
"Deletes",
"any",
"traits",
"composite",
"entities",
"and",
"structs",
"owned",
"by",
"each",
"entity",
".",
"Also",
"deletes",
"all",
"the",
"references",
"from",
"/",
"to",
"the",
"entity",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java#L85-L123 |
sjamesr/jfreesane | src/main/java/au/com/southsky/jfreesane/SaneSession.java | SaneSession.withRemoteSane | public static SaneSession withRemoteSane(
InetAddress saneAddress, long timeout, TimeUnit timeUnit, long soTimeout, TimeUnit soTimeUnit)
throws IOException {
return withRemoteSane(saneAddress, DEFAULT_PORT, timeout, timeUnit, soTimeout, soTimeUnit);
} | java | public static SaneSession withRemoteSane(
InetAddress saneAddress, long timeout, TimeUnit timeUnit, long soTimeout, TimeUnit soTimeUnit)
throws IOException {
return withRemoteSane(saneAddress, DEFAULT_PORT, timeout, timeUnit, soTimeout, soTimeUnit);
} | [
"public",
"static",
"SaneSession",
"withRemoteSane",
"(",
"InetAddress",
"saneAddress",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
",",
"long",
"soTimeout",
",",
"TimeUnit",
"soTimeUnit",
")",
"throws",
"IOException",
"{",
"return",
"withRemoteSane",
"(",
... | Establishes a connection to the SANE daemon running on the given host on the default SANE port
with the given connection timeout. | [
"Establishes",
"a",
"connection",
"to",
"the",
"SANE",
"daemon",
"running",
"on",
"the",
"given",
"host",
"on",
"the",
"default",
"SANE",
"port",
"with",
"the",
"given",
"connection",
"timeout",
"."
] | train | https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L67-L71 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/LinearEquationSystem.java | LinearEquationSystem.totalPivotSearch | private IntIntPair totalPivotSearch(int k) {
double max = 0;
int i, j, pivotRow = k, pivotCol = k;
double absValue;
for(i = k; i < coeff.length; i++) {
for(j = k; j < coeff[0].length; j++) {
// compute absolute value of
// current entry in absValue
absValue = Math.abs(coeff[row[i]][col[j]]);
// compare absValue with value max
// found so far
if(max < absValue) {
// remember new value and position
max = absValue;
pivotRow = i;
pivotCol = j;
} // end if
} // end for j
} // end for k
return new IntIntPair(pivotRow, pivotCol);
} | java | private IntIntPair totalPivotSearch(int k) {
double max = 0;
int i, j, pivotRow = k, pivotCol = k;
double absValue;
for(i = k; i < coeff.length; i++) {
for(j = k; j < coeff[0].length; j++) {
// compute absolute value of
// current entry in absValue
absValue = Math.abs(coeff[row[i]][col[j]]);
// compare absValue with value max
// found so far
if(max < absValue) {
// remember new value and position
max = absValue;
pivotRow = i;
pivotCol = j;
} // end if
} // end for j
} // end for k
return new IntIntPair(pivotRow, pivotCol);
} | [
"private",
"IntIntPair",
"totalPivotSearch",
"(",
"int",
"k",
")",
"{",
"double",
"max",
"=",
"0",
";",
"int",
"i",
",",
"j",
",",
"pivotRow",
"=",
"k",
",",
"pivotCol",
"=",
"k",
";",
"double",
"absValue",
";",
"for",
"(",
"i",
"=",
"k",
";",
"i... | Method for total pivot search, searches for x,y in {k,...n}, so that
{@code |a_xy| > |a_ij|}
@param k search starts at entry (k,k)
@return the position of the found pivot element | [
"Method",
"for",
"total",
"pivot",
"search",
"searches",
"for",
"x",
"y",
"in",
"{",
"k",
"...",
"n",
"}",
"so",
"that",
"{",
"@code",
"|a_xy|",
">",
"|a_ij|",
"}"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/LinearEquationSystem.java#L472-L493 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.task_contactChange_GET | public ArrayList<Long> task_contactChange_GET(String askingAccount, net.minidev.ovh.api.nichandle.changecontact.OvhTaskStateEnum state, String toAccount) throws IOException {
String qPath = "/me/task/contactChange";
StringBuilder sb = path(qPath);
query(sb, "askingAccount", askingAccount);
query(sb, "state", state);
query(sb, "toAccount", toAccount);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> task_contactChange_GET(String askingAccount, net.minidev.ovh.api.nichandle.changecontact.OvhTaskStateEnum state, String toAccount) throws IOException {
String qPath = "/me/task/contactChange";
StringBuilder sb = path(qPath);
query(sb, "askingAccount", askingAccount);
query(sb, "state", state);
query(sb, "toAccount", toAccount);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"task_contactChange_GET",
"(",
"String",
"askingAccount",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"nichandle",
".",
"changecontact",
".",
"OvhTaskStateEnum",
"state",
",",
"String",
"toAccount",
")",
"t... | List of service contact change tasks you are involved in
REST: GET /me/task/contactChange
@param toAccount [required] Filter the value of toAccount property (like)
@param state [required] Filter the value of state property (like)
@param askingAccount [required] Filter the value of askingAccount property (like) | [
"List",
"of",
"service",
"contact",
"change",
"tasks",
"you",
"are",
"involved",
"in"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2460-L2468 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java | PageInBrowserStats.getAverageDOMLoadTime | public double getAverageDOMLoadTime(final String intervalName, final TimeUnit unit) {
return unit.transformMillis(totalDomLoadTime.getValueAsLong(intervalName)) / numberOfLoads.getValueAsDouble(intervalName);
} | java | public double getAverageDOMLoadTime(final String intervalName, final TimeUnit unit) {
return unit.transformMillis(totalDomLoadTime.getValueAsLong(intervalName)) / numberOfLoads.getValueAsDouble(intervalName);
} | [
"public",
"double",
"getAverageDOMLoadTime",
"(",
"final",
"String",
"intervalName",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"return",
"unit",
".",
"transformMillis",
"(",
"totalDomLoadTime",
".",
"getValueAsLong",
"(",
"intervalName",
")",
")",
"/",
"numberOf... | Returns the average DOM load time for given interval and {@link TimeUnit}.
@param intervalName name of the interval
@param unit {@link TimeUnit}
@return average DOM load time | [
"Returns",
"the",
"average",
"DOM",
"load",
"time",
"for",
"given",
"interval",
"and",
"{",
"@link",
"TimeUnit",
"}",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L210-L212 |
validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.pushCharArray | private void pushCharArray(String ename, char[] ch, int start, int length)
throws SAXException {
// Push the existing status
pushInput(ename);
if ((ename != null) && doReport) {
dataBufferFlush();
handler.startInternalEntity(ename);
}
sourceType = INPUT_INTERNAL;
readBuffer = ch;
readBufferPos = start;
readBufferLength = length;
readBufferOverflow = -1;
} | java | private void pushCharArray(String ename, char[] ch, int start, int length)
throws SAXException {
// Push the existing status
pushInput(ename);
if ((ename != null) && doReport) {
dataBufferFlush();
handler.startInternalEntity(ename);
}
sourceType = INPUT_INTERNAL;
readBuffer = ch;
readBufferPos = start;
readBufferLength = length;
readBufferOverflow = -1;
} | [
"private",
"void",
"pushCharArray",
"(",
"String",
"ename",
",",
"char",
"[",
"]",
"ch",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"SAXException",
"{",
"// Push the existing status",
"pushInput",
"(",
"ename",
")",
";",
"if",
"(",
"(",
"ena... | Push a new internal input source.
<p>
This method is useful for expanding an internal entity, or for unreading
a string of characters. It creates a new readBuffer containing the
characters in the array, instead of characters converted from an input
byte stream.
@param ch
The char array to push.
@see #pushString
@see #pushURL
@see #readBuffer
@see #sourceType
@see #pushInput | [
"Push",
"a",
"new",
"internal",
"input",
"source",
".",
"<p",
">",
"This",
"method",
"is",
"useful",
"for",
"expanding",
"an",
"internal",
"entity",
"or",
"for",
"unreading",
"a",
"string",
"of",
"characters",
".",
"It",
"creates",
"a",
"new",
"readBuffer"... | train | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L4152-L4165 |
aws/aws-sdk-java | aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java | EntityFilter.setTags | public void setTags(java.util.Collection<java.util.Map<String, String>> tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new java.util.ArrayList<java.util.Map<String, String>>(tags);
} | java | public void setTags(java.util.Collection<java.util.Map<String, String>> tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new java.util.ArrayList<java.util.Map<String, String>>(tags);
} | [
"public",
"void",
"setTags",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
">",
"tags",
")",
"{",
"if",
"(",
"tags",
"==",
"null",
")",
"{",
"this",
".",
"tags",
"=",
"null",... | <p>
A map of entity tags attached to the affected entity.
</p>
@param tags
A map of entity tags attached to the affected entity. | [
"<p",
">",
"A",
"map",
"of",
"entity",
"tags",
"attached",
"to",
"the",
"affected",
"entity",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java#L378-L385 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java | ClassBuilder.buildMemberSummary | public void buildMemberSummary(XMLNode node, Content classContentTree) throws Exception {
Content memberSummaryTree = writer.getMemberTreeHeader();
configuration.getBuilderFactory().
getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
classContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
} | java | public void buildMemberSummary(XMLNode node, Content classContentTree) throws Exception {
Content memberSummaryTree = writer.getMemberTreeHeader();
configuration.getBuilderFactory().
getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
classContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
} | [
"public",
"void",
"buildMemberSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"classContentTree",
")",
"throws",
"Exception",
"{",
"Content",
"memberSummaryTree",
"=",
"writer",
".",
"getMemberTreeHeader",
"(",
")",
";",
"configuration",
".",
"getBuilderFactory",
... | Build the member summary contents of the page.
@param node the XML element that specifies which components to document
@param classContentTree the content tree to which the documentation will be added | [
"Build",
"the",
"member",
"summary",
"contents",
"of",
"the",
"page",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java#L339-L344 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java | TextFormatter.appendSize | public static void appendSize(StringBuilder buf, long size) {
if (size >= 104857600) { // >= 100 MiB
buf.append(size / 1048576).append("MiB(").append(size).append("B)");
} else if (size >= 102400) { // >= 100 KiB
buf.append(size / 1024).append("KiB(").append(size).append("B)");
} else {
buf.append(size).append('B');
}
} | java | public static void appendSize(StringBuilder buf, long size) {
if (size >= 104857600) { // >= 100 MiB
buf.append(size / 1048576).append("MiB(").append(size).append("B)");
} else if (size >= 102400) { // >= 100 KiB
buf.append(size / 1024).append("KiB(").append(size).append("B)");
} else {
buf.append(size).append('B');
}
} | [
"public",
"static",
"void",
"appendSize",
"(",
"StringBuilder",
"buf",
",",
"long",
"size",
")",
"{",
"if",
"(",
"size",
">=",
"104857600",
")",
"{",
"// >= 100 MiB",
"buf",
".",
"append",
"(",
"size",
"/",
"1048576",
")",
".",
"append",
"(",
"\"MiB(\"",... | Appends the human-readable representation of the specified byte-unit {@code size} to the specified
{@link StringBuffer}. | [
"Appends",
"the",
"human",
"-",
"readable",
"representation",
"of",
"the",
"specified",
"byte",
"-",
"unit",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java#L36-L44 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/inline/InlineMediaSource.java | InlineMediaSource.getInlineAsset | private Asset getInlineAsset(Resource ntResourceResource, Media media, String fileName) {
return new InlineAsset(ntResourceResource, media, fileName, adaptable);
} | java | private Asset getInlineAsset(Resource ntResourceResource, Media media, String fileName) {
return new InlineAsset(ntResourceResource, media, fileName, adaptable);
} | [
"private",
"Asset",
"getInlineAsset",
"(",
"Resource",
"ntResourceResource",
",",
"Media",
"media",
",",
"String",
"fileName",
")",
"{",
"return",
"new",
"InlineAsset",
"(",
"ntResourceResource",
",",
"media",
",",
"fileName",
",",
"adaptable",
")",
";",
"}"
] | Get implementation of inline media item
@param ntResourceResource nt:resource node
@param media Media metadata
@param fileName File name
@return Inline media item instance | [
"Get",
"implementation",
"of",
"inline",
"media",
"item"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineMediaSource.java#L170-L172 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/cdn/CdnClient.java | CdnClient.setRequestAuth | public SetRequestAuthResponse setRequestAuth(SetRequestAuthRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest =
createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
internalRequest.addParameter("requestAuth", "");
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, SetRequestAuthResponse.class);
} | java | public SetRequestAuthResponse setRequestAuth(SetRequestAuthRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest =
createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
internalRequest.addParameter("requestAuth", "");
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, SetRequestAuthResponse.class);
} | [
"public",
"SetRequestAuthResponse",
"setRequestAuth",
"(",
"SetRequestAuthRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"request",... | Set the request authentication.
@param request The request containing all of the options related to the update request.
@return Result of the setHTTPSAcceleration operation returned by the service. | [
"Set",
"the",
"request",
"authentication",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L494-L501 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java | GVRPose.getLocalRotation | public void getLocalRotation(int boneindex, Quaternionf q)
{
Bone bone = mBones[boneindex];
if ((bone.Changed & (WORLD_POS | WORLD_ROT)) != 0)
{
calcLocal(bone, mSkeleton.getParentBoneIndex(boneindex));
}
bone.LocalMatrix.getUnnormalizedRotation(q);
q.normalize();
} | java | public void getLocalRotation(int boneindex, Quaternionf q)
{
Bone bone = mBones[boneindex];
if ((bone.Changed & (WORLD_POS | WORLD_ROT)) != 0)
{
calcLocal(bone, mSkeleton.getParentBoneIndex(boneindex));
}
bone.LocalMatrix.getUnnormalizedRotation(q);
q.normalize();
} | [
"public",
"void",
"getLocalRotation",
"(",
"int",
"boneindex",
",",
"Quaternionf",
"q",
")",
"{",
"Bone",
"bone",
"=",
"mBones",
"[",
"boneindex",
"]",
";",
"if",
"(",
"(",
"bone",
".",
"Changed",
"&",
"(",
"WORLD_POS",
"|",
"WORLD_ROT",
")",
")",
"!="... | Gets the local rotation for a bone given its index.
@param boneindex zero based index of bone whose rotation is wanted.
@return local rotation for the designated bone as a quaternion.
@see #setLocalRotation
@see #setWorldRotations
@see #setWorldMatrix
@see GVRSkeleton#setBoneAxis | [
"Gets",
"the",
"local",
"rotation",
"for",
"a",
"bone",
"given",
"its",
"index",
".",
"@param",
"boneindex",
"zero",
"based",
"index",
"of",
"bone",
"whose",
"rotation",
"is",
"wanted",
".",
"@return",
"local",
"rotation",
"for",
"the",
"designated",
"bone",... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L588-L598 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.reportSyntaxError | private void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) {
int pos = diagPos.getPreferredPosition();
if (pos > S.errPos() || pos == Position.NOPOS) {
if (token.kind == EOF) {
error(diagPos, "premature.eof");
} else {
error(diagPos, key, args);
}
}
S.errPos(pos);
if (token.pos == errorPos)
nextToken(); // guarantee progress
errorPos = token.pos;
} | java | private void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) {
int pos = diagPos.getPreferredPosition();
if (pos > S.errPos() || pos == Position.NOPOS) {
if (token.kind == EOF) {
error(diagPos, "premature.eof");
} else {
error(diagPos, key, args);
}
}
S.errPos(pos);
if (token.pos == errorPos)
nextToken(); // guarantee progress
errorPos = token.pos;
} | [
"private",
"void",
"reportSyntaxError",
"(",
"JCDiagnostic",
".",
"DiagnosticPosition",
"diagPos",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"int",
"pos",
"=",
"diagPos",
".",
"getPreferredPosition",
"(",
")",
";",
"if",
"(",
"pos",
">",
... | Report a syntax error using the given DiagnosticPosition object and
arguments, unless one was already reported at the same position. | [
"Report",
"a",
"syntax",
"error",
"using",
"the",
"given",
"DiagnosticPosition",
"object",
"and",
"arguments",
"unless",
"one",
"was",
"already",
"reported",
"at",
"the",
"same",
"position",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/parser/JavacParser.java#L469-L482 |
mnlipp/jgrapes | org.jgrapes.http/src/org/jgrapes/http/ResponseCreationSupport.java | ResponseCreationSupport.uriFromPath | public static URI uriFromPath(String path) throws IllegalArgumentException {
try {
return new URI(null, null, path, null);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
} | java | public static URI uriFromPath(String path) throws IllegalArgumentException {
try {
return new URI(null, null, path, null);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
} | [
"public",
"static",
"URI",
"uriFromPath",
"(",
"String",
"path",
")",
"throws",
"IllegalArgumentException",
"{",
"try",
"{",
"return",
"new",
"URI",
"(",
"null",
",",
"null",
",",
"path",
",",
"null",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",... | Create a {@link URI} from a path. This is similar to calling
`new URI(null, null, path, null)` with the {@link URISyntaxException}
converted to a {@link IllegalArgumentException}.
@param path the path
@return the uri
@throws IllegalArgumentException if the string violates
RFC 2396 | [
"Create",
"a",
"{",
"@link",
"URI",
"}",
"from",
"a",
"path",
".",
"This",
"is",
"similar",
"to",
"calling",
"new",
"URI",
"(",
"null",
"null",
"path",
"null",
")",
"with",
"the",
"{",
"@link",
"URISyntaxException",
"}",
"converted",
"to",
"a",
"{",
... | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/ResponseCreationSupport.java#L311-L317 |
OpenBEL/openbel-framework | org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseTwoApplication.java | PhaseTwoApplication.stage3Statement | private void stage3Statement(final ProtoNetwork network, int pct) {
stageOutput("Equivalencing statements");
int sct = p2.stage3EquivalenceStatements(network);
stageOutput("(" + sct + " equivalences)");
} | java | private void stage3Statement(final ProtoNetwork network, int pct) {
stageOutput("Equivalencing statements");
int sct = p2.stage3EquivalenceStatements(network);
stageOutput("(" + sct + " equivalences)");
} | [
"private",
"void",
"stage3Statement",
"(",
"final",
"ProtoNetwork",
"network",
",",
"int",
"pct",
")",
"{",
"stageOutput",
"(",
"\"Equivalencing statements\"",
")",
";",
"int",
"sct",
"=",
"p2",
".",
"stage3EquivalenceStatements",
"(",
"network",
")",
";",
"stag... | Stage three statement equivalencing.
@param network the {@link ProtoNetwork network} to equivalence
@param pct the parameter equivalencing count to control output | [
"Stage",
"three",
"statement",
"equivalencing",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseTwoApplication.java#L375-L379 |
ontop/ontop | core/model/src/main/java/it/unibz/inf/ontop/dbschema/BasicDBMetadata.java | BasicDBMetadata.add | protected <T extends RelationDefinition> void add(T td, Map<RelationID, T> schema) {
if (!isStillMutable) {
throw new IllegalStateException("Too late, cannot add a schema");
}
schema.put(td.getID(), td);
if (td.getID().hasSchema()) {
RelationID noSchemaID = td.getID().getSchemalessID();
if (!schema.containsKey(noSchemaID)) {
schema.put(noSchemaID, td);
}
else {
LOGGER.warn("DUPLICATE TABLE NAMES, USE QUALIFIED NAMES:\n" + td + "\nAND\n" + schema.get(noSchemaID));
//schema.remove(noSchemaID);
// TODO (ROMAN 8 Oct 2015): think of a better way of resolving ambiguities
}
}
} | java | protected <T extends RelationDefinition> void add(T td, Map<RelationID, T> schema) {
if (!isStillMutable) {
throw new IllegalStateException("Too late, cannot add a schema");
}
schema.put(td.getID(), td);
if (td.getID().hasSchema()) {
RelationID noSchemaID = td.getID().getSchemalessID();
if (!schema.containsKey(noSchemaID)) {
schema.put(noSchemaID, td);
}
else {
LOGGER.warn("DUPLICATE TABLE NAMES, USE QUALIFIED NAMES:\n" + td + "\nAND\n" + schema.get(noSchemaID));
//schema.remove(noSchemaID);
// TODO (ROMAN 8 Oct 2015): think of a better way of resolving ambiguities
}
}
} | [
"protected",
"<",
"T",
"extends",
"RelationDefinition",
">",
"void",
"add",
"(",
"T",
"td",
",",
"Map",
"<",
"RelationID",
",",
"T",
">",
"schema",
")",
"{",
"if",
"(",
"!",
"isStillMutable",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Too... | Inserts a new data definition to this metadata object.
@param td
The data definition. It can be a {@link DatabaseRelationDefinition} or a
{@link ParserViewDefinition} object. | [
"Inserts",
"a",
"new",
"data",
"definition",
"to",
"this",
"metadata",
"object",
"."
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/dbschema/BasicDBMetadata.java#L86-L102 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java | MultiUserChatLightManager.blockUsers | public void blockUsers(DomainBareJid mucLightService, List<Jid> usersJids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
HashMap<Jid, Boolean> users = new HashMap<>();
for (Jid jid : usersJids) {
users.put(jid, false);
}
sendBlockUsers(mucLightService, users);
} | java | public void blockUsers(DomainBareJid mucLightService, List<Jid> usersJids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
HashMap<Jid, Boolean> users = new HashMap<>();
for (Jid jid : usersJids) {
users.put(jid, false);
}
sendBlockUsers(mucLightService, users);
} | [
"public",
"void",
"blockUsers",
"(",
"DomainBareJid",
"mucLightService",
",",
"List",
"<",
"Jid",
">",
"usersJids",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"HashMap",
"<",
"Jid",
... | Block users.
@param mucLightService
@param usersJids
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException | [
"Block",
"users",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java#L313-L320 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/TypeUtil.java | TypeUtil.isDouble | public static boolean isDouble(String _str, char _separator, boolean _allowNegative) {
String pattern = "\\d+XXX\\d+$";
if (_separator == '.') {
pattern = pattern.replace("XXX", "\\.?");
} else {
pattern = pattern.replace("XXX", _separator + "?");
}
if (_allowNegative) {
pattern = "^-?" + pattern;
} else {
pattern = "^" + pattern;
}
if (_str != null) {
return _str.matches(pattern) || isInteger(_str, _allowNegative);
}
return false;
} | java | public static boolean isDouble(String _str, char _separator, boolean _allowNegative) {
String pattern = "\\d+XXX\\d+$";
if (_separator == '.') {
pattern = pattern.replace("XXX", "\\.?");
} else {
pattern = pattern.replace("XXX", _separator + "?");
}
if (_allowNegative) {
pattern = "^-?" + pattern;
} else {
pattern = "^" + pattern;
}
if (_str != null) {
return _str.matches(pattern) || isInteger(_str, _allowNegative);
}
return false;
} | [
"public",
"static",
"boolean",
"isDouble",
"(",
"String",
"_str",
",",
"char",
"_separator",
",",
"boolean",
"_allowNegative",
")",
"{",
"String",
"pattern",
"=",
"\"\\\\d+XXX\\\\d+$\"",
";",
"if",
"(",
"_separator",
"==",
"'",
"'",
")",
"{",
"pattern",
"=",... | Checks if the given string is a valid double.
@param _str string to validate
@param _separator seperator used (e.g. "." (dot) or "," (comma))
@param _allowNegative set to true if negative double should be allowed
@return true if given string is double, false otherwise | [
"Checks",
"if",
"the",
"given",
"string",
"is",
"a",
"valid",
"double",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/TypeUtil.java#L76-L94 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/DefaultBeanContext.java | DefaultBeanContext.findConcreteCandidate | protected @Nonnull <T> BeanDefinition<T> findConcreteCandidate(
@Nonnull Class<T> beanType,
@Nullable Qualifier<T> qualifier,
@Nonnull Collection<BeanDefinition<T>> candidates) {
throw new NonUniqueBeanException(beanType, candidates.iterator());
} | java | protected @Nonnull <T> BeanDefinition<T> findConcreteCandidate(
@Nonnull Class<T> beanType,
@Nullable Qualifier<T> qualifier,
@Nonnull Collection<BeanDefinition<T>> candidates) {
throw new NonUniqueBeanException(beanType, candidates.iterator());
} | [
"protected",
"@",
"Nonnull",
"<",
"T",
">",
"BeanDefinition",
"<",
"T",
">",
"findConcreteCandidate",
"(",
"@",
"Nonnull",
"Class",
"<",
"T",
">",
"beanType",
",",
"@",
"Nullable",
"Qualifier",
"<",
"T",
">",
"qualifier",
",",
"@",
"Nonnull",
"Collection",... | Fall back method to attempt to find a candidate for the given definitions.
@param beanType The bean type
@param qualifier The qualifier
@param candidates The candidates
@param <T> The generic time
@return The concrete bean definition | [
"Fall",
"back",
"method",
"to",
"attempt",
"to",
"find",
"a",
"candidate",
"for",
"the",
"given",
"definitions",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L1593-L1598 |
grpc/grpc-java | okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OkHostnameVerifier.java | OkHostnameVerifier.verifyIpAddress | private boolean verifyIpAddress(String ipAddress, X509Certificate certificate) {
List<String> altNames = getSubjectAltNames(certificate, ALT_IPA_NAME);
for (int i = 0, size = altNames.size(); i < size; i++) {
if (ipAddress.equalsIgnoreCase(altNames.get(i))) {
return true;
}
}
return false;
} | java | private boolean verifyIpAddress(String ipAddress, X509Certificate certificate) {
List<String> altNames = getSubjectAltNames(certificate, ALT_IPA_NAME);
for (int i = 0, size = altNames.size(); i < size; i++) {
if (ipAddress.equalsIgnoreCase(altNames.get(i))) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"verifyIpAddress",
"(",
"String",
"ipAddress",
",",
"X509Certificate",
"certificate",
")",
"{",
"List",
"<",
"String",
">",
"altNames",
"=",
"getSubjectAltNames",
"(",
"certificate",
",",
"ALT_IPA_NAME",
")",
";",
"for",
"(",
"int",
"i",
... | Returns true if {@code certificate} matches {@code ipAddress}. | [
"Returns",
"true",
"if",
"{"
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OkHostnameVerifier.java#L87-L95 |
google/error-prone | check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java | ASTHelpers.hasDirectAnnotationWithSimpleName | public static boolean hasDirectAnnotationWithSimpleName(Symbol sym, String simpleName) {
for (AnnotationMirror annotation : sym.getAnnotationMirrors()) {
if (annotation.getAnnotationType().asElement().getSimpleName().contentEquals(simpleName)) {
return true;
}
}
return false;
} | java | public static boolean hasDirectAnnotationWithSimpleName(Symbol sym, String simpleName) {
for (AnnotationMirror annotation : sym.getAnnotationMirrors()) {
if (annotation.getAnnotationType().asElement().getSimpleName().contentEquals(simpleName)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"hasDirectAnnotationWithSimpleName",
"(",
"Symbol",
"sym",
",",
"String",
"simpleName",
")",
"{",
"for",
"(",
"AnnotationMirror",
"annotation",
":",
"sym",
".",
"getAnnotationMirrors",
"(",
")",
")",
"{",
"if",
"(",
"annotation",
"... | Check for the presence of an annotation with a specific simple name directly on this symbol.
Does *not* consider annotation inheritance.
@param sym the symbol to check for the presence of the annotation
@param simpleName the simple name of the annotation to look for, e.g. "Nullable" or
"CheckReturnValue" | [
"Check",
"for",
"the",
"presence",
"of",
"an",
"annotation",
"with",
"a",
"specific",
"simple",
"name",
"directly",
"on",
"this",
"symbol",
".",
"Does",
"*",
"not",
"*",
"consider",
"annotation",
"inheritance",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L740-L747 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/HttpMessageSecurity.java | HttpMessageSecurity.protectPayload | private JWEObject protectPayload(String payload) throws IOException {
try {
JWEHeader jweHeader = new JWEHeader("RSA-OAEP", serverEncryptionKey.kid(), "A128CBC-HS256");
byte[] aesKeyBytes = generateAesKey();
SymmetricKey aesKey = new SymmetricKey(UUID.randomUUID().toString(), aesKeyBytes);
byte[] iv = generateAesIv();
RsaKey serverEncryptionRsaKey = new RsaKey(serverEncryptionKey.kid(), serverEncryptionKey.toRSA(false));
Triple<byte[], byte[], String> encryptedKey = serverEncryptionRsaKey
.encryptAsync(aesKeyBytes, null, null, "RSA-OAEP").get();
Triple<byte[], byte[], String> cipher = aesKey
.encryptAsync(payload.getBytes(MESSAGE_ENCODING), iv,
MessageSecurityHelper.stringToBase64Url(jweHeader.serialize()).getBytes(MESSAGE_ENCODING), "A128CBC-HS256")
.get();
JWEObject jweObject = new JWEObject(jweHeader,
MessageSecurityHelper.bytesToBase64Url((!testMode) ? encryptedKey.getLeft() : "key".getBytes(MESSAGE_ENCODING)),
MessageSecurityHelper.bytesToBase64Url(iv),
MessageSecurityHelper.bytesToBase64Url(cipher.getLeft()),
MessageSecurityHelper.bytesToBase64Url(cipher.getMiddle()));
return jweObject;
} catch (ExecutionException e) {
// unexpected;
return null;
} catch (InterruptedException e) {
// unexpected;
return null;
} catch (NoSuchAlgorithmException e) {
// unexpected;
return null;
}
} | java | private JWEObject protectPayload(String payload) throws IOException {
try {
JWEHeader jweHeader = new JWEHeader("RSA-OAEP", serverEncryptionKey.kid(), "A128CBC-HS256");
byte[] aesKeyBytes = generateAesKey();
SymmetricKey aesKey = new SymmetricKey(UUID.randomUUID().toString(), aesKeyBytes);
byte[] iv = generateAesIv();
RsaKey serverEncryptionRsaKey = new RsaKey(serverEncryptionKey.kid(), serverEncryptionKey.toRSA(false));
Triple<byte[], byte[], String> encryptedKey = serverEncryptionRsaKey
.encryptAsync(aesKeyBytes, null, null, "RSA-OAEP").get();
Triple<byte[], byte[], String> cipher = aesKey
.encryptAsync(payload.getBytes(MESSAGE_ENCODING), iv,
MessageSecurityHelper.stringToBase64Url(jweHeader.serialize()).getBytes(MESSAGE_ENCODING), "A128CBC-HS256")
.get();
JWEObject jweObject = new JWEObject(jweHeader,
MessageSecurityHelper.bytesToBase64Url((!testMode) ? encryptedKey.getLeft() : "key".getBytes(MESSAGE_ENCODING)),
MessageSecurityHelper.bytesToBase64Url(iv),
MessageSecurityHelper.bytesToBase64Url(cipher.getLeft()),
MessageSecurityHelper.bytesToBase64Url(cipher.getMiddle()));
return jweObject;
} catch (ExecutionException e) {
// unexpected;
return null;
} catch (InterruptedException e) {
// unexpected;
return null;
} catch (NoSuchAlgorithmException e) {
// unexpected;
return null;
}
} | [
"private",
"JWEObject",
"protectPayload",
"(",
"String",
"payload",
")",
"throws",
"IOException",
"{",
"try",
"{",
"JWEHeader",
"jweHeader",
"=",
"new",
"JWEHeader",
"(",
"\"RSA-OAEP\"",
",",
"serverEncryptionKey",
".",
"kid",
"(",
")",
",",
"\"A128CBC-HS256\"",
... | Encrypt provided payload and return proper JWEObject.
@param payload Content to be encrypted. Content will be encrypted with
UTF-8 representation of contents as per
https://tools.ietf.org/html/rfc7515. It can
represent anything.
@return JWEObject with encrypted payload.
@throws IOException throws IOException | [
"Encrypt",
"provided",
"payload",
"and",
"return",
"proper",
"JWEObject",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/HttpMessageSecurity.java#L293-L329 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Query.java | Query.aroundLatitudeLongitude | public Query aroundLatitudeLongitude(float latitude, float longitude, int radius, int precision) {
aroundLatLong = "aroundLatLng=" + latitude + "," + longitude;
aroundRadius = radius;
aroundPrecision = precision;
return this;
} | java | public Query aroundLatitudeLongitude(float latitude, float longitude, int radius, int precision) {
aroundLatLong = "aroundLatLng=" + latitude + "," + longitude;
aroundRadius = radius;
aroundPrecision = precision;
return this;
} | [
"public",
"Query",
"aroundLatitudeLongitude",
"(",
"float",
"latitude",
",",
"float",
"longitude",
",",
"int",
"radius",
",",
"int",
"precision",
")",
"{",
"aroundLatLong",
"=",
"\"aroundLatLng=\"",
"+",
"latitude",
"+",
"\",\"",
"+",
"longitude",
";",
"aroundRa... | Search for entries around a given latitude/longitude.
@param radius set the maximum distance in meters (manually defined)
@param precision set the precision for ranking (for example if you set
precision=100, two objects that are distant of less than 100m
will be considered as identical for "geo" ranking parameter).
Note: at indexing, geoloc of an object should be set with
_geoloc attribute containing lat and lng attributes (for
example {"_geoloc":{"lat":48.853409, "lng":2.348800}}) | [
"Search",
"for",
"entries",
"around",
"a",
"given",
"latitude",
"/",
"longitude",
"."
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Query.java#L474-L479 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseDereferenceExpression | private Expr parseDereferenceExpression(EnclosingScope scope, boolean terminated) {
int start = index;
match(Star);
Expr expression = parseTermExpression(scope, terminated);
return annotateSourceLocation(new Expr.Dereference(Type.Void, expression), start);
} | java | private Expr parseDereferenceExpression(EnclosingScope scope, boolean terminated) {
int start = index;
match(Star);
Expr expression = parseTermExpression(scope, terminated);
return annotateSourceLocation(new Expr.Dereference(Type.Void, expression), start);
} | [
"private",
"Expr",
"parseDereferenceExpression",
"(",
"EnclosingScope",
"scope",
",",
"boolean",
"terminated",
")",
"{",
"int",
"start",
"=",
"index",
";",
"match",
"(",
"Star",
")",
";",
"Expr",
"expression",
"=",
"parseTermExpression",
"(",
"scope",
",",
"te... | Parse a dereference expression, which has the form:
<pre>
TermExpr::= ...
| '*' Expr
</pre>
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@return | [
"Parse",
"a",
"dereference",
"expression",
"which",
"has",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L3092-L3097 |
real-logic/agrona | agrona/src/main/java/org/agrona/concurrent/AgentRunner.java | AgentRunner.startOnThread | public static Thread startOnThread(final AgentRunner runner, final ThreadFactory threadFactory)
{
final Thread thread = threadFactory.newThread(runner);
thread.setName(runner.agent().roleName());
thread.start();
return thread;
} | java | public static Thread startOnThread(final AgentRunner runner, final ThreadFactory threadFactory)
{
final Thread thread = threadFactory.newThread(runner);
thread.setName(runner.agent().roleName());
thread.start();
return thread;
} | [
"public",
"static",
"Thread",
"startOnThread",
"(",
"final",
"AgentRunner",
"runner",
",",
"final",
"ThreadFactory",
"threadFactory",
")",
"{",
"final",
"Thread",
"thread",
"=",
"threadFactory",
".",
"newThread",
"(",
"runner",
")",
";",
"thread",
".",
"setName"... | Start the given agent runner on a new thread.
@param runner the agent runner to start.
@param threadFactory the factory to use to create the thread.
@return the new thread that has been started. | [
"Start",
"the",
"given",
"agent",
"runner",
"on",
"a",
"new",
"thread",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/concurrent/AgentRunner.java#L95-L102 |
synchronoss/cpo-api | cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java | CassandraCpoAdapter.retrieveBean | @Override
public <T, C> T retrieveBean(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException {
Iterator<T> it = processSelectGroup(name, criteria, result, wheres, orderBy, nativeExpressions, true).iterator();
if (it.hasNext()) {
return it.next();
} else {
return null;
}
} | java | @Override
public <T, C> T retrieveBean(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException {
Iterator<T> it = processSelectGroup(name, criteria, result, wheres, orderBy, nativeExpressions, true).iterator();
if (it.hasNext()) {
return it.next();
} else {
return null;
}
} | [
"@",
"Override",
"public",
"<",
"T",
",",
"C",
">",
"T",
"retrieveBean",
"(",
"String",
"name",
",",
"C",
"criteria",
",",
"T",
"result",
",",
"Collection",
"<",
"CpoWhere",
">",
"wheres",
",",
"Collection",
"<",
"CpoOrderBy",
">",
"orderBy",
",",
"Col... | Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve
function defined for this beans returns more than one row, an exception will be thrown.
@param name The filter name which tells the datasource which beans should be returned. The name also signifies what
data in the bean will be populated.
@param criteria This is an bean that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown.
This bean is used to specify the arguments used to retrieve the collection of beans.
@param result This is an bean that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown.
This bean is used to specify the bean type that will be returned in the collection.
@param wheres A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
@param orderBy The CpoOrderBy bean that defines the order in which beans should be returned
@param nativeExpressions Native expression that will be used to augment the expression stored in the meta data. This
text will be embedded at run-time
@return An bean of the same type as the result argument that is filled in as specified the metadata for the
retireve.
@throws CpoException Thrown if there are errors accessing the datasource | [
"Retrieves",
"the",
"bean",
"from",
"the",
"datasource",
".",
"The",
"assumption",
"is",
"that",
"the",
"bean",
"exists",
"in",
"the",
"datasource",
".",
"If",
"the",
"retrieve",
"function",
"defined",
"for",
"this",
"beans",
"returns",
"more",
"than",
"one"... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1428-L1436 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java | AtomicAllocator.seekUnusedZero | protected synchronized long seekUnusedZero(Long bucketId, Aggressiveness aggressiveness) {
AtomicLong freeSpace = new AtomicLong(0);
int totalElements = (int) memoryHandler.getAllocatedHostObjects(bucketId);
// these 2 variables will contain jvm-wise memory access frequencies
float shortAverage = zeroShort.getAverage();
float longAverage = zeroLong.getAverage();
// threshold is calculated based on agressiveness specified via configuration
float shortThreshold = shortAverage / (Aggressiveness.values().length - aggressiveness.ordinal());
float longThreshold = longAverage / (Aggressiveness.values().length - aggressiveness.ordinal());
// simple counter for dereferenced objects
AtomicInteger elementsDropped = new AtomicInteger(0);
AtomicInteger elementsSurvived = new AtomicInteger(0);
for (Long object : memoryHandler.getHostTrackingPoints(bucketId)) {
AllocationPoint point = getAllocationPoint(object);
// point can be null, if memory was promoted to device and was deleted there
if (point == null)
continue;
if (point.getAllocationStatus() == AllocationStatus.HOST) {
//point.getAccessState().isToeAvailable()
//point.getAccessState().requestToe();
/*
Check if memory points to non-existant buffer, using externals.
If externals don't have specified buffer - delete reference.
*/
if (point.getBuffer() == null) {
purgeZeroObject(bucketId, object, point, false);
freeSpace.addAndGet(AllocationUtils.getRequiredMemory(point.getShape()));
elementsDropped.incrementAndGet();
continue;
} else {
elementsSurvived.incrementAndGet();
}
//point.getAccessState().releaseToe();
} else {
// log.warn("SKIPPING :(");
}
}
//log.debug("Short average: ["+shortAverage+"], Long average: [" + longAverage + "]");
//log.debug("Aggressiveness: ["+ aggressiveness+"]; Short threshold: ["+shortThreshold+"]; Long threshold: [" + longThreshold + "]");
log.debug("Zero {} elements checked: [{}], deleted: {}, survived: {}", bucketId, totalElements,
elementsDropped.get(), elementsSurvived.get());
return freeSpace.get();
} | java | protected synchronized long seekUnusedZero(Long bucketId, Aggressiveness aggressiveness) {
AtomicLong freeSpace = new AtomicLong(0);
int totalElements = (int) memoryHandler.getAllocatedHostObjects(bucketId);
// these 2 variables will contain jvm-wise memory access frequencies
float shortAverage = zeroShort.getAverage();
float longAverage = zeroLong.getAverage();
// threshold is calculated based on agressiveness specified via configuration
float shortThreshold = shortAverage / (Aggressiveness.values().length - aggressiveness.ordinal());
float longThreshold = longAverage / (Aggressiveness.values().length - aggressiveness.ordinal());
// simple counter for dereferenced objects
AtomicInteger elementsDropped = new AtomicInteger(0);
AtomicInteger elementsSurvived = new AtomicInteger(0);
for (Long object : memoryHandler.getHostTrackingPoints(bucketId)) {
AllocationPoint point = getAllocationPoint(object);
// point can be null, if memory was promoted to device and was deleted there
if (point == null)
continue;
if (point.getAllocationStatus() == AllocationStatus.HOST) {
//point.getAccessState().isToeAvailable()
//point.getAccessState().requestToe();
/*
Check if memory points to non-existant buffer, using externals.
If externals don't have specified buffer - delete reference.
*/
if (point.getBuffer() == null) {
purgeZeroObject(bucketId, object, point, false);
freeSpace.addAndGet(AllocationUtils.getRequiredMemory(point.getShape()));
elementsDropped.incrementAndGet();
continue;
} else {
elementsSurvived.incrementAndGet();
}
//point.getAccessState().releaseToe();
} else {
// log.warn("SKIPPING :(");
}
}
//log.debug("Short average: ["+shortAverage+"], Long average: [" + longAverage + "]");
//log.debug("Aggressiveness: ["+ aggressiveness+"]; Short threshold: ["+shortThreshold+"]; Long threshold: [" + longThreshold + "]");
log.debug("Zero {} elements checked: [{}], deleted: {}, survived: {}", bucketId, totalElements,
elementsDropped.get(), elementsSurvived.get());
return freeSpace.get();
} | [
"protected",
"synchronized",
"long",
"seekUnusedZero",
"(",
"Long",
"bucketId",
",",
"Aggressiveness",
"aggressiveness",
")",
"{",
"AtomicLong",
"freeSpace",
"=",
"new",
"AtomicLong",
"(",
"0",
")",
";",
"int",
"totalElements",
"=",
"(",
"int",
")",
"memoryHandl... | This method seeks for unused zero-copy memory allocations
@param bucketId Id of the bucket, serving allocations
@return size of memory that was deallocated | [
"This",
"method",
"seeks",
"for",
"unused",
"zero",
"-",
"copy",
"memory",
"allocations"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java#L563-L619 |
i-net-software/jlessc | src/com/inet/lib/less/FunctionExpression.java | FunctionExpression.evalParam | private void evalParam( int idx, CssFormatter formatter ) {
Expression expr = get( idx );
type = expr.getDataType( formatter );
switch( type ) {
case BOOLEAN:
booleanValue = expr.booleanValue( formatter );
break;
case STRING:
break;
default:
doubleValue = expr.doubleValue( formatter );
}
} | java | private void evalParam( int idx, CssFormatter formatter ) {
Expression expr = get( idx );
type = expr.getDataType( formatter );
switch( type ) {
case BOOLEAN:
booleanValue = expr.booleanValue( formatter );
break;
case STRING:
break;
default:
doubleValue = expr.doubleValue( formatter );
}
} | [
"private",
"void",
"evalParam",
"(",
"int",
"idx",
",",
"CssFormatter",
"formatter",
")",
"{",
"Expression",
"expr",
"=",
"get",
"(",
"idx",
")",
";",
"type",
"=",
"expr",
".",
"getDataType",
"(",
"formatter",
")",
";",
"switch",
"(",
"type",
")",
"{",... | Evaluate a parameter as this function.
@param idx
the index of the parameter starting with 0
@param formatter
the current formation context | [
"Evaluate",
"a",
"parameter",
"as",
"this",
"function",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L748-L760 |
xfcjscn/sudoor-server-lib | src/main/java/net/gplatform/sudoor/server/security/model/DefaultPermissionEvaluator.java | DefaultPermissionEvaluator.getExpressionString | public String getExpressionString(String name, Object permission) {
String expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name + "." + permission);
//Get generic permit
if (expression == null) {
expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name);
}
//Get parent permit
if (expression == null && StringUtils.contains(name, ".")) {
String parent = StringUtils.substringBeforeLast(name, ".");
expression = getExpressionString(parent, permission);
}
LOG.debug("Get Expression String: [{}] for name: [{}] permission: [{}]", expression, name, permission);
return expression;
} | java | public String getExpressionString(String name, Object permission) {
String expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name + "." + permission);
//Get generic permit
if (expression == null) {
expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name);
}
//Get parent permit
if (expression == null && StringUtils.contains(name, ".")) {
String parent = StringUtils.substringBeforeLast(name, ".");
expression = getExpressionString(parent, permission);
}
LOG.debug("Get Expression String: [{}] for name: [{}] permission: [{}]", expression, name, permission);
return expression;
} | [
"public",
"String",
"getExpressionString",
"(",
"String",
"name",
",",
"Object",
"permission",
")",
"{",
"String",
"expression",
"=",
"properties",
".",
"getProperty",
"(",
"CONFIG_EXPRESSION_PREFIX",
"+",
"name",
"+",
"\".\"",
"+",
"permission",
")",
";",
"//Ge... | Find the expression string recursively from the config file
@param name
@param permission
@return | [
"Find",
"the",
"expression",
"string",
"recursively",
"from",
"the",
"config",
"file"
] | train | https://github.com/xfcjscn/sudoor-server-lib/blob/37dc1996eaa9cad25c82abd1de315ba565e32097/src/main/java/net/gplatform/sudoor/server/security/model/DefaultPermissionEvaluator.java#L75-L91 |
greenmail-mail-test/greenmail | greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java | GreenMailUtil.setQuota | public static void setQuota(final GreenMailUser user, final Quota quota) {
Session session = GreenMailUtil.getSession(ServerSetupTest.IMAP);
try {
Store store = session.getStore("imap");
store.connect(user.getEmail(), user.getPassword());
try {
((QuotaAwareStore) store).setQuota(quota);
} finally {
store.close();
}
} catch (Exception ex) {
throw new IllegalStateException("Can not set quota " + quota
+ " for user " + user, ex);
}
} | java | public static void setQuota(final GreenMailUser user, final Quota quota) {
Session session = GreenMailUtil.getSession(ServerSetupTest.IMAP);
try {
Store store = session.getStore("imap");
store.connect(user.getEmail(), user.getPassword());
try {
((QuotaAwareStore) store).setQuota(quota);
} finally {
store.close();
}
} catch (Exception ex) {
throw new IllegalStateException("Can not set quota " + quota
+ " for user " + user, ex);
}
} | [
"public",
"static",
"void",
"setQuota",
"(",
"final",
"GreenMailUser",
"user",
",",
"final",
"Quota",
"quota",
")",
"{",
"Session",
"session",
"=",
"GreenMailUtil",
".",
"getSession",
"(",
"ServerSetupTest",
".",
"IMAP",
")",
";",
"try",
"{",
"Store",
"store... | Sets a quota for a users.
@param user the user.
@param quota the quota. | [
"Sets",
"a",
"quota",
"for",
"a",
"users",
"."
] | train | https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java#L391-L405 |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.getOUComboBox | public static ComboBox getOUComboBox(CmsObject cms, String baseOu, Log log) {
return getOUComboBox(cms, baseOu, log, true);
} | java | public static ComboBox getOUComboBox(CmsObject cms, String baseOu, Log log) {
return getOUComboBox(cms, baseOu, log, true);
} | [
"public",
"static",
"ComboBox",
"getOUComboBox",
"(",
"CmsObject",
"cms",
",",
"String",
"baseOu",
",",
"Log",
"log",
")",
"{",
"return",
"getOUComboBox",
"(",
"cms",
",",
"baseOu",
",",
"log",
",",
"true",
")",
";",
"}"
] | Creates the ComboBox for OU selection.<p>
@param cms CmsObject
@param baseOu OU
@param log Logger object
@return ComboBox | [
"Creates",
"the",
"ComboBox",
"for",
"OU",
"selection",
".",
"<p",
">",
"@param",
"cms",
"CmsObject",
"@param",
"baseOu",
"OU",
"@param",
"log",
"Logger",
"object"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L657-L660 |
Javen205/IJPay | src/main/java/com/jpay/unionpay/AcpService.java | AcpService.validate | public static boolean validate(Map<String, String> rspData, String encoding) {
return SDKUtil.validate(rspData, encoding);
} | java | public static boolean validate(Map<String, String> rspData, String encoding) {
return SDKUtil.validate(rspData, encoding);
} | [
"public",
"static",
"boolean",
"validate",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"rspData",
",",
"String",
"encoding",
")",
"{",
"return",
"SDKUtil",
".",
"validate",
"(",
"rspData",
",",
"encoding",
")",
";",
"}"
] | 验证签名(SHA-1摘要算法)<br>
@param resData 返回报文数据<br>
@param encoding 上送请求报文域encoding字段的值<br>
@return true 通过 false 未通过<br> | [
"验证签名",
"(",
"SHA",
"-",
"1摘要算法",
")",
"<br",
">"
] | train | https://github.com/Javen205/IJPay/blob/78da6be4b70675abc6a41df74817532fa257ef29/src/main/java/com/jpay/unionpay/AcpService.java#L65-L67 |
spring-projects/spring-loaded | springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java | TypeRegistry.getReloadableType | public ReloadableType getReloadableType(String slashedClassname, boolean allocateIdIfNotYetLoaded) {
if (allocateIdIfNotYetLoaded) {
return getReloadableType(getTypeIdFor(slashedClassname, allocateIdIfNotYetLoaded));
}
else {
for (int i = 0; i < reloadableTypesSize; i++) {
ReloadableType rtype = reloadableTypes[i];
if (rtype != null && rtype.getSlashedName().equals(slashedClassname)) {
return rtype;
}
}
return null;
}
} | java | public ReloadableType getReloadableType(String slashedClassname, boolean allocateIdIfNotYetLoaded) {
if (allocateIdIfNotYetLoaded) {
return getReloadableType(getTypeIdFor(slashedClassname, allocateIdIfNotYetLoaded));
}
else {
for (int i = 0; i < reloadableTypesSize; i++) {
ReloadableType rtype = reloadableTypes[i];
if (rtype != null && rtype.getSlashedName().equals(slashedClassname)) {
return rtype;
}
}
return null;
}
} | [
"public",
"ReloadableType",
"getReloadableType",
"(",
"String",
"slashedClassname",
",",
"boolean",
"allocateIdIfNotYetLoaded",
")",
"{",
"if",
"(",
"allocateIdIfNotYetLoaded",
")",
"{",
"return",
"getReloadableType",
"(",
"getTypeIdFor",
"(",
"slashedClassname",
",",
"... | Find the ReloadableType object for a given classname. If the allocateIdIfNotYetLoaded option is set then a new id
will be allocated for this classname if it hasn't previously been seen before. This method does not create new
ReloadableType objects, they are expected to come into existence when defined by the classloader.
@param slashedClassname the slashed class name (e.g. java/lang/String)
@param allocateIdIfNotYetLoaded if true an id will be allocated because sometime later the type will be loaded
(and made reloadable)
@return the ReloadableType discovered or allocated, or null if not found and !allocateIdIfNotYetLoaded | [
"Find",
"the",
"ReloadableType",
"object",
"for",
"a",
"given",
"classname",
".",
"If",
"the",
"allocateIdIfNotYetLoaded",
"option",
"is",
"set",
"then",
"a",
"new",
"id",
"will",
"be",
"allocated",
"for",
"this",
"classname",
"if",
"it",
"hasn",
"t",
"previ... | train | https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java#L1269-L1282 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/component/infinispan/bolt/InfinispanLookupBolt.java | InfinispanLookupBolt.onLookupAfter | protected void onLookupAfter(StreamMessage input, K lookupKey, V lookupValue)
{
// デフォルトでは取得した結果がnull以外の場合、下流にデータを流す。
if (lookupValue != null)
{
StreamMessage message = new StreamMessage();
message.addField(FieldName.MESSAGE_KEY, lookupKey);
message.addField(FieldName.MESSAGE_VALUE, lookupValue);
emitWithGrouping(message, lookupKey, lookupKey.toString());
}
} | java | protected void onLookupAfter(StreamMessage input, K lookupKey, V lookupValue)
{
// デフォルトでは取得した結果がnull以外の場合、下流にデータを流す。
if (lookupValue != null)
{
StreamMessage message = new StreamMessage();
message.addField(FieldName.MESSAGE_KEY, lookupKey);
message.addField(FieldName.MESSAGE_VALUE, lookupValue);
emitWithGrouping(message, lookupKey, lookupKey.toString());
}
} | [
"protected",
"void",
"onLookupAfter",
"(",
"StreamMessage",
"input",
",",
"K",
"lookupKey",
",",
"V",
"lookupValue",
")",
"{",
"// デフォルトでは取得した結果がnull以外の場合、下流にデータを流す。",
"if",
"(",
"lookupValue",
"!=",
"null",
")",
"{",
"StreamMessage",
"message",
"=",
"new",
"Strea... | Infinispanからのデータ取得後に実行される処理。
@param input Tuple
@param lookupKey 取得に使用したKey
@param lookupValue 取得したValue(取得されなかった場合はnull) | [
"Infinispanからのデータ取得後に実行される処理。"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/component/infinispan/bolt/InfinispanLookupBolt.java#L140-L151 |
alkacon/opencms-core | src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java | CmsSetupXmlHelper.setValue | public int setValue(String xmlFilename, String xPath, String value) throws CmsXmlException {
return setValue(getDocument(xmlFilename), xPath, value, null);
} | java | public int setValue(String xmlFilename, String xPath, String value) throws CmsXmlException {
return setValue(getDocument(xmlFilename), xPath, value, null);
} | [
"public",
"int",
"setValue",
"(",
"String",
"xmlFilename",
",",
"String",
"xPath",
",",
"String",
"value",
")",
"throws",
"CmsXmlException",
"{",
"return",
"setValue",
"(",
"getDocument",
"(",
"xmlFilename",
")",
",",
"xPath",
",",
"value",
",",
"null",
")",... | Sets the given value in all nodes identified by the given xpath of the given xml file.<p>
If value is <code>null</code>, all nodes identified by the given xpath will be deleted.<p>
If the node identified by the given xpath does not exists, the missing nodes will be created
(if <code>value</code> not <code>null</code>).<p>
@param xmlFilename the xml config file (could be relative to the base path)
@param xPath the xpath to set
@param value the value to set (can be <code>null</code> for deletion)
@return the number of successful changed or deleted nodes
@throws CmsXmlException if something goes wrong | [
"Sets",
"the",
"given",
"value",
"in",
"all",
"nodes",
"identified",
"by",
"the",
"given",
"xpath",
"of",
"the",
"given",
"xml",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java#L464-L467 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/randomizers/range/FloatRangeRandomizer.java | FloatRangeRandomizer.aNewFloatRangeRandomizer | public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max, final long seed) {
return new FloatRangeRandomizer(min, max, seed);
} | java | public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max, final long seed) {
return new FloatRangeRandomizer(min, max, seed);
} | [
"public",
"static",
"FloatRangeRandomizer",
"aNewFloatRangeRandomizer",
"(",
"final",
"Float",
"min",
",",
"final",
"Float",
"max",
",",
"final",
"long",
"seed",
")",
"{",
"return",
"new",
"FloatRangeRandomizer",
"(",
"min",
",",
"max",
",",
"seed",
")",
";",
... | Create a new {@link FloatRangeRandomizer}.
@param min min value
@param max max value
@param seed initial seed
@return a new {@link FloatRangeRandomizer}. | [
"Create",
"a",
"new",
"{",
"@link",
"FloatRangeRandomizer",
"}",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/FloatRangeRandomizer.java#L90-L92 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.L1_EL2 | @Pure
public static Point2d L1_EL2(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2E_N,
LAMBERT_2E_C,
LAMBERT_2E_XS,
LAMBERT_2E_YS);
} | java | @Pure
public static Point2d L1_EL2(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2E_N,
LAMBERT_2E_C,
LAMBERT_2E_XS,
LAMBERT_2E_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"L1_EL2",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"NTFLambert_NTFLambdaPhi",
"(",
"x",
",",
"y",
",",
"LAMBERT_1_N",
",",
"LAMBERT_1_C",
",",
"LAMBERT_1_XS",
",",
... | This function convert France Lambert I coordinate to
extended France Lambert II coordinate.
@param x is the coordinate in France Lambert I
@param y is the coordinate in France Lambert I
@return the extended France Lambert II coordinate. | [
"This",
"function",
"convert",
"France",
"Lambert",
"I",
"coordinate",
"to",
"extended",
"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#L305-L318 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/serialize/convert/SerializationConverterRegistry.java | SerializationConverterRegistry.iterateAllRegisteredSerializationConverters | public void iterateAllRegisteredSerializationConverters (@Nonnull final ISerializationConverterCallback aCallback)
{
// Create a static (non weak) copy of the map
final Map <Class <?>, ISerializationConverter <?>> aCopy = m_aRWLock.readLocked ( () -> new CommonsHashMap <> (m_aMap));
// And iterate the copy
for (final Map.Entry <Class <?>, ISerializationConverter <?>> aEntry : aCopy.entrySet ())
if (aCallback.call (aEntry.getKey (), aEntry.getValue ()).isBreak ())
break;
} | java | public void iterateAllRegisteredSerializationConverters (@Nonnull final ISerializationConverterCallback aCallback)
{
// Create a static (non weak) copy of the map
final Map <Class <?>, ISerializationConverter <?>> aCopy = m_aRWLock.readLocked ( () -> new CommonsHashMap <> (m_aMap));
// And iterate the copy
for (final Map.Entry <Class <?>, ISerializationConverter <?>> aEntry : aCopy.entrySet ())
if (aCallback.call (aEntry.getKey (), aEntry.getValue ()).isBreak ())
break;
} | [
"public",
"void",
"iterateAllRegisteredSerializationConverters",
"(",
"@",
"Nonnull",
"final",
"ISerializationConverterCallback",
"aCallback",
")",
"{",
"// Create a static (non weak) copy of the map",
"final",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"ISerializationConverter... | Iterate all registered serialization converters. For informational purposes
only.
@param aCallback
The callback invoked for all iterations. | [
"Iterate",
"all",
"registered",
"serialization",
"converters",
".",
"For",
"informational",
"purposes",
"only",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/serialize/convert/SerializationConverterRegistry.java#L155-L164 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUserSegmentRelPersistenceImpl.java | CommerceDiscountUserSegmentRelPersistenceImpl.findByCommerceDiscountId | @Override
public List<CommerceDiscountUserSegmentRel> findByCommerceDiscountId(
long commerceDiscountId, int start, int end) {
return findByCommerceDiscountId(commerceDiscountId, start, end, null);
} | java | @Override
public List<CommerceDiscountUserSegmentRel> findByCommerceDiscountId(
long commerceDiscountId, int start, int end) {
return findByCommerceDiscountId(commerceDiscountId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountUserSegmentRel",
">",
"findByCommerceDiscountId",
"(",
"long",
"commerceDiscountId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommerceDiscountId",
"(",
"commerceDiscountId",
",",
"start... | Returns a range of all the commerce discount user segment rels where commerceDiscountId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountUserSegmentRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param commerceDiscountId the commerce discount ID
@param start the lower bound of the range of commerce discount user segment rels
@param end the upper bound of the range of commerce discount user segment rels (not inclusive)
@return the range of matching commerce discount user segment rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"discount",
"user",
"segment",
"rels",
"where",
"commerceDiscountId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUserSegmentRelPersistenceImpl.java#L146-L150 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201808/orderservice/GetOrdersStartingSoon.java | GetOrdersStartingSoon.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
OrderServiceInterface orderService =
adManagerServices.get(session, OrderServiceInterface.class);
// Create a statement to select orders.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status and startDateTime >= :now and startDateTime <= :soon")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", OrderStatus.APPROVED.toString())
.withBindVariableValue("now", DateTimes.toDateTime(Instant.now(), "America/New_York"))
.withBindVariableValue("soon", DateTimes.toDateTime(Instant.now().plus(
Duration.standardDays(5L)), "America/New_York"));
// Retrieve a small amount of orders at a time, paging through
// until all orders have been retrieved.
int totalResultSetSize = 0;
do {
OrderPage page =
orderService.getOrdersByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each order.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Order order : page.getResults()) {
System.out.printf(
"%d) Order with ID %d and name '%s' was found.%n",
i++,
order.getId(),
order.getName()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
OrderServiceInterface orderService =
adManagerServices.get(session, OrderServiceInterface.class);
// Create a statement to select orders.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status and startDateTime >= :now and startDateTime <= :soon")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", OrderStatus.APPROVED.toString())
.withBindVariableValue("now", DateTimes.toDateTime(Instant.now(), "America/New_York"))
.withBindVariableValue("soon", DateTimes.toDateTime(Instant.now().plus(
Duration.standardDays(5L)), "America/New_York"));
// Retrieve a small amount of orders at a time, paging through
// until all orders have been retrieved.
int totalResultSetSize = 0;
do {
OrderPage page =
orderService.getOrdersByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each order.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Order order : page.getResults()) {
System.out.printf(
"%d) Order with ID %d and name '%s' was found.%n",
i++,
order.getId(),
order.getName()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"OrderServiceInterface",
"orderService",
"=",
"adManagerServices",
".",
"get",
"(",
"session",
",",
"Order... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/orderservice/GetOrdersStartingSoon.java#L55-L95 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/JMProgressiveManager.java | JMProgressiveManager.registerTargetChangeListener | public JMProgressiveManager<T, R>
registerTargetChangeListener(Consumer<T> targetChangeListener) {
return registerListener(currentTarget, targetChangeListener);
} | java | public JMProgressiveManager<T, R>
registerTargetChangeListener(Consumer<T> targetChangeListener) {
return registerListener(currentTarget, targetChangeListener);
} | [
"public",
"JMProgressiveManager",
"<",
"T",
",",
"R",
">",
"registerTargetChangeListener",
"(",
"Consumer",
"<",
"T",
">",
"targetChangeListener",
")",
"{",
"return",
"registerListener",
"(",
"currentTarget",
",",
"targetChangeListener",
")",
";",
"}"
] | Register target change listener jm progressive manager.
@param targetChangeListener the target change listener
@return the jm progressive manager | [
"Register",
"target",
"change",
"listener",
"jm",
"progressive",
"manager",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/JMProgressiveManager.java#L296-L299 |
goodow/realtime-json | src/main/java/com/goodow/realtime/json/impl/Base64.java | Base64.encodeBytes | public static String encodeBytes(final byte[] source, final int options) {
return Base64.encodeBytes(source, 0, source.length, options);
} | java | public static String encodeBytes(final byte[] source, final int options) {
return Base64.encodeBytes(source, 0, source.length, options);
} | [
"public",
"static",
"String",
"encodeBytes",
"(",
"final",
"byte",
"[",
"]",
"source",
",",
"final",
"int",
"options",
")",
"{",
"return",
"Base64",
".",
"encodeBytes",
"(",
"source",
",",
"0",
",",
"source",
".",
"length",
",",
"options",
")",
";",
"}... | Encodes a byte array into Base64 notation.
<p/>
Valid options:
<pre>
GZIP: gzip-compresses object before encoding it.
DONT_BREAK_LINES: don't break lines at 76 characters
<i>Note: Technically, this makes your encoding non-compliant.</i>
</pre>
<p/>
Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
<p/>
Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
@param source The data to convert
@param options Specified options
@see Base64#GZIP
@see Base64#DONT_BREAK_LINES
@since 2.0 | [
"Encodes",
"a",
"byte",
"array",
"into",
"Base64",
"notation",
".",
"<p",
"/",
">",
"Valid",
"options",
":"
] | train | https://github.com/goodow/realtime-json/blob/be2f5a8cab27afa052583ae2e09f6f7975d8cb0c/src/main/java/com/goodow/realtime/json/impl/Base64.java#L1116-L1118 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/Record.java | Record.getFloat | public Number getFloat(int field) throws MPXJException
{
try
{
Number result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
result = m_formats.getDecimalFormat().parse(m_fields[field]);
}
else
{
result = null;
}
return (result);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse float", ex);
}
} | java | public Number getFloat(int field) throws MPXJException
{
try
{
Number result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
result = m_formats.getDecimalFormat().parse(m_fields[field]);
}
else
{
result = null;
}
return (result);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse float", ex);
}
} | [
"public",
"Number",
"getFloat",
"(",
"int",
"field",
")",
"throws",
"MPXJException",
"{",
"try",
"{",
"Number",
"result",
";",
"if",
"(",
"(",
"field",
"<",
"m_fields",
".",
"length",
")",
"&&",
"(",
"m_fields",
"[",
"field",
"]",
".",
"length",
"(",
... | Accessor method used to retrieve a Float object representing the
contents of an individual field. If the field does not exist in the
record, null is returned.
@param field the index number of the field to be retrieved
@return the value of the required field | [
"Accessor",
"method",
"used",
"to",
"retrieve",
"a",
"Float",
"object",
"representing",
"the",
"contents",
"of",
"an",
"individual",
"field",
".",
"If",
"the",
"field",
"does",
"not",
"exist",
"in",
"the",
"record",
"null",
"is",
"returned",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L181-L203 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java | DeploymentsInner.checkExistence | public boolean checkExistence(String resourceGroupName, String deploymentName) {
return checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body();
} | java | public boolean checkExistence(String resourceGroupName, String deploymentName) {
return checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body();
} | [
"public",
"boolean",
"checkExistence",
"(",
"String",
"resourceGroupName",
",",
"String",
"deploymentName",
")",
"{",
"return",
"checkExistenceWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"deploymentName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Checks whether the deployment exists.
@param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive.
@param deploymentName The name of the deployment to check.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the boolean object if successful. | [
"Checks",
"whether",
"the",
"deployment",
"exists",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java#L287-L289 |
kiegroup/drools | drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/parser/JavaParser.java | JavaParser.integerLiteral | public final void integerLiteral() throws RecognitionException {
int integerLiteral_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 62) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:596:5: ( HexLiteral | OctalLiteral | DecimalLiteral )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( input.LA(1)==DecimalLiteral||input.LA(1)==HexLiteral||input.LA(1)==OctalLiteral ) {
input.consume();
state.errorRecovery=false;
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
throw mse;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 62, integerLiteral_StartIndex); }
}
} | java | public final void integerLiteral() throws RecognitionException {
int integerLiteral_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 62) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:596:5: ( HexLiteral | OctalLiteral | DecimalLiteral )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( input.LA(1)==DecimalLiteral||input.LA(1)==HexLiteral||input.LA(1)==OctalLiteral ) {
input.consume();
state.errorRecovery=false;
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
throw mse;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 62, integerLiteral_StartIndex); }
}
} | [
"public",
"final",
"void",
"integerLiteral",
"(",
")",
"throws",
"RecognitionException",
"{",
"int",
"integerLiteral_StartIndex",
"=",
"input",
".",
"index",
"(",
")",
";",
"try",
"{",
"if",
"(",
"state",
".",
"backtracking",
">",
"0",
"&&",
"alreadyParsedRule... | src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:595:1: integerLiteral : ( HexLiteral | OctalLiteral | DecimalLiteral ); | [
"src",
"/",
"main",
"/",
"resources",
"/",
"org",
"/",
"drools",
"/",
"compiler",
"/",
"semantics",
"/",
"java",
"/",
"parser",
"/",
"Java",
".",
"g",
":",
"595",
":",
"1",
":",
"integerLiteral",
":",
"(",
"HexLiteral",
"|",
"OctalLiteral",
"|",
"Dec... | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/parser/JavaParser.java#L5123-L5154 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/monitor/UicStatsAsHtml.java | UicStatsAsHtml.writeRow | private static void writeRow(final PrintWriter writer, final UicStats.Stat stat) {
writer.print("<tr>");
writer.print("<td>" + stat.getClassName() + "</td>");
writer.print("<td>" + stat.getModelStateAsString() + "</td>");
if (stat.getSerializedSize() > 0) {
writer.print("<td>" + stat.getSerializedSize() + "</td>");
} else {
writer.print("<td> </td>");
}
writer.print("<td>" + stat.getRef() + "</td>");
writer.print("<td>" + stat.getName() + "</td>");
if (stat.getComment() == null) {
writer.print("<td> </td>");
} else {
writer.print("<td>" + stat.getComment() + "</td>");
}
writer.println("</tr>");
} | java | private static void writeRow(final PrintWriter writer, final UicStats.Stat stat) {
writer.print("<tr>");
writer.print("<td>" + stat.getClassName() + "</td>");
writer.print("<td>" + stat.getModelStateAsString() + "</td>");
if (stat.getSerializedSize() > 0) {
writer.print("<td>" + stat.getSerializedSize() + "</td>");
} else {
writer.print("<td> </td>");
}
writer.print("<td>" + stat.getRef() + "</td>");
writer.print("<td>" + stat.getName() + "</td>");
if (stat.getComment() == null) {
writer.print("<td> </td>");
} else {
writer.print("<td>" + stat.getComment() + "</td>");
}
writer.println("</tr>");
} | [
"private",
"static",
"void",
"writeRow",
"(",
"final",
"PrintWriter",
"writer",
",",
"final",
"UicStats",
".",
"Stat",
"stat",
")",
"{",
"writer",
".",
"print",
"(",
"\"<tr>\"",
")",
";",
"writer",
".",
"print",
"(",
"\"<td>\"",
"+",
"stat",
".",
"getCla... | Writes a row containing a single stat.
@param writer the writer to write the row to.
@param stat the stat to write. | [
"Writes",
"a",
"row",
"containing",
"a",
"single",
"stat",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/monitor/UicStatsAsHtml.java#L131-L152 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.ensureUniqueName | public void ensureUniqueName(CmsClientSitemapEntry parent, String newName, I_CmsSimpleCallback<String> callback) {
ensureUniqueName(parent.getSitePath(), newName, callback);
} | java | public void ensureUniqueName(CmsClientSitemapEntry parent, String newName, I_CmsSimpleCallback<String> callback) {
ensureUniqueName(parent.getSitePath(), newName, callback);
} | [
"public",
"void",
"ensureUniqueName",
"(",
"CmsClientSitemapEntry",
"parent",
",",
"String",
"newName",
",",
"I_CmsSimpleCallback",
"<",
"String",
">",
"callback",
")",
"{",
"ensureUniqueName",
"(",
"parent",
".",
"getSitePath",
"(",
")",
",",
"newName",
",",
"c... | Ensure the uniqueness of a given URL-name within the children of the given parent site-map entry.<p>
@param parent the parent entry
@param newName the proposed name
@param callback the callback to execute | [
"Ensure",
"the",
"uniqueness",
"of",
"a",
"given",
"URL",
"-",
"name",
"within",
"the",
"children",
"of",
"the",
"given",
"parent",
"site",
"-",
"map",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L882-L885 |
sagiegurari/fax4j | src/main/java/org/fax4j/util/SpiUtil.java | SpiUtil.replaceTemplateParameter | public static String replaceTemplateParameter(String template,String parameter,String value,TemplateParameterEncoder encoder)
{
String text=template;
if((text!=null)&&(parameter!=null))
{
String updatedValue=value;
if(updatedValue==null)
{
updatedValue=SpiUtil.EMPTY_STRING;
}
else if(encoder!=null)
{
updatedValue=encoder.encodeTemplateParameter(updatedValue);
}
text=text.replace(parameter,updatedValue);
}
return text;
} | java | public static String replaceTemplateParameter(String template,String parameter,String value,TemplateParameterEncoder encoder)
{
String text=template;
if((text!=null)&&(parameter!=null))
{
String updatedValue=value;
if(updatedValue==null)
{
updatedValue=SpiUtil.EMPTY_STRING;
}
else if(encoder!=null)
{
updatedValue=encoder.encodeTemplateParameter(updatedValue);
}
text=text.replace(parameter,updatedValue);
}
return text;
} | [
"public",
"static",
"String",
"replaceTemplateParameter",
"(",
"String",
"template",
",",
"String",
"parameter",
",",
"String",
"value",
",",
"TemplateParameterEncoder",
"encoder",
")",
"{",
"String",
"text",
"=",
"template",
";",
"if",
"(",
"(",
"text",
"!=",
... | This function replaces the parameter with the provided value.
@param template
The template
@param parameter
The parameter
@param value
The value
@param encoder
The encoder that encodes the template values (may be null)
@return The updated template | [
"This",
"function",
"replaces",
"the",
"parameter",
"with",
"the",
"provided",
"value",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/SpiUtil.java#L183-L201 |
3redronin/mu-server | src/main/java/io/muserver/ContextHandlerBuilder.java | ContextHandlerBuilder.addHandler | public ContextHandlerBuilder addHandler(Method method, String uriTemplate, RouteHandler handler) {
if (handler == null) {
return this;
}
return addHandler(Routes.route(method, uriTemplate, handler));
} | java | public ContextHandlerBuilder addHandler(Method method, String uriTemplate, RouteHandler handler) {
if (handler == null) {
return this;
}
return addHandler(Routes.route(method, uriTemplate, handler));
} | [
"public",
"ContextHandlerBuilder",
"addHandler",
"(",
"Method",
"method",
",",
"String",
"uriTemplate",
",",
"RouteHandler",
"handler",
")",
"{",
"if",
"(",
"handler",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"return",
"addHandler",
"(",
"Routes",
... | Registers a new handler that will only be called if it matches the given route info (relative to the current context).
@param method The method to match, or <code>null</code> to accept any method.
@param uriTemplate A URL template, relative to the context. Supports plain URLs like <code>/abc</code> or paths
with named parameters such as <code>/abc/{id}</code> or named parameters
with regexes such as <code>/abc/{id : [0-9]+}</code> where the named
parameter values can be accessed with the <code>pathParams</code>
parameter in the route handler.
@param handler The handler to invoke if the method and URI matches.
@return Returns the server builder | [
"Registers",
"a",
"new",
"handler",
"that",
"will",
"only",
"be",
"called",
"if",
"it",
"matches",
"the",
"given",
"route",
"info",
"(",
"relative",
"to",
"the",
"current",
"context",
")",
"."
] | train | https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/ContextHandlerBuilder.java#L132-L137 |
sporniket/core | sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java | ComponentFactory.getImageIcon | public static Icon getImageIcon(ClassLoader objectLoader, String fileName) throws UrlProviderException
{
return getImageIcon(new ClassLoaderUrlProvider(objectLoader), fileName);
} | java | public static Icon getImageIcon(ClassLoader objectLoader, String fileName) throws UrlProviderException
{
return getImageIcon(new ClassLoaderUrlProvider(objectLoader), fileName);
} | [
"public",
"static",
"Icon",
"getImageIcon",
"(",
"ClassLoader",
"objectLoader",
",",
"String",
"fileName",
")",
"throws",
"UrlProviderException",
"{",
"return",
"getImageIcon",
"(",
"new",
"ClassLoaderUrlProvider",
"(",
"objectLoader",
")",
",",
"fileName",
")",
";"... | Create an Image icon from a String.
@param objectLoader
This method use <i>objectLoader.getResource() </i> to retrieve the icon.
@param fileName
the name of the file.
@return an Icon.
@throws UrlProviderException if there is a problem to deal with. | [
"Create",
"an",
"Image",
"icon",
"from",
"a",
"String",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java#L104-L107 |
cdk/cdk | tool/formula/src/main/java/org/openscience/cdk/formula/IsotopePatternManipulator.java | IsotopePatternManipulator.sortByMass | public static IsotopePattern sortByMass(IsotopePattern isotopeP) {
try {
IsotopePattern isoSort = (IsotopePattern) isotopeP.clone();
// Do nothing for empty isotope pattern
if (isoSort.getNumberOfIsotopes() == 0)
return isoSort;
// Sort the isotopes
List<IsotopeContainer> listISO = isoSort.getIsotopes();
Collections.sort(listISO, new Comparator<IsotopeContainer>() {
@Override
public int compare(IsotopeContainer o1, IsotopeContainer o2) {
return Double.compare(o1.getMass(),o2.getMass());
}
});
// Set the monoisotopic peak to the one with lowest mass
isoSort.setMonoIsotope(listISO.get(0));
return isoSort;
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return null;
} | java | public static IsotopePattern sortByMass(IsotopePattern isotopeP) {
try {
IsotopePattern isoSort = (IsotopePattern) isotopeP.clone();
// Do nothing for empty isotope pattern
if (isoSort.getNumberOfIsotopes() == 0)
return isoSort;
// Sort the isotopes
List<IsotopeContainer> listISO = isoSort.getIsotopes();
Collections.sort(listISO, new Comparator<IsotopeContainer>() {
@Override
public int compare(IsotopeContainer o1, IsotopeContainer o2) {
return Double.compare(o1.getMass(),o2.getMass());
}
});
// Set the monoisotopic peak to the one with lowest mass
isoSort.setMonoIsotope(listISO.get(0));
return isoSort;
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"IsotopePattern",
"sortByMass",
"(",
"IsotopePattern",
"isotopeP",
")",
"{",
"try",
"{",
"IsotopePattern",
"isoSort",
"=",
"(",
"IsotopePattern",
")",
"isotopeP",
".",
"clone",
"(",
")",
";",
"// Do nothing for empty isotope pattern",
"if",
"(",
... | Return the isotope pattern sorted by mass
to the highest abundance.
@param isotopeP The IsotopePattern object to sort
@return The IsotopePattern sorted | [
"Return",
"the",
"isotope",
"pattern",
"sorted",
"by",
"mass",
"to",
"the",
"highest",
"abundance",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/formula/IsotopePatternManipulator.java#L113-L140 |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java | ThriftHttpServlet.getAuthHeader | private String getAuthHeader(HttpServletRequest request, String authType)
throws HttpAuthenticationException {
String authHeader = request.getHeader(HttpAuthUtils.AUTHORIZATION);
// Each http request must have an Authorization header
if (authHeader == null || authHeader.isEmpty()) {
throw new HttpAuthenticationException("Authorization header received " +
"from the client is empty.");
}
String authHeaderBase64String;
int beginIndex;
if (isKerberosAuthMode(authType)) {
beginIndex = (HttpAuthUtils.NEGOTIATE + " ").length();
}
else {
beginIndex = (HttpAuthUtils.BASIC + " ").length();
}
authHeaderBase64String = authHeader.substring(beginIndex);
// Authorization header must have a payload
if (authHeaderBase64String == null || authHeaderBase64String.isEmpty()) {
throw new HttpAuthenticationException("Authorization header received " +
"from the client does not contain any data.");
}
return authHeaderBase64String;
} | java | private String getAuthHeader(HttpServletRequest request, String authType)
throws HttpAuthenticationException {
String authHeader = request.getHeader(HttpAuthUtils.AUTHORIZATION);
// Each http request must have an Authorization header
if (authHeader == null || authHeader.isEmpty()) {
throw new HttpAuthenticationException("Authorization header received " +
"from the client is empty.");
}
String authHeaderBase64String;
int beginIndex;
if (isKerberosAuthMode(authType)) {
beginIndex = (HttpAuthUtils.NEGOTIATE + " ").length();
}
else {
beginIndex = (HttpAuthUtils.BASIC + " ").length();
}
authHeaderBase64String = authHeader.substring(beginIndex);
// Authorization header must have a payload
if (authHeaderBase64String == null || authHeaderBase64String.isEmpty()) {
throw new HttpAuthenticationException("Authorization header received " +
"from the client does not contain any data.");
}
return authHeaderBase64String;
} | [
"private",
"String",
"getAuthHeader",
"(",
"HttpServletRequest",
"request",
",",
"String",
"authType",
")",
"throws",
"HttpAuthenticationException",
"{",
"String",
"authHeader",
"=",
"request",
".",
"getHeader",
"(",
"HttpAuthUtils",
".",
"AUTHORIZATION",
")",
";",
... | Returns the base64 encoded auth header payload
@param request
@param authType
@return
@throws HttpAuthenticationException | [
"Returns",
"the",
"base64",
"encoded",
"auth",
"header",
"payload"
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L496-L520 |
geomajas/geomajas-project-client-gwt2 | common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImpl.java | DomImpl.setElementAttributeNS | public void setElementAttributeNS(String ns, Element element, String attr, String value) {
setNameSpaceAttribute(ns, element, attr, value);
} | java | public void setElementAttributeNS(String ns, Element element, String attr, String value) {
setNameSpaceAttribute(ns, element, attr, value);
} | [
"public",
"void",
"setElementAttributeNS",
"(",
"String",
"ns",
",",
"Element",
"element",
",",
"String",
"attr",
",",
"String",
"value",
")",
"{",
"setNameSpaceAttribute",
"(",
"ns",
",",
"element",
",",
"attr",
",",
"value",
")",
";",
"}"
] | <p>
Adds a new attribute in the given name-space to an element.
</p>
<p>
There is an exception when using Internet Explorer! For Internet Explorer the attribute of type "namespace:attr"
will be set.
</p>
@param ns
The name-space to be used in the element creation.
@param element
The element to which the attribute is to be set.
@param attr
The name of the attribute.
@param value
The new value for the attribute. | [
"<p",
">",
"Adds",
"a",
"new",
"attribute",
"in",
"the",
"given",
"name",
"-",
"space",
"to",
"an",
"element",
".",
"<",
"/",
"p",
">",
"<p",
">",
"There",
"is",
"an",
"exception",
"when",
"using",
"Internet",
"Explorer!",
"For",
"Internet",
"Explorer"... | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImpl.java#L161-L163 |
UrielCh/ovh-java-sdk | ovh-java-sdk-partners/src/main/java/net/minidev/ovh/api/ApiOvhPartners.java | ApiOvhPartners.register_company_companyId_application_POST | public OvhApplication register_company_companyId_application_POST(String companyId, Boolean termsAndConditionsOfServiceAccepted) throws IOException {
String qPath = "/partners/register/company/{companyId}/application";
StringBuilder sb = path(qPath, companyId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "termsAndConditionsOfServiceAccepted", termsAndConditionsOfServiceAccepted);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhApplication.class);
} | java | public OvhApplication register_company_companyId_application_POST(String companyId, Boolean termsAndConditionsOfServiceAccepted) throws IOException {
String qPath = "/partners/register/company/{companyId}/application";
StringBuilder sb = path(qPath, companyId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "termsAndConditionsOfServiceAccepted", termsAndConditionsOfServiceAccepted);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhApplication.class);
} | [
"public",
"OvhApplication",
"register_company_companyId_application_POST",
"(",
"String",
"companyId",
",",
"Boolean",
"termsAndConditionsOfServiceAccepted",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/partners/register/company/{companyId}/application\"",
";",
... | Submit application information for validation
REST: POST /partners/register/company/{companyId}/application
@param companyId [required] Company's id
@param termsAndConditionsOfServiceAccepted [required] I have read the terms and conditions of the OVH partner program and accept them | [
"Submit",
"application",
"information",
"for",
"validation"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-partners/src/main/java/net/minidev/ovh/api/ApiOvhPartners.java#L338-L345 |
apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/aurora/AuroraCLIController.java | AuroraCLIController.appendAuroraCommandOptions | private static void appendAuroraCommandOptions(List<String> auroraCmd, boolean isVerbose) {
// Append verbose if needed
if (isVerbose) {
auroraCmd.add("--verbose");
}
// Append batch size.
// Note that we can not use "--no-batching" since "restart" command does not accept it.
// So we play a small trick here by setting batch size Integer.MAX_VALUE.
auroraCmd.add("--batch-size");
auroraCmd.add(Integer.toString(Integer.MAX_VALUE));
} | java | private static void appendAuroraCommandOptions(List<String> auroraCmd, boolean isVerbose) {
// Append verbose if needed
if (isVerbose) {
auroraCmd.add("--verbose");
}
// Append batch size.
// Note that we can not use "--no-batching" since "restart" command does not accept it.
// So we play a small trick here by setting batch size Integer.MAX_VALUE.
auroraCmd.add("--batch-size");
auroraCmd.add(Integer.toString(Integer.MAX_VALUE));
} | [
"private",
"static",
"void",
"appendAuroraCommandOptions",
"(",
"List",
"<",
"String",
">",
"auroraCmd",
",",
"boolean",
"isVerbose",
")",
"{",
"// Append verbose if needed",
"if",
"(",
"isVerbose",
")",
"{",
"auroraCmd",
".",
"add",
"(",
"\"--verbose\"",
")",
"... | Static method to append verbose and batching options if needed | [
"Static",
"method",
"to",
"append",
"verbose",
"and",
"batching",
"options",
"if",
"needed"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/aurora/AuroraCLIController.java#L202-L213 |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java | GroovyRuntimeImpl.createGroovyClassLoader | public GroovyClassLoader createGroovyClassLoader(final ClassLoader classLoader, final ResourceLoader resourceLoader) {
return AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>()
{
@Override
public GroovyClassLoader run() {
GroovyClassLoader gcl = new GroovyClassLoader(classLoader);
gcl.setResourceLoader(createGroovyResourceLoader(resourceLoader));
return gcl;
}
});
} | java | public GroovyClassLoader createGroovyClassLoader(final ClassLoader classLoader, final ResourceLoader resourceLoader) {
return AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>()
{
@Override
public GroovyClassLoader run() {
GroovyClassLoader gcl = new GroovyClassLoader(classLoader);
gcl.setResourceLoader(createGroovyResourceLoader(resourceLoader));
return gcl;
}
});
} | [
"public",
"GroovyClassLoader",
"createGroovyClassLoader",
"(",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"ResourceLoader",
"resourceLoader",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"GroovyClassLoader",
"... | Create a {@link GroovyClassLoader} from given {@link ClassLoader} and {@link ResourceLoader}. | [
"Create",
"a",
"{"
] | train | https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java#L85-L95 |
hawkular/hawkular-apm | client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java | OpenTracingManager.startSpanWithContext | public void startSpanWithContext(SpanBuilder spanBuilder, SpanContext context, String id) {
if (context != null) {
spanBuilder.asChildOf(context);
}
doStartSpan(spanBuilder, id);
} | java | public void startSpanWithContext(SpanBuilder spanBuilder, SpanContext context, String id) {
if (context != null) {
spanBuilder.asChildOf(context);
}
doStartSpan(spanBuilder, id);
} | [
"public",
"void",
"startSpanWithContext",
"(",
"SpanBuilder",
"spanBuilder",
",",
"SpanContext",
"context",
",",
"String",
"id",
")",
"{",
"if",
"(",
"context",
"!=",
"null",
")",
"{",
"spanBuilder",
".",
"asChildOf",
"(",
"context",
")",
";",
"}",
"doStartS... | This is a convenience method for situations where we don't know
if a parent span is available. If we try to add a childOf relationship
to a null context, it would cause a null pointer exception.
The optional id is associated with the started span.
@param spanBuilder The span builder
@param context The span context
@param id The optional id to associate with the span | [
"This",
"is",
"a",
"convenience",
"method",
"for",
"situations",
"where",
"we",
"don",
"t",
"know",
"if",
"a",
"parent",
"span",
"is",
"available",
".",
"If",
"we",
"try",
"to",
"add",
"a",
"childOf",
"relationship",
"to",
"a",
"null",
"context",
"it",
... | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java#L169-L175 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/smatch/filters/RedundantGeneratorMappingFilter.java | RedundantGeneratorMappingFilter.isRedundant | private boolean isRedundant(IContextMapping<INode> mapping, INode source, INode target, char R) {
switch (R) {
case IMappingElement.LESS_GENERAL: {
if (verifyCondition1(mapping, source, target)) {
return true;
}
break;
}
case IMappingElement.MORE_GENERAL: {
if (verifyCondition2(mapping, source, target)) {
return true;
}
break;
}
case IMappingElement.DISJOINT: {
if (verifyCondition3(mapping, source, target)) {
return true;
}
break;
}
case IMappingElement.EQUIVALENCE: {
if (verifyCondition1(mapping, source, target) && verifyCondition2(mapping, source, target)) {
return true;
}
break;
}
default: {
return false;
}
}// end switch
return false;
} | java | private boolean isRedundant(IContextMapping<INode> mapping, INode source, INode target, char R) {
switch (R) {
case IMappingElement.LESS_GENERAL: {
if (verifyCondition1(mapping, source, target)) {
return true;
}
break;
}
case IMappingElement.MORE_GENERAL: {
if (verifyCondition2(mapping, source, target)) {
return true;
}
break;
}
case IMappingElement.DISJOINT: {
if (verifyCondition3(mapping, source, target)) {
return true;
}
break;
}
case IMappingElement.EQUIVALENCE: {
if (verifyCondition1(mapping, source, target) && verifyCondition2(mapping, source, target)) {
return true;
}
break;
}
default: {
return false;
}
}// end switch
return false;
} | [
"private",
"boolean",
"isRedundant",
"(",
"IContextMapping",
"<",
"INode",
">",
"mapping",
",",
"INode",
"source",
",",
"INode",
"target",
",",
"char",
"R",
")",
"{",
"switch",
"(",
"R",
")",
"{",
"case",
"IMappingElement",
".",
"LESS_GENERAL",
":",
"{",
... | Checks whether the relation between source and target is redundant or not for minimal mapping.
@param mapping a mapping
@param source source
@param target target
@param R relation between source and target node @return true for redundant relation
@return true if the relation between source and target is redundant | [
"Checks",
"whether",
"the",
"relation",
"between",
"source",
"and",
"target",
"is",
"redundant",
"or",
"not",
"for",
"minimal",
"mapping",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/RedundantGeneratorMappingFilter.java#L122-L155 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.createAward | public GitlabAward createAward(GitlabMergeRequest mergeRequest, String awardName) throws IOException {
Query query = new Query().append("name", awardName);
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/"
+ mergeRequest.getIid() + GitlabAward.URL + query.toString();
return dispatch().to(tailUrl, GitlabAward.class);
} | java | public GitlabAward createAward(GitlabMergeRequest mergeRequest, String awardName) throws IOException {
Query query = new Query().append("name", awardName);
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/"
+ mergeRequest.getIid() + GitlabAward.URL + query.toString();
return dispatch().to(tailUrl, GitlabAward.class);
} | [
"public",
"GitlabAward",
"createAward",
"(",
"GitlabMergeRequest",
"mergeRequest",
",",
"String",
"awardName",
")",
"throws",
"IOException",
"{",
"Query",
"query",
"=",
"new",
"Query",
"(",
")",
".",
"append",
"(",
"\"name\"",
",",
"awardName",
")",
";",
"Stri... | Create an award for a merge request
@param mergeRequest
@param awardName
@throws IOException on gitlab api call error | [
"Create",
"an",
"award",
"for",
"a",
"merge",
"request"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3477-L3483 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java | InMemoryLookupTable.putVector | @Override
public void putVector(String word, INDArray vector) {
if (word == null)
throw new IllegalArgumentException("No null words allowed");
if (vector == null)
throw new IllegalArgumentException("No null vectors allowed");
int idx = vocab.indexOf(word);
syn0.slice(idx).assign(vector);
} | java | @Override
public void putVector(String word, INDArray vector) {
if (word == null)
throw new IllegalArgumentException("No null words allowed");
if (vector == null)
throw new IllegalArgumentException("No null vectors allowed");
int idx = vocab.indexOf(word);
syn0.slice(idx).assign(vector);
} | [
"@",
"Override",
"public",
"void",
"putVector",
"(",
"String",
"word",
",",
"INDArray",
"vector",
")",
"{",
"if",
"(",
"word",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No null words allowed\"",
")",
";",
"if",
"(",
"vector",
"==... | Inserts a word vector
@param word the word to insert
@param vector the vector to insert | [
"Inserts",
"a",
"word",
"vector"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java#L496-L505 |
dita-ot/dita-ot | src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/index2/IndexPreprocessor.java | IndexPreprocessor.processCurrNode | private Node[] processCurrNode(final Node theNode, final Document theTargetDocument, final IndexEntryFoundListener theIndexEntryFoundListener) {
final NodeList childNodes = theNode.getChildNodes();
if (checkElementName(theNode) && !excludedDraftSection.peek()) {
return processIndexNode(theNode, theTargetDocument, theIndexEntryFoundListener);
} else {
final Node result = theTargetDocument.importNode(theNode, false);
if (!includeDraft && checkDraftNode(theNode)) {
excludedDraftSection.add(true);
}
for (int i = 0; i < childNodes.getLength(); i++) {
final Node[] processedNodes = processCurrNode(childNodes.item(i), theTargetDocument, theIndexEntryFoundListener);
for (final Node node : processedNodes) {
result.appendChild(node);
}
}
if (!includeDraft && checkDraftNode(theNode)) {
excludedDraftSection.pop();
}
return new Node[]{result};
}
} | java | private Node[] processCurrNode(final Node theNode, final Document theTargetDocument, final IndexEntryFoundListener theIndexEntryFoundListener) {
final NodeList childNodes = theNode.getChildNodes();
if (checkElementName(theNode) && !excludedDraftSection.peek()) {
return processIndexNode(theNode, theTargetDocument, theIndexEntryFoundListener);
} else {
final Node result = theTargetDocument.importNode(theNode, false);
if (!includeDraft && checkDraftNode(theNode)) {
excludedDraftSection.add(true);
}
for (int i = 0; i < childNodes.getLength(); i++) {
final Node[] processedNodes = processCurrNode(childNodes.item(i), theTargetDocument, theIndexEntryFoundListener);
for (final Node node : processedNodes) {
result.appendChild(node);
}
}
if (!includeDraft && checkDraftNode(theNode)) {
excludedDraftSection.pop();
}
return new Node[]{result};
}
} | [
"private",
"Node",
"[",
"]",
"processCurrNode",
"(",
"final",
"Node",
"theNode",
",",
"final",
"Document",
"theTargetDocument",
",",
"final",
"IndexEntryFoundListener",
"theIndexEntryFoundListener",
")",
"{",
"final",
"NodeList",
"childNodes",
"=",
"theNode",
".",
"... | Processes curr node. Copies node to the target document if its is not a text node of index entry element.
Otherwise it process it and creates nodes with "prefix" in given "namespace_url" from the parsed index entry text.
@param theNode node to process
@param theTargetDocument target document used to import and create nodes
@param theIndexEntryFoundListener listener to notify that new index entry was found
@return the array of nodes after processing input node | [
"Processes",
"curr",
"node",
".",
"Copies",
"node",
"to",
"the",
"target",
"document",
"if",
"its",
"is",
"not",
"a",
"text",
"node",
"of",
"index",
"entry",
"element",
".",
"Otherwise",
"it",
"process",
"it",
"and",
"creates",
"nodes",
"with",
"prefix",
... | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/index2/IndexPreprocessor.java#L161-L182 |
facebookarchive/hive-dwrf | hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java | Slice.getBytes | public void getBytes(int index, byte[] destination, int destinationIndex, int length)
{
checkIndexLength(index, length);
checkPositionIndexes(destinationIndex, destinationIndex + length, destination.length);
copyMemory(base, address + index, destination, (long) SizeOf.ARRAY_BYTE_BASE_OFFSET + destinationIndex, length);
} | java | public void getBytes(int index, byte[] destination, int destinationIndex, int length)
{
checkIndexLength(index, length);
checkPositionIndexes(destinationIndex, destinationIndex + length, destination.length);
copyMemory(base, address + index, destination, (long) SizeOf.ARRAY_BYTE_BASE_OFFSET + destinationIndex, length);
} | [
"public",
"void",
"getBytes",
"(",
"int",
"index",
",",
"byte",
"[",
"]",
"destination",
",",
"int",
"destinationIndex",
",",
"int",
"length",
")",
"{",
"checkIndexLength",
"(",
"index",
",",
"length",
")",
";",
"checkPositionIndexes",
"(",
"destinationIndex",... | Transfers portion of data from this slice into the specified destination starting at
the specified absolute {@code index}.
@param destinationIndex the first index of the destination
@param length the number of bytes to transfer
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0},
if the specified {@code destinationIndex} is less than {@code 0},
if {@code index + length} is greater than
{@code this.length()}, or
if {@code destinationIndex + length} is greater than
{@code destination.length} | [
"Transfers",
"portion",
"of",
"data",
"from",
"this",
"slice",
"into",
"the",
"specified",
"destination",
"starting",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"."
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L350-L356 |
neo4j/neo4j-java-driver | driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java | DriverFactory.createDirectDriver | protected InternalDriver createDirectDriver( SecurityPlan securityPlan, BoltServerAddress address, ConnectionPool connectionPool, RetryLogic retryLogic,
MetricsProvider metricsProvider, Config config )
{
ConnectionProvider connectionProvider = new DirectConnectionProvider( address, connectionPool );
SessionFactory sessionFactory = createSessionFactory( connectionProvider, retryLogic, config );
InternalDriver driver = createDriver( securityPlan, sessionFactory, metricsProvider, config );
Logger log = config.logging().getLog( Driver.class.getSimpleName() );
log.info( "Direct driver instance %s created for server address %s", driver.hashCode(), address );
return driver;
} | java | protected InternalDriver createDirectDriver( SecurityPlan securityPlan, BoltServerAddress address, ConnectionPool connectionPool, RetryLogic retryLogic,
MetricsProvider metricsProvider, Config config )
{
ConnectionProvider connectionProvider = new DirectConnectionProvider( address, connectionPool );
SessionFactory sessionFactory = createSessionFactory( connectionProvider, retryLogic, config );
InternalDriver driver = createDriver( securityPlan, sessionFactory, metricsProvider, config );
Logger log = config.logging().getLog( Driver.class.getSimpleName() );
log.info( "Direct driver instance %s created for server address %s", driver.hashCode(), address );
return driver;
} | [
"protected",
"InternalDriver",
"createDirectDriver",
"(",
"SecurityPlan",
"securityPlan",
",",
"BoltServerAddress",
"address",
",",
"ConnectionPool",
"connectionPool",
",",
"RetryLogic",
"retryLogic",
",",
"MetricsProvider",
"metricsProvider",
",",
"Config",
"config",
")",
... | Creates a new driver for "bolt" scheme.
<p>
<b>This method is protected only for testing</b> | [
"Creates",
"a",
"new",
"driver",
"for",
"bolt",
"scheme",
".",
"<p",
">",
"<b",
">",
"This",
"method",
"is",
"protected",
"only",
"for",
"testing<",
"/",
"b",
">"
] | train | https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java#L156-L165 |
playn/playn | java-base/src/playn/java/JavaAudio.java | JavaAudio.createSound | public JavaSound createSound(final JavaAssets.Resource rsrc, final boolean music) {
final JavaSound sound = new JavaSound(exec);
exec.invokeAsync(new Runnable() {
public void run () {
try {
AudioInputStream ais = rsrc.openAudioStream();
AudioFormat format = ais.getFormat();
Clip clip;
if (music) {
// BigClip needs sounds in PCM_SIGNED format; it attempts to do this conversion
// internally, but the way it does it fails in some circumstances, so we do it out here
if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
ais = AudioSystem.getAudioInputStream(new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
format.getSampleRate(),
16, // we have to force sample size to 16
format.getChannels(),
format.getChannels()*2,
format.getSampleRate(),
false // big endian
), ais);
}
clip = new BigClip();
} else {
DataLine.Info info = new DataLine.Info(Clip.class, format);
clip = (Clip) AudioSystem.getLine(info);
}
clip.open(ais);
sound.succeed(clip);
} catch (Exception e) {
sound.fail(e);
}
}
});
return sound;
} | java | public JavaSound createSound(final JavaAssets.Resource rsrc, final boolean music) {
final JavaSound sound = new JavaSound(exec);
exec.invokeAsync(new Runnable() {
public void run () {
try {
AudioInputStream ais = rsrc.openAudioStream();
AudioFormat format = ais.getFormat();
Clip clip;
if (music) {
// BigClip needs sounds in PCM_SIGNED format; it attempts to do this conversion
// internally, but the way it does it fails in some circumstances, so we do it out here
if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
ais = AudioSystem.getAudioInputStream(new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
format.getSampleRate(),
16, // we have to force sample size to 16
format.getChannels(),
format.getChannels()*2,
format.getSampleRate(),
false // big endian
), ais);
}
clip = new BigClip();
} else {
DataLine.Info info = new DataLine.Info(Clip.class, format);
clip = (Clip) AudioSystem.getLine(info);
}
clip.open(ais);
sound.succeed(clip);
} catch (Exception e) {
sound.fail(e);
}
}
});
return sound;
} | [
"public",
"JavaSound",
"createSound",
"(",
"final",
"JavaAssets",
".",
"Resource",
"rsrc",
",",
"final",
"boolean",
"music",
")",
"{",
"final",
"JavaSound",
"sound",
"=",
"new",
"JavaSound",
"(",
"exec",
")",
";",
"exec",
".",
"invokeAsync",
"(",
"new",
"R... | Creates a sound instance from the audio data available via {@code in}.
@param rsrc an resource instance via which the audio data can be read.
@param music if true, a custom {@link Clip} implementation will be used which can handle long
audio clips; if false, the default Java clip implementation is used which cannot handle long
audio clips. | [
"Creates",
"a",
"sound",
"instance",
"from",
"the",
"audio",
"data",
"available",
"via",
"{",
"@code",
"in",
"}",
"."
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaAudio.java#L43-L78 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.