repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/sepa/SepaVersion.java | SepaVersion.findType | private static Type findType(String type, String value) throws IllegalArgumentException {
if (type == null || type.length() == 0)
throw new IllegalArgumentException("no SEPA type type given");
if (value == null || value.length() == 0)
throw new IllegalArgumentException("no SEPA version value given");
for (Type t : Type.values()) {
if (t.getType().equalsIgnoreCase(type) && t.getValue().equals(value))
return t;
}
throw new IllegalArgumentException("unknown SEPA version type: " + type + "." + value);
} | java | private static Type findType(String type, String value) throws IllegalArgumentException {
if (type == null || type.length() == 0)
throw new IllegalArgumentException("no SEPA type type given");
if (value == null || value.length() == 0)
throw new IllegalArgumentException("no SEPA version value given");
for (Type t : Type.values()) {
if (t.getType().equalsIgnoreCase(type) && t.getValue().equals(value))
return t;
}
throw new IllegalArgumentException("unknown SEPA version type: " + type + "." + value);
} | [
"private",
"static",
"Type",
"findType",
"(",
"String",
"type",
",",
"String",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"length",
"(",
")",
"==",
"0",
")",
"throw",
"new",
"IllegalArgument... | Liefert den enum-Type fuer den angegebenen Wert.
@param type der Type. "pain", "camt".
@param value der Wert. 001, 002, 008, ....
@return der zugehoerige Enum-Wert.
@throws IllegalArgumentException wenn der Typ unbekannt ist. | [
"Liefert",
"den",
"enum",
"-",
"Type",
"fuer",
"den",
"angegebenen",
"Wert",
"."
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/sepa/SepaVersion.java#L182-L194 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java | AbstractHttpCommandCodec.defineCommand | @Override
public void defineCommand(String name, HttpMethod method, String pathPattern) {
defineCommand(name, new CommandSpec(method, pathPattern));
} | java | @Override
public void defineCommand(String name, HttpMethod method, String pathPattern) {
defineCommand(name, new CommandSpec(method, pathPattern));
} | [
"@",
"Override",
"public",
"void",
"defineCommand",
"(",
"String",
"name",
",",
"HttpMethod",
"method",
",",
"String",
"pathPattern",
")",
"{",
"defineCommand",
"(",
"name",
",",
"new",
"CommandSpec",
"(",
"method",
",",
"pathPattern",
")",
")",
";",
"}"
] | Defines a new command mapping.
@param name The command name.
@param method The HTTP method to use for the command.
@param pathPattern The URI path pattern for the command. When encoding a command, each
path segment prefixed with a ":" will be replaced with the corresponding parameter
from the encoded command. | [
"Defines",
"a",
"new",
"command",
"mapping",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java#L296-L299 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java | BufferUtil.copy | public static ByteBuffer copy(ByteBuffer src, int srcStart, ByteBuffer dest, int destStart, int length) {
System.arraycopy(src.array(), srcStart, dest.array(), destStart, length);
return dest;
} | java | public static ByteBuffer copy(ByteBuffer src, int srcStart, ByteBuffer dest, int destStart, int length) {
System.arraycopy(src.array(), srcStart, dest.array(), destStart, length);
return dest;
} | [
"public",
"static",
"ByteBuffer",
"copy",
"(",
"ByteBuffer",
"src",
",",
"int",
"srcStart",
",",
"ByteBuffer",
"dest",
",",
"int",
"destStart",
",",
"int",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"src",
".",
"array",
"(",
")",
",",
"srcStart... | 拷贝ByteBuffer
@param src 源ByteBuffer
@param srcStart 源开始的位置
@param dest 目标ByteBuffer
@param destStart 目标开始的位置
@param length 长度
@return 目标ByteBuffer | [
"拷贝ByteBuffer"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java#L65-L68 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.createGroup | public CmsGroup createGroup(String groupFqn, String description, int flags, String parent) throws CmsException {
return m_securityManager.createGroup(m_context, groupFqn, description, flags, parent);
} | java | public CmsGroup createGroup(String groupFqn, String description, int flags, String parent) throws CmsException {
return m_securityManager.createGroup(m_context, groupFqn, description, flags, parent);
} | [
"public",
"CmsGroup",
"createGroup",
"(",
"String",
"groupFqn",
",",
"String",
"description",
",",
"int",
"flags",
",",
"String",
"parent",
")",
"throws",
"CmsException",
"{",
"return",
"m_securityManager",
".",
"createGroup",
"(",
"m_context",
",",
"groupFqn",
... | Creates a new user group.<p>
@param groupFqn the name of the new group
@param description the description of the new group
@param flags the flags for the new group
@param parent the parent group (or <code>null</code>)
@return a <code>{@link CmsGroup}</code> object representing the newly created group
@throws CmsException if operation was not successful | [
"Creates",
"a",
"new",
"user",
"group",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L658-L661 |
infinispan/infinispan | core/src/main/java/org/infinispan/transaction/totalorder/TotalOrderManager.java | TotalOrderManager.ensureOrder | public final void ensureOrder(TotalOrderRemoteTransactionState state, Collection<?> keysModified) throws InterruptedException {
//the retries due to state transfer re-uses the same state. we need that the keys previous locked to be release
//in order to insert it again in the keys locked.
//NOTE: this method does not need to be synchronized because it is invoked by a one thread at the time, namely
//the thread that is delivering the messages in total order.
state.awaitUntilReset();
TotalOrderLatch transactionSynchronizedBlock = new TotalOrderLatchImpl(state.getGlobalTransaction().globalId());
state.setTransactionSynchronizedBlock(transactionSynchronizedBlock);
//this will collect all the count down latch corresponding to the previous transactions in the queue
for (Object key : keysModified) {
TotalOrderLatch prevTx = keysLocked.put(key, transactionSynchronizedBlock);
if (prevTx != null) {
state.addSynchronizedBlock(prevTx);
}
state.addLockedKey(key);
}
TotalOrderLatch stateTransfer = stateTransferInProgress.get();
if (stateTransfer != null) {
state.addSynchronizedBlock(stateTransfer);
}
if (trace) {
log.tracef("Transaction [%s] will wait for %s and locked %s", state.getGlobalTransaction().globalId(),
state.getConflictingTransactionBlocks(), state.getLockedKeys() == null ? "[ClearCommand]" :
state.getLockedKeys());
}
} | java | public final void ensureOrder(TotalOrderRemoteTransactionState state, Collection<?> keysModified) throws InterruptedException {
//the retries due to state transfer re-uses the same state. we need that the keys previous locked to be release
//in order to insert it again in the keys locked.
//NOTE: this method does not need to be synchronized because it is invoked by a one thread at the time, namely
//the thread that is delivering the messages in total order.
state.awaitUntilReset();
TotalOrderLatch transactionSynchronizedBlock = new TotalOrderLatchImpl(state.getGlobalTransaction().globalId());
state.setTransactionSynchronizedBlock(transactionSynchronizedBlock);
//this will collect all the count down latch corresponding to the previous transactions in the queue
for (Object key : keysModified) {
TotalOrderLatch prevTx = keysLocked.put(key, transactionSynchronizedBlock);
if (prevTx != null) {
state.addSynchronizedBlock(prevTx);
}
state.addLockedKey(key);
}
TotalOrderLatch stateTransfer = stateTransferInProgress.get();
if (stateTransfer != null) {
state.addSynchronizedBlock(stateTransfer);
}
if (trace) {
log.tracef("Transaction [%s] will wait for %s and locked %s", state.getGlobalTransaction().globalId(),
state.getConflictingTransactionBlocks(), state.getLockedKeys() == null ? "[ClearCommand]" :
state.getLockedKeys());
}
} | [
"public",
"final",
"void",
"ensureOrder",
"(",
"TotalOrderRemoteTransactionState",
"state",
",",
"Collection",
"<",
"?",
">",
"keysModified",
")",
"throws",
"InterruptedException",
"{",
"//the retries due to state transfer re-uses the same state. we need that the keys previous lock... | It ensures the validation order for the transaction corresponding to the prepare command. This allow the prepare
command to be moved to a thread pool.
@param state the total order prepare state | [
"It",
"ensures",
"the",
"validation",
"order",
"for",
"the",
"transaction",
"corresponding",
"to",
"the",
"prepare",
"command",
".",
"This",
"allow",
"the",
"prepare",
"command",
"to",
"be",
"moved",
"to",
"a",
"thread",
"pool",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/transaction/totalorder/TotalOrderManager.java#L65-L93 |
WolfgangFahl/Mediawiki-Japi | src/main/java/com/bitplan/mediawiki/japi/SiteInfoImpl.java | SiteInfoImpl.mapNamespace | public String mapNamespace(String ns, SiteInfo targetWiki) throws Exception {
Map<String, Ns> sourceMap = this.getNamespaces();
Map<Integer, Ns> targetMap = targetWiki.getNamespacesById();
Ns sourceNs = sourceMap.get(ns);
if (sourceNs == null) {
if (debug)
LOGGER.log(Level.WARNING, "can not map unknown namespace " + ns);
return ns;
}
Ns targetNs = targetMap.get(sourceNs.getId());
if (targetNs == null) {
if (debug)
LOGGER.log(
Level.WARNING,
"missing namespace " + sourceNs.getValue() + " id:"
+ sourceNs.getId() + " canonical:" + sourceNs.getCanonical());
return ns;
}
return targetNs.getValue();
} | java | public String mapNamespace(String ns, SiteInfo targetWiki) throws Exception {
Map<String, Ns> sourceMap = this.getNamespaces();
Map<Integer, Ns> targetMap = targetWiki.getNamespacesById();
Ns sourceNs = sourceMap.get(ns);
if (sourceNs == null) {
if (debug)
LOGGER.log(Level.WARNING, "can not map unknown namespace " + ns);
return ns;
}
Ns targetNs = targetMap.get(sourceNs.getId());
if (targetNs == null) {
if (debug)
LOGGER.log(
Level.WARNING,
"missing namespace " + sourceNs.getValue() + " id:"
+ sourceNs.getId() + " canonical:" + sourceNs.getCanonical());
return ns;
}
return targetNs.getValue();
} | [
"public",
"String",
"mapNamespace",
"(",
"String",
"ns",
",",
"SiteInfo",
"targetWiki",
")",
"throws",
"Exception",
"{",
"Map",
"<",
"String",
",",
"Ns",
">",
"sourceMap",
"=",
"this",
".",
"getNamespaces",
"(",
")",
";",
"Map",
"<",
"Integer",
",",
"Ns"... | map the given namespace to the target wiki
@param ns
@param targetWiki
@return the namespace name for the target wiki
@throws Exception | [
"map",
"the",
"given",
"namespace",
"to",
"the",
"target",
"wiki"
] | train | https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/SiteInfoImpl.java#L153-L172 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONArray.java | JSONArray.toList | public static List toList( JSONArray jsonArray, Class objectClass ) {
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setRootClass( objectClass );
return toList( jsonArray, jsonConfig );
} | java | public static List toList( JSONArray jsonArray, Class objectClass ) {
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setRootClass( objectClass );
return toList( jsonArray, jsonConfig );
} | [
"public",
"static",
"List",
"toList",
"(",
"JSONArray",
"jsonArray",
",",
"Class",
"objectClass",
")",
"{",
"JsonConfig",
"jsonConfig",
"=",
"new",
"JsonConfig",
"(",
")",
";",
"jsonConfig",
".",
"setRootClass",
"(",
"objectClass",
")",
";",
"return",
"toList"... | Creates a List from a JSONArray.
@deprecated replaced by toCollection
@see #toCollection(JSONArray,Class) | [
"Creates",
"a",
"List",
"from",
"a",
"JSONArray",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONArray.java#L421-L425 |
betfair/cougar | cougar-framework/jetty-transport/src/main/java/com/betfair/cougar/transport/impl/protocol/http/AbstractHttpCommandProcessor.java | AbstractHttpCommandProcessor.resolveContextForErrorHandling | protected DehydratedExecutionContext resolveContextForErrorHandling(DehydratedExecutionContext ctx, HttpCommand command) {
if (ctx != null) return ctx;
try {
return contextResolution.resolveExecutionContext(protocol, command, null);
} catch (RuntimeException e) {
// Well that failed too... nothing to do but return null
LOGGER.debug("Failed to resolve error execution context", e);
return null;
}
} | java | protected DehydratedExecutionContext resolveContextForErrorHandling(DehydratedExecutionContext ctx, HttpCommand command) {
if (ctx != null) return ctx;
try {
return contextResolution.resolveExecutionContext(protocol, command, null);
} catch (RuntimeException e) {
// Well that failed too... nothing to do but return null
LOGGER.debug("Failed to resolve error execution context", e);
return null;
}
} | [
"protected",
"DehydratedExecutionContext",
"resolveContextForErrorHandling",
"(",
"DehydratedExecutionContext",
"ctx",
",",
"HttpCommand",
"command",
")",
"{",
"if",
"(",
"ctx",
"!=",
"null",
")",
"return",
"ctx",
";",
"try",
"{",
"return",
"contextResolution",
".",
... | Resolves an HttpCommand to an ExecutionContext for the error logging scenario. This will
never throw an exception although it might return null. The process is:
<li>If a non null context is passed,us it</li>
<li>Otherwise try and resolve a context from the commmand</li>
<li>If that fail, return null</li>
@param ctx
the previously resolved context
@param command
contains the HttpServletRequest from which the contextual
information is derived
@return the ExecutionContext, populated with information from the
HttpCommend | [
"Resolves",
"an",
"HttpCommand",
"to",
"an",
"ExecutionContext",
"for",
"the",
"error",
"logging",
"scenario",
".",
"This",
"will",
"never",
"throw",
"an",
"exception",
"although",
"it",
"might",
"return",
"null",
".",
"The",
"process",
"is",
":",
"<li",
">"... | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/jetty-transport/src/main/java/com/betfair/cougar/transport/impl/protocol/http/AbstractHttpCommandProcessor.java#L215-L224 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoGpsLog.java | DaoGpsLog.collectDataForLog | public static void collectDataForLog( IHMConnection connection, GpsLog log ) throws Exception {
long logId = log.id;
String query = "select "
+ //
GpsLogsDataTableFields.COLUMN_DATA_LAT.getFieldName() + ","
+ //
GpsLogsDataTableFields.COLUMN_DATA_LON.getFieldName() + ","
+ //
GpsLogsDataTableFields.COLUMN_DATA_ALTIM.getFieldName() + ","
+ //
GpsLogsDataTableFields.COLUMN_DATA_TS.getFieldName()
+ //
" from " + TABLE_GPSLOG_DATA + " where "
+ //
GpsLogsDataTableFields.COLUMN_LOGID.getFieldName() + " = " + logId + " order by "
+ GpsLogsDataTableFields.COLUMN_DATA_TS.getFieldName();
try (IHMStatement newStatement = connection.createStatement(); IHMResultSet result = newStatement.executeQuery(query);) {
newStatement.setQueryTimeout(30);
while( result.next() ) {
double lat = result.getDouble(1);
double lon = result.getDouble(2);
double altim = result.getDouble(3);
long ts = result.getLong(4);
GpsPoint gPoint = new GpsPoint();
gPoint.lon = lon;
gPoint.lat = lat;
gPoint.altim = altim;
gPoint.utctime = ts;
log.points.add(gPoint);
}
}
} | java | public static void collectDataForLog( IHMConnection connection, GpsLog log ) throws Exception {
long logId = log.id;
String query = "select "
+ //
GpsLogsDataTableFields.COLUMN_DATA_LAT.getFieldName() + ","
+ //
GpsLogsDataTableFields.COLUMN_DATA_LON.getFieldName() + ","
+ //
GpsLogsDataTableFields.COLUMN_DATA_ALTIM.getFieldName() + ","
+ //
GpsLogsDataTableFields.COLUMN_DATA_TS.getFieldName()
+ //
" from " + TABLE_GPSLOG_DATA + " where "
+ //
GpsLogsDataTableFields.COLUMN_LOGID.getFieldName() + " = " + logId + " order by "
+ GpsLogsDataTableFields.COLUMN_DATA_TS.getFieldName();
try (IHMStatement newStatement = connection.createStatement(); IHMResultSet result = newStatement.executeQuery(query);) {
newStatement.setQueryTimeout(30);
while( result.next() ) {
double lat = result.getDouble(1);
double lon = result.getDouble(2);
double altim = result.getDouble(3);
long ts = result.getLong(4);
GpsPoint gPoint = new GpsPoint();
gPoint.lon = lon;
gPoint.lat = lat;
gPoint.altim = altim;
gPoint.utctime = ts;
log.points.add(gPoint);
}
}
} | [
"public",
"static",
"void",
"collectDataForLog",
"(",
"IHMConnection",
"connection",
",",
"GpsLog",
"log",
")",
"throws",
"Exception",
"{",
"long",
"logId",
"=",
"log",
".",
"id",
";",
"String",
"query",
"=",
"\"select \"",
"+",
"//",
"GpsLogsDataTableFields",
... | Gather gps points data for a supplied log.
@param connection the connection to use.
@param log the log.
@throws Exception | [
"Gather",
"gps",
"points",
"data",
"for",
"a",
"supplied",
"log",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoGpsLog.java#L303-L338 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/model/ForeignkeyDef.java | ForeignkeyDef.addColumnPair | public void addColumnPair(String localColumn, String remoteColumn)
{
if (!_localColumns.contains(localColumn))
{
_localColumns.add(localColumn);
}
if (!_remoteColumns.contains(remoteColumn))
{
_remoteColumns.add(remoteColumn);
}
} | java | public void addColumnPair(String localColumn, String remoteColumn)
{
if (!_localColumns.contains(localColumn))
{
_localColumns.add(localColumn);
}
if (!_remoteColumns.contains(remoteColumn))
{
_remoteColumns.add(remoteColumn);
}
} | [
"public",
"void",
"addColumnPair",
"(",
"String",
"localColumn",
",",
"String",
"remoteColumn",
")",
"{",
"if",
"(",
"!",
"_localColumns",
".",
"contains",
"(",
"localColumn",
")",
")",
"{",
"_localColumns",
".",
"add",
"(",
"localColumn",
")",
";",
"}",
"... | Adds a column pair to this foreignkey.
@param localColumn The column in the local table
@param remoteColumn The column in the remote table | [
"Adds",
"a",
"column",
"pair",
"to",
"this",
"foreignkey",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/ForeignkeyDef.java#L60-L70 |
actframework/actframework | src/main/java/act/data/ApacheMultipartParser.java | ApacheMultipartParser.getFieldName | private String getFieldName(Map /* String, String */ headers) {
String fieldName = null;
String cd = getHeader(headers, CONTENT_DISPOSITION);
if (cd != null && cd.toLowerCase().startsWith(FORM_DATA)) {
ParameterParser parser = new ParameterParser();
parser.setLowerCaseNames(true);
// Parameter parser can handle null input
Map params = parser.parse(cd, ';');
fieldName = (String) params.get("name");
if (fieldName != null) {
fieldName = fieldName.trim();
}
}
return fieldName;
} | java | private String getFieldName(Map /* String, String */ headers) {
String fieldName = null;
String cd = getHeader(headers, CONTENT_DISPOSITION);
if (cd != null && cd.toLowerCase().startsWith(FORM_DATA)) {
ParameterParser parser = new ParameterParser();
parser.setLowerCaseNames(true);
// Parameter parser can handle null input
Map params = parser.parse(cd, ';');
fieldName = (String) params.get("name");
if (fieldName != null) {
fieldName = fieldName.trim();
}
}
return fieldName;
} | [
"private",
"String",
"getFieldName",
"(",
"Map",
"/* String, String */",
"headers",
")",
"{",
"String",
"fieldName",
"=",
"null",
";",
"String",
"cd",
"=",
"getHeader",
"(",
"headers",
",",
"CONTENT_DISPOSITION",
")",
";",
"if",
"(",
"cd",
"!=",
"null",
"&&"... | Retrieves the field name from the <code>Content-disposition</code>
header.
@param headers A <code>Map</code> containing the HTTP request headers.
@return The field name for the current <code>encapsulation</code>. | [
"Retrieves",
"the",
"field",
"name",
"from",
"the",
"<code",
">",
"Content",
"-",
"disposition<",
"/",
"code",
">",
"header",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/data/ApacheMultipartParser.java#L207-L222 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java | Whitebox.invokeMethod | public static synchronized <T> T invokeMethod(Class<?> clazz, String methodToExecute, Object... arguments)
throws Exception {
return WhiteboxImpl.invokeMethod(clazz, methodToExecute, arguments);
} | java | public static synchronized <T> T invokeMethod(Class<?> clazz, String methodToExecute, Object... arguments)
throws Exception {
return WhiteboxImpl.invokeMethod(clazz, methodToExecute, arguments);
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"invokeMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodToExecute",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"return",
"WhiteboxImpl",
".",
"invokeMethod",
... | Invoke a static private or inner class method. This may be useful to test
private methods. | [
"Invoke",
"a",
"static",
"private",
"or",
"inner",
"class",
"method",
".",
"This",
"may",
"be",
"useful",
"to",
"test",
"private",
"methods",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L464-L467 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Chunk.java | Chunk.setSkew | public Chunk setSkew(float alpha, float beta) {
alpha = (float) Math.tan(alpha * Math.PI / 180);
beta = (float) Math.tan(beta * Math.PI / 180);
return setAttribute(SKEW, new float[] { alpha, beta });
} | java | public Chunk setSkew(float alpha, float beta) {
alpha = (float) Math.tan(alpha * Math.PI / 180);
beta = (float) Math.tan(beta * Math.PI / 180);
return setAttribute(SKEW, new float[] { alpha, beta });
} | [
"public",
"Chunk",
"setSkew",
"(",
"float",
"alpha",
",",
"float",
"beta",
")",
"{",
"alpha",
"=",
"(",
"float",
")",
"Math",
".",
"tan",
"(",
"alpha",
"*",
"Math",
".",
"PI",
"/",
"180",
")",
";",
"beta",
"=",
"(",
"float",
")",
"Math",
".",
"... | Skews the text to simulate italic and other effects. Try <CODE>alpha=0
</CODE> and <CODE>beta=12</CODE>.
@param alpha
the first angle in degrees
@param beta
the second angle in degrees
@return this <CODE>Chunk</CODE> | [
"Skews",
"the",
"text",
"to",
"simulate",
"italic",
"and",
"other",
"effects",
".",
"Try",
"<CODE",
">",
"alpha",
"=",
"0",
"<",
"/",
"CODE",
">",
"and",
"<CODE",
">",
"beta",
"=",
"12<",
"/",
"CODE",
">",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Chunk.java#L581-L585 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java | SocketBindingJBossASClient.setSocketBindingPort | public void setSocketBindingPort(String socketBindingGroupName, String socketBindingName, int port)
throws Exception {
setSocketBindingPortExpression(socketBindingGroupName, socketBindingName, null, port);
} | java | public void setSocketBindingPort(String socketBindingGroupName, String socketBindingName, int port)
throws Exception {
setSocketBindingPortExpression(socketBindingGroupName, socketBindingName, null, port);
} | [
"public",
"void",
"setSocketBindingPort",
"(",
"String",
"socketBindingGroupName",
",",
"String",
"socketBindingName",
",",
"int",
"port",
")",
"throws",
"Exception",
"{",
"setSocketBindingPortExpression",
"(",
"socketBindingGroupName",
",",
"socketBindingName",
",",
"nul... | Sets the port number for the named socket binding found in the named socket binding group.
@param socketBindingGroupName the name of the socket binding group that has the named socket binding
@param socketBindingName the name of the socket binding whose port is to be set
@param port the new port number
@throws Exception any error | [
"Sets",
"the",
"port",
"number",
"for",
"the",
"named",
"socket",
"binding",
"found",
"in",
"the",
"named",
"socket",
"binding",
"group",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java#L236-L239 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java | ContinuousDistributions.dirichletPdf | public static double dirichletPdf(double[] pi, double a) {
double probability=1.0;
int piLength=pi.length;
for(int i=0;i<piLength;++i) {
probability*=Math.pow(pi[i], a-1);
}
double sumAi=piLength*a;
double productGammaAi=Math.pow(gamma(a), piLength);
probability*=gamma(sumAi)/productGammaAi;
return probability;
} | java | public static double dirichletPdf(double[] pi, double a) {
double probability=1.0;
int piLength=pi.length;
for(int i=0;i<piLength;++i) {
probability*=Math.pow(pi[i], a-1);
}
double sumAi=piLength*a;
double productGammaAi=Math.pow(gamma(a), piLength);
probability*=gamma(sumAi)/productGammaAi;
return probability;
} | [
"public",
"static",
"double",
"dirichletPdf",
"(",
"double",
"[",
"]",
"pi",
",",
"double",
"a",
")",
"{",
"double",
"probability",
"=",
"1.0",
";",
"int",
"piLength",
"=",
"pi",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | Implementation for single alpha value.
@param pi The vector with probabilities.
@param a The alpha parameter for all pseudocounts.
@return The probability | [
"Implementation",
"for",
"single",
"alpha",
"value",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java#L619-L633 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java | RelatedClassMap.getCardinality | public Cardinality getCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) {
Cardinalities cardinalities = getCardinalities(sourceClass);
Cardinality cardinality = cardinalities == null ? null : cardinalities.getCardinality(targetClass);
return cardinality == null ? new Cardinality(sourceClass, targetClass, 0) : cardinality;
} | java | public Cardinality getCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) {
Cardinalities cardinalities = getCardinalities(sourceClass);
Cardinality cardinality = cardinalities == null ? null : cardinalities.getCardinality(targetClass);
return cardinality == null ? new Cardinality(sourceClass, targetClass, 0) : cardinality;
} | [
"public",
"Cardinality",
"getCardinality",
"(",
"Class",
"<",
"?",
"extends",
"ElementBase",
">",
"sourceClass",
",",
"Class",
"<",
"?",
"extends",
"ElementBase",
">",
"targetClass",
")",
"{",
"Cardinalities",
"cardinalities",
"=",
"getCardinalities",
"(",
"source... | Returns the cardinality between two element classes.
@param sourceClass The primary class.
@param targetClass The class to test.
@return The cardinality in the class relationship (never null). | [
"Returns",
"the",
"cardinality",
"between",
"two",
"element",
"classes",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L197-L201 |
Erudika/para | para-server/src/main/java/com/erudika/para/rest/RestUtils.java | RestUtils.getReadResponse | public static Response getReadResponse(App app, ParaObject content) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "crud", "read")) {
// app can't modify other apps except itself
if (app != null && content != null &&
checkImplicitAppPermissions(app, content) && checkIfUserCanModifyObject(app, content)) {
return Response.ok(content).build();
}
return getStatusResponse(Response.Status.NOT_FOUND);
}
} | java | public static Response getReadResponse(App app, ParaObject content) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "crud", "read")) {
// app can't modify other apps except itself
if (app != null && content != null &&
checkImplicitAppPermissions(app, content) && checkIfUserCanModifyObject(app, content)) {
return Response.ok(content).build();
}
return getStatusResponse(Response.Status.NOT_FOUND);
}
} | [
"public",
"static",
"Response",
"getReadResponse",
"(",
"App",
"app",
",",
"ParaObject",
"content",
")",
"{",
"try",
"(",
"final",
"Metrics",
".",
"Context",
"context",
"=",
"Metrics",
".",
"time",
"(",
"app",
"==",
"null",
"?",
"null",
":",
"app",
".",
... | Read response as JSON.
@param app the app object
@param content the object that was read
@return status code 200 or 404 | [
"Read",
"response",
"as",
"JSON",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L296-L306 |
rey5137/material | material/src/main/java/com/rey/material/widget/EditText.java | EditText.setTextKeepState | public final void setTextKeepState (CharSequence text, TextView.BufferType type){
mInputView.setTextKeepState(text, type);
} | java | public final void setTextKeepState (CharSequence text, TextView.BufferType type){
mInputView.setTextKeepState(text, type);
} | [
"public",
"final",
"void",
"setTextKeepState",
"(",
"CharSequence",
"text",
",",
"TextView",
".",
"BufferType",
"type",
")",
"{",
"mInputView",
".",
"setTextKeepState",
"(",
"text",
",",
"type",
")",
";",
"}"
] | Like {@link #setText(CharSequence, TextView.BufferType)},
except that the cursor position (if any) is retained in the new text.
@see #setText(CharSequence, TextView.BufferType) | [
"Like",
"{",
"@link",
"#setText",
"(",
"CharSequence",
"TextView",
".",
"BufferType",
")",
"}",
"except",
"that",
"the",
"cursor",
"position",
"(",
"if",
"any",
")",
"is",
"retained",
"in",
"the",
"new",
"text",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L3521-L3523 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/OrchestrationMasterSlaveDataSourceFactory.java | OrchestrationMasterSlaveDataSourceFactory.createDataSource | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final MasterSlaveRuleConfiguration masterSlaveRuleConfig,
final Properties props, final OrchestrationConfiguration orchestrationConfig) throws SQLException {
if (null == masterSlaveRuleConfig || null == masterSlaveRuleConfig.getMasterDataSourceName()) {
return createDataSource(orchestrationConfig);
}
MasterSlaveDataSource masterSlaveDataSource = new MasterSlaveDataSource(dataSourceMap, masterSlaveRuleConfig, props);
return new OrchestrationMasterSlaveDataSource(masterSlaveDataSource, orchestrationConfig);
} | java | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final MasterSlaveRuleConfiguration masterSlaveRuleConfig,
final Properties props, final OrchestrationConfiguration orchestrationConfig) throws SQLException {
if (null == masterSlaveRuleConfig || null == masterSlaveRuleConfig.getMasterDataSourceName()) {
return createDataSource(orchestrationConfig);
}
MasterSlaveDataSource masterSlaveDataSource = new MasterSlaveDataSource(dataSourceMap, masterSlaveRuleConfig, props);
return new OrchestrationMasterSlaveDataSource(masterSlaveDataSource, orchestrationConfig);
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"final",
"Map",
"<",
"String",
",",
"DataSource",
">",
"dataSourceMap",
",",
"final",
"MasterSlaveRuleConfiguration",
"masterSlaveRuleConfig",
",",
"final",
"Properties",
"props",
",",
"final",
"OrchestrationCon... | Create master-slave data source.
@param dataSourceMap data source map
@param masterSlaveRuleConfig master-slave rule configuration
@param props properties
@param orchestrationConfig orchestration configuration
@return master-slave data source
@throws SQLException SQL exception | [
"Create",
"master",
"-",
"slave",
"data",
"source",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/OrchestrationMasterSlaveDataSourceFactory.java#L50-L57 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.sub | public static <T> List<T> sub(List<T> list, int start, int end) {
return sub(list, start, end, 1);
} | java | public static <T> List<T> sub(List<T> list, int start, int end) {
return sub(list, start, end, 1);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"sub",
"(",
"List",
"<",
"T",
">",
"list",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"sub",
"(",
"list",
",",
"start",
",",
"end",
",",
"1",
")",
";",
"}"
] | 截取集合的部分
@param <T> 集合元素类型
@param list 被截取的数组
@param start 开始位置(包含)
@param end 结束位置(不包含)
@return 截取后的数组,当开始位置超过最大时,返回空的List | [
"截取集合的部分"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L814-L816 |
operasoftware/operaprestodriver | src/com/opera/core/systems/OperaLogs.java | OperaLogs.addEntry | public void addEntry(String logType, LogEntry entry) {
if (logTypesToIgnore.contains(logType)) {
return;
}
if (!localLogs.containsKey(logType)) {
localLogs.put(logType, Lists.newArrayList(entry));
} else {
localLogs.get(logType).add(entry);
}
} | java | public void addEntry(String logType, LogEntry entry) {
if (logTypesToIgnore.contains(logType)) {
return;
}
if (!localLogs.containsKey(logType)) {
localLogs.put(logType, Lists.newArrayList(entry));
} else {
localLogs.get(logType).add(entry);
}
} | [
"public",
"void",
"addEntry",
"(",
"String",
"logType",
",",
"LogEntry",
"entry",
")",
"{",
"if",
"(",
"logTypesToIgnore",
".",
"contains",
"(",
"logType",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"localLogs",
".",
"containsKey",
"(",
"logType"... | Add a new log entry to the local storage.
@param logType the log type to store
@param entry the entry to store | [
"Add",
"a",
"new",
"log",
"entry",
"to",
"the",
"local",
"storage",
"."
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaLogs.java#L71-L81 |
kiswanij/jk-util | src/main/java/com/jk/util/locale/JKMessage.java | JKMessage.addLables | public void addLables(JKLocale locale, final Properties lables) {
final Enumeration keys = lables.keys();
while (keys.hasMoreElements()) {
final String key = (String) keys.nextElement();
setProperty(locale, key, lables.getProperty(key));
}
} | java | public void addLables(JKLocale locale, final Properties lables) {
final Enumeration keys = lables.keys();
while (keys.hasMoreElements()) {
final String key = (String) keys.nextElement();
setProperty(locale, key, lables.getProperty(key));
}
} | [
"public",
"void",
"addLables",
"(",
"JKLocale",
"locale",
",",
"final",
"Properties",
"lables",
")",
"{",
"final",
"Enumeration",
"keys",
"=",
"lables",
".",
"keys",
"(",
")",
";",
"while",
"(",
"keys",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"final"... | Adds the lables.
@param locale the locale
@param lables the lables | [
"Adds",
"the",
"lables",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/locale/JKMessage.java#L120-L126 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java | AddThenHideOldStrategy.getNonProductResourceWithHigherVersion | private RepositoryResource getNonProductResourceWithHigherVersion(RepositoryResource res1, RepositoryResource res2) {
if (res1.getVersion() == null || res2.getVersion() == null) {
return res1; // don't have two versions so can't compare
}
// have two String versions .. convert them into Version objects,checking that they are valid versions in the process
Version4Digit res1Version = null;
Version4Digit res2Version = null;
try {
res1Version = new Version4Digit(res1.getVersion());
res2Version = new Version4Digit(res2.getVersion());
} catch (IllegalArgumentException iae) {
// at least one of the one or more of Versions is not a proper osgi
// version so we cannot compare the version fields. Just return res1.
return res1;
}
if (res1Version.compareTo(res2Version) > 0) {
return res1;
} else {
return res2;
}
} | java | private RepositoryResource getNonProductResourceWithHigherVersion(RepositoryResource res1, RepositoryResource res2) {
if (res1.getVersion() == null || res2.getVersion() == null) {
return res1; // don't have two versions so can't compare
}
// have two String versions .. convert them into Version objects,checking that they are valid versions in the process
Version4Digit res1Version = null;
Version4Digit res2Version = null;
try {
res1Version = new Version4Digit(res1.getVersion());
res2Version = new Version4Digit(res2.getVersion());
} catch (IllegalArgumentException iae) {
// at least one of the one or more of Versions is not a proper osgi
// version so we cannot compare the version fields. Just return res1.
return res1;
}
if (res1Version.compareTo(res2Version) > 0) {
return res1;
} else {
return res2;
}
} | [
"private",
"RepositoryResource",
"getNonProductResourceWithHigherVersion",
"(",
"RepositoryResource",
"res1",
",",
"RepositoryResource",
"res2",
")",
"{",
"if",
"(",
"res1",
".",
"getVersion",
"(",
")",
"==",
"null",
"||",
"res2",
".",
"getVersion",
"(",
")",
"=="... | Return the resource with the highest version for when the appliesTo versions are equal
@param res1 resource to compare
@param res2 resource to compare
@return RepositoryResource with the higher version field | [
"Return",
"the",
"resource",
"with",
"the",
"highest",
"version",
"for",
"when",
"the",
"appliesTo",
"versions",
"are",
"equal"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/strategies/writeable/AddThenHideOldStrategy.java#L375-L398 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.findLast | public static <E> E findLast(Iterator<E> iterator, Predicate<E> predicate) {
final Iterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
return new LastElement<E>().apply(filtered);
} | java | public static <E> E findLast(Iterator<E> iterator, Predicate<E> predicate) {
final Iterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
return new LastElement<E>().apply(filtered);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"findLast",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"final",
"Iterator",
"<",
"E",
">",
"filtered",
"=",
"new",
"FilteringIterator",
"<",
"E",
">",
"(... | Searches the last matching element returning it.
@param <E> the element type parameter
@param iterator the iterator to be searched
@param predicate the predicate to be applied to each element
@throws IllegalArgumentException if no element matches
@return the last element found | [
"Searches",
"the",
"last",
"matching",
"element",
"returning",
"it",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L598-L601 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/agent/ZooKeeperAgentModel.java | ZooKeeperAgentModel.setTaskStatus | @Override
public void setTaskStatus(final JobId jobId, final TaskStatus status)
throws InterruptedException {
log.debug("setting task status: {}", status);
taskStatuses.put(jobId.toString(), status.toJsonBytes());
if (historyWriter != null) {
try {
historyWriter.saveHistoryItem(status);
} catch (Exception e) {
// Log error here and keep going as saving task history is not critical.
// This is to prevent bad data in the queue from screwing up the actually important Helios
// agent operations.
log.error("Error saving task status {} to ZooKeeper: {}", status, e);
}
}
final TaskStatusEvent event = new TaskStatusEvent(status, System.currentTimeMillis(), agent);
final byte[] message = event.toJsonBytes();
for (final EventSender sender : eventSenders) {
sender.send(taskStatusEventTopic, message);
}
} | java | @Override
public void setTaskStatus(final JobId jobId, final TaskStatus status)
throws InterruptedException {
log.debug("setting task status: {}", status);
taskStatuses.put(jobId.toString(), status.toJsonBytes());
if (historyWriter != null) {
try {
historyWriter.saveHistoryItem(status);
} catch (Exception e) {
// Log error here and keep going as saving task history is not critical.
// This is to prevent bad data in the queue from screwing up the actually important Helios
// agent operations.
log.error("Error saving task status {} to ZooKeeper: {}", status, e);
}
}
final TaskStatusEvent event = new TaskStatusEvent(status, System.currentTimeMillis(), agent);
final byte[] message = event.toJsonBytes();
for (final EventSender sender : eventSenders) {
sender.send(taskStatusEventTopic, message);
}
} | [
"@",
"Override",
"public",
"void",
"setTaskStatus",
"(",
"final",
"JobId",
"jobId",
",",
"final",
"TaskStatus",
"status",
")",
"throws",
"InterruptedException",
"{",
"log",
".",
"debug",
"(",
"\"setting task status: {}\"",
",",
"status",
")",
";",
"taskStatuses",
... | Set the {@link TaskStatus} for the job identified by {@code jobId}. | [
"Set",
"the",
"{"
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/ZooKeeperAgentModel.java#L155-L175 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/cluster/topology/ClusterTopologyRefresh.java | ClusterTopologyRefresh.getViewedBy | public RedisURI getViewedBy(Map<RedisURI, Partitions> map, Partitions partitions) {
for (Map.Entry<RedisURI, Partitions> entry : map.entrySet()) {
if (entry.getValue() == partitions) {
return entry.getKey();
}
}
return null;
} | java | public RedisURI getViewedBy(Map<RedisURI, Partitions> map, Partitions partitions) {
for (Map.Entry<RedisURI, Partitions> entry : map.entrySet()) {
if (entry.getValue() == partitions) {
return entry.getKey();
}
}
return null;
} | [
"public",
"RedisURI",
"getViewedBy",
"(",
"Map",
"<",
"RedisURI",
",",
"Partitions",
">",
"map",
",",
"Partitions",
"partitions",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"RedisURI",
",",
"Partitions",
">",
"entry",
":",
"map",
".",
"entrySet",
"(... | Resolve a {@link RedisURI} from a map of cluster views by {@link Partitions} as key
@param map the map
@param partitions the key
@return a {@link RedisURI} or null | [
"Resolve",
"a",
"{",
"@link",
"RedisURI",
"}",
"from",
"a",
"map",
"of",
"cluster",
"views",
"by",
"{",
"@link",
"Partitions",
"}",
"as",
"key"
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/topology/ClusterTopologyRefresh.java#L276-L285 |
zeromq/jeromq | src/main/java/org/zeromq/proto/ZPicture.java | ZPicture.sendPicture | @Draft
public boolean sendPicture(Socket socket, String picture, Object... args)
{
if (!FORMAT.matcher(picture).matches()) {
throw new ZMQException(picture + " is not in expected format " + FORMAT.pattern(), ZError.EPROTO);
}
ZMsg msg = new ZMsg();
for (int pictureIndex = 0, argIndex = 0; pictureIndex < picture.length(); pictureIndex++, argIndex++) {
char pattern = picture.charAt(pictureIndex);
switch (pattern) {
case 'i': {
msg.add(String.format("%d", (int) args[argIndex]));
break;
}
case '1': {
msg.add(String.format("%d", (0xff) & (int) args[argIndex]));
break;
}
case '2': {
msg.add(String.format("%d", (0xffff) & (int) args[argIndex]));
break;
}
case '4': {
msg.add(String.format("%d", (0xffffffff) & (int) args[argIndex]));
break;
}
case '8': {
msg.add(String.format("%d", (long) args[argIndex]));
break;
}
case 's': {
msg.add((String) args[argIndex]);
break;
}
case 'b':
case 'c': {
msg.add((byte[]) args[argIndex]);
break;
}
case 'f': {
msg.add((ZFrame) args[argIndex]);
break;
}
case 'm': {
ZMsg msgParm = (ZMsg) args[argIndex];
while (msgParm.size() > 0) {
msg.add(msgParm.pop());
}
break;
}
case 'z': {
msg.add((byte[]) null);
argIndex--;
break;
}
default:
assert (false) : "invalid picture element '" + pattern + "'";
}
}
return msg.send(socket, false);
} | java | @Draft
public boolean sendPicture(Socket socket, String picture, Object... args)
{
if (!FORMAT.matcher(picture).matches()) {
throw new ZMQException(picture + " is not in expected format " + FORMAT.pattern(), ZError.EPROTO);
}
ZMsg msg = new ZMsg();
for (int pictureIndex = 0, argIndex = 0; pictureIndex < picture.length(); pictureIndex++, argIndex++) {
char pattern = picture.charAt(pictureIndex);
switch (pattern) {
case 'i': {
msg.add(String.format("%d", (int) args[argIndex]));
break;
}
case '1': {
msg.add(String.format("%d", (0xff) & (int) args[argIndex]));
break;
}
case '2': {
msg.add(String.format("%d", (0xffff) & (int) args[argIndex]));
break;
}
case '4': {
msg.add(String.format("%d", (0xffffffff) & (int) args[argIndex]));
break;
}
case '8': {
msg.add(String.format("%d", (long) args[argIndex]));
break;
}
case 's': {
msg.add((String) args[argIndex]);
break;
}
case 'b':
case 'c': {
msg.add((byte[]) args[argIndex]);
break;
}
case 'f': {
msg.add((ZFrame) args[argIndex]);
break;
}
case 'm': {
ZMsg msgParm = (ZMsg) args[argIndex];
while (msgParm.size() > 0) {
msg.add(msgParm.pop());
}
break;
}
case 'z': {
msg.add((byte[]) null);
argIndex--;
break;
}
default:
assert (false) : "invalid picture element '" + pattern + "'";
}
}
return msg.send(socket, false);
} | [
"@",
"Draft",
"public",
"boolean",
"sendPicture",
"(",
"Socket",
"socket",
",",
"String",
"picture",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"FORMAT",
".",
"matcher",
"(",
"picture",
")",
".",
"matches",
"(",
")",
")",
"{",
"throw",
"... | Queues a 'picture' message to the socket (or actor), so it can be sent.
@param picture The picture is a string that defines the type of each frame.
This makes it easy to send a complex multiframe message in
one call. The picture can contain any of these characters,
each corresponding to zero or one arguments:
<table>
<caption> </caption>
<tr><td>i = int (stores signed integer)</td></tr>
<tr><td>1 = byte (stores 8-bit unsigned integer)</td></tr>
<tr><td>2 = int (stores 16-bit unsigned integer)</td></tr>
<tr><td>4 = long (stores 32-bit unsigned integer)</td></tr>
<tr><td>8 = long (stores 64-bit unsigned integer)</td></tr>
<tr><td>s = String</td></tr>
<tr><td>b = byte[]</td></tr>
<tr><td>c = byte[]</td></tr>
<tr><td>f = ZFrame</td></tr>
<tr><td>m = ZMsg (sends all frames in the ZMsg)<b>Has to be the last element of the picture</b></td></tr>
<tr><td>z = sends zero-sized frame (0 arguments)</td></tr>
</table>
Note that s, b, f and m are encoded the same way and the choice is
offered as a convenience to the sender, which may or may not already
have data in a ZFrame or ZMsg. Does not change or take ownership of
any arguments.
Also see {@link #recvPicture(Socket, String)}} how to recv a
multiframe picture.
@param args Arguments according to the picture
@return true if successful, false if sending failed for any reason | [
"Queues",
"a",
"picture",
"message",
"to",
"the",
"socket",
"(",
"or",
"actor",
")",
"so",
"it",
"can",
"be",
"sent",
"."
] | train | https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/proto/ZPicture.java#L279-L339 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/index/SecondaryIndex.java | SecondaryIndex.buildIndexAsync | public Future<?> buildIndexAsync()
{
// if we're just linking in the index to indexedColumns on an already-built index post-restart, we're done
boolean allAreBuilt = true;
for (ColumnDefinition cdef : columnDefs)
{
if (!SystemKeyspace.isIndexBuilt(baseCfs.keyspace.getName(), getNameForSystemKeyspace(cdef.name.bytes)))
{
allAreBuilt = false;
break;
}
}
if (allAreBuilt)
return null;
// build it asynchronously; addIndex gets called by CFS open and schema update, neither of which
// we want to block for a long period. (actual build is serialized on CompactionManager.)
Runnable runnable = new Runnable()
{
public void run()
{
baseCfs.forceBlockingFlush();
buildIndexBlocking();
}
};
FutureTask<?> f = new FutureTask<Object>(runnable, null);
new Thread(f, "Creating index: " + getIndexName()).start();
return f;
} | java | public Future<?> buildIndexAsync()
{
// if we're just linking in the index to indexedColumns on an already-built index post-restart, we're done
boolean allAreBuilt = true;
for (ColumnDefinition cdef : columnDefs)
{
if (!SystemKeyspace.isIndexBuilt(baseCfs.keyspace.getName(), getNameForSystemKeyspace(cdef.name.bytes)))
{
allAreBuilt = false;
break;
}
}
if (allAreBuilt)
return null;
// build it asynchronously; addIndex gets called by CFS open and schema update, neither of which
// we want to block for a long period. (actual build is serialized on CompactionManager.)
Runnable runnable = new Runnable()
{
public void run()
{
baseCfs.forceBlockingFlush();
buildIndexBlocking();
}
};
FutureTask<?> f = new FutureTask<Object>(runnable, null);
new Thread(f, "Creating index: " + getIndexName()).start();
return f;
} | [
"public",
"Future",
"<",
"?",
">",
"buildIndexAsync",
"(",
")",
"{",
"// if we're just linking in the index to indexedColumns on an already-built index post-restart, we're done",
"boolean",
"allAreBuilt",
"=",
"true",
";",
"for",
"(",
"ColumnDefinition",
"cdef",
":",
"columnD... | Builds the index using the data in the underlying CF, non blocking
@return A future object which the caller can block on (optional) | [
"Builds",
"the",
"index",
"using",
"the",
"data",
"in",
"the",
"underlying",
"CF",
"non",
"blocking"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/index/SecondaryIndex.java#L227-L257 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_account_accountName_filter_name_changeActivity_POST | public OvhTaskFilter domain_account_accountName_filter_name_changeActivity_POST(String domain, String accountName, String name, Boolean activity) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/changeActivity";
StringBuilder sb = path(qPath, domain, accountName, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activity", activity);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskFilter.class);
} | java | public OvhTaskFilter domain_account_accountName_filter_name_changeActivity_POST(String domain, String accountName, String name, Boolean activity) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/changeActivity";
StringBuilder sb = path(qPath, domain, accountName, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activity", activity);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskFilter.class);
} | [
"public",
"OvhTaskFilter",
"domain_account_accountName_filter_name_changeActivity_POST",
"(",
"String",
"domain",
",",
"String",
"accountName",
",",
"String",
"name",
",",
"Boolean",
"activity",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{... | Change filter activity
REST: POST /email/domain/{domain}/account/{accountName}/filter/{name}/changeActivity
@param activity [required] New activity
@param domain [required] Name of your domain name
@param accountName [required] Name of account
@param name [required] Filter name | [
"Change",
"filter",
"activity"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L668-L675 |
Stratio/cassandra-lucene-index | plugin/src/main/java/com/stratio/cassandra/lucene/schema/SchemaBuilders.java | SchemaBuilders.bitemporalMapper | public static BitemporalMapperBuilder bitemporalMapper(String vtFrom, String vtTo, String ttFrom, String ttTo) {
return new BitemporalMapperBuilder(vtFrom, vtTo, ttFrom, ttTo);
} | java | public static BitemporalMapperBuilder bitemporalMapper(String vtFrom, String vtTo, String ttFrom, String ttTo) {
return new BitemporalMapperBuilder(vtFrom, vtTo, ttFrom, ttTo);
} | [
"public",
"static",
"BitemporalMapperBuilder",
"bitemporalMapper",
"(",
"String",
"vtFrom",
",",
"String",
"vtTo",
",",
"String",
"ttFrom",
",",
"String",
"ttTo",
")",
"{",
"return",
"new",
"BitemporalMapperBuilder",
"(",
"vtFrom",
",",
"vtTo",
",",
"ttFrom",
",... | Returns a new {@link BitemporalMapperBuilder}.
@param vtFrom the column name containing the valid time start
@param vtTo the column name containing the valid time stop
@param ttFrom the column name containing the transaction time start
@param ttTo the column name containing the transaction time stop
@return a new bitemporal mapper builder | [
"Returns",
"a",
"new",
"{",
"@link",
"BitemporalMapperBuilder",
"}",
"."
] | train | https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/schema/SchemaBuilders.java#L71-L73 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/AbstractListBinding.java | AbstractListBinding.convertValue | protected Object convertValue(Object value, Class targetClass) throws ConversionException {
Assert.notNull(value);
Assert.notNull(targetClass);
return getConversionService().getConversionExecutor(value.getClass(), targetClass).execute(value);
} | java | protected Object convertValue(Object value, Class targetClass) throws ConversionException {
Assert.notNull(value);
Assert.notNull(targetClass);
return getConversionService().getConversionExecutor(value.getClass(), targetClass).execute(value);
} | [
"protected",
"Object",
"convertValue",
"(",
"Object",
"value",
",",
"Class",
"targetClass",
")",
"throws",
"ConversionException",
"{",
"Assert",
".",
"notNull",
"(",
"value",
")",
";",
"Assert",
".",
"notNull",
"(",
"targetClass",
")",
";",
"return",
"getConve... | Converts the given object value into the given targetClass
@param value
the value to convert
@param targetClass
the target class to convert the value to
@return the converted value
@throws org.springframework.binding.convert.ConversionException
if the value can not be converted | [
"Converts",
"the",
"given",
"object",
"value",
"into",
"the",
"given",
"targetClass"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/AbstractListBinding.java#L157-L161 |
sebastiangraf/perfidix | src/main/java/org/perfidix/element/BenchmarkExecutor.java | BenchmarkExecutor.initialize | public static void initialize(final AbstractConfig config, final BenchmarkResult result) {
METERS_TO_BENCH.clear();
METERS_TO_BENCH.addAll(Arrays.asList(config.getMeters()));
EXECUTOR.clear();
BENCHRES = result;
CONFIG = config;
} | java | public static void initialize(final AbstractConfig config, final BenchmarkResult result) {
METERS_TO_BENCH.clear();
METERS_TO_BENCH.addAll(Arrays.asList(config.getMeters()));
EXECUTOR.clear();
BENCHRES = result;
CONFIG = config;
} | [
"public",
"static",
"void",
"initialize",
"(",
"final",
"AbstractConfig",
"config",
",",
"final",
"BenchmarkResult",
"result",
")",
"{",
"METERS_TO_BENCH",
".",
"clear",
"(",
")",
";",
"METERS_TO_BENCH",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"confi... | Initializing the executor.
@param config to be benched
@param result to be stored to | [
"Initializing",
"the",
"executor",
"."
] | train | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/element/BenchmarkExecutor.java#L122-L129 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.checkFieldTypeSignature | private static int checkFieldTypeSignature(final String signature, int pos) {
// FieldTypeSignature:
// ClassTypeSignature | ArrayTypeSignature | TypeVariableSignature
//
// ArrayTypeSignature:
// [ TypeSignature
switch (getChar(signature, pos)) {
case 'L':
return checkClassTypeSignature(signature, pos);
case '[':
return checkTypeSignature(signature, pos + 1);
default:
return checkTypeVariableSignature(signature, pos);
}
} | java | private static int checkFieldTypeSignature(final String signature, int pos) {
// FieldTypeSignature:
// ClassTypeSignature | ArrayTypeSignature | TypeVariableSignature
//
// ArrayTypeSignature:
// [ TypeSignature
switch (getChar(signature, pos)) {
case 'L':
return checkClassTypeSignature(signature, pos);
case '[':
return checkTypeSignature(signature, pos + 1);
default:
return checkTypeVariableSignature(signature, pos);
}
} | [
"private",
"static",
"int",
"checkFieldTypeSignature",
"(",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"// FieldTypeSignature:",
"// ClassTypeSignature | ArrayTypeSignature | TypeVariableSignature",
"//",
"// ArrayTypeSignature:",
"// [ TypeSignature",
"switch",... | Checks a field type signature.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first character after the checked part. | [
"Checks",
"a",
"field",
"type",
"signature",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L820-L835 |
Netflix/zeno | src/main/java/com/netflix/zeno/diff/DiffOperation.java | DiffOperation.performDiff | public DiffReport performDiff(FastBlobStateEngine fromState, FastBlobStateEngine toState) throws DiffReportGenerationException {
return performDiff(null, fromState, toState);
} | java | public DiffReport performDiff(FastBlobStateEngine fromState, FastBlobStateEngine toState) throws DiffReportGenerationException {
return performDiff(null, fromState, toState);
} | [
"public",
"DiffReport",
"performDiff",
"(",
"FastBlobStateEngine",
"fromState",
",",
"FastBlobStateEngine",
"toState",
")",
"throws",
"DiffReportGenerationException",
"{",
"return",
"performDiff",
"(",
"null",
",",
"fromState",
",",
"toState",
")",
";",
"}"
] | Perform a diff between two data states.
Note: For now, this operation will ignore type instructions for non-unique keys.
@param fromState - The "from" state engine, populated with one of the deserialized data states to compare
@param toState - the "to" state engine, populated with the other deserialized data state to compare.
@param factory - The SerializerFactory describing the data model to use.
@return the DiffReport for investigation of the differences between the two data states.
@throws DiffReportGenerationException | [
"Perform",
"a",
"diff",
"between",
"two",
"data",
"states",
"."
] | train | https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/diff/DiffOperation.java#L53-L55 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancerOutboundRulesInner.java | LoadBalancerOutboundRulesInner.getAsync | public Observable<OutboundRuleInner> getAsync(String resourceGroupName, String loadBalancerName, String outboundRuleName) {
return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, outboundRuleName).map(new Func1<ServiceResponse<OutboundRuleInner>, OutboundRuleInner>() {
@Override
public OutboundRuleInner call(ServiceResponse<OutboundRuleInner> response) {
return response.body();
}
});
} | java | public Observable<OutboundRuleInner> getAsync(String resourceGroupName, String loadBalancerName, String outboundRuleName) {
return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, outboundRuleName).map(new Func1<ServiceResponse<OutboundRuleInner>, OutboundRuleInner>() {
@Override
public OutboundRuleInner call(ServiceResponse<OutboundRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OutboundRuleInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"loadBalancerName",
",",
"String",
"outboundRuleName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"loadBalancerName... | Gets the specified load balancer outbound rule.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@param outboundRuleName The name of the outbound rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OutboundRuleInner object | [
"Gets",
"the",
"specified",
"load",
"balancer",
"outbound",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancerOutboundRulesInner.java#L233-L240 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainerGroupsInner.java | ContainerGroupsInner.restartAsync | public Observable<Void> restartAsync(String resourceGroupName, String containerGroupName) {
return restartWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> restartAsync(String resourceGroupName, String containerGroupName) {
return restartWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"restartAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
")",
"{",
"return",
"restartWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGroupName",
")",
".",
"map",
"(",
"new",
... | Restarts all containers in a container group.
Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Restarts",
"all",
"containers",
"in",
"a",
"container",
"group",
".",
"Restarts",
"all",
"containers",
"in",
"a",
"container",
"group",
"in",
"place",
".",
"If",
"container",
"image",
"has",
"updates",
"new",
"image",
"will",
"be",
"downloaded",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainerGroupsInner.java#L848-L855 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptContainer.java | ScriptContainer.addLegacyTagIdMappings | public void addLegacyTagIdMappings(String tagId, String tagName)
{
assert (tagId != null) : "The parameter 'tagId' must not be null";
assert (tagName != null) : "The parameter 'tagName' must not be null";
if (_idMap == null) {
_idMap = new HashMap/*<String, String>*/();
}
assert (_idMap != null) : "_idMap should not be null";
_idMap.put(tagId, tagName);
} | java | public void addLegacyTagIdMappings(String tagId, String tagName)
{
assert (tagId != null) : "The parameter 'tagId' must not be null";
assert (tagName != null) : "The parameter 'tagName' must not be null";
if (_idMap == null) {
_idMap = new HashMap/*<String, String>*/();
}
assert (_idMap != null) : "_idMap should not be null";
_idMap.put(tagId, tagName);
} | [
"public",
"void",
"addLegacyTagIdMappings",
"(",
"String",
"tagId",
",",
"String",
"tagName",
")",
"{",
"assert",
"(",
"tagId",
"!=",
"null",
")",
":",
"\"The parameter 'tagId' must not be null\"",
";",
"assert",
"(",
"tagName",
"!=",
"null",
")",
":",
"\"The pa... | Adds a tagID and tagName to the Html's getId javascript function.
@param tagId the id of a child tag.
@param tagName the name of a child tag. | [
"Adds",
"a",
"tagID",
"and",
"tagName",
"to",
"the",
"Html",
"s",
"getId",
"javascript",
"function",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptContainer.java#L142-L153 |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/datatype/xsd/DecimalDatatype.java | DecimalDatatype.sameValue | public boolean sameValue(Object value1, Object value2) {
return ((BigDecimal)value1).compareTo((BigDecimal)value2) == 0;
} | java | public boolean sameValue(Object value1, Object value2) {
return ((BigDecimal)value1).compareTo((BigDecimal)value2) == 0;
} | [
"public",
"boolean",
"sameValue",
"(",
"Object",
"value1",
",",
"Object",
"value2",
")",
"{",
"return",
"(",
"(",
"BigDecimal",
")",
"value1",
")",
".",
"compareTo",
"(",
"(",
"BigDecimal",
")",
"value2",
")",
"==",
"0",
";",
"}"
] | BigDecimal.equals considers objects distinct if they have the
different scales but the same mathematical value. Similarly
for hashCode. | [
"BigDecimal",
".",
"equals",
"considers",
"objects",
"distinct",
"if",
"they",
"have",
"the",
"different",
"scales",
"but",
"the",
"same",
"mathematical",
"value",
".",
"Similarly",
"for",
"hashCode",
"."
] | train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/datatype/xsd/DecimalDatatype.java#L75-L77 |
google/truth | core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java | Platform.isInstanceOfType | static boolean isInstanceOfType(Object instance, Class<?> clazz) {
if (clazz.isInterface()) {
throw new UnsupportedOperationException(
"Under GWT, we can't determine whether an object is an instance of an interface Class");
}
for (Class<?> current = instance.getClass();
current != null;
current = current.getSuperclass()) {
if (current.equals(clazz)) {
return true;
}
}
return false;
} | java | static boolean isInstanceOfType(Object instance, Class<?> clazz) {
if (clazz.isInterface()) {
throw new UnsupportedOperationException(
"Under GWT, we can't determine whether an object is an instance of an interface Class");
}
for (Class<?> current = instance.getClass();
current != null;
current = current.getSuperclass()) {
if (current.equals(clazz)) {
return true;
}
}
return false;
} | [
"static",
"boolean",
"isInstanceOfType",
"(",
"Object",
"instance",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"clazz",
".",
"isInterface",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Under GWT, we can't determine... | Returns true if the instance is assignable to the type Clazz. | [
"Returns",
"true",
"if",
"the",
"instance",
"is",
"assignable",
"to",
"the",
"type",
"Clazz",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java#L37-L51 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Point2D.java | Point2D.orientationRobust | public static int orientationRobust(Point2D p, Point2D q, Point2D r) {
ECoordinate det_ec = new ECoordinate();
det_ec.set(q.x);
det_ec.sub(p.x);
ECoordinate rp_y_ec = new ECoordinate();
rp_y_ec.set(r.y);
rp_y_ec.sub(p.y);
ECoordinate qp_y_ec = new ECoordinate();
qp_y_ec.set(q.y);
qp_y_ec.sub(p.y);
ECoordinate rp_x_ec = new ECoordinate();
rp_x_ec.set(r.x);
rp_x_ec.sub(p.x);
det_ec.mul(rp_y_ec);
qp_y_ec.mul(rp_x_ec);
det_ec.sub(qp_y_ec);
if (!det_ec.isFuzzyZero()) {
double det_ec_value = det_ec.value();
if (det_ec_value < 0.0)
return -1;
if (det_ec_value > 0.0)
return 1;
return 0;
}
// Need extended precision
BigDecimal det_mp = new BigDecimal(q.x);
BigDecimal px_mp = new BigDecimal(p.x);
BigDecimal py_mp = new BigDecimal(p.y);
det_mp = det_mp.subtract(px_mp);
BigDecimal rp_y_mp = new BigDecimal(r.y);
rp_y_mp = rp_y_mp.subtract(py_mp);
BigDecimal qp_y_mp = new BigDecimal(q.y);
qp_y_mp = qp_y_mp.subtract(py_mp);
BigDecimal rp_x_mp = new BigDecimal(r.x);
rp_x_mp = rp_x_mp.subtract(px_mp);
det_mp = det_mp.multiply(rp_y_mp);
qp_y_mp = qp_y_mp.multiply(rp_x_mp);
det_mp = det_mp.subtract(qp_y_mp);
return det_mp.signum();
} | java | public static int orientationRobust(Point2D p, Point2D q, Point2D r) {
ECoordinate det_ec = new ECoordinate();
det_ec.set(q.x);
det_ec.sub(p.x);
ECoordinate rp_y_ec = new ECoordinate();
rp_y_ec.set(r.y);
rp_y_ec.sub(p.y);
ECoordinate qp_y_ec = new ECoordinate();
qp_y_ec.set(q.y);
qp_y_ec.sub(p.y);
ECoordinate rp_x_ec = new ECoordinate();
rp_x_ec.set(r.x);
rp_x_ec.sub(p.x);
det_ec.mul(rp_y_ec);
qp_y_ec.mul(rp_x_ec);
det_ec.sub(qp_y_ec);
if (!det_ec.isFuzzyZero()) {
double det_ec_value = det_ec.value();
if (det_ec_value < 0.0)
return -1;
if (det_ec_value > 0.0)
return 1;
return 0;
}
// Need extended precision
BigDecimal det_mp = new BigDecimal(q.x);
BigDecimal px_mp = new BigDecimal(p.x);
BigDecimal py_mp = new BigDecimal(p.y);
det_mp = det_mp.subtract(px_mp);
BigDecimal rp_y_mp = new BigDecimal(r.y);
rp_y_mp = rp_y_mp.subtract(py_mp);
BigDecimal qp_y_mp = new BigDecimal(q.y);
qp_y_mp = qp_y_mp.subtract(py_mp);
BigDecimal rp_x_mp = new BigDecimal(r.x);
rp_x_mp = rp_x_mp.subtract(px_mp);
det_mp = det_mp.multiply(rp_y_mp);
qp_y_mp = qp_y_mp.multiply(rp_x_mp);
det_mp = det_mp.subtract(qp_y_mp);
return det_mp.signum();
} | [
"public",
"static",
"int",
"orientationRobust",
"(",
"Point2D",
"p",
",",
"Point2D",
"q",
",",
"Point2D",
"r",
")",
"{",
"ECoordinate",
"det_ec",
"=",
"new",
"ECoordinate",
"(",
")",
";",
"det_ec",
".",
"set",
"(",
"q",
".",
"x",
")",
";",
"det_ec",
... | Calculates the orientation of the triangle formed by p, q, r. Returns 1
for counter-clockwise, -1 for clockwise, and 0 for collinear. May use
high precision arithmetics for some special degenerate cases. | [
"Calculates",
"the",
"orientation",
"of",
"the",
"triangle",
"formed",
"by",
"p",
"q",
"r",
".",
"Returns",
"1",
"for",
"counter",
"-",
"clockwise",
"-",
"1",
"for",
"clockwise",
"and",
"0",
"for",
"collinear",
".",
"May",
"use",
"high",
"precision",
"ar... | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Point2D.java#L442-L496 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java | AssertKripton.assertTrueOrUnknownPropertyInJQLException | public static void assertTrueOrUnknownPropertyInJQLException(boolean expression, JQLContext method,
String columnName) {
if (!expression) {
throw (new UnknownPropertyInJQLException(method, columnName));
}
} | java | public static void assertTrueOrUnknownPropertyInJQLException(boolean expression, JQLContext method,
String columnName) {
if (!expression) {
throw (new UnknownPropertyInJQLException(method, columnName));
}
} | [
"public",
"static",
"void",
"assertTrueOrUnknownPropertyInJQLException",
"(",
"boolean",
"expression",
",",
"JQLContext",
"method",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"(",
"new",
"UnknownPropertyInJQLException",
"... | Assert true or unknown property in JQL exception.
@param expression
the expression
@param method
the method
@param columnName
the column name | [
"Assert",
"true",
"or",
"unknown",
"property",
"in",
"JQL",
"exception",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java#L257-L263 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getColorR | public float getColorR(int vertex, int colorset) {
if (!hasColors(colorset)) {
throw new IllegalStateException("mesh has no colorset " + colorset);
}
checkVertexIndexBounds(vertex);
/* bound checks for colorset are done by java for us */
return m_colorsets[colorset].getFloat(vertex * 4 * SIZEOF_FLOAT);
} | java | public float getColorR(int vertex, int colorset) {
if (!hasColors(colorset)) {
throw new IllegalStateException("mesh has no colorset " + colorset);
}
checkVertexIndexBounds(vertex);
/* bound checks for colorset are done by java for us */
return m_colorsets[colorset].getFloat(vertex * 4 * SIZEOF_FLOAT);
} | [
"public",
"float",
"getColorR",
"(",
"int",
"vertex",
",",
"int",
"colorset",
")",
"{",
"if",
"(",
"!",
"hasColors",
"(",
"colorset",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no colorset \"",
"+",
"colorset",
")",
";",
"}",
... | Returns the red color component of a color from a vertex color set.
@param vertex the vertex index
@param colorset the color set
@return the red color component | [
"Returns",
"the",
"red",
"color",
"component",
"of",
"a",
"color",
"from",
"a",
"vertex",
"color",
"set",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L870-L879 |
phax/ph-css | ph-css/src/main/java/com/helger/css/decl/CSSExpression.java | CSSExpression.addString | @Nonnull
public CSSExpression addString (@Nonnegative final int nIndex, @Nonnull final String sValue)
{
return addTermSimple (nIndex, getQuotedStringValue (sValue));
} | java | @Nonnull
public CSSExpression addString (@Nonnegative final int nIndex, @Nonnull final String sValue)
{
return addTermSimple (nIndex, getQuotedStringValue (sValue));
} | [
"@",
"Nonnull",
"public",
"CSSExpression",
"addString",
"(",
"@",
"Nonnegative",
"final",
"int",
"nIndex",
",",
"@",
"Nonnull",
"final",
"String",
"sValue",
")",
"{",
"return",
"addTermSimple",
"(",
"nIndex",
",",
"getQuotedStringValue",
"(",
"sValue",
")",
")... | Shortcut method to add a string value that is automatically quoted inside
@param nIndex
The index where the member should be added. Must be ≥ 0.
@param sValue
The value to be quoted and than added. May not be <code>null</code>.
@return this | [
"Shortcut",
"method",
"to",
"add",
"a",
"string",
"value",
"that",
"is",
"automatically",
"quoted",
"inside"
] | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/decl/CSSExpression.java#L272-L276 |
apache/incubator-gobblin | gobblin-modules/gobblin-kafka-09/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaSimpleStreamingExtractor.java | KafkaSimpleStreamingExtractor.readRecordEnvelopeImpl | @Override
public RecordEnvelope<D> readRecordEnvelopeImpl()
throws DataRecordException, IOException {
if (!_isStarted.get()) {
throw new IOException("Streaming extractor has not been started.");
}
while ((_records == null) || (!_records.hasNext())) {
synchronized (_consumer) {
if (_close.get()) {
throw new ClosedChannelException();
}
_records = _consumer.poll(this.fetchTimeOut).iterator();
}
}
ConsumerRecord<S, D> record = _records.next();
_rowCount.getAndIncrement();
return new RecordEnvelope<D>(record.value(), new KafkaWatermark(_partition, new LongWatermark(record.offset())));
} | java | @Override
public RecordEnvelope<D> readRecordEnvelopeImpl()
throws DataRecordException, IOException {
if (!_isStarted.get()) {
throw new IOException("Streaming extractor has not been started.");
}
while ((_records == null) || (!_records.hasNext())) {
synchronized (_consumer) {
if (_close.get()) {
throw new ClosedChannelException();
}
_records = _consumer.poll(this.fetchTimeOut).iterator();
}
}
ConsumerRecord<S, D> record = _records.next();
_rowCount.getAndIncrement();
return new RecordEnvelope<D>(record.value(), new KafkaWatermark(_partition, new LongWatermark(record.offset())));
} | [
"@",
"Override",
"public",
"RecordEnvelope",
"<",
"D",
">",
"readRecordEnvelopeImpl",
"(",
")",
"throws",
"DataRecordException",
",",
"IOException",
"{",
"if",
"(",
"!",
"_isStarted",
".",
"get",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Str... | Return the next record when available. Will never time out since this is a streaming source. | [
"Return",
"the",
"next",
"record",
"when",
"available",
".",
"Will",
"never",
"time",
"out",
"since",
"this",
"is",
"a",
"streaming",
"source",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-09/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaSimpleStreamingExtractor.java#L208-L225 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java | AbstractCasView.getAssertionFrom | protected Assertion getAssertionFrom(final Map<String, Object> model) {
return (Assertion) model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_ASSERTION);
} | java | protected Assertion getAssertionFrom(final Map<String, Object> model) {
return (Assertion) model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_ASSERTION);
} | [
"protected",
"Assertion",
"getAssertionFrom",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"model",
")",
"{",
"return",
"(",
"Assertion",
")",
"model",
".",
"get",
"(",
"CasViewConstants",
".",
"MODEL_ATTRIBUTE_NAME_ASSERTION",
")",
";",
"}"
] | Gets the assertion from the model.
@param model the model
@return the assertion from | [
"Gets",
"the",
"assertion",
"from",
"the",
"model",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java#L76-L78 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java | AssertMessages.lowerEqualParameters | @Pure
public static String lowerEqualParameters(int aindex, Object avalue, int bindex, Object bvalue) {
return msg("A3", aindex, avalue, bindex, bvalue); //$NON-NLS-1$
} | java | @Pure
public static String lowerEqualParameters(int aindex, Object avalue, int bindex, Object bvalue) {
return msg("A3", aindex, avalue, bindex, bvalue); //$NON-NLS-1$
} | [
"@",
"Pure",
"public",
"static",
"String",
"lowerEqualParameters",
"(",
"int",
"aindex",
",",
"Object",
"avalue",
",",
"int",
"bindex",
",",
"Object",
"bvalue",
")",
"{",
"return",
"msg",
"(",
"\"A3\"",
",",
"aindex",
",",
"avalue",
",",
"bindex",
",",
"... | Parameter A must be lower than or equal to Parameter B.
@param aindex the index of the parameter A.
@param avalue the value of the parameter A.
@param bindex the index of the parameter B.
@param bvalue the value of the parameter B.
@return the error message. | [
"Parameter",
"A",
"must",
"be",
"lower",
"than",
"or",
"equal",
"to",
"Parameter",
"B",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L139-L142 |
alkacon/opencms-core | src/org/opencms/main/CmsSystemInfo.java | CmsSystemInfo.getConfigFilePath | public String getConfigFilePath(CmsObject cms, String configFile) {
String path = CmsStringUtil.joinPaths(VFS_CONFIG_OVERRIDE_FOLDER, configFile);
if (!cms.existsResource(path)) {
path = CmsStringUtil.joinPaths(VFS_CONFIG_FOLDER, configFile);
}
return path;
} | java | public String getConfigFilePath(CmsObject cms, String configFile) {
String path = CmsStringUtil.joinPaths(VFS_CONFIG_OVERRIDE_FOLDER, configFile);
if (!cms.existsResource(path)) {
path = CmsStringUtil.joinPaths(VFS_CONFIG_FOLDER, configFile);
}
return path;
} | [
"public",
"String",
"getConfigFilePath",
"(",
"CmsObject",
"cms",
",",
"String",
"configFile",
")",
"{",
"String",
"path",
"=",
"CmsStringUtil",
".",
"joinPaths",
"(",
"VFS_CONFIG_OVERRIDE_FOLDER",
",",
"configFile",
")",
";",
"if",
"(",
"!",
"cms",
".",
"exis... | Returns the path to a configuration file.<p>
This will either be a file below /system/config/ or in case an override file exists below /system/config/overrides/.<p>
@param cms the cms ontext
@param configFile the config file path within /system/config/
@return the file path | [
"Returns",
"the",
"path",
"to",
"a",
"configuration",
"file",
".",
"<p",
">",
"This",
"will",
"either",
"be",
"a",
"file",
"below",
"/",
"system",
"/",
"config",
"/",
"or",
"in",
"case",
"an",
"override",
"file",
"exists",
"below",
"/",
"system",
"/",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSystemInfo.java#L320-L327 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/SequenceFile.java | SequenceFile.createWriter | private static Writer
createWriter(FileSystem fs, Configuration conf, Path file,
Class keyClass, Class valClass,
boolean compress, boolean blockCompress,
CompressionCodec codec, Progressable progress, Metadata metadata)
throws IOException {
if (codec != null && (codec instanceof GzipCodec) &&
!NativeCodeLoader.isNativeCodeLoaded() &&
!ZlibFactory.isNativeZlibLoaded(conf)) {
throw new IllegalArgumentException("SequenceFile doesn't work with " +
"GzipCodec without native-hadoop code!");
}
Writer writer = null;
if (!compress) {
writer = new Writer(fs, conf, file, keyClass, valClass, progress, metadata);
} else if (compress && !blockCompress) {
writer = new RecordCompressWriter(fs, conf, file, keyClass, valClass,
codec, progress, metadata);
} else {
writer = new BlockCompressWriter(fs, conf, file, keyClass, valClass,
codec, progress, metadata);
}
return writer;
} | java | private static Writer
createWriter(FileSystem fs, Configuration conf, Path file,
Class keyClass, Class valClass,
boolean compress, boolean blockCompress,
CompressionCodec codec, Progressable progress, Metadata metadata)
throws IOException {
if (codec != null && (codec instanceof GzipCodec) &&
!NativeCodeLoader.isNativeCodeLoaded() &&
!ZlibFactory.isNativeZlibLoaded(conf)) {
throw new IllegalArgumentException("SequenceFile doesn't work with " +
"GzipCodec without native-hadoop code!");
}
Writer writer = null;
if (!compress) {
writer = new Writer(fs, conf, file, keyClass, valClass, progress, metadata);
} else if (compress && !blockCompress) {
writer = new RecordCompressWriter(fs, conf, file, keyClass, valClass,
codec, progress, metadata);
} else {
writer = new BlockCompressWriter(fs, conf, file, keyClass, valClass,
codec, progress, metadata);
}
return writer;
} | [
"private",
"static",
"Writer",
"createWriter",
"(",
"FileSystem",
"fs",
",",
"Configuration",
"conf",
",",
"Path",
"file",
",",
"Class",
"keyClass",
",",
"Class",
"valClass",
",",
"boolean",
"compress",
",",
"boolean",
"blockCompress",
",",
"CompressionCodec",
"... | Construct the preferred type of 'raw' SequenceFile Writer.
@param fs The configured filesystem.
@param conf The configuration.
@param file The name of the file.
@param keyClass The 'key' type.
@param valClass The 'value' type.
@param compress Compress data?
@param blockCompress Compress blocks?
@param codec The compression codec.
@param progress
@param metadata The metadata of the file.
@return Returns the handle to the constructed SequenceFile Writer.
@throws IOException | [
"Construct",
"the",
"preferred",
"type",
"of",
"raw",
"SequenceFile",
"Writer",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/SequenceFile.java#L611-L637 |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudget10V1_1Generator.java | RRFedNonFedBudget10V1_1Generator.setCumulativeEquipments | private void setCumulativeEquipments(BudgetSummary budgetSummary, BudgetSummaryDto budgetSummaryData) {
if (budgetSummaryData != null) {
SummaryDataType summary = SummaryDataType.Factory.newInstance();
if (budgetSummaryData.getCumEquipmentFunds() != null) {
summary.setFederalSummary(budgetSummaryData.getCumEquipmentFunds().bigDecimalValue());
}
if (budgetSummaryData.getCumEquipmentNonFunds() != null) {
summary.setNonFederalSummary(budgetSummaryData.getCumEquipmentNonFunds().bigDecimalValue());
if (budgetSummaryData.getCumEquipmentFunds() != null) {
summary.setTotalFedNonFedSummary(budgetSummaryData.getCumEquipmentFunds().add(
budgetSummaryData.getCumEquipmentNonFunds()).bigDecimalValue());
}
else {
summary.setTotalFedNonFedSummary(budgetSummaryData.getCumEquipmentNonFunds().bigDecimalValue());
}
}
budgetSummary.setCumulativeTotalFundsRequestedEquipment(summary);
}
} | java | private void setCumulativeEquipments(BudgetSummary budgetSummary, BudgetSummaryDto budgetSummaryData) {
if (budgetSummaryData != null) {
SummaryDataType summary = SummaryDataType.Factory.newInstance();
if (budgetSummaryData.getCumEquipmentFunds() != null) {
summary.setFederalSummary(budgetSummaryData.getCumEquipmentFunds().bigDecimalValue());
}
if (budgetSummaryData.getCumEquipmentNonFunds() != null) {
summary.setNonFederalSummary(budgetSummaryData.getCumEquipmentNonFunds().bigDecimalValue());
if (budgetSummaryData.getCumEquipmentFunds() != null) {
summary.setTotalFedNonFedSummary(budgetSummaryData.getCumEquipmentFunds().add(
budgetSummaryData.getCumEquipmentNonFunds()).bigDecimalValue());
}
else {
summary.setTotalFedNonFedSummary(budgetSummaryData.getCumEquipmentNonFunds().bigDecimalValue());
}
}
budgetSummary.setCumulativeTotalFundsRequestedEquipment(summary);
}
} | [
"private",
"void",
"setCumulativeEquipments",
"(",
"BudgetSummary",
"budgetSummary",
",",
"BudgetSummaryDto",
"budgetSummaryData",
")",
"{",
"if",
"(",
"budgetSummaryData",
"!=",
"null",
")",
"{",
"SummaryDataType",
"summary",
"=",
"SummaryDataType",
".",
"Factory",
"... | This method gets CumulativeEquipments information CumulativeTotalFundsRequestedEquipment based on BudgetSummaryInfo for the
form RRFedNonFedBudget.
@param budgetSummaryData (BudgetSummaryInfo) budget summary entry. | [
"This",
"method",
"gets",
"CumulativeEquipments",
"information",
"CumulativeTotalFundsRequestedEquipment",
"based",
"on",
"BudgetSummaryInfo",
"for",
"the",
"form",
"RRFedNonFedBudget",
"."
] | train | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudget10V1_1Generator.java#L629-L648 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java | BugInstance.addCalledMethod | @Nonnull
public BugInstance addCalledMethod(MethodGen methodGen, InvokeInstruction inv) {
ConstantPoolGen cpg = methodGen.getConstantPool();
return addCalledMethod(cpg, inv);
} | java | @Nonnull
public BugInstance addCalledMethod(MethodGen methodGen, InvokeInstruction inv) {
ConstantPoolGen cpg = methodGen.getConstantPool();
return addCalledMethod(cpg, inv);
} | [
"@",
"Nonnull",
"public",
"BugInstance",
"addCalledMethod",
"(",
"MethodGen",
"methodGen",
",",
"InvokeInstruction",
"inv",
")",
"{",
"ConstantPoolGen",
"cpg",
"=",
"methodGen",
".",
"getConstantPool",
"(",
")",
";",
"return",
"addCalledMethod",
"(",
"cpg",
",",
... | Add a method annotation for the method which is called by given
instruction.
@param methodGen
the method containing the call
@param inv
the InvokeInstruction
@return this object | [
"Add",
"a",
"method",
"annotation",
"for",
"the",
"method",
"which",
"is",
"called",
"by",
"given",
"instruction",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1472-L1476 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/filter/SubCurrentFilter.java | SubCurrentFilter.setMainKey | public boolean setMainKey(boolean bDisplayOption, Boolean boolSetModified, boolean bSetIfModified)
{
super.setMainKey(bDisplayOption, boolSetModified, bSetIfModified);
boolean bNonNulls = false; // Default to yes, all keys are null.
if (Boolean.TRUE.equals(boolSetModified))
{ // Only restore the key value when setting the starting or ending key, not when adding a record.
KeyArea keyArea = this.getOwner().getKeyArea(-1);
m_buffer.resetPosition();
keyArea.reverseKeyBuffer(m_buffer, DBConstants.FILE_KEY_AREA);
for (int i = 0; i < keyArea.getKeyFields(); i++)
{
keyArea.getField(i).setModified(false);
if ((i <= m_iLastModifiedToSet)
|| (m_iLastModifiedToSet == -1))
{
keyArea.getField(i).setModified(true);
if (!keyArea.getField(i).isNull())
bNonNulls = true; // Non null.
}
}
}
return bNonNulls;
} | java | public boolean setMainKey(boolean bDisplayOption, Boolean boolSetModified, boolean bSetIfModified)
{
super.setMainKey(bDisplayOption, boolSetModified, bSetIfModified);
boolean bNonNulls = false; // Default to yes, all keys are null.
if (Boolean.TRUE.equals(boolSetModified))
{ // Only restore the key value when setting the starting or ending key, not when adding a record.
KeyArea keyArea = this.getOwner().getKeyArea(-1);
m_buffer.resetPosition();
keyArea.reverseKeyBuffer(m_buffer, DBConstants.FILE_KEY_AREA);
for (int i = 0; i < keyArea.getKeyFields(); i++)
{
keyArea.getField(i).setModified(false);
if ((i <= m_iLastModifiedToSet)
|| (m_iLastModifiedToSet == -1))
{
keyArea.getField(i).setModified(true);
if (!keyArea.getField(i).isNull())
bNonNulls = true; // Non null.
}
}
}
return bNonNulls;
} | [
"public",
"boolean",
"setMainKey",
"(",
"boolean",
"bDisplayOption",
",",
"Boolean",
"boolSetModified",
",",
"boolean",
"bSetIfModified",
")",
"{",
"super",
".",
"setMainKey",
"(",
"bDisplayOption",
",",
"boolSetModified",
",",
"bSetIfModified",
")",
";",
"boolean",... | Setup the target key field.
Restore the original value if this is called for initial or end (ie., boolSetModified us TRUE).
@oaram bDisplayOption If true, display changes.
@param boolSetModified - If not null, set this field's modified flag to this value
@return false If this key was set to all nulls. | [
"Setup",
"the",
"target",
"key",
"field",
".",
"Restore",
"the",
"original",
"value",
"if",
"this",
"is",
"called",
"for",
"initial",
"or",
"end",
"(",
"ie",
".",
"boolSetModified",
"us",
"TRUE",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/filter/SubCurrentFilter.java#L130-L152 |
StripesFramework/stripes-stuff | src/main/java/org/stripesstuff/plugin/waitpage/WaitPageInterceptor.java | WaitPageInterceptor.createContextAndRedirect | private Resolution createContextAndRedirect(ExecutionContext executionContext, WaitPage annotation) throws IOException {
// Create context used to call the event in background.
Context context = this.createContext(executionContext);
context.actionBean = executionContext.getActionBean();
context.eventHandler = executionContext.getHandler();
context.annotation = annotation;
context.resolution = new ForwardResolution(annotation.path());
context.bindingFlashScope = FlashScope.getCurrent(context.actionBean.getContext().getRequest(), false);
int id = context.hashCode();
// Id of context.
String ids = Integer.toHexString(id);
// Create background request to execute event.
HttpServletRequest request = executionContext.getActionBeanContext().getRequest();
UrlBuilder urlBuilder = new UrlBuilder(executionContext.getActionBeanContext().getLocale(), THREAD_URL, false);
// Add parameters from the original request in case there were some parameters that weren't bound but are used
@SuppressWarnings({ "cast", "unchecked" })
Set<Map.Entry<String,String[]>> paramSet = (Set<Map.Entry<String,String[]>>) request.getParameterMap().entrySet();
for (Map.Entry<String,String[]> param : paramSet)
for (String value : param.getValue())
urlBuilder.addParameter(param.getKey(), value);
urlBuilder.addParameter(ID_PARAMETER, ids);
if (context.bindingFlashScope != null) {
urlBuilder.addParameter(StripesConstants.URL_KEY_FLASH_SCOPE_ID, String.valueOf(context.bindingFlashScope.key()));
}
urlBuilder.addParameter(StripesConstants.URL_KEY_SOURCE_PAGE, CryptoUtil.encrypt(executionContext.getActionBeanContext().getSourcePage()));
context.url = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), request.getContextPath() + urlBuilder.toString());
context.cookies = request.getHeader("Cookie");
// Save context.
contexts.put(id, context);
// Execute background request.
context.thread = new Thread(context);
context.thread.start();
// Redirect user to wait page.
return new RedirectResolution(StripesFilter.getConfiguration().getActionResolver().getUrlBinding(context.actionBean.getClass())) {
@Override
public RedirectResolution addParameter(String key, Object... value) {
// Leave flash scope to background request.
if (!StripesConstants.URL_KEY_FLASH_SCOPE_ID.equals(key)) {
return super.addParameter(key, value);
}
return this;
}
}.addParameter(ID_PARAMETER, ids);
} | java | private Resolution createContextAndRedirect(ExecutionContext executionContext, WaitPage annotation) throws IOException {
// Create context used to call the event in background.
Context context = this.createContext(executionContext);
context.actionBean = executionContext.getActionBean();
context.eventHandler = executionContext.getHandler();
context.annotation = annotation;
context.resolution = new ForwardResolution(annotation.path());
context.bindingFlashScope = FlashScope.getCurrent(context.actionBean.getContext().getRequest(), false);
int id = context.hashCode();
// Id of context.
String ids = Integer.toHexString(id);
// Create background request to execute event.
HttpServletRequest request = executionContext.getActionBeanContext().getRequest();
UrlBuilder urlBuilder = new UrlBuilder(executionContext.getActionBeanContext().getLocale(), THREAD_URL, false);
// Add parameters from the original request in case there were some parameters that weren't bound but are used
@SuppressWarnings({ "cast", "unchecked" })
Set<Map.Entry<String,String[]>> paramSet = (Set<Map.Entry<String,String[]>>) request.getParameterMap().entrySet();
for (Map.Entry<String,String[]> param : paramSet)
for (String value : param.getValue())
urlBuilder.addParameter(param.getKey(), value);
urlBuilder.addParameter(ID_PARAMETER, ids);
if (context.bindingFlashScope != null) {
urlBuilder.addParameter(StripesConstants.URL_KEY_FLASH_SCOPE_ID, String.valueOf(context.bindingFlashScope.key()));
}
urlBuilder.addParameter(StripesConstants.URL_KEY_SOURCE_PAGE, CryptoUtil.encrypt(executionContext.getActionBeanContext().getSourcePage()));
context.url = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), request.getContextPath() + urlBuilder.toString());
context.cookies = request.getHeader("Cookie");
// Save context.
contexts.put(id, context);
// Execute background request.
context.thread = new Thread(context);
context.thread.start();
// Redirect user to wait page.
return new RedirectResolution(StripesFilter.getConfiguration().getActionResolver().getUrlBinding(context.actionBean.getClass())) {
@Override
public RedirectResolution addParameter(String key, Object... value) {
// Leave flash scope to background request.
if (!StripesConstants.URL_KEY_FLASH_SCOPE_ID.equals(key)) {
return super.addParameter(key, value);
}
return this;
}
}.addParameter(ID_PARAMETER, ids);
} | [
"private",
"Resolution",
"createContextAndRedirect",
"(",
"ExecutionContext",
"executionContext",
",",
"WaitPage",
"annotation",
")",
"throws",
"IOException",
"{",
"// Create context used to call the event in background.",
"Context",
"context",
"=",
"this",
".",
"createContext"... | Create a wait context to execute event in background.
@param executionContext execution context
@param annotation wait page annotation
@return redirect redirect user so that wait page appears
@throws IOException could not create background request | [
"Create",
"a",
"wait",
"context",
"to",
"execute",
"event",
"in",
"background",
"."
] | train | https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/waitpage/WaitPageInterceptor.java#L204-L254 |
bwkimmel/java-util | src/main/java/ca/eandb/util/io/FileUtil.java | FileUtil.writeObjectToFile | public static void writeObjectToFile(File file, Object object) throws IOException {
FileOutputStream fs = new FileOutputStream(file);
ObjectOutputStream os = new ObjectOutputStream(fs);
os.writeObject(object);
os.close();
} | java | public static void writeObjectToFile(File file, Object object) throws IOException {
FileOutputStream fs = new FileOutputStream(file);
ObjectOutputStream os = new ObjectOutputStream(fs);
os.writeObject(object);
os.close();
} | [
"public",
"static",
"void",
"writeObjectToFile",
"(",
"File",
"file",
",",
"Object",
"object",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fs",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"ObjectOutputStream",
"os",
"=",
"new",
"ObjectOutp... | Writes a single object to a file.
@param file The <code>File</code> to write to.
@param object The <code>Object</code> to write.
@throws IOException If the file could not be written. | [
"Writes",
"a",
"single",
"object",
"to",
"a",
"file",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L161-L166 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/Record.java | Record.getPercentage | public Number getPercentage(int field) throws MPXJException
{
Number result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
try
{
result = m_formats.getPercentageDecimalFormat().parse(m_fields[field]);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse percentage", ex);
}
}
else
{
result = null;
}
return (result);
} | java | public Number getPercentage(int field) throws MPXJException
{
Number result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
try
{
result = m_formats.getPercentageDecimalFormat().parse(m_fields[field]);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse percentage", ex);
}
}
else
{
result = null;
}
return (result);
} | [
"public",
"Number",
"getPercentage",
"(",
"int",
"field",
")",
"throws",
"MPXJException",
"{",
"Number",
"result",
";",
"if",
"(",
"(",
"field",
"<",
"m_fields",
".",
"length",
")",
"&&",
"(",
"m_fields",
"[",
"field",
"]",
".",
"length",
"(",
")",
"!=... | Accessor method used to retrieve an Number instance 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
@throws MPXJException normally thrown when parsing fails | [
"Accessor",
"method",
"used",
"to",
"retrieve",
"an",
"Number",
"instance",
"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#L451-L473 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java | CommerceRegionPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceRegion commerceRegion : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceRegion);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceRegion commerceRegion : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceRegion);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CommerceRegion",
"commerceRegion",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUti... | Removes all the commerce regions where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"commerce",
"regions",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java#L1401-L1407 |
digipost/sdp-shared | api-commons/src/main/java/no/digipost/api/interceptors/Wss4jInterceptor.java | Wss4jInterceptor.updateContextWithResults | @SuppressWarnings("unchecked")
private void updateContextWithResults(final MessageContext messageContext, final WSHandlerResult result) {
List<WSHandlerResult> handlerResults;
if ((handlerResults = (List<WSHandlerResult>) messageContext.getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
handlerResults = new ArrayList<WSHandlerResult>();
messageContext.setProperty(WSHandlerConstants.RECV_RESULTS, handlerResults);
}
handlerResults.add(0, result);
messageContext.setProperty(WSHandlerConstants.RECV_RESULTS, handlerResults);
} | java | @SuppressWarnings("unchecked")
private void updateContextWithResults(final MessageContext messageContext, final WSHandlerResult result) {
List<WSHandlerResult> handlerResults;
if ((handlerResults = (List<WSHandlerResult>) messageContext.getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
handlerResults = new ArrayList<WSHandlerResult>();
messageContext.setProperty(WSHandlerConstants.RECV_RESULTS, handlerResults);
}
handlerResults.add(0, result);
messageContext.setProperty(WSHandlerConstants.RECV_RESULTS, handlerResults);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"updateContextWithResults",
"(",
"final",
"MessageContext",
"messageContext",
",",
"final",
"WSHandlerResult",
"result",
")",
"{",
"List",
"<",
"WSHandlerResult",
">",
"handlerResults",
";",
"if",
... | Puts the results of WS-Security headers processing in the message context. Some actions like Signature
Confirmation require this. | [
"Puts",
"the",
"results",
"of",
"WS",
"-",
"Security",
"headers",
"processing",
"in",
"the",
"message",
"context",
".",
"Some",
"actions",
"like",
"Signature",
"Confirmation",
"require",
"this",
"."
] | train | https://github.com/digipost/sdp-shared/blob/c34920a993b65ff0908dab9d9c92140ded7312bc/api-commons/src/main/java/no/digipost/api/interceptors/Wss4jInterceptor.java#L419-L428 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.createTempFile | public static File createTempFile(String prefix, String suffix, File dir, boolean isReCreat) throws IORuntimeException {
int exceptionsCount = 0;
while (true) {
try {
File file = File.createTempFile(prefix, suffix, dir).getCanonicalFile();
if (isReCreat) {
file.delete();
file.createNewFile();
}
return file;
} catch (IOException ioex) { // fixes java.io.WinNTFileSystem.createFileExclusively access denied
if (++exceptionsCount >= 50) {
throw new IORuntimeException(ioex);
}
}
}
} | java | public static File createTempFile(String prefix, String suffix, File dir, boolean isReCreat) throws IORuntimeException {
int exceptionsCount = 0;
while (true) {
try {
File file = File.createTempFile(prefix, suffix, dir).getCanonicalFile();
if (isReCreat) {
file.delete();
file.createNewFile();
}
return file;
} catch (IOException ioex) { // fixes java.io.WinNTFileSystem.createFileExclusively access denied
if (++exceptionsCount >= 50) {
throw new IORuntimeException(ioex);
}
}
}
} | [
"public",
"static",
"File",
"createTempFile",
"(",
"String",
"prefix",
",",
"String",
"suffix",
",",
"File",
"dir",
",",
"boolean",
"isReCreat",
")",
"throws",
"IORuntimeException",
"{",
"int",
"exceptionsCount",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{"... | 创建临时文件<br>
创建后的文件名为 prefix[Randon].suffix From com.jodd.io.FileUtil
@param prefix 前缀,至少3个字符
@param suffix 后缀,如果null则使用默认.tmp
@param dir 临时文件创建的所在目录
@param isReCreat 是否重新创建文件(删掉原来的,创建新的)
@return 临时文件
@throws IORuntimeException IO异常 | [
"创建临时文件<br",
">",
"创建后的文件名为",
"prefix",
"[",
"Randon",
"]",
".",
"suffix",
"From",
"com",
".",
"jodd",
".",
"io",
".",
"FileUtil"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L897-L913 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java | SVGUtil.setCSSClass | public static void setCSSClass(Element e, String cssclass) {
setAtt(e, SVGConstants.SVG_CLASS_ATTRIBUTE, cssclass);
} | java | public static void setCSSClass(Element e, String cssclass) {
setAtt(e, SVGConstants.SVG_CLASS_ATTRIBUTE, cssclass);
} | [
"public",
"static",
"void",
"setCSSClass",
"(",
"Element",
"e",
",",
"String",
"cssclass",
")",
"{",
"setAtt",
"(",
"e",
",",
"SVGConstants",
".",
"SVG_CLASS_ATTRIBUTE",
",",
"cssclass",
")",
";",
"}"
] | Set the CSS class of an Element. See also {@link #addCSSClass} and
{@link #removeCSSClass}.
@param e Element
@param cssclass class to set. | [
"Set",
"the",
"CSS",
"class",
"of",
"an",
"Element",
".",
"See",
"also",
"{",
"@link",
"#addCSSClass",
"}",
"and",
"{",
"@link",
"#removeCSSClass",
"}",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L337-L339 |
Azure/azure-sdk-for-java | resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceGroupsInner.java | ResourceGroupsInner.exportTemplateAsync | public Observable<ResourceGroupExportResultInner> exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) {
return exportTemplateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1<ServiceResponse<ResourceGroupExportResultInner>, ResourceGroupExportResultInner>() {
@Override
public ResourceGroupExportResultInner call(ServiceResponse<ResourceGroupExportResultInner> response) {
return response.body();
}
});
} | java | public Observable<ResourceGroupExportResultInner> exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) {
return exportTemplateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1<ServiceResponse<ResourceGroupExportResultInner>, ResourceGroupExportResultInner>() {
@Override
public ResourceGroupExportResultInner call(ServiceResponse<ResourceGroupExportResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ResourceGroupExportResultInner",
">",
"exportTemplateAsync",
"(",
"String",
"resourceGroupName",
",",
"ExportTemplateRequest",
"parameters",
")",
"{",
"return",
"exportTemplateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"parameters",
... | Captures the specified resource group as a template.
@param resourceGroupName The name of the resource group to export as a template.
@param parameters Parameters for exporting the template.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ResourceGroupExportResultInner object | [
"Captures",
"the",
"specified",
"resource",
"group",
"as",
"a",
"template",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceGroupsInner.java#L876-L883 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java | BigDecimalMath.cosh | public static BigDecimal cosh(BigDecimal x, MathContext mathContext) {
checkMathContext(mathContext);
MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode());
BigDecimal result = CoshCalculator.INSTANCE.calculate(x, mc);
return round(result, mathContext);
} | java | public static BigDecimal cosh(BigDecimal x, MathContext mathContext) {
checkMathContext(mathContext);
MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode());
BigDecimal result = CoshCalculator.INSTANCE.calculate(x, mc);
return round(result, mathContext);
} | [
"public",
"static",
"BigDecimal",
"cosh",
"(",
"BigDecimal",
"x",
",",
"MathContext",
"mathContext",
")",
"{",
"checkMathContext",
"(",
"mathContext",
")",
";",
"MathContext",
"mc",
"=",
"new",
"MathContext",
"(",
"mathContext",
".",
"getPrecision",
"(",
")",
... | Calculates the hyperbolic cosine of {@link BigDecimal} x.
<p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p>
@param x the {@link BigDecimal} to calculate the hyperbolic cosine for
@param mathContext the {@link MathContext} used for the result
@return the calculated hyperbolic cosine {@link BigDecimal} with the precision specified in the <code>mathContext</code>
@throws UnsupportedOperationException if the {@link MathContext} has unlimited precision | [
"Calculates",
"the",
"hyperbolic",
"cosine",
"of",
"{",
"@link",
"BigDecimal",
"}",
"x",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1550-L1555 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxItem.java | BoxItem.applyWatermark | protected BoxWatermark applyWatermark(URLTemplate itemUrl, String imprint) {
URL watermarkUrl = itemUrl.build(this.getAPI().getBaseURL(), this.getID());
URL url = WATERMARK_URL_TEMPLATE.build(watermarkUrl.toString());
BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "PUT");
JsonObject body = new JsonObject()
.add(BoxWatermark.WATERMARK_JSON_KEY, new JsonObject()
.add(BoxWatermark.WATERMARK_IMPRINT_JSON_KEY, imprint));
request.setBody(body.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new BoxWatermark(response.getJSON());
} | java | protected BoxWatermark applyWatermark(URLTemplate itemUrl, String imprint) {
URL watermarkUrl = itemUrl.build(this.getAPI().getBaseURL(), this.getID());
URL url = WATERMARK_URL_TEMPLATE.build(watermarkUrl.toString());
BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "PUT");
JsonObject body = new JsonObject()
.add(BoxWatermark.WATERMARK_JSON_KEY, new JsonObject()
.add(BoxWatermark.WATERMARK_IMPRINT_JSON_KEY, imprint));
request.setBody(body.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
return new BoxWatermark(response.getJSON());
} | [
"protected",
"BoxWatermark",
"applyWatermark",
"(",
"URLTemplate",
"itemUrl",
",",
"String",
"imprint",
")",
"{",
"URL",
"watermarkUrl",
"=",
"itemUrl",
".",
"build",
"(",
"this",
".",
"getAPI",
"(",
")",
".",
"getBaseURL",
"(",
")",
",",
"this",
".",
"get... | Used to apply or update the watermark for the item.
@param itemUrl url template for the item.
@param imprint the value must be "default", as custom watermarks is not yet supported.
@return the watermark associated with the item. | [
"Used",
"to",
"apply",
"or",
"update",
"the",
"watermark",
"for",
"the",
"item",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxItem.java#L105-L115 |
jamesagnew/hapi-fhir | hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/interceptor/AdditionalRequestHeadersInterceptor.java | AdditionalRequestHeadersInterceptor.addAllHeaderValues | public void addAllHeaderValues(String headerName, List<String> headerValues) {
Objects.requireNonNull(headerName, "headerName cannot be null");
Objects.requireNonNull(headerValues, "headerValues cannot be null");
getHeaderValues(headerName).addAll(headerValues);
} | java | public void addAllHeaderValues(String headerName, List<String> headerValues) {
Objects.requireNonNull(headerName, "headerName cannot be null");
Objects.requireNonNull(headerValues, "headerValues cannot be null");
getHeaderValues(headerName).addAll(headerValues);
} | [
"public",
"void",
"addAllHeaderValues",
"(",
"String",
"headerName",
",",
"List",
"<",
"String",
">",
"headerValues",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"headerName",
",",
"\"headerName cannot be null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"... | Adds the list of header values for the given header.
Note that {@code headerName} and {@code headerValues} cannot be null.
@param headerName the name of the header
@param headerValues the list of values to add for the header
@throws NullPointerException if either parameter is {@code null} | [
"Adds",
"the",
"list",
"of",
"header",
"values",
"for",
"the",
"given",
"header",
".",
"Note",
"that",
"{"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/interceptor/AdditionalRequestHeadersInterceptor.java#L72-L77 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.createOrUpdateSecuritySettings | public void createOrUpdateSecuritySettings(String deviceName, String resourceGroupName, AsymmetricEncryptedSecret deviceAdminPassword) {
createOrUpdateSecuritySettingsWithServiceResponseAsync(deviceName, resourceGroupName, deviceAdminPassword).toBlocking().last().body();
} | java | public void createOrUpdateSecuritySettings(String deviceName, String resourceGroupName, AsymmetricEncryptedSecret deviceAdminPassword) {
createOrUpdateSecuritySettingsWithServiceResponseAsync(deviceName, resourceGroupName, deviceAdminPassword).toBlocking().last().body();
} | [
"public",
"void",
"createOrUpdateSecuritySettings",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"AsymmetricEncryptedSecret",
"deviceAdminPassword",
")",
"{",
"createOrUpdateSecuritySettingsWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroup... | Updates the security settings on a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param deviceAdminPassword Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters.
@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 | [
"Updates",
"the",
"security",
"settings",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1837-L1839 |
cdk/cdk | tool/structgen/src/main/java/org/openscience/cdk/atomtype/StructGenMatcher.java | StructGenMatcher.findMatchingAtomType | @Override
public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom) throws CDKException {
if (factory == null) {
try {
factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/structgen_atomtypes.xml",
atom.getBuilder());
} catch (Exception ex1) {
logger.error(ex1.getMessage());
logger.debug(ex1);
throw new CDKException("Could not instantiate the AtomType list!", ex1);
}
}
double bondOrderSum = atomContainer.getBondOrderSum(atom);
IBond.Order maxBondOrder = atomContainer.getMaximumBondOrder(atom);
int charge = atom.getFormalCharge();
int hcount = atom.getImplicitHydrogenCount() == null ? 0 : atom.getImplicitHydrogenCount();
IAtomType[] types = factory.getAtomTypes(atom.getSymbol());
for (IAtomType type : types) {
logger.debug(" ... matching atom ", atom, " vs ", type);
if (bondOrderSum - charge + hcount == type.getBondOrderSum()
&& !BondManipulator.isHigherOrder(maxBondOrder, type.getMaxBondOrder())) {
return type;
}
}
logger.debug(" No Match");
return null;
} | java | @Override
public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom) throws CDKException {
if (factory == null) {
try {
factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/structgen_atomtypes.xml",
atom.getBuilder());
} catch (Exception ex1) {
logger.error(ex1.getMessage());
logger.debug(ex1);
throw new CDKException("Could not instantiate the AtomType list!", ex1);
}
}
double bondOrderSum = atomContainer.getBondOrderSum(atom);
IBond.Order maxBondOrder = atomContainer.getMaximumBondOrder(atom);
int charge = atom.getFormalCharge();
int hcount = atom.getImplicitHydrogenCount() == null ? 0 : atom.getImplicitHydrogenCount();
IAtomType[] types = factory.getAtomTypes(atom.getSymbol());
for (IAtomType type : types) {
logger.debug(" ... matching atom ", atom, " vs ", type);
if (bondOrderSum - charge + hcount == type.getBondOrderSum()
&& !BondManipulator.isHigherOrder(maxBondOrder, type.getMaxBondOrder())) {
return type;
}
}
logger.debug(" No Match");
return null;
} | [
"@",
"Override",
"public",
"IAtomType",
"findMatchingAtomType",
"(",
"IAtomContainer",
"atomContainer",
",",
"IAtom",
"atom",
")",
"throws",
"CDKException",
"{",
"if",
"(",
"factory",
"==",
"null",
")",
"{",
"try",
"{",
"factory",
"=",
"AtomTypeFactory",
".",
... | Finds the AtomType matching the Atom's element symbol, formal charge and
hybridization state.
@param atomContainer AtomContainer
@param atom the target atom
@exception CDKException Exception thrown if something goes wrong
@return the matching AtomType | [
"Finds",
"the",
"AtomType",
"matching",
"the",
"Atom",
"s",
"element",
"symbol",
"formal",
"charge",
"and",
"hybridization",
"state",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/structgen/src/main/java/org/openscience/cdk/atomtype/StructGenMatcher.java#L74-L103 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/HpelHelper.java | HpelHelper.getHeaderAsProperties | public static Properties getHeaderAsProperties() {
Properties result = new Properties();
if (customProps != null) {
result.putAll(customProps);
}
result.put(ServerInstanceLogRecordList.HEADER_PROCESSID, processId);
result.put(ServerInstanceLogRecordList.HEADER_SERVER_TIMEZONE, TimeZone.getDefault().getID());
result.put(ServerInstanceLogRecordList.HEADER_SERVER_LOCALE_LANGUAGE, Locale.getDefault().getLanguage());
result.put(ServerInstanceLogRecordList.HEADER_SERVER_LOCALE_COUNTRY, Locale.getDefault().getCountry());
addSystemPropertyIfPresent(result, "java.fullversion");
addSystemPropertyIfPresent(result, "java.version");
addSystemPropertyIfPresent(result, "os.name");
addSystemPropertyIfPresent(result, "os.version");
addSystemPropertyIfPresent(result, "java.compiler");
addSystemPropertyIfPresent(result, "java.vm.name");
// addSystemPropertyIfPresent(result, "was.install.root"); // WAS specific
// addSystemPropertyIfPresent(result, "user.install.root"); // WAS specific
addSystemPropertyIfPresent(result, "java.home");
// addSystemPropertyIfPresent(result, "ws.ext.dirs"); // WAS specific
addSystemPropertyIfPresent(result, "java.class.path");
addSystemPropertyIfPresent(result, "java.library.path");
// Add property to know if server is configured to convert depricated
// messages or not.
// addSystemPropertyIfPresent(result, "com.ibm.websphere.logging.messageId.version");// WAS specific
// Add CBE related values
addSystemPropertyIfPresent(result, "os.arch");
// try {
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_HOSTNAME,
// getHostName());
// } catch (Throwable t) {
// // Ignore just don't put anything.
// }
addIfPresent(result, ServerInstanceLogRecordList.HEADER_ISZOS, isZOS ? "Y" : null);
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_ISSERVER,
// RasHelper.isServer() ? "Y" : null);
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_ISTHINCLIENT,
// ManagerAdmin.isThinClient() ? "Y" : null);
// if (isZos) {
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_PROCESSNAME,
// ZRasHelper.ProcessInfo.getPId());
// addIfPresent(result,
// ServerInstanceLogRecordList.HEADER_ADDRESSSPACEID,
// ZRasHelper.ProcessInfo.getAddressSpaceId());
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_JOBNAME,
// ZRasHelper.ProcessInfo.getJobName());
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_SERVER_NAME,
// ZRasHelper.ProcessInfo.getServer());
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_JOBID,
// ZRasHelper.ProcessInfo.getSystemJobId());
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_SYSTEMNAME,
// ZRasHelper.ProcessInfo.getSystemName());
// }
return result;
} | java | public static Properties getHeaderAsProperties() {
Properties result = new Properties();
if (customProps != null) {
result.putAll(customProps);
}
result.put(ServerInstanceLogRecordList.HEADER_PROCESSID, processId);
result.put(ServerInstanceLogRecordList.HEADER_SERVER_TIMEZONE, TimeZone.getDefault().getID());
result.put(ServerInstanceLogRecordList.HEADER_SERVER_LOCALE_LANGUAGE, Locale.getDefault().getLanguage());
result.put(ServerInstanceLogRecordList.HEADER_SERVER_LOCALE_COUNTRY, Locale.getDefault().getCountry());
addSystemPropertyIfPresent(result, "java.fullversion");
addSystemPropertyIfPresent(result, "java.version");
addSystemPropertyIfPresent(result, "os.name");
addSystemPropertyIfPresent(result, "os.version");
addSystemPropertyIfPresent(result, "java.compiler");
addSystemPropertyIfPresent(result, "java.vm.name");
// addSystemPropertyIfPresent(result, "was.install.root"); // WAS specific
// addSystemPropertyIfPresent(result, "user.install.root"); // WAS specific
addSystemPropertyIfPresent(result, "java.home");
// addSystemPropertyIfPresent(result, "ws.ext.dirs"); // WAS specific
addSystemPropertyIfPresent(result, "java.class.path");
addSystemPropertyIfPresent(result, "java.library.path");
// Add property to know if server is configured to convert depricated
// messages or not.
// addSystemPropertyIfPresent(result, "com.ibm.websphere.logging.messageId.version");// WAS specific
// Add CBE related values
addSystemPropertyIfPresent(result, "os.arch");
// try {
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_HOSTNAME,
// getHostName());
// } catch (Throwable t) {
// // Ignore just don't put anything.
// }
addIfPresent(result, ServerInstanceLogRecordList.HEADER_ISZOS, isZOS ? "Y" : null);
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_ISSERVER,
// RasHelper.isServer() ? "Y" : null);
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_ISTHINCLIENT,
// ManagerAdmin.isThinClient() ? "Y" : null);
// if (isZos) {
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_PROCESSNAME,
// ZRasHelper.ProcessInfo.getPId());
// addIfPresent(result,
// ServerInstanceLogRecordList.HEADER_ADDRESSSPACEID,
// ZRasHelper.ProcessInfo.getAddressSpaceId());
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_JOBNAME,
// ZRasHelper.ProcessInfo.getJobName());
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_SERVER_NAME,
// ZRasHelper.ProcessInfo.getServer());
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_JOBID,
// ZRasHelper.ProcessInfo.getSystemJobId());
// addIfPresent(result, ServerInstanceLogRecordList.HEADER_SYSTEMNAME,
// ZRasHelper.ProcessInfo.getSystemName());
// }
return result;
} | [
"public",
"static",
"Properties",
"getHeaderAsProperties",
"(",
")",
"{",
"Properties",
"result",
"=",
"new",
"Properties",
"(",
")",
";",
"if",
"(",
"customProps",
"!=",
"null",
")",
"{",
"result",
".",
"putAll",
"(",
"customProps",
")",
";",
"}",
"result... | Gets Header information as a Propeties instance.
@return new Properties instance filled with necessary information. | [
"Gets",
"Header",
"information",
"as",
"a",
"Propeties",
"instance",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/HpelHelper.java#L107-L165 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateResourceAssignmentWorkgroupFields | private void populateResourceAssignmentWorkgroupFields(Record record, ResourceAssignmentWorkgroupFields workgroup) throws MPXJException
{
workgroup.setMessageUniqueID(record.getString(0));
workgroup.setConfirmed(NumberHelper.getInt(record.getInteger(1)) == 1);
workgroup.setResponsePending(NumberHelper.getInt(record.getInteger(1)) == 1);
workgroup.setUpdateStart(record.getDateTime(3));
workgroup.setUpdateFinish(record.getDateTime(4));
workgroup.setScheduleID(record.getString(5));
} | java | private void populateResourceAssignmentWorkgroupFields(Record record, ResourceAssignmentWorkgroupFields workgroup) throws MPXJException
{
workgroup.setMessageUniqueID(record.getString(0));
workgroup.setConfirmed(NumberHelper.getInt(record.getInteger(1)) == 1);
workgroup.setResponsePending(NumberHelper.getInt(record.getInteger(1)) == 1);
workgroup.setUpdateStart(record.getDateTime(3));
workgroup.setUpdateFinish(record.getDateTime(4));
workgroup.setScheduleID(record.getString(5));
} | [
"private",
"void",
"populateResourceAssignmentWorkgroupFields",
"(",
"Record",
"record",
",",
"ResourceAssignmentWorkgroupFields",
"workgroup",
")",
"throws",
"MPXJException",
"{",
"workgroup",
".",
"setMessageUniqueID",
"(",
"record",
".",
"getString",
"(",
"0",
")",
"... | Populate a resource assignment workgroup instance.
@param record MPX record
@param workgroup workgroup instance
@throws MPXJException | [
"Populate",
"a",
"resource",
"assignment",
"workgroup",
"instance",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L1458-L1466 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getRequiredString | public String getRequiredString(String name) {
String value = getString(name, null);
if (value != null) {
return value.trim();
}
throw new PippoRuntimeException("Setting '{}' has not been configured!", name);
} | java | public String getRequiredString(String name) {
String value = getString(name, null);
if (value != null) {
return value.trim();
}
throw new PippoRuntimeException("Setting '{}' has not been configured!", name);
} | [
"public",
"String",
"getRequiredString",
"(",
"String",
"name",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
".",
"trim",
"(",
")",
";",
"}",
"throw"... | Returns the string value for the specified name. If the name does not
exist an exception is thrown.
@param name
@return name value | [
"Returns",
"the",
"string",
"value",
"for",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"does",
"not",
"exist",
"an",
"exception",
"is",
"thrown",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L603-L609 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.createRelation | private void createRelation(String resourceName, String targetPath, String relationType, boolean importCase)
throws CmsException {
CmsResource resource = readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION);
CmsResource target = readResource(targetPath, CmsResourceFilter.IGNORE_EXPIRATION);
createRelation(resource, target, relationType, importCase);
} | java | private void createRelation(String resourceName, String targetPath, String relationType, boolean importCase)
throws CmsException {
CmsResource resource = readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION);
CmsResource target = readResource(targetPath, CmsResourceFilter.IGNORE_EXPIRATION);
createRelation(resource, target, relationType, importCase);
} | [
"private",
"void",
"createRelation",
"(",
"String",
"resourceName",
",",
"String",
"targetPath",
",",
"String",
"relationType",
",",
"boolean",
"importCase",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"readResource",
"(",
"resourceName",
","... | Adds a new relation to the given resource.<p>
@param resourceName the name of the source resource
@param targetPath the path of the target resource
@param relationType the type of the relation
@param importCase if importing relations
@throws CmsException if something goes wrong | [
"Adds",
"a",
"new",
"relation",
"to",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L4239-L4245 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProject.java | FrameworkProject.createFileStructure | public static void createFileStructure(final File projectDir) throws IOException {
/*
* create an empty project file structure
*/
if (! projectDir.exists() && ! projectDir.mkdirs()) {
throw new IOException("failed creating project base dir: " + projectDir.getAbsolutePath());
}
/**
* Create project etc directory for configuration data
*/
final File etcDir = new File(projectDir, FrameworkProject.ETC_DIR_NAME);
if (! etcDir.exists() && ! etcDir.mkdirs()) {
throw new IOException("failed creating project etc dir: " + etcDir.getAbsolutePath());
}
} | java | public static void createFileStructure(final File projectDir) throws IOException {
/*
* create an empty project file structure
*/
if (! projectDir.exists() && ! projectDir.mkdirs()) {
throw new IOException("failed creating project base dir: " + projectDir.getAbsolutePath());
}
/**
* Create project etc directory for configuration data
*/
final File etcDir = new File(projectDir, FrameworkProject.ETC_DIR_NAME);
if (! etcDir.exists() && ! etcDir.mkdirs()) {
throw new IOException("failed creating project etc dir: " + etcDir.getAbsolutePath());
}
} | [
"public",
"static",
"void",
"createFileStructure",
"(",
"final",
"File",
"projectDir",
")",
"throws",
"IOException",
"{",
"/*\n * create an empty project file structure\n */",
"if",
"(",
"!",
"projectDir",
".",
"exists",
"(",
")",
"&&",
"!",
"projectDir",
... | Creates the file structure for a project
@param projectDir The project base directory
@throws IOException on io error | [
"Creates",
"the",
"file",
"structure",
"for",
"a",
"project"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProject.java#L309-L324 |
Azure/azure-sdk-for-java | common/azure-common/src/main/java/com/azure/common/implementation/SwaggerInterfaceParser.java | SwaggerInterfaceParser.methodParser | public SwaggerMethodParser methodParser(Method swaggerMethod) {
SwaggerMethodParser result = methodParsers.get(swaggerMethod);
if (result == null) {
result = new SwaggerMethodParser(swaggerMethod, serializer, host());
methodParsers.put(swaggerMethod, result);
}
return result;
} | java | public SwaggerMethodParser methodParser(Method swaggerMethod) {
SwaggerMethodParser result = methodParsers.get(swaggerMethod);
if (result == null) {
result = new SwaggerMethodParser(swaggerMethod, serializer, host());
methodParsers.put(swaggerMethod, result);
}
return result;
} | [
"public",
"SwaggerMethodParser",
"methodParser",
"(",
"Method",
"swaggerMethod",
")",
"{",
"SwaggerMethodParser",
"result",
"=",
"methodParsers",
".",
"get",
"(",
"swaggerMethod",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"Sw... | Get the method parser that is associated with the provided swaggerMethod. The method parser
can be used to get details about the Swagger REST API call.
@param swaggerMethod the method to generate a parser for
@return the SwaggerMethodParser associated with the provided swaggerMethod | [
"Get",
"the",
"method",
"parser",
"that",
"is",
"associated",
"with",
"the",
"provided",
"swaggerMethod",
".",
"The",
"method",
"parser",
"can",
"be",
"used",
"to",
"get",
"details",
"about",
"the",
"Swagger",
"REST",
"API",
"call",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/SwaggerInterfaceParser.java#L62-L69 |
knowm/XChart | xchart/src/main/java/org/knowm/xchart/PieChart.java | PieChart.addSeries | public PieSeries addSeries(String seriesName, Number value) {
PieSeries series = new PieSeries(seriesName, value);
if (seriesMap.keySet().contains(seriesName)) {
throw new IllegalArgumentException(
"Series name >"
+ seriesName
+ "< has already been used. Use unique names for each series!!!");
}
seriesMap.put(seriesName, series);
return series;
} | java | public PieSeries addSeries(String seriesName, Number value) {
PieSeries series = new PieSeries(seriesName, value);
if (seriesMap.keySet().contains(seriesName)) {
throw new IllegalArgumentException(
"Series name >"
+ seriesName
+ "< has already been used. Use unique names for each series!!!");
}
seriesMap.put(seriesName, series);
return series;
} | [
"public",
"PieSeries",
"addSeries",
"(",
"String",
"seriesName",
",",
"Number",
"value",
")",
"{",
"PieSeries",
"series",
"=",
"new",
"PieSeries",
"(",
"seriesName",
",",
"value",
")",
";",
"if",
"(",
"seriesMap",
".",
"keySet",
"(",
")",
".",
"contains",
... | Add a series for a Pie type chart
@param seriesName
@param value
@return | [
"Add",
"a",
"series",
"for",
"a",
"Pie",
"type",
"chart"
] | train | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/PieChart.java#L74-L87 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java | ByteArrayUtil.writeFloat | public static int writeFloat(byte[] array, int offset, float v) {
return writeInt(array, offset, Float.floatToIntBits(v));
} | java | public static int writeFloat(byte[] array, int offset, float v) {
return writeInt(array, offset, Float.floatToIntBits(v));
} | [
"public",
"static",
"int",
"writeFloat",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"float",
"v",
")",
"{",
"return",
"writeInt",
"(",
"array",
",",
"offset",
",",
"Float",
".",
"floatToIntBits",
"(",
"v",
")",
")",
";",
"}"
] | Write a float to the byte array at the given offset.
@param array Array to write to
@param offset Offset to write to
@param v data
@return number of bytes written | [
"Write",
"a",
"float",
"to",
"the",
"byte",
"array",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java#L156-L158 |
UrielCh/ovh-java-sdk | ovh-java-sdk-clusterhadoop/src/main/java/net/minidev/ovh/api/ApiOvhClusterhadoop.java | ApiOvhClusterhadoop.serviceName_node_GET | public ArrayList<String> serviceName_node_GET(String serviceName, OvhNodeProfileEnum softwareProfile) throws IOException {
String qPath = "/cluster/hadoop/{serviceName}/node";
StringBuilder sb = path(qPath, serviceName);
query(sb, "softwareProfile", softwareProfile);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> serviceName_node_GET(String serviceName, OvhNodeProfileEnum softwareProfile) throws IOException {
String qPath = "/cluster/hadoop/{serviceName}/node";
StringBuilder sb = path(qPath, serviceName);
query(sb, "softwareProfile", softwareProfile);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"serviceName_node_GET",
"(",
"String",
"serviceName",
",",
"OvhNodeProfileEnum",
"softwareProfile",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cluster/hadoop/{serviceName}/node\"",
";",
"StringBuilder",
"sb",
... | Nodes of the Cluster
REST: GET /cluster/hadoop/{serviceName}/node
@param softwareProfile [required] Filter the value of softwareProfile property (=)
@param serviceName [required] The internal name of your cluster | [
"Nodes",
"of",
"the",
"Cluster"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-clusterhadoop/src/main/java/net/minidev/ovh/api/ApiOvhClusterhadoop.java#L392-L398 |
Impetus/Kundera | src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/util/KunderaPropertyBuilder.java | KunderaPropertyBuilder.getKunderaClientToLookupClass | private static String getKunderaClientToLookupClass(String client)
{
Datasource datasource;
try
{
datasource = Datasource.valueOf(client.toUpperCase());
}
catch (IllegalArgumentException ex)
{
LOGGER.error(client + " is not supported!", ex);
throw new KunderaException(client + " is not supported!", ex);
}
return clientNameToFactoryMap.get(datasource);
} | java | private static String getKunderaClientToLookupClass(String client)
{
Datasource datasource;
try
{
datasource = Datasource.valueOf(client.toUpperCase());
}
catch (IllegalArgumentException ex)
{
LOGGER.error(client + " is not supported!", ex);
throw new KunderaException(client + " is not supported!", ex);
}
return clientNameToFactoryMap.get(datasource);
} | [
"private",
"static",
"String",
"getKunderaClientToLookupClass",
"(",
"String",
"client",
")",
"{",
"Datasource",
"datasource",
";",
"try",
"{",
"datasource",
"=",
"Datasource",
".",
"valueOf",
"(",
"client",
".",
"toUpperCase",
"(",
")",
")",
";",
"}",
"catch"... | Gets the kundera client to lookup class.
@param client
the client
@return the kundera client to lookup class | [
"Gets",
"the",
"kundera",
"client",
"to",
"lookup",
"class",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/util/KunderaPropertyBuilder.java#L170-L185 |
cache2k/cache2k | cache2k-core/src/main/java/org/cache2k/core/WiredCache.java | WiredCache.onEvictionFromHeap | @Override
public void onEvictionFromHeap(final Entry<K, V> e) {
CacheEntry<K,V> _currentEntry = heapCache.returnCacheEntry(e);
if (syncEntryEvictedListeners != null) {
for (CacheEntryEvictedListener<K, V> l : syncEntryEvictedListeners) {
l.onEntryEvicted(this, _currentEntry);
}
}
} | java | @Override
public void onEvictionFromHeap(final Entry<K, V> e) {
CacheEntry<K,V> _currentEntry = heapCache.returnCacheEntry(e);
if (syncEntryEvictedListeners != null) {
for (CacheEntryEvictedListener<K, V> l : syncEntryEvictedListeners) {
l.onEntryEvicted(this, _currentEntry);
}
}
} | [
"@",
"Override",
"public",
"void",
"onEvictionFromHeap",
"(",
"final",
"Entry",
"<",
"K",
",",
"V",
">",
"e",
")",
"{",
"CacheEntry",
"<",
"K",
",",
"V",
">",
"_currentEntry",
"=",
"heapCache",
".",
"returnCacheEntry",
"(",
"e",
")",
";",
"if",
"(",
... | Nothing done here. Will notify the storage about eviction in some future version. | [
"Nothing",
"done",
"here",
".",
"Will",
"notify",
"the",
"storage",
"about",
"eviction",
"in",
"some",
"future",
"version",
"."
] | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/WiredCache.java#L667-L675 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_tcp_route_routeId_GET | public OvhRouteTcp serviceName_tcp_route_routeId_GET(String serviceName, Long routeId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}";
StringBuilder sb = path(qPath, serviceName, routeId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRouteTcp.class);
} | java | public OvhRouteTcp serviceName_tcp_route_routeId_GET(String serviceName, Long routeId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}";
StringBuilder sb = path(qPath, serviceName, routeId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRouteTcp.class);
} | [
"public",
"OvhRouteTcp",
"serviceName_tcp_route_routeId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"routeId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/tcp/route/{routeId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
... | Get this object properties
REST: GET /ipLoadbalancing/{serviceName}/tcp/route/{routeId}
@param serviceName [required] The internal name of your IP load balancing
@param routeId [required] Id of your route | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1306-L1311 |
Bearded-Hen/Android-Bootstrap | AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java | AwesomeTextView.startRotate | public void startRotate(boolean clockwise, AnimationSpeed speed) {
Animation rotate;
//set up the rotation animation
if (clockwise) {
rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
}
else {
rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
}
//set up some extra variables
rotate.setRepeatCount(Animation.INFINITE);
rotate.setInterpolator(new LinearInterpolator());
rotate.setStartOffset(0);
rotate.setRepeatMode(Animation.RESTART);
rotate.setDuration(speed.getRotateDuration());
startAnimation(rotate);
} | java | public void startRotate(boolean clockwise, AnimationSpeed speed) {
Animation rotate;
//set up the rotation animation
if (clockwise) {
rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
}
else {
rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
}
//set up some extra variables
rotate.setRepeatCount(Animation.INFINITE);
rotate.setInterpolator(new LinearInterpolator());
rotate.setStartOffset(0);
rotate.setRepeatMode(Animation.RESTART);
rotate.setDuration(speed.getRotateDuration());
startAnimation(rotate);
} | [
"public",
"void",
"startRotate",
"(",
"boolean",
"clockwise",
",",
"AnimationSpeed",
"speed",
")",
"{",
"Animation",
"rotate",
";",
"//set up the rotation animation",
"if",
"(",
"clockwise",
")",
"{",
"rotate",
"=",
"new",
"RotateAnimation",
"(",
"0",
",",
"360"... | Starts a rotating animation on the AwesomeTextView
@param clockwise true for clockwise, false for anti clockwise spinning
@param speed how fast the item should rotate | [
"Starts",
"a",
"rotating",
"animation",
"on",
"the",
"AwesomeTextView"
] | train | https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java#L186-L204 |
twitter/hraven | hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserHadoop2.java | JobHistoryFileParserHadoop2.processCounters | private void processCounters(Put p, JSONObject eventDetails, String key) {
try {
JSONObject jsonCounters = eventDetails.getJSONObject(key);
String counterMetaGroupName = jsonCounters.getString(NAME);
JSONArray groups = jsonCounters.getJSONArray(GROUPS);
for (int i = 0; i < groups.length(); i++) {
JSONObject aCounter = groups.getJSONObject(i);
JSONArray counts = aCounter.getJSONArray(COUNTS);
for (int j = 0; j < counts.length(); j++) {
JSONObject countDetails = counts.getJSONObject(j);
populatePut(p, Constants.INFO_FAM_BYTES, counterMetaGroupName, aCounter.get(NAME)
.toString(), countDetails.get(NAME).toString(), countDetails.getLong(VALUE));
}
}
} catch (JSONException e) {
throw new ProcessingException(" Caught json exception while processing counters ", e);
}
} | java | private void processCounters(Put p, JSONObject eventDetails, String key) {
try {
JSONObject jsonCounters = eventDetails.getJSONObject(key);
String counterMetaGroupName = jsonCounters.getString(NAME);
JSONArray groups = jsonCounters.getJSONArray(GROUPS);
for (int i = 0; i < groups.length(); i++) {
JSONObject aCounter = groups.getJSONObject(i);
JSONArray counts = aCounter.getJSONArray(COUNTS);
for (int j = 0; j < counts.length(); j++) {
JSONObject countDetails = counts.getJSONObject(j);
populatePut(p, Constants.INFO_FAM_BYTES, counterMetaGroupName, aCounter.get(NAME)
.toString(), countDetails.get(NAME).toString(), countDetails.getLong(VALUE));
}
}
} catch (JSONException e) {
throw new ProcessingException(" Caught json exception while processing counters ", e);
}
} | [
"private",
"void",
"processCounters",
"(",
"Put",
"p",
",",
"JSONObject",
"eventDetails",
",",
"String",
"key",
")",
"{",
"try",
"{",
"JSONObject",
"jsonCounters",
"=",
"eventDetails",
".",
"getJSONObject",
"(",
"key",
")",
";",
"String",
"counterMetaGroupName",... | process the counter details example line in .jhist file for counters: { "name":"MAP_COUNTERS",
"groups":[ { "name":"org.apache.hadoop.mapreduce.FileSystemCounter",
"displayName":"File System Counters", "counts":[ { "name":"HDFS_BYTES_READ",
"displayName":"HDFS: Number of bytes read", "value":480 }, { "name":"HDFS_BYTES_WRITTEN",
"displayName":"HDFS: Number of bytes written", "value":0 } ] }, {
"name":"org.apache.hadoop.mapreduce.TaskCounter", "displayName":"Map-Reduce Framework",
"counts":[ { "name":"MAP_INPUT_RECORDS", "displayName":"Map input records", "value":10 }, {
"name":"MAP_OUTPUT_RECORDS", "displayName":"Map output records", "value":10 } ] } ] } | [
"process",
"the",
"counter",
"details",
"example",
"line",
"in",
".",
"jhist",
"file",
"for",
"counters",
":",
"{",
"name",
":",
"MAP_COUNTERS",
"groups",
":",
"[",
"{",
"name",
":",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapreduce",
".",
"FileSystem... | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserHadoop2.java#L390-L409 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/dataset/DatasetUtils.java | DatasetUtils.getDatasetSpecificProps | public static Map<String, State> getDatasetSpecificProps(Iterable<String> datasets, State state) {
if (!Strings.isNullOrEmpty(state.getProp(DATASET_SPECIFIC_PROPS))
|| !Strings.isNullOrEmpty(state.getProp(KAFKA_TOPIC_SPECIFIC_STATE))) {
Map<String, State> datasetSpecificConfigMap = Maps.newHashMap();
JsonArray array = !Strings.isNullOrEmpty(state.getProp(DATASET_SPECIFIC_PROPS))
? state.getPropAsJsonArray(DATASET_SPECIFIC_PROPS) : state.getPropAsJsonArray(KAFKA_TOPIC_SPECIFIC_STATE);
// Iterate over the entire JsonArray specified by the config key
for (JsonElement datasetElement : array) {
// Check that each entry in the JsonArray is a JsonObject
Preconditions.checkArgument(datasetElement.isJsonObject(),
"The value for property " + DATASET_SPECIFIC_PROPS + " is malformed");
JsonObject object = datasetElement.getAsJsonObject();
// Only process JsonObjects that have a dataset identifier
if (object.has(DATASET)) {
JsonElement datasetNameElement = object.get(DATASET);
Preconditions.checkArgument(datasetNameElement.isJsonPrimitive(), "The value for property "
+ DATASET_SPECIFIC_PROPS + " is malformed, the " + DATASET + " field must be a string");
// Iterate through each dataset that matches the value of the JsonObjects DATASET field
for (String dataset : Iterables.filter(datasets, new DatasetPredicate(datasetNameElement.getAsString()))) {
// If an entry already exists for a dataset, add it to the current state, else create a new state
if (datasetSpecificConfigMap.containsKey(dataset)) {
datasetSpecificConfigMap.get(dataset).addAll(StateUtils.jsonObjectToState(object, DATASET));
} else {
datasetSpecificConfigMap.put(dataset, StateUtils.jsonObjectToState(object, DATASET));
}
}
} else {
LOG.warn("Skipping JsonElement " + datasetElement + " as it is does not contain a field with key " + DATASET);
}
}
return datasetSpecificConfigMap;
}
return Maps.newHashMap();
} | java | public static Map<String, State> getDatasetSpecificProps(Iterable<String> datasets, State state) {
if (!Strings.isNullOrEmpty(state.getProp(DATASET_SPECIFIC_PROPS))
|| !Strings.isNullOrEmpty(state.getProp(KAFKA_TOPIC_SPECIFIC_STATE))) {
Map<String, State> datasetSpecificConfigMap = Maps.newHashMap();
JsonArray array = !Strings.isNullOrEmpty(state.getProp(DATASET_SPECIFIC_PROPS))
? state.getPropAsJsonArray(DATASET_SPECIFIC_PROPS) : state.getPropAsJsonArray(KAFKA_TOPIC_SPECIFIC_STATE);
// Iterate over the entire JsonArray specified by the config key
for (JsonElement datasetElement : array) {
// Check that each entry in the JsonArray is a JsonObject
Preconditions.checkArgument(datasetElement.isJsonObject(),
"The value for property " + DATASET_SPECIFIC_PROPS + " is malformed");
JsonObject object = datasetElement.getAsJsonObject();
// Only process JsonObjects that have a dataset identifier
if (object.has(DATASET)) {
JsonElement datasetNameElement = object.get(DATASET);
Preconditions.checkArgument(datasetNameElement.isJsonPrimitive(), "The value for property "
+ DATASET_SPECIFIC_PROPS + " is malformed, the " + DATASET + " field must be a string");
// Iterate through each dataset that matches the value of the JsonObjects DATASET field
for (String dataset : Iterables.filter(datasets, new DatasetPredicate(datasetNameElement.getAsString()))) {
// If an entry already exists for a dataset, add it to the current state, else create a new state
if (datasetSpecificConfigMap.containsKey(dataset)) {
datasetSpecificConfigMap.get(dataset).addAll(StateUtils.jsonObjectToState(object, DATASET));
} else {
datasetSpecificConfigMap.put(dataset, StateUtils.jsonObjectToState(object, DATASET));
}
}
} else {
LOG.warn("Skipping JsonElement " + datasetElement + " as it is does not contain a field with key " + DATASET);
}
}
return datasetSpecificConfigMap;
}
return Maps.newHashMap();
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"State",
">",
"getDatasetSpecificProps",
"(",
"Iterable",
"<",
"String",
">",
"datasets",
",",
"State",
"state",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"state",
".",
"getProp",
"(",
... | Given a {@link Iterable} of dataset identifiers (e.g., name, URN, etc.), return a {@link Map} that links each
dataset with the extra configuration information specified in the state via {@link #DATASET_SPECIFIC_PROPS}. | [
"Given",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/dataset/DatasetUtils.java#L76-L115 |
primefaces/primefaces | src/main/java/org/primefaces/util/TreeUtils.java | TreeUtils.sortNode | public static void sortNode(TreeNode node, Comparator comparator) {
TreeNodeList children = (TreeNodeList) node.getChildren();
if (children != null && !children.isEmpty()) {
Object[] childrenArray = children.toArray();
Arrays.sort(childrenArray, comparator);
for (int i = 0; i < childrenArray.length; i++) {
children.setSibling(i, (TreeNode) childrenArray[i]);
}
for (int i = 0; i < children.size(); i++) {
sortNode(children.get(i), comparator);
}
}
} | java | public static void sortNode(TreeNode node, Comparator comparator) {
TreeNodeList children = (TreeNodeList) node.getChildren();
if (children != null && !children.isEmpty()) {
Object[] childrenArray = children.toArray();
Arrays.sort(childrenArray, comparator);
for (int i = 0; i < childrenArray.length; i++) {
children.setSibling(i, (TreeNode) childrenArray[i]);
}
for (int i = 0; i < children.size(); i++) {
sortNode(children.get(i), comparator);
}
}
} | [
"public",
"static",
"void",
"sortNode",
"(",
"TreeNode",
"node",
",",
"Comparator",
"comparator",
")",
"{",
"TreeNodeList",
"children",
"=",
"(",
"TreeNodeList",
")",
"node",
".",
"getChildren",
"(",
")",
";",
"if",
"(",
"children",
"!=",
"null",
"&&",
"!"... | Sorts children of a node using a comparator
@param node Node instance whose children to be sorted
@param comparator Comparator to use in sorting | [
"Sorts",
"children",
"of",
"a",
"node",
"using",
"a",
"comparator"
] | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/TreeUtils.java#L45-L59 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java | ProxiedFileSystemCache.getProxiedFileSystemUsingKeytab | @Deprecated
public static FileSystem getProxiedFileSystemUsingKeytab(State state, URI fsURI, Configuration conf)
throws ExecutionException {
Preconditions.checkArgument(state.contains(ConfigurationKeys.FS_PROXY_AS_USER_NAME));
Preconditions.checkArgument(state.contains(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS));
Preconditions.checkArgument(state.contains(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION));
return getProxiedFileSystemUsingKeytab(state.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME),
state.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS),
new Path(state.getProp(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION)), fsURI, conf);
} | java | @Deprecated
public static FileSystem getProxiedFileSystemUsingKeytab(State state, URI fsURI, Configuration conf)
throws ExecutionException {
Preconditions.checkArgument(state.contains(ConfigurationKeys.FS_PROXY_AS_USER_NAME));
Preconditions.checkArgument(state.contains(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS));
Preconditions.checkArgument(state.contains(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION));
return getProxiedFileSystemUsingKeytab(state.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME),
state.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS),
new Path(state.getProp(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION)), fsURI, conf);
} | [
"@",
"Deprecated",
"public",
"static",
"FileSystem",
"getProxiedFileSystemUsingKeytab",
"(",
"State",
"state",
",",
"URI",
"fsURI",
",",
"Configuration",
"conf",
")",
"throws",
"ExecutionException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"state",
".",
"con... | Cached version of {@link ProxiedFileSystemUtils#createProxiedFileSystemUsingKeytab(State, URI, Configuration)}.
@deprecated use {@link #fromKeytab}. | [
"Cached",
"version",
"of",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java#L146-L156 |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java | AbsSetting.getDouble | public Double getDouble(String key, String group, Double defaultValue) {
return Convert.toDouble(getByGroup(key, group), defaultValue);
} | java | public Double getDouble(String key, String group, Double defaultValue) {
return Convert.toDouble(getByGroup(key, group), defaultValue);
} | [
"public",
"Double",
"getDouble",
"(",
"String",
"key",
",",
"String",
"group",
",",
"Double",
"defaultValue",
")",
"{",
"return",
"Convert",
".",
"toDouble",
"(",
"getByGroup",
"(",
"key",
",",
"group",
")",
",",
"defaultValue",
")",
";",
"}"
] | 获取double类型属性值
@param key 属性名
@param group 分组名
@param defaultValue 默认值
@return 属性值 | [
"获取double类型属性值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L252-L254 |
ggrandes/kvstore | src/main/java/org/javastack/kvstore/structures/btree/BplusTree.java | BplusTree.lowerEntry | public synchronized TreeEntry<K, V> lowerEntry(final K key) {
// Retorna la clave mas cercana menor a la clave indicada
return getRoundEntry(key, false, false);
} | java | public synchronized TreeEntry<K, V> lowerEntry(final K key) {
// Retorna la clave mas cercana menor a la clave indicada
return getRoundEntry(key, false, false);
} | [
"public",
"synchronized",
"TreeEntry",
"<",
"K",
",",
"V",
">",
"lowerEntry",
"(",
"final",
"K",
"key",
")",
"{",
"// Retorna la clave mas cercana menor a la clave indicada",
"return",
"getRoundEntry",
"(",
"key",
",",
"false",
",",
"false",
")",
";",
"}"
] | Returns the greatest key strictly less than the given key, or null if there is no such key.
@param key the key
@return the Entry with greatest key strictly less than the given key, or null if there is no such key. | [
"Returns",
"the",
"greatest",
"key",
"strictly",
"less",
"than",
"the",
"given",
"key",
"or",
"null",
"if",
"there",
"is",
"no",
"such",
"key",
"."
] | train | https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/structures/btree/BplusTree.java#L682-L685 |
lucee/Lucee | core/src/main/java/lucee/runtime/tag/Http.java | Http.setTimeout | public void setTimeout(Object timeout) throws PageException {
if (timeout instanceof TimeSpan) this.timeout = (TimeSpan) timeout;
// seconds
else {
int i = Caster.toIntValue(timeout);
if (i < 0) throw new ApplicationException("invalid value [" + i + "] for attribute timeout, value must be a positive integer greater or equal than 0");
this.timeout = new TimeSpanImpl(0, 0, 0, i);
}
} | java | public void setTimeout(Object timeout) throws PageException {
if (timeout instanceof TimeSpan) this.timeout = (TimeSpan) timeout;
// seconds
else {
int i = Caster.toIntValue(timeout);
if (i < 0) throw new ApplicationException("invalid value [" + i + "] for attribute timeout, value must be a positive integer greater or equal than 0");
this.timeout = new TimeSpanImpl(0, 0, 0, i);
}
} | [
"public",
"void",
"setTimeout",
"(",
"Object",
"timeout",
")",
"throws",
"PageException",
"{",
"if",
"(",
"timeout",
"instanceof",
"TimeSpan",
")",
"this",
".",
"timeout",
"=",
"(",
"TimeSpan",
")",
"timeout",
";",
"// seconds",
"else",
"{",
"int",
"i",
"=... | set the value timeout
@param timeout value to set
@throws ExpressionException | [
"set",
"the",
"value",
"timeout"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Http.java#L439-L448 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java | Math.max | public static double max(double a, double b) {
if (a != a)
return a; // a is NaN
if ((a == 0.0d) &&
(b == 0.0d) &&
(Double.doubleToRawLongBits(a) == negativeZeroDoubleBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b;
}
return (a >= b) ? a : b;
} | java | public static double max(double a, double b) {
if (a != a)
return a; // a is NaN
if ((a == 0.0d) &&
(b == 0.0d) &&
(Double.doubleToRawLongBits(a) == negativeZeroDoubleBits)) {
// Raw conversion ok since NaN can't map to -0.0.
return b;
}
return (a >= b) ? a : b;
} | [
"public",
"static",
"double",
"max",
"(",
"double",
"a",
",",
"double",
"b",
")",
"{",
"if",
"(",
"a",
"!=",
"a",
")",
"return",
"a",
";",
"// a is NaN",
"if",
"(",
"(",
"a",
"==",
"0.0d",
")",
"&&",
"(",
"b",
"==",
"0.0d",
")",
"&&",
"(",
"D... | Returns the greater of two {@code double} values. That
is, the result is the argument closer to positive infinity. If
the arguments have the same value, the result is that same
value. If either value is NaN, then the result is NaN. Unlike
the numerical comparison operators, this method considers
negative zero to be strictly smaller than positive zero. If one
argument is positive zero and the other negative zero, the
result is positive zero.
@param a an argument.
@param b another argument.
@return the larger of {@code a} and {@code b}. | [
"Returns",
"the",
"greater",
"of",
"two",
"{",
"@code",
"double",
"}",
"values",
".",
"That",
"is",
"the",
"result",
"is",
"the",
"argument",
"closer",
"to",
"positive",
"infinity",
".",
"If",
"the",
"arguments",
"have",
"the",
"same",
"value",
"the",
"r... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L1324-L1334 |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/StringUtility.java | StringUtility.firstLineOnly | public static String firstLineOnly(String value, int maxCharacters) {
if(value==null) return value;
int pos = value.indexOf(lineSeparator);
if(pos==-1) pos = value.length();
if(pos>maxCharacters) pos = maxCharacters;
return pos==value.length() ? value : (value.substring(0, pos) + '\u2026');
} | java | public static String firstLineOnly(String value, int maxCharacters) {
if(value==null) return value;
int pos = value.indexOf(lineSeparator);
if(pos==-1) pos = value.length();
if(pos>maxCharacters) pos = maxCharacters;
return pos==value.length() ? value : (value.substring(0, pos) + '\u2026');
} | [
"public",
"static",
"String",
"firstLineOnly",
"(",
"String",
"value",
",",
"int",
"maxCharacters",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"value",
";",
"int",
"pos",
"=",
"value",
".",
"indexOf",
"(",
"lineSeparator",
")",
";",
"if",... | Returns the first line only, and only up to the maximum number of characters. If the
value is modified, will append a horizontal ellipsis (Unicode 0x2026). | [
"Returns",
"the",
"first",
"line",
"only",
"and",
"only",
"up",
"to",
"the",
"maximum",
"number",
"of",
"characters",
".",
"If",
"the",
"value",
"is",
"modified",
"will",
"append",
"a",
"horizontal",
"ellipsis",
"(",
"Unicode",
"0x2026",
")",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/StringUtility.java#L1417-L1423 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/BusGroup.java | BusGroup.generateResetSubscriptionMessage | protected SubscriptionMessage generateResetSubscriptionMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "generateResetSubscriptionMessage");
// Get the Message Handler for doing this operation.
final SubscriptionMessageHandler messageHandler =
iProxyHandler.getMessageHandler();
// Reset the message.
messageHandler.resetResetSubscriptionMessage();
// Add the local subscriptions
addToMessage(messageHandler, iLocalSubscriptions);
// Add the remote Subscriptions
addToMessage(messageHandler, iRemoteSubscriptions);
SubscriptionMessage message = messageHandler.getSubscriptionMessage();
// Add the message back into the pool
iProxyHandler.addMessageHandler(messageHandler);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "generateResetSubscriptionMessage", message);
return message;
} | java | protected SubscriptionMessage generateResetSubscriptionMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "generateResetSubscriptionMessage");
// Get the Message Handler for doing this operation.
final SubscriptionMessageHandler messageHandler =
iProxyHandler.getMessageHandler();
// Reset the message.
messageHandler.resetResetSubscriptionMessage();
// Add the local subscriptions
addToMessage(messageHandler, iLocalSubscriptions);
// Add the remote Subscriptions
addToMessage(messageHandler, iRemoteSubscriptions);
SubscriptionMessage message = messageHandler.getSubscriptionMessage();
// Add the message back into the pool
iProxyHandler.addMessageHandler(messageHandler);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "generateResetSubscriptionMessage", message);
return message;
} | [
"protected",
"SubscriptionMessage",
"generateResetSubscriptionMessage",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"generateResetSubsc... | Generates the reset subscription message that should be sent to a
member, or members of this Bus.
@return a new ResetSubscriptionMessage | [
"Generates",
"the",
"reset",
"subscription",
"message",
"that",
"should",
"be",
"sent",
"to",
"a",
"member",
"or",
"members",
"of",
"this",
"Bus",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/BusGroup.java#L770-L797 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listMultiRoleUsagesWithServiceResponseAsync | public Observable<ServiceResponse<Page<UsageInner>>> listMultiRoleUsagesWithServiceResponseAsync(final String resourceGroupName, final String name) {
return listMultiRoleUsagesSinglePageAsync(resourceGroupName, name)
.concatMap(new Func1<ServiceResponse<Page<UsageInner>>, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(ServiceResponse<Page<UsageInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listMultiRoleUsagesNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<UsageInner>>> listMultiRoleUsagesWithServiceResponseAsync(final String resourceGroupName, final String name) {
return listMultiRoleUsagesSinglePageAsync(resourceGroupName, name)
.concatMap(new Func1<ServiceResponse<Page<UsageInner>>, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(ServiceResponse<Page<UsageInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listMultiRoleUsagesNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"UsageInner",
">",
">",
">",
"listMultiRoleUsagesWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
")",
"{",
"return",
"listMultiRoleUsagesSinglePageA... | Get usage metrics for a multi-role pool of an App Service Environment.
Get usage metrics for a multi-role pool of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<UsageInner> object | [
"Get",
"usage",
"metrics",
"for",
"a",
"multi",
"-",
"role",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"usage",
"metrics",
"for",
"a",
"multi",
"-",
"role",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3559-L3571 |
Waikato/moa | moa/src/main/java/moa/clusterers/clustree/Node.java | Node.addEntry | public void addEntry(Entry newEntry, long currentTime){
newEntry.setNode(this);
int freePosition = getNextEmptyPosition();
entries[freePosition].initializeEntry(newEntry, currentTime);
} | java | public void addEntry(Entry newEntry, long currentTime){
newEntry.setNode(this);
int freePosition = getNextEmptyPosition();
entries[freePosition].initializeEntry(newEntry, currentTime);
} | [
"public",
"void",
"addEntry",
"(",
"Entry",
"newEntry",
",",
"long",
"currentTime",
")",
"{",
"newEntry",
".",
"setNode",
"(",
"this",
")",
";",
"int",
"freePosition",
"=",
"getNextEmptyPosition",
"(",
")",
";",
"entries",
"[",
"freePosition",
"]",
".",
"i... | Add a new <code>Entry</code> to this node. If there is no space left a
<code>NoFreeEntryException</code> is thrown.
@param newEntry The <code>Entry</code> to be added.
@throws NoFreeEntryException Is thrown when there is no space left in
the node for the new entry. | [
"Add",
"a",
"new",
"<code",
">",
"Entry<",
"/",
"code",
">",
"to",
"this",
"node",
".",
"If",
"there",
"is",
"no",
"space",
"left",
"a",
"<code",
">",
"NoFreeEntryException<",
"/",
"code",
">",
"is",
"thrown",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/Node.java#L204-L208 |
zaproxy/zaproxy | src/org/parosproxy/paros/db/paros/ParosTableHistory.java | ParosTableHistory.getHistoryIdsOfHistType | @Override
public List<Integer> getHistoryIdsOfHistType(long sessionId, int... histTypes) throws DatabaseException {
return getHistoryIdsByParams(sessionId, 0, true, histTypes);
} | java | @Override
public List<Integer> getHistoryIdsOfHistType(long sessionId, int... histTypes) throws DatabaseException {
return getHistoryIdsByParams(sessionId, 0, true, histTypes);
} | [
"@",
"Override",
"public",
"List",
"<",
"Integer",
">",
"getHistoryIdsOfHistType",
"(",
"long",
"sessionId",
",",
"int",
"...",
"histTypes",
")",
"throws",
"DatabaseException",
"{",
"return",
"getHistoryIdsByParams",
"(",
"sessionId",
",",
"0",
",",
"true",
",",... | Gets all the history record IDs of the given session and with the given history types.
@param sessionId the ID of session of the history records
@param histTypes the history types of the history records that should be returned
@return a {@code List} with all the history IDs of the given session and history types, never {@code null}
@throws DatabaseException if an error occurred while getting the history IDs
@since 2.3.0
@see #getHistoryIds(long)
@see #getHistoryIdsExceptOfHistType(long, int...) | [
"Gets",
"all",
"the",
"history",
"record",
"IDs",
"of",
"the",
"given",
"session",
"and",
"with",
"the",
"given",
"history",
"types",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/db/paros/ParosTableHistory.java#L436-L439 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java | CmsDefaultXmlContentHandler.isMappingUsingDefault | private boolean isMappingUsingDefault(String path, String mapping) {
String key = path + ":" + mapping;
return m_mappingsUsingDefault.contains(key);
} | java | private boolean isMappingUsingDefault(String path, String mapping) {
String key = path + ":" + mapping;
return m_mappingsUsingDefault.contains(key);
} | [
"private",
"boolean",
"isMappingUsingDefault",
"(",
"String",
"path",
",",
"String",
"mapping",
")",
"{",
"String",
"key",
"=",
"path",
"+",
"\":\"",
"+",
"mapping",
";",
"return",
"m_mappingsUsingDefault",
".",
"contains",
"(",
"key",
")",
";",
"}"
] | Checks if the given mapping has the 'useDefault' flag set to true.<p>
@param path the mapping path
@param mapping the mapping type
@return true if 'useDefault' is enabled for this mapping | [
"Checks",
"if",
"the",
"given",
"mapping",
"has",
"the",
"useDefault",
"flag",
"set",
"to",
"true",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L4017-L4021 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java | SeleniumHelper.findElement | public T findElement(By by, int index) {
T element = null;
List<T> elements = findElements(by);
if (elements.size() > index) {
element = elements.get(index);
}
return element;
} | java | public T findElement(By by, int index) {
T element = null;
List<T> elements = findElements(by);
if (elements.size() > index) {
element = elements.get(index);
}
return element;
} | [
"public",
"T",
"findElement",
"(",
"By",
"by",
",",
"int",
"index",
")",
"{",
"T",
"element",
"=",
"null",
";",
"List",
"<",
"T",
">",
"elements",
"=",
"findElements",
"(",
"by",
")",
";",
"if",
"(",
"elements",
".",
"size",
"(",
")",
">",
"index... | Finds the nth element matching the By supplied.
@param by criteria.
@param index (zero based) matching element to return.
@return element if found, null if none could be found. | [
"Finds",
"the",
"nth",
"element",
"matching",
"the",
"By",
"supplied",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L797-L804 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/OperatorTable.java | OperatorTable.infixn | public OperatorTable<T> infixn(
Parser<? extends BiFunction<? super T, ? super T, ? extends T>> parser, int precedence) {
ops.add(new Operator(parser, precedence, Associativity.NASSOC));
return this;
} | java | public OperatorTable<T> infixn(
Parser<? extends BiFunction<? super T, ? super T, ? extends T>> parser, int precedence) {
ops.add(new Operator(parser, precedence, Associativity.NASSOC));
return this;
} | [
"public",
"OperatorTable",
"<",
"T",
">",
"infixn",
"(",
"Parser",
"<",
"?",
"extends",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"T",
",",
"?",
"extends",
"T",
">",
">",
"parser",
",",
"int",
"precedence",
")",
"{",
"ops",
".",
"add... | Adds an infix non-associative binary operator.
@param parser the parser for the operator.
@param precedence the precedence number.
@return this. | [
"Adds",
"an",
"infix",
"non",
"-",
"associative",
"binary",
"operator",
"."
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/OperatorTable.java#L140-L144 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ExperimentsInner.java | ExperimentsInner.listByWorkspaceWithServiceResponseAsync | public Observable<ServiceResponse<Page<ExperimentInner>>> listByWorkspaceWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final ExperimentsListByWorkspaceOptions experimentsListByWorkspaceOptions) {
return listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, experimentsListByWorkspaceOptions)
.concatMap(new Func1<ServiceResponse<Page<ExperimentInner>>, Observable<ServiceResponse<Page<ExperimentInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ExperimentInner>>> call(ServiceResponse<Page<ExperimentInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByWorkspaceNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<ExperimentInner>>> listByWorkspaceWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final ExperimentsListByWorkspaceOptions experimentsListByWorkspaceOptions) {
return listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, experimentsListByWorkspaceOptions)
.concatMap(new Func1<ServiceResponse<Page<ExperimentInner>>, Observable<ServiceResponse<Page<ExperimentInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ExperimentInner>>> call(ServiceResponse<Page<ExperimentInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByWorkspaceNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"ExperimentInner",
">",
">",
">",
"listByWorkspaceWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"workspaceName",
",",
"final",
"ExperimentsListByWorkspaceOp... | Gets a list of Experiments within the specified Workspace.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param experimentsListByWorkspaceOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ExperimentInner> object | [
"Gets",
"a",
"list",
"of",
"Experiments",
"within",
"the",
"specified",
"Workspace",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ExperimentsInner.java#L283-L295 |
relayrides/pushy | pushy/src/main/java/com/turo/pushy/apns/util/ApnsPayloadBuilder.java | ApnsPayloadBuilder.setLocalizedAlertTitle | public ApnsPayloadBuilder setLocalizedAlertTitle(final String localizedAlertTitleKey, final String... alertTitleArguments) {
this.localizedAlertTitleKey = localizedAlertTitleKey;
this.localizedAlertTitleArguments = (alertTitleArguments != null && alertTitleArguments.length > 0) ? alertTitleArguments : null;
this.alertTitle = null;
return this;
} | java | public ApnsPayloadBuilder setLocalizedAlertTitle(final String localizedAlertTitleKey, final String... alertTitleArguments) {
this.localizedAlertTitleKey = localizedAlertTitleKey;
this.localizedAlertTitleArguments = (alertTitleArguments != null && alertTitleArguments.length > 0) ? alertTitleArguments : null;
this.alertTitle = null;
return this;
} | [
"public",
"ApnsPayloadBuilder",
"setLocalizedAlertTitle",
"(",
"final",
"String",
"localizedAlertTitleKey",
",",
"final",
"String",
"...",
"alertTitleArguments",
")",
"{",
"this",
".",
"localizedAlertTitleKey",
"=",
"localizedAlertTitleKey",
";",
"this",
".",
"localizedAl... | <p>Sets the key of the title string in the receiving app's localized string list to be shown for the push
notification. Clears any previously-set literal alert title. The message in the app's string list may optionally
have placeholders, which will be populated by values from the given {@code alertArguments}.</p>
@param localizedAlertTitleKey a key to a string in the receiving app's localized string list
@param alertTitleArguments arguments to populate placeholders in the localized alert string; may be {@code null}
@return a reference to this payload builder | [
"<p",
">",
"Sets",
"the",
"key",
"of",
"the",
"title",
"string",
"in",
"the",
"receiving",
"app",
"s",
"localized",
"string",
"list",
"to",
"be",
"shown",
"for",
"the",
"push",
"notification",
".",
"Clears",
"any",
"previously",
"-",
"set",
"literal",
"a... | train | https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/util/ApnsPayloadBuilder.java#L237-L244 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectAllValuesFromImpl_CustomFieldSerializer.java | OWLObjectAllValuesFromImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectAllValuesFromImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectAllValuesFromImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLObjectAllValuesFromImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectAllValuesFromImpl_CustomFieldSerializer.java#L94-L97 |
icode/ameba | src/main/java/ameba/feature/AmebaFeature.java | AmebaFeature.subscribeEvent | protected <E extends Event> void subscribeEvent(Class<E> eventClass, final Listener<E> listener) {
locator.inject(listener);
locator.postConstruct(listener);
subscribe(eventClass, listener);
} | java | protected <E extends Event> void subscribeEvent(Class<E> eventClass, final Listener<E> listener) {
locator.inject(listener);
locator.postConstruct(listener);
subscribe(eventClass, listener);
} | [
"protected",
"<",
"E",
"extends",
"Event",
">",
"void",
"subscribeEvent",
"(",
"Class",
"<",
"E",
">",
"eventClass",
",",
"final",
"Listener",
"<",
"E",
">",
"listener",
")",
"{",
"locator",
".",
"inject",
"(",
"listener",
")",
";",
"locator",
".",
"po... | <p>subscribeEvent.</p>
@param eventClass a {@link java.lang.Class} object.
@param listener a {@link ameba.event.Listener} object.
@param <E> a E object. | [
"<p",
">",
"subscribeEvent",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/feature/AmebaFeature.java#L87-L91 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/LuisRuntimeManager.java | LuisRuntimeManager.authenticate | public static LuisRuntimeAPI authenticate(EndpointAPI endpointAPI, String luisAuthoringKey) {
return authenticate(String.format("https://%s/luis/v2.0/", endpointAPI.toString()), luisAuthoringKey)
.withEndpoint(endpointAPI.toString());
} | java | public static LuisRuntimeAPI authenticate(EndpointAPI endpointAPI, String luisAuthoringKey) {
return authenticate(String.format("https://%s/luis/v2.0/", endpointAPI.toString()), luisAuthoringKey)
.withEndpoint(endpointAPI.toString());
} | [
"public",
"static",
"LuisRuntimeAPI",
"authenticate",
"(",
"EndpointAPI",
"endpointAPI",
",",
"String",
"luisAuthoringKey",
")",
"{",
"return",
"authenticate",
"(",
"String",
".",
"format",
"(",
"\"https://%s/luis/v2.0/\"",
",",
"endpointAPI",
".",
"toString",
"(",
... | Initializes an instance of Language Understanding (LUIS) Runtime API client.
@param endpointAPI the endpoint API
@param luisAuthoringKey the Language Understanding (LUIS) Authoring API key (see https://www.luis.ai)
@return the Language Understanding Runtime API client | [
"Initializes",
"an",
"instance",
"of",
"Language",
"Understanding",
"(",
"LUIS",
")",
"Runtime",
"API",
"client",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/LuisRuntimeManager.java#L31-L34 |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundSession.java | SMPPOutboundSession.connectAndOutbind | public BindRequest connectAndOutbind(String host, int port, OutbindParameter outbindParameter, long timeout)
throws IOException {
logger.debug("Connect and bind to {} port {}", host, port);
if (getSessionState() != SessionState.CLOSED) {
throw new IOException("Session state is not closed");
}
conn = connFactory.createConnection(host, port);
logger.info("Connected to {}", conn.getInetAddress());
conn.setSoTimeout(getEnquireLinkTimer());
sessionContext.open();
try {
in = new DataInputStream(conn.getInputStream());
out = conn.getOutputStream();
pduReaderWorker = new PDUReaderWorker();
pduReaderWorker.start();
sendOutbind(outbindParameter.getSystemId(), outbindParameter.getPassword());
}
catch (IOException e) {
logger.error("IO error occurred", e);
close();
throw e;
}
try {
BindRequest bindRequest = waitForBind(timeout);
logger.info("Start enquireLinkSender");
enquireLinkSender = new EnquireLinkSender();
enquireLinkSender.start();
return bindRequest;
}
catch (IllegalStateException e) {
String message = "System error";
logger.error(message, e);
close();
throw new IOException(message + ": " + e.getMessage(), e);
}
catch (TimeoutException e) {
String message = "Waiting bind response take time too long";
logger.error(message, e);
throw new IOException(message + ": " + e.getMessage(), e);
}
} | java | public BindRequest connectAndOutbind(String host, int port, OutbindParameter outbindParameter, long timeout)
throws IOException {
logger.debug("Connect and bind to {} port {}", host, port);
if (getSessionState() != SessionState.CLOSED) {
throw new IOException("Session state is not closed");
}
conn = connFactory.createConnection(host, port);
logger.info("Connected to {}", conn.getInetAddress());
conn.setSoTimeout(getEnquireLinkTimer());
sessionContext.open();
try {
in = new DataInputStream(conn.getInputStream());
out = conn.getOutputStream();
pduReaderWorker = new PDUReaderWorker();
pduReaderWorker.start();
sendOutbind(outbindParameter.getSystemId(), outbindParameter.getPassword());
}
catch (IOException e) {
logger.error("IO error occurred", e);
close();
throw e;
}
try {
BindRequest bindRequest = waitForBind(timeout);
logger.info("Start enquireLinkSender");
enquireLinkSender = new EnquireLinkSender();
enquireLinkSender.start();
return bindRequest;
}
catch (IllegalStateException e) {
String message = "System error";
logger.error(message, e);
close();
throw new IOException(message + ": " + e.getMessage(), e);
}
catch (TimeoutException e) {
String message = "Waiting bind response take time too long";
logger.error(message, e);
throw new IOException(message + ": " + e.getMessage(), e);
}
} | [
"public",
"BindRequest",
"connectAndOutbind",
"(",
"String",
"host",
",",
"int",
"port",
",",
"OutbindParameter",
"outbindParameter",
",",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"Connect and bind to {} port {}\"",
",",
"... | Open connection and outbind immediately.
@param host is the ESME host address.
@param port is the ESME listen port.
@param outbindParameter is the bind parameters.
@param timeout is the timeout.
@return the SMSC system id.
@throws IOException if there is an IO error found. | [
"Open",
"connection",
"and",
"outbind",
"immediately",
"."
] | train | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundSession.java#L174-L221 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VFSUtils.java | VFSUtils.copyStreamAndClose | public static void copyStreamAndClose(InputStream is, OutputStream os) throws IOException {
copyStreamAndClose(is, os, DEFAULT_BUFFER_SIZE);
} | java | public static void copyStreamAndClose(InputStream is, OutputStream os) throws IOException {
copyStreamAndClose(is, os, DEFAULT_BUFFER_SIZE);
} | [
"public",
"static",
"void",
"copyStreamAndClose",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"copyStreamAndClose",
"(",
"is",
",",
"os",
",",
"DEFAULT_BUFFER_SIZE",
")",
";",
"}"
] | Copy input stream to output stream and close them both
@param is input stream
@param os output stream
@throws IOException for any error | [
"Copy",
"input",
"stream",
"to",
"output",
"stream",
"and",
"close",
"them",
"both"
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L384-L386 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.