repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
tvesalainen/util | util/src/main/java/org/vesalainen/util/HexDump.java | HexDump.toHex | public static final String toHex(byte[] buf, int offset, int length) {
"""
Creates readable view to byte array content.
@param buf
@param offset
@param length
@return
"""
return toHex(Arrays.copyOfRange(buf, offset, offset+length));
} | java | public static final String toHex(byte[] buf, int offset, int length)
{
return toHex(Arrays.copyOfRange(buf, offset, offset+length));
} | [
"public",
"static",
"final",
"String",
"toHex",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"toHex",
"(",
"Arrays",
".",
"copyOfRange",
"(",
"buf",
",",
"offset",
",",
"offset",
"+",
"length",
")",
")",
";",
"}"
] | Creates readable view to byte array content.
@param buf
@param offset
@param length
@return | [
"Creates",
"readable",
"view",
"to",
"byte",
"array",
"content",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/HexDump.java#L123-L126 |
jenetics/jenetics | jenetics.ext/src/main/java/io/jenetics/ext/internal/random.java | random.nextBigInteger | public static BigInteger nextBigInteger(
final BigInteger min,
final BigInteger max,
final Random random
) {
"""
Returns a pseudo-random, uniformly distributed int value between min
and max (min and max included).
@param min lower bound for generated long integer (inclusively)
@param max upper bound for generated long integer (inclusively)
@param random the random engine to use for calculating the random
long value
@return a random long integer greater than or equal to {@code min}
and less than or equal to {@code max}
@throws IllegalArgumentException if {@code min >= max}
@throws NullPointerException if one of the given parameters
are {@code null}.
"""
if (min.compareTo(max) >= 0) {
throw new IllegalArgumentException(format(
"min >= max: %d >= %d.", min, max
));
}
final BigInteger n = max.subtract(min).add(BigInteger.ONE);
return nextBigInteger(n, random).add(min);
} | java | public static BigInteger nextBigInteger(
final BigInteger min,
final BigInteger max,
final Random random
) {
if (min.compareTo(max) >= 0) {
throw new IllegalArgumentException(format(
"min >= max: %d >= %d.", min, max
));
}
final BigInteger n = max.subtract(min).add(BigInteger.ONE);
return nextBigInteger(n, random).add(min);
} | [
"public",
"static",
"BigInteger",
"nextBigInteger",
"(",
"final",
"BigInteger",
"min",
",",
"final",
"BigInteger",
"max",
",",
"final",
"Random",
"random",
")",
"{",
"if",
"(",
"min",
".",
"compareTo",
"(",
"max",
")",
">=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"\"min >= max: %d >= %d.\"",
",",
"min",
",",
"max",
")",
")",
";",
"}",
"final",
"BigInteger",
"n",
"=",
"max",
".",
"subtract",
"(",
"min",
")",
".",
"add",
"(",
"BigInteger",
".",
"ONE",
")",
";",
"return",
"nextBigInteger",
"(",
"n",
",",
"random",
")",
".",
"add",
"(",
"min",
")",
";",
"}"
] | Returns a pseudo-random, uniformly distributed int value between min
and max (min and max included).
@param min lower bound for generated long integer (inclusively)
@param max upper bound for generated long integer (inclusively)
@param random the random engine to use for calculating the random
long value
@return a random long integer greater than or equal to {@code min}
and less than or equal to {@code max}
@throws IllegalArgumentException if {@code min >= max}
@throws NullPointerException if one of the given parameters
are {@code null}. | [
"Returns",
"a",
"pseudo",
"-",
"random",
"uniformly",
"distributed",
"int",
"value",
"between",
"min",
"and",
"max",
"(",
"min",
"and",
"max",
"included",
")",
"."
] | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/internal/random.java#L120-L133 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.addEntries | public static void addEntries(File zip, ZipEntrySource[] entries, File destZip) {
"""
Copies an existing ZIP file and appends it with new entries.
@param zip
an existing ZIP file (only read).
@param entries
new ZIP entries appended.
@param destZip
new ZIP file created.
"""
if (log.isDebugEnabled()) {
log.debug("Copying '" + zip + "' to '" + destZip + "' and adding " + Arrays.asList(entries) + ".");
}
OutputStream destOut = null;
try {
destOut = new BufferedOutputStream(new FileOutputStream(destZip));
addEntries(zip, entries, destOut);
}
catch (IOException e) {
ZipExceptionUtil.rethrow(e);
}
finally {
IOUtils.closeQuietly(destOut);
}
} | java | public static void addEntries(File zip, ZipEntrySource[] entries, File destZip) {
if (log.isDebugEnabled()) {
log.debug("Copying '" + zip + "' to '" + destZip + "' and adding " + Arrays.asList(entries) + ".");
}
OutputStream destOut = null;
try {
destOut = new BufferedOutputStream(new FileOutputStream(destZip));
addEntries(zip, entries, destOut);
}
catch (IOException e) {
ZipExceptionUtil.rethrow(e);
}
finally {
IOUtils.closeQuietly(destOut);
}
} | [
"public",
"static",
"void",
"addEntries",
"(",
"File",
"zip",
",",
"ZipEntrySource",
"[",
"]",
"entries",
",",
"File",
"destZip",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Copying '\"",
"+",
"zip",
"+",
"\"' to '\"",
"+",
"destZip",
"+",
"\"' and adding \"",
"+",
"Arrays",
".",
"asList",
"(",
"entries",
")",
"+",
"\".\"",
")",
";",
"}",
"OutputStream",
"destOut",
"=",
"null",
";",
"try",
"{",
"destOut",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"destZip",
")",
")",
";",
"addEntries",
"(",
"zip",
",",
"entries",
",",
"destOut",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ZipExceptionUtil",
".",
"rethrow",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"IOUtils",
".",
"closeQuietly",
"(",
"destOut",
")",
";",
"}",
"}"
] | Copies an existing ZIP file and appends it with new entries.
@param zip
an existing ZIP file (only read).
@param entries
new ZIP entries appended.
@param destZip
new ZIP file created. | [
"Copies",
"an",
"existing",
"ZIP",
"file",
"and",
"appends",
"it",
"with",
"new",
"entries",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2164-L2180 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/logging/Redwood.java | Redwood.startTrack | public static void startTrack(final Object... args) {
"""
Begin a "track;" that is, begin logging at one level deeper.
Channels other than the FORCE channel are ignored.
@param args The title of the track to begin, with an optional FORCE flag.
"""
if(isClosed){ return; }
//--Create Record
final int len = args.length == 0 ? 0 : args.length-1;
final Object content = args.length == 0 ? "" : args[len];
final Object[] tags = new Object[len];
final StackTraceElement ste = getStackTrace();
final long timestamp = System.currentTimeMillis();
System.arraycopy(args,0,tags,0,len);
//--Create Task
final long threadID = Thread.currentThread().getId();
final Runnable startTrack = new Runnable(){
public void run(){
assert !isThreaded || control.isHeldByCurrentThread();
Record toPass = new Record(content,tags,depth,ste,timestamp);
depth += 1;
titleStack.push(args.length == 0 ? "" : args[len].toString());
handlers.process(toPass, MessageType.START_TRACK, depth, toPass.timesstamp);
assert !isThreaded || control.isHeldByCurrentThread();
}
};
//--Run Task
if(isThreaded){
//(case: multithreaded)
long threadId = Thread.currentThread().getId();
attemptThreadControl( threadId, startTrack );
} else {
//(case: no threading)
startTrack.run();
}
} | java | public static void startTrack(final Object... args){
if(isClosed){ return; }
//--Create Record
final int len = args.length == 0 ? 0 : args.length-1;
final Object content = args.length == 0 ? "" : args[len];
final Object[] tags = new Object[len];
final StackTraceElement ste = getStackTrace();
final long timestamp = System.currentTimeMillis();
System.arraycopy(args,0,tags,0,len);
//--Create Task
final long threadID = Thread.currentThread().getId();
final Runnable startTrack = new Runnable(){
public void run(){
assert !isThreaded || control.isHeldByCurrentThread();
Record toPass = new Record(content,tags,depth,ste,timestamp);
depth += 1;
titleStack.push(args.length == 0 ? "" : args[len].toString());
handlers.process(toPass, MessageType.START_TRACK, depth, toPass.timesstamp);
assert !isThreaded || control.isHeldByCurrentThread();
}
};
//--Run Task
if(isThreaded){
//(case: multithreaded)
long threadId = Thread.currentThread().getId();
attemptThreadControl( threadId, startTrack );
} else {
//(case: no threading)
startTrack.run();
}
} | [
"public",
"static",
"void",
"startTrack",
"(",
"final",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isClosed",
")",
"{",
"return",
";",
"}",
"//--Create Record\r",
"final",
"int",
"len",
"=",
"args",
".",
"length",
"==",
"0",
"?",
"0",
":",
"args",
".",
"length",
"-",
"1",
";",
"final",
"Object",
"content",
"=",
"args",
".",
"length",
"==",
"0",
"?",
"\"\"",
":",
"args",
"[",
"len",
"]",
";",
"final",
"Object",
"[",
"]",
"tags",
"=",
"new",
"Object",
"[",
"len",
"]",
";",
"final",
"StackTraceElement",
"ste",
"=",
"getStackTrace",
"(",
")",
";",
"final",
"long",
"timestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"System",
".",
"arraycopy",
"(",
"args",
",",
"0",
",",
"tags",
",",
"0",
",",
"len",
")",
";",
"//--Create Task\r",
"final",
"long",
"threadID",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getId",
"(",
")",
";",
"final",
"Runnable",
"startTrack",
"=",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"assert",
"!",
"isThreaded",
"||",
"control",
".",
"isHeldByCurrentThread",
"(",
")",
";",
"Record",
"toPass",
"=",
"new",
"Record",
"(",
"content",
",",
"tags",
",",
"depth",
",",
"ste",
",",
"timestamp",
")",
";",
"depth",
"+=",
"1",
";",
"titleStack",
".",
"push",
"(",
"args",
".",
"length",
"==",
"0",
"?",
"\"\"",
":",
"args",
"[",
"len",
"]",
".",
"toString",
"(",
")",
")",
";",
"handlers",
".",
"process",
"(",
"toPass",
",",
"MessageType",
".",
"START_TRACK",
",",
"depth",
",",
"toPass",
".",
"timesstamp",
")",
";",
"assert",
"!",
"isThreaded",
"||",
"control",
".",
"isHeldByCurrentThread",
"(",
")",
";",
"}",
"}",
";",
"//--Run Task\r",
"if",
"(",
"isThreaded",
")",
"{",
"//(case: multithreaded)\r",
"long",
"threadId",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getId",
"(",
")",
";",
"attemptThreadControl",
"(",
"threadId",
",",
"startTrack",
")",
";",
"}",
"else",
"{",
"//(case: no threading)\r",
"startTrack",
".",
"run",
"(",
")",
";",
"}",
"}"
] | Begin a "track;" that is, begin logging at one level deeper.
Channels other than the FORCE channel are ignored.
@param args The title of the track to begin, with an optional FORCE flag. | [
"Begin",
"a",
"track",
";",
"that",
"is",
"begin",
"logging",
"at",
"one",
"level",
"deeper",
".",
"Channels",
"other",
"than",
"the",
"FORCE",
"channel",
"are",
"ignored",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/logging/Redwood.java#L468-L498 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/Table.java | Table.insertRow | void insertRow(Session session, PersistentStore store, Object[] data) {
"""
Mid level method for inserting rows. Performs constraint checks and
fires row level triggers.
"""
setIdentityColumn(session, data);
if (triggerLists[Trigger.INSERT_BEFORE].length != 0) {
fireBeforeTriggers(session, Trigger.INSERT_BEFORE, null, data,
null);
}
if (isView) {
return;
}
checkRowDataInsert(session, data);
insertNoCheck(session, store, data);
} | java | void insertRow(Session session, PersistentStore store, Object[] data) {
setIdentityColumn(session, data);
if (triggerLists[Trigger.INSERT_BEFORE].length != 0) {
fireBeforeTriggers(session, Trigger.INSERT_BEFORE, null, data,
null);
}
if (isView) {
return;
}
checkRowDataInsert(session, data);
insertNoCheck(session, store, data);
} | [
"void",
"insertRow",
"(",
"Session",
"session",
",",
"PersistentStore",
"store",
",",
"Object",
"[",
"]",
"data",
")",
"{",
"setIdentityColumn",
"(",
"session",
",",
"data",
")",
";",
"if",
"(",
"triggerLists",
"[",
"Trigger",
".",
"INSERT_BEFORE",
"]",
".",
"length",
"!=",
"0",
")",
"{",
"fireBeforeTriggers",
"(",
"session",
",",
"Trigger",
".",
"INSERT_BEFORE",
",",
"null",
",",
"data",
",",
"null",
")",
";",
"}",
"if",
"(",
"isView",
")",
"{",
"return",
";",
"}",
"checkRowDataInsert",
"(",
"session",
",",
"data",
")",
";",
"insertNoCheck",
"(",
"session",
",",
"store",
",",
"data",
")",
";",
"}"
] | Mid level method for inserting rows. Performs constraint checks and
fires row level triggers. | [
"Mid",
"level",
"method",
"for",
"inserting",
"rows",
".",
"Performs",
"constraint",
"checks",
"and",
"fires",
"row",
"level",
"triggers",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Table.java#L2241-L2256 |
apache/groovy | src/main/groovy/groovy/lang/GroovyClassLoader.java | GroovyClassLoader.parseClass | public Class parseClass(File file) throws CompilationFailedException, IOException {
"""
Parses the given file into a Java class capable of being run
@param file the file name to parse
@return the main class defined in the given script
"""
return parseClass(new GroovyCodeSource(file, config.getSourceEncoding()));
} | java | public Class parseClass(File file) throws CompilationFailedException, IOException {
return parseClass(new GroovyCodeSource(file, config.getSourceEncoding()));
} | [
"public",
"Class",
"parseClass",
"(",
"File",
"file",
")",
"throws",
"CompilationFailedException",
",",
"IOException",
"{",
"return",
"parseClass",
"(",
"new",
"GroovyCodeSource",
"(",
"file",
",",
"config",
".",
"getSourceEncoding",
"(",
")",
")",
")",
";",
"}"
] | Parses the given file into a Java class capable of being run
@param file the file name to parse
@return the main class defined in the given script | [
"Parses",
"the",
"given",
"file",
"into",
"a",
"Java",
"class",
"capable",
"of",
"being",
"run"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L233-L235 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventManager.java | EventManager.hostSubscribe | private void hostSubscribe(String eventName, boolean subscribe) {
"""
Registers or unregisters a subscription with the global event dispatcher, if one is present.
@param eventName Name of event
@param subscribe If true, a subscription is registered. If false, it is unregistered.
"""
if (globalEventDispatcher != null) {
try {
globalEventDispatcher.subscribeRemoteEvent(eventName, subscribe);
} catch (Throwable e) {
log.error(
"Error " + (subscribe ? "subscribing to" : "unsubscribing from") + " remote event '" + eventName + "'",
e);
}
}
} | java | private void hostSubscribe(String eventName, boolean subscribe) {
if (globalEventDispatcher != null) {
try {
globalEventDispatcher.subscribeRemoteEvent(eventName, subscribe);
} catch (Throwable e) {
log.error(
"Error " + (subscribe ? "subscribing to" : "unsubscribing from") + " remote event '" + eventName + "'",
e);
}
}
} | [
"private",
"void",
"hostSubscribe",
"(",
"String",
"eventName",
",",
"boolean",
"subscribe",
")",
"{",
"if",
"(",
"globalEventDispatcher",
"!=",
"null",
")",
"{",
"try",
"{",
"globalEventDispatcher",
".",
"subscribeRemoteEvent",
"(",
"eventName",
",",
"subscribe",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Error \"",
"+",
"(",
"subscribe",
"?",
"\"subscribing to\"",
":",
"\"unsubscribing from\"",
")",
"+",
"\" remote event '\"",
"+",
"eventName",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Registers or unregisters a subscription with the global event dispatcher, if one is present.
@param eventName Name of event
@param subscribe If true, a subscription is registered. If false, it is unregistered. | [
"Registers",
"or",
"unregisters",
"a",
"subscription",
"with",
"the",
"global",
"event",
"dispatcher",
"if",
"one",
"is",
"present",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventManager.java#L144-L154 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java | PubSubManager.deleteNode | public boolean deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Delete the specified node.
@param nodeId
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
@return <code>true</code> if this node existed and was deleted and <code>false</code> if this node did not exist.
"""
boolean res = true;
try {
sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace());
} catch (XMPPErrorException e) {
if (e.getStanzaError().getCondition() == StanzaError.Condition.item_not_found) {
res = false;
} else {
throw e;
}
}
nodeMap.remove(nodeId);
return res;
} | java | public boolean deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
boolean res = true;
try {
sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace());
} catch (XMPPErrorException e) {
if (e.getStanzaError().getCondition() == StanzaError.Condition.item_not_found) {
res = false;
} else {
throw e;
}
}
nodeMap.remove(nodeId);
return res;
} | [
"public",
"boolean",
"deleteNode",
"(",
"String",
"nodeId",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"boolean",
"res",
"=",
"true",
";",
"try",
"{",
"sendPubsubPacket",
"(",
"Type",
".",
"set",
",",
"new",
"NodeExtension",
"(",
"PubSubElementType",
".",
"DELETE",
",",
"nodeId",
")",
",",
"PubSubElementType",
".",
"DELETE",
".",
"getNamespace",
"(",
")",
")",
";",
"}",
"catch",
"(",
"XMPPErrorException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getStanzaError",
"(",
")",
".",
"getCondition",
"(",
")",
"==",
"StanzaError",
".",
"Condition",
".",
"item_not_found",
")",
"{",
"res",
"=",
"false",
";",
"}",
"else",
"{",
"throw",
"e",
";",
"}",
"}",
"nodeMap",
".",
"remove",
"(",
"nodeId",
")",
";",
"return",
"res",
";",
"}"
] | Delete the specified node.
@param nodeId
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
@return <code>true</code> if this node existed and was deleted and <code>false</code> if this node did not exist. | [
"Delete",
"the",
"specified",
"node",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java#L512-L525 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java | WorkflowTriggersInner.listAsync | public Observable<Page<WorkflowTriggerInner>> listAsync(final String resourceGroupName, final String workflowName, final Integer top, final String filter) {
"""
Gets a list of workflow triggers.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param top The number of items to be included in the result.
@param filter The filter to apply on the operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<WorkflowTriggerInner> object
"""
return listWithServiceResponseAsync(resourceGroupName, workflowName, top, filter)
.map(new Func1<ServiceResponse<Page<WorkflowTriggerInner>>, Page<WorkflowTriggerInner>>() {
@Override
public Page<WorkflowTriggerInner> call(ServiceResponse<Page<WorkflowTriggerInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<WorkflowTriggerInner>> listAsync(final String resourceGroupName, final String workflowName, final Integer top, final String filter) {
return listWithServiceResponseAsync(resourceGroupName, workflowName, top, filter)
.map(new Func1<ServiceResponse<Page<WorkflowTriggerInner>>, Page<WorkflowTriggerInner>>() {
@Override
public Page<WorkflowTriggerInner> call(ServiceResponse<Page<WorkflowTriggerInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"WorkflowTriggerInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"workflowName",
",",
"final",
"Integer",
"top",
",",
"final",
"String",
"filter",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workflowName",
",",
"top",
",",
"filter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"WorkflowTriggerInner",
">",
">",
",",
"Page",
"<",
"WorkflowTriggerInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"WorkflowTriggerInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"WorkflowTriggerInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a list of workflow triggers.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param top The number of items to be included in the result.
@param filter The filter to apply on the operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<WorkflowTriggerInner> object | [
"Gets",
"a",
"list",
"of",
"workflow",
"triggers",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java#L272-L280 |
forge/core | resources/impl/src/main/java/org/jboss/forge/addon/resource/DirectoryResourceImpl.java | DirectoryResourceImpl.getChildOfType | @Override
@SuppressWarnings("unchecked")
public <E, T extends Resource<E>> T getChildOfType(final Class<T> type, final String name) throws ResourceException {
"""
Using the given type, obtain a reference to the child resource of the given type. If the result is not of the
requested type and does not exist, return null. If the result is not of the requested type and exists, throw
{@link ResourceException}
"""
T result;
Resource<?> child = getChild(name);
if (type.isAssignableFrom(child.getClass()))
{
result = (T) child;
}
else if (child.exists())
{
throw new ResourceException("Requested resource [" + name + "] was not of type [" + type.getName()
+ "], but was instead [" + child.getClass().getName() + "]");
}
else
{
E underlyingResource = (E) child.getUnderlyingResourceObject();
result = getResourceFactory().create(type, underlyingResource);
}
return result;
} | java | @Override
@SuppressWarnings("unchecked")
public <E, T extends Resource<E>> T getChildOfType(final Class<T> type, final String name) throws ResourceException
{
T result;
Resource<?> child = getChild(name);
if (type.isAssignableFrom(child.getClass()))
{
result = (T) child;
}
else if (child.exists())
{
throw new ResourceException("Requested resource [" + name + "] was not of type [" + type.getName()
+ "], but was instead [" + child.getClass().getName() + "]");
}
else
{
E underlyingResource = (E) child.getUnderlyingResourceObject();
result = getResourceFactory().create(type, underlyingResource);
}
return result;
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
",",
"T",
"extends",
"Resource",
"<",
"E",
">",
">",
"T",
"getChildOfType",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"String",
"name",
")",
"throws",
"ResourceException",
"{",
"T",
"result",
";",
"Resource",
"<",
"?",
">",
"child",
"=",
"getChild",
"(",
"name",
")",
";",
"if",
"(",
"type",
".",
"isAssignableFrom",
"(",
"child",
".",
"getClass",
"(",
")",
")",
")",
"{",
"result",
"=",
"(",
"T",
")",
"child",
";",
"}",
"else",
"if",
"(",
"child",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"ResourceException",
"(",
"\"Requested resource [\"",
"+",
"name",
"+",
"\"] was not of type [\"",
"+",
"type",
".",
"getName",
"(",
")",
"+",
"\"], but was instead [\"",
"+",
"child",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"else",
"{",
"E",
"underlyingResource",
"=",
"(",
"E",
")",
"child",
".",
"getUnderlyingResourceObject",
"(",
")",
";",
"result",
"=",
"getResourceFactory",
"(",
")",
".",
"create",
"(",
"type",
",",
"underlyingResource",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Using the given type, obtain a reference to the child resource of the given type. If the result is not of the
requested type and does not exist, return null. If the result is not of the requested type and exists, throw
{@link ResourceException} | [
"Using",
"the",
"given",
"type",
"obtain",
"a",
"reference",
"to",
"the",
"child",
"resource",
"of",
"the",
"given",
"type",
".",
"If",
"the",
"result",
"is",
"not",
"of",
"the",
"requested",
"type",
"and",
"does",
"not",
"exist",
"return",
"null",
".",
"If",
"the",
"result",
"is",
"not",
"of",
"the",
"requested",
"type",
"and",
"exists",
"throw",
"{"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/resources/impl/src/main/java/org/jboss/forge/addon/resource/DirectoryResourceImpl.java#L111-L132 |
twitter/cloudhopper-commons | ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java | DataCoding.createGeneralGroup | static public DataCoding createGeneralGroup(byte characterEncoding, Byte messageClass, boolean compressed) throws IllegalArgumentException {
"""
Creates a "General" group data coding scheme where 3 different
languages are supported (8BIT, UCS2, or DEFAULT). This method validates the
message class.
@param characterEncoding Either CHAR_ENC_DEFAULT, CHAR_ENC_8BIT, or CHAR_ENC_UCS2
@param messageClass The 4 different possible message classes (0-3). If null,
the "message class" not active flag will not be set.
@param compressed If true, the message is compressed. False if unpacked.
@return A new immutable DataCoding instance representing this data coding scheme
@throws IllegalArgumentException Thrown if the range is not supported.
"""
// only default, 8bit, or UCS2 are valid
if (!(characterEncoding == CHAR_ENC_DEFAULT || characterEncoding == CHAR_ENC_8BIT || characterEncoding == CHAR_ENC_UCS2)) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only default, 8bit, or UCS2 supported for general group");
}
// validate the message class (only if non-null)
if (messageClass != null && (messageClass.byteValue() < 0 || messageClass.byteValue() > 3)) {
throw new IllegalArgumentException("Invalid messageClass [0x" + HexUtil.toHexString(messageClass) + "] value used: 0x00-0x03 only valid range");
}
// need to build this dcs value (top 2 bits are 0, start with 0x00)
byte dcs = 0;
if (compressed) {
dcs |= (byte)0x20; // turn bit 5 on
}
// if a message class is present turn bit 4 on
if (messageClass != null) {
dcs |= (byte)0x10; // turn bit 4 on
// bits 1 thru 0 is the message class
// merge in the message class (bottom 2 bits)
dcs |= messageClass;
}
// merge in language encodings (they nicely merge in since only default, 8-bit or UCS2)
dcs |= characterEncoding;
return new DataCoding(dcs, Group.GENERAL, characterEncoding, (messageClass == null ? MESSAGE_CLASS_0 : messageClass.byteValue()), compressed);
} | java | static public DataCoding createGeneralGroup(byte characterEncoding, Byte messageClass, boolean compressed) throws IllegalArgumentException {
// only default, 8bit, or UCS2 are valid
if (!(characterEncoding == CHAR_ENC_DEFAULT || characterEncoding == CHAR_ENC_8BIT || characterEncoding == CHAR_ENC_UCS2)) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only default, 8bit, or UCS2 supported for general group");
}
// validate the message class (only if non-null)
if (messageClass != null && (messageClass.byteValue() < 0 || messageClass.byteValue() > 3)) {
throw new IllegalArgumentException("Invalid messageClass [0x" + HexUtil.toHexString(messageClass) + "] value used: 0x00-0x03 only valid range");
}
// need to build this dcs value (top 2 bits are 0, start with 0x00)
byte dcs = 0;
if (compressed) {
dcs |= (byte)0x20; // turn bit 5 on
}
// if a message class is present turn bit 4 on
if (messageClass != null) {
dcs |= (byte)0x10; // turn bit 4 on
// bits 1 thru 0 is the message class
// merge in the message class (bottom 2 bits)
dcs |= messageClass;
}
// merge in language encodings (they nicely merge in since only default, 8-bit or UCS2)
dcs |= characterEncoding;
return new DataCoding(dcs, Group.GENERAL, characterEncoding, (messageClass == null ? MESSAGE_CLASS_0 : messageClass.byteValue()), compressed);
} | [
"static",
"public",
"DataCoding",
"createGeneralGroup",
"(",
"byte",
"characterEncoding",
",",
"Byte",
"messageClass",
",",
"boolean",
"compressed",
")",
"throws",
"IllegalArgumentException",
"{",
"// only default, 8bit, or UCS2 are valid",
"if",
"(",
"!",
"(",
"characterEncoding",
"==",
"CHAR_ENC_DEFAULT",
"||",
"characterEncoding",
"==",
"CHAR_ENC_8BIT",
"||",
"characterEncoding",
"==",
"CHAR_ENC_UCS2",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid characterEncoding [0x\"",
"+",
"HexUtil",
".",
"toHexString",
"(",
"characterEncoding",
")",
"+",
"\"] value used: only default, 8bit, or UCS2 supported for general group\"",
")",
";",
"}",
"// validate the message class (only if non-null)",
"if",
"(",
"messageClass",
"!=",
"null",
"&&",
"(",
"messageClass",
".",
"byteValue",
"(",
")",
"<",
"0",
"||",
"messageClass",
".",
"byteValue",
"(",
")",
">",
"3",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid messageClass [0x\"",
"+",
"HexUtil",
".",
"toHexString",
"(",
"messageClass",
")",
"+",
"\"] value used: 0x00-0x03 only valid range\"",
")",
";",
"}",
"// need to build this dcs value (top 2 bits are 0, start with 0x00)",
"byte",
"dcs",
"=",
"0",
";",
"if",
"(",
"compressed",
")",
"{",
"dcs",
"|=",
"(",
"byte",
")",
"0x20",
";",
"// turn bit 5 on",
"}",
"// if a message class is present turn bit 4 on",
"if",
"(",
"messageClass",
"!=",
"null",
")",
"{",
"dcs",
"|=",
"(",
"byte",
")",
"0x10",
";",
"// turn bit 4 on",
"// bits 1 thru 0 is the message class",
"// merge in the message class (bottom 2 bits)",
"dcs",
"|=",
"messageClass",
";",
"}",
"// merge in language encodings (they nicely merge in since only default, 8-bit or UCS2)",
"dcs",
"|=",
"characterEncoding",
";",
"return",
"new",
"DataCoding",
"(",
"dcs",
",",
"Group",
".",
"GENERAL",
",",
"characterEncoding",
",",
"(",
"messageClass",
"==",
"null",
"?",
"MESSAGE_CLASS_0",
":",
"messageClass",
".",
"byteValue",
"(",
")",
")",
",",
"compressed",
")",
";",
"}"
] | Creates a "General" group data coding scheme where 3 different
languages are supported (8BIT, UCS2, or DEFAULT). This method validates the
message class.
@param characterEncoding Either CHAR_ENC_DEFAULT, CHAR_ENC_8BIT, or CHAR_ENC_UCS2
@param messageClass The 4 different possible message classes (0-3). If null,
the "message class" not active flag will not be set.
@param compressed If true, the message is compressed. False if unpacked.
@return A new immutable DataCoding instance representing this data coding scheme
@throws IllegalArgumentException Thrown if the range is not supported. | [
"Creates",
"a",
"General",
"group",
"data",
"coding",
"scheme",
"where",
"3",
"different",
"languages",
"are",
"supported",
"(",
"8BIT",
"UCS2",
"or",
"DEFAULT",
")",
".",
"This",
"method",
"validates",
"the",
"message",
"class",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java#L255-L285 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Theme.java | Theme.createChildTheme | public Theme createChildTheme(String name, Map<String, Object> attributes) {
"""
Create a theme that is a child of this theme.
@param name Name of the new theme.
@param attributes additional attributes for new theme.
@return The new theme.
"""
Theme theme = getInstance().create().theme(name, getProject(), attributes);
theme.setParentTheme(this);
theme.save();
return theme;
} | java | public Theme createChildTheme(String name, Map<String, Object> attributes) {
Theme theme = getInstance().create().theme(name, getProject(), attributes);
theme.setParentTheme(this);
theme.save();
return theme;
} | [
"public",
"Theme",
"createChildTheme",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"Theme",
"theme",
"=",
"getInstance",
"(",
")",
".",
"create",
"(",
")",
".",
"theme",
"(",
"name",
",",
"getProject",
"(",
")",
",",
"attributes",
")",
";",
"theme",
".",
"setParentTheme",
"(",
"this",
")",
";",
"theme",
".",
"save",
"(",
")",
";",
"return",
"theme",
";",
"}"
] | Create a theme that is a child of this theme.
@param name Name of the new theme.
@param attributes additional attributes for new theme.
@return The new theme. | [
"Create",
"a",
"theme",
"that",
"is",
"a",
"child",
"of",
"this",
"theme",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Theme.java#L240-L246 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/Utils.java | Utils.parseInt | public static int parseInt(String val, int defValue) {
"""
Parse a int from a String in a safe manner.
@param val the string to parse
@param defValue the default value to return if parsing fails
@return the parsed int, or default value
"""
if(TextUtils.isEmpty(val)) return defValue;
try{
return Integer.parseInt(val);
}catch (NumberFormatException e){
return defValue;
}
} | java | public static int parseInt(String val, int defValue){
if(TextUtils.isEmpty(val)) return defValue;
try{
return Integer.parseInt(val);
}catch (NumberFormatException e){
return defValue;
}
} | [
"public",
"static",
"int",
"parseInt",
"(",
"String",
"val",
",",
"int",
"defValue",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"val",
")",
")",
"return",
"defValue",
";",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"val",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"return",
"defValue",
";",
"}",
"}"
] | Parse a int from a String in a safe manner.
@param val the string to parse
@param defValue the default value to return if parsing fails
@return the parsed int, or default value | [
"Parse",
"a",
"int",
"from",
"a",
"String",
"in",
"a",
"safe",
"manner",
"."
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L262-L269 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchClient.java | JMElasticsearchClient.getAllIdList | public List<String> getAllIdList(String index, String type) {
"""
Gets all id list.
@param index the index
@param type the type
@return the all id list
"""
return extractIdList(searchAll(index, type));
} | java | public List<String> getAllIdList(String index, String type) {
return extractIdList(searchAll(index, type));
} | [
"public",
"List",
"<",
"String",
">",
"getAllIdList",
"(",
"String",
"index",
",",
"String",
"type",
")",
"{",
"return",
"extractIdList",
"(",
"searchAll",
"(",
"index",
",",
"type",
")",
")",
";",
"}"
] | Gets all id list.
@param index the index
@param type the type
@return the all id list | [
"Gets",
"all",
"id",
"list",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchClient.java#L234-L236 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java | TransformerImpl.executeChildTemplates | public void executeChildTemplates(
ElemTemplateElement elem, ContentHandler handler)
throws TransformerException {
"""
Execute each of the children of a template element.
@param elem The ElemTemplateElement that contains the children
that should execute.
@param handler The ContentHandler to where the result events
should be fed.
@throws TransformerException
@xsl.usage advanced
"""
SerializationHandler xoh = this.getSerializationHandler();
// These may well not be the same! In this case when calling
// the Redirect extension, it has already set the ContentHandler
// in the Transformer.
SerializationHandler savedHandler = xoh;
try
{
xoh.flushPending();
// %REVIEW% Make sure current node is being pushed.
LexicalHandler lex = null;
if (handler instanceof LexicalHandler) {
lex = (LexicalHandler) handler;
}
m_serializationHandler = new ToXMLSAXHandler(handler, lex, savedHandler.getEncoding());
m_serializationHandler.setTransformer(this);
executeChildTemplates(elem, true);
}
catch (TransformerException e)
{
throw e;
}
catch (SAXException se) {
throw new TransformerException(se);
}
finally
{
m_serializationHandler = savedHandler;
}
} | java | public void executeChildTemplates(
ElemTemplateElement elem, ContentHandler handler)
throws TransformerException
{
SerializationHandler xoh = this.getSerializationHandler();
// These may well not be the same! In this case when calling
// the Redirect extension, it has already set the ContentHandler
// in the Transformer.
SerializationHandler savedHandler = xoh;
try
{
xoh.flushPending();
// %REVIEW% Make sure current node is being pushed.
LexicalHandler lex = null;
if (handler instanceof LexicalHandler) {
lex = (LexicalHandler) handler;
}
m_serializationHandler = new ToXMLSAXHandler(handler, lex, savedHandler.getEncoding());
m_serializationHandler.setTransformer(this);
executeChildTemplates(elem, true);
}
catch (TransformerException e)
{
throw e;
}
catch (SAXException se) {
throw new TransformerException(se);
}
finally
{
m_serializationHandler = savedHandler;
}
} | [
"public",
"void",
"executeChildTemplates",
"(",
"ElemTemplateElement",
"elem",
",",
"ContentHandler",
"handler",
")",
"throws",
"TransformerException",
"{",
"SerializationHandler",
"xoh",
"=",
"this",
".",
"getSerializationHandler",
"(",
")",
";",
"// These may well not be the same! In this case when calling",
"// the Redirect extension, it has already set the ContentHandler",
"// in the Transformer.",
"SerializationHandler",
"savedHandler",
"=",
"xoh",
";",
"try",
"{",
"xoh",
".",
"flushPending",
"(",
")",
";",
"// %REVIEW% Make sure current node is being pushed.",
"LexicalHandler",
"lex",
"=",
"null",
";",
"if",
"(",
"handler",
"instanceof",
"LexicalHandler",
")",
"{",
"lex",
"=",
"(",
"LexicalHandler",
")",
"handler",
";",
"}",
"m_serializationHandler",
"=",
"new",
"ToXMLSAXHandler",
"(",
"handler",
",",
"lex",
",",
"savedHandler",
".",
"getEncoding",
"(",
")",
")",
";",
"m_serializationHandler",
".",
"setTransformer",
"(",
"this",
")",
";",
"executeChildTemplates",
"(",
"elem",
",",
"true",
")",
";",
"}",
"catch",
"(",
"TransformerException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"SAXException",
"se",
")",
"{",
"throw",
"new",
"TransformerException",
"(",
"se",
")",
";",
"}",
"finally",
"{",
"m_serializationHandler",
"=",
"savedHandler",
";",
"}",
"}"
] | Execute each of the children of a template element.
@param elem The ElemTemplateElement that contains the children
that should execute.
@param handler The ContentHandler to where the result events
should be fed.
@throws TransformerException
@xsl.usage advanced | [
"Execute",
"each",
"of",
"the",
"children",
"of",
"a",
"template",
"element",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java#L2255-L2291 |
m-m-m/util | validation/src/main/java/net/sf/mmm/util/validation/base/ValidatorJsr303.java | ValidatorJsr303.createValidationFailure | protected ValidationFailure createValidationFailure(ConstraintViolation<?> violation, Object valueSource) {
"""
Creates a {@link ValidationFailure} for the given {@link ConstraintViolation}.
@param violation is the {@link ConstraintViolation}.
@param valueSource is the source of the value. May be {@code null}.
@return the created {@link ValidationFailure}.
"""
String code = violation.getConstraintDescriptor().getAnnotation().annotationType().getSimpleName();
return new ValidationFailureImpl(code, valueSource, violation.getMessage());
} | java | protected ValidationFailure createValidationFailure(ConstraintViolation<?> violation, Object valueSource) {
String code = violation.getConstraintDescriptor().getAnnotation().annotationType().getSimpleName();
return new ValidationFailureImpl(code, valueSource, violation.getMessage());
} | [
"protected",
"ValidationFailure",
"createValidationFailure",
"(",
"ConstraintViolation",
"<",
"?",
">",
"violation",
",",
"Object",
"valueSource",
")",
"{",
"String",
"code",
"=",
"violation",
".",
"getConstraintDescriptor",
"(",
")",
".",
"getAnnotation",
"(",
")",
".",
"annotationType",
"(",
")",
".",
"getSimpleName",
"(",
")",
";",
"return",
"new",
"ValidationFailureImpl",
"(",
"code",
",",
"valueSource",
",",
"violation",
".",
"getMessage",
"(",
")",
")",
";",
"}"
] | Creates a {@link ValidationFailure} for the given {@link ConstraintViolation}.
@param violation is the {@link ConstraintViolation}.
@param valueSource is the source of the value. May be {@code null}.
@return the created {@link ValidationFailure}. | [
"Creates",
"a",
"{",
"@link",
"ValidationFailure",
"}",
"for",
"the",
"given",
"{",
"@link",
"ConstraintViolation",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/validation/src/main/java/net/sf/mmm/util/validation/base/ValidatorJsr303.java#L226-L230 |
aalmiray/Json-lib | extensions/spring/src/main/java/net/sf/json/spring/web/servlet/view/JsonView.java | JsonView.createJSON | protected JSON createJSON( Map model, HttpServletRequest request, HttpServletResponse response ) {
"""
Creates a JSON [JSONObject,JSONArray,JSONNUll] from the model values.
"""
return defaultCreateJSON( model );
} | java | protected JSON createJSON( Map model, HttpServletRequest request, HttpServletResponse response ) {
return defaultCreateJSON( model );
} | [
"protected",
"JSON",
"createJSON",
"(",
"Map",
"model",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"{",
"return",
"defaultCreateJSON",
"(",
"model",
")",
";",
"}"
] | Creates a JSON [JSONObject,JSONArray,JSONNUll] from the model values. | [
"Creates",
"a",
"JSON",
"[",
"JSONObject",
"JSONArray",
"JSONNUll",
"]",
"from",
"the",
"model",
"values",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/extensions/spring/src/main/java/net/sf/json/spring/web/servlet/view/JsonView.java#L117-L119 |
LevelFourAB/commons | commons-io/src/main/java/se/l4/commons/io/BytesBuilder.java | BytesBuilder.addChunk | public BytesBuilder addChunk(@NonNull byte[] buffer, int offset, int length) {
"""
Add a chunk of data to the {@link Bytes} instance.
@param buffer
byte data to add
@param offset
offset to start adding byte data from
@param length
the length of the data to add
"""
Objects.requireNonNull(buffer);
out.write(buffer, offset, length);
return this;
} | java | public BytesBuilder addChunk(@NonNull byte[] buffer, int offset, int length)
{
Objects.requireNonNull(buffer);
out.write(buffer, offset, length);
return this;
} | [
"public",
"BytesBuilder",
"addChunk",
"(",
"@",
"NonNull",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"buffer",
")",
";",
"out",
".",
"write",
"(",
"buffer",
",",
"offset",
",",
"length",
")",
";",
"return",
"this",
";",
"}"
] | Add a chunk of data to the {@link Bytes} instance.
@param buffer
byte data to add
@param offset
offset to start adding byte data from
@param length
the length of the data to add | [
"Add",
"a",
"chunk",
"of",
"data",
"to",
"the",
"{",
"@link",
"Bytes",
"}",
"instance",
"."
] | train | https://github.com/LevelFourAB/commons/blob/aa121b3a5504b43d0c10450a1b984694fcd2b8ee/commons-io/src/main/java/se/l4/commons/io/BytesBuilder.java#L46-L52 |
spring-projects/spring-social | spring-social-core/src/main/java/org/springframework/social/connect/support/AbstractConnection.java | AbstractConnection.initKey | protected void initKey(String providerId, String providerUserId) {
"""
Hook that should be called by subclasses to initialize the key property when establishing a new connection.
@param providerId the providerId
@param providerUserId the providerUserId
"""
if (providerUserId == null) {
providerUserId = setValues().providerUserId;
}
key = new ConnectionKey(providerId, providerUserId);
} | java | protected void initKey(String providerId, String providerUserId) {
if (providerUserId == null) {
providerUserId = setValues().providerUserId;
}
key = new ConnectionKey(providerId, providerUserId);
} | [
"protected",
"void",
"initKey",
"(",
"String",
"providerId",
",",
"String",
"providerUserId",
")",
"{",
"if",
"(",
"providerUserId",
"==",
"null",
")",
"{",
"providerUserId",
"=",
"setValues",
"(",
")",
".",
"providerUserId",
";",
"}",
"key",
"=",
"new",
"ConnectionKey",
"(",
"providerId",
",",
"providerUserId",
")",
";",
"}"
] | Hook that should be called by subclasses to initialize the key property when establishing a new connection.
@param providerId the providerId
@param providerUserId the providerUserId | [
"Hook",
"that",
"should",
"be",
"called",
"by",
"subclasses",
"to",
"initialize",
"the",
"key",
"property",
"when",
"establishing",
"a",
"new",
"connection",
"."
] | train | https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-core/src/main/java/org/springframework/social/connect/support/AbstractConnection.java#L135-L140 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.setStaticQuiet | public MethodHandle setStaticQuiet(MethodHandles.Lookup lookup, Class<?> target, String name) {
"""
Apply the chain of transforms and bind them to an object field assignment specified
using the end signature plus the given class and name. The end signature must take
the target class or a subclass and the field's type as its arguments, and its return
type must be compatible with void.
If the final handle's type does not exactly match the initial type for
this Binder, an additional cast will be attempted.
This version is "quiet" in that it throws an unchecked InvalidTransformException
if the target method does not exist or is inaccessible.
@param lookup the MethodHandles.Lookup to use to look up the field
@param target the class in which the field is defined
@param name the field's name
@return the full handle chain, bound to the given field assignment
"""
try {
return setStatic(lookup, target, name);
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new InvalidTransformException(e);
}
} | java | public MethodHandle setStaticQuiet(MethodHandles.Lookup lookup, Class<?> target, String name) {
try {
return setStatic(lookup, target, name);
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new InvalidTransformException(e);
}
} | [
"public",
"MethodHandle",
"setStaticQuiet",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"Class",
"<",
"?",
">",
"target",
",",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"setStatic",
"(",
"lookup",
",",
"target",
",",
"name",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"NoSuchFieldException",
"e",
")",
"{",
"throw",
"new",
"InvalidTransformException",
"(",
"e",
")",
";",
"}",
"}"
] | Apply the chain of transforms and bind them to an object field assignment specified
using the end signature plus the given class and name. The end signature must take
the target class or a subclass and the field's type as its arguments, and its return
type must be compatible with void.
If the final handle's type does not exactly match the initial type for
this Binder, an additional cast will be attempted.
This version is "quiet" in that it throws an unchecked InvalidTransformException
if the target method does not exist or is inaccessible.
@param lookup the MethodHandles.Lookup to use to look up the field
@param target the class in which the field is defined
@param name the field's name
@return the full handle chain, bound to the given field assignment | [
"Apply",
"the",
"chain",
"of",
"transforms",
"and",
"bind",
"them",
"to",
"an",
"object",
"field",
"assignment",
"specified",
"using",
"the",
"end",
"signature",
"plus",
"the",
"given",
"class",
"and",
"name",
".",
"The",
"end",
"signature",
"must",
"take",
"the",
"target",
"class",
"or",
"a",
"subclass",
"and",
"the",
"field",
"s",
"type",
"as",
"its",
"arguments",
"and",
"its",
"return",
"type",
"must",
"be",
"compatible",
"with",
"void",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1540-L1546 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/products/SwapAnnuity.java | SwapAnnuity.getSwapAnnuity | public static RandomVariable getSwapAnnuity(Schedule schedule, ForwardCurveInterface forwardCurve) {
"""
Function to calculate an (idealized) single curve swap annuity for a given schedule and forward curve.
The discount curve used to calculate the annuity is calculated from the forward curve using classical
single curve interpretations of forwards and a default period length. The may be a crude approximation.
Note: This method will consider evaluationTime being 0, see {@link net.finmath.marketdata2.products.SwapAnnuity#getSwapAnnuity(double, Schedule, DiscountCurveInterface, AnalyticModel)}.
@param schedule The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period.
@param forwardCurve The forward curve.
@return The swap annuity.
"""
DiscountCurveInterface discountCurve = new DiscountCurveFromForwardCurve(forwardCurve.getName());
double evaluationTime = 0.0; // Consider only payment time > 0
return getSwapAnnuity(evaluationTime, schedule, discountCurve, new AnalyticModelFromCurvesAndVols( new Curve[] {forwardCurve, discountCurve} ));
} | java | public static RandomVariable getSwapAnnuity(Schedule schedule, ForwardCurveInterface forwardCurve) {
DiscountCurveInterface discountCurve = new DiscountCurveFromForwardCurve(forwardCurve.getName());
double evaluationTime = 0.0; // Consider only payment time > 0
return getSwapAnnuity(evaluationTime, schedule, discountCurve, new AnalyticModelFromCurvesAndVols( new Curve[] {forwardCurve, discountCurve} ));
} | [
"public",
"static",
"RandomVariable",
"getSwapAnnuity",
"(",
"Schedule",
"schedule",
",",
"ForwardCurveInterface",
"forwardCurve",
")",
"{",
"DiscountCurveInterface",
"discountCurve",
"=",
"new",
"DiscountCurveFromForwardCurve",
"(",
"forwardCurve",
".",
"getName",
"(",
")",
")",
";",
"double",
"evaluationTime",
"=",
"0.0",
";",
"// Consider only payment time > 0",
"return",
"getSwapAnnuity",
"(",
"evaluationTime",
",",
"schedule",
",",
"discountCurve",
",",
"new",
"AnalyticModelFromCurvesAndVols",
"(",
"new",
"Curve",
"[",
"]",
"{",
"forwardCurve",
",",
"discountCurve",
"}",
")",
")",
";",
"}"
] | Function to calculate an (idealized) single curve swap annuity for a given schedule and forward curve.
The discount curve used to calculate the annuity is calculated from the forward curve using classical
single curve interpretations of forwards and a default period length. The may be a crude approximation.
Note: This method will consider evaluationTime being 0, see {@link net.finmath.marketdata2.products.SwapAnnuity#getSwapAnnuity(double, Schedule, DiscountCurveInterface, AnalyticModel)}.
@param schedule The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period.
@param forwardCurve The forward curve.
@return The swap annuity. | [
"Function",
"to",
"calculate",
"an",
"(",
"idealized",
")",
"single",
"curve",
"swap",
"annuity",
"for",
"a",
"given",
"schedule",
"and",
"forward",
"curve",
".",
"The",
"discount",
"curve",
"used",
"to",
"calculate",
"the",
"annuity",
"is",
"calculated",
"from",
"the",
"forward",
"curve",
"using",
"classical",
"single",
"curve",
"interpretations",
"of",
"forwards",
"and",
"a",
"default",
"period",
"length",
".",
"The",
"may",
"be",
"a",
"crude",
"approximation",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/products/SwapAnnuity.java#L101-L105 |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java | FineUploader5Session.addParam | @Nonnull
public FineUploader5Session addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue) {
"""
Any parameters you would like passed with the associated GET request to
your server.
@param sKey
Parameter name
@param sValue
Parameter value
@return this
"""
ValueEnforcer.notEmpty (sKey, "Key");
ValueEnforcer.notNull (sValue, "Value");
m_aSessionParams.put (sKey, sValue);
return this;
} | java | @Nonnull
public FineUploader5Session addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue)
{
ValueEnforcer.notEmpty (sKey, "Key");
ValueEnforcer.notNull (sValue, "Value");
m_aSessionParams.put (sKey, sValue);
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Session",
"addParam",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sKey",
",",
"@",
"Nonnull",
"final",
"String",
"sValue",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sKey",
",",
"\"Key\"",
")",
";",
"ValueEnforcer",
".",
"notNull",
"(",
"sValue",
",",
"\"Value\"",
")",
";",
"m_aSessionParams",
".",
"put",
"(",
"sKey",
",",
"sValue",
")",
";",
"return",
"this",
";",
"}"
] | Any parameters you would like passed with the associated GET request to
your server.
@param sKey
Parameter name
@param sValue
Parameter value
@return this | [
"Any",
"parameters",
"you",
"would",
"like",
"passed",
"with",
"the",
"associated",
"GET",
"request",
"to",
"your",
"server",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java#L176-L184 |
khipu/lib-java | src/main/java/com/khipu/lib/java/Khipu.java | Khipu.getPaymentButton | public static String getPaymentButton(int receiverId, String secret, String email, String bankId, String subject, String body, int amount, Date expiresDate, String notifyUrl, String returnUrl, String cancelUrl, String pictureUrl, String custom, String transactionId, String button) {
"""
Entrega un String que contiene un botón de pago que dirije a khipu.
@param receiverId id de cobrador
@param secret llave de cobrador
@param email correo del pagador. Este correo aparecerá pre-configurado en
la página de pago (opcional).
@param bankId el identificador del banco para hacer el pago.
@param subject asunto del cobro. Con un máximo de 255 caracteres.
@param body la descripción del cobro (opcional).
@param amount el monto del cobro.
@param expiresDate la fecha de expiración para pagar.
@param notifyUrl la dirección de tu web service que utilizará khipu para
notificarte de un pago realizado (opcional).
@param returnUrl la dirección URL a donde enviar al cliente una vez que el pago
sea realizado (opcional).
@param cancelUrl la dirección URL a donde enviar al cliente si se arrepiente de
hacer la transacción (opcional)
@param pictureUrl una dirección URL de una foto de tu producto o servicio para
mostrar en la página del cobro (opcional).
@param custom variable para enviar información personalizada de la
transacción (opcional).
@param transactionId variable disponible para enviar un identificador propio de la
transacción (opcional).
@param button imagen del botón de pago.
@return el servicio para crear botones de pago
@since 2013-05-24
"""
StringBuilder builder = new StringBuilder();
builder.append("<form action=\"" + API_URL + CREATE_PAYMENT_PAGE_ENDPOINT + "\" method=\"post\">\n");
builder.append("<input type=\"hidden\" name=\"receiver_id\" value=\"").append(receiverId).append("\">\n");
builder.append("<input type=\"hidden\" name=\"subject\" value=\"").append(subject != null ? subject : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"body\" value=\"").append(body != null ? body : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"amount\" value=\"").append(amount).append("\">\n");
builder.append("<input type=\"hidden\" name=\"expires_date\" value=\"").append(expiresDate != null ? expiresDate.getTime() / 1000 : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"notify_url\" value=\"").append(notifyUrl != null ? notifyUrl : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"return_url\" value=\"").append(returnUrl != null ? returnUrl : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"cancel_url\" value=\"").append(cancelUrl != null ? cancelUrl : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"custom\" value=\"").append(custom != null ? custom : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"transaction_id\" value=\"").append(transactionId != null ? transactionId : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"payer_email\" value=\"").append(email != null ? email : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"bank_id\" value=\"").append(bankId != null ? bankId : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"picture_url\" value=\"").append(pictureUrl != null ? pictureUrl : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"hash\" value=\"").append(KhipuService.HmacSHA256(secret, getConcatenated(receiverId, email, bankId, subject, body, amount, expiresDate, notifyUrl, returnUrl, cancelUrl, pictureUrl, custom, transactionId))).append("\">\n");
builder.append("<input type=\"image\" name=\"submit\" src=\"" + AMAZON_IMAGES_URL).append(button).append("\"/>");
builder.append("</form>");
return builder.toString();
} | java | public static String getPaymentButton(int receiverId, String secret, String email, String bankId, String subject, String body, int amount, Date expiresDate, String notifyUrl, String returnUrl, String cancelUrl, String pictureUrl, String custom, String transactionId, String button) {
StringBuilder builder = new StringBuilder();
builder.append("<form action=\"" + API_URL + CREATE_PAYMENT_PAGE_ENDPOINT + "\" method=\"post\">\n");
builder.append("<input type=\"hidden\" name=\"receiver_id\" value=\"").append(receiverId).append("\">\n");
builder.append("<input type=\"hidden\" name=\"subject\" value=\"").append(subject != null ? subject : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"body\" value=\"").append(body != null ? body : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"amount\" value=\"").append(amount).append("\">\n");
builder.append("<input type=\"hidden\" name=\"expires_date\" value=\"").append(expiresDate != null ? expiresDate.getTime() / 1000 : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"notify_url\" value=\"").append(notifyUrl != null ? notifyUrl : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"return_url\" value=\"").append(returnUrl != null ? returnUrl : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"cancel_url\" value=\"").append(cancelUrl != null ? cancelUrl : "").append("\"/>\n");
builder.append("<input type=\"hidden\" name=\"custom\" value=\"").append(custom != null ? custom : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"transaction_id\" value=\"").append(transactionId != null ? transactionId : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"payer_email\" value=\"").append(email != null ? email : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"bank_id\" value=\"").append(bankId != null ? bankId : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"picture_url\" value=\"").append(pictureUrl != null ? pictureUrl : "").append("\">\n");
builder.append("<input type=\"hidden\" name=\"hash\" value=\"").append(KhipuService.HmacSHA256(secret, getConcatenated(receiverId, email, bankId, subject, body, amount, expiresDate, notifyUrl, returnUrl, cancelUrl, pictureUrl, custom, transactionId))).append("\">\n");
builder.append("<input type=\"image\" name=\"submit\" src=\"" + AMAZON_IMAGES_URL).append(button).append("\"/>");
builder.append("</form>");
return builder.toString();
} | [
"public",
"static",
"String",
"getPaymentButton",
"(",
"int",
"receiverId",
",",
"String",
"secret",
",",
"String",
"email",
",",
"String",
"bankId",
",",
"String",
"subject",
",",
"String",
"body",
",",
"int",
"amount",
",",
"Date",
"expiresDate",
",",
"String",
"notifyUrl",
",",
"String",
"returnUrl",
",",
"String",
"cancelUrl",
",",
"String",
"pictureUrl",
",",
"String",
"custom",
",",
"String",
"transactionId",
",",
"String",
"button",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"<form action=\\\"\"",
"+",
"API_URL",
"+",
"CREATE_PAYMENT_PAGE_ENDPOINT",
"+",
"\"\\\" method=\\\"post\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"receiver_id\\\" value=\\\"\"",
")",
".",
"append",
"(",
"receiverId",
")",
".",
"append",
"(",
"\"\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"subject\\\" value=\\\"\"",
")",
".",
"append",
"(",
"subject",
"!=",
"null",
"?",
"subject",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\"/>\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"body\\\" value=\\\"\"",
")",
".",
"append",
"(",
"body",
"!=",
"null",
"?",
"body",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"amount\\\" value=\\\"\"",
")",
".",
"append",
"(",
"amount",
")",
".",
"append",
"(",
"\"\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"expires_date\\\" value=\\\"\"",
")",
".",
"append",
"(",
"expiresDate",
"!=",
"null",
"?",
"expiresDate",
".",
"getTime",
"(",
")",
"/",
"1000",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\"/>\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"notify_url\\\" value=\\\"\"",
")",
".",
"append",
"(",
"notifyUrl",
"!=",
"null",
"?",
"notifyUrl",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\"/>\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"return_url\\\" value=\\\"\"",
")",
".",
"append",
"(",
"returnUrl",
"!=",
"null",
"?",
"returnUrl",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\"/>\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"cancel_url\\\" value=\\\"\"",
")",
".",
"append",
"(",
"cancelUrl",
"!=",
"null",
"?",
"cancelUrl",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\"/>\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"custom\\\" value=\\\"\"",
")",
".",
"append",
"(",
"custom",
"!=",
"null",
"?",
"custom",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"transaction_id\\\" value=\\\"\"",
")",
".",
"append",
"(",
"transactionId",
"!=",
"null",
"?",
"transactionId",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"payer_email\\\" value=\\\"\"",
")",
".",
"append",
"(",
"email",
"!=",
"null",
"?",
"email",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"bank_id\\\" value=\\\"\"",
")",
".",
"append",
"(",
"bankId",
"!=",
"null",
"?",
"bankId",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"picture_url\\\" value=\\\"\"",
")",
".",
"append",
"(",
"pictureUrl",
"!=",
"null",
"?",
"pictureUrl",
":",
"\"\"",
")",
".",
"append",
"(",
"\"\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"hidden\\\" name=\\\"hash\\\" value=\\\"\"",
")",
".",
"append",
"(",
"KhipuService",
".",
"HmacSHA256",
"(",
"secret",
",",
"getConcatenated",
"(",
"receiverId",
",",
"email",
",",
"bankId",
",",
"subject",
",",
"body",
",",
"amount",
",",
"expiresDate",
",",
"notifyUrl",
",",
"returnUrl",
",",
"cancelUrl",
",",
"pictureUrl",
",",
"custom",
",",
"transactionId",
")",
")",
")",
".",
"append",
"(",
"\"\\\">\\n\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<input type=\\\"image\\\" name=\\\"submit\\\" src=\\\"\"",
"+",
"AMAZON_IMAGES_URL",
")",
".",
"append",
"(",
"button",
")",
".",
"append",
"(",
"\"\\\"/>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"</form>\"",
")",
";",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] | Entrega un String que contiene un botón de pago que dirije a khipu.
@param receiverId id de cobrador
@param secret llave de cobrador
@param email correo del pagador. Este correo aparecerá pre-configurado en
la página de pago (opcional).
@param bankId el identificador del banco para hacer el pago.
@param subject asunto del cobro. Con un máximo de 255 caracteres.
@param body la descripción del cobro (opcional).
@param amount el monto del cobro.
@param expiresDate la fecha de expiración para pagar.
@param notifyUrl la dirección de tu web service que utilizará khipu para
notificarte de un pago realizado (opcional).
@param returnUrl la dirección URL a donde enviar al cliente una vez que el pago
sea realizado (opcional).
@param cancelUrl la dirección URL a donde enviar al cliente si se arrepiente de
hacer la transacción (opcional)
@param pictureUrl una dirección URL de una foto de tu producto o servicio para
mostrar en la página del cobro (opcional).
@param custom variable para enviar información personalizada de la
transacción (opcional).
@param transactionId variable disponible para enviar un identificador propio de la
transacción (opcional).
@param button imagen del botón de pago.
@return el servicio para crear botones de pago
@since 2013-05-24 | [
"Entrega",
"un",
"String",
"que",
"contiene",
"un",
"botón",
"de",
"pago",
"que",
"dirije",
"a",
"khipu",
"."
] | train | https://github.com/khipu/lib-java/blob/7a56476a60c6f5012e13f342c81b5ef9dc2328e6/src/main/java/com/khipu/lib/java/Khipu.java#L214-L234 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.createOrUpdateFirewallRule | public FirewallRuleInner createOrUpdateFirewallRule(String resourceGroupName, String accountName, String name, FirewallRuleInner parameters) {
"""
Creates or updates the specified firewall rule.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account.
@param accountName The name of the Data Lake Store account to which to add the firewall rule.
@param name The name of the firewall rule to create or update.
@param parameters Parameters supplied to create the create firewall rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the FirewallRuleInner object if successful.
"""
return createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, accountName, name, parameters).toBlocking().single().body();
} | java | public FirewallRuleInner createOrUpdateFirewallRule(String resourceGroupName, String accountName, String name, FirewallRuleInner parameters) {
return createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, accountName, name, parameters).toBlocking().single().body();
} | [
"public",
"FirewallRuleInner",
"createOrUpdateFirewallRule",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"name",
",",
"FirewallRuleInner",
"parameters",
")",
"{",
"return",
"createOrUpdateFirewallRuleWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"name",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates the specified firewall rule.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account.
@param accountName The name of the Data Lake Store account to which to add the firewall rule.
@param name The name of the firewall rule to create or update.
@param parameters Parameters supplied to create the create firewall rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the FirewallRuleInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"specified",
"firewall",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L460-L462 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.relativeQuadTo | public SVGPath relativeQuadTo(double[] c1xy, double[] xy) {
"""
Quadratic Bezier line to the given relative coordinates.
@param c1xy first control point
@param xy new coordinates
@return path object, for compact syntax.
"""
return append(PATH_QUAD_TO_RELATIVE).append(c1xy[0]).append(c1xy[1]).append(xy[0]).append(xy[1]);
} | java | public SVGPath relativeQuadTo(double[] c1xy, double[] xy) {
return append(PATH_QUAD_TO_RELATIVE).append(c1xy[0]).append(c1xy[1]).append(xy[0]).append(xy[1]);
} | [
"public",
"SVGPath",
"relativeQuadTo",
"(",
"double",
"[",
"]",
"c1xy",
",",
"double",
"[",
"]",
"xy",
")",
"{",
"return",
"append",
"(",
"PATH_QUAD_TO_RELATIVE",
")",
".",
"append",
"(",
"c1xy",
"[",
"0",
"]",
")",
".",
"append",
"(",
"c1xy",
"[",
"1",
"]",
")",
".",
"append",
"(",
"xy",
"[",
"0",
"]",
")",
".",
"append",
"(",
"xy",
"[",
"1",
"]",
")",
";",
"}"
] | Quadratic Bezier line to the given relative coordinates.
@param c1xy first control point
@param xy new coordinates
@return path object, for compact syntax. | [
"Quadratic",
"Bezier",
"line",
"to",
"the",
"given",
"relative",
"coordinates",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L492-L494 |
aws/aws-sdk-java | aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/Step.java | Step.withScreenshots | public Step withScreenshots(java.util.Map<String, String> screenshots) {
"""
<p>
List of screenshot Urls for the execution step, if relevant.
</p>
@param screenshots
List of screenshot Urls for the execution step, if relevant.
@return Returns a reference to this object so that method calls can be chained together.
"""
setScreenshots(screenshots);
return this;
} | java | public Step withScreenshots(java.util.Map<String, String> screenshots) {
setScreenshots(screenshots);
return this;
} | [
"public",
"Step",
"withScreenshots",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"screenshots",
")",
"{",
"setScreenshots",
"(",
"screenshots",
")",
";",
"return",
"this",
";",
"}"
] | <p>
List of screenshot Urls for the execution step, if relevant.
</p>
@param screenshots
List of screenshot Urls for the execution step, if relevant.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"List",
"of",
"screenshot",
"Urls",
"for",
"the",
"execution",
"step",
"if",
"relevant",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/Step.java#L367-L370 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/RegExUtils.java | RegExUtils.removeAll | public static String removeAll(final String text, final Pattern regex) {
"""
<p>Removes each substring of the text String that matches the given regular expression pattern.</p>
This method is a {@code null} safe equivalent to:
<ul>
<li>{@code pattern.matcher(text).replaceAll(StringUtils.EMPTY)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>
StringUtils.removeAll(null, *) = null
StringUtils.removeAll("any", (Pattern) null) = "any"
StringUtils.removeAll("any", Pattern.compile("")) = "any"
StringUtils.removeAll("any", Pattern.compile(".*")) = ""
StringUtils.removeAll("any", Pattern.compile(".+")) = ""
StringUtils.removeAll("abc", Pattern.compile(".?")) = ""
StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\nB"
StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>", Pattern.DOTALL)) = "AB"
StringUtils.removeAll("ABCabc123abc", Pattern.compile("[a-z]")) = "ABC123"
</pre>
@param text text to remove from, may be null
@param regex the regular expression to which this string is to be matched
@return the text with any removes processed,
{@code null} if null String input
@see #replaceAll(String, Pattern, String)
@see java.util.regex.Matcher#replaceAll(String)
@see java.util.regex.Pattern
"""
return replaceAll(text, regex, StringUtils.EMPTY);
} | java | public static String removeAll(final String text, final Pattern regex) {
return replaceAll(text, regex, StringUtils.EMPTY);
} | [
"public",
"static",
"String",
"removeAll",
"(",
"final",
"String",
"text",
",",
"final",
"Pattern",
"regex",
")",
"{",
"return",
"replaceAll",
"(",
"text",
",",
"regex",
",",
"StringUtils",
".",
"EMPTY",
")",
";",
"}"
] | <p>Removes each substring of the text String that matches the given regular expression pattern.</p>
This method is a {@code null} safe equivalent to:
<ul>
<li>{@code pattern.matcher(text).replaceAll(StringUtils.EMPTY)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>
StringUtils.removeAll(null, *) = null
StringUtils.removeAll("any", (Pattern) null) = "any"
StringUtils.removeAll("any", Pattern.compile("")) = "any"
StringUtils.removeAll("any", Pattern.compile(".*")) = ""
StringUtils.removeAll("any", Pattern.compile(".+")) = ""
StringUtils.removeAll("abc", Pattern.compile(".?")) = ""
StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\nB"
StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>", Pattern.DOTALL)) = "AB"
StringUtils.removeAll("ABCabc123abc", Pattern.compile("[a-z]")) = "ABC123"
</pre>
@param text text to remove from, may be null
@param regex the regular expression to which this string is to be matched
@return the text with any removes processed,
{@code null} if null String input
@see #replaceAll(String, Pattern, String)
@see java.util.regex.Matcher#replaceAll(String)
@see java.util.regex.Pattern | [
"<p",
">",
"Removes",
"each",
"substring",
"of",
"the",
"text",
"String",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"pattern",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/RegExUtils.java#L60-L62 |
qspin/qtaste | kernel/src/main/java/com/qspin/qtaste/tcom/jmx/impl/JMXAgent.java | JMXAgent.sendNotification | public synchronized void sendNotification(PropertyChangeEvent pEvt) {
"""
Send a JMX notification of a property change event
@param pEvt a property change event
"""
String oldValue = pEvt.getOldValue() == null ? "null" : pEvt.getOldValue().toString();
String newValue = pEvt.getNewValue() == null ? "null" : pEvt.getNewValue().toString();
String sourceName = pEvt.getSource().getClass().getCanonicalName();
String message = sourceName + ":" + pEvt.getPropertyName() + " changed from " + oldValue + " to " + newValue;
Notification n = new AttributeChangeNotification(sourceName, notifSequenceNumber++, System.currentTimeMillis(), message,
pEvt.getPropertyName(), "java.lang.String", oldValue, newValue);
sendNotification(n);
logger.trace("Sent notification: " + message);
} | java | public synchronized void sendNotification(PropertyChangeEvent pEvt) {
String oldValue = pEvt.getOldValue() == null ? "null" : pEvt.getOldValue().toString();
String newValue = pEvt.getNewValue() == null ? "null" : pEvt.getNewValue().toString();
String sourceName = pEvt.getSource().getClass().getCanonicalName();
String message = sourceName + ":" + pEvt.getPropertyName() + " changed from " + oldValue + " to " + newValue;
Notification n = new AttributeChangeNotification(sourceName, notifSequenceNumber++, System.currentTimeMillis(), message,
pEvt.getPropertyName(), "java.lang.String", oldValue, newValue);
sendNotification(n);
logger.trace("Sent notification: " + message);
} | [
"public",
"synchronized",
"void",
"sendNotification",
"(",
"PropertyChangeEvent",
"pEvt",
")",
"{",
"String",
"oldValue",
"=",
"pEvt",
".",
"getOldValue",
"(",
")",
"==",
"null",
"?",
"\"null\"",
":",
"pEvt",
".",
"getOldValue",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"newValue",
"=",
"pEvt",
".",
"getNewValue",
"(",
")",
"==",
"null",
"?",
"\"null\"",
":",
"pEvt",
".",
"getNewValue",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"sourceName",
"=",
"pEvt",
".",
"getSource",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
";",
"String",
"message",
"=",
"sourceName",
"+",
"\":\"",
"+",
"pEvt",
".",
"getPropertyName",
"(",
")",
"+",
"\" changed from \"",
"+",
"oldValue",
"+",
"\" to \"",
"+",
"newValue",
";",
"Notification",
"n",
"=",
"new",
"AttributeChangeNotification",
"(",
"sourceName",
",",
"notifSequenceNumber",
"++",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
",",
"message",
",",
"pEvt",
".",
"getPropertyName",
"(",
")",
",",
"\"java.lang.String\"",
",",
"oldValue",
",",
"newValue",
")",
";",
"sendNotification",
"(",
"n",
")",
";",
"logger",
".",
"trace",
"(",
"\"Sent notification: \"",
"+",
"message",
")",
";",
"}"
] | Send a JMX notification of a property change event
@param pEvt a property change event | [
"Send",
"a",
"JMX",
"notification",
"of",
"a",
"property",
"change",
"event"
] | train | https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/tcom/jmx/impl/JMXAgent.java#L101-L110 |
VoltDB/voltdb | src/frontend/org/voltdb/planner/microoptimizations/MakeInsertNodesInlineIfPossible.java | MakeInsertNodesInlineIfPossible.recursivelyApply | private AbstractPlanNode recursivelyApply(AbstractPlanNode plan, int childIdx) {
"""
This helper function is called when we recurse down the childIdx-th
child of a parent node.
@param plan
@param parentIdx
@return
"""
// If this is an insert plan node, then try to
// inline it. There will only ever by one insert
// node, so if we can't inline it we just return the
// given plan.
if (plan instanceof InsertPlanNode) {
InsertPlanNode insertNode = (InsertPlanNode)plan;
assert(insertNode.getChildCount() == 1);
AbstractPlanNode abstractChild = insertNode.getChild(0);
ScanPlanNodeWhichCanHaveInlineInsert targetNode
= (abstractChild instanceof ScanPlanNodeWhichCanHaveInlineInsert)
? ((ScanPlanNodeWhichCanHaveInlineInsert)abstractChild)
: null;
// If we have a sequential/index scan node without an inline aggregate
// node then we can inline the insert node.
if ( targetNode != null
&& ! insertNode.isUpsert()
&& ! targetNode.hasInlineAggregateNode()
// If INSERT INTO and SELECT FROM have the same target table name,
// then it could be a recursive insert into select.
// Currently, our scan executor implementations cannot handle it well. (ENG-13036)
&& ! targetNode.getTargetTableName().equalsIgnoreCase(insertNode.getTargetTableName()) ) {
AbstractPlanNode parent = (insertNode.getParentCount() > 0) ? insertNode.getParent(0) : null;
AbstractPlanNode abstractTargetNode = targetNode.getAbstractNode();
abstractTargetNode.addInlinePlanNode(insertNode);
// Don't call removeFromGraph. That
// screws up the order of the children.
insertNode.clearChildren();
insertNode.clearParents();
// Remvoe all the abstractTarget node's parents.
// It used to be the insertNode, which is now
// dead to us.
abstractTargetNode.clearParents();
if (parent != null) {
parent.setAndLinkChild(childIdx, abstractTargetNode);
}
plan = abstractTargetNode;
}
return plan;
}
for (int idx = 0; idx < plan.getChildCount(); idx += 1) {
AbstractPlanNode child = plan.getChild(idx);
recursivelyApply(child, idx);
}
return plan;
} | java | private AbstractPlanNode recursivelyApply(AbstractPlanNode plan, int childIdx) {
// If this is an insert plan node, then try to
// inline it. There will only ever by one insert
// node, so if we can't inline it we just return the
// given plan.
if (plan instanceof InsertPlanNode) {
InsertPlanNode insertNode = (InsertPlanNode)plan;
assert(insertNode.getChildCount() == 1);
AbstractPlanNode abstractChild = insertNode.getChild(0);
ScanPlanNodeWhichCanHaveInlineInsert targetNode
= (abstractChild instanceof ScanPlanNodeWhichCanHaveInlineInsert)
? ((ScanPlanNodeWhichCanHaveInlineInsert)abstractChild)
: null;
// If we have a sequential/index scan node without an inline aggregate
// node then we can inline the insert node.
if ( targetNode != null
&& ! insertNode.isUpsert()
&& ! targetNode.hasInlineAggregateNode()
// If INSERT INTO and SELECT FROM have the same target table name,
// then it could be a recursive insert into select.
// Currently, our scan executor implementations cannot handle it well. (ENG-13036)
&& ! targetNode.getTargetTableName().equalsIgnoreCase(insertNode.getTargetTableName()) ) {
AbstractPlanNode parent = (insertNode.getParentCount() > 0) ? insertNode.getParent(0) : null;
AbstractPlanNode abstractTargetNode = targetNode.getAbstractNode();
abstractTargetNode.addInlinePlanNode(insertNode);
// Don't call removeFromGraph. That
// screws up the order of the children.
insertNode.clearChildren();
insertNode.clearParents();
// Remvoe all the abstractTarget node's parents.
// It used to be the insertNode, which is now
// dead to us.
abstractTargetNode.clearParents();
if (parent != null) {
parent.setAndLinkChild(childIdx, abstractTargetNode);
}
plan = abstractTargetNode;
}
return plan;
}
for (int idx = 0; idx < plan.getChildCount(); idx += 1) {
AbstractPlanNode child = plan.getChild(idx);
recursivelyApply(child, idx);
}
return plan;
} | [
"private",
"AbstractPlanNode",
"recursivelyApply",
"(",
"AbstractPlanNode",
"plan",
",",
"int",
"childIdx",
")",
"{",
"// If this is an insert plan node, then try to",
"// inline it. There will only ever by one insert",
"// node, so if we can't inline it we just return the",
"// given plan.",
"if",
"(",
"plan",
"instanceof",
"InsertPlanNode",
")",
"{",
"InsertPlanNode",
"insertNode",
"=",
"(",
"InsertPlanNode",
")",
"plan",
";",
"assert",
"(",
"insertNode",
".",
"getChildCount",
"(",
")",
"==",
"1",
")",
";",
"AbstractPlanNode",
"abstractChild",
"=",
"insertNode",
".",
"getChild",
"(",
"0",
")",
";",
"ScanPlanNodeWhichCanHaveInlineInsert",
"targetNode",
"=",
"(",
"abstractChild",
"instanceof",
"ScanPlanNodeWhichCanHaveInlineInsert",
")",
"?",
"(",
"(",
"ScanPlanNodeWhichCanHaveInlineInsert",
")",
"abstractChild",
")",
":",
"null",
";",
"// If we have a sequential/index scan node without an inline aggregate",
"// node then we can inline the insert node.",
"if",
"(",
"targetNode",
"!=",
"null",
"&&",
"!",
"insertNode",
".",
"isUpsert",
"(",
")",
"&&",
"!",
"targetNode",
".",
"hasInlineAggregateNode",
"(",
")",
"// If INSERT INTO and SELECT FROM have the same target table name,",
"// then it could be a recursive insert into select.",
"// Currently, our scan executor implementations cannot handle it well. (ENG-13036)",
"&&",
"!",
"targetNode",
".",
"getTargetTableName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"insertNode",
".",
"getTargetTableName",
"(",
")",
")",
")",
"{",
"AbstractPlanNode",
"parent",
"=",
"(",
"insertNode",
".",
"getParentCount",
"(",
")",
">",
"0",
")",
"?",
"insertNode",
".",
"getParent",
"(",
"0",
")",
":",
"null",
";",
"AbstractPlanNode",
"abstractTargetNode",
"=",
"targetNode",
".",
"getAbstractNode",
"(",
")",
";",
"abstractTargetNode",
".",
"addInlinePlanNode",
"(",
"insertNode",
")",
";",
"// Don't call removeFromGraph. That",
"// screws up the order of the children.",
"insertNode",
".",
"clearChildren",
"(",
")",
";",
"insertNode",
".",
"clearParents",
"(",
")",
";",
"// Remvoe all the abstractTarget node's parents.",
"// It used to be the insertNode, which is now",
"// dead to us.",
"abstractTargetNode",
".",
"clearParents",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"parent",
".",
"setAndLinkChild",
"(",
"childIdx",
",",
"abstractTargetNode",
")",
";",
"}",
"plan",
"=",
"abstractTargetNode",
";",
"}",
"return",
"plan",
";",
"}",
"for",
"(",
"int",
"idx",
"=",
"0",
";",
"idx",
"<",
"plan",
".",
"getChildCount",
"(",
")",
";",
"idx",
"+=",
"1",
")",
"{",
"AbstractPlanNode",
"child",
"=",
"plan",
".",
"getChild",
"(",
"idx",
")",
";",
"recursivelyApply",
"(",
"child",
",",
"idx",
")",
";",
"}",
"return",
"plan",
";",
"}"
] | This helper function is called when we recurse down the childIdx-th
child of a parent node.
@param plan
@param parentIdx
@return | [
"This",
"helper",
"function",
"is",
"called",
"when",
"we",
"recurse",
"down",
"the",
"childIdx",
"-",
"th",
"child",
"of",
"a",
"parent",
"node",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/microoptimizations/MakeInsertNodesInlineIfPossible.java#L38-L83 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.queryTransactionByID | public TransactionInfo queryTransactionByID(Collection<Peer> peers, String txID, User userContext) throws ProposalException, InvalidArgumentException {
"""
Query for a Fabric Transaction given its transactionID
@param txID the ID of the transaction
@param peers the peers to try to send the request.
@param userContext the user context
@return a {@link TransactionInfo}
@throws ProposalException
@throws InvalidArgumentException
"""
checkChannelState();
checkPeers(peers);
User.userContextCheck(userContext);
if (txID == null) {
throw new InvalidArgumentException("TxID parameter is null.");
}
TransactionInfo transactionInfo;
try {
logger.debug("queryTransactionByID with txID " + txID + "\n from peer " + " on channel " + name);
QuerySCCRequest querySCCRequest = new QuerySCCRequest(userContext);
querySCCRequest.setFcn(QuerySCCRequest.GETTRANSACTIONBYID);
querySCCRequest.setArgs(name, txID);
ProposalResponse proposalResponse = sendProposalSerially(querySCCRequest, peers);
return new TransactionInfo(txID, ProcessedTransaction.parseFrom(proposalResponse.getProposalResponse().getResponse().getPayload()));
} catch (Exception e) {
logger.error(e);
throw new ProposalException(e);
}
} | java | public TransactionInfo queryTransactionByID(Collection<Peer> peers, String txID, User userContext) throws ProposalException, InvalidArgumentException {
checkChannelState();
checkPeers(peers);
User.userContextCheck(userContext);
if (txID == null) {
throw new InvalidArgumentException("TxID parameter is null.");
}
TransactionInfo transactionInfo;
try {
logger.debug("queryTransactionByID with txID " + txID + "\n from peer " + " on channel " + name);
QuerySCCRequest querySCCRequest = new QuerySCCRequest(userContext);
querySCCRequest.setFcn(QuerySCCRequest.GETTRANSACTIONBYID);
querySCCRequest.setArgs(name, txID);
ProposalResponse proposalResponse = sendProposalSerially(querySCCRequest, peers);
return new TransactionInfo(txID, ProcessedTransaction.parseFrom(proposalResponse.getProposalResponse().getResponse().getPayload()));
} catch (Exception e) {
logger.error(e);
throw new ProposalException(e);
}
} | [
"public",
"TransactionInfo",
"queryTransactionByID",
"(",
"Collection",
"<",
"Peer",
">",
"peers",
",",
"String",
"txID",
",",
"User",
"userContext",
")",
"throws",
"ProposalException",
",",
"InvalidArgumentException",
"{",
"checkChannelState",
"(",
")",
";",
"checkPeers",
"(",
"peers",
")",
";",
"User",
".",
"userContextCheck",
"(",
"userContext",
")",
";",
"if",
"(",
"txID",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"TxID parameter is null.\"",
")",
";",
"}",
"TransactionInfo",
"transactionInfo",
";",
"try",
"{",
"logger",
".",
"debug",
"(",
"\"queryTransactionByID with txID \"",
"+",
"txID",
"+",
"\"\\n from peer \"",
"+",
"\" on channel \"",
"+",
"name",
")",
";",
"QuerySCCRequest",
"querySCCRequest",
"=",
"new",
"QuerySCCRequest",
"(",
"userContext",
")",
";",
"querySCCRequest",
".",
"setFcn",
"(",
"QuerySCCRequest",
".",
"GETTRANSACTIONBYID",
")",
";",
"querySCCRequest",
".",
"setArgs",
"(",
"name",
",",
"txID",
")",
";",
"ProposalResponse",
"proposalResponse",
"=",
"sendProposalSerially",
"(",
"querySCCRequest",
",",
"peers",
")",
";",
"return",
"new",
"TransactionInfo",
"(",
"txID",
",",
"ProcessedTransaction",
".",
"parseFrom",
"(",
"proposalResponse",
".",
"getProposalResponse",
"(",
")",
".",
"getResponse",
"(",
")",
".",
"getPayload",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
")",
";",
"throw",
"new",
"ProposalException",
"(",
"e",
")",
";",
"}",
"}"
] | Query for a Fabric Transaction given its transactionID
@param txID the ID of the transaction
@param peers the peers to try to send the request.
@param userContext the user context
@return a {@link TransactionInfo}
@throws ProposalException
@throws InvalidArgumentException | [
"Query",
"for",
"a",
"Fabric",
"Transaction",
"given",
"its",
"transactionID"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L3224-L3250 |
Jasig/uPortal | uPortal-groups/uPortal-groups-filesystem/src/main/java/org/apereo/portal/groups/filesystem/FileSystemGroupStore.java | FileSystemGroupStore.findParentGroups | protected Iterator findParentGroups(IEntity ent) throws GroupsException {
"""
Returns an <code>Iterator</code> over the <code>Collection</code> of <code>IEntityGroups
</code> that the <code>IEntity</code> belongs to.
@return java.util.Iterator
@param ent org.apereo.portal.groups.IEntityGroup
"""
if (log.isDebugEnabled()) log.debug(DEBUG_CLASS_NAME + ".findParentGroups(): for " + ent);
List groups = new ArrayList();
File root = getFileRoot(ent.getType());
if (root != null) {
File[] files = getAllFilesBelow(root);
try {
for (int i = 0; i < files.length; i++) {
Collection ids = getEntityIdsFromFile(files[i]);
if (ids.contains(ent.getKey())) {
groups.add(find(files[i]));
}
}
} catch (IOException ex) {
throw new GroupsException("Problem reading group files", ex);
}
}
return groups.iterator();
} | java | protected Iterator findParentGroups(IEntity ent) throws GroupsException {
if (log.isDebugEnabled()) log.debug(DEBUG_CLASS_NAME + ".findParentGroups(): for " + ent);
List groups = new ArrayList();
File root = getFileRoot(ent.getType());
if (root != null) {
File[] files = getAllFilesBelow(root);
try {
for (int i = 0; i < files.length; i++) {
Collection ids = getEntityIdsFromFile(files[i]);
if (ids.contains(ent.getKey())) {
groups.add(find(files[i]));
}
}
} catch (IOException ex) {
throw new GroupsException("Problem reading group files", ex);
}
}
return groups.iterator();
} | [
"protected",
"Iterator",
"findParentGroups",
"(",
"IEntity",
"ent",
")",
"throws",
"GroupsException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"DEBUG_CLASS_NAME",
"+",
"\".findParentGroups(): for \"",
"+",
"ent",
")",
";",
"List",
"groups",
"=",
"new",
"ArrayList",
"(",
")",
";",
"File",
"root",
"=",
"getFileRoot",
"(",
"ent",
".",
"getType",
"(",
")",
")",
";",
"if",
"(",
"root",
"!=",
"null",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"getAllFilesBelow",
"(",
"root",
")",
";",
"try",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"files",
".",
"length",
";",
"i",
"++",
")",
"{",
"Collection",
"ids",
"=",
"getEntityIdsFromFile",
"(",
"files",
"[",
"i",
"]",
")",
";",
"if",
"(",
"ids",
".",
"contains",
"(",
"ent",
".",
"getKey",
"(",
")",
")",
")",
"{",
"groups",
".",
"add",
"(",
"find",
"(",
"files",
"[",
"i",
"]",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"GroupsException",
"(",
"\"Problem reading group files\"",
",",
"ex",
")",
";",
"}",
"}",
"return",
"groups",
".",
"iterator",
"(",
")",
";",
"}"
] | Returns an <code>Iterator</code> over the <code>Collection</code> of <code>IEntityGroups
</code> that the <code>IEntity</code> belongs to.
@return java.util.Iterator
@param ent org.apereo.portal.groups.IEntityGroup | [
"Returns",
"an",
"<code",
">",
"Iterator<",
"/",
"code",
">",
"over",
"the",
"<code",
">",
"Collection<",
"/",
"code",
">",
"of",
"<code",
">",
"IEntityGroups",
"<",
"/",
"code",
">",
"that",
"the",
"<code",
">",
"IEntity<",
"/",
"code",
">",
"belongs",
"to",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-filesystem/src/main/java/org/apereo/portal/groups/filesystem/FileSystemGroupStore.java#L279-L300 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/PasswordNullifier.java | PasswordNullifier.nullify | public static String nullify(String value, byte delimiter) {
"""
Scan the input value for the "password=" and "client_secret=" key markers
and convert the password value to a series of *s. The delimiter value
can be used if the search string is a sequence like
"key=value<delim>key2=value2".
@param value
@param delimiter
@return String
"""
// check to see if we need to null out passwords
if (null == value) {
return null;
}
String source = value.toLowerCase();
StringBuilder b = new StringBuilder(value);
boolean modified = optionallyMaskChars(b, source, delimiter, PASSWORD_PATTERN);
modified = optionallyMaskChars(b, source, delimiter, CLIENT_SECRET_PATTERN) || modified;
if (modified) {
return b.toString();
}
return value;
} | java | public static String nullify(String value, byte delimiter) {
// check to see if we need to null out passwords
if (null == value) {
return null;
}
String source = value.toLowerCase();
StringBuilder b = new StringBuilder(value);
boolean modified = optionallyMaskChars(b, source, delimiter, PASSWORD_PATTERN);
modified = optionallyMaskChars(b, source, delimiter, CLIENT_SECRET_PATTERN) || modified;
if (modified) {
return b.toString();
}
return value;
} | [
"public",
"static",
"String",
"nullify",
"(",
"String",
"value",
",",
"byte",
"delimiter",
")",
"{",
"// check to see if we need to null out passwords",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"return",
"null",
";",
"}",
"String",
"source",
"=",
"value",
".",
"toLowerCase",
"(",
")",
";",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
"value",
")",
";",
"boolean",
"modified",
"=",
"optionallyMaskChars",
"(",
"b",
",",
"source",
",",
"delimiter",
",",
"PASSWORD_PATTERN",
")",
";",
"modified",
"=",
"optionallyMaskChars",
"(",
"b",
",",
"source",
",",
"delimiter",
",",
"CLIENT_SECRET_PATTERN",
")",
"||",
"modified",
";",
"if",
"(",
"modified",
")",
"{",
"return",
"b",
".",
"toString",
"(",
")",
";",
"}",
"return",
"value",
";",
"}"
] | Scan the input value for the "password=" and "client_secret=" key markers
and convert the password value to a series of *s. The delimiter value
can be used if the search string is a sequence like
"key=value<delim>key2=value2".
@param value
@param delimiter
@return String | [
"Scan",
"the",
"input",
"value",
"for",
"the",
"password",
"=",
"and",
"client_secret",
"=",
"key",
"markers",
"and",
"convert",
"the",
"password",
"value",
"to",
"a",
"series",
"of",
"*",
"s",
".",
"The",
"delimiter",
"value",
"can",
"be",
"used",
"if",
"the",
"search",
"string",
"is",
"a",
"sequence",
"like",
"key",
"=",
"value<delim",
">",
"key2",
"=",
"value2",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/PasswordNullifier.java#L45-L60 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutMethodResponseRequest.java | PutMethodResponseRequest.withResponseModels | public PutMethodResponseRequest withResponseModels(java.util.Map<String, String> responseModels) {
"""
<p>
Specifies the <a>Model</a> resources used for the response's content type. Response models are represented as a
key/value map, with a content type as the key and a <a>Model</a> name as the value.
</p>
@param responseModels
Specifies the <a>Model</a> resources used for the response's content type. Response models are represented
as a key/value map, with a content type as the key and a <a>Model</a> name as the value.
@return Returns a reference to this object so that method calls can be chained together.
"""
setResponseModels(responseModels);
return this;
} | java | public PutMethodResponseRequest withResponseModels(java.util.Map<String, String> responseModels) {
setResponseModels(responseModels);
return this;
} | [
"public",
"PutMethodResponseRequest",
"withResponseModels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseModels",
")",
"{",
"setResponseModels",
"(",
"responseModels",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Specifies the <a>Model</a> resources used for the response's content type. Response models are represented as a
key/value map, with a content type as the key and a <a>Model</a> name as the value.
</p>
@param responseModels
Specifies the <a>Model</a> resources used for the response's content type. Response models are represented
as a key/value map, with a content type as the key and a <a>Model</a> name as the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Specifies",
"the",
"<a",
">",
"Model<",
"/",
"a",
">",
"resources",
"used",
"for",
"the",
"response",
"s",
"content",
"type",
".",
"Response",
"models",
"are",
"represented",
"as",
"a",
"key",
"/",
"value",
"map",
"with",
"a",
"content",
"type",
"as",
"the",
"key",
"and",
"a",
"<a",
">",
"Model<",
"/",
"a",
">",
"name",
"as",
"the",
"value",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutMethodResponseRequest.java#L387-L390 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java | SARLReentrantTypeResolver.getSarlCapacityFieldType | protected LightweightTypeReference getSarlCapacityFieldType(IResolvedTypes resolvedTypes, JvmField field) {
"""
Replies the type of the field that represents a SARL capacity buffer.
@param resolvedTypes the resolver of types.
@param field the field.
@return the type, never {@code null}.
"""
// For capacity call redirection
LightweightTypeReference fieldType = resolvedTypes.getActualType(field);
final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field,
ImportedCapacityFeature.class);
if (capacityAnnotation != null) {
final JvmTypeReference ref = ((JvmTypeAnnotationValue) capacityAnnotation.getValues().get(0)).getValues().get(0);
fieldType = resolvedTypes.getActualType(ref.getType());
}
return fieldType;
} | java | protected LightweightTypeReference getSarlCapacityFieldType(IResolvedTypes resolvedTypes, JvmField field) {
// For capacity call redirection
LightweightTypeReference fieldType = resolvedTypes.getActualType(field);
final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field,
ImportedCapacityFeature.class);
if (capacityAnnotation != null) {
final JvmTypeReference ref = ((JvmTypeAnnotationValue) capacityAnnotation.getValues().get(0)).getValues().get(0);
fieldType = resolvedTypes.getActualType(ref.getType());
}
return fieldType;
} | [
"protected",
"LightweightTypeReference",
"getSarlCapacityFieldType",
"(",
"IResolvedTypes",
"resolvedTypes",
",",
"JvmField",
"field",
")",
"{",
"// For capacity call redirection",
"LightweightTypeReference",
"fieldType",
"=",
"resolvedTypes",
".",
"getActualType",
"(",
"field",
")",
";",
"final",
"JvmAnnotationReference",
"capacityAnnotation",
"=",
"this",
".",
"annotationLookup",
".",
"findAnnotation",
"(",
"field",
",",
"ImportedCapacityFeature",
".",
"class",
")",
";",
"if",
"(",
"capacityAnnotation",
"!=",
"null",
")",
"{",
"final",
"JvmTypeReference",
"ref",
"=",
"(",
"(",
"JvmTypeAnnotationValue",
")",
"capacityAnnotation",
".",
"getValues",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
".",
"getValues",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"fieldType",
"=",
"resolvedTypes",
".",
"getActualType",
"(",
"ref",
".",
"getType",
"(",
")",
")",
";",
"}",
"return",
"fieldType",
";",
"}"
] | Replies the type of the field that represents a SARL capacity buffer.
@param resolvedTypes the resolver of types.
@param field the field.
@return the type, never {@code null}. | [
"Replies",
"the",
"type",
"of",
"the",
"field",
"that",
"represents",
"a",
"SARL",
"capacity",
"buffer",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java#L143-L153 |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/ClassUtils.java | ClassUtils.getInstance | public static <T> T getInstance(String className, ClassLoader loader) {
"""
获取class实例
@param className class名字
@param loader 加载class的classloader
@param <T> class类型
@return class的实例
"""
return getInstance(loadClass(className, loader));
} | java | public static <T> T getInstance(String className, ClassLoader loader) {
return getInstance(loadClass(className, loader));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getInstance",
"(",
"String",
"className",
",",
"ClassLoader",
"loader",
")",
"{",
"return",
"getInstance",
"(",
"loadClass",
"(",
"className",
",",
"loader",
")",
")",
";",
"}"
] | 获取class实例
@param className class名字
@param loader 加载class的classloader
@param <T> class类型
@return class的实例 | [
"获取class实例"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/ClassUtils.java#L125-L127 |
QNJR-GROUP/EasyTransaction | easytrans-demo/rpc-dubbo/rpcdubbo-order-service/src/main/java/com/yiqiniu/easytrans/demos/order/impl/OrderApplication.java | OrderApplication.dubboConsumerCustomizationer | @Bean
public DubboReferanceCustomizationer dubboConsumerCustomizationer() {
"""
This is an optional bean, you can modify Dubbo reference here to change the behavior of consumer
@return
"""
return new DubboReferanceCustomizationer() {
@Override
public void customDubboReferance(String appId, String busCode, ReferenceConfig<GenericService> referenceConfig) {
Logger logger = LoggerFactory.getLogger(getClass());
logger.info("custom dubbo consumer!");
}
};
} | java | @Bean
public DubboReferanceCustomizationer dubboConsumerCustomizationer() {
return new DubboReferanceCustomizationer() {
@Override
public void customDubboReferance(String appId, String busCode, ReferenceConfig<GenericService> referenceConfig) {
Logger logger = LoggerFactory.getLogger(getClass());
logger.info("custom dubbo consumer!");
}
};
} | [
"@",
"Bean",
"public",
"DubboReferanceCustomizationer",
"dubboConsumerCustomizationer",
"(",
")",
"{",
"return",
"new",
"DubboReferanceCustomizationer",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"customDubboReferance",
"(",
"String",
"appId",
",",
"String",
"busCode",
",",
"ReferenceConfig",
"<",
"GenericService",
">",
"referenceConfig",
")",
"{",
"Logger",
"logger",
"=",
"LoggerFactory",
".",
"getLogger",
"(",
"getClass",
"(",
")",
")",
";",
"logger",
".",
"info",
"(",
"\"custom dubbo consumer!\"",
")",
";",
"}",
"}",
";",
"}"
] | This is an optional bean, you can modify Dubbo reference here to change the behavior of consumer
@return | [
"This",
"is",
"an",
"optional",
"bean",
"you",
"can",
"modify",
"Dubbo",
"reference",
"here",
"to",
"change",
"the",
"behavior",
"of",
"consumer"
] | train | https://github.com/QNJR-GROUP/EasyTransaction/blob/53b031724a3fd1145f32b9a7b5c6fb8138d6a426/easytrans-demo/rpc-dubbo/rpcdubbo-order-service/src/main/java/com/yiqiniu/easytrans/demos/order/impl/OrderApplication.java#L30-L40 |
jboss-integration/fuse-bxms-integ | quickstarts/switchyard-rules-interview-dtable/src/main/java/org/switchyard/quickstarts/rules/interview/Transformers.java | Transformers.transformVerifyToApplicant | @Transformer(from = " {
"""
Transform verify to applicant.
@param e the e
@return the applicant
"""urn:switchyard-quickstart:rules-interview-dtable:0.1.0}verify")
public Applicant transformVerifyToApplicant(Element e) {
String name = getElementValue(e, "name");
int age = Integer.valueOf(getElementValue(e, "age")).intValue();
return new Applicant(name, age);
} | java | @Transformer(from = "{urn:switchyard-quickstart:rules-interview-dtable:0.1.0}verify")
public Applicant transformVerifyToApplicant(Element e) {
String name = getElementValue(e, "name");
int age = Integer.valueOf(getElementValue(e, "age")).intValue();
return new Applicant(name, age);
} | [
"@",
"Transformer",
"(",
"from",
"=",
"\"{urn:switchyard-quickstart:rules-interview-dtable:0.1.0}verify\"",
")",
"public",
"Applicant",
"transformVerifyToApplicant",
"(",
"Element",
"e",
")",
"{",
"String",
"name",
"=",
"getElementValue",
"(",
"e",
",",
"\"name\"",
")",
";",
"int",
"age",
"=",
"Integer",
".",
"valueOf",
"(",
"getElementValue",
"(",
"e",
",",
"\"age\"",
")",
")",
".",
"intValue",
"(",
")",
";",
"return",
"new",
"Applicant",
"(",
"name",
",",
"age",
")",
";",
"}"
] | Transform verify to applicant.
@param e the e
@return the applicant | [
"Transform",
"verify",
"to",
"applicant",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/quickstarts/switchyard-rules-interview-dtable/src/main/java/org/switchyard/quickstarts/rules/interview/Transformers.java#L46-L51 |
networknt/light-rest-4j | openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java | ResponseValidator.validateResponseContent | public Status validateResponseContent(Object responseContent, String uri, String httpMethod) {
"""
validate a given response content object with status code "200" and media content type "application/json"
uri, httpMethod, JSON_MEDIA_TYPE("200"), DEFAULT_MEDIA_TYPE("application/json") is to locate the schema to validate
@param responseContent response content needs to be validated
@param uri original uri of the request
@param httpMethod eg. "put" or "get"
@return Status
"""
return validateResponseContent(responseContent, uri, httpMethod, GOOD_STATUS_CODE);
} | java | public Status validateResponseContent(Object responseContent, String uri, String httpMethod) {
return validateResponseContent(responseContent, uri, httpMethod, GOOD_STATUS_CODE);
} | [
"public",
"Status",
"validateResponseContent",
"(",
"Object",
"responseContent",
",",
"String",
"uri",
",",
"String",
"httpMethod",
")",
"{",
"return",
"validateResponseContent",
"(",
"responseContent",
",",
"uri",
",",
"httpMethod",
",",
"GOOD_STATUS_CODE",
")",
";",
"}"
] | validate a given response content object with status code "200" and media content type "application/json"
uri, httpMethod, JSON_MEDIA_TYPE("200"), DEFAULT_MEDIA_TYPE("application/json") is to locate the schema to validate
@param responseContent response content needs to be validated
@param uri original uri of the request
@param httpMethod eg. "put" or "get"
@return Status | [
"validate",
"a",
"given",
"response",
"content",
"object",
"with",
"status",
"code",
"200",
"and",
"media",
"content",
"type",
"application",
"/",
"json",
"uri",
"httpMethod",
"JSON_MEDIA_TYPE",
"(",
"200",
")",
"DEFAULT_MEDIA_TYPE",
"(",
"application",
"/",
"json",
")",
"is",
"to",
"locate",
"the",
"schema",
"to",
"validate"
] | train | https://github.com/networknt/light-rest-4j/blob/06b15128e6101351e617284a636ef5d632e6b1fe/openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java#L67-L69 |
UrielCh/ovh-java-sdk | ovh-java-sdk-clusterhadoop/src/main/java/net/minidev/ovh/api/ApiOvhClusterhadoop.java | ApiOvhClusterhadoop.serviceName_service_restart_POST | public OvhTask serviceName_service_restart_POST(String serviceName, OvhClusterServiceNameEnum service) throws IOException {
"""
Restart a Cloudera Manager service (THIS ACTION WILL RESTART OTHER DEPENDANT SERVICES)
REST: POST /cluster/hadoop/{serviceName}/service/restart
@param service [required] Name of the service to be restarted
@param serviceName [required] The internal name of your cluster
"""
String qPath = "/cluster/hadoop/{serviceName}/service/restart";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "service", service);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_service_restart_POST(String serviceName, OvhClusterServiceNameEnum service) throws IOException {
String qPath = "/cluster/hadoop/{serviceName}/service/restart";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "service", service);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_service_restart_POST",
"(",
"String",
"serviceName",
",",
"OvhClusterServiceNameEnum",
"service",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cluster/hadoop/{serviceName}/service/restart\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"service\"",
",",
"service",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Restart a Cloudera Manager service (THIS ACTION WILL RESTART OTHER DEPENDANT SERVICES)
REST: POST /cluster/hadoop/{serviceName}/service/restart
@param service [required] Name of the service to be restarted
@param serviceName [required] The internal name of your cluster | [
"Restart",
"a",
"Cloudera",
"Manager",
"service",
"(",
"THIS",
"ACTION",
"WILL",
"RESTART",
"OTHER",
"DEPENDANT",
"SERVICES",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-clusterhadoop/src/main/java/net/minidev/ovh/api/ApiOvhClusterhadoop.java#L129-L136 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java | MsgDestEncodingUtilsImpl.initializePropertyMaps | private static void initializePropertyMaps() {
"""
initializePropertyMaps
Initialize the Property Maps which must each contain an entry for every supported
Destination Property which is to be encoded or set via this class.
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "initializePropertyMap");
// Add all the supported properties to the PropertyMaps:
// PR, DM, and TL use the PhantomPropertyCoder as they are encoded/decoded
// separately rather than by using their PropertyCoder.
// They need to be included in the map so that methods can extract information
// and set them.
// Any property with a shortName which maps to null but be added with one of
// the general coders - currently StringPropertyCoder or IntegerPropertyCoder.
// NOTE: If SuppressIfDefaultInJNDI is not null, the LongName MUST match that defined in
// JmsInternalConstants
// Parameters:
// PropertyCoder ( LongName ShortName), IntValue, ValueType , DefaultValue SuppressIfDefaultInJNDI)
addToMaps(new PhantomPropertyCoder (JmsInternalConstants.PRIORITY , PR), PR_INT, Integer.class, Integer.valueOf(Message.DEFAULT_PRIORITY) ,null);
addToMaps(new PhantomPropertyCoder (JmsInternalConstants.DELIVERY_MODE , DM), DM_INT, String.class , ApiJmsConstants.DELIVERY_MODE_APP ,null);
addToMaps(new PhantomPropertyCoder (JmsInternalConstants.TIME_TO_LIVE , TL), TL_INT, Long.class , Long.valueOf(Message.DEFAULT_TIME_TO_LIVE),null);
addToMaps(new ReadAheadCoder ("readAhead" , RA), RA_INT, String.class , ApiJmsConstants.READ_AHEAD_AS_CONNECTION ,null);
addToMaps(new ShortStringPropertyCoder("topicName" , TN), TN_INT, String.class , null ,null);
addToMaps(new ShortStringPropertyCoder("topicSpace" , TS), TS_INT, String.class , JmsTopicImpl.DEFAULT_TOPIC_SPACE ,null);
addToMaps(new ShortStringPropertyCoder("queueName" , QN), QN_INT, String.class , null ,null);
addToMaps(new OnOffPropertyCoder (JmsInternalConstants.SCOPE_TO_LOCAL_QP , QP), QP_INT, String.class , ApiJmsConstants.SCOPE_TO_LOCAL_QP_OFF ,JmsQueueImpl.class);
addToMaps(new OnOffPropertyCoder (JmsInternalConstants.PRODUCER_PREFER_LOCAL, PL), PL_INT, String.class , ApiJmsConstants.PRODUCER_PREFER_LOCAL_ON ,JmsQueueImpl.class);
addToMaps(new OnOffPropertyCoder (JmsInternalConstants.PRODUCER_BIND , PB), PB_INT, String.class , ApiJmsConstants.PRODUCER_BIND_OFF ,JmsQueueImpl.class);
addToMaps(new OnOffPropertyCoder (JmsInternalConstants.GATHER_MESSAGES , GM), GM_INT, String.class , ApiJmsConstants.GATHER_MESSAGES_OFF ,JmsQueueImpl.class);
addToMaps(new StringPropertyCoder (JmsInternalConstants.BUS_NAME , BN), BN_INT, String.class , null ,null);
addToMaps(new IntegerPropertyCoder (JmsInternalConstants.BLOCKED_DESTINATION , BD), BD_INT, Integer.class, null ,null);
addToMaps(new StringPropertyCoder ("destName" , DN), DN_INT, String.class , null ,null);
addToMaps(new StringPropertyCoder ("destDiscrim" , DD), DD_INT, String.class , null ,null);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "propertyMap" + propertyMap);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "reverseMap" + reverseMap);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "initializePropertyMap");
} | java | private static void initializePropertyMaps() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "initializePropertyMap");
// Add all the supported properties to the PropertyMaps:
// PR, DM, and TL use the PhantomPropertyCoder as they are encoded/decoded
// separately rather than by using their PropertyCoder.
// They need to be included in the map so that methods can extract information
// and set them.
// Any property with a shortName which maps to null but be added with one of
// the general coders - currently StringPropertyCoder or IntegerPropertyCoder.
// NOTE: If SuppressIfDefaultInJNDI is not null, the LongName MUST match that defined in
// JmsInternalConstants
// Parameters:
// PropertyCoder ( LongName ShortName), IntValue, ValueType , DefaultValue SuppressIfDefaultInJNDI)
addToMaps(new PhantomPropertyCoder (JmsInternalConstants.PRIORITY , PR), PR_INT, Integer.class, Integer.valueOf(Message.DEFAULT_PRIORITY) ,null);
addToMaps(new PhantomPropertyCoder (JmsInternalConstants.DELIVERY_MODE , DM), DM_INT, String.class , ApiJmsConstants.DELIVERY_MODE_APP ,null);
addToMaps(new PhantomPropertyCoder (JmsInternalConstants.TIME_TO_LIVE , TL), TL_INT, Long.class , Long.valueOf(Message.DEFAULT_TIME_TO_LIVE),null);
addToMaps(new ReadAheadCoder ("readAhead" , RA), RA_INT, String.class , ApiJmsConstants.READ_AHEAD_AS_CONNECTION ,null);
addToMaps(new ShortStringPropertyCoder("topicName" , TN), TN_INT, String.class , null ,null);
addToMaps(new ShortStringPropertyCoder("topicSpace" , TS), TS_INT, String.class , JmsTopicImpl.DEFAULT_TOPIC_SPACE ,null);
addToMaps(new ShortStringPropertyCoder("queueName" , QN), QN_INT, String.class , null ,null);
addToMaps(new OnOffPropertyCoder (JmsInternalConstants.SCOPE_TO_LOCAL_QP , QP), QP_INT, String.class , ApiJmsConstants.SCOPE_TO_LOCAL_QP_OFF ,JmsQueueImpl.class);
addToMaps(new OnOffPropertyCoder (JmsInternalConstants.PRODUCER_PREFER_LOCAL, PL), PL_INT, String.class , ApiJmsConstants.PRODUCER_PREFER_LOCAL_ON ,JmsQueueImpl.class);
addToMaps(new OnOffPropertyCoder (JmsInternalConstants.PRODUCER_BIND , PB), PB_INT, String.class , ApiJmsConstants.PRODUCER_BIND_OFF ,JmsQueueImpl.class);
addToMaps(new OnOffPropertyCoder (JmsInternalConstants.GATHER_MESSAGES , GM), GM_INT, String.class , ApiJmsConstants.GATHER_MESSAGES_OFF ,JmsQueueImpl.class);
addToMaps(new StringPropertyCoder (JmsInternalConstants.BUS_NAME , BN), BN_INT, String.class , null ,null);
addToMaps(new IntegerPropertyCoder (JmsInternalConstants.BLOCKED_DESTINATION , BD), BD_INT, Integer.class, null ,null);
addToMaps(new StringPropertyCoder ("destName" , DN), DN_INT, String.class , null ,null);
addToMaps(new StringPropertyCoder ("destDiscrim" , DD), DD_INT, String.class , null ,null);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "propertyMap" + propertyMap);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "reverseMap" + reverseMap);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "initializePropertyMap");
} | [
"private",
"static",
"void",
"initializePropertyMaps",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"initializePropertyMap\"",
")",
";",
"// Add all the supported properties to the PropertyMaps:",
"// PR, DM, and TL use the PhantomPropertyCoder as they are encoded/decoded",
"// separately rather than by using their PropertyCoder.",
"// They need to be included in the map so that methods can extract information",
"// and set them.",
"// Any property with a shortName which maps to null but be added with one of",
"// the general coders - currently StringPropertyCoder or IntegerPropertyCoder.",
"// NOTE: If SuppressIfDefaultInJNDI is not null, the LongName MUST match that defined in",
"// JmsInternalConstants",
"// Parameters:",
"// PropertyCoder ( LongName ShortName), IntValue, ValueType , DefaultValue SuppressIfDefaultInJNDI)",
"addToMaps",
"(",
"new",
"PhantomPropertyCoder",
"(",
"JmsInternalConstants",
".",
"PRIORITY",
",",
"PR",
")",
",",
"PR_INT",
",",
"Integer",
".",
"class",
",",
"Integer",
".",
"valueOf",
"(",
"Message",
".",
"DEFAULT_PRIORITY",
")",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"PhantomPropertyCoder",
"(",
"JmsInternalConstants",
".",
"DELIVERY_MODE",
",",
"DM",
")",
",",
"DM_INT",
",",
"String",
".",
"class",
",",
"ApiJmsConstants",
".",
"DELIVERY_MODE_APP",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"PhantomPropertyCoder",
"(",
"JmsInternalConstants",
".",
"TIME_TO_LIVE",
",",
"TL",
")",
",",
"TL_INT",
",",
"Long",
".",
"class",
",",
"Long",
".",
"valueOf",
"(",
"Message",
".",
"DEFAULT_TIME_TO_LIVE",
")",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"ReadAheadCoder",
"(",
"\"readAhead\"",
",",
"RA",
")",
",",
"RA_INT",
",",
"String",
".",
"class",
",",
"ApiJmsConstants",
".",
"READ_AHEAD_AS_CONNECTION",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"ShortStringPropertyCoder",
"(",
"\"topicName\"",
",",
"TN",
")",
",",
"TN_INT",
",",
"String",
".",
"class",
",",
"null",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"ShortStringPropertyCoder",
"(",
"\"topicSpace\"",
",",
"TS",
")",
",",
"TS_INT",
",",
"String",
".",
"class",
",",
"JmsTopicImpl",
".",
"DEFAULT_TOPIC_SPACE",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"ShortStringPropertyCoder",
"(",
"\"queueName\"",
",",
"QN",
")",
",",
"QN_INT",
",",
"String",
".",
"class",
",",
"null",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"OnOffPropertyCoder",
"(",
"JmsInternalConstants",
".",
"SCOPE_TO_LOCAL_QP",
",",
"QP",
")",
",",
"QP_INT",
",",
"String",
".",
"class",
",",
"ApiJmsConstants",
".",
"SCOPE_TO_LOCAL_QP_OFF",
",",
"JmsQueueImpl",
".",
"class",
")",
";",
"addToMaps",
"(",
"new",
"OnOffPropertyCoder",
"(",
"JmsInternalConstants",
".",
"PRODUCER_PREFER_LOCAL",
",",
"PL",
")",
",",
"PL_INT",
",",
"String",
".",
"class",
",",
"ApiJmsConstants",
".",
"PRODUCER_PREFER_LOCAL_ON",
",",
"JmsQueueImpl",
".",
"class",
")",
";",
"addToMaps",
"(",
"new",
"OnOffPropertyCoder",
"(",
"JmsInternalConstants",
".",
"PRODUCER_BIND",
",",
"PB",
")",
",",
"PB_INT",
",",
"String",
".",
"class",
",",
"ApiJmsConstants",
".",
"PRODUCER_BIND_OFF",
",",
"JmsQueueImpl",
".",
"class",
")",
";",
"addToMaps",
"(",
"new",
"OnOffPropertyCoder",
"(",
"JmsInternalConstants",
".",
"GATHER_MESSAGES",
",",
"GM",
")",
",",
"GM_INT",
",",
"String",
".",
"class",
",",
"ApiJmsConstants",
".",
"GATHER_MESSAGES_OFF",
",",
"JmsQueueImpl",
".",
"class",
")",
";",
"addToMaps",
"(",
"new",
"StringPropertyCoder",
"(",
"JmsInternalConstants",
".",
"BUS_NAME",
",",
"BN",
")",
",",
"BN_INT",
",",
"String",
".",
"class",
",",
"null",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"IntegerPropertyCoder",
"(",
"JmsInternalConstants",
".",
"BLOCKED_DESTINATION",
",",
"BD",
")",
",",
"BD_INT",
",",
"Integer",
".",
"class",
",",
"null",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"StringPropertyCoder",
"(",
"\"destName\"",
",",
"DN",
")",
",",
"DN_INT",
",",
"String",
".",
"class",
",",
"null",
",",
"null",
")",
";",
"addToMaps",
"(",
"new",
"StringPropertyCoder",
"(",
"\"destDiscrim\"",
",",
"DD",
")",
",",
"DD_INT",
",",
"String",
".",
"class",
",",
"null",
",",
"null",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"propertyMap\"",
"+",
"propertyMap",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"reverseMap\"",
"+",
"reverseMap",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"initializePropertyMap\"",
")",
";",
"}"
] | initializePropertyMaps
Initialize the Property Maps which must each contain an entry for every supported
Destination Property which is to be encoded or set via this class. | [
"initializePropertyMaps",
"Initialize",
"the",
"Property",
"Maps",
"which",
"must",
"each",
"contain",
"an",
"entry",
"for",
"every",
"supported",
"Destination",
"Property",
"which",
"is",
"to",
"be",
"encoded",
"or",
"set",
"via",
"this",
"class",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L427-L460 |
wuman/orientdb-android | object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java | OObjectDatabaseTx.newInstance | public <RET extends Object> RET newInstance(final String iClassName, final Object iEnclosingClass, Object... iArgs) {
"""
Create a new POJO by its class name. Assure to have called the registerEntityClasses() declaring the packages that are part of
entity classes.
@see OEntityManager.registerEntityClasses(String)
"""
checkSecurity(ODatabaseSecurityResources.CLASS, ORole.PERMISSION_CREATE, iClassName);
try {
RET enhanced = (RET) OObjectEntityEnhancer.getInstance().getProxiedInstance(entityManager.getEntityClass(iClassName),
iEnclosingClass, underlying.newInstance(iClassName), iArgs);
return (RET) enhanced;
} catch (Exception e) {
OLogManager.instance().error(this, "Error on creating object of class " + iClassName, e, ODatabaseException.class);
}
return null;
} | java | public <RET extends Object> RET newInstance(final String iClassName, final Object iEnclosingClass, Object... iArgs) {
checkSecurity(ODatabaseSecurityResources.CLASS, ORole.PERMISSION_CREATE, iClassName);
try {
RET enhanced = (RET) OObjectEntityEnhancer.getInstance().getProxiedInstance(entityManager.getEntityClass(iClassName),
iEnclosingClass, underlying.newInstance(iClassName), iArgs);
return (RET) enhanced;
} catch (Exception e) {
OLogManager.instance().error(this, "Error on creating object of class " + iClassName, e, ODatabaseException.class);
}
return null;
} | [
"public",
"<",
"RET",
"extends",
"Object",
">",
"RET",
"newInstance",
"(",
"final",
"String",
"iClassName",
",",
"final",
"Object",
"iEnclosingClass",
",",
"Object",
"...",
"iArgs",
")",
"{",
"checkSecurity",
"(",
"ODatabaseSecurityResources",
".",
"CLASS",
",",
"ORole",
".",
"PERMISSION_CREATE",
",",
"iClassName",
")",
";",
"try",
"{",
"RET",
"enhanced",
"=",
"(",
"RET",
")",
"OObjectEntityEnhancer",
".",
"getInstance",
"(",
")",
".",
"getProxiedInstance",
"(",
"entityManager",
".",
"getEntityClass",
"(",
"iClassName",
")",
",",
"iEnclosingClass",
",",
"underlying",
".",
"newInstance",
"(",
"iClassName",
")",
",",
"iArgs",
")",
";",
"return",
"(",
"RET",
")",
"enhanced",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"OLogManager",
".",
"instance",
"(",
")",
".",
"error",
"(",
"this",
",",
"\"Error on creating object of class \"",
"+",
"iClassName",
",",
"e",
",",
"ODatabaseException",
".",
"class",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Create a new POJO by its class name. Assure to have called the registerEntityClasses() declaring the packages that are part of
entity classes.
@see OEntityManager.registerEntityClasses(String) | [
"Create",
"a",
"new",
"POJO",
"by",
"its",
"class",
"name",
".",
"Assure",
"to",
"have",
"called",
"the",
"registerEntityClasses",
"()",
"declaring",
"the",
"packages",
"that",
"are",
"part",
"of",
"entity",
"classes",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java#L110-L121 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java | JsHdrsImpl.setFlagValue | private final void setFlagValue(byte flagBit, boolean value) {
"""
Set the boolean 'value' of one of the flags in the FLAGS field of th message.
@param flagBit A byte with a single bit set on, marking the position
of the required flag.
@param value true if the required flag is to be set on, otherwise false
"""
if (value) {
flags = (byte) (getFlags() | flagBit);
}
else {
flags = (byte) (getFlags() & (~flagBit));
}
} | java | private final void setFlagValue(byte flagBit, boolean value) {
if (value) {
flags = (byte) (getFlags() | flagBit);
}
else {
flags = (byte) (getFlags() & (~flagBit));
}
} | [
"private",
"final",
"void",
"setFlagValue",
"(",
"byte",
"flagBit",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"value",
")",
"{",
"flags",
"=",
"(",
"byte",
")",
"(",
"getFlags",
"(",
")",
"|",
"flagBit",
")",
";",
"}",
"else",
"{",
"flags",
"=",
"(",
"byte",
")",
"(",
"getFlags",
"(",
")",
"&",
"(",
"~",
"flagBit",
")",
")",
";",
"}",
"}"
] | Set the boolean 'value' of one of the flags in the FLAGS field of th message.
@param flagBit A byte with a single bit set on, marking the position
of the required flag.
@param value true if the required flag is to be set on, otherwise false | [
"Set",
"the",
"boolean",
"value",
"of",
"one",
"of",
"the",
"flags",
"in",
"the",
"FLAGS",
"field",
"of",
"th",
"message",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java#L2572-L2579 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java | UnicodeSet.spanBack | public int spanBack(CharSequence s, SpanCondition spanCondition) {
"""
Span a string backwards (from the end) using this UnicodeSet.
<p>To replace, count elements, or delete spans, see {@link android.icu.text.UnicodeSetSpanner UnicodeSetSpanner}.
@param s The string to be spanned
@param spanCondition The span condition
@return The string index which starts the span (i.e. inclusive).
"""
return spanBack(s, s.length(), spanCondition);
} | java | public int spanBack(CharSequence s, SpanCondition spanCondition) {
return spanBack(s, s.length(), spanCondition);
} | [
"public",
"int",
"spanBack",
"(",
"CharSequence",
"s",
",",
"SpanCondition",
"spanCondition",
")",
"{",
"return",
"spanBack",
"(",
"s",
",",
"s",
".",
"length",
"(",
")",
",",
"spanCondition",
")",
";",
"}"
] | Span a string backwards (from the end) using this UnicodeSet.
<p>To replace, count elements, or delete spans, see {@link android.icu.text.UnicodeSetSpanner UnicodeSetSpanner}.
@param s The string to be spanned
@param spanCondition The span condition
@return The string index which starts the span (i.e. inclusive). | [
"Span",
"a",
"string",
"backwards",
"(",
"from",
"the",
"end",
")",
"using",
"this",
"UnicodeSet",
".",
"<p",
">",
"To",
"replace",
"count",
"elements",
"or",
"delete",
"spans",
"see",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L4061-L4063 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsNotification.java | CmsNotification.sendDeferred | public void sendDeferred(final Type type, final String message) {
"""
Sends a new notification after all other events have been processed.<p>
@param type the notification type
@param message the message
"""
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
/**
* @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute()
*/
public void execute() {
send(type, message);
}
});
} | java | public void sendDeferred(final Type type, final String message) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
/**
* @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute()
*/
public void execute() {
send(type, message);
}
});
} | [
"public",
"void",
"sendDeferred",
"(",
"final",
"Type",
"type",
",",
"final",
"String",
"message",
")",
"{",
"Scheduler",
".",
"get",
"(",
")",
".",
"scheduleDeferred",
"(",
"new",
"ScheduledCommand",
"(",
")",
"{",
"/**\n * @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute()\n */",
"public",
"void",
"execute",
"(",
")",
"{",
"send",
"(",
"type",
",",
"message",
")",
";",
"}",
"}",
")",
";",
"}"
] | Sends a new notification after all other events have been processed.<p>
@param type the notification type
@param message the message | [
"Sends",
"a",
"new",
"notification",
"after",
"all",
"other",
"events",
"have",
"been",
"processed",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsNotification.java#L207-L220 |
httl/httl | httl/src/main/java/httl/Engine.java | Engine.getTemplate | public Template getTemplate(String name, Object args) throws IOException, ParseException {
"""
Get template.
@param name - template name
@return template instance
@throws IOException - If an I/O error occurs
@throws ParseException - If the template cannot be parsed
@see #getEngine()
"""
if (args instanceof String)
return getTemplate(name, (String) args);
if (args instanceof Locale)
return getTemplate(name, (Locale) args);
return getTemplate(name, null, null, args);
} | java | public Template getTemplate(String name, Object args) throws IOException, ParseException {
if (args instanceof String)
return getTemplate(name, (String) args);
if (args instanceof Locale)
return getTemplate(name, (Locale) args);
return getTemplate(name, null, null, args);
} | [
"public",
"Template",
"getTemplate",
"(",
"String",
"name",
",",
"Object",
"args",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"if",
"(",
"args",
"instanceof",
"String",
")",
"return",
"getTemplate",
"(",
"name",
",",
"(",
"String",
")",
"args",
")",
";",
"if",
"(",
"args",
"instanceof",
"Locale",
")",
"return",
"getTemplate",
"(",
"name",
",",
"(",
"Locale",
")",
"args",
")",
";",
"return",
"getTemplate",
"(",
"name",
",",
"null",
",",
"null",
",",
"args",
")",
";",
"}"
] | Get template.
@param name - template name
@return template instance
@throws IOException - If an I/O error occurs
@throws ParseException - If the template cannot be parsed
@see #getEngine() | [
"Get",
"template",
"."
] | train | https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/Engine.java#L369-L375 |
aggregateknowledge/java-hll | src/main/java/net/agkn/hll/util/HLLUtil.java | HLLUtil.largeEstimator | public static double largeEstimator(final int log2m, final int registerSizeInBits, final double estimator) {
"""
The "large range correction" formula from the HyperLogLog algorithm, adapted
for 64 bit hashes. Only appropriate for estimators whose value exceeds
the return of {@link #largeEstimatorCutoff(int, int)}.
@param log2m log-base-2 of the number of registers in the HLL. <em>b<em> in the paper.
@param registerSizeInBits the size of the HLL registers, in bits.
@param estimator the original estimator ("E" in the paper).
@return a corrected cardinality estimate.
@see <a href='http://research.neustar.biz/2013/01/24/hyperloglog-googles-take-on-engineering-hll/'>Blog post with section on 64 bit hashes and "large range correction"</a>
"""
final double twoToL = TWO_TO_L[(REG_WIDTH_INDEX_MULTIPLIER * registerSizeInBits) + log2m];
return -1 * twoToL * Math.log(1.0 - (estimator/twoToL));
} | java | public static double largeEstimator(final int log2m, final int registerSizeInBits, final double estimator) {
final double twoToL = TWO_TO_L[(REG_WIDTH_INDEX_MULTIPLIER * registerSizeInBits) + log2m];
return -1 * twoToL * Math.log(1.0 - (estimator/twoToL));
} | [
"public",
"static",
"double",
"largeEstimator",
"(",
"final",
"int",
"log2m",
",",
"final",
"int",
"registerSizeInBits",
",",
"final",
"double",
"estimator",
")",
"{",
"final",
"double",
"twoToL",
"=",
"TWO_TO_L",
"[",
"(",
"REG_WIDTH_INDEX_MULTIPLIER",
"*",
"registerSizeInBits",
")",
"+",
"log2m",
"]",
";",
"return",
"-",
"1",
"*",
"twoToL",
"*",
"Math",
".",
"log",
"(",
"1.0",
"-",
"(",
"estimator",
"/",
"twoToL",
")",
")",
";",
"}"
] | The "large range correction" formula from the HyperLogLog algorithm, adapted
for 64 bit hashes. Only appropriate for estimators whose value exceeds
the return of {@link #largeEstimatorCutoff(int, int)}.
@param log2m log-base-2 of the number of registers in the HLL. <em>b<em> in the paper.
@param registerSizeInBits the size of the HLL registers, in bits.
@param estimator the original estimator ("E" in the paper).
@return a corrected cardinality estimate.
@see <a href='http://research.neustar.biz/2013/01/24/hyperloglog-googles-take-on-engineering-hll/'>Blog post with section on 64 bit hashes and "large range correction"</a> | [
"The",
"large",
"range",
"correction",
"formula",
"from",
"the",
"HyperLogLog",
"algorithm",
"adapted",
"for",
"64",
"bit",
"hashes",
".",
"Only",
"appropriate",
"for",
"estimators",
"whose",
"value",
"exceeds",
"the",
"return",
"of",
"{",
"@link",
"#largeEstimatorCutoff",
"(",
"int",
"int",
")",
"}",
"."
] | train | https://github.com/aggregateknowledge/java-hll/blob/1f4126e79a85b79581460c75bf1c1634b8a7402d/src/main/java/net/agkn/hll/util/HLLUtil.java#L198-L201 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/ST_ProjectPoint.java | ST_ProjectPoint.projectPoint | public static Point projectPoint(Geometry point, Geometry geometry) {
"""
Project a point on a linestring or multilinestring
@param point
@param geometry
@return
"""
if (point == null || geometry==null) {
return null;
}
if (point.getDimension()==0 && geometry.getDimension() == 1) {
LengthIndexedLine ll = new LengthIndexedLine(geometry);
double index = ll.project(point.getCoordinate());
return geometry.getFactory().createPoint(ll.extractPoint(index));
} else {
return null;
}
} | java | public static Point projectPoint(Geometry point, Geometry geometry) {
if (point == null || geometry==null) {
return null;
}
if (point.getDimension()==0 && geometry.getDimension() == 1) {
LengthIndexedLine ll = new LengthIndexedLine(geometry);
double index = ll.project(point.getCoordinate());
return geometry.getFactory().createPoint(ll.extractPoint(index));
} else {
return null;
}
} | [
"public",
"static",
"Point",
"projectPoint",
"(",
"Geometry",
"point",
",",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"point",
"==",
"null",
"||",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"point",
".",
"getDimension",
"(",
")",
"==",
"0",
"&&",
"geometry",
".",
"getDimension",
"(",
")",
"==",
"1",
")",
"{",
"LengthIndexedLine",
"ll",
"=",
"new",
"LengthIndexedLine",
"(",
"geometry",
")",
";",
"double",
"index",
"=",
"ll",
".",
"project",
"(",
"point",
".",
"getCoordinate",
"(",
")",
")",
";",
"return",
"geometry",
".",
"getFactory",
"(",
")",
".",
"createPoint",
"(",
"ll",
".",
"extractPoint",
"(",
"index",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Project a point on a linestring or multilinestring
@param point
@param geometry
@return | [
"Project",
"a",
"point",
"on",
"a",
"linestring",
"or",
"multilinestring"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/ST_ProjectPoint.java#L52-L63 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.findDataPoints | public Cursor<DataPointFound> findDataPoints(Series series, Interval interval, Predicate predicate, DateTimeZone timezone) {
"""
Returns a cursor of intervals/datapoints matching a predicate specified by series.
@param series The series
@param interval An interval of time for the query (start/end datetimes)
@param predicate The predicate for the query.
@param timezone The time zone for the returned datapoints.
@return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request.
@see Cursor
@since 1.1.0
"""
checkNotNull(series);
checkNotNull(interval);
checkNotNull(predicate);
checkNotNull(timezone);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/find/", API_VERSION, urlencode(series.getKey())));
addIntervalToURI(builder, interval);
addPredicateToURI(builder, predicate);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, predicate: %s, timezone: %s", series.getKey(), interval, predicate, timezone);
throw new IllegalArgumentException(message, e);
}
Cursor<DataPointFound> cursor = new DataPointFoundCursor(uri, this);
return cursor;
} | java | public Cursor<DataPointFound> findDataPoints(Series series, Interval interval, Predicate predicate, DateTimeZone timezone) {
checkNotNull(series);
checkNotNull(interval);
checkNotNull(predicate);
checkNotNull(timezone);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/find/", API_VERSION, urlencode(series.getKey())));
addIntervalToURI(builder, interval);
addPredicateToURI(builder, predicate);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, predicate: %s, timezone: %s", series.getKey(), interval, predicate, timezone);
throw new IllegalArgumentException(message, e);
}
Cursor<DataPointFound> cursor = new DataPointFoundCursor(uri, this);
return cursor;
} | [
"public",
"Cursor",
"<",
"DataPointFound",
">",
"findDataPoints",
"(",
"Series",
"series",
",",
"Interval",
"interval",
",",
"Predicate",
"predicate",
",",
"DateTimeZone",
"timezone",
")",
"{",
"checkNotNull",
"(",
"series",
")",
";",
"checkNotNull",
"(",
"interval",
")",
";",
"checkNotNull",
"(",
"predicate",
")",
";",
"checkNotNull",
"(",
"timezone",
")",
";",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/key/%s/find/\"",
",",
"API_VERSION",
",",
"urlencode",
"(",
"series",
".",
"getKey",
"(",
")",
")",
")",
")",
";",
"addIntervalToURI",
"(",
"builder",
",",
"interval",
")",
";",
"addPredicateToURI",
"(",
"builder",
",",
"predicate",
")",
";",
"addTimeZoneToURI",
"(",
"builder",
",",
"timezone",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Could not build URI with inputs: key: %s, interval: %s, predicate: %s, timezone: %s\"",
",",
"series",
".",
"getKey",
"(",
")",
",",
"interval",
",",
"predicate",
",",
"timezone",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"Cursor",
"<",
"DataPointFound",
">",
"cursor",
"=",
"new",
"DataPointFoundCursor",
"(",
"uri",
",",
"this",
")",
";",
"return",
"cursor",
";",
"}"
] | Returns a cursor of intervals/datapoints matching a predicate specified by series.
@param series The series
@param interval An interval of time for the query (start/end datetimes)
@param predicate The predicate for the query.
@param timezone The time zone for the returned datapoints.
@return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request.
@see Cursor
@since 1.1.0 | [
"Returns",
"a",
"cursor",
"of",
"intervals",
"/",
"datapoints",
"matching",
"a",
"predicate",
"specified",
"by",
"series",
"."
] | train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L316-L336 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_schol.java | Dcs_schol.cs_schol | public static Dcss cs_schol(int order, Dcs A) {
"""
Ordering and symbolic analysis for a Cholesky factorization.
@param order
ordering option (0 or 1)
@param A
column-compressed matrix
@return symbolic analysis for Cholesky, null on error
"""
int n, c[], post[], P[];
Dcs C;
Dcss S;
if (!Dcs_util.CS_CSC(A))
return (null); /* check inputs */
n = A.n;
S = new Dcss(); /* allocate result S */
P = Dcs_amd.cs_amd(order, A); /* P = amd(A+A'), or natural */
S.pinv = Dcs_pinv.cs_pinv(P, n); /* find inverse permutation */
if (order != 0 && S.pinv == null)
return null;
C = Dcs_symperm.cs_symperm(A, S.pinv, false); /* C = spones(triu(A(P,P))) */
S.parent = Dcs_etree.cs_etree(C, false); /* find etree of C */
post = Dcs_post.cs_post(S.parent, n); /* postorder the etree */
c = Dcs_counts.cs_counts(C, S.parent, post, false); /* find column counts of chol(C) */
S.cp = new int[n + 1]; /* allocate result S.cp */
S.unz = S.lnz = Dcs_cumsum.cs_cumsum(S.cp, c, n); /* find column pointers for L */
return ((S.lnz >= 0) ? S : null);
} | java | public static Dcss cs_schol(int order, Dcs A) {
int n, c[], post[], P[];
Dcs C;
Dcss S;
if (!Dcs_util.CS_CSC(A))
return (null); /* check inputs */
n = A.n;
S = new Dcss(); /* allocate result S */
P = Dcs_amd.cs_amd(order, A); /* P = amd(A+A'), or natural */
S.pinv = Dcs_pinv.cs_pinv(P, n); /* find inverse permutation */
if (order != 0 && S.pinv == null)
return null;
C = Dcs_symperm.cs_symperm(A, S.pinv, false); /* C = spones(triu(A(P,P))) */
S.parent = Dcs_etree.cs_etree(C, false); /* find etree of C */
post = Dcs_post.cs_post(S.parent, n); /* postorder the etree */
c = Dcs_counts.cs_counts(C, S.parent, post, false); /* find column counts of chol(C) */
S.cp = new int[n + 1]; /* allocate result S.cp */
S.unz = S.lnz = Dcs_cumsum.cs_cumsum(S.cp, c, n); /* find column pointers for L */
return ((S.lnz >= 0) ? S : null);
} | [
"public",
"static",
"Dcss",
"cs_schol",
"(",
"int",
"order",
",",
"Dcs",
"A",
")",
"{",
"int",
"n",
",",
"c",
"[",
"]",
",",
"post",
"[",
"]",
",",
"P",
"[",
"]",
";",
"Dcs",
"C",
";",
"Dcss",
"S",
";",
"if",
"(",
"!",
"Dcs_util",
".",
"CS_CSC",
"(",
"A",
")",
")",
"return",
"(",
"null",
")",
";",
"/* check inputs */",
"n",
"=",
"A",
".",
"n",
";",
"S",
"=",
"new",
"Dcss",
"(",
")",
";",
"/* allocate result S */",
"P",
"=",
"Dcs_amd",
".",
"cs_amd",
"(",
"order",
",",
"A",
")",
";",
"/* P = amd(A+A'), or natural */",
"S",
".",
"pinv",
"=",
"Dcs_pinv",
".",
"cs_pinv",
"(",
"P",
",",
"n",
")",
";",
"/* find inverse permutation */",
"if",
"(",
"order",
"!=",
"0",
"&&",
"S",
".",
"pinv",
"==",
"null",
")",
"return",
"null",
";",
"C",
"=",
"Dcs_symperm",
".",
"cs_symperm",
"(",
"A",
",",
"S",
".",
"pinv",
",",
"false",
")",
";",
"/* C = spones(triu(A(P,P))) */",
"S",
".",
"parent",
"=",
"Dcs_etree",
".",
"cs_etree",
"(",
"C",
",",
"false",
")",
";",
"/* find etree of C */",
"post",
"=",
"Dcs_post",
".",
"cs_post",
"(",
"S",
".",
"parent",
",",
"n",
")",
";",
"/* postorder the etree */",
"c",
"=",
"Dcs_counts",
".",
"cs_counts",
"(",
"C",
",",
"S",
".",
"parent",
",",
"post",
",",
"false",
")",
";",
"/* find column counts of chol(C) */",
"S",
".",
"cp",
"=",
"new",
"int",
"[",
"n",
"+",
"1",
"]",
";",
"/* allocate result S.cp */",
"S",
".",
"unz",
"=",
"S",
".",
"lnz",
"=",
"Dcs_cumsum",
".",
"cs_cumsum",
"(",
"S",
".",
"cp",
",",
"c",
",",
"n",
")",
";",
"/* find column pointers for L */",
"return",
"(",
"(",
"S",
".",
"lnz",
">=",
"0",
")",
"?",
"S",
":",
"null",
")",
";",
"}"
] | Ordering and symbolic analysis for a Cholesky factorization.
@param order
ordering option (0 or 1)
@param A
column-compressed matrix
@return symbolic analysis for Cholesky, null on error | [
"Ordering",
"and",
"symbolic",
"analysis",
"for",
"a",
"Cholesky",
"factorization",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_schol.java#L46-L65 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProjectApi.java | ProjectApi.getProject | public Project getProject(Object projectIdOrPath, Boolean includeStatistics) throws GitLabApiException {
"""
Get a specific project, which is owned by the authentication user.
<pre><code>GET /projects/:id</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param includeStatistics include project statistics
@return the specified project
@throws GitLabApiException if any exception occurs
"""
Form formData = new GitLabApiForm().withParam("statistics", includeStatistics);
Response response = get(Response.Status.OK, formData.asMap(), "projects", this.getProjectIdOrPath(projectIdOrPath));
return (response.readEntity(Project.class));
} | java | public Project getProject(Object projectIdOrPath, Boolean includeStatistics) throws GitLabApiException {
Form formData = new GitLabApiForm().withParam("statistics", includeStatistics);
Response response = get(Response.Status.OK, formData.asMap(), "projects", this.getProjectIdOrPath(projectIdOrPath));
return (response.readEntity(Project.class));
} | [
"public",
"Project",
"getProject",
"(",
"Object",
"projectIdOrPath",
",",
"Boolean",
"includeStatistics",
")",
"throws",
"GitLabApiException",
"{",
"Form",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"statistics\"",
",",
"includeStatistics",
")",
";",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"formData",
".",
"asMap",
"(",
")",
",",
"\"projects\"",
",",
"this",
".",
"getProjectIdOrPath",
"(",
"projectIdOrPath",
")",
")",
";",
"return",
"(",
"response",
".",
"readEntity",
"(",
"Project",
".",
"class",
")",
")",
";",
"}"
] | Get a specific project, which is owned by the authentication user.
<pre><code>GET /projects/:id</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param includeStatistics include project statistics
@return the specified project
@throws GitLabApiException if any exception occurs | [
"Get",
"a",
"specific",
"project",
"which",
"is",
"owned",
"by",
"the",
"authentication",
"user",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L584-L588 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeBoolean | @Pure
public static boolean getAttributeBoolean(Node document, String... path) {
"""
Replies the boolean value that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
Be careful about the fact that the names are case sensitives.
@param document is the XML document to explore.
@param path is the list of and ended by the attribute's name.
@return the boolean value of the specified attribute or <code>0</code>.
"""
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeBooleanWithDefault(document, true, false, path);
} | java | @Pure
public static boolean getAttributeBoolean(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeBooleanWithDefault(document, true, false, path);
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"getAttributeBoolean",
"(",
"Node",
"document",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";",
"return",
"getAttributeBooleanWithDefault",
"(",
"document",
",",
"true",
",",
"false",
",",
"path",
")",
";",
"}"
] | Replies the boolean value that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
Be careful about the fact that the names are case sensitives.
@param document is the XML document to explore.
@param path is the list of and ended by the attribute's name.
@return the boolean value of the specified attribute or <code>0</code>. | [
"Replies",
"the",
"boolean",
"value",
"that",
"corresponds",
"to",
"the",
"specified",
"attribute",
"s",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L299-L303 |
citrusframework/citrus | modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java | MailMessageConverter.handleImageBinaryPart | protected BodyPart handleImageBinaryPart(MimePart image, String contentType) throws IOException, MessagingException {
"""
Construct base64 body part from image data.
@param image
@param contentType
@return
@throws IOException
"""
ByteArrayOutputStream bos = new ByteArrayOutputStream();
FileCopyUtils.copy(image.getInputStream(), bos);
String base64 = Base64.encodeBase64String(bos.toByteArray());
return new BodyPart(base64, contentType);
} | java | protected BodyPart handleImageBinaryPart(MimePart image, String contentType) throws IOException, MessagingException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
FileCopyUtils.copy(image.getInputStream(), bos);
String base64 = Base64.encodeBase64String(bos.toByteArray());
return new BodyPart(base64, contentType);
} | [
"protected",
"BodyPart",
"handleImageBinaryPart",
"(",
"MimePart",
"image",
",",
"String",
"contentType",
")",
"throws",
"IOException",
",",
"MessagingException",
"{",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"FileCopyUtils",
".",
"copy",
"(",
"image",
".",
"getInputStream",
"(",
")",
",",
"bos",
")",
";",
"String",
"base64",
"=",
"Base64",
".",
"encodeBase64String",
"(",
"bos",
".",
"toByteArray",
"(",
")",
")",
";",
"return",
"new",
"BodyPart",
"(",
"base64",
",",
"contentType",
")",
";",
"}"
] | Construct base64 body part from image data.
@param image
@param contentType
@return
@throws IOException | [
"Construct",
"base64",
"body",
"part",
"from",
"image",
"data",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java#L236-L241 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/Ser.java | Ser.writeOffset | static void writeOffset(ZoneOffset offset, DataOutput out) throws IOException {
"""
Writes the state to the stream.
@param offset the offset, not null
@param out the output stream, not null
@throws IOException if an error occurs
"""
final int offsetSecs = offset.getTotalSeconds();
int offsetByte = offsetSecs % 900 == 0 ? offsetSecs / 900 : 127; // compress to -72 to +72
out.writeByte(offsetByte);
if (offsetByte == 127) {
out.writeInt(offsetSecs);
}
} | java | static void writeOffset(ZoneOffset offset, DataOutput out) throws IOException {
final int offsetSecs = offset.getTotalSeconds();
int offsetByte = offsetSecs % 900 == 0 ? offsetSecs / 900 : 127; // compress to -72 to +72
out.writeByte(offsetByte);
if (offsetByte == 127) {
out.writeInt(offsetSecs);
}
} | [
"static",
"void",
"writeOffset",
"(",
"ZoneOffset",
"offset",
",",
"DataOutput",
"out",
")",
"throws",
"IOException",
"{",
"final",
"int",
"offsetSecs",
"=",
"offset",
".",
"getTotalSeconds",
"(",
")",
";",
"int",
"offsetByte",
"=",
"offsetSecs",
"%",
"900",
"==",
"0",
"?",
"offsetSecs",
"/",
"900",
":",
"127",
";",
"// compress to -72 to +72",
"out",
".",
"writeByte",
"(",
"offsetByte",
")",
";",
"if",
"(",
"offsetByte",
"==",
"127",
")",
"{",
"out",
".",
"writeInt",
"(",
"offsetSecs",
")",
";",
"}",
"}"
] | Writes the state to the stream.
@param offset the offset, not null
@param out the output stream, not null
@throws IOException if an error occurs | [
"Writes",
"the",
"state",
"to",
"the",
"stream",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/Ser.java#L221-L228 |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java | GregorianCalendar.compareDate | private int compareDate(Date a, Date b) {
"""
Calculate the number of days between two dates
@param a Date
@param b Date
@return the difference in days between b and a (b - a)
"""
final Date ta = new Date(a.getTime());
final Date tb = new Date(b.getTime());
final long d1 = setHourToZero(ta).getTime();
final long d2 = setHourToZero(tb).getTime();
return (int) Math.round((d2 - d1) / 1000.0 / 60.0 / 60.0 / 24.0);
} | java | private int compareDate(Date a, Date b) {
final Date ta = new Date(a.getTime());
final Date tb = new Date(b.getTime());
final long d1 = setHourToZero(ta).getTime();
final long d2 = setHourToZero(tb).getTime();
return (int) Math.round((d2 - d1) / 1000.0 / 60.0 / 60.0 / 24.0);
} | [
"private",
"int",
"compareDate",
"(",
"Date",
"a",
",",
"Date",
"b",
")",
"{",
"final",
"Date",
"ta",
"=",
"new",
"Date",
"(",
"a",
".",
"getTime",
"(",
")",
")",
";",
"final",
"Date",
"tb",
"=",
"new",
"Date",
"(",
"b",
".",
"getTime",
"(",
")",
")",
";",
"final",
"long",
"d1",
"=",
"setHourToZero",
"(",
"ta",
")",
".",
"getTime",
"(",
")",
";",
"final",
"long",
"d2",
"=",
"setHourToZero",
"(",
"tb",
")",
".",
"getTime",
"(",
")",
";",
"return",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"(",
"d2",
"-",
"d1",
")",
"/",
"1000.0",
"/",
"60.0",
"/",
"60.0",
"/",
"24.0",
")",
";",
"}"
] | Calculate the number of days between two dates
@param a Date
@param b Date
@return the difference in days between b and a (b - a) | [
"Calculate",
"the",
"number",
"of",
"days",
"between",
"two",
"dates"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java#L365-L371 |
m-m-m/util | pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java | AbstractPojoPathNavigator.createState | protected PojoPathState createState(Object initialPojo, String pojoPath, PojoPathMode mode, PojoPathContext context) {
"""
This method gets the {@link PojoPathState} for the given {@code context}.
@param initialPojo is the initial {@link net.sf.mmm.util.pojo.api.Pojo} this {@link PojoPathNavigator} was invoked
with.
@param pojoPath is the {@link net.sf.mmm.util.pojo.path.api.PojoPath} to navigate.
@param mode is the {@link PojoPathMode mode} that determines how to deal {@code null} values.
@param context is the {@link PojoPathContext context} for this operation.
@return the {@link PojoPathState} or {@code null} if caching is disabled.
"""
if (mode == null) {
throw new NlsNullPointerException("mode");
}
Map<Object, Object> rawCache = context.getCache();
if (rawCache == null) {
CachingPojoPath rootPath = new CachingPojoPath(initialPojo, initialPojo.getClass());
return new PojoPathState(rootPath, mode, pojoPath);
}
HashKey<Object> hashKey = new HashKey<>(initialPojo);
PojoPathCache masterCache = (PojoPathCache) rawCache.get(hashKey);
if (masterCache == null) {
masterCache = new PojoPathCache(initialPojo);
rawCache.put(hashKey, masterCache);
}
return masterCache.createState(mode, pojoPath);
} | java | protected PojoPathState createState(Object initialPojo, String pojoPath, PojoPathMode mode, PojoPathContext context) {
if (mode == null) {
throw new NlsNullPointerException("mode");
}
Map<Object, Object> rawCache = context.getCache();
if (rawCache == null) {
CachingPojoPath rootPath = new CachingPojoPath(initialPojo, initialPojo.getClass());
return new PojoPathState(rootPath, mode, pojoPath);
}
HashKey<Object> hashKey = new HashKey<>(initialPojo);
PojoPathCache masterCache = (PojoPathCache) rawCache.get(hashKey);
if (masterCache == null) {
masterCache = new PojoPathCache(initialPojo);
rawCache.put(hashKey, masterCache);
}
return masterCache.createState(mode, pojoPath);
} | [
"protected",
"PojoPathState",
"createState",
"(",
"Object",
"initialPojo",
",",
"String",
"pojoPath",
",",
"PojoPathMode",
"mode",
",",
"PojoPathContext",
"context",
")",
"{",
"if",
"(",
"mode",
"==",
"null",
")",
"{",
"throw",
"new",
"NlsNullPointerException",
"(",
"\"mode\"",
")",
";",
"}",
"Map",
"<",
"Object",
",",
"Object",
">",
"rawCache",
"=",
"context",
".",
"getCache",
"(",
")",
";",
"if",
"(",
"rawCache",
"==",
"null",
")",
"{",
"CachingPojoPath",
"rootPath",
"=",
"new",
"CachingPojoPath",
"(",
"initialPojo",
",",
"initialPojo",
".",
"getClass",
"(",
")",
")",
";",
"return",
"new",
"PojoPathState",
"(",
"rootPath",
",",
"mode",
",",
"pojoPath",
")",
";",
"}",
"HashKey",
"<",
"Object",
">",
"hashKey",
"=",
"new",
"HashKey",
"<>",
"(",
"initialPojo",
")",
";",
"PojoPathCache",
"masterCache",
"=",
"(",
"PojoPathCache",
")",
"rawCache",
".",
"get",
"(",
"hashKey",
")",
";",
"if",
"(",
"masterCache",
"==",
"null",
")",
"{",
"masterCache",
"=",
"new",
"PojoPathCache",
"(",
"initialPojo",
")",
";",
"rawCache",
".",
"put",
"(",
"hashKey",
",",
"masterCache",
")",
";",
"}",
"return",
"masterCache",
".",
"createState",
"(",
"mode",
",",
"pojoPath",
")",
";",
"}"
] | This method gets the {@link PojoPathState} for the given {@code context}.
@param initialPojo is the initial {@link net.sf.mmm.util.pojo.api.Pojo} this {@link PojoPathNavigator} was invoked
with.
@param pojoPath is the {@link net.sf.mmm.util.pojo.path.api.PojoPath} to navigate.
@param mode is the {@link PojoPathMode mode} that determines how to deal {@code null} values.
@param context is the {@link PojoPathContext context} for this operation.
@return the {@link PojoPathState} or {@code null} if caching is disabled. | [
"This",
"method",
"gets",
"the",
"{",
"@link",
"PojoPathState",
"}",
"for",
"the",
"given",
"{",
"@code",
"context",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java#L219-L236 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.setNoDisturb | public ResponseWrapper setNoDisturb(String username, NoDisturbPayload payload)
throws APIConnectionException, APIRequestException {
"""
Set don't disturb service while receiving messages.
You can Add or remove single conversation or group conversation
@param username Necessary
@param payload NoDisturbPayload
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception
"""
return _userClient.setNoDisturb(username, payload);
} | java | public ResponseWrapper setNoDisturb(String username, NoDisturbPayload payload)
throws APIConnectionException, APIRequestException {
return _userClient.setNoDisturb(username, payload);
} | [
"public",
"ResponseWrapper",
"setNoDisturb",
"(",
"String",
"username",
",",
"NoDisturbPayload",
"payload",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_userClient",
".",
"setNoDisturb",
"(",
"username",
",",
"payload",
")",
";",
"}"
] | Set don't disturb service while receiving messages.
You can Add or remove single conversation or group conversation
@param username Necessary
@param payload NoDisturbPayload
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Set",
"don",
"t",
"disturb",
"service",
"while",
"receiving",
"messages",
".",
"You",
"can",
"Add",
"or",
"remove",
"single",
"conversation",
"or",
"group",
"conversation"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L277-L280 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.buildAliasKey | private String buildAliasKey(String aPath, List hintClasses) {
"""
Build the key for the TableAlias based on the path and the hints
@param aPath
@param hintClasses
@return the key for the TableAlias
"""
if (hintClasses == null || hintClasses.isEmpty())
{
return aPath;
}
StringBuffer buf = new StringBuffer(aPath);
for (Iterator iter = hintClasses.iterator(); iter.hasNext();)
{
Class hint = (Class) iter.next();
buf.append(" ");
buf.append(hint.getName());
}
return buf.toString();
} | java | private String buildAliasKey(String aPath, List hintClasses)
{
if (hintClasses == null || hintClasses.isEmpty())
{
return aPath;
}
StringBuffer buf = new StringBuffer(aPath);
for (Iterator iter = hintClasses.iterator(); iter.hasNext();)
{
Class hint = (Class) iter.next();
buf.append(" ");
buf.append(hint.getName());
}
return buf.toString();
} | [
"private",
"String",
"buildAliasKey",
"(",
"String",
"aPath",
",",
"List",
"hintClasses",
")",
"{",
"if",
"(",
"hintClasses",
"==",
"null",
"||",
"hintClasses",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"aPath",
";",
"}",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"aPath",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"hintClasses",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Class",
"hint",
"=",
"(",
"Class",
")",
"iter",
".",
"next",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\" \"",
")",
";",
"buf",
".",
"append",
"(",
"hint",
".",
"getName",
"(",
")",
")",
";",
"}",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}"
] | Build the key for the TableAlias based on the path and the hints
@param aPath
@param hintClasses
@return the key for the TableAlias | [
"Build",
"the",
"key",
"for",
"the",
"TableAlias",
"based",
"on",
"the",
"path",
"and",
"the",
"hints"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L1381-L1396 |
gotev/android-upload-service | uploadservice/src/main/java/net/gotev/uploadservice/HttpUploadRequest.java | HttpUploadRequest.addArrayParameter | public B addArrayParameter(final String paramName, final String... array) {
"""
Adds a parameter with multiple values to this upload request.
@param paramName parameter name
@param array values
@return self instance
"""
for (String value : array) {
httpParams.addParameter(paramName, value);
}
return self();
} | java | public B addArrayParameter(final String paramName, final String... array) {
for (String value : array) {
httpParams.addParameter(paramName, value);
}
return self();
} | [
"public",
"B",
"addArrayParameter",
"(",
"final",
"String",
"paramName",
",",
"final",
"String",
"...",
"array",
")",
"{",
"for",
"(",
"String",
"value",
":",
"array",
")",
"{",
"httpParams",
".",
"addParameter",
"(",
"paramName",
",",
"value",
")",
";",
"}",
"return",
"self",
"(",
")",
";",
"}"
] | Adds a parameter with multiple values to this upload request.
@param paramName parameter name
@param array values
@return self instance | [
"Adds",
"a",
"parameter",
"with",
"multiple",
"values",
"to",
"this",
"upload",
"request",
"."
] | train | https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/uploadservice/src/main/java/net/gotev/uploadservice/HttpUploadRequest.java#L97-L102 |
apache/groovy | subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java | XmlUtil.newSAXParser | public static SAXParser newSAXParser(String schemaLanguage, boolean namespaceAware, boolean validating, File schema) throws SAXException, ParserConfigurationException {
"""
Factory method to create a SAXParser configured to validate according to a particular schema language and
a File containing the schema to validate against.
@param schemaLanguage the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)
@param namespaceAware will the parser be namespace aware
@param validating will the parser also validate against DTDs
@param schema a file containing the schema to validate against
@return the created SAXParser
@throws SAXException
@throws ParserConfigurationException
@since 1.8.7
"""
SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);
return newSAXParser(namespaceAware, validating, schemaFactory.newSchema(schema));
} | java | public static SAXParser newSAXParser(String schemaLanguage, boolean namespaceAware, boolean validating, File schema) throws SAXException, ParserConfigurationException {
SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);
return newSAXParser(namespaceAware, validating, schemaFactory.newSchema(schema));
} | [
"public",
"static",
"SAXParser",
"newSAXParser",
"(",
"String",
"schemaLanguage",
",",
"boolean",
"namespaceAware",
",",
"boolean",
"validating",
",",
"File",
"schema",
")",
"throws",
"SAXException",
",",
"ParserConfigurationException",
"{",
"SchemaFactory",
"schemaFactory",
"=",
"SchemaFactory",
".",
"newInstance",
"(",
"schemaLanguage",
")",
";",
"return",
"newSAXParser",
"(",
"namespaceAware",
",",
"validating",
",",
"schemaFactory",
".",
"newSchema",
"(",
"schema",
")",
")",
";",
"}"
] | Factory method to create a SAXParser configured to validate according to a particular schema language and
a File containing the schema to validate against.
@param schemaLanguage the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)
@param namespaceAware will the parser be namespace aware
@param validating will the parser also validate against DTDs
@param schema a file containing the schema to validate against
@return the created SAXParser
@throws SAXException
@throws ParserConfigurationException
@since 1.8.7 | [
"Factory",
"method",
"to",
"create",
"a",
"SAXParser",
"configured",
"to",
"validate",
"according",
"to",
"a",
"particular",
"schema",
"language",
"and",
"a",
"File",
"containing",
"the",
"schema",
"to",
"validate",
"against",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java#L291-L294 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/Shape.java | Shape.doApplyShadow | protected final void doApplyShadow(final Context2D context, final Attributes attr) {
"""
Applies this shape's Shadow.
@param context
@param attr
@return boolean
"""
if ((false == isAppliedShadow()) && (attr.hasShadow()))
{
setAppliedShadow(true);
final Shadow shadow = attr.getShadow();
if (null != shadow)
{
context.setShadow(shadow);
}
}
} | java | protected final void doApplyShadow(final Context2D context, final Attributes attr)
{
if ((false == isAppliedShadow()) && (attr.hasShadow()))
{
setAppliedShadow(true);
final Shadow shadow = attr.getShadow();
if (null != shadow)
{
context.setShadow(shadow);
}
}
} | [
"protected",
"final",
"void",
"doApplyShadow",
"(",
"final",
"Context2D",
"context",
",",
"final",
"Attributes",
"attr",
")",
"{",
"if",
"(",
"(",
"false",
"==",
"isAppliedShadow",
"(",
")",
")",
"&&",
"(",
"attr",
".",
"hasShadow",
"(",
")",
")",
")",
"{",
"setAppliedShadow",
"(",
"true",
")",
";",
"final",
"Shadow",
"shadow",
"=",
"attr",
".",
"getShadow",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"shadow",
")",
"{",
"context",
".",
"setShadow",
"(",
"shadow",
")",
";",
"}",
"}",
"}"
] | Applies this shape's Shadow.
@param context
@param attr
@return boolean | [
"Applies",
"this",
"shape",
"s",
"Shadow",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Shape.java#L670-L683 |
mfornos/humanize | humanize-icu/src/main/java/humanize/ICUHumanize.java | ICUHumanize.naturalTime | public static String naturalTime(final Date reference, final Date duration) {
"""
<p>
Computes both past and future relative dates.
</p>
<p>
E.g. "1 day ago", "1 day from now", "10 years ago", "3 minutes from now"
and so on.
</p>
@param reference
Date to be used as reference
@param duration
Date to be used as duration from reference
@return String representing the relative date
"""
long diff = duration.getTime() - reference.getTime();
return context.get().getDurationFormat().formatDurationFrom(diff, reference.getTime());
} | java | public static String naturalTime(final Date reference, final Date duration)
{
long diff = duration.getTime() - reference.getTime();
return context.get().getDurationFormat().formatDurationFrom(diff, reference.getTime());
} | [
"public",
"static",
"String",
"naturalTime",
"(",
"final",
"Date",
"reference",
",",
"final",
"Date",
"duration",
")",
"{",
"long",
"diff",
"=",
"duration",
".",
"getTime",
"(",
")",
"-",
"reference",
".",
"getTime",
"(",
")",
";",
"return",
"context",
".",
"get",
"(",
")",
".",
"getDurationFormat",
"(",
")",
".",
"formatDurationFrom",
"(",
"diff",
",",
"reference",
".",
"getTime",
"(",
")",
")",
";",
"}"
] | <p>
Computes both past and future relative dates.
</p>
<p>
E.g. "1 day ago", "1 day from now", "10 years ago", "3 minutes from now"
and so on.
</p>
@param reference
Date to be used as reference
@param duration
Date to be used as duration from reference
@return String representing the relative date | [
"<p",
">",
"Computes",
"both",
"past",
"and",
"future",
"relative",
"dates",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L1336-L1340 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/cuDoubleComplex.java | cuDoubleComplex.cuCadd | public static cuDoubleComplex cuCadd (cuDoubleComplex x, cuDoubleComplex y) {
"""
Returns a new complex number that is the sum of the given
complex numbers.
@param x The first addend
@param y The second addend
@return The sum of the given addends
"""
return cuCmplx (cuCreal(x) + cuCreal(y), cuCimag(x) + cuCimag(y));
} | java | public static cuDoubleComplex cuCadd (cuDoubleComplex x, cuDoubleComplex y)
{
return cuCmplx (cuCreal(x) + cuCreal(y), cuCimag(x) + cuCimag(y));
} | [
"public",
"static",
"cuDoubleComplex",
"cuCadd",
"(",
"cuDoubleComplex",
"x",
",",
"cuDoubleComplex",
"y",
")",
"{",
"return",
"cuCmplx",
"(",
"cuCreal",
"(",
"x",
")",
"+",
"cuCreal",
"(",
"y",
")",
",",
"cuCimag",
"(",
"x",
")",
"+",
"cuCimag",
"(",
"y",
")",
")",
";",
"}"
] | Returns a new complex number that is the sum of the given
complex numbers.
@param x The first addend
@param y The second addend
@return The sum of the given addends | [
"Returns",
"a",
"new",
"complex",
"number",
"that",
"is",
"the",
"sum",
"of",
"the",
"given",
"complex",
"numbers",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/cuDoubleComplex.java#L104-L107 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/ConvexPolygon.java | ConvexPolygon.distanceFromLine | public static double distanceFromLine(double x0, double y0, double x1, double y1, double x2, double y2) {
"""
Returns distance from point (x0, y0) to line that goes through points
(x1, y1) and (x2, y2)
@param x0
@param y0
@param x1
@param y1
@param x2
@param y2
@return
"""
double dx = x2-x1;
if (dx == 0.0)
{
return Math.abs(x1-x0);
}
double dy = y2-y1;
if (dy == 0.0)
{
return Math.abs(y1-y0);
}
return Math.abs(dy*x0-dx*y0+x2*y1-y2*x1)/Math.hypot(dx, dy);
} | java | public static double distanceFromLine(double x0, double y0, double x1, double y1, double x2, double y2)
{
double dx = x2-x1;
if (dx == 0.0)
{
return Math.abs(x1-x0);
}
double dy = y2-y1;
if (dy == 0.0)
{
return Math.abs(y1-y0);
}
return Math.abs(dy*x0-dx*y0+x2*y1-y2*x1)/Math.hypot(dx, dy);
} | [
"public",
"static",
"double",
"distanceFromLine",
"(",
"double",
"x0",
",",
"double",
"y0",
",",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
")",
"{",
"double",
"dx",
"=",
"x2",
"-",
"x1",
";",
"if",
"(",
"dx",
"==",
"0.0",
")",
"{",
"return",
"Math",
".",
"abs",
"(",
"x1",
"-",
"x0",
")",
";",
"}",
"double",
"dy",
"=",
"y2",
"-",
"y1",
";",
"if",
"(",
"dy",
"==",
"0.0",
")",
"{",
"return",
"Math",
".",
"abs",
"(",
"y1",
"-",
"y0",
")",
";",
"}",
"return",
"Math",
".",
"abs",
"(",
"dy",
"*",
"x0",
"-",
"dx",
"*",
"y0",
"+",
"x2",
"*",
"y1",
"-",
"y2",
"*",
"x1",
")",
"/",
"Math",
".",
"hypot",
"(",
"dx",
",",
"dy",
")",
";",
"}"
] | Returns distance from point (x0, y0) to line that goes through points
(x1, y1) and (x2, y2)
@param x0
@param y0
@param x1
@param y1
@param x2
@param y2
@return | [
"Returns",
"distance",
"from",
"point",
"(",
"x0",
"y0",
")",
"to",
"line",
"that",
"goes",
"through",
"points",
"(",
"x1",
"y1",
")",
"and",
"(",
"x2",
"y2",
")"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/ConvexPolygon.java#L127-L140 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java | TypeUtility.className | public static ClassName className(String className) {
"""
Generate class typeName.
@param className
the class name
@return class typeName generated
"""
int index = className.lastIndexOf(".");
if (index > 0) {
return classNameWithSuffix(className.substring(0, index), className.substring(index + 1), "");
}
return ClassName.get("", className);
} | java | public static ClassName className(String className) {
int index = className.lastIndexOf(".");
if (index > 0) {
return classNameWithSuffix(className.substring(0, index), className.substring(index + 1), "");
}
return ClassName.get("", className);
} | [
"public",
"static",
"ClassName",
"className",
"(",
"String",
"className",
")",
"{",
"int",
"index",
"=",
"className",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"return",
"classNameWithSuffix",
"(",
"className",
".",
"substring",
"(",
"0",
",",
"index",
")",
",",
"className",
".",
"substring",
"(",
"index",
"+",
"1",
")",
",",
"\"\"",
")",
";",
"}",
"return",
"ClassName",
".",
"get",
"(",
"\"\"",
",",
"className",
")",
";",
"}"
] | Generate class typeName.
@param className
the class name
@return class typeName generated | [
"Generate",
"class",
"typeName",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java#L205-L212 |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateProperties.java | HibernateProperties.determineHibernateProperties | public Map<String, Object> determineHibernateProperties(
Map<String, String> jpaProperties, HibernateSettings settings) {
"""
Determine the configuration properties for the initialization of the main Hibernate
EntityManagerFactory based on standard JPA properties and
{@link HibernateSettings}.
@param jpaProperties standard JPA properties
@param settings the settings to apply when determining the configuration properties
@return the Hibernate properties to use
"""
Assert.notNull(jpaProperties, "JpaProperties must not be null");
Assert.notNull(settings, "Settings must not be null");
return getAdditionalProperties(jpaProperties, settings);
} | java | public Map<String, Object> determineHibernateProperties(
Map<String, String> jpaProperties, HibernateSettings settings) {
Assert.notNull(jpaProperties, "JpaProperties must not be null");
Assert.notNull(settings, "Settings must not be null");
return getAdditionalProperties(jpaProperties, settings);
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"determineHibernateProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"jpaProperties",
",",
"HibernateSettings",
"settings",
")",
"{",
"Assert",
".",
"notNull",
"(",
"jpaProperties",
",",
"\"JpaProperties must not be null\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"settings",
",",
"\"Settings must not be null\"",
")",
";",
"return",
"getAdditionalProperties",
"(",
"jpaProperties",
",",
"settings",
")",
";",
"}"
] | Determine the configuration properties for the initialization of the main Hibernate
EntityManagerFactory based on standard JPA properties and
{@link HibernateSettings}.
@param jpaProperties standard JPA properties
@param settings the settings to apply when determining the configuration properties
@return the Hibernate properties to use | [
"Determine",
"the",
"configuration",
"properties",
"for",
"the",
"initialization",
"of",
"the",
"main",
"Hibernate",
"EntityManagerFactory",
"based",
"on",
"standard",
"JPA",
"properties",
"and",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateProperties.java#L90-L95 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/ext/HCConditionalCommentNode.java | HCConditionalCommentNode.getAsConditionalCommentNode | @Nonnull
public static HCConditionalCommentNode getAsConditionalCommentNode (@Nonnull @Nonempty final String sCondition,
@Nonnull final IHCNode aNode) {
"""
Get the passed node wrapped in a conditional comment. This is a sanity
method for <code>new HCConditionalCommentNode (this, sCondition)</code>. If
this node is already an {@link HCConditionalCommentNode} the object is
simply casted.
@param sCondition
The condition to us. May neither be <code>null</code> nor empty.
@param aNode
The HC node to be wrapped. May not be <code>null</code>.
@return Never <code>null</code>.
"""
if (aNode instanceof HCConditionalCommentNode)
return (HCConditionalCommentNode) aNode;
return new HCConditionalCommentNode (sCondition, aNode);
} | java | @Nonnull
public static HCConditionalCommentNode getAsConditionalCommentNode (@Nonnull @Nonempty final String sCondition,
@Nonnull final IHCNode aNode)
{
if (aNode instanceof HCConditionalCommentNode)
return (HCConditionalCommentNode) aNode;
return new HCConditionalCommentNode (sCondition, aNode);
} | [
"@",
"Nonnull",
"public",
"static",
"HCConditionalCommentNode",
"getAsConditionalCommentNode",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sCondition",
",",
"@",
"Nonnull",
"final",
"IHCNode",
"aNode",
")",
"{",
"if",
"(",
"aNode",
"instanceof",
"HCConditionalCommentNode",
")",
"return",
"(",
"HCConditionalCommentNode",
")",
"aNode",
";",
"return",
"new",
"HCConditionalCommentNode",
"(",
"sCondition",
",",
"aNode",
")",
";",
"}"
] | Get the passed node wrapped in a conditional comment. This is a sanity
method for <code>new HCConditionalCommentNode (this, sCondition)</code>. If
this node is already an {@link HCConditionalCommentNode} the object is
simply casted.
@param sCondition
The condition to us. May neither be <code>null</code> nor empty.
@param aNode
The HC node to be wrapped. May not be <code>null</code>.
@return Never <code>null</code>. | [
"Get",
"the",
"passed",
"node",
"wrapped",
"in",
"a",
"conditional",
"comment",
".",
"This",
"is",
"a",
"sanity",
"method",
"for",
"<code",
">",
"new",
"HCConditionalCommentNode",
"(",
"this",
"sCondition",
")",
"<",
"/",
"code",
">",
".",
"If",
"this",
"node",
"is",
"already",
"an",
"{",
"@link",
"HCConditionalCommentNode",
"}",
"the",
"object",
"is",
"simply",
"casted",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/ext/HCConditionalCommentNode.java#L423-L430 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/TransactionOutPoint.java | TransactionOutPoint.getConnectedRedeemData | @Nullable
public RedeemData getConnectedRedeemData(KeyBag keyBag) throws ScriptException {
"""
Returns the RedeemData identified in the connected output, for either P2PKH, P2WPKH, P2PK
or P2SH scripts.
If the script forms cannot be understood, throws ScriptException.
@return a RedeemData or null if the connected data cannot be found in the wallet.
"""
TransactionOutput connectedOutput = getConnectedOutput();
checkNotNull(connectedOutput, "Input is not connected so cannot retrieve key");
Script connectedScript = connectedOutput.getScriptPubKey();
if (ScriptPattern.isP2PKH(connectedScript)) {
byte[] addressBytes = ScriptPattern.extractHashFromP2PKH(connectedScript);
return RedeemData.of(keyBag.findKeyFromPubKeyHash(addressBytes, Script.ScriptType.P2PKH), connectedScript);
} else if (ScriptPattern.isP2WPKH(connectedScript)) {
byte[] addressBytes = ScriptPattern.extractHashFromP2WH(connectedScript);
return RedeemData.of(keyBag.findKeyFromPubKeyHash(addressBytes, Script.ScriptType.P2WPKH), connectedScript);
} else if (ScriptPattern.isP2PK(connectedScript)) {
byte[] pubkeyBytes = ScriptPattern.extractKeyFromP2PK(connectedScript);
return RedeemData.of(keyBag.findKeyFromPubKey(pubkeyBytes), connectedScript);
} else if (ScriptPattern.isP2SH(connectedScript)) {
byte[] scriptHash = ScriptPattern.extractHashFromP2SH(connectedScript);
return keyBag.findRedeemDataFromScriptHash(scriptHash);
} else {
throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Could not understand form of connected output script: " + connectedScript);
}
} | java | @Nullable
public RedeemData getConnectedRedeemData(KeyBag keyBag) throws ScriptException {
TransactionOutput connectedOutput = getConnectedOutput();
checkNotNull(connectedOutput, "Input is not connected so cannot retrieve key");
Script connectedScript = connectedOutput.getScriptPubKey();
if (ScriptPattern.isP2PKH(connectedScript)) {
byte[] addressBytes = ScriptPattern.extractHashFromP2PKH(connectedScript);
return RedeemData.of(keyBag.findKeyFromPubKeyHash(addressBytes, Script.ScriptType.P2PKH), connectedScript);
} else if (ScriptPattern.isP2WPKH(connectedScript)) {
byte[] addressBytes = ScriptPattern.extractHashFromP2WH(connectedScript);
return RedeemData.of(keyBag.findKeyFromPubKeyHash(addressBytes, Script.ScriptType.P2WPKH), connectedScript);
} else if (ScriptPattern.isP2PK(connectedScript)) {
byte[] pubkeyBytes = ScriptPattern.extractKeyFromP2PK(connectedScript);
return RedeemData.of(keyBag.findKeyFromPubKey(pubkeyBytes), connectedScript);
} else if (ScriptPattern.isP2SH(connectedScript)) {
byte[] scriptHash = ScriptPattern.extractHashFromP2SH(connectedScript);
return keyBag.findRedeemDataFromScriptHash(scriptHash);
} else {
throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Could not understand form of connected output script: " + connectedScript);
}
} | [
"@",
"Nullable",
"public",
"RedeemData",
"getConnectedRedeemData",
"(",
"KeyBag",
"keyBag",
")",
"throws",
"ScriptException",
"{",
"TransactionOutput",
"connectedOutput",
"=",
"getConnectedOutput",
"(",
")",
";",
"checkNotNull",
"(",
"connectedOutput",
",",
"\"Input is not connected so cannot retrieve key\"",
")",
";",
"Script",
"connectedScript",
"=",
"connectedOutput",
".",
"getScriptPubKey",
"(",
")",
";",
"if",
"(",
"ScriptPattern",
".",
"isP2PKH",
"(",
"connectedScript",
")",
")",
"{",
"byte",
"[",
"]",
"addressBytes",
"=",
"ScriptPattern",
".",
"extractHashFromP2PKH",
"(",
"connectedScript",
")",
";",
"return",
"RedeemData",
".",
"of",
"(",
"keyBag",
".",
"findKeyFromPubKeyHash",
"(",
"addressBytes",
",",
"Script",
".",
"ScriptType",
".",
"P2PKH",
")",
",",
"connectedScript",
")",
";",
"}",
"else",
"if",
"(",
"ScriptPattern",
".",
"isP2WPKH",
"(",
"connectedScript",
")",
")",
"{",
"byte",
"[",
"]",
"addressBytes",
"=",
"ScriptPattern",
".",
"extractHashFromP2WH",
"(",
"connectedScript",
")",
";",
"return",
"RedeemData",
".",
"of",
"(",
"keyBag",
".",
"findKeyFromPubKeyHash",
"(",
"addressBytes",
",",
"Script",
".",
"ScriptType",
".",
"P2WPKH",
")",
",",
"connectedScript",
")",
";",
"}",
"else",
"if",
"(",
"ScriptPattern",
".",
"isP2PK",
"(",
"connectedScript",
")",
")",
"{",
"byte",
"[",
"]",
"pubkeyBytes",
"=",
"ScriptPattern",
".",
"extractKeyFromP2PK",
"(",
"connectedScript",
")",
";",
"return",
"RedeemData",
".",
"of",
"(",
"keyBag",
".",
"findKeyFromPubKey",
"(",
"pubkeyBytes",
")",
",",
"connectedScript",
")",
";",
"}",
"else",
"if",
"(",
"ScriptPattern",
".",
"isP2SH",
"(",
"connectedScript",
")",
")",
"{",
"byte",
"[",
"]",
"scriptHash",
"=",
"ScriptPattern",
".",
"extractHashFromP2SH",
"(",
"connectedScript",
")",
";",
"return",
"keyBag",
".",
"findRedeemDataFromScriptHash",
"(",
"scriptHash",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"ScriptException",
"(",
"ScriptError",
".",
"SCRIPT_ERR_UNKNOWN_ERROR",
",",
"\"Could not understand form of connected output script: \"",
"+",
"connectedScript",
")",
";",
"}",
"}"
] | Returns the RedeemData identified in the connected output, for either P2PKH, P2WPKH, P2PK
or P2SH scripts.
If the script forms cannot be understood, throws ScriptException.
@return a RedeemData or null if the connected data cannot be found in the wallet. | [
"Returns",
"the",
"RedeemData",
"identified",
"in",
"the",
"connected",
"output",
"for",
"either",
"P2PKH",
"P2WPKH",
"P2PK",
"or",
"P2SH",
"scripts",
".",
"If",
"the",
"script",
"forms",
"cannot",
"be",
"understood",
"throws",
"ScriptException",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/TransactionOutPoint.java#L165-L185 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/regions/RegionMetadataParser.java | RegionMetadataParser.parseRegionMetadata | @Deprecated
public List<Region> parseRegionMetadata(final InputStream input,
final boolean endpointVerification)
throws IOException {
"""
Parses the specified input stream and optionally verifies that all of
the endpoints end in ".amazonaws.com". This method is deprecated, since
not all valid AWS endpoints end in ".amazonaws.com" any more.
@param input
The stream containing the region metadata to parse.
@param endpointVerification
Whether to verify each region endpoint
@return The list of parsed regions.
@deprecated in favor of {@link #parse(InputStream)}
"""
return internalParse(input, endpointVerification);
} | java | @Deprecated
public List<Region> parseRegionMetadata(final InputStream input,
final boolean endpointVerification)
throws IOException {
return internalParse(input, endpointVerification);
} | [
"@",
"Deprecated",
"public",
"List",
"<",
"Region",
">",
"parseRegionMetadata",
"(",
"final",
"InputStream",
"input",
",",
"final",
"boolean",
"endpointVerification",
")",
"throws",
"IOException",
"{",
"return",
"internalParse",
"(",
"input",
",",
"endpointVerification",
")",
";",
"}"
] | Parses the specified input stream and optionally verifies that all of
the endpoints end in ".amazonaws.com". This method is deprecated, since
not all valid AWS endpoints end in ".amazonaws.com" any more.
@param input
The stream containing the region metadata to parse.
@param endpointVerification
Whether to verify each region endpoint
@return The list of parsed regions.
@deprecated in favor of {@link #parse(InputStream)} | [
"Parses",
"the",
"specified",
"input",
"stream",
"and",
"optionally",
"verifies",
"that",
"all",
"of",
"the",
"endpoints",
"end",
"in",
".",
"amazonaws",
".",
"com",
".",
"This",
"method",
"is",
"deprecated",
"since",
"not",
"all",
"valid",
"AWS",
"endpoints",
"end",
"in",
".",
"amazonaws",
".",
"com",
"any",
"more",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/regions/RegionMetadataParser.java#L99-L105 |
jbundle/jbundle | thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java | MemoryRemoteTable.set | public void set(Object data, int iOpenMode) throws DBException, RemoteException {
"""
Update the current record.
@param The data to update.
@exception Exception File exception.
"""
if (m_objCurrentKey == null)
throw new DBException(Constants.INVALID_RECORD);
Object key = this.getKey(data);
if (!key.equals(m_objCurrentKey))
m_mDataMap.remove(key);
m_mDataMap.put(key, data); // Replace the data at this position
m_objCurrentKey = null;
} | java | public void set(Object data, int iOpenMode) throws DBException, RemoteException
{
if (m_objCurrentKey == null)
throw new DBException(Constants.INVALID_RECORD);
Object key = this.getKey(data);
if (!key.equals(m_objCurrentKey))
m_mDataMap.remove(key);
m_mDataMap.put(key, data); // Replace the data at this position
m_objCurrentKey = null;
} | [
"public",
"void",
"set",
"(",
"Object",
"data",
",",
"int",
"iOpenMode",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"if",
"(",
"m_objCurrentKey",
"==",
"null",
")",
"throw",
"new",
"DBException",
"(",
"Constants",
".",
"INVALID_RECORD",
")",
";",
"Object",
"key",
"=",
"this",
".",
"getKey",
"(",
"data",
")",
";",
"if",
"(",
"!",
"key",
".",
"equals",
"(",
"m_objCurrentKey",
")",
")",
"m_mDataMap",
".",
"remove",
"(",
"key",
")",
";",
"m_mDataMap",
".",
"put",
"(",
"key",
",",
"data",
")",
";",
"// Replace the data at this position",
"m_objCurrentKey",
"=",
"null",
";",
"}"
] | Update the current record.
@param The data to update.
@exception Exception File exception. | [
"Update",
"the",
"current",
"record",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java#L160-L169 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java | DialogFragmentUtils.supportShowOnLoaderCallback | public static void supportShowOnLoaderCallback(final android.support.v4.app.FragmentManager manager, final android.support.v4.app.DialogFragment fragment, final String tag) {
"""
Show {@link android.support.v4.app.DialogFragment} with the specified tag on the loader callbacks.
@param manager the manager.
@param fragment the fragment.
@param tag the tag string that is related to the {@link android.support.v4.app.DialogFragment}.
"""
supportShowOnLoaderCallback(HandlerUtils.getMainHandler(), manager, fragment, tag);
} | java | public static void supportShowOnLoaderCallback(final android.support.v4.app.FragmentManager manager, final android.support.v4.app.DialogFragment fragment, final String tag) {
supportShowOnLoaderCallback(HandlerUtils.getMainHandler(), manager, fragment, tag);
} | [
"public",
"static",
"void",
"supportShowOnLoaderCallback",
"(",
"final",
"android",
".",
"support",
".",
"v4",
".",
"app",
".",
"FragmentManager",
"manager",
",",
"final",
"android",
".",
"support",
".",
"v4",
".",
"app",
".",
"DialogFragment",
"fragment",
",",
"final",
"String",
"tag",
")",
"{",
"supportShowOnLoaderCallback",
"(",
"HandlerUtils",
".",
"getMainHandler",
"(",
")",
",",
"manager",
",",
"fragment",
",",
"tag",
")",
";",
"}"
] | Show {@link android.support.v4.app.DialogFragment} with the specified tag on the loader callbacks.
@param manager the manager.
@param fragment the fragment.
@param tag the tag string that is related to the {@link android.support.v4.app.DialogFragment}. | [
"Show",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java#L150-L152 |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java | CreateMASCaseManager.closeMASCaseManager | public static void closeMASCaseManager(File caseManager) {
"""
Method to close the file caseManager. It is called just one time, by the
MASReader, once every test and stroy have been added.
@param caseManager
"""
FileWriter caseManagerWriter;
try {
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write("}\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger
.getLogger("CreateMASCaseManager.closeMASCaseManager");
logger.info("ERROR: There is a mistake closing caseManager file.\n");
}
} | java | public static void closeMASCaseManager(File caseManager) {
FileWriter caseManagerWriter;
try {
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write("}\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger
.getLogger("CreateMASCaseManager.closeMASCaseManager");
logger.info("ERROR: There is a mistake closing caseManager file.\n");
}
} | [
"public",
"static",
"void",
"closeMASCaseManager",
"(",
"File",
"caseManager",
")",
"{",
"FileWriter",
"caseManagerWriter",
";",
"try",
"{",
"caseManagerWriter",
"=",
"new",
"FileWriter",
"(",
"caseManager",
",",
"true",
")",
";",
"caseManagerWriter",
".",
"write",
"(",
"\"}\\n\"",
")",
";",
"caseManagerWriter",
".",
"flush",
"(",
")",
";",
"caseManagerWriter",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"CreateMASCaseManager.closeMASCaseManager\"",
")",
";",
"logger",
".",
"info",
"(",
"\"ERROR: There is a mistake closing caseManager file.\\n\"",
")",
";",
"}",
"}"
] | Method to close the file caseManager. It is called just one time, by the
MASReader, once every test and stroy have been added.
@param caseManager | [
"Method",
"to",
"close",
"the",
"file",
"caseManager",
".",
"It",
"is",
"called",
"just",
"one",
"time",
"by",
"the",
"MASReader",
"once",
"every",
"test",
"and",
"stroy",
"have",
"been",
"added",
"."
] | train | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java#L244-L258 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/OAuthApi.java | OAuthApi.loadLegacyTokenProperties | private Properties loadLegacyTokenProperties(InputStream inputStream) throws JinxException {
"""
/*
Load legacy properties.
The legacy token object stored its data as an XML properties file. Given the input stream to that file,
we load a Properties object and return it.
"""
Properties p = new Properties();
try {
p.loadFromXML(inputStream);
} catch (Exception e) {
throw new JinxException("Unable to load data from input stream.", e);
}
return p;
} | java | private Properties loadLegacyTokenProperties(InputStream inputStream) throws JinxException {
Properties p = new Properties();
try {
p.loadFromXML(inputStream);
} catch (Exception e) {
throw new JinxException("Unable to load data from input stream.", e);
}
return p;
} | [
"private",
"Properties",
"loadLegacyTokenProperties",
"(",
"InputStream",
"inputStream",
")",
"throws",
"JinxException",
"{",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"p",
".",
"loadFromXML",
"(",
"inputStream",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"JinxException",
"(",
"\"Unable to load data from input stream.\"",
",",
"e",
")",
";",
"}",
"return",
"p",
";",
"}"
] | /*
Load legacy properties.
The legacy token object stored its data as an XML properties file. Given the input stream to that file,
we load a Properties object and return it. | [
"/",
"*",
"Load",
"legacy",
"properties",
".",
"The",
"legacy",
"token",
"object",
"stored",
"its",
"data",
"as",
"an",
"XML",
"properties",
"file",
".",
"Given",
"the",
"input",
"stream",
"to",
"that",
"file",
"we",
"load",
"a",
"Properties",
"object",
"and",
"return",
"it",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/OAuthApi.java#L188-L196 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java | Visualizer.writeImage | public void writeImage(File input, File output, String formatName)
throws IOException {
"""
Writes an image to the output file that displays the structure of the PE
file.
@param input
the PE file to create an image from
@param output
the file to write the image to
@param formatName
the format name for the output image
@throws IOException
if sections can not be read
"""
BufferedImage image = createImage(input);
ImageIO.write(image, formatName, output);
} | java | public void writeImage(File input, File output, String formatName)
throws IOException {
BufferedImage image = createImage(input);
ImageIO.write(image, formatName, output);
} | [
"public",
"void",
"writeImage",
"(",
"File",
"input",
",",
"File",
"output",
",",
"String",
"formatName",
")",
"throws",
"IOException",
"{",
"BufferedImage",
"image",
"=",
"createImage",
"(",
"input",
")",
";",
"ImageIO",
".",
"write",
"(",
"image",
",",
"formatName",
",",
"output",
")",
";",
"}"
] | Writes an image to the output file that displays the structure of the PE
file.
@param input
the PE file to create an image from
@param output
the file to write the image to
@param formatName
the format name for the output image
@throws IOException
if sections can not be read | [
"Writes",
"an",
"image",
"to",
"the",
"output",
"file",
"that",
"displays",
"the",
"structure",
"of",
"the",
"PE",
"file",
"."
] | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L339-L343 |
Azure/azure-sdk-for-java | mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java | SpatialAnchorsAccountsInner.getKeys | public SpatialAnchorsAccountKeysInner getKeys(String resourceGroupName, String spatialAnchorsAccountName) {
"""
Get Both of the 2 Keys of a Spatial Anchors Account.
@param resourceGroupName Name of an Azure resource group.
@param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SpatialAnchorsAccountKeysInner object if successful.
"""
return getKeysWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName).toBlocking().single().body();
} | java | public SpatialAnchorsAccountKeysInner getKeys(String resourceGroupName, String spatialAnchorsAccountName) {
return getKeysWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName).toBlocking().single().body();
} | [
"public",
"SpatialAnchorsAccountKeysInner",
"getKeys",
"(",
"String",
"resourceGroupName",
",",
"String",
"spatialAnchorsAccountName",
")",
"{",
"return",
"getKeysWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"spatialAnchorsAccountName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Get Both of the 2 Keys of a Spatial Anchors Account.
@param resourceGroupName Name of an Azure resource group.
@param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SpatialAnchorsAccountKeysInner object if successful. | [
"Get",
"Both",
"of",
"the",
"2",
"Keys",
"of",
"a",
"Spatial",
"Anchors",
"Account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java#L705-L707 |
code4everything/util | src/main/java/com/zhazhapan/util/FileExecutor.java | FileExecutor.readFile | public static String readFile(File file, long start, int length) throws IOException {
"""
从指定位置读取指定长度
@param file 文件
@param start 开始位置
@param length 读取长度
@return 文件内容
@throws IOException 异常
"""
byte[] bs = new byte[length];
try (FileInputStream fis = new FileInputStream(file)) {
fis.skip(start);
fis.read(bs);
}
return new String(bs);
} | java | public static String readFile(File file, long start, int length) throws IOException {
byte[] bs = new byte[length];
try (FileInputStream fis = new FileInputStream(file)) {
fis.skip(start);
fis.read(bs);
}
return new String(bs);
} | [
"public",
"static",
"String",
"readFile",
"(",
"File",
"file",
",",
"long",
"start",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bs",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"try",
"(",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
")",
"{",
"fis",
".",
"skip",
"(",
"start",
")",
";",
"fis",
".",
"read",
"(",
"bs",
")",
";",
"}",
"return",
"new",
"String",
"(",
"bs",
")",
";",
"}"
] | 从指定位置读取指定长度
@param file 文件
@param start 开始位置
@param length 读取长度
@return 文件内容
@throws IOException 异常 | [
"从指定位置读取指定长度"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L946-L953 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java | StreamingJobsInner.beginCreateOrReplaceAsync | public Observable<StreamingJobInner> beginCreateOrReplaceAsync(String resourceGroupName, String jobName, StreamingJobInner streamingJob, String ifMatch, String ifNoneMatch) {
"""
Creates a streaming job or replaces an already existing streaming job.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@param streamingJob The definition of the streaming job that will be used to create a new streaming job or replace the existing one.
@param ifMatch The ETag of the streaming job. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes.
@param ifNoneMatch Set to '*' to allow a new streaming job to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed response.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StreamingJobInner object
"""
return beginCreateOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, streamingJob, ifMatch, ifNoneMatch).map(new Func1<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>, StreamingJobInner>() {
@Override
public StreamingJobInner call(ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders> response) {
return response.body();
}
});
} | java | public Observable<StreamingJobInner> beginCreateOrReplaceAsync(String resourceGroupName, String jobName, StreamingJobInner streamingJob, String ifMatch, String ifNoneMatch) {
return beginCreateOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, streamingJob, ifMatch, ifNoneMatch).map(new Func1<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>, StreamingJobInner>() {
@Override
public StreamingJobInner call(ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StreamingJobInner",
">",
"beginCreateOrReplaceAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"StreamingJobInner",
"streamingJob",
",",
"String",
"ifMatch",
",",
"String",
"ifNoneMatch",
")",
"{",
"return",
"beginCreateOrReplaceWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"jobName",
",",
"streamingJob",
",",
"ifMatch",
",",
"ifNoneMatch",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHeaders",
"<",
"StreamingJobInner",
",",
"StreamingJobsCreateOrReplaceHeaders",
">",
",",
"StreamingJobInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"StreamingJobInner",
"call",
"(",
"ServiceResponseWithHeaders",
"<",
"StreamingJobInner",
",",
"StreamingJobsCreateOrReplaceHeaders",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates a streaming job or replaces an already existing streaming job.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@param streamingJob The definition of the streaming job that will be used to create a new streaming job or replace the existing one.
@param ifMatch The ETag of the streaming job. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes.
@param ifNoneMatch Set to '*' to allow a new streaming job to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed response.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StreamingJobInner object | [
"Creates",
"a",
"streaming",
"job",
"or",
"replaces",
"an",
"already",
"existing",
"streaming",
"job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java#L428-L435 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/products/SwapAnnuity.java | SwapAnnuity.getSwapAnnuity | public static double getSwapAnnuity(double evaluationTime, Schedule schedule, DiscountCurve discountCurve, AnalyticModel model) {
"""
Function to calculate an (idealized) swap annuity for a given schedule and discount curve.
Note that, the value returned is divided by the discount factor at evaluation.
This matters, if the discount factor at evaluationTime is not equal to 1.0.
@param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered.
@param schedule The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period.
@param discountCurve The discount curve.
@param model The model, needed only in case the discount curve evaluation depends on an additional curve.
@return The swap annuity.
"""
double value = 0.0;
for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods(); periodIndex++) {
double paymentDate = schedule.getPayment(periodIndex);
if(paymentDate <= evaluationTime) {
continue;
}
double periodLength = schedule.getPeriodLength(periodIndex);
double discountFactor = discountCurve.getDiscountFactor(model, paymentDate);
value += periodLength * discountFactor;
}
return value / discountCurve.getDiscountFactor(model, evaluationTime);
} | java | public static double getSwapAnnuity(double evaluationTime, Schedule schedule, DiscountCurve discountCurve, AnalyticModel model) {
double value = 0.0;
for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods(); periodIndex++) {
double paymentDate = schedule.getPayment(periodIndex);
if(paymentDate <= evaluationTime) {
continue;
}
double periodLength = schedule.getPeriodLength(periodIndex);
double discountFactor = discountCurve.getDiscountFactor(model, paymentDate);
value += periodLength * discountFactor;
}
return value / discountCurve.getDiscountFactor(model, evaluationTime);
} | [
"public",
"static",
"double",
"getSwapAnnuity",
"(",
"double",
"evaluationTime",
",",
"Schedule",
"schedule",
",",
"DiscountCurve",
"discountCurve",
",",
"AnalyticModel",
"model",
")",
"{",
"double",
"value",
"=",
"0.0",
";",
"for",
"(",
"int",
"periodIndex",
"=",
"0",
";",
"periodIndex",
"<",
"schedule",
".",
"getNumberOfPeriods",
"(",
")",
";",
"periodIndex",
"++",
")",
"{",
"double",
"paymentDate",
"=",
"schedule",
".",
"getPayment",
"(",
"periodIndex",
")",
";",
"if",
"(",
"paymentDate",
"<=",
"evaluationTime",
")",
"{",
"continue",
";",
"}",
"double",
"periodLength",
"=",
"schedule",
".",
"getPeriodLength",
"(",
"periodIndex",
")",
";",
"double",
"discountFactor",
"=",
"discountCurve",
".",
"getDiscountFactor",
"(",
"model",
",",
"paymentDate",
")",
";",
"value",
"+=",
"periodLength",
"*",
"discountFactor",
";",
"}",
"return",
"value",
"/",
"discountCurve",
".",
"getDiscountFactor",
"(",
"model",
",",
"evaluationTime",
")",
";",
"}"
] | Function to calculate an (idealized) swap annuity for a given schedule and discount curve.
Note that, the value returned is divided by the discount factor at evaluation.
This matters, if the discount factor at evaluationTime is not equal to 1.0.
@param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered.
@param schedule The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period.
@param discountCurve The discount curve.
@param model The model, needed only in case the discount curve evaluation depends on an additional curve.
@return The swap annuity. | [
"Function",
"to",
"calculate",
"an",
"(",
"idealized",
")",
"swap",
"annuity",
"for",
"a",
"given",
"schedule",
"and",
"discount",
"curve",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/products/SwapAnnuity.java#L117-L130 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/core/download/BaseImageDownloader.java | BaseImageDownloader.getStreamFromAssets | protected InputStream getStreamFromAssets(String imageUri, Object extra) throws IOException {
"""
Retrieves {@link InputStream} of image by URI (image is located in assets of application).
@param imageUri Image URI
@param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForDownloader(Object)
DisplayImageOptions.extraForDownloader(Object)}; can be null
@return {@link InputStream} of image
@throws IOException if some I/O error occurs file reading
"""
String filePath = Scheme.ASSETS.crop(imageUri);
return context.getAssets().open(filePath);
} | java | protected InputStream getStreamFromAssets(String imageUri, Object extra) throws IOException {
String filePath = Scheme.ASSETS.crop(imageUri);
return context.getAssets().open(filePath);
} | [
"protected",
"InputStream",
"getStreamFromAssets",
"(",
"String",
"imageUri",
",",
"Object",
"extra",
")",
"throws",
"IOException",
"{",
"String",
"filePath",
"=",
"Scheme",
".",
"ASSETS",
".",
"crop",
"(",
"imageUri",
")",
";",
"return",
"context",
".",
"getAssets",
"(",
")",
".",
"open",
"(",
"filePath",
")",
";",
"}"
] | Retrieves {@link InputStream} of image by URI (image is located in assets of application).
@param imageUri Image URI
@param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForDownloader(Object)
DisplayImageOptions.extraForDownloader(Object)}; can be null
@return {@link InputStream} of image
@throws IOException if some I/O error occurs file reading | [
"Retrieves",
"{",
"@link",
"InputStream",
"}",
"of",
"image",
"by",
"URI",
"(",
"image",
"is",
"located",
"in",
"assets",
"of",
"application",
")",
"."
] | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/download/BaseImageDownloader.java#L247-L250 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.newPropertyChangeEvent | protected PropertyChangeEvent newPropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
"""
Creates a new instance of the PropertyChangeEvent initialized with this Bean as the source as well as the
name of the property that is changing along with the property's old and new values. A PropertyChangeEvent
will be created only if event dispatching to registered listeners is enabled and there are either
PropertyChangeListeners or VetoableChangeListeners registered on this Bean.
@param propertyName a String value specifying the name of the property on this Bean that is being changed.
@param oldValue an Object containing the old value of the specified property.
@param newValue an Object containing the new value for the specified property.
@return a PropertyChangeEvent for this Bean specifying the name of the property changing along with the
property's old and new value.
@see java.beans.PropertyChangeEvent
"""
if (isEventDispatchEnabled()) {
if (vetoableChangeSupport.hasListeners(propertyName) || propertyChangeSupport.hasListeners(propertyName)) {
return new PropertyChangeEvent(this, propertyName, oldValue, newValue);
}
}
return this.propertyChangeEvent;
} | java | protected PropertyChangeEvent newPropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
if (isEventDispatchEnabled()) {
if (vetoableChangeSupport.hasListeners(propertyName) || propertyChangeSupport.hasListeners(propertyName)) {
return new PropertyChangeEvent(this, propertyName, oldValue, newValue);
}
}
return this.propertyChangeEvent;
} | [
"protected",
"PropertyChangeEvent",
"newPropertyChangeEvent",
"(",
"String",
"propertyName",
",",
"Object",
"oldValue",
",",
"Object",
"newValue",
")",
"{",
"if",
"(",
"isEventDispatchEnabled",
"(",
")",
")",
"{",
"if",
"(",
"vetoableChangeSupport",
".",
"hasListeners",
"(",
"propertyName",
")",
"||",
"propertyChangeSupport",
".",
"hasListeners",
"(",
"propertyName",
")",
")",
"{",
"return",
"new",
"PropertyChangeEvent",
"(",
"this",
",",
"propertyName",
",",
"oldValue",
",",
"newValue",
")",
";",
"}",
"}",
"return",
"this",
".",
"propertyChangeEvent",
";",
"}"
] | Creates a new instance of the PropertyChangeEvent initialized with this Bean as the source as well as the
name of the property that is changing along with the property's old and new values. A PropertyChangeEvent
will be created only if event dispatching to registered listeners is enabled and there are either
PropertyChangeListeners or VetoableChangeListeners registered on this Bean.
@param propertyName a String value specifying the name of the property on this Bean that is being changed.
@param oldValue an Object containing the old value of the specified property.
@param newValue an Object containing the new value for the specified property.
@return a PropertyChangeEvent for this Bean specifying the name of the property changing along with the
property's old and new value.
@see java.beans.PropertyChangeEvent | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"PropertyChangeEvent",
"initialized",
"with",
"this",
"Bean",
"as",
"the",
"source",
"as",
"well",
"as",
"the",
"name",
"of",
"the",
"property",
"that",
"is",
"changing",
"along",
"with",
"the",
"property",
"s",
"old",
"and",
"new",
"values",
".",
"A",
"PropertyChangeEvent",
"will",
"be",
"created",
"only",
"if",
"event",
"dispatching",
"to",
"registered",
"listeners",
"is",
"enabled",
"and",
"there",
"are",
"either",
"PropertyChangeListeners",
"or",
"VetoableChangeListeners",
"registered",
"on",
"this",
"Bean",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L487-L495 |
criccomini/ezdb | ezdb-api/src/main/java/ezdb/comparator/SerdeComparator.java | SerdeComparator.innerCompare | protected int innerCompare(Comparable<Object> co1, Comparable<Object> co2) {
"""
Override this to customize the comparation itself. E.g. inversing it.
"""
return co1.compareTo(co2);
} | java | protected int innerCompare(Comparable<Object> co1, Comparable<Object> co2) {
return co1.compareTo(co2);
} | [
"protected",
"int",
"innerCompare",
"(",
"Comparable",
"<",
"Object",
">",
"co1",
",",
"Comparable",
"<",
"Object",
">",
"co2",
")",
"{",
"return",
"co1",
".",
"compareTo",
"(",
"co2",
")",
";",
"}"
] | Override this to customize the comparation itself. E.g. inversing it. | [
"Override",
"this",
"to",
"customize",
"the",
"comparation",
"itself",
".",
"E",
".",
"g",
".",
"inversing",
"it",
"."
] | train | https://github.com/criccomini/ezdb/blob/2adaccee179614f01e1c7e5af82a4f731e4e72cc/ezdb-api/src/main/java/ezdb/comparator/SerdeComparator.java#L37-L39 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/mmax/MMAXAnnotation.java | MMAXAnnotation.setPointerList | public void setPointerList(int i, MMAXPointer v) {
"""
indexed setter for pointerList - sets an indexed value - The list of MMAX pointers of the MMAX annotation.
@generated
@param i index in the array to set
@param v value to set into the array
"""
if (MMAXAnnotation_Type.featOkTst && ((MMAXAnnotation_Type)jcasType).casFeat_pointerList == null)
jcasType.jcas.throwFeatMissing("pointerList", "de.julielab.jules.types.mmax.MMAXAnnotation");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_pointerList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_pointerList), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setPointerList(int i, MMAXPointer v) {
if (MMAXAnnotation_Type.featOkTst && ((MMAXAnnotation_Type)jcasType).casFeat_pointerList == null)
jcasType.jcas.throwFeatMissing("pointerList", "de.julielab.jules.types.mmax.MMAXAnnotation");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_pointerList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_pointerList), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setPointerList",
"(",
"int",
"i",
",",
"MMAXPointer",
"v",
")",
"{",
"if",
"(",
"MMAXAnnotation_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"MMAXAnnotation_Type",
")",
"jcasType",
")",
".",
"casFeat_pointerList",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"pointerList\"",
",",
"\"de.julielab.jules.types.mmax.MMAXAnnotation\"",
")",
";",
"jcasType",
".",
"jcas",
".",
"checkArrayBounds",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"MMAXAnnotation_Type",
")",
"jcasType",
")",
".",
"casFeatCode_pointerList",
")",
",",
"i",
")",
";",
"jcasType",
".",
"ll_cas",
".",
"ll_setRefArrayValue",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"MMAXAnnotation_Type",
")",
"jcasType",
")",
".",
"casFeatCode_pointerList",
")",
",",
"i",
",",
"jcasType",
".",
"ll_cas",
".",
"ll_getFSRef",
"(",
"v",
")",
")",
";",
"}"
] | indexed setter for pointerList - sets an indexed value - The list of MMAX pointers of the MMAX annotation.
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"pointerList",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"The",
"list",
"of",
"MMAX",
"pointers",
"of",
"the",
"MMAX",
"annotation",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/mmax/MMAXAnnotation.java#L251-L255 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/FTPClient.java | FTPClient.getChecksum | public String getChecksum(String algorithm,
String path)
throws ClientException, ServerException, IOException {
"""
GridFTP v2 CKSM command for the whole file
@param algorithm ckeckum alorithm
@param path
@return ckecksum value returned by the server
@throws org.globus.ftp.exception.ClientException
@throws org.globus.ftp.exception.ServerException
@throws java.io.IOException
"""
return getChecksum(algorithm,0,-1,path);
} | java | public String getChecksum(String algorithm,
String path)
throws ClientException, ServerException, IOException {
return getChecksum(algorithm,0,-1,path);
} | [
"public",
"String",
"getChecksum",
"(",
"String",
"algorithm",
",",
"String",
"path",
")",
"throws",
"ClientException",
",",
"ServerException",
",",
"IOException",
"{",
"return",
"getChecksum",
"(",
"algorithm",
",",
"0",
",",
"-",
"1",
",",
"path",
")",
";",
"}"
] | GridFTP v2 CKSM command for the whole file
@param algorithm ckeckum alorithm
@param path
@return ckecksum value returned by the server
@throws org.globus.ftp.exception.ClientException
@throws org.globus.ftp.exception.ServerException
@throws java.io.IOException | [
"GridFTP",
"v2",
"CKSM",
"command",
"for",
"the",
"whole",
"file"
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L2186-L2190 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java | LabsInner.update | public LabInner update(String resourceGroupName, String labAccountName, String labName, LabFragment lab) {
"""
Modify properties of labs.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param lab Represents a lab.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the LabInner object if successful.
"""
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, lab).toBlocking().single().body();
} | java | public LabInner update(String resourceGroupName, String labAccountName, String labName, LabFragment lab) {
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, lab).toBlocking().single().body();
} | [
"public",
"LabInner",
"update",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"LabFragment",
"lab",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
",",
"labName",
",",
"lab",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Modify properties of labs.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param lab Represents a lab.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the LabInner object if successful. | [
"Modify",
"properties",
"of",
"labs",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java#L835-L837 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/learning/ConfusionMatrixPanel.java | ConfusionMatrixPanel.renderLabels | private void renderLabels(Graphics2D g2, double fontSize) {
"""
Renders the names on each category to the side of the confusion matrix
"""
int numCategories = confusion.getNumRows();
int longestLabel = 0;
if(renderLabels) {
for (int i = 0; i < numCategories; i++) {
longestLabel = Math.max(longestLabel,labels.get(i).length());
}
}
Font fontLabel = new Font("monospaced", Font.BOLD, (int)(0.055*longestLabel*fontSize + 0.5));
g2.setFont(fontLabel);
FontMetrics metrics = g2.getFontMetrics(fontLabel);
// clear the background
g2.setColor(Color.WHITE);
g2.fillRect(gridWidth,0,viewWidth-gridWidth,viewHeight);
// draw the text
g2.setColor(Color.BLACK);
for (int i = 0; i < numCategories; i++) {
String label = labels.get(i);
int y0 = i * gridHeight / numCategories;
int y1 = (i + 1) * gridHeight / numCategories;
Rectangle2D r = metrics.getStringBounds(label,null);
float adjX = (float)(r.getX()*2 + r.getWidth())/2.0f;
float adjY = (float)(r.getY()*2 + r.getHeight())/2.0f;
float x = ((viewWidth+gridWidth)/2f-adjX);
float y = ((y1+y0)/2f-adjY);
g2.drawString(label, x, y);
}
} | java | private void renderLabels(Graphics2D g2, double fontSize) {
int numCategories = confusion.getNumRows();
int longestLabel = 0;
if(renderLabels) {
for (int i = 0; i < numCategories; i++) {
longestLabel = Math.max(longestLabel,labels.get(i).length());
}
}
Font fontLabel = new Font("monospaced", Font.BOLD, (int)(0.055*longestLabel*fontSize + 0.5));
g2.setFont(fontLabel);
FontMetrics metrics = g2.getFontMetrics(fontLabel);
// clear the background
g2.setColor(Color.WHITE);
g2.fillRect(gridWidth,0,viewWidth-gridWidth,viewHeight);
// draw the text
g2.setColor(Color.BLACK);
for (int i = 0; i < numCategories; i++) {
String label = labels.get(i);
int y0 = i * gridHeight / numCategories;
int y1 = (i + 1) * gridHeight / numCategories;
Rectangle2D r = metrics.getStringBounds(label,null);
float adjX = (float)(r.getX()*2 + r.getWidth())/2.0f;
float adjY = (float)(r.getY()*2 + r.getHeight())/2.0f;
float x = ((viewWidth+gridWidth)/2f-adjX);
float y = ((y1+y0)/2f-adjY);
g2.drawString(label, x, y);
}
} | [
"private",
"void",
"renderLabels",
"(",
"Graphics2D",
"g2",
",",
"double",
"fontSize",
")",
"{",
"int",
"numCategories",
"=",
"confusion",
".",
"getNumRows",
"(",
")",
";",
"int",
"longestLabel",
"=",
"0",
";",
"if",
"(",
"renderLabels",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numCategories",
";",
"i",
"++",
")",
"{",
"longestLabel",
"=",
"Math",
".",
"max",
"(",
"longestLabel",
",",
"labels",
".",
"get",
"(",
"i",
")",
".",
"length",
"(",
")",
")",
";",
"}",
"}",
"Font",
"fontLabel",
"=",
"new",
"Font",
"(",
"\"monospaced\"",
",",
"Font",
".",
"BOLD",
",",
"(",
"int",
")",
"(",
"0.055",
"*",
"longestLabel",
"*",
"fontSize",
"+",
"0.5",
")",
")",
";",
"g2",
".",
"setFont",
"(",
"fontLabel",
")",
";",
"FontMetrics",
"metrics",
"=",
"g2",
".",
"getFontMetrics",
"(",
"fontLabel",
")",
";",
"// clear the background",
"g2",
".",
"setColor",
"(",
"Color",
".",
"WHITE",
")",
";",
"g2",
".",
"fillRect",
"(",
"gridWidth",
",",
"0",
",",
"viewWidth",
"-",
"gridWidth",
",",
"viewHeight",
")",
";",
"// draw the text",
"g2",
".",
"setColor",
"(",
"Color",
".",
"BLACK",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numCategories",
";",
"i",
"++",
")",
"{",
"String",
"label",
"=",
"labels",
".",
"get",
"(",
"i",
")",
";",
"int",
"y0",
"=",
"i",
"*",
"gridHeight",
"/",
"numCategories",
";",
"int",
"y1",
"=",
"(",
"i",
"+",
"1",
")",
"*",
"gridHeight",
"/",
"numCategories",
";",
"Rectangle2D",
"r",
"=",
"metrics",
".",
"getStringBounds",
"(",
"label",
",",
"null",
")",
";",
"float",
"adjX",
"=",
"(",
"float",
")",
"(",
"r",
".",
"getX",
"(",
")",
"*",
"2",
"+",
"r",
".",
"getWidth",
"(",
")",
")",
"/",
"2.0f",
";",
"float",
"adjY",
"=",
"(",
"float",
")",
"(",
"r",
".",
"getY",
"(",
")",
"*",
"2",
"+",
"r",
".",
"getHeight",
"(",
")",
")",
"/",
"2.0f",
";",
"float",
"x",
"=",
"(",
"(",
"viewWidth",
"+",
"gridWidth",
")",
"/",
"2f",
"-",
"adjX",
")",
";",
"float",
"y",
"=",
"(",
"(",
"y1",
"+",
"y0",
")",
"/",
"2f",
"-",
"adjY",
")",
";",
"g2",
".",
"drawString",
"(",
"label",
",",
"x",
",",
"y",
")",
";",
"}",
"}"
] | Renders the names on each category to the side of the confusion matrix | [
"Renders",
"the",
"names",
"on",
"each",
"category",
"to",
"the",
"side",
"of",
"the",
"confusion",
"matrix"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/learning/ConfusionMatrixPanel.java#L200-L236 |
GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java | MaterialAutoComplete.setup | protected void setup(SuggestOracle suggestions) {
"""
Generate and build the List Items to be set on Auto Complete box.
"""
if (itemBoxKeyDownHandler != null) {
itemBoxKeyDownHandler.removeHandler();
}
list.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_LIST);
this.suggestions = suggestions;
final ListItem item = new ListItem();
item.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_INPUT_TOKEN);
suggestBox = new SuggestBox(suggestions, itemBox);
suggestBox.addSelectionHandler(selectionEvent -> {
Suggestion selectedItem = selectionEvent.getSelectedItem();
itemBox.setValue("");
if (addItem(selectedItem)) {
ValueChangeEvent.fire(MaterialAutoComplete.this, getValue());
}
itemBox.setFocus(true);
});
loadHandlers();
setLimit(this.limit);
String autocompleteId = DOM.createUniqueId();
itemBox.getElement().setId(autocompleteId);
item.add(suggestBox);
item.add(label);
list.add(item);
panel.add(list);
panel.getElement().setAttribute("onclick",
"document.getElementById('" + autocompleteId + "').focus()");
panel.add(errorLabel);
suggestBox.setFocus(true);
} | java | protected void setup(SuggestOracle suggestions) {
if (itemBoxKeyDownHandler != null) {
itemBoxKeyDownHandler.removeHandler();
}
list.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_LIST);
this.suggestions = suggestions;
final ListItem item = new ListItem();
item.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_INPUT_TOKEN);
suggestBox = new SuggestBox(suggestions, itemBox);
suggestBox.addSelectionHandler(selectionEvent -> {
Suggestion selectedItem = selectionEvent.getSelectedItem();
itemBox.setValue("");
if (addItem(selectedItem)) {
ValueChangeEvent.fire(MaterialAutoComplete.this, getValue());
}
itemBox.setFocus(true);
});
loadHandlers();
setLimit(this.limit);
String autocompleteId = DOM.createUniqueId();
itemBox.getElement().setId(autocompleteId);
item.add(suggestBox);
item.add(label);
list.add(item);
panel.add(list);
panel.getElement().setAttribute("onclick",
"document.getElementById('" + autocompleteId + "').focus()");
panel.add(errorLabel);
suggestBox.setFocus(true);
} | [
"protected",
"void",
"setup",
"(",
"SuggestOracle",
"suggestions",
")",
"{",
"if",
"(",
"itemBoxKeyDownHandler",
"!=",
"null",
")",
"{",
"itemBoxKeyDownHandler",
".",
"removeHandler",
"(",
")",
";",
"}",
"list",
".",
"setStyleName",
"(",
"AddinsCssName",
".",
"MULTIVALUESUGGESTBOX_LIST",
")",
";",
"this",
".",
"suggestions",
"=",
"suggestions",
";",
"final",
"ListItem",
"item",
"=",
"new",
"ListItem",
"(",
")",
";",
"item",
".",
"setStyleName",
"(",
"AddinsCssName",
".",
"MULTIVALUESUGGESTBOX_INPUT_TOKEN",
")",
";",
"suggestBox",
"=",
"new",
"SuggestBox",
"(",
"suggestions",
",",
"itemBox",
")",
";",
"suggestBox",
".",
"addSelectionHandler",
"(",
"selectionEvent",
"->",
"{",
"Suggestion",
"selectedItem",
"=",
"selectionEvent",
".",
"getSelectedItem",
"(",
")",
";",
"itemBox",
".",
"setValue",
"(",
"\"\"",
")",
";",
"if",
"(",
"addItem",
"(",
"selectedItem",
")",
")",
"{",
"ValueChangeEvent",
".",
"fire",
"(",
"MaterialAutoComplete",
".",
"this",
",",
"getValue",
"(",
")",
")",
";",
"}",
"itemBox",
".",
"setFocus",
"(",
"true",
")",
";",
"}",
")",
";",
"loadHandlers",
"(",
")",
";",
"setLimit",
"(",
"this",
".",
"limit",
")",
";",
"String",
"autocompleteId",
"=",
"DOM",
".",
"createUniqueId",
"(",
")",
";",
"itemBox",
".",
"getElement",
"(",
")",
".",
"setId",
"(",
"autocompleteId",
")",
";",
"item",
".",
"add",
"(",
"suggestBox",
")",
";",
"item",
".",
"add",
"(",
"label",
")",
";",
"list",
".",
"add",
"(",
"item",
")",
";",
"panel",
".",
"add",
"(",
"list",
")",
";",
"panel",
".",
"getElement",
"(",
")",
".",
"setAttribute",
"(",
"\"onclick\"",
",",
"\"document.getElementById('\"",
"+",
"autocompleteId",
"+",
"\"').focus()\"",
")",
";",
"panel",
".",
"add",
"(",
"errorLabel",
")",
";",
"suggestBox",
".",
"setFocus",
"(",
"true",
")",
";",
"}"
] | Generate and build the List Items to be set on Auto Complete box. | [
"Generate",
"and",
"build",
"the",
"List",
"Items",
"to",
"be",
"set",
"on",
"Auto",
"Complete",
"box",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java#L312-L349 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArrayFor | public static <T> Level0ArrayOperator<Date[],Date> onArrayFor(final Date... elements) {
"""
<p>
Creates an array with the specified elements and an <i>operation expression</i> on it.
</p>
@param elements the elements of the array being created
@return an operator, ready for chaining
"""
return onArrayOf(Types.DATE, VarArgsUtil.asRequiredObjectArray(elements));
} | java | public static <T> Level0ArrayOperator<Date[],Date> onArrayFor(final Date... elements) {
return onArrayOf(Types.DATE, VarArgsUtil.asRequiredObjectArray(elements));
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"Date",
"[",
"]",
",",
"Date",
">",
"onArrayFor",
"(",
"final",
"Date",
"...",
"elements",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"DATE",
",",
"VarArgsUtil",
".",
"asRequiredObjectArray",
"(",
"elements",
")",
")",
";",
"}"
] | <p>
Creates an array with the specified elements and an <i>operation expression</i> on it.
</p>
@param elements the elements of the array being created
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"array",
"with",
"the",
"specified",
"elements",
"and",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"it",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L1036-L1038 |
alibaba/otter | node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlUtils.java | SqlUtils.getResultSetValue | private static String getResultSetValue(ResultSet rs, int index) throws SQLException {
"""
Retrieve a JDBC column value from a ResultSet, using the most appropriate
value type. The returned value should be a detached value object, not
having any ties to the active ResultSet: in particular, it should not be
a Blob or Clob object but rather a byte array respectively String
representation.
<p>
Uses the <code>getObject(index)</code> method, but includes additional
"hacks" to get around Oracle 10g returning a non-standard object for its
TIMESTAMP datatype and a <code>java.sql.Date</code> for DATE columns
leaving out the time portion: These columns will explicitly be extracted
as standard <code>java.sql.Timestamp</code> object.
@param rs is the ResultSet holding the data
@param index is the column index
@return the value object
@throws SQLException if thrown by the JDBC API
@see java.sql.Blob
@see java.sql.Clob
@see java.sql.Timestamp
"""
Object obj = rs.getObject(index);
return (obj == null) ? null : convertUtilsBean.convert(obj);
} | java | private static String getResultSetValue(ResultSet rs, int index) throws SQLException {
Object obj = rs.getObject(index);
return (obj == null) ? null : convertUtilsBean.convert(obj);
} | [
"private",
"static",
"String",
"getResultSetValue",
"(",
"ResultSet",
"rs",
",",
"int",
"index",
")",
"throws",
"SQLException",
"{",
"Object",
"obj",
"=",
"rs",
".",
"getObject",
"(",
"index",
")",
";",
"return",
"(",
"obj",
"==",
"null",
")",
"?",
"null",
":",
"convertUtilsBean",
".",
"convert",
"(",
"obj",
")",
";",
"}"
] | Retrieve a JDBC column value from a ResultSet, using the most appropriate
value type. The returned value should be a detached value object, not
having any ties to the active ResultSet: in particular, it should not be
a Blob or Clob object but rather a byte array respectively String
representation.
<p>
Uses the <code>getObject(index)</code> method, but includes additional
"hacks" to get around Oracle 10g returning a non-standard object for its
TIMESTAMP datatype and a <code>java.sql.Date</code> for DATE columns
leaving out the time portion: These columns will explicitly be extracted
as standard <code>java.sql.Timestamp</code> object.
@param rs is the ResultSet holding the data
@param index is the column index
@return the value object
@throws SQLException if thrown by the JDBC API
@see java.sql.Blob
@see java.sql.Clob
@see java.sql.Timestamp | [
"Retrieve",
"a",
"JDBC",
"column",
"value",
"from",
"a",
"ResultSet",
"using",
"the",
"most",
"appropriate",
"value",
"type",
".",
"The",
"returned",
"value",
"should",
"be",
"a",
"detached",
"value",
"object",
"not",
"having",
"any",
"ties",
"to",
"the",
"active",
"ResultSet",
":",
"in",
"particular",
"it",
"should",
"not",
"be",
"a",
"Blob",
"or",
"Clob",
"object",
"but",
"rather",
"a",
"byte",
"array",
"respectively",
"String",
"representation",
".",
"<p",
">",
"Uses",
"the",
"<code",
">",
"getObject",
"(",
"index",
")",
"<",
"/",
"code",
">",
"method",
"but",
"includes",
"additional",
"hacks",
"to",
"get",
"around",
"Oracle",
"10g",
"returning",
"a",
"non",
"-",
"standard",
"object",
"for",
"its",
"TIMESTAMP",
"datatype",
"and",
"a",
"<code",
">",
"java",
".",
"sql",
".",
"Date<",
"/",
"code",
">",
"for",
"DATE",
"columns",
"leaving",
"out",
"the",
"time",
"portion",
":",
"These",
"columns",
"will",
"explicitly",
"be",
"extracted",
"as",
"standard",
"<code",
">",
"java",
".",
"sql",
".",
"Timestamp<",
"/",
"code",
">",
"object",
"."
] | train | https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlUtils.java#L310-L313 |
Coveros/selenified | src/main/java/com/coveros/selenified/services/HTTP.java | HTTP.getConnection | private HttpURLConnection getConnection(URL url) throws IOException {
"""
Opens the URL connection, and if a proxy is provided, uses the proxy to establish the connection
@param url - the url to connect to
@return HttpURLConnection: our established http connection
@throws IOException: if the connection can't be established, an IOException is thrown
"""
Proxy proxy = Proxy.NO_PROXY;
if (Property.isProxySet()) {
SocketAddress addr = new InetSocketAddress(Property.getProxyHost(), Property.getProxyPort());
proxy = new Proxy(Proxy.Type.HTTP, addr);
}
return (HttpURLConnection) url.openConnection(proxy);
} | java | private HttpURLConnection getConnection(URL url) throws IOException {
Proxy proxy = Proxy.NO_PROXY;
if (Property.isProxySet()) {
SocketAddress addr = new InetSocketAddress(Property.getProxyHost(), Property.getProxyPort());
proxy = new Proxy(Proxy.Type.HTTP, addr);
}
return (HttpURLConnection) url.openConnection(proxy);
} | [
"private",
"HttpURLConnection",
"getConnection",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"Proxy",
"proxy",
"=",
"Proxy",
".",
"NO_PROXY",
";",
"if",
"(",
"Property",
".",
"isProxySet",
"(",
")",
")",
"{",
"SocketAddress",
"addr",
"=",
"new",
"InetSocketAddress",
"(",
"Property",
".",
"getProxyHost",
"(",
")",
",",
"Property",
".",
"getProxyPort",
"(",
")",
")",
";",
"proxy",
"=",
"new",
"Proxy",
"(",
"Proxy",
".",
"Type",
".",
"HTTP",
",",
"addr",
")",
";",
"}",
"return",
"(",
"HttpURLConnection",
")",
"url",
".",
"openConnection",
"(",
"proxy",
")",
";",
"}"
] | Opens the URL connection, and if a proxy is provided, uses the proxy to establish the connection
@param url - the url to connect to
@return HttpURLConnection: our established http connection
@throws IOException: if the connection can't be established, an IOException is thrown | [
"Opens",
"the",
"URL",
"connection",
"and",
"if",
"a",
"proxy",
"is",
"provided",
"uses",
"the",
"proxy",
"to",
"establish",
"the",
"connection"
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/services/HTTP.java#L327-L334 |
facebookarchive/hadoop-20 | src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ImageLibrary.java | ImageLibrary.newImage | private boolean newImage(String name, String filename) {
"""
Load and register a new image. If the image resource does not exist or
fails to load, a default "error" resource is supplied.
@param name name of the image
@param filename name of the file containing the image
@return whether the image has correctly been loaded
"""
ImageDescriptor id;
boolean success;
try {
URL fileURL =
FileLocator.find(bundle, new Path(RESOURCE_DIR + filename), null);
id = ImageDescriptor.createFromURL(FileLocator.toFileURL(fileURL));
success = true;
} catch (Exception e) {
e.printStackTrace();
id = ImageDescriptor.getMissingImageDescriptor();
// id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);
success = false;
}
descMap.put(name, id);
imageMap.put(name, id.createImage(true));
return success;
} | java | private boolean newImage(String name, String filename) {
ImageDescriptor id;
boolean success;
try {
URL fileURL =
FileLocator.find(bundle, new Path(RESOURCE_DIR + filename), null);
id = ImageDescriptor.createFromURL(FileLocator.toFileURL(fileURL));
success = true;
} catch (Exception e) {
e.printStackTrace();
id = ImageDescriptor.getMissingImageDescriptor();
// id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);
success = false;
}
descMap.put(name, id);
imageMap.put(name, id.createImage(true));
return success;
} | [
"private",
"boolean",
"newImage",
"(",
"String",
"name",
",",
"String",
"filename",
")",
"{",
"ImageDescriptor",
"id",
";",
"boolean",
"success",
";",
"try",
"{",
"URL",
"fileURL",
"=",
"FileLocator",
".",
"find",
"(",
"bundle",
",",
"new",
"Path",
"(",
"RESOURCE_DIR",
"+",
"filename",
")",
",",
"null",
")",
";",
"id",
"=",
"ImageDescriptor",
".",
"createFromURL",
"(",
"FileLocator",
".",
"toFileURL",
"(",
"fileURL",
")",
")",
";",
"success",
"=",
"true",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"id",
"=",
"ImageDescriptor",
".",
"getMissingImageDescriptor",
"(",
")",
";",
"// id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);",
"success",
"=",
"false",
";",
"}",
"descMap",
".",
"put",
"(",
"name",
",",
"id",
")",
";",
"imageMap",
".",
"put",
"(",
"name",
",",
"id",
".",
"createImage",
"(",
"true",
")",
")",
";",
"return",
"success",
";",
"}"
] | Load and register a new image. If the image resource does not exist or
fails to load, a default "error" resource is supplied.
@param name name of the image
@param filename name of the file containing the image
@return whether the image has correctly been loaded | [
"Load",
"and",
"register",
"a",
"new",
"image",
".",
"If",
"the",
"image",
"resource",
"does",
"not",
"exist",
"or",
"fails",
"to",
"load",
"a",
"default",
"error",
"resource",
"is",
"supplied",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ImageLibrary.java#L176-L198 |
cdk/cdk | misc/extra/src/main/java/org/openscience/cdk/io/VASPReader.java | VASPReader.nextVASPTokenFollowing | public String nextVASPTokenFollowing(String string) throws IOException {
"""
Find the next token of a VASP file beginning
with the *next* line.
"""
int index;
String line;
while (inputBuffer.ready()) {
line = inputBuffer.readLine();
index = line.indexOf(string);
if (index > 0) {
index = index + string.length();
line = line.substring(index);
st = new StringTokenizer(line, " =\t");
while (!st.hasMoreTokens() && inputBuffer.ready()) {
line = inputBuffer.readLine();
st = new StringTokenizer(line, " =\t");
}
if (st.hasMoreTokens()) {
fieldVal = st.nextToken();
} else {
fieldVal = null;
}
break;
}
}
return fieldVal;
} | java | public String nextVASPTokenFollowing(String string) throws IOException {
int index;
String line;
while (inputBuffer.ready()) {
line = inputBuffer.readLine();
index = line.indexOf(string);
if (index > 0) {
index = index + string.length();
line = line.substring(index);
st = new StringTokenizer(line, " =\t");
while (!st.hasMoreTokens() && inputBuffer.ready()) {
line = inputBuffer.readLine();
st = new StringTokenizer(line, " =\t");
}
if (st.hasMoreTokens()) {
fieldVal = st.nextToken();
} else {
fieldVal = null;
}
break;
}
}
return fieldVal;
} | [
"public",
"String",
"nextVASPTokenFollowing",
"(",
"String",
"string",
")",
"throws",
"IOException",
"{",
"int",
"index",
";",
"String",
"line",
";",
"while",
"(",
"inputBuffer",
".",
"ready",
"(",
")",
")",
"{",
"line",
"=",
"inputBuffer",
".",
"readLine",
"(",
")",
";",
"index",
"=",
"line",
".",
"indexOf",
"(",
"string",
")",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"index",
"=",
"index",
"+",
"string",
".",
"length",
"(",
")",
";",
"line",
"=",
"line",
".",
"substring",
"(",
"index",
")",
";",
"st",
"=",
"new",
"StringTokenizer",
"(",
"line",
",",
"\" =\\t\"",
")",
";",
"while",
"(",
"!",
"st",
".",
"hasMoreTokens",
"(",
")",
"&&",
"inputBuffer",
".",
"ready",
"(",
")",
")",
"{",
"line",
"=",
"inputBuffer",
".",
"readLine",
"(",
")",
";",
"st",
"=",
"new",
"StringTokenizer",
"(",
"line",
",",
"\" =\\t\"",
")",
";",
"}",
"if",
"(",
"st",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"fieldVal",
"=",
"st",
".",
"nextToken",
"(",
")",
";",
"}",
"else",
"{",
"fieldVal",
"=",
"null",
";",
"}",
"break",
";",
"}",
"}",
"return",
"fieldVal",
";",
"}"
] | Find the next token of a VASP file beginning
with the *next* line. | [
"Find",
"the",
"next",
"token",
"of",
"a",
"VASP",
"file",
"beginning",
"with",
"the",
"*",
"next",
"*",
"line",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/misc/extra/src/main/java/org/openscience/cdk/io/VASPReader.java#L310-L333 |
knowm/XChange | xchange-core/src/main/java/org/knowm/xchange/utils/DateUtils.java | DateUtils.fromISO8601DateString | public static Date fromISO8601DateString(String iso8601FormattedDate)
throws com.fasterxml.jackson.databind.exc.InvalidFormatException {
"""
Converts an ISO 8601 formatted Date String to a Java Date ISO 8601 format:
yyyy-MM-dd'T'HH:mm:ss
@param iso8601FormattedDate
@return Date
@throws com.fasterxml.jackson.databind.exc.InvalidFormatException
"""
SimpleDateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
// set UTC time zone
iso8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
return iso8601Format.parse(iso8601FormattedDate);
} catch (ParseException e) {
throw new InvalidFormatException("Error parsing as date", iso8601FormattedDate, Date.class);
}
} | java | public static Date fromISO8601DateString(String iso8601FormattedDate)
throws com.fasterxml.jackson.databind.exc.InvalidFormatException {
SimpleDateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
// set UTC time zone
iso8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
return iso8601Format.parse(iso8601FormattedDate);
} catch (ParseException e) {
throw new InvalidFormatException("Error parsing as date", iso8601FormattedDate, Date.class);
}
} | [
"public",
"static",
"Date",
"fromISO8601DateString",
"(",
"String",
"iso8601FormattedDate",
")",
"throws",
"com",
".",
"fasterxml",
".",
"jackson",
".",
"databind",
".",
"exc",
".",
"InvalidFormatException",
"{",
"SimpleDateFormat",
"iso8601Format",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ss\"",
")",
";",
"// set UTC time zone",
"iso8601Format",
".",
"setTimeZone",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"UTC\"",
")",
")",
";",
"try",
"{",
"return",
"iso8601Format",
".",
"parse",
"(",
"iso8601FormattedDate",
")",
";",
"}",
"catch",
"(",
"ParseException",
"e",
")",
"{",
"throw",
"new",
"InvalidFormatException",
"(",
"\"Error parsing as date\"",
",",
"iso8601FormattedDate",
",",
"Date",
".",
"class",
")",
";",
"}",
"}"
] | Converts an ISO 8601 formatted Date String to a Java Date ISO 8601 format:
yyyy-MM-dd'T'HH:mm:ss
@param iso8601FormattedDate
@return Date
@throws com.fasterxml.jackson.databind.exc.InvalidFormatException | [
"Converts",
"an",
"ISO",
"8601",
"formatted",
"Date",
"String",
"to",
"a",
"Java",
"Date",
"ISO",
"8601",
"format",
":",
"yyyy",
"-",
"MM",
"-",
"dd",
"T",
"HH",
":",
"mm",
":",
"ss"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/DateUtils.java#L74-L85 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java | MarshallUtil.marshallMap | public static <K, V, T extends Map<K, V>> void marshallMap(T map, ObjectOutput out) throws IOException {
"""
Marshall the {@code map} to the {@code ObjectOutput}.
<p>
{@code null} maps are supported.
@param map {@link Map} to marshall.
@param out {@link ObjectOutput} to write. It must be non-null.
@param <K> Key type of the map.
@param <V> Value type of the map.
@param <T> Type of the {@link Map}.
@throws IOException If any of the usual Input/Output related exceptions occur.
"""
final int mapSize = map == null ? NULL_VALUE : map.size();
marshallSize(out, mapSize);
if (mapSize <= 0) return;
for (Map.Entry<K, V> me : map.entrySet()) {
out.writeObject(me.getKey());
out.writeObject(me.getValue());
}
} | java | public static <K, V, T extends Map<K, V>> void marshallMap(T map, ObjectOutput out) throws IOException {
final int mapSize = map == null ? NULL_VALUE : map.size();
marshallSize(out, mapSize);
if (mapSize <= 0) return;
for (Map.Entry<K, V> me : map.entrySet()) {
out.writeObject(me.getKey());
out.writeObject(me.getValue());
}
} | [
"public",
"static",
"<",
"K",
",",
"V",
",",
"T",
"extends",
"Map",
"<",
"K",
",",
"V",
">",
">",
"void",
"marshallMap",
"(",
"T",
"map",
",",
"ObjectOutput",
"out",
")",
"throws",
"IOException",
"{",
"final",
"int",
"mapSize",
"=",
"map",
"==",
"null",
"?",
"NULL_VALUE",
":",
"map",
".",
"size",
"(",
")",
";",
"marshallSize",
"(",
"out",
",",
"mapSize",
")",
";",
"if",
"(",
"mapSize",
"<=",
"0",
")",
"return",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
"me",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"out",
".",
"writeObject",
"(",
"me",
".",
"getKey",
"(",
")",
")",
";",
"out",
".",
"writeObject",
"(",
"me",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] | Marshall the {@code map} to the {@code ObjectOutput}.
<p>
{@code null} maps are supported.
@param map {@link Map} to marshall.
@param out {@link ObjectOutput} to write. It must be non-null.
@param <K> Key type of the map.
@param <V> Value type of the map.
@param <T> Type of the {@link Map}.
@throws IOException If any of the usual Input/Output related exceptions occur. | [
"Marshall",
"the",
"{",
"@code",
"map",
"}",
"to",
"the",
"{",
"@code",
"ObjectOutput",
"}",
".",
"<p",
">",
"{",
"@code",
"null",
"}",
"maps",
"are",
"supported",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java#L56-L65 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java | TaskOperations.createTask | public void createTask(String jobId, TaskAddParameter taskToAdd) throws BatchErrorException, IOException {
"""
Adds a single task to a job.
@param jobId
The ID of the job to which to add the task.
@param taskToAdd
The {@link TaskAddParameter task} to add.
@throws BatchErrorException
Exception thrown when an error response is received from the
Batch service.
@throws IOException
Exception thrown when there is an error in
serialization/deserialization of data sent to/received from the
Batch service.
"""
createTask(jobId, taskToAdd, null);
} | java | public void createTask(String jobId, TaskAddParameter taskToAdd) throws BatchErrorException, IOException {
createTask(jobId, taskToAdd, null);
} | [
"public",
"void",
"createTask",
"(",
"String",
"jobId",
",",
"TaskAddParameter",
"taskToAdd",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"createTask",
"(",
"jobId",
",",
"taskToAdd",
",",
"null",
")",
";",
"}"
] | Adds a single task to a job.
@param jobId
The ID of the job to which to add the task.
@param taskToAdd
The {@link TaskAddParameter task} to add.
@throws BatchErrorException
Exception thrown when an error response is received from the
Batch service.
@throws IOException
Exception thrown when there is an error in
serialization/deserialization of data sent to/received from the
Batch service. | [
"Adds",
"a",
"single",
"task",
"to",
"a",
"job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java#L94-L96 |
square/dagger | compiler/src/main/java/dagger/internal/codegen/GraphAnalysisLoader.java | GraphAnalysisLoader.resolveType | @VisibleForTesting static TypeElement resolveType(Elements elements, String className) {
"""
Resolves the given class name into a {@link TypeElement}. The class name is a binary name, but
{@link Elements#getTypeElement(CharSequence)} wants a canonical name. So this method searches
the space of possible canonical names, starting with the most likely (since '$' is rarely used
in canonical class names).
"""
int index = nextDollar(className, className, 0);
if (index == -1) {
return getTypeElement(elements, className);
}
// have to test various possibilities of replacing '$' with '.' since '.' in a canonical name
// of a nested type is replaced with '$' in the binary name.
StringBuilder sb = new StringBuilder(className);
return resolveType(elements, className, sb, index);
} | java | @VisibleForTesting static TypeElement resolveType(Elements elements, String className) {
int index = nextDollar(className, className, 0);
if (index == -1) {
return getTypeElement(elements, className);
}
// have to test various possibilities of replacing '$' with '.' since '.' in a canonical name
// of a nested type is replaced with '$' in the binary name.
StringBuilder sb = new StringBuilder(className);
return resolveType(elements, className, sb, index);
} | [
"@",
"VisibleForTesting",
"static",
"TypeElement",
"resolveType",
"(",
"Elements",
"elements",
",",
"String",
"className",
")",
"{",
"int",
"index",
"=",
"nextDollar",
"(",
"className",
",",
"className",
",",
"0",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"return",
"getTypeElement",
"(",
"elements",
",",
"className",
")",
";",
"}",
"// have to test various possibilities of replacing '$' with '.' since '.' in a canonical name",
"// of a nested type is replaced with '$' in the binary name.",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"className",
")",
";",
"return",
"resolveType",
"(",
"elements",
",",
"className",
",",
"sb",
",",
"index",
")",
";",
"}"
] | Resolves the given class name into a {@link TypeElement}. The class name is a binary name, but
{@link Elements#getTypeElement(CharSequence)} wants a canonical name. So this method searches
the space of possible canonical names, starting with the most likely (since '$' is rarely used
in canonical class names). | [
"Resolves",
"the",
"given",
"class",
"name",
"into",
"a",
"{"
] | train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/compiler/src/main/java/dagger/internal/codegen/GraphAnalysisLoader.java#L64-L73 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/CommonExpectations.java | CommonExpectations.successfullyReachedUrl | public static Expectations successfullyReachedUrl(String testAction, String url) {
"""
Sets expectations that will check:
<ol>
<li>200 status code in the response for the specified test action
<li>Response URL is equivalent to provided URL
</ol>
"""
Expectations expectations = new Expectations();
expectations.addSuccessStatusCodesForActions(new String[] { testAction });
expectations.addExpectation(new ResponseUrlExpectation(testAction, Constants.STRING_EQUALS, url, "Did not reach the expected URL."));
return expectations;
} | java | public static Expectations successfullyReachedUrl(String testAction, String url) {
Expectations expectations = new Expectations();
expectations.addSuccessStatusCodesForActions(new String[] { testAction });
expectations.addExpectation(new ResponseUrlExpectation(testAction, Constants.STRING_EQUALS, url, "Did not reach the expected URL."));
return expectations;
} | [
"public",
"static",
"Expectations",
"successfullyReachedUrl",
"(",
"String",
"testAction",
",",
"String",
"url",
")",
"{",
"Expectations",
"expectations",
"=",
"new",
"Expectations",
"(",
")",
";",
"expectations",
".",
"addSuccessStatusCodesForActions",
"(",
"new",
"String",
"[",
"]",
"{",
"testAction",
"}",
")",
";",
"expectations",
".",
"addExpectation",
"(",
"new",
"ResponseUrlExpectation",
"(",
"testAction",
",",
"Constants",
".",
"STRING_EQUALS",
",",
"url",
",",
"\"Did not reach the expected URL.\"",
")",
")",
";",
"return",
"expectations",
";",
"}"
] | Sets expectations that will check:
<ol>
<li>200 status code in the response for the specified test action
<li>Response URL is equivalent to provided URL
</ol> | [
"Sets",
"expectations",
"that",
"will",
"check",
":",
"<ol",
">",
"<li",
">",
"200",
"status",
"code",
"in",
"the",
"response",
"for",
"the",
"specified",
"test",
"action",
"<li",
">",
"Response",
"URL",
"is",
"equivalent",
"to",
"provided",
"URL",
"<",
"/",
"ol",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/CommonExpectations.java#L30-L35 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java | AmazonSQSMessagingClientWrapper.deleteMessage | public void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSException {
"""
Calls <code>deleteMessage</code> and wraps <code>AmazonClientException</code>. This is used to
acknowledge single messages, so that they can be deleted from SQS queue.
@param deleteMessageRequest
Container for the necessary parameters to execute the
deleteMessage service method on AmazonSQS.
@throws JMSException
"""
try {
prepareRequest(deleteMessageRequest);
amazonSQSClient.deleteMessage(deleteMessageRequest);
} catch (AmazonClientException e) {
throw handleException(e, "deleteMessage");
}
} | java | public void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSException {
try {
prepareRequest(deleteMessageRequest);
amazonSQSClient.deleteMessage(deleteMessageRequest);
} catch (AmazonClientException e) {
throw handleException(e, "deleteMessage");
}
} | [
"public",
"void",
"deleteMessage",
"(",
"DeleteMessageRequest",
"deleteMessageRequest",
")",
"throws",
"JMSException",
"{",
"try",
"{",
"prepareRequest",
"(",
"deleteMessageRequest",
")",
";",
"amazonSQSClient",
".",
"deleteMessage",
"(",
"deleteMessageRequest",
")",
";",
"}",
"catch",
"(",
"AmazonClientException",
"e",
")",
"{",
"throw",
"handleException",
"(",
"e",
",",
"\"deleteMessage\"",
")",
";",
"}",
"}"
] | Calls <code>deleteMessage</code> and wraps <code>AmazonClientException</code>. This is used to
acknowledge single messages, so that they can be deleted from SQS queue.
@param deleteMessageRequest
Container for the necessary parameters to execute the
deleteMessage service method on AmazonSQS.
@throws JMSException | [
"Calls",
"<code",
">",
"deleteMessage<",
"/",
"code",
">",
"and",
"wraps",
"<code",
">",
"AmazonClientException<",
"/",
"code",
">",
".",
"This",
"is",
"used",
"to",
"acknowledge",
"single",
"messages",
"so",
"that",
"they",
"can",
"be",
"deleted",
"from",
"SQS",
"queue",
"."
] | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L156-L163 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.groupJoin | @CheckReturnValue
@BackpressureSupport(BackpressureKind.ERROR)
@SchedulerSupport(SchedulerSupport.NONE)
public final <TRight, TLeftEnd, TRightEnd, R> Flowable<R> groupJoin(
Publisher<? extends TRight> other,
Function<? super T, ? extends Publisher<TLeftEnd>> leftEnd,
Function<? super TRight, ? extends Publisher<TRightEnd>> rightEnd,
BiFunction<? super T, ? super Flowable<TRight>, ? extends R> resultSelector) {
"""
Returns a Flowable that correlates two Publishers when they overlap in time and groups the results.
<p>
There are no guarantees in what order the items get combined when multiple
items from one or both source Publishers overlap.
<p>
<img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/groupJoin.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator doesn't support backpressure and consumes all participating {@code Publisher}s in
an unbounded mode (i.e., not applying any backpressure to them).</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code groupJoin} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param <TRight> the value type of the right Publisher source
@param <TLeftEnd> the element type of the left duration Publishers
@param <TRightEnd> the element type of the right duration Publishers
@param <R> the result type
@param other
the other Publisher to correlate items from the source Publisher with
@param leftEnd
a function that returns a Publisher whose emissions indicate the duration of the values of
the source Publisher
@param rightEnd
a function that returns a Publisher whose emissions indicate the duration of the values of
the {@code right} Publisher
@param resultSelector
a function that takes an item emitted by each Publisher and returns the value to be emitted
by the resulting Publisher
@return a Flowable that emits items based on combining those items emitted by the source Publishers
whose durations overlap
@see <a href="http://reactivex.io/documentation/operators/join.html">ReactiveX operators documentation: Join</a>
"""
ObjectHelper.requireNonNull(other, "other is null");
ObjectHelper.requireNonNull(leftEnd, "leftEnd is null");
ObjectHelper.requireNonNull(rightEnd, "rightEnd is null");
ObjectHelper.requireNonNull(resultSelector, "resultSelector is null");
return RxJavaPlugins.onAssembly(new FlowableGroupJoin<T, TRight, TLeftEnd, TRightEnd, R>(
this, other, leftEnd, rightEnd, resultSelector));
} | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.ERROR)
@SchedulerSupport(SchedulerSupport.NONE)
public final <TRight, TLeftEnd, TRightEnd, R> Flowable<R> groupJoin(
Publisher<? extends TRight> other,
Function<? super T, ? extends Publisher<TLeftEnd>> leftEnd,
Function<? super TRight, ? extends Publisher<TRightEnd>> rightEnd,
BiFunction<? super T, ? super Flowable<TRight>, ? extends R> resultSelector) {
ObjectHelper.requireNonNull(other, "other is null");
ObjectHelper.requireNonNull(leftEnd, "leftEnd is null");
ObjectHelper.requireNonNull(rightEnd, "rightEnd is null");
ObjectHelper.requireNonNull(resultSelector, "resultSelector is null");
return RxJavaPlugins.onAssembly(new FlowableGroupJoin<T, TRight, TLeftEnd, TRightEnd, R>(
this, other, leftEnd, rightEnd, resultSelector));
} | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"ERROR",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"<",
"TRight",
",",
"TLeftEnd",
",",
"TRightEnd",
",",
"R",
">",
"Flowable",
"<",
"R",
">",
"groupJoin",
"(",
"Publisher",
"<",
"?",
"extends",
"TRight",
">",
"other",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"Publisher",
"<",
"TLeftEnd",
">",
">",
"leftEnd",
",",
"Function",
"<",
"?",
"super",
"TRight",
",",
"?",
"extends",
"Publisher",
"<",
"TRightEnd",
">",
">",
"rightEnd",
",",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"Flowable",
"<",
"TRight",
">",
",",
"?",
"extends",
"R",
">",
"resultSelector",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"other",
",",
"\"other is null\"",
")",
";",
"ObjectHelper",
".",
"requireNonNull",
"(",
"leftEnd",
",",
"\"leftEnd is null\"",
")",
";",
"ObjectHelper",
".",
"requireNonNull",
"(",
"rightEnd",
",",
"\"rightEnd is null\"",
")",
";",
"ObjectHelper",
".",
"requireNonNull",
"(",
"resultSelector",
",",
"\"resultSelector is null\"",
")",
";",
"return",
"RxJavaPlugins",
".",
"onAssembly",
"(",
"new",
"FlowableGroupJoin",
"<",
"T",
",",
"TRight",
",",
"TLeftEnd",
",",
"TRightEnd",
",",
"R",
">",
"(",
"this",
",",
"other",
",",
"leftEnd",
",",
"rightEnd",
",",
"resultSelector",
")",
")",
";",
"}"
] | Returns a Flowable that correlates two Publishers when they overlap in time and groups the results.
<p>
There are no guarantees in what order the items get combined when multiple
items from one or both source Publishers overlap.
<p>
<img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/groupJoin.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator doesn't support backpressure and consumes all participating {@code Publisher}s in
an unbounded mode (i.e., not applying any backpressure to them).</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code groupJoin} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param <TRight> the value type of the right Publisher source
@param <TLeftEnd> the element type of the left duration Publishers
@param <TRightEnd> the element type of the right duration Publishers
@param <R> the result type
@param other
the other Publisher to correlate items from the source Publisher with
@param leftEnd
a function that returns a Publisher whose emissions indicate the duration of the values of
the source Publisher
@param rightEnd
a function that returns a Publisher whose emissions indicate the duration of the values of
the {@code right} Publisher
@param resultSelector
a function that takes an item emitted by each Publisher and returns the value to be emitted
by the resulting Publisher
@return a Flowable that emits items based on combining those items emitted by the source Publishers
whose durations overlap
@see <a href="http://reactivex.io/documentation/operators/join.html">ReactiveX operators documentation: Join</a> | [
"Returns",
"a",
"Flowable",
"that",
"correlates",
"two",
"Publishers",
"when",
"they",
"overlap",
"in",
"time",
"and",
"groups",
"the",
"results",
".",
"<p",
">",
"There",
"are",
"no",
"guarantees",
"in",
"what",
"order",
"the",
"items",
"get",
"combined",
"when",
"multiple",
"items",
"from",
"one",
"or",
"both",
"source",
"Publishers",
"overlap",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"380",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"groupJoin",
".",
"png",
"alt",
"=",
">",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Backpressure",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"The",
"operator",
"doesn",
"t",
"support",
"backpressure",
"and",
"consumes",
"all",
"participating",
"{",
"@code",
"Publisher",
"}",
"s",
"in",
"an",
"unbounded",
"mode",
"(",
"i",
".",
"e",
".",
"not",
"applying",
"any",
"backpressure",
"to",
"them",
")",
".",
"<",
"/",
"dd",
">",
"<dt",
">",
"<b",
">",
"Scheduler",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"{",
"@code",
"groupJoin",
"}",
"does",
"not",
"operate",
"by",
"default",
"on",
"a",
"particular",
"{",
"@link",
"Scheduler",
"}",
".",
"<",
"/",
"dd",
">",
"<",
"/",
"dl",
">"
] | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L10619-L10633 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java | PackageManagerUtils.getActivityPackageInfo | public static PackageInfo getActivityPackageInfo(Context context, String targetPackage) throws NameNotFoundException {
"""
Get the {@link android.content.pm.PackageInfo} that contains all activities declaration for the context.
@param context the context.
@return the {@link android.content.pm.PackageInfo}.
@throws NameNotFoundException if no package found.
"""
PackageManager manager = context.getPackageManager();
return manager.getPackageInfo(targetPackage, PackageManager.GET_ACTIVITIES);
} | java | public static PackageInfo getActivityPackageInfo(Context context, String targetPackage) throws NameNotFoundException {
PackageManager manager = context.getPackageManager();
return manager.getPackageInfo(targetPackage, PackageManager.GET_ACTIVITIES);
} | [
"public",
"static",
"PackageInfo",
"getActivityPackageInfo",
"(",
"Context",
"context",
",",
"String",
"targetPackage",
")",
"throws",
"NameNotFoundException",
"{",
"PackageManager",
"manager",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"return",
"manager",
".",
"getPackageInfo",
"(",
"targetPackage",
",",
"PackageManager",
".",
"GET_ACTIVITIES",
")",
";",
"}"
] | Get the {@link android.content.pm.PackageInfo} that contains all activities declaration for the context.
@param context the context.
@return the {@link android.content.pm.PackageInfo}.
@throws NameNotFoundException if no package found. | [
"Get",
"the",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L132-L135 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupBean.java | CmsSetupBean.importModuleFromDefault | protected void importModuleFromDefault(String importFile) throws Exception {
"""
Imports a module (zipfile) from the default module directory,
creating a temporary project for this.<p>
@param importFile the name of the import module located in the default module directory
@throws Exception if something goes wrong
@see org.opencms.importexport.CmsImportExportManager#importData(CmsObject, org.opencms.report.I_CmsReport, CmsImportParameters)
"""
String fileName = getModuleFolder() + importFile;
OpenCms.getImportExportManager().importData(
m_cms,
new CmsShellReport(m_cms.getRequestContext().getLocale()),
new CmsImportParameters(fileName, "/", true));
} | java | protected void importModuleFromDefault(String importFile) throws Exception {
String fileName = getModuleFolder() + importFile;
OpenCms.getImportExportManager().importData(
m_cms,
new CmsShellReport(m_cms.getRequestContext().getLocale()),
new CmsImportParameters(fileName, "/", true));
} | [
"protected",
"void",
"importModuleFromDefault",
"(",
"String",
"importFile",
")",
"throws",
"Exception",
"{",
"String",
"fileName",
"=",
"getModuleFolder",
"(",
")",
"+",
"importFile",
";",
"OpenCms",
".",
"getImportExportManager",
"(",
")",
".",
"importData",
"(",
"m_cms",
",",
"new",
"CmsShellReport",
"(",
"m_cms",
".",
"getRequestContext",
"(",
")",
".",
"getLocale",
"(",
")",
")",
",",
"new",
"CmsImportParameters",
"(",
"fileName",
",",
"\"/\"",
",",
"true",
")",
")",
";",
"}"
] | Imports a module (zipfile) from the default module directory,
creating a temporary project for this.<p>
@param importFile the name of the import module located in the default module directory
@throws Exception if something goes wrong
@see org.opencms.importexport.CmsImportExportManager#importData(CmsObject, org.opencms.report.I_CmsReport, CmsImportParameters) | [
"Imports",
"a",
"module",
"(",
"zipfile",
")",
"from",
"the",
"default",
"module",
"directory",
"creating",
"a",
"temporary",
"project",
"for",
"this",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L2580-L2587 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/json/PJsonObject.java | PJsonObject.getJSONArray | public final PJsonArray getJSONArray(final String key) {
"""
Get a property as a json array or throw exception.
@param key the property name
"""
final JSONArray val = this.obj.optJSONArray(key);
if (val == null) {
throw new ObjectMissingException(this, key);
}
return new PJsonArray(this, val, key);
} | java | public final PJsonArray getJSONArray(final String key) {
final JSONArray val = this.obj.optJSONArray(key);
if (val == null) {
throw new ObjectMissingException(this, key);
}
return new PJsonArray(this, val, key);
} | [
"public",
"final",
"PJsonArray",
"getJSONArray",
"(",
"final",
"String",
"key",
")",
"{",
"final",
"JSONArray",
"val",
"=",
"this",
".",
"obj",
".",
"optJSONArray",
"(",
"key",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"throw",
"new",
"ObjectMissingException",
"(",
"this",
",",
"key",
")",
";",
"}",
"return",
"new",
"PJsonArray",
"(",
"this",
",",
"val",
",",
"key",
")",
";",
"}"
] | Get a property as a json array or throw exception.
@param key the property name | [
"Get",
"a",
"property",
"as",
"a",
"json",
"array",
"or",
"throw",
"exception",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/json/PJsonObject.java#L168-L174 |
Subsets and Splits