repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
NoraUi/NoraUi | src/main/java/com/github/noraui/utils/Utilities.java | Utilities.findElement | public static WebElement findElement(Page page, String code, Object... args) {
return Context.getDriver().findElement(getLocator(page.getApplication(), page.getPageKey() + code, args));
} | java | public static WebElement findElement(Page page, String code, Object... args) {
return Context.getDriver().findElement(getLocator(page.getApplication(), page.getPageKey() + code, args));
} | [
"public",
"static",
"WebElement",
"findElement",
"(",
"Page",
"page",
",",
"String",
"code",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"Context",
".",
"getDriver",
"(",
")",
".",
"findElement",
"(",
"getLocator",
"(",
"page",
".",
"getApplication",
... | Find the first {@link WebElement} using the given method.
This method is affected by the 'implicit wait' times in force at the time of execution.
The findElement(..) invocation will return a matching row, or try again repeatedly until
the configured timeout is reached.
@param page
is target page
@param code
Name of element on the web Page.
@param args
can be a index i
@return the first {@link WebElement} using the given method | [
"Find",
"the",
"first",
"{",
"@link",
"WebElement",
"}",
"using",
"the",
"given",
"method",
".",
"This",
"method",
"is",
"affected",
"by",
"the",
"implicit",
"wait",
"times",
"in",
"force",
"at",
"the",
"time",
"of",
"execution",
".",
"The",
"findElement",... | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/utils/Utilities.java#L177-L179 |
BlueBrain/bluima | modules/bluima_jsre/src/main/java/org/itc/irst/tcc/sre/util/Node.java | Node.dotProduct | public static double dotProduct(Node[] n1, Node[] n2) {
// logger.info("n1 " + n1.length);
// logger.info("n2 " + n2.length);
double sum = 0;
int i = 0, j = 0;
while (i < n1.length && j < n2.length) {
if (n1[i] == null)
break;
// logger.error("n1" + n1[i] + " " + i);
if (n2[j] == null)
break;
// logger.error("n2" + n2[j] + " " + j);
// logger.info(n1[i].index + " == " + n2[j].index);
if (n1[i].index == n2[j].index) {
// logger.info(n1[i].index + " == " + n2[j].index);
sum += n1[i].value * n2[j].value;
++i;
++j;
} else {
if (n1[i].index > n2[j].index) {
// logger.info(n1[i].index + " > " + n2[j].index);
++j;
} else {
// logger.info(n1[i].index + " <= " + n2[j].index);
++i;
}
}
}
return sum;
} | java | public static double dotProduct(Node[] n1, Node[] n2) {
// logger.info("n1 " + n1.length);
// logger.info("n2 " + n2.length);
double sum = 0;
int i = 0, j = 0;
while (i < n1.length && j < n2.length) {
if (n1[i] == null)
break;
// logger.error("n1" + n1[i] + " " + i);
if (n2[j] == null)
break;
// logger.error("n2" + n2[j] + " " + j);
// logger.info(n1[i].index + " == " + n2[j].index);
if (n1[i].index == n2[j].index) {
// logger.info(n1[i].index + " == " + n2[j].index);
sum += n1[i].value * n2[j].value;
++i;
++j;
} else {
if (n1[i].index > n2[j].index) {
// logger.info(n1[i].index + " > " + n2[j].index);
++j;
} else {
// logger.info(n1[i].index + " <= " + n2[j].index);
++i;
}
}
}
return sum;
} | [
"public",
"static",
"double",
"dotProduct",
"(",
"Node",
"[",
"]",
"n1",
",",
"Node",
"[",
"]",
"n2",
")",
"{",
"// logger.info(\"n1 \" + n1.length);",
"// logger.info(\"n2 \" + n2.length);",
"double",
"sum",
"=",
"0",
";",
"int",
"i",
"=",
"0",
",",
"j",
"=... | Returns an iterator over the elements in this vector in proper sequence
(optional operation).
@return an iterator over the elements in this vector in proper sequence. | [
"Returns",
"an",
"iterator",
"over",
"the",
"elements",
"in",
"this",
"vector",
"in",
"proper",
"sequence",
"(",
"optional",
"operation",
")",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_jsre/src/main/java/org/itc/irst/tcc/sre/util/Node.java#L46-L78 |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.updateComponentError | public static boolean updateComponentError(AbstractComponent component, ErrorMessage error) {
if (component.getComponentError() != error) {
component.setComponentError(error);
return true;
}
return false;
} | java | public static boolean updateComponentError(AbstractComponent component, ErrorMessage error) {
if (component.getComponentError() != error) {
component.setComponentError(error);
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"updateComponentError",
"(",
"AbstractComponent",
"component",
",",
"ErrorMessage",
"error",
")",
"{",
"if",
"(",
"component",
".",
"getComponentError",
"(",
")",
"!=",
"error",
")",
"{",
"component",
".",
"setComponentError",
"(",
... | Updates the component error of a component, but only if it differs from the currently set
error.<p>
@param component the component
@param error the error
@return true if the error was changed | [
"Updates",
"the",
"component",
"error",
"of",
"a",
"component",
"but",
"only",
"if",
"it",
"differs",
"from",
"the",
"currently",
"set",
"error",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1233-L1240 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphicsMapResources | public static int cuGraphicsMapResources(int count, CUgraphicsResource resources[], CUstream hStream)
{
return checkResult(cuGraphicsMapResourcesNative(count, resources, hStream));
} | java | public static int cuGraphicsMapResources(int count, CUgraphicsResource resources[], CUstream hStream)
{
return checkResult(cuGraphicsMapResourcesNative(count, resources, hStream));
} | [
"public",
"static",
"int",
"cuGraphicsMapResources",
"(",
"int",
"count",
",",
"CUgraphicsResource",
"resources",
"[",
"]",
",",
"CUstream",
"hStream",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphicsMapResourcesNative",
"(",
"count",
",",
"resources",
",",
"hS... | Map graphics resources for access by CUDA.
<pre>
CUresult cuGraphicsMapResources (
unsigned int count,
CUgraphicsResource* resources,
CUstream hStream )
</pre>
<div>
<p>Map graphics resources for access by
CUDA. Maps the <tt>count</tt> graphics resources in <tt>resources</tt>
for access by CUDA.
</p>
<p>The resources in <tt>resources</tt>
may be accessed by CUDA until they are unmapped. The graphics API from
which <tt>resources</tt> were registered should not access any
resources while they are mapped by CUDA. If an application does so,
the results are
undefined.
</p>
<p>This function provides the synchronization
guarantee that any graphics calls issued before cuGraphicsMapResources()
will complete before any subsequent CUDA work issued in <tt>stream</tt>
begins.
</p>
<p>If <tt>resources</tt> includes any
duplicate entries then CUDA_ERROR_INVALID_HANDLE is returned. If any
of <tt>resources</tt> are presently mapped for access by CUDA then
CUDA_ERROR_ALREADY_MAPPED is returned.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param count Number of resources to map
@param resources Resources to map for CUDA usage
@param hStream Stream with which to synchronize
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE,
CUDA_ERROR_ALREADY_MAPPED, CUDA_ERROR_UNKNOWN
@see JCudaDriver#cuGraphicsResourceGetMappedPointer
@see JCudaDriver#cuGraphicsSubResourceGetMappedArray
@see JCudaDriver#cuGraphicsUnmapResources | [
"Map",
"graphics",
"resources",
"for",
"access",
"by",
"CUDA",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L16094-L16097 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.cacheStatement | public final void cacheStatement(Statement statement, StatementCacheKey key) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(this, tc, "cacheStatement", AdapterUtil.toString(statement), key);
// Add the statement to the cache. If there is no room in the cache, a statement from
// the least recently used bucket will be cast out of the cache. Any statement cast
// out of the cache must be closed.
CacheMap cache = getStatementCache();
Object discardedStatement = cache == null ? statement : statementCache.add(key, statement);
if (discardedStatement != null)
destroyStatement(discardedStatement);
} | java | public final void cacheStatement(Statement statement, StatementCacheKey key) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(this, tc, "cacheStatement", AdapterUtil.toString(statement), key);
// Add the statement to the cache. If there is no room in the cache, a statement from
// the least recently used bucket will be cast out of the cache. Any statement cast
// out of the cache must be closed.
CacheMap cache = getStatementCache();
Object discardedStatement = cache == null ? statement : statementCache.add(key, statement);
if (discardedStatement != null)
destroyStatement(discardedStatement);
} | [
"public",
"final",
"void",
"cacheStatement",
"(",
"Statement",
"statement",
",",
"StatementCacheKey",
"key",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"Tr",
".",
"event",
"(... | Returns the statement into the cache. The statement is closed if an error occurs
attempting to cache it. This method will only called if statement caching was enabled
at some point, although it might not be enabled anymore.
@param statement the statement to return to the cache.
@param key the statement cache key. | [
"Returns",
"the",
"statement",
"into",
"the",
"cache",
".",
"The",
"statement",
"is",
"closed",
"if",
"an",
"error",
"occurs",
"attempting",
"to",
"cache",
"it",
".",
"This",
"method",
"will",
"only",
"called",
"if",
"statement",
"caching",
"was",
"enabled",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L2244-L2257 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.rectifyHToAbsoluteQuadratic | public static void rectifyHToAbsoluteQuadratic(DMatrixRMaj H , DMatrixRMaj Q ) {
int indexQ = 0;
for (int rowA = 0; rowA < 4; rowA++) {
for (int colB = 0; colB < 4; colB++) {
int indexA = rowA*4;
int indexB = colB*4;
double sum = 0;
for (int i = 0; i < 3; i++) {
// sum += H.get(rowA,i)*H.get(colB,i);
sum += H.data[indexA++]*H.data[indexB++];
}
// Q.set(rowA,colB,sum);
Q.data[indexQ++] = sum;
}
}
} | java | public static void rectifyHToAbsoluteQuadratic(DMatrixRMaj H , DMatrixRMaj Q ) {
int indexQ = 0;
for (int rowA = 0; rowA < 4; rowA++) {
for (int colB = 0; colB < 4; colB++) {
int indexA = rowA*4;
int indexB = colB*4;
double sum = 0;
for (int i = 0; i < 3; i++) {
// sum += H.get(rowA,i)*H.get(colB,i);
sum += H.data[indexA++]*H.data[indexB++];
}
// Q.set(rowA,colB,sum);
Q.data[indexQ++] = sum;
}
}
} | [
"public",
"static",
"void",
"rectifyHToAbsoluteQuadratic",
"(",
"DMatrixRMaj",
"H",
",",
"DMatrixRMaj",
"Q",
")",
"{",
"int",
"indexQ",
"=",
"0",
";",
"for",
"(",
"int",
"rowA",
"=",
"0",
";",
"rowA",
"<",
"4",
";",
"rowA",
"++",
")",
"{",
"for",
"("... | Rectifying homography to dual absolute quadratic.
<p>Q = H*I*H<sup>T</sup> = H(:,1:3)*H(:,1:3)'</p>
<p>where I = diag(1 1 1 0)</p>
@param H (Input) 4x4 rectifying homography.
@param Q (Output) Absolute quadratic. Typically found in auto calibration. Not modified. | [
"Rectifying",
"homography",
"to",
"dual",
"absolute",
"quadratic",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L1489-L1506 |
facebookarchive/hive-dwrf | hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java | Slice.getBytes | public void getBytes(int index, Slice destination, int destinationIndex, int length)
{
destination.setBytes(destinationIndex, this, index, length);
} | java | public void getBytes(int index, Slice destination, int destinationIndex, int length)
{
destination.setBytes(destinationIndex, this, index, length);
} | [
"public",
"void",
"getBytes",
"(",
"int",
"index",
",",
"Slice",
"destination",
",",
"int",
"destinationIndex",
",",
"int",
"length",
")",
"{",
"destination",
".",
"setBytes",
"(",
"destinationIndex",
",",
"this",
",",
"index",
",",
"length",
")",
";",
"}"... | Transfers portion of data from this slice into the specified destination starting at
the specified absolute {@code index}.
@param destinationIndex the first index of the destination
@param length the number of bytes to transfer
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0},
if the specified {@code destinationIndex} is less than {@code 0},
if {@code index + length} is greater than
{@code this.length()}, or
if {@code destinationIndex + length} is greater than
{@code destination.length()} | [
"Transfers",
"portion",
"of",
"data",
"from",
"this",
"slice",
"into",
"the",
"specified",
"destination",
"starting",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"."
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L320-L323 |
icode/ameba | src/main/java/ameba/db/ebean/support/ModelResourceStructure.java | ModelResourceStructure.executeTx | protected void executeTx(final TxRunnable r, final TxRunnable errorHandler) throws Exception {
Transaction transaction = beginTransaction();
configureTransDefault(transaction);
processTransactionError(transaction, t -> {
try {
r.run(t);
t.commit();
} catch (Throwable e) {
t.rollback(e);
throw e;
} finally {
t.end();
}
return null;
}, errorHandler != null ? (TxCallable) t -> {
errorHandler.run(t);
return null;
} : null);
} | java | protected void executeTx(final TxRunnable r, final TxRunnable errorHandler) throws Exception {
Transaction transaction = beginTransaction();
configureTransDefault(transaction);
processTransactionError(transaction, t -> {
try {
r.run(t);
t.commit();
} catch (Throwable e) {
t.rollback(e);
throw e;
} finally {
t.end();
}
return null;
}, errorHandler != null ? (TxCallable) t -> {
errorHandler.run(t);
return null;
} : null);
} | [
"protected",
"void",
"executeTx",
"(",
"final",
"TxRunnable",
"r",
",",
"final",
"TxRunnable",
"errorHandler",
")",
"throws",
"Exception",
"{",
"Transaction",
"transaction",
"=",
"beginTransaction",
"(",
")",
";",
"configureTransDefault",
"(",
"transaction",
")",
... | <p>executeTx.</p>
@param r a {@link ameba.db.ebean.support.ModelResourceStructure.TxRunnable} object.
@param errorHandler error handler
@throws java.lang.Exception if any. | [
"<p",
">",
"executeTx",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L1096-L1114 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/IOUtils.java | IOUtils.copy | public static void copy(Reader reader, Writer writer) throws IOException {
copy(reader, writer, false);
} | java | public static void copy(Reader reader, Writer writer) throws IOException {
copy(reader, writer, false);
} | [
"public",
"static",
"void",
"copy",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"copy",
"(",
"reader",
",",
"writer",
",",
"false",
")",
";",
"}"
] | Writes all the contents of a Reader to a Writer.
@param reader
the reader to read from
@param writer
the writer to write to
@throws java.io.IOException
if an IOExcption occurs | [
"Writes",
"all",
"the",
"contents",
"of",
"a",
"Reader",
"to",
"a",
"Writer",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/IOUtils.java#L42-L44 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/Dataset.java | Dataset.readSVMLightFormat | public static Dataset<String, String> readSVMLightFormat(String filename) {
return readSVMLightFormat(filename, new HashIndex<String>(), new HashIndex<String>());
} | java | public static Dataset<String, String> readSVMLightFormat(String filename) {
return readSVMLightFormat(filename, new HashIndex<String>(), new HashIndex<String>());
} | [
"public",
"static",
"Dataset",
"<",
"String",
",",
"String",
">",
"readSVMLightFormat",
"(",
"String",
"filename",
")",
"{",
"return",
"readSVMLightFormat",
"(",
"filename",
",",
"new",
"HashIndex",
"<",
"String",
">",
"(",
")",
",",
"new",
"HashIndex",
"<",... | Constructs a Dataset by reading in a file in SVM light format. | [
"Constructs",
"a",
"Dataset",
"by",
"reading",
"in",
"a",
"file",
"in",
"SVM",
"light",
"format",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/Dataset.java#L197-L199 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/ShanksSimulation2DGUI.java | ShanksSimulation2DGUI.addDisplay | public void addDisplay(String displayID, Display2D display)
throws ShanksException {
Scenario2DPortrayal scenarioPortrayal = (Scenario2DPortrayal) this
.getSimulation().getScenarioPortrayal();
HashMap<String, Display2D> displays = scenarioPortrayal.getDisplays();
if (!displays.containsKey(displayID)) {
displays.put(displayID, display);
} else {
throw new DuplictaedDisplayIDException(displayID);
}
} | java | public void addDisplay(String displayID, Display2D display)
throws ShanksException {
Scenario2DPortrayal scenarioPortrayal = (Scenario2DPortrayal) this
.getSimulation().getScenarioPortrayal();
HashMap<String, Display2D> displays = scenarioPortrayal.getDisplays();
if (!displays.containsKey(displayID)) {
displays.put(displayID, display);
} else {
throw new DuplictaedDisplayIDException(displayID);
}
} | [
"public",
"void",
"addDisplay",
"(",
"String",
"displayID",
",",
"Display2D",
"display",
")",
"throws",
"ShanksException",
"{",
"Scenario2DPortrayal",
"scenarioPortrayal",
"=",
"(",
"Scenario2DPortrayal",
")",
"this",
".",
"getSimulation",
"(",
")",
".",
"getScenari... | Add a display to the simulation
@param displayID
@param display
@throws DuplictaedDisplayIDException
@throws DuplicatedPortrayalIDException
@throws ScenarioNotFoundException | [
"Add",
"a",
"display",
"to",
"the",
"simulation"
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/ShanksSimulation2DGUI.java#L320-L330 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIData.java | UIData.queueEvent | @Override
public void queueEvent(FacesEvent event)
{
if (event == null)
{
throw new NullPointerException("event");
}
super.queueEvent(new FacesEventWrapper(event, getRowIndex(), this));
} | java | @Override
public void queueEvent(FacesEvent event)
{
if (event == null)
{
throw new NullPointerException("event");
}
super.queueEvent(new FacesEventWrapper(event, getRowIndex(), this));
} | [
"@",
"Override",
"public",
"void",
"queueEvent",
"(",
"FacesEvent",
"event",
")",
"{",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"event\"",
")",
";",
"}",
"super",
".",
"queueEvent",
"(",
"new",
"FacesEventW... | Modify events queued for any child components so that the UIData state will be correctly configured before the
event's listeners are executed.
<p>
Child components or their renderers may register events against those child components. When the listener for
that event is eventually invoked, it may expect the uidata's rowData and rowIndex to be referring to the same
object that caused the event to fire.
<p>
The original queueEvent call against the child component has been forwarded up the chain of ancestors in the
standard way, making it possible here to wrap the event in a new event whose source is <i>this</i> component, not
the original one. When the event finally is executed, this component's broadcast method is invoked, which ensures
that the UIData is set to be at the correct row before executing the original event. | [
"Modify",
"events",
"queued",
"for",
"any",
"child",
"components",
"so",
"that",
"the",
"UIData",
"state",
"will",
"be",
"correctly",
"configured",
"before",
"the",
"event",
"s",
"listeners",
"are",
"executed",
".",
"<p",
">",
"Child",
"components",
"or",
"t... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIData.java#L1657-L1665 |
jbehave/jbehave-core | jbehave-core/src/main/java/org/jbehave/core/embedder/StoryRunner.java | StoryRunner.storyOfPath | public Story storyOfPath(Configuration configuration, String storyPath) {
String storyAsText = configuration.storyLoader().loadStoryAsText(storyPath);
return configuration.storyParser().parseStory(storyAsText, storyPath);
} | java | public Story storyOfPath(Configuration configuration, String storyPath) {
String storyAsText = configuration.storyLoader().loadStoryAsText(storyPath);
return configuration.storyParser().parseStory(storyAsText, storyPath);
} | [
"public",
"Story",
"storyOfPath",
"(",
"Configuration",
"configuration",
",",
"String",
"storyPath",
")",
"{",
"String",
"storyAsText",
"=",
"configuration",
".",
"storyLoader",
"(",
")",
".",
"loadStoryAsText",
"(",
"storyPath",
")",
";",
"return",
"configuration... | Returns the parsed story from the given path
@param configuration the Configuration used to run story
@param storyPath the story path
@return The parsed Story | [
"Returns",
"the",
"parsed",
"story",
"from",
"the",
"given",
"path"
] | train | https://github.com/jbehave/jbehave-core/blob/bdd6a6199528df3c35087e72d4644870655b23e6/jbehave-core/src/main/java/org/jbehave/core/embedder/StoryRunner.java#L195-L198 |
cdk/cdk | app/depict/src/main/java/org/openscience/cdk/depict/DepictionGenerator.java | DepictionGenerator.withAtomNumbers | public DepictionGenerator withAtomNumbers() {
if (annotateAtomMap || annotateAtomVal)
throw new IllegalArgumentException("Can not annotated atom numbers, atom values or maps are already annotated");
DepictionGenerator copy = new DepictionGenerator(this);
copy.annotateAtomNum = true;
return copy;
} | java | public DepictionGenerator withAtomNumbers() {
if (annotateAtomMap || annotateAtomVal)
throw new IllegalArgumentException("Can not annotated atom numbers, atom values or maps are already annotated");
DepictionGenerator copy = new DepictionGenerator(this);
copy.annotateAtomNum = true;
return copy;
} | [
"public",
"DepictionGenerator",
"withAtomNumbers",
"(",
")",
"{",
"if",
"(",
"annotateAtomMap",
"||",
"annotateAtomVal",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can not annotated atom numbers, atom values or maps are already annotated\"",
")",
";",
"DepictionGe... | Display atom numbers on the molecule or reaction. The numbers are based on the
ordering of atoms in the molecule data structure and not a systematic system
such as IUPAC numbering.
Note: A depiction can not have both atom numbers and atom maps visible
(but this can be achieved by manually setting the annotation).
@return new generator for method chaining
@see #withAtomMapNumbers()
@see StandardGenerator#ANNOTATION_LABEL | [
"Display",
"atom",
"numbers",
"on",
"the",
"molecule",
"or",
"reaction",
".",
"The",
"numbers",
"are",
"based",
"on",
"the",
"ordering",
"of",
"atoms",
"in",
"the",
"molecule",
"data",
"structure",
"and",
"not",
"a",
"systematic",
"system",
"such",
"as",
"... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/DepictionGenerator.java#L771-L777 |
PrashamTrivedi/SharedPreferenceInspector | sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/fragments/SharedPreferencesItem.java | SharedPreferencesItem.storeOriginal | private void storeOriginal(Pair<String, Object> keyValue) {
String key = SharedPreferenceUtils.keyTestMode + keyValue.first;
if (!preferenceUtils.isValueExistForKey(key)) {
preferenceUtils.put(key, keyValue.second);
}
} | java | private void storeOriginal(Pair<String, Object> keyValue) {
String key = SharedPreferenceUtils.keyTestMode + keyValue.first;
if (!preferenceUtils.isValueExistForKey(key)) {
preferenceUtils.put(key, keyValue.second);
}
} | [
"private",
"void",
"storeOriginal",
"(",
"Pair",
"<",
"String",
",",
"Object",
">",
"keyValue",
")",
"{",
"String",
"key",
"=",
"SharedPreferenceUtils",
".",
"keyTestMode",
"+",
"keyValue",
".",
"first",
";",
"if",
"(",
"!",
"preferenceUtils",
".",
"isValueE... | Store original value before it's changed in test mode. It will take care not to over write if original value is already stored.
@param keyValue
: Pair of key and original value. | [
"Store",
"original",
"value",
"before",
"it",
"s",
"changed",
"in",
"test",
"mode",
".",
"It",
"will",
"take",
"care",
"not",
"to",
"over",
"write",
"if",
"original",
"value",
"is",
"already",
"stored",
"."
] | train | https://github.com/PrashamTrivedi/SharedPreferenceInspector/blob/c04d567c4d0fc5e0f8cda308ca85df19c6b3b838/sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/fragments/SharedPreferencesItem.java#L373-L380 |
LableOrg/java-uniqueid | uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ZooKeeperHelper.java | ZooKeeperHelper.createIfNotThere | static void createIfNotThere(ZooKeeper zookeeper, String znode) throws KeeperException, InterruptedException {
try {
create(zookeeper, znode);
} catch (KeeperException e) {
if (e.code() != KeeperException.Code.NODEEXISTS) {
// Rethrow all exceptions, except "node exists",
// because if the node exists, this method reached its goal.
throw e;
}
}
} | java | static void createIfNotThere(ZooKeeper zookeeper, String znode) throws KeeperException, InterruptedException {
try {
create(zookeeper, znode);
} catch (KeeperException e) {
if (e.code() != KeeperException.Code.NODEEXISTS) {
// Rethrow all exceptions, except "node exists",
// because if the node exists, this method reached its goal.
throw e;
}
}
} | [
"static",
"void",
"createIfNotThere",
"(",
"ZooKeeper",
"zookeeper",
",",
"String",
"znode",
")",
"throws",
"KeeperException",
",",
"InterruptedException",
"{",
"try",
"{",
"create",
"(",
"zookeeper",
",",
"znode",
")",
";",
"}",
"catch",
"(",
"KeeperException",... | Create an empty normal (persistent) Znode. If the znode already exists, do nothing.
@param zookeeper ZooKeeper instance to work with.
@param znode Znode to create.
@throws KeeperException
@throws InterruptedException | [
"Create",
"an",
"empty",
"normal",
"(",
"persistent",
")",
"Znode",
".",
"If",
"the",
"znode",
"already",
"exists",
"do",
"nothing",
"."
] | train | https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ZooKeeperHelper.java#L88-L98 |
windup/windup | decompiler/impl-procyon/src/main/java/org/jboss/windup/decompiler/procyon/ProcyonDecompiler.java | ProcyonDecompiler.refreshMetadataCache | private void refreshMetadataCache(final Queue<WindupMetadataSystem> metadataSystemCache, final DecompilerSettings settings)
{
metadataSystemCache.clear();
for (int i = 0; i < this.getNumberOfThreads(); i++)
{
metadataSystemCache.add(new NoRetryMetadataSystem(settings.getTypeLoader()));
}
} | java | private void refreshMetadataCache(final Queue<WindupMetadataSystem> metadataSystemCache, final DecompilerSettings settings)
{
metadataSystemCache.clear();
for (int i = 0; i < this.getNumberOfThreads(); i++)
{
metadataSystemCache.add(new NoRetryMetadataSystem(settings.getTypeLoader()));
}
} | [
"private",
"void",
"refreshMetadataCache",
"(",
"final",
"Queue",
"<",
"WindupMetadataSystem",
">",
"metadataSystemCache",
",",
"final",
"DecompilerSettings",
"settings",
")",
"{",
"metadataSystemCache",
".",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | The metadata cache can become huge over time. This simply flushes it periodically. | [
"The",
"metadata",
"cache",
"can",
"become",
"huge",
"over",
"time",
".",
"This",
"simply",
"flushes",
"it",
"periodically",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/decompiler/impl-procyon/src/main/java/org/jboss/windup/decompiler/procyon/ProcyonDecompiler.java#L522-L529 |
ACRA/acra | acra-core/src/main/java/org/acra/builder/ReportExecutor.java | ReportExecutor.handReportToDefaultExceptionHandler | public void handReportToDefaultExceptionHandler(@Nullable Thread t, @NonNull Throwable e) {
if (defaultExceptionHandler != null) {
ACRA.log.i(LOG_TAG, "ACRA is disabled for " + context.getPackageName()
+ " - forwarding uncaught Exception on to default ExceptionHandler");
defaultExceptionHandler.uncaughtException(t, e);
} else {
ACRA.log.e(LOG_TAG, "ACRA is disabled for " + context.getPackageName() + " - no default ExceptionHandler");
ACRA.log.e(LOG_TAG, "ACRA caught a " + e.getClass().getSimpleName() + " for " + context.getPackageName(), e);
}
} | java | public void handReportToDefaultExceptionHandler(@Nullable Thread t, @NonNull Throwable e) {
if (defaultExceptionHandler != null) {
ACRA.log.i(LOG_TAG, "ACRA is disabled for " + context.getPackageName()
+ " - forwarding uncaught Exception on to default ExceptionHandler");
defaultExceptionHandler.uncaughtException(t, e);
} else {
ACRA.log.e(LOG_TAG, "ACRA is disabled for " + context.getPackageName() + " - no default ExceptionHandler");
ACRA.log.e(LOG_TAG, "ACRA caught a " + e.getClass().getSimpleName() + " for " + context.getPackageName(), e);
}
} | [
"public",
"void",
"handReportToDefaultExceptionHandler",
"(",
"@",
"Nullable",
"Thread",
"t",
",",
"@",
"NonNull",
"Throwable",
"e",
")",
"{",
"if",
"(",
"defaultExceptionHandler",
"!=",
"null",
")",
"{",
"ACRA",
".",
"log",
".",
"i",
"(",
"LOG_TAG",
",",
... | pass-through to default handler
@param t the crashed thread
@param e the uncaught exception | [
"pass",
"-",
"through",
"to",
"default",
"handler"
] | train | https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/builder/ReportExecutor.java#L98-L108 |
jingwei/krati | krati-main/src/main/java/krati/core/array/SimpleDataArray.java | SimpleDataArray.setCompactionAddress | protected void setCompactionAddress(int index, long value, long scn) throws Exception {
_addressArray.setCompactionAddress(index, value, scn);
_hwmSet = Math.max(_hwmSet, scn);
} | java | protected void setCompactionAddress(int index, long value, long scn) throws Exception {
_addressArray.setCompactionAddress(index, value, scn);
_hwmSet = Math.max(_hwmSet, scn);
} | [
"protected",
"void",
"setCompactionAddress",
"(",
"int",
"index",
",",
"long",
"value",
",",
"long",
"scn",
")",
"throws",
"Exception",
"{",
"_addressArray",
".",
"setCompactionAddress",
"(",
"index",
",",
"value",
",",
"scn",
")",
";",
"_hwmSet",
"=",
"Math... | Sets the address (long value), which is produced by the Segment compactor,
at the specified array index.
@param index - the array index.
@param value - the address value.
@param scn - the System Change Number (SCN) representing an ever-increasing update order.
@throws Exception if the address cannot be updated at the specified array index. | [
"Sets",
"the",
"address",
"(",
"long",
"value",
")",
"which",
"is",
"produced",
"by",
"the",
"Segment",
"compactor",
"at",
"the",
"specified",
"array",
"index",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/SimpleDataArray.java#L362-L365 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/BrokerHelper.java | BrokerHelper.getRealClassDescriptor | private ClassDescriptor getRealClassDescriptor(ClassDescriptor aCld, Object anObj)
{
ClassDescriptor result;
if(aCld.getClassOfObject() == ProxyHelper.getRealClass(anObj))
{
result = aCld;
}
else
{
result = aCld.getRepository().getDescriptorFor(anObj.getClass());
}
return result;
} | java | private ClassDescriptor getRealClassDescriptor(ClassDescriptor aCld, Object anObj)
{
ClassDescriptor result;
if(aCld.getClassOfObject() == ProxyHelper.getRealClass(anObj))
{
result = aCld;
}
else
{
result = aCld.getRepository().getDescriptorFor(anObj.getClass());
}
return result;
} | [
"private",
"ClassDescriptor",
"getRealClassDescriptor",
"(",
"ClassDescriptor",
"aCld",
",",
"Object",
"anObj",
")",
"{",
"ClassDescriptor",
"result",
";",
"if",
"(",
"aCld",
".",
"getClassOfObject",
"(",
")",
"==",
"ProxyHelper",
".",
"getRealClass",
"(",
"anObj"... | Answer the real ClassDescriptor for anObj
ie. aCld may be an Interface of anObj, so the cld for anObj is returned | [
"Answer",
"the",
"real",
"ClassDescriptor",
"for",
"anObj",
"ie",
".",
"aCld",
"may",
"be",
"an",
"Interface",
"of",
"anObj",
"so",
"the",
"cld",
"for",
"anObj",
"is",
"returned"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L141-L155 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/SymbolTable.java | SymbolTable.addSymbol | public String addSymbol(String symbol) {
// search for identical symbol
int bucket = hash(symbol) % fTableSize;
int length = symbol.length();
OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
if (length == entry.characters.length) {
for (int i = 0; i < length; i++) {
if (symbol.charAt(i) != entry.characters[i]) {
continue OUTER;
}
}
return entry.symbol;
}
}
// create new entry
Entry entry = new Entry(symbol, fBuckets[bucket]);
fBuckets[bucket] = entry;
return entry.symbol;
} | java | public String addSymbol(String symbol) {
// search for identical symbol
int bucket = hash(symbol) % fTableSize;
int length = symbol.length();
OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
if (length == entry.characters.length) {
for (int i = 0; i < length; i++) {
if (symbol.charAt(i) != entry.characters[i]) {
continue OUTER;
}
}
return entry.symbol;
}
}
// create new entry
Entry entry = new Entry(symbol, fBuckets[bucket]);
fBuckets[bucket] = entry;
return entry.symbol;
} | [
"public",
"String",
"addSymbol",
"(",
"String",
"symbol",
")",
"{",
"// search for identical symbol",
"int",
"bucket",
"=",
"hash",
"(",
"symbol",
")",
"%",
"fTableSize",
";",
"int",
"length",
"=",
"symbol",
".",
"length",
"(",
")",
";",
"OUTER",
":",
"for... | Adds the specified symbol to the symbol table and returns a
reference to the unique symbol. If the symbol already exists,
the previous symbol reference is returned instead, in order
guarantee that symbol references remain unique.
@param symbol The new symbol. | [
"Adds",
"the",
"specified",
"symbol",
"to",
"the",
"symbol",
"table",
"and",
"returns",
"a",
"reference",
"to",
"the",
"unique",
"symbol",
".",
"If",
"the",
"symbol",
"already",
"exists",
"the",
"previous",
"symbol",
"reference",
"is",
"returned",
"instead",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/document/SymbolTable.java#L86-L107 |
oasp/oasp4j | modules/cxf-client/src/main/java/io/oasp/module/cxf/common/impl/client/SyncServiceClientFactoryCxf.java | SyncServiceClientFactoryCxf.applyInterceptors | protected void applyInterceptors(ServiceContext<?> context, InterceptorProvider client, String serviceName) {
client.getOutInterceptors().add(new PerformanceStartInterceptor());
client.getInInterceptors().add(new PerformanceStopInterceptor());
client.getInFaultInterceptors().add(new TechnicalExceptionInterceptor(serviceName));
} | java | protected void applyInterceptors(ServiceContext<?> context, InterceptorProvider client, String serviceName) {
client.getOutInterceptors().add(new PerformanceStartInterceptor());
client.getInInterceptors().add(new PerformanceStopInterceptor());
client.getInFaultInterceptors().add(new TechnicalExceptionInterceptor(serviceName));
} | [
"protected",
"void",
"applyInterceptors",
"(",
"ServiceContext",
"<",
"?",
">",
"context",
",",
"InterceptorProvider",
"client",
",",
"String",
"serviceName",
")",
"{",
"client",
".",
"getOutInterceptors",
"(",
")",
".",
"add",
"(",
"new",
"PerformanceStartInterce... | Applies CXF interceptors to the given {@code serviceClient}.
@param context the {@link ServiceContext}.
@param client the {@link InterceptorProvider}.
@param serviceName the {@link #createServiceName(ServiceContext) service name}. | [
"Applies",
"CXF",
"interceptors",
"to",
"the",
"given",
"{",
"@code",
"serviceClient",
"}",
"."
] | train | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/cxf-client/src/main/java/io/oasp/module/cxf/common/impl/client/SyncServiceClientFactoryCxf.java#L120-L125 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.computeAngle | double computeAngle( int index1 ) {
int index0 = CircularIndex.addOffset(index1,-1, histogramMag.length);
int index2 = CircularIndex.addOffset(index1, 1, histogramMag.length);
// compute the peak location using a second order polygon
double v0 = histogramMag[index0];
double v1 = histogramMag[index1];
double v2 = histogramMag[index2];
double offset = FastHessianFeatureDetector.polyPeak(v0,v1,v2);
// interpolate using the index offset and angle of its neighbor
return interpolateAngle(index0, index1, index2, offset);
} | java | double computeAngle( int index1 ) {
int index0 = CircularIndex.addOffset(index1,-1, histogramMag.length);
int index2 = CircularIndex.addOffset(index1, 1, histogramMag.length);
// compute the peak location using a second order polygon
double v0 = histogramMag[index0];
double v1 = histogramMag[index1];
double v2 = histogramMag[index2];
double offset = FastHessianFeatureDetector.polyPeak(v0,v1,v2);
// interpolate using the index offset and angle of its neighbor
return interpolateAngle(index0, index1, index2, offset);
} | [
"double",
"computeAngle",
"(",
"int",
"index1",
")",
"{",
"int",
"index0",
"=",
"CircularIndex",
".",
"addOffset",
"(",
"index1",
",",
"-",
"1",
",",
"histogramMag",
".",
"length",
")",
";",
"int",
"index2",
"=",
"CircularIndex",
".",
"addOffset",
"(",
"... | Compute the angle. The angle for each neighbor bin is found using the weighted sum
of the derivative. Then the peak index is found by 2nd order polygon interpolation. These two bits of
information are combined and used to return the final angle output.
@param index1 Histogram index of the peak
@return angle of the peak. -pi to pi | [
"Compute",
"the",
"angle",
".",
"The",
"angle",
"for",
"each",
"neighbor",
"bin",
"is",
"found",
"using",
"the",
"weighted",
"sum",
"of",
"the",
"derivative",
".",
"Then",
"the",
"peak",
"index",
"is",
"found",
"by",
"2nd",
"order",
"polygon",
"interpolati... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L259-L273 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.initXPath | public void initXPath(
Compiler compiler, String expression, PrefixResolver namespaceContext)
throws javax.xml.transform.TransformerException
{
m_ops = compiler;
m_namespaceContext = namespaceContext;
m_functionTable = compiler.getFunctionTable();
Lexer lexer = new Lexer(compiler, namespaceContext, this);
lexer.tokenize(expression);
m_ops.setOp(0,OpCodes.OP_XPATH);
m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);
// Patch for Christine's gripe. She wants her errorHandler to return from
// a fatal error and continue trying to parse, rather than throwing an exception.
// Without the patch, that put us into an endless loop.
//
// %REVIEW% Is there a better way of doing this?
// %REVIEW% Are there any other cases which need the safety net?
// (and if so do we care right now, or should we rewrite the XPath
// grammar engine and can fix it at that time?)
try {
nextToken();
Expr();
if (null != m_token)
{
String extraTokens = "";
while (null != m_token)
{
extraTokens += "'" + m_token + "'";
nextToken();
if (null != m_token)
extraTokens += ", ";
}
error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens);
}
}
catch (org.apache.xpath.XPathProcessorException e)
{
if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
{
// What I _want_ to do is null out this XPath.
// I doubt this has the desired effect, but I'm not sure what else to do.
// %REVIEW%!!!
initXPath(compiler, "/..", namespaceContext);
}
else
throw e;
}
compiler.shrink();
} | java | public void initXPath(
Compiler compiler, String expression, PrefixResolver namespaceContext)
throws javax.xml.transform.TransformerException
{
m_ops = compiler;
m_namespaceContext = namespaceContext;
m_functionTable = compiler.getFunctionTable();
Lexer lexer = new Lexer(compiler, namespaceContext, this);
lexer.tokenize(expression);
m_ops.setOp(0,OpCodes.OP_XPATH);
m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);
// Patch for Christine's gripe. She wants her errorHandler to return from
// a fatal error and continue trying to parse, rather than throwing an exception.
// Without the patch, that put us into an endless loop.
//
// %REVIEW% Is there a better way of doing this?
// %REVIEW% Are there any other cases which need the safety net?
// (and if so do we care right now, or should we rewrite the XPath
// grammar engine and can fix it at that time?)
try {
nextToken();
Expr();
if (null != m_token)
{
String extraTokens = "";
while (null != m_token)
{
extraTokens += "'" + m_token + "'";
nextToken();
if (null != m_token)
extraTokens += ", ";
}
error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens);
}
}
catch (org.apache.xpath.XPathProcessorException e)
{
if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
{
// What I _want_ to do is null out this XPath.
// I doubt this has the desired effect, but I'm not sure what else to do.
// %REVIEW%!!!
initXPath(compiler, "/..", namespaceContext);
}
else
throw e;
}
compiler.shrink();
} | [
"public",
"void",
"initXPath",
"(",
"Compiler",
"compiler",
",",
"String",
"expression",
",",
"PrefixResolver",
"namespaceContext",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"m_ops",
"=",
"compiler",
";",
"m_namespaceC... | Given an string, init an XPath object for selections,
in order that a parse doesn't
have to be done each time the expression is evaluated.
@param compiler The compiler object.
@param expression A string conforming to the XPath grammar.
@param namespaceContext An object that is able to resolve prefixes in
the XPath to namespaces.
@throws javax.xml.transform.TransformerException | [
"Given",
"an",
"string",
"init",
"an",
"XPath",
"object",
"for",
"selections",
"in",
"order",
"that",
"a",
"parse",
"doesn",
"t",
"have",
"to",
"be",
"done",
"each",
"time",
"the",
"expression",
"is",
"evaluated",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L101-L164 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java | TimeZone.getDisplayName | public final String getDisplayName(boolean daylight, int style) {
return getDisplayName(daylight, style,
Locale.getDefault(Locale.Category.DISPLAY));
} | java | public final String getDisplayName(boolean daylight, int style) {
return getDisplayName(daylight, style,
Locale.getDefault(Locale.Category.DISPLAY));
} | [
"public",
"final",
"String",
"getDisplayName",
"(",
"boolean",
"daylight",
",",
"int",
"style",
")",
"{",
"return",
"getDisplayName",
"(",
"daylight",
",",
"style",
",",
"Locale",
".",
"getDefault",
"(",
"Locale",
".",
"Category",
".",
"DISPLAY",
")",
")",
... | Returns a name in the specified {@code style} of this {@code TimeZone}
suitable for presentation to the user in the default locale. If the
specified {@code daylight} is {@code true}, a Daylight Saving Time name
is returned (even if this {@code TimeZone} doesn't observe Daylight Saving
Time). Otherwise, a Standard Time name is returned.
<p>This method is equivalent to:
<blockquote><pre>
getDisplayName(daylight, style,
Locale.getDefault({@link Locale.Category#DISPLAY}))
</pre></blockquote>
@param daylight {@code true} specifying a Daylight Saving Time name, or
{@code false} specifying a Standard Time name
@param style either {@link #LONG} or {@link #SHORT}
@return the human-readable name of this time zone in the default locale.
@exception IllegalArgumentException if {@code style} is invalid.
@since 1.2
@see #getDisplayName(boolean, int, Locale)
@see Locale#getDefault(Locale.Category)
@see Locale.Category
@see java.text.DateFormatSymbols#getZoneStrings() | [
"Returns",
"a",
"name",
"in",
"the",
"specified",
"{",
"@code",
"style",
"}",
"of",
"this",
"{",
"@code",
"TimeZone",
"}",
"suitable",
"for",
"presentation",
"to",
"the",
"user",
"in",
"the",
"default",
"locale",
".",
"If",
"the",
"specified",
"{",
"@cod... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java#L369-L372 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/CommonUtils.java | CommonUtils.getWorkerDataDirectory | public static String getWorkerDataDirectory(String storageDir, AlluxioConfiguration conf) {
return PathUtils.concatPath(
storageDir.trim(), conf.get(PropertyKey.WORKER_DATA_FOLDER));
} | java | public static String getWorkerDataDirectory(String storageDir, AlluxioConfiguration conf) {
return PathUtils.concatPath(
storageDir.trim(), conf.get(PropertyKey.WORKER_DATA_FOLDER));
} | [
"public",
"static",
"String",
"getWorkerDataDirectory",
"(",
"String",
"storageDir",
",",
"AlluxioConfiguration",
"conf",
")",
"{",
"return",
"PathUtils",
".",
"concatPath",
"(",
"storageDir",
".",
"trim",
"(",
")",
",",
"conf",
".",
"get",
"(",
"PropertyKey",
... | @param storageDir the root of a storage directory in tiered storage
@param conf Alluxio's current configuration
@return the worker data folder path after each storage directory, the final path will be like
"/mnt/ramdisk/alluxioworker" for storage dir "/mnt/ramdisk" by appending
{@link PropertyKey#WORKER_DATA_FOLDER). | [
"@param",
"storageDir",
"the",
"root",
"of",
"a",
"storage",
"directory",
"in",
"tiered",
"storage",
"@param",
"conf",
"Alluxio",
"s",
"current",
"configuration"
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/CommonUtils.java#L99-L102 |
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.createOrUpdateAsync | public Observable<LabInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, LabInner lab) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, lab).map(new Func1<ServiceResponse<LabInner>, LabInner>() {
@Override
public LabInner call(ServiceResponse<LabInner> response) {
return response.body();
}
});
} | java | public Observable<LabInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, LabInner lab) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, lab).map(new Func1<ServiceResponse<LabInner>, LabInner>() {
@Override
public LabInner call(ServiceResponse<LabInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LabInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"LabInner",
"lab",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupN... | Create or replace an existing Lab.
@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
@return the observable to the LabInner object | [
"Create",
"or",
"replace",
"an",
"existing",
"Lab",
"."
] | 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#L594-L601 |
OpenTSDB/opentsdb | src/tools/UidManager.java | UidManager.purgeTree | private static int purgeTree(final TSDB tsdb, final int tree_id,
final boolean delete_definition) throws Exception {
final TreeSync sync = new TreeSync(tsdb, 0, 1, 0);
return sync.purgeTree(tree_id, delete_definition);
} | java | private static int purgeTree(final TSDB tsdb, final int tree_id,
final boolean delete_definition) throws Exception {
final TreeSync sync = new TreeSync(tsdb, 0, 1, 0);
return sync.purgeTree(tree_id, delete_definition);
} | [
"private",
"static",
"int",
"purgeTree",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"int",
"tree_id",
",",
"final",
"boolean",
"delete_definition",
")",
"throws",
"Exception",
"{",
"final",
"TreeSync",
"sync",
"=",
"new",
"TreeSync",
"(",
"tsdb",
",",
"0",
... | Attempts to delete the branches, leaves, collisions and not-matched entries
for a given tree. Optionally removes the tree definition itself
@param tsdb The TSDB to use for access
@param tree_id ID of the tree to delete
@param delete_definition Whether or not to delete the tree definition as
well
@return 0 if completed successfully, something else if an error occurred | [
"Attempts",
"to",
"delete",
"the",
"branches",
"leaves",
"collisions",
"and",
"not",
"-",
"matched",
"entries",
"for",
"a",
"given",
"tree",
".",
"Optionally",
"removes",
"the",
"tree",
"definition",
"itself"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L1149-L1153 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectMgr.java | FrameworkProjectMgr.getFrameworkProject | public FrameworkProject getFrameworkProject(final String name) {
FrameworkProject frameworkProject = loadChild(name);
if (null != frameworkProject) {
return frameworkProject;
}
throw new NoSuchResourceException("Project does not exist: " + name, this);
} | java | public FrameworkProject getFrameworkProject(final String name) {
FrameworkProject frameworkProject = loadChild(name);
if (null != frameworkProject) {
return frameworkProject;
}
throw new NoSuchResourceException("Project does not exist: " + name, this);
} | [
"public",
"FrameworkProject",
"getFrameworkProject",
"(",
"final",
"String",
"name",
")",
"{",
"FrameworkProject",
"frameworkProject",
"=",
"loadChild",
"(",
"name",
")",
";",
"if",
"(",
"null",
"!=",
"frameworkProject",
")",
"{",
"return",
"frameworkProject",
";"... | @return an existing Project object and returns it
@param name The name of the project | [
"@return",
"an",
"existing",
"Project",
"object",
"and",
"returns",
"it"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectMgr.java#L197-L203 |
orhanobut/mockwebserverplus | mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/Fixture.java | Fixture.parseFrom | public static Fixture parseFrom(String fileName, Parser parser) {
if (fileName == null) {
throw new NullPointerException("File name should not be null");
}
String path = "fixtures/" + fileName + ".yaml";
InputStream inputStream = openPathAsStream(path);
Fixture result = parser.parse(inputStream);
if (result.body != null && !result.body.startsWith("{")) {
String bodyPath = "fixtures/" + result.body;
try {
result.body = readPathIntoString(bodyPath);
} catch (IOException e) {
throw new IllegalStateException("Error reading body: " + bodyPath, e);
}
}
return result;
} | java | public static Fixture parseFrom(String fileName, Parser parser) {
if (fileName == null) {
throw new NullPointerException("File name should not be null");
}
String path = "fixtures/" + fileName + ".yaml";
InputStream inputStream = openPathAsStream(path);
Fixture result = parser.parse(inputStream);
if (result.body != null && !result.body.startsWith("{")) {
String bodyPath = "fixtures/" + result.body;
try {
result.body = readPathIntoString(bodyPath);
} catch (IOException e) {
throw new IllegalStateException("Error reading body: " + bodyPath, e);
}
}
return result;
} | [
"public",
"static",
"Fixture",
"parseFrom",
"(",
"String",
"fileName",
",",
"Parser",
"parser",
")",
"{",
"if",
"(",
"fileName",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"File name should not be null\"",
")",
";",
"}",
"String",
"... | Parse the given filename and returns the Fixture object.
@param fileName filename should not contain extension or relative path. ie: login
@param parser parser is required for parsing operation, it should not be null | [
"Parse",
"the",
"given",
"filename",
"and",
"returns",
"the",
"Fixture",
"object",
"."
] | train | https://github.com/orhanobut/mockwebserverplus/blob/bb2c5cb4eece98745688ec562486b6bfc5d1b6c7/mockwebserverplus/src/main/java/com/orhanobut/mockwebserverplus/Fixture.java#L38-L55 |
tropo/tropo-webapi-java | src/main/java/com/voxeo/tropo/Key.java | Key.SAY_OF_ON | public static Key SAY_OF_ON(com.voxeo.tropo.actions.OnAction.Say... says) {
return createKey("say", says);
} | java | public static Key SAY_OF_ON(com.voxeo.tropo.actions.OnAction.Say... says) {
return createKey("say", says);
} | [
"public",
"static",
"Key",
"SAY_OF_ON",
"(",
"com",
".",
"voxeo",
".",
"tropo",
".",
"actions",
".",
"OnAction",
".",
"Say",
"...",
"says",
")",
"{",
"return",
"createKey",
"(",
"\"say\"",
",",
"says",
")",
";",
"}"
] | <p>
This determines what is played or sent to the caller. This can be a single
object or an array of objects.
</p> | [
"<p",
">",
"This",
"determines",
"what",
"is",
"played",
"or",
"sent",
"to",
"the",
"caller",
".",
"This",
"can",
"be",
"a",
"single",
"object",
"or",
"an",
"array",
"of",
"objects",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/tropo/tropo-webapi-java/blob/96af1fa292c1d4b6321d85a559d9718d33eec7e0/src/main/java/com/voxeo/tropo/Key.java#L783-L786 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/EndPointInfoImpl.java | EndPointInfoImpl.updatePort | public int updatePort(final int newPort) {
int oldPort = this.port;
this.port = newPort;
if (oldPort != newPort) {
sendNotification(new AttributeChangeNotification(this, sequenceNum.incrementAndGet(), System.currentTimeMillis(), this.toString()
+ " port value changed", "Port", "java.lang.Integer", oldPort, newPort));
}
return oldPort;
} | java | public int updatePort(final int newPort) {
int oldPort = this.port;
this.port = newPort;
if (oldPort != newPort) {
sendNotification(new AttributeChangeNotification(this, sequenceNum.incrementAndGet(), System.currentTimeMillis(), this.toString()
+ " port value changed", "Port", "java.lang.Integer", oldPort, newPort));
}
return oldPort;
} | [
"public",
"int",
"updatePort",
"(",
"final",
"int",
"newPort",
")",
"{",
"int",
"oldPort",
"=",
"this",
".",
"port",
";",
"this",
".",
"port",
"=",
"newPort",
";",
"if",
"(",
"oldPort",
"!=",
"newPort",
")",
"{",
"sendNotification",
"(",
"new",
"Attrib... | Update the port value for this end point.
Will emit an AttributeChangeNotification if the value changed.
@param newPort The new (or current) port value. If no change, no notification is sent.
@return int The previous port value | [
"Update",
"the",
"port",
"value",
"for",
"this",
"end",
"point",
".",
"Will",
"emit",
"an",
"AttributeChangeNotification",
"if",
"the",
"value",
"changed",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/EndPointInfoImpl.java#L141-L151 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/alias/simple/CmsAliasPathColumn.java | CmsAliasPathColumn.getComparator | public static Comparator<CmsAliasTableRow> getComparator() {
return new Comparator<CmsAliasTableRow>() {
public int compare(CmsAliasTableRow o1, CmsAliasTableRow o2) {
return o1.getAliasPath().toString().compareTo(o2.getAliasPath().toString());
}
};
} | java | public static Comparator<CmsAliasTableRow> getComparator() {
return new Comparator<CmsAliasTableRow>() {
public int compare(CmsAliasTableRow o1, CmsAliasTableRow o2) {
return o1.getAliasPath().toString().compareTo(o2.getAliasPath().toString());
}
};
} | [
"public",
"static",
"Comparator",
"<",
"CmsAliasTableRow",
">",
"getComparator",
"(",
")",
"{",
"return",
"new",
"Comparator",
"<",
"CmsAliasTableRow",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"CmsAliasTableRow",
"o1",
",",
"CmsAliasTableRow",
"o2",
... | Gets the comparator used for this column.<p>
@return the comparator to use for this row | [
"Gets",
"the",
"comparator",
"used",
"for",
"this",
"column",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/alias/simple/CmsAliasPathColumn.java#L75-L84 |
mapbox/mapbox-java | services-turf/src/main/java/com/mapbox/turf/TurfAssertions.java | TurfAssertions.collectionOf | public static void collectionOf(FeatureCollection featureCollection, String type, String name) {
if (name == null || name.length() == 0) {
throw new TurfException("collectionOf() requires a name");
}
if (featureCollection == null || !featureCollection.type().equals("FeatureCollection")
|| featureCollection.features() == null) {
throw new TurfException(String.format(
"Invalid input to %s, FeatureCollection required", name));
}
for (Feature feature : featureCollection.features()) {
if (feature == null || !feature.type().equals("Feature") || feature.geometry() == null) {
throw new TurfException(String.format(
"Invalid input to %s, Feature with geometry required", name));
}
if (feature.geometry() == null || !feature.geometry().type().equals(type)) {
throw new TurfException(String.format(
"Invalid input to %s: must be a %s, given %s", name, type, feature.geometry().type()));
}
}
} | java | public static void collectionOf(FeatureCollection featureCollection, String type, String name) {
if (name == null || name.length() == 0) {
throw new TurfException("collectionOf() requires a name");
}
if (featureCollection == null || !featureCollection.type().equals("FeatureCollection")
|| featureCollection.features() == null) {
throw new TurfException(String.format(
"Invalid input to %s, FeatureCollection required", name));
}
for (Feature feature : featureCollection.features()) {
if (feature == null || !feature.type().equals("Feature") || feature.geometry() == null) {
throw new TurfException(String.format(
"Invalid input to %s, Feature with geometry required", name));
}
if (feature.geometry() == null || !feature.geometry().type().equals(type)) {
throw new TurfException(String.format(
"Invalid input to %s: must be a %s, given %s", name, type, feature.geometry().type()));
}
}
} | [
"public",
"static",
"void",
"collectionOf",
"(",
"FeatureCollection",
"featureCollection",
",",
"String",
"type",
",",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new"... | Enforce expectations about types of {@link FeatureCollection} inputs for Turf. Internally
this uses {@link Feature#type()}} to judge geometry types.
@param featureCollection for which features will be judged
@param type expected GeoJson type
@param name name of calling function
@see <a href="http://turfjs.org/docs/#collectionof">Turf collectionOf documentation</a>
@since 1.2.0 | [
"Enforce",
"expectations",
"about",
"types",
"of",
"{",
"@link",
"FeatureCollection",
"}",
"inputs",
"for",
"Turf",
".",
"Internally",
"this",
"uses",
"{",
"@link",
"Feature#type",
"()",
"}}",
"to",
"judge",
"geometry",
"types",
"."
] | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-turf/src/main/java/com/mapbox/turf/TurfAssertions.java#L88-L107 |
GoSimpleLLC/nbvcxz | src/main/java/me/gosimple/nbvcxz/resources/DictionaryUtil.java | DictionaryUtil.loadRankedDictionary | public static Map<String, Integer> loadRankedDictionary(final String fileName)
{
Map<String, Integer> ranked = new HashMap<>();
String path = "/dictionaries/" + fileName;
try (InputStream is = DictionaryUtil.class.getResourceAsStream(path);
BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")))
{
String line;
int i = 1;
while ((line = br.readLine()) != null)
{
ranked.put(line, i++);
}
}
catch (IOException e)
{
System.out.println("Error while reading " + fileName);
}
return ranked;
} | java | public static Map<String, Integer> loadRankedDictionary(final String fileName)
{
Map<String, Integer> ranked = new HashMap<>();
String path = "/dictionaries/" + fileName;
try (InputStream is = DictionaryUtil.class.getResourceAsStream(path);
BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")))
{
String line;
int i = 1;
while ((line = br.readLine()) != null)
{
ranked.put(line, i++);
}
}
catch (IOException e)
{
System.out.println("Error while reading " + fileName);
}
return ranked;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Integer",
">",
"loadRankedDictionary",
"(",
"final",
"String",
"fileName",
")",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"ranked",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"String",
"path",
"=",
... | Read a resource file with a list of entries (sorted by frequency) and use
it to create a ranked dictionary.
<p>
The dictionary must contain only lower case values for the matching to work properly.
@param fileName the name of the file
@return the ranked dictionary (a {@code HashMap} which associated a
rank to each entry | [
"Read",
"a",
"resource",
"file",
"with",
"a",
"list",
"of",
"entries",
"(",
"sorted",
"by",
"frequency",
")",
"and",
"use",
"it",
"to",
"create",
"a",
"ranked",
"dictionary",
".",
"<p",
">",
"The",
"dictionary",
"must",
"contain",
"only",
"lower",
"case"... | train | https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/resources/DictionaryUtil.java#L99-L119 |
kite-sdk/kite | kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/io/MemcmpDecoder.java | MemcmpDecoder.readFixed | @Override
public void readFixed(byte[] bytes, int start, int length) throws IOException {
int i = in.read(bytes, start, length);
if (i < length) {
throw new EOFException();
}
} | java | @Override
public void readFixed(byte[] bytes, int start, int length) throws IOException {
int i = in.read(bytes, start, length);
if (i < length) {
throw new EOFException();
}
} | [
"@",
"Override",
"public",
"void",
"readFixed",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"int",
"i",
"=",
"in",
".",
"read",
"(",
"bytes",
",",
"start",
",",
"length",
")",
";",
"... | A fixed is decoded by just reading length bytes, and placing the bytes read
into the bytes array, starting at index start.
@param bytes
The bytes array to populate.
@param start
The index in bytes to place the read bytes.
@param length
The number of bytes to read. | [
"A",
"fixed",
"is",
"decoded",
"by",
"just",
"reading",
"length",
"bytes",
"and",
"placing",
"the",
"bytes",
"read",
"into",
"the",
"bytes",
"array",
"starting",
"at",
"index",
"start",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/io/MemcmpDecoder.java#L227-L233 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/math/matrixes/Matrix.java | Matrix.setColumn | public void setColumn(ColumnVector cv, int c)
throws MatrixException
{
if ((c < 0) || (c >= nCols)) {
throw new MatrixException(MatrixException.INVALID_INDEX);
}
if (nRows != cv.nRows) {
throw new MatrixException(
MatrixException.INVALID_DIMENSIONS);
}
for (int r = 0; r < nRows; ++r) {
this.values[r][c] = cv.values[r][0];
}
} | java | public void setColumn(ColumnVector cv, int c)
throws MatrixException
{
if ((c < 0) || (c >= nCols)) {
throw new MatrixException(MatrixException.INVALID_INDEX);
}
if (nRows != cv.nRows) {
throw new MatrixException(
MatrixException.INVALID_DIMENSIONS);
}
for (int r = 0; r < nRows; ++r) {
this.values[r][c] = cv.values[r][0];
}
} | [
"public",
"void",
"setColumn",
"(",
"ColumnVector",
"cv",
",",
"int",
"c",
")",
"throws",
"MatrixException",
"{",
"if",
"(",
"(",
"c",
"<",
"0",
")",
"||",
"(",
"c",
">=",
"nCols",
")",
")",
"{",
"throw",
"new",
"MatrixException",
"(",
"MatrixException... | Set a column of this matrix from a column vector.
@param cv the column vector
@param c the column index
@throws numbercruncher.MatrixException for an invalid index or
an invalid vector size | [
"Set",
"a",
"column",
"of",
"this",
"matrix",
"from",
"a",
"column",
"vector",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/math/matrixes/Matrix.java#L205-L219 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/primitives/UnsignedLongs.java | UnsignedLongs.parseUnsignedLong | @CanIgnoreReturnValue
public static long parseUnsignedLong(String string, int radix) {
checkNotNull(string);
if (string.length() == 0) {
throw new NumberFormatException("empty string");
}
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) {
throw new NumberFormatException("illegal radix: " + radix);
}
int maxSafePos = maxSafeDigits[radix] - 1;
long value = 0;
for (int pos = 0; pos < string.length(); pos++) {
int digit = Character.digit(string.charAt(pos), radix);
if (digit == -1) {
throw new NumberFormatException(string);
}
if (pos > maxSafePos && overflowInParse(value, digit, radix)) {
throw new NumberFormatException("Too large for unsigned long: " + string);
}
value = (value * radix) + digit;
}
return value;
} | java | @CanIgnoreReturnValue
public static long parseUnsignedLong(String string, int radix) {
checkNotNull(string);
if (string.length() == 0) {
throw new NumberFormatException("empty string");
}
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) {
throw new NumberFormatException("illegal radix: " + radix);
}
int maxSafePos = maxSafeDigits[radix] - 1;
long value = 0;
for (int pos = 0; pos < string.length(); pos++) {
int digit = Character.digit(string.charAt(pos), radix);
if (digit == -1) {
throw new NumberFormatException(string);
}
if (pos > maxSafePos && overflowInParse(value, digit, radix)) {
throw new NumberFormatException("Too large for unsigned long: " + string);
}
value = (value * radix) + digit;
}
return value;
} | [
"@",
"CanIgnoreReturnValue",
"public",
"static",
"long",
"parseUnsignedLong",
"(",
"String",
"string",
",",
"int",
"radix",
")",
"{",
"checkNotNull",
"(",
"string",
")",
";",
"if",
"(",
"string",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"ne... | Returns the unsigned {@code long} value represented by a string with the given radix.
@param s the string containing the unsigned {@code long} representation to be parsed.
@param radix the radix to use while parsing {@code string}
@throws NumberFormatException if the string does not contain a valid unsigned {@code long} with
the given radix, or if {@code radix} is not between {@link Character#MIN_RADIX} and
{@link Character#MAX_RADIX}.
@throws NullPointerException if {@code string} is null (in contrast to
{@link Long#parseLong(String)}) | [
"Returns",
"the",
"unsigned",
"{",
"@code",
"long",
"}",
"value",
"represented",
"by",
"a",
"string",
"with",
"the",
"given",
"radix",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/primitives/UnsignedLongs.java#L298-L322 |
jboss/jboss-jstl-api_spec | src/main/java/javax/servlet/jsp/jstl/tlv/ScriptFreeTLV.java | ScriptFreeTLV.setInitParameters | @Override
public void setInitParameters(Map<java.lang.String, java.lang.Object> initParms) {
super.setInitParameters(initParms);
String declarationsParm = (String) initParms.get("allowDeclarations");
String scriptletsParm = (String) initParms.get("allowScriptlets");
String expressionsParm = (String) initParms.get("allowExpressions");
String rtExpressionsParm = (String) initParms.get("allowRTExpressions");
allowDeclarations = "true".equalsIgnoreCase(declarationsParm);
allowScriptlets = "true".equalsIgnoreCase(scriptletsParm);
allowExpressions = "true".equalsIgnoreCase(expressionsParm);
allowRTExpressions = "true".equalsIgnoreCase(rtExpressionsParm);
} | java | @Override
public void setInitParameters(Map<java.lang.String, java.lang.Object> initParms) {
super.setInitParameters(initParms);
String declarationsParm = (String) initParms.get("allowDeclarations");
String scriptletsParm = (String) initParms.get("allowScriptlets");
String expressionsParm = (String) initParms.get("allowExpressions");
String rtExpressionsParm = (String) initParms.get("allowRTExpressions");
allowDeclarations = "true".equalsIgnoreCase(declarationsParm);
allowScriptlets = "true".equalsIgnoreCase(scriptletsParm);
allowExpressions = "true".equalsIgnoreCase(expressionsParm);
allowRTExpressions = "true".equalsIgnoreCase(rtExpressionsParm);
} | [
"@",
"Override",
"public",
"void",
"setInitParameters",
"(",
"Map",
"<",
"java",
".",
"lang",
".",
"String",
",",
"java",
".",
"lang",
".",
"Object",
">",
"initParms",
")",
"{",
"super",
".",
"setInitParameters",
"(",
"initParms",
")",
";",
"String",
"de... | Sets the values of the initialization parameters, as supplied in the TLD.
@param initParms a mapping from the names of the initialization parameters
to their values, as specified in the TLD. | [
"Sets",
"the",
"values",
"of",
"the",
"initialization",
"parameters",
"as",
"supplied",
"in",
"the",
"TLD",
"."
] | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/javax/servlet/jsp/jstl/tlv/ScriptFreeTLV.java#L68-L80 |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAtomTypeMatcher.java | MmffAtomTypeMatcher.fixNCNTypes | private void fixNCNTypes(String[] symbs, int[][] graph) {
for (int v = 0; v < graph.length; v++) {
if ("NCN+".equals(symbs[v])) {
boolean foundCNN = false;
for (int w : graph[v]) {
foundCNN = foundCNN || "CNN+".equals(symbs[w]) || "CIM+".equals(symbs[w]);
}
if (!foundCNN) {
symbs[v] = "NC=N";
}
}
}
} | java | private void fixNCNTypes(String[] symbs, int[][] graph) {
for (int v = 0; v < graph.length; v++) {
if ("NCN+".equals(symbs[v])) {
boolean foundCNN = false;
for (int w : graph[v]) {
foundCNN = foundCNN || "CNN+".equals(symbs[w]) || "CIM+".equals(symbs[w]);
}
if (!foundCNN) {
symbs[v] = "NC=N";
}
}
}
} | [
"private",
"void",
"fixNCNTypes",
"(",
"String",
"[",
"]",
"symbs",
",",
"int",
"[",
"]",
"[",
"]",
"graph",
")",
"{",
"for",
"(",
"int",
"v",
"=",
"0",
";",
"v",
"<",
"graph",
".",
"length",
";",
"v",
"++",
")",
"{",
"if",
"(",
"\"NCN+\"",
"... | Special case, 'NCN+' matches entries that the validation suite say should actually be 'NC=N'.
We can achieve 100% compliance by checking if NCN+ is still next to CNN+ or CIM+ after
aromatic types are assigned
@param symbs symbolic types
@param graph adjacency list graph | [
"Special",
"case",
"NCN",
"+",
"matches",
"entries",
"that",
"the",
"validation",
"suite",
"say",
"should",
"actually",
"be",
"NC",
"=",
"N",
".",
"We",
"can",
"achieve",
"100%",
"compliance",
"by",
"checking",
"if",
"NCN",
"+",
"is",
"still",
"next",
"t... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAtomTypeMatcher.java#L149-L161 |
unbescape/unbescape | src/main/java/org/unbescape/json/JsonEscape.java | JsonEscape.unescapeJson | public static void unescapeJson(final Reader reader, final Writer writer)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
JsonEscapeUtil.unescape(reader, writer);
} | java | public static void unescapeJson(final Reader reader, final Writer writer)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
JsonEscapeUtil.unescape(reader, writer);
} | [
"public",
"static",
"void",
"unescapeJson",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'writer' ... | <p>
Perform a JSON <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing
results to a <tt>Writer</tt>.
</p>
<p>
No additional configuration arguments are required. Unescape operations
will always perform <em>complete</em> JSON unescape of SECs and u-based escapes.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"a",
"JSON",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/json/JsonEscape.java#L957-L966 |
HiddenStage/divide | Shared/src/main/java/io/divide/shared/transitory/TransientObject.java | TransientObject.put | public void put(String key, Object object, boolean serialize){
if(serialize)
put(key,gson.toJson(object));
else
put(key,object);
} | java | public void put(String key, Object object, boolean serialize){
if(serialize)
put(key,gson.toJson(object));
else
put(key,object);
} | [
"public",
"void",
"put",
"(",
"String",
"key",
",",
"Object",
"object",
",",
"boolean",
"serialize",
")",
"{",
"if",
"(",
"serialize",
")",
"put",
"(",
"key",
",",
"gson",
".",
"toJson",
"(",
"object",
")",
")",
";",
"else",
"put",
"(",
"key",
",",... | Add a specific key value pair to this object.
@param key key to identify this element by.
@param object object to be added.
@param serialize whether to manually serialize this object and store it as a json blob. | [
"Add",
"a",
"specific",
"key",
"value",
"pair",
"to",
"this",
"object",
"."
] | train | https://github.com/HiddenStage/divide/blob/14e36598c50d92b4393e6649915e32b86141c598/Shared/src/main/java/io/divide/shared/transitory/TransientObject.java#L167-L172 |
alkacon/opencms-core | src/org/opencms/xml/types/CmsXmlVfsImageValue.java | CmsXmlVfsImageValue.setFormat | public void setFormat(CmsObject cms, String format) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(format)) {
m_format = "";
if (m_element.element(PARAM_FORMAT) != null) {
m_element.remove(m_element.element(PARAM_FORMAT));
}
} else {
m_format = format;
}
setParameterValue(cms, PARAM_FORMAT, format);
} | java | public void setFormat(CmsObject cms, String format) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(format)) {
m_format = "";
if (m_element.element(PARAM_FORMAT) != null) {
m_element.remove(m_element.element(PARAM_FORMAT));
}
} else {
m_format = format;
}
setParameterValue(cms, PARAM_FORMAT, format);
} | [
"public",
"void",
"setFormat",
"(",
"CmsObject",
"cms",
",",
"String",
"format",
")",
"{",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhitespaceOnly",
"(",
"format",
")",
")",
"{",
"m_format",
"=",
"\"\"",
";",
"if",
"(",
"m_element",
".",
"element",
"(",
... | Sets the format information of the image.<p>
@param cms the current users contexts
@param format the format information of the image | [
"Sets",
"the",
"format",
"information",
"of",
"the",
"image",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/types/CmsXmlVfsImageValue.java#L248-L259 |
LearnLib/automatalib | serialization/etf/src/main/java/net/automatalib/serialization/etf/writer/DFA2ETFWriter.java | DFA2ETFWriter.writeETF | @Override
protected void writeETF(PrintWriter pw, DFA<?, I> dfa, Alphabet<I> inputs) {
writeETFInternal(pw, dfa, inputs);
} | java | @Override
protected void writeETF(PrintWriter pw, DFA<?, I> dfa, Alphabet<I> inputs) {
writeETFInternal(pw, dfa, inputs);
} | [
"@",
"Override",
"protected",
"void",
"writeETF",
"(",
"PrintWriter",
"pw",
",",
"DFA",
"<",
"?",
",",
"I",
">",
"dfa",
",",
"Alphabet",
"<",
"I",
">",
"inputs",
")",
"{",
"writeETFInternal",
"(",
"pw",
",",
"dfa",
",",
"inputs",
")",
";",
"}"
] | Write DFA specific parts in the ETF.
- initial state,
- the valuations for the state 'id',
- the letters in the alphabet,
- the transitions,
- the state labels (rejecting/accepting),
- the mapping from states to state labels.
@param pw the Writer.
@param dfa the DFA to write.
@param inputs the alphabet. | [
"Write",
"DFA",
"specific",
"parts",
"in",
"the",
"ETF",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/serialization/etf/src/main/java/net/automatalib/serialization/etf/writer/DFA2ETFWriter.java#L63-L66 |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java | VortexAggregateFuture.aggregationCompleted | @Private
@Override
public void aggregationCompleted(final List<Integer> taskletIds, final TOutput result) {
try {
completedTasklets(result, taskletIds);
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | java | @Private
@Override
public void aggregationCompleted(final List<Integer> taskletIds, final TOutput result) {
try {
completedTasklets(result, taskletIds);
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Private",
"@",
"Override",
"public",
"void",
"aggregationCompleted",
"(",
"final",
"List",
"<",
"Integer",
">",
"taskletIds",
",",
"final",
"TOutput",
"result",
")",
"{",
"try",
"{",
"completedTasklets",
"(",
"result",
",",
"taskletIds",
")",
";",
"}",... | Aggregation has completed for a list of Tasklets, with an aggregated result. | [
"Aggregation",
"has",
"completed",
"for",
"a",
"list",
"of",
"Tasklets",
"with",
"an",
"aggregated",
"result",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L125-L133 |
awltech/org.parallelj | parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/loop/KWhileLoop.java | KWhileLoop.complete | private void complete(KSplit split, KCall call) {
reset(call.getProcess());
split.split(call);
} | java | private void complete(KSplit split, KCall call) {
reset(call.getProcess());
split.split(call);
} | [
"private",
"void",
"complete",
"(",
"KSplit",
"split",
",",
"KCall",
"call",
")",
"{",
"reset",
"(",
"call",
".",
"getProcess",
"(",
")",
")",
";",
"split",
".",
"split",
"(",
"call",
")",
";",
"}"
] | Called at the end of a KWhileLoop
@param split
@param call
@return void | [
"Called",
"at",
"the",
"end",
"of",
"a",
"KWhileLoop"
] | train | https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/loop/KWhileLoop.java#L145-L148 |
xcesco/kripton | kripton-shared-preferences/src/main/java/com/abubusoft/kripton/common/PrefsTypeAdapterUtils.java | PrefsTypeAdapterUtils.toJava | public static <D, J> J toJava(Class<? extends PreferenceTypeAdapter<J, D>> clazz, D value) {
@SuppressWarnings("unchecked")
PreferenceTypeAdapter<J, D> adapter = cache.get(clazz);
if (adapter == null) {
adapter = generateAdapter(clazz);
}
return adapter.toJava(value);
} | java | public static <D, J> J toJava(Class<? extends PreferenceTypeAdapter<J, D>> clazz, D value) {
@SuppressWarnings("unchecked")
PreferenceTypeAdapter<J, D> adapter = cache.get(clazz);
if (adapter == null) {
adapter = generateAdapter(clazz);
}
return adapter.toJava(value);
} | [
"public",
"static",
"<",
"D",
",",
"J",
">",
"J",
"toJava",
"(",
"Class",
"<",
"?",
"extends",
"PreferenceTypeAdapter",
"<",
"J",
",",
"D",
">",
">",
"clazz",
",",
"D",
"value",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"PreferenceT... | To java.
@param <D> the generic type
@param <J> the generic type
@param clazz the clazz
@param value the value
@return the j | [
"To",
"java",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-shared-preferences/src/main/java/com/abubusoft/kripton/common/PrefsTypeAdapterUtils.java#L46-L55 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java | Util.extractStyle | static String extractStyle(String style, String attribute) {
if (style == null) {
return "";
}
StringTokenizer tokens = new StringTokenizer(style,";");
while (tokens.hasMoreTokens()) {
String token = tokens.nextToken();
String key = token.substring(0,token.indexOf(':'));
if (key.equals(attribute)) {
return token.substring(token.indexOf(':')+1);
}
}
return "";
} | java | static String extractStyle(String style, String attribute) {
if (style == null) {
return "";
}
StringTokenizer tokens = new StringTokenizer(style,";");
while (tokens.hasMoreTokens()) {
String token = tokens.nextToken();
String key = token.substring(0,token.indexOf(':'));
if (key.equals(attribute)) {
return token.substring(token.indexOf(':')+1);
}
}
return "";
} | [
"static",
"String",
"extractStyle",
"(",
"String",
"style",
",",
"String",
"attribute",
")",
"{",
"if",
"(",
"style",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringTokenizer",
"tokens",
"=",
"new",
"StringTokenizer",
"(",
"style",
",",
"\";\""... | Extract the style value from a Inkscape encoded string
@param style The style string to be decoded
@param attribute The style attribute to retrieve
@return The value for the given attribute | [
"Extract",
"the",
"style",
"value",
"from",
"a",
"Inkscape",
"encoded",
"string"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java#L87-L103 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toDate | public static DateTime toDate(String str, TimeZone tz) throws PageException {
return DateCaster.toDateAdvanced(str, tz);
} | java | public static DateTime toDate(String str, TimeZone tz) throws PageException {
return DateCaster.toDateAdvanced(str, tz);
} | [
"public",
"static",
"DateTime",
"toDate",
"(",
"String",
"str",
",",
"TimeZone",
"tz",
")",
"throws",
"PageException",
"{",
"return",
"DateCaster",
".",
"toDateAdvanced",
"(",
"str",
",",
"tz",
")",
";",
"}"
] | cast a Object to a DateTime Object
@param str String to cast
@param tz
@return casted DateTime Object
@throws PageException | [
"cast",
"a",
"Object",
"to",
"a",
"DateTime",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L2885-L2887 |
javagl/ND | nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleNeighborhoodIterables.java | IntTupleNeighborhoodIterables.vonNeumannNeighborhoodIterable | public static Iterable<MutableIntTuple> vonNeumannNeighborhoodIterable(
IntTuple center, final int radius)
{
final IntTuple localCenter = IntTuples.copy(center);
return new Iterable<MutableIntTuple>()
{
@Override
public Iterator<MutableIntTuple> iterator()
{
return new VonNeumannIntTupleIterator(localCenter, radius);
}
};
} | java | public static Iterable<MutableIntTuple> vonNeumannNeighborhoodIterable(
IntTuple center, final int radius)
{
final IntTuple localCenter = IntTuples.copy(center);
return new Iterable<MutableIntTuple>()
{
@Override
public Iterator<MutableIntTuple> iterator()
{
return new VonNeumannIntTupleIterator(localCenter, radius);
}
};
} | [
"public",
"static",
"Iterable",
"<",
"MutableIntTuple",
">",
"vonNeumannNeighborhoodIterable",
"(",
"IntTuple",
"center",
",",
"final",
"int",
"radius",
")",
"{",
"final",
"IntTuple",
"localCenter",
"=",
"IntTuples",
".",
"copy",
"(",
"center",
")",
";",
"return... | Creates an iterable that provides iterators for iterating over the
Von Neumann neighborhood of the given center and the given radius.<br>
<br>
Also see <a href="../../package-summary.html#Neighborhoods">
Neighborhoods</a>
@param center The center of the Von Neumann neighborhood.
A copy of this tuple will be stored internally.
@param radius The radius of the Von Neumann neighborhood
@return The iterable | [
"Creates",
"an",
"iterable",
"that",
"provides",
"iterators",
"for",
"iterating",
"over",
"the",
"Von",
"Neumann",
"neighborhood",
"of",
"the",
"given",
"center",
"and",
"the",
"given",
"radius",
".",
"<br",
">",
"<br",
">",
"Also",
"see",
"<a",
"href",
"=... | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleNeighborhoodIterables.java#L132-L144 |
nilsreiter/uima-util | src/main/java/de/unistuttgart/ims/uimautil/AnnotationUtil.java | AnnotationUtil.trimBegin | public static <T extends Annotation> T trimBegin(T annotation, char... ws) {
char[] s = annotation.getCoveredText().toCharArray();
if (s.length == 0)
return annotation;
int b = 0;
while (ArrayUtils.contains(ws, s[b])) {
b++;
}
annotation.setBegin(annotation.getBegin() + b);
return annotation;
} | java | public static <T extends Annotation> T trimBegin(T annotation, char... ws) {
char[] s = annotation.getCoveredText().toCharArray();
if (s.length == 0)
return annotation;
int b = 0;
while (ArrayUtils.contains(ws, s[b])) {
b++;
}
annotation.setBegin(annotation.getBegin() + b);
return annotation;
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"trimBegin",
"(",
"T",
"annotation",
",",
"char",
"...",
"ws",
")",
"{",
"char",
"[",
"]",
"s",
"=",
"annotation",
".",
"getCoveredText",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"i... | Moves the begin-index as long as a character contain in the array is at
the beginning.
@param annotation
the annotation to be trimmed
@param ws
an array of chars to be trimmed
@param <T>
the annotation type
@return the trimmed annotation
@since 0.4.2 | [
"Moves",
"the",
"begin",
"-",
"index",
"as",
"long",
"as",
"a",
"character",
"contain",
"in",
"the",
"array",
"is",
"at",
"the",
"beginning",
"."
] | train | https://github.com/nilsreiter/uima-util/blob/6f3bc3b8785702fe4ab9b670b87eaa215006f593/src/main/java/de/unistuttgart/ims/uimautil/AnnotationUtil.java#L147-L159 |
wildfly/wildfly-maven-plugin | core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java | DeploymentOperations.addDeploymentOperationStep | static void addDeploymentOperationStep(final CompositeOperationBuilder builder, final Deployment deployment) {
final String name = deployment.getName();
final ModelNode address = createAddress(DEPLOYMENT, name);
final String runtimeName = deployment.getRuntimeName();
final ModelNode addOperation = createAddOperation(address);
if (runtimeName != null) {
addOperation.get(RUNTIME_NAME).set(runtimeName);
}
addOperation.get(ENABLED).set(deployment.isEnabled());
addContent(builder, addOperation, deployment);
builder.addStep(addOperation);
final Set<String> serverGroups = deployment.getServerGroups();
// If the server groups are empty this is a standalone deployment
if (!serverGroups.isEmpty()) {
for (String serverGroup : serverGroups) {
final ModelNode sgAddress = createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, name);
final ModelNode op = createAddOperation(sgAddress);
op.get(ENABLED).set(deployment.isEnabled());
if (runtimeName != null) {
op.get(RUNTIME_NAME).set(runtimeName);
}
builder.addStep(op);
}
}
} | java | static void addDeploymentOperationStep(final CompositeOperationBuilder builder, final Deployment deployment) {
final String name = deployment.getName();
final ModelNode address = createAddress(DEPLOYMENT, name);
final String runtimeName = deployment.getRuntimeName();
final ModelNode addOperation = createAddOperation(address);
if (runtimeName != null) {
addOperation.get(RUNTIME_NAME).set(runtimeName);
}
addOperation.get(ENABLED).set(deployment.isEnabled());
addContent(builder, addOperation, deployment);
builder.addStep(addOperation);
final Set<String> serverGroups = deployment.getServerGroups();
// If the server groups are empty this is a standalone deployment
if (!serverGroups.isEmpty()) {
for (String serverGroup : serverGroups) {
final ModelNode sgAddress = createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, name);
final ModelNode op = createAddOperation(sgAddress);
op.get(ENABLED).set(deployment.isEnabled());
if (runtimeName != null) {
op.get(RUNTIME_NAME).set(runtimeName);
}
builder.addStep(op);
}
}
} | [
"static",
"void",
"addDeploymentOperationStep",
"(",
"final",
"CompositeOperationBuilder",
"builder",
",",
"final",
"Deployment",
"deployment",
")",
"{",
"final",
"String",
"name",
"=",
"deployment",
".",
"getName",
"(",
")",
";",
"final",
"ModelNode",
"address",
... | Creates an add operation on the deployment resource to the composite operation.
<p>
If the {@link Deployment#isEnabled()} is {@code false} a step to
{@linkplain #addDeployOperationStep(CompositeOperationBuilder, DeploymentDescription) deploy} the content may be
required.
</p>
@param builder the builder to add the step to
@param deployment the deployment to deploy | [
"Creates",
"an",
"add",
"operation",
"on",
"the",
"deployment",
"resource",
"to",
"the",
"composite",
"operation",
".",
"<p",
">",
"If",
"the",
"{",
"@link",
"Deployment#isEnabled",
"()",
"}",
"is",
"{",
"@code",
"false",
"}",
"a",
"step",
"to",
"{",
"@l... | train | https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java#L302-L328 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-xml/src/main/java/org/htmlcleaner/XWikiDOMSerializer.java | XWikiDOMSerializer.createDOM | public Document createDOM(DocumentBuilder documentBuilder, TagNode rootNode) throws ParserConfigurationException
{
Document document = createDocument(documentBuilder, rootNode);
createSubnodes(document, document.getDocumentElement(), rootNode.getAllChildren());
return document;
} | java | public Document createDOM(DocumentBuilder documentBuilder, TagNode rootNode) throws ParserConfigurationException
{
Document document = createDocument(documentBuilder, rootNode);
createSubnodes(document, document.getDocumentElement(), rootNode.getAllChildren());
return document;
} | [
"public",
"Document",
"createDOM",
"(",
"DocumentBuilder",
"documentBuilder",
",",
"TagNode",
"rootNode",
")",
"throws",
"ParserConfigurationException",
"{",
"Document",
"document",
"=",
"createDocument",
"(",
"documentBuilder",
",",
"rootNode",
")",
";",
"createSubnode... | Create the DOM given a rootNode and a document builder.
This method is a replica of {@link DomSerializer#createDOM(TagNode)} excepts that it requires to give a
DocumentBuilder.
@param documentBuilder the {@link DocumentBuilder} instance to use, DocumentBuilder is not guaranteed to
be thread safe so at most the safe instance should be used only in the same thread
@param rootNode the HTML Cleaner root node to serialize
@return the W3C Document object
@throws ParserConfigurationException if there's an error during serialization | [
"Create",
"the",
"DOM",
"given",
"a",
"rootNode",
"and",
"a",
"document",
"builder",
".",
"This",
"method",
"is",
"a",
"replica",
"of",
"{"
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-xml/src/main/java/org/htmlcleaner/XWikiDOMSerializer.java#L167-L174 |
kamcpp/avicenna | src/avicenna/src/main/java/org/labcrypto/avicenna/Avicenna.java | Avicenna.get | public static <T> T get(Class<T> clazz, Collection<String> qualifiers) {
SortedSet<String> qs = new TreeSet<String>();
if (qualifiers != null) {
qs.addAll(qualifiers);
}
return dependencyContainer.get(DependencyIdentifier.getDependencyIdentifierForClass(clazz, qs));
} | java | public static <T> T get(Class<T> clazz, Collection<String> qualifiers) {
SortedSet<String> qs = new TreeSet<String>();
if (qualifiers != null) {
qs.addAll(qualifiers);
}
return dependencyContainer.get(DependencyIdentifier.getDependencyIdentifierForClass(clazz, qs));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"get",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Collection",
"<",
"String",
">",
"qualifiers",
")",
"{",
"SortedSet",
"<",
"String",
">",
"qs",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
")",
";",
"... | Retrieves a stored dependnecy using class object and qualifiers.
@param clazz Class type which its related dependency reference should be retrieved.
@param qualifiers List of qualifiers to distinguish between similar types. | [
"Retrieves",
"a",
"stored",
"dependnecy",
"using",
"class",
"object",
"and",
"qualifiers",
"."
] | train | https://github.com/kamcpp/avicenna/blob/0fc4eff447761140cd3799287427d99c63ea6e6e/src/avicenna/src/main/java/org/labcrypto/avicenna/Avicenna.java#L181-L187 |
fabric8io/fabric8-forge | addons/utils/src/main/java/io/fabric8/forge/addon/utils/CommandHelpers.java | CommandHelpers.setInitialComponentValue | public static <T> void setInitialComponentValue(UIInput<T> inputComponent, T value) {
if (value != null) {
inputComponent.setValue(value);
}
} | java | public static <T> void setInitialComponentValue(UIInput<T> inputComponent, T value) {
if (value != null) {
inputComponent.setValue(value);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"setInitialComponentValue",
"(",
"UIInput",
"<",
"T",
">",
"inputComponent",
",",
"T",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"inputComponent",
".",
"setValue",
"(",
"value",
")",
";",
... | If the initial value is not blank lets set the value on the underlying component | [
"If",
"the",
"initial",
"value",
"is",
"not",
"blank",
"lets",
"set",
"the",
"value",
"on",
"the",
"underlying",
"component"
] | train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/utils/src/main/java/io/fabric8/forge/addon/utils/CommandHelpers.java#L74-L78 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/ResourceLoader.java | ResourceLoader.await | public synchronized void await()
{
if (!started.get())
{
throw new LionEngineException(ERROR_NOT_STARTED);
}
try
{
thread.join();
}
catch (final InterruptedException exception)
{
Thread.currentThread().interrupt();
throw new LionEngineException(exception, ERROR_SKIPPED);
}
finally
{
done.set(true);
}
} | java | public synchronized void await()
{
if (!started.get())
{
throw new LionEngineException(ERROR_NOT_STARTED);
}
try
{
thread.join();
}
catch (final InterruptedException exception)
{
Thread.currentThread().interrupt();
throw new LionEngineException(exception, ERROR_SKIPPED);
}
finally
{
done.set(true);
}
} | [
"public",
"synchronized",
"void",
"await",
"(",
")",
"{",
"if",
"(",
"!",
"started",
".",
"get",
"(",
")",
")",
"{",
"throw",
"new",
"LionEngineException",
"(",
"ERROR_NOT_STARTED",
")",
";",
"}",
"try",
"{",
"thread",
".",
"join",
"(",
")",
";",
"}"... | Wait for load to finish. Can be called only if {@link #start()} were performed somewhere before.
@throws LionEngineException If loading skipped or loader has not been started. | [
"Wait",
"for",
"load",
"to",
"finish",
".",
"Can",
"be",
"called",
"only",
"if",
"{",
"@link",
"#start",
"()",
"}",
"were",
"performed",
"somewhere",
"before",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/ResourceLoader.java#L107-L126 |
jenkinsci/java-client-api | jenkins-client/src/main/java/com/offbytwo/jenkins/client/util/UrlUtils.java | UrlUtils.toJsonApiUri | public static URI toJsonApiUri(final URI uri, final String context, final String path) {
String p = path;
if (!p.matches("(?i)https?://.*")) p = join(context, p);
if (!p.contains("?")) {
p = join(p, "api/json");
} else {
final String[] components = p.split("\\?", 2);
p = join(components[0], "api/json") + "?" + components[1];
}
return uri.resolve("/").resolve(p.replace(" ", "%20"));
} | java | public static URI toJsonApiUri(final URI uri, final String context, final String path) {
String p = path;
if (!p.matches("(?i)https?://.*")) p = join(context, p);
if (!p.contains("?")) {
p = join(p, "api/json");
} else {
final String[] components = p.split("\\?", 2);
p = join(components[0], "api/json") + "?" + components[1];
}
return uri.resolve("/").resolve(p.replace(" ", "%20"));
} | [
"public",
"static",
"URI",
"toJsonApiUri",
"(",
"final",
"URI",
"uri",
",",
"final",
"String",
"context",
",",
"final",
"String",
"path",
")",
"{",
"String",
"p",
"=",
"path",
";",
"if",
"(",
"!",
"p",
".",
"matches",
"(",
"\"(?i)https?://.*\"",
")",
"... | Create a JSON URI from the supplied parameters.
@param uri the server URI
@param context the server context if any
@param path the specific API path
@return new full URI instance | [
"Create",
"a",
"JSON",
"URI",
"from",
"the",
"supplied",
"parameters",
"."
] | train | https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/client/util/UrlUtils.java#L127-L138 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java | MatrixFeatures_ZDRM.isZeros | public static boolean isZeros(ZMatrixD1 m , double tol )
{
int length = m.getNumElements()*2;
for( int i = 0; i < length; i++ ) {
if( Math.abs(m.data[i]) > tol )
return false;
}
return true;
} | java | public static boolean isZeros(ZMatrixD1 m , double tol )
{
int length = m.getNumElements()*2;
for( int i = 0; i < length; i++ ) {
if( Math.abs(m.data[i]) > tol )
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isZeros",
"(",
"ZMatrixD1",
"m",
",",
"double",
"tol",
")",
"{",
"int",
"length",
"=",
"m",
".",
"getNumElements",
"(",
")",
"*",
"2",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",... | Checks to see all the elements in the matrix are zeros
@param m A matrix. Not modified.
@return True if all elements are zeros or false if not | [
"Checks",
"to",
"see",
"all",
"the",
"elements",
"in",
"the",
"matrix",
"are",
"zeros"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java#L423-L432 |
Mthwate/DatLib | src/main/java/com/mthwate/datlib/HashUtils.java | HashUtils.md2Hex | public static String md2Hex(String data, Charset charset) throws NoSuchAlgorithmException {
return md2Hex(data.getBytes(charset));
} | java | public static String md2Hex(String data, Charset charset) throws NoSuchAlgorithmException {
return md2Hex(data.getBytes(charset));
} | [
"public",
"static",
"String",
"md2Hex",
"(",
"String",
"data",
",",
"Charset",
"charset",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"return",
"md2Hex",
"(",
"data",
".",
"getBytes",
"(",
"charset",
")",
")",
";",
"}"
] | Hashes a string using the MD2 algorithm. Returns a hexadecimal result.
@since 1.1
@param data the string to hash
@param charset the charset of the string
@return the hexadecimal MD2 hash of the string
@throws NoSuchAlgorithmException the algorithm is not supported by existing providers | [
"Hashes",
"a",
"string",
"using",
"the",
"MD2",
"algorithm",
".",
"Returns",
"a",
"hexadecimal",
"result",
"."
] | train | https://github.com/Mthwate/DatLib/blob/f0b3a9f9cf6fdc773d4f86234ebd95986c9b6077/src/main/java/com/mthwate/datlib/HashUtils.java#L138-L140 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/reporter/JdtUtils.java | JdtUtils.sortAnonymous | private static void sortAnonymous(List<IType> anonymous, IType anonType) {
SourceOffsetComparator sourceComparator = new SourceOffsetComparator();
final AnonymClassComparator classComparator = new AnonymClassComparator(anonType, sourceComparator);
Collections.sort(anonymous, classComparator);
// if (Reporter.DEBUG) {
// debugCompilePrio(classComparator);
// }
} | java | private static void sortAnonymous(List<IType> anonymous, IType anonType) {
SourceOffsetComparator sourceComparator = new SourceOffsetComparator();
final AnonymClassComparator classComparator = new AnonymClassComparator(anonType, sourceComparator);
Collections.sort(anonymous, classComparator);
// if (Reporter.DEBUG) {
// debugCompilePrio(classComparator);
// }
} | [
"private",
"static",
"void",
"sortAnonymous",
"(",
"List",
"<",
"IType",
">",
"anonymous",
",",
"IType",
"anonType",
")",
"{",
"SourceOffsetComparator",
"sourceComparator",
"=",
"new",
"SourceOffsetComparator",
"(",
")",
";",
"final",
"AnonymClassComparator",
"class... | Sort given anonymous classes in order like java compiler would generate
output classes, in context of given anonymous type
@param anonymous | [
"Sort",
"given",
"anonymous",
"classes",
"in",
"order",
"like",
"java",
"compiler",
"would",
"generate",
"output",
"classes",
"in",
"context",
"of",
"given",
"anonymous",
"type"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/reporter/JdtUtils.java#L333-L342 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapFieldLite.java | MapFieldLite.calculateHashCodeForMap | static <K, V> int calculateHashCodeForMap(Map<K, V> a) {
int result = 0;
for (Map.Entry<K, V> entry : a.entrySet()) {
result += calculateHashCodeForObject(entry.getKey()) ^ calculateHashCodeForObject(entry.getValue());
}
return result;
} | java | static <K, V> int calculateHashCodeForMap(Map<K, V> a) {
int result = 0;
for (Map.Entry<K, V> entry : a.entrySet()) {
result += calculateHashCodeForObject(entry.getKey()) ^ calculateHashCodeForObject(entry.getValue());
}
return result;
} | [
"static",
"<",
"K",
",",
"V",
">",
"int",
"calculateHashCodeForMap",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"a",
")",
"{",
"int",
"result",
"=",
"0",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
"entry",
":",
"a",
".",
"entryS... | Calculates the hash code for a {@link Map}. We don't use the default hash code method of {@link Map} because for
byte arrays and protobuf enums it use {@link Object#hashCode()}.
@param <K> the key type
@param <V> the value type
@param a the a
@return the int | [
"Calculates",
"the",
"hash",
"code",
"for",
"a",
"{",
"@link",
"Map",
"}",
".",
"We",
"don",
"t",
"use",
"the",
"default",
"hash",
"code",
"method",
"of",
"{",
"@link",
"Map",
"}",
"because",
"for",
"byte",
"arrays",
"and",
"protobuf",
"enums",
"it",
... | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapFieldLite.java#L224-L230 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentLinkedQueue.java | ConcurrentLinkedQueue.updateHead | final void updateHead(Node<E> h, Node<E> p) {
// assert h != null && p != null && (h == p || h.item == null);
if (h != p && casHead(h, p))
lazySetNext(h, sentinel());
} | java | final void updateHead(Node<E> h, Node<E> p) {
// assert h != null && p != null && (h == p || h.item == null);
if (h != p && casHead(h, p))
lazySetNext(h, sentinel());
} | [
"final",
"void",
"updateHead",
"(",
"Node",
"<",
"E",
">",
"h",
",",
"Node",
"<",
"E",
">",
"p",
")",
"{",
"// assert h != null && p != null && (h == p || h.item == null);",
"if",
"(",
"h",
"!=",
"p",
"&&",
"casHead",
"(",
"h",
",",
"p",
")",
")",
"lazyS... | Tries to CAS head to p. If successful, repoint old head to itself
as sentinel for succ(), below. | [
"Tries",
"to",
"CAS",
"head",
"to",
"p",
".",
"If",
"successful",
"repoint",
"old",
"head",
"to",
"itself",
"as",
"sentinel",
"for",
"succ",
"()",
"below",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentLinkedQueue.java#L287-L291 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java | BitmapUtils.storeOnApplicationPrivateDir | public static boolean storeOnApplicationPrivateDir(Context context, Bitmap bitmap, String filename, Bitmap.CompressFormat format, int quality) {
OutputStream out = null;
try {
out = new BufferedOutputStream(context.openFileOutput(filename, Context.MODE_PRIVATE));
return bitmap.compress(format, quality, out);
} catch (FileNotFoundException e) {
Log.e(TAG, "no such file for saving bitmap: ", e);
return false;
} finally {
CloseableUtils.close(out);
}
} | java | public static boolean storeOnApplicationPrivateDir(Context context, Bitmap bitmap, String filename, Bitmap.CompressFormat format, int quality) {
OutputStream out = null;
try {
out = new BufferedOutputStream(context.openFileOutput(filename, Context.MODE_PRIVATE));
return bitmap.compress(format, quality, out);
} catch (FileNotFoundException e) {
Log.e(TAG, "no such file for saving bitmap: ", e);
return false;
} finally {
CloseableUtils.close(out);
}
} | [
"public",
"static",
"boolean",
"storeOnApplicationPrivateDir",
"(",
"Context",
"context",
",",
"Bitmap",
"bitmap",
",",
"String",
"filename",
",",
"Bitmap",
".",
"CompressFormat",
"format",
",",
"int",
"quality",
")",
"{",
"OutputStream",
"out",
"=",
"null",
";"... | Store the bitmap on the application private directory path.
@param context the context.
@param bitmap to store.
@param filename file name.
@param format bitmap format.
@param quality the quality of the compressed bitmap.
@return the compressed bitmap file. | [
"Store",
"the",
"bitmap",
"on",
"the",
"application",
"private",
"directory",
"path",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L269-L280 |
samskivert/samskivert | src/main/java/com/samskivert/util/CollectionUtil.java | CollectionUtil.maxList | public static <T> List<T> maxList (Iterable<T> iterable, Comparator<? super T> comp)
{
Iterator<T> itr = iterable.iterator();
T max = itr.next();
List<T> maxes = new ArrayList<T>();
maxes.add(max);
if (itr.hasNext()) {
do {
T elem = itr.next();
int cmp = comp.compare(max, elem);
if (cmp <= 0) {
if (cmp < 0) {
max = elem;
maxes.clear();
}
maxes.add(elem);
}
} while (itr.hasNext());
} else if (0 != comp.compare(max, max)) {
// The main point of this test is to compare the sole element to something,
// in case it turns out to be incompatible with the Comparator for some reason.
// In that case, we don't even get to this IAE, we've probably already bombed out
// with an NPE or CCE. For example, the Comparable version could be called with
// a sole element of null. (Collections.max() gets this wrong.)
throw new IllegalArgumentException();
}
return maxes;
} | java | public static <T> List<T> maxList (Iterable<T> iterable, Comparator<? super T> comp)
{
Iterator<T> itr = iterable.iterator();
T max = itr.next();
List<T> maxes = new ArrayList<T>();
maxes.add(max);
if (itr.hasNext()) {
do {
T elem = itr.next();
int cmp = comp.compare(max, elem);
if (cmp <= 0) {
if (cmp < 0) {
max = elem;
maxes.clear();
}
maxes.add(elem);
}
} while (itr.hasNext());
} else if (0 != comp.compare(max, max)) {
// The main point of this test is to compare the sole element to something,
// in case it turns out to be incompatible with the Comparator for some reason.
// In that case, we don't even get to this IAE, we've probably already bombed out
// with an NPE or CCE. For example, the Comparable version could be called with
// a sole element of null. (Collections.max() gets this wrong.)
throw new IllegalArgumentException();
}
return maxes;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"maxList",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comp",
")",
"{",
"Iterator",
"<",
"T",
">",
"itr",
"=",
"iterable",
".",
"iterator",
... | Return a List containing all the elements of the specified Iterable that compare as being
equal to the maximum element.
@throws NoSuchElementException if the Iterable is empty. | [
"Return",
"a",
"List",
"containing",
"all",
"the",
"elements",
"of",
"the",
"specified",
"Iterable",
"that",
"compare",
"as",
"being",
"equal",
"to",
"the",
"maximum",
"element",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/CollectionUtil.java#L138-L166 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/security/auth/authorizer/DRPCAuthorizerBase.java | DRPCAuthorizerBase.permit | @Override
public boolean permit(ReqContext context, String operation, Map params) {
if ("execute".equals(operation)) {
return permitClientRequest(context, operation, params);
} else if ("failRequest".equals(operation) || "fetchRequest".equals(operation) || "result".equals(operation)) {
return permitInvocationRequest(context, operation, params);
}
// Deny unsupported operations.
LOG.warn("Denying unsupported operation \"" + operation + "\" from " + context.remoteAddress());
return false;
} | java | @Override
public boolean permit(ReqContext context, String operation, Map params) {
if ("execute".equals(operation)) {
return permitClientRequest(context, operation, params);
} else if ("failRequest".equals(operation) || "fetchRequest".equals(operation) || "result".equals(operation)) {
return permitInvocationRequest(context, operation, params);
}
// Deny unsupported operations.
LOG.warn("Denying unsupported operation \"" + operation + "\" from " + context.remoteAddress());
return false;
} | [
"@",
"Override",
"public",
"boolean",
"permit",
"(",
"ReqContext",
"context",
",",
"String",
"operation",
",",
"Map",
"params",
")",
"{",
"if",
"(",
"\"execute\"",
".",
"equals",
"(",
"operation",
")",
")",
"{",
"return",
"permitClientRequest",
"(",
"context... | Authorizes request from to the DRPC server.
@param context the client request context
@param operation the operation requested by the DRPC server
@param params a Map with any key-value entries of use to the authorization implementation | [
"Authorizes",
"request",
"from",
"to",
"the",
"DRPC",
"server",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/security/auth/authorizer/DRPCAuthorizerBase.java#L50-L60 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAvailabilityEstimatePersistenceImpl.java | CommerceAvailabilityEstimatePersistenceImpl.findAll | @Override
public List<CommerceAvailabilityEstimate> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceAvailabilityEstimate> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAvailabilityEstimate",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce availability estimates.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAvailabilityEstimateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce availability estimates
@param end the upper bound of the range of commerce availability estimates (not inclusive)
@return the range of commerce availability estimates | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"availability",
"estimates",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAvailabilityEstimatePersistenceImpl.java#L2694-L2697 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/StringUtil.java | StringUtil.indexOf | public static int indexOf(String input, char ch, int offset) {
for (int i = offset; i < input.length(); i++) {
if (input.charAt(i) == ch) {
return i;
}
}
return -1;
} | java | public static int indexOf(String input, char ch, int offset) {
for (int i = offset; i < input.length(); i++) {
if (input.charAt(i) == ch) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"String",
"input",
",",
"char",
"ch",
",",
"int",
"offset",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"offset",
";",
"i",
"<",
"input",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"input... | Like a String.indexOf but without MIN_SUPPLEMENTARY_CODE_POINT handling
@param input to check the indexOf on
@param ch character to find the index of
@param offset offset to start the reading from
@return index of the character, or -1 if not found | [
"Like",
"a",
"String",
".",
"indexOf",
"but",
"without",
"MIN_SUPPLEMENTARY_CODE_POINT",
"handling"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/StringUtil.java#L210-L217 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java | WebhookMessage.files | public static WebhookMessage files(String name1, Object data1, Object... attachments)
{
Checks.notBlank(name1, "Name");
Checks.notNull(data1, "Data");
Checks.notNull(attachments, "Attachments");
Checks.check(attachments.length % 2 == 0, "Must provide even number of varargs arguments");
int fileAmount = 1 + attachments.length / 2;
Checks.check(fileAmount <= WebhookMessageBuilder.MAX_FILES, "Cannot add more than %d files to a message", WebhookMessageBuilder.MAX_FILES);
MessageAttachment[] files = new MessageAttachment[fileAmount];
files[0] = convertAttachment(name1, data1);
for (int i = 0, j = 1; i < attachments.length; j++, i += 2)
{
Object name = attachments[i];
Object data = attachments[i+1];
if (!(name instanceof String))
throw new IllegalArgumentException("Provided arguments must be pairs for (String, Data). Expected String and found " + (name == null ? null : name.getClass().getName()));
files[j] = convertAttachment((String) name, data);
}
return new WebhookMessage(null, null, null, null, false, files);
} | java | public static WebhookMessage files(String name1, Object data1, Object... attachments)
{
Checks.notBlank(name1, "Name");
Checks.notNull(data1, "Data");
Checks.notNull(attachments, "Attachments");
Checks.check(attachments.length % 2 == 0, "Must provide even number of varargs arguments");
int fileAmount = 1 + attachments.length / 2;
Checks.check(fileAmount <= WebhookMessageBuilder.MAX_FILES, "Cannot add more than %d files to a message", WebhookMessageBuilder.MAX_FILES);
MessageAttachment[] files = new MessageAttachment[fileAmount];
files[0] = convertAttachment(name1, data1);
for (int i = 0, j = 1; i < attachments.length; j++, i += 2)
{
Object name = attachments[i];
Object data = attachments[i+1];
if (!(name instanceof String))
throw new IllegalArgumentException("Provided arguments must be pairs for (String, Data). Expected String and found " + (name == null ? null : name.getClass().getName()));
files[j] = convertAttachment((String) name, data);
}
return new WebhookMessage(null, null, null, null, false, files);
} | [
"public",
"static",
"WebhookMessage",
"files",
"(",
"String",
"name1",
",",
"Object",
"data1",
",",
"Object",
"...",
"attachments",
")",
"{",
"Checks",
".",
"notBlank",
"(",
"name1",
",",
"\"Name\"",
")",
";",
"Checks",
".",
"notNull",
"(",
"data1",
",",
... | forcing first pair as we expect at least one entry (Effective Java 3rd. Edition - Item 53) | [
"forcing",
"first",
"pair",
"as",
"we",
"expect",
"at",
"least",
"one",
"entry",
"(",
"Effective",
"Java",
"3rd",
".",
"Edition",
"-",
"Item",
"53",
")"
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java#L186-L205 |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/EffectSize.java | EffectSize.getCohenD | public static <V> double getCohenD(final int baselineN, final double baselineMean, final double baselineStd, final int testN, final double testMean, final double testStd) {
double pooledStd = Math.sqrt(((testN - 1) * Math.pow(testStd, 2) + (baselineN - 1) * Math.pow(baselineStd, 2)) / (baselineN + testN));
double d = Math.abs(testMean - baselineMean) / pooledStd;
return d;
} | java | public static <V> double getCohenD(final int baselineN, final double baselineMean, final double baselineStd, final int testN, final double testMean, final double testStd) {
double pooledStd = Math.sqrt(((testN - 1) * Math.pow(testStd, 2) + (baselineN - 1) * Math.pow(baselineStd, 2)) / (baselineN + testN));
double d = Math.abs(testMean - baselineMean) / pooledStd;
return d;
} | [
"public",
"static",
"<",
"V",
">",
"double",
"getCohenD",
"(",
"final",
"int",
"baselineN",
",",
"final",
"double",
"baselineMean",
",",
"final",
"double",
"baselineStd",
",",
"final",
"int",
"testN",
",",
"final",
"double",
"testMean",
",",
"final",
"double... | Original Cohen's d formulation, as in Cohen (1988), Statistical power
analysis for the behavioral sciences.
@param <V> type of the keys of each map.
@param baselineN number of samples of baseline method.
@param baselineMean mean of baseline method.
@param baselineStd standard deviation of baseline method.
@param testN number of samples of test method.
@param testMean mean of test method.
@param testStd standard deviation of test method.
@return Cohen's d without least squares estimation. | [
"Original",
"Cohen",
"s",
"d",
"formulation",
"as",
"in",
"Cohen",
"(",
"1988",
")",
"Statistical",
"power",
"analysis",
"for",
"the",
"behavioral",
"sciences",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/EffectSize.java#L122-L127 |
netty/netty-tcnative | openssl-dynamic/src/main/java/io/netty/internal/tcnative/Library.java | Library.initialize | public static boolean initialize(String libraryName, String engine) throws Exception {
if (_instance == null) {
_instance = libraryName == null ? new Library() : new Library(libraryName);
if (aprMajorVersion() < 1) {
throw new UnsatisfiedLinkError("Unsupported APR Version (" +
aprVersionString() + ")");
}
if (!aprHasThreads()) {
throw new UnsatisfiedLinkError("Missing APR_HAS_THREADS");
}
}
return initialize0() && SSL.initialize(engine) == 0;
} | java | public static boolean initialize(String libraryName, String engine) throws Exception {
if (_instance == null) {
_instance = libraryName == null ? new Library() : new Library(libraryName);
if (aprMajorVersion() < 1) {
throw new UnsatisfiedLinkError("Unsupported APR Version (" +
aprVersionString() + ")");
}
if (!aprHasThreads()) {
throw new UnsatisfiedLinkError("Missing APR_HAS_THREADS");
}
}
return initialize0() && SSL.initialize(engine) == 0;
} | [
"public",
"static",
"boolean",
"initialize",
"(",
"String",
"libraryName",
",",
"String",
"engine",
")",
"throws",
"Exception",
"{",
"if",
"(",
"_instance",
"==",
"null",
")",
"{",
"_instance",
"=",
"libraryName",
"==",
"null",
"?",
"new",
"Library",
"(",
... | Setup native library. This is the first method that must be called!
@param libraryName the name of the library to load
@param engine Support for external a Crypto Device ("engine"), usually
@return {@code true} if initialization was successful
@throws Exception if an error happens during initialization | [
"Setup",
"native",
"library",
".",
"This",
"is",
"the",
"first",
"method",
"that",
"must",
"be",
"called!"
] | train | https://github.com/netty/netty-tcnative/blob/4a5d7330c6c36cff2bebbb465571cab1cf7a4063/openssl-dynamic/src/main/java/io/netty/internal/tcnative/Library.java#L145-L159 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java | BitsUtil.nextClearBit | public static int nextClearBit(long v, int start) {
if(start >= Long.SIZE) {
return -1;
}
start = start < 0 ? 0 : start;
long cur = ~v & (LONG_ALL_BITS << start);
return cur == 0 ? -1 : Long.numberOfTrailingZeros(cur);
} | java | public static int nextClearBit(long v, int start) {
if(start >= Long.SIZE) {
return -1;
}
start = start < 0 ? 0 : start;
long cur = ~v & (LONG_ALL_BITS << start);
return cur == 0 ? -1 : Long.numberOfTrailingZeros(cur);
} | [
"public",
"static",
"int",
"nextClearBit",
"(",
"long",
"v",
",",
"int",
"start",
")",
"{",
"if",
"(",
"start",
">=",
"Long",
".",
"SIZE",
")",
"{",
"return",
"-",
"1",
";",
"}",
"start",
"=",
"start",
"<",
"0",
"?",
"0",
":",
"start",
";",
"lo... | Find the next clear bit.
@param v Value to process
@param start Start position (inclusive)
@return Position of next clear bit, or -1. | [
"Find",
"the",
"next",
"clear",
"bit",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java#L1350-L1357 |
matthewhorridge/mdock | src/main/java/org/coode/mdock/SplitterNode.java | SplitterNode.insertNodeAfter | public void insertNodeAfter(Node insert, Node after, double split) {
addChild(insert, children.indexOf(after) + 1, split);
notifyStateChange();
} | java | public void insertNodeAfter(Node insert, Node after, double split) {
addChild(insert, children.indexOf(after) + 1, split);
notifyStateChange();
} | [
"public",
"void",
"insertNodeAfter",
"(",
"Node",
"insert",
",",
"Node",
"after",
",",
"double",
"split",
")",
"{",
"addChild",
"(",
"insert",
",",
"children",
".",
"indexOf",
"(",
"after",
")",
"+",
"1",
",",
"split",
")",
";",
"notifyStateChange",
"(",... | Inserts a node after (right of or bottom of) a given node by splitting the inserted
node with the given node.
@param insert The node to be inserted
@param after The node that the inserted node will be split with.
@param split The weight | [
"Inserts",
"a",
"node",
"after",
"(",
"right",
"of",
"or",
"bottom",
"of",
")",
"a",
"given",
"node",
"by",
"splitting",
"the",
"inserted",
"node",
"with",
"the",
"given",
"node",
"."
] | train | https://github.com/matthewhorridge/mdock/blob/37839a56f30bdb73d56d82c4d1afe548d66b404b/src/main/java/org/coode/mdock/SplitterNode.java#L291-L294 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.rangeClosed | public static IntStreamEx rangeClosed(int startInclusive, int endInclusive, int step) {
if (step == 0)
throw new IllegalArgumentException("step = 0");
if (step == 1)
return seq(IntStream.rangeClosed(startInclusive, endInclusive));
if (step == -1) {
// Handled specially as number of elements can exceed
// Integer.MAX_VALUE
int sum = endInclusive + startInclusive;
return seq(IntStream.rangeClosed(endInclusive, startInclusive).map(x -> sum - x));
}
if (endInclusive > startInclusive ^ step > 0)
return empty();
int limit = (endInclusive - startInclusive) * Integer.signum(step);
limit = Integer.divideUnsigned(limit, Math.abs(step));
return seq(IntStream.rangeClosed(0, limit).map(x -> x * step + startInclusive));
} | java | public static IntStreamEx rangeClosed(int startInclusive, int endInclusive, int step) {
if (step == 0)
throw new IllegalArgumentException("step = 0");
if (step == 1)
return seq(IntStream.rangeClosed(startInclusive, endInclusive));
if (step == -1) {
// Handled specially as number of elements can exceed
// Integer.MAX_VALUE
int sum = endInclusive + startInclusive;
return seq(IntStream.rangeClosed(endInclusive, startInclusive).map(x -> sum - x));
}
if (endInclusive > startInclusive ^ step > 0)
return empty();
int limit = (endInclusive - startInclusive) * Integer.signum(step);
limit = Integer.divideUnsigned(limit, Math.abs(step));
return seq(IntStream.rangeClosed(0, limit).map(x -> x * step + startInclusive));
} | [
"public",
"static",
"IntStreamEx",
"rangeClosed",
"(",
"int",
"startInclusive",
",",
"int",
"endInclusive",
",",
"int",
"step",
")",
"{",
"if",
"(",
"step",
"==",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"step = 0\"",
")",
";",
"if",
"(",... | Returns a sequential ordered {@code IntStreamEx} from
{@code startInclusive} (inclusive) to {@code endInclusive} (inclusive) by
the specified incremental step. The negative step values are also
supported. In this case the {@code startInclusive} should be greater than
{@code endInclusive}.
<p>
Note that depending on the step value the {@code endInclusive} bound may
still not be reached. For example
{@code IntStreamEx.rangeClosed(0, 5, 2)} will yield the stream of three
numbers: 0, 2 and 4.
@param startInclusive the (inclusive) initial value
@param endInclusive the inclusive upper bound
@param step the non-zero value which designates the difference between
the consecutive values of the resulting stream.
@return a sequential {@code IntStreamEx} for the range of {@code int}
elements
@throws IllegalArgumentException if step is zero
@see IntStreamEx#rangeClosed(int, int)
@since 0.4.0 | [
"Returns",
"a",
"sequential",
"ordered",
"{",
"@code",
"IntStreamEx",
"}",
"from",
"{",
"@code",
"startInclusive",
"}",
"(",
"inclusive",
")",
"to",
"{",
"@code",
"endInclusive",
"}",
"(",
"inclusive",
")",
"by",
"the",
"specified",
"incremental",
"step",
".... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L2579-L2595 |
EdwardRaff/JSAT | JSAT/src/jsat/clustering/OPTICS.java | OPTICS.setXi | public void setXi(double xi)
{
if(xi <= 0 || xi >= 1 || Double.isNaN(xi))
throw new ArithmeticException("xi must be in the range (0, 1) not " + xi);
this.xi = xi;
this.one_min_xi = 1.0 - xi;
} | java | public void setXi(double xi)
{
if(xi <= 0 || xi >= 1 || Double.isNaN(xi))
throw new ArithmeticException("xi must be in the range (0, 1) not " + xi);
this.xi = xi;
this.one_min_xi = 1.0 - xi;
} | [
"public",
"void",
"setXi",
"(",
"double",
"xi",
")",
"{",
"if",
"(",
"xi",
"<=",
"0",
"||",
"xi",
">=",
"1",
"||",
"Double",
".",
"isNaN",
"(",
"xi",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"xi must be in the range (0, 1) not \"",
"+",
"x... | Sets the xi value used in {@link ExtractionMethod#XI_STEEP_ORIGINAL} to
produce cluster results.
@param xi the value in the range (0, 1)
@throws ArithmeticException if the value is not in the appropriate range | [
"Sets",
"the",
"xi",
"value",
"used",
"in",
"{",
"@link",
"ExtractionMethod#XI_STEEP_ORIGINAL",
"}",
"to",
"produce",
"cluster",
"results",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/clustering/OPTICS.java#L226-L232 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java | WebUtils.putAuthenticationResultBuilder | public static void putAuthenticationResultBuilder(final AuthenticationResultBuilder builder, final RequestContext ctx) {
ctx.getConversationScope().put(PARAMETER_AUTHENTICATION_RESULT_BUILDER, builder);
} | java | public static void putAuthenticationResultBuilder(final AuthenticationResultBuilder builder, final RequestContext ctx) {
ctx.getConversationScope().put(PARAMETER_AUTHENTICATION_RESULT_BUILDER, builder);
} | [
"public",
"static",
"void",
"putAuthenticationResultBuilder",
"(",
"final",
"AuthenticationResultBuilder",
"builder",
",",
"final",
"RequestContext",
"ctx",
")",
"{",
"ctx",
".",
"getConversationScope",
"(",
")",
".",
"put",
"(",
"PARAMETER_AUTHENTICATION_RESULT_BUILDER",... | Put authentication result builder.
@param builder the builder
@param ctx the ctx | [
"Put",
"authentication",
"result",
"builder",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L486-L488 |
google/j2objc | jre_emul/android/platform/external/mockwebserver/src/main/java/com/google/mockwebserver/MockResponse.java | MockResponse.setChunkedBody | public MockResponse setChunkedBody(byte[] body, int maxChunkSize) {
removeHeader("Content-Length");
headers.add(CHUNKED_BODY_HEADER);
try {
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
int pos = 0;
while (pos < body.length) {
int chunkSize = Math.min(body.length - pos, maxChunkSize);
bytesOut.write(Integer.toHexString(chunkSize).getBytes(US_ASCII));
bytesOut.write("\r\n".getBytes(US_ASCII));
bytesOut.write(body, pos, chunkSize);
bytesOut.write("\r\n".getBytes(US_ASCII));
pos += chunkSize;
}
bytesOut.write("0\r\n\r\n".getBytes(US_ASCII)); // last chunk + empty trailer + crlf
this.body = bytesOut.toByteArray();
return this;
} catch (IOException e) {
throw new AssertionError(); // In-memory I/O doesn't throw IOExceptions.
}
} | java | public MockResponse setChunkedBody(byte[] body, int maxChunkSize) {
removeHeader("Content-Length");
headers.add(CHUNKED_BODY_HEADER);
try {
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
int pos = 0;
while (pos < body.length) {
int chunkSize = Math.min(body.length - pos, maxChunkSize);
bytesOut.write(Integer.toHexString(chunkSize).getBytes(US_ASCII));
bytesOut.write("\r\n".getBytes(US_ASCII));
bytesOut.write(body, pos, chunkSize);
bytesOut.write("\r\n".getBytes(US_ASCII));
pos += chunkSize;
}
bytesOut.write("0\r\n\r\n".getBytes(US_ASCII)); // last chunk + empty trailer + crlf
this.body = bytesOut.toByteArray();
return this;
} catch (IOException e) {
throw new AssertionError(); // In-memory I/O doesn't throw IOExceptions.
}
} | [
"public",
"MockResponse",
"setChunkedBody",
"(",
"byte",
"[",
"]",
"body",
",",
"int",
"maxChunkSize",
")",
"{",
"removeHeader",
"(",
"\"Content-Length\"",
")",
";",
"headers",
".",
"add",
"(",
"CHUNKED_BODY_HEADER",
")",
";",
"try",
"{",
"ByteArrayOutputStream"... | Sets the response body to {@code body}, chunked every {@code
maxChunkSize} bytes. | [
"Sets",
"the",
"response",
"body",
"to",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/mockwebserver/src/main/java/com/google/mockwebserver/MockResponse.java#L186-L208 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conditions.java | Conditions.betweenExclusiveMin | public static Between betweenExclusiveMin( String property, int minimum, int maximum)
{
return new Between( moreThan( property, minimum), notMoreThan( property, maximum));
} | java | public static Between betweenExclusiveMin( String property, int minimum, int maximum)
{
return new Between( moreThan( property, minimum), notMoreThan( property, maximum));
} | [
"public",
"static",
"Between",
"betweenExclusiveMin",
"(",
"String",
"property",
",",
"int",
"minimum",
",",
"int",
"maximum",
")",
"{",
"return",
"new",
"Between",
"(",
"moreThan",
"(",
"property",
",",
"minimum",
")",
",",
"notMoreThan",
"(",
"property",
"... | Returns a {@link ICondition condition} that is satisfied by a {@link org.cornutum.tcases.PropertySet} that contains
between a specified minimum (exclusive) and maximum (inclusive) number of instances of a property. | [
"Returns",
"a",
"{"
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conditions.java#L154-L157 |
guardtime/ksi-java-sdk | ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIRequest.java | AbstractKSIRequest.calculateMac | protected DataHash calculateMac() throws KSIException {
try {
HashAlgorithm algorithm = HashAlgorithm.getByName("DEFAULT");
algorithm.checkExpiration();
return new DataHash(algorithm, Util.calculateHMAC(getContent(), this.loginKey, algorithm.getName()));
} catch (IOException e) {
throw new KSIProtocolException("Problem with HMAC", e);
} catch (InvalidKeyException e) {
throw new KSIProtocolException("Problem with HMAC key.", e);
} catch (NoSuchAlgorithmException e) {
// If the default algorithm changes to be outside of MD5 / SHA1 /
// SHA256 list.
throw new KSIProtocolException("Unsupported HMAC algorithm.", e);
} catch (HashException e) {
throw new KSIProtocolException(e.getMessage(), e);
}
} | java | protected DataHash calculateMac() throws KSIException {
try {
HashAlgorithm algorithm = HashAlgorithm.getByName("DEFAULT");
algorithm.checkExpiration();
return new DataHash(algorithm, Util.calculateHMAC(getContent(), this.loginKey, algorithm.getName()));
} catch (IOException e) {
throw new KSIProtocolException("Problem with HMAC", e);
} catch (InvalidKeyException e) {
throw new KSIProtocolException("Problem with HMAC key.", e);
} catch (NoSuchAlgorithmException e) {
// If the default algorithm changes to be outside of MD5 / SHA1 /
// SHA256 list.
throw new KSIProtocolException("Unsupported HMAC algorithm.", e);
} catch (HashException e) {
throw new KSIProtocolException(e.getMessage(), e);
}
} | [
"protected",
"DataHash",
"calculateMac",
"(",
")",
"throws",
"KSIException",
"{",
"try",
"{",
"HashAlgorithm",
"algorithm",
"=",
"HashAlgorithm",
".",
"getByName",
"(",
"\"DEFAULT\"",
")",
";",
"algorithm",
".",
"checkExpiration",
"(",
")",
";",
"return",
"new",... | Calculates the MAC based on header and payload TLVs.
@return Calculated data hash.
@throws KSIException
if HMAC generation fails. | [
"Calculates",
"the",
"MAC",
"based",
"on",
"header",
"and",
"payload",
"TLVs",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIRequest.java#L132-L148 |
tuenti/ButtonMenu | library/src/main/java/com/tuenti/buttonmenu/animator/ScrollAnimator.java | ScrollAnimator.onScrollPositionChanged | private void onScrollPositionChanged(int oldScrollPosition, int newScrollPosition) {
int newScrollDirection;
if (newScrollPosition < oldScrollPosition) {
newScrollDirection = SCROLL_TO_TOP;
} else {
newScrollDirection = SCROLL_TO_BOTTOM;
}
if (directionHasChanged(newScrollDirection)) {
translateYAnimatedView(newScrollDirection);
}
} | java | private void onScrollPositionChanged(int oldScrollPosition, int newScrollPosition) {
int newScrollDirection;
if (newScrollPosition < oldScrollPosition) {
newScrollDirection = SCROLL_TO_TOP;
} else {
newScrollDirection = SCROLL_TO_BOTTOM;
}
if (directionHasChanged(newScrollDirection)) {
translateYAnimatedView(newScrollDirection);
}
} | [
"private",
"void",
"onScrollPositionChanged",
"(",
"int",
"oldScrollPosition",
",",
"int",
"newScrollPosition",
")",
"{",
"int",
"newScrollDirection",
";",
"if",
"(",
"newScrollPosition",
"<",
"oldScrollPosition",
")",
"{",
"newScrollDirection",
"=",
"SCROLL_TO_TOP",
... | Perform the "translateY" animation using the new scroll position and the old scroll position to show or hide
the animated view.
@param oldScrollPosition
@param newScrollPosition | [
"Perform",
"the",
"translateY",
"animation",
"using",
"the",
"new",
"scroll",
"position",
"and",
"the",
"old",
"scroll",
"position",
"to",
"show",
"or",
"hide",
"the",
"animated",
"view",
"."
] | train | https://github.com/tuenti/ButtonMenu/blob/95791383f6f976933496542b54e8c6dbdd73e669/library/src/main/java/com/tuenti/buttonmenu/animator/ScrollAnimator.java#L192-L204 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java | SliceOps.calcSliceFence | private static long calcSliceFence(long skip, long limit) {
long sliceFence = limit >= 0 ? skip + limit : Long.MAX_VALUE;
// Check for overflow
return (sliceFence >= 0) ? sliceFence : Long.MAX_VALUE;
} | java | private static long calcSliceFence(long skip, long limit) {
long sliceFence = limit >= 0 ? skip + limit : Long.MAX_VALUE;
// Check for overflow
return (sliceFence >= 0) ? sliceFence : Long.MAX_VALUE;
} | [
"private",
"static",
"long",
"calcSliceFence",
"(",
"long",
"skip",
",",
"long",
"limit",
")",
"{",
"long",
"sliceFence",
"=",
"limit",
">=",
"0",
"?",
"skip",
"+",
"limit",
":",
"Long",
".",
"MAX_VALUE",
";",
"// Check for overflow",
"return",
"(",
"slice... | Calculates the slice fence, which is one past the index of the slice
range
@param skip the number of elements to skip, assumed to be >= 0
@param limit the number of elements to limit, assumed to be >= 0, with
a value of {@code Long.MAX_VALUE} if there is no limit
@return the slice fence. | [
"Calculates",
"the",
"slice",
"fence",
"which",
"is",
"one",
"past",
"the",
"index",
"of",
"the",
"slice",
"range"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java#L64-L68 |
cdapio/tigon | tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java | DatumWriterGenerator.getFieldAccessorName | private String getFieldAccessorName(TypeToken<?> recordType, String fieldName) {
return String.format("%s$%s", normalizeTypeName(recordType), fieldName);
} | java | private String getFieldAccessorName(TypeToken<?> recordType, String fieldName) {
return String.format("%s$%s", normalizeTypeName(recordType), fieldName);
} | [
"private",
"String",
"getFieldAccessorName",
"(",
"TypeToken",
"<",
"?",
">",
"recordType",
",",
"String",
"fieldName",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s$%s\"",
",",
"normalizeTypeName",
"(",
"recordType",
")",
",",
"fieldName",
")",
";",... | Generates the name of the class field for storing {@link FieldAccessor} for the given record field.
@param recordType Type of the record.
@param fieldName name of the field.
@return name of the class field. | [
"Generates",
"the",
"name",
"of",
"the",
"class",
"field",
"for",
"storing",
"{"
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java#L954-L956 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/UsersApi.java | UsersApi.getUserRules | public RulesEnvelope getUserRules(String userId, Boolean excludeDisabled, Integer count, Integer offset, String owner) throws ApiException {
ApiResponse<RulesEnvelope> resp = getUserRulesWithHttpInfo(userId, excludeDisabled, count, offset, owner);
return resp.getData();
} | java | public RulesEnvelope getUserRules(String userId, Boolean excludeDisabled, Integer count, Integer offset, String owner) throws ApiException {
ApiResponse<RulesEnvelope> resp = getUserRulesWithHttpInfo(userId, excludeDisabled, count, offset, owner);
return resp.getData();
} | [
"public",
"RulesEnvelope",
"getUserRules",
"(",
"String",
"userId",
",",
"Boolean",
"excludeDisabled",
",",
"Integer",
"count",
",",
"Integer",
"offset",
",",
"String",
"owner",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"RulesEnvelope",
">",
"resp",
... | Get User Rules
Retrieve User's Rules
@param userId User ID. (required)
@param excludeDisabled Exclude disabled rules in the result. (optional)
@param count Desired count of items in the result set. (optional)
@param offset Offset for pagination. (optional)
@param owner Rule owner (optional)
@return RulesEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"User",
"Rules",
"Retrieve",
"User'",
";",
"s",
"Rules"
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/UsersApi.java#L915-L918 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java | ProjDepTreeFactor.hasOneParentPerToken | public static boolean hasOneParentPerToken(int n, VarConfig vc) {
int[] parents = new int[n];
Arrays.fill(parents, -2);
for (Var v : vc.getVars()) {
if (v instanceof LinkVar) {
LinkVar link = (LinkVar) v;
if (vc.getState(v) == LinkVar.TRUE) {
if (parents[link.getChild()] != -2) {
// Multiple parents defined for the same child.
return false;
}
parents[link.getChild()] = link.getParent();
}
}
}
return !ArrayUtils.contains(parents, -2);
} | java | public static boolean hasOneParentPerToken(int n, VarConfig vc) {
int[] parents = new int[n];
Arrays.fill(parents, -2);
for (Var v : vc.getVars()) {
if (v instanceof LinkVar) {
LinkVar link = (LinkVar) v;
if (vc.getState(v) == LinkVar.TRUE) {
if (parents[link.getChild()] != -2) {
// Multiple parents defined for the same child.
return false;
}
parents[link.getChild()] = link.getParent();
}
}
}
return !ArrayUtils.contains(parents, -2);
} | [
"public",
"static",
"boolean",
"hasOneParentPerToken",
"(",
"int",
"n",
",",
"VarConfig",
"vc",
")",
"{",
"int",
"[",
"]",
"parents",
"=",
"new",
"int",
"[",
"n",
"]",
";",
"Arrays",
".",
"fill",
"(",
"parents",
",",
"-",
"2",
")",
";",
"for",
"(",... | Returns whether this variable assignment specifies one parent per token. | [
"Returns",
"whether",
"this",
"variable",
"assignment",
"specifies",
"one",
"parent",
"per",
"token",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java#L229-L245 |
NoraUi/NoraUi | src/main/java/com/github/noraui/browser/steps/BrowserSteps.java | BrowserSteps.closeWindowAndSwitchTo | @Conditioned
@Lorsque("Je ferme la fenêtre actuelle et passe à la fenêtre '(.*)'[\\.|\\?]")
@Then("I close current window and switch to '(.*)' window[\\.|\\?]")
public void closeWindowAndSwitchTo(String key, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException {
closeWindowAndSwitchTo(key);
} | java | @Conditioned
@Lorsque("Je ferme la fenêtre actuelle et passe à la fenêtre '(.*)'[\\.|\\?]")
@Then("I close current window and switch to '(.*)' window[\\.|\\?]")
public void closeWindowAndSwitchTo(String key, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException {
closeWindowAndSwitchTo(key);
} | [
"@",
"Conditioned",
"@",
"Lorsque",
"(",
"\"Je ferme la fenêtre actuelle et passe à la fenêtre '(.*)'[\\\\.|\\\\?]\")\r",
"",
"@",
"Then",
"(",
"\"I close current window and switch to '(.*)' window[\\\\.|\\\\?]\"",
")",
"public",
"void",
"closeWindowAndSwitchTo",
"(",
"String",
"ke... | Closes window and switches to target window with conditions.
@param key
is the key of application (Ex: SALTO).
@param conditions
list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}).
@throws TechnicalException
is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_CLOSE_APP} message (with screenshot, no exception)
@throws FailureException
if the scenario encounters a functional error | [
"Closes",
"window",
"and",
"switches",
"to",
"target",
"window",
"with",
"conditions",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/browser/steps/BrowserSteps.java#L146-L151 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java | ConverterRegistry.putCustom | public ConverterRegistry putCustom(Type type, Class<? extends Converter<?>> converterClass) {
return putCustom(type, ReflectUtil.newInstance(converterClass));
} | java | public ConverterRegistry putCustom(Type type, Class<? extends Converter<?>> converterClass) {
return putCustom(type, ReflectUtil.newInstance(converterClass));
} | [
"public",
"ConverterRegistry",
"putCustom",
"(",
"Type",
"type",
",",
"Class",
"<",
"?",
"extends",
"Converter",
"<",
"?",
">",
">",
"converterClass",
")",
"{",
"return",
"putCustom",
"(",
"type",
",",
"ReflectUtil",
".",
"newInstance",
"(",
"converterClass",
... | 登记自定义转换器
@param type 转换的目标类型
@param converterClass 转换器类,必须有默认构造方法
@return {@link ConverterRegistry} | [
"登记自定义转换器"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java#L103-L105 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.multOuter | public static void multOuter(DMatrix1Row a , DMatrix1Row c )
{
c.reshape(a.numRows,a.numRows);
MatrixMultProduct_DDRM.outer(a, c);
} | java | public static void multOuter(DMatrix1Row a , DMatrix1Row c )
{
c.reshape(a.numRows,a.numRows);
MatrixMultProduct_DDRM.outer(a, c);
} | [
"public",
"static",
"void",
"multOuter",
"(",
"DMatrix1Row",
"a",
",",
"DMatrix1Row",
"c",
")",
"{",
"c",
".",
"reshape",
"(",
"a",
".",
"numRows",
",",
"a",
".",
"numRows",
")",
";",
"MatrixMultProduct_DDRM",
".",
"outer",
"(",
"a",
",",
"c",
")",
"... | <p>Computes the matrix multiplication outer product:<br>
<br>
c = a * a<sup>T</sup> <br>
<br>
c<sub>ij</sub> = ∑<sub>k=1:m</sub> { a<sub>ik</sub> * a<sub>jk</sub>}
</p>
<p>
Is faster than using a generic matrix multiplication by taking advantage of symmetry.
</p>
@param a The matrix being multiplied. Not modified.
@param c Where the results of the operation are stored. Modified. | [
"<p",
">",
"Computes",
"the",
"matrix",
"multiplication",
"outer",
"product",
":",
"<br",
">",
"<br",
">",
"c",
"=",
"a",
"*",
"a<sup",
">",
"T<",
"/",
"sup",
">",
"<br",
">",
"<br",
">",
"c<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"&sum",
";",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L314-L319 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/recurrent/BaseRecurrentLayer.java | BaseRecurrentLayer.rnnSetPreviousState | @Override
public void rnnSetPreviousState(Map<String, INDArray> stateMap) {
this.stateMap.clear();
this.stateMap.putAll(stateMap);
} | java | @Override
public void rnnSetPreviousState(Map<String, INDArray> stateMap) {
this.stateMap.clear();
this.stateMap.putAll(stateMap);
} | [
"@",
"Override",
"public",
"void",
"rnnSetPreviousState",
"(",
"Map",
"<",
"String",
",",
"INDArray",
">",
"stateMap",
")",
"{",
"this",
".",
"stateMap",
".",
"clear",
"(",
")",
";",
"this",
".",
"stateMap",
".",
"putAll",
"(",
"stateMap",
")",
";",
"}... | Set the state map. Values set using this method will be used
in next call to rnnTimeStep() | [
"Set",
"the",
"state",
"map",
".",
"Values",
"set",
"using",
"this",
"method",
"will",
"be",
"used",
"in",
"next",
"call",
"to",
"rnnTimeStep",
"()"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/recurrent/BaseRecurrentLayer.java#L60-L64 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.asEnclosingSuper | public Type asEnclosingSuper(Type t, Symbol sym) {
switch (t.getTag()) {
case CLASS:
do {
Type s = asSuper(t, sym);
if (s != null) return s;
Type outer = t.getEnclosingType();
t = (outer.hasTag(CLASS)) ? outer :
(t.tsym.owner.enclClass() != null) ? t.tsym.owner.enclClass().type :
Type.noType;
} while (t.hasTag(CLASS));
return null;
case ARRAY:
return isSubtype(t, sym.type) ? sym.type : null;
case TYPEVAR:
return asSuper(t, sym);
case ERROR:
return t;
default:
return null;
}
} | java | public Type asEnclosingSuper(Type t, Symbol sym) {
switch (t.getTag()) {
case CLASS:
do {
Type s = asSuper(t, sym);
if (s != null) return s;
Type outer = t.getEnclosingType();
t = (outer.hasTag(CLASS)) ? outer :
(t.tsym.owner.enclClass() != null) ? t.tsym.owner.enclClass().type :
Type.noType;
} while (t.hasTag(CLASS));
return null;
case ARRAY:
return isSubtype(t, sym.type) ? sym.type : null;
case TYPEVAR:
return asSuper(t, sym);
case ERROR:
return t;
default:
return null;
}
} | [
"public",
"Type",
"asEnclosingSuper",
"(",
"Type",
"t",
",",
"Symbol",
"sym",
")",
"{",
"switch",
"(",
"t",
".",
"getTag",
"(",
")",
")",
"{",
"case",
"CLASS",
":",
"do",
"{",
"Type",
"s",
"=",
"asSuper",
"(",
"t",
",",
"sym",
")",
";",
"if",
"... | Return the base type of t or any of its enclosing types that
starts with the given symbol. If none exists, return null.
@param t a type
@param sym a symbol | [
"Return",
"the",
"base",
"type",
"of",
"t",
"or",
"any",
"of",
"its",
"enclosing",
"types",
"that",
"starts",
"with",
"the",
"given",
"symbol",
".",
"If",
"none",
"exists",
"return",
"null",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1950-L1971 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/operators/Functionals.java | Functionals.fromRunnable | public static Action0 fromRunnable(Runnable run, Worker inner) {
if (run == null) {
throw new NullPointerException("run");
}
return new ActionWrappingRunnable(run, inner);
} | java | public static Action0 fromRunnable(Runnable run, Worker inner) {
if (run == null) {
throw new NullPointerException("run");
}
return new ActionWrappingRunnable(run, inner);
} | [
"public",
"static",
"Action0",
"fromRunnable",
"(",
"Runnable",
"run",
",",
"Worker",
"inner",
")",
"{",
"if",
"(",
"run",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"run\"",
")",
";",
"}",
"return",
"new",
"ActionWrappingRunnable... | Converts a runnable instance into an Action0 instance.
@param run the Runnable to run when the Action0 is called
@return the Action0 wrapping the Runnable | [
"Converts",
"a",
"runnable",
"instance",
"into",
"an",
"Action0",
"instance",
"."
] | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/operators/Functionals.java#L69-L74 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java | JingleManager.triggerSessionRequested | void triggerSessionRequested(Jingle initJin) {
JingleSessionRequestListener[] jingleSessionRequestListeners;
// Make a synchronized copy of the listenerJingles
synchronized (this.jingleSessionRequestListeners) {
jingleSessionRequestListeners = new JingleSessionRequestListener[this.jingleSessionRequestListeners.size()];
this.jingleSessionRequestListeners.toArray(jingleSessionRequestListeners);
}
// ... and let them know of the event
JingleSessionRequest request = new JingleSessionRequest(this, initJin);
for (int i = 0; i < jingleSessionRequestListeners.length; i++) {
jingleSessionRequestListeners[i].sessionRequested(request);
}
} | java | void triggerSessionRequested(Jingle initJin) {
JingleSessionRequestListener[] jingleSessionRequestListeners;
// Make a synchronized copy of the listenerJingles
synchronized (this.jingleSessionRequestListeners) {
jingleSessionRequestListeners = new JingleSessionRequestListener[this.jingleSessionRequestListeners.size()];
this.jingleSessionRequestListeners.toArray(jingleSessionRequestListeners);
}
// ... and let them know of the event
JingleSessionRequest request = new JingleSessionRequest(this, initJin);
for (int i = 0; i < jingleSessionRequestListeners.length; i++) {
jingleSessionRequestListeners[i].sessionRequested(request);
}
} | [
"void",
"triggerSessionRequested",
"(",
"Jingle",
"initJin",
")",
"{",
"JingleSessionRequestListener",
"[",
"]",
"jingleSessionRequestListeners",
";",
"// Make a synchronized copy of the listenerJingles",
"synchronized",
"(",
"this",
".",
"jingleSessionRequestListeners",
")",
"... | Activates the listenerJingles on a Jingle session request.
@param initJin the stanza that must be passed to the jingleSessionRequestListener. | [
"Activates",
"the",
"listenerJingles",
"on",
"a",
"Jingle",
"session",
"request",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java#L495-L510 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java | BitcoinSerializer.makeAddressMessage | @Override
public AddressMessage makeAddressMessage(byte[] payloadBytes, int length) throws ProtocolException {
return new AddressMessage(params, payloadBytes, this, length);
} | java | @Override
public AddressMessage makeAddressMessage(byte[] payloadBytes, int length) throws ProtocolException {
return new AddressMessage(params, payloadBytes, this, length);
} | [
"@",
"Override",
"public",
"AddressMessage",
"makeAddressMessage",
"(",
"byte",
"[",
"]",
"payloadBytes",
",",
"int",
"length",
")",
"throws",
"ProtocolException",
"{",
"return",
"new",
"AddressMessage",
"(",
"params",
",",
"payloadBytes",
",",
"this",
",",
"len... | Make an address message from the payload. Extension point for alternative
serialization format support. | [
"Make",
"an",
"address",
"message",
"from",
"the",
"payload",
".",
"Extension",
"point",
"for",
"alternative",
"serialization",
"format",
"support",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java#L254-L257 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.getLearnedRoutes | public GatewayRouteListResultInner getLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) {
return getLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | java | public GatewayRouteListResultInner getLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) {
return getLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | [
"public",
"GatewayRouteListResultInner",
"getLearnedRoutes",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"getLearnedRoutesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName",
")",
".",
"to... | This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@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 GatewayRouteListResultInner object if successful. | [
"This",
"operation",
"retrieves",
"a",
"list",
"of",
"routes",
"the",
"virtual",
"network",
"gateway",
"has",
"learned",
"including",
"routes",
"learned",
"from",
"BGP",
"peers",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2340-L2342 |
greese/dasein-cloud-digitalocean | src/main/java/org/dasein/cloud/digitalocean/models/rest/DigitalOceanModelFactory.java | DigitalOceanModelFactory.checkAction | public static int checkAction(@Nonnull org.dasein.cloud.digitalocean.DigitalOcean provider, String actionUrl) throws CloudException, InternalException {
if( logger.isTraceEnabled() ) {
logger.trace("ENTER - " + DigitalOceanModelFactory.class.getName() + ".checkAction(" + provider.getCloudName() + ")");
}
String token = (String) provider.getContext().getConfigurationValue("token");
try {
return sendRequest(provider, RESTMethod.HEAD, token, getApiUrl(provider) + "v2/" + actionUrl, null).getStatusLine().getStatusCode();
} finally {
if( logger.isTraceEnabled() ) {
logger.trace("EXIT - " + DigitalOceanModelFactory.class.getName() + ".checkAction(" + provider.getCloudName() + ")");
}
}
} | java | public static int checkAction(@Nonnull org.dasein.cloud.digitalocean.DigitalOcean provider, String actionUrl) throws CloudException, InternalException {
if( logger.isTraceEnabled() ) {
logger.trace("ENTER - " + DigitalOceanModelFactory.class.getName() + ".checkAction(" + provider.getCloudName() + ")");
}
String token = (String) provider.getContext().getConfigurationValue("token");
try {
return sendRequest(provider, RESTMethod.HEAD, token, getApiUrl(provider) + "v2/" + actionUrl, null).getStatusLine().getStatusCode();
} finally {
if( logger.isTraceEnabled() ) {
logger.trace("EXIT - " + DigitalOceanModelFactory.class.getName() + ".checkAction(" + provider.getCloudName() + ")");
}
}
} | [
"public",
"static",
"int",
"checkAction",
"(",
"@",
"Nonnull",
"org",
".",
"dasein",
".",
"cloud",
".",
"digitalocean",
".",
"DigitalOcean",
"provider",
",",
"String",
"actionUrl",
")",
"throws",
"CloudException",
",",
"InternalException",
"{",
"if",
"(",
"log... | Return HTTP status code for an action request sent via HEAD method
@param provider
@param actionUrl
@return status code
@throws InternalException
@throws CloudException | [
"Return",
"HTTP",
"status",
"code",
"for",
"an",
"action",
"request",
"sent",
"via",
"HEAD",
"method"
] | train | https://github.com/greese/dasein-cloud-digitalocean/blob/09b74566b24d7f668379fca237524d4cc0335f77/src/main/java/org/dasein/cloud/digitalocean/models/rest/DigitalOceanModelFactory.java#L378-L392 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpHandler.java | RtcpHandler.rescheduleRtcp | private void rescheduleRtcp(TxTask task, long timestamp) {
// Cancel current execution of the task
this.reportTaskFuture.cancel(true);
// Re-schedule task execution
long interval = resolveInterval(timestamp);
try {
this.reportTaskFuture = this.scheduler.schedule(task, interval, TimeUnit.MILLISECONDS);
} catch (IllegalStateException e) {
logger.warn("RTCP timer already canceled. Scheduled report was canceled and cannot be re-scheduled.");
}
} | java | private void rescheduleRtcp(TxTask task, long timestamp) {
// Cancel current execution of the task
this.reportTaskFuture.cancel(true);
// Re-schedule task execution
long interval = resolveInterval(timestamp);
try {
this.reportTaskFuture = this.scheduler.schedule(task, interval, TimeUnit.MILLISECONDS);
} catch (IllegalStateException e) {
logger.warn("RTCP timer already canceled. Scheduled report was canceled and cannot be re-scheduled.");
}
} | [
"private",
"void",
"rescheduleRtcp",
"(",
"TxTask",
"task",
",",
"long",
"timestamp",
")",
"{",
"// Cancel current execution of the task",
"this",
".",
"reportTaskFuture",
".",
"cancel",
"(",
"true",
")",
";",
"// Re-schedule task execution",
"long",
"interval",
"=",
... | Re-schedules a previously scheduled event.
@param timestamp The time stamp (in milliseconds) of the rescheduled event | [
"Re",
"-",
"schedules",
"a",
"previously",
"scheduled",
"event",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpHandler.java#L255-L266 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java | AtomWriter.writeFeed | public void writeFeed(List<?> entities, String requestContextURL, Map<String, Object> meta)
throws ODataRenderException {
writeStartFeed(requestContextURL, meta);
writeBodyFeed(entities);
writeEndFeed();
} | java | public void writeFeed(List<?> entities, String requestContextURL, Map<String, Object> meta)
throws ODataRenderException {
writeStartFeed(requestContextURL, meta);
writeBodyFeed(entities);
writeEndFeed();
} | [
"public",
"void",
"writeFeed",
"(",
"List",
"<",
"?",
">",
"entities",
",",
"String",
"requestContextURL",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"meta",
")",
"throws",
"ODataRenderException",
"{",
"writeStartFeed",
"(",
"requestContextURL",
",",
"meta... | <p> Write a list of entities (feed) to the XML stream. </p> <p> <b>Note:</b> Make sure {@link
AtomWriter#startDocument()} has been previously invoked to start the XML stream document, and {@link
AtomWriter#endDocument()} is invoked after to end it. </p>
@param entities The list of entities to fill in the XML stream. It can not {@code null}.
@param requestContextURL The 'Context URL' to write for the feed. It can not {@code null}.
@param meta Additional metadata to write.
@throws ODataRenderException In case it is not possible to write to the XML stream. | [
"<p",
">",
"Write",
"a",
"list",
"of",
"entities",
"(",
"feed",
")",
"to",
"the",
"XML",
"stream",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"Make",
"sure",
"{",
"@link",
"AtomWriter#startDocument",
"()",
"}"... | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java#L209-L214 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.smoothCubicTo | public SVGPath smoothCubicTo(double c2x, double c2y, double x, double y) {
return append(PATH_SMOOTH_CUBIC_TO).append(c2x).append(c2y).append(x).append(y);
} | java | public SVGPath smoothCubicTo(double c2x, double c2y, double x, double y) {
return append(PATH_SMOOTH_CUBIC_TO).append(c2x).append(c2y).append(x).append(y);
} | [
"public",
"SVGPath",
"smoothCubicTo",
"(",
"double",
"c2x",
",",
"double",
"c2y",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_SMOOTH_CUBIC_TO",
")",
".",
"append",
"(",
"c2x",
")",
".",
"append",
"(",
"c2y",
")",
".... | Smooth Cubic Bezier line to the given coordinates.
@param c2x second control point x
@param c2y second control point y
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax. | [
"Smooth",
"Cubic",
"Bezier",
"line",
"to",
"the",
"given",
"coordinates",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L409-L411 |
jfinal/jfinal | src/main/java/com/jfinal/captcha/CaptchaRender.java | CaptchaRender.validate | public static boolean validate(Controller controller, String userInputString) {
String captchaKey = controller.getCookie(captchaName);
if (validate(captchaKey, userInputString)) {
controller.removeCookie(captchaName);
return true;
}
return false;
} | java | public static boolean validate(Controller controller, String userInputString) {
String captchaKey = controller.getCookie(captchaName);
if (validate(captchaKey, userInputString)) {
controller.removeCookie(captchaName);
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"validate",
"(",
"Controller",
"controller",
",",
"String",
"userInputString",
")",
"{",
"String",
"captchaKey",
"=",
"controller",
".",
"getCookie",
"(",
"captchaName",
")",
";",
"if",
"(",
"validate",
"(",
"captchaKey",
",",
"u... | 校验用户输入的验证码是否正确
@param controller 控制器
@param userInputString 用户输入的字符串
@return 验证通过返回 true, 否则返回 false | [
"校验用户输入的验证码是否正确"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/captcha/CaptchaRender.java#L218-L225 |
jenkinsci/jenkins | core/src/main/java/hudson/util/KeyedDataStorage.java | KeyedDataStorage.get | public @CheckForNull T get(String key) throws IOException {
return get(key,false,null);
} | java | public @CheckForNull T get(String key) throws IOException {
return get(key,false,null);
} | [
"public",
"@",
"CheckForNull",
"T",
"get",
"(",
"String",
"key",
")",
"throws",
"IOException",
"{",
"return",
"get",
"(",
"key",
",",
"false",
",",
"null",
")",
";",
"}"
] | Finds the data object that matches the given key if available, or null
if not found.
@return Item with the specified {@code key}
@throws IOException Loading error | [
"Finds",
"the",
"data",
"object",
"that",
"matches",
"the",
"given",
"key",
"if",
"available",
"or",
"null",
"if",
"not",
"found",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/KeyedDataStorage.java#L120-L122 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/argparser/TaggedArgumentParser.java | TaggedArgumentParser.populateArgumentTags | public static void populateArgumentTags(final TaggedArgument taggedArg, final String longArgName, final String tagString) {
if (tagString == null) {
taggedArg.setTag(null);
taggedArg.setTagAttributes(Collections.emptyMap());
} else {
final ParsedArgument pa = ParsedArgument.of(longArgName, tagString);
taggedArg.setTag(pa.getName());
taggedArg.setTagAttributes(pa.keyValueMap());
}
} | java | public static void populateArgumentTags(final TaggedArgument taggedArg, final String longArgName, final String tagString) {
if (tagString == null) {
taggedArg.setTag(null);
taggedArg.setTagAttributes(Collections.emptyMap());
} else {
final ParsedArgument pa = ParsedArgument.of(longArgName, tagString);
taggedArg.setTag(pa.getName());
taggedArg.setTagAttributes(pa.keyValueMap());
}
} | [
"public",
"static",
"void",
"populateArgumentTags",
"(",
"final",
"TaggedArgument",
"taggedArg",
",",
"final",
"String",
"longArgName",
",",
"final",
"String",
"tagString",
")",
"{",
"if",
"(",
"tagString",
"==",
"null",
")",
"{",
"taggedArg",
".",
"setTag",
"... | Parse a tag string and populate a TaggedArgument with values.
@param taggedArg TaggedArgument to receive tags
@param longArgName name of the argument being tagged
@param tagString tag string (including logical name and attributes, no option name) | [
"Parse",
"a",
"tag",
"string",
"and",
"populate",
"a",
"TaggedArgument",
"with",
"values",
"."
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/argparser/TaggedArgumentParser.java#L231-L240 |
alkacon/opencms-core | src/org/opencms/jsp/search/controller/CmsSearchControllerFacetField.java | CmsSearchControllerFacetField.addFacetOptions | protected void addFacetOptions(StringBuffer query, final boolean useLimit) {
// mincount
if (m_config.getMinCount() != null) {
appendFacetOption(query, "mincount", m_config.getMinCount().toString());
}
// limit
if (useLimit && (m_config.getLimit() != null)) {
appendFacetOption(query, "limit", m_config.getLimit().toString());
}
// sort
if (m_config.getSortOrder() != null) {
appendFacetOption(query, "sort", m_config.getSortOrder().toString());
}
// prefix
if (!m_config.getPrefix().isEmpty()) {
appendFacetOption(query, "prefix", m_config.getPrefix());
}
} | java | protected void addFacetOptions(StringBuffer query, final boolean useLimit) {
// mincount
if (m_config.getMinCount() != null) {
appendFacetOption(query, "mincount", m_config.getMinCount().toString());
}
// limit
if (useLimit && (m_config.getLimit() != null)) {
appendFacetOption(query, "limit", m_config.getLimit().toString());
}
// sort
if (m_config.getSortOrder() != null) {
appendFacetOption(query, "sort", m_config.getSortOrder().toString());
}
// prefix
if (!m_config.getPrefix().isEmpty()) {
appendFacetOption(query, "prefix", m_config.getPrefix());
}
} | [
"protected",
"void",
"addFacetOptions",
"(",
"StringBuffer",
"query",
",",
"final",
"boolean",
"useLimit",
")",
"{",
"// mincount",
"if",
"(",
"m_config",
".",
"getMinCount",
"(",
")",
"!=",
"null",
")",
"{",
"appendFacetOption",
"(",
"query",
",",
"\"mincount... | Adds the query parts for the facet options, except the filter parts.
@param query The query part that is extended with the facet options.
@param useLimit Flag, if the limit option should be set. | [
"Adds",
"the",
"query",
"parts",
"for",
"the",
"facet",
"options",
"except",
"the",
"filter",
"parts",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/controller/CmsSearchControllerFacetField.java#L140-L158 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.