repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/launchable/LauncherModel.java | LauncherModel.computeVector | private Force computeVector(Force vector) {
"""
Compute the vector used for launch.
@param vector The initial vector used for launch.
@return The vector used for launch.
"""
if (target != null)
{
return computeVector(vector, target);
}
vector.setDestination(vector.getDirectionHorizontal(), vector.getDirectionVertical());
return vector;
} | java | private Force computeVector(Force vector)
{
if (target != null)
{
return computeVector(vector, target);
}
vector.setDestination(vector.getDirectionHorizontal(), vector.getDirectionVertical());
return vector;
} | [
"private",
"Force",
"computeVector",
"(",
"Force",
"vector",
")",
"{",
"if",
"(",
"target",
"!=",
"null",
")",
"{",
"return",
"computeVector",
"(",
"vector",
",",
"target",
")",
";",
"}",
"vector",
".",
"setDestination",
"(",
"vector",
".",
"getDirectionHorizontal",
"(",
")",
",",
"vector",
".",
"getDirectionVertical",
"(",
")",
")",
";",
"return",
"vector",
";",
"}"
] | Compute the vector used for launch.
@param vector The initial vector used for launch.
@return The vector used for launch. | [
"Compute",
"the",
"vector",
"used",
"for",
"launch",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/launchable/LauncherModel.java#L188-L196 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/CLINK.java | CLINK.clinkstep8 | private void clinkstep8(DBIDRef id, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableDoubleDataStore m) {
"""
Update hierarchy.
@param id Current object
@param it Iterator
@param n Last object to process
@param pi Parent data store
@param lambda Height data store
@param m Distance data store
"""
DBIDVar p_i = DBIDUtil.newVar(), pp_i = DBIDUtil.newVar();
for(it.seek(0); it.getOffset() < n; it.advance()) {
p_i.from(pi, it); // p_i = pi[i]
pp_i.from(pi, p_i); // pp_i = pi[pi[i]]
if(DBIDUtil.equal(pp_i, id) && lambda.doubleValue(it) >= lambda.doubleValue(p_i)) {
pi.putDBID(it, id);
}
}
} | java | private void clinkstep8(DBIDRef id, DBIDArrayIter it, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableDoubleDataStore m) {
DBIDVar p_i = DBIDUtil.newVar(), pp_i = DBIDUtil.newVar();
for(it.seek(0); it.getOffset() < n; it.advance()) {
p_i.from(pi, it); // p_i = pi[i]
pp_i.from(pi, p_i); // pp_i = pi[pi[i]]
if(DBIDUtil.equal(pp_i, id) && lambda.doubleValue(it) >= lambda.doubleValue(p_i)) {
pi.putDBID(it, id);
}
}
} | [
"private",
"void",
"clinkstep8",
"(",
"DBIDRef",
"id",
",",
"DBIDArrayIter",
"it",
",",
"int",
"n",
",",
"WritableDBIDDataStore",
"pi",
",",
"WritableDoubleDataStore",
"lambda",
",",
"WritableDoubleDataStore",
"m",
")",
"{",
"DBIDVar",
"p_i",
"=",
"DBIDUtil",
".",
"newVar",
"(",
")",
",",
"pp_i",
"=",
"DBIDUtil",
".",
"newVar",
"(",
")",
";",
"for",
"(",
"it",
".",
"seek",
"(",
"0",
")",
";",
"it",
".",
"getOffset",
"(",
")",
"<",
"n",
";",
"it",
".",
"advance",
"(",
")",
")",
"{",
"p_i",
".",
"from",
"(",
"pi",
",",
"it",
")",
";",
"// p_i = pi[i]",
"pp_i",
".",
"from",
"(",
"pi",
",",
"p_i",
")",
";",
"// pp_i = pi[pi[i]]",
"if",
"(",
"DBIDUtil",
".",
"equal",
"(",
"pp_i",
",",
"id",
")",
"&&",
"lambda",
".",
"doubleValue",
"(",
"it",
")",
">=",
"lambda",
".",
"doubleValue",
"(",
"p_i",
")",
")",
"{",
"pi",
".",
"putDBID",
"(",
"it",
",",
"id",
")",
";",
"}",
"}",
"}"
] | Update hierarchy.
@param id Current object
@param it Iterator
@param n Last object to process
@param pi Parent data store
@param lambda Height data store
@param m Distance data store | [
"Update",
"hierarchy",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/CLINK.java#L195-L204 |
duracloud/duracloud | durastore/src/main/java/org/duracloud/durastore/rest/StoreRest.java | StoreRest.getStores | @GET
public Response getStores() {
"""
Provides a listing of all available storage provider accounts
@return 200 response with XML file listing stores
"""
String msg = "getting stores.";
try {
return doGetStores(msg);
} catch (StorageException se) {
return responseBad(msg, se);
} catch (Exception e) {
return responseBad(msg, e);
}
} | java | @GET
public Response getStores() {
String msg = "getting stores.";
try {
return doGetStores(msg);
} catch (StorageException se) {
return responseBad(msg, se);
} catch (Exception e) {
return responseBad(msg, e);
}
} | [
"@",
"GET",
"public",
"Response",
"getStores",
"(",
")",
"{",
"String",
"msg",
"=",
"\"getting stores.\"",
";",
"try",
"{",
"return",
"doGetStores",
"(",
"msg",
")",
";",
"}",
"catch",
"(",
"StorageException",
"se",
")",
"{",
"return",
"responseBad",
"(",
"msg",
",",
"se",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"responseBad",
"(",
"msg",
",",
"e",
")",
";",
"}",
"}"
] | Provides a listing of all available storage provider accounts
@return 200 response with XML file listing stores | [
"Provides",
"a",
"listing",
"of",
"all",
"available",
"storage",
"provider",
"accounts"
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/StoreRest.java#L49-L61 |
UrielCh/ovh-java-sdk | ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java | ApiOvhPrice.xdsl_addressMove_fee_option_GET | public OvhPrice xdsl_addressMove_fee_option_GET(net.minidev.ovh.api.price.xdsl.addressmove.OvhFeeEnum option) throws IOException {
"""
Get the price of address move option fee
REST: GET /price/xdsl/addressMove/fee/{option}
@param option [required] The option name
"""
String qPath = "/price/xdsl/addressMove/fee/{option}";
StringBuilder sb = path(qPath, option);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | java | public OvhPrice xdsl_addressMove_fee_option_GET(net.minidev.ovh.api.price.xdsl.addressmove.OvhFeeEnum option) throws IOException {
String qPath = "/price/xdsl/addressMove/fee/{option}";
StringBuilder sb = path(qPath, option);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | [
"public",
"OvhPrice",
"xdsl_addressMove_fee_option_GET",
"(",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"price",
".",
"xdsl",
".",
"addressmove",
".",
"OvhFeeEnum",
"option",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/price/xdsl/addressMove/fee/{option}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"option",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhPrice",
".",
"class",
")",
";",
"}"
] | Get the price of address move option fee
REST: GET /price/xdsl/addressMove/fee/{option}
@param option [required] The option name | [
"Get",
"the",
"price",
"of",
"address",
"move",
"option",
"fee"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L37-L42 |
edwardcapriolo/gossip | src/main/java/com/google/code/gossip/manager/GossipManager.java | GossipManager.handleNotification | @Override
public void handleNotification(Notification notification, Object handback) {
"""
All timers associated with a member will trigger this method when it goes off. The timer will
go off if we have not heard from this member in <code> _settings.T_CLEANUP </code> time.
"""
LocalGossipMember deadMember = (LocalGossipMember) notification.getUserData();
GossipService.LOGGER.debug("Dead member detected: " + deadMember);
members.put(deadMember, GossipState.DOWN);
if (listener != null) {
listener.gossipEvent(deadMember, GossipState.DOWN);
}
} | java | @Override
public void handleNotification(Notification notification, Object handback) {
LocalGossipMember deadMember = (LocalGossipMember) notification.getUserData();
GossipService.LOGGER.debug("Dead member detected: " + deadMember);
members.put(deadMember, GossipState.DOWN);
if (listener != null) {
listener.gossipEvent(deadMember, GossipState.DOWN);
}
} | [
"@",
"Override",
"public",
"void",
"handleNotification",
"(",
"Notification",
"notification",
",",
"Object",
"handback",
")",
"{",
"LocalGossipMember",
"deadMember",
"=",
"(",
"LocalGossipMember",
")",
"notification",
".",
"getUserData",
"(",
")",
";",
"GossipService",
".",
"LOGGER",
".",
"debug",
"(",
"\"Dead member detected: \"",
"+",
"deadMember",
")",
";",
"members",
".",
"put",
"(",
"deadMember",
",",
"GossipState",
".",
"DOWN",
")",
";",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"listener",
".",
"gossipEvent",
"(",
"deadMember",
",",
"GossipState",
".",
"DOWN",
")",
";",
"}",
"}"
] | All timers associated with a member will trigger this method when it goes off. The timer will
go off if we have not heard from this member in <code> _settings.T_CLEANUP </code> time. | [
"All",
"timers",
"associated",
"with",
"a",
"member",
"will",
"trigger",
"this",
"method",
"when",
"it",
"goes",
"off",
".",
"The",
"timer",
"will",
"go",
"off",
"if",
"we",
"have",
"not",
"heard",
"from",
"this",
"member",
"in",
"<code",
">",
"_settings",
".",
"T_CLEANUP",
"<",
"/",
"code",
">",
"time",
"."
] | train | https://github.com/edwardcapriolo/gossip/blob/ac87301458c7ba4eb7d952046894ebf42ffb0518/src/main/java/com/google/code/gossip/manager/GossipManager.java#L102-L110 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java | Calc.getTMScore | public static double getTMScore(Atom[] atomSet1, Atom[] atomSet2, int len1, int len2) throws StructureException {
"""
Calculate the TM-Score for the superposition.
<em>Normalizes by the <strong>minimum</strong>-length structure (that is, {@code min\{len1,len2\}}).</em>
Atom sets must be pre-rotated.
<p>
Citation:<br/>
<i>Zhang Y and Skolnick J (2004). "Scoring function for automated
assessment of protein structure template quality". Proteins 57: 702 -
710.</i>
@param atomSet1
atom array 1
@param atomSet2
atom array 2
@param len1
The full length of the protein supplying atomSet1
@param len2
The full length of the protein supplying atomSet2
@return The TM-Score
@throws StructureException
"""
return getTMScore(atomSet1, atomSet2, len1, len2,true);
} | java | public static double getTMScore(Atom[] atomSet1, Atom[] atomSet2, int len1, int len2) throws StructureException {
return getTMScore(atomSet1, atomSet2, len1, len2,true);
} | [
"public",
"static",
"double",
"getTMScore",
"(",
"Atom",
"[",
"]",
"atomSet1",
",",
"Atom",
"[",
"]",
"atomSet2",
",",
"int",
"len1",
",",
"int",
"len2",
")",
"throws",
"StructureException",
"{",
"return",
"getTMScore",
"(",
"atomSet1",
",",
"atomSet2",
",",
"len1",
",",
"len2",
",",
"true",
")",
";",
"}"
] | Calculate the TM-Score for the superposition.
<em>Normalizes by the <strong>minimum</strong>-length structure (that is, {@code min\{len1,len2\}}).</em>
Atom sets must be pre-rotated.
<p>
Citation:<br/>
<i>Zhang Y and Skolnick J (2004). "Scoring function for automated
assessment of protein structure template quality". Proteins 57: 702 -
710.</i>
@param atomSet1
atom array 1
@param atomSet2
atom array 2
@param len1
The full length of the protein supplying atomSet1
@param len2
The full length of the protein supplying atomSet2
@return The TM-Score
@throws StructureException | [
"Calculate",
"the",
"TM",
"-",
"Score",
"for",
"the",
"superposition",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L1285-L1287 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateAffineXYZ | public Matrix4f rotateAffineXYZ(float angleX, float angleY, float angleZ) {
"""
Apply rotation of <code>angleX</code> radians about the X axis, followed by a rotation of <code>angleY</code> radians about the Y axis and
followed by a rotation of <code>angleZ</code> radians about the Z axis.
<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 assumes that <code>this</code> matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to <code>(0, 0, 0, 1)</code>)
and can be used to speed up matrix multiplication if the matrix only represents affine transformations, such as translation, rotation, scaling and shearing (in any combination).
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateX(angleX).rotateY(angleY).rotateZ(angleZ)</code>
@param angleX
the angle to rotate about X
@param angleY
the angle to rotate about Y
@param angleZ
the angle to rotate about Z
@return a matrix holding the result
"""
return rotateAffineXYZ(angleX, angleY, angleZ, thisOrNew());
} | java | public Matrix4f rotateAffineXYZ(float angleX, float angleY, float angleZ) {
return rotateAffineXYZ(angleX, angleY, angleZ, thisOrNew());
} | [
"public",
"Matrix4f",
"rotateAffineXYZ",
"(",
"float",
"angleX",
",",
"float",
"angleY",
",",
"float",
"angleZ",
")",
"{",
"return",
"rotateAffineXYZ",
"(",
"angleX",
",",
"angleY",
",",
"angleZ",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
] | Apply rotation of <code>angleX</code> radians about the X axis, followed by a rotation of <code>angleY</code> radians about the Y axis and
followed by a rotation of <code>angleZ</code> radians about the Z axis.
<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 assumes that <code>this</code> matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to <code>(0, 0, 0, 1)</code>)
and can be used to speed up matrix multiplication if the matrix only represents affine transformations, such as translation, rotation, scaling and shearing (in any combination).
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateX(angleX).rotateY(angleY).rotateZ(angleZ)</code>
@param angleX
the angle to rotate about X
@param angleY
the angle to rotate about Y
@param angleZ
the angle to rotate about Z
@return a matrix holding the result | [
"Apply",
"rotation",
"of",
"<code",
">",
"angleX<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angleY<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axis",
"and",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angleZ<",
"/",
"code",
">",
"radians",
"about",
"the",
"Z",
"axis",
".",
"<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",
"assumes",
"that",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"represents",
"an",
"{",
"@link",
"#isAffine",
"()",
"affine",
"}",
"transformation",
"(",
"i",
".",
"e",
".",
"its",
"last",
"row",
"is",
"equal",
"to",
"<code",
">",
"(",
"0",
"0",
"0",
"1",
")",
"<",
"/",
"code",
">",
")",
"and",
"can",
"be",
"used",
"to",
"speed",
"up",
"matrix",
"multiplication",
"if",
"the",
"matrix",
"only",
"represents",
"affine",
"transformations",
"such",
"as",
"translation",
"rotation",
"scaling",
"and",
"shearing",
"(",
"in",
"any",
"combination",
")",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"R<",
"/",
"code",
">",
"the",
"rotation",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"R<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"R",
"*",
"v<",
"/",
"code",
">",
"the",
"rotation",
"will",
"be",
"applied",
"first!",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
":",
"<code",
">",
"rotateX",
"(",
"angleX",
")",
".",
"rotateY",
"(",
"angleY",
")",
".",
"rotateZ",
"(",
"angleZ",
")",
"<",
"/",
"code",
">"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L5399-L5401 |
spockframework/spock | spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java | GroovyRuntimeUtil.invokeMethod | public static Object invokeMethod(Object target, String method, Object... args) {
"""
Note: This method may throw checked exceptions although it doesn't say so.
"""
try {
return InvokerHelper.invokeMethod(target, method, args);
} catch (InvokerInvocationException e) {
ExceptionUtil.sneakyThrow(e.getCause());
return null; // never reached
}
} | java | public static Object invokeMethod(Object target, String method, Object... args) {
try {
return InvokerHelper.invokeMethod(target, method, args);
} catch (InvokerInvocationException e) {
ExceptionUtil.sneakyThrow(e.getCause());
return null; // never reached
}
} | [
"public",
"static",
"Object",
"invokeMethod",
"(",
"Object",
"target",
",",
"String",
"method",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"return",
"InvokerHelper",
".",
"invokeMethod",
"(",
"target",
",",
"method",
",",
"args",
")",
";",
"}",
"catch",
"(",
"InvokerInvocationException",
"e",
")",
"{",
"ExceptionUtil",
".",
"sneakyThrow",
"(",
"e",
".",
"getCause",
"(",
")",
")",
";",
"return",
"null",
";",
"// never reached",
"}",
"}"
] | Note: This method may throw checked exceptions although it doesn't say so. | [
"Note",
":",
"This",
"method",
"may",
"throw",
"checked",
"exceptions",
"although",
"it",
"doesn",
"t",
"say",
"so",
"."
] | train | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java#L169-L176 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.removeAll | @SafeVarargs
public static short[] removeAll(final short[] a, final short... elements) {
"""
Returns a new array with removes all the occurrences of specified elements from <code>a</code>
@param a
@param elements
@return
@see Collection#removeAll(Collection)
"""
if (N.isNullOrEmpty(a)) {
return N.EMPTY_SHORT_ARRAY;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final ShortList list = ShortList.of(a.clone());
list.removeAll(ShortList.of(elements));
return list.trimToSize().array();
} | java | @SafeVarargs
public static short[] removeAll(final short[] a, final short... elements) {
if (N.isNullOrEmpty(a)) {
return N.EMPTY_SHORT_ARRAY;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final ShortList list = ShortList.of(a.clone());
list.removeAll(ShortList.of(elements));
return list.trimToSize().array();
} | [
"@",
"SafeVarargs",
"public",
"static",
"short",
"[",
"]",
"removeAll",
"(",
"final",
"short",
"[",
"]",
"a",
",",
"final",
"short",
"...",
"elements",
")",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"a",
")",
")",
"{",
"return",
"N",
".",
"EMPTY_SHORT_ARRAY",
";",
"}",
"else",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"elements",
")",
")",
"{",
"return",
"a",
".",
"clone",
"(",
")",
";",
"}",
"else",
"if",
"(",
"elements",
".",
"length",
"==",
"1",
")",
"{",
"return",
"removeAllOccurrences",
"(",
"a",
",",
"elements",
"[",
"0",
"]",
")",
";",
"}",
"final",
"ShortList",
"list",
"=",
"ShortList",
".",
"of",
"(",
"a",
".",
"clone",
"(",
")",
")",
";",
"list",
".",
"removeAll",
"(",
"ShortList",
".",
"of",
"(",
"elements",
")",
")",
";",
"return",
"list",
".",
"trimToSize",
"(",
")",
".",
"array",
"(",
")",
";",
"}"
] | Returns a new array with removes all the occurrences of specified elements from <code>a</code>
@param a
@param elements
@return
@see Collection#removeAll(Collection) | [
"Returns",
"a",
"new",
"array",
"with",
"removes",
"all",
"the",
"occurrences",
"of",
"specified",
"elements",
"from",
"<code",
">",
"a<",
"/",
"code",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L23420-L23433 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Document.java | Document.addKeywords | public boolean addKeywords(String keywords) {
"""
Adds the keywords to a Document.
@param keywords
adds the keywords to the document
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
"""
try {
return add(new Meta(Element.KEYWORDS, keywords));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | java | public boolean addKeywords(String keywords) {
try {
return add(new Meta(Element.KEYWORDS, keywords));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | [
"public",
"boolean",
"addKeywords",
"(",
"String",
"keywords",
")",
"{",
"try",
"{",
"return",
"add",
"(",
"new",
"Meta",
"(",
"Element",
".",
"KEYWORDS",
",",
"keywords",
")",
")",
";",
"}",
"catch",
"(",
"DocumentException",
"de",
")",
"{",
"throw",
"new",
"ExceptionConverter",
"(",
"de",
")",
";",
"}",
"}"
] | Adds the keywords to a Document.
@param keywords
adds the keywords to the document
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise | [
"Adds",
"the",
"keywords",
"to",
"a",
"Document",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Document.java#L560-L566 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/Wikipedia.java | Wikipedia.getCategory | public Category getCategory(int pageId) {
"""
Gets the category for a given pageId.
@param pageId The id of the {@link Category}.
@return The category object or null if no category with this pageId exists.
"""
long hibernateId = __getCategoryHibernateId(pageId);
if (hibernateId == -1) {
return null;
}
try {
Category cat = new Category(this, hibernateId);
return cat;
} catch (WikiPageNotFoundException e) {
return null;
}
} | java | public Category getCategory(int pageId) {
long hibernateId = __getCategoryHibernateId(pageId);
if (hibernateId == -1) {
return null;
}
try {
Category cat = new Category(this, hibernateId);
return cat;
} catch (WikiPageNotFoundException e) {
return null;
}
} | [
"public",
"Category",
"getCategory",
"(",
"int",
"pageId",
")",
"{",
"long",
"hibernateId",
"=",
"__getCategoryHibernateId",
"(",
"pageId",
")",
";",
"if",
"(",
"hibernateId",
"==",
"-",
"1",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"Category",
"cat",
"=",
"new",
"Category",
"(",
"this",
",",
"hibernateId",
")",
";",
"return",
"cat",
";",
"}",
"catch",
"(",
"WikiPageNotFoundException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Gets the category for a given pageId.
@param pageId The id of the {@link Category}.
@return The category object or null if no category with this pageId exists. | [
"Gets",
"the",
"category",
"for",
"a",
"given",
"pageId",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/Wikipedia.java#L473-L485 |
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) {
"""
Returns all the commerce price lists where groupId = ?.
@param groupId the group ID
@return the matching commerce price lists
"""
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommercePriceList> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommercePriceList",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce price lists where groupId = ?.
@param groupId the group ID
@return the matching commerce price lists | [
"Returns",
"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#L1524-L1527 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java | Fastpath.getOID | public long getOID(String name, FastpathArg[] args) throws SQLException {
"""
This convenience method assumes that the return value is an oid.
@param name Function name
@param args Function arguments
@return oid of the given call
@throws SQLException if a database-access error occurs or no result
"""
long oid = getInteger(name, args);
if (oid < 0) {
oid += NUM_OIDS;
}
return oid;
} | java | public long getOID(String name, FastpathArg[] args) throws SQLException {
long oid = getInteger(name, args);
if (oid < 0) {
oid += NUM_OIDS;
}
return oid;
} | [
"public",
"long",
"getOID",
"(",
"String",
"name",
",",
"FastpathArg",
"[",
"]",
"args",
")",
"throws",
"SQLException",
"{",
"long",
"oid",
"=",
"getInteger",
"(",
"name",
",",
"args",
")",
";",
"if",
"(",
"oid",
"<",
"0",
")",
"{",
"oid",
"+=",
"NUM_OIDS",
";",
"}",
"return",
"oid",
";",
"}"
] | This convenience method assumes that the return value is an oid.
@param name Function name
@param args Function arguments
@return oid of the given call
@throws SQLException if a database-access error occurs or no result | [
"This",
"convenience",
"method",
"assumes",
"that",
"the",
"return",
"value",
"is",
"an",
"oid",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java#L208-L214 |
virgo47/javasimon | console-embed/src/main/java/org/javasimon/console/SimonConsoleRequestProcessor.java | SimonConsoleRequestProcessor.processRequest | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
"""
Processes requests for both HTTP {@code GET} and {@code POST} methods.
@param request servlet request
@param response servlet response
@throws javax.servlet.ServletException if a servlet-specific error occurs
@throws java.io.IOException if an I/O error occurs
"""
String path = request.getRequestURI().substring(request.getContextPath().length() + urlPrefix.length());
ActionContext actionContext = new ActionContext(request, response, path);
actionContext.setManager(manager);
actionContext.setPluginManager(pluginManager);
processContext(actionContext);
} | java | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String path = request.getRequestURI().substring(request.getContextPath().length() + urlPrefix.length());
ActionContext actionContext = new ActionContext(request, response, path);
actionContext.setManager(manager);
actionContext.setPluginManager(pluginManager);
processContext(actionContext);
} | [
"protected",
"void",
"processRequest",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"String",
"path",
"=",
"request",
".",
"getRequestURI",
"(",
")",
".",
"substring",
"(",
"request",
".",
"getContextPath",
"(",
")",
".",
"length",
"(",
")",
"+",
"urlPrefix",
".",
"length",
"(",
")",
")",
";",
"ActionContext",
"actionContext",
"=",
"new",
"ActionContext",
"(",
"request",
",",
"response",
",",
"path",
")",
";",
"actionContext",
".",
"setManager",
"(",
"manager",
")",
";",
"actionContext",
".",
"setPluginManager",
"(",
"pluginManager",
")",
";",
"processContext",
"(",
"actionContext",
")",
";",
"}"
] | Processes requests for both HTTP {@code GET} and {@code POST} methods.
@param request servlet request
@param response servlet response
@throws javax.servlet.ServletException if a servlet-specific error occurs
@throws java.io.IOException if an I/O error occurs | [
"Processes",
"requests",
"for",
"both",
"HTTP",
"{",
"@code",
"GET",
"}",
"and",
"{",
"@code",
"POST",
"}",
"methods",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonConsoleRequestProcessor.java#L206-L214 |
dmerkushov/os-helper | src/main/java/ru/dmerkushov/oshelper/OSHelper.java | OSHelper.procWaitWithProcessReturn | public static ProcessReturn procWaitWithProcessReturn (Process process) throws OSHelperException {
"""
/*public static Thread runCommandInThread (final List<String> toRun) throws OSHelperException {
Thread commandThread;
}
"""
ProcessReturn processReturn = new ProcessReturn ();
try {
processReturn.exitCode = process.waitFor ();
} catch (InterruptedException ex) {
throw new OSHelperException ("Received an InterruptedException when waiting for an external process to terminate.", ex);
}
InputStream stdoutIs = process.getInputStream ();
processReturn.stdout = readInputStreamAsString (stdoutIs);
InputStream stderrIs = process.getErrorStream ();
processReturn.stderr = readInputStreamAsString (stderrIs);
processReturn.exitStatus = ProcessReturn.osh_PROCESS_EXITED_BY_ITSELF;
return processReturn;
} | java | public static ProcessReturn procWaitWithProcessReturn (Process process) throws OSHelperException {
ProcessReturn processReturn = new ProcessReturn ();
try {
processReturn.exitCode = process.waitFor ();
} catch (InterruptedException ex) {
throw new OSHelperException ("Received an InterruptedException when waiting for an external process to terminate.", ex);
}
InputStream stdoutIs = process.getInputStream ();
processReturn.stdout = readInputStreamAsString (stdoutIs);
InputStream stderrIs = process.getErrorStream ();
processReturn.stderr = readInputStreamAsString (stderrIs);
processReturn.exitStatus = ProcessReturn.osh_PROCESS_EXITED_BY_ITSELF;
return processReturn;
} | [
"public",
"static",
"ProcessReturn",
"procWaitWithProcessReturn",
"(",
"Process",
"process",
")",
"throws",
"OSHelperException",
"{",
"ProcessReturn",
"processReturn",
"=",
"new",
"ProcessReturn",
"(",
")",
";",
"try",
"{",
"processReturn",
".",
"exitCode",
"=",
"process",
".",
"waitFor",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"Received an InterruptedException when waiting for an external process to terminate.\"",
",",
"ex",
")",
";",
"}",
"InputStream",
"stdoutIs",
"=",
"process",
".",
"getInputStream",
"(",
")",
";",
"processReturn",
".",
"stdout",
"=",
"readInputStreamAsString",
"(",
"stdoutIs",
")",
";",
"InputStream",
"stderrIs",
"=",
"process",
".",
"getErrorStream",
"(",
")",
";",
"processReturn",
".",
"stderr",
"=",
"readInputStreamAsString",
"(",
"stderrIs",
")",
";",
"processReturn",
".",
"exitStatus",
"=",
"ProcessReturn",
".",
"osh_PROCESS_EXITED_BY_ITSELF",
";",
"return",
"processReturn",
";",
"}"
] | /*public static Thread runCommandInThread (final List<String> toRun) throws OSHelperException {
Thread commandThread;
} | [
"/",
"*",
"public",
"static",
"Thread",
"runCommandInThread",
"(",
"final",
"List<String",
">",
"toRun",
")",
"throws",
"OSHelperException",
"{",
"Thread",
"commandThread",
";"
] | train | https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L77-L92 |
gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/data/SenBotReferenceService.java | SenBotReferenceService.getElementLocatorForElementReference | public By getElementLocatorForElementReference(String elementReference, String apendix) {
"""
Find a {@link By} locator by its reference name and add something to the xpath before the element gets returned
The drawback of using this method is, that all locators are converted into By.xpath
@param elementReference The name under which the refference is found
@param apendix The part of the xpath that shall be added
@return {@link By}
"""
Map<String, By> objectReferenceMap = getObjectReferenceMap(By.class);
By elementLocator = objectReferenceMap.get(elementReference);
if (elementLocator instanceof ById) {
String xpathExpression = elementLocator.toString().replaceAll("By.id: ", "//*[@id='") + "']" + apendix;
elementLocator = By.xpath(xpathExpression);
} else if (elementLocator instanceof ByXPath) {
String xpathExpression = elementLocator.toString().replaceAll("By.xpath: ", "") + apendix;
elementLocator = By.xpath(xpathExpression);
} else {
fail("ElementLocator conversion error");
}
if (elementLocator == null) {
fail("No elementLocator is found for element name: '" + elementReference + "'. Available element references are: " + objectReferenceMap.keySet().toString());
}
return elementLocator;
} | java | public By getElementLocatorForElementReference(String elementReference, String apendix) {
Map<String, By> objectReferenceMap = getObjectReferenceMap(By.class);
By elementLocator = objectReferenceMap.get(elementReference);
if (elementLocator instanceof ById) {
String xpathExpression = elementLocator.toString().replaceAll("By.id: ", "//*[@id='") + "']" + apendix;
elementLocator = By.xpath(xpathExpression);
} else if (elementLocator instanceof ByXPath) {
String xpathExpression = elementLocator.toString().replaceAll("By.xpath: ", "") + apendix;
elementLocator = By.xpath(xpathExpression);
} else {
fail("ElementLocator conversion error");
}
if (elementLocator == null) {
fail("No elementLocator is found for element name: '" + elementReference + "'. Available element references are: " + objectReferenceMap.keySet().toString());
}
return elementLocator;
} | [
"public",
"By",
"getElementLocatorForElementReference",
"(",
"String",
"elementReference",
",",
"String",
"apendix",
")",
"{",
"Map",
"<",
"String",
",",
"By",
">",
"objectReferenceMap",
"=",
"getObjectReferenceMap",
"(",
"By",
".",
"class",
")",
";",
"By",
"elementLocator",
"=",
"objectReferenceMap",
".",
"get",
"(",
"elementReference",
")",
";",
"if",
"(",
"elementLocator",
"instanceof",
"ById",
")",
"{",
"String",
"xpathExpression",
"=",
"elementLocator",
".",
"toString",
"(",
")",
".",
"replaceAll",
"(",
"\"By.id: \"",
",",
"\"//*[@id='\"",
")",
"+",
"\"']\"",
"+",
"apendix",
";",
"elementLocator",
"=",
"By",
".",
"xpath",
"(",
"xpathExpression",
")",
";",
"}",
"else",
"if",
"(",
"elementLocator",
"instanceof",
"ByXPath",
")",
"{",
"String",
"xpathExpression",
"=",
"elementLocator",
".",
"toString",
"(",
")",
".",
"replaceAll",
"(",
"\"By.xpath: \"",
",",
"\"\"",
")",
"+",
"apendix",
";",
"elementLocator",
"=",
"By",
".",
"xpath",
"(",
"xpathExpression",
")",
";",
"}",
"else",
"{",
"fail",
"(",
"\"ElementLocator conversion error\"",
")",
";",
"}",
"if",
"(",
"elementLocator",
"==",
"null",
")",
"{",
"fail",
"(",
"\"No elementLocator is found for element name: '\"",
"+",
"elementReference",
"+",
"\"'. Available element references are: \"",
"+",
"objectReferenceMap",
".",
"keySet",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"elementLocator",
";",
"}"
] | Find a {@link By} locator by its reference name and add something to the xpath before the element gets returned
The drawback of using this method is, that all locators are converted into By.xpath
@param elementReference The name under which the refference is found
@param apendix The part of the xpath that shall be added
@return {@link By} | [
"Find",
"a",
"{",
"@link",
"By",
"}",
"locator",
"by",
"its",
"reference",
"name",
"and",
"add",
"something",
"to",
"the",
"xpath",
"before",
"the",
"element",
"gets",
"returned",
"The",
"drawback",
"of",
"using",
"this",
"method",
"is",
"that",
"all",
"locators",
"are",
"converted",
"into",
"By",
".",
"xpath"
] | train | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/data/SenBotReferenceService.java#L167-L185 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/tools/SSTableExport.java | SSTableExport.serializeRow | private static void serializeRow(SSTableIdentityIterator row, DecoratedKey key, PrintStream out) {
"""
Get portion of the columns and serialize in loop while not more columns left in the row
@param row SSTableIdentityIterator row representation with Column Family
@param key Decorated Key for the required row
@param out output stream
"""
serializeRow(row.getColumnFamily().deletionInfo(), row, row.getColumnFamily().metadata(), key, out);
} | java | private static void serializeRow(SSTableIdentityIterator row, DecoratedKey key, PrintStream out)
{
serializeRow(row.getColumnFamily().deletionInfo(), row, row.getColumnFamily().metadata(), key, out);
} | [
"private",
"static",
"void",
"serializeRow",
"(",
"SSTableIdentityIterator",
"row",
",",
"DecoratedKey",
"key",
",",
"PrintStream",
"out",
")",
"{",
"serializeRow",
"(",
"row",
".",
"getColumnFamily",
"(",
")",
".",
"deletionInfo",
"(",
")",
",",
"row",
",",
"row",
".",
"getColumnFamily",
"(",
")",
".",
"metadata",
"(",
")",
",",
"key",
",",
"out",
")",
";",
"}"
] | Get portion of the columns and serialize in loop while not more columns left in the row
@param row SSTableIdentityIterator row representation with Column Family
@param key Decorated Key for the required row
@param out output stream | [
"Get",
"portion",
"of",
"the",
"columns",
"and",
"serialize",
"in",
"loop",
"while",
"not",
"more",
"columns",
"left",
"in",
"the",
"row"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/tools/SSTableExport.java#L179-L182 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java | HBaseDataHandler.addFilter | public void addFilter(final String columnFamily, Filter filter) {
"""
Adds the filter.
@param columnFamily
the column family
@param filter
the filter
"""
FilterList filterList = this.filters.get(columnFamily);
if (filterList == null)
{
filterList = new FilterList();
}
if (filter != null)
{
filterList.addFilter(filter);
}
this.filters.put(columnFamily, filterList);
} | java | public void addFilter(final String columnFamily, Filter filter)
{
FilterList filterList = this.filters.get(columnFamily);
if (filterList == null)
{
filterList = new FilterList();
}
if (filter != null)
{
filterList.addFilter(filter);
}
this.filters.put(columnFamily, filterList);
} | [
"public",
"void",
"addFilter",
"(",
"final",
"String",
"columnFamily",
",",
"Filter",
"filter",
")",
"{",
"FilterList",
"filterList",
"=",
"this",
".",
"filters",
".",
"get",
"(",
"columnFamily",
")",
";",
"if",
"(",
"filterList",
"==",
"null",
")",
"{",
"filterList",
"=",
"new",
"FilterList",
"(",
")",
";",
"}",
"if",
"(",
"filter",
"!=",
"null",
")",
"{",
"filterList",
".",
"addFilter",
"(",
"filter",
")",
";",
"}",
"this",
".",
"filters",
".",
"put",
"(",
"columnFamily",
",",
"filterList",
")",
";",
"}"
] | Adds the filter.
@param columnFamily
the column family
@param filter
the filter | [
"Adds",
"the",
"filter",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java#L716-L728 |
i-net-software/jlessc | src/com/inet/lib/less/HashMultimap.java | HashMultimap.addAll | void addAll( HashMultimap<K, V> m ) {
"""
Add all values of the mappings from the specified map to this map.
@param m
mappings to be stored in this map
"""
if( m == this ) {
return;
}
for( Entry<K, List<V>> entry : m.map.entrySet() ) {
K key = entry.getKey();
List<V> rules = map.get( key );
if( rules == null ) {
rules = new ArrayList<>();
map.put( key, rules );
}
for( V value : entry.getValue() ) {
if( !rules.contains( value ) ) {
rules.add( value );
}
}
}
} | java | void addAll( HashMultimap<K, V> m ) {
if( m == this ) {
return;
}
for( Entry<K, List<V>> entry : m.map.entrySet() ) {
K key = entry.getKey();
List<V> rules = map.get( key );
if( rules == null ) {
rules = new ArrayList<>();
map.put( key, rules );
}
for( V value : entry.getValue() ) {
if( !rules.contains( value ) ) {
rules.add( value );
}
}
}
} | [
"void",
"addAll",
"(",
"HashMultimap",
"<",
"K",
",",
"V",
">",
"m",
")",
"{",
"if",
"(",
"m",
"==",
"this",
")",
"{",
"return",
";",
"}",
"for",
"(",
"Entry",
"<",
"K",
",",
"List",
"<",
"V",
">",
">",
"entry",
":",
"m",
".",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"K",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"List",
"<",
"V",
">",
"rules",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"rules",
"==",
"null",
")",
"{",
"rules",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"map",
".",
"put",
"(",
"key",
",",
"rules",
")",
";",
"}",
"for",
"(",
"V",
"value",
":",
"entry",
".",
"getValue",
"(",
")",
")",
"{",
"if",
"(",
"!",
"rules",
".",
"contains",
"(",
"value",
")",
")",
"{",
"rules",
".",
"add",
"(",
"value",
")",
";",
"}",
"}",
"}",
"}"
] | Add all values of the mappings from the specified map to this map.
@param m
mappings to be stored in this map | [
"Add",
"all",
"values",
"of",
"the",
"mappings",
"from",
"the",
"specified",
"map",
"to",
"this",
"map",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/HashMultimap.java#L110-L127 |
windup/windup | rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/VendorSpecificationExtensionService.java | VendorSpecificationExtensionService.associateAsVendorExtension | public VendorSpecificationExtensionModel associateAsVendorExtension(FileModel model, String localFileName) {
"""
Makes the file model a vendor extension, and references a local file (if exists)
@param model
@param localFileName
"""
String pathToDescriptor = model.getFilePath();
pathToDescriptor = StringUtils.removeEnd(pathToDescriptor, model.getFileName());
pathToDescriptor += localFileName;
// now look up the
FileModel specificationFile = fileService.getUniqueByProperty(FileModel.FILE_PATH, pathToDescriptor);
VendorSpecificationExtensionModel extension = addTypeToModel(model);
if (specificationFile == null)
{
LOG.warning("File not found: " + pathToDescriptor);
}
else
{
// now associate current model with vendorspecificationextension
extension.setSpecificationFile(specificationFile);
}
return extension;
} | java | public VendorSpecificationExtensionModel associateAsVendorExtension(FileModel model, String localFileName)
{
String pathToDescriptor = model.getFilePath();
pathToDescriptor = StringUtils.removeEnd(pathToDescriptor, model.getFileName());
pathToDescriptor += localFileName;
// now look up the
FileModel specificationFile = fileService.getUniqueByProperty(FileModel.FILE_PATH, pathToDescriptor);
VendorSpecificationExtensionModel extension = addTypeToModel(model);
if (specificationFile == null)
{
LOG.warning("File not found: " + pathToDescriptor);
}
else
{
// now associate current model with vendorspecificationextension
extension.setSpecificationFile(specificationFile);
}
return extension;
} | [
"public",
"VendorSpecificationExtensionModel",
"associateAsVendorExtension",
"(",
"FileModel",
"model",
",",
"String",
"localFileName",
")",
"{",
"String",
"pathToDescriptor",
"=",
"model",
".",
"getFilePath",
"(",
")",
";",
"pathToDescriptor",
"=",
"StringUtils",
".",
"removeEnd",
"(",
"pathToDescriptor",
",",
"model",
".",
"getFileName",
"(",
")",
")",
";",
"pathToDescriptor",
"+=",
"localFileName",
";",
"// now look up the",
"FileModel",
"specificationFile",
"=",
"fileService",
".",
"getUniqueByProperty",
"(",
"FileModel",
".",
"FILE_PATH",
",",
"pathToDescriptor",
")",
";",
"VendorSpecificationExtensionModel",
"extension",
"=",
"addTypeToModel",
"(",
"model",
")",
";",
"if",
"(",
"specificationFile",
"==",
"null",
")",
"{",
"LOG",
".",
"warning",
"(",
"\"File not found: \"",
"+",
"pathToDescriptor",
")",
";",
"}",
"else",
"{",
"// now associate current model with vendorspecificationextension",
"extension",
".",
"setSpecificationFile",
"(",
"specificationFile",
")",
";",
"}",
"return",
"extension",
";",
"}"
] | Makes the file model a vendor extension, and references a local file (if exists)
@param model
@param localFileName | [
"Makes",
"the",
"file",
"model",
"a",
"vendor",
"extension",
"and",
"references",
"a",
"local",
"file",
"(",
"if",
"exists",
")"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/VendorSpecificationExtensionService.java#L51-L73 |
jeremylong/DependencyCheck | utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java | Settings.setInt | public void setInt(@NotNull final String key, @NotNull final int value) {
"""
Sets a property value.
@param key the key for the property
@param value the value for the property
"""
props.setProperty(key, String.valueOf(value));
LOGGER.debug("Setting: {}='{}'", key, value);
} | java | public void setInt(@NotNull final String key, @NotNull final int value) {
props.setProperty(key, String.valueOf(value));
LOGGER.debug("Setting: {}='{}'", key, value);
} | [
"public",
"void",
"setInt",
"(",
"@",
"NotNull",
"final",
"String",
"key",
",",
"@",
"NotNull",
"final",
"int",
"value",
")",
"{",
"props",
".",
"setProperty",
"(",
"key",
",",
"String",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Setting: {}='{}'\"",
",",
"key",
",",
"value",
")",
";",
"}"
] | Sets a property value.
@param key the key for the property
@param value the value for the property | [
"Sets",
"a",
"property",
"value",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L746-L749 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.beginGetVpnProfilePackageUrlAsync | public Observable<String> beginGetVpnProfilePackageUrlAsync(String resourceGroupName, String virtualNetworkGatewayName) {
"""
Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified resource group. The profile needs to be generated first using generateVpnProfile.
@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
@return the observable to the String object
"""
return beginGetVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | java | public Observable<String> beginGetVpnProfilePackageUrlAsync(String resourceGroupName, String virtualNetworkGatewayName) {
return beginGetVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"String",
">",
"beginGetVpnProfilePackageUrlAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"beginGetVpnProfilePackageUrlWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"String",
">",
",",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"call",
"(",
"ServiceResponse",
"<",
"String",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified resource group. The profile needs to be generated first using generateVpnProfile.
@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
@return the observable to the String object | [
"Gets",
"pre",
"-",
"generated",
"VPN",
"profile",
"for",
"P2S",
"client",
"of",
"the",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
".",
"The",
"profile",
"needs",
"to",
"be",
"generated",
"first",
"using",
"generateVpnProfile",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1891-L1898 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java | Infer.reportBoundError | void reportBoundError(UndetVar uv, InferenceBound ib1, InferenceBound ib2) {
"""
Incorporation error: mismatch between two (or more) bounds of different kinds.
"""
reportInferenceError(
String.format("incompatible.%s.%s.bounds",
StringUtils.toLowerCase(ib1.name()),
StringUtils.toLowerCase(ib2.name())),
uv.qtype,
uv.getBounds(ib1),
uv.getBounds(ib2));
} | java | void reportBoundError(UndetVar uv, InferenceBound ib1, InferenceBound ib2) {
reportInferenceError(
String.format("incompatible.%s.%s.bounds",
StringUtils.toLowerCase(ib1.name()),
StringUtils.toLowerCase(ib2.name())),
uv.qtype,
uv.getBounds(ib1),
uv.getBounds(ib2));
} | [
"void",
"reportBoundError",
"(",
"UndetVar",
"uv",
",",
"InferenceBound",
"ib1",
",",
"InferenceBound",
"ib2",
")",
"{",
"reportInferenceError",
"(",
"String",
".",
"format",
"(",
"\"incompatible.%s.%s.bounds\"",
",",
"StringUtils",
".",
"toLowerCase",
"(",
"ib1",
".",
"name",
"(",
")",
")",
",",
"StringUtils",
".",
"toLowerCase",
"(",
"ib2",
".",
"name",
"(",
")",
")",
")",
",",
"uv",
".",
"qtype",
",",
"uv",
".",
"getBounds",
"(",
"ib1",
")",
",",
"uv",
".",
"getBounds",
"(",
"ib2",
")",
")",
";",
"}"
] | Incorporation error: mismatch between two (or more) bounds of different kinds. | [
"Incorporation",
"error",
":",
"mismatch",
"between",
"two",
"(",
"or",
"more",
")",
"bounds",
"of",
"different",
"kinds",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java#L1290-L1298 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java | CouchDatabaseBase.removeAttachment | public Response removeAttachment(String id, String rev, String attachmentName) {
"""
Removes an attachment from a document given both a document <code>_id</code> and
<code>_rev</code> and <code>attachmentName</code> values.
@param id The document _id field.
@param rev The document _rev field.
@param attachmentName The document attachment field.
@return {@link Response}
@throws NoDocumentException If the document is not found in the database.
@throws DocumentConflictException If a conflict is found during attachment removal.
"""
assertNotEmpty(id, "id");
assertNotEmpty(rev, "rev");
assertNotEmpty(attachmentName, "attachmentName");
final URI uri = new DatabaseURIHelper(dbUri).attachmentUri(id, rev, attachmentName);
return couchDbClient.delete(uri);
} | java | public Response removeAttachment(String id, String rev, String attachmentName) {
assertNotEmpty(id, "id");
assertNotEmpty(rev, "rev");
assertNotEmpty(attachmentName, "attachmentName");
final URI uri = new DatabaseURIHelper(dbUri).attachmentUri(id, rev, attachmentName);
return couchDbClient.delete(uri);
} | [
"public",
"Response",
"removeAttachment",
"(",
"String",
"id",
",",
"String",
"rev",
",",
"String",
"attachmentName",
")",
"{",
"assertNotEmpty",
"(",
"id",
",",
"\"id\"",
")",
";",
"assertNotEmpty",
"(",
"rev",
",",
"\"rev\"",
")",
";",
"assertNotEmpty",
"(",
"attachmentName",
",",
"\"attachmentName\"",
")",
";",
"final",
"URI",
"uri",
"=",
"new",
"DatabaseURIHelper",
"(",
"dbUri",
")",
".",
"attachmentUri",
"(",
"id",
",",
"rev",
",",
"attachmentName",
")",
";",
"return",
"couchDbClient",
".",
"delete",
"(",
"uri",
")",
";",
"}"
] | Removes an attachment from a document given both a document <code>_id</code> and
<code>_rev</code> and <code>attachmentName</code> values.
@param id The document _id field.
@param rev The document _rev field.
@param attachmentName The document attachment field.
@return {@link Response}
@throws NoDocumentException If the document is not found in the database.
@throws DocumentConflictException If a conflict is found during attachment removal. | [
"Removes",
"an",
"attachment",
"from",
"a",
"document",
"given",
"both",
"a",
"document",
"<code",
">",
"_id<",
"/",
"code",
">",
"and",
"<code",
">",
"_rev<",
"/",
"code",
">",
"and",
"<code",
">",
"attachmentName<",
"/",
"code",
">",
"values",
"."
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java#L411-L417 |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java | DBIDUtil.randomSample | public static DBIDs randomSample(DBIDs ids, double rate, RandomFactory random) {
"""
Produce a random sample of the given DBIDs.
@param ids Original ids, no duplicates allowed
@param rate Sampling rate
@param random Random generator
@return Sample
"""
return randomSample(ids, rate, random.getSingleThreadedRandom());
} | java | public static DBIDs randomSample(DBIDs ids, double rate, RandomFactory random) {
return randomSample(ids, rate, random.getSingleThreadedRandom());
} | [
"public",
"static",
"DBIDs",
"randomSample",
"(",
"DBIDs",
"ids",
",",
"double",
"rate",
",",
"RandomFactory",
"random",
")",
"{",
"return",
"randomSample",
"(",
"ids",
",",
"rate",
",",
"random",
".",
"getSingleThreadedRandom",
"(",
")",
")",
";",
"}"
] | Produce a random sample of the given DBIDs.
@param ids Original ids, no duplicates allowed
@param rate Sampling rate
@param random Random generator
@return Sample | [
"Produce",
"a",
"random",
"sample",
"of",
"the",
"given",
"DBIDs",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L684-L686 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/platform/PersistentSettings.java | PersistentSettings.saveProperty | public PersistentSettings saveProperty(DbSession dbSession, String key, @Nullable String value) {
"""
Insert property into database if value is not {@code null}, else delete property from
database. Session is not committed but {@link org.sonar.api.config.GlobalPropertyChangeHandler}
are executed.
"""
savePropertyImpl(dbSession, key, value);
changeNotifier.onGlobalPropertyChange(key, value);
return this;
} | java | public PersistentSettings saveProperty(DbSession dbSession, String key, @Nullable String value) {
savePropertyImpl(dbSession, key, value);
changeNotifier.onGlobalPropertyChange(key, value);
return this;
} | [
"public",
"PersistentSettings",
"saveProperty",
"(",
"DbSession",
"dbSession",
",",
"String",
"key",
",",
"@",
"Nullable",
"String",
"value",
")",
"{",
"savePropertyImpl",
"(",
"dbSession",
",",
"key",
",",
"value",
")",
";",
"changeNotifier",
".",
"onGlobalPropertyChange",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Insert property into database if value is not {@code null}, else delete property from
database. Session is not committed but {@link org.sonar.api.config.GlobalPropertyChangeHandler}
are executed. | [
"Insert",
"property",
"into",
"database",
"if",
"value",
"is",
"not",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/platform/PersistentSettings.java#L51-L55 |
datastax/java-driver | query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java | SchemaBuilder.createTable | @NonNull
public static CreateTableStart createTable(
@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier tableName) {
"""
Starts a CREATE TABLE query with the given table name for the given keyspace name.
"""
return new DefaultCreateTable(keyspace, tableName);
} | java | @NonNull
public static CreateTableStart createTable(
@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier tableName) {
return new DefaultCreateTable(keyspace, tableName);
} | [
"@",
"NonNull",
"public",
"static",
"CreateTableStart",
"createTable",
"(",
"@",
"Nullable",
"CqlIdentifier",
"keyspace",
",",
"@",
"NonNull",
"CqlIdentifier",
"tableName",
")",
"{",
"return",
"new",
"DefaultCreateTable",
"(",
"keyspace",
",",
"tableName",
")",
";",
"}"
] | Starts a CREATE TABLE query with the given table name for the given keyspace name. | [
"Starts",
"a",
"CREATE",
"TABLE",
"query",
"with",
"the",
"given",
"table",
"name",
"for",
"the",
"given",
"keyspace",
"name",
"."
] | train | https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java#L118-L122 |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.readDeviceIdentification | final public MEIReadDeviceIdentification readDeviceIdentification(int serverAddress, int objectId, ReadDeviceIdentificationCode readDeviceId) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
"""
This function code allows reading the identification and additional information relative to the
physical and functional description of a remote device, only.
The Read Device Identification interface is modeled as an address space composed of a set
of addressable data elements. The data elements are called objects and an object Id
identifies them.
The interface consists of 3 categories of objects :
Basic Device Identification. All objects of this category are mandatory : VendorName,
Product code, and revision number.
Regular Device Identification. In addition to Basic data objects, the device provides
additional and optional identification and description data objects. All of the objects of
this category are defined in the standard but their implementation is optional .
Extended Device Identification. In addition to regular data objects, the device provides
additional and optional identification and description private data about the physical
device itself. All of these data are device dependent.
ObjectId ObjectName/Description Type M/O category
0x00 VendorName ASCII String Mandatory Basic
0x01 ProductCode ASCII String Mandatory Basic
0x02 MajorMinorRevision ASCII String Mandatory Basic
0x03 VendorUrl ASCII String Optional Regular
0x04 ProductName ASCII String Optional Regular
0x05 ModelName ASCII String Optional Regular
0x06 UserApplicationName ASCII String Optional Regular
0x07 Reserved Optional Optional Regular
…
0x7F
0x80 Private objects may be optionally device Optional Extended
… defined. The range [0x80 – 0xFF] dependant
0xFF is Product dependant.
"""
EncapsulatedInterfaceTransportResponse response = (EncapsulatedInterfaceTransportResponse) processRequest(ModbusRequestBuilder.getInstance().buildReadDeviceIdentification(serverAddress, objectId, readDeviceId));
return (MEIReadDeviceIdentification) response.getMei();
} | java | final public MEIReadDeviceIdentification readDeviceIdentification(int serverAddress, int objectId, ReadDeviceIdentificationCode readDeviceId) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
EncapsulatedInterfaceTransportResponse response = (EncapsulatedInterfaceTransportResponse) processRequest(ModbusRequestBuilder.getInstance().buildReadDeviceIdentification(serverAddress, objectId, readDeviceId));
return (MEIReadDeviceIdentification) response.getMei();
} | [
"final",
"public",
"MEIReadDeviceIdentification",
"readDeviceIdentification",
"(",
"int",
"serverAddress",
",",
"int",
"objectId",
",",
"ReadDeviceIdentificationCode",
"readDeviceId",
")",
"throws",
"ModbusProtocolException",
",",
"ModbusNumberException",
",",
"ModbusIOException",
"{",
"EncapsulatedInterfaceTransportResponse",
"response",
"=",
"(",
"EncapsulatedInterfaceTransportResponse",
")",
"processRequest",
"(",
"ModbusRequestBuilder",
".",
"getInstance",
"(",
")",
".",
"buildReadDeviceIdentification",
"(",
"serverAddress",
",",
"objectId",
",",
"readDeviceId",
")",
")",
";",
"return",
"(",
"MEIReadDeviceIdentification",
")",
"response",
".",
"getMei",
"(",
")",
";",
"}"
] | This function code allows reading the identification and additional information relative to the
physical and functional description of a remote device, only.
The Read Device Identification interface is modeled as an address space composed of a set
of addressable data elements. The data elements are called objects and an object Id
identifies them.
The interface consists of 3 categories of objects :
Basic Device Identification. All objects of this category are mandatory : VendorName,
Product code, and revision number.
Regular Device Identification. In addition to Basic data objects, the device provides
additional and optional identification and description data objects. All of the objects of
this category are defined in the standard but their implementation is optional .
Extended Device Identification. In addition to regular data objects, the device provides
additional and optional identification and description private data about the physical
device itself. All of these data are device dependent.
ObjectId ObjectName/Description Type M/O category
0x00 VendorName ASCII String Mandatory Basic
0x01 ProductCode ASCII String Mandatory Basic
0x02 MajorMinorRevision ASCII String Mandatory Basic
0x03 VendorUrl ASCII String Optional Regular
0x04 ProductName ASCII String Optional Regular
0x05 ModelName ASCII String Optional Regular
0x06 UserApplicationName ASCII String Optional Regular
0x07 Reserved Optional Optional Regular
…
0x7F
0x80 Private objects may be optionally device Optional Extended
… defined. The range [0x80 – 0xFF] dependant
0xFF is Product dependant. | [
"This",
"function",
"code",
"allows",
"reading",
"the",
"identification",
"and",
"additional",
"information",
"relative",
"to",
"the",
"physical",
"and",
"functional",
"description",
"of",
"a",
"remote",
"device",
"only",
".",
"The",
"Read",
"Device",
"Identification",
"interface",
"is",
"modeled",
"as",
"an",
"address",
"space",
"composed",
"of",
"a",
"set",
"of",
"addressable",
"data",
"elements",
".",
"The",
"data",
"elements",
"are",
"called",
"objects",
"and",
"an",
"object",
"Id",
"identifies",
"them",
".",
"The",
"interface",
"consists",
"of",
"3",
"categories",
"of",
"objects",
":",
"",
"Basic",
"Device",
"Identification",
".",
"All",
"objects",
"of",
"this",
"category",
"are",
"mandatory",
":",
"VendorName",
"Product",
"code",
"and",
"revision",
"number",
".",
"",
"Regular",
"Device",
"Identification",
".",
"In",
"addition",
"to",
"Basic",
"data",
"objects",
"the",
"device",
"provides",
"additional",
"and",
"optional",
"identification",
"and",
"description",
"data",
"objects",
".",
"All",
"of",
"the",
"objects",
"of",
"this",
"category",
"are",
"defined",
"in",
"the",
"standard",
"but",
"their",
"implementation",
"is",
"optional",
".",
"",
"Extended",
"Device",
"Identification",
".",
"In",
"addition",
"to",
"regular",
"data",
"objects",
"the",
"device",
"provides",
"additional",
"and",
"optional",
"identification",
"and",
"description",
"private",
"data",
"about",
"the",
"physical",
"device",
"itself",
".",
"All",
"of",
"these",
"data",
"are",
"device",
"dependent",
".",
"ObjectId",
"ObjectName",
"/",
"Description",
"Type",
"M",
"/",
"O",
"category",
"0x00",
"VendorName",
"ASCII",
"String",
"Mandatory",
"Basic",
"0x01",
"ProductCode",
"ASCII",
"String",
"Mandatory",
"Basic",
"0x02",
"MajorMinorRevision",
"ASCII",
"String",
"Mandatory",
"Basic",
"0x03",
"VendorUrl",
"ASCII",
"String",
"Optional",
"Regular",
"0x04",
"ProductName",
"ASCII",
"String",
"Optional",
"Regular",
"0x05",
"ModelName",
"ASCII",
"String",
"Optional",
"Regular",
"0x06",
"UserApplicationName",
"ASCII",
"String",
"Optional",
"Regular",
"0x07",
"Reserved",
"Optional",
"Optional",
"Regular",
"…",
"0x7F",
"0x80",
"Private",
"objects",
"may",
"be",
"optionally",
"device",
"Optional",
"Extended",
"…",
"defined",
".",
"The",
"range",
"[",
"0x80",
"–",
"0xFF",
"]",
"dependant",
"0xFF",
"is",
"Product",
"dependant",
"."
] | train | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L741-L745 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJ.java | IfmapJ.createSsrc | @Deprecated
public static SSRC createSsrc(String url, KeyManager[] kms, TrustManager[] tms)
throws InitializationException {
"""
Create a new {@link SSRC} object to operate on the given URL
using certificate-based authentication.
The keystore and truststore to be used have to be set using
the {@link System#setProperty(String, String)} method using
the keys javax.net.ssl.keyStore, and javax.net.ssl.trustStore
respectively.
@param url
the URL to connect to
@param kms
TrustManager instances to initialize the {@link SSLContext} with.
@param tms
KeyManager instances to initialize the {@link SSLContext} with.
@return a new {@link SSRC} that uses certificate-based authentication
@throws IOException
@deprecated use createSsrc(CertAuthConfig) instead
"""
return new SsrcImpl(url, kms, tms, 120 * 1000);
} | java | @Deprecated
public static SSRC createSsrc(String url, KeyManager[] kms, TrustManager[] tms)
throws InitializationException {
return new SsrcImpl(url, kms, tms, 120 * 1000);
} | [
"@",
"Deprecated",
"public",
"static",
"SSRC",
"createSsrc",
"(",
"String",
"url",
",",
"KeyManager",
"[",
"]",
"kms",
",",
"TrustManager",
"[",
"]",
"tms",
")",
"throws",
"InitializationException",
"{",
"return",
"new",
"SsrcImpl",
"(",
"url",
",",
"kms",
",",
"tms",
",",
"120",
"*",
"1000",
")",
";",
"}"
] | Create a new {@link SSRC} object to operate on the given URL
using certificate-based authentication.
The keystore and truststore to be used have to be set using
the {@link System#setProperty(String, String)} method using
the keys javax.net.ssl.keyStore, and javax.net.ssl.trustStore
respectively.
@param url
the URL to connect to
@param kms
TrustManager instances to initialize the {@link SSLContext} with.
@param tms
KeyManager instances to initialize the {@link SSLContext} with.
@return a new {@link SSRC} that uses certificate-based authentication
@throws IOException
@deprecated use createSsrc(CertAuthConfig) instead | [
"Create",
"a",
"new",
"{",
"@link",
"SSRC",
"}",
"object",
"to",
"operate",
"on",
"the",
"given",
"URL",
"using",
"certificate",
"-",
"based",
"authentication",
"."
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJ.java#L147-L151 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java | ProxiedFileSystemUtils.createProxiedFileSystemUsingKeytab | static FileSystem createProxiedFileSystemUsingKeytab(State state, URI fsURI, Configuration conf)
throws IOException, InterruptedException {
"""
Create a {@link FileSystem} that can perform any operations allowed the by the specified userNameToProxyAs. This
method uses the {@link #createProxiedFileSystemUsingKeytab(String, String, Path, URI, Configuration)} object to perform
all its work. A specific set of configuration keys are required to be set in the given {@link State} object:
<ul>
<li>{@link ConfigurationKeys#FS_PROXY_AS_USER_NAME} specifies the user name to proxy as</li>
<li>{@link ConfigurationKeys#SUPER_USER_NAME_TO_PROXY_AS_OTHERS} specifies the name of the user with secure
impersonation priveleges</li>
<li>{@link ConfigurationKeys#SUPER_USER_KEY_TAB_LOCATION} specifies the location of the super user's keytab file</li>
<ul>
@param state The {@link State} object that contains all the necessary key, value pairs for
{@link #createProxiedFileSystemUsingKeytab(String, String, Path, URI, Configuration)}
@param fsURI The {@link URI} for the {@link FileSystem} that should be created
@param conf The {@link Configuration} for the {@link FileSystem} that should be created
@return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs
"""
Preconditions.checkArgument(state.contains(ConfigurationKeys.FS_PROXY_AS_USER_NAME));
Preconditions.checkArgument(state.contains(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS));
Preconditions.checkArgument(state.contains(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION));
return createProxiedFileSystemUsingKeytab(state.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME),
state.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS),
new Path(state.getProp(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION)), fsURI, conf);
} | java | static FileSystem createProxiedFileSystemUsingKeytab(State state, URI fsURI, Configuration conf)
throws IOException, InterruptedException {
Preconditions.checkArgument(state.contains(ConfigurationKeys.FS_PROXY_AS_USER_NAME));
Preconditions.checkArgument(state.contains(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS));
Preconditions.checkArgument(state.contains(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION));
return createProxiedFileSystemUsingKeytab(state.getProp(ConfigurationKeys.FS_PROXY_AS_USER_NAME),
state.getProp(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS),
new Path(state.getProp(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION)), fsURI, conf);
} | [
"static",
"FileSystem",
"createProxiedFileSystemUsingKeytab",
"(",
"State",
"state",
",",
"URI",
"fsURI",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"state",
".",
"contains",
"(",
"ConfigurationKeys",
".",
"FS_PROXY_AS_USER_NAME",
")",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"state",
".",
"contains",
"(",
"ConfigurationKeys",
".",
"SUPER_USER_NAME_TO_PROXY_AS_OTHERS",
")",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"state",
".",
"contains",
"(",
"ConfigurationKeys",
".",
"SUPER_USER_KEY_TAB_LOCATION",
")",
")",
";",
"return",
"createProxiedFileSystemUsingKeytab",
"(",
"state",
".",
"getProp",
"(",
"ConfigurationKeys",
".",
"FS_PROXY_AS_USER_NAME",
")",
",",
"state",
".",
"getProp",
"(",
"ConfigurationKeys",
".",
"SUPER_USER_NAME_TO_PROXY_AS_OTHERS",
")",
",",
"new",
"Path",
"(",
"state",
".",
"getProp",
"(",
"ConfigurationKeys",
".",
"SUPER_USER_KEY_TAB_LOCATION",
")",
")",
",",
"fsURI",
",",
"conf",
")",
";",
"}"
] | Create a {@link FileSystem} that can perform any operations allowed the by the specified userNameToProxyAs. This
method uses the {@link #createProxiedFileSystemUsingKeytab(String, String, Path, URI, Configuration)} object to perform
all its work. A specific set of configuration keys are required to be set in the given {@link State} object:
<ul>
<li>{@link ConfigurationKeys#FS_PROXY_AS_USER_NAME} specifies the user name to proxy as</li>
<li>{@link ConfigurationKeys#SUPER_USER_NAME_TO_PROXY_AS_OTHERS} specifies the name of the user with secure
impersonation priveleges</li>
<li>{@link ConfigurationKeys#SUPER_USER_KEY_TAB_LOCATION} specifies the location of the super user's keytab file</li>
<ul>
@param state The {@link State} object that contains all the necessary key, value pairs for
{@link #createProxiedFileSystemUsingKeytab(String, String, Path, URI, Configuration)}
@param fsURI The {@link URI} for the {@link FileSystem} that should be created
@param conf The {@link Configuration} for the {@link FileSystem} that should be created
@return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs | [
"Create",
"a",
"{",
"@link",
"FileSystem",
"}",
"that",
"can",
"perform",
"any",
"operations",
"allowed",
"the",
"by",
"the",
"specified",
"userNameToProxyAs",
".",
"This",
"method",
"uses",
"the",
"{",
"@link",
"#createProxiedFileSystemUsingKeytab",
"(",
"String",
"String",
"Path",
"URI",
"Configuration",
")",
"}",
"object",
"to",
"perform",
"all",
"its",
"work",
".",
"A",
"specific",
"set",
"of",
"configuration",
"keys",
"are",
"required",
"to",
"be",
"set",
"in",
"the",
"given",
"{",
"@link",
"State",
"}",
"object",
":"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java#L153-L162 |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.registerDaoWithTableConfig | public static synchronized void registerDaoWithTableConfig(ConnectionSource connectionSource, Dao<?, ?> dao) {
"""
Same as {@link #registerDao(ConnectionSource, Dao)} but this allows you to register it just with its
{@link DatabaseTableConfig}. This allows multiple versions of the DAO to be configured if necessary.
"""
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
if (dao instanceof BaseDaoImpl) {
DatabaseTableConfig<?> tableConfig = ((BaseDaoImpl<?, ?>) dao).getTableConfig();
if (tableConfig != null) {
addDaoToTableMap(new TableConfigConnectionSource(connectionSource, tableConfig), dao);
return;
}
}
addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao);
} | java | public static synchronized void registerDaoWithTableConfig(ConnectionSource connectionSource, Dao<?, ?> dao) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
if (dao instanceof BaseDaoImpl) {
DatabaseTableConfig<?> tableConfig = ((BaseDaoImpl<?, ?>) dao).getTableConfig();
if (tableConfig != null) {
addDaoToTableMap(new TableConfigConnectionSource(connectionSource, tableConfig), dao);
return;
}
}
addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), dao);
} | [
"public",
"static",
"synchronized",
"void",
"registerDaoWithTableConfig",
"(",
"ConnectionSource",
"connectionSource",
",",
"Dao",
"<",
"?",
",",
"?",
">",
"dao",
")",
"{",
"if",
"(",
"connectionSource",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"connectionSource argument cannot be null\"",
")",
";",
"}",
"if",
"(",
"dao",
"instanceof",
"BaseDaoImpl",
")",
"{",
"DatabaseTableConfig",
"<",
"?",
">",
"tableConfig",
"=",
"(",
"(",
"BaseDaoImpl",
"<",
"?",
",",
"?",
">",
")",
"dao",
")",
".",
"getTableConfig",
"(",
")",
";",
"if",
"(",
"tableConfig",
"!=",
"null",
")",
"{",
"addDaoToTableMap",
"(",
"new",
"TableConfigConnectionSource",
"(",
"connectionSource",
",",
"tableConfig",
")",
",",
"dao",
")",
";",
"return",
";",
"}",
"}",
"addDaoToClassMap",
"(",
"new",
"ClassConnectionSource",
"(",
"connectionSource",
",",
"dao",
".",
"getDataClass",
"(",
")",
")",
",",
"dao",
")",
";",
"}"
] | Same as {@link #registerDao(ConnectionSource, Dao)} but this allows you to register it just with its
{@link DatabaseTableConfig}. This allows multiple versions of the DAO to be configured if necessary. | [
"Same",
"as",
"{"
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L200-L212 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallPlugin | public static PluginBean unmarshallPlugin(Map<String, Object> source) {
"""
Unmarshals the given map source into a bean.
@param source the source
@return the plugin
"""
if (source == null) {
return null;
}
PluginBean bean = new PluginBean();
bean.setId(asLong(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setGroupId(asString(source.get("groupId")));
bean.setArtifactId(asString(source.get("artifactId")));
bean.setVersion(asString(source.get("version")));
bean.setType(asString(source.get("type")));
bean.setClassifier(asString(source.get("classifier")));
bean.setDeleted(asBoolean(source.get("deleted")));
postMarshall(bean);
return bean;
} | java | public static PluginBean unmarshallPlugin(Map<String, Object> source) {
if (source == null) {
return null;
}
PluginBean bean = new PluginBean();
bean.setId(asLong(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setGroupId(asString(source.get("groupId")));
bean.setArtifactId(asString(source.get("artifactId")));
bean.setVersion(asString(source.get("version")));
bean.setType(asString(source.get("type")));
bean.setClassifier(asString(source.get("classifier")));
bean.setDeleted(asBoolean(source.get("deleted")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"PluginBean",
"unmarshallPlugin",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"PluginBean",
"bean",
"=",
"new",
"PluginBean",
"(",
")",
";",
"bean",
".",
"setId",
"(",
"asLong",
"(",
"source",
".",
"get",
"(",
"\"id\"",
")",
")",
")",
";",
"bean",
".",
"setName",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"name\"",
")",
")",
")",
";",
"bean",
".",
"setDescription",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"description\"",
")",
")",
")",
";",
"bean",
".",
"setCreatedBy",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"createdBy\"",
")",
")",
")",
";",
"bean",
".",
"setCreatedOn",
"(",
"asDate",
"(",
"source",
".",
"get",
"(",
"\"createdOn\"",
")",
")",
")",
";",
"bean",
".",
"setGroupId",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"groupId\"",
")",
")",
")",
";",
"bean",
".",
"setArtifactId",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"artifactId\"",
")",
")",
")",
";",
"bean",
".",
"setVersion",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"version\"",
")",
")",
")",
";",
"bean",
".",
"setType",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"type\"",
")",
")",
")",
";",
"bean",
".",
"setClassifier",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"classifier\"",
")",
")",
")",
";",
"bean",
".",
"setDeleted",
"(",
"asBoolean",
"(",
"source",
".",
"get",
"(",
"\"deleted\"",
")",
")",
")",
";",
"postMarshall",
"(",
"bean",
")",
";",
"return",
"bean",
";",
"}"
] | Unmarshals the given map source into a bean.
@param source the source
@return the plugin | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L1310-L1328 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/TokenProvider.java | TokenProvider.createAzureActiveDirectoryTokenProvider | public static TokenProvider createAzureActiveDirectoryTokenProvider(String authorityUrl, String clientId, String clientSecret) throws MalformedURLException {
"""
Creates an Azure Active Directory token provider that acquires a token from the given active directory instance using the given clientId and client secret.
This is a utility method.
@param authorityUrl URL of the Azure Active Directory instance
@param clientId client id of the application
@param clientSecret client secret of the application
@return an instance of Azure Active Directory token provider
@throws MalformedURLException if the authority URL is not well formed
"""
AuthenticationContext authContext = createAuthenticationContext(authorityUrl);
return new AzureActiveDirectoryTokenProvider(authContext, new ClientCredential(clientId, clientSecret));
} | java | public static TokenProvider createAzureActiveDirectoryTokenProvider(String authorityUrl, String clientId, String clientSecret) throws MalformedURLException
{
AuthenticationContext authContext = createAuthenticationContext(authorityUrl);
return new AzureActiveDirectoryTokenProvider(authContext, new ClientCredential(clientId, clientSecret));
} | [
"public",
"static",
"TokenProvider",
"createAzureActiveDirectoryTokenProvider",
"(",
"String",
"authorityUrl",
",",
"String",
"clientId",
",",
"String",
"clientSecret",
")",
"throws",
"MalformedURLException",
"{",
"AuthenticationContext",
"authContext",
"=",
"createAuthenticationContext",
"(",
"authorityUrl",
")",
";",
"return",
"new",
"AzureActiveDirectoryTokenProvider",
"(",
"authContext",
",",
"new",
"ClientCredential",
"(",
"clientId",
",",
"clientSecret",
")",
")",
";",
"}"
] | Creates an Azure Active Directory token provider that acquires a token from the given active directory instance using the given clientId and client secret.
This is a utility method.
@param authorityUrl URL of the Azure Active Directory instance
@param clientId client id of the application
@param clientSecret client secret of the application
@return an instance of Azure Active Directory token provider
@throws MalformedURLException if the authority URL is not well formed | [
"Creates",
"an",
"Azure",
"Active",
"Directory",
"token",
"provider",
"that",
"acquires",
"a",
"token",
"from",
"the",
"given",
"active",
"directory",
"instance",
"using",
"the",
"given",
"clientId",
"and",
"client",
"secret",
".",
"This",
"is",
"a",
"utility",
"method",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/TokenProvider.java#L75-L79 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_secondaryDnsDomains_POST | public void serviceName_secondaryDnsDomains_POST(String serviceName, String domain, String ip) throws IOException {
"""
add a domain on secondary dns
REST: POST /dedicated/server/{serviceName}/secondaryDnsDomains
@param domain [required] The domain to add
@param ip [required]
@param serviceName [required] The internal name of your dedicated server
"""
String qPath = "/dedicated/server/{serviceName}/secondaryDnsDomains";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "ip", ip);
exec(qPath, "POST", sb.toString(), o);
} | java | public void serviceName_secondaryDnsDomains_POST(String serviceName, String domain, String ip) throws IOException {
String qPath = "/dedicated/server/{serviceName}/secondaryDnsDomains";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "ip", ip);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"serviceName_secondaryDnsDomains_POST",
"(",
"String",
"serviceName",
",",
"String",
"domain",
",",
"String",
"ip",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/secondaryDnsDomains\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"domain\"",
",",
"domain",
")",
";",
"addBody",
"(",
"o",
",",
"\"ip\"",
",",
"ip",
")",
";",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"}"
] | add a domain on secondary dns
REST: POST /dedicated/server/{serviceName}/secondaryDnsDomains
@param domain [required] The domain to add
@param ip [required]
@param serviceName [required] The internal name of your dedicated server | [
"add",
"a",
"domain",
"on",
"secondary",
"dns"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2003-L2010 |
phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setFont | public void setFont (final PDFont font, final float fontSize) throws IOException {
"""
Set the font and font size to draw text with.
@param font
The font to use.
@param fontSize
The font size to draw the text.
@throws IOException
If there is an error writing the font information.
"""
if (fontStack.isEmpty ())
fontStack.add (font);
else
fontStack.set (fontStack.size () - 1, font);
PDDocumentHelper.handleFontSubset (m_aDoc, font);
writeOperand (resources.add (font));
writeOperand (fontSize);
writeOperator ((byte) 'T', (byte) 'f');
} | java | public void setFont (final PDFont font, final float fontSize) throws IOException
{
if (fontStack.isEmpty ())
fontStack.add (font);
else
fontStack.set (fontStack.size () - 1, font);
PDDocumentHelper.handleFontSubset (m_aDoc, font);
writeOperand (resources.add (font));
writeOperand (fontSize);
writeOperator ((byte) 'T', (byte) 'f');
} | [
"public",
"void",
"setFont",
"(",
"final",
"PDFont",
"font",
",",
"final",
"float",
"fontSize",
")",
"throws",
"IOException",
"{",
"if",
"(",
"fontStack",
".",
"isEmpty",
"(",
")",
")",
"fontStack",
".",
"add",
"(",
"font",
")",
";",
"else",
"fontStack",
".",
"set",
"(",
"fontStack",
".",
"size",
"(",
")",
"-",
"1",
",",
"font",
")",
";",
"PDDocumentHelper",
".",
"handleFontSubset",
"(",
"m_aDoc",
",",
"font",
")",
";",
"writeOperand",
"(",
"resources",
".",
"add",
"(",
"font",
")",
")",
";",
"writeOperand",
"(",
"fontSize",
")",
";",
"writeOperator",
"(",
"(",
"byte",
")",
"'",
"'",
",",
"(",
"byte",
")",
"'",
"'",
")",
";",
"}"
] | Set the font and font size to draw text with.
@param font
The font to use.
@param fontSize
The font size to draw the text.
@throws IOException
If there is an error writing the font information. | [
"Set",
"the",
"font",
"and",
"font",
"size",
"to",
"draw",
"text",
"with",
"."
] | train | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L332-L344 |
threerings/narya | core/src/main/java/com/threerings/presents/client/Client.java | Client.standaloneLogon | public void standaloneLogon (BootstrapData data, DObjectManager omgr) {
"""
Logs this client on in standalone mode with the faked bootstrap data and shared local
distributed object manager.
"""
if (!_standalone) {
throw new IllegalStateException("Must call prepareStandaloneLogon() first.");
}
gotBootstrap(data, omgr);
} | java | public void standaloneLogon (BootstrapData data, DObjectManager omgr)
{
if (!_standalone) {
throw new IllegalStateException("Must call prepareStandaloneLogon() first.");
}
gotBootstrap(data, omgr);
} | [
"public",
"void",
"standaloneLogon",
"(",
"BootstrapData",
"data",
",",
"DObjectManager",
"omgr",
")",
"{",
"if",
"(",
"!",
"_standalone",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Must call prepareStandaloneLogon() first.\"",
")",
";",
"}",
"gotBootstrap",
"(",
"data",
",",
"omgr",
")",
";",
"}"
] | Logs this client on in standalone mode with the faked bootstrap data and shared local
distributed object manager. | [
"Logs",
"this",
"client",
"on",
"in",
"standalone",
"mode",
"with",
"the",
"faked",
"bootstrap",
"data",
"and",
"shared",
"local",
"distributed",
"object",
"manager",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/Client.java#L635-L641 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.data_afnicAssociationInformation_POST | public OvhAssociationContact data_afnicAssociationInformation_POST(Long contactId, Date declarationDate, Date publicationDate, String publicationNumber, String publicationPageNumber) throws IOException {
"""
Post a new association information according to Afnic
REST: POST /domain/data/afnicAssociationInformation
@param declarationDate [required] Date of the declaration of the association
@param publicationDate [required] Date of the publication of the declaration of the association
@param publicationNumber [required] Number of the publication of the declaration of the association
@param publicationPageNumber [required] Page number of the publication of the declaration of the association
@param contactId [required] Contact ID related to the association contact information
"""
String qPath = "/domain/data/afnicAssociationInformation";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "contactId", contactId);
addBody(o, "declarationDate", declarationDate);
addBody(o, "publicationDate", publicationDate);
addBody(o, "publicationNumber", publicationNumber);
addBody(o, "publicationPageNumber", publicationPageNumber);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhAssociationContact.class);
} | java | public OvhAssociationContact data_afnicAssociationInformation_POST(Long contactId, Date declarationDate, Date publicationDate, String publicationNumber, String publicationPageNumber) throws IOException {
String qPath = "/domain/data/afnicAssociationInformation";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "contactId", contactId);
addBody(o, "declarationDate", declarationDate);
addBody(o, "publicationDate", publicationDate);
addBody(o, "publicationNumber", publicationNumber);
addBody(o, "publicationPageNumber", publicationPageNumber);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhAssociationContact.class);
} | [
"public",
"OvhAssociationContact",
"data_afnicAssociationInformation_POST",
"(",
"Long",
"contactId",
",",
"Date",
"declarationDate",
",",
"Date",
"publicationDate",
",",
"String",
"publicationNumber",
",",
"String",
"publicationPageNumber",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/data/afnicAssociationInformation\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"contactId\"",
",",
"contactId",
")",
";",
"addBody",
"(",
"o",
",",
"\"declarationDate\"",
",",
"declarationDate",
")",
";",
"addBody",
"(",
"o",
",",
"\"publicationDate\"",
",",
"publicationDate",
")",
";",
"addBody",
"(",
"o",
",",
"\"publicationNumber\"",
",",
"publicationNumber",
")",
";",
"addBody",
"(",
"o",
",",
"\"publicationPageNumber\"",
",",
"publicationPageNumber",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhAssociationContact",
".",
"class",
")",
";",
"}"
] | Post a new association information according to Afnic
REST: POST /domain/data/afnicAssociationInformation
@param declarationDate [required] Date of the declaration of the association
@param publicationDate [required] Date of the publication of the declaration of the association
@param publicationNumber [required] Number of the publication of the declaration of the association
@param publicationPageNumber [required] Page number of the publication of the declaration of the association
@param contactId [required] Contact ID related to the association contact information | [
"Post",
"a",
"new",
"association",
"information",
"according",
"to",
"Afnic"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L198-L209 |
derari/cthul | objects/src/main/java/org/cthul/objects/reflection/Signatures.java | Signatures.candidateMethods | public static Method[] candidateMethods(Method[] methods, Class<?>[] argTypes) {
"""
Selects the best equally-matching methods for the given argument types.
@param methods
@param argTypes
@return methods
"""
return candidates(methods, collectSignatures(methods), collectVarArgs(methods), argTypes);
} | java | public static Method[] candidateMethods(Method[] methods, Class<?>[] argTypes) {
return candidates(methods, collectSignatures(methods), collectVarArgs(methods), argTypes);
} | [
"public",
"static",
"Method",
"[",
"]",
"candidateMethods",
"(",
"Method",
"[",
"]",
"methods",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"argTypes",
")",
"{",
"return",
"candidates",
"(",
"methods",
",",
"collectSignatures",
"(",
"methods",
")",
",",
"collectVarArgs",
"(",
"methods",
")",
",",
"argTypes",
")",
";",
"}"
] | Selects the best equally-matching methods for the given argument types.
@param methods
@param argTypes
@return methods | [
"Selects",
"the",
"best",
"equally",
"-",
"matching",
"methods",
"for",
"the",
"given",
"argument",
"types",
"."
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/reflection/Signatures.java#L207-L209 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/AnnotationUtils.java | AnnotationUtils.annotationArrayMemberEquals | @GwtIncompatible("incompatible method")
private static boolean annotationArrayMemberEquals(final Annotation[] a1, final Annotation[] a2) {
"""
Helper method for comparing two arrays of annotations.
@param a1 the first array
@param a2 the second array
@return a flag whether these arrays are equal
"""
if (a1.length != a2.length) {
return false;
}
for (int i = 0; i < a1.length; i++) {
if (!equals(a1[i], a2[i])) {
return false;
}
}
return true;
} | java | @GwtIncompatible("incompatible method")
private static boolean annotationArrayMemberEquals(final Annotation[] a1, final Annotation[] a2) {
if (a1.length != a2.length) {
return false;
}
for (int i = 0; i < a1.length; i++) {
if (!equals(a1[i], a2[i])) {
return false;
}
}
return true;
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"private",
"static",
"boolean",
"annotationArrayMemberEquals",
"(",
"final",
"Annotation",
"[",
"]",
"a1",
",",
"final",
"Annotation",
"[",
"]",
"a2",
")",
"{",
"if",
"(",
"a1",
".",
"length",
"!=",
"a2",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"a1",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"equals",
"(",
"a1",
"[",
"i",
"]",
",",
"a2",
"[",
"i",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Helper method for comparing two arrays of annotations.
@param a1 the first array
@param a2 the second array
@return a flag whether these arrays are equal | [
"Helper",
"method",
"for",
"comparing",
"two",
"arrays",
"of",
"annotations",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/AnnotationUtils.java#L333-L344 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java | ReplicationLinksInner.getAsync | public Observable<ReplicationLinkInner> getAsync(String resourceGroupName, String serverName, String databaseName, String linkId) {
"""
Gets a database replication link.
@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 serverName The name of the server.
@param databaseName The name of the database to get the link for.
@param linkId The replication link ID to be retrieved.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ReplicationLinkInner object
"""
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<ReplicationLinkInner>, ReplicationLinkInner>() {
@Override
public ReplicationLinkInner call(ServiceResponse<ReplicationLinkInner> response) {
return response.body();
}
});
} | java | public Observable<ReplicationLinkInner> getAsync(String resourceGroupName, String serverName, String databaseName, String linkId) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<ReplicationLinkInner>, ReplicationLinkInner>() {
@Override
public ReplicationLinkInner call(ServiceResponse<ReplicationLinkInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ReplicationLinkInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"linkId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseName",
",",
"linkId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ReplicationLinkInner",
">",
",",
"ReplicationLinkInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ReplicationLinkInner",
"call",
"(",
"ServiceResponse",
"<",
"ReplicationLinkInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a database replication link.
@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 serverName The name of the server.
@param databaseName The name of the database to get the link for.
@param linkId The replication link ID to be retrieved.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ReplicationLinkInner object | [
"Gets",
"a",
"database",
"replication",
"link",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java#L228-L235 |
grails/grails-core | grails-core/src/main/groovy/grails/util/GrailsClassUtils.java | GrailsClassUtils.getBooleanFromMap | public static boolean getBooleanFromMap(String key, Map<?, ?> map, boolean defaultValue) {
"""
Retrieves a boolean value from a Map for the given key
@param key The key that references the boolean value
@param map The map to look in
@return A boolean value which will be false if the map is null, the map doesn't contain the key or the value is false
"""
if (map == null) return defaultValue;
if (map.containsKey(key)) {
Object o = map.get(key);
if (o == null) {
return defaultValue;
}
if (o instanceof Boolean) {
return (Boolean)o;
}
return Boolean.valueOf(o.toString());
}
return defaultValue;
} | java | public static boolean getBooleanFromMap(String key, Map<?, ?> map, boolean defaultValue) {
if (map == null) return defaultValue;
if (map.containsKey(key)) {
Object o = map.get(key);
if (o == null) {
return defaultValue;
}
if (o instanceof Boolean) {
return (Boolean)o;
}
return Boolean.valueOf(o.toString());
}
return defaultValue;
} | [
"public",
"static",
"boolean",
"getBooleanFromMap",
"(",
"String",
"key",
",",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"boolean",
"defaultValue",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"return",
"defaultValue",
";",
"if",
"(",
"map",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"Object",
"o",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"if",
"(",
"o",
"instanceof",
"Boolean",
")",
"{",
"return",
"(",
"Boolean",
")",
"o",
";",
"}",
"return",
"Boolean",
".",
"valueOf",
"(",
"o",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"defaultValue",
";",
"}"
] | Retrieves a boolean value from a Map for the given key
@param key The key that references the boolean value
@param map The map to look in
@return A boolean value which will be false if the map is null, the map doesn't contain the key or the value is false | [
"Retrieves",
"a",
"boolean",
"value",
"from",
"a",
"Map",
"for",
"the",
"given",
"key"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L824-L837 |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/AtsdServerExceptionFactory.java | AtsdServerExceptionFactory.fromResponse | static AtsdServerException fromResponse(final Response response) {
"""
Generate {@link AtsdServerException} from Http Response.
@param response {@link Response} class from jersey.
@return AtsdServerException instance with extracted message from response.
"""
final int status = response.getStatus();
try {
final ServerError serverError = response.readEntity(ServerError.class);
final String message = AtsdServerMessageFactory.from(serverError);
return new AtsdServerException(message, status);
} catch (ProcessingException e) {
throw new IllegalArgumentException("Failed to extract server error", e);
}
} | java | static AtsdServerException fromResponse(final Response response) {
final int status = response.getStatus();
try {
final ServerError serverError = response.readEntity(ServerError.class);
final String message = AtsdServerMessageFactory.from(serverError);
return new AtsdServerException(message, status);
} catch (ProcessingException e) {
throw new IllegalArgumentException("Failed to extract server error", e);
}
} | [
"static",
"AtsdServerException",
"fromResponse",
"(",
"final",
"Response",
"response",
")",
"{",
"final",
"int",
"status",
"=",
"response",
".",
"getStatus",
"(",
")",
";",
"try",
"{",
"final",
"ServerError",
"serverError",
"=",
"response",
".",
"readEntity",
"(",
"ServerError",
".",
"class",
")",
";",
"final",
"String",
"message",
"=",
"AtsdServerMessageFactory",
".",
"from",
"(",
"serverError",
")",
";",
"return",
"new",
"AtsdServerException",
"(",
"message",
",",
"status",
")",
";",
"}",
"catch",
"(",
"ProcessingException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Failed to extract server error\"",
",",
"e",
")",
";",
"}",
"}"
] | Generate {@link AtsdServerException} from Http Response.
@param response {@link Response} class from jersey.
@return AtsdServerException instance with extracted message from response. | [
"Generate",
"{",
"@link",
"AtsdServerException",
"}",
"from",
"Http",
"Response",
"."
] | train | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/AtsdServerExceptionFactory.java#L22-L31 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(InputStream inStream, int bufferSize) {
"""
Adds data to the digest using the specified input stream of bytes, starting at an offset of 0.
@param inStream input stream of bytes.
@param bufferSize maximum allowed buffer size for reading data.
@return The same {@link DataHasher} object for chaining calls.
@throws HashException when hash calculation fails.
@throws NullPointerException when input stream is null.
"""
Util.notNull(inStream, "Input stream");
try {
byte[] buffer = new byte[bufferSize];
while (true) {
int bytesRead = inStream.read(buffer);
if (bytesRead == -1) {
return this;
}
addData(buffer, 0, bytesRead);
}
} catch (IOException e) {
throw new HashException("Exception occurred when reading input stream while calculating hash", e);
}
} | java | public final DataHasher addData(InputStream inStream, int bufferSize) {
Util.notNull(inStream, "Input stream");
try {
byte[] buffer = new byte[bufferSize];
while (true) {
int bytesRead = inStream.read(buffer);
if (bytesRead == -1) {
return this;
}
addData(buffer, 0, bytesRead);
}
} catch (IOException e) {
throw new HashException("Exception occurred when reading input stream while calculating hash", e);
}
} | [
"public",
"final",
"DataHasher",
"addData",
"(",
"InputStream",
"inStream",
",",
"int",
"bufferSize",
")",
"{",
"Util",
".",
"notNull",
"(",
"inStream",
",",
"\"Input stream\"",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"bufferSize",
"]",
";",
"while",
"(",
"true",
")",
"{",
"int",
"bytesRead",
"=",
"inStream",
".",
"read",
"(",
"buffer",
")",
";",
"if",
"(",
"bytesRead",
"==",
"-",
"1",
")",
"{",
"return",
"this",
";",
"}",
"addData",
"(",
"buffer",
",",
"0",
",",
"bytesRead",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"HashException",
"(",
"\"Exception occurred when reading input stream while calculating hash\"",
",",
"e",
")",
";",
"}",
"}"
] | Adds data to the digest using the specified input stream of bytes, starting at an offset of 0.
@param inStream input stream of bytes.
@param bufferSize maximum allowed buffer size for reading data.
@return The same {@link DataHasher} object for chaining calls.
@throws HashException when hash calculation fails.
@throws NullPointerException when input stream is null. | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"input",
"stream",
"of",
"bytes",
"starting",
"at",
"an",
"offset",
"of",
"0",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L218-L233 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java | ArchiveUtils.getLicenseAgreement | public static String getLicenseAgreement(final JarFile jar, final Map<String, String> manifestAttrs) {
"""
Gets the license agreement for the jar file.
@param jar the jar file
@param manifestAttrs the manifest file for the jar file
@return the license agreement as a String
"""
String licenseAgreement = null;
if (manifestAttrs.isEmpty()) {
return licenseAgreement;
}
String licenseAgreementPrefix = manifestAttrs.get(ArchiveUtils.LICENSE_AGREEMENT);
LicenseProvider licenseProvider = (licenseAgreementPrefix != null) ? ZipLicenseProvider.createInstance(jar, licenseAgreementPrefix) : null;
if (licenseProvider != null)
licenseAgreement = new InstallLicenseImpl("", LicenseType.UNSPECIFIED, licenseProvider).getAgreement();
return licenseAgreement;
} | java | public static String getLicenseAgreement(final JarFile jar, final Map<String, String> manifestAttrs) {
String licenseAgreement = null;
if (manifestAttrs.isEmpty()) {
return licenseAgreement;
}
String licenseAgreementPrefix = manifestAttrs.get(ArchiveUtils.LICENSE_AGREEMENT);
LicenseProvider licenseProvider = (licenseAgreementPrefix != null) ? ZipLicenseProvider.createInstance(jar, licenseAgreementPrefix) : null;
if (licenseProvider != null)
licenseAgreement = new InstallLicenseImpl("", LicenseType.UNSPECIFIED, licenseProvider).getAgreement();
return licenseAgreement;
} | [
"public",
"static",
"String",
"getLicenseAgreement",
"(",
"final",
"JarFile",
"jar",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"manifestAttrs",
")",
"{",
"String",
"licenseAgreement",
"=",
"null",
";",
"if",
"(",
"manifestAttrs",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"licenseAgreement",
";",
"}",
"String",
"licenseAgreementPrefix",
"=",
"manifestAttrs",
".",
"get",
"(",
"ArchiveUtils",
".",
"LICENSE_AGREEMENT",
")",
";",
"LicenseProvider",
"licenseProvider",
"=",
"(",
"licenseAgreementPrefix",
"!=",
"null",
")",
"?",
"ZipLicenseProvider",
".",
"createInstance",
"(",
"jar",
",",
"licenseAgreementPrefix",
")",
":",
"null",
";",
"if",
"(",
"licenseProvider",
"!=",
"null",
")",
"licenseAgreement",
"=",
"new",
"InstallLicenseImpl",
"(",
"\"\"",
",",
"LicenseType",
".",
"UNSPECIFIED",
",",
"licenseProvider",
")",
".",
"getAgreement",
"(",
")",
";",
"return",
"licenseAgreement",
";",
"}"
] | Gets the license agreement for the jar file.
@param jar the jar file
@param manifestAttrs the manifest file for the jar file
@return the license agreement as a String | [
"Gets",
"the",
"license",
"agreement",
"for",
"the",
"jar",
"file",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java#L168-L183 |
kiswanij/jk-util | src/main/java/com/jk/util/JKHttpUtil.java | JKHttpUtil.getValueFromUrl | public static String getValueFromUrl(String url, String preText, int length) {
"""
Gets the value from url based on pre-text value from the response.
@param url the url
@param preText the pre text
@param length the length
@return the value from url
"""
String urlContents = getUrlContents(url);
int indexOf = urlContents.indexOf(preText);
if (indexOf != -1) {
indexOf += preText.length();
String substring = urlContents.substring(indexOf, indexOf + length);
return substring;
}
return null;
} | java | public static String getValueFromUrl(String url, String preText, int length) {
String urlContents = getUrlContents(url);
int indexOf = urlContents.indexOf(preText);
if (indexOf != -1) {
indexOf += preText.length();
String substring = urlContents.substring(indexOf, indexOf + length);
return substring;
}
return null;
} | [
"public",
"static",
"String",
"getValueFromUrl",
"(",
"String",
"url",
",",
"String",
"preText",
",",
"int",
"length",
")",
"{",
"String",
"urlContents",
"=",
"getUrlContents",
"(",
"url",
")",
";",
"int",
"indexOf",
"=",
"urlContents",
".",
"indexOf",
"(",
"preText",
")",
";",
"if",
"(",
"indexOf",
"!=",
"-",
"1",
")",
"{",
"indexOf",
"+=",
"preText",
".",
"length",
"(",
")",
";",
"String",
"substring",
"=",
"urlContents",
".",
"substring",
"(",
"indexOf",
",",
"indexOf",
"+",
"length",
")",
";",
"return",
"substring",
";",
"}",
"return",
"null",
";",
"}"
] | Gets the value from url based on pre-text value from the response.
@param url the url
@param preText the pre text
@param length the length
@return the value from url | [
"Gets",
"the",
"value",
"from",
"url",
"based",
"on",
"pre",
"-",
"text",
"value",
"from",
"the",
"response",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L184-L193 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/ST_FurthestCoordinate.java | ST_FurthestCoordinate.getFurthestCoordinate | public static Geometry getFurthestCoordinate(Point point, Geometry geom) {
"""
Computes the furthest coordinate(s) contained in the given geometry starting
from the given point, using the 2D distance.
@param point Point
@param geom Geometry
@return The furthest coordinate(s) contained in the given geometry starting from
the given point, using the 2D distance
"""
if (point == null || geom == null) {
return null;
}
double maxDistance = Double.NEGATIVE_INFINITY;
Coordinate pointCoordinate = point.getCoordinate();
Set<Coordinate> furthestCoordinates = new HashSet<Coordinate>();
for (Coordinate c : geom.getCoordinates()) {
double distance = c.distance(pointCoordinate);
if (Double.compare(distance, maxDistance) == 0) {
furthestCoordinates.add(c);
}
if (Double.compare(distance, maxDistance) > 0) {
maxDistance = distance;
furthestCoordinates.clear();
furthestCoordinates.add(c);
}
}
if (furthestCoordinates.size() == 1) {
return GEOMETRY_FACTORY.createPoint(furthestCoordinates.iterator().next());
}
return GEOMETRY_FACTORY.createMultiPoint(
furthestCoordinates.toArray(new Coordinate[0]));
} | java | public static Geometry getFurthestCoordinate(Point point, Geometry geom) {
if (point == null || geom == null) {
return null;
}
double maxDistance = Double.NEGATIVE_INFINITY;
Coordinate pointCoordinate = point.getCoordinate();
Set<Coordinate> furthestCoordinates = new HashSet<Coordinate>();
for (Coordinate c : geom.getCoordinates()) {
double distance = c.distance(pointCoordinate);
if (Double.compare(distance, maxDistance) == 0) {
furthestCoordinates.add(c);
}
if (Double.compare(distance, maxDistance) > 0) {
maxDistance = distance;
furthestCoordinates.clear();
furthestCoordinates.add(c);
}
}
if (furthestCoordinates.size() == 1) {
return GEOMETRY_FACTORY.createPoint(furthestCoordinates.iterator().next());
}
return GEOMETRY_FACTORY.createMultiPoint(
furthestCoordinates.toArray(new Coordinate[0]));
} | [
"public",
"static",
"Geometry",
"getFurthestCoordinate",
"(",
"Point",
"point",
",",
"Geometry",
"geom",
")",
"{",
"if",
"(",
"point",
"==",
"null",
"||",
"geom",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"double",
"maxDistance",
"=",
"Double",
".",
"NEGATIVE_INFINITY",
";",
"Coordinate",
"pointCoordinate",
"=",
"point",
".",
"getCoordinate",
"(",
")",
";",
"Set",
"<",
"Coordinate",
">",
"furthestCoordinates",
"=",
"new",
"HashSet",
"<",
"Coordinate",
">",
"(",
")",
";",
"for",
"(",
"Coordinate",
"c",
":",
"geom",
".",
"getCoordinates",
"(",
")",
")",
"{",
"double",
"distance",
"=",
"c",
".",
"distance",
"(",
"pointCoordinate",
")",
";",
"if",
"(",
"Double",
".",
"compare",
"(",
"distance",
",",
"maxDistance",
")",
"==",
"0",
")",
"{",
"furthestCoordinates",
".",
"add",
"(",
"c",
")",
";",
"}",
"if",
"(",
"Double",
".",
"compare",
"(",
"distance",
",",
"maxDistance",
")",
">",
"0",
")",
"{",
"maxDistance",
"=",
"distance",
";",
"furthestCoordinates",
".",
"clear",
"(",
")",
";",
"furthestCoordinates",
".",
"add",
"(",
"c",
")",
";",
"}",
"}",
"if",
"(",
"furthestCoordinates",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"GEOMETRY_FACTORY",
".",
"createPoint",
"(",
"furthestCoordinates",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"}",
"return",
"GEOMETRY_FACTORY",
".",
"createMultiPoint",
"(",
"furthestCoordinates",
".",
"toArray",
"(",
"new",
"Coordinate",
"[",
"0",
"]",
")",
")",
";",
"}"
] | Computes the furthest coordinate(s) contained in the given geometry starting
from the given point, using the 2D distance.
@param point Point
@param geom Geometry
@return The furthest coordinate(s) contained in the given geometry starting from
the given point, using the 2D distance | [
"Computes",
"the",
"furthest",
"coordinate",
"(",
"s",
")",
"contained",
"in",
"the",
"given",
"geometry",
"starting",
"from",
"the",
"given",
"point",
"using",
"the",
"2D",
"distance",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/ST_FurthestCoordinate.java#L64-L87 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/WaitHelper.java | WaitHelper.waitUntilNoMoreException | public void waitUntilNoMoreException(final Runnable runnable, final List<Class<? extends Exception>> expectedExceptions) {
"""
Wait until no more expected exception is thrown or the number of wait cycles has been exceeded.
@param runnable
Code to run.
@param expectedExceptions
List of expected exceptions.
"""
final List<RuntimeException> actualExceptions = new ArrayList<>();
int tries = 0;
while (tries < maxTries) {
try {
runnable.run();
return;
} catch (final RuntimeException ex) {
if (!Utils4J.expectedException(ex, expectedExceptions) && !Utils4J.expectedCause(ex, expectedExceptions)) {
throw ex;
}
actualExceptions.add(ex);
tries++;
Utils4J.sleep(sleepMillis);
}
}
throw new IllegalStateException("Waited too long for execution without exception. Expected exceptions: " + expectedExceptions
+ ", Actual exceptions: " + actualExceptions);
} | java | public void waitUntilNoMoreException(final Runnable runnable, final List<Class<? extends Exception>> expectedExceptions) {
final List<RuntimeException> actualExceptions = new ArrayList<>();
int tries = 0;
while (tries < maxTries) {
try {
runnable.run();
return;
} catch (final RuntimeException ex) {
if (!Utils4J.expectedException(ex, expectedExceptions) && !Utils4J.expectedCause(ex, expectedExceptions)) {
throw ex;
}
actualExceptions.add(ex);
tries++;
Utils4J.sleep(sleepMillis);
}
}
throw new IllegalStateException("Waited too long for execution without exception. Expected exceptions: " + expectedExceptions
+ ", Actual exceptions: " + actualExceptions);
} | [
"public",
"void",
"waitUntilNoMoreException",
"(",
"final",
"Runnable",
"runnable",
",",
"final",
"List",
"<",
"Class",
"<",
"?",
"extends",
"Exception",
">",
">",
"expectedExceptions",
")",
"{",
"final",
"List",
"<",
"RuntimeException",
">",
"actualExceptions",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"tries",
"=",
"0",
";",
"while",
"(",
"tries",
"<",
"maxTries",
")",
"{",
"try",
"{",
"runnable",
".",
"run",
"(",
")",
";",
"return",
";",
"}",
"catch",
"(",
"final",
"RuntimeException",
"ex",
")",
"{",
"if",
"(",
"!",
"Utils4J",
".",
"expectedException",
"(",
"ex",
",",
"expectedExceptions",
")",
"&&",
"!",
"Utils4J",
".",
"expectedCause",
"(",
"ex",
",",
"expectedExceptions",
")",
")",
"{",
"throw",
"ex",
";",
"}",
"actualExceptions",
".",
"add",
"(",
"ex",
")",
";",
"tries",
"++",
";",
"Utils4J",
".",
"sleep",
"(",
"sleepMillis",
")",
";",
"}",
"}",
"throw",
"new",
"IllegalStateException",
"(",
"\"Waited too long for execution without exception. Expected exceptions: \"",
"+",
"expectedExceptions",
"+",
"\", Actual exceptions: \"",
"+",
"actualExceptions",
")",
";",
"}"
] | Wait until no more expected exception is thrown or the number of wait cycles has been exceeded.
@param runnable
Code to run.
@param expectedExceptions
List of expected exceptions. | [
"Wait",
"until",
"no",
"more",
"expected",
"exception",
"is",
"thrown",
"or",
"the",
"number",
"of",
"wait",
"cycles",
"has",
"been",
"exceeded",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/WaitHelper.java#L55-L75 |
zackpollard/JavaTelegramBot-API | core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java | TelegramBot.editInlineMessageText | public boolean editInlineMessageText(String inlineMessageId, String text, ParseMode parseMode, boolean disableWebPagePreview, InlineReplyMarkup inlineReplyMarkup) {
"""
This allows you to edit the text of an inline message you have sent previously. (The inline message must have an
InlineReplyMarkup object attached in order to be editable)
@param inlineMessageId The ID of the inline message you want to edit
@param text The new text you want to display
@param parseMode The ParseMode that should be used with this new text
@param disableWebPagePreview Whether any URLs should be displayed with a preview of their content
@param inlineReplyMarkup Any InlineReplyMarkup object you want to edit into the message
@return True if the edit succeeded, otherwise false
"""
if(inlineMessageId != null && text != null) {
JSONObject jsonResponse = this.editMessageText(null, null, inlineMessageId, text, parseMode, disableWebPagePreview, inlineReplyMarkup);
if (jsonResponse != null) {
if (jsonResponse.getBoolean("result")) return true;
}
}
return false;
} | java | public boolean editInlineMessageText(String inlineMessageId, String text, ParseMode parseMode, boolean disableWebPagePreview, InlineReplyMarkup inlineReplyMarkup) {
if(inlineMessageId != null && text != null) {
JSONObject jsonResponse = this.editMessageText(null, null, inlineMessageId, text, parseMode, disableWebPagePreview, inlineReplyMarkup);
if (jsonResponse != null) {
if (jsonResponse.getBoolean("result")) return true;
}
}
return false;
} | [
"public",
"boolean",
"editInlineMessageText",
"(",
"String",
"inlineMessageId",
",",
"String",
"text",
",",
"ParseMode",
"parseMode",
",",
"boolean",
"disableWebPagePreview",
",",
"InlineReplyMarkup",
"inlineReplyMarkup",
")",
"{",
"if",
"(",
"inlineMessageId",
"!=",
"null",
"&&",
"text",
"!=",
"null",
")",
"{",
"JSONObject",
"jsonResponse",
"=",
"this",
".",
"editMessageText",
"(",
"null",
",",
"null",
",",
"inlineMessageId",
",",
"text",
",",
"parseMode",
",",
"disableWebPagePreview",
",",
"inlineReplyMarkup",
")",
";",
"if",
"(",
"jsonResponse",
"!=",
"null",
")",
"{",
"if",
"(",
"jsonResponse",
".",
"getBoolean",
"(",
"\"result\"",
")",
")",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | This allows you to edit the text of an inline message you have sent previously. (The inline message must have an
InlineReplyMarkup object attached in order to be editable)
@param inlineMessageId The ID of the inline message you want to edit
@param text The new text you want to display
@param parseMode The ParseMode that should be used with this new text
@param disableWebPagePreview Whether any URLs should be displayed with a preview of their content
@param inlineReplyMarkup Any InlineReplyMarkup object you want to edit into the message
@return True if the edit succeeded, otherwise false | [
"This",
"allows",
"you",
"to",
"edit",
"the",
"text",
"of",
"an",
"inline",
"message",
"you",
"have",
"sent",
"previously",
".",
"(",
"The",
"inline",
"message",
"must",
"have",
"an",
"InlineReplyMarkup",
"object",
"attached",
"in",
"order",
"to",
"be",
"editable",
")"
] | train | https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L712-L725 |
ontop/ontop | mapping/core/src/main/java/it/unibz/inf/ontop/spec/mapping/transformer/impl/MappingDataTypeCompletion.java | MappingDataTypeCompletion.insertOperationDatatyping | private void insertOperationDatatyping(Term term, Function atom, int position) throws UnknownDatatypeException {
"""
Following r2rml standard we do not infer the datatype for operation but we return the default value string
"""
ImmutableTerm immutableTerm = immutabilityTools.convertIntoImmutableTerm(term);
if (immutableTerm instanceof ImmutableFunctionalTerm) {
ImmutableFunctionalTerm castTerm = (ImmutableFunctionalTerm) immutableTerm;
Predicate functionSymbol = castTerm.getFunctionSymbol();
if (functionSymbol instanceof OperationPredicate) {
Optional<TermType> inferredType = termTypeInferenceTools.inferType(castTerm);
if(inferredType.isPresent()){
// delete explicit datatypes of the operands
deleteExplicitTypes(term, atom, position);
// insert the datatype of the evaluated operation
atom.setTerm(
position,
termFactory.getTypedTerm(
term,
// TODO: refactor this cast
(RDFDatatype) inferredType.get()
));
}
else
{
if (defaultDatatypeInferred) {
atom.setTerm(position, termFactory.getTypedTerm(term, typeFactory.getXsdStringDatatype()));
} else {
throw new UnknownDatatypeException("Impossible to determine the expected datatype for the operation " + castTerm + "\n" +
"Possible solutions: \n" +
"- Add an explicit datatype in the mapping \n" +
"- Add in the .properties file the setting: ontop.inferDefaultDatatype = true\n" +
" and we will infer the default datatype (xsd:string)"
);
}
}
}
}
} | java | private void insertOperationDatatyping(Term term, Function atom, int position) throws UnknownDatatypeException {
ImmutableTerm immutableTerm = immutabilityTools.convertIntoImmutableTerm(term);
if (immutableTerm instanceof ImmutableFunctionalTerm) {
ImmutableFunctionalTerm castTerm = (ImmutableFunctionalTerm) immutableTerm;
Predicate functionSymbol = castTerm.getFunctionSymbol();
if (functionSymbol instanceof OperationPredicate) {
Optional<TermType> inferredType = termTypeInferenceTools.inferType(castTerm);
if(inferredType.isPresent()){
// delete explicit datatypes of the operands
deleteExplicitTypes(term, atom, position);
// insert the datatype of the evaluated operation
atom.setTerm(
position,
termFactory.getTypedTerm(
term,
// TODO: refactor this cast
(RDFDatatype) inferredType.get()
));
}
else
{
if (defaultDatatypeInferred) {
atom.setTerm(position, termFactory.getTypedTerm(term, typeFactory.getXsdStringDatatype()));
} else {
throw new UnknownDatatypeException("Impossible to determine the expected datatype for the operation " + castTerm + "\n" +
"Possible solutions: \n" +
"- Add an explicit datatype in the mapping \n" +
"- Add in the .properties file the setting: ontop.inferDefaultDatatype = true\n" +
" and we will infer the default datatype (xsd:string)"
);
}
}
}
}
} | [
"private",
"void",
"insertOperationDatatyping",
"(",
"Term",
"term",
",",
"Function",
"atom",
",",
"int",
"position",
")",
"throws",
"UnknownDatatypeException",
"{",
"ImmutableTerm",
"immutableTerm",
"=",
"immutabilityTools",
".",
"convertIntoImmutableTerm",
"(",
"term",
")",
";",
"if",
"(",
"immutableTerm",
"instanceof",
"ImmutableFunctionalTerm",
")",
"{",
"ImmutableFunctionalTerm",
"castTerm",
"=",
"(",
"ImmutableFunctionalTerm",
")",
"immutableTerm",
";",
"Predicate",
"functionSymbol",
"=",
"castTerm",
".",
"getFunctionSymbol",
"(",
")",
";",
"if",
"(",
"functionSymbol",
"instanceof",
"OperationPredicate",
")",
"{",
"Optional",
"<",
"TermType",
">",
"inferredType",
"=",
"termTypeInferenceTools",
".",
"inferType",
"(",
"castTerm",
")",
";",
"if",
"(",
"inferredType",
".",
"isPresent",
"(",
")",
")",
"{",
"// delete explicit datatypes of the operands",
"deleteExplicitTypes",
"(",
"term",
",",
"atom",
",",
"position",
")",
";",
"// insert the datatype of the evaluated operation",
"atom",
".",
"setTerm",
"(",
"position",
",",
"termFactory",
".",
"getTypedTerm",
"(",
"term",
",",
"// TODO: refactor this cast",
"(",
"RDFDatatype",
")",
"inferredType",
".",
"get",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"defaultDatatypeInferred",
")",
"{",
"atom",
".",
"setTerm",
"(",
"position",
",",
"termFactory",
".",
"getTypedTerm",
"(",
"term",
",",
"typeFactory",
".",
"getXsdStringDatatype",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"UnknownDatatypeException",
"(",
"\"Impossible to determine the expected datatype for the operation \"",
"+",
"castTerm",
"+",
"\"\\n\"",
"+",
"\"Possible solutions: \\n\"",
"+",
"\"- Add an explicit datatype in the mapping \\n\"",
"+",
"\"- Add in the .properties file the setting: ontop.inferDefaultDatatype = true\\n\"",
"+",
"\" and we will infer the default datatype (xsd:string)\"",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Following r2rml standard we do not infer the datatype for operation but we return the default value string | [
"Following",
"r2rml",
"standard",
"we",
"do",
"not",
"infer",
"the",
"datatype",
"for",
"operation",
"but",
"we",
"return",
"the",
"default",
"value",
"string"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/core/src/main/java/it/unibz/inf/ontop/spec/mapping/transformer/impl/MappingDataTypeCompletion.java#L145-L185 |
influxdata/influxdb-java | src/main/java/org/influxdb/impl/Preconditions.java | Preconditions.checkPositiveNumber | public static void checkPositiveNumber(final Number number, final String name) throws IllegalArgumentException {
"""
Enforces that the number is larger than 0.
@param number the number to test
@param name variable name for reporting
@throws IllegalArgumentException if the number is less or equal to 0
"""
if (number == null || number.doubleValue() <= 0) {
throw new IllegalArgumentException("Expecting a positive number for " + name);
}
} | java | public static void checkPositiveNumber(final Number number, final String name) throws IllegalArgumentException {
if (number == null || number.doubleValue() <= 0) {
throw new IllegalArgumentException("Expecting a positive number for " + name);
}
} | [
"public",
"static",
"void",
"checkPositiveNumber",
"(",
"final",
"Number",
"number",
",",
"final",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"number",
"==",
"null",
"||",
"number",
".",
"doubleValue",
"(",
")",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expecting a positive number for \"",
"+",
"name",
")",
";",
"}",
"}"
] | Enforces that the number is larger than 0.
@param number the number to test
@param name variable name for reporting
@throws IllegalArgumentException if the number is less or equal to 0 | [
"Enforces",
"that",
"the",
"number",
"is",
"larger",
"than",
"0",
"."
] | train | https://github.com/influxdata/influxdb-java/blob/8ae777f34aa2e598f609208cf4fa12d4642f83f5/src/main/java/org/influxdb/impl/Preconditions.java#L33-L37 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java | ConstructorBuilder.getInstance | public static ConstructorBuilder getInstance(Context context,
ClassDoc classDoc, ConstructorWriter writer) {
"""
Construct a new ConstructorBuilder.
@param context the build context.
@param classDoc the class whoses members are being documented.
@param writer the doclet specific writer.
"""
return new ConstructorBuilder(context, classDoc, writer);
} | java | public static ConstructorBuilder getInstance(Context context,
ClassDoc classDoc, ConstructorWriter writer) {
return new ConstructorBuilder(context, classDoc, writer);
} | [
"public",
"static",
"ConstructorBuilder",
"getInstance",
"(",
"Context",
"context",
",",
"ClassDoc",
"classDoc",
",",
"ConstructorWriter",
"writer",
")",
"{",
"return",
"new",
"ConstructorBuilder",
"(",
"context",
",",
"classDoc",
",",
"writer",
")",
";",
"}"
] | Construct a new ConstructorBuilder.
@param context the build context.
@param classDoc the class whoses members are being documented.
@param writer the doclet specific writer. | [
"Construct",
"a",
"new",
"ConstructorBuilder",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java#L116-L119 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java | TopicAccessManager.checkAccessTopicGlobalAC | boolean checkAccessTopicGlobalAC(UserContext ctx, String topic) throws IllegalAccessException {
"""
Check if global access control is allowed
@param ctx
@param topic
@return true if at least one global topicAccessControl exist
@throws IllegalAccessException
"""
logger.debug("Looking for accessController for topic '{}' from GlobalAccess", topic);
Iterable<JsTopicAccessController> accessControls = topicAccessController.select(DEFAULT_AT);
return checkAccessTopicFromControllers(ctx, topic, accessControls);
} | java | boolean checkAccessTopicGlobalAC(UserContext ctx, String topic) throws IllegalAccessException {
logger.debug("Looking for accessController for topic '{}' from GlobalAccess", topic);
Iterable<JsTopicAccessController> accessControls = topicAccessController.select(DEFAULT_AT);
return checkAccessTopicFromControllers(ctx, topic, accessControls);
} | [
"boolean",
"checkAccessTopicGlobalAC",
"(",
"UserContext",
"ctx",
",",
"String",
"topic",
")",
"throws",
"IllegalAccessException",
"{",
"logger",
".",
"debug",
"(",
"\"Looking for accessController for topic '{}' from GlobalAccess\"",
",",
"topic",
")",
";",
"Iterable",
"<",
"JsTopicAccessController",
">",
"accessControls",
"=",
"topicAccessController",
".",
"select",
"(",
"DEFAULT_AT",
")",
";",
"return",
"checkAccessTopicFromControllers",
"(",
"ctx",
",",
"topic",
",",
"accessControls",
")",
";",
"}"
] | Check if global access control is allowed
@param ctx
@param topic
@return true if at least one global topicAccessControl exist
@throws IllegalAccessException | [
"Check",
"if",
"global",
"access",
"control",
"is",
"allowed"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L67-L71 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java | ClassesManager.fieldName | public static String fieldName(Class<?> aClass,String regex) {
"""
This method returns the name of the field whose name matches with regex.
@param aClass a class to control
@param regex field name
@return true if exists a field with this name in aClass, false otherwise
"""
if(isNestedMapping(regex))
return regex;
String result = null;
for(Class<?> clazz: getAllsuperClasses(aClass))
if(!isNull(result = getFieldName(clazz, regex)))
return result;
return result;
} | java | public static String fieldName(Class<?> aClass,String regex){
if(isNestedMapping(regex))
return regex;
String result = null;
for(Class<?> clazz: getAllsuperClasses(aClass))
if(!isNull(result = getFieldName(clazz, regex)))
return result;
return result;
} | [
"public",
"static",
"String",
"fieldName",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"String",
"regex",
")",
"{",
"if",
"(",
"isNestedMapping",
"(",
"regex",
")",
")",
"return",
"regex",
";",
"String",
"result",
"=",
"null",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"clazz",
":",
"getAllsuperClasses",
"(",
"aClass",
")",
")",
"if",
"(",
"!",
"isNull",
"(",
"result",
"=",
"getFieldName",
"(",
"clazz",
",",
"regex",
")",
")",
")",
"return",
"result",
";",
"return",
"result",
";",
"}"
] | This method returns the name of the field whose name matches with regex.
@param aClass a class to control
@param regex field name
@return true if exists a field with this name in aClass, false otherwise | [
"This",
"method",
"returns",
"the",
"name",
"of",
"the",
"field",
"whose",
"name",
"matches",
"with",
"regex",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L393-L405 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java | FilterList.findInList | public boolean findInList(int[] address) {
"""
Determine if an address, represented by an integer array, is in the address
tree
@param address
integer array representing the address, leftmost number
in the address should start at array offset 0.
@return true if this address is found in the address tree, false if
it is not.
"""
int len = address.length;
if (len < IP_ADDR_NUMBERS) {
int j = IP_ADDR_NUMBERS - 1;
// for performace, hard code the size here
int a[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
// int a[] = new int[IP_ADDR_NUMBERS];
// for (int i = 0; i < IP_ADDR_NUMBERS; i++)
// {
// a[i] = 0;
// }
for (int i = len; i > 0; i--, j--) {
a[j] = address[i - 1];
}
return findInList(a, 0, firstCell, 7);
}
return findInList(address, 0, firstCell, (address.length - 1));
} | java | public boolean findInList(int[] address) {
int len = address.length;
if (len < IP_ADDR_NUMBERS) {
int j = IP_ADDR_NUMBERS - 1;
// for performace, hard code the size here
int a[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
// int a[] = new int[IP_ADDR_NUMBERS];
// for (int i = 0; i < IP_ADDR_NUMBERS; i++)
// {
// a[i] = 0;
// }
for (int i = len; i > 0; i--, j--) {
a[j] = address[i - 1];
}
return findInList(a, 0, firstCell, 7);
}
return findInList(address, 0, firstCell, (address.length - 1));
} | [
"public",
"boolean",
"findInList",
"(",
"int",
"[",
"]",
"address",
")",
"{",
"int",
"len",
"=",
"address",
".",
"length",
";",
"if",
"(",
"len",
"<",
"IP_ADDR_NUMBERS",
")",
"{",
"int",
"j",
"=",
"IP_ADDR_NUMBERS",
"-",
"1",
";",
"// for performace, hard code the size here",
"int",
"a",
"[",
"]",
"=",
"{",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
"}",
";",
"// int a[] = new int[IP_ADDR_NUMBERS];",
"// for (int i = 0; i < IP_ADDR_NUMBERS; i++)",
"// {",
"// a[i] = 0;",
"// }",
"for",
"(",
"int",
"i",
"=",
"len",
";",
"i",
">",
"0",
";",
"i",
"--",
",",
"j",
"--",
")",
"{",
"a",
"[",
"j",
"]",
"=",
"address",
"[",
"i",
"-",
"1",
"]",
";",
"}",
"return",
"findInList",
"(",
"a",
",",
"0",
",",
"firstCell",
",",
"7",
")",
";",
"}",
"return",
"findInList",
"(",
"address",
",",
"0",
",",
"firstCell",
",",
"(",
"address",
".",
"length",
"-",
"1",
")",
")",
";",
"}"
] | Determine if an address, represented by an integer array, is in the address
tree
@param address
integer array representing the address, leftmost number
in the address should start at array offset 0.
@return true if this address is found in the address tree, false if
it is not. | [
"Determine",
"if",
"an",
"address",
"represented",
"by",
"an",
"integer",
"array",
"is",
"in",
"the",
"address",
"tree"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java#L228-L249 |
KayLerch/alexa-skills-kit-tellask-java | src/main/java/io/klerch/alexa/tellask/util/factory/AlexaSpeechletFactory.java | AlexaSpeechletFactory.createSpeechletFromRequest | public static <T extends AlexaSpeechlet> T createSpeechletFromRequest(final byte[] serializedSpeechletRequest, final Class<T> speechletClass, final UtteranceReader utteranceReader) throws IOException {
"""
Creates an AlexaSpeechlet from bytes of a speechlet request. It will extract the
locale from the request and uses it for creating a new instance of AlexaSpeechlet
@param serializedSpeechletRequest bytes of a speechlet request
@param speechletClass the class of your AlexaSpeechlet to instantiate
@param utteranceReader the reader AlexaSpeechlet should use when reading out utterances
@param <T> must extend AlexaSpeechlet
@return new instance of AlexaSpeechlet
@throws IOException thrown when something went wrong
"""
final ObjectMapper mapper = new ObjectMapper();
final JsonNode parser = mapper.readTree(serializedSpeechletRequest);
final String locale = Optional.of(parser.path("request"))
.filter(node -> !node.isMissingNode())
.map(node -> node.path("locale"))
.filter(node -> !node.isMissingNode())
.map(JsonNode::textValue)
.orElse(DEFAULT_LOCALE);
try {
return speechletClass.getConstructor(String.class, UtteranceReader.class)
.newInstance(locale, utteranceReader);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new IOException("Could not create Speechlet from speechlet request", e);
}
} | java | public static <T extends AlexaSpeechlet> T createSpeechletFromRequest(final byte[] serializedSpeechletRequest, final Class<T> speechletClass, final UtteranceReader utteranceReader) throws IOException {
final ObjectMapper mapper = new ObjectMapper();
final JsonNode parser = mapper.readTree(serializedSpeechletRequest);
final String locale = Optional.of(parser.path("request"))
.filter(node -> !node.isMissingNode())
.map(node -> node.path("locale"))
.filter(node -> !node.isMissingNode())
.map(JsonNode::textValue)
.orElse(DEFAULT_LOCALE);
try {
return speechletClass.getConstructor(String.class, UtteranceReader.class)
.newInstance(locale, utteranceReader);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new IOException("Could not create Speechlet from speechlet request", e);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"AlexaSpeechlet",
">",
"T",
"createSpeechletFromRequest",
"(",
"final",
"byte",
"[",
"]",
"serializedSpeechletRequest",
",",
"final",
"Class",
"<",
"T",
">",
"speechletClass",
",",
"final",
"UtteranceReader",
"utteranceReader",
")",
"throws",
"IOException",
"{",
"final",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"final",
"JsonNode",
"parser",
"=",
"mapper",
".",
"readTree",
"(",
"serializedSpeechletRequest",
")",
";",
"final",
"String",
"locale",
"=",
"Optional",
".",
"of",
"(",
"parser",
".",
"path",
"(",
"\"request\"",
")",
")",
".",
"filter",
"(",
"node",
"->",
"!",
"node",
".",
"isMissingNode",
"(",
")",
")",
".",
"map",
"(",
"node",
"->",
"node",
".",
"path",
"(",
"\"locale\"",
")",
")",
".",
"filter",
"(",
"node",
"->",
"!",
"node",
".",
"isMissingNode",
"(",
")",
")",
".",
"map",
"(",
"JsonNode",
"::",
"textValue",
")",
".",
"orElse",
"(",
"DEFAULT_LOCALE",
")",
";",
"try",
"{",
"return",
"speechletClass",
".",
"getConstructor",
"(",
"String",
".",
"class",
",",
"UtteranceReader",
".",
"class",
")",
".",
"newInstance",
"(",
"locale",
",",
"utteranceReader",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"|",
"IllegalAccessException",
"|",
"InvocationTargetException",
"|",
"NoSuchMethodException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Could not create Speechlet from speechlet request\"",
",",
"e",
")",
";",
"}",
"}"
] | Creates an AlexaSpeechlet from bytes of a speechlet request. It will extract the
locale from the request and uses it for creating a new instance of AlexaSpeechlet
@param serializedSpeechletRequest bytes of a speechlet request
@param speechletClass the class of your AlexaSpeechlet to instantiate
@param utteranceReader the reader AlexaSpeechlet should use when reading out utterances
@param <T> must extend AlexaSpeechlet
@return new instance of AlexaSpeechlet
@throws IOException thrown when something went wrong | [
"Creates",
"an",
"AlexaSpeechlet",
"from",
"bytes",
"of",
"a",
"speechlet",
"request",
".",
"It",
"will",
"extract",
"the",
"locale",
"from",
"the",
"request",
"and",
"uses",
"it",
"for",
"creating",
"a",
"new",
"instance",
"of",
"AlexaSpeechlet"
] | train | https://github.com/KayLerch/alexa-skills-kit-tellask-java/blob/2c19028e775c2512dd4649d12962c0b48bf7f2bc/src/main/java/io/klerch/alexa/tellask/util/factory/AlexaSpeechletFactory.java#L37-L54 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.readFile | public <OUT> DataStreamSource<OUT> readFile(FileInputFormat<OUT> inputFormat,
String filePath) {
"""
Reads the contents of the user-specified {@code filePath} based on the given {@link FileInputFormat}.
<p>Since all data streams need specific information about their types, this method needs to determine the
type of the data produced by the input format. It will attempt to determine the data type by reflection,
unless the input format implements the {@link org.apache.flink.api.java.typeutils.ResultTypeQueryable} interface.
In the latter case, this method will invoke the
{@link org.apache.flink.api.java.typeutils.ResultTypeQueryable#getProducedType()} method to determine data
type produced by the input format.
<p><b>NOTES ON CHECKPOINTING: </b> The source monitors the path, creates the
{@link org.apache.flink.core.fs.FileInputSplit FileInputSplits} to be processed,
forwards them to the downstream {@link ContinuousFileReaderOperator readers} to read the actual data,
and exits, without waiting for the readers to finish reading. This implies that no more checkpoint
barriers are going to be forwarded after the source exits, thus having no checkpoints after that point.
@param filePath
The path of the file, as a URI (e.g., "file:///some/local/file" or "hdfs://host:port/file/path")
@param inputFormat
The input format used to create the data stream
@param <OUT>
The type of the returned data stream
@return The data stream that represents the data read from the given file
"""
return readFile(inputFormat, filePath, FileProcessingMode.PROCESS_ONCE, -1);
} | java | public <OUT> DataStreamSource<OUT> readFile(FileInputFormat<OUT> inputFormat,
String filePath) {
return readFile(inputFormat, filePath, FileProcessingMode.PROCESS_ONCE, -1);
} | [
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"readFile",
"(",
"FileInputFormat",
"<",
"OUT",
">",
"inputFormat",
",",
"String",
"filePath",
")",
"{",
"return",
"readFile",
"(",
"inputFormat",
",",
"filePath",
",",
"FileProcessingMode",
".",
"PROCESS_ONCE",
",",
"-",
"1",
")",
";",
"}"
] | Reads the contents of the user-specified {@code filePath} based on the given {@link FileInputFormat}.
<p>Since all data streams need specific information about their types, this method needs to determine the
type of the data produced by the input format. It will attempt to determine the data type by reflection,
unless the input format implements the {@link org.apache.flink.api.java.typeutils.ResultTypeQueryable} interface.
In the latter case, this method will invoke the
{@link org.apache.flink.api.java.typeutils.ResultTypeQueryable#getProducedType()} method to determine data
type produced by the input format.
<p><b>NOTES ON CHECKPOINTING: </b> The source monitors the path, creates the
{@link org.apache.flink.core.fs.FileInputSplit FileInputSplits} to be processed,
forwards them to the downstream {@link ContinuousFileReaderOperator readers} to read the actual data,
and exits, without waiting for the readers to finish reading. This implies that no more checkpoint
barriers are going to be forwarded after the source exits, thus having no checkpoints after that point.
@param filePath
The path of the file, as a URI (e.g., "file:///some/local/file" or "hdfs://host:port/file/path")
@param inputFormat
The input format used to create the data stream
@param <OUT>
The type of the returned data stream
@return The data stream that represents the data read from the given file | [
"Reads",
"the",
"contents",
"of",
"the",
"user",
"-",
"specified",
"{",
"@code",
"filePath",
"}",
"based",
"on",
"the",
"given",
"{",
"@link",
"FileInputFormat",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L994-L997 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.initializeOrgUnit | public void initializeOrgUnit(CmsRequestContext context, CmsOrganizationalUnit ou) {
"""
Initializes the default groups for an organizational unit.<p>
@param context the request context
@param ou the organizational unit
"""
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
m_driverManager.initOrgUnit(dbc, ou);
} | java | public void initializeOrgUnit(CmsRequestContext context, CmsOrganizationalUnit ou) {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
m_driverManager.initOrgUnit(dbc, ou);
} | [
"public",
"void",
"initializeOrgUnit",
"(",
"CmsRequestContext",
"context",
",",
"CmsOrganizationalUnit",
"ou",
")",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"m_driverManager",
".",
"initOrgUnit",
"(",
"dbc",
",",
"ou",
")",
";",
"}"
] | Initializes the default groups for an organizational unit.<p>
@param context the request context
@param ou the organizational unit | [
"Initializes",
"the",
"default",
"groups",
"for",
"an",
"organizational",
"unit",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3477-L3482 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/ReturnValueIgnored.java | ReturnValueIgnored.functionalMethod | private static boolean functionalMethod(ExpressionTree tree, VisitorState state) {
"""
Methods in {@link java.util.function} are pure, and their returnvalues should not be discarded.
"""
Symbol symbol = ASTHelpers.getSymbol(tree);
return symbol instanceof MethodSymbol
&& ((MethodSymbol) symbol)
.owner
.packge()
.getQualifiedName()
.contentEquals("java.util.function");
} | java | private static boolean functionalMethod(ExpressionTree tree, VisitorState state) {
Symbol symbol = ASTHelpers.getSymbol(tree);
return symbol instanceof MethodSymbol
&& ((MethodSymbol) symbol)
.owner
.packge()
.getQualifiedName()
.contentEquals("java.util.function");
} | [
"private",
"static",
"boolean",
"functionalMethod",
"(",
"ExpressionTree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"Symbol",
"symbol",
"=",
"ASTHelpers",
".",
"getSymbol",
"(",
"tree",
")",
";",
"return",
"symbol",
"instanceof",
"MethodSymbol",
"&&",
"(",
"(",
"MethodSymbol",
")",
"symbol",
")",
".",
"owner",
".",
"packge",
"(",
")",
".",
"getQualifiedName",
"(",
")",
".",
"contentEquals",
"(",
"\"java.util.function\"",
")",
";",
"}"
] | Methods in {@link java.util.function} are pure, and their returnvalues should not be discarded. | [
"Methods",
"in",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ReturnValueIgnored.java#L126-L134 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.zipDir | private static void zipDir(final File srcDir, final FileFilter filter, final String destPath, final ZipOutputStream out)
throws IOException {
"""
Add a directory to a ZIP output stream.
@param srcDir
Directory to add - Cannot be <code>null</code> and must be a valid directory.
@param filter
Filter or <code>null</code> for all files.
@param destPath
Path to use for the ZIP archive - May be <code>null</code> or an empyt string.
@param out
Destination stream - Cannot be <code>null</code>.
@throws IOException
Error writing to the output stream.
"""
final File[] files = listFiles(srcDir, filter);
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
zipDir(files[i], filter, concatPathAndFilename(destPath, files[i].getName(), File.separator), out);
} else {
zipFile(files[i], destPath, out);
}
}
} | java | private static void zipDir(final File srcDir, final FileFilter filter, final String destPath, final ZipOutputStream out)
throws IOException {
final File[] files = listFiles(srcDir, filter);
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
zipDir(files[i], filter, concatPathAndFilename(destPath, files[i].getName(), File.separator), out);
} else {
zipFile(files[i], destPath, out);
}
}
} | [
"private",
"static",
"void",
"zipDir",
"(",
"final",
"File",
"srcDir",
",",
"final",
"FileFilter",
"filter",
",",
"final",
"String",
"destPath",
",",
"final",
"ZipOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"final",
"File",
"[",
"]",
"files",
"=",
"listFiles",
"(",
"srcDir",
",",
"filter",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"files",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"files",
"[",
"i",
"]",
".",
"isDirectory",
"(",
")",
")",
"{",
"zipDir",
"(",
"files",
"[",
"i",
"]",
",",
"filter",
",",
"concatPathAndFilename",
"(",
"destPath",
",",
"files",
"[",
"i",
"]",
".",
"getName",
"(",
")",
",",
"File",
".",
"separator",
")",
",",
"out",
")",
";",
"}",
"else",
"{",
"zipFile",
"(",
"files",
"[",
"i",
"]",
",",
"destPath",
",",
"out",
")",
";",
"}",
"}",
"}"
] | Add a directory to a ZIP output stream.
@param srcDir
Directory to add - Cannot be <code>null</code> and must be a valid directory.
@param filter
Filter or <code>null</code> for all files.
@param destPath
Path to use for the ZIP archive - May be <code>null</code> or an empyt string.
@param out
Destination stream - Cannot be <code>null</code>.
@throws IOException
Error writing to the output stream. | [
"Add",
"a",
"directory",
"to",
"a",
"ZIP",
"output",
"stream",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1349-L1361 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_migrationToken_POST | public OvhIpMigrationToken ip_migrationToken_POST(String ip, String customerId) throws IOException {
"""
Generate a migration token
REST: POST /ip/{ip}/migrationToken
@param customerId [required] destination customer ID
@param ip [required]
"""
String qPath = "/ip/{ip}/migrationToken";
StringBuilder sb = path(qPath, ip);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "customerId", customerId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhIpMigrationToken.class);
} | java | public OvhIpMigrationToken ip_migrationToken_POST(String ip, String customerId) throws IOException {
String qPath = "/ip/{ip}/migrationToken";
StringBuilder sb = path(qPath, ip);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "customerId", customerId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhIpMigrationToken.class);
} | [
"public",
"OvhIpMigrationToken",
"ip_migrationToken_POST",
"(",
"String",
"ip",
",",
"String",
"customerId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/migrationToken\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"customerId\"",
",",
"customerId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhIpMigrationToken",
".",
"class",
")",
";",
"}"
] | Generate a migration token
REST: POST /ip/{ip}/migrationToken
@param customerId [required] destination customer ID
@param ip [required] | [
"Generate",
"a",
"migration",
"token"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L312-L319 |
cdk/cdk | storage/smiles/src/main/java/org/openscience/cdk/smiles/SmilesParser.java | SmilesParser.parseMolCXSMILES | private void parseMolCXSMILES(String title, IAtomContainer mol) {
"""
Parses CXSMILES layer and set attributes for atoms and bonds on the provided molecule.
@param title SMILES title field
@param mol molecule
"""
CxSmilesState cxstate;
int pos;
if (title != null && title.startsWith("|")) {
if ((pos = CxSmilesParser.processCx(title, cxstate = new CxSmilesState())) >= 0) {
// set the correct title
mol.setTitle(title.substring(pos));
final Map<IAtom, IAtomContainer> atomToMol = Maps.newHashMapWithExpectedSize(mol.getAtomCount());
final List<IAtom> atoms = new ArrayList<>(mol.getAtomCount());
for (IAtom atom : mol.atoms()) {
atoms.add(atom);
atomToMol.put(atom, mol);
}
assignCxSmilesInfo(mol.getBuilder(), mol, atoms, atomToMol, cxstate);
}
}
} | java | private void parseMolCXSMILES(String title, IAtomContainer mol) {
CxSmilesState cxstate;
int pos;
if (title != null && title.startsWith("|")) {
if ((pos = CxSmilesParser.processCx(title, cxstate = new CxSmilesState())) >= 0) {
// set the correct title
mol.setTitle(title.substring(pos));
final Map<IAtom, IAtomContainer> atomToMol = Maps.newHashMapWithExpectedSize(mol.getAtomCount());
final List<IAtom> atoms = new ArrayList<>(mol.getAtomCount());
for (IAtom atom : mol.atoms()) {
atoms.add(atom);
atomToMol.put(atom, mol);
}
assignCxSmilesInfo(mol.getBuilder(), mol, atoms, atomToMol, cxstate);
}
}
} | [
"private",
"void",
"parseMolCXSMILES",
"(",
"String",
"title",
",",
"IAtomContainer",
"mol",
")",
"{",
"CxSmilesState",
"cxstate",
";",
"int",
"pos",
";",
"if",
"(",
"title",
"!=",
"null",
"&&",
"title",
".",
"startsWith",
"(",
"\"|\"",
")",
")",
"{",
"if",
"(",
"(",
"pos",
"=",
"CxSmilesParser",
".",
"processCx",
"(",
"title",
",",
"cxstate",
"=",
"new",
"CxSmilesState",
"(",
")",
")",
")",
">=",
"0",
")",
"{",
"// set the correct title",
"mol",
".",
"setTitle",
"(",
"title",
".",
"substring",
"(",
"pos",
")",
")",
";",
"final",
"Map",
"<",
"IAtom",
",",
"IAtomContainer",
">",
"atomToMol",
"=",
"Maps",
".",
"newHashMapWithExpectedSize",
"(",
"mol",
".",
"getAtomCount",
"(",
")",
")",
";",
"final",
"List",
"<",
"IAtom",
">",
"atoms",
"=",
"new",
"ArrayList",
"<>",
"(",
"mol",
".",
"getAtomCount",
"(",
")",
")",
";",
"for",
"(",
"IAtom",
"atom",
":",
"mol",
".",
"atoms",
"(",
")",
")",
"{",
"atoms",
".",
"add",
"(",
"atom",
")",
";",
"atomToMol",
".",
"put",
"(",
"atom",
",",
"mol",
")",
";",
"}",
"assignCxSmilesInfo",
"(",
"mol",
".",
"getBuilder",
"(",
")",
",",
"mol",
",",
"atoms",
",",
"atomToMol",
",",
"cxstate",
")",
";",
"}",
"}",
"}"
] | Parses CXSMILES layer and set attributes for atoms and bonds on the provided molecule.
@param title SMILES title field
@param mol molecule | [
"Parses",
"CXSMILES",
"layer",
"and",
"set",
"attributes",
"for",
"atoms",
"and",
"bonds",
"on",
"the",
"provided",
"molecule",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmilesParser.java#L310-L330 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.addPageInput | public static void addPageInput( String name, Object value, ServletRequest request ) {
"""
Set a named action output, which corresponds to an input declared by the <code>pageInput</code> JSP tag.
The actual value can be read from within a JSP using the <code>"pageInput"</code> databinding context.
@deprecated Use {@link #addActionOutput} instead.
@param name the name of the action output.
@param value the value of the action output.
@param request the current ServletRequest.
"""
addActionOutput( name, value, request );
} | java | public static void addPageInput( String name, Object value, ServletRequest request )
{
addActionOutput( name, value, request );
} | [
"public",
"static",
"void",
"addPageInput",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"ServletRequest",
"request",
")",
"{",
"addActionOutput",
"(",
"name",
",",
"value",
",",
"request",
")",
";",
"}"
] | Set a named action output, which corresponds to an input declared by the <code>pageInput</code> JSP tag.
The actual value can be read from within a JSP using the <code>"pageInput"</code> databinding context.
@deprecated Use {@link #addActionOutput} instead.
@param name the name of the action output.
@param value the value of the action output.
@param request the current ServletRequest. | [
"Set",
"a",
"named",
"action",
"output",
"which",
"corresponds",
"to",
"an",
"input",
"declared",
"by",
"the",
"<code",
">",
"pageInput<",
"/",
"code",
">",
"JSP",
"tag",
".",
"The",
"actual",
"value",
"can",
"be",
"read",
"from",
"within",
"a",
"JSP",
"using",
"the",
"<code",
">",
"pageInput",
"<",
"/",
"code",
">",
"databinding",
"context",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L921-L924 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java | RestClientUtil.mgetDocuments | public <T> List<T> mgetDocuments(String index, Class<T> type, Object... ids) throws ElasticSearchException {
"""
For Elasticsearch 7 and 7+
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
@param index _mget
test/_mget
test/type/_mget
test/type/_mget?stored_fields=field1,field2
_mget?routing=key1
@param type
@param ids
@param <T>
@return
@throws ElasticSearchException
"""
return mgetDocuments( index, _doc,type, ids);
} | java | public <T> List<T> mgetDocuments(String index, Class<T> type, Object... ids) throws ElasticSearchException{
return mgetDocuments( index, _doc,type, ids);
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"mgetDocuments",
"(",
"String",
"index",
",",
"Class",
"<",
"T",
">",
"type",
",",
"Object",
"...",
"ids",
")",
"throws",
"ElasticSearchException",
"{",
"return",
"mgetDocuments",
"(",
"index",
",",
"_doc",
",",
"type",
",",
"ids",
")",
";",
"}"
] | For Elasticsearch 7 and 7+
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
@param index _mget
test/_mget
test/type/_mget
test/type/_mget?stored_fields=field1,field2
_mget?routing=key1
@param type
@param ids
@param <T>
@return
@throws ElasticSearchException | [
"For",
"Elasticsearch",
"7",
"and",
"7",
"+",
"https",
":",
"//",
"www",
".",
"elastic",
".",
"co",
"/",
"guide",
"/",
"en",
"/",
"elasticsearch",
"/",
"reference",
"/",
"current",
"/",
"docs",
"-",
"multi",
"-",
"get",
".",
"html"
] | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L5085-L5087 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/html/Table.java | Table.addCell | public Table addCell(Object o, String attributes) {
"""
/* Add a new Cell in the current row.
Adds to the table after this call and before next call to newRow,
newCell or newHeader are added to the cell.
@return This table for call chaining
"""
addCell(o);
cell.attribute(attributes);
return this;
} | java | public Table addCell(Object o, String attributes)
{
addCell(o);
cell.attribute(attributes);
return this;
} | [
"public",
"Table",
"addCell",
"(",
"Object",
"o",
",",
"String",
"attributes",
")",
"{",
"addCell",
"(",
"o",
")",
";",
"cell",
".",
"attribute",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | /* Add a new Cell in the current row.
Adds to the table after this call and before next call to newRow,
newCell or newHeader are added to the cell.
@return This table for call chaining | [
"/",
"*",
"Add",
"a",
"new",
"Cell",
"in",
"the",
"current",
"row",
".",
"Adds",
"to",
"the",
"table",
"after",
"this",
"call",
"and",
"before",
"next",
"call",
"to",
"newRow",
"newCell",
"or",
"newHeader",
"are",
"added",
"to",
"the",
"cell",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/Table.java#L171-L176 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/model/loader/ObjFileImporter.java | ObjFileImporter.addVertex | private void addVertex(String data) {
"""
Creates a new {@link Vertex} from data and adds it to {@link #vertexes}.
@param data the data
"""
String coords[] = data.split("\\s+");
float x = 0;
float y = 0;
float z = 0;
if (coords.length != 3)
{
MalisisCore.log.error("[ObjFileImporter] Wrong coordinates number {} at line {} : {}", coords.length, lineNumber, currentLine);
}
else
{
x = Float.parseFloat(coords[0]);
y = Float.parseFloat(coords[1]);
z = Float.parseFloat(coords[2]);
}
vertexes.add(new Vertex(x, y, z));
} | java | private void addVertex(String data)
{
String coords[] = data.split("\\s+");
float x = 0;
float y = 0;
float z = 0;
if (coords.length != 3)
{
MalisisCore.log.error("[ObjFileImporter] Wrong coordinates number {} at line {} : {}", coords.length, lineNumber, currentLine);
}
else
{
x = Float.parseFloat(coords[0]);
y = Float.parseFloat(coords[1]);
z = Float.parseFloat(coords[2]);
}
vertexes.add(new Vertex(x, y, z));
} | [
"private",
"void",
"addVertex",
"(",
"String",
"data",
")",
"{",
"String",
"coords",
"[",
"]",
"=",
"data",
".",
"split",
"(",
"\"\\\\s+\"",
")",
";",
"float",
"x",
"=",
"0",
";",
"float",
"y",
"=",
"0",
";",
"float",
"z",
"=",
"0",
";",
"if",
"(",
"coords",
".",
"length",
"!=",
"3",
")",
"{",
"MalisisCore",
".",
"log",
".",
"error",
"(",
"\"[ObjFileImporter] Wrong coordinates number {} at line {} : {}\"",
",",
"coords",
".",
"length",
",",
"lineNumber",
",",
"currentLine",
")",
";",
"}",
"else",
"{",
"x",
"=",
"Float",
".",
"parseFloat",
"(",
"coords",
"[",
"0",
"]",
")",
";",
"y",
"=",
"Float",
".",
"parseFloat",
"(",
"coords",
"[",
"1",
"]",
")",
";",
"z",
"=",
"Float",
".",
"parseFloat",
"(",
"coords",
"[",
"2",
"]",
")",
";",
"}",
"vertexes",
".",
"add",
"(",
"new",
"Vertex",
"(",
"x",
",",
"y",
",",
"z",
")",
")",
";",
"}"
] | Creates a new {@link Vertex} from data and adds it to {@link #vertexes}.
@param data the data | [
"Creates",
"a",
"new",
"{",
"@link",
"Vertex",
"}",
"from",
"data",
"and",
"adds",
"it",
"to",
"{",
"@link",
"#vertexes",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/model/loader/ObjFileImporter.java#L206-L224 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java | SyncMembersInner.createOrUpdate | public SyncMemberInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) {
"""
Creates or updates a sync member.
@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 serverName The name of the server.
@param databaseName The name of the database on which the sync group is hosted.
@param syncGroupName The name of the sync group on which the sync member is hosted.
@param syncMemberName The name of the sync member.
@param parameters The requested sync member resource state.
@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 SyncMemberInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().last().body();
} | java | public SyncMemberInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().last().body();
} | [
"public",
"SyncMemberInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"syncGroupName",
",",
"String",
"syncMemberName",
",",
"SyncMemberInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseName",
",",
"syncGroupName",
",",
"syncMemberName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates a sync member.
@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 serverName The name of the server.
@param databaseName The name of the database on which the sync group is hosted.
@param syncGroupName The name of the sync group on which the sync member is hosted.
@param syncMemberName The name of the sync member.
@param parameters The requested sync member resource state.
@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 SyncMemberInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"sync",
"member",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L241-L243 |
skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java | LargestAreaFitFirstPackager.isBetter3D | protected int isBetter3D(Box a, Box b, Space space) {
"""
Is box b strictly better than a?
@param a box
@param b box
@param space free space
@return -1 if b is better, 0 if equal, 1 if b is better
"""
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
// determine lowest fit
a.fitRotate3DSmallestFootprint(space);
b.fitRotate3DSmallestFootprint(space);
return Long.compare(b.getFootprint(), a.getFootprint()); // i.e. smaller i better
} | java | protected int isBetter3D(Box a, Box b, Space space) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
// determine lowest fit
a.fitRotate3DSmallestFootprint(space);
b.fitRotate3DSmallestFootprint(space);
return Long.compare(b.getFootprint(), a.getFootprint()); // i.e. smaller i better
} | [
"protected",
"int",
"isBetter3D",
"(",
"Box",
"a",
",",
"Box",
"b",
",",
"Space",
"space",
")",
"{",
"int",
"compare",
"=",
"Long",
".",
"compare",
"(",
"a",
".",
"getVolume",
"(",
")",
",",
"b",
".",
"getVolume",
"(",
")",
")",
";",
"if",
"(",
"compare",
"!=",
"0",
")",
"{",
"return",
"compare",
";",
"}",
"// determine lowest fit",
"a",
".",
"fitRotate3DSmallestFootprint",
"(",
"space",
")",
";",
"b",
".",
"fitRotate3DSmallestFootprint",
"(",
"space",
")",
";",
"return",
"Long",
".",
"compare",
"(",
"b",
".",
"getFootprint",
"(",
")",
",",
"a",
".",
"getFootprint",
"(",
")",
")",
";",
"// i.e. smaller i better",
"}"
] | Is box b strictly better than a?
@param a box
@param b box
@param space free space
@return -1 if b is better, 0 if equal, 1 if b is better | [
"Is",
"box",
"b",
"strictly",
"better",
"than",
"a?"
] | train | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java#L450-L460 |
Polidea/RxAndroidBle | rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/connection/ThrowingIllegalOperationHandler.java | ThrowingIllegalOperationHandler.handleMismatchData | @Override
public BleIllegalOperationException handleMismatchData(BluetoothGattCharacteristic characteristic, int neededProperties) {
"""
This method logs an error and returns a {@link BleIllegalOperationException}.
@param characteristic the characteristic upon which the operation was requested
@param neededProperties bitmask of properties needed by the operation
"""
String message = messageCreator.createMismatchMessage(characteristic, neededProperties);
return new BleIllegalOperationException(message,
characteristic.getUuid(),
characteristic.getProperties(),
neededProperties);
} | java | @Override
public BleIllegalOperationException handleMismatchData(BluetoothGattCharacteristic characteristic, int neededProperties) {
String message = messageCreator.createMismatchMessage(characteristic, neededProperties);
return new BleIllegalOperationException(message,
characteristic.getUuid(),
characteristic.getProperties(),
neededProperties);
} | [
"@",
"Override",
"public",
"BleIllegalOperationException",
"handleMismatchData",
"(",
"BluetoothGattCharacteristic",
"characteristic",
",",
"int",
"neededProperties",
")",
"{",
"String",
"message",
"=",
"messageCreator",
".",
"createMismatchMessage",
"(",
"characteristic",
",",
"neededProperties",
")",
";",
"return",
"new",
"BleIllegalOperationException",
"(",
"message",
",",
"characteristic",
".",
"getUuid",
"(",
")",
",",
"characteristic",
".",
"getProperties",
"(",
")",
",",
"neededProperties",
")",
";",
"}"
] | This method logs an error and returns a {@link BleIllegalOperationException}.
@param characteristic the characteristic upon which the operation was requested
@param neededProperties bitmask of properties needed by the operation | [
"This",
"method",
"logs",
"an",
"error",
"and",
"returns",
"a",
"{"
] | train | https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/internal/connection/ThrowingIllegalOperationHandler.java#L25-L32 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.writeProject | public void writeProject(CmsDbContext dbc, CmsProject project) throws CmsException {
"""
Writes an already existing project.<p>
The project id has to be a valid OpenCms project id.<br>
The project with the given id will be completely overridden
by the given data.<p>
@param dbc the current database context
@param project the project that should be written
@throws CmsException if operation was not successful
"""
m_monitor.uncacheProject(project);
getProjectDriver(dbc).writeProject(dbc, project);
m_monitor.cacheProject(project);
} | java | public void writeProject(CmsDbContext dbc, CmsProject project) throws CmsException {
m_monitor.uncacheProject(project);
getProjectDriver(dbc).writeProject(dbc, project);
m_monitor.cacheProject(project);
} | [
"public",
"void",
"writeProject",
"(",
"CmsDbContext",
"dbc",
",",
"CmsProject",
"project",
")",
"throws",
"CmsException",
"{",
"m_monitor",
".",
"uncacheProject",
"(",
"project",
")",
";",
"getProjectDriver",
"(",
"dbc",
")",
".",
"writeProject",
"(",
"dbc",
",",
"project",
")",
";",
"m_monitor",
".",
"cacheProject",
"(",
"project",
")",
";",
"}"
] | Writes an already existing project.<p>
The project id has to be a valid OpenCms project id.<br>
The project with the given id will be completely overridden
by the given data.<p>
@param dbc the current database context
@param project the project that should be written
@throws CmsException if operation was not successful | [
"Writes",
"an",
"already",
"existing",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L9945-L9950 |
HiddenStage/divide | Client/java-client/src/main/java/io/divide/client/BackendUser.java | BackendUser.signIn | public static SignInResponse signIn(String email, String password) {
"""
Perform syncronously login attempt.
@param email user email address
@param password user password
@return login results.
"""
return signIn(new LoginCredentials(email,password));
} | java | public static SignInResponse signIn(String email, String password){
return signIn(new LoginCredentials(email,password));
} | [
"public",
"static",
"SignInResponse",
"signIn",
"(",
"String",
"email",
",",
"String",
"password",
")",
"{",
"return",
"signIn",
"(",
"new",
"LoginCredentials",
"(",
"email",
",",
"password",
")",
")",
";",
"}"
] | Perform syncronously login attempt.
@param email user email address
@param password user password
@return login results. | [
"Perform",
"syncronously",
"login",
"attempt",
"."
] | train | https://github.com/HiddenStage/divide/blob/14e36598c50d92b4393e6649915e32b86141c598/Client/java-client/src/main/java/io/divide/client/BackendUser.java#L152-L154 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java | MSPDIReader.readAssignmentExtendedAttributes | private void readAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx) {
"""
This method processes any extended attributes associated with a
resource assignment.
@param xml MSPDI resource assignment instance
@param mpx MPX task instance
"""
for (Project.Assignments.Assignment.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
AssignmentField mpxFieldID = MPPAssignmentField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);
}
} | java | private void readAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx)
{
for (Project.Assignments.Assignment.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
AssignmentField mpxFieldID = MPPAssignmentField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);
}
} | [
"private",
"void",
"readAssignmentExtendedAttributes",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
"xml",
",",
"ResourceAssignment",
"mpx",
")",
"{",
"for",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
".",
"ExtendedAttribute",
"attrib",
":",
"xml",
".",
"getExtendedAttribute",
"(",
")",
")",
"{",
"int",
"xmlFieldID",
"=",
"Integer",
".",
"parseInt",
"(",
"attrib",
".",
"getFieldID",
"(",
")",
")",
"&",
"0x0000FFFF",
";",
"AssignmentField",
"mpxFieldID",
"=",
"MPPAssignmentField",
".",
"getInstance",
"(",
"xmlFieldID",
")",
";",
"TimeUnit",
"durationFormat",
"=",
"DatatypeConverter",
".",
"parseDurationTimeUnits",
"(",
"attrib",
".",
"getDurationFormat",
"(",
")",
",",
"null",
")",
";",
"DatatypeConverter",
".",
"parseExtendedAttribute",
"(",
"m_projectFile",
",",
"mpx",
",",
"attrib",
".",
"getValue",
"(",
")",
",",
"mpxFieldID",
",",
"durationFormat",
")",
";",
"}",
"}"
] | This method processes any extended attributes associated with a
resource assignment.
@param xml MSPDI resource assignment instance
@param mpx MPX task instance | [
"This",
"method",
"processes",
"any",
"extended",
"attributes",
"associated",
"with",
"a",
"resource",
"assignment",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1721-L1730 |
brianwhu/xillium | base/src/main/java/org/xillium/base/Singleton.java | Singleton.get | public T get(Factory<T> factory, Object... args) throws Exception {
"""
Retrieves the singleton object, creating it by calling a provider if it is not created yet. This method uses
double-checked locking to ensure that only one instance will ever be created, while keeping retrieval cost at
minimum.
@see <a href="http://en.wikipedia.org/wiki/Double-checked_locking">Double-checked locking</a>
@param factory a {@link org.xillium.base.Factory Factory} that can be called to create a new value with more than 1 arguments
@param args the arguments to pass to the factory
@return the singleton object
@throws Exception if the factory fails to create a new value
"""
T result = _value;
if (isMissing(result)) synchronized(this) {
result = _value;
if (isMissing(result)) {
_value = result = factory.make(args);
}
}
return result;
} | java | public T get(Factory<T> factory, Object... args) throws Exception {
T result = _value;
if (isMissing(result)) synchronized(this) {
result = _value;
if (isMissing(result)) {
_value = result = factory.make(args);
}
}
return result;
} | [
"public",
"T",
"get",
"(",
"Factory",
"<",
"T",
">",
"factory",
",",
"Object",
"...",
"args",
")",
"throws",
"Exception",
"{",
"T",
"result",
"=",
"_value",
";",
"if",
"(",
"isMissing",
"(",
"result",
")",
")",
"synchronized",
"(",
"this",
")",
"{",
"result",
"=",
"_value",
";",
"if",
"(",
"isMissing",
"(",
"result",
")",
")",
"{",
"_value",
"=",
"result",
"=",
"factory",
".",
"make",
"(",
"args",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Retrieves the singleton object, creating it by calling a provider if it is not created yet. This method uses
double-checked locking to ensure that only one instance will ever be created, while keeping retrieval cost at
minimum.
@see <a href="http://en.wikipedia.org/wiki/Double-checked_locking">Double-checked locking</a>
@param factory a {@link org.xillium.base.Factory Factory} that can be called to create a new value with more than 1 arguments
@param args the arguments to pass to the factory
@return the singleton object
@throws Exception if the factory fails to create a new value | [
"Retrieves",
"the",
"singleton",
"object",
"creating",
"it",
"by",
"calling",
"a",
"provider",
"if",
"it",
"is",
"not",
"created",
"yet",
".",
"This",
"method",
"uses",
"double",
"-",
"checked",
"locking",
"to",
"ensure",
"that",
"only",
"one",
"instance",
"will",
"ever",
"be",
"created",
"while",
"keeping",
"retrieval",
"cost",
"at",
"minimum",
"."
] | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/Singleton.java#L82-L91 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.globPathsLevel | private Path[] globPathsLevel(Path[] parents, String[] filePattern,
int level, boolean[] hasGlob) throws IOException {
"""
/*
For a path of N components, return a list of paths that match the
components [<code>level</code>, <code>N-1</code>].
"""
if (level == filePattern.length - 1)
return parents;
if (parents == null || parents.length == 0) {
return null;
}
GlobFilter fp = new GlobFilter(filePattern[level]);
if (fp.hasPattern()) {
parents = FileUtil.stat2Paths(listStatus(parents, fp));
hasGlob[0] = true;
} else {
for (int i = 0; i < parents.length; i++) {
parents[i] = new Path(parents[i], filePattern[level]);
}
}
return globPathsLevel(parents, filePattern, level + 1, hasGlob);
} | java | private Path[] globPathsLevel(Path[] parents, String[] filePattern,
int level, boolean[] hasGlob) throws IOException {
if (level == filePattern.length - 1)
return parents;
if (parents == null || parents.length == 0) {
return null;
}
GlobFilter fp = new GlobFilter(filePattern[level]);
if (fp.hasPattern()) {
parents = FileUtil.stat2Paths(listStatus(parents, fp));
hasGlob[0] = true;
} else {
for (int i = 0; i < parents.length; i++) {
parents[i] = new Path(parents[i], filePattern[level]);
}
}
return globPathsLevel(parents, filePattern, level + 1, hasGlob);
} | [
"private",
"Path",
"[",
"]",
"globPathsLevel",
"(",
"Path",
"[",
"]",
"parents",
",",
"String",
"[",
"]",
"filePattern",
",",
"int",
"level",
",",
"boolean",
"[",
"]",
"hasGlob",
")",
"throws",
"IOException",
"{",
"if",
"(",
"level",
"==",
"filePattern",
".",
"length",
"-",
"1",
")",
"return",
"parents",
";",
"if",
"(",
"parents",
"==",
"null",
"||",
"parents",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"GlobFilter",
"fp",
"=",
"new",
"GlobFilter",
"(",
"filePattern",
"[",
"level",
"]",
")",
";",
"if",
"(",
"fp",
".",
"hasPattern",
"(",
")",
")",
"{",
"parents",
"=",
"FileUtil",
".",
"stat2Paths",
"(",
"listStatus",
"(",
"parents",
",",
"fp",
")",
")",
";",
"hasGlob",
"[",
"0",
"]",
"=",
"true",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parents",
".",
"length",
";",
"i",
"++",
")",
"{",
"parents",
"[",
"i",
"]",
"=",
"new",
"Path",
"(",
"parents",
"[",
"i",
"]",
",",
"filePattern",
"[",
"level",
"]",
")",
";",
"}",
"}",
"return",
"globPathsLevel",
"(",
"parents",
",",
"filePattern",
",",
"level",
"+",
"1",
",",
"hasGlob",
")",
";",
"}"
] | /*
For a path of N components, return a list of paths that match the
components [<code>level</code>, <code>N-1</code>]. | [
"/",
"*",
"For",
"a",
"path",
"of",
"N",
"components",
"return",
"a",
"list",
"of",
"paths",
"that",
"match",
"the",
"components",
"[",
"<code",
">",
"level<",
"/",
"code",
">",
"<code",
">",
"N",
"-",
"1<",
"/",
"code",
">",
"]",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1422-L1439 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/DisparityScoreRowFormat.java | DisparityScoreRowFormat.process | public void process( Input left , Input right , Disparity disparity ) {
"""
Computes disparity between two stereo images
@param left Left rectified stereo image. Input
@param right Right rectified stereo image. Input
@param disparity Disparity between the two images. Output
"""
// initialize data structures
InputSanityCheck.checkSameShape(left, right, disparity);
if( maxDisparity > left.width-2*radiusX )
throw new RuntimeException(
"The maximum disparity is too large for this image size: max size "+(left.width-2*radiusX));
lengthHorizontal = left.width*rangeDisparity;
_process(left,right,disparity);
} | java | public void process( Input left , Input right , Disparity disparity ) {
// initialize data structures
InputSanityCheck.checkSameShape(left, right, disparity);
if( maxDisparity > left.width-2*radiusX )
throw new RuntimeException(
"The maximum disparity is too large for this image size: max size "+(left.width-2*radiusX));
lengthHorizontal = left.width*rangeDisparity;
_process(left,right,disparity);
} | [
"public",
"void",
"process",
"(",
"Input",
"left",
",",
"Input",
"right",
",",
"Disparity",
"disparity",
")",
"{",
"// initialize data structures",
"InputSanityCheck",
".",
"checkSameShape",
"(",
"left",
",",
"right",
",",
"disparity",
")",
";",
"if",
"(",
"maxDisparity",
">",
"left",
".",
"width",
"-",
"2",
"*",
"radiusX",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"The maximum disparity is too large for this image size: max size \"",
"+",
"(",
"left",
".",
"width",
"-",
"2",
"*",
"radiusX",
")",
")",
";",
"lengthHorizontal",
"=",
"left",
".",
"width",
"*",
"rangeDisparity",
";",
"_process",
"(",
"left",
",",
"right",
",",
"disparity",
")",
";",
"}"
] | Computes disparity between two stereo images
@param left Left rectified stereo image. Input
@param right Right rectified stereo image. Input
@param disparity Disparity between the two images. Output | [
"Computes",
"disparity",
"between",
"two",
"stereo",
"images"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/DisparityScoreRowFormat.java#L92-L103 |
itfsw/QueryBuilder | src/main/java/com/itfsw/query/builder/support/utils/spring/Assert.java | Assert.notEmpty | public static void notEmpty(Map<?, ?> map, String message) {
"""
Assert that a Map contains entries; that is, it must not be {@code null}
and must contain at least one entry.
<pre class="code">Assert.notEmpty(map, "Map must contain entries");</pre>
@param map the map to check
@param message the exception message to use if the assertion fails
@throws IllegalArgumentException if the map is {@code null} or contains no entries
"""
if (CollectionUtils.isEmpty(map)) {
throw new IllegalArgumentException(message);
}
} | java | public static void notEmpty(Map<?, ?> map, String message) {
if (CollectionUtils.isEmpty(map)) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"String",
"message",
")",
"{",
"if",
"(",
"CollectionUtils",
".",
"isEmpty",
"(",
"map",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"}"
] | Assert that a Map contains entries; that is, it must not be {@code null}
and must contain at least one entry.
<pre class="code">Assert.notEmpty(map, "Map must contain entries");</pre>
@param map the map to check
@param message the exception message to use if the assertion fails
@throws IllegalArgumentException if the map is {@code null} or contains no entries | [
"Assert",
"that",
"a",
"Map",
"contains",
"entries",
";",
"that",
"is",
"it",
"must",
"not",
"be",
"{"
] | train | https://github.com/itfsw/QueryBuilder/blob/231dc9a334d54cf98755cfcb236202201ddee162/src/main/java/com/itfsw/query/builder/support/utils/spring/Assert.java#L298-L302 |
iipc/webarchive-commons | src/main/java/org/archive/util/Recorder.java | Recorder.wrapInputStreamWithHttpRecord | public static Recorder wrapInputStreamWithHttpRecord(File dir,
String basename, InputStream in, String encoding)
throws IOException {
"""
Record the input stream for later playback by an extractor, etc.
This is convenience method used to setup an artificial HttpRecorder
scenario used in unit tests, etc.
@param dir Directory to write backing file to.
@param basename of what we're recording.
@param in Stream to read.
@param encoding Stream encoding.
@throws IOException
@return An {@link org.archive.util.Recorder}.
"""
Recorder rec = new Recorder(dir, basename);
if (encoding != null && encoding.length() > 0) {
rec.setCharset(Charset.forName(encoding));
}
// Do not use FastBufferedInputStream here. It does not
// support mark.
InputStream is = rec.inputWrap(new BufferedInputStream(in));
final int BUFFER_SIZE = 1024 * 4;
byte [] buffer = new byte[BUFFER_SIZE];
while(true) {
// Just read it all down.
int x = is.read(buffer);
if (x == -1) {
break;
}
}
is.close();
return rec;
} | java | public static Recorder wrapInputStreamWithHttpRecord(File dir,
String basename, InputStream in, String encoding)
throws IOException {
Recorder rec = new Recorder(dir, basename);
if (encoding != null && encoding.length() > 0) {
rec.setCharset(Charset.forName(encoding));
}
// Do not use FastBufferedInputStream here. It does not
// support mark.
InputStream is = rec.inputWrap(new BufferedInputStream(in));
final int BUFFER_SIZE = 1024 * 4;
byte [] buffer = new byte[BUFFER_SIZE];
while(true) {
// Just read it all down.
int x = is.read(buffer);
if (x == -1) {
break;
}
}
is.close();
return rec;
} | [
"public",
"static",
"Recorder",
"wrapInputStreamWithHttpRecord",
"(",
"File",
"dir",
",",
"String",
"basename",
",",
"InputStream",
"in",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"Recorder",
"rec",
"=",
"new",
"Recorder",
"(",
"dir",
",",
"basename",
")",
";",
"if",
"(",
"encoding",
"!=",
"null",
"&&",
"encoding",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"rec",
".",
"setCharset",
"(",
"Charset",
".",
"forName",
"(",
"encoding",
")",
")",
";",
"}",
"// Do not use FastBufferedInputStream here. It does not",
"// support mark.",
"InputStream",
"is",
"=",
"rec",
".",
"inputWrap",
"(",
"new",
"BufferedInputStream",
"(",
"in",
")",
")",
";",
"final",
"int",
"BUFFER_SIZE",
"=",
"1024",
"*",
"4",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
";",
"while",
"(",
"true",
")",
"{",
"// Just read it all down.",
"int",
"x",
"=",
"is",
".",
"read",
"(",
"buffer",
")",
";",
"if",
"(",
"x",
"==",
"-",
"1",
")",
"{",
"break",
";",
"}",
"}",
"is",
".",
"close",
"(",
")",
";",
"return",
"rec",
";",
"}"
] | Record the input stream for later playback by an extractor, etc.
This is convenience method used to setup an artificial HttpRecorder
scenario used in unit tests, etc.
@param dir Directory to write backing file to.
@param basename of what we're recording.
@param in Stream to read.
@param encoding Stream encoding.
@throws IOException
@return An {@link org.archive.util.Recorder}. | [
"Record",
"the",
"input",
"stream",
"for",
"later",
"playback",
"by",
"an",
"extractor",
"etc",
".",
"This",
"is",
"convenience",
"method",
"used",
"to",
"setup",
"an",
"artificial",
"HttpRecorder",
"scenario",
"used",
"in",
"unit",
"tests",
"etc",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/Recorder.java#L554-L575 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java | ScriptRequestState.mapLegacyTagId | public String mapLegacyTagId(IScriptReporter scriptReporter, String tagId, String value) {
"""
This method will add a tagId and value to the ScriptRepoter TagId map.
The a ScriptContainer tag will create a JavaScript table that allows
the container, such as a portal, to rewrite the id so it's unique.
The real name may be looked up based upon the tagId.
If the no ScriptReporter is found, a script string will be returned
to the caller so they can output the script block.
@param tagId
@param value
@return String
"""
if (scriptReporter != null) {
scriptReporter.addLegacyTagIdMappings(tagId, value);
return null;
}
// without a scripRepoter we need to create the actual JavaScript that will be written out
InternalStringBuilder sb = new InternalStringBuilder(64);
StringBuilderRenderAppender writer = new StringBuilderRenderAppender(sb);
getTagIdMapping(tagId, value, writer);
return sb.toString();
} | java | public String mapLegacyTagId(IScriptReporter scriptReporter, String tagId, String value)
{
if (scriptReporter != null) {
scriptReporter.addLegacyTagIdMappings(tagId, value);
return null;
}
// without a scripRepoter we need to create the actual JavaScript that will be written out
InternalStringBuilder sb = new InternalStringBuilder(64);
StringBuilderRenderAppender writer = new StringBuilderRenderAppender(sb);
getTagIdMapping(tagId, value, writer);
return sb.toString();
} | [
"public",
"String",
"mapLegacyTagId",
"(",
"IScriptReporter",
"scriptReporter",
",",
"String",
"tagId",
",",
"String",
"value",
")",
"{",
"if",
"(",
"scriptReporter",
"!=",
"null",
")",
"{",
"scriptReporter",
".",
"addLegacyTagIdMappings",
"(",
"tagId",
",",
"value",
")",
";",
"return",
"null",
";",
"}",
"// without a scripRepoter we need to create the actual JavaScript that will be written out",
"InternalStringBuilder",
"sb",
"=",
"new",
"InternalStringBuilder",
"(",
"64",
")",
";",
"StringBuilderRenderAppender",
"writer",
"=",
"new",
"StringBuilderRenderAppender",
"(",
"sb",
")",
";",
"getTagIdMapping",
"(",
"tagId",
",",
"value",
",",
"writer",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | This method will add a tagId and value to the ScriptRepoter TagId map.
The a ScriptContainer tag will create a JavaScript table that allows
the container, such as a portal, to rewrite the id so it's unique.
The real name may be looked up based upon the tagId.
If the no ScriptReporter is found, a script string will be returned
to the caller so they can output the script block.
@param tagId
@param value
@return String | [
"This",
"method",
"will",
"add",
"a",
"tagId",
"and",
"value",
"to",
"the",
"ScriptRepoter",
"TagId",
"map",
".",
"The",
"a",
"ScriptContainer",
"tag",
"will",
"create",
"a",
"JavaScript",
"table",
"that",
"allows",
"the",
"container",
"such",
"as",
"a",
"portal",
"to",
"rewrite",
"the",
"id",
"so",
"it",
"s",
"unique",
".",
"The",
"real",
"name",
"may",
"be",
"looked",
"up",
"based",
"upon",
"the",
"tagId",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java#L192-L204 |
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.getLogs | public LogStreamResponse getLogs(String appName, Boolean tail) {
"""
Get logs for an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@return log stream response
"""
return connection.execute(new Log(appName, tail), apiKey);
} | java | public LogStreamResponse getLogs(String appName, Boolean tail) {
return connection.execute(new Log(appName, tail), apiKey);
} | [
"public",
"LogStreamResponse",
"getLogs",
"(",
"String",
"appName",
",",
"Boolean",
"tail",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"Log",
"(",
"appName",
",",
"tail",
")",
",",
"apiKey",
")",
";",
"}"
] | Get logs for an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@return log stream response | [
"Get",
"logs",
"for",
"an",
"app",
"."
] | train | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L365-L367 |
playn/playn | core/src/playn/core/json/JsonParser.java | JsonParser.createParseException | private JsonParserException createParseException(Exception e, String message, boolean tokenPos) {
"""
Creates a {@link JsonParserException} and fills it from the current line and char position.
"""
if (tokenPos)
return new JsonParserException(e, message + " on line " + tokenLinePos + ", char " + tokenCharPos,
tokenLinePos, tokenCharPos, tokenCharOffset);
else {
int charPos = Math.max(1, index - rowPos - utf8adjust);
return new JsonParserException(e, message + " on line " + linePos + ", char " + charPos, linePos, charPos,
index + charOffset);
}
} | java | private JsonParserException createParseException(Exception e, String message, boolean tokenPos) {
if (tokenPos)
return new JsonParserException(e, message + " on line " + tokenLinePos + ", char " + tokenCharPos,
tokenLinePos, tokenCharPos, tokenCharOffset);
else {
int charPos = Math.max(1, index - rowPos - utf8adjust);
return new JsonParserException(e, message + " on line " + linePos + ", char " + charPos, linePos, charPos,
index + charOffset);
}
} | [
"private",
"JsonParserException",
"createParseException",
"(",
"Exception",
"e",
",",
"String",
"message",
",",
"boolean",
"tokenPos",
")",
"{",
"if",
"(",
"tokenPos",
")",
"return",
"new",
"JsonParserException",
"(",
"e",
",",
"message",
"+",
"\" on line \"",
"+",
"tokenLinePos",
"+",
"\", char \"",
"+",
"tokenCharPos",
",",
"tokenLinePos",
",",
"tokenCharPos",
",",
"tokenCharOffset",
")",
";",
"else",
"{",
"int",
"charPos",
"=",
"Math",
".",
"max",
"(",
"1",
",",
"index",
"-",
"rowPos",
"-",
"utf8adjust",
")",
";",
"return",
"new",
"JsonParserException",
"(",
"e",
",",
"message",
"+",
"\" on line \"",
"+",
"linePos",
"+",
"\", char \"",
"+",
"charPos",
",",
"linePos",
",",
"charPos",
",",
"index",
"+",
"charOffset",
")",
";",
"}",
"}"
] | Creates a {@link JsonParserException} and fills it from the current line and char position. | [
"Creates",
"a",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L462-L471 |
xwiki/xwiki-rendering | xwiki-rendering-macros/xwiki-rendering-macro-ctsreport/src/main/java/org/xwiki/rendering/internal/macro/ctsreport/ResultExtractor.java | ResultExtractor.normalize | public void normalize(Set<String> testNames, Map<String, Pair<Set<Test>, Set<Test>>> tests) {
"""
Add not applicable tests for all syntaxes.
@param testNames the test names (eg "simple/bold/bold1")
@param tests the tests by syntaxes
"""
for (Pair<Set<Test>, Set<Test>> inOutTests : tests.values()) {
addNotApplicableTests(testNames, inOutTests.getLeft());
addNotApplicableTests(testNames, inOutTests.getRight());
}
} | java | public void normalize(Set<String> testNames, Map<String, Pair<Set<Test>, Set<Test>>> tests)
{
for (Pair<Set<Test>, Set<Test>> inOutTests : tests.values()) {
addNotApplicableTests(testNames, inOutTests.getLeft());
addNotApplicableTests(testNames, inOutTests.getRight());
}
} | [
"public",
"void",
"normalize",
"(",
"Set",
"<",
"String",
">",
"testNames",
",",
"Map",
"<",
"String",
",",
"Pair",
"<",
"Set",
"<",
"Test",
">",
",",
"Set",
"<",
"Test",
">",
">",
">",
"tests",
")",
"{",
"for",
"(",
"Pair",
"<",
"Set",
"<",
"Test",
">",
",",
"Set",
"<",
"Test",
">",
">",
"inOutTests",
":",
"tests",
".",
"values",
"(",
")",
")",
"{",
"addNotApplicableTests",
"(",
"testNames",
",",
"inOutTests",
".",
"getLeft",
"(",
")",
")",
";",
"addNotApplicableTests",
"(",
"testNames",
",",
"inOutTests",
".",
"getRight",
"(",
")",
")",
";",
"}",
"}"
] | Add not applicable tests for all syntaxes.
@param testNames the test names (eg "simple/bold/bold1")
@param tests the tests by syntaxes | [
"Add",
"not",
"applicable",
"tests",
"for",
"all",
"syntaxes",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-macros/xwiki-rendering-macro-ctsreport/src/main/java/org/xwiki/rendering/internal/macro/ctsreport/ResultExtractor.java#L95-L101 |
lotaris/rox-client-java | rox-client-java/src/main/java/com/lotaris/rox/core/filters/FilterUtils.java | FilterUtils.isRunnable | private static boolean isRunnable(FilterTargetData targetData, String[] filters) {
"""
Define if a test is runnable based on the object that represents the test
meta data
@param targetData The meta data
@param filters The filters
@return True if the test can be run
"""
if (filters == null || filters.length == 0) {
return true;
}
for (String filter : filters) {
String[] filterSplitted = filter.split(":");
// We must evaluate all the filters and return only when there is a valid match
if (
(filterSplitted.length == 1 && targetData.anyMatch(filterSplitted[0])) || // Any filter
("key".equalsIgnoreCase(filterSplitted[0]) && targetData.keyMatch(filterSplitted[1])) || // Key filter
("name".equalsIgnoreCase(filterSplitted[0]) && targetData.nameMatch(filterSplitted[1])) || // Name filter
("tag".equalsIgnoreCase(filterSplitted[0]) && targetData.tagMatch(filterSplitted[1])) || // Tag filter
("ticket".equalsIgnoreCase(filterSplitted[0]) && targetData.ticketMatch(filterSplitted[1])) // Ticket filter
) {
return true;
}
}
return false;
} | java | private static boolean isRunnable(FilterTargetData targetData, String[] filters) {
if (filters == null || filters.length == 0) {
return true;
}
for (String filter : filters) {
String[] filterSplitted = filter.split(":");
// We must evaluate all the filters and return only when there is a valid match
if (
(filterSplitted.length == 1 && targetData.anyMatch(filterSplitted[0])) || // Any filter
("key".equalsIgnoreCase(filterSplitted[0]) && targetData.keyMatch(filterSplitted[1])) || // Key filter
("name".equalsIgnoreCase(filterSplitted[0]) && targetData.nameMatch(filterSplitted[1])) || // Name filter
("tag".equalsIgnoreCase(filterSplitted[0]) && targetData.tagMatch(filterSplitted[1])) || // Tag filter
("ticket".equalsIgnoreCase(filterSplitted[0]) && targetData.ticketMatch(filterSplitted[1])) // Ticket filter
) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"isRunnable",
"(",
"FilterTargetData",
"targetData",
",",
"String",
"[",
"]",
"filters",
")",
"{",
"if",
"(",
"filters",
"==",
"null",
"||",
"filters",
".",
"length",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"String",
"filter",
":",
"filters",
")",
"{",
"String",
"[",
"]",
"filterSplitted",
"=",
"filter",
".",
"split",
"(",
"\":\"",
")",
";",
"// We must evaluate all the filters and return only when there is a valid match",
"if",
"(",
"(",
"filterSplitted",
".",
"length",
"==",
"1",
"&&",
"targetData",
".",
"anyMatch",
"(",
"filterSplitted",
"[",
"0",
"]",
")",
")",
"||",
"// Any filter",
"(",
"\"key\"",
".",
"equalsIgnoreCase",
"(",
"filterSplitted",
"[",
"0",
"]",
")",
"&&",
"targetData",
".",
"keyMatch",
"(",
"filterSplitted",
"[",
"1",
"]",
")",
")",
"||",
"// Key filter",
"(",
"\"name\"",
".",
"equalsIgnoreCase",
"(",
"filterSplitted",
"[",
"0",
"]",
")",
"&&",
"targetData",
".",
"nameMatch",
"(",
"filterSplitted",
"[",
"1",
"]",
")",
")",
"||",
"// Name filter",
"(",
"\"tag\"",
".",
"equalsIgnoreCase",
"(",
"filterSplitted",
"[",
"0",
"]",
")",
"&&",
"targetData",
".",
"tagMatch",
"(",
"filterSplitted",
"[",
"1",
"]",
")",
")",
"||",
"// Tag filter",
"(",
"\"ticket\"",
".",
"equalsIgnoreCase",
"(",
"filterSplitted",
"[",
"0",
"]",
")",
"&&",
"targetData",
".",
"ticketMatch",
"(",
"filterSplitted",
"[",
"1",
"]",
")",
")",
"// Ticket filter",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Define if a test is runnable based on the object that represents the test
meta data
@param targetData The meta data
@param filters The filters
@return True if the test can be run | [
"Define",
"if",
"a",
"test",
"is",
"runnable",
"based",
"on",
"the",
"object",
"that",
"represents",
"the",
"test",
"meta",
"data"
] | train | https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/core/filters/FilterUtils.java#L76-L97 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java | RelativeDateTimeFormatter.getAbsoluteUnitString | private String getAbsoluteUnitString(Style style, AbsoluteUnit unit, Direction direction) {
"""
Gets the string value from qualitativeUnitMap with fallback based on style.
"""
EnumMap<AbsoluteUnit, EnumMap<Direction, String>> unitMap;
EnumMap<Direction, String> dirMap;
do {
unitMap = qualitativeUnitMap.get(style);
if (unitMap != null) {
dirMap = unitMap.get(unit);
if (dirMap != null) {
String result = dirMap.get(direction);
if (result != null) {
return result;
}
}
}
// Consider other styles from alias fallback.
// Data loading guaranteed no endless loops.
} while ((style = fallbackCache[style.ordinal()]) != null);
return null;
} | java | private String getAbsoluteUnitString(Style style, AbsoluteUnit unit, Direction direction) {
EnumMap<AbsoluteUnit, EnumMap<Direction, String>> unitMap;
EnumMap<Direction, String> dirMap;
do {
unitMap = qualitativeUnitMap.get(style);
if (unitMap != null) {
dirMap = unitMap.get(unit);
if (dirMap != null) {
String result = dirMap.get(direction);
if (result != null) {
return result;
}
}
}
// Consider other styles from alias fallback.
// Data loading guaranteed no endless loops.
} while ((style = fallbackCache[style.ordinal()]) != null);
return null;
} | [
"private",
"String",
"getAbsoluteUnitString",
"(",
"Style",
"style",
",",
"AbsoluteUnit",
"unit",
",",
"Direction",
"direction",
")",
"{",
"EnumMap",
"<",
"AbsoluteUnit",
",",
"EnumMap",
"<",
"Direction",
",",
"String",
">",
">",
"unitMap",
";",
"EnumMap",
"<",
"Direction",
",",
"String",
">",
"dirMap",
";",
"do",
"{",
"unitMap",
"=",
"qualitativeUnitMap",
".",
"get",
"(",
"style",
")",
";",
"if",
"(",
"unitMap",
"!=",
"null",
")",
"{",
"dirMap",
"=",
"unitMap",
".",
"get",
"(",
"unit",
")",
";",
"if",
"(",
"dirMap",
"!=",
"null",
")",
"{",
"String",
"result",
"=",
"dirMap",
".",
"get",
"(",
"direction",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"return",
"result",
";",
"}",
"}",
"}",
"// Consider other styles from alias fallback.",
"// Data loading guaranteed no endless loops.",
"}",
"while",
"(",
"(",
"style",
"=",
"fallbackCache",
"[",
"style",
".",
"ordinal",
"(",
")",
"]",
")",
"!=",
"null",
")",
";",
"return",
"null",
";",
"}"
] | Gets the string value from qualitativeUnitMap with fallback based on style. | [
"Gets",
"the",
"string",
"value",
"from",
"qualitativeUnitMap",
"with",
"fallback",
"based",
"on",
"style",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L636-L657 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/configuration/ConfigurationMetadataBuilder.java | ConfigurationMetadataBuilder.writeAttribute | static void writeAttribute(Writer out, String name, String value) throws IOException {
"""
Write a quoted attribute with a value to a writer.
@param out The out writer
@param name The name of the attribute
@param value The value
@throws IOException If an error occurred writing output
"""
out.write('"');
out.write(name);
out.write("\":");
out.write(quote(value));
} | java | static void writeAttribute(Writer out, String name, String value) throws IOException {
out.write('"');
out.write(name);
out.write("\":");
out.write(quote(value));
} | [
"static",
"void",
"writeAttribute",
"(",
"Writer",
"out",
",",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"'",
"'",
")",
";",
"out",
".",
"write",
"(",
"name",
")",
";",
"out",
".",
"write",
"(",
"\"\\\":\"",
")",
";",
"out",
".",
"write",
"(",
"quote",
"(",
"value",
")",
")",
";",
"}"
] | Write a quoted attribute with a value to a writer.
@param out The out writer
@param name The name of the attribute
@param value The value
@throws IOException If an error occurred writing output | [
"Write",
"a",
"quoted",
"attribute",
"with",
"a",
"value",
"to",
"a",
"writer",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/configuration/ConfigurationMetadataBuilder.java#L261-L266 |
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java | OtpInputStream.read_atom | @SuppressWarnings("fallthrough")
public String read_atom() throws OtpErlangDecodeException {
"""
Read an Erlang atom from the stream.
@return a String containing the value of the atom.
@exception OtpErlangDecodeException
if the next term in the stream is not an atom.
"""
int tag;
int len = -1;
byte[] strbuf;
String atom;
tag = read1skip_version();
switch (tag) {
case OtpExternal.atomTag:
len = read2BE();
strbuf = new byte[len];
this.readN(strbuf);
try {
atom = new String(strbuf, "ISO-8859-1");
} catch (final java.io.UnsupportedEncodingException e) {
throw new OtpErlangDecodeException(
"Failed to decode ISO-8859-1 atom");
}
if (atom.length() > OtpExternal.maxAtomLength) {
/*
* Throwing an exception would be better I think, but truncation
* seems to be the way it has been done in other parts of OTP...
*/
atom = atom.substring(0, OtpExternal.maxAtomLength);
}
break;
case OtpExternal.smallAtomUtf8Tag:
len = read1();
// fall-through
case OtpExternal.atomUtf8Tag:
if (len < 0) {
len = read2BE();
}
strbuf = new byte[len];
this.readN(strbuf);
try {
atom = new String(strbuf, "UTF-8");
} catch (final java.io.UnsupportedEncodingException e) {
throw new OtpErlangDecodeException(
"Failed to decode UTF-8 atom");
}
if (atom.codePointCount(0, atom.length()) > OtpExternal.maxAtomLength) {
/*
* Throwing an exception would be better I think, but truncation
* seems to be the way it has been done in other parts of OTP...
*/
final int[] cps = OtpErlangString.stringToCodePoints(atom);
atom = new String(cps, 0, OtpExternal.maxAtomLength);
}
break;
default:
throw new OtpErlangDecodeException(
"wrong tag encountered, expected " + OtpExternal.atomTag
+ ", or " + OtpExternal.atomUtf8Tag + ", got "
+ tag);
}
return atom;
} | java | @SuppressWarnings("fallthrough")
public String read_atom() throws OtpErlangDecodeException {
int tag;
int len = -1;
byte[] strbuf;
String atom;
tag = read1skip_version();
switch (tag) {
case OtpExternal.atomTag:
len = read2BE();
strbuf = new byte[len];
this.readN(strbuf);
try {
atom = new String(strbuf, "ISO-8859-1");
} catch (final java.io.UnsupportedEncodingException e) {
throw new OtpErlangDecodeException(
"Failed to decode ISO-8859-1 atom");
}
if (atom.length() > OtpExternal.maxAtomLength) {
/*
* Throwing an exception would be better I think, but truncation
* seems to be the way it has been done in other parts of OTP...
*/
atom = atom.substring(0, OtpExternal.maxAtomLength);
}
break;
case OtpExternal.smallAtomUtf8Tag:
len = read1();
// fall-through
case OtpExternal.atomUtf8Tag:
if (len < 0) {
len = read2BE();
}
strbuf = new byte[len];
this.readN(strbuf);
try {
atom = new String(strbuf, "UTF-8");
} catch (final java.io.UnsupportedEncodingException e) {
throw new OtpErlangDecodeException(
"Failed to decode UTF-8 atom");
}
if (atom.codePointCount(0, atom.length()) > OtpExternal.maxAtomLength) {
/*
* Throwing an exception would be better I think, but truncation
* seems to be the way it has been done in other parts of OTP...
*/
final int[] cps = OtpErlangString.stringToCodePoints(atom);
atom = new String(cps, 0, OtpExternal.maxAtomLength);
}
break;
default:
throw new OtpErlangDecodeException(
"wrong tag encountered, expected " + OtpExternal.atomTag
+ ", or " + OtpExternal.atomUtf8Tag + ", got "
+ tag);
}
return atom;
} | [
"@",
"SuppressWarnings",
"(",
"\"fallthrough\"",
")",
"public",
"String",
"read_atom",
"(",
")",
"throws",
"OtpErlangDecodeException",
"{",
"int",
"tag",
";",
"int",
"len",
"=",
"-",
"1",
";",
"byte",
"[",
"]",
"strbuf",
";",
"String",
"atom",
";",
"tag",
"=",
"read1skip_version",
"(",
")",
";",
"switch",
"(",
"tag",
")",
"{",
"case",
"OtpExternal",
".",
"atomTag",
":",
"len",
"=",
"read2BE",
"(",
")",
";",
"strbuf",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"this",
".",
"readN",
"(",
"strbuf",
")",
";",
"try",
"{",
"atom",
"=",
"new",
"String",
"(",
"strbuf",
",",
"\"ISO-8859-1\"",
")",
";",
"}",
"catch",
"(",
"final",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"OtpErlangDecodeException",
"(",
"\"Failed to decode ISO-8859-1 atom\"",
")",
";",
"}",
"if",
"(",
"atom",
".",
"length",
"(",
")",
">",
"OtpExternal",
".",
"maxAtomLength",
")",
"{",
"/*\n * Throwing an exception would be better I think, but truncation\n * seems to be the way it has been done in other parts of OTP...\n */",
"atom",
"=",
"atom",
".",
"substring",
"(",
"0",
",",
"OtpExternal",
".",
"maxAtomLength",
")",
";",
"}",
"break",
";",
"case",
"OtpExternal",
".",
"smallAtomUtf8Tag",
":",
"len",
"=",
"read1",
"(",
")",
";",
"// fall-through",
"case",
"OtpExternal",
".",
"atomUtf8Tag",
":",
"if",
"(",
"len",
"<",
"0",
")",
"{",
"len",
"=",
"read2BE",
"(",
")",
";",
"}",
"strbuf",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"this",
".",
"readN",
"(",
"strbuf",
")",
";",
"try",
"{",
"atom",
"=",
"new",
"String",
"(",
"strbuf",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"final",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"OtpErlangDecodeException",
"(",
"\"Failed to decode UTF-8 atom\"",
")",
";",
"}",
"if",
"(",
"atom",
".",
"codePointCount",
"(",
"0",
",",
"atom",
".",
"length",
"(",
")",
")",
">",
"OtpExternal",
".",
"maxAtomLength",
")",
"{",
"/*\n * Throwing an exception would be better I think, but truncation\n * seems to be the way it has been done in other parts of OTP...\n */",
"final",
"int",
"[",
"]",
"cps",
"=",
"OtpErlangString",
".",
"stringToCodePoints",
"(",
"atom",
")",
";",
"atom",
"=",
"new",
"String",
"(",
"cps",
",",
"0",
",",
"OtpExternal",
".",
"maxAtomLength",
")",
";",
"}",
"break",
";",
"default",
":",
"throw",
"new",
"OtpErlangDecodeException",
"(",
"\"wrong tag encountered, expected \"",
"+",
"OtpExternal",
".",
"atomTag",
"+",
"\", or \"",
"+",
"OtpExternal",
".",
"atomUtf8Tag",
"+",
"\", got \"",
"+",
"tag",
")",
";",
"}",
"return",
"atom",
";",
"}"
] | Read an Erlang atom from the stream.
@return a String containing the value of the atom.
@exception OtpErlangDecodeException
if the next term in the stream is not an atom. | [
"Read",
"an",
"Erlang",
"atom",
"from",
"the",
"stream",
"."
] | train | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java#L350-L413 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java | StreamTask.handleAsyncException | @Override
public void handleAsyncException(String message, Throwable exception) {
"""
Handles an exception thrown by another thread (e.g. a TriggerTask),
other than the one executing the main task by failing the task entirely.
<p>In more detail, it marks task execution failed for an external reason
(a reason other than the task code itself throwing an exception). If the task
is already in a terminal state (such as FINISHED, CANCELED, FAILED), or if the
task is already canceling this does nothing. Otherwise it sets the state to
FAILED, and, if the invokable code is running, starts an asynchronous thread
that aborts that code.
<p>This method never blocks.
"""
if (isRunning) {
// only fail if the task is still running
getEnvironment().failExternally(exception);
}
} | java | @Override
public void handleAsyncException(String message, Throwable exception) {
if (isRunning) {
// only fail if the task is still running
getEnvironment().failExternally(exception);
}
} | [
"@",
"Override",
"public",
"void",
"handleAsyncException",
"(",
"String",
"message",
",",
"Throwable",
"exception",
")",
"{",
"if",
"(",
"isRunning",
")",
"{",
"// only fail if the task is still running",
"getEnvironment",
"(",
")",
".",
"failExternally",
"(",
"exception",
")",
";",
"}",
"}"
] | Handles an exception thrown by another thread (e.g. a TriggerTask),
other than the one executing the main task by failing the task entirely.
<p>In more detail, it marks task execution failed for an external reason
(a reason other than the task code itself throwing an exception). If the task
is already in a terminal state (such as FINISHED, CANCELED, FAILED), or if the
task is already canceling this does nothing. Otherwise it sets the state to
FAILED, and, if the invokable code is running, starts an asynchronous thread
that aborts that code.
<p>This method never blocks. | [
"Handles",
"an",
"exception",
"thrown",
"by",
"another",
"thread",
"(",
"e",
".",
"g",
".",
"a",
"TriggerTask",
")",
"other",
"than",
"the",
"one",
"executing",
"the",
"main",
"task",
"by",
"failing",
"the",
"task",
"entirely",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java#L851-L857 |
webmetrics/browsermob-proxy | src/main/java/org/xbill/DNS/security/CERTConverter.java | CERTConverter.buildRecord | public static CERTRecord
buildRecord(Name name, int dclass, long ttl, Certificate cert, int tag,
int alg) {
"""
Builds a CERT record from a Certificate associated with a key also in DNS
"""
int type;
byte [] data;
try {
if (cert instanceof X509Certificate) {
type = CERTRecord.PKIX;
data = cert.getEncoded();
}
else
return null;
return new CERTRecord(name, dclass, ttl, type, tag, alg, data);
}
catch (CertificateException e) {
if (Options.check("verboseexceptions"))
System.err.println("Cert build exception:" + e);
return null;
}
} | java | public static CERTRecord
buildRecord(Name name, int dclass, long ttl, Certificate cert, int tag,
int alg)
{
int type;
byte [] data;
try {
if (cert instanceof X509Certificate) {
type = CERTRecord.PKIX;
data = cert.getEncoded();
}
else
return null;
return new CERTRecord(name, dclass, ttl, type, tag, alg, data);
}
catch (CertificateException e) {
if (Options.check("verboseexceptions"))
System.err.println("Cert build exception:" + e);
return null;
}
} | [
"public",
"static",
"CERTRecord",
"buildRecord",
"(",
"Name",
"name",
",",
"int",
"dclass",
",",
"long",
"ttl",
",",
"Certificate",
"cert",
",",
"int",
"tag",
",",
"int",
"alg",
")",
"{",
"int",
"type",
";",
"byte",
"[",
"]",
"data",
";",
"try",
"{",
"if",
"(",
"cert",
"instanceof",
"X509Certificate",
")",
"{",
"type",
"=",
"CERTRecord",
".",
"PKIX",
";",
"data",
"=",
"cert",
".",
"getEncoded",
"(",
")",
";",
"}",
"else",
"return",
"null",
";",
"return",
"new",
"CERTRecord",
"(",
"name",
",",
"dclass",
",",
"ttl",
",",
"type",
",",
"tag",
",",
"alg",
",",
"data",
")",
";",
"}",
"catch",
"(",
"CertificateException",
"e",
")",
"{",
"if",
"(",
"Options",
".",
"check",
"(",
"\"verboseexceptions\"",
")",
")",
"System",
".",
"err",
".",
"println",
"(",
"\"Cert build exception:\"",
"+",
"e",
")",
";",
"return",
"null",
";",
"}",
"}"
] | Builds a CERT record from a Certificate associated with a key also in DNS | [
"Builds",
"a",
"CERT",
"record",
"from",
"a",
"Certificate",
"associated",
"with",
"a",
"key",
"also",
"in",
"DNS"
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/xbill/DNS/security/CERTConverter.java#L56-L78 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/boot/impl/OgmServiceRegistryInitializer.java | OgmServiceRegistryInitializer.isOgmImplicitEnabled | private boolean isOgmImplicitEnabled(Map<?, ?> settings) {
"""
Decides if we need to start OGM when {@link OgmProperties#ENABLED} is not set.
At the moment, if a dialect class is not declared, Hibernate ORM requires a datasource or a JDBC connector when a dialect is not declared.
If none of those properties are declared, we assume the user wants to start Hibernate OGM.
@param settings
@return {@code true} if we have to start OGM, {@code false} otherwise
"""
String jdbcUrl = new ConfigurationPropertyReader( settings )
.property( Environment.URL, String.class )
.getValue();
String jndiDatasource = new ConfigurationPropertyReader( settings )
.property( Environment.DATASOURCE, String.class )
.getValue();
String dialect = new ConfigurationPropertyReader( settings )
.property( Environment.DIALECT, String.class )
.getValue();
return jdbcUrl == null && jndiDatasource == null && dialect == null;
} | java | private boolean isOgmImplicitEnabled(Map<?, ?> settings) {
String jdbcUrl = new ConfigurationPropertyReader( settings )
.property( Environment.URL, String.class )
.getValue();
String jndiDatasource = new ConfigurationPropertyReader( settings )
.property( Environment.DATASOURCE, String.class )
.getValue();
String dialect = new ConfigurationPropertyReader( settings )
.property( Environment.DIALECT, String.class )
.getValue();
return jdbcUrl == null && jndiDatasource == null && dialect == null;
} | [
"private",
"boolean",
"isOgmImplicitEnabled",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"settings",
")",
"{",
"String",
"jdbcUrl",
"=",
"new",
"ConfigurationPropertyReader",
"(",
"settings",
")",
".",
"property",
"(",
"Environment",
".",
"URL",
",",
"String",
".",
"class",
")",
".",
"getValue",
"(",
")",
";",
"String",
"jndiDatasource",
"=",
"new",
"ConfigurationPropertyReader",
"(",
"settings",
")",
".",
"property",
"(",
"Environment",
".",
"DATASOURCE",
",",
"String",
".",
"class",
")",
".",
"getValue",
"(",
")",
";",
"String",
"dialect",
"=",
"new",
"ConfigurationPropertyReader",
"(",
"settings",
")",
".",
"property",
"(",
"Environment",
".",
"DIALECT",
",",
"String",
".",
"class",
")",
".",
"getValue",
"(",
")",
";",
"return",
"jdbcUrl",
"==",
"null",
"&&",
"jndiDatasource",
"==",
"null",
"&&",
"dialect",
"==",
"null",
";",
"}"
] | Decides if we need to start OGM when {@link OgmProperties#ENABLED} is not set.
At the moment, if a dialect class is not declared, Hibernate ORM requires a datasource or a JDBC connector when a dialect is not declared.
If none of those properties are declared, we assume the user wants to start Hibernate OGM.
@param settings
@return {@code true} if we have to start OGM, {@code false} otherwise | [
"Decides",
"if",
"we",
"need",
"to",
"start",
"OGM",
"when",
"{",
"@link",
"OgmProperties#ENABLED",
"}",
"is",
"not",
"set",
".",
"At",
"the",
"moment",
"if",
"a",
"dialect",
"class",
"is",
"not",
"declared",
"Hibernate",
"ORM",
"requires",
"a",
"datasource",
"or",
"a",
"JDBC",
"connector",
"when",
"a",
"dialect",
"is",
"not",
"declared",
".",
"If",
"none",
"of",
"those",
"properties",
"are",
"declared",
"we",
"assume",
"the",
"user",
"wants",
"to",
"start",
"Hibernate",
"OGM",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/boot/impl/OgmServiceRegistryInitializer.java#L108-L122 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java | DynamicReportBuilder.setQuery | public DynamicReportBuilder setQuery(String text, String language) {
"""
Adds main report query.
@param text
@param language use constants from {@link DJConstants}
@return
"""
this.report.setQuery(new DJQuery(text, language));
return this;
} | java | public DynamicReportBuilder setQuery(String text, String language) {
this.report.setQuery(new DJQuery(text, language));
return this;
} | [
"public",
"DynamicReportBuilder",
"setQuery",
"(",
"String",
"text",
",",
"String",
"language",
")",
"{",
"this",
".",
"report",
".",
"setQuery",
"(",
"new",
"DJQuery",
"(",
"text",
",",
"language",
")",
")",
";",
"return",
"this",
";",
"}"
] | Adds main report query.
@param text
@param language use constants from {@link DJConstants}
@return | [
"Adds",
"main",
"report",
"query",
"."
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1424-L1427 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java | HBaseDataHandler.isIdCol | private boolean isIdCol(EntityMetadata m, String colName) {
"""
Checks if is id col.
@param m
the m
@param colName
the col name
@return true, if is id col
"""
return ((AbstractAttribute) m.getIdAttribute()).getJPAColumnName().equals(colName);
} | java | private boolean isIdCol(EntityMetadata m, String colName)
{
return ((AbstractAttribute) m.getIdAttribute()).getJPAColumnName().equals(colName);
} | [
"private",
"boolean",
"isIdCol",
"(",
"EntityMetadata",
"m",
",",
"String",
"colName",
")",
"{",
"return",
"(",
"(",
"AbstractAttribute",
")",
"m",
".",
"getIdAttribute",
"(",
")",
")",
".",
"getJPAColumnName",
"(",
")",
".",
"equals",
"(",
"colName",
")",
";",
"}"
] | Checks if is id col.
@param m
the m
@param colName
the col name
@return true, if is id col | [
"Checks",
"if",
"is",
"id",
"col",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java#L898-L901 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/util/ListenerList.java | ListenerList.addListener | public static <L, K> void addListener (Map<K, ListenerList<L>> map, K key, L listener) {
"""
Adds a listener to the listener list in the supplied map. If no list exists, one will be
created and mapped to the supplied key.
"""
ListenerList<L> list = map.get(key);
if (list == null) {
map.put(key, list = new ListenerList<L>());
}
list.add(listener);
} | java | public static <L, K> void addListener (Map<K, ListenerList<L>> map, K key, L listener)
{
ListenerList<L> list = map.get(key);
if (list == null) {
map.put(key, list = new ListenerList<L>());
}
list.add(listener);
} | [
"public",
"static",
"<",
"L",
",",
"K",
">",
"void",
"addListener",
"(",
"Map",
"<",
"K",
",",
"ListenerList",
"<",
"L",
">",
">",
"map",
",",
"K",
"key",
",",
"L",
"listener",
")",
"{",
"ListenerList",
"<",
"L",
">",
"list",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"map",
".",
"put",
"(",
"key",
",",
"list",
"=",
"new",
"ListenerList",
"<",
"L",
">",
"(",
")",
")",
";",
"}",
"list",
".",
"add",
"(",
"listener",
")",
";",
"}"
] | Adds a listener to the listener list in the supplied map. If no list exists, one will be
created and mapped to the supplied key. | [
"Adds",
"a",
"listener",
"to",
"the",
"listener",
"list",
"in",
"the",
"supplied",
"map",
".",
"If",
"no",
"list",
"exists",
"one",
"will",
"be",
"created",
"and",
"mapped",
"to",
"the",
"supplied",
"key",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/ListenerList.java#L56-L63 |
casmi/casmi | src/main/java/casmi/graphics/element/Bezier.java | Bezier.setNode | public void setNode(int number, Vector3D v) {
"""
Sets coordinate of nodes of this Bezier.
@param number The number of a node. The node whose number is 0 or 3 is a anchor point, and
the node whose number is 1 or 2 is a control point.
@param v The coordinates of this node.
"""
setNode(number, v.getX(), v.getY(), v.getZ());
} | java | public void setNode(int number, Vector3D v) {
setNode(number, v.getX(), v.getY(), v.getZ());
} | [
"public",
"void",
"setNode",
"(",
"int",
"number",
",",
"Vector3D",
"v",
")",
"{",
"setNode",
"(",
"number",
",",
"v",
".",
"getX",
"(",
")",
",",
"v",
".",
"getY",
"(",
")",
",",
"v",
".",
"getZ",
"(",
")",
")",
";",
"}"
] | Sets coordinate of nodes of this Bezier.
@param number The number of a node. The node whose number is 0 or 3 is a anchor point, and
the node whose number is 1 or 2 is a control point.
@param v The coordinates of this node. | [
"Sets",
"coordinate",
"of",
"nodes",
"of",
"this",
"Bezier",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Bezier.java#L179-L181 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuModuleLoadDataEx | public static int cuModuleLoadDataEx(CUmodule phMod, String string, int numOptions, int options[], Pointer optionValues) {
"""
A wrapper function for
{@link JCudaDriver#cuModuleLoadDataEx(CUmodule, Pointer, int, int[], Pointer)}
which allows passing in the image data as a string.
@param module Returned module
@param image Module data to load
@param numOptions Number of options
@param options Options for JIT
@param optionValues Option values for JIT
@return The return code from <code>cuModuleLoadDataEx</code>
@see #cuModuleLoadDataEx(CUmodule, Pointer, int, int[], Pointer)
"""
byte bytes[] = string.getBytes();
byte image[] = Arrays.copyOf(bytes, bytes.length+1);
return cuModuleLoadDataEx(phMod, Pointer.to(image), numOptions, options, optionValues);
} | java | public static int cuModuleLoadDataEx(CUmodule phMod, String string, int numOptions, int options[], Pointer optionValues)
{
byte bytes[] = string.getBytes();
byte image[] = Arrays.copyOf(bytes, bytes.length+1);
return cuModuleLoadDataEx(phMod, Pointer.to(image), numOptions, options, optionValues);
} | [
"public",
"static",
"int",
"cuModuleLoadDataEx",
"(",
"CUmodule",
"phMod",
",",
"String",
"string",
",",
"int",
"numOptions",
",",
"int",
"options",
"[",
"]",
",",
"Pointer",
"optionValues",
")",
"{",
"byte",
"bytes",
"[",
"]",
"=",
"string",
".",
"getBytes",
"(",
")",
";",
"byte",
"image",
"[",
"]",
"=",
"Arrays",
".",
"copyOf",
"(",
"bytes",
",",
"bytes",
".",
"length",
"+",
"1",
")",
";",
"return",
"cuModuleLoadDataEx",
"(",
"phMod",
",",
"Pointer",
".",
"to",
"(",
"image",
")",
",",
"numOptions",
",",
"options",
",",
"optionValues",
")",
";",
"}"
] | A wrapper function for
{@link JCudaDriver#cuModuleLoadDataEx(CUmodule, Pointer, int, int[], Pointer)}
which allows passing in the image data as a string.
@param module Returned module
@param image Module data to load
@param numOptions Number of options
@param options Options for JIT
@param optionValues Option values for JIT
@return The return code from <code>cuModuleLoadDataEx</code>
@see #cuModuleLoadDataEx(CUmodule, Pointer, int, int[], Pointer) | [
"A",
"wrapper",
"function",
"for",
"{",
"@link",
"JCudaDriver#cuModuleLoadDataEx",
"(",
"CUmodule",
"Pointer",
"int",
"int",
"[]",
"Pointer",
")",
"}",
"which",
"allows",
"passing",
"in",
"the",
"image",
"data",
"as",
"a",
"string",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L416-L421 |
Talend/tesb-rt-se | sam/sam-agent/src/main/java/org/talend/esb/sam/agent/flowidprocessor/FlowIdSoapCodec.java | FlowIdSoapCodec.writeFlowId | public static void writeFlowId(Message message, String flowId) {
"""
Write flow id to message.
@param message the message
@param flowId the flow id
"""
if (!(message instanceof SoapMessage)) {
return;
}
SoapMessage soapMessage = (SoapMessage)message;
Header hdFlowId = soapMessage.getHeader(FLOW_ID_QNAME);
if (hdFlowId != null) {
LOG.warning("FlowId already existing in soap header, need not to write FlowId header.");
return;
}
try {
soapMessage.getHeaders().add(
new Header(FLOW_ID_QNAME, flowId, new JAXBDataBinding(String.class)));
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Stored flowId '" + flowId + "' in soap header: " + FLOW_ID_QNAME);
}
} catch (JAXBException e) {
LOG.log(Level.SEVERE, "Couldn't create flowId header.", e);
}
} | java | public static void writeFlowId(Message message, String flowId) {
if (!(message instanceof SoapMessage)) {
return;
}
SoapMessage soapMessage = (SoapMessage)message;
Header hdFlowId = soapMessage.getHeader(FLOW_ID_QNAME);
if (hdFlowId != null) {
LOG.warning("FlowId already existing in soap header, need not to write FlowId header.");
return;
}
try {
soapMessage.getHeaders().add(
new Header(FLOW_ID_QNAME, flowId, new JAXBDataBinding(String.class)));
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Stored flowId '" + flowId + "' in soap header: " + FLOW_ID_QNAME);
}
} catch (JAXBException e) {
LOG.log(Level.SEVERE, "Couldn't create flowId header.", e);
}
} | [
"public",
"static",
"void",
"writeFlowId",
"(",
"Message",
"message",
",",
"String",
"flowId",
")",
"{",
"if",
"(",
"!",
"(",
"message",
"instanceof",
"SoapMessage",
")",
")",
"{",
"return",
";",
"}",
"SoapMessage",
"soapMessage",
"=",
"(",
"SoapMessage",
")",
"message",
";",
"Header",
"hdFlowId",
"=",
"soapMessage",
".",
"getHeader",
"(",
"FLOW_ID_QNAME",
")",
";",
"if",
"(",
"hdFlowId",
"!=",
"null",
")",
"{",
"LOG",
".",
"warning",
"(",
"\"FlowId already existing in soap header, need not to write FlowId header.\"",
")",
";",
"return",
";",
"}",
"try",
"{",
"soapMessage",
".",
"getHeaders",
"(",
")",
".",
"add",
"(",
"new",
"Header",
"(",
"FLOW_ID_QNAME",
",",
"flowId",
",",
"new",
"JAXBDataBinding",
"(",
"String",
".",
"class",
")",
")",
")",
";",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LOG",
".",
"fine",
"(",
"\"Stored flowId '\"",
"+",
"flowId",
"+",
"\"' in soap header: \"",
"+",
"FLOW_ID_QNAME",
")",
";",
"}",
"}",
"catch",
"(",
"JAXBException",
"e",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Couldn't create flowId header.\"",
",",
"e",
")",
";",
"}",
"}"
] | Write flow id to message.
@param message the message
@param flowId the flow id | [
"Write",
"flow",
"id",
"to",
"message",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/flowidprocessor/FlowIdSoapCodec.java#L81-L102 |
primefaces/primefaces | src/main/java/org/primefaces/util/CalendarUtils.java | CalendarUtils.encodeListValue | public static void encodeListValue(FacesContext context, UICalendar uicalendar, String optionName, List<Object> values) throws IOException {
"""
Write the value of Calendar options
@param context
@param uicalendar component
@param optionName the name of an option
@param values the List values of an option
@throws java.io.IOException if writer is null
"""
if (values == null) {
return;
}
ResponseWriter writer = context.getResponseWriter();
writer.write("," + optionName + ":[");
for (int i = 0; i < values.size(); i++) {
Object item = values.get(i);
Object preText = (i == 0) ? "" : ",";
if (item instanceof Date) {
writer.write(preText + "\"" + EscapeUtils.forJavaScript(getValueAsString(context, uicalendar, item)) + "\"");
}
else {
writer.write(preText + "" + item);
}
}
writer.write("]");
} | java | public static void encodeListValue(FacesContext context, UICalendar uicalendar, String optionName, List<Object> values) throws IOException {
if (values == null) {
return;
}
ResponseWriter writer = context.getResponseWriter();
writer.write("," + optionName + ":[");
for (int i = 0; i < values.size(); i++) {
Object item = values.get(i);
Object preText = (i == 0) ? "" : ",";
if (item instanceof Date) {
writer.write(preText + "\"" + EscapeUtils.forJavaScript(getValueAsString(context, uicalendar, item)) + "\"");
}
else {
writer.write(preText + "" + item);
}
}
writer.write("]");
} | [
"public",
"static",
"void",
"encodeListValue",
"(",
"FacesContext",
"context",
",",
"UICalendar",
"uicalendar",
",",
"String",
"optionName",
",",
"List",
"<",
"Object",
">",
"values",
")",
"throws",
"IOException",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"return",
";",
"}",
"ResponseWriter",
"writer",
"=",
"context",
".",
"getResponseWriter",
"(",
")",
";",
"writer",
".",
"write",
"(",
"\",\"",
"+",
"optionName",
"+",
"\":[\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"values",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Object",
"item",
"=",
"values",
".",
"get",
"(",
"i",
")",
";",
"Object",
"preText",
"=",
"(",
"i",
"==",
"0",
")",
"?",
"\"\"",
":",
"\",\"",
";",
"if",
"(",
"item",
"instanceof",
"Date",
")",
"{",
"writer",
".",
"write",
"(",
"preText",
"+",
"\"\\\"\"",
"+",
"EscapeUtils",
".",
"forJavaScript",
"(",
"getValueAsString",
"(",
"context",
",",
"uicalendar",
",",
"item",
")",
")",
"+",
"\"\\\"\"",
")",
";",
"}",
"else",
"{",
"writer",
".",
"write",
"(",
"preText",
"+",
"\"\"",
"+",
"item",
")",
";",
"}",
"}",
"writer",
".",
"write",
"(",
"\"]\"",
")",
";",
"}"
] | Write the value of Calendar options
@param context
@param uicalendar component
@param optionName the name of an option
@param values the List values of an option
@throws java.io.IOException if writer is null | [
"Write",
"the",
"value",
"of",
"Calendar",
"options"
] | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/CalendarUtils.java#L221-L242 |
zaproxy/zaproxy | src/org/parosproxy/paros/core/scanner/VariantCustom.java | VariantCustom.addParamQuery | public void addParamQuery(String name, String value) {
"""
Support method to add a new QueryString param to this custom variant
@param name the param name
@param value the value of this parameter
"""
addParam(name, value, NameValuePair.TYPE_QUERY_STRING);
} | java | public void addParamQuery(String name, String value) {
addParam(name, value, NameValuePair.TYPE_QUERY_STRING);
} | [
"public",
"void",
"addParamQuery",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"addParam",
"(",
"name",
",",
"value",
",",
"NameValuePair",
".",
"TYPE_QUERY_STRING",
")",
";",
"}"
] | Support method to add a new QueryString param to this custom variant
@param name the param name
@param value the value of this parameter | [
"Support",
"method",
"to",
"add",
"a",
"new",
"QueryString",
"param",
"to",
"this",
"custom",
"variant"
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/VariantCustom.java#L152-L154 |
codelibs/jcifs | src/main/java/jcifs/smb1/Config.java | Config.getLong | public static long getLong( String key, long def ) {
"""
Retrieve a <code>long</code>. If the key does not exist or
cannot be converted to a <code>long</code>, the provided default
argument will be returned.
"""
String s = prp.getProperty( key );
if( s != null ) {
try {
def = Long.parseLong( s );
} catch( NumberFormatException nfe ) {
if( log.level > 0 )
nfe.printStackTrace( log );
}
}
return def;
} | java | public static long getLong( String key, long def ) {
String s = prp.getProperty( key );
if( s != null ) {
try {
def = Long.parseLong( s );
} catch( NumberFormatException nfe ) {
if( log.level > 0 )
nfe.printStackTrace( log );
}
}
return def;
} | [
"public",
"static",
"long",
"getLong",
"(",
"String",
"key",
",",
"long",
"def",
")",
"{",
"String",
"s",
"=",
"prp",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"try",
"{",
"def",
"=",
"Long",
".",
"parseLong",
"(",
"s",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"if",
"(",
"log",
".",
"level",
">",
"0",
")",
"nfe",
".",
"printStackTrace",
"(",
"log",
")",
";",
"}",
"}",
"return",
"def",
";",
"}"
] | Retrieve a <code>long</code>. If the key does not exist or
cannot be converted to a <code>long</code>, the provided default
argument will be returned. | [
"Retrieve",
"a",
"<code",
">",
"long<",
"/",
"code",
">",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"or",
"cannot",
"be",
"converted",
"to",
"a",
"<code",
">",
"long<",
"/",
"code",
">",
"the",
"provided",
"default",
"argument",
"will",
"be",
"returned",
"."
] | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/Config.java#L259-L270 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java | AnycastOutputHandler.writeStartedFlush | public final Item writeStartedFlush(TransactionCommon t, AOStream stream) throws Exception {
"""
Helper method used by AOStream to persistently record that flush has been started
@param t the transaction
@param stream the stream making this call
@return the Item written
@throws Exception
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeStartedFlush");
String key =
SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid());
StreamInfo sinfo = streamTable.get(key);
if ((sinfo != null) && sinfo.streamId.equals(stream.streamId))
{
AOStartedFlushItem item = new AOStartedFlushItem(key, stream.streamId);
Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t);
this.containerItemStream.addItem(item, msTran);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeStartedFlush", item);
return item;
}
// this should not occur
// log error and throw exception
SIErrorException e = new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2810:1.89.4.1" },
null));
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writeStartedFlush",
"1:2817:1.89.4.1",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2822:1.89.4.1" });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeStartedFlush", e);
throw e;
} | java | public final Item writeStartedFlush(TransactionCommon t, AOStream stream) throws Exception
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeStartedFlush");
String key =
SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid());
StreamInfo sinfo = streamTable.get(key);
if ((sinfo != null) && sinfo.streamId.equals(stream.streamId))
{
AOStartedFlushItem item = new AOStartedFlushItem(key, stream.streamId);
Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t);
this.containerItemStream.addItem(item, msTran);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeStartedFlush", item);
return item;
}
// this should not occur
// log error and throw exception
SIErrorException e = new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2810:1.89.4.1" },
null));
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writeStartedFlush",
"1:2817:1.89.4.1",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler", "1:2822:1.89.4.1" });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeStartedFlush", e);
throw e;
} | [
"public",
"final",
"Item",
"writeStartedFlush",
"(",
"TransactionCommon",
"t",
",",
"AOStream",
"stream",
")",
"throws",
"Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"writeStartedFlush\"",
")",
";",
"String",
"key",
"=",
"SIMPUtils",
".",
"getRemoteGetKey",
"(",
"stream",
".",
"getRemoteMEUuid",
"(",
")",
",",
"stream",
".",
"getGatheringTargetDestUuid",
"(",
")",
")",
";",
"StreamInfo",
"sinfo",
"=",
"streamTable",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"(",
"sinfo",
"!=",
"null",
")",
"&&",
"sinfo",
".",
"streamId",
".",
"equals",
"(",
"stream",
".",
"streamId",
")",
")",
"{",
"AOStartedFlushItem",
"item",
"=",
"new",
"AOStartedFlushItem",
"(",
"key",
",",
"stream",
".",
"streamId",
")",
";",
"Transaction",
"msTran",
"=",
"mp",
".",
"resolveAndEnlistMsgStoreTransaction",
"(",
"t",
")",
";",
"this",
".",
"containerItemStream",
".",
"addItem",
"(",
"item",
",",
"msTran",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeStartedFlush\"",
",",
"item",
")",
";",
"return",
"item",
";",
"}",
"// this should not occur",
"// log error and throw exception",
"SIErrorException",
"e",
"=",
"new",
"SIErrorException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"",
",",
"\"1:2810:1.89.4.1\"",
"}",
",",
"null",
")",
")",
";",
"// FFDC",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writeStartedFlush\"",
",",
"\"1:2817:1.89.4.1\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.AnycastOutputHandler\"",
",",
"\"1:2822:1.89.4.1\"",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"writeStartedFlush\"",
",",
"e",
")",
";",
"throw",
"e",
";",
"}"
] | Helper method used by AOStream to persistently record that flush has been started
@param t the transaction
@param stream the stream making this call
@return the Item written
@throws Exception | [
"Helper",
"method",
"used",
"by",
"AOStream",
"to",
"persistently",
"record",
"that",
"flush",
"has",
"been",
"started"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2740-L2782 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.buildSelect | public String buildSelect(String parameters, List<String> options, List<String> values, int selected) {
"""
Generates a html select box out of the provided values.<p>
@param parameters a string that will be inserted into the initial select tag,
if null no parameters will be inserted
@param options the options
@param values the option values, if null the select will have no value attributes
@param selected the index of the pre-selected option, if -1 no option is pre-selected
@return a formatted html String representing a html select box
"""
return buildSelect(parameters, options, values, selected, true);
} | java | public String buildSelect(String parameters, List<String> options, List<String> values, int selected) {
return buildSelect(parameters, options, values, selected, true);
} | [
"public",
"String",
"buildSelect",
"(",
"String",
"parameters",
",",
"List",
"<",
"String",
">",
"options",
",",
"List",
"<",
"String",
">",
"values",
",",
"int",
"selected",
")",
"{",
"return",
"buildSelect",
"(",
"parameters",
",",
"options",
",",
"values",
",",
"selected",
",",
"true",
")",
";",
"}"
] | Generates a html select box out of the provided values.<p>
@param parameters a string that will be inserted into the initial select tag,
if null no parameters will be inserted
@param options the options
@param values the option values, if null the select will have no value attributes
@param selected the index of the pre-selected option, if -1 no option is pre-selected
@return a formatted html String representing a html select box | [
"Generates",
"a",
"html",
"select",
"box",
"out",
"of",
"the",
"provided",
"values",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L1109-L1112 |
OpenBEL/openbel-framework | org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Term.java | Term.findParameters | protected void findParameters(final List<Parameter> parms, final Term trm) {
"""
Find all parameters in <tt>term</tt> in a left-to-right, depth-first
fashion. The term's function arguments are read in order and the
following rules apply:
<ul>
<li>If the function argument is a parameter:
<ul>
<li>Add it to the parameter list (<tt>ps</tt>).</li>
</ul>
</li>
<li>If the function argument is a term:
<ul>
<li>Recurse into {@link #findParameters(List, Term)} for the nested term.
</li>
</ul>
</ul>
<p>
The results are captured in the <tt>params</tt> {@link List}.
</p>
@param params {@link List} of {@link Parameter}, the list of parameters
found from the top-level term so far
"""
List<BELObject> tfa = trm.getFunctionArguments();
if (hasItems(tfa)) {
for (BELObject bmo : tfa) {
if (Parameter.class.isAssignableFrom(bmo.getClass())) {
Parameter p = (Parameter) bmo;
parms.add(p);
} else {
Term inner = (Term) bmo;
if (!isProteinDecorator(inner.function)) {
findParameters(parms, inner);
} else if (FUSION.equals(inner.function)
&& hasItems(inner.getParameters())) {
parms.add(inner.getParameters().get(0));
}
}
}
}
} | java | protected void findParameters(final List<Parameter> parms, final Term trm) {
List<BELObject> tfa = trm.getFunctionArguments();
if (hasItems(tfa)) {
for (BELObject bmo : tfa) {
if (Parameter.class.isAssignableFrom(bmo.getClass())) {
Parameter p = (Parameter) bmo;
parms.add(p);
} else {
Term inner = (Term) bmo;
if (!isProteinDecorator(inner.function)) {
findParameters(parms, inner);
} else if (FUSION.equals(inner.function)
&& hasItems(inner.getParameters())) {
parms.add(inner.getParameters().get(0));
}
}
}
}
} | [
"protected",
"void",
"findParameters",
"(",
"final",
"List",
"<",
"Parameter",
">",
"parms",
",",
"final",
"Term",
"trm",
")",
"{",
"List",
"<",
"BELObject",
">",
"tfa",
"=",
"trm",
".",
"getFunctionArguments",
"(",
")",
";",
"if",
"(",
"hasItems",
"(",
"tfa",
")",
")",
"{",
"for",
"(",
"BELObject",
"bmo",
":",
"tfa",
")",
"{",
"if",
"(",
"Parameter",
".",
"class",
".",
"isAssignableFrom",
"(",
"bmo",
".",
"getClass",
"(",
")",
")",
")",
"{",
"Parameter",
"p",
"=",
"(",
"Parameter",
")",
"bmo",
";",
"parms",
".",
"add",
"(",
"p",
")",
";",
"}",
"else",
"{",
"Term",
"inner",
"=",
"(",
"Term",
")",
"bmo",
";",
"if",
"(",
"!",
"isProteinDecorator",
"(",
"inner",
".",
"function",
")",
")",
"{",
"findParameters",
"(",
"parms",
",",
"inner",
")",
";",
"}",
"else",
"if",
"(",
"FUSION",
".",
"equals",
"(",
"inner",
".",
"function",
")",
"&&",
"hasItems",
"(",
"inner",
".",
"getParameters",
"(",
")",
")",
")",
"{",
"parms",
".",
"add",
"(",
"inner",
".",
"getParameters",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Find all parameters in <tt>term</tt> in a left-to-right, depth-first
fashion. The term's function arguments are read in order and the
following rules apply:
<ul>
<li>If the function argument is a parameter:
<ul>
<li>Add it to the parameter list (<tt>ps</tt>).</li>
</ul>
</li>
<li>If the function argument is a term:
<ul>
<li>Recurse into {@link #findParameters(List, Term)} for the nested term.
</li>
</ul>
</ul>
<p>
The results are captured in the <tt>params</tt> {@link List}.
</p>
@param params {@link List} of {@link Parameter}, the list of parameters
found from the top-level term so far | [
"Find",
"all",
"parameters",
"in",
"<tt",
">",
"term<",
"/",
"tt",
">",
"in",
"a",
"left",
"-",
"to",
"-",
"right",
"depth",
"-",
"first",
"fashion",
".",
"The",
"term",
"s",
"function",
"arguments",
"are",
"read",
"in",
"order",
"and",
"the",
"following",
"rules",
"apply",
":",
"<ul",
">",
"<li",
">",
"If",
"the",
"function",
"argument",
"is",
"a",
"parameter",
":",
"<ul",
">",
"<li",
">",
"Add",
"it",
"to",
"the",
"parameter",
"list",
"(",
"<tt",
">",
"ps<",
"/",
"tt",
">",
")",
".",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">",
"<",
"/",
"li",
">",
"<li",
">",
"If",
"the",
"function",
"argument",
"is",
"a",
"term",
":",
"<ul",
">",
"<li",
">",
"Recurse",
"into",
"{",
"@link",
"#findParameters",
"(",
"List",
"Term",
")",
"}",
"for",
"the",
"nested",
"term",
".",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">",
"<",
"/",
"ul",
">",
"<p",
">",
"The",
"results",
"are",
"captured",
"in",
"the",
"<tt",
">",
"params<",
"/",
"tt",
">",
"{",
"@link",
"List",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Term.java#L534-L552 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java | PyGenerator.generateDocString | protected static boolean generateDocString(String comment, PyAppendable it) {
"""
Generate a Python docstring with the given comment.
@param comment the comment.
@param it the receiver of the docstring.
@return {@code true} if the docstring is added, {@code false} otherwise.
"""
final String cmt = comment == null ? null : comment.trim();
if (!Strings.isEmpty(cmt)) {
assert cmt != null;
it.append("\"\"\"").increaseIndentation(); //$NON-NLS-1$
for (final String line : cmt.split("[\n\r\f]+")) { //$NON-NLS-1$
it.newLine().append(line);
}
it.decreaseIndentation().newLine();
it.append("\"\"\"").newLine(); //$NON-NLS-1$
return true;
}
return false;
} | java | protected static boolean generateDocString(String comment, PyAppendable it) {
final String cmt = comment == null ? null : comment.trim();
if (!Strings.isEmpty(cmt)) {
assert cmt != null;
it.append("\"\"\"").increaseIndentation(); //$NON-NLS-1$
for (final String line : cmt.split("[\n\r\f]+")) { //$NON-NLS-1$
it.newLine().append(line);
}
it.decreaseIndentation().newLine();
it.append("\"\"\"").newLine(); //$NON-NLS-1$
return true;
}
return false;
} | [
"protected",
"static",
"boolean",
"generateDocString",
"(",
"String",
"comment",
",",
"PyAppendable",
"it",
")",
"{",
"final",
"String",
"cmt",
"=",
"comment",
"==",
"null",
"?",
"null",
":",
"comment",
".",
"trim",
"(",
")",
";",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"cmt",
")",
")",
"{",
"assert",
"cmt",
"!=",
"null",
";",
"it",
".",
"append",
"(",
"\"\\\"\\\"\\\"\"",
")",
".",
"increaseIndentation",
"(",
")",
";",
"//$NON-NLS-1$",
"for",
"(",
"final",
"String",
"line",
":",
"cmt",
".",
"split",
"(",
"\"[\\n\\r\\f]+\"",
")",
")",
"{",
"//$NON-NLS-1$",
"it",
".",
"newLine",
"(",
")",
".",
"append",
"(",
"line",
")",
";",
"}",
"it",
".",
"decreaseIndentation",
"(",
")",
".",
"newLine",
"(",
")",
";",
"it",
".",
"append",
"(",
"\"\\\"\\\"\\\"\"",
")",
".",
"newLine",
"(",
")",
";",
"//$NON-NLS-1$",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Generate a Python docstring with the given comment.
@param comment the comment.
@param it the receiver of the docstring.
@return {@code true} if the docstring is added, {@code false} otherwise. | [
"Generate",
"a",
"Python",
"docstring",
"with",
"the",
"given",
"comment",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L288-L301 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.