repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByOtherPhone | public Iterable<DContact> queryByOtherPhone(Object parent, java.lang.String otherPhone) {
return queryByField(parent, DContactMapper.Field.OTHERPHONE.getFieldName(), otherPhone);
} | java | public Iterable<DContact> queryByOtherPhone(Object parent, java.lang.String otherPhone) {
return queryByField(parent, DContactMapper.Field.OTHERPHONE.getFieldName(), otherPhone);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByOtherPhone",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"otherPhone",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"OTHERPHONE",
".",
"... | query-by method for field otherPhone
@param otherPhone the specified attribute
@return an Iterable of DContacts for the specified otherPhone | [
"query",
"-",
"by",
"method",
"for",
"field",
"otherPhone"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L241-L243 |
biojava/biojava | biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java | JmolSymmetryScriptGeneratorH.drawAxes | @Override
public String drawAxes() {
StringBuilder s = new StringBuilder();
// Point3d centroid = helixAxisAligner.getCentroid();
// System.out.println("Centroid: " + helixAxisAligner.getCentroid());
// Point3d centroid = helixAxisAligner.getGeometricCenter();
Point3d centroid = helixAxisAligner.calcCenterOfRotation();
// System.out.println("Geometric center: " + centroid);
AxisAngle4d axisAngle = helixAxisAligner.getHelixLayers().getByLowestAngle().getAxisAngle();
Vector3d axis = new Vector3d(axisAngle.x, axisAngle.y, axisAngle.z);
s.append("draw axesHelical");
s.append(name);
s.append(0);
s.append(" ");
s.append("line");
Point3d v1 = new Point3d(axis);
v1.scale(AXIS_SCALE_FACTOR*(helixAxisAligner.getDimension().y + SIDE_CHAIN_EXTENSION));
Point3d v2 = new Point3d(v1);
v2.negate();
v1.add(centroid);
v2.add(centroid);
s.append(getJmolPoint(v1));
s.append(getJmolPoint(v2));
s.append("width 1.0 ");
s.append(" color red");
s.append(" off;");
return s.toString();
} | java | @Override
public String drawAxes() {
StringBuilder s = new StringBuilder();
// Point3d centroid = helixAxisAligner.getCentroid();
// System.out.println("Centroid: " + helixAxisAligner.getCentroid());
// Point3d centroid = helixAxisAligner.getGeometricCenter();
Point3d centroid = helixAxisAligner.calcCenterOfRotation();
// System.out.println("Geometric center: " + centroid);
AxisAngle4d axisAngle = helixAxisAligner.getHelixLayers().getByLowestAngle().getAxisAngle();
Vector3d axis = new Vector3d(axisAngle.x, axisAngle.y, axisAngle.z);
s.append("draw axesHelical");
s.append(name);
s.append(0);
s.append(" ");
s.append("line");
Point3d v1 = new Point3d(axis);
v1.scale(AXIS_SCALE_FACTOR*(helixAxisAligner.getDimension().y + SIDE_CHAIN_EXTENSION));
Point3d v2 = new Point3d(v1);
v2.negate();
v1.add(centroid);
v2.add(centroid);
s.append(getJmolPoint(v1));
s.append(getJmolPoint(v2));
s.append("width 1.0 ");
s.append(" color red");
s.append(" off;");
return s.toString();
} | [
"@",
"Override",
"public",
"String",
"drawAxes",
"(",
")",
"{",
"StringBuilder",
"s",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"//\t\tPoint3d centroid = helixAxisAligner.getCentroid();",
"//\t\tSystem.out.println(\"Centroid: \" + helixAxisAligner.getCentroid());",
"//\t\tPoint... | Returns a Jmol script that draws symmetry or inertia axes for a structure.
Use showAxes() and hideAxes() to toggle visibility.
@return Jmol script | [
"Returns",
"a",
"Jmol",
"script",
"that",
"draws",
"symmetry",
"or",
"inertia",
"axes",
"for",
"a",
"structure",
".",
"Use",
"showAxes",
"()",
"and",
"hideAxes",
"()",
"to",
"toggle",
"visibility",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java#L313-L341 |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java | MemcachedNodesManager.setNodeAvailable | public void setNodeAvailable(@Nullable final String nodeId, final boolean available) {
if ( _nodeIdService != null ) {
_nodeIdService.setNodeAvailable(nodeId, available);
}
} | java | public void setNodeAvailable(@Nullable final String nodeId, final boolean available) {
if ( _nodeIdService != null ) {
_nodeIdService.setNodeAvailable(nodeId, available);
}
} | [
"public",
"void",
"setNodeAvailable",
"(",
"@",
"Nullable",
"final",
"String",
"nodeId",
",",
"final",
"boolean",
"available",
")",
"{",
"if",
"(",
"_nodeIdService",
"!=",
"null",
")",
"{",
"_nodeIdService",
".",
"setNodeAvailable",
"(",
"nodeId",
",",
"availa... | Mark the given nodeId as available as specified.
@param nodeId the nodeId to update
@param available specifies if the node was abailable or not | [
"Mark",
"the",
"given",
"nodeId",
"as",
"available",
"as",
"specified",
"."
] | train | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java#L412-L416 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java | HBasePanel.printHtmlHeader | public void printHtmlHeader(PrintWriter out, ResourceBundle reg)
{
String strTitle = this.getProperty("title"); // Menu page
if ((strTitle == null) || (strTitle.length() == 0))
strTitle = ((BasePanel)this.getScreenField()).getTitle();
String strHTMLStart = reg.getString("htmlHeaderStart");
String strHTMLEnd = reg.getString("htmlHeaderEnd");
// Note: don't free the reg key (DBServlet will)
this.printHtmlHeader(out, strTitle, strHTMLStart, strHTMLEnd);
} | java | public void printHtmlHeader(PrintWriter out, ResourceBundle reg)
{
String strTitle = this.getProperty("title"); // Menu page
if ((strTitle == null) || (strTitle.length() == 0))
strTitle = ((BasePanel)this.getScreenField()).getTitle();
String strHTMLStart = reg.getString("htmlHeaderStart");
String strHTMLEnd = reg.getString("htmlHeaderEnd");
// Note: don't free the reg key (DBServlet will)
this.printHtmlHeader(out, strTitle, strHTMLStart, strHTMLEnd);
} | [
"public",
"void",
"printHtmlHeader",
"(",
"PrintWriter",
"out",
",",
"ResourceBundle",
"reg",
")",
"{",
"String",
"strTitle",
"=",
"this",
".",
"getProperty",
"(",
"\"title\"",
")",
";",
"// Menu page",
"if",
"(",
"(",
"strTitle",
"==",
"null",
")",
"||",
... | Form Header.
@param out The html out stream.
@param reg The resources object. | [
"Form",
"Header",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L449-L458 |
Impetus/Kundera | src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateUtils.java | HibernateUtils.getProperties | static final Properties getProperties(final KunderaMetadata kunderaMetadata, final String persistenceUnit)
{
PersistenceUnitMetadata persistenceUnitMetadatata = kunderaMetadata.getApplicationMetadata()
.getPersistenceUnitMetadata(persistenceUnit);
Properties props = persistenceUnitMetadatata.getProperties();
return props;
} | java | static final Properties getProperties(final KunderaMetadata kunderaMetadata, final String persistenceUnit)
{
PersistenceUnitMetadata persistenceUnitMetadatata = kunderaMetadata.getApplicationMetadata()
.getPersistenceUnitMetadata(persistenceUnit);
Properties props = persistenceUnitMetadatata.getProperties();
return props;
} | [
"static",
"final",
"Properties",
"getProperties",
"(",
"final",
"KunderaMetadata",
"kunderaMetadata",
",",
"final",
"String",
"persistenceUnit",
")",
"{",
"PersistenceUnitMetadata",
"persistenceUnitMetadatata",
"=",
"kunderaMetadata",
".",
"getApplicationMetadata",
"(",
")"... | Gets the properties.
@param persistenceUnit
the persistence unit
@return the properties | [
"Gets",
"the",
"properties",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateUtils.java#L61-L67 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java | BaseRecordOwner.setProperty | public void setProperty(String strProperty, String strValue)
{
if (this.getParentRecordOwner() != null)
this.getParentRecordOwner().setProperty(strProperty, strValue);
} | java | public void setProperty(String strProperty, String strValue)
{
if (this.getParentRecordOwner() != null)
this.getParentRecordOwner().setProperty(strProperty, strValue);
} | [
"public",
"void",
"setProperty",
"(",
"String",
"strProperty",
",",
"String",
"strValue",
")",
"{",
"if",
"(",
"this",
".",
"getParentRecordOwner",
"(",
")",
"!=",
"null",
")",
"this",
".",
"getParentRecordOwner",
"(",
")",
".",
"setProperty",
"(",
"strPrope... | Set this property.
@param strProperty The property key.
@param strValue The property value.
Override this to do something. | [
"Set",
"this",
"property",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java#L353-L357 |
ardoq/ardoq-java-client | src/main/java/com/ardoq/util/SyncUtil.java | SyncUtil.getTagByName | public Tag getTagByName(String name) {
Tag t = this.tags.get(name);
if (null == t) {
t = new Tag(name, this.workspace.getId(), "");
this.tags.put(name, t);
}
return t;
} | java | public Tag getTagByName(String name) {
Tag t = this.tags.get(name);
if (null == t) {
t = new Tag(name, this.workspace.getId(), "");
this.tags.put(name, t);
}
return t;
} | [
"public",
"Tag",
"getTagByName",
"(",
"String",
"name",
")",
"{",
"Tag",
"t",
"=",
"this",
".",
"tags",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"null",
"==",
"t",
")",
"{",
"t",
"=",
"new",
"Tag",
"(",
"name",
",",
"this",
".",
"workspace... | Gets an existing tag by name
@param name Name of the tag
@return Returns the tag | [
"Gets",
"an",
"existing",
"tag",
"by",
"name"
] | train | https://github.com/ardoq/ardoq-java-client/blob/03731c3df864d850ef41b252364a104376dde983/src/main/java/com/ardoq/util/SyncUtil.java#L145-L152 |
m9aertner/PBKDF2 | src/main/java/de/rtner/security/auth/spi/PBKDF2Engine.java | PBKDF2Engine.INT | protected void INT(byte[] dest, int offset, int i)
{
dest[offset + 0] = (byte) (i / (256 * 256 * 256));
dest[offset + 1] = (byte) (i / (256 * 256));
dest[offset + 2] = (byte) (i / (256));
dest[offset + 3] = (byte) (i);
} | java | protected void INT(byte[] dest, int offset, int i)
{
dest[offset + 0] = (byte) (i / (256 * 256 * 256));
dest[offset + 1] = (byte) (i / (256 * 256));
dest[offset + 2] = (byte) (i / (256));
dest[offset + 3] = (byte) (i);
} | [
"protected",
"void",
"INT",
"(",
"byte",
"[",
"]",
"dest",
",",
"int",
"offset",
",",
"int",
"i",
")",
"{",
"dest",
"[",
"offset",
"+",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"i",
"/",
"(",
"256",
"*",
"256",
"*",
"256",
")",
")",
";",
"dest... | Four-octet encoding of the integer i, most significant octet first.
@see <a href="http://tools.ietf.org/html/rfc2898">RFC 2898 5.2 Step 3.</a>
@param dest destination byte buffer
@param offset zero-based offset into dest
@param i the integer to encode | [
"Four",
"-",
"octet",
"encoding",
"of",
"the",
"integer",
"i",
"most",
"significant",
"octet",
"first",
"."
] | train | https://github.com/m9aertner/PBKDF2/blob/b84511bb78848106c0f778136d9f01870c957722/src/main/java/de/rtner/security/auth/spi/PBKDF2Engine.java#L309-L315 |
haifengl/smile | core/src/main/java/smile/clustering/BBDTree.java | BBDTree.clustering | public double clustering(double[][] centroids, double[][] sums, int[] counts, int[] membership) {
int k = centroids.length;
Arrays.fill(counts, 0);
int[] candidates = new int[k];
for (int i = 0; i < k; i++) {
candidates[i] = i;
Arrays.fill(sums[i], 0.0);
}
return filter(root, centroids, candidates, k, sums, counts, membership);
} | java | public double clustering(double[][] centroids, double[][] sums, int[] counts, int[] membership) {
int k = centroids.length;
Arrays.fill(counts, 0);
int[] candidates = new int[k];
for (int i = 0; i < k; i++) {
candidates[i] = i;
Arrays.fill(sums[i], 0.0);
}
return filter(root, centroids, candidates, k, sums, counts, membership);
} | [
"public",
"double",
"clustering",
"(",
"double",
"[",
"]",
"[",
"]",
"centroids",
",",
"double",
"[",
"]",
"[",
"]",
"sums",
",",
"int",
"[",
"]",
"counts",
",",
"int",
"[",
"]",
"membership",
")",
"{",
"int",
"k",
"=",
"centroids",
".",
"length",
... | Given k cluster centroids, this method assigns data to nearest centroids.
The return value is the distortion to the centroids. The parameter sums
will hold the sum of data for each cluster. The parameter counts hold
the number of data of each cluster. If membership is
not null, it should be an array of size n that will be filled with the
index of the cluster [0 - k) that each data point is assigned to. | [
"Given",
"k",
"cluster",
"centroids",
"this",
"method",
"assigns",
"data",
"to",
"nearest",
"centroids",
".",
"The",
"return",
"value",
"is",
"the",
"distortion",
"to",
"the",
"centroids",
".",
"The",
"parameter",
"sums",
"will",
"hold",
"the",
"sum",
"of",
... | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/clustering/BBDTree.java#L259-L270 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/index/IndexAVL.java | IndexAVL.firstRow | @Override
public RowIterator firstRow(Session session, PersistentStore store) {
int tempDepth = 0;
readLock.lock();
try {
NodeAVL x = getAccessor(store);
NodeAVL l = x;
while (l != null) {
x = l;
l = x.getLeft(store);
tempDepth++;
}
while (session != null && x != null) {
Row row = x.getRow(store);
if (session.database.txManager.canRead(session, row)) {
break;
}
x = next(store, x);
}
return getIterator(session, store, x);
} finally {
depth = tempDepth;
readLock.unlock();
}
} | java | @Override
public RowIterator firstRow(Session session, PersistentStore store) {
int tempDepth = 0;
readLock.lock();
try {
NodeAVL x = getAccessor(store);
NodeAVL l = x;
while (l != null) {
x = l;
l = x.getLeft(store);
tempDepth++;
}
while (session != null && x != null) {
Row row = x.getRow(store);
if (session.database.txManager.canRead(session, row)) {
break;
}
x = next(store, x);
}
return getIterator(session, store, x);
} finally {
depth = tempDepth;
readLock.unlock();
}
} | [
"@",
"Override",
"public",
"RowIterator",
"firstRow",
"(",
"Session",
"session",
",",
"PersistentStore",
"store",
")",
"{",
"int",
"tempDepth",
"=",
"0",
";",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"NodeAVL",
"x",
"=",
"getAccessor",
"(",
"s... | Returns the row for the first node of the index
@return Iterator for first row | [
"Returns",
"the",
"row",
"for",
"the",
"first",
"node",
"of",
"the",
"index"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/index/IndexAVL.java#L1049-L1083 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/dynamic/JarXtractor.java | JarXtractor.startsWith | private static boolean startsWith(String str, String... prefixes) {
for (String prefix : prefixes) {
if (str.startsWith(prefix)) return true;
}
return false;
} | java | private static boolean startsWith(String str, String... prefixes) {
for (String prefix : prefixes) {
if (str.startsWith(prefix)) return true;
}
return false;
} | [
"private",
"static",
"boolean",
"startsWith",
"(",
"String",
"str",
",",
"String",
"...",
"prefixes",
")",
"{",
"for",
"(",
"String",
"prefix",
":",
"prefixes",
")",
"{",
"if",
"(",
"str",
".",
"startsWith",
"(",
"prefix",
")",
")",
"return",
"true",
"... | Checks if the given string starts with any of the given prefixes.
@param str
String to check for prefix.
@param prefixes
Potential prefixes of the string.
@return True if the string starts with any of the prefixes. | [
"Checks",
"if",
"the",
"given",
"string",
"starts",
"with",
"any",
"of",
"the",
"given",
"prefixes",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/dynamic/JarXtractor.java#L99-L104 |
OpenTSDB/opentsdb | src/query/QueryUtil.java | QueryUtil.getRowKeyUIDRegex | public static String getRowKeyUIDRegex(final List<byte[]> group_bys,
final ByteMap<byte[][]> row_key_literals) {
return getRowKeyUIDRegex(group_bys, row_key_literals, false, null, null);
} | java | public static String getRowKeyUIDRegex(final List<byte[]> group_bys,
final ByteMap<byte[][]> row_key_literals) {
return getRowKeyUIDRegex(group_bys, row_key_literals, false, null, null);
} | [
"public",
"static",
"String",
"getRowKeyUIDRegex",
"(",
"final",
"List",
"<",
"byte",
"[",
"]",
">",
"group_bys",
",",
"final",
"ByteMap",
"<",
"byte",
"[",
"]",
"[",
"]",
">",
"row_key_literals",
")",
"{",
"return",
"getRowKeyUIDRegex",
"(",
"group_bys",
... | Crafts a regular expression for scanning over data table rows and filtering
time series that the user doesn't want. At least one of the parameters
must be set and have values.
NOTE: This method will sort the group bys.
@param group_bys An optional list of tag keys that we want to group on. May
be null.
@param row_key_literals An optional list of key value pairs to filter on.
May be null.
@return A regular expression string to pass to the storage layer. | [
"Crafts",
"a",
"regular",
"expression",
"for",
"scanning",
"over",
"data",
"table",
"rows",
"and",
"filtering",
"time",
"series",
"that",
"the",
"user",
"doesn",
"t",
"want",
".",
"At",
"least",
"one",
"of",
"the",
"parameters",
"must",
"be",
"set",
"and",... | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/QueryUtil.java#L57-L60 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/parse/dep/ProjectiveDependencyParser.java | ProjectiveDependencyParser.parseSingleRoot | public static double parseSingleRoot(double[] fracRoot, double[][] fracChild, int[] parents) {
assert (parents.length == fracRoot.length);
assert (fracChild.length == fracRoot.length);
final int n = parents.length;
final ProjTreeChart c = new ProjTreeChart(n+1, DepParseType.VITERBI);
insideAlgorithm(EdgeScores.combine(fracRoot, fracChild), c, true);
// Trace the backpointers to extract the parents.
Arrays.fill(parents, -2);
// Get the head of the sentence.
int head = c.getBp(0, n, RIGHT, COMPLETE);
parents[head-1] = -1; // The wall (-1) is its parent.
// Extract parents left of the head.
extractParentsComp(1, head, LEFT, c, parents);
// Extract parents right of the head.
extractParentsComp(head, n, RIGHT, c, parents);
return c.getScore(0, n, RIGHT, COMPLETE);
} | java | public static double parseSingleRoot(double[] fracRoot, double[][] fracChild, int[] parents) {
assert (parents.length == fracRoot.length);
assert (fracChild.length == fracRoot.length);
final int n = parents.length;
final ProjTreeChart c = new ProjTreeChart(n+1, DepParseType.VITERBI);
insideAlgorithm(EdgeScores.combine(fracRoot, fracChild), c, true);
// Trace the backpointers to extract the parents.
Arrays.fill(parents, -2);
// Get the head of the sentence.
int head = c.getBp(0, n, RIGHT, COMPLETE);
parents[head-1] = -1; // The wall (-1) is its parent.
// Extract parents left of the head.
extractParentsComp(1, head, LEFT, c, parents);
// Extract parents right of the head.
extractParentsComp(head, n, RIGHT, c, parents);
return c.getScore(0, n, RIGHT, COMPLETE);
} | [
"public",
"static",
"double",
"parseSingleRoot",
"(",
"double",
"[",
"]",
"fracRoot",
",",
"double",
"[",
"]",
"[",
"]",
"fracChild",
",",
"int",
"[",
"]",
"parents",
")",
"{",
"assert",
"(",
"parents",
".",
"length",
"==",
"fracRoot",
".",
"length",
"... | This gives the maximum projective dependency tree using the algorithm of
(Eisner, 2000) as described in McDonald (2006). In the resulting tree,
the wall node (denoted as the parent -1) will be the root, and will have
exactly one child.
@param fracRoot Input: The edge weights from the wall to each child.
@param fracChild Input: The edge weights from parent to child.
@param parents Output: The parent index of each node or -1 if its parent
is the wall node.
@return The score of the parse. | [
"This",
"gives",
"the",
"maximum",
"projective",
"dependency",
"tree",
"using",
"the",
"algorithm",
"of",
"(",
"Eisner",
"2000",
")",
"as",
"described",
"in",
"McDonald",
"(",
"2006",
")",
".",
"In",
"the",
"resulting",
"tree",
"the",
"wall",
"node",
"(",
... | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/ProjectiveDependencyParser.java#L57-L76 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java | Visualizer.drawPixels | private void drawPixels(Color color, long fileOffset, long length) {
assert color != null;
drawPixels(color, fileOffset, length, 0);
} | java | private void drawPixels(Color color, long fileOffset, long length) {
assert color != null;
drawPixels(color, fileOffset, length, 0);
} | [
"private",
"void",
"drawPixels",
"(",
"Color",
"color",
",",
"long",
"fileOffset",
",",
"long",
"length",
")",
"{",
"assert",
"color",
"!=",
"null",
";",
"drawPixels",
"(",
"color",
",",
"fileOffset",
",",
"length",
",",
"0",
")",
";",
"}"
] | Draws a square pixels at fileOffset with color. Height and width of the
drawn area are based on the number of bytes that it represents given by
the length.
Square pixels are drawn without visible gap.
@param color
of the square pixels
@param fileOffset
file location that the square pixels represent
@param length
number of bytes that are colored by the square pixels. | [
"Draws",
"a",
"square",
"pixels",
"at",
"fileOffset",
"with",
"color",
".",
"Height",
"and",
"width",
"of",
"the",
"drawn",
"area",
"are",
"based",
"on",
"the",
"number",
"of",
"bytes",
"that",
"it",
"represents",
"given",
"by",
"the",
"length",
"."
] | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/tools/visualizer/Visualizer.java#L935-L938 |
pwall567/jsonutil | src/main/java/net/pwall/json/JSON.java | JSON.parseArray | public static JSONArray parseArray(InputStream is, String csName) throws IOException {
return (JSONArray)parse(is, csName);
} | java | public static JSONArray parseArray(InputStream is, String csName) throws IOException {
return (JSONArray)parse(is, csName);
} | [
"public",
"static",
"JSONArray",
"parseArray",
"(",
"InputStream",
"is",
",",
"String",
"csName",
")",
"throws",
"IOException",
"{",
"return",
"(",
"JSONArray",
")",
"parse",
"(",
"is",
",",
"csName",
")",
";",
"}"
] | Parse a sequence of characters from an {@link InputStream} as a JSON array, specifying
the character set by name.
@param is the {@link InputStream}
@param csName the character set name
@return the JSON array
@throws JSONException if the stream does not contain a valid JSON value
@throws IOException on any I/O errors
@throws ClassCastException if the value is not an array | [
"Parse",
"a",
"sequence",
"of",
"characters",
"from",
"an",
"{",
"@link",
"InputStream",
"}",
"as",
"a",
"JSON",
"array",
"specifying",
"the",
"character",
"set",
"by",
"name",
"."
] | train | https://github.com/pwall567/jsonutil/blob/dd5960b9b0bcc9acfe6c52b884fffd9ee5f422fe/src/main/java/net/pwall/json/JSON.java#L423-L425 |
alibaba/Tangram-Android | tangram/src/main/java/com/tmall/wireless/tangram3/BaseTangramEngine.java | BaseTangramEngine.insertData | @Deprecated
public void insertData(int position, @Nullable List<Card> data) {
Preconditions.checkState(mGroupBasicAdapter != null, "Must call bindView() first");
this.mGroupBasicAdapter.insertGroup(position, data);
} | java | @Deprecated
public void insertData(int position, @Nullable List<Card> data) {
Preconditions.checkState(mGroupBasicAdapter != null, "Must call bindView() first");
this.mGroupBasicAdapter.insertGroup(position, data);
} | [
"@",
"Deprecated",
"public",
"void",
"insertData",
"(",
"int",
"position",
",",
"@",
"Nullable",
"List",
"<",
"Card",
">",
"data",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"mGroupBasicAdapter",
"!=",
"null",
",",
"\"Must call bindView() first\"",
")",
... | Insert parsed data to Tangram at target position. It cause full screen item's rebinding, be careful.
@param position Target insert position.
@param data Parsed data list. | [
"Insert",
"parsed",
"data",
"to",
"Tangram",
"at",
"target",
"position",
".",
"It",
"cause",
"full",
"screen",
"item",
"s",
"rebinding",
"be",
"careful",
"."
] | train | https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram3/BaseTangramEngine.java#L337-L341 |
pietermartin/sqlg | sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java | TopologyManager.updateGraph | public static String updateGraph(SqlgGraph sqlgGraph, String version) {
Connection conn = sqlgGraph.tx().getConnection();
try {
DatabaseMetaData metadata = conn.getMetaData();
GraphTraversalSource traversalSource = sqlgGraph.topology();
List<Vertex> graphVertices = traversalSource.V().hasLabel(SQLG_SCHEMA + "." + Topology.SQLG_SCHEMA_GRAPH).toList();
Preconditions.checkState(graphVertices.size() == 1, "BUG: There can only ever be one graph vertex, found %s", graphVertices.size());
Vertex graph = graphVertices.get(0);
String oldVersion = graph.value(SQLG_SCHEMA_GRAPH_VERSION);
if (!oldVersion.equals(version)) {
graph.property(SQLG_SCHEMA_GRAPH_VERSION, version);
graph.property(SQLG_SCHEMA_GRAPH_DB_VERSION, metadata.getDatabaseProductVersion());
graph.property(UPDATED_ON, LocalDateTime.now());
}
return oldVersion;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static String updateGraph(SqlgGraph sqlgGraph, String version) {
Connection conn = sqlgGraph.tx().getConnection();
try {
DatabaseMetaData metadata = conn.getMetaData();
GraphTraversalSource traversalSource = sqlgGraph.topology();
List<Vertex> graphVertices = traversalSource.V().hasLabel(SQLG_SCHEMA + "." + Topology.SQLG_SCHEMA_GRAPH).toList();
Preconditions.checkState(graphVertices.size() == 1, "BUG: There can only ever be one graph vertex, found %s", graphVertices.size());
Vertex graph = graphVertices.get(0);
String oldVersion = graph.value(SQLG_SCHEMA_GRAPH_VERSION);
if (!oldVersion.equals(version)) {
graph.property(SQLG_SCHEMA_GRAPH_VERSION, version);
graph.property(SQLG_SCHEMA_GRAPH_DB_VERSION, metadata.getDatabaseProductVersion());
graph.property(UPDATED_ON, LocalDateTime.now());
}
return oldVersion;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"String",
"updateGraph",
"(",
"SqlgGraph",
"sqlgGraph",
",",
"String",
"version",
")",
"{",
"Connection",
"conn",
"=",
"sqlgGraph",
".",
"tx",
"(",
")",
".",
"getConnection",
"(",
")",
";",
"try",
"{",
"DatabaseMetaData",
"metadata",
"=",... | Updates sqlg_schema.V_graph's version to the new version and returns the old version.
@param sqlgGraph The graph.
@param version The new version.
@return The old version. | [
"Updates",
"sqlg_schema",
".",
"V_graph",
"s",
"version",
"to",
"the",
"new",
"version",
"and",
"returns",
"the",
"old",
"version",
"."
] | train | https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java#L58-L76 |
gitblit/fathom | fathom-x509/src/main/java/fathom/x509/X509Utils.java | X509Utils.getCertificate | public static X509Certificate getCertificate(String alias, File storeFile, String storePassword) {
try {
KeyStore store = openKeyStore(storeFile, storePassword);
X509Certificate caCert = (X509Certificate) store.getCertificate(alias);
return caCert;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static X509Certificate getCertificate(String alias, File storeFile, String storePassword) {
try {
KeyStore store = openKeyStore(storeFile, storePassword);
X509Certificate caCert = (X509Certificate) store.getCertificate(alias);
return caCert;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"X509Certificate",
"getCertificate",
"(",
"String",
"alias",
",",
"File",
"storeFile",
",",
"String",
"storePassword",
")",
"{",
"try",
"{",
"KeyStore",
"store",
"=",
"openKeyStore",
"(",
"storeFile",
",",
"storePassword",
")",
";",
"X509Cert... | Retrieves the X509 certificate with the specified alias from the certificate
store.
@param alias
@param storeFile
@param storePassword
@return the certificate | [
"Retrieves",
"the",
"X509",
"certificate",
"with",
"the",
"specified",
"alias",
"from",
"the",
"certificate",
"store",
"."
] | train | https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-x509/src/main/java/fathom/x509/X509Utils.java#L396-L404 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/PairwiseImageMatching.java | PairwiseImageMatching.addImage | public void addImage(T image , String cameraName ) {
PairwiseImageGraph.View view = new PairwiseImageGraph.View(graph.nodes.size(),
new FastQueue<TupleDesc>(TupleDesc.class,true) {
@Override
protected TupleDesc createInstance() {
return detDesc.createDescription();
}
});
view.camera = graph.cameras.get(cameraName);
if( view.camera == null )
throw new IllegalArgumentException("Must have added the camera first");
view.index = graph.nodes.size();
graph.nodes.add(view);
detDesc.detect(image);
// Pre-declare memory
view.descriptions.growArray(detDesc.getNumberOfFeatures());
view.observationPixels.growArray(detDesc.getNumberOfFeatures());
for (int i = 0; i < detDesc.getNumberOfFeatures(); i++) {
Point2D_F64 p = detDesc.getLocation(i);
// save copies since detDesc recycles memory
view.descriptions.grow().setTo(detDesc.getDescription(i));
view.observationPixels.grow().set(p);
}
if( view.camera.pixelToNorm == null ){
return;
}
view.observationNorm.growArray(detDesc.getNumberOfFeatures());
for (int i = 0; i < view.observationPixels.size; i++) {
Point2D_F64 p = view.observationPixels.get(i);
view.camera.pixelToNorm.compute(p.x,p.y,view.observationNorm.grow());
}
if( verbose != null ) {
verbose.println("Detected Features: "+detDesc.getNumberOfFeatures());
}
} | java | public void addImage(T image , String cameraName ) {
PairwiseImageGraph.View view = new PairwiseImageGraph.View(graph.nodes.size(),
new FastQueue<TupleDesc>(TupleDesc.class,true) {
@Override
protected TupleDesc createInstance() {
return detDesc.createDescription();
}
});
view.camera = graph.cameras.get(cameraName);
if( view.camera == null )
throw new IllegalArgumentException("Must have added the camera first");
view.index = graph.nodes.size();
graph.nodes.add(view);
detDesc.detect(image);
// Pre-declare memory
view.descriptions.growArray(detDesc.getNumberOfFeatures());
view.observationPixels.growArray(detDesc.getNumberOfFeatures());
for (int i = 0; i < detDesc.getNumberOfFeatures(); i++) {
Point2D_F64 p = detDesc.getLocation(i);
// save copies since detDesc recycles memory
view.descriptions.grow().setTo(detDesc.getDescription(i));
view.observationPixels.grow().set(p);
}
if( view.camera.pixelToNorm == null ){
return;
}
view.observationNorm.growArray(detDesc.getNumberOfFeatures());
for (int i = 0; i < view.observationPixels.size; i++) {
Point2D_F64 p = view.observationPixels.get(i);
view.camera.pixelToNorm.compute(p.x,p.y,view.observationNorm.grow());
}
if( verbose != null ) {
verbose.println("Detected Features: "+detDesc.getNumberOfFeatures());
}
} | [
"public",
"void",
"addImage",
"(",
"T",
"image",
",",
"String",
"cameraName",
")",
"{",
"PairwiseImageGraph",
".",
"View",
"view",
"=",
"new",
"PairwiseImageGraph",
".",
"View",
"(",
"graph",
".",
"nodes",
".",
"size",
"(",
")",
",",
"new",
"FastQueue",
... | Adds a new observation from a camera. Detects features inside the and saves those.
@param image The image | [
"Adds",
"a",
"new",
"observation",
"from",
"a",
"camera",
".",
"Detects",
"features",
"inside",
"the",
"and",
"saves",
"those",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/PairwiseImageMatching.java#L118-L162 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/builder/AbstractProcessorBuilder.java | AbstractProcessorBuilder.registerForConversion | public <A extends Annotation> void registerForConversion(final Class<A> anno, final ConversionProcessorFactory<A> factory) {
this.conversionHandler.register(anno, factory);
} | java | public <A extends Annotation> void registerForConversion(final Class<A> anno, final ConversionProcessorFactory<A> factory) {
this.conversionHandler.register(anno, factory);
} | [
"public",
"<",
"A",
"extends",
"Annotation",
">",
"void",
"registerForConversion",
"(",
"final",
"Class",
"<",
"A",
">",
"anno",
",",
"final",
"ConversionProcessorFactory",
"<",
"A",
">",
"factory",
")",
"{",
"this",
".",
"conversionHandler",
".",
"register",
... | 変換のCellProcessorを作成するクラスを登録する。読み込み時と書き込み時は共通です。
@param <A> アノテーションのクラス
@param anno 関連づけるアノテーション
@param factory アノテーションを処理する{@link ConversionProcessorFactory}の実装。 | [
"変換のCellProcessorを作成するクラスを登録する。読み込み時と書き込み時は共通です。"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/AbstractProcessorBuilder.java#L204-L206 |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/StringUtil.java | StringUtil.wrapLine | private static String wrapLine(final String givenLine, final String newline, final int wrapColumn) {
final StringBuilder wrappedLine = new StringBuilder();
String line = givenLine;
while (line.length() > wrapColumn) {
int spaceToWrapAt = line.lastIndexOf(' ', wrapColumn);
if (spaceToWrapAt >= 0) {
wrappedLine.append(line.substring(0, spaceToWrapAt));
wrappedLine.append(newline);
line = line.substring(spaceToWrapAt + 1);
} else {
// This must be a really long word or URL. Pass it
// through unchanged even though it's longer than the
// wrapColumn would allow. This behavior could be
// dependent on a parameter for those situations when
// someone wants long words broken at line length.
spaceToWrapAt = line.indexOf(' ', wrapColumn);
if (spaceToWrapAt >= 0) {
wrappedLine.append(line.substring(0, spaceToWrapAt));
wrappedLine.append(newline);
line = line.substring(spaceToWrapAt + 1);
} else {
wrappedLine.append(line);
line = "";
}
}
}
// Whatever is left in line is short enough to just pass through,
// just like a small small kidney stone
wrappedLine.append(line);
return wrappedLine.toString();
} | java | private static String wrapLine(final String givenLine, final String newline, final int wrapColumn) {
final StringBuilder wrappedLine = new StringBuilder();
String line = givenLine;
while (line.length() > wrapColumn) {
int spaceToWrapAt = line.lastIndexOf(' ', wrapColumn);
if (spaceToWrapAt >= 0) {
wrappedLine.append(line.substring(0, spaceToWrapAt));
wrappedLine.append(newline);
line = line.substring(spaceToWrapAt + 1);
} else {
// This must be a really long word or URL. Pass it
// through unchanged even though it's longer than the
// wrapColumn would allow. This behavior could be
// dependent on a parameter for those situations when
// someone wants long words broken at line length.
spaceToWrapAt = line.indexOf(' ', wrapColumn);
if (spaceToWrapAt >= 0) {
wrappedLine.append(line.substring(0, spaceToWrapAt));
wrappedLine.append(newline);
line = line.substring(spaceToWrapAt + 1);
} else {
wrappedLine.append(line);
line = "";
}
}
}
// Whatever is left in line is short enough to just pass through,
// just like a small small kidney stone
wrappedLine.append(line);
return wrappedLine.toString();
} | [
"private",
"static",
"String",
"wrapLine",
"(",
"final",
"String",
"givenLine",
",",
"final",
"String",
"newline",
",",
"final",
"int",
"wrapColumn",
")",
"{",
"final",
"StringBuilder",
"wrappedLine",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"line... | Wraps a single line of text. Called by wrapText(). I can't
think of any good reason for exposing this to the public,
since wrapText should always be used AFAIK.
@param line A line which is in need of word-wrapping.
@param newline The characters that define a newline.
@param wrapColumn The column to wrap the words at.
@return A line with newlines inserted. | [
"Wraps",
"a",
"single",
"line",
"of",
"text",
".",
"Called",
"by",
"wrapText",
"()",
".",
"I",
"can",
"t",
"think",
"of",
"any",
"good",
"reason",
"for",
"exposing",
"this",
"to",
"the",
"public",
"since",
"wrapText",
"should",
"always",
"be",
"used",
... | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L220-L255 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/table/MListTable.java | MListTable.setList | public void setList(final List<T> newList) {
getListTableModel().setList(newList);
adjustColumnWidths();
// Réinitialise les hauteurs des lignes qui pourraient avoir été particularisées
// avec setRowHeight(row, rowHeight).
setRowHeight(getRowHeight());
// remarque perf: on pourrait parcourir les colonnes pour affecter des renderers aux colonnes n'en ayant pas selon getDefaultRenderer(getColumnClass(i))
// pour éliminer les appels à getDefaultRenderer pour chaque cellule
} | java | public void setList(final List<T> newList) {
getListTableModel().setList(newList);
adjustColumnWidths();
// Réinitialise les hauteurs des lignes qui pourraient avoir été particularisées
// avec setRowHeight(row, rowHeight).
setRowHeight(getRowHeight());
// remarque perf: on pourrait parcourir les colonnes pour affecter des renderers aux colonnes n'en ayant pas selon getDefaultRenderer(getColumnClass(i))
// pour éliminer les appels à getDefaultRenderer pour chaque cellule
} | [
"public",
"void",
"setList",
"(",
"final",
"List",
"<",
"T",
">",
"newList",
")",
"{",
"getListTableModel",
"(",
")",
".",
"setList",
"(",
"newList",
")",
";",
"adjustColumnWidths",
"(",
")",
";",
"// Réinitialise les hauteurs des lignes qui pourraient avoir été par... | Définit la valeur de la propriété list. <BR>
Cette méthode adaptent automatiquement les largeurs des colonnes selon les données.
@param newList
List
@see #getList | [
"Définit",
"la",
"valeur",
"de",
"la",
"propriété",
"list",
".",
"<BR",
">"
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/table/MListTable.java#L86-L97 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsADECache.java | CmsADECache.uncacheGroupContainer | public void uncacheGroupContainer(CmsUUID structureId, boolean online) {
try {
m_lock.writeLock().lock();
if (online) {
m_groupContainersOnline.remove(getCacheKey(structureId, true));
m_groupContainersOnline.remove(getCacheKey(structureId, false));
} else {
m_groupContainersOffline.remove(getCacheKey(structureId, true));
m_groupContainersOffline.remove(getCacheKey(structureId, false));
}
} finally {
m_lock.writeLock().unlock();
}
} | java | public void uncacheGroupContainer(CmsUUID structureId, boolean online) {
try {
m_lock.writeLock().lock();
if (online) {
m_groupContainersOnline.remove(getCacheKey(structureId, true));
m_groupContainersOnline.remove(getCacheKey(structureId, false));
} else {
m_groupContainersOffline.remove(getCacheKey(structureId, true));
m_groupContainersOffline.remove(getCacheKey(structureId, false));
}
} finally {
m_lock.writeLock().unlock();
}
} | [
"public",
"void",
"uncacheGroupContainer",
"(",
"CmsUUID",
"structureId",
",",
"boolean",
"online",
")",
"{",
"try",
"{",
"m_lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"if",
"(",
"online",
")",
"{",
"m_groupContainersOnline",
".",
"remo... | Removes the group container identified by its structure id from the cache.<p>
@param structureId the group container's structure id
@param online if online or offline | [
"Removes",
"the",
"group",
"container",
"identified",
"by",
"its",
"structure",
"id",
"from",
"the",
"cache",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADECache.java#L338-L352 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/MacroCycleLayout.java | MacroCycleLayout.selectCoords | private int selectCoords(Collection<Point2d[]> ps, Point2d[] coords, IRing macrocycle, IRingSet ringset) {
assert ps.size() != 0;
final int[] winding = new int[coords.length];
MacroScore best = null;
for (Point2d[] p : ps) {
final int wind = winding(p, winding);
MacroScore score = bestScore(macrocycle, ringset, wind, winding);
if (score.compareTo(best) < 0) {
best = score;
System.arraycopy(p, 0, coords, 0, p.length);
}
}
// never null
return best != null ? best.offset : 0;
} | java | private int selectCoords(Collection<Point2d[]> ps, Point2d[] coords, IRing macrocycle, IRingSet ringset) {
assert ps.size() != 0;
final int[] winding = new int[coords.length];
MacroScore best = null;
for (Point2d[] p : ps) {
final int wind = winding(p, winding);
MacroScore score = bestScore(macrocycle, ringset, wind, winding);
if (score.compareTo(best) < 0) {
best = score;
System.arraycopy(p, 0, coords, 0, p.length);
}
}
// never null
return best != null ? best.offset : 0;
} | [
"private",
"int",
"selectCoords",
"(",
"Collection",
"<",
"Point2d",
"[",
"]",
">",
"ps",
",",
"Point2d",
"[",
"]",
"coords",
",",
"IRing",
"macrocycle",
",",
"IRingSet",
"ringset",
")",
"{",
"assert",
"ps",
".",
"size",
"(",
")",
"!=",
"0",
";",
"fi... | Select the best coordinates
@param ps template points
@param coords best coordinates (updated by this method)
@param macrocycle the macrocycle
@param ringset rest of the ring system
@return offset into the coordinates | [
"Select",
"the",
"best",
"coordinates"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/MacroCycleLayout.java#L268-L284 |
census-instrumentation/opencensus-java | impl_core/src/main/java/io/opencensus/implcore/tags/propagation/CorrelationContextFormat.java | CorrelationContextFormat.decodeTag | private static void decodeTag(String stringTag, Map<TagKey, TagValueWithMetadata> tags) {
String keyWithValue;
int firstPropertyIndex = stringTag.indexOf(TAG_PROPERTIES_DELIMITER);
if (firstPropertyIndex != -1) { // Tag with properties.
keyWithValue = stringTag.substring(0, firstPropertyIndex);
// TODO(songya): support decoding tag properties.
} else { // Tag without properties.
keyWithValue = stringTag;
}
List<String> keyValuePair = TAG_KEY_VALUE_SPLITTER.splitToList(keyWithValue);
checkArgument(keyValuePair.size() == 2, "Malformed tag " + stringTag);
TagKey key = TagKey.create(keyValuePair.get(0).trim());
TagValue value = TagValue.create(keyValuePair.get(1).trim());
TagValueWithMetadata valueWithMetadata =
TagValueWithMetadata.create(value, METADATA_UNLIMITED_PROPAGATION);
tags.put(key, valueWithMetadata);
} | java | private static void decodeTag(String stringTag, Map<TagKey, TagValueWithMetadata> tags) {
String keyWithValue;
int firstPropertyIndex = stringTag.indexOf(TAG_PROPERTIES_DELIMITER);
if (firstPropertyIndex != -1) { // Tag with properties.
keyWithValue = stringTag.substring(0, firstPropertyIndex);
// TODO(songya): support decoding tag properties.
} else { // Tag without properties.
keyWithValue = stringTag;
}
List<String> keyValuePair = TAG_KEY_VALUE_SPLITTER.splitToList(keyWithValue);
checkArgument(keyValuePair.size() == 2, "Malformed tag " + stringTag);
TagKey key = TagKey.create(keyValuePair.get(0).trim());
TagValue value = TagValue.create(keyValuePair.get(1).trim());
TagValueWithMetadata valueWithMetadata =
TagValueWithMetadata.create(value, METADATA_UNLIMITED_PROPAGATION);
tags.put(key, valueWithMetadata);
} | [
"private",
"static",
"void",
"decodeTag",
"(",
"String",
"stringTag",
",",
"Map",
"<",
"TagKey",
",",
"TagValueWithMetadata",
">",
"tags",
")",
"{",
"String",
"keyWithValue",
";",
"int",
"firstPropertyIndex",
"=",
"stringTag",
".",
"indexOf",
"(",
"TAG_PROPERTIE... | The format of encoded string tag is name1=value1;properties1=p1;properties2=p2. | [
"The",
"format",
"of",
"encoded",
"string",
"tag",
"is",
"name1",
"=",
"value1",
";",
"properties1",
"=",
"p1",
";",
"properties2",
"=",
"p2",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/impl_core/src/main/java/io/opencensus/implcore/tags/propagation/CorrelationContextFormat.java#L171-L187 |
iipc/webarchive-commons | src/main/java/org/archive/util/DateUtils.java | DateUtils.padTo | public static String padTo(final int i, final int pad) {
String n = Integer.toString(i);
return padTo(n, pad);
} | java | public static String padTo(final int i, final int pad) {
String n = Integer.toString(i);
return padTo(n, pad);
} | [
"public",
"static",
"String",
"padTo",
"(",
"final",
"int",
"i",
",",
"final",
"int",
"pad",
")",
"{",
"String",
"n",
"=",
"Integer",
".",
"toString",
"(",
"i",
")",
";",
"return",
"padTo",
"(",
"n",
",",
"pad",
")",
";",
"}"
] | Convert an <code>int</code> to a <code>String</code>, and pad it to
<code>pad</code> spaces.
@param i the int
@param pad the width to pad to.
@return String w/ padding. | [
"Convert",
"an",
"<code",
">",
"int<",
"/",
"code",
">",
"to",
"a",
"<code",
">",
"String<",
"/",
"code",
">",
"and",
"pad",
"it",
"to",
"<code",
">",
"pad<",
"/",
"code",
">",
"spaces",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/DateUtils.java#L467-L470 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java | CommerceAddressRestrictionPersistenceImpl.removeByC_C | @Override
public void removeByC_C(long classNameId, long classPK) {
for (CommerceAddressRestriction commerceAddressRestriction : findByC_C(
classNameId, classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceAddressRestriction);
}
} | java | @Override
public void removeByC_C(long classNameId, long classPK) {
for (CommerceAddressRestriction commerceAddressRestriction : findByC_C(
classNameId, classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceAddressRestriction);
}
} | [
"@",
"Override",
"public",
"void",
"removeByC_C",
"(",
"long",
"classNameId",
",",
"long",
"classPK",
")",
"{",
"for",
"(",
"CommerceAddressRestriction",
"commerceAddressRestriction",
":",
"findByC_C",
"(",
"classNameId",
",",
"classPK",
",",
"QueryUtil",
".",
"AL... | Removes all the commerce address restrictions where classNameId = ? and classPK = ? from the database.
@param classNameId the class name ID
@param classPK the class pk | [
"Removes",
"all",
"the",
"commerce",
"address",
"restrictions",
"where",
"classNameId",
"=",
"?",
";",
"and",
"classPK",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java#L1113-L1119 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/TraceId.java | TraceId.fromBytes | public static TraceId fromBytes(byte[] src, int srcOffset) {
Utils.checkNotNull(src, "src");
return new TraceId(
BigendianEncoding.longFromByteArray(src, srcOffset),
BigendianEncoding.longFromByteArray(src, srcOffset + BigendianEncoding.LONG_BYTES));
} | java | public static TraceId fromBytes(byte[] src, int srcOffset) {
Utils.checkNotNull(src, "src");
return new TraceId(
BigendianEncoding.longFromByteArray(src, srcOffset),
BigendianEncoding.longFromByteArray(src, srcOffset + BigendianEncoding.LONG_BYTES));
} | [
"public",
"static",
"TraceId",
"fromBytes",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
")",
"{",
"Utils",
".",
"checkNotNull",
"(",
"src",
",",
"\"src\"",
")",
";",
"return",
"new",
"TraceId",
"(",
"BigendianEncoding",
".",
"longFromByteArray",
... | Returns a {@code TraceId} whose representation is copied from the {@code src} beginning at the
{@code srcOffset} offset.
@param src the buffer where the representation of the {@code TraceId} is copied.
@param srcOffset the offset in the buffer where the representation of the {@code TraceId}
begins.
@return a {@code TraceId} whose representation is copied from the buffer.
@throws NullPointerException if {@code src} is null.
@throws IndexOutOfBoundsException if {@code srcOffset+TraceId.SIZE} is greater than {@code
src.length}.
@since 0.5 | [
"Returns",
"a",
"{",
"@code",
"TraceId",
"}",
"whose",
"representation",
"is",
"copied",
"from",
"the",
"{",
"@code",
"src",
"}",
"beginning",
"at",
"the",
"{",
"@code",
"srcOffset",
"}",
"offset",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/TraceId.java#L87-L92 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/MenuUtil.java | MenuUtil.addMenuItem | public static JMenuItem addMenuItem (
JMenu menu, String name, Object target, String callbackName)
{
JMenuItem item = createItem(name, null, null);
item.addActionListener(new ReflectedAction(target, callbackName));
menu.add(item);
return item;
} | java | public static JMenuItem addMenuItem (
JMenu menu, String name, Object target, String callbackName)
{
JMenuItem item = createItem(name, null, null);
item.addActionListener(new ReflectedAction(target, callbackName));
menu.add(item);
return item;
} | [
"public",
"static",
"JMenuItem",
"addMenuItem",
"(",
"JMenu",
"menu",
",",
"String",
"name",
",",
"Object",
"target",
",",
"String",
"callbackName",
")",
"{",
"JMenuItem",
"item",
"=",
"createItem",
"(",
"name",
",",
"null",
",",
"null",
")",
";",
"item",
... | Adds a new menu item to the menu with the specified name and
attributes. The supplied method name will be called (it must have
the same signature as {@link ActionListener#actionPerformed} but
can be named whatever you like) when the menu item is selected.
@param menu the menu to add the item to.
@param name the item name.
@param target the object on which to invoke a method when the menu is selected.
@param callbackName the name of the method to invoke when the menu is selected.
@return the new menu item. | [
"Adds",
"a",
"new",
"menu",
"item",
"to",
"the",
"menu",
"with",
"the",
"specified",
"name",
"and",
"attributes",
".",
"The",
"supplied",
"method",
"name",
"will",
"be",
"called",
"(",
"it",
"must",
"have",
"the",
"same",
"signature",
"as",
"{",
"@link",... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/MenuUtil.java#L142-L149 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/DBQuery.java | DBQuery.lessThan | public static Query lessThan(String field, Object value) {
return new Query().lessThan(field, value);
} | java | public static Query lessThan(String field, Object value) {
return new Query().lessThan(field, value);
} | [
"public",
"static",
"Query",
"lessThan",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"Query",
"(",
")",
".",
"lessThan",
"(",
"field",
",",
"value",
")",
";",
"}"
] | The field is less than the given value
@param field The field to compare
@param value The value to compare to
@return the query | [
"The",
"field",
"is",
"less",
"than",
"the",
"given",
"value"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBQuery.java#L62-L64 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Transform3D.java | Transform3D.setTranslation | public void setTranslation(double x, double y, double z) {
this.m03 = x;
this.m13 = y;
this.m23 = z;
} | java | public void setTranslation(double x, double y, double z) {
this.m03 = x;
this.m13 = y;
this.m23 = z;
} | [
"public",
"void",
"setTranslation",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"this",
".",
"m03",
"=",
"x",
";",
"this",
".",
"m13",
"=",
"y",
";",
"this",
".",
"m23",
"=",
"z",
";",
"}"
] | Set the position.
<p>
This function changes only the elements of
the matrix related to the translation.
The scaling and the shearing are not changed.
<p>
After a call to this function, the matrix will
contains (? means any value):
<pre>
[ ? ? x ]
[ ? ? y ]
[ ? ? z ]
[ ? ? ? ]
</pre>
@param x
@param y
@param z
@see #makeTranslationMatrix(double, double, double) | [
"Set",
"the",
"position",
".",
"<p",
">",
"This",
"function",
"changes",
"only",
"the",
"elements",
"of",
"the",
"matrix",
"related",
"to",
"the",
"translation",
".",
"The",
"scaling",
"and",
"the",
"shearing",
"are",
"not",
"changed",
".",
"<p",
">",
"A... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Transform3D.java#L136-L140 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.buttonBar | public String buttonBar(int segment, String attributes) {
if (segment == HTML_START) {
String result = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"";
if (attributes != null) {
result += " " + attributes;
}
return result + "><tr>\n";
} else {
return "</tr></table>";
}
} | java | public String buttonBar(int segment, String attributes) {
if (segment == HTML_START) {
String result = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"";
if (attributes != null) {
result += " " + attributes;
}
return result + "><tr>\n";
} else {
return "</tr></table>";
}
} | [
"public",
"String",
"buttonBar",
"(",
"int",
"segment",
",",
"String",
"attributes",
")",
"{",
"if",
"(",
"segment",
"==",
"HTML_START",
")",
"{",
"String",
"result",
"=",
"\"<table cellpadding=\\\"0\\\" cellspacing=\\\"0\\\" border=\\\"0\\\"\"",
";",
"if",
"(",
"at... | Returns the html for a button bar.<p>
@param segment the HTML segment (START / END)
@param attributes optional attributes for the table tag
@return a button bar html start / end segment | [
"Returns",
"the",
"html",
"for",
"a",
"button",
"bar",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L1279-L1290 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java | ServerUpdater.addRolesToUser | public ServerUpdater addRolesToUser(User user, Collection<Role> roles) {
delegate.addRolesToUser(user, roles);
return this;
} | java | public ServerUpdater addRolesToUser(User user, Collection<Role> roles) {
delegate.addRolesToUser(user, roles);
return this;
} | [
"public",
"ServerUpdater",
"addRolesToUser",
"(",
"User",
"user",
",",
"Collection",
"<",
"Role",
">",
"roles",
")",
"{",
"delegate",
".",
"addRolesToUser",
"(",
"user",
",",
"roles",
")",
";",
"return",
"this",
";",
"}"
] | Queues a collection of roles to be assigned to the user.
@param user The server member the role should be added to.
@param roles The roles which should be added to the server member.
@return The current instance in order to chain call methods. | [
"Queues",
"a",
"collection",
"of",
"roles",
"to",
"be",
"assigned",
"to",
"the",
"user",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L479-L482 |
BioPAX/Paxtools | normalizer/src/main/java/org/biopax/paxtools/normalizer/MiriamLink.java | MiriamLink.getURI | public static String getURI(String name, String id)
{
Datatype datatype = getDatatype(name);
String db = datatype.getName();
if(checkRegExp(id, db)) {
try {
return getOfficialDataTypeURI(datatype) + ":" + URLEncoder.encode(id, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 encoding error of id=" + id, e);
}
} else
throw new IllegalArgumentException(
"ID pattern mismatch. db=" + db + ", id=" + id
+ ", regexp: " + datatype.getPattern());
} | java | public static String getURI(String name, String id)
{
Datatype datatype = getDatatype(name);
String db = datatype.getName();
if(checkRegExp(id, db)) {
try {
return getOfficialDataTypeURI(datatype) + ":" + URLEncoder.encode(id, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 encoding error of id=" + id, e);
}
} else
throw new IllegalArgumentException(
"ID pattern mismatch. db=" + db + ", id=" + id
+ ", regexp: " + datatype.getPattern());
} | [
"public",
"static",
"String",
"getURI",
"(",
"String",
"name",
",",
"String",
"id",
")",
"{",
"Datatype",
"datatype",
"=",
"getDatatype",
"(",
"name",
")",
";",
"String",
"db",
"=",
"datatype",
".",
"getName",
"(",
")",
";",
"if",
"(",
"checkRegExp",
"... | Retrieves the unique MIRIAM URI of a specific entity (example: "urn:miriam:obo.go:GO%3A0045202").
@param name - name, URI/URL, or ID of a data type (examples: "ChEBI", "MIR:00000005")
@param id identifier of an entity within the data type (examples: "GO:0045202", "P62158")
@return unique standard MIRIAM URI of a given entity
@throws IllegalArgumentException when datatype not found | [
"Retrieves",
"the",
"unique",
"MIRIAM",
"URI",
"of",
"a",
"specific",
"entity",
"(",
"example",
":",
"urn",
":",
"miriam",
":",
"obo",
".",
"go",
":",
"GO%3A0045202",
")",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/normalizer/src/main/java/org/biopax/paxtools/normalizer/MiriamLink.java#L192-L206 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java | ComputeNodesImpl.disableScheduling | public void disableScheduling(String poolId, String nodeId) {
disableSchedulingWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body();
} | java | public void disableScheduling(String poolId, String nodeId) {
disableSchedulingWithServiceResponseAsync(poolId, nodeId).toBlocking().single().body();
} | [
"public",
"void",
"disableScheduling",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
")",
"{",
"disableSchedulingWithServiceResponseAsync",
"(",
"poolId",
",",
"nodeId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";... | Disables task scheduling on the specified compute node.
You can disable task scheduling on a node only if its current scheduling state is enabled.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node on which you want to disable task scheduling.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Disables",
"task",
"scheduling",
"on",
"the",
"specified",
"compute",
"node",
".",
"You",
"can",
"disable",
"task",
"scheduling",
"on",
"a",
"node",
"only",
"if",
"its",
"current",
"scheduling",
"state",
"is",
"enabled",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L1502-L1504 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.toWriter | public static void toWriter(String templateFileName, VelocityContext context, Writer writer) {
assertInit();
final Template template = Velocity.getTemplate(templateFileName);
merge(template, context, writer);
} | java | public static void toWriter(String templateFileName, VelocityContext context, Writer writer) {
assertInit();
final Template template = Velocity.getTemplate(templateFileName);
merge(template, context, writer);
} | [
"public",
"static",
"void",
"toWriter",
"(",
"String",
"templateFileName",
",",
"VelocityContext",
"context",
",",
"Writer",
"writer",
")",
"{",
"assertInit",
"(",
")",
";",
"final",
"Template",
"template",
"=",
"Velocity",
".",
"getTemplate",
"(",
"templateFile... | 生成内容写入流<br>
会自动关闭Writer
@param templateFileName 模板文件名
@param context 上下文
@param writer 流 | [
"生成内容写入流<br",
">",
"会自动关闭Writer"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L199-L204 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/DoubleField.java | DoubleField.getSQLFromField | public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
{
if (this.isNull())
{
if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE))
statement.setNull(iParamColumn, Types.DOUBLE);
else
statement.setDouble(iParamColumn, Double.NaN);
}
else
statement.setDouble(iParamColumn, this.getValue());
} | java | public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
{
if (this.isNull())
{
if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE))
statement.setNull(iParamColumn, Types.DOUBLE);
else
statement.setDouble(iParamColumn, Double.NaN);
}
else
statement.setDouble(iParamColumn, this.getValue());
} | [
"public",
"void",
"getSQLFromField",
"(",
"PreparedStatement",
"statement",
",",
"int",
"iType",
",",
"int",
"iParamColumn",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"this",
".",
"isNull",
"(",
")",
")",
"{",
"if",
"(",
"(",
"this",
".",
"isNullable"... | Move the physical binary data to this SQL parameter row.
@param statement The SQL prepare statement.
@param iType the type of SQL statement.
@param iParamColumn The column in the prepared statement to set the data.
@exception SQLException From SQL calls. | [
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"SQL",
"parameter",
"row",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DoubleField.java#L143-L154 |
apache/groovy | src/main/groovy/groovy/util/ObjectGraphBuilder.java | ObjectGraphBuilder.setNewInstanceResolver | public void setNewInstanceResolver(final Object newInstanceResolver) {
if (newInstanceResolver instanceof NewInstanceResolver) {
this.newInstanceResolver = (NewInstanceResolver) newInstanceResolver;
} else if (newInstanceResolver instanceof Closure) {
final ObjectGraphBuilder self = this;
this.newInstanceResolver = new NewInstanceResolver() {
public Object newInstance(Class klass, Map attributes)
throws InstantiationException, IllegalAccessException {
Closure cls = (Closure) newInstanceResolver;
cls.setDelegate(self);
return cls.call(klass, attributes);
}
};
} else {
this.newInstanceResolver = new DefaultNewInstanceResolver();
}
} | java | public void setNewInstanceResolver(final Object newInstanceResolver) {
if (newInstanceResolver instanceof NewInstanceResolver) {
this.newInstanceResolver = (NewInstanceResolver) newInstanceResolver;
} else if (newInstanceResolver instanceof Closure) {
final ObjectGraphBuilder self = this;
this.newInstanceResolver = new NewInstanceResolver() {
public Object newInstance(Class klass, Map attributes)
throws InstantiationException, IllegalAccessException {
Closure cls = (Closure) newInstanceResolver;
cls.setDelegate(self);
return cls.call(klass, attributes);
}
};
} else {
this.newInstanceResolver = new DefaultNewInstanceResolver();
}
} | [
"public",
"void",
"setNewInstanceResolver",
"(",
"final",
"Object",
"newInstanceResolver",
")",
"{",
"if",
"(",
"newInstanceResolver",
"instanceof",
"NewInstanceResolver",
")",
"{",
"this",
".",
"newInstanceResolver",
"=",
"(",
"NewInstanceResolver",
")",
"newInstanceRe... | Sets the current NewInstanceResolver.<br>
It will assign DefaultNewInstanceResolver if null.<br>
It accepts a NewInstanceResolver instance or a Closure. | [
"Sets",
"the",
"current",
"NewInstanceResolver",
".",
"<br",
">",
"It",
"will",
"assign",
"DefaultNewInstanceResolver",
"if",
"null",
".",
"<br",
">",
"It",
"accepts",
"a",
"NewInstanceResolver",
"instance",
"or",
"a",
"Closure",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/ObjectGraphBuilder.java#L263-L279 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/prune_policy.java | prune_policy.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
prune_policy_responses result = (prune_policy_responses) service.get_payload_formatter().string_to_resource(prune_policy_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.prune_policy_response_array);
}
prune_policy[] result_prune_policy = new prune_policy[result.prune_policy_response_array.length];
for(int i = 0; i < result.prune_policy_response_array.length; i++)
{
result_prune_policy[i] = result.prune_policy_response_array[i].prune_policy[0];
}
return result_prune_policy;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
prune_policy_responses result = (prune_policy_responses) service.get_payload_formatter().string_to_resource(prune_policy_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.prune_policy_response_array);
}
prune_policy[] result_prune_policy = new prune_policy[result.prune_policy_response_array.length];
for(int i = 0; i < result.prune_policy_response_array.length; i++)
{
result_prune_policy[i] = result.prune_policy_response_array[i].prune_policy[0];
}
return result_prune_policy;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"prune_policy_responses",
"result",
"=",
"(",
"prune_policy_responses",
")",
"service",
".",
"get_payload_form... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/prune_policy.java#L223-L240 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java | MultiLayerNetwork.scoreExamples | public INDArray scoreExamples(DataSet data, boolean addRegularizationTerms) {
try{
return scoreExamplesHelper(data, addRegularizationTerms);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} | java | public INDArray scoreExamples(DataSet data, boolean addRegularizationTerms) {
try{
return scoreExamplesHelper(data, addRegularizationTerms);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} | [
"public",
"INDArray",
"scoreExamples",
"(",
"DataSet",
"data",
",",
"boolean",
"addRegularizationTerms",
")",
"{",
"try",
"{",
"return",
"scoreExamplesHelper",
"(",
"data",
",",
"addRegularizationTerms",
")",
";",
"}",
"catch",
"(",
"OutOfMemoryError",
"e",
")",
... | Calculate the score for each example in a DataSet individually. Unlike {@link #score(DataSet)} and {@link #score(DataSet, boolean)}
this method does not average/sum over examples. This method allows for examples to be scored individually (at test time only), which
may be useful for example for autoencoder architectures and the like.<br>
Each row of the output (assuming addRegularizationTerms == true) is equivalent to calling score(DataSet) with a single example.
@param data The data to score
@param addRegularizationTerms If true: add l1/l2 regularization terms (if any) to the score. If false: don't add regularization terms
@return An INDArray (column vector) of size input.numRows(); the ith entry is the score (loss value) of the ith example | [
"Calculate",
"the",
"score",
"for",
"each",
"example",
"in",
"a",
"DataSet",
"individually",
".",
"Unlike",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java#L2555-L2562 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/WriterTableProcessor.java | WriterTableProcessor.readKeysFromSegment | @SneakyThrows(IOException.class)
private KeyUpdateCollection readKeysFromSegment(DirectSegmentAccess segment, long firstOffset, long lastOffset, TimeoutTimer timer) {
KeyUpdateCollection keyUpdates = new KeyUpdateCollection();
try (InputStream input = readFromInMemorySegment(segment, firstOffset, lastOffset, timer)) {
long segmentOffset = firstOffset;
while (segmentOffset < lastOffset) {
segmentOffset += indexSingleKey(input, segmentOffset, keyUpdates);
}
}
return keyUpdates;
} | java | @SneakyThrows(IOException.class)
private KeyUpdateCollection readKeysFromSegment(DirectSegmentAccess segment, long firstOffset, long lastOffset, TimeoutTimer timer) {
KeyUpdateCollection keyUpdates = new KeyUpdateCollection();
try (InputStream input = readFromInMemorySegment(segment, firstOffset, lastOffset, timer)) {
long segmentOffset = firstOffset;
while (segmentOffset < lastOffset) {
segmentOffset += indexSingleKey(input, segmentOffset, keyUpdates);
}
}
return keyUpdates;
} | [
"@",
"SneakyThrows",
"(",
"IOException",
".",
"class",
")",
"private",
"KeyUpdateCollection",
"readKeysFromSegment",
"(",
"DirectSegmentAccess",
"segment",
",",
"long",
"firstOffset",
",",
"long",
"lastOffset",
",",
"TimeoutTimer",
"timer",
")",
"{",
"KeyUpdateCollect... | Reads all the Keys from the given Segment between the given offsets and indexes them by key.
@param segment The InputStream to process.
@param firstOffset The first offset in the Segment to start reading Keys at.
@param lastOffset The last offset in the Segment to read Keys until.
@param timer Timer for the operation.
@return A {@link KeyUpdateCollection}s containing the indexed keys. | [
"Reads",
"all",
"the",
"Keys",
"from",
"the",
"given",
"Segment",
"between",
"the",
"given",
"offsets",
"and",
"indexes",
"them",
"by",
"key",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/WriterTableProcessor.java#L343-L353 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/internal/utils/ExamplesUtil.java | ExamplesUtil.generateStringExample | public static String generateStringExample(String format, List<String> enumValues) {
if (enumValues == null || enumValues.isEmpty()) {
if (format == null) {
return "string";
} else {
switch (format) {
case "byte":
return "Ynl0ZQ==";
case "date":
return "1970-01-01";
case "date-time":
return "1970-01-01T00:00:00Z";
case "email":
return "email@example.com";
case "password":
return "secret";
case "uuid":
return "f81d4fae-7dec-11d0-a765-00a0c91e6bf6";
default:
return "string";
}
}
} else {
return enumValues.get(0);
}
} | java | public static String generateStringExample(String format, List<String> enumValues) {
if (enumValues == null || enumValues.isEmpty()) {
if (format == null) {
return "string";
} else {
switch (format) {
case "byte":
return "Ynl0ZQ==";
case "date":
return "1970-01-01";
case "date-time":
return "1970-01-01T00:00:00Z";
case "email":
return "email@example.com";
case "password":
return "secret";
case "uuid":
return "f81d4fae-7dec-11d0-a765-00a0c91e6bf6";
default:
return "string";
}
}
} else {
return enumValues.get(0);
}
} | [
"public",
"static",
"String",
"generateStringExample",
"(",
"String",
"format",
",",
"List",
"<",
"String",
">",
"enumValues",
")",
"{",
"if",
"(",
"enumValues",
"==",
"null",
"||",
"enumValues",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"format",
"... | Generates examples for string properties or parameters with given format
@param format the format of the string property
@param enumValues the enum values
@return example | [
"Generates",
"examples",
"for",
"string",
"properties",
"or",
"parameters",
"with",
"given",
"format"
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/utils/ExamplesUtil.java#L373-L398 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java | JobMaster.tryRestoreExecutionGraphFromSavepoint | private void tryRestoreExecutionGraphFromSavepoint(ExecutionGraph executionGraphToRestore, SavepointRestoreSettings savepointRestoreSettings) throws Exception {
if (savepointRestoreSettings.restoreSavepoint()) {
final CheckpointCoordinator checkpointCoordinator = executionGraphToRestore.getCheckpointCoordinator();
if (checkpointCoordinator != null) {
checkpointCoordinator.restoreSavepoint(
savepointRestoreSettings.getRestorePath(),
savepointRestoreSettings.allowNonRestoredState(),
executionGraphToRestore.getAllVertices(),
userCodeLoader);
}
}
} | java | private void tryRestoreExecutionGraphFromSavepoint(ExecutionGraph executionGraphToRestore, SavepointRestoreSettings savepointRestoreSettings) throws Exception {
if (savepointRestoreSettings.restoreSavepoint()) {
final CheckpointCoordinator checkpointCoordinator = executionGraphToRestore.getCheckpointCoordinator();
if (checkpointCoordinator != null) {
checkpointCoordinator.restoreSavepoint(
savepointRestoreSettings.getRestorePath(),
savepointRestoreSettings.allowNonRestoredState(),
executionGraphToRestore.getAllVertices(),
userCodeLoader);
}
}
} | [
"private",
"void",
"tryRestoreExecutionGraphFromSavepoint",
"(",
"ExecutionGraph",
"executionGraphToRestore",
",",
"SavepointRestoreSettings",
"savepointRestoreSettings",
")",
"throws",
"Exception",
"{",
"if",
"(",
"savepointRestoreSettings",
".",
"restoreSavepoint",
"(",
")",
... | Tries to restore the given {@link ExecutionGraph} from the provided {@link SavepointRestoreSettings}.
@param executionGraphToRestore {@link ExecutionGraph} which is supposed to be restored
@param savepointRestoreSettings {@link SavepointRestoreSettings} containing information about the savepoint to restore from
@throws Exception if the {@link ExecutionGraph} could not be restored | [
"Tries",
"to",
"restore",
"the",
"given",
"{",
"@link",
"ExecutionGraph",
"}",
"from",
"the",
"provided",
"{",
"@link",
"SavepointRestoreSettings",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java#L1126-L1137 |
AKSW/RDFUnit | rdfunit-validate/src/main/java/org/aksw/rdfunit/validate/ws/AbstractRDFUnitWebService.java | AbstractRDFUnitWebService.printMessage | protected void printMessage(HttpServletResponse httpServletResponse, String message) throws IOException {
// Set response content type
httpServletResponse.setContentType("text/html");
// Actual logic goes here.
PrintWriter out = httpServletResponse.getWriter();
out.println("<pre>" + message + "</pre>");
//out.close();
} | java | protected void printMessage(HttpServletResponse httpServletResponse, String message) throws IOException {
// Set response content type
httpServletResponse.setContentType("text/html");
// Actual logic goes here.
PrintWriter out = httpServletResponse.getWriter();
out.println("<pre>" + message + "</pre>");
//out.close();
} | [
"protected",
"void",
"printMessage",
"(",
"HttpServletResponse",
"httpServletResponse",
",",
"String",
"message",
")",
"throws",
"IOException",
"{",
"// Set response content type",
"httpServletResponse",
".",
"setContentType",
"(",
"\"text/html\"",
")",
";",
"// Actual logi... | Help function that writes a string to the output surrounded with {@code <pre> </pre>}
@param httpServletResponse a {@link javax.servlet.http.HttpServletResponse} object.
@param message the message we want to write
@throws java.io.IOException if any. | [
"Help",
"function",
"that",
"writes",
"a",
"string",
"to",
"the",
"output",
"surrounded",
"with",
"{",
"@code",
"<pre",
">",
"<",
"/",
"pre",
">",
"}"
] | train | https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-validate/src/main/java/org/aksw/rdfunit/validate/ws/AbstractRDFUnitWebService.java#L138-L145 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java | SVGPlot.saveAsJPEG | public void saveAsJPEG(File file, int width, int height, float quality) throws IOException, TranscoderException {
JPEGTranscoder t = new JPEGTranscoder();
t.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, new Float(width));
t.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, new Float(height));
t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(quality));
transcode(file, t);
} | java | public void saveAsJPEG(File file, int width, int height, float quality) throws IOException, TranscoderException {
JPEGTranscoder t = new JPEGTranscoder();
t.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, new Float(width));
t.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, new Float(height));
t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(quality));
transcode(file, t);
} | [
"public",
"void",
"saveAsJPEG",
"(",
"File",
"file",
",",
"int",
"width",
",",
"int",
"height",
",",
"float",
"quality",
")",
"throws",
"IOException",
",",
"TranscoderException",
"{",
"JPEGTranscoder",
"t",
"=",
"new",
"JPEGTranscoder",
"(",
")",
";",
"t",
... | Transcode file to JPEG.
@param file Output filename
@param width Width
@param height Height
@param quality JPEG quality setting, between 0.0 and 1.0
@throws IOException On write errors
@throws TranscoderException On input/parsing errors. | [
"Transcode",
"file",
"to",
"JPEG",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L533-L539 |
SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java | PluginLoader.instantiatePluginClasses | @VisibleForTesting
Map<String, Plugin> instantiatePluginClasses(Map<PluginClassLoaderDef, ClassLoader> classloaders) {
// instantiate plugins
Map<String, Plugin> instancesByPluginKey = new HashMap<>();
for (Map.Entry<PluginClassLoaderDef, ClassLoader> entry : classloaders.entrySet()) {
PluginClassLoaderDef def = entry.getKey();
ClassLoader classLoader = entry.getValue();
// the same classloader can be used by multiple plugins
for (Map.Entry<String, String> mainClassEntry : def.getMainClassesByPluginKey().entrySet()) {
String pluginKey = mainClassEntry.getKey();
String mainClass = mainClassEntry.getValue();
try {
instancesByPluginKey.put(pluginKey, (Plugin) classLoader.loadClass(mainClass).newInstance());
} catch (UnsupportedClassVersionError e) {
throw new IllegalStateException(String.format("The plugin [%s] does not support Java %s",
pluginKey, SystemUtils.JAVA_VERSION_TRIMMED), e);
} catch (Throwable e) {
throw new IllegalStateException(String.format(
"Fail to instantiate class [%s] of plugin [%s]", mainClass, pluginKey), e);
}
}
}
return instancesByPluginKey;
} | java | @VisibleForTesting
Map<String, Plugin> instantiatePluginClasses(Map<PluginClassLoaderDef, ClassLoader> classloaders) {
// instantiate plugins
Map<String, Plugin> instancesByPluginKey = new HashMap<>();
for (Map.Entry<PluginClassLoaderDef, ClassLoader> entry : classloaders.entrySet()) {
PluginClassLoaderDef def = entry.getKey();
ClassLoader classLoader = entry.getValue();
// the same classloader can be used by multiple plugins
for (Map.Entry<String, String> mainClassEntry : def.getMainClassesByPluginKey().entrySet()) {
String pluginKey = mainClassEntry.getKey();
String mainClass = mainClassEntry.getValue();
try {
instancesByPluginKey.put(pluginKey, (Plugin) classLoader.loadClass(mainClass).newInstance());
} catch (UnsupportedClassVersionError e) {
throw new IllegalStateException(String.format("The plugin [%s] does not support Java %s",
pluginKey, SystemUtils.JAVA_VERSION_TRIMMED), e);
} catch (Throwable e) {
throw new IllegalStateException(String.format(
"Fail to instantiate class [%s] of plugin [%s]", mainClass, pluginKey), e);
}
}
}
return instancesByPluginKey;
} | [
"@",
"VisibleForTesting",
"Map",
"<",
"String",
",",
"Plugin",
">",
"instantiatePluginClasses",
"(",
"Map",
"<",
"PluginClassLoaderDef",
",",
"ClassLoader",
">",
"classloaders",
")",
"{",
"// instantiate plugins",
"Map",
"<",
"String",
",",
"Plugin",
">",
"instanc... | Instantiates collection of {@link org.sonar.api.Plugin} according to given metadata and classloaders
@return the instances grouped by plugin key
@throws IllegalStateException if at least one plugin can't be correctly loaded | [
"Instantiates",
"collection",
"of",
"{",
"@link",
"org",
".",
"sonar",
".",
"api",
".",
"Plugin",
"}",
"according",
"to",
"given",
"metadata",
"and",
"classloaders"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java#L115-L139 |
Impetus/Kundera | src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java | HibernateClient.onNativeUpdate | public int onNativeUpdate(String query, Map<Parameter, Object> parameterMap)
{
s = getStatelessSession();
Query q = s.createSQLQuery(query);
setParameters(parameterMap, q);
// Transaction tx = s.getTransaction() == null ? s.beginTransaction():
// s.getTransaction();
// tx.begin();
int i = q.executeUpdate();
// tx.commit();
return i;
} | java | public int onNativeUpdate(String query, Map<Parameter, Object> parameterMap)
{
s = getStatelessSession();
Query q = s.createSQLQuery(query);
setParameters(parameterMap, q);
// Transaction tx = s.getTransaction() == null ? s.beginTransaction():
// s.getTransaction();
// tx.begin();
int i = q.executeUpdate();
// tx.commit();
return i;
} | [
"public",
"int",
"onNativeUpdate",
"(",
"String",
"query",
",",
"Map",
"<",
"Parameter",
",",
"Object",
">",
"parameterMap",
")",
"{",
"s",
"=",
"getStatelessSession",
"(",
")",
";",
"Query",
"q",
"=",
"s",
".",
"createSQLQuery",
"(",
"query",
")",
";",
... | On native update.
@param query
the query
@param parameterMap
the parameter map
@return the int | [
"On",
"native",
"update",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java#L616-L632 |
craftercms/profile | security-provider/src/main/java/org/craftercms/security/utils/social/ConnectionUtils.java | ConnectionUtils.addProviderProfileInfo | public static void addProviderProfileInfo(Profile profile, UserProfile providerProfile) {
String email = providerProfile.getEmail();
if (StringUtils.isEmpty(email)) {
throw new IllegalStateException("No email included in provider profile");
}
String username = providerProfile.getUsername();
if (StringUtils.isEmpty(username)) {
username = email;
}
String firstName = providerProfile.getFirstName();
String lastName = providerProfile.getLastName();
profile.setUsername(username);
profile.setEmail(email);
profile.setAttribute(FIRST_NAME_ATTRIBUTE_NAME, firstName);
profile.setAttribute(LAST_NAME_ATTRIBUTE_NAME, lastName);
} | java | public static void addProviderProfileInfo(Profile profile, UserProfile providerProfile) {
String email = providerProfile.getEmail();
if (StringUtils.isEmpty(email)) {
throw new IllegalStateException("No email included in provider profile");
}
String username = providerProfile.getUsername();
if (StringUtils.isEmpty(username)) {
username = email;
}
String firstName = providerProfile.getFirstName();
String lastName = providerProfile.getLastName();
profile.setUsername(username);
profile.setEmail(email);
profile.setAttribute(FIRST_NAME_ATTRIBUTE_NAME, firstName);
profile.setAttribute(LAST_NAME_ATTRIBUTE_NAME, lastName);
} | [
"public",
"static",
"void",
"addProviderProfileInfo",
"(",
"Profile",
"profile",
",",
"UserProfile",
"providerProfile",
")",
"{",
"String",
"email",
"=",
"providerProfile",
".",
"getEmail",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"email",
... | Adds the info from the provider profile to the specified profile.
@param profile the target profile
@param providerProfile the provider profile where to get the info | [
"Adds",
"the",
"info",
"from",
"the",
"provider",
"profile",
"to",
"the",
"specified",
"profile",
"."
] | train | https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/utils/social/ConnectionUtils.java#L217-L235 |
libgdx/packr | src/main/java/com/badlogicgames/packr/PackrFileUtils.java | PackrFileUtils.copyDirectory | static void copyDirectory(File sourceDirectory, File targetDirectory) throws IOException {
final Path sourcePath = Paths.get(sourceDirectory.toURI()).toRealPath();
final Path targetPath = Paths.get(targetDirectory.toURI());
Files.walkFileTree(sourcePath, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
Path relative = sourcePath.relativize(dir);
Path target = targetPath.resolve(relative);
File folder = target.toFile();
if (!folder.exists()) {
mkdirs(folder);
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Path relative = sourcePath.relativize(file);
Path target = targetPath.resolve(relative);
Files.copy(file, target, StandardCopyOption.COPY_ATTRIBUTES);
return FileVisitResult.CONTINUE;
}
});
} | java | static void copyDirectory(File sourceDirectory, File targetDirectory) throws IOException {
final Path sourcePath = Paths.get(sourceDirectory.toURI()).toRealPath();
final Path targetPath = Paths.get(targetDirectory.toURI());
Files.walkFileTree(sourcePath, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
Path relative = sourcePath.relativize(dir);
Path target = targetPath.resolve(relative);
File folder = target.toFile();
if (!folder.exists()) {
mkdirs(folder);
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Path relative = sourcePath.relativize(file);
Path target = targetPath.resolve(relative);
Files.copy(file, target, StandardCopyOption.COPY_ATTRIBUTES);
return FileVisitResult.CONTINUE;
}
});
} | [
"static",
"void",
"copyDirectory",
"(",
"File",
"sourceDirectory",
",",
"File",
"targetDirectory",
")",
"throws",
"IOException",
"{",
"final",
"Path",
"sourcePath",
"=",
"Paths",
".",
"get",
"(",
"sourceDirectory",
".",
"toURI",
"(",
")",
")",
".",
"toRealPath... | Copies directories, preserving file attributes.
<p>
The {@link org.zeroturnaround.zip.commons.FileUtilsV2_2#copyDirectory(File, File)} function does not
preserve file attributes. | [
"Copies",
"directories",
"preserving",
"file",
"attributes",
".",
"<p",
">",
"The",
"{"
] | train | https://github.com/libgdx/packr/blob/4dd00a1fb5075dc1b6cd84f46bfdd918eb3d50e9/src/main/java/com/badlogicgames/packr/PackrFileUtils.java#L55-L80 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java | FileUtil.appendToFile | public static File appendToFile(String filename, String extraContent, boolean onNewLine){
PrintWriter pw = null;
try {
pw = new PrintWriter(
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(filename, true),
FILE_ENCODING)
)
);
if (onNewLine) {
pw.println();
}
pw.print(extraContent);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("Unable to write to: " + filename, e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} finally {
if (pw != null) {
pw.close();
}
}
return new File(filename);
} | java | public static File appendToFile(String filename, String extraContent, boolean onNewLine){
PrintWriter pw = null;
try {
pw = new PrintWriter(
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(filename, true),
FILE_ENCODING)
)
);
if (onNewLine) {
pw.println();
}
pw.print(extraContent);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("Unable to write to: " + filename, e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} finally {
if (pw != null) {
pw.close();
}
}
return new File(filename);
} | [
"public",
"static",
"File",
"appendToFile",
"(",
"String",
"filename",
",",
"String",
"extraContent",
",",
"boolean",
"onNewLine",
")",
"{",
"PrintWriter",
"pw",
"=",
"null",
";",
"try",
"{",
"pw",
"=",
"new",
"PrintWriter",
"(",
"new",
"BufferedWriter",
"("... | Appends the extra content to the file, in UTF-8 encoding.
@param filename file to create or append to.
@param extraContent extraContent to write.
@param onNewLine whether a new line should be created before appending the extra content
@return file reference to file. | [
"Appends",
"the",
"extra",
"content",
"to",
"the",
"file",
"in",
"UTF",
"-",
"8",
"encoding",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L287-L311 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/WrapperAdapter.java | WrapperAdapter.recordMethodInvocation | @SneakyThrows
public final void recordMethodInvocation(final Class<?> targetClass, final String methodName, final Class<?>[] argumentTypes, final Object[] arguments) {
jdbcMethodInvocations.add(new JdbcMethodInvocation(targetClass.getMethod(methodName, argumentTypes), arguments));
} | java | @SneakyThrows
public final void recordMethodInvocation(final Class<?> targetClass, final String methodName, final Class<?>[] argumentTypes, final Object[] arguments) {
jdbcMethodInvocations.add(new JdbcMethodInvocation(targetClass.getMethod(methodName, argumentTypes), arguments));
} | [
"@",
"SneakyThrows",
"public",
"final",
"void",
"recordMethodInvocation",
"(",
"final",
"Class",
"<",
"?",
">",
"targetClass",
",",
"final",
"String",
"methodName",
",",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"argumentTypes",
",",
"final",
"Object",
"[",... | record method invocation.
@param targetClass target class
@param methodName method name
@param argumentTypes argument types
@param arguments arguments | [
"record",
"method",
"invocation",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/WrapperAdapter.java#L59-L62 |
redkale/redkale | src/org/redkale/net/http/HttpRequest.java | HttpRequest.getRequstURIPath | public double getRequstURIPath(String prefix, double defvalue) {
String val = getRequstURIPath(prefix, null);
try {
return val == null ? defvalue : Double.parseDouble(val);
} catch (NumberFormatException e) {
return defvalue;
}
} | java | public double getRequstURIPath(String prefix, double defvalue) {
String val = getRequstURIPath(prefix, null);
try {
return val == null ? defvalue : Double.parseDouble(val);
} catch (NumberFormatException e) {
return defvalue;
}
} | [
"public",
"double",
"getRequstURIPath",
"(",
"String",
"prefix",
",",
"double",
"defvalue",
")",
"{",
"String",
"val",
"=",
"getRequstURIPath",
"(",
"prefix",
",",
"null",
")",
";",
"try",
"{",
"return",
"val",
"==",
"null",
"?",
"defvalue",
":",
"Double",... | 获取请求URL分段中含prefix段的double值 <br>
例如请求URL /pipes/record/query/point:40.0 <br>
获取time参数: double point = request.getRequstURIPath("point:", 0.0);
@param prefix prefix段前缀
@param defvalue 默认double值
@return double值 | [
"获取请求URL分段中含prefix段的double值",
"<br",
">",
"例如请求URL",
"/",
"pipes",
"/",
"record",
"/",
"query",
"/",
"point",
":",
"40",
".",
"0",
"<br",
">",
"获取time参数",
":",
"double",
"point",
"=",
"request",
".",
"getRequstURIPath",
"(",
"point",
":",
"0",
".",
"0",
... | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L955-L962 |
phax/ph-oton | ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/handler/AbstractWebPageActionHandlerMultiUndelete.java | AbstractWebPageActionHandlerMultiUndelete.createUndeleteToolbar | @Nonnull
@OverrideOnDemand
protected TOOLBAR_TYPE createUndeleteToolbar (@Nonnull final WPECTYPE aWPEC,
@Nonnull final FORM_TYPE aForm,
@Nonnull final ICommonsList <DATATYPE> aSelectedObjects)
{
final Locale aDisplayLocale = aWPEC.getDisplayLocale ();
final TOOLBAR_TYPE aToolbar = getUIHandler ().createToolbar (aWPEC);
aToolbar.addHiddenField (CPageParam.PARAM_ACTION, aWPEC.getAction ());
aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE);
for (final DATATYPE aItem : aSelectedObjects)
aToolbar.addHiddenField (getFieldName (), aItem.getID ());
// Yes button
aToolbar.addSubmitButton (getUndeleteToolbarSubmitButtonText (aDisplayLocale),
getUndeleteToolbarSubmitButtonIcon ());
// No button
aToolbar.addButtonNo (aDisplayLocale);
// Callback
modifyUndeleteToolbar (aWPEC, aToolbar);
return aToolbar;
} | java | @Nonnull
@OverrideOnDemand
protected TOOLBAR_TYPE createUndeleteToolbar (@Nonnull final WPECTYPE aWPEC,
@Nonnull final FORM_TYPE aForm,
@Nonnull final ICommonsList <DATATYPE> aSelectedObjects)
{
final Locale aDisplayLocale = aWPEC.getDisplayLocale ();
final TOOLBAR_TYPE aToolbar = getUIHandler ().createToolbar (aWPEC);
aToolbar.addHiddenField (CPageParam.PARAM_ACTION, aWPEC.getAction ());
aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE);
for (final DATATYPE aItem : aSelectedObjects)
aToolbar.addHiddenField (getFieldName (), aItem.getID ());
// Yes button
aToolbar.addSubmitButton (getUndeleteToolbarSubmitButtonText (aDisplayLocale),
getUndeleteToolbarSubmitButtonIcon ());
// No button
aToolbar.addButtonNo (aDisplayLocale);
// Callback
modifyUndeleteToolbar (aWPEC, aToolbar);
return aToolbar;
} | [
"@",
"Nonnull",
"@",
"OverrideOnDemand",
"protected",
"TOOLBAR_TYPE",
"createUndeleteToolbar",
"(",
"@",
"Nonnull",
"final",
"WPECTYPE",
"aWPEC",
",",
"@",
"Nonnull",
"final",
"FORM_TYPE",
"aForm",
",",
"@",
"Nonnull",
"final",
"ICommonsList",
"<",
"DATATYPE",
">"... | Create toolbar for undeleting an existing object
@param aWPEC
The web page execution context
@param aForm
The handled form. Never <code>null</code>.
@param aSelectedObjects
Selected objects. Never <code>null</code>.
@return Never <code>null</code>. | [
"Create",
"toolbar",
"for",
"undeleting",
"an",
"existing",
"object"
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/handler/AbstractWebPageActionHandlerMultiUndelete.java#L134-L157 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.setInternalStateFromContext | public static void setInternalStateFromContext(Object object, Object context, Object[] additionalContexts) {
setInternalStateFromContext(object, context, FieldMatchingStrategy.MATCHING);
if (additionalContexts != null && additionalContexts.length > 0) {
for (Object additionContext : additionalContexts) {
setInternalStateFromContext(object, additionContext, FieldMatchingStrategy.MATCHING);
}
}
} | java | public static void setInternalStateFromContext(Object object, Object context, Object[] additionalContexts) {
setInternalStateFromContext(object, context, FieldMatchingStrategy.MATCHING);
if (additionalContexts != null && additionalContexts.length > 0) {
for (Object additionContext : additionalContexts) {
setInternalStateFromContext(object, additionContext, FieldMatchingStrategy.MATCHING);
}
}
} | [
"public",
"static",
"void",
"setInternalStateFromContext",
"(",
"Object",
"object",
",",
"Object",
"context",
",",
"Object",
"[",
"]",
"additionalContexts",
")",
"{",
"setInternalStateFromContext",
"(",
"object",
",",
"context",
",",
"FieldMatchingStrategy",
".",
"M... | Set the values of multiple instance fields defined in a context using
reflection. The values in the context will be assigned to values on the
{@code instance}. This method will traverse the class hierarchy when
searching for the fields. Example usage:
Given:
<pre>
public class MyContext {
private String myString = "myString";
protected int myInt = 9;
}
public class MyInstance {
private String myInstanceString;
private int myInstanceInt;
}
</pre>
then
<pre>
Whitebox.setInternalStateFromContext(new MyInstance(), new MyContext());
</pre>
will set the instance variables of {@code myInstance} to the values
specified in {@code MyContext}.
@param object the object
@param context The context where the fields are defined.
@param additionalContexts Optionally more additional contexts. | [
"Set",
"the",
"values",
"of",
"multiple",
"instance",
"fields",
"defined",
"in",
"a",
"context",
"using",
"reflection",
".",
"The",
"values",
"in",
"the",
"context",
"will",
"be",
"assigned",
"to",
"values",
"on",
"the",
"{",
"@code",
"instance",
"}",
".",... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2467-L2474 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/exception/SuperCsvCellProcessorException.java | SuperCsvCellProcessorException.getUnexpectedTypeMessage | private static String getUnexpectedTypeMessage(final Class<?> expectedType, final Object actualValue) {
if( expectedType == null ) {
throw new NullPointerException("expectedType should not be null");
}
String expectedClassName = expectedType.getName();
String actualClassName = (actualValue != null) ? actualValue.getClass().getName() : "null";
return String.format("the input value should be of type %s but is %s", expectedClassName, actualClassName);
} | java | private static String getUnexpectedTypeMessage(final Class<?> expectedType, final Object actualValue) {
if( expectedType == null ) {
throw new NullPointerException("expectedType should not be null");
}
String expectedClassName = expectedType.getName();
String actualClassName = (actualValue != null) ? actualValue.getClass().getName() : "null";
return String.format("the input value should be of type %s but is %s", expectedClassName, actualClassName);
} | [
"private",
"static",
"String",
"getUnexpectedTypeMessage",
"(",
"final",
"Class",
"<",
"?",
">",
"expectedType",
",",
"final",
"Object",
"actualValue",
")",
"{",
"if",
"(",
"expectedType",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\... | Assembles the exception message when the value received by a CellProcessor isn't of the correct type.
@param expectedType
the expected type
@param actualValue
the value received by the CellProcessor
@return the message
@throws NullPointerException
if expectedType is null | [
"Assembles",
"the",
"exception",
"message",
"when",
"the",
"value",
"received",
"by",
"a",
"CellProcessor",
"isn",
"t",
"of",
"the",
"correct",
"type",
"."
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/exception/SuperCsvCellProcessorException.java#L97-L104 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optBundle | @Nullable
public static Bundle optBundle(@Nullable Bundle bundle, @Nullable String key) {
return optBundle(bundle, key, new Bundle());
} | java | @Nullable
public static Bundle optBundle(@Nullable Bundle bundle, @Nullable String key) {
return optBundle(bundle, key, new Bundle());
} | [
"@",
"Nullable",
"public",
"static",
"Bundle",
"optBundle",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optBundle",
"(",
"bundle",
",",
"key",
",",
"new",
"Bundle",
"(",
")",
")",
";",
"}"
] | Returns a optional {@link android.os.Bundle} value. In other words, returns the value mapped by key if it exists and is a {@link android.os.Bundle}.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return a fallback value.
@param key a key for the value.
@return a {@link android.os.Bundle} value if exists, null otherwise.
@see android.os.Bundle#getBundle(String) | [
"Returns",
"a",
"optional",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L183-L186 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java | CPMeasurementUnitPersistenceImpl.removeByG_P_T | @Override
public void removeByG_P_T(long groupId, boolean primary, int type) {
for (CPMeasurementUnit cpMeasurementUnit : findByG_P_T(groupId,
primary, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpMeasurementUnit);
}
} | java | @Override
public void removeByG_P_T(long groupId, boolean primary, int type) {
for (CPMeasurementUnit cpMeasurementUnit : findByG_P_T(groupId,
primary, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpMeasurementUnit);
}
} | [
"@",
"Override",
"public",
"void",
"removeByG_P_T",
"(",
"long",
"groupId",
",",
"boolean",
"primary",
",",
"int",
"type",
")",
"{",
"for",
"(",
"CPMeasurementUnit",
"cpMeasurementUnit",
":",
"findByG_P_T",
"(",
"groupId",
",",
"primary",
",",
"type",
",",
"... | Removes all the cp measurement units where groupId = ? and primary = ? and type = ? from the database.
@param groupId the group ID
@param primary the primary
@param type the type | [
"Removes",
"all",
"the",
"cp",
"measurement",
"units",
"where",
"groupId",
"=",
"?",
";",
"and",
"primary",
"=",
"?",
";",
"and",
"type",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L3328-L3334 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/CommonUtils.java | CommonUtils.dateReservedYear | public static Date dateReservedYear(int year, boolean is000) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
return is000 ? dateReservedYear000(calendar) : dateReservedYear999(calendar);
} | java | public static Date dateReservedYear(int year, boolean is000) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
return is000 ? dateReservedYear000(calendar) : dateReservedYear999(calendar);
} | [
"public",
"static",
"Date",
"dateReservedYear",
"(",
"int",
"year",
",",
"boolean",
"is000",
")",
"{",
"Calendar",
"calendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"YEAR",
",",
"year",
")",
";"... | 将某一年对应的日期的月,日,时,分,秒,毫秒调整为最大值或者最小值
@param year 年份
@param is000 true则调整为最小值,反之最大值
@return 被转化后的日期
@see #dateReservedYear000(Date)
@see #dateReservedYear000(Calendar)
@see #dateReservedYear999(Date)
@see #dateReservedYear999(Calendar) | [
"将某一年对应的日期的月",
"日",
"时",
"分",
"秒",
"毫秒调整为最大值或者最小值"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/CommonUtils.java#L574-L579 |
tdomzal/junit-docker-rule | src/main/java/pl/domzal/junit/docker/rule/DockerRule.java | DockerRule.waitForLogMessage | public void waitForLogMessage(final String logSearchString, int waitTime) throws TimeoutException {
WaitForContainer.waitForCondition(new LogChecker(this, logSearchString), waitTime, describe());
} | java | public void waitForLogMessage(final String logSearchString, int waitTime) throws TimeoutException {
WaitForContainer.waitForCondition(new LogChecker(this, logSearchString), waitTime, describe());
} | [
"public",
"void",
"waitForLogMessage",
"(",
"final",
"String",
"logSearchString",
",",
"int",
"waitTime",
")",
"throws",
"TimeoutException",
"{",
"WaitForContainer",
".",
"waitForCondition",
"(",
"new",
"LogChecker",
"(",
"this",
",",
"logSearchString",
")",
",",
... | Stop and wait till given string will show in container output.
@param logSearchString String to wait for in container output.
@param waitTime Wait time.
@throws TimeoutException On wait timeout. | [
"Stop",
"and",
"wait",
"till",
"given",
"string",
"will",
"show",
"in",
"container",
"output",
"."
] | train | https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/DockerRule.java#L361-L363 |
linkedin/dexmaker | dexmaker-mockito-inline-extended/src/main/java/com/android/dx/mockito/inline/extended/ExtendedMockito.java | ExtendedMockito.doThrow | @SafeVarargs
public static StaticCapableStubber doThrow(Class<? extends Throwable> toBeThrown,
Class<? extends Throwable>... toBeThrownNext) {
return new StaticCapableStubber(Mockito.doThrow(toBeThrown, toBeThrownNext));
} | java | @SafeVarargs
public static StaticCapableStubber doThrow(Class<? extends Throwable> toBeThrown,
Class<? extends Throwable>... toBeThrownNext) {
return new StaticCapableStubber(Mockito.doThrow(toBeThrown, toBeThrownNext));
} | [
"@",
"SafeVarargs",
"public",
"static",
"StaticCapableStubber",
"doThrow",
"(",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"toBeThrown",
",",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"...",
"toBeThrownNext",
")",
"{",
"return",
"new",
"StaticCapableS... | Same as {@link Mockito#doThrow(Class, Class...)} but adds the ability to stub static method
calls via {@link StaticCapableStubber#when(MockedMethod)} and
{@link StaticCapableStubber#when(MockedVoidMethod)}. | [
"Same",
"as",
"{"
] | train | https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker-mockito-inline-extended/src/main/java/com/android/dx/mockito/inline/extended/ExtendedMockito.java#L131-L135 |
windup/windup | rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/condition/annotation/AnnotationTypeCondition.java | AnnotationTypeCondition.addCondition | public AnnotationTypeCondition addCondition(String element, AnnotationCondition condition)
{
this.conditions.put(element, condition);
return this;
} | java | public AnnotationTypeCondition addCondition(String element, AnnotationCondition condition)
{
this.conditions.put(element, condition);
return this;
} | [
"public",
"AnnotationTypeCondition",
"addCondition",
"(",
"String",
"element",
",",
"AnnotationCondition",
"condition",
")",
"{",
"this",
".",
"conditions",
".",
"put",
"(",
"element",
",",
"condition",
")",
";",
"return",
"this",
";",
"}"
] | Adds another condition for an element within this annotation. | [
"Adds",
"another",
"condition",
"for",
"an",
"element",
"within",
"this",
"annotation",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/condition/annotation/AnnotationTypeCondition.java#L36-L40 |
Red5/red5-server-common | src/main/java/org/red5/server/stream/PlayEngine.java | PlayEngine.sendSeekStatus | private void sendSeekStatus(IPlayItem item, int position) {
Status seek = new Status(StatusCodes.NS_SEEK_NOTIFY);
seek.setClientid(streamId);
seek.setDetails(item.getName());
seek.setDesciption(String.format("Seeking %d (stream ID: %d).", position, streamId));
doPushMessage(seek);
} | java | private void sendSeekStatus(IPlayItem item, int position) {
Status seek = new Status(StatusCodes.NS_SEEK_NOTIFY);
seek.setClientid(streamId);
seek.setDetails(item.getName());
seek.setDesciption(String.format("Seeking %d (stream ID: %d).", position, streamId));
doPushMessage(seek);
} | [
"private",
"void",
"sendSeekStatus",
"(",
"IPlayItem",
"item",
",",
"int",
"position",
")",
"{",
"Status",
"seek",
"=",
"new",
"Status",
"(",
"StatusCodes",
".",
"NS_SEEK_NOTIFY",
")",
";",
"seek",
".",
"setClientid",
"(",
"streamId",
")",
";",
"seek",
"."... | Send seek status notification
@param item
Playlist item
@param position
Seek position | [
"Send",
"seek",
"status",
"notification"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/PlayEngine.java#L1232-L1239 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4Connection.java | JDBC4Connection.prepareStatement | @Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"PreparedStatement",
"prepareStatement",
"(",
"String",
"sql",
",",
"int",
"resultSetType",
",",
"int",
"resultSetConcurrency",
",",
"int",
"resultSetHoldability",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
... | Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability. | [
"Creates",
"a",
"PreparedStatement",
"object",
"that",
"will",
"generate",
"ResultSet",
"objects",
"with",
"the",
"given",
"type",
"concurrency",
"and",
"holdability",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Connection.java#L398-L403 |
galan/commons | src/main/java/de/galan/commons/net/flux/Response.java | Response.getStreamAsString | public String getStreamAsString(String encoding) throws IOException {
String result = null;
try {
result = IOUtils.toString(getStream(), encoding);
}
catch (NullPointerException npex) {
throw new IOException("Timeout has been forced by CommonHttpClient", npex);
}
return result;
} | java | public String getStreamAsString(String encoding) throws IOException {
String result = null;
try {
result = IOUtils.toString(getStream(), encoding);
}
catch (NullPointerException npex) {
throw new IOException("Timeout has been forced by CommonHttpClient", npex);
}
return result;
} | [
"public",
"String",
"getStreamAsString",
"(",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"String",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"IOUtils",
".",
"toString",
"(",
"getStream",
"(",
")",
",",
"encoding",
")",
";",
"}",
... | Converts the inputstream to a string with the given encoding. Subsequent the inputstream will be empty/closed. | [
"Converts",
"the",
"inputstream",
"to",
"a",
"string",
"with",
"the",
"given",
"encoding",
".",
"Subsequent",
"the",
"inputstream",
"will",
"be",
"empty",
"/",
"closed",
"."
] | train | https://github.com/galan/commons/blob/45d2f36c69958d3f847e5fed66603ea629471822/src/main/java/de/galan/commons/net/flux/Response.java#L87-L96 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listPrebuilts | public List<PrebuiltEntityExtractor> listPrebuilts(UUID appId, String versionId, ListPrebuiltsOptionalParameter listPrebuiltsOptionalParameter) {
return listPrebuiltsWithServiceResponseAsync(appId, versionId, listPrebuiltsOptionalParameter).toBlocking().single().body();
} | java | public List<PrebuiltEntityExtractor> listPrebuilts(UUID appId, String versionId, ListPrebuiltsOptionalParameter listPrebuiltsOptionalParameter) {
return listPrebuiltsWithServiceResponseAsync(appId, versionId, listPrebuiltsOptionalParameter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"PrebuiltEntityExtractor",
">",
"listPrebuilts",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListPrebuiltsOptionalParameter",
"listPrebuiltsOptionalParameter",
")",
"{",
"return",
"listPrebuiltsWithServiceResponseAsync",
"(",
"appId",
",",... | Gets information about the prebuilt entity models.
@param appId The application ID.
@param versionId The version ID.
@param listPrebuiltsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<PrebuiltEntityExtractor> object if successful. | [
"Gets",
"information",
"about",
"the",
"prebuilt",
"entity",
"models",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2183-L2185 |
square/picasso | picasso/src/main/java/com/squareup/picasso3/RequestCreator.java | RequestCreator.get | @Nullable // TODO make non-null and always throw?
public Bitmap get() throws IOException {
long started = System.nanoTime();
checkNotMain();
if (deferred) {
throw new IllegalStateException("Fit cannot be used with get.");
}
if (!data.hasImage()) {
return null;
}
Request request = createRequest(started);
Action action = new GetAction(picasso, request);
RequestHandler.Result result =
forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt();
Bitmap bitmap = result.getBitmap();
if (bitmap != null && shouldWriteToMemoryCache(request.memoryPolicy)) {
picasso.cache.set(request.key, bitmap);
}
return bitmap;
} | java | @Nullable // TODO make non-null and always throw?
public Bitmap get() throws IOException {
long started = System.nanoTime();
checkNotMain();
if (deferred) {
throw new IllegalStateException("Fit cannot be used with get.");
}
if (!data.hasImage()) {
return null;
}
Request request = createRequest(started);
Action action = new GetAction(picasso, request);
RequestHandler.Result result =
forRequest(picasso, picasso.dispatcher, picasso.cache, picasso.stats, action).hunt();
Bitmap bitmap = result.getBitmap();
if (bitmap != null && shouldWriteToMemoryCache(request.memoryPolicy)) {
picasso.cache.set(request.key, bitmap);
}
return bitmap;
} | [
"@",
"Nullable",
"// TODO make non-null and always throw?",
"public",
"Bitmap",
"get",
"(",
")",
"throws",
"IOException",
"{",
"long",
"started",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"checkNotMain",
"(",
")",
";",
"if",
"(",
"deferred",
")",
"{",
"... | Synchronously fulfill this request. Must not be called from the main thread. | [
"Synchronously",
"fulfill",
"this",
"request",
".",
"Must",
"not",
"be",
"called",
"from",
"the",
"main",
"thread",
"."
] | train | https://github.com/square/picasso/blob/89f55b76e3be2b65e5997b7698f782f16f8547e3/picasso/src/main/java/com/squareup/picasso3/RequestCreator.java#L405-L427 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/isomorphism/matchers/CTFileQueryBond.java | CTFileQueryBond.ofType | public static CTFileQueryBond ofType(IBond bond, int type) {
CTFileQueryBond queryBond = new CTFileQueryBond(bond.getBuilder());
queryBond.setOrder(Order.UNSET);
queryBond.setAtoms(new IAtom[]{bond.getBegin(), bond.getEnd()});
switch (type) {
case 1:
queryBond.setType(Type.SINGLE);
break;
case 2:
queryBond.setType(Type.DOUBLE);
break;
case 3:
queryBond.setType(Type.TRIPLE);
break;
case 4:
queryBond.setType(Type.AROMATIC);
break;
case 5:
queryBond.setType(Type.SINGLE_OR_DOUBLE);
break;
case 6:
queryBond.setType(Type.SINGLE_OR_AROMATIC);
break;
case 7:
queryBond.setType(Type.DOUBLE_OR_AROMATIC);
break;
case 8:
queryBond.setType(Type.ANY);
break;
default:
throw new IllegalArgumentException("Unknown bond type: " + type);
}
return queryBond;
} | java | public static CTFileQueryBond ofType(IBond bond, int type) {
CTFileQueryBond queryBond = new CTFileQueryBond(bond.getBuilder());
queryBond.setOrder(Order.UNSET);
queryBond.setAtoms(new IAtom[]{bond.getBegin(), bond.getEnd()});
switch (type) {
case 1:
queryBond.setType(Type.SINGLE);
break;
case 2:
queryBond.setType(Type.DOUBLE);
break;
case 3:
queryBond.setType(Type.TRIPLE);
break;
case 4:
queryBond.setType(Type.AROMATIC);
break;
case 5:
queryBond.setType(Type.SINGLE_OR_DOUBLE);
break;
case 6:
queryBond.setType(Type.SINGLE_OR_AROMATIC);
break;
case 7:
queryBond.setType(Type.DOUBLE_OR_AROMATIC);
break;
case 8:
queryBond.setType(Type.ANY);
break;
default:
throw new IllegalArgumentException("Unknown bond type: " + type);
}
return queryBond;
} | [
"public",
"static",
"CTFileQueryBond",
"ofType",
"(",
"IBond",
"bond",
",",
"int",
"type",
")",
"{",
"CTFileQueryBond",
"queryBond",
"=",
"new",
"CTFileQueryBond",
"(",
"bond",
".",
"getBuilder",
"(",
")",
")",
";",
"queryBond",
".",
"setOrder",
"(",
"Order"... | Create a CTFileQueryBond of the specified type (from the MDL spec). The
bond copies the atoms and sets the type using the value 'type', 5 = single
or double, 8 = any, etc.
@param bond an existing bond
@param type the specified type
@return a new CTFileQueryBond | [
"Create",
"a",
"CTFileQueryBond",
"of",
"the",
"specified",
"type",
"(",
"from",
"the",
"MDL",
"spec",
")",
".",
"The",
"bond",
"copies",
"the",
"atoms",
"and",
"sets",
"the",
"type",
"using",
"the",
"value",
"type",
"5",
"=",
"single",
"or",
"double",
... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/isomorphism/matchers/CTFileQueryBond.java#L88-L121 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/Journaler.java | Journaler.initModule | @Override
public void initModule() throws ModuleInitializationException {
Map<String, String> parameters = getParameters();
copyPropertiesOverParameters(parameters);
serverInterface = new ServerWrapper(getServer());
logger.info("Journaling parameters: " + parameters);
parseParameters(parameters);
if (inRecoveryMode) {
worker =
new JournalConsumer(parameters, getRole(), serverInterface);
} else {
worker = new JournalCreator(parameters, getRole(), serverInterface);
}
logger.info("Journal worker module is: " + worker.toString());
} | java | @Override
public void initModule() throws ModuleInitializationException {
Map<String, String> parameters = getParameters();
copyPropertiesOverParameters(parameters);
serverInterface = new ServerWrapper(getServer());
logger.info("Journaling parameters: " + parameters);
parseParameters(parameters);
if (inRecoveryMode) {
worker =
new JournalConsumer(parameters, getRole(), serverInterface);
} else {
worker = new JournalCreator(parameters, getRole(), serverInterface);
}
logger.info("Journal worker module is: " + worker.toString());
} | [
"@",
"Override",
"public",
"void",
"initModule",
"(",
")",
"throws",
"ModuleInitializationException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
"=",
"getParameters",
"(",
")",
";",
"copyPropertiesOverParameters",
"(",
"parameters",
")",
";",
"... | Augment the parameters with values obtained from System Properties, and
create the proper worker (JournalCreator or JournalConsumer) for the
current mode. | [
"Augment",
"the",
"parameters",
"with",
"values",
"obtained",
"from",
"System",
"Properties",
"and",
"create",
"the",
"proper",
"worker",
"(",
"JournalCreator",
"or",
"JournalConsumer",
")",
"for",
"the",
"current",
"mode",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/Journaler.java#L61-L76 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java | TotpUtils.getQRCode | public static String getQRCode(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) {
Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString());
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(issuer, Required.ISSUER.toString());
Objects.requireNonNull(algorithm, Required.ALGORITHM.toString());
Objects.requireNonNull(digits, Required.DIGITS.toString());
Objects.requireNonNull(period, Required.PERIOD.toString());
var buffer = new StringBuilder();
buffer.append("https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=200x200&chld=M|0&cht=qr&chl=")
.append(getOtpauthURL(name, issuer, secret, algorithm, digits, period));
return buffer.toString();
} | java | public static String getQRCode(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) {
Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString());
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(issuer, Required.ISSUER.toString());
Objects.requireNonNull(algorithm, Required.ALGORITHM.toString());
Objects.requireNonNull(digits, Required.DIGITS.toString());
Objects.requireNonNull(period, Required.PERIOD.toString());
var buffer = new StringBuilder();
buffer.append("https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=200x200&chld=M|0&cht=qr&chl=")
.append(getOtpauthURL(name, issuer, secret, algorithm, digits, period));
return buffer.toString();
} | [
"public",
"static",
"String",
"getQRCode",
"(",
"String",
"name",
",",
"String",
"issuer",
",",
"String",
"secret",
",",
"HmacShaAlgorithm",
"algorithm",
",",
"String",
"digits",
",",
"String",
"period",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"name",... | Generates a QR code to share a secret with a user
@param name The name of the account
@param issuer The name of the issuer
@param secret The secret to use
@param algorithm The algorithm to use
@param digits The number of digits to use
@param period The period to use
@return An URL to Google charts API with the QR code | [
"Generates",
"a",
"QR",
"code",
"to",
"share",
"a",
"secret",
"with",
"a",
"user"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java#L156-L169 |
tango-controls/JTango | server/src/main/java/org/tango/server/events/EventManager.java | EventManager.pushAttributeDataReadyEvent | public void pushAttributeDataReadyEvent(final String deviceName, final String attributeName, final int counter)
throws DevFailed {
xlogger.entry();
final String fullName = EventUtilities.buildEventName(deviceName, attributeName, EventType.DATA_READY_EVENT);
final EventImpl eventImpl = getEventImpl(fullName);
if (eventImpl != null) {
for (ZMQ.Socket eventSocket : eventEndpoints.values()) {
eventImpl.pushAttributeDataReadyEvent(counter, eventSocket);
}
}
xlogger.exit();
} | java | public void pushAttributeDataReadyEvent(final String deviceName, final String attributeName, final int counter)
throws DevFailed {
xlogger.entry();
final String fullName = EventUtilities.buildEventName(deviceName, attributeName, EventType.DATA_READY_EVENT);
final EventImpl eventImpl = getEventImpl(fullName);
if (eventImpl != null) {
for (ZMQ.Socket eventSocket : eventEndpoints.values()) {
eventImpl.pushAttributeDataReadyEvent(counter, eventSocket);
}
}
xlogger.exit();
} | [
"public",
"void",
"pushAttributeDataReadyEvent",
"(",
"final",
"String",
"deviceName",
",",
"final",
"String",
"attributeName",
",",
"final",
"int",
"counter",
")",
"throws",
"DevFailed",
"{",
"xlogger",
".",
"entry",
"(",
")",
";",
"final",
"String",
"fullName"... | fire event with AttDataReady
@param deviceName Specified event device
@param attributeName specified event attribute name
@param counter a counter value
@throws DevFailed | [
"fire",
"event",
"with",
"AttDataReady"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/events/EventManager.java#L543-L554 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getIntentSuggestions | public List<IntentsSuggestionExample> getIntentSuggestions(UUID appId, String versionId, UUID intentId, GetIntentSuggestionsOptionalParameter getIntentSuggestionsOptionalParameter) {
return getIntentSuggestionsWithServiceResponseAsync(appId, versionId, intentId, getIntentSuggestionsOptionalParameter).toBlocking().single().body();
} | java | public List<IntentsSuggestionExample> getIntentSuggestions(UUID appId, String versionId, UUID intentId, GetIntentSuggestionsOptionalParameter getIntentSuggestionsOptionalParameter) {
return getIntentSuggestionsWithServiceResponseAsync(appId, versionId, intentId, getIntentSuggestionsOptionalParameter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"IntentsSuggestionExample",
">",
"getIntentSuggestions",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"intentId",
",",
"GetIntentSuggestionsOptionalParameter",
"getIntentSuggestionsOptionalParameter",
")",
"{",
"return",
"getIntentSu... | Suggests examples that would improve the accuracy of the intent model.
@param appId The application ID.
@param versionId The version ID.
@param intentId The intent classifier ID.
@param getIntentSuggestionsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<IntentsSuggestionExample> object if successful. | [
"Suggests",
"examples",
"that",
"would",
"improve",
"the",
"accuracy",
"of",
"the",
"intent",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L5071-L5073 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/OutputLayerUtil.java | OutputLayerUtil.validateOutputLayer | public static void validateOutputLayer(String layerName, Layer layer){
IActivation activation;
ILossFunction loss;
long nOut;
boolean isLossLayer = false;
if (layer instanceof BaseOutputLayer && !(layer instanceof OCNNOutputLayer)) {
activation = ((BaseOutputLayer) layer).getActivationFn();
loss = ((BaseOutputLayer) layer).getLossFn();
nOut = ((BaseOutputLayer) layer).getNOut();
} else if (layer instanceof LossLayer) {
activation = ((LossLayer) layer).getActivationFn();
loss = ((LossLayer) layer).getLossFn();
nOut = ((LossLayer) layer).getNOut();
isLossLayer = true;
} else if (layer instanceof RnnLossLayer) {
activation = ((RnnLossLayer) layer).getActivationFn();
loss = ((RnnLossLayer) layer).getLossFn();
nOut = ((RnnLossLayer) layer).getNOut();
isLossLayer = true;
} else if (layer instanceof CnnLossLayer) {
activation = ((CnnLossLayer) layer).getActivationFn();
loss = ((CnnLossLayer) layer).getLossFn();
nOut = ((CnnLossLayer) layer).getNOut();
isLossLayer = true;
} else {
//Not an output layer
return;
}
OutputLayerUtil.validateOutputLayerConfiguration(layerName, nOut, isLossLayer, activation, loss);
} | java | public static void validateOutputLayer(String layerName, Layer layer){
IActivation activation;
ILossFunction loss;
long nOut;
boolean isLossLayer = false;
if (layer instanceof BaseOutputLayer && !(layer instanceof OCNNOutputLayer)) {
activation = ((BaseOutputLayer) layer).getActivationFn();
loss = ((BaseOutputLayer) layer).getLossFn();
nOut = ((BaseOutputLayer) layer).getNOut();
} else if (layer instanceof LossLayer) {
activation = ((LossLayer) layer).getActivationFn();
loss = ((LossLayer) layer).getLossFn();
nOut = ((LossLayer) layer).getNOut();
isLossLayer = true;
} else if (layer instanceof RnnLossLayer) {
activation = ((RnnLossLayer) layer).getActivationFn();
loss = ((RnnLossLayer) layer).getLossFn();
nOut = ((RnnLossLayer) layer).getNOut();
isLossLayer = true;
} else if (layer instanceof CnnLossLayer) {
activation = ((CnnLossLayer) layer).getActivationFn();
loss = ((CnnLossLayer) layer).getLossFn();
nOut = ((CnnLossLayer) layer).getNOut();
isLossLayer = true;
} else {
//Not an output layer
return;
}
OutputLayerUtil.validateOutputLayerConfiguration(layerName, nOut, isLossLayer, activation, loss);
} | [
"public",
"static",
"void",
"validateOutputLayer",
"(",
"String",
"layerName",
",",
"Layer",
"layer",
")",
"{",
"IActivation",
"activation",
";",
"ILossFunction",
"loss",
";",
"long",
"nOut",
";",
"boolean",
"isLossLayer",
"=",
"false",
";",
"if",
"(",
"layer"... | Validate the output layer (or loss layer) configuration, to detect invalid consfiugrations. A DL4JInvalidConfigException
will be thrown for invalid configurations (like softmax + nOut=1).<br>
If the specified layer is not an output layer, this is a no-op
@param layerName Name of the layer
@param layer Layer | [
"Validate",
"the",
"output",
"layer",
"(",
"or",
"loss",
"layer",
")",
"configuration",
"to",
"detect",
"invalid",
"consfiugrations",
".",
"A",
"DL4JInvalidConfigException",
"will",
"be",
"thrown",
"for",
"invalid",
"configurations",
"(",
"like",
"softmax",
"+",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/OutputLayerUtil.java#L74-L103 |
Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java | ClientFactory.registerNamedLoadBalancerFromclientConfig | public static ILoadBalancer registerNamedLoadBalancerFromclientConfig(String name, IClientConfig clientConfig) throws ClientException {
if (namedLBMap.get(name) != null) {
throw new ClientException("LoadBalancer for name " + name + " already exists");
}
ILoadBalancer lb = null;
try {
String loadBalancerClassName = clientConfig.getOrDefault(CommonClientConfigKey.NFLoadBalancerClassName);
lb = (ILoadBalancer) ClientFactory.instantiateInstanceWithClientConfig(loadBalancerClassName, clientConfig);
namedLBMap.put(name, lb);
logger.info("Client: {} instantiated a LoadBalancer: {}", name, lb);
return lb;
} catch (Throwable e) {
throw new ClientException("Unable to instantiate/associate LoadBalancer with Client:" + name, e);
}
} | java | public static ILoadBalancer registerNamedLoadBalancerFromclientConfig(String name, IClientConfig clientConfig) throws ClientException {
if (namedLBMap.get(name) != null) {
throw new ClientException("LoadBalancer for name " + name + " already exists");
}
ILoadBalancer lb = null;
try {
String loadBalancerClassName = clientConfig.getOrDefault(CommonClientConfigKey.NFLoadBalancerClassName);
lb = (ILoadBalancer) ClientFactory.instantiateInstanceWithClientConfig(loadBalancerClassName, clientConfig);
namedLBMap.put(name, lb);
logger.info("Client: {} instantiated a LoadBalancer: {}", name, lb);
return lb;
} catch (Throwable e) {
throw new ClientException("Unable to instantiate/associate LoadBalancer with Client:" + name, e);
}
} | [
"public",
"static",
"ILoadBalancer",
"registerNamedLoadBalancerFromclientConfig",
"(",
"String",
"name",
",",
"IClientConfig",
"clientConfig",
")",
"throws",
"ClientException",
"{",
"if",
"(",
"namedLBMap",
".",
"get",
"(",
"name",
")",
"!=",
"null",
")",
"{",
"th... | Create and register a load balancer with the name and given the class of configClass.
@throws ClientException if load balancer with the same name already exists or any error occurs
@see #instantiateInstanceWithClientConfig(String, IClientConfig) | [
"Create",
"and",
"register",
"a",
"load",
"balancer",
"with",
"the",
"name",
"and",
"given",
"the",
"class",
"of",
"configClass",
"."
] | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java#L178-L192 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.selectField | private TaskField selectField(TaskField[] fields, int index)
{
if (index < 1 || index > fields.length)
{
throw new IllegalArgumentException(index + " is not a valid field index");
}
return (fields[index - 1]);
} | java | private TaskField selectField(TaskField[] fields, int index)
{
if (index < 1 || index > fields.length)
{
throw new IllegalArgumentException(index + " is not a valid field index");
}
return (fields[index - 1]);
} | [
"private",
"TaskField",
"selectField",
"(",
"TaskField",
"[",
"]",
"fields",
",",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"1",
"||",
"index",
">",
"fields",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"index",
"+"... | Maps a field index to a TaskField instance.
@param fields array of fields used as the basis for the mapping.
@param index required field index
@return TaskField instance | [
"Maps",
"a",
"field",
"index",
"to",
"a",
"TaskField",
"instance",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4670-L4677 |
Bearded-Hen/Android-Bootstrap | AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java | AwesomeTextView.setIcon | public void setIcon(CharSequence iconCode, IconSet iconSet) {
setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addIcon(iconCode, iconSet).build());
} | java | public void setIcon(CharSequence iconCode, IconSet iconSet) {
setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addIcon(iconCode, iconSet).build());
} | [
"public",
"void",
"setIcon",
"(",
"CharSequence",
"iconCode",
",",
"IconSet",
"iconSet",
")",
"{",
"setBootstrapText",
"(",
"new",
"BootstrapText",
".",
"Builder",
"(",
"getContext",
"(",
")",
",",
"isInEditMode",
"(",
")",
")",
".",
"addIcon",
"(",
"iconCod... | Sets the text to display a FontIcon, replacing whatever text is already present.
Used to set the text to display a FontAwesome Icon.
@param iconSet - An implementation of FontIcon | [
"Sets",
"the",
"text",
"to",
"display",
"a",
"FontIcon",
"replacing",
"whatever",
"text",
"is",
"already",
"present",
".",
"Used",
"to",
"set",
"the",
"text",
"to",
"display",
"a",
"FontAwesome",
"Icon",
"."
] | train | https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java#L212-L214 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.addItems | private void addItems(Map<String, String> values) {
for (String itemName : values.keySet()) {
setItem(itemName, values.get(itemName));
}
} | java | private void addItems(Map<String, String> values) {
for (String itemName : values.keySet()) {
setItem(itemName, values.get(itemName));
}
} | [
"private",
"void",
"addItems",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"values",
")",
"{",
"for",
"(",
"String",
"itemName",
":",
"values",
".",
"keySet",
"(",
")",
")",
"{",
"setItem",
"(",
"itemName",
",",
"values",
".",
"get",
"(",
"itemNam... | Adds property values to the context item list.
@param values Values to add. | [
"Adds",
"property",
"values",
"to",
"the",
"context",
"item",
"list",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L336-L340 |
google/error-prone | check_api/src/main/java/com/google/errorprone/SuppressionInfo.java | SuppressionInfo.forCompilationUnit | public SuppressionInfo forCompilationUnit(CompilationUnitTree tree, VisitorState state) {
AtomicBoolean generated = new AtomicBoolean(false);
new SimpleTreeVisitor<Void, Void>() {
@Override
public Void visitClass(ClassTree node, Void unused) {
ClassSymbol symbol = ASTHelpers.getSymbol(node);
generated.compareAndSet(false, symbol != null && isGenerated(symbol, state));
return null;
}
}.visit(tree.getTypeDecls(), null);
return new SuppressionInfo(suppressWarningsStrings, customSuppressions, generated.get());
} | java | public SuppressionInfo forCompilationUnit(CompilationUnitTree tree, VisitorState state) {
AtomicBoolean generated = new AtomicBoolean(false);
new SimpleTreeVisitor<Void, Void>() {
@Override
public Void visitClass(ClassTree node, Void unused) {
ClassSymbol symbol = ASTHelpers.getSymbol(node);
generated.compareAndSet(false, symbol != null && isGenerated(symbol, state));
return null;
}
}.visit(tree.getTypeDecls(), null);
return new SuppressionInfo(suppressWarningsStrings, customSuppressions, generated.get());
} | [
"public",
"SuppressionInfo",
"forCompilationUnit",
"(",
"CompilationUnitTree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"AtomicBoolean",
"generated",
"=",
"new",
"AtomicBoolean",
"(",
"false",
")",
";",
"new",
"SimpleTreeVisitor",
"<",
"Void",
",",
"Void",
... | Generates the {@link SuppressionInfo} for a {@link CompilationUnitTree}. This differs in that
{@code isGenerated} is determined by inspecting the annotations of the outermost class so that
matchers on {@link CompilationUnitTree} will also be suppressed. | [
"Generates",
"the",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/SuppressionInfo.java#L116-L127 |
xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java | CuratorFrameworkFactory.newClient | public static CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy)
{
return builder().
connectString(connectString).
sessionTimeoutMs(sessionTimeoutMs).
connectionTimeoutMs(connectionTimeoutMs).
retryPolicy(retryPolicy).
build();
} | java | public static CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy)
{
return builder().
connectString(connectString).
sessionTimeoutMs(sessionTimeoutMs).
connectionTimeoutMs(connectionTimeoutMs).
retryPolicy(retryPolicy).
build();
} | [
"public",
"static",
"CuratorFramework",
"newClient",
"(",
"String",
"connectString",
",",
"int",
"sessionTimeoutMs",
",",
"int",
"connectionTimeoutMs",
",",
"RetryPolicy",
"retryPolicy",
")",
"{",
"return",
"builder",
"(",
")",
".",
"connectString",
"(",
"connectStr... | Create a new client
@param connectString list of servers to connect to
@param sessionTimeoutMs session timeout
@param connectionTimeoutMs connection timeout
@param retryPolicy retry policy to use
@return client | [
"Create",
"a",
"new",
"client"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java#L93-L101 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/resilience/AbstractResilienceStrategy.java | AbstractResilienceStrategy.inconsistent | protected void inconsistent(Iterable<? extends K> keys, StoreAccessException because, StoreAccessException... cleanup) {
pacedErrorLog("Ehcache keys {} in possible inconsistent state", keys, because);
} | java | protected void inconsistent(Iterable<? extends K> keys, StoreAccessException because, StoreAccessException... cleanup) {
pacedErrorLog("Ehcache keys {} in possible inconsistent state", keys, because);
} | [
"protected",
"void",
"inconsistent",
"(",
"Iterable",
"<",
"?",
"extends",
"K",
">",
"keys",
",",
"StoreAccessException",
"because",
",",
"StoreAccessException",
"...",
"cleanup",
")",
"{",
"pacedErrorLog",
"(",
"\"Ehcache keys {} in possible inconsistent state\"",
",",... | Called when the cache failed to recover from a failing store operation on a list of keys.
@param keys
@param because exception thrown by the failing operation
@param cleanup all the exceptions that occurred during cleanup | [
"Called",
"when",
"the",
"cache",
"failed",
"to",
"recover",
"from",
"a",
"failing",
"store",
"operation",
"on",
"a",
"list",
"of",
"keys",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/AbstractResilienceStrategy.java#L157-L159 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java | DomainsInner.getOwnershipIdentifierAsync | public Observable<DomainOwnershipIdentifierInner> getOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name) {
return getOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name).map(new Func1<ServiceResponse<DomainOwnershipIdentifierInner>, DomainOwnershipIdentifierInner>() {
@Override
public DomainOwnershipIdentifierInner call(ServiceResponse<DomainOwnershipIdentifierInner> response) {
return response.body();
}
});
} | java | public Observable<DomainOwnershipIdentifierInner> getOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name) {
return getOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name).map(new Func1<ServiceResponse<DomainOwnershipIdentifierInner>, DomainOwnershipIdentifierInner>() {
@Override
public DomainOwnershipIdentifierInner call(ServiceResponse<DomainOwnershipIdentifierInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DomainOwnershipIdentifierInner",
">",
"getOwnershipIdentifierAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"domainName",
",",
"String",
"name",
")",
"{",
"return",
"getOwnershipIdentifierWithServiceResponseAsync",
"(",
"resourceGroup... | Get ownership identifier for domain.
Get ownership identifier for domain.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param domainName Name of domain.
@param name Name of identifier.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DomainOwnershipIdentifierInner object | [
"Get",
"ownership",
"identifier",
"for",
"domain",
".",
"Get",
"ownership",
"identifier",
"for",
"domain",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java#L1452-L1459 |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java | RocksDBIncrementalRestoreOperation.restoreInstanceDirectoryFromPath | private void restoreInstanceDirectoryFromPath(Path source, String instanceRocksDBPath) throws IOException {
FileSystem fileSystem = source.getFileSystem();
final FileStatus[] fileStatuses = fileSystem.listStatus(source);
if (fileStatuses == null) {
throw new IOException("Cannot list file statues. Directory " + source + " does not exist.");
}
for (FileStatus fileStatus : fileStatuses) {
final Path filePath = fileStatus.getPath();
final String fileName = filePath.getName();
File restoreFile = new File(source.getPath(), fileName);
File targetFile = new File(instanceRocksDBPath, fileName);
if (fileName.endsWith(SST_FILE_SUFFIX)) {
// hardlink'ing the immutable sst-files.
Files.createLink(targetFile.toPath(), restoreFile.toPath());
} else {
// true copy for all other files.
Files.copy(restoreFile.toPath(), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
} | java | private void restoreInstanceDirectoryFromPath(Path source, String instanceRocksDBPath) throws IOException {
FileSystem fileSystem = source.getFileSystem();
final FileStatus[] fileStatuses = fileSystem.listStatus(source);
if (fileStatuses == null) {
throw new IOException("Cannot list file statues. Directory " + source + " does not exist.");
}
for (FileStatus fileStatus : fileStatuses) {
final Path filePath = fileStatus.getPath();
final String fileName = filePath.getName();
File restoreFile = new File(source.getPath(), fileName);
File targetFile = new File(instanceRocksDBPath, fileName);
if (fileName.endsWith(SST_FILE_SUFFIX)) {
// hardlink'ing the immutable sst-files.
Files.createLink(targetFile.toPath(), restoreFile.toPath());
} else {
// true copy for all other files.
Files.copy(restoreFile.toPath(), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
} | [
"private",
"void",
"restoreInstanceDirectoryFromPath",
"(",
"Path",
"source",
",",
"String",
"instanceRocksDBPath",
")",
"throws",
"IOException",
"{",
"FileSystem",
"fileSystem",
"=",
"source",
".",
"getFileSystem",
"(",
")",
";",
"final",
"FileStatus",
"[",
"]",
... | This recreates the new working directory of the recovered RocksDB instance and links/copies the contents from
a local state. | [
"This",
"recreates",
"the",
"new",
"working",
"directory",
"of",
"the",
"recovered",
"RocksDB",
"instance",
"and",
"links",
"/",
"copies",
"the",
"contents",
"from",
"a",
"local",
"state",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java#L456-L479 |
grpc/grpc-java | alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java | RpcProtocolVersionsUtil.isGreaterThanOrEqualTo | @VisibleForTesting
static boolean isGreaterThanOrEqualTo(Version first, Version second) {
if ((first.getMajor() > second.getMajor())
|| (first.getMajor() == second.getMajor() && first.getMinor() >= second.getMinor())) {
return true;
}
return false;
} | java | @VisibleForTesting
static boolean isGreaterThanOrEqualTo(Version first, Version second) {
if ((first.getMajor() > second.getMajor())
|| (first.getMajor() == second.getMajor() && first.getMinor() >= second.getMinor())) {
return true;
}
return false;
} | [
"@",
"VisibleForTesting",
"static",
"boolean",
"isGreaterThanOrEqualTo",
"(",
"Version",
"first",
",",
"Version",
"second",
")",
"{",
"if",
"(",
"(",
"first",
".",
"getMajor",
"(",
")",
">",
"second",
".",
"getMajor",
"(",
")",
")",
"||",
"(",
"first",
"... | Returns true if first Rpc Protocol Version is greater than or equal to the second one. Returns
false otherwise. | [
"Returns",
"true",
"if",
"first",
"Rpc",
"Protocol",
"Version",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"second",
"one",
".",
"Returns",
"false",
"otherwise",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java#L53-L60 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java | JvmTypesBuilder.newTypeRef | @Deprecated
public JvmTypeReference newTypeRef(JvmType type, JvmTypeReference... typeArgs) {
return references.createTypeRef(type, typeArgs);
} | java | @Deprecated
public JvmTypeReference newTypeRef(JvmType type, JvmTypeReference... typeArgs) {
return references.createTypeRef(type, typeArgs);
} | [
"@",
"Deprecated",
"public",
"JvmTypeReference",
"newTypeRef",
"(",
"JvmType",
"type",
",",
"JvmTypeReference",
"...",
"typeArgs",
")",
"{",
"return",
"references",
".",
"createTypeRef",
"(",
"type",
",",
"typeArgs",
")",
";",
"}"
] | Creates a new {@link JvmTypeReference} pointing to the given class and containing the given type arguments.
@param type
the type the reference shall point to.
@param typeArgs
type arguments
@return the newly created {@link JvmTypeReference}
@deprecated use {@link JvmTypeReferenceBuilder#typeRef(JvmType, JvmTypeReference...)} | [
"Creates",
"a",
"new",
"{",
"@link",
"JvmTypeReference",
"}",
"pointing",
"to",
"the",
"given",
"class",
"and",
"containing",
"the",
"given",
"type",
"arguments",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L1333-L1336 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java | StorageAccountsInner.listByAccountAsync | public Observable<Page<StorageAccountInformationInner>> listByAccountAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) {
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName, filter, top, skip, select, orderby, count)
.map(new Func1<ServiceResponse<Page<StorageAccountInformationInner>>, Page<StorageAccountInformationInner>>() {
@Override
public Page<StorageAccountInformationInner> call(ServiceResponse<Page<StorageAccountInformationInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<StorageAccountInformationInner>> listByAccountAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) {
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName, filter, top, skip, select, orderby, count)
.map(new Func1<ServiceResponse<Page<StorageAccountInformationInner>>, Page<StorageAccountInformationInner>>() {
@Override
public Page<StorageAccountInformationInner> call(ServiceResponse<Page<StorageAccountInformationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"StorageAccountInformationInner",
">",
">",
"listByAccountAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
",",
"final",
"String",
"filter",
",",
"final",
"Integer",
"top",
",",
"... | Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param filter The OData filter. Optional.
@param top The number of items to return. Optional.
@param skip The number of items to skip over before returning elements. Optional.
@param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional.
@param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional.
@param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<StorageAccountInformationInner> object | [
"Gets",
"the",
"first",
"page",
"of",
"Azure",
"Storage",
"accounts",
"if",
"any",
"linked",
"to",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
".",
"The",
"response",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java#L303-L311 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/CUtil.java | CUtil.sameSet | public static boolean sameSet(final Object[] a, final Vector b) {
if (a == null || b == null || a.length != b.size()) {
return false;
}
if (a.length == 0) {
return true;
}
// Convert the array into a set
final Hashtable t = new Hashtable();
for (final Object element : a) {
t.put(element, element);
}
for (int i = 0; i < b.size(); i++) {
final Object o = b.elementAt(i);
if (t.remove(o) == null) {
return false;
}
}
return t.size() == 0;
} | java | public static boolean sameSet(final Object[] a, final Vector b) {
if (a == null || b == null || a.length != b.size()) {
return false;
}
if (a.length == 0) {
return true;
}
// Convert the array into a set
final Hashtable t = new Hashtable();
for (final Object element : a) {
t.put(element, element);
}
for (int i = 0; i < b.size(); i++) {
final Object o = b.elementAt(i);
if (t.remove(o) == null) {
return false;
}
}
return t.size() == 0;
} | [
"public",
"static",
"boolean",
"sameSet",
"(",
"final",
"Object",
"[",
"]",
"a",
",",
"final",
"Vector",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"null",
"||",
"b",
"==",
"null",
"||",
"a",
".",
"length",
"!=",
"b",
".",
"size",
"(",
")",
")",
"{",... | Compares the contents of an array and a Vector for set equality. Assumes
input array and vector are sets (i.e. no duplicate entries) | [
"Compares",
"the",
"contents",
"of",
"an",
"array",
"and",
"a",
"Vector",
"for",
"set",
"equality",
".",
"Assumes",
"input",
"array",
"and",
"vector",
"are",
"sets",
"(",
"i",
".",
"e",
".",
"no",
"duplicate",
"entries",
")"
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/CUtil.java#L464-L483 |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java | StaxUtils.copy | public static void copy(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
copy(reader, writer, false, false);
} | java | public static void copy(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
copy(reader, writer, false, false);
} | [
"public",
"static",
"void",
"copy",
"(",
"XMLStreamReader",
"reader",
",",
"XMLStreamWriter",
"writer",
")",
"throws",
"XMLStreamException",
"{",
"copy",
"(",
"reader",
",",
"writer",
",",
"false",
",",
"false",
")",
";",
"}"
] | Copies the reader to the writer. The start and end document methods must
be handled on the writer manually.
@param reader
@param writer
@throws XMLStreamException | [
"Copies",
"the",
"reader",
"to",
"the",
"writer",
".",
"The",
"start",
"and",
"end",
"document",
"methods",
"must",
"be",
"handled",
"on",
"the",
"writer",
"manually",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java#L729-L731 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/FormatUtils.java | FormatUtils.condenseFileSize | public static String condenseFileSize(long bytes, String precision) throws IllegalFormatException {
// Kilobyte Check
float kilo = bytes / 1024f;
float mega = kilo / 1024f;
float giga = mega / 1024f;
float tera = giga / 1024f;
float peta = tera / 1024f;
// Determine which value to send back
if(peta > 1)
return String.format(precision + " PB", peta);
else if (tera > 1)
return String.format(precision + " TB", tera);
else if(giga > 1)
return String.format(precision + " GB", giga);
else if(mega > 1)
return String.format(precision + " MB", mega);
else if(kilo > 1)
return String.format(precision + " KB", kilo);
else
return bytes + " b";
} | java | public static String condenseFileSize(long bytes, String precision) throws IllegalFormatException {
// Kilobyte Check
float kilo = bytes / 1024f;
float mega = kilo / 1024f;
float giga = mega / 1024f;
float tera = giga / 1024f;
float peta = tera / 1024f;
// Determine which value to send back
if(peta > 1)
return String.format(precision + " PB", peta);
else if (tera > 1)
return String.format(precision + " TB", tera);
else if(giga > 1)
return String.format(precision + " GB", giga);
else if(mega > 1)
return String.format(precision + " MB", mega);
else if(kilo > 1)
return String.format(precision + " KB", kilo);
else
return bytes + " b";
} | [
"public",
"static",
"String",
"condenseFileSize",
"(",
"long",
"bytes",
",",
"String",
"precision",
")",
"throws",
"IllegalFormatException",
"{",
"// Kilobyte Check",
"float",
"kilo",
"=",
"bytes",
"/",
"1024f",
";",
"float",
"mega",
"=",
"kilo",
"/",
"1024f",
... | Condense a file size in bytes to it's highest form (i.e. KB, MB, GB, etc)
@param bytes the size in bytes
@param precision the precision constant {@code ONE_DIGIT}, {@code TWO_DIGIT}, {@code THREE_DIGIT}
@return the condensed string | [
"Condense",
"a",
"file",
"size",
"in",
"bytes",
"to",
"it",
"s",
"highest",
"form",
"(",
"i",
".",
"e",
".",
"KB",
"MB",
"GB",
"etc",
")"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/FormatUtils.java#L93-L116 |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/QuickSelectDBIDs.java | QuickSelectDBIDs.quickSelect | public static void quickSelect(ArrayModifiableDBIDs data, Comparator<? super DBIDRef> comparator, int rank) {
quickSelect(data, comparator, 0, data.size(), rank);
} | java | public static void quickSelect(ArrayModifiableDBIDs data, Comparator<? super DBIDRef> comparator, int rank) {
quickSelect(data, comparator, 0, data.size(), rank);
} | [
"public",
"static",
"void",
"quickSelect",
"(",
"ArrayModifiableDBIDs",
"data",
",",
"Comparator",
"<",
"?",
"super",
"DBIDRef",
">",
"comparator",
",",
"int",
"rank",
")",
"{",
"quickSelect",
"(",
"data",
",",
"comparator",
",",
"0",
",",
"data",
".",
"si... | QuickSelect is essentially quicksort, except that we only "sort" that half
of the array that we are interested in.
Note: the array is <b>modified</b> by this.
@param data Data to process
@param comparator Comparator to use
@param rank Rank position that we are interested in (integer!) | [
"QuickSelect",
"is",
"essentially",
"quicksort",
"except",
"that",
"we",
"only",
"sort",
"that",
"half",
"of",
"the",
"array",
"that",
"we",
"are",
"interested",
"in",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/QuickSelectDBIDs.java#L88-L90 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.listFromTask | public PagedList<NodeFile> listFromTask(final String jobId, final String taskId) {
ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> response = listFromTaskSinglePageAsync(jobId, taskId).toBlocking().single();
return new PagedList<NodeFile>(response.body()) {
@Override
public Page<NodeFile> nextPage(String nextPageLink) {
return listFromTaskNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
} | java | public PagedList<NodeFile> listFromTask(final String jobId, final String taskId) {
ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> response = listFromTaskSinglePageAsync(jobId, taskId).toBlocking().single();
return new PagedList<NodeFile>(response.body()) {
@Override
public Page<NodeFile> nextPage(String nextPageLink) {
return listFromTaskNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
} | [
"public",
"PagedList",
"<",
"NodeFile",
">",
"listFromTask",
"(",
"final",
"String",
"jobId",
",",
"final",
"String",
"taskId",
")",
"{",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"NodeFile",
">",
",",
"FileListFromTaskHeaders",
">",
"response",
"=",
"list... | Lists the files in a task's directory on its compute node.
@param jobId The ID of the job that contains the task.
@param taskId The ID of the task whose files you want to list.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PagedList<NodeFile> object if successful. | [
"Lists",
"the",
"files",
"in",
"a",
"task",
"s",
"directory",
"on",
"its",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L1605-L1613 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_promotionCode_generate_POST | public OvhTask packName_promotionCode_generate_POST(String packName) throws IOException {
String qPath = "/pack/xdsl/{packName}/promotionCode/generate";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask packName_promotionCode_generate_POST(String packName) throws IOException {
String qPath = "/pack/xdsl/{packName}/promotionCode/generate";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"packName_promotionCode_generate_POST",
"(",
"String",
"packName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/promotionCode/generate\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"packName",
... | Creates a task to generate a new promotion code
REST: POST /pack/xdsl/{packName}/promotionCode/generate
@param packName [required] The internal name of your pack | [
"Creates",
"a",
"task",
"to",
"generate",
"a",
"new",
"promotion",
"code"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L801-L806 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java | ProductSearchClient.addProductToProductSet | public final void addProductToProductSet(String name, String product) {
AddProductToProductSetRequest request =
AddProductToProductSetRequest.newBuilder().setName(name).setProduct(product).build();
addProductToProductSet(request);
} | java | public final void addProductToProductSet(String name, String product) {
AddProductToProductSetRequest request =
AddProductToProductSetRequest.newBuilder().setName(name).setProduct(product).build();
addProductToProductSet(request);
} | [
"public",
"final",
"void",
"addProductToProductSet",
"(",
"String",
"name",
",",
"String",
"product",
")",
"{",
"AddProductToProductSetRequest",
"request",
"=",
"AddProductToProductSetRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"s... | Adds a Product to the specified ProductSet. If the Product is already present, no change is
made.
<p>One Product can be added to at most 100 ProductSets.
<p>Possible errors:
<p>* Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
<p>Sample code:
<pre><code>
try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
productSearchClient.addProductToProductSet(name.toString(), product.toString());
}
</code></pre>
@param name The resource name for the ProductSet to modify.
<p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
@param product The resource name for the Product to be added to this ProductSet.
<p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Adds",
"a",
"Product",
"to",
"the",
"specified",
"ProductSet",
".",
"If",
"the",
"Product",
"is",
"already",
"present",
"no",
"change",
"is",
"made",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java#L2294-L2299 |
jtmelton/appsensor | analysis-engines/appsensor-analysis-reference/src/main/java/org/owasp/appsensor/analysis/ReferenceEventAnalysisEngine.java | ReferenceEventAnalysisEngine.findMostRecentAttackTime | protected DateTime findMostRecentAttackTime(Event event, DetectionPoint configuredDetectionPoint) {
DateTime newest = DateUtils.epoch();
SearchCriteria criteria = new SearchCriteria().
setUser(event.getUser()).
setDetectionPoint(configuredDetectionPoint).
setDetectionSystemIds(appSensorServer.getConfiguration().getRelatedDetectionSystems(event.getDetectionSystem()));
Collection<Attack> attacks = appSensorServer.getAttackStore().findAttacks(criteria);
for (Attack attack : attacks) {
if (DateUtils.fromString(attack.getTimestamp()).isAfter(newest)) {
newest = DateUtils.fromString(attack.getTimestamp());
}
}
return newest;
} | java | protected DateTime findMostRecentAttackTime(Event event, DetectionPoint configuredDetectionPoint) {
DateTime newest = DateUtils.epoch();
SearchCriteria criteria = new SearchCriteria().
setUser(event.getUser()).
setDetectionPoint(configuredDetectionPoint).
setDetectionSystemIds(appSensorServer.getConfiguration().getRelatedDetectionSystems(event.getDetectionSystem()));
Collection<Attack> attacks = appSensorServer.getAttackStore().findAttacks(criteria);
for (Attack attack : attacks) {
if (DateUtils.fromString(attack.getTimestamp()).isAfter(newest)) {
newest = DateUtils.fromString(attack.getTimestamp());
}
}
return newest;
} | [
"protected",
"DateTime",
"findMostRecentAttackTime",
"(",
"Event",
"event",
",",
"DetectionPoint",
"configuredDetectionPoint",
")",
"{",
"DateTime",
"newest",
"=",
"DateUtils",
".",
"epoch",
"(",
")",
";",
"SearchCriteria",
"criteria",
"=",
"new",
"SearchCriteria",
... | Find most recent {@link Attack} matching the given {@link Event} {@link User}, {@link DetectionPoint}
matching the currently configured detection point (supporting multiple detection points per label),
detection system and find it's timestamp.
The {@link Event} should only be counted if they've occurred after the most recent {@link Attack}.
@param event {@link Event} to use to find matching {@link Attack}s
@param configuredDetectionPoint {@link DetectionPoint} to use to find matching {@link Attack}s
@return timestamp representing last matching {@link Attack}, or -1L if not found | [
"Find",
"most",
"recent",
"{",
"@link",
"Attack",
"}",
"matching",
"the",
"given",
"{",
"@link",
"Event",
"}",
"{",
"@link",
"User",
"}",
"{",
"@link",
"DetectionPoint",
"}",
"matching",
"the",
"currently",
"configured",
"detection",
"point",
"(",
"supportin... | train | https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/analysis-engines/appsensor-analysis-reference/src/main/java/org/owasp/appsensor/analysis/ReferenceEventAnalysisEngine.java#L157-L174 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/linsol/qr/LinearSolverQr_ZDRM.java | LinearSolverQr_ZDRM.setMaxSize | public void setMaxSize( int maxRows , int maxCols )
{
this.maxRows = maxRows; this.maxCols = maxCols;
Q = new ZMatrixRMaj(maxRows,maxRows);
Qt = new ZMatrixRMaj(maxRows,maxRows);
R = new ZMatrixRMaj(maxRows,maxCols);
Y = new ZMatrixRMaj(maxRows,1);
Z = new ZMatrixRMaj(maxRows,1);
} | java | public void setMaxSize( int maxRows , int maxCols )
{
this.maxRows = maxRows; this.maxCols = maxCols;
Q = new ZMatrixRMaj(maxRows,maxRows);
Qt = new ZMatrixRMaj(maxRows,maxRows);
R = new ZMatrixRMaj(maxRows,maxCols);
Y = new ZMatrixRMaj(maxRows,1);
Z = new ZMatrixRMaj(maxRows,1);
} | [
"public",
"void",
"setMaxSize",
"(",
"int",
"maxRows",
",",
"int",
"maxCols",
")",
"{",
"this",
".",
"maxRows",
"=",
"maxRows",
";",
"this",
".",
"maxCols",
"=",
"maxCols",
";",
"Q",
"=",
"new",
"ZMatrixRMaj",
"(",
"maxRows",
",",
"maxRows",
")",
";",
... | Changes the size of the matrix it can solve for
@param maxRows Maximum number of rows in the matrix it will decompose.
@param maxCols Maximum number of columns in the matrix it will decompose. | [
"Changes",
"the",
"size",
"of",
"the",
"matrix",
"it",
"can",
"solve",
"for"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/linsol/qr/LinearSolverQr_ZDRM.java#L70-L80 |
pedrovgs/DraggablePanel | draggablepanel/src/main/java/com/github/pedrovgs/DraggableViewCallback.java | DraggableViewCallback.onViewPositionChanged | @Override public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
if (draggableView.isDragViewAtBottom()) {
draggableView.changeDragViewViewAlpha();
} else {
draggableView.restoreAlpha();
draggableView.changeDragViewScale();
draggableView.changeDragViewPosition();
draggableView.changeSecondViewAlpha();
draggableView.changeSecondViewPosition();
draggableView.changeBackgroundAlpha();
}
} | java | @Override public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
if (draggableView.isDragViewAtBottom()) {
draggableView.changeDragViewViewAlpha();
} else {
draggableView.restoreAlpha();
draggableView.changeDragViewScale();
draggableView.changeDragViewPosition();
draggableView.changeSecondViewAlpha();
draggableView.changeSecondViewPosition();
draggableView.changeBackgroundAlpha();
}
} | [
"@",
"Override",
"public",
"void",
"onViewPositionChanged",
"(",
"View",
"changedView",
",",
"int",
"left",
",",
"int",
"top",
",",
"int",
"dx",
",",
"int",
"dy",
")",
"{",
"if",
"(",
"draggableView",
".",
"isDragViewAtBottom",
"(",
")",
")",
"{",
"dragg... | Override method used to apply different scale and alpha effects while the view is being
dragged.
@param left position.
@param top position.
@param dx change in X position from the last call.
@param dy change in Y position from the last call. | [
"Override",
"method",
"used",
"to",
"apply",
"different",
"scale",
"and",
"alpha",
"effects",
"while",
"the",
"view",
"is",
"being",
"dragged",
"."
] | train | https://github.com/pedrovgs/DraggablePanel/blob/6b6d1806fa4140113f31307a2571bf02435aa53a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableViewCallback.java#L56-L67 |
roboconf/roboconf-platform | core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java | AgentProperties.readIaasProperties | public static AgentProperties readIaasProperties( String rawProperties, Logger logger ) throws IOException {
Properties props = Utils.readPropertiesQuietly( rawProperties, logger );
return readIaasProperties( props );
} | java | public static AgentProperties readIaasProperties( String rawProperties, Logger logger ) throws IOException {
Properties props = Utils.readPropertiesQuietly( rawProperties, logger );
return readIaasProperties( props );
} | [
"public",
"static",
"AgentProperties",
"readIaasProperties",
"(",
"String",
"rawProperties",
",",
"Logger",
"logger",
")",
"throws",
"IOException",
"{",
"Properties",
"props",
"=",
"Utils",
".",
"readPropertiesQuietly",
"(",
"rawProperties",
",",
"logger",
")",
";",... | Creates a new bean from raw properties that will be parsed.
@param rawProperties a non-null string
@param logger a logger (not null)
@return a non-null bean
@throws IOException if there were files that failed to be written | [
"Creates",
"a",
"new",
"bean",
"from",
"raw",
"properties",
"that",
"will",
"be",
"parsed",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java#L166-L170 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java | ElementBase.moveChild | protected void moveChild(BaseUIComponent child, BaseUIComponent before) {
child.getParent().addChild(child, before);
} | java | protected void moveChild(BaseUIComponent child, BaseUIComponent before) {
child.getParent().addChild(child, before);
} | [
"protected",
"void",
"moveChild",
"(",
"BaseUIComponent",
"child",
",",
"BaseUIComponent",
"before",
")",
"{",
"child",
".",
"getParent",
"(",
")",
".",
"addChild",
"(",
"child",
",",
"before",
")",
";",
"}"
] | Moves a child to before another component.
@param child Child to move
@param before Move child to this component. | [
"Moves",
"a",
"child",
"to",
"before",
"another",
"component",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L763-L765 |
Microsoft/azure-maven-plugins | azure-maven-plugin-lib/src/main/java/com/microsoft/azure/maven/Utils.java | Utils.copyResources | public static void copyResources(final MavenProject project, final MavenSession session,
final MavenResourcesFiltering filtering, final List<Resource> resources,
final String targetDirectory) throws IOException {
for (final Resource resource : resources) {
final String targetPath = resource.getTargetPath() == null ? "" : resource.getTargetPath();
resource.setTargetPath(Paths.get(targetDirectory, targetPath).toString());
resource.setFiltering(false);
}
final MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(
resources,
new File(targetDirectory),
project,
"UTF-8",
null,
Collections.EMPTY_LIST,
session
);
// Configure executor
mavenResourcesExecution.setEscapeWindowsPaths(true);
mavenResourcesExecution.setInjectProjectBuildFilters(false);
mavenResourcesExecution.setOverwrite(true);
mavenResourcesExecution.setIncludeEmptyDirs(false);
mavenResourcesExecution.setSupportMultiLineFiltering(false);
// Filter resources
try {
filtering.filterResources(mavenResourcesExecution);
} catch (MavenFilteringException ex) {
throw new IOException("Failed to copy resources", ex);
}
} | java | public static void copyResources(final MavenProject project, final MavenSession session,
final MavenResourcesFiltering filtering, final List<Resource> resources,
final String targetDirectory) throws IOException {
for (final Resource resource : resources) {
final String targetPath = resource.getTargetPath() == null ? "" : resource.getTargetPath();
resource.setTargetPath(Paths.get(targetDirectory, targetPath).toString());
resource.setFiltering(false);
}
final MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(
resources,
new File(targetDirectory),
project,
"UTF-8",
null,
Collections.EMPTY_LIST,
session
);
// Configure executor
mavenResourcesExecution.setEscapeWindowsPaths(true);
mavenResourcesExecution.setInjectProjectBuildFilters(false);
mavenResourcesExecution.setOverwrite(true);
mavenResourcesExecution.setIncludeEmptyDirs(false);
mavenResourcesExecution.setSupportMultiLineFiltering(false);
// Filter resources
try {
filtering.filterResources(mavenResourcesExecution);
} catch (MavenFilteringException ex) {
throw new IOException("Failed to copy resources", ex);
}
} | [
"public",
"static",
"void",
"copyResources",
"(",
"final",
"MavenProject",
"project",
",",
"final",
"MavenSession",
"session",
",",
"final",
"MavenResourcesFiltering",
"filtering",
",",
"final",
"List",
"<",
"Resource",
">",
"resources",
",",
"final",
"String",
"t... | Copy resources to target directory using Maven resource filtering so that we don't have to handle
recursive directory listing and pattern matching.
In order to disable filtering, the "filtering" property is force set to False.
@param project
@param session
@param filtering
@param resources
@param targetDirectory
@throws IOException | [
"Copy",
"resources",
"to",
"target",
"directory",
"using",
"Maven",
"resource",
"filtering",
"so",
"that",
"we",
"don",
"t",
"have",
"to",
"handle",
"recursive",
"directory",
"listing",
"and",
"pattern",
"matching",
".",
"In",
"order",
"to",
"disable",
"filter... | train | https://github.com/Microsoft/azure-maven-plugins/blob/a254902e820185df1823b1d692c7c1d119490b1e/azure-maven-plugin-lib/src/main/java/com/microsoft/azure/maven/Utils.java#L97-L129 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheService.java | AbstractCacheService.sendInvalidationEvent | @Override
public void sendInvalidationEvent(String cacheNameWithPrefix, Data key, String sourceUuid) {
cacheEventHandler.sendInvalidationEvent(cacheNameWithPrefix, key, sourceUuid);
} | java | @Override
public void sendInvalidationEvent(String cacheNameWithPrefix, Data key, String sourceUuid) {
cacheEventHandler.sendInvalidationEvent(cacheNameWithPrefix, key, sourceUuid);
} | [
"@",
"Override",
"public",
"void",
"sendInvalidationEvent",
"(",
"String",
"cacheNameWithPrefix",
",",
"Data",
"key",
",",
"String",
"sourceUuid",
")",
"{",
"cacheEventHandler",
".",
"sendInvalidationEvent",
"(",
"cacheNameWithPrefix",
",",
"key",
",",
"sourceUuid",
... | Sends an invalidation event for given <code>cacheName</code> with specified <code>key</code>
from mentioned source with <code>sourceUuid</code>.
@param cacheNameWithPrefix the name of the cache that invalidation event is sent for
@param key the {@link com.hazelcast.nio.serialization.Data} represents the invalidation event
@param sourceUuid an ID that represents the source for invalidation event | [
"Sends",
"an",
"invalidation",
"event",
"for",
"given",
"<code",
">",
"cacheName<",
"/",
"code",
">",
"with",
"specified",
"<code",
">",
"key<",
"/",
"code",
">",
"from",
"mentioned",
"source",
"with",
"<code",
">",
"sourceUuid<",
"/",
"code",
">",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheService.java#L818-L821 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java | BaseXmlParser.getTagChildren | protected NodeList getTagChildren(String tagName, Element element) {
return element.getNamespaceURI() == null ? element.getElementsByTagName(tagName) : element.getElementsByTagNameNS(
element.getNamespaceURI(), tagName);
} | java | protected NodeList getTagChildren(String tagName, Element element) {
return element.getNamespaceURI() == null ? element.getElementsByTagName(tagName) : element.getElementsByTagNameNS(
element.getNamespaceURI(), tagName);
} | [
"protected",
"NodeList",
"getTagChildren",
"(",
"String",
"tagName",
",",
"Element",
"element",
")",
"{",
"return",
"element",
".",
"getNamespaceURI",
"(",
")",
"==",
"null",
"?",
"element",
".",
"getElementsByTagName",
"(",
"tagName",
")",
":",
"element",
"."... | Returns the children under the specified tag. Compensates for namespace usage.
@param tagName Name of tag whose children are sought.
@param element Element to search for tag.
@return Node list containing children of tag. | [
"Returns",
"the",
"children",
"under",
"the",
"specified",
"tag",
".",
"Compensates",
"for",
"namespace",
"usage",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L82-L85 |
s1-platform/s1 | s1-core/src/java/org/s1/ws/SOAPOperation.java | SOAPOperation.getAction | protected String getAction(String service, SOAPMessage msg, HttpServletRequest request){
if(!request.getMethod().equalsIgnoreCase("post")){
return null;
}
String a = null;
Element action = null;
try {
action = XMLFormat.getFirstChildElement(msg.getSOAPBody(), null, null);
} catch (SOAPException e) {
throw S1SystemError.wrap(e);
}
if(action!=null)
a = action.getLocalName();
return a;
} | java | protected String getAction(String service, SOAPMessage msg, HttpServletRequest request){
if(!request.getMethod().equalsIgnoreCase("post")){
return null;
}
String a = null;
Element action = null;
try {
action = XMLFormat.getFirstChildElement(msg.getSOAPBody(), null, null);
} catch (SOAPException e) {
throw S1SystemError.wrap(e);
}
if(action!=null)
a = action.getLocalName();
return a;
} | [
"protected",
"String",
"getAction",
"(",
"String",
"service",
",",
"SOAPMessage",
"msg",
",",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"!",
"request",
".",
"getMethod",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"\"post\"",
")",
")",
"{",
"return",... | Get SOAPAction, try to get it from first body child name
@param service
@param msg
@param request
@return | [
"Get",
"SOAPAction",
"try",
"to",
"get",
"it",
"from",
"first",
"body",
"child",
"name"
] | train | https://github.com/s1-platform/s1/blob/370101c13fef01af524bc171bcc1a97e5acc76e8/s1-core/src/java/org/s1/ws/SOAPOperation.java#L178-L193 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.