repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
maddingo/sojo | src/main/java/net/sf/sojo/util/Util.java | Util.clearDateFormats | public static void clearDateFormats(Map<String, DateFormat> copy) {
synchronized(dateFormats) {
if (copy != null) {
copy.putAll(dateFormats);
}
dateFormats.clear();
}
} | java | public static void clearDateFormats(Map<String, DateFormat> copy) {
synchronized(dateFormats) {
if (copy != null) {
copy.putAll(dateFormats);
}
dateFormats.clear();
}
} | [
"public",
"static",
"void",
"clearDateFormats",
"(",
"Map",
"<",
"String",
",",
"DateFormat",
">",
"copy",
")",
"{",
"synchronized",
"(",
"dateFormats",
")",
"{",
"if",
"(",
"copy",
"!=",
"null",
")",
"{",
"copy",
".",
"putAll",
"(",
"dateFormats",
")",
... | Removes all registered {@link DateFormat DateFormats}.
@param copy if not null, the old values are copied to this map
@return an unmodifiable version of the original registrations. | [
"Removes",
"all",
"registered",
"{",
"@link",
"DateFormat",
"DateFormats",
"}",
"."
] | train | https://github.com/maddingo/sojo/blob/99e9e0a146b502deb7f507fe0623227402ed675b/src/main/java/net/sf/sojo/util/Util.java#L95-L102 |
selendroid/selendroid | selendroid-server/src/main/java/io/selendroid/server/util/Intents.java | Intents.createStartActivityIntent | public static Intent createStartActivityIntent(Context context, String mainActivityName) {
Intent intent = new Intent();
intent.setClassName(context, mainActivityName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
| Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
return intent;
} | java | public static Intent createStartActivityIntent(Context context, String mainActivityName) {
Intent intent = new Intent();
intent.setClassName(context, mainActivityName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
| Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
return intent;
} | [
"public",
"static",
"Intent",
"createStartActivityIntent",
"(",
"Context",
"context",
",",
"String",
"mainActivityName",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
")",
";",
"intent",
".",
"setClassName",
"(",
"context",
",",
"mainActivityName",
")... | Create an intent to start an activity, for both ServerInstrumentation and LightweightInstrumentation | [
"Create",
"an",
"intent",
"to",
"start",
"an",
"activity",
"for",
"both",
"ServerInstrumentation",
"and",
"LightweightInstrumentation"
] | train | https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-server/src/main/java/io/selendroid/server/util/Intents.java#L14-L22 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.renderChild | public static void renderChild(FacesContext fc, UIComponent child) throws IOException {
if (!child.isRendered()) {
return;
}
child.encodeBegin(fc);
if (child.getRendersChildren()) {
child.encodeChildren(fc);
} else {
renderChildren(fc, child);
}
child.encodeEnd(fc);
} | java | public static void renderChild(FacesContext fc, UIComponent child) throws IOException {
if (!child.isRendered()) {
return;
}
child.encodeBegin(fc);
if (child.getRendersChildren()) {
child.encodeChildren(fc);
} else {
renderChildren(fc, child);
}
child.encodeEnd(fc);
} | [
"public",
"static",
"void",
"renderChild",
"(",
"FacesContext",
"fc",
",",
"UIComponent",
"child",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"child",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"child",
".",
"encodeBegin",
"(",
"f... | Renders the Child of a Component
@param fc
@param child
@throws IOException | [
"Renders",
"the",
"Child",
"of",
"a",
"Component"
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L346-L359 |
apereo/cas | core/cas-server-core-logout-api/src/main/java/org/apereo/cas/logout/slo/BaseSingleLogoutServiceMessageHandler.java | BaseSingleLogoutServiceMessageHandler.sendMessageToEndpoint | protected boolean sendMessageToEndpoint(final LogoutHttpMessage msg, final SingleLogoutRequest request, final SingleLogoutMessage logoutMessage) {
return this.httpClient.sendMessageToEndPoint(msg);
} | java | protected boolean sendMessageToEndpoint(final LogoutHttpMessage msg, final SingleLogoutRequest request, final SingleLogoutMessage logoutMessage) {
return this.httpClient.sendMessageToEndPoint(msg);
} | [
"protected",
"boolean",
"sendMessageToEndpoint",
"(",
"final",
"LogoutHttpMessage",
"msg",
",",
"final",
"SingleLogoutRequest",
"request",
",",
"final",
"SingleLogoutMessage",
"logoutMessage",
")",
"{",
"return",
"this",
".",
"httpClient",
".",
"sendMessageToEndPoint",
... | Send message to endpoint.
@param msg the msg
@param request the request
@param logoutMessage the logout message
@return the boolean | [
"Send",
"message",
"to",
"endpoint",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-logout-api/src/main/java/org/apereo/cas/logout/slo/BaseSingleLogoutServiceMessageHandler.java#L193-L195 |
h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeMojoModel.java | SharedTreeMojoModel.scoreTreeRange | public final void scoreTreeRange(double[] row, int fromIndex, int toIndex, double[] preds) {
final int clOffset = _nclasses == 1 ? 0 : 1;
for (int classIndex = 0; classIndex < _ntrees_per_group; classIndex++) {
int k = clOffset + classIndex;
int itree = treeIndex(fromIndex, classIndex);
for (int groupIndex = fromIndex; groupIndex < toIndex; groupIndex++) {
if (_compressed_trees[itree] != null) { // Skip all empty trees
preds[k] += _scoreTree.scoreTree(_compressed_trees[itree], row, false, _domains);
}
itree++;
}
}
} | java | public final void scoreTreeRange(double[] row, int fromIndex, int toIndex, double[] preds) {
final int clOffset = _nclasses == 1 ? 0 : 1;
for (int classIndex = 0; classIndex < _ntrees_per_group; classIndex++) {
int k = clOffset + classIndex;
int itree = treeIndex(fromIndex, classIndex);
for (int groupIndex = fromIndex; groupIndex < toIndex; groupIndex++) {
if (_compressed_trees[itree] != null) { // Skip all empty trees
preds[k] += _scoreTree.scoreTree(_compressed_trees[itree], row, false, _domains);
}
itree++;
}
}
} | [
"public",
"final",
"void",
"scoreTreeRange",
"(",
"double",
"[",
"]",
"row",
",",
"int",
"fromIndex",
",",
"int",
"toIndex",
",",
"double",
"[",
"]",
"preds",
")",
"{",
"final",
"int",
"clOffset",
"=",
"_nclasses",
"==",
"1",
"?",
"0",
":",
"1",
";",... | Generates (partial, per-class) predictions using only trees from a given range.
@param row input row
@param fromIndex low endpoint (inclusive) of the tree range
@param toIndex high endpoint (exclusive) of the tree range
@param preds array of partial predictions.
To get final predictions pass the result to {@link SharedTreeMojoModel#unifyPreds}. | [
"Generates",
"(",
"partial",
"per",
"-",
"class",
")",
"predictions",
"using",
"only",
"trees",
"from",
"a",
"given",
"range",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeMojoModel.java#L698-L710 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java | ST_Graph.makeEnvelopes | private static void makeEnvelopes(Statement st, double tolerance, boolean isH2, int srid) throws SQLException {
st.execute("DROP TABLE IF EXISTS"+ PTS_TABLE + ";");
if (tolerance > 0) {
LOGGER.info("Calculating envelopes around coordinates...");
if (isH2) {
// Putting all points and their envelopes together...
st.execute("CREATE TABLE "+ PTS_TABLE +"( "
+ "ID SERIAL PRIMARY KEY, "
+ "THE_GEOM POINT, "
+ "AREA POLYGON "
+ ") AS "
+ "SELECT NULL, START_POINT, START_POINT_EXP FROM "+ COORDS_TABLE
+ " UNION ALL "
+ "SELECT NULL, END_POINT, END_POINT_EXP FROM "+ COORDS_TABLE+";");
// Putting a spatial index on the envelopes...
st.execute("CREATE SPATIAL INDEX ON "+ PTS_TABLE +"(AREA);");
} else {
// Putting all points and their envelopes together...
st.execute("CREATE TABLE "+ PTS_TABLE + "( ID SERIAL PRIMARY KEY, "
+ "THE_GEOM GEOMETRY(POINT,"+srid+"),"
+ "AREA GEOMETRY(POLYGON, "+srid+")"
+ ") ");
st.execute("INSERT INTO " + PTS_TABLE +" (SELECT (row_number() over())::int , a.THE_GEOM, A.AREA FROM "
+ "(SELECT START_POINT AS THE_GEOM, START_POINT_EXP as AREA FROM "+ COORDS_TABLE
+ " UNION ALL "
+ "SELECT END_POINT AS THE_GEOM, END_POINT_EXP as AREA FROM "+ COORDS_TABLE+") as a);");
// Putting a spatial index on the envelopes...
st.execute("CREATE INDEX ON "+ PTS_TABLE +" USING GIST(AREA);");
}
} else {
LOGGER.info("Preparing temporary nodes table from coordinates...");
if (isH2) {
// If the tolerance is zero, we just put all points together
st.execute("CREATE TABLE "+ PTS_TABLE +"( "
+ "ID SERIAL PRIMARY KEY, "
+ "THE_GEOM POINT"
+ ") AS "
+ "SELECT NULL, START_POINT FROM "+ COORDS_TABLE
+ " UNION ALL "
+ "SELECT NULL, END_POINT FROM "+ COORDS_TABLE+";");
// Putting a spatial index on the points themselves...
st.execute("CREATE SPATIAL INDEX ON "+ PTS_TABLE +"(THE_GEOM);");
} else {
// If the tolerance is zero, we just put all points together
st.execute("CREATE TABLE "+ PTS_TABLE +"( "
+ "ID SERIAL PRIMARY KEY, "
+ "THE_GEOM GEOMETRY(POINT,"+srid+")"
+ ")");
st.execute("INSERT INTO "+ PTS_TABLE +" (SELECT (row_number() over())::int , a.the_geom FROM "
+ "(SELECT START_POINT as THE_GEOM FROM "+ COORDS_TABLE
+ " UNION ALL "
+ "SELECT END_POINT as THE_GEOM FROM "+ COORDS_TABLE+") as a);");
// Putting a spatial index on the points themselves...
st.execute("CREATE INDEX ON "+ PTS_TABLE + " USING GIST(THE_GEOM);");
}
}
} | java | private static void makeEnvelopes(Statement st, double tolerance, boolean isH2, int srid) throws SQLException {
st.execute("DROP TABLE IF EXISTS"+ PTS_TABLE + ";");
if (tolerance > 0) {
LOGGER.info("Calculating envelopes around coordinates...");
if (isH2) {
// Putting all points and their envelopes together...
st.execute("CREATE TABLE "+ PTS_TABLE +"( "
+ "ID SERIAL PRIMARY KEY, "
+ "THE_GEOM POINT, "
+ "AREA POLYGON "
+ ") AS "
+ "SELECT NULL, START_POINT, START_POINT_EXP FROM "+ COORDS_TABLE
+ " UNION ALL "
+ "SELECT NULL, END_POINT, END_POINT_EXP FROM "+ COORDS_TABLE+";");
// Putting a spatial index on the envelopes...
st.execute("CREATE SPATIAL INDEX ON "+ PTS_TABLE +"(AREA);");
} else {
// Putting all points and their envelopes together...
st.execute("CREATE TABLE "+ PTS_TABLE + "( ID SERIAL PRIMARY KEY, "
+ "THE_GEOM GEOMETRY(POINT,"+srid+"),"
+ "AREA GEOMETRY(POLYGON, "+srid+")"
+ ") ");
st.execute("INSERT INTO " + PTS_TABLE +" (SELECT (row_number() over())::int , a.THE_GEOM, A.AREA FROM "
+ "(SELECT START_POINT AS THE_GEOM, START_POINT_EXP as AREA FROM "+ COORDS_TABLE
+ " UNION ALL "
+ "SELECT END_POINT AS THE_GEOM, END_POINT_EXP as AREA FROM "+ COORDS_TABLE+") as a);");
// Putting a spatial index on the envelopes...
st.execute("CREATE INDEX ON "+ PTS_TABLE +" USING GIST(AREA);");
}
} else {
LOGGER.info("Preparing temporary nodes table from coordinates...");
if (isH2) {
// If the tolerance is zero, we just put all points together
st.execute("CREATE TABLE "+ PTS_TABLE +"( "
+ "ID SERIAL PRIMARY KEY, "
+ "THE_GEOM POINT"
+ ") AS "
+ "SELECT NULL, START_POINT FROM "+ COORDS_TABLE
+ " UNION ALL "
+ "SELECT NULL, END_POINT FROM "+ COORDS_TABLE+";");
// Putting a spatial index on the points themselves...
st.execute("CREATE SPATIAL INDEX ON "+ PTS_TABLE +"(THE_GEOM);");
} else {
// If the tolerance is zero, we just put all points together
st.execute("CREATE TABLE "+ PTS_TABLE +"( "
+ "ID SERIAL PRIMARY KEY, "
+ "THE_GEOM GEOMETRY(POINT,"+srid+")"
+ ")");
st.execute("INSERT INTO "+ PTS_TABLE +" (SELECT (row_number() over())::int , a.the_geom FROM "
+ "(SELECT START_POINT as THE_GEOM FROM "+ COORDS_TABLE
+ " UNION ALL "
+ "SELECT END_POINT as THE_GEOM FROM "+ COORDS_TABLE+") as a);");
// Putting a spatial index on the points themselves...
st.execute("CREATE INDEX ON "+ PTS_TABLE + " USING GIST(THE_GEOM);");
}
}
} | [
"private",
"static",
"void",
"makeEnvelopes",
"(",
"Statement",
"st",
",",
"double",
"tolerance",
",",
"boolean",
"isH2",
",",
"int",
"srid",
")",
"throws",
"SQLException",
"{",
"st",
".",
"execute",
"(",
"\"DROP TABLE IF EXISTS\"",
"+",
"PTS_TABLE",
"+",
"\";... | Make a big table of all points in the coords table with an envelope around each point.
We will use this table to remove duplicate points. | [
"Make",
"a",
"big",
"table",
"of",
"all",
"points",
"in",
"the",
"coords",
"table",
"with",
"an",
"envelope",
"around",
"each",
"point",
".",
"We",
"will",
"use",
"this",
"table",
"to",
"remove",
"duplicate",
"points",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java#L390-L446 |
canoo/dolphin-platform | platform/dolphin-platform-remoting-common/src/main/java/com/canoo/dp/impl/remoting/legacy/core/ModelStoreConfig.java | ModelStoreConfig.ensurePowerOfTwo | private void ensurePowerOfTwo(String parameter, int number) {
if (Integer.bitCount(number) > 1) {
LOG.warn("Parameter {} should be power of two but was {}", parameter, number);
}
} | java | private void ensurePowerOfTwo(String parameter, int number) {
if (Integer.bitCount(number) > 1) {
LOG.warn("Parameter {} should be power of two but was {}", parameter, number);
}
} | [
"private",
"void",
"ensurePowerOfTwo",
"(",
"String",
"parameter",
",",
"int",
"number",
")",
"{",
"if",
"(",
"Integer",
".",
"bitCount",
"(",
"number",
")",
">",
"1",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Parameter {} should be power of two but was {}\"",
","... | all the capacities will be used to initialize HashMaps so they should be powers of two | [
"all",
"the",
"capacities",
"will",
"be",
"used",
"to",
"initialize",
"HashMaps",
"so",
"they",
"should",
"be",
"powers",
"of",
"two"
] | train | https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-common/src/main/java/com/canoo/dp/impl/remoting/legacy/core/ModelStoreConfig.java#L87-L91 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsync | public static <T1, T2, T3, T4, T5, T6, T7, T8> Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<Void>> toAsync(Action8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8> action) {
return toAsync(action, Schedulers.computation());
} | java | public static <T1, T2, T3, T4, T5, T6, T7, T8> Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<Void>> toAsync(Action8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8> action) {
return toAsync(action, Schedulers.computation());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
">",
"Func8",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
",",
"Observable",
"<",
"Voi... | Convert a synchronous action call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.an.png" alt="">
@param <T1> the first parameter type
@param <T2> the second parameter type
@param <T3> the third parameter type
@param <T4> the fourth parameter type
@param <T5> the fifth parameter type
@param <T6> the sixth parameter type
@param <T7> the seventh parameter type
@param <T8> the eighth parameter type
@param action the action to convert
@return a function that returns an Observable that executes the {@code action} and emits {@code null}
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh228993.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"action",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L590-L592 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.objLongConsumer | public static <T> ObjLongConsumer<T> objLongConsumer(CheckedObjLongConsumer<T> consumer, Consumer<Throwable> handler) {
return (t, u) -> {
try {
consumer.accept(t, u);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static <T> ObjLongConsumer<T> objLongConsumer(CheckedObjLongConsumer<T> consumer, Consumer<Throwable> handler) {
return (t, u) -> {
try {
consumer.accept(t, u);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"ObjLongConsumer",
"<",
"T",
">",
"objLongConsumer",
"(",
"CheckedObjLongConsumer",
"<",
"T",
">",
"consumer",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"(",
"t",
",",
"u",
")",
"->",
"{",
... | Wrap a {@link CheckedObjLongConsumer} in a {@link ObjLongConsumer} with a custom handler for checked exceptions. | [
"Wrap",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L276-L287 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.translationRotateMul | public Matrix4x3f translationRotateMul(float tx, float ty, float tz, float qx, float qy, float qz, float qw, Matrix4x3fc mat) {
float w2 = qw * qw;
float x2 = qx * qx;
float y2 = qy * qy;
float z2 = qz * qz;
float zw = qz * qw;
float xy = qx * qy;
float xz = qx * qz;
float yw = qy * qw;
float yz = qy * qz;
float xw = qx * qw;
float nm00 = w2 + x2 - z2 - y2;
float nm01 = xy + zw + zw + xy;
float nm02 = xz - yw + xz - yw;
float nm10 = -zw + xy - zw + xy;
float nm11 = y2 - z2 + w2 - x2;
float nm12 = yz + yz + xw + xw;
float nm20 = yw + xz + xz + yw;
float nm21 = yz + yz - xw - xw;
float nm22 = z2 - y2 - x2 + w2;
m00 = nm00 * mat.m00() + nm10 * mat.m01() + nm20 * mat.m02();
m01 = nm01 * mat.m00() + nm11 * mat.m01() + nm21 * mat.m02();
m02 = nm02 * mat.m00() + nm12 * mat.m01() + nm22 * mat.m02();
m10 = nm00 * mat.m10() + nm10 * mat.m11() + nm20 * mat.m12();
m11 = nm01 * mat.m10() + nm11 * mat.m11() + nm21 * mat.m12();
m12 = nm02 * mat.m10() + nm12 * mat.m11() + nm22 * mat.m12();
m20 = nm00 * mat.m20() + nm10 * mat.m21() + nm20 * mat.m22();
m21 = nm01 * mat.m20() + nm11 * mat.m21() + nm21 * mat.m22();
m22 = nm02 * mat.m20() + nm12 * mat.m21() + nm22 * mat.m22();
m30 = nm00 * mat.m30() + nm10 * mat.m31() + nm20 * mat.m32() + tx;
m31 = nm01 * mat.m30() + nm11 * mat.m31() + nm21 * mat.m32() + ty;
m32 = nm02 * mat.m30() + nm12 * mat.m31() + nm22 * mat.m32() + tz;
this.properties = 0;
return this;
} | java | public Matrix4x3f translationRotateMul(float tx, float ty, float tz, float qx, float qy, float qz, float qw, Matrix4x3fc mat) {
float w2 = qw * qw;
float x2 = qx * qx;
float y2 = qy * qy;
float z2 = qz * qz;
float zw = qz * qw;
float xy = qx * qy;
float xz = qx * qz;
float yw = qy * qw;
float yz = qy * qz;
float xw = qx * qw;
float nm00 = w2 + x2 - z2 - y2;
float nm01 = xy + zw + zw + xy;
float nm02 = xz - yw + xz - yw;
float nm10 = -zw + xy - zw + xy;
float nm11 = y2 - z2 + w2 - x2;
float nm12 = yz + yz + xw + xw;
float nm20 = yw + xz + xz + yw;
float nm21 = yz + yz - xw - xw;
float nm22 = z2 - y2 - x2 + w2;
m00 = nm00 * mat.m00() + nm10 * mat.m01() + nm20 * mat.m02();
m01 = nm01 * mat.m00() + nm11 * mat.m01() + nm21 * mat.m02();
m02 = nm02 * mat.m00() + nm12 * mat.m01() + nm22 * mat.m02();
m10 = nm00 * mat.m10() + nm10 * mat.m11() + nm20 * mat.m12();
m11 = nm01 * mat.m10() + nm11 * mat.m11() + nm21 * mat.m12();
m12 = nm02 * mat.m10() + nm12 * mat.m11() + nm22 * mat.m12();
m20 = nm00 * mat.m20() + nm10 * mat.m21() + nm20 * mat.m22();
m21 = nm01 * mat.m20() + nm11 * mat.m21() + nm21 * mat.m22();
m22 = nm02 * mat.m20() + nm12 * mat.m21() + nm22 * mat.m22();
m30 = nm00 * mat.m30() + nm10 * mat.m31() + nm20 * mat.m32() + tx;
m31 = nm01 * mat.m30() + nm11 * mat.m31() + nm21 * mat.m32() + ty;
m32 = nm02 * mat.m30() + nm12 * mat.m31() + nm22 * mat.m32() + tz;
this.properties = 0;
return this;
} | [
"public",
"Matrix4x3f",
"translationRotateMul",
"(",
"float",
"tx",
",",
"float",
"ty",
",",
"float",
"tz",
",",
"float",
"qx",
",",
"float",
"qy",
",",
"float",
"qz",
",",
"float",
"qw",
",",
"Matrix4x3fc",
"mat",
")",
"{",
"float",
"w2",
"=",
"qw",
... | Set <code>this</code> matrix to <code>T * R * M</code>, where <code>T</code> is a translation by the given <code>(tx, ty, tz)</code>,
<code>R</code> is a rotation - and possibly scaling - transformation specified by the quaternion <code>(qx, qy, qz, qw)</code> and <code>M</code> is the given matrix <code>mat</code>
<p>
When transforming a vector by the resulting matrix the transformation described by <code>M</code> will be applied first, then the scaling, then rotation and
at last the translation.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
This method is equivalent to calling: <code>translation(tx, ty, tz).rotate(quat).mul(mat)</code>
@see #translation(float, float, float)
@see #rotate(Quaternionfc)
@see #mul(Matrix4x3fc)
@param tx
the number of units by which to translate the x-component
@param ty
the number of units by which to translate the y-component
@param tz
the number of units by which to translate the z-component
@param qx
the x-coordinate of the vector part of the quaternion
@param qy
the y-coordinate of the vector part of the quaternion
@param qz
the z-coordinate of the vector part of the quaternion
@param qw
the scalar part of the quaternion
@param mat
the matrix to multiply with
@return this | [
"Set",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"to",
"<code",
">",
"T",
"*",
"R",
"*",
"M<",
"/",
"code",
">",
"where",
"<code",
">",
"T<",
"/",
"code",
">",
"is",
"a",
"translation",
"by",
"the",
"given",
"<code",
">",
"(",
"tx",
"t... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L2997-L3031 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java | XBaseGridScreen.printControlEndForm | public void printControlEndForm(PrintWriter out, int iPrintOptions)
{
BasePanel scrDetail = ((BaseGridScreen)this.getScreenField()).getReportDetail();
this.printHeadingFootingControls(out, iPrintOptions | HtmlConstants.FOOTING_SCREEN);
if (scrDetail != null)
{
scrDetail.printControl(out, iPrintOptions | HtmlConstants.DETAIL_SCREEN);
}
Record record = ((BaseGridScreen)this.getScreenField()).getMainRecord();
if (record != null)
out.println(Utility.endTag(XMLTags.DETAIL));
BasePanel scrFooting = ((BaseGridScreen)this.getScreenField()).getReportFooting();
if (scrFooting != null)
{
out.println(Utility.startTag(XMLTags.FOOTING));
scrFooting.printControl(out, iPrintOptions | HtmlConstants.FOOTING_SCREEN);
out.println(Utility.endTag(XMLTags.FOOTING));
}
super.printControlEndForm(out, iPrintOptions);
} | java | public void printControlEndForm(PrintWriter out, int iPrintOptions)
{
BasePanel scrDetail = ((BaseGridScreen)this.getScreenField()).getReportDetail();
this.printHeadingFootingControls(out, iPrintOptions | HtmlConstants.FOOTING_SCREEN);
if (scrDetail != null)
{
scrDetail.printControl(out, iPrintOptions | HtmlConstants.DETAIL_SCREEN);
}
Record record = ((BaseGridScreen)this.getScreenField()).getMainRecord();
if (record != null)
out.println(Utility.endTag(XMLTags.DETAIL));
BasePanel scrFooting = ((BaseGridScreen)this.getScreenField()).getReportFooting();
if (scrFooting != null)
{
out.println(Utility.startTag(XMLTags.FOOTING));
scrFooting.printControl(out, iPrintOptions | HtmlConstants.FOOTING_SCREEN);
out.println(Utility.endTag(XMLTags.FOOTING));
}
super.printControlEndForm(out, iPrintOptions);
} | [
"public",
"void",
"printControlEndForm",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"BasePanel",
"scrDetail",
"=",
"(",
"(",
"BaseGridScreen",
")",
"this",
".",
"getScreenField",
"(",
")",
")",
".",
"getReportDetail",
"(",
")",
";",
"t... | Display the start form in input format.
@param out The out stream.
@param iPrintOptions The view specific attributes. | [
"Display",
"the",
"start",
"form",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java#L117-L139 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/storage/types/DatastreamReferencedContent.java | DatastreamReferencedContent.getContentStream | @Override
public InputStream getContentStream(Context context) throws StreamIOException {
try {
ContentManagerParams params = new ContentManagerParams(DSLocation);
if (context != null ) {
params.setContext(context);
}
MIMETypedStream stream = getExternalContentManager()
.getExternalContent(params);
DSSize = getContentLength(stream);
return stream.getStream();
} catch (Exception ex) {
throw new StreamIOException("Error getting content stream", ex);
}
} | java | @Override
public InputStream getContentStream(Context context) throws StreamIOException {
try {
ContentManagerParams params = new ContentManagerParams(DSLocation);
if (context != null ) {
params.setContext(context);
}
MIMETypedStream stream = getExternalContentManager()
.getExternalContent(params);
DSSize = getContentLength(stream);
return stream.getStream();
} catch (Exception ex) {
throw new StreamIOException("Error getting content stream", ex);
}
} | [
"@",
"Override",
"public",
"InputStream",
"getContentStream",
"(",
"Context",
"context",
")",
"throws",
"StreamIOException",
"{",
"try",
"{",
"ContentManagerParams",
"params",
"=",
"new",
"ContentManagerParams",
"(",
"DSLocation",
")",
";",
"if",
"(",
"context",
"... | Gets an InputStream to the content of this externally-referenced
datastream.
<p>The DSLocation of this datastream must be non-null before invoking
this method.
<p>If successful, the DSMIME type is automatically set based on the web
server's response header. If the web server doesn't send a valid
Content-type: header, as a last resort, the content-type is guessed by
using a map of common extensions to mime-types.
<p>If the content-length header is present in the response, DSSize will
be set accordingly.
@see org.fcrepo.server.storage.types.Datastream#getContentStream() | [
"Gets",
"an",
"InputStream",
"to",
"the",
"content",
"of",
"this",
"externally",
"-",
"referenced",
"datastream",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/types/DatastreamReferencedContent.java#L84-L98 |
eyp/serfj | src/main/java/net/sf/serfj/RestServlet.java | RestServlet.service | @Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Eliminamos de la URI el contexto
String url = request.getRequestURI().substring(request.getContextPath().length());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("url => {}", url);
LOGGER.debug("HTTP_METHOD => {}", request.getMethod());
LOGGER.debug("queryString => {}", request.getQueryString());
LOGGER.debug("Context [{}]", request.getContextPath());
}
HttpMethod requestMethod = HttpMethod.valueOf(request.getMethod());
if (requestMethod == HttpMethod.POST) {
String httpMethodParam = request.getParameter(HTTP_METHOD_PARAM);
LOGGER.debug("param: http_method => {}", httpMethodParam);
if (httpMethodParam != null) {
requestMethod = HttpMethod.valueOf(httpMethodParam);
}
}
// Getting all the information from the URL
UrlInfo urlInfo = urlInspector.getUrlInfo(url, requestMethod);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("URL info {}", urlInfo.toString());
}
// Calling the controller's action
ResponseHelper responseHelper = new ResponseHelper(this.getServletContext(), request, response, urlInfo, config.getString(Config.VIEWS_DIRECTORY));
helper.invokeAction(urlInfo, responseHelper);
responseHelper.doResponse();
} | java | @Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Eliminamos de la URI el contexto
String url = request.getRequestURI().substring(request.getContextPath().length());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("url => {}", url);
LOGGER.debug("HTTP_METHOD => {}", request.getMethod());
LOGGER.debug("queryString => {}", request.getQueryString());
LOGGER.debug("Context [{}]", request.getContextPath());
}
HttpMethod requestMethod = HttpMethod.valueOf(request.getMethod());
if (requestMethod == HttpMethod.POST) {
String httpMethodParam = request.getParameter(HTTP_METHOD_PARAM);
LOGGER.debug("param: http_method => {}", httpMethodParam);
if (httpMethodParam != null) {
requestMethod = HttpMethod.valueOf(httpMethodParam);
}
}
// Getting all the information from the URL
UrlInfo urlInfo = urlInspector.getUrlInfo(url, requestMethod);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("URL info {}", urlInfo.toString());
}
// Calling the controller's action
ResponseHelper responseHelper = new ResponseHelper(this.getServletContext(), request, response, urlInfo, config.getString(Config.VIEWS_DIRECTORY));
helper.invokeAction(urlInfo, responseHelper);
responseHelper.doResponse();
} | [
"@",
"Override",
"protected",
"void",
"service",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"// Eliminamos de la URI el contexto",
"String",
"url",
"=",
"request",
".",
"getRe... | Parses the request to get information about what controller is trying to call, then
invoke the action from that controller (if any), and finally gives an answer.<br>
<br>
Basically it only dispatchs the request to a controller. | [
"Parses",
"the",
"request",
"to",
"get",
"information",
"about",
"what",
"controller",
"is",
"trying",
"to",
"call",
"then",
"invoke",
"the",
"action",
"from",
"that",
"controller",
"(",
"if",
"any",
")",
"and",
"finally",
"gives",
"an",
"answer",
".",
"<b... | train | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/RestServlet.java#L88-L116 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java | SimpleDocTreeVisitor.visitAttribute | @Override
public R visitAttribute(AttributeTree node, P p) {
return defaultAction(node, p);
} | java | @Override
public R visitAttribute(AttributeTree node, P p) {
return defaultAction(node, p);
} | [
"@",
"Override",
"public",
"R",
"visitAttribute",
"(",
"AttributeTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"node",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"calls",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L105-L108 |
btrplace/scheduler | api/src/main/java/org/btrplace/model/view/network/Network.java | Network.generateDot | public void generateDot(Model mo, String out, boolean fromLeftToRight) throws IOException {
try (BufferedWriter dot = new BufferedWriter(new FileWriter(out))) {
dot.append("digraph G {\n");
if (fromLeftToRight) {
dot.append("rankdir=LR;\n");
}
drawNodes(dot, NamingService.getNodeNames(mo));
drawSwitches(dot);
drawLinks(dot);
dot.append("}\n");
}
} | java | public void generateDot(Model mo, String out, boolean fromLeftToRight) throws IOException {
try (BufferedWriter dot = new BufferedWriter(new FileWriter(out))) {
dot.append("digraph G {\n");
if (fromLeftToRight) {
dot.append("rankdir=LR;\n");
}
drawNodes(dot, NamingService.getNodeNames(mo));
drawSwitches(dot);
drawLinks(dot);
dot.append("}\n");
}
} | [
"public",
"void",
"generateDot",
"(",
"Model",
"mo",
",",
"String",
"out",
",",
"boolean",
"fromLeftToRight",
")",
"throws",
"IOException",
"{",
"try",
"(",
"BufferedWriter",
"dot",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"out",
")",
")"... | Generate a dot file (diagram) of the current network infrastructure, included all connected elements and links.
@param mo the model to use, it may contains naming services for switches or nodes that will
replace the generic names mainly based on the id number.
@param out the output dot file to create
@param fromLeftToRight if true: force diagram's shapes to be placed side by side (create larger diagrams)
@throws IOException if an error occurred while writing | [
"Generate",
"a",
"dot",
"file",
"(",
"diagram",
")",
"of",
"the",
"current",
"network",
"infrastructure",
"included",
"all",
"connected",
"elements",
"and",
"links",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/network/Network.java#L313-L325 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/miner/DirectedRelationMiner.java | DirectedRelationMiner.writeResult | @Override
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out)
throws IOException
{
writeResultAsSIF(matches, out, true, getSourceLabel(), getTargetLabel());
} | java | @Override
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out)
throws IOException
{
writeResultAsSIF(matches, out, true, getSourceLabel(), getTargetLabel());
} | [
"@",
"Override",
"public",
"void",
"writeResult",
"(",
"Map",
"<",
"BioPAXElement",
",",
"List",
"<",
"Match",
">",
">",
"matches",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"writeResultAsSIF",
"(",
"matches",
",",
"out",
",",
"true",
... | Writes the result as "A B", where A and B are gene symbols, and whitespace is tab.
@param matches pattern search result
@param out output stream | [
"Writes",
"the",
"result",
"as",
"A",
"B",
"where",
"A",
"and",
"B",
"are",
"gene",
"symbols",
"and",
"whitespace",
"is",
"tab",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/DirectedRelationMiner.java#L63-L68 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/PathUtils.java | PathUtils.contains | @Trivial
private static boolean contains(String[] fileList, String fileName) {
if (fileList != null) {
for (String name : fileList) {
if (name.equals(fileName)) {
return true;
}
}
}
return false;
} | java | @Trivial
private static boolean contains(String[] fileList, String fileName) {
if (fileList != null) {
for (String name : fileList) {
if (name.equals(fileName)) {
return true;
}
}
}
return false;
} | [
"@",
"Trivial",
"private",
"static",
"boolean",
"contains",
"(",
"String",
"[",
"]",
"fileList",
",",
"String",
"fileName",
")",
"{",
"if",
"(",
"fileList",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"name",
":",
"fileList",
")",
"{",
"if",
"(",
"... | Tell if a file name is present in an array of file names. Test
file names using case sensitive {@link String#equals(Object)}.
The parameter file names collection is expected to be obtained from
a call to {@link File#list()}, which can return null.
@param fileNames The file names to test against. The array may
be null, but may not contain null elements.
@param fileName The file name to test. May be null.
@return True or false telling if the file name matches any of
the file names. False if the file names array is null. | [
"Tell",
"if",
"a",
"file",
"name",
"is",
"present",
"in",
"an",
"array",
"of",
"file",
"names",
".",
"Test",
"file",
"names",
"using",
"case",
"sensitive",
"{",
"@link",
"String#equals",
"(",
"Object",
")",
"}",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/PathUtils.java#L1442-L1453 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java | JDBC4CallableStatement.setBigDecimal | @Override
public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"void",
"setBigDecimal",
"(",
"String",
"parameterName",
",",
"BigDecimal",
"x",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
")",
";",
"}"
] | Sets the designated parameter to the given java.math.BigDecimal value. | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"java",
".",
"math",
".",
"BigDecimal",
"value",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L591-L596 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printDurationTimeUnits | public static final BigInteger printDurationTimeUnits(Duration duration, boolean estimated)
{
// SF-329: null default required to keep Powerproject happy when importing MSPDI files
TimeUnit units = duration == null ? PARENT_FILE.get().getProjectProperties().getDefaultDurationUnits() : duration.getUnits();
return printDurationTimeUnits(units, estimated);
} | java | public static final BigInteger printDurationTimeUnits(Duration duration, boolean estimated)
{
// SF-329: null default required to keep Powerproject happy when importing MSPDI files
TimeUnit units = duration == null ? PARENT_FILE.get().getProjectProperties().getDefaultDurationUnits() : duration.getUnits();
return printDurationTimeUnits(units, estimated);
} | [
"public",
"static",
"final",
"BigInteger",
"printDurationTimeUnits",
"(",
"Duration",
"duration",
",",
"boolean",
"estimated",
")",
"{",
"// SF-329: null default required to keep Powerproject happy when importing MSPDI files",
"TimeUnit",
"units",
"=",
"duration",
"==",
"null",... | Print duration time units.
@param duration Duration value
@param estimated is this an estimated duration
@return time units value | [
"Print",
"duration",
"time",
"units",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L994-L999 |
apache/incubator-gobblin | gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java | KafkaUtils.containsPartitionAvgRecordMillis | public static boolean containsPartitionAvgRecordMillis(State state, KafkaPartition partition) {
return state.contains(
getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS);
} | java | public static boolean containsPartitionAvgRecordMillis(State state, KafkaPartition partition) {
return state.contains(
getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS);
} | [
"public",
"static",
"boolean",
"containsPartitionAvgRecordMillis",
"(",
"State",
"state",
",",
"KafkaPartition",
"partition",
")",
"{",
"return",
"state",
".",
"contains",
"(",
"getPartitionPropName",
"(",
"partition",
".",
"getTopicName",
"(",
")",
",",
"partition"... | Determines whether the given {@link State} contains "[topicname].[partitionid].avg.record.millis". | [
"Determines",
"whether",
"the",
"given",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java#L137-L140 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraDefs.java | CassandraDefs.slicePredicateStartEndCol | static SlicePredicate slicePredicateStartEndCol(byte[] startColName, byte[] endColName, int count) {
if(startColName == null) startColName = EMPTY_BYTES;
if(endColName == null) endColName = EMPTY_BYTES;
SliceRange sliceRange =
new SliceRange(ByteBuffer.wrap(startColName), ByteBuffer.wrap(endColName), false, count);
SlicePredicate slicePred = new SlicePredicate();
slicePred.setSlice_range(sliceRange);
return slicePred;
} | java | static SlicePredicate slicePredicateStartEndCol(byte[] startColName, byte[] endColName, int count) {
if(startColName == null) startColName = EMPTY_BYTES;
if(endColName == null) endColName = EMPTY_BYTES;
SliceRange sliceRange =
new SliceRange(ByteBuffer.wrap(startColName), ByteBuffer.wrap(endColName), false, count);
SlicePredicate slicePred = new SlicePredicate();
slicePred.setSlice_range(sliceRange);
return slicePred;
} | [
"static",
"SlicePredicate",
"slicePredicateStartEndCol",
"(",
"byte",
"[",
"]",
"startColName",
",",
"byte",
"[",
"]",
"endColName",
",",
"int",
"count",
")",
"{",
"if",
"(",
"startColName",
"==",
"null",
")",
"startColName",
"=",
"EMPTY_BYTES",
";",
"if",
"... | Create a SlicePredicate that starts at the given column name, selecting up to
{@link #MAX_COLS_BATCH_SIZE} columns.
@param startColName Starting column name as a byte[].
@param endColName Ending column name as a byte[]
@return SlicePredicate that starts at the given starting column name,
ends at the given ending column name, selecting up to
{@link #MAX_COLS_BATCH_SIZE} columns. | [
"Create",
"a",
"SlicePredicate",
"that",
"starts",
"at",
"the",
"given",
"column",
"name",
"selecting",
"up",
"to",
"{",
"@link",
"#MAX_COLS_BATCH_SIZE",
"}",
"columns",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraDefs.java#L173-L181 |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.drawElevation | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected void drawElevation() {
float halfSize = getSize() / 2;
final int left = (int) (calculateCenterX() - halfSize);
final int top = (int) (calculateCenterY() - halfSize);
final int right = (int) (calculateCenterX() + halfSize);
final int bottom = (int) (calculateCenterY() + halfSize);
ViewOutlineProvider provider = new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(left, top, right, bottom);
}
};
setOutlineProvider(provider);
LOGGER.trace("Drawn the Action Button elevation");
} | java | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected void drawElevation() {
float halfSize = getSize() / 2;
final int left = (int) (calculateCenterX() - halfSize);
final int top = (int) (calculateCenterY() - halfSize);
final int right = (int) (calculateCenterX() + halfSize);
final int bottom = (int) (calculateCenterY() + halfSize);
ViewOutlineProvider provider = new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(left, top, right, bottom);
}
};
setOutlineProvider(provider);
LOGGER.trace("Drawn the Action Button elevation");
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"protected",
"void",
"drawElevation",
"(",
")",
"{",
"float",
"halfSize",
"=",
"getSize",
"(",
")",
"/",
"2",
";",
"final",
"int",
"left",
"=",
"(",
"int",
")",
"(",
"calculate... | Draws the elevation around the main circle
<p>
Stroke corrective is used due to ambiguity in drawing stroke in
combination with elevation enabled (for API 21 and higher only.
In such case there is no possibility to determine the accurate
<b>Action Button</b> size, so width and height must be corrected
<p>
This logic may be changed in future if the better solution is found | [
"Draws",
"the",
"elevation",
"around",
"the",
"main",
"circle",
"<p",
">",
"Stroke",
"corrective",
"is",
"used",
"due",
"to",
"ambiguity",
"in",
"drawing",
"stroke",
"in",
"combination",
"with",
"elevation",
"enabled",
"(",
"for",
"API",
"21",
"and",
"higher... | train | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L1545-L1560 |
stevespringett/Alpine | alpine/src/main/java/alpine/tasks/AlpineTaskScheduler.java | AlpineTaskScheduler.scheduleEvent | protected void scheduleEvent(final Event event, final long delay, final long period) {
final Timer timer = new Timer();
timer.schedule(new ScheduleEvent().event(event), delay, period);
timers.add(timer);
} | java | protected void scheduleEvent(final Event event, final long delay, final long period) {
final Timer timer = new Timer();
timer.schedule(new ScheduleEvent().event(event), delay, period);
timers.add(timer);
} | [
"protected",
"void",
"scheduleEvent",
"(",
"final",
"Event",
"event",
",",
"final",
"long",
"delay",
",",
"final",
"long",
"period",
")",
"{",
"final",
"Timer",
"timer",
"=",
"new",
"Timer",
"(",
")",
";",
"timer",
".",
"schedule",
"(",
"new",
"ScheduleE... | Schedules a repeating Event.
@param event the Event to schedule
@param delay delay in milliseconds before task is to be executed.
@param period time in milliseconds between successive task executions. | [
"Schedules",
"a",
"repeating",
"Event",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/tasks/AlpineTaskScheduler.java#L46-L50 |
apache/incubator-heron | heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/CacheCore.java | CacheCore.getExceptions | public ExceptionResponse getExceptions(
ExceptionRequest request) {
synchronized (CacheCore.class) {
List<ExceptionDatum> response = new ArrayList<>();
Map<String, Set<String>> componentNameInstanceId = request.getComponentNameInstanceId();
// candidate component names
Set<String> componentNameFilter;
if (componentNameInstanceId == null) {
componentNameFilter = idxComponentInstance.keySet();
} else {
componentNameFilter = componentNameInstanceId.keySet();
}
for (String componentName : componentNameFilter) {
// candidate instance ids
Set<String> instanceIdFilter;
if (componentNameInstanceId == null
|| componentNameInstanceId.get(componentName) == null) {
instanceIdFilter = idxComponentInstance.get(componentName).keySet();
} else {
instanceIdFilter = componentNameInstanceId.get(componentName);
}
for (String instanceId : instanceIdFilter) {
int idx = idxComponentInstance.get(componentName).get(instanceId);
for (ExceptionDatapoint exceptionDatapoint : cacheException.get(idx)) {
response.add(new ExceptionDatum(componentName, instanceId, exceptionDatapoint));
}
}
}
return new ExceptionResponse(response);
}
} | java | public ExceptionResponse getExceptions(
ExceptionRequest request) {
synchronized (CacheCore.class) {
List<ExceptionDatum> response = new ArrayList<>();
Map<String, Set<String>> componentNameInstanceId = request.getComponentNameInstanceId();
// candidate component names
Set<String> componentNameFilter;
if (componentNameInstanceId == null) {
componentNameFilter = idxComponentInstance.keySet();
} else {
componentNameFilter = componentNameInstanceId.keySet();
}
for (String componentName : componentNameFilter) {
// candidate instance ids
Set<String> instanceIdFilter;
if (componentNameInstanceId == null
|| componentNameInstanceId.get(componentName) == null) {
instanceIdFilter = idxComponentInstance.get(componentName).keySet();
} else {
instanceIdFilter = componentNameInstanceId.get(componentName);
}
for (String instanceId : instanceIdFilter) {
int idx = idxComponentInstance.get(componentName).get(instanceId);
for (ExceptionDatapoint exceptionDatapoint : cacheException.get(idx)) {
response.add(new ExceptionDatum(componentName, instanceId, exceptionDatapoint));
}
}
}
return new ExceptionResponse(response);
}
} | [
"public",
"ExceptionResponse",
"getExceptions",
"(",
"ExceptionRequest",
"request",
")",
"{",
"synchronized",
"(",
"CacheCore",
".",
"class",
")",
"{",
"List",
"<",
"ExceptionDatum",
">",
"response",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Map",
"<",
... | for internal process use
@param request <p>
idxComponentInstance == null: query all components
idxComponentInstance == []: query none component
idxComponentInstance == [c1->null, ..]: query all instances of c1, ..
idxComponentInstance == [c1->[], ..]: query none instance of c1, ..
idxComponentInstance == [c1->[a, b, c, ..], ..]: query instance a, b, c, .. of c1, ..
@return query result | [
"for",
"internal",
"process",
"use"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/CacheCore.java#L459-L494 |
Impetus/Kundera | src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/util/PropertyReader.java | PropertyReader.getProperties | private static Map<String, String> getProperties(String fileName)
{
if (kunderaBlockchainProps == null || kunderaBlockchainProps.isEmpty())
{
Configuration config = null;
try
{
config = new PropertiesConfiguration(fileName);
}
catch (ConfigurationException ce)
{
LOGGER.error("Not able to load properties from " + fileName + " file. ", ce);
throw new KunderaException("Not able to load properties from " + fileName + " file. ", ce);
}
kunderaBlockchainProps = (Map) ConfigurationConverter.getProperties(config);
LOGGER.info("Properties loaded from " + fileName + " file. Properties: " + kunderaBlockchainProps);
}
return kunderaBlockchainProps;
} | java | private static Map<String, String> getProperties(String fileName)
{
if (kunderaBlockchainProps == null || kunderaBlockchainProps.isEmpty())
{
Configuration config = null;
try
{
config = new PropertiesConfiguration(fileName);
}
catch (ConfigurationException ce)
{
LOGGER.error("Not able to load properties from " + fileName + " file. ", ce);
throw new KunderaException("Not able to load properties from " + fileName + " file. ", ce);
}
kunderaBlockchainProps = (Map) ConfigurationConverter.getProperties(config);
LOGGER.info("Properties loaded from " + fileName + " file. Properties: " + kunderaBlockchainProps);
}
return kunderaBlockchainProps;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getProperties",
"(",
"String",
"fileName",
")",
"{",
"if",
"(",
"kunderaBlockchainProps",
"==",
"null",
"||",
"kunderaBlockchainProps",
".",
"isEmpty",
"(",
")",
")",
"{",
"Configuration",
"config... | Gets the properties.
@param fileName
the file name
@return the properties | [
"Gets",
"the",
"properties",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/util/PropertyReader.java#L61-L80 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/Vector2f.java | Vector2f.projectOntoUnit | public void projectOntoUnit(Vector2f b, Vector2f result) {
float dp = b.dot(this);
result.x = dp * b.getX();
result.y = dp * b.getY();
} | java | public void projectOntoUnit(Vector2f b, Vector2f result) {
float dp = b.dot(this);
result.x = dp * b.getX();
result.y = dp * b.getY();
} | [
"public",
"void",
"projectOntoUnit",
"(",
"Vector2f",
"b",
",",
"Vector2f",
"result",
")",
"{",
"float",
"dp",
"=",
"b",
".",
"dot",
"(",
"this",
")",
";",
"result",
".",
"x",
"=",
"dp",
"*",
"b",
".",
"getX",
"(",
")",
";",
"result",
".",
"y",
... | Project this vector onto another
@param b The vector to project onto
@param result The projected vector | [
"Project",
"this",
"vector",
"onto",
"another"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Vector2f.java#L329-L335 |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EntityStatisticsProcessor.java | EntityStatisticsProcessor.countKey | private void countKey(Map<String, Integer> map, String key, int count) {
if (map.containsKey(key)) {
map.put(key, map.get(key) + count);
} else {
map.put(key, count);
}
} | java | private void countKey(Map<String, Integer> map, String key, int count) {
if (map.containsKey(key)) {
map.put(key, map.get(key) + count);
} else {
map.put(key, count);
}
} | [
"private",
"void",
"countKey",
"(",
"Map",
"<",
"String",
",",
"Integer",
">",
"map",
",",
"String",
"key",
",",
"int",
"count",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"map",
".",
"put",
"(",
"key",
",",
"map",... | Helper method that stores in a hash map how often a certain key occurs.
If the key has not been encountered yet, a new entry is created for it in
the map. Otherwise the existing value for the key is incremented.
@param map
the map where the counts are stored
@param key
the key to be counted
@param count
value by which the count should be incremented; 1 is the usual
case | [
"Helper",
"method",
"that",
"stores",
"in",
"a",
"hash",
"map",
"how",
"often",
"a",
"certain",
"key",
"occurs",
".",
"If",
"the",
"key",
"has",
"not",
"been",
"encountered",
"yet",
"a",
"new",
"entry",
"is",
"created",
"for",
"it",
"in",
"the",
"map",... | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/EntityStatisticsProcessor.java#L441-L447 |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/TaggedConverter.java | TaggedConverter.addConverters | public void addConverters(Converter converter, String... tags) {
for (String tag : tags) {
if (tag.startsWith("!")) {
notConverters.put(tag.substring(1), converter);
} else {
converters.put(tag, converter);
}
}
} | java | public void addConverters(Converter converter, String... tags) {
for (String tag : tags) {
if (tag.startsWith("!")) {
notConverters.put(tag.substring(1), converter);
} else {
converters.put(tag, converter);
}
}
} | [
"public",
"void",
"addConverters",
"(",
"Converter",
"converter",
",",
"String",
"...",
"tags",
")",
"{",
"for",
"(",
"String",
"tag",
":",
"tags",
")",
"{",
"if",
"(",
"tag",
".",
"startsWith",
"(",
"\"!\"",
")",
")",
"{",
"notConverters",
".",
"put",... | Add the converter which should be used for a specific tag.
@param tags tags for which the converter applies
@param converter converter for the tag | [
"Add",
"the",
"converter",
"which",
"should",
"be",
"used",
"for",
"a",
"specific",
"tag",
"."
] | train | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/TaggedConverter.java#L34-L42 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java | CommsUtils.getRuntimeProperty | public static String getRuntimeProperty(String property, String defaultValue)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeProperty", new Object[] {property, defaultValue});
String runtimeProp = RuntimeInfo.getPropertyWithMsg(property, defaultValue);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeProperty", runtimeProp);
return runtimeProp;
} | java | public static String getRuntimeProperty(String property, String defaultValue)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeProperty", new Object[] {property, defaultValue});
String runtimeProp = RuntimeInfo.getPropertyWithMsg(property, defaultValue);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeProperty", runtimeProp);
return runtimeProp;
} | [
"public",
"static",
"String",
"getRuntimeProperty",
"(",
"String",
"property",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
... | This method will get a runtime property from the sib.properties file.
@param property The property key used to look up in the file.
@param defaultValue The default value if the property is not in the file.
@return Returns the property value. | [
"This",
"method",
"will",
"get",
"a",
"runtime",
"property",
"from",
"the",
"sib",
".",
"properties",
"file",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java#L59-L68 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/UserData.java | UserData.addAttributeShort | private final void addAttributeShort(String key, String value) {
this._toString = null; // reset toString variable
ArrayList<String> array = this._attributes.get(key);
if (array != null) {
if (array.size() > 0) {
if (key.equals("u")) {
return;
}
}
} else {
array = new ArrayList<String>();
this._attributes.put(key, array);
}
// Add the String to the array list
array.add(value);
} | java | private final void addAttributeShort(String key, String value) {
this._toString = null; // reset toString variable
ArrayList<String> array = this._attributes.get(key);
if (array != null) {
if (array.size() > 0) {
if (key.equals("u")) {
return;
}
}
} else {
array = new ArrayList<String>();
this._attributes.put(key, array);
}
// Add the String to the array list
array.add(value);
} | [
"private",
"final",
"void",
"addAttributeShort",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"_toString",
"=",
"null",
";",
"// reset toString variable",
"ArrayList",
"<",
"String",
">",
"array",
"=",
"this",
".",
"_attributes",
".",
... | Add the attribute name/value pair to a String[] list of values for
the specified key. Once an attribute is set, it cannot only be
appended to but not overwritten. This method does not return any
values.
@param key The name of a attribute
@param value The value of the attribute | [
"Add",
"the",
"attribute",
"name",
"/",
"value",
"pair",
"to",
"a",
"String",
"[]",
"list",
"of",
"values",
"for",
"the",
"specified",
"key",
".",
"Once",
"an",
"attribute",
"is",
"set",
"it",
"cannot",
"only",
"be",
"appended",
"to",
"but",
"not",
"ov... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.token.ltpa/src/com/ibm/ws/security/token/ltpa/internal/UserData.java#L124-L139 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.checkItemStatus | public boolean checkItemStatus(String listId, Integer mediaId) throws MovieDbException {
return tmdbList.checkItemStatus(listId, mediaId);
} | java | public boolean checkItemStatus(String listId, Integer mediaId) throws MovieDbException {
return tmdbList.checkItemStatus(listId, mediaId);
} | [
"public",
"boolean",
"checkItemStatus",
"(",
"String",
"listId",
",",
"Integer",
"mediaId",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbList",
".",
"checkItemStatus",
"(",
"listId",
",",
"mediaId",
")",
";",
"}"
] | Check to see if an item is already on a list.
@param listId listId
@param mediaId mediaId
@return true if the item is on the list
@throws MovieDbException exception | [
"Check",
"to",
"see",
"if",
"an",
"item",
"is",
"already",
"on",
"a",
"list",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L800-L802 |
square/phrase | src/main/java/com/squareup/phrase/Phrase.java | Phrase.fromPlural | public static Phrase fromPlural(Resources r, @PluralsRes int patternResourceId, int quantity) {
return from(r.getQuantityText(patternResourceId, quantity));
} | java | public static Phrase fromPlural(Resources r, @PluralsRes int patternResourceId, int quantity) {
return from(r.getQuantityText(patternResourceId, quantity));
} | [
"public",
"static",
"Phrase",
"fromPlural",
"(",
"Resources",
"r",
",",
"@",
"PluralsRes",
"int",
"patternResourceId",
",",
"int",
"quantity",
")",
"{",
"return",
"from",
"(",
"r",
".",
"getQuantityText",
"(",
"patternResourceId",
",",
"quantity",
")",
")",
... | Entry point into this API.
@throws IllegalArgumentException if pattern contains any syntax errors. | [
"Entry",
"point",
"into",
"this",
"API",
"."
] | train | https://github.com/square/phrase/blob/d91f18e80790832db11b811c462f8e5cd492d97e/src/main/java/com/squareup/phrase/Phrase.java#L132-L134 |
elki-project/elki | addons/tutorial/src/main/java/tutorial/clustering/SameSizeKMeansAlgorithm.java | SameSizeKMeansAlgorithm.updateDistances | protected void updateDistances(Relation<V> relation, double[][] means, final WritableDataStore<Meta> metas, NumberVectorDistanceFunction<? super V> df) {
for(DBIDIter id = relation.iterDBIDs(); id.valid(); id.advance()) {
Meta c = metas.get(id);
V fv = relation.get(id);
// Update distances to means.
c.secondary = -1;
for(int i = 0; i < k; i++) {
c.dists[i] = df.distance(fv, DoubleVector.wrap(means[i]));
if(c.primary != i) {
if(c.secondary < 0 || c.dists[i] < c.dists[c.secondary]) {
c.secondary = i;
}
}
}
metas.put(id, c); // Changed.
}
} | java | protected void updateDistances(Relation<V> relation, double[][] means, final WritableDataStore<Meta> metas, NumberVectorDistanceFunction<? super V> df) {
for(DBIDIter id = relation.iterDBIDs(); id.valid(); id.advance()) {
Meta c = metas.get(id);
V fv = relation.get(id);
// Update distances to means.
c.secondary = -1;
for(int i = 0; i < k; i++) {
c.dists[i] = df.distance(fv, DoubleVector.wrap(means[i]));
if(c.primary != i) {
if(c.secondary < 0 || c.dists[i] < c.dists[c.secondary]) {
c.secondary = i;
}
}
}
metas.put(id, c); // Changed.
}
} | [
"protected",
"void",
"updateDistances",
"(",
"Relation",
"<",
"V",
">",
"relation",
",",
"double",
"[",
"]",
"[",
"]",
"means",
",",
"final",
"WritableDataStore",
"<",
"Meta",
">",
"metas",
",",
"NumberVectorDistanceFunction",
"<",
"?",
"super",
"V",
">",
... | Compute the distances of each object to all means. Update
{@link Meta#secondary} to point to the best cluster number except the
current cluster assignment
@param relation Data relation
@param means Means
@param metas Metadata storage
@param df Distance function | [
"Compute",
"the",
"distances",
"of",
"each",
"object",
"to",
"all",
"means",
".",
"Update",
"{",
"@link",
"Meta#secondary",
"}",
"to",
"point",
"to",
"the",
"best",
"cluster",
"number",
"except",
"the",
"current",
"cluster",
"assignment"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/tutorial/src/main/java/tutorial/clustering/SameSizeKMeansAlgorithm.java#L232-L248 |
rundeck/rundeck | core/src/main/java/com/dtolabs/utils/Mapper.java | Mapper.mapValues | public static Map mapValues(Mapper mapper, Map map, boolean includeNull) {
HashMap h = new HashMap();
for (Object e : map.keySet()) {
Map.Entry entry = (Map.Entry) e;
Object v = entry.getValue();
Object o = mapper.map(v);
if (includeNull || o != null) {
h.put(entry.getKey(), o);
}
}
return h;
} | java | public static Map mapValues(Mapper mapper, Map map, boolean includeNull) {
HashMap h = new HashMap();
for (Object e : map.keySet()) {
Map.Entry entry = (Map.Entry) e;
Object v = entry.getValue();
Object o = mapper.map(v);
if (includeNull || o != null) {
h.put(entry.getKey(), o);
}
}
return h;
} | [
"public",
"static",
"Map",
"mapValues",
"(",
"Mapper",
"mapper",
",",
"Map",
"map",
",",
"boolean",
"includeNull",
")",
"{",
"HashMap",
"h",
"=",
"new",
"HashMap",
"(",
")",
";",
"for",
"(",
"Object",
"e",
":",
"map",
".",
"keySet",
"(",
")",
")",
... | Create a new Map by mapping all values from the original map and maintaining the original key.
@param mapper a Mapper to map the values
@param map an Map
@param includeNull true to include null
@return a new Map with values mapped | [
"Create",
"a",
"new",
"Map",
"by",
"mapping",
"all",
"values",
"from",
"the",
"original",
"map",
"and",
"maintaining",
"the",
"original",
"key",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L427-L438 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/fingerprint/FingerprinterTool.java | FingerprinterTool.makeBitFingerprint | public static IBitFingerprint makeBitFingerprint(final Map<String,Integer> features, int len, int bits) {
final BitSetFingerprint fingerprint = new BitSetFingerprint(len);
final Random rand = new Random();
for (String feature : features.keySet()) {
int hash = feature.hashCode();
fingerprint.set(Math.abs(hash % len));
for (int i = 1; i < bits; i++) {
rand.setSeed(hash);
fingerprint.set(hash = rand.nextInt(len));
}
}
return fingerprint;
} | java | public static IBitFingerprint makeBitFingerprint(final Map<String,Integer> features, int len, int bits) {
final BitSetFingerprint fingerprint = new BitSetFingerprint(len);
final Random rand = new Random();
for (String feature : features.keySet()) {
int hash = feature.hashCode();
fingerprint.set(Math.abs(hash % len));
for (int i = 1; i < bits; i++) {
rand.setSeed(hash);
fingerprint.set(hash = rand.nextInt(len));
}
}
return fingerprint;
} | [
"public",
"static",
"IBitFingerprint",
"makeBitFingerprint",
"(",
"final",
"Map",
"<",
"String",
",",
"Integer",
">",
"features",
",",
"int",
"len",
",",
"int",
"bits",
")",
"{",
"final",
"BitSetFingerprint",
"fingerprint",
"=",
"new",
"BitSetFingerprint",
"(",
... | Convert a mapping of features and their counts to a binary fingerprint. Each feature
can set 1-n hashes, the amount is modified by the {@code bits} operand.
@param features features to include
@param len fingerprint length
@param bits number of bits to set for each pattern
@return the continuous fingerprint | [
"Convert",
"a",
"mapping",
"of",
"features",
"and",
"their",
"counts",
"to",
"a",
"binary",
"fingerprint",
".",
"Each",
"feature",
"can",
"set",
"1",
"-",
"n",
"hashes",
"the",
"amount",
"is",
"modified",
"by",
"the",
"{",
"@code",
"bits",
"}",
"operand"... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/fingerprint/FingerprinterTool.java#L157-L169 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/Validate.java | Validate.isFalse | public static void isFalse(final boolean expression, final String message, final Object... values) {
INSTANCE.isFalse(expression, message, values);
} | java | public static void isFalse(final boolean expression, final String message, final Object... values) {
INSTANCE.isFalse(expression, message, values);
} | [
"public",
"static",
"void",
"isFalse",
"(",
"final",
"boolean",
"expression",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"INSTANCE",
".",
"isFalse",
"(",
"expression",
",",
"message",
",",
"values",
")",
";",
"}"
... | <p>Validate that the argument condition is {@code false}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean
expression, such as validating a primitive number or using your own custom validation expression.</p>
@param expression
the boolean expression to check
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@throws IllegalArgumentValidationException
if expression is {@code true}
@see #isFalse(boolean)
@see #isFalse(boolean, String, long)
@see #isFalse(boolean, String, double) | [
"<p",
">",
"Validate",
"that",
"the",
"argument",
"condition",
"is",
"{",
"@code",
"false",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L624-L626 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/cache/ConfigCache.java | ConfigCache.getProperty | private TypeContainer getProperty(String propName) {
TypeContainer container = cache.get(propName);
if (container == null) {
container = new TypeContainer(propName, config, version);
TypeContainer existing = cache.putIfAbsent(propName, container);
if (existing != null) {
return existing;
}
}
return container;
} | java | private TypeContainer getProperty(String propName) {
TypeContainer container = cache.get(propName);
if (container == null) {
container = new TypeContainer(propName, config, version);
TypeContainer existing = cache.putIfAbsent(propName, container);
if (existing != null) {
return existing;
}
}
return container;
} | [
"private",
"TypeContainer",
"getProperty",
"(",
"String",
"propName",
")",
"{",
"TypeContainer",
"container",
"=",
"cache",
".",
"get",
"(",
"propName",
")",
";",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"container",
"=",
"new",
"TypeContainer",
"(",
... | Gets the cached property container or make a new one, cache it and return it
@param propName
@return the property's container | [
"Gets",
"the",
"cached",
"property",
"container",
"or",
"make",
"a",
"new",
"one",
"cache",
"it",
"and",
"return",
"it"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/cache/ConfigCache.java#L63-L74 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArrayCOO.java | BaseSparseNDArrayCOO.createIndiceBuffer | protected static DataBuffer createIndiceBuffer(long[][] indices, long[] shape){
checkNotNull(indices);
checkNotNull(shape);
if(indices.length == 0){
return Nd4j.getDataBufferFactory().createLong(shape.length);
}
if (indices.length == shape.length) {
return Nd4j.createBuffer(ArrayUtil.flattenF(indices));
}
return Nd4j.createBuffer(ArrayUtil.flatten(indices));
} | java | protected static DataBuffer createIndiceBuffer(long[][] indices, long[] shape){
checkNotNull(indices);
checkNotNull(shape);
if(indices.length == 0){
return Nd4j.getDataBufferFactory().createLong(shape.length);
}
if (indices.length == shape.length) {
return Nd4j.createBuffer(ArrayUtil.flattenF(indices));
}
return Nd4j.createBuffer(ArrayUtil.flatten(indices));
} | [
"protected",
"static",
"DataBuffer",
"createIndiceBuffer",
"(",
"long",
"[",
"]",
"[",
"]",
"indices",
",",
"long",
"[",
"]",
"shape",
")",
"{",
"checkNotNull",
"(",
"indices",
")",
";",
"checkNotNull",
"(",
"shape",
")",
";",
"if",
"(",
"indices",
".",
... | Create a DataBuffer for indices of given arrays of indices.
@param indices
@param shape
@return | [
"Create",
"a",
"DataBuffer",
"for",
"indices",
"of",
"given",
"arrays",
"of",
"indices",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArrayCOO.java#L202-L214 |
dyu/protostuff-1.0.x | protostuff-yaml/src/main/java/com/dyuproject/protostuff/YamlIOUtil.java | YamlIOUtil.writeListTo | public static <T> int writeListTo(OutputStream out, List<T> messages,
Schema<T> schema, LinkedBuffer buffer) throws IOException
{
if(buffer.start != buffer.offset)
throw new IllegalArgumentException("Buffer previously used and had not been reset.");
final YamlOutput output = new YamlOutput(buffer, out, schema);
output.tail = YamlOutput.writeTag(
schema.messageName(),
true,
output.sink,
output,
output.sink.writeByteArray(
START_DIRECTIVE,
output,
buffer));
for(T m : messages)
{
schema.writeTo(output.writeSequenceDelim(), m);
LinkedBuffer.writeTo(out, buffer);
output.clear(true, false);
}
return output.getSize();
} | java | public static <T> int writeListTo(OutputStream out, List<T> messages,
Schema<T> schema, LinkedBuffer buffer) throws IOException
{
if(buffer.start != buffer.offset)
throw new IllegalArgumentException("Buffer previously used and had not been reset.");
final YamlOutput output = new YamlOutput(buffer, out, schema);
output.tail = YamlOutput.writeTag(
schema.messageName(),
true,
output.sink,
output,
output.sink.writeByteArray(
START_DIRECTIVE,
output,
buffer));
for(T m : messages)
{
schema.writeTo(output.writeSequenceDelim(), m);
LinkedBuffer.writeTo(out, buffer);
output.clear(true, false);
}
return output.getSize();
} | [
"public",
"static",
"<",
"T",
">",
"int",
"writeListTo",
"(",
"OutputStream",
"out",
",",
"List",
"<",
"T",
">",
"messages",
",",
"Schema",
"<",
"T",
">",
"schema",
",",
"LinkedBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
... | Serializes the {@code messages} into an {@link OutputStream}
using the given schema with the supplied buffer.
@return the total bytes written to the output. | [
"Serializes",
"the",
"{",
"@code",
"messages",
"}",
"into",
"an",
"{",
"@link",
"OutputStream",
"}",
"using",
"the",
"given",
"schema",
"with",
"the",
"supplied",
"buffer",
"."
] | train | https://github.com/dyu/protostuff-1.0.x/blob/d7c964ec20da3fe44699d86ee95c2677ddffde96/protostuff-yaml/src/main/java/com/dyuproject/protostuff/YamlIOUtil.java#L181-L207 |
jroyalty/jglm | src/main/java/com/hackoeur/jglm/support/Precision.java | Precision.equalsIncludingNaN | public static boolean equalsIncludingNaN(double x, double y, double eps) {
return equalsIncludingNaN(x, y) || (FastMath.abs(y - x) <= eps);
} | java | public static boolean equalsIncludingNaN(double x, double y, double eps) {
return equalsIncludingNaN(x, y) || (FastMath.abs(y - x) <= eps);
} | [
"public",
"static",
"boolean",
"equalsIncludingNaN",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"eps",
")",
"{",
"return",
"equalsIncludingNaN",
"(",
"x",
",",
"y",
")",
"||",
"(",
"FastMath",
".",
"abs",
"(",
"y",
"-",
"x",
")",
"<=",
"e... | Returns true if both arguments are NaN or are equal or within the range
of allowed error (inclusive).
@param x first value
@param y second value
@param eps the amount of absolute error to allow.
@return {@code true} if the values are equal or within range of each other,
or both are NaN.
@since 2.2 | [
"Returns",
"true",
"if",
"both",
"arguments",
"are",
"NaN",
"or",
"are",
"equal",
"or",
"within",
"the",
"range",
"of",
"allowed",
"error",
"(",
"inclusive",
")",
"."
] | train | https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/Precision.java#L325-L327 |
alkacon/opencms-core | src/org/opencms/lock/CmsLockManager.java | CmsLockManager.removeDeletedResource | public void removeDeletedResource(CmsDbContext dbc, String resourceName) throws CmsException {
try {
m_driverManager.getVfsDriver(dbc).readResource(dbc, dbc.currentProject().getUuid(), resourceName, false);
throw new CmsLockException(
Messages.get().container(
Messages.ERR_REMOVING_UNDELETED_RESOURCE_1,
dbc.getRequestContext().removeSiteRoot(resourceName)));
} catch (CmsVfsResourceNotFoundException e) {
// ok, ignore
}
unlockResource(resourceName, true);
unlockResource(resourceName, false);
} | java | public void removeDeletedResource(CmsDbContext dbc, String resourceName) throws CmsException {
try {
m_driverManager.getVfsDriver(dbc).readResource(dbc, dbc.currentProject().getUuid(), resourceName, false);
throw new CmsLockException(
Messages.get().container(
Messages.ERR_REMOVING_UNDELETED_RESOURCE_1,
dbc.getRequestContext().removeSiteRoot(resourceName)));
} catch (CmsVfsResourceNotFoundException e) {
// ok, ignore
}
unlockResource(resourceName, true);
unlockResource(resourceName, false);
} | [
"public",
"void",
"removeDeletedResource",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"resourceName",
")",
"throws",
"CmsException",
"{",
"try",
"{",
"m_driverManager",
".",
"getVfsDriver",
"(",
"dbc",
")",
".",
"readResource",
"(",
"dbc",
",",
"dbc",
".",
"cu... | Removes a resource after it has been deleted by the driver manager.<p>
@param dbc the current database context
@param resourceName the root path of the deleted resource
@throws CmsException if something goes wrong | [
"Removes",
"a",
"resource",
"after",
"it",
"has",
"been",
"deleted",
"by",
"the",
"driver",
"manager",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/lock/CmsLockManager.java#L498-L511 |
windup/windup | rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/JmsDestinationService.java | JmsDestinationService.createUnique | public JmsDestinationModel createUnique(Set<ProjectModel> applications, String jndiName, JmsDestinationType destinationType)
{
JmsDestinationModel model = createUnique(applications, jndiName);
model.setDestinationType(destinationType);
return model;
} | java | public JmsDestinationModel createUnique(Set<ProjectModel> applications, String jndiName, JmsDestinationType destinationType)
{
JmsDestinationModel model = createUnique(applications, jndiName);
model.setDestinationType(destinationType);
return model;
} | [
"public",
"JmsDestinationModel",
"createUnique",
"(",
"Set",
"<",
"ProjectModel",
">",
"applications",
",",
"String",
"jndiName",
",",
"JmsDestinationType",
"destinationType",
")",
"{",
"JmsDestinationModel",
"model",
"=",
"createUnique",
"(",
"applications",
",",
"jn... | Creates a new instance with the given name, or converts an existing instance at this location if one already exists | [
"Creates",
"a",
"new",
"instance",
"with",
"the",
"given",
"name",
"or",
"converts",
"an",
"existing",
"instance",
"at",
"this",
"location",
"if",
"one",
"already",
"exists"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/JmsDestinationService.java#L45-L51 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/JobApi.java | JobApi.downloadSingleArtifactsFile | public InputStream downloadSingleArtifactsFile(Object projectIdOrPath, Integer jobId, Path artifactPath) throws GitLabApiException {
String path = artifactPath.toString().replace("\\", "/");
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path);
return (response.readEntity(InputStream.class));
} | java | public InputStream downloadSingleArtifactsFile(Object projectIdOrPath, Integer jobId, Path artifactPath) throws GitLabApiException {
String path = artifactPath.toString().replace("\\", "/");
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "artifacts", path);
return (response.readEntity(InputStream.class));
} | [
"public",
"InputStream",
"downloadSingleArtifactsFile",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"jobId",
",",
"Path",
"artifactPath",
")",
"throws",
"GitLabApiException",
"{",
"String",
"path",
"=",
"artifactPath",
".",
"toString",
"(",
")",
".",
"replace"... | Download a single artifact file from within the job's artifacts archive.
Only a single file is going to be extracted from the archive and streamed to a client.
<pre><code>GitLab Endpoint: GET /projects/:id/jobs/:job_id/artifacts/*artifact_path</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param jobId the unique job identifier
@param artifactPath the Path to a file inside the artifacts archive
@return an InputStream to read the specified artifacts file from
@throws GitLabApiException if any exception occurs | [
"Download",
"a",
"single",
"artifact",
"file",
"from",
"within",
"the",
"job",
"s",
"artifacts",
"archive",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/JobApi.java#L407-L412 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/api/ContentServiceV1.java | ContentServiceV1.listCommits | @Get("regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/commits(?<revision>(|/.*))$")
public CompletableFuture<?> listCommits(@Param("revision") String revision,
@Param("path") @Default("/**") String path,
@Param("to") Optional<String> to,
@Param("maxCommits") Optional<Integer> maxCommits,
Repository repository) {
final Revision fromRevision;
final Revision toRevision;
// 1. only the "revision" is specified: get the "revision" and return just one commit
// 2. only the "to" is specified: get from "HEAD" to "to" and return the list
// 3. the "revision" and "to" is specified: get from the "revision" to "to" and return the list
// 4. nothing is specified: get from "HEAD" to "INIT" and return the list
if (isNullOrEmpty(revision) || "/".equalsIgnoreCase(revision)) {
fromRevision = Revision.HEAD;
toRevision = to.map(Revision::new).orElse(Revision.INIT);
} else {
fromRevision = new Revision(revision.substring(1));
toRevision = to.map(Revision::new).orElse(fromRevision);
}
final RevisionRange range = repository.normalizeNow(fromRevision, toRevision).toDescending();
final int maxCommits0 = maxCommits.map(integer -> Math.min(integer, Repository.DEFAULT_MAX_COMMITS))
.orElse(Repository.DEFAULT_MAX_COMMITS);
return repository
.history(range.from(), range.to(), normalizePath(path), maxCommits0)
.thenApply(commits -> {
final boolean toList = isNullOrEmpty(revision) || "/".equalsIgnoreCase(revision) ||
to.isPresent();
return objectOrList(commits, toList, DtoConverter::convert);
});
} | java | @Get("regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/commits(?<revision>(|/.*))$")
public CompletableFuture<?> listCommits(@Param("revision") String revision,
@Param("path") @Default("/**") String path,
@Param("to") Optional<String> to,
@Param("maxCommits") Optional<Integer> maxCommits,
Repository repository) {
final Revision fromRevision;
final Revision toRevision;
// 1. only the "revision" is specified: get the "revision" and return just one commit
// 2. only the "to" is specified: get from "HEAD" to "to" and return the list
// 3. the "revision" and "to" is specified: get from the "revision" to "to" and return the list
// 4. nothing is specified: get from "HEAD" to "INIT" and return the list
if (isNullOrEmpty(revision) || "/".equalsIgnoreCase(revision)) {
fromRevision = Revision.HEAD;
toRevision = to.map(Revision::new).orElse(Revision.INIT);
} else {
fromRevision = new Revision(revision.substring(1));
toRevision = to.map(Revision::new).orElse(fromRevision);
}
final RevisionRange range = repository.normalizeNow(fromRevision, toRevision).toDescending();
final int maxCommits0 = maxCommits.map(integer -> Math.min(integer, Repository.DEFAULT_MAX_COMMITS))
.orElse(Repository.DEFAULT_MAX_COMMITS);
return repository
.history(range.from(), range.to(), normalizePath(path), maxCommits0)
.thenApply(commits -> {
final boolean toList = isNullOrEmpty(revision) || "/".equalsIgnoreCase(revision) ||
to.isPresent();
return objectOrList(commits, toList, DtoConverter::convert);
});
} | [
"@",
"Get",
"(",
"\"regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/commits(?<revision>(|/.*))$\"",
")",
"public",
"CompletableFuture",
"<",
"?",
">",
"listCommits",
"(",
"@",
"Param",
"(",
"\"revision\"",
")",
"String",
"revision",
",",
"@",
"Param",
"(",
... | GET /projects/{projectName}/repos/{repoName}/commits/{revision}?
path={path}&to={to}&maxCommits={maxCommits}
<p>Returns a commit or the list of commits in the path. If the user specify the {@code revision} only,
this will return the corresponding commit. If the user does not specify the {@code revision} or
specify {@code to}, this will return the list of commits. | [
"GET",
"/",
"projects",
"/",
"{",
"projectName",
"}",
"/",
"repos",
"/",
"{",
"repoName",
"}",
"/",
"commits",
"/",
"{",
"revision",
"}",
"?",
"path",
"=",
"{",
"path",
"}",
"&",
";",
"to",
"=",
"{",
"to",
"}",
"&",
";",
"maxCommits",
"=",
... | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/ContentServiceV1.java#L293-L324 |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/parser/SQLParserFactory.java | SQLParserFactory.newInstance | public static SQLParser newInstance(final DatabaseType databaseType, final String sql) {
for (ShardingParseEngine each : NewInstanceServiceLoader.newServiceInstances(ShardingParseEngine.class)) {
if (DatabaseType.valueOf(each.getDatabaseType()) == databaseType) {
return each.createSQLParser(sql);
}
}
throw new UnsupportedOperationException(String.format("Cannot support database type '%s'", databaseType));
} | java | public static SQLParser newInstance(final DatabaseType databaseType, final String sql) {
for (ShardingParseEngine each : NewInstanceServiceLoader.newServiceInstances(ShardingParseEngine.class)) {
if (DatabaseType.valueOf(each.getDatabaseType()) == databaseType) {
return each.createSQLParser(sql);
}
}
throw new UnsupportedOperationException(String.format("Cannot support database type '%s'", databaseType));
} | [
"public",
"static",
"SQLParser",
"newInstance",
"(",
"final",
"DatabaseType",
"databaseType",
",",
"final",
"String",
"sql",
")",
"{",
"for",
"(",
"ShardingParseEngine",
"each",
":",
"NewInstanceServiceLoader",
".",
"newServiceInstances",
"(",
"ShardingParseEngine",
"... | New instance of SQL parser.
@param databaseType database type
@param sql SQL
@return SQL parser | [
"New",
"instance",
"of",
"SQL",
"parser",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/parser/SQLParserFactory.java#L47-L54 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java | GroupsInterface.joinRequest | public void joinRequest(String groupId, String message, boolean acceptRules) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_JOIN_REQUEST);
parameters.put("group_id", groupId);
parameters.put("message", message);
parameters.put("accept_rules", acceptRules);
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void joinRequest(String groupId, String message, boolean acceptRules) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_JOIN_REQUEST);
parameters.put("group_id", groupId);
parameters.put("message", message);
parameters.put("accept_rules", acceptRules);
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"joinRequest",
"(",
"String",
"groupId",
",",
"String",
"message",
",",
"boolean",
"acceptRules",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Obj... | Request to join a group.
Note: if a group has rules, the client must display the rules to the user and the user must accept them (which is indicated by passing a true value to
acceptRules) prior to making the join request.
@param groupId
- groupId parameter
@param message
- (required) message to group administrator
@param acceptRules
- (required) parameter indicating user has accepted groups rules | [
"Request",
"to",
"join",
"a",
"group",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java#L289-L300 |
Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/ClassHelper.java | ClassHelper.getInterfacesAsStream | public static Stream<Class<?>> getInterfacesAsStream(Class<?> clazz) {
return getSuperclassesAsStream(clazz, true)
.flatMap(superClass -> Stream.concat(
superClass.isInterface() ? Stream.of(superClass) : Stream.empty(),
Arrays.stream(superClass.getInterfaces()).flatMap(ClassHelper::getInterfacesAsStream)))
.distinct();
} | java | public static Stream<Class<?>> getInterfacesAsStream(Class<?> clazz) {
return getSuperclassesAsStream(clazz, true)
.flatMap(superClass -> Stream.concat(
superClass.isInterface() ? Stream.of(superClass) : Stream.empty(),
Arrays.stream(superClass.getInterfaces()).flatMap(ClassHelper::getInterfacesAsStream)))
.distinct();
} | [
"public",
"static",
"Stream",
"<",
"Class",
"<",
"?",
">",
">",
"getInterfacesAsStream",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"return",
"getSuperclassesAsStream",
"(",
"clazz",
",",
"true",
")",
".",
"flatMap",
"(",
"superClass",
"->",
"Stream",... | Get a stream of all interfaces of the given class including extended interfaces and interfaces of all
superclasses.
If the given class is an interface, it will be included in the result, otherwise not.
@param clazz The class to get the interfaces for.
@return The stream of interfaces of the given class. | [
"Get",
"a",
"stream",
"of",
"all",
"interfaces",
"of",
"the",
"given",
"class",
"including",
"extended",
"interfaces",
"and",
"interfaces",
"of",
"all",
"superclasses",
".",
"If",
"the",
"given",
"class",
"is",
"an",
"interface",
"it",
"will",
"be",
"include... | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/ClassHelper.java#L37-L43 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasActivationUtils.java | KerasActivationUtils.getIActivationFromConfig | public static IActivation getIActivationFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
return getActivationFromConfig(layerConfig, conf).getActivationFunction();
} | java | public static IActivation getIActivationFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
return getActivationFromConfig(layerConfig, conf).getActivationFunction();
} | [
"public",
"static",
"IActivation",
"getIActivationFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
",",
"UnsupportedKerasConfigurationException",
"{",
"ret... | Get activation function from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return DL4J activation function
@throws InvalidKerasConfigurationException Invalid Keras config
@throws UnsupportedKerasConfigurationException Unsupported Keras config | [
"Get",
"activation",
"function",
"from",
"Keras",
"layer",
"configuration",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasActivationUtils.java#L95-L98 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.resetVpnClientSharedKey | public void resetVpnClientSharedKey(String resourceGroupName, String virtualNetworkGatewayName) {
resetVpnClientSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | java | public void resetVpnClientSharedKey(String resourceGroupName, String virtualNetworkGatewayName) {
resetVpnClientSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | [
"public",
"void",
"resetVpnClientSharedKey",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"resetVpnClientSharedKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName",
")",
".",
"toBlocking",
"(",
"... | Resets the VPN client shared key of the virtual network gateway in the specified resource group.
@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 | [
"Resets",
"the",
"VPN",
"client",
"shared",
"key",
"of",
"the",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualNetworkGatewaysInner.java#L1471-L1473 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/code/Symtab.java | Symtab.enterConstant | private VarSymbol enterConstant(String name, Type type) {
VarSymbol c = new VarSymbol(
PUBLIC | STATIC | FINAL,
names.fromString(name),
type,
predefClass);
c.setData(type.constValue());
predefClass.members().enter(c);
return c;
} | java | private VarSymbol enterConstant(String name, Type type) {
VarSymbol c = new VarSymbol(
PUBLIC | STATIC | FINAL,
names.fromString(name),
type,
predefClass);
c.setData(type.constValue());
predefClass.members().enter(c);
return c;
} | [
"private",
"VarSymbol",
"enterConstant",
"(",
"String",
"name",
",",
"Type",
"type",
")",
"{",
"VarSymbol",
"c",
"=",
"new",
"VarSymbol",
"(",
"PUBLIC",
"|",
"STATIC",
"|",
"FINAL",
",",
"names",
".",
"fromString",
"(",
"name",
")",
",",
"type",
",",
"... | Enter a constant into symbol table.
@param name The constant's name.
@param type The constant's type. | [
"Enter",
"a",
"constant",
"into",
"symbol",
"table",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Symtab.java#L233-L242 |
weld/core | environments/common/src/main/java/org/jboss/weld/environment/util/BeanArchives.java | BeanArchives.extractBeanArchiveId | public static String extractBeanArchiveId(String beanArchiveRef, String base, String separator) {
beanArchiveRef = beanArchiveRef.replace('\\', '/');
StringBuilder id = new StringBuilder();
id.append(base);
id.append(BeanArchives.BEAN_ARCHIVE_ID_BASE_DELIMITER);
if (beanArchiveRef.contains(separator)) {
id.append(beanArchiveRef.substring(beanArchiveRef.indexOf(separator), beanArchiveRef.length()));
} else {
id.append(beanArchiveRef);
}
return id.toString();
} | java | public static String extractBeanArchiveId(String beanArchiveRef, String base, String separator) {
beanArchiveRef = beanArchiveRef.replace('\\', '/');
StringBuilder id = new StringBuilder();
id.append(base);
id.append(BeanArchives.BEAN_ARCHIVE_ID_BASE_DELIMITER);
if (beanArchiveRef.contains(separator)) {
id.append(beanArchiveRef.substring(beanArchiveRef.indexOf(separator), beanArchiveRef.length()));
} else {
id.append(beanArchiveRef);
}
return id.toString();
} | [
"public",
"static",
"String",
"extractBeanArchiveId",
"(",
"String",
"beanArchiveRef",
",",
"String",
"base",
",",
"String",
"separator",
")",
"{",
"beanArchiveRef",
"=",
"beanArchiveRef",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"StringBuilder"... | Takes the {@link #getBeanArchiveRef()} value and extracts the bean archive id.
<ol>
<li>First, the windows file separators found in beanArchiveRef are converted to slashes</li>
<li>{@code base} value is appended</li>
<li>{@link BeanArchives#BEAN_ARCHIVE_ID_BASE_DELIMITER} is appended</li>
<li>If the {@code beanArchiveRef} contains the separator, the substring (beginning at the separator index) is appended</li>
<li>Otherwise, the whole {@code beanArchiveRef} value is appended</li>
</ol>
The id should be consistent between multiple occurrences of the deployment.
@param beanArchiveRef
@param base
@param separator
@return the extracted bean archive id | [
"Takes",
"the",
"{",
"@link",
"#getBeanArchiveRef",
"()",
"}",
"value",
"and",
"extracts",
"the",
"bean",
"archive",
"id",
".",
"<ol",
">",
"<li",
">",
"First",
"the",
"windows",
"file",
"separators",
"found",
"in",
"beanArchiveRef",
"are",
"converted",
"to"... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/common/src/main/java/org/jboss/weld/environment/util/BeanArchives.java#L103-L114 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java | MediaDescriptorField.createVideoFormat | private RTPFormat createVideoFormat(int payload, Text description) {
Iterator<Text> it = description.split('/').iterator();
//encoding name
Text token = it.next();
token.trim();
EncodingName name = new EncodingName(token);
//clock rate
//TODO : convert to frame rate
token = it.next();
token.trim();
int clockRate = token.toInteger();
RTPFormat rtpFormat = getFormat(payload);
if (rtpFormat == null) {
formats.add(new RTPFormat(payload, FormatFactory.createVideoFormat(name, clockRate)));
} else {
//TODO: recreate format anyway. it is illegal to use clock rate as frame rate
((VideoFormat)rtpFormat.getFormat()).setName(name);
((VideoFormat)rtpFormat.getFormat()).setFrameRate(clockRate);
}
return rtpFormat;
} | java | private RTPFormat createVideoFormat(int payload, Text description) {
Iterator<Text> it = description.split('/').iterator();
//encoding name
Text token = it.next();
token.trim();
EncodingName name = new EncodingName(token);
//clock rate
//TODO : convert to frame rate
token = it.next();
token.trim();
int clockRate = token.toInteger();
RTPFormat rtpFormat = getFormat(payload);
if (rtpFormat == null) {
formats.add(new RTPFormat(payload, FormatFactory.createVideoFormat(name, clockRate)));
} else {
//TODO: recreate format anyway. it is illegal to use clock rate as frame rate
((VideoFormat)rtpFormat.getFormat()).setName(name);
((VideoFormat)rtpFormat.getFormat()).setFrameRate(clockRate);
}
return rtpFormat;
} | [
"private",
"RTPFormat",
"createVideoFormat",
"(",
"int",
"payload",
",",
"Text",
"description",
")",
"{",
"Iterator",
"<",
"Text",
">",
"it",
"=",
"description",
".",
"split",
"(",
"'",
"'",
")",
".",
"iterator",
"(",
")",
";",
"//encoding name",
"Text",
... | Creates or updates video format using payload number and text format description.
@param payload the payload number of the format.
@param description text description of the format
@return format object | [
"Creates",
"or",
"updates",
"video",
"format",
"using",
"payload",
"number",
"and",
"text",
"format",
"description",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java#L463-L487 |
aspectran/aspectran | shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java | HelpFormatter.printWrapped | private void printWrapped(int nextLineTabStop, String text) {
StringBuilder sb = new StringBuilder(text.length());
renderWrappedTextBlock(sb, nextLineTabStop, text);
console.writeLine(sb.toString());
} | java | private void printWrapped(int nextLineTabStop, String text) {
StringBuilder sb = new StringBuilder(text.length());
renderWrappedTextBlock(sb, nextLineTabStop, text);
console.writeLine(sb.toString());
} | [
"private",
"void",
"printWrapped",
"(",
"int",
"nextLineTabStop",
",",
"String",
"text",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"text",
".",
"length",
"(",
")",
")",
";",
"renderWrappedTextBlock",
"(",
"sb",
",",
"nextLineTabStop",
... | Print the specified text to the specified PrintWriter.
@param nextLineTabStop the position on the next line for the first tab
@param text the text to be written to the PrintWriter | [
"Print",
"the",
"specified",
"text",
"to",
"the",
"specified",
"PrintWriter",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java#L381-L385 |
Alluxio/alluxio | core/common/src/main/java/alluxio/cli/CommandUtils.java | CommandUtils.checkNumOfArgsNoLessThan | public static void checkNumOfArgsNoLessThan(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length < n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_INSUFFICIENT
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | java | public static void checkNumOfArgsNoLessThan(Command cmd, CommandLine cl, int n) throws
InvalidArgumentException {
if (cl.getArgs().length < n) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_INSUFFICIENT
.getMessage(cmd.getCommandName(), n, cl.getArgs().length));
}
} | [
"public",
"static",
"void",
"checkNumOfArgsNoLessThan",
"(",
"Command",
"cmd",
",",
"CommandLine",
"cl",
",",
"int",
"n",
")",
"throws",
"InvalidArgumentException",
"{",
"if",
"(",
"cl",
".",
"getArgs",
"(",
")",
".",
"length",
"<",
"n",
")",
"{",
"throw",... | Checks the number of non-option arguments is no less than n for command.
@param cmd command instance
@param cl parsed commandline arguments
@param n an integer
@throws InvalidArgumentException if the number is smaller than n | [
"Checks",
"the",
"number",
"of",
"non",
"-",
"option",
"arguments",
"is",
"no",
"less",
"than",
"n",
"for",
"command",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/cli/CommandUtils.java#L84-L90 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java | InstanceFailoverGroupsInner.beginFailover | public InstanceFailoverGroupInner beginFailover(String resourceGroupName, String locationName, String failoverGroupName) {
return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body();
} | java | public InstanceFailoverGroupInner beginFailover(String resourceGroupName, String locationName, String failoverGroupName) {
return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body();
} | [
"public",
"InstanceFailoverGroupInner",
"beginFailover",
"(",
"String",
"resourceGroupName",
",",
"String",
"locationName",
",",
"String",
"failoverGroupName",
")",
"{",
"return",
"beginFailoverWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"locationName",
",",
"... | Fails over from the current primary managed instance to this managed instance.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param locationName The name of the region where the resource is located.
@param failoverGroupName The name of the failover group.
@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 InstanceFailoverGroupInner object if successful. | [
"Fails",
"over",
"from",
"the",
"current",
"primary",
"managed",
"instance",
"to",
"this",
"managed",
"instance",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L770-L772 |
windup/windup | config/api/src/main/java/org/jboss/windup/config/operation/iteration/AbstractIterationOperation.java | AbstractIterationOperation.resolveVariable | protected WindupVertexFrame resolveVariable(GraphRewrite event, String variableName)
{
Variables variables = Variables.instance(event);
Iterator<String> tokenizer = new VariableNameIterator(variableName);
WindupVertexFrame payload;
String initialName = tokenizer.next();
try
{
payload = Iteration.getCurrentPayload(variables, initialName);
}
catch (IllegalArgumentException e1)
{
payload = variables.findSingletonVariable(initialName);
}
while (tokenizer.hasNext())
{
String propertyName = tokenizer.next();
propertyName = "get" + camelCase(propertyName, true);
try
{
payload = (WindupVertexFrame) payload.getClass().getMethod(propertyName).invoke(payload);
}
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e)
{
throw new IllegalArgumentException("Invalid variable expression: " + variableName, e);
}
}
return payload;
} | java | protected WindupVertexFrame resolveVariable(GraphRewrite event, String variableName)
{
Variables variables = Variables.instance(event);
Iterator<String> tokenizer = new VariableNameIterator(variableName);
WindupVertexFrame payload;
String initialName = tokenizer.next();
try
{
payload = Iteration.getCurrentPayload(variables, initialName);
}
catch (IllegalArgumentException e1)
{
payload = variables.findSingletonVariable(initialName);
}
while (tokenizer.hasNext())
{
String propertyName = tokenizer.next();
propertyName = "get" + camelCase(propertyName, true);
try
{
payload = (WindupVertexFrame) payload.getClass().getMethod(propertyName).invoke(payload);
}
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e)
{
throw new IllegalArgumentException("Invalid variable expression: " + variableName, e);
}
}
return payload;
} | [
"protected",
"WindupVertexFrame",
"resolveVariable",
"(",
"GraphRewrite",
"event",
",",
"String",
"variableName",
")",
"{",
"Variables",
"variables",
"=",
"Variables",
".",
"instance",
"(",
"event",
")",
";",
"Iterator",
"<",
"String",
">",
"tokenizer",
"=",
"ne... | Resolves variable/property name expressions of the form `
<code>#{initialModelVar.customProperty.anotherProp}</code>`, where the `initialModelVar` has a {@link Property}
method of the form `<code>@Property public X getCustomProperty()</code>` and `X` has a {@link Property} method of
the form `<code>@Property public X getAnotherProp()</code>` | [
"Resolves",
"variable",
"/",
"property",
"name",
"expressions",
"of",
"the",
"form",
"<code",
">",
"#",
"{",
"initialModelVar",
".",
"customProperty",
".",
"anotherProp",
"}",
"<",
"/",
"code",
">",
"where",
"the",
"initialModelVar",
"has",
"a",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/operation/iteration/AbstractIterationOperation.java#L91-L122 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newClientContext | @Deprecated
public static SslContext newClientContext(SslProvider provider, File certChainFile) throws SSLException {
return newClientContext(provider, certChainFile, null);
} | java | @Deprecated
public static SslContext newClientContext(SslProvider provider, File certChainFile) throws SSLException {
return newClientContext(provider, certChainFile, null);
} | [
"@",
"Deprecated",
"public",
"static",
"SslContext",
"newClientContext",
"(",
"SslProvider",
"provider",
",",
"File",
"certChainFile",
")",
"throws",
"SSLException",
"{",
"return",
"newClientContext",
"(",
"provider",
",",
"certChainFile",
",",
"null",
")",
";",
"... | Creates a new client-side {@link SslContext}.
@param provider the {@link SslContext} implementation to use.
{@code null} to use the current default one.
@param certChainFile an X.509 certificate chain file in PEM format.
{@code null} to use the system default
@return a new client-side {@link SslContext}
@deprecated Replaced by {@link SslContextBuilder} | [
"Creates",
"a",
"new",
"client",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L586-L589 |
lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newUsed | public Used newUsed(QualifiedName id, QualifiedName activity, QualifiedName entity) {
Used res = newUsed(id);
res.setActivity(activity);
res.setEntity(entity);
return res;
} | java | public Used newUsed(QualifiedName id, QualifiedName activity, QualifiedName entity) {
Used res = newUsed(id);
res.setActivity(activity);
res.setEntity(entity);
return res;
} | [
"public",
"Used",
"newUsed",
"(",
"QualifiedName",
"id",
",",
"QualifiedName",
"activity",
",",
"QualifiedName",
"entity",
")",
"{",
"Used",
"res",
"=",
"newUsed",
"(",
"id",
")",
";",
"res",
".",
"setActivity",
"(",
"activity",
")",
";",
"res",
".",
"se... | A factory method to create an instance of a usage {@link Used}
@param id an optional identifier for a usage
@param activity the identifier of the <a href="http://www.w3.org/TR/prov-dm/#usage.activity">activity</a> that used an entity
@param entity an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#usage.entity">entity</a> being used
@return an instance of {@link Used} | [
"A",
"factory",
"method",
"to",
"create",
"an",
"instance",
"of",
"a",
"usage",
"{"
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L977-L982 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java | HttpChannelConfig.parseJITOnlyReads | private void parseJITOnlyReads(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_JIT_ONLY_READS);
if (null != value) {
this.bJITOnlyReads = convertBoolean(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: JIT only reads is " + isJITOnlyReads());
}
}
} | java | private void parseJITOnlyReads(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_JIT_ONLY_READS);
if (null != value) {
this.bJITOnlyReads = convertBoolean(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: JIT only reads is " + isJITOnlyReads());
}
}
} | [
"private",
"void",
"parseJITOnlyReads",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"props",
")",
"{",
"Object",
"value",
"=",
"props",
".",
"get",
"(",
"HttpConfigConstants",
".",
"PROPNAME_JIT_ONLY_READS",
")",
";",
"if",
"(",
"null",
"!=",
"value",
"... | Parse the configuration on whether to perform JIT allocate only reads
or leave it to the default behavior.
@param props | [
"Parse",
"the",
"configuration",
"on",
"whether",
"to",
"perform",
"JIT",
"allocate",
"only",
"reads",
"or",
"leave",
"it",
"to",
"the",
"default",
"behavior",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1029-L1037 |
authlete/authlete-java-common | src/main/java/com/authlete/common/util/Utils.java | Utils.stringifyScopeNames | public static String stringifyScopeNames(Scope[] scopes)
{
if (scopes == null)
{
return null;
}
String[] array = new String[scopes.length];
for (int i = 0; i < scopes.length; ++i)
{
array[i] = (scopes[i] == null) ? null : scopes[i].getName();
}
return join(array, " ");
} | java | public static String stringifyScopeNames(Scope[] scopes)
{
if (scopes == null)
{
return null;
}
String[] array = new String[scopes.length];
for (int i = 0; i < scopes.length; ++i)
{
array[i] = (scopes[i] == null) ? null : scopes[i].getName();
}
return join(array, " ");
} | [
"public",
"static",
"String",
"stringifyScopeNames",
"(",
"Scope",
"[",
"]",
"scopes",
")",
"{",
"if",
"(",
"scopes",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"array",
"=",
"new",
"String",
"[",
"scopes",
".",
"length",
... | Generate a list of scope names.
@param scopes
An array of {@link Scope}. If {@code null} is given,
{@code null} is returned.
@return
A string containing scope names using white spaces as
the delimiter.
@since 2.5 | [
"Generate",
"a",
"list",
"of",
"scope",
"names",
"."
] | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/Utils.java#L257-L272 |
mangstadt/biweekly | src/main/java/biweekly/io/ICalTimeZone.java | ICalTimeZone.calculateSortedObservances | private List<Observance> calculateSortedObservances() {
List<DaylightSavingsTime> daylights = component.getDaylightSavingsTime();
List<StandardTime> standards = component.getStandardTimes();
int numObservances = standards.size() + daylights.size();
List<Observance> sortedObservances = new ArrayList<Observance>(numObservances);
sortedObservances.addAll(standards);
sortedObservances.addAll(daylights);
Collections.sort(sortedObservances, new Comparator<Observance>() {
public int compare(Observance left, Observance right) {
ICalDate startLeft = getValue(left.getDateStart());
ICalDate startRight = getValue(right.getDateStart());
if (startLeft == null && startRight == null) {
return 0;
}
if (startLeft == null) {
return -1;
}
if (startRight == null) {
return 1;
}
return startLeft.getRawComponents().compareTo(startRight.getRawComponents());
}
});
return Collections.unmodifiableList(sortedObservances);
} | java | private List<Observance> calculateSortedObservances() {
List<DaylightSavingsTime> daylights = component.getDaylightSavingsTime();
List<StandardTime> standards = component.getStandardTimes();
int numObservances = standards.size() + daylights.size();
List<Observance> sortedObservances = new ArrayList<Observance>(numObservances);
sortedObservances.addAll(standards);
sortedObservances.addAll(daylights);
Collections.sort(sortedObservances, new Comparator<Observance>() {
public int compare(Observance left, Observance right) {
ICalDate startLeft = getValue(left.getDateStart());
ICalDate startRight = getValue(right.getDateStart());
if (startLeft == null && startRight == null) {
return 0;
}
if (startLeft == null) {
return -1;
}
if (startRight == null) {
return 1;
}
return startLeft.getRawComponents().compareTo(startRight.getRawComponents());
}
});
return Collections.unmodifiableList(sortedObservances);
} | [
"private",
"List",
"<",
"Observance",
">",
"calculateSortedObservances",
"(",
")",
"{",
"List",
"<",
"DaylightSavingsTime",
">",
"daylights",
"=",
"component",
".",
"getDaylightSavingsTime",
"(",
")",
";",
"List",
"<",
"StandardTime",
">",
"standards",
"=",
"com... | Builds a list of all the observances in the VTIMEZONE component, sorted
by DTSTART.
@return the sorted observances | [
"Builds",
"a",
"list",
"of",
"all",
"the",
"observances",
"in",
"the",
"VTIMEZONE",
"component",
"sorted",
"by",
"DTSTART",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/ICalTimeZone.java#L106-L135 |
pietermartin/sqlg | sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java | VertexLabel.ensureEdgeLabelExist | public EdgeLabel ensureEdgeLabelExist(final String edgeLabelName, final VertexLabel inVertexLabel) {
return this.getSchema().ensureEdgeLabelExist(edgeLabelName, this, inVertexLabel, Collections.emptyMap());
} | java | public EdgeLabel ensureEdgeLabelExist(final String edgeLabelName, final VertexLabel inVertexLabel) {
return this.getSchema().ensureEdgeLabelExist(edgeLabelName, this, inVertexLabel, Collections.emptyMap());
} | [
"public",
"EdgeLabel",
"ensureEdgeLabelExist",
"(",
"final",
"String",
"edgeLabelName",
",",
"final",
"VertexLabel",
"inVertexLabel",
")",
"{",
"return",
"this",
".",
"getSchema",
"(",
")",
".",
"ensureEdgeLabelExist",
"(",
"edgeLabelName",
",",
"this",
",",
"inVe... | Ensures that the {@link EdgeLabel} exists. It will be created if it does not exists.
"this" is the out {@link VertexLabel} and inVertexLabel is the inVertexLabel
This method is equivalent to {@link Schema#ensureEdgeLabelExist(String, VertexLabel, VertexLabel, Map)}
@param edgeLabelName The EdgeLabel's label's name.
@param inVertexLabel The edge's in VertexLabel.
@return The {@link EdgeLabel}. | [
"Ensures",
"that",
"the",
"{",
"@link",
"EdgeLabel",
"}",
"exists",
".",
"It",
"will",
"be",
"created",
"if",
"it",
"does",
"not",
"exists",
".",
"this",
"is",
"the",
"out",
"{",
"@link",
"VertexLabel",
"}",
"and",
"inVertexLabel",
"is",
"the",
"inVertex... | train | https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java#L285-L287 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java | ModulePackageIndexFrameWriter.getPackage | protected Content getPackage(PackageElement pkg, ModuleElement mdle) {
Content packageLinkContent;
Content pkgLabel;
if (!pkg.isUnnamed()) {
pkgLabel = getPackageLabel(utils.getPackageName(pkg));
packageLinkContent = getHyperLink(pathString(pkg,
DocPaths.PACKAGE_FRAME), pkgLabel, "",
"packageFrame");
} else {
pkgLabel = new StringContent("<unnamed package>");
packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
pkgLabel, "", "packageFrame");
}
Content li = HtmlTree.LI(packageLinkContent);
return li;
} | java | protected Content getPackage(PackageElement pkg, ModuleElement mdle) {
Content packageLinkContent;
Content pkgLabel;
if (!pkg.isUnnamed()) {
pkgLabel = getPackageLabel(utils.getPackageName(pkg));
packageLinkContent = getHyperLink(pathString(pkg,
DocPaths.PACKAGE_FRAME), pkgLabel, "",
"packageFrame");
} else {
pkgLabel = new StringContent("<unnamed package>");
packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
pkgLabel, "", "packageFrame");
}
Content li = HtmlTree.LI(packageLinkContent);
return li;
} | [
"protected",
"Content",
"getPackage",
"(",
"PackageElement",
"pkg",
",",
"ModuleElement",
"mdle",
")",
"{",
"Content",
"packageLinkContent",
";",
"Content",
"pkgLabel",
";",
"if",
"(",
"!",
"pkg",
".",
"isUnnamed",
"(",
")",
")",
"{",
"pkgLabel",
"=",
"getPa... | Returns each package name as a separate link.
@param pkg PackageElement
@param mdle the module being documented
@return content for the package link | [
"Returns",
"each",
"package",
"name",
"as",
"a",
"separate",
"link",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java#L141-L156 |
rpau/javalang-compiler | src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java | SymbolType.typeVariableOf | private static SymbolType typeVariableOf(String typeVariable, final String name, final int arrayCount,
final List<SymbolType> upperBounds, final List<SymbolType> lowerBounds) {
return new SymbolType(name, arrayCount, upperBounds, lowerBounds, typeVariable);
} | java | private static SymbolType typeVariableOf(String typeVariable, final String name, final int arrayCount,
final List<SymbolType> upperBounds, final List<SymbolType> lowerBounds) {
return new SymbolType(name, arrayCount, upperBounds, lowerBounds, typeVariable);
} | [
"private",
"static",
"SymbolType",
"typeVariableOf",
"(",
"String",
"typeVariable",
",",
"final",
"String",
"name",
",",
"final",
"int",
"arrayCount",
",",
"final",
"List",
"<",
"SymbolType",
">",
"upperBounds",
",",
"final",
"List",
"<",
"SymbolType",
">",
"l... | Builds a symbol for a type variable.
@param typeVariable the name of the variable
@param name type name of the variable
@param arrayCount the array dimensions
@param upperBounds the upper bounds of the variable
@param lowerBounds the lower bounds of the variable
@return a SymbolType that represents a variable (for generics) | [
"Builds",
"a",
"symbol",
"for",
"a",
"type",
"variable",
"."
] | train | https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java#L817-L820 |
bignerdranch/expandable-recycler-view | expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java | ExpandableRecyclerAdapter.updateExpandedParent | @UiThread
private void updateExpandedParent(@NonNull ExpandableWrapper<P, C> parentWrapper, int flatParentPosition, boolean expansionTriggeredByListItemClick) {
if (parentWrapper.isExpanded()) {
return;
}
parentWrapper.setExpanded(true);
mExpansionStateMap.put(parentWrapper.getParent(), true);
List<ExpandableWrapper<P, C>> wrappedChildList = parentWrapper.getWrappedChildList();
if (wrappedChildList != null) {
int childCount = wrappedChildList.size();
for (int i = 0; i < childCount; i++) {
mFlatItemList.add(flatParentPosition + i + 1, wrappedChildList.get(i));
}
notifyItemRangeInserted(flatParentPosition + 1, childCount);
}
if (expansionTriggeredByListItemClick && mExpandCollapseListener != null) {
mExpandCollapseListener.onParentExpanded(getNearestParentPosition(flatParentPosition));
}
} | java | @UiThread
private void updateExpandedParent(@NonNull ExpandableWrapper<P, C> parentWrapper, int flatParentPosition, boolean expansionTriggeredByListItemClick) {
if (parentWrapper.isExpanded()) {
return;
}
parentWrapper.setExpanded(true);
mExpansionStateMap.put(parentWrapper.getParent(), true);
List<ExpandableWrapper<P, C>> wrappedChildList = parentWrapper.getWrappedChildList();
if (wrappedChildList != null) {
int childCount = wrappedChildList.size();
for (int i = 0; i < childCount; i++) {
mFlatItemList.add(flatParentPosition + i + 1, wrappedChildList.get(i));
}
notifyItemRangeInserted(flatParentPosition + 1, childCount);
}
if (expansionTriggeredByListItemClick && mExpandCollapseListener != null) {
mExpandCollapseListener.onParentExpanded(getNearestParentPosition(flatParentPosition));
}
} | [
"@",
"UiThread",
"private",
"void",
"updateExpandedParent",
"(",
"@",
"NonNull",
"ExpandableWrapper",
"<",
"P",
",",
"C",
">",
"parentWrapper",
",",
"int",
"flatParentPosition",
",",
"boolean",
"expansionTriggeredByListItemClick",
")",
"{",
"if",
"(",
"parentWrapper... | Expands a specified parent. Calls through to the
ExpandCollapseListener and adds children of the specified parent to the
flat list of items.
@param parentWrapper The ExpandableWrapper of the parent to expand
@param flatParentPosition The index of the parent to expand
@param expansionTriggeredByListItemClick true if expansion was triggered
by a click event, false otherwise. | [
"Expands",
"a",
"specified",
"parent",
".",
"Calls",
"through",
"to",
"the",
"ExpandCollapseListener",
"and",
"adds",
"children",
"of",
"the",
"specified",
"parent",
"to",
"the",
"flat",
"list",
"of",
"items",
"."
] | train | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L694-L716 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java | CommercePriceListPersistenceImpl.findByGroupId | @Override
public List<CommercePriceList> findByGroupId(long groupId, int start,
int end) {
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CommercePriceList> findByGroupId(long groupId, int start,
int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommercePriceList",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce price lists where groupId = ?.
<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 CommercePriceListModelImpl}. 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 groupId the group ID
@param start the lower bound of the range of commerce price lists
@param end the upper bound of the range of commerce price lists (not inclusive)
@return the range of matching commerce price lists | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"price",
"lists",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L1541-L1545 |
bugsnag/bugsnag-java | bugsnag/src/main/java/com/bugsnag/Report.java | Report.setUser | public Report setUser(String id, String email, String name) {
diagnostics.user.put("id", id);
diagnostics.user.put("email", email);
diagnostics.user.put("name", name);
return this;
} | java | public Report setUser(String id, String email, String name) {
diagnostics.user.put("id", id);
diagnostics.user.put("email", email);
diagnostics.user.put("name", name);
return this;
} | [
"public",
"Report",
"setUser",
"(",
"String",
"id",
",",
"String",
"email",
",",
"String",
"name",
")",
"{",
"diagnostics",
".",
"user",
".",
"put",
"(",
"\"id\"",
",",
"id",
")",
";",
"diagnostics",
".",
"user",
".",
"put",
"(",
"\"email\"",
",",
"e... | Helper method to set all the user attributes.
@param id the identifier of the user.
@param email the email of the user.
@param name the name of the user.
@return the modified report. | [
"Helper",
"method",
"to",
"set",
"all",
"the",
"user",
"attributes",
"."
] | train | https://github.com/bugsnag/bugsnag-java/blob/11817d63949bcf2b2b6b765a1d37305cdec356f2/bugsnag/src/main/java/com/bugsnag/Report.java#L297-L302 |
jblas-project/jblas | src/main/java/org/jblas/Eigen.java | Eigen.symmetricGeneralizedEigenvalues | public static DoubleMatrix symmetricGeneralizedEigenvalues(DoubleMatrix A, DoubleMatrix B, int il, int iu) {
A.assertSquare();
B.assertSquare();
A.assertSameSize(B);
if (iu < il) {
throw new IllegalArgumentException("Index exception: make sure iu >= il");
}
if (il < 0) {
throw new IllegalArgumentException("Index exception: make sure il >= 0");
}
if (iu > A.rows - 1) {
throw new IllegalArgumentException("Index exception: make sure iu <= A.rows - 1");
}
double abstol = (double) 1e-9; // What is a good tolerance?
int[] m = new int[1];
DoubleMatrix W = new DoubleMatrix(A.rows);
DoubleMatrix Z = new DoubleMatrix(A.rows, A.columns);
SimpleBlas.sygvx(1, 'N', 'I', 'U', A.dup(), B.dup(), 0.0, 0.0, il + 1, iu + 1, abstol, m, W, Z);
return W.get(new IntervalRange(0, m[0]), 0);
} | java | public static DoubleMatrix symmetricGeneralizedEigenvalues(DoubleMatrix A, DoubleMatrix B, int il, int iu) {
A.assertSquare();
B.assertSquare();
A.assertSameSize(B);
if (iu < il) {
throw new IllegalArgumentException("Index exception: make sure iu >= il");
}
if (il < 0) {
throw new IllegalArgumentException("Index exception: make sure il >= 0");
}
if (iu > A.rows - 1) {
throw new IllegalArgumentException("Index exception: make sure iu <= A.rows - 1");
}
double abstol = (double) 1e-9; // What is a good tolerance?
int[] m = new int[1];
DoubleMatrix W = new DoubleMatrix(A.rows);
DoubleMatrix Z = new DoubleMatrix(A.rows, A.columns);
SimpleBlas.sygvx(1, 'N', 'I', 'U', A.dup(), B.dup(), 0.0, 0.0, il + 1, iu + 1, abstol, m, W, Z);
return W.get(new IntervalRange(0, m[0]), 0);
} | [
"public",
"static",
"DoubleMatrix",
"symmetricGeneralizedEigenvalues",
"(",
"DoubleMatrix",
"A",
",",
"DoubleMatrix",
"B",
",",
"int",
"il",
",",
"int",
"iu",
")",
"{",
"A",
".",
"assertSquare",
"(",
")",
";",
"B",
".",
"assertSquare",
"(",
")",
";",
"A",
... | Computes selected eigenvalues of the real generalized symmetric-definite eigenproblem of the form A x = L B x
or, equivalently, (A - L B)x = 0. Here A and B are assumed to be symmetric and B is also positive definite.
The selection is based on the given range of indices for the desired eigenvalues.
@param A symmetric Matrix A. Only the upper triangle will be considered.
@param B symmetric Matrix B. Only the upper triangle will be considered.
@param il lower index (in ascending order) of the smallest eigenvalue to return (index is 0-based)
@param iu upper index (in ascending order) of the largest eigenvalue to return (index is 0-based)
@throws IllegalArgumentException if <code>il > iu</code> or <code>il < 0 </code> or <code>iu > A.rows - 1</code>
@return a vector of eigenvalues L | [
"Computes",
"selected",
"eigenvalues",
"of",
"the",
"real",
"generalized",
"symmetric",
"-",
"definite",
"eigenproblem",
"of",
"the",
"form",
"A",
"x",
"=",
"L",
"B",
"x",
"or",
"equivalently",
"(",
"A",
"-",
"L",
"B",
")",
"x",
"=",
"0",
".",
"Here",
... | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Eigen.java#L208-L227 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java | ParticleIO.loadConfiguredSystem | public static ParticleSystem loadConfiguredSystem(String ref, Color mask)
throws IOException {
return loadConfiguredSystem(ResourceLoader.getResourceAsStream(ref),
null, null, mask);
} | java | public static ParticleSystem loadConfiguredSystem(String ref, Color mask)
throws IOException {
return loadConfiguredSystem(ResourceLoader.getResourceAsStream(ref),
null, null, mask);
} | [
"public",
"static",
"ParticleSystem",
"loadConfiguredSystem",
"(",
"String",
"ref",
",",
"Color",
"mask",
")",
"throws",
"IOException",
"{",
"return",
"loadConfiguredSystem",
"(",
"ResourceLoader",
".",
"getResourceAsStream",
"(",
"ref",
")",
",",
"null",
",",
"nu... | Load a set of configured emitters into a single system
@param ref
The reference to the XML file (file or classpath)
@param mask
@return A configured particle system
@throws IOException
Indicates a failure to find, read or parse the XML file | [
"Load",
"a",
"set",
"of",
"configured",
"emitters",
"into",
"a",
"single",
"system"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L50-L54 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/util/Cron.java | Cron.shouldRun | public static boolean shouldRun(String entry, Date atTime) {
entry = entry.trim().toUpperCase();
if (ANNUALLY.equals(entry) || (YEARLY.equals(entry))) {
entry = "0 0 1 1 *";
} else if (MONTHLY.equals(entry)) {
entry = "0 0 1 * *";
} else if (WEEKLY.equals(entry)) {
entry = "0 0 * * 0";
} else if (DAILY.equals(entry) || (MIDNIGHT.equals(entry))) {
entry = "0 0 * * *";
} else if (HOURLY.equals(entry)) {
entry = "0 * * * *";
}
return new CronTabEntry(entry).isRunnable(atTime);
} | java | public static boolean shouldRun(String entry, Date atTime) {
entry = entry.trim().toUpperCase();
if (ANNUALLY.equals(entry) || (YEARLY.equals(entry))) {
entry = "0 0 1 1 *";
} else if (MONTHLY.equals(entry)) {
entry = "0 0 1 * *";
} else if (WEEKLY.equals(entry)) {
entry = "0 0 * * 0";
} else if (DAILY.equals(entry) || (MIDNIGHT.equals(entry))) {
entry = "0 0 * * *";
} else if (HOURLY.equals(entry)) {
entry = "0 * * * *";
}
return new CronTabEntry(entry).isRunnable(atTime);
} | [
"public",
"static",
"boolean",
"shouldRun",
"(",
"String",
"entry",
",",
"Date",
"atTime",
")",
"{",
"entry",
"=",
"entry",
".",
"trim",
"(",
")",
".",
"toUpperCase",
"(",
")",
";",
"if",
"(",
"ANNUALLY",
".",
"equals",
"(",
"entry",
")",
"||",
"(",
... | Determines if the given CRON entry is runnable at this current moment in time. This mimics the original implementation of the CRON table.
<p>This implementation supports only the following types of entries:</p>
<ol>
<li>Standard Entries having form: <minutes> <hours> <days> <months> <days of week>
<ul>
<li>* : All</li>
<li>*\/n : Only mod n</li>
<li>n : Numeric</li>
<li>n-n : Range</li>
<li>n,n,...,n : List</li>
<li>n,n-n,...,n : List having ranges</li>
</ul>
</li>
<li>Special Entries
<ul>
<li>@annually : equivalent to "0 0 1 1 *"</li>
<li>@yearly : equivalent to "0 0 1 1 *"</li>
<li>@monthly : equivalent to "0 0 1 * *"</li>
<li>@weekly : equivalent to "0 0 * * 0"</li>
<li>@daily : equivalent to "0 0 * * *"</li>
<li>@midnight : equivalent to "0 0 * * *"</li>
<li>@hourly : equivalent to "0 * * * *"</li>
</ul>
</li>
</ol>
@param entry The CRON entry to evaluate.
@param atTime The time at which to evaluate the entry.
@return true if the the current time is a valid runnable time with respect to the supplied entry. | [
"Determines",
"if",
"the",
"given",
"CRON",
"entry",
"is",
"runnable",
"at",
"this",
"current",
"moment",
"in",
"time",
".",
"This",
"mimics",
"the",
"original",
"implementation",
"of",
"the",
"CRON",
"table",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/util/Cron.java#L99-L113 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java | XPathUtils.evaluateAsNodeList | public static NodeList evaluateAsNodeList(Node node, String xPathExpression, NamespaceContext nsContext) {
NodeList result = (NodeList) evaluateExpression(node, xPathExpression, nsContext, XPathConstants.NODESET);
if (result == null) {
throw new CitrusRuntimeException("No result for XPath expression: '" + xPathExpression + "'");
}
return result;
} | java | public static NodeList evaluateAsNodeList(Node node, String xPathExpression, NamespaceContext nsContext) {
NodeList result = (NodeList) evaluateExpression(node, xPathExpression, nsContext, XPathConstants.NODESET);
if (result == null) {
throw new CitrusRuntimeException("No result for XPath expression: '" + xPathExpression + "'");
}
return result;
} | [
"public",
"static",
"NodeList",
"evaluateAsNodeList",
"(",
"Node",
"node",
",",
"String",
"xPathExpression",
",",
"NamespaceContext",
"nsContext",
")",
"{",
"NodeList",
"result",
"=",
"(",
"NodeList",
")",
"evaluateExpression",
"(",
"node",
",",
"xPathExpression",
... | Evaluate XPath expression with result type NodeList.
@param node
@param xPathExpression
@param nsContext
@return | [
"Evaluate",
"XPath",
"expression",
"with",
"result",
"type",
"NodeList",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java#L198-L206 |
jayantk/jklol | src/com/jayantkrish/jklol/tensor/DenseTensorBuilder.java | DenseTensorBuilder.simpleIncrement | private void simpleIncrement(TensorBase other, double multiplier) {
Preconditions.checkArgument(Arrays.equals(other.getDimensionNumbers(), getDimensionNumbers()));
if (other instanceof DenseTensorBase) {
double[] otherTensorValues = ((DenseTensorBase) other).values;
Preconditions.checkArgument(otherTensorValues.length == values.length);
int length = values.length;
for (int i = 0; i < length; i++) {
values[i] += otherTensorValues[i] * multiplier;
}
} else {
int otherSize = other.size();
for (int i = 0; i < otherSize; i++) {
long keyNum = other.indexToKeyNum(i);
double value = other.getByIndex(i);
values[keyNumToIndex(keyNum)] += value * multiplier;
}
}
} | java | private void simpleIncrement(TensorBase other, double multiplier) {
Preconditions.checkArgument(Arrays.equals(other.getDimensionNumbers(), getDimensionNumbers()));
if (other instanceof DenseTensorBase) {
double[] otherTensorValues = ((DenseTensorBase) other).values;
Preconditions.checkArgument(otherTensorValues.length == values.length);
int length = values.length;
for (int i = 0; i < length; i++) {
values[i] += otherTensorValues[i] * multiplier;
}
} else {
int otherSize = other.size();
for (int i = 0; i < otherSize; i++) {
long keyNum = other.indexToKeyNum(i);
double value = other.getByIndex(i);
values[keyNumToIndex(keyNum)] += value * multiplier;
}
}
} | [
"private",
"void",
"simpleIncrement",
"(",
"TensorBase",
"other",
",",
"double",
"multiplier",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"Arrays",
".",
"equals",
"(",
"other",
".",
"getDimensionNumbers",
"(",
")",
",",
"getDimensionNumbers",
"(",
")"... | Increment algorithm for the case where both tensors have the same set of
dimensions.
@param other
@param multiplier | [
"Increment",
"algorithm",
"for",
"the",
"case",
"where",
"both",
"tensors",
"have",
"the",
"same",
"set",
"of",
"dimensions",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/tensor/DenseTensorBuilder.java#L197-L214 |
jhy/jsoup | src/main/java/org/jsoup/safety/Whitelist.java | Whitelist.removeProtocols | public Whitelist removeProtocols(String tag, String attribute, String... removeProtocols) {
Validate.notEmpty(tag);
Validate.notEmpty(attribute);
Validate.notNull(removeProtocols);
TagName tagName = TagName.valueOf(tag);
AttributeKey attr = AttributeKey.valueOf(attribute);
// make sure that what we're removing actually exists; otherwise can open the tag to any data and that can
// be surprising
Validate.isTrue(protocols.containsKey(tagName), "Cannot remove a protocol that is not set.");
Map<AttributeKey, Set<Protocol>> tagProtocols = protocols.get(tagName);
Validate.isTrue(tagProtocols.containsKey(attr), "Cannot remove a protocol that is not set.");
Set<Protocol> attrProtocols = tagProtocols.get(attr);
for (String protocol : removeProtocols) {
Validate.notEmpty(protocol);
attrProtocols.remove(Protocol.valueOf(protocol));
}
if (attrProtocols.isEmpty()) { // Remove protocol set if empty
tagProtocols.remove(attr);
if (tagProtocols.isEmpty()) // Remove entry for tag if empty
protocols.remove(tagName);
}
return this;
} | java | public Whitelist removeProtocols(String tag, String attribute, String... removeProtocols) {
Validate.notEmpty(tag);
Validate.notEmpty(attribute);
Validate.notNull(removeProtocols);
TagName tagName = TagName.valueOf(tag);
AttributeKey attr = AttributeKey.valueOf(attribute);
// make sure that what we're removing actually exists; otherwise can open the tag to any data and that can
// be surprising
Validate.isTrue(protocols.containsKey(tagName), "Cannot remove a protocol that is not set.");
Map<AttributeKey, Set<Protocol>> tagProtocols = protocols.get(tagName);
Validate.isTrue(tagProtocols.containsKey(attr), "Cannot remove a protocol that is not set.");
Set<Protocol> attrProtocols = tagProtocols.get(attr);
for (String protocol : removeProtocols) {
Validate.notEmpty(protocol);
attrProtocols.remove(Protocol.valueOf(protocol));
}
if (attrProtocols.isEmpty()) { // Remove protocol set if empty
tagProtocols.remove(attr);
if (tagProtocols.isEmpty()) // Remove entry for tag if empty
protocols.remove(tagName);
}
return this;
} | [
"public",
"Whitelist",
"removeProtocols",
"(",
"String",
"tag",
",",
"String",
"attribute",
",",
"String",
"...",
"removeProtocols",
")",
"{",
"Validate",
".",
"notEmpty",
"(",
"tag",
")",
";",
"Validate",
".",
"notEmpty",
"(",
"attribute",
")",
";",
"Valida... | Remove allowed URL protocols for an element's URL attribute. If you remove all protocols for an attribute, that
attribute will allow any protocol.
<p>
E.g.: <code>removeProtocols("a", "href", "ftp")</code>
</p>
@param tag Tag the URL protocol is for
@param attribute Attribute name
@param removeProtocols List of invalid protocols
@return this, for chaining | [
"Remove",
"allowed",
"URL",
"protocols",
"for",
"an",
"element",
"s",
"URL",
"attribute",
".",
"If",
"you",
"remove",
"all",
"protocols",
"for",
"an",
"attribute",
"that",
"attribute",
"will",
"allow",
"any",
"protocol",
".",
"<p",
">",
"E",
".",
"g",
".... | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/safety/Whitelist.java#L452-L478 |
redbox-mint/redbox | plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/FormDataParser.java | FormDataParser.getObject | private static JsonObject getObject(JSONArray array, int index)
throws IOException {
// We can't just jam an entry into the array without
// checking that earlier indexes exist. Also we need
// to account for 0 versus 1 based indexing.
// Index changed to 0 based
if (index < 1) {
throw new IOException("Invalid index value provided in form data.");
}
index -= 1;
// Nice and easy, it already exists
if (array.size() > index) {
Object object = array.get(index);
if (object instanceof JsonObject) {
return (JsonObject) object;
}
throw new IOException("Non-Object found in array!");
// Slightly more annoying, we need to fill in
// all the indices up to this point
} else {
for (int i = array.size(); i <= index; i++) {
JsonObject object = new JsonObject();
array.add(object);
}
return (JsonObject) array.get(index);
}
} | java | private static JsonObject getObject(JSONArray array, int index)
throws IOException {
// We can't just jam an entry into the array without
// checking that earlier indexes exist. Also we need
// to account for 0 versus 1 based indexing.
// Index changed to 0 based
if (index < 1) {
throw new IOException("Invalid index value provided in form data.");
}
index -= 1;
// Nice and easy, it already exists
if (array.size() > index) {
Object object = array.get(index);
if (object instanceof JsonObject) {
return (JsonObject) object;
}
throw new IOException("Non-Object found in array!");
// Slightly more annoying, we need to fill in
// all the indices up to this point
} else {
for (int i = array.size(); i <= index; i++) {
JsonObject object = new JsonObject();
array.add(object);
}
return (JsonObject) array.get(index);
}
} | [
"private",
"static",
"JsonObject",
"getObject",
"(",
"JSONArray",
"array",
",",
"int",
"index",
")",
"throws",
"IOException",
"{",
"// We can't just jam an entry into the array without",
"// checking that earlier indexes exist. Also we need",
"// to account for 0 versus 1 based ind... | Get a child JSON Object from an incoming JSON array. If the child does
not exist it will be created, along with any smaller index values. The
index is expected to be 1 based (like form data).
It is only valid for form arrays to hold JSON Objects.
@param array The incoming array we are to look inside
@param index The child index we are looking for (1 based)
@return JsonObject The child we found or created
@throws IOException if anything other than an object is found, or an
invalid index is provided | [
"Get",
"a",
"child",
"JSON",
"Object",
"from",
"an",
"incoming",
"JSON",
"array",
".",
"If",
"the",
"child",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
"along",
"with",
"any",
"smaller",
"index",
"values",
".",
"The",
"index",
"is",
"expected... | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/FormDataParser.java#L231-L260 |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.readBytes | public static ByteBuf readBytes(ByteBufAllocator alloc, ByteBuf buffer, int length) {
boolean release = true;
ByteBuf dst = alloc.buffer(length);
try {
buffer.readBytes(dst);
release = false;
return dst;
} finally {
if (release) {
dst.release();
}
}
} | java | public static ByteBuf readBytes(ByteBufAllocator alloc, ByteBuf buffer, int length) {
boolean release = true;
ByteBuf dst = alloc.buffer(length);
try {
buffer.readBytes(dst);
release = false;
return dst;
} finally {
if (release) {
dst.release();
}
}
} | [
"public",
"static",
"ByteBuf",
"readBytes",
"(",
"ByteBufAllocator",
"alloc",
",",
"ByteBuf",
"buffer",
",",
"int",
"length",
")",
"{",
"boolean",
"release",
"=",
"true",
";",
"ByteBuf",
"dst",
"=",
"alloc",
".",
"buffer",
"(",
"length",
")",
";",
"try",
... | Read the given amount of bytes into a new {@link ByteBuf} that is allocated from the {@link ByteBufAllocator}. | [
"Read",
"the",
"given",
"amount",
"of",
"bytes",
"into",
"a",
"new",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L442-L454 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/HanLP.java | HanLP.extractWords | public static List<WordInfo> extractWords(BufferedReader reader, int size) throws IOException
{
return extractWords(reader, size, false);
} | java | public static List<WordInfo> extractWords(BufferedReader reader, int size) throws IOException
{
return extractWords(reader, size, false);
} | [
"public",
"static",
"List",
"<",
"WordInfo",
">",
"extractWords",
"(",
"BufferedReader",
"reader",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"return",
"extractWords",
"(",
"reader",
",",
"size",
",",
"false",
")",
";",
"}"
] | 提取词语
@param reader 从reader获取文本
@param size 需要提取词语的数量
@return 一个词语列表 | [
"提取词语"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L744-L747 |
influxdata/influxdb-java | src/main/java/org/influxdb/impl/Preconditions.java | Preconditions.checkDuration | public static void checkDuration(final String duration, final String name) throws IllegalArgumentException {
if (!duration.matches("(\\d+[wdmhs])+|inf")) {
throw new IllegalArgumentException("Invalid InfluxDB duration: " + duration
+ " for " + name);
}
} | java | public static void checkDuration(final String duration, final String name) throws IllegalArgumentException {
if (!duration.matches("(\\d+[wdmhs])+|inf")) {
throw new IllegalArgumentException("Invalid InfluxDB duration: " + duration
+ " for " + name);
}
} | [
"public",
"static",
"void",
"checkDuration",
"(",
"final",
"String",
"duration",
",",
"final",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"!",
"duration",
".",
"matches",
"(",
"\"(\\\\d+[wdmhs])+|inf\"",
")",
")",
"{",
"throw",
... | Enforces that the duration is a valid influxDB duration.
@param duration the duration to test
@param name variable name for reporting
@throws IllegalArgumentException if the given duration is not valid. | [
"Enforces",
"that",
"the",
"duration",
"is",
"a",
"valid",
"influxDB",
"duration",
"."
] | train | https://github.com/influxdata/influxdb-java/blob/8ae777f34aa2e598f609208cf4fa12d4642f83f5/src/main/java/org/influxdb/impl/Preconditions.java#L56-L61 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Waiter.java | Waiter.waitForFragment | public boolean waitForFragment(String tag, int id, int timeout){
long endTime = SystemClock.uptimeMillis() + timeout;
while (SystemClock.uptimeMillis() <= endTime) {
if(getSupportFragment(tag, id) != null)
return true;
if(getFragment(tag, id) != null)
return true;
}
return false;
} | java | public boolean waitForFragment(String tag, int id, int timeout){
long endTime = SystemClock.uptimeMillis() + timeout;
while (SystemClock.uptimeMillis() <= endTime) {
if(getSupportFragment(tag, id) != null)
return true;
if(getFragment(tag, id) != null)
return true;
}
return false;
} | [
"public",
"boolean",
"waitForFragment",
"(",
"String",
"tag",
",",
"int",
"id",
",",
"int",
"timeout",
")",
"{",
"long",
"endTime",
"=",
"SystemClock",
".",
"uptimeMillis",
"(",
")",
"+",
"timeout",
";",
"while",
"(",
"SystemClock",
".",
"uptimeMillis",
"(... | Waits for a Fragment with a given tag or id to appear.
@param tag the name of the tag or null if no tag
@param id the id of the tag
@param timeout the amount of time in milliseconds to wait
@return true if fragment appears and false if it does not appear before the timeout | [
"Waits",
"for",
"a",
"Fragment",
"with",
"a",
"given",
"tag",
"or",
"id",
"to",
"appear",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L682-L693 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/NameUtil.java | NameUtil.getHomeBeanClassName | public static String getHomeBeanClassName(EnterpriseBean enterpriseBean, boolean isPost11DD) // d114199
{
String packageName = null;
String homeInterfaceName = getHomeInterfaceName(enterpriseBean);
// LIDB2281.24.2 made several changes to code below, to accommodate case
// where neither a remote home nor a local home is present (EJB 2.1 allows
// this).
if (homeInterfaceName == null) { // f111627.1
homeInterfaceName = getLocalHomeInterfaceName(enterpriseBean); // f111627.1
}
if (homeInterfaceName != null) {
packageName = packageName(homeInterfaceName);
StringBuffer result = new StringBuffer();
if (packageName != null) {
result.append(packageName);
result.append('.');
}
result.append(homeBeanPrefix);
result.append(getUniquePrefix(enterpriseBean));
String homeName = encodeBeanInterfacesName(enterpriseBean, isPost11DD, false, true, true); // d114199 d147734
result.append(homeName);
return result.toString();
} else {
return null;
}
} | java | public static String getHomeBeanClassName(EnterpriseBean enterpriseBean, boolean isPost11DD) // d114199
{
String packageName = null;
String homeInterfaceName = getHomeInterfaceName(enterpriseBean);
// LIDB2281.24.2 made several changes to code below, to accommodate case
// where neither a remote home nor a local home is present (EJB 2.1 allows
// this).
if (homeInterfaceName == null) { // f111627.1
homeInterfaceName = getLocalHomeInterfaceName(enterpriseBean); // f111627.1
}
if (homeInterfaceName != null) {
packageName = packageName(homeInterfaceName);
StringBuffer result = new StringBuffer();
if (packageName != null) {
result.append(packageName);
result.append('.');
}
result.append(homeBeanPrefix);
result.append(getUniquePrefix(enterpriseBean));
String homeName = encodeBeanInterfacesName(enterpriseBean, isPost11DD, false, true, true); // d114199 d147734
result.append(homeName);
return result.toString();
} else {
return null;
}
} | [
"public",
"static",
"String",
"getHomeBeanClassName",
"(",
"EnterpriseBean",
"enterpriseBean",
",",
"boolean",
"isPost11DD",
")",
"// d114199",
"{",
"String",
"packageName",
"=",
"null",
";",
"String",
"homeInterfaceName",
"=",
"getHomeInterfaceName",
"(",
"enterpriseBe... | Return the name of the deployed home bean class. Assumption here is
the package name of the local and remote interfaces are the same. This
method uses the last package name found in either the remote or local
interface, if one or the other exist. If neither is found, null is returned.
@param enterpriseBean WCCM object for EnterpriseBean
@param isPost11DD true if bean is defined using later than 1.1 deployment description. | [
"Return",
"the",
"name",
"of",
"the",
"deployed",
"home",
"bean",
"class",
".",
"Assumption",
"here",
"is",
"the",
"package",
"name",
"of",
"the",
"local",
"and",
"remote",
"interfaces",
"are",
"the",
"same",
".",
"This",
"method",
"uses",
"the",
"last",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/NameUtil.java#L367-L399 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.read07BySax | public static Excel07SaxReader read07BySax(InputStream in, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel07SaxReader(rowHandler).read(in, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | java | public static Excel07SaxReader read07BySax(InputStream in, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel07SaxReader(rowHandler).read(in, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | [
"public",
"static",
"Excel07SaxReader",
"read07BySax",
"(",
"InputStream",
"in",
",",
"int",
"sheetIndex",
",",
"RowHandler",
"rowHandler",
")",
"{",
"try",
"{",
"return",
"new",
"Excel07SaxReader",
"(",
"rowHandler",
")",
".",
"read",
"(",
"in",
",",
"sheetIn... | Sax方式读取Excel07
@param in 输入流
@param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet
@param rowHandler 行处理器
@return {@link Excel07SaxReader}
@since 3.2.0 | [
"Sax方式读取Excel07"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L89-L95 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/util/HexHelper.java | HexHelper.fromHex | public static final byte[] fromHex(final String value)
{
if (value.length() == 0)
return new byte[0];
else if (value.indexOf(':') != -1)
return fromHex(':', value);
else if (value.length() % 2 != 0)
throw new IllegalArgumentException("Invalid hex specified: uneven number of digits passed for byte[] conversion");
final byte[] buffer = new byte[value.length() / 2];
// i tracks input position, j tracks output position
int j = 0;
for (int i = 0; i < buffer.length; i++)
{
buffer[i] = (byte) Integer.parseInt(value.substring(j, j + 2), 16);
j += 2;
}
return buffer;
} | java | public static final byte[] fromHex(final String value)
{
if (value.length() == 0)
return new byte[0];
else if (value.indexOf(':') != -1)
return fromHex(':', value);
else if (value.length() % 2 != 0)
throw new IllegalArgumentException("Invalid hex specified: uneven number of digits passed for byte[] conversion");
final byte[] buffer = new byte[value.length() / 2];
// i tracks input position, j tracks output position
int j = 0;
for (int i = 0; i < buffer.length; i++)
{
buffer[i] = (byte) Integer.parseInt(value.substring(j, j + 2), 16);
j += 2;
}
return buffer;
} | [
"public",
"static",
"final",
"byte",
"[",
"]",
"fromHex",
"(",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"value",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"new",
"byte",
"[",
"0",
"]",
";",
"else",
"if",
"(",
"value",
".",
"index... | Decodes a hexidecimal string into a series of bytes
@param value
@return | [
"Decodes",
"a",
"hexidecimal",
"string",
"into",
"a",
"series",
"of",
"bytes"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/util/HexHelper.java#L24-L44 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/FastAggregation.java | FastAggregation.priorityqueue_xor | public static RoaringBitmap priorityqueue_xor(RoaringBitmap... bitmaps) {
// TODO: This code could be faster, see priorityqueue_or
if (bitmaps.length == 0) {
return new RoaringBitmap();
}
PriorityQueue<RoaringBitmap> pq =
new PriorityQueue<>(bitmaps.length, new Comparator<RoaringBitmap>() {
@Override
public int compare(RoaringBitmap a, RoaringBitmap b) {
return (int)(a.getLongSizeInBytes() - b.getLongSizeInBytes());
}
});
Collections.addAll(pq, bitmaps);
while (pq.size() > 1) {
RoaringBitmap x1 = pq.poll();
RoaringBitmap x2 = pq.poll();
pq.add(RoaringBitmap.xor(x1, x2));
}
return pq.poll();
} | java | public static RoaringBitmap priorityqueue_xor(RoaringBitmap... bitmaps) {
// TODO: This code could be faster, see priorityqueue_or
if (bitmaps.length == 0) {
return new RoaringBitmap();
}
PriorityQueue<RoaringBitmap> pq =
new PriorityQueue<>(bitmaps.length, new Comparator<RoaringBitmap>() {
@Override
public int compare(RoaringBitmap a, RoaringBitmap b) {
return (int)(a.getLongSizeInBytes() - b.getLongSizeInBytes());
}
});
Collections.addAll(pq, bitmaps);
while (pq.size() > 1) {
RoaringBitmap x1 = pq.poll();
RoaringBitmap x2 = pq.poll();
pq.add(RoaringBitmap.xor(x1, x2));
}
return pq.poll();
} | [
"public",
"static",
"RoaringBitmap",
"priorityqueue_xor",
"(",
"RoaringBitmap",
"...",
"bitmaps",
")",
"{",
"// TODO: This code could be faster, see priorityqueue_or",
"if",
"(",
"bitmaps",
".",
"length",
"==",
"0",
")",
"{",
"return",
"new",
"RoaringBitmap",
"(",
")"... | Uses a priority queue to compute the xor aggregate.
This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps.
@param bitmaps input bitmaps
@return aggregated bitmap
@see #horizontal_xor(RoaringBitmap...) | [
"Uses",
"a",
"priority",
"queue",
"to",
"compute",
"the",
"xor",
"aggregate",
"."
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/FastAggregation.java#L494-L514 |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/geomorphology/curvatures/OmsCurvaturesBivariate.java | OmsCurvaturesBivariate.calculateCurvatures | public static void calculateCurvatures( RandomIter elevationIter, final double[] planTangProf, int ncols, int nrows, int col,
int row, double xRes, double yRes, double disXX, double disYY, int windowSize ) {
GridNode node = new GridNode(elevationIter, ncols, nrows, xRes, yRes, col, row);
double[][] window = node.getWindow(windowSize, false);
if (!hasNovalues(window)) {
double[] parameters = calculateParameters(window);
double a = parameters[0];
double b = parameters[1];
double c = parameters[2];
double d = parameters[3];
double e = parameters[4];
double slope = atan(sqrt(d * d + e * e));
slope = toDegrees(slope);
double aspect = atan(e / d);
aspect = toDegrees(aspect);
double profcNumerator = -200.0 * (a * d * d + b * e * e + c * d * e);
double profcDenominator = (e * e + d * d) * pow((1 + e * e + d * d), 1.5);
double profc = profcNumerator / profcDenominator;
double plancNumerator = -200.0 * (b * d * d + a * e * e + c * d * e);
double plancDenominator = pow((e * e + d * d), 1.5);
double planc = plancNumerator / plancDenominator;
planTangProf[0] = planc;
planTangProf[1] = profc;
planTangProf[2] = slope;
planTangProf[3] = aspect;
} else {
planTangProf[0] = doubleNovalue;
planTangProf[1] = doubleNovalue;
planTangProf[2] = doubleNovalue;
planTangProf[3] = doubleNovalue;
}
} | java | public static void calculateCurvatures( RandomIter elevationIter, final double[] planTangProf, int ncols, int nrows, int col,
int row, double xRes, double yRes, double disXX, double disYY, int windowSize ) {
GridNode node = new GridNode(elevationIter, ncols, nrows, xRes, yRes, col, row);
double[][] window = node.getWindow(windowSize, false);
if (!hasNovalues(window)) {
double[] parameters = calculateParameters(window);
double a = parameters[0];
double b = parameters[1];
double c = parameters[2];
double d = parameters[3];
double e = parameters[4];
double slope = atan(sqrt(d * d + e * e));
slope = toDegrees(slope);
double aspect = atan(e / d);
aspect = toDegrees(aspect);
double profcNumerator = -200.0 * (a * d * d + b * e * e + c * d * e);
double profcDenominator = (e * e + d * d) * pow((1 + e * e + d * d), 1.5);
double profc = profcNumerator / profcDenominator;
double plancNumerator = -200.0 * (b * d * d + a * e * e + c * d * e);
double plancDenominator = pow((e * e + d * d), 1.5);
double planc = plancNumerator / plancDenominator;
planTangProf[0] = planc;
planTangProf[1] = profc;
planTangProf[2] = slope;
planTangProf[3] = aspect;
} else {
planTangProf[0] = doubleNovalue;
planTangProf[1] = doubleNovalue;
planTangProf[2] = doubleNovalue;
planTangProf[3] = doubleNovalue;
}
} | [
"public",
"static",
"void",
"calculateCurvatures",
"(",
"RandomIter",
"elevationIter",
",",
"final",
"double",
"[",
"]",
"planTangProf",
",",
"int",
"ncols",
",",
"int",
"nrows",
",",
"int",
"col",
",",
"int",
"row",
",",
"double",
"xRes",
",",
"double",
"... | Calculate curvatures for a single cell.
@param elevationIter the elevation map.
@param planTangProf the array into which to insert the resulting [plan, tang, prof] curvatures.
@param col the column to process.
@param row the row to process.
@param ncols the columns of the raster.
@param nrows the rows of the raster.
@param xRes
@param yRes
@param disXX the diagonal size of the cell, x component.
@param disYY the diagonal size of the cell, y component. | [
"Calculate",
"curvatures",
"for",
"a",
"single",
"cell",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/geomorphology/curvatures/OmsCurvaturesBivariate.java#L175-L211 |
pushtorefresh/storio | storio-common/src/main/java/com/pushtorefresh/storio3/internal/Checks.java | Checks.checkNotEmpty | public static void checkNotEmpty(@Nullable String value, @NonNull String message) {
if (value == null) {
throw new NullPointerException(message);
} else if (value.length() == 0) {
throw new IllegalStateException(message);
}
} | java | public static void checkNotEmpty(@Nullable String value, @NonNull String message) {
if (value == null) {
throw new NullPointerException(message);
} else if (value.length() == 0) {
throw new IllegalStateException(message);
}
} | [
"public",
"static",
"void",
"checkNotEmpty",
"(",
"@",
"Nullable",
"String",
"value",
",",
"@",
"NonNull",
"String",
"message",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"message",
")",
";",
"}",
"... | Checks that passed string is not null and not empty,
throws {@link NullPointerException} or {@link IllegalStateException} with passed message
if string is null or empty.
@param value a string to check
@param message exception message if object is null | [
"Checks",
"that",
"passed",
"string",
"is",
"not",
"null",
"and",
"not",
"empty",
"throws",
"{",
"@link",
"NullPointerException",
"}",
"or",
"{",
"@link",
"IllegalStateException",
"}",
"with",
"passed",
"message",
"if",
"string",
"is",
"null",
"or",
"empty",
... | train | https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-common/src/main/java/com/pushtorefresh/storio3/internal/Checks.java#L38-L44 |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.addMessageListener | public void addMessageListener(DigitalChannel channel, MessageListener<? extends Message> messageListener) {
addListener(channel.getIdentifier(), messageListener.getMessageType(), messageListener);
} | java | public void addMessageListener(DigitalChannel channel, MessageListener<? extends Message> messageListener) {
addListener(channel.getIdentifier(), messageListener.getMessageType(), messageListener);
} | [
"public",
"void",
"addMessageListener",
"(",
"DigitalChannel",
"channel",
",",
"MessageListener",
"<",
"?",
"extends",
"Message",
">",
"messageListener",
")",
"{",
"addListener",
"(",
"channel",
".",
"getIdentifier",
"(",
")",
",",
"messageListener",
".",
"getMess... | Add a messageListener to the Firmata object which will fire whenever a matching message is received
over the SerialPort that corresponds to the given DigitalChannel.
@param channel DigitalChannel to listen on
@param messageListener MessageListener object to handle a received Message event over the SerialPort. | [
"Add",
"a",
"messageListener",
"to",
"the",
"Firmata",
"object",
"which",
"will",
"fire",
"whenever",
"a",
"matching",
"message",
"is",
"received",
"over",
"the",
"SerialPort",
"that",
"corresponds",
"to",
"the",
"given",
"DigitalChannel",
"."
] | train | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L185-L187 |
Red5/red5-server-common | src/main/java/org/red5/server/stream/ClientBroadcastStream.java | ClientBroadcastStream.onOOBControlMessage | public void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) {
String target = oobCtrlMsg.getTarget();
if ("ClientBroadcastStream".equals(target)) {
String serviceName = oobCtrlMsg.getServiceName();
if ("chunkSize".equals(serviceName)) {
chunkSize = (Integer) oobCtrlMsg.getServiceParamMap().get("chunkSize");
notifyChunkSize();
} else {
log.debug("Unhandled OOB control message for service: {}", serviceName);
}
} else {
log.debug("Unhandled OOB control message to target: {}", target);
}
} | java | public void onOOBControlMessage(IMessageComponent source, IPipe pipe, OOBControlMessage oobCtrlMsg) {
String target = oobCtrlMsg.getTarget();
if ("ClientBroadcastStream".equals(target)) {
String serviceName = oobCtrlMsg.getServiceName();
if ("chunkSize".equals(serviceName)) {
chunkSize = (Integer) oobCtrlMsg.getServiceParamMap().get("chunkSize");
notifyChunkSize();
} else {
log.debug("Unhandled OOB control message for service: {}", serviceName);
}
} else {
log.debug("Unhandled OOB control message to target: {}", target);
}
} | [
"public",
"void",
"onOOBControlMessage",
"(",
"IMessageComponent",
"source",
",",
"IPipe",
"pipe",
",",
"OOBControlMessage",
"oobCtrlMsg",
")",
"{",
"String",
"target",
"=",
"oobCtrlMsg",
".",
"getTarget",
"(",
")",
";",
"if",
"(",
"\"ClientBroadcastStream\"",
"."... | Out-of-band control message handler
@param source
OOB message source
@param pipe
Pipe that used to send OOB message
@param oobCtrlMsg
Out-of-band control message | [
"Out",
"-",
"of",
"-",
"band",
"control",
"message",
"handler"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/ClientBroadcastStream.java#L583-L596 |
feroult/yawp | yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java | ResourceFinder.mapAllStrings | public Map<String, String> mapAllStrings(String uri) throws IOException {
Map<String, String> strings = new HashMap<>();
Map<String, URL> resourcesMap = getResourcesMap(uri);
for (Iterator iterator = resourcesMap.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
String name = (String) entry.getKey();
URL url = (URL) entry.getValue();
String value = readContents(url);
strings.put(name, value);
}
return strings;
} | java | public Map<String, String> mapAllStrings(String uri) throws IOException {
Map<String, String> strings = new HashMap<>();
Map<String, URL> resourcesMap = getResourcesMap(uri);
for (Iterator iterator = resourcesMap.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
String name = (String) entry.getKey();
URL url = (URL) entry.getValue();
String value = readContents(url);
strings.put(name, value);
}
return strings;
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"mapAllStrings",
"(",
"String",
"uri",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"strings",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"Map",
"<",
"String",
",",
... | Reads the contents of all non-directory URLs immediately under the specified
location and returns them in a map keyed by the file name.
<p/>
Any URLs that cannot be read will cause an exception to be thrown.
<p/>
Example classpath:
<p/>
META-INF/serializables/one
META-INF/serializables/two
META-INF/serializables/three
META-INF/serializables/four/foo.txt
<p/>
ResourceFinder finder = new ResourceFinder("META-INF/");
Map map = finder.mapAvailableStrings("serializables");
map.contains("one"); // true
map.contains("two"); // true
map.contains("three"); // true
map.contains("four"); // false
@param uri
@return a list of the content of each resource URL found
@throws IOException if any of the urls cannot be read | [
"Reads",
"the",
"contents",
"of",
"all",
"non",
"-",
"directory",
"URLs",
"immediately",
"under",
"the",
"specified",
"location",
"and",
"returns",
"them",
"in",
"a",
"map",
"keyed",
"by",
"the",
"file",
"name",
".",
"<p",
"/",
">",
"Any",
"URLs",
"that"... | train | https://github.com/feroult/yawp/blob/b90deb905edd3fdb3009a5525e310cd17ead7f3d/yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java#L235-L246 |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/FetchActiveFlowDao.java | FetchActiveFlowDao.fetchUnfinishedFlows | Map<Integer, Pair<ExecutionReference, ExecutableFlow>> fetchUnfinishedFlows()
throws ExecutorManagerException {
try {
return this.dbOperator.query(FetchActiveExecutableFlows.FETCH_UNFINISHED_EXECUTABLE_FLOWS,
new FetchActiveExecutableFlows());
} catch (final SQLException e) {
throw new ExecutorManagerException("Error fetching unfinished flows", e);
}
} | java | Map<Integer, Pair<ExecutionReference, ExecutableFlow>> fetchUnfinishedFlows()
throws ExecutorManagerException {
try {
return this.dbOperator.query(FetchActiveExecutableFlows.FETCH_UNFINISHED_EXECUTABLE_FLOWS,
new FetchActiveExecutableFlows());
} catch (final SQLException e) {
throw new ExecutorManagerException("Error fetching unfinished flows", e);
}
} | [
"Map",
"<",
"Integer",
",",
"Pair",
"<",
"ExecutionReference",
",",
"ExecutableFlow",
">",
">",
"fetchUnfinishedFlows",
"(",
")",
"throws",
"ExecutorManagerException",
"{",
"try",
"{",
"return",
"this",
".",
"dbOperator",
".",
"query",
"(",
"FetchActiveExecutableF... | Fetch flows that are not in finished status, including both dispatched and non-dispatched
flows.
@return unfinished flows map
@throws ExecutorManagerException the executor manager exception | [
"Fetch",
"flows",
"that",
"are",
"not",
"in",
"finished",
"status",
"including",
"both",
"dispatched",
"and",
"non",
"-",
"dispatched",
"flows",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/FetchActiveFlowDao.java#L113-L121 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java | DocumentSubscriptions.createForRevisions | public <T> String createForRevisions(Class<T> clazz, SubscriptionCreationOptions options, String database) {
options = ObjectUtils.firstNonNull(options, new SubscriptionCreationOptions());
return create(ensureCriteria(options, clazz, true), database);
} | java | public <T> String createForRevisions(Class<T> clazz, SubscriptionCreationOptions options, String database) {
options = ObjectUtils.firstNonNull(options, new SubscriptionCreationOptions());
return create(ensureCriteria(options, clazz, true), database);
} | [
"public",
"<",
"T",
">",
"String",
"createForRevisions",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"SubscriptionCreationOptions",
"options",
",",
"String",
"database",
")",
"{",
"options",
"=",
"ObjectUtils",
".",
"firstNonNull",
"(",
"options",
",",
"new",
... | Creates a data subscription in a database. The subscription will expose all documents that match the specified subscription options for a given type.
@param options Subscription options
@param clazz Document class
@param <T> Document class
@param database Target database
@return created subscription | [
"Creates",
"a",
"data",
"subscription",
"in",
"a",
"database",
".",
"The",
"subscription",
"will",
"expose",
"all",
"documents",
"that",
"match",
"the",
"specified",
"subscription",
"options",
"for",
"a",
"given",
"type",
"."
] | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L120-L123 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/html/metadata/HCHead.java | HCHead.addJSAt | @Nonnull
public final HCHead addJSAt (@Nonnegative final int nIndex, @Nonnull final IHCNode aJS)
{
ValueEnforcer.notNull (aJS, "JS");
if (!HCJSNodeDetector.isJSNode (aJS))
throw new IllegalArgumentException (aJS + " is not a valid JS node!");
m_aJS.add (nIndex, aJS);
return this;
} | java | @Nonnull
public final HCHead addJSAt (@Nonnegative final int nIndex, @Nonnull final IHCNode aJS)
{
ValueEnforcer.notNull (aJS, "JS");
if (!HCJSNodeDetector.isJSNode (aJS))
throw new IllegalArgumentException (aJS + " is not a valid JS node!");
m_aJS.add (nIndex, aJS);
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"HCHead",
"addJSAt",
"(",
"@",
"Nonnegative",
"final",
"int",
"nIndex",
",",
"@",
"Nonnull",
"final",
"IHCNode",
"aJS",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aJS",
",",
"\"JS\"",
")",
";",
"if",
"(",
"!",
"... | Append some JavaScript code at the specified index
@param nIndex
The index where the JS should be added (counting only JS elements)
@param aJS
The JS to be added. May not be <code>null</code>.
@return this | [
"Append",
"some",
"JavaScript",
"code",
"at",
"the",
"specified",
"index"
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/html/metadata/HCHead.java#L281-L289 |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/ServerHandshaker.java | ServerHandshaker.clientKeyExchange | private SecretKey clientKeyExchange(KerberosClientKeyExchange mesg)
throws IOException {
if (debug != null && Debug.isOn("handshake")) {
mesg.print(System.out);
}
// Record the principals involved in exchange
session.setPeerPrincipal(mesg.getPeerPrincipal());
session.setLocalPrincipal(mesg.getLocalPrincipal());
byte[] b = mesg.getUnencryptedPreMasterSecret();
return new SecretKeySpec(b, "TlsPremasterSecret");
} | java | private SecretKey clientKeyExchange(KerberosClientKeyExchange mesg)
throws IOException {
if (debug != null && Debug.isOn("handshake")) {
mesg.print(System.out);
}
// Record the principals involved in exchange
session.setPeerPrincipal(mesg.getPeerPrincipal());
session.setLocalPrincipal(mesg.getLocalPrincipal());
byte[] b = mesg.getUnencryptedPreMasterSecret();
return new SecretKeySpec(b, "TlsPremasterSecret");
} | [
"private",
"SecretKey",
"clientKeyExchange",
"(",
"KerberosClientKeyExchange",
"mesg",
")",
"throws",
"IOException",
"{",
"if",
"(",
"debug",
"!=",
"null",
"&&",
"Debug",
".",
"isOn",
"(",
"\"handshake\"",
")",
")",
"{",
"mesg",
".",
"print",
"(",
"System",
... | /*
For Kerberos ciphers, the premaster secret is encrypted using
the session key. See RFC 2712. | [
"/",
"*",
"For",
"Kerberos",
"ciphers",
"the",
"premaster",
"secret",
"is",
"encrypted",
"using",
"the",
"session",
"key",
".",
"See",
"RFC",
"2712",
"."
] | train | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/ServerHandshaker.java#L1394-L1407 |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.vacateZone | public static Cluster vacateZone(Cluster currentCluster, int dropZoneId) {
Cluster returnCluster = Cluster.cloneCluster(currentCluster);
// Go over each node in the zone being dropped
for(Integer nodeId: currentCluster.getNodeIdsInZone(dropZoneId)) {
// For each node grab all the partitions it hosts
for(Integer partitionId: currentCluster.getNodeById(nodeId).getPartitionIds()) {
// Now for each partition find a new home..which would be a node
// in one of the existing zones
int finalZoneId = -1;
int finalNodeId = -1;
int adjacentPartitionId = partitionId;
do {
adjacentPartitionId = (adjacentPartitionId + 1)
% currentCluster.getNumberOfPartitions();
finalNodeId = currentCluster.getNodeForPartitionId(adjacentPartitionId).getId();
finalZoneId = currentCluster.getZoneForPartitionId(adjacentPartitionId).getId();
if(adjacentPartitionId == partitionId) {
logger.error("PartitionId " + partitionId + "stays unchanged \n");
} else {
logger.info("PartitionId " + partitionId
+ " goes together with partition " + adjacentPartitionId
+ " on node " + finalNodeId + " in zone " + finalZoneId);
returnCluster = UpdateClusterUtils.createUpdatedCluster(returnCluster,
finalNodeId,
Lists.newArrayList(partitionId));
}
} while(finalZoneId == dropZoneId);
}
}
return returnCluster;
} | java | public static Cluster vacateZone(Cluster currentCluster, int dropZoneId) {
Cluster returnCluster = Cluster.cloneCluster(currentCluster);
// Go over each node in the zone being dropped
for(Integer nodeId: currentCluster.getNodeIdsInZone(dropZoneId)) {
// For each node grab all the partitions it hosts
for(Integer partitionId: currentCluster.getNodeById(nodeId).getPartitionIds()) {
// Now for each partition find a new home..which would be a node
// in one of the existing zones
int finalZoneId = -1;
int finalNodeId = -1;
int adjacentPartitionId = partitionId;
do {
adjacentPartitionId = (adjacentPartitionId + 1)
% currentCluster.getNumberOfPartitions();
finalNodeId = currentCluster.getNodeForPartitionId(adjacentPartitionId).getId();
finalZoneId = currentCluster.getZoneForPartitionId(adjacentPartitionId).getId();
if(adjacentPartitionId == partitionId) {
logger.error("PartitionId " + partitionId + "stays unchanged \n");
} else {
logger.info("PartitionId " + partitionId
+ " goes together with partition " + adjacentPartitionId
+ " on node " + finalNodeId + " in zone " + finalZoneId);
returnCluster = UpdateClusterUtils.createUpdatedCluster(returnCluster,
finalNodeId,
Lists.newArrayList(partitionId));
}
} while(finalZoneId == dropZoneId);
}
}
return returnCluster;
} | [
"public",
"static",
"Cluster",
"vacateZone",
"(",
"Cluster",
"currentCluster",
",",
"int",
"dropZoneId",
")",
"{",
"Cluster",
"returnCluster",
"=",
"Cluster",
".",
"cloneCluster",
"(",
"currentCluster",
")",
";",
"// Go over each node in the zone being dropped",
"for",
... | Given the current cluster and a zone id that needs to be dropped, this
method will remove all partitions from the zone that is being dropped and
move it to the existing zones. The partitions are moved intelligently so
as not to avoid any data movement in the existing zones.
This is achieved by moving the partitions to nodes in the surviving zones
that is zone-nry to that partition in the surviving zone.
@param currentCluster Current cluster metadata
@return Returns an interim cluster with empty partition lists on the
nodes from the zone being dropped | [
"Given",
"the",
"current",
"cluster",
"and",
"a",
"zone",
"id",
"that",
"needs",
"to",
"be",
"dropped",
"this",
"method",
"will",
"remove",
"all",
"partitions",
"from",
"the",
"zone",
"that",
"is",
"being",
"dropped",
"and",
"move",
"it",
"to",
"the",
"e... | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L295-L325 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/GuestWindowsRegistryManager.java | GuestWindowsRegistryManager.deleteRegistryKeyInGuest | public void deleteRegistryKeyInGuest(VirtualMachine vm, GuestAuthentication auth, GuestRegKeyNameSpec keyName, boolean recursive) throws GuestComponentsOutOfDate, GuestOperationsFault,
GuestOperationsUnavailable, GuestPermissionDenied, GuestRegistryKeyHasSubkeys, GuestRegistryKeyInvalid, InvalidGuestLogin, InvalidPowerState, InvalidState, OperationDisabledByGuest,
OperationNotSupportedByGuest, RuntimeFault, TaskInProgress, RemoteException {
getVimService().deleteRegistryKeyInGuest(getMOR(), vm.getMOR(), auth, keyName, recursive);
} | java | public void deleteRegistryKeyInGuest(VirtualMachine vm, GuestAuthentication auth, GuestRegKeyNameSpec keyName, boolean recursive) throws GuestComponentsOutOfDate, GuestOperationsFault,
GuestOperationsUnavailable, GuestPermissionDenied, GuestRegistryKeyHasSubkeys, GuestRegistryKeyInvalid, InvalidGuestLogin, InvalidPowerState, InvalidState, OperationDisabledByGuest,
OperationNotSupportedByGuest, RuntimeFault, TaskInProgress, RemoteException {
getVimService().deleteRegistryKeyInGuest(getMOR(), vm.getMOR(), auth, keyName, recursive);
} | [
"public",
"void",
"deleteRegistryKeyInGuest",
"(",
"VirtualMachine",
"vm",
",",
"GuestAuthentication",
"auth",
",",
"GuestRegKeyNameSpec",
"keyName",
",",
"boolean",
"recursive",
")",
"throws",
"GuestComponentsOutOfDate",
",",
"GuestOperationsFault",
",",
"GuestOperationsUn... | Delete a registry key.
@param vm Virtual machine to perform the operation on.
@param auth The guest authentication data.
@param keyName The path to the registry key to be deleted.
@param recursive If true, the key is deleted along with any subkeys (if present). Otherwise, it shall only delete the key if it has no subkeys.
@throws GuestComponentsOutOfDate
@throws GuestOperationsFault
@throws GuestOperationsUnavailable
@throws GuestPermissionDenied
@throws GuestRegistryKeyHasSubkeys
@throws GuestRegistryKeyInvalid
@throws InvalidGuestLogin
@throws InvalidPowerState
@throws InvalidState
@throws OperationDisabledByGuest
@throws OperationNotSupportedByGuest
@throws RuntimeFault
@throws TaskInProgress
@throws RemoteException | [
"Delete",
"a",
"registry",
"key",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/GuestWindowsRegistryManager.java#L92-L96 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java | UsersInner.updateAsync | public Observable<UserInner> updateAsync(String resourceGroupName, String labAccountName, String labName, String userName, UserFragment user) {
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() {
@Override
public UserInner call(ServiceResponse<UserInner> response) {
return response.body();
}
});
} | java | public Observable<UserInner> updateAsync(String resourceGroupName, String labAccountName, String labName, String userName, UserFragment user) {
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() {
@Override
public UserInner call(ServiceResponse<UserInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UserInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"userName",
",",
"UserFragment",
"user",
")",
"{",
"return",
"updateWithServiceResponseAsync",
... | Modify properties of users.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param userName The name of the user.
@param user The User registered to a lab
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UserInner object | [
"Modify",
"properties",
"of",
"users",
"."
] | 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/UsersInner.java#L908-L915 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java | WebConfigParamUtils.getIntegerInitParameter | public static int getIntegerInitParameter(ExternalContext context, String name, int defaultValue)
{
if (name == null)
{
throw new NullPointerException();
}
String param = getStringInitParameter(context, name);
if (param == null)
{
return defaultValue;
}
else
{
return Integer.parseInt(param.toLowerCase());
}
} | java | public static int getIntegerInitParameter(ExternalContext context, String name, int defaultValue)
{
if (name == null)
{
throw new NullPointerException();
}
String param = getStringInitParameter(context, name);
if (param == null)
{
return defaultValue;
}
else
{
return Integer.parseInt(param.toLowerCase());
}
} | [
"public",
"static",
"int",
"getIntegerInitParameter",
"(",
"ExternalContext",
"context",
",",
"String",
"name",
",",
"int",
"defaultValue",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"Stri... | Gets the int init parameter value from the specified context. If the parameter was not specified,
the default value is used instead.
@param context
the application's external context
@param name
the init parameter's name
@param deprecatedName
the init parameter's deprecated name.
@param defaultValue
the default value to return in case the parameter was not set
@return the init parameter value as a int
@throws NullPointerException
if context or name is <code>null</code> | [
"Gets",
"the",
"int",
"init",
"parameter",
"value",
"from",
"the",
"specified",
"context",
".",
"If",
"the",
"parameter",
"was",
"not",
"specified",
"the",
"default",
"value",
"is",
"used",
"instead",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L457-L473 |
HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.doubleValue | protected double doubleValue(final char op, final String s) {
final double result = Double.parseDouble(s);
if (op == '-') {
return -1 * result;
}
return result;
} | java | protected double doubleValue(final char op, final String s) {
final double result = Double.parseDouble(s);
if (op == '-') {
return -1 * result;
}
return result;
} | [
"protected",
"double",
"doubleValue",
"(",
"final",
"char",
"op",
",",
"final",
"String",
"s",
")",
"{",
"final",
"double",
"result",
"=",
"Double",
".",
"parseDouble",
"(",
"s",
")",
";",
"if",
"(",
"op",
"==",
"'",
"'",
")",
"{",
"return",
"-",
"... | Parses the sting into an double.
@param op the sign char
@param s the string to parse
@return the double value | [
"Parses",
"the",
"sting",
"into",
"an",
"double",
"."
] | train | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L767-L773 |
bit3/jsass | example/webapp/src/main/java/io/bit3/jsass/example/webapp/JsassServlet.java | JsassServlet.resolveImport | private Collection<Import> resolveImport(Path path) throws IOException, URISyntaxException {
URL resource = resolveResource(path);
if (null == resource) {
return null;
}
// calculate a webapp absolute URI
final URI uri = new URI(
Paths.get("/").resolve(
Paths.get(getServletContext().getResource("/").toURI()).relativize(Paths.get(resource.toURI()))
).toString()
);
final String source = IOUtils.toString(resource, StandardCharsets.UTF_8);
final Import scssImport = new Import(uri, uri, source);
return Collections.singleton(scssImport);
} | java | private Collection<Import> resolveImport(Path path) throws IOException, URISyntaxException {
URL resource = resolveResource(path);
if (null == resource) {
return null;
}
// calculate a webapp absolute URI
final URI uri = new URI(
Paths.get("/").resolve(
Paths.get(getServletContext().getResource("/").toURI()).relativize(Paths.get(resource.toURI()))
).toString()
);
final String source = IOUtils.toString(resource, StandardCharsets.UTF_8);
final Import scssImport = new Import(uri, uri, source);
return Collections.singleton(scssImport);
} | [
"private",
"Collection",
"<",
"Import",
">",
"resolveImport",
"(",
"Path",
"path",
")",
"throws",
"IOException",
",",
"URISyntaxException",
"{",
"URL",
"resource",
"=",
"resolveResource",
"(",
"path",
")",
";",
"if",
"(",
"null",
"==",
"resource",
")",
"{",
... | Try to determine the import object for a given path.
@param path The path to resolve.
@return The import object or {@code null} if the file was not found. | [
"Try",
"to",
"determine",
"the",
"import",
"object",
"for",
"a",
"given",
"path",
"."
] | train | https://github.com/bit3/jsass/blob/fba91d5cb1eb507c7cfde5a261e04b1d328cb1ef/example/webapp/src/main/java/io/bit3/jsass/example/webapp/JsassServlet.java#L139-L156 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.catalog_formatted_privateCloudReseller_GET | public net.minidev.ovh.api.order.catalog.pcc.OvhCatalog catalog_formatted_privateCloudReseller_GET(OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException {
String qPath = "/order/catalog/formatted/privateCloudReseller";
StringBuilder sb = path(qPath);
query(sb, "ovhSubsidiary", ovhSubsidiary);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.order.catalog.pcc.OvhCatalog.class);
} | java | public net.minidev.ovh.api.order.catalog.pcc.OvhCatalog catalog_formatted_privateCloudReseller_GET(OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException {
String qPath = "/order/catalog/formatted/privateCloudReseller";
StringBuilder sb = path(qPath);
query(sb, "ovhSubsidiary", ovhSubsidiary);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.order.catalog.pcc.OvhCatalog.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"order",
".",
"catalog",
".",
"pcc",
".",
"OvhCatalog",
"catalog_formatted_privateCloudReseller_GET",
"(",
"OvhOvhSubsidiaryEnum",
"ovhSubsidiary",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
... | Retrieve information of Private Cloud Reseller catalog
REST: GET /order/catalog/formatted/privateCloudReseller
@param ovhSubsidiary [required] Subsidiary of the country you want to consult catalog | [
"Retrieve",
"information",
"of",
"Private",
"Cloud",
"Reseller",
"catalog"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L7205-L7211 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/blobstore/BlobStore.java | BlobStore.createBlob | public void createBlob(String key, byte [] data, SettableBlobMeta meta) throws KeyAlreadyExistsException, IOException {
AtomicOutputStream out = null;
try {
out = createBlob(key, meta);
out.write(data);
out.close();
out = null;
} finally {
if (out != null) {
out.cancel();
}
}
} | java | public void createBlob(String key, byte [] data, SettableBlobMeta meta) throws KeyAlreadyExistsException, IOException {
AtomicOutputStream out = null;
try {
out = createBlob(key, meta);
out.write(data);
out.close();
out = null;
} finally {
if (out != null) {
out.cancel();
}
}
} | [
"public",
"void",
"createBlob",
"(",
"String",
"key",
",",
"byte",
"[",
"]",
"data",
",",
"SettableBlobMeta",
"meta",
")",
"throws",
"KeyAlreadyExistsException",
",",
"IOException",
"{",
"AtomicOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
... | Wrapper called to create the blob which contains
the byte data
@param key Key for the blob.
@param data Byte data that needs to be uploaded.
@param meta Metadata which contains the acls information
@throws KeyAlreadyExistsException
@throws IOException | [
"Wrapper",
"called",
"to",
"create",
"the",
"blob",
"which",
"contains",
"the",
"byte",
"data"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/blobstore/BlobStore.java#L165-L177 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/routing/subnetwork/PrepareRoutingSubnetworks.java | PrepareRoutingSubnetworks.removeEdges | int removeEdges(final PrepEdgeFilter bothFilter, List<IntArrayList> components, int min) {
// remove edges determined from nodes but only if less than minimum size
EdgeExplorer explorer = ghStorage.createEdgeExplorer(bothFilter);
int removedEdges = 0;
for (IntArrayList component : components) {
removedEdges += removeEdges(explorer, bothFilter.getAccessEnc(), component, min);
}
return removedEdges;
} | java | int removeEdges(final PrepEdgeFilter bothFilter, List<IntArrayList> components, int min) {
// remove edges determined from nodes but only if less than minimum size
EdgeExplorer explorer = ghStorage.createEdgeExplorer(bothFilter);
int removedEdges = 0;
for (IntArrayList component : components) {
removedEdges += removeEdges(explorer, bothFilter.getAccessEnc(), component, min);
}
return removedEdges;
} | [
"int",
"removeEdges",
"(",
"final",
"PrepEdgeFilter",
"bothFilter",
",",
"List",
"<",
"IntArrayList",
">",
"components",
",",
"int",
"min",
")",
"{",
"// remove edges determined from nodes but only if less than minimum size",
"EdgeExplorer",
"explorer",
"=",
"ghStorage",
... | This method removes the access to edges available from the nodes contained in the components.
But only if a components' size is smaller then the specified min value.
@return number of removed edges | [
"This",
"method",
"removes",
"the",
"access",
"to",
"edges",
"available",
"from",
"the",
"nodes",
"contained",
"in",
"the",
"components",
".",
"But",
"only",
"if",
"a",
"components",
"size",
"is",
"smaller",
"then",
"the",
"specified",
"min",
"value",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/subnetwork/PrepareRoutingSubnetworks.java#L216-L224 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.