repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendImageTag | public XHTMLText appendImageTag(String align, String alt, String height, String src, String width) {
text.halfOpenElement(IMG);
text.optAttribute("align", align);
text.optAttribute("alt", alt);
text.optAttribute("height", height);
text.optAttribute("src", src);
text.optAttribute("width", width);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendImageTag(String align, String alt, String height, String src, String width) {
text.halfOpenElement(IMG);
text.optAttribute("align", align);
text.optAttribute("alt", alt);
text.optAttribute("height", height);
text.optAttribute("src", src);
text.optAttribute("width", width);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendImageTag",
"(",
"String",
"align",
",",
"String",
"alt",
",",
"String",
"height",
",",
"String",
"src",
",",
"String",
"width",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"IMG",
")",
";",
"text",
".",
"optAttribute",
"(",
... | Appends a tag that indicates an image.
@param align how text should flow around the picture
@param alt the text to show if you don't show the picture
@param height how tall is the picture
@param src where to get the picture
@param width how wide is the picture
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"an",
"image",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L237-L246 |
eurekaclinical/eurekaclinical-common | src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java | EurekaClinicalClient.doPostMultipart | public void doPostMultipart(String path, FormDataMultiPart formDataMultiPart, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper()
.rewritten(path, HttpMethod.POST).getRequestBuilder();
requestBuilder = ensurePostMultipartHeaders(headers, requestBuilder);
ClientResponse response = requestBuilder
.post(ClientResponse.class, formDataMultiPart);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.NO_CONTENT);
response.close();
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | java | public void doPostMultipart(String path, FormDataMultiPart formDataMultiPart, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper()
.rewritten(path, HttpMethod.POST).getRequestBuilder();
requestBuilder = ensurePostMultipartHeaders(headers, requestBuilder);
ClientResponse response = requestBuilder
.post(ClientResponse.class, formDataMultiPart);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.NO_CONTENT);
response.close();
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | [
"public",
"void",
"doPostMultipart",
"(",
"String",
"path",
",",
"FormDataMultiPart",
"formDataMultiPart",
",",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"ClientException",
"{",
"this",
".",
"readLock",
".",
"lock",
"(",
")",... | Submits a multi-part form.
@param path the API to call.
@param formDataMultiPart the multi-part form content.
@param headers any headers to add. If no Content Type header is provided,
this method adds a Content Type header for multi-part forms data.
@throws ClientException if a status code other than 200 (OK) and 204 (No
Content) is returned. | [
"Submits",
"a",
"multi",
"-",
"part",
"form",
"."
] | train | https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L666-L681 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java | ByteConverter.int4 | public static void int4(byte[] target, int idx, int value) {
target[idx + 0] = (byte) (value >>> 24);
target[idx + 1] = (byte) (value >>> 16);
target[idx + 2] = (byte) (value >>> 8);
target[idx + 3] = (byte) value;
} | java | public static void int4(byte[] target, int idx, int value) {
target[idx + 0] = (byte) (value >>> 24);
target[idx + 1] = (byte) (value >>> 16);
target[idx + 2] = (byte) (value >>> 8);
target[idx + 3] = (byte) value;
} | [
"public",
"static",
"void",
"int4",
"(",
"byte",
"[",
"]",
"target",
",",
"int",
"idx",
",",
"int",
"value",
")",
"{",
"target",
"[",
"idx",
"+",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"24",
")",
";",
"target",
"[",
"idx",
"+",
... | Encodes a int value to the byte array.
@param target The byte array to encode to.
@param idx The starting index in the byte array.
@param value The value to encode. | [
"Encodes",
"a",
"int",
"value",
"to",
"the",
"byte",
"array",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java#L124-L129 |
aragozin/jvm-tools | hprof-heap/src/main/java/org/gridkit/jvmtool/util/PagedBitMap.java | PagedBitMap.addWithOverflow | public void addWithOverflow(PagedBitMap that, PagedBitMap overflow) {
LongArray ta = that.array;
LongArray of = overflow.array;
long n = 0;
while(true) {
n = ta.seekNext(n);
if (n < 0) {
break;
}
long o = array.get(n) & ta.get(n);
long v = array.get(n) | ta.get(n);
array.set(n, v);
if (o != 0) {
o |= of.get(n);
of.set(n, o);
}
++n;
}
} | java | public void addWithOverflow(PagedBitMap that, PagedBitMap overflow) {
LongArray ta = that.array;
LongArray of = overflow.array;
long n = 0;
while(true) {
n = ta.seekNext(n);
if (n < 0) {
break;
}
long o = array.get(n) & ta.get(n);
long v = array.get(n) | ta.get(n);
array.set(n, v);
if (o != 0) {
o |= of.get(n);
of.set(n, o);
}
++n;
}
} | [
"public",
"void",
"addWithOverflow",
"(",
"PagedBitMap",
"that",
",",
"PagedBitMap",
"overflow",
")",
"{",
"LongArray",
"ta",
"=",
"that",
".",
"array",
";",
"LongArray",
"of",
"=",
"overflow",
".",
"array",
";",
"long",
"n",
"=",
"0",
";",
"while",
"(",... | Bitwise <br/>
<code>overflow = this & that</code>
<br/>
<code>this = this | that</code> | [
"Bitwise",
"<br",
"/",
">",
"<code",
">",
"overflow",
"=",
"this",
"&",
"that<",
"/",
"code",
">",
"<br",
"/",
">",
"<code",
">",
"this",
"=",
"this",
"|",
"that<",
"/",
"code",
">"
] | train | https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/hprof-heap/src/main/java/org/gridkit/jvmtool/util/PagedBitMap.java#L125-L143 |
stagemonitor/stagemonitor | stagemonitor-core/src/main/java/org/stagemonitor/core/metrics/metrics2/Metric2Registry.java | Metric2Registry.registerNewMetrics | public void registerNewMetrics(MetricName name, Metric metric) {
final Set<MetricName> registeredNames = getNames();
if (!registeredNames.contains(name)) {
try {
register(name, metric);
} catch (IllegalArgumentException e){/* exception due to race condition*/}
}
} | java | public void registerNewMetrics(MetricName name, Metric metric) {
final Set<MetricName> registeredNames = getNames();
if (!registeredNames.contains(name)) {
try {
register(name, metric);
} catch (IllegalArgumentException e){/* exception due to race condition*/}
}
} | [
"public",
"void",
"registerNewMetrics",
"(",
"MetricName",
"name",
",",
"Metric",
"metric",
")",
"{",
"final",
"Set",
"<",
"MetricName",
">",
"registeredNames",
"=",
"getNames",
"(",
")",
";",
"if",
"(",
"!",
"registeredNames",
".",
"contains",
"(",
"name",
... | Only registers the metric if it is not already registered
@param name the name of the metric
@param metric the metric | [
"Only",
"registers",
"the",
"metric",
"if",
"it",
"is",
"not",
"already",
"registered"
] | train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-core/src/main/java/org/stagemonitor/core/metrics/metrics2/Metric2Registry.java#L99-L106 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java | GeometryTools.getClosestAtom | public static IAtom getClosestAtom(double xPosition, double yPosition, IAtomContainer atomCon, IAtom toignore) {
IAtom closestAtom = null;
IAtom currentAtom;
// we compare squared distances, allowing us to do one sqrt()
// calculation less
double smallestSquaredMouseDistance = -1;
double mouseSquaredDistance;
double atomX;
double atomY;
for (int i = 0; i < atomCon.getAtomCount(); i++) {
currentAtom = atomCon.getAtom(i);
if (!currentAtom.equals(toignore)) {
atomX = currentAtom.getPoint2d().x;
atomY = currentAtom.getPoint2d().y;
mouseSquaredDistance = Math.pow(atomX - xPosition, 2) + Math.pow(atomY - yPosition, 2);
if (mouseSquaredDistance < smallestSquaredMouseDistance || smallestSquaredMouseDistance == -1) {
smallestSquaredMouseDistance = mouseSquaredDistance;
closestAtom = currentAtom;
}
}
}
return closestAtom;
} | java | public static IAtom getClosestAtom(double xPosition, double yPosition, IAtomContainer atomCon, IAtom toignore) {
IAtom closestAtom = null;
IAtom currentAtom;
// we compare squared distances, allowing us to do one sqrt()
// calculation less
double smallestSquaredMouseDistance = -1;
double mouseSquaredDistance;
double atomX;
double atomY;
for (int i = 0; i < atomCon.getAtomCount(); i++) {
currentAtom = atomCon.getAtom(i);
if (!currentAtom.equals(toignore)) {
atomX = currentAtom.getPoint2d().x;
atomY = currentAtom.getPoint2d().y;
mouseSquaredDistance = Math.pow(atomX - xPosition, 2) + Math.pow(atomY - yPosition, 2);
if (mouseSquaredDistance < smallestSquaredMouseDistance || smallestSquaredMouseDistance == -1) {
smallestSquaredMouseDistance = mouseSquaredDistance;
closestAtom = currentAtom;
}
}
}
return closestAtom;
} | [
"public",
"static",
"IAtom",
"getClosestAtom",
"(",
"double",
"xPosition",
",",
"double",
"yPosition",
",",
"IAtomContainer",
"atomCon",
",",
"IAtom",
"toignore",
")",
"{",
"IAtom",
"closestAtom",
"=",
"null",
";",
"IAtom",
"currentAtom",
";",
"// we compare squar... | Returns the atom of the given molecule that is closest to the given
coordinates and is not the atom.
See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
@param xPosition The x coordinate
@param yPosition The y coordinate
@param atomCon The molecule that is searched for the closest atom
@param toignore This molecule will not be returned.
@return The atom that is closest to the given coordinates | [
"Returns",
"the",
"atom",
"of",
"the",
"given",
"molecule",
"that",
"is",
"closest",
"to",
"the",
"given",
"coordinates",
"and",
"is",
"not",
"the",
"atom",
".",
"See",
"comment",
"for",
"center",
"(",
"IAtomContainer",
"atomCon",
"Dimension",
"areaDim",
"Ha... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L735-L757 |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java | LevenshteinDistanceFunction.levenshteinDistance | public static int levenshteinDistance(String o1, String o2, int prefix, int postfix) {
final int l1 = o1.length(), l2 = o2.length();
// Buffer, interleaved. Even and odd values are our rows.
int[] buf = new int[(l2 + 1 - (prefix + postfix)) << 1];
// Initial "row", on even positions
for(int j = 0; j < buf.length; j += 2) {
buf[j] = j >> 1;
}
int inter = 1; // Interleaving offset
for(int i = prefix, e1 = l1 - postfix; i < e1; i++, inter ^= 1) {
final char chr = o1.charAt(i);
buf[inter] = i + 1 - prefix; // First entry
for(int c = 2 + inter, p = 3 - inter, j = prefix; c < buf.length; c += 2, p += 2) {
buf[c] = min(buf[p] + 1, buf[c - 2] + 1, buf[p - 2] + ((chr == o2.charAt(j++)) ? 0 : 1));
}
}
return buf[buf.length - 2 + (inter ^ 1)];
} | java | public static int levenshteinDistance(String o1, String o2, int prefix, int postfix) {
final int l1 = o1.length(), l2 = o2.length();
// Buffer, interleaved. Even and odd values are our rows.
int[] buf = new int[(l2 + 1 - (prefix + postfix)) << 1];
// Initial "row", on even positions
for(int j = 0; j < buf.length; j += 2) {
buf[j] = j >> 1;
}
int inter = 1; // Interleaving offset
for(int i = prefix, e1 = l1 - postfix; i < e1; i++, inter ^= 1) {
final char chr = o1.charAt(i);
buf[inter] = i + 1 - prefix; // First entry
for(int c = 2 + inter, p = 3 - inter, j = prefix; c < buf.length; c += 2, p += 2) {
buf[c] = min(buf[p] + 1, buf[c - 2] + 1, buf[p - 2] + ((chr == o2.charAt(j++)) ? 0 : 1));
}
}
return buf[buf.length - 2 + (inter ^ 1)];
} | [
"public",
"static",
"int",
"levenshteinDistance",
"(",
"String",
"o1",
",",
"String",
"o2",
",",
"int",
"prefix",
",",
"int",
"postfix",
")",
"{",
"final",
"int",
"l1",
"=",
"o1",
".",
"length",
"(",
")",
",",
"l2",
"=",
"o2",
".",
"length",
"(",
"... | Compute the Levenshtein distance, except for prefix and postfix.
@param o1 First object
@param o2 Second object
@param prefix Prefix length
@param postfix Postfix length
@return Levenshtein distance | [
"Compute",
"the",
"Levenshtein",
"distance",
"except",
"for",
"prefix",
"and",
"postfix",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/strings/LevenshteinDistanceFunction.java#L150-L167 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/javaee/util/DDUtil.java | DDUtil.methodParamsMatch | public static boolean methodParamsMatch(List<String> typeNames, Class<?>[] types)
{
if (typeNames.size() != types.length)
{
return false;
}
for (int i = 0; i < types.length; i++)
{
String typeName = typeNames.get(i);
int typeNameEnd = typeName.length();
Class<?> type = types[i];
for (; type.isArray(); type = type.getComponentType())
{
if (typeNameEnd < 2 ||
typeName.charAt(--typeNameEnd) != ']' ||
typeName.charAt(--typeNameEnd) != '[')
{
return false;
}
}
if (!type.getName().regionMatches(0, typeName, 0, typeNameEnd))
{
return false;
}
}
return true;
} | java | public static boolean methodParamsMatch(List<String> typeNames, Class<?>[] types)
{
if (typeNames.size() != types.length)
{
return false;
}
for (int i = 0; i < types.length; i++)
{
String typeName = typeNames.get(i);
int typeNameEnd = typeName.length();
Class<?> type = types[i];
for (; type.isArray(); type = type.getComponentType())
{
if (typeNameEnd < 2 ||
typeName.charAt(--typeNameEnd) != ']' ||
typeName.charAt(--typeNameEnd) != '[')
{
return false;
}
}
if (!type.getName().regionMatches(0, typeName, 0, typeNameEnd))
{
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"methodParamsMatch",
"(",
"List",
"<",
"String",
">",
"typeNames",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
")",
"{",
"if",
"(",
"typeNames",
".",
"size",
"(",
")",
"!=",
"types",
".",
"length",
")",
"{",
"return... | Checks if the specified method parameters object matches the specified
method parameter types.
@param parms the method parameters object
@param types the method parameter types
@return true if the object matches the types | [
"Checks",
"if",
"the",
"specified",
"method",
"parameters",
"object",
"matches",
"the",
"specified",
"method",
"parameter",
"types",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/javaee/util/DDUtil.java#L36-L66 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/ResourceIndexRebuilder.java | ResourceIndexRebuilder.addObject | public void addObject(DigitalObject obj) throws ResourceIndexException {
m_ri.addObject(new SimpleDOReader(null, null, null, null, null, obj));
} | java | public void addObject(DigitalObject obj) throws ResourceIndexException {
m_ri.addObject(new SimpleDOReader(null, null, null, null, null, obj));
} | [
"public",
"void",
"addObject",
"(",
"DigitalObject",
"obj",
")",
"throws",
"ResourceIndexException",
"{",
"m_ri",
".",
"addObject",
"(",
"new",
"SimpleDOReader",
"(",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"obj",
")",
")",
";",
... | Add the data of interest for the given object.
@throws ResourceIndexException | [
"Add",
"the",
"data",
"of",
"interest",
"for",
"the",
"given",
"object",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/ResourceIndexRebuilder.java#L203-L205 |
antlrjavaparser/antlr-java-parser | src/main/java/com/github/antlrjavaparser/ASTHelper.java | ASTHelper.addStmt | public static void addStmt(BlockStmt block, Statement stmt) {
List<Statement> stmts = block.getStmts();
if (stmts == null) {
stmts = new ArrayList<Statement>();
block.setStmts(stmts);
}
stmts.add(stmt);
} | java | public static void addStmt(BlockStmt block, Statement stmt) {
List<Statement> stmts = block.getStmts();
if (stmts == null) {
stmts = new ArrayList<Statement>();
block.setStmts(stmts);
}
stmts.add(stmt);
} | [
"public",
"static",
"void",
"addStmt",
"(",
"BlockStmt",
"block",
",",
"Statement",
"stmt",
")",
"{",
"List",
"<",
"Statement",
">",
"stmts",
"=",
"block",
".",
"getStmts",
"(",
")",
";",
"if",
"(",
"stmts",
"==",
"null",
")",
"{",
"stmts",
"=",
"new... | Adds the given statement to the specified block. The list of statements
will be initialized if it is <code>null</code>.
@param block
@param stmt | [
"Adds",
"the",
"given",
"statement",
"to",
"the",
"specified",
"block",
".",
"The",
"list",
"of",
"statements",
"will",
"be",
"initialized",
"if",
"it",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/ASTHelper.java#L245-L252 |
citrusframework/citrus | modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/server/FtpServerFtpLet.java | FtpServerFtpLet.writeFtpReply | private void writeFtpReply(FtpSession session, FtpMessage response) {
try {
CommandResultType commandResult = response.getPayload(CommandResultType.class);
FtpReply reply = new DefaultFtpReply(Integer.valueOf(commandResult.getReplyCode()), commandResult.getReplyString());
session.write(reply);
} catch (FtpException e) {
throw new CitrusRuntimeException("Failed to write ftp reply", e);
}
} | java | private void writeFtpReply(FtpSession session, FtpMessage response) {
try {
CommandResultType commandResult = response.getPayload(CommandResultType.class);
FtpReply reply = new DefaultFtpReply(Integer.valueOf(commandResult.getReplyCode()), commandResult.getReplyString());
session.write(reply);
} catch (FtpException e) {
throw new CitrusRuntimeException("Failed to write ftp reply", e);
}
} | [
"private",
"void",
"writeFtpReply",
"(",
"FtpSession",
"session",
",",
"FtpMessage",
"response",
")",
"{",
"try",
"{",
"CommandResultType",
"commandResult",
"=",
"response",
".",
"getPayload",
"(",
"CommandResultType",
".",
"class",
")",
";",
"FtpReply",
"reply",
... | Construct ftp reply from response message and write reply to given session.
@param session
@param response | [
"Construct",
"ftp",
"reply",
"from",
"response",
"message",
"and",
"write",
"reply",
"to",
"given",
"session",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/server/FtpServerFtpLet.java#L171-L180 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java | ImageBandMath.stdDev | public static void stdDev(Planar<GrayS64> input, GrayS64 output, @Nullable GrayS64 avg) {
stdDev(input,output,avg,0,input.getNumBands() - 1);
} | java | public static void stdDev(Planar<GrayS64> input, GrayS64 output, @Nullable GrayS64 avg) {
stdDev(input,output,avg,0,input.getNumBands() - 1);
} | [
"public",
"static",
"void",
"stdDev",
"(",
"Planar",
"<",
"GrayS64",
">",
"input",
",",
"GrayS64",
"output",
",",
"@",
"Nullable",
"GrayS64",
"avg",
")",
"{",
"stdDev",
"(",
"input",
",",
"output",
",",
"avg",
",",
"0",
",",
"input",
".",
"getNumBands"... | Computes the standard deviation for each pixel across all bands in the {@link Planar}
image.
@param input Planar image - not modified
@param output Gray scale image containing average pixel values - modified
@param avg Input Gray scale image containing average image. Can be null | [
"Computes",
"the",
"standard",
"deviation",
"for",
"each",
"pixel",
"across",
"all",
"bands",
"in",
"the",
"{"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java#L859-L861 |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newCoref | public Coref newCoref(String id, List<Span<Term>> mentions) {
idManager.updateCounter(AnnotationType.COREF, id);
Coref newCoref = new Coref(id, mentions);
annotationContainer.add(newCoref, Layer.COREFERENCES, AnnotationType.COREF);
return newCoref;
} | java | public Coref newCoref(String id, List<Span<Term>> mentions) {
idManager.updateCounter(AnnotationType.COREF, id);
Coref newCoref = new Coref(id, mentions);
annotationContainer.add(newCoref, Layer.COREFERENCES, AnnotationType.COREF);
return newCoref;
} | [
"public",
"Coref",
"newCoref",
"(",
"String",
"id",
",",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"mentions",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"COREF",
",",
"id",
")",
";",
"Coref",
"newCoref",
"=",
"new",
"Co... | Creates a coreference object to load an existing Coref. It receives it's ID as an argument. The Coref is added to the document.
@param id the ID of the coreference.
@param references different mentions (list of targets) to the same entity.
@return a new coreference. | [
"Creates",
"a",
"coreference",
"object",
"to",
"load",
"an",
"existing",
"Coref",
".",
"It",
"receives",
"it",
"s",
"ID",
"as",
"an",
"argument",
".",
"The",
"Coref",
"is",
"added",
"to",
"the",
"document",
"."
] | train | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L756-L761 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/Parser.java | Parser.parseSelectKeyword | public static boolean parseSelectKeyword(final char[] query, int offset) {
if (query.length < (offset + 6)) {
return false;
}
return (query[offset] | 32) == 's'
&& (query[offset + 1] | 32) == 'e'
&& (query[offset + 2] | 32) == 'l'
&& (query[offset + 3] | 32) == 'e'
&& (query[offset + 4] | 32) == 'c'
&& (query[offset + 5] | 32) == 't';
} | java | public static boolean parseSelectKeyword(final char[] query, int offset) {
if (query.length < (offset + 6)) {
return false;
}
return (query[offset] | 32) == 's'
&& (query[offset + 1] | 32) == 'e'
&& (query[offset + 2] | 32) == 'l'
&& (query[offset + 3] | 32) == 'e'
&& (query[offset + 4] | 32) == 'c'
&& (query[offset + 5] | 32) == 't';
} | [
"public",
"static",
"boolean",
"parseSelectKeyword",
"(",
"final",
"char",
"[",
"]",
"query",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"query",
".",
"length",
"<",
"(",
"offset",
"+",
"6",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
... | Parse string to check presence of SELECT keyword regardless of case.
@param query char[] of the query statement
@param offset position of query to start checking
@return boolean indicates presence of word | [
"Parse",
"string",
"to",
"check",
"presence",
"of",
"SELECT",
"keyword",
"regardless",
"of",
"case",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Parser.java#L643-L654 |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java | SourceMapGenerator.fromSourceMap | public static SourceMapGenerator fromSourceMap(SourceMapConsumer aSourceMapConsumer) {
String sourceRoot = aSourceMapConsumer.sourceRoot;
SourceMapGenerator generator = new SourceMapGenerator(aSourceMapConsumer.file, sourceRoot);
aSourceMapConsumer.eachMapping().forEach(mapping -> {
Mapping newMapping = new Mapping(mapping.generated);
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = Util.relative(sourceRoot, newMapping.source);
}
newMapping.original = mapping.original;
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources().stream().forEach(sourceFile -> {
String content = aSourceMapConsumer.sourceContentFor(sourceFile, null);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
} | java | public static SourceMapGenerator fromSourceMap(SourceMapConsumer aSourceMapConsumer) {
String sourceRoot = aSourceMapConsumer.sourceRoot;
SourceMapGenerator generator = new SourceMapGenerator(aSourceMapConsumer.file, sourceRoot);
aSourceMapConsumer.eachMapping().forEach(mapping -> {
Mapping newMapping = new Mapping(mapping.generated);
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = Util.relative(sourceRoot, newMapping.source);
}
newMapping.original = mapping.original;
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources().stream().forEach(sourceFile -> {
String content = aSourceMapConsumer.sourceContentFor(sourceFile, null);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
} | [
"public",
"static",
"SourceMapGenerator",
"fromSourceMap",
"(",
"SourceMapConsumer",
"aSourceMapConsumer",
")",
"{",
"String",
"sourceRoot",
"=",
"aSourceMapConsumer",
".",
"sourceRoot",
";",
"SourceMapGenerator",
"generator",
"=",
"new",
"SourceMapGenerator",
"(",
"aSour... | Creates a new SourceMapGenerator based on a SourceMapConsumer
@param aSourceMapConsumer
The SourceMap. | [
"Creates",
"a",
"new",
"SourceMapGenerator",
"based",
"on",
"a",
"SourceMapConsumer"
] | train | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java#L57-L81 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/impl/getters/EvictableGetterCache.java | EvictableGetterCache.evictMap | private void evictMap(SampleableConcurrentHashMap<?, ?> map, int triggeringEvictionSize, int afterEvictionSize) {
map.purgeStaleEntries();
int mapSize = map.size();
if (mapSize - triggeringEvictionSize >= 0) {
for (SampleableConcurrentHashMap.SamplingEntry entry : map.getRandomSamples(mapSize - afterEvictionSize)) {
map.remove(entry.getEntryKey());
}
}
} | java | private void evictMap(SampleableConcurrentHashMap<?, ?> map, int triggeringEvictionSize, int afterEvictionSize) {
map.purgeStaleEntries();
int mapSize = map.size();
if (mapSize - triggeringEvictionSize >= 0) {
for (SampleableConcurrentHashMap.SamplingEntry entry : map.getRandomSamples(mapSize - afterEvictionSize)) {
map.remove(entry.getEntryKey());
}
}
} | [
"private",
"void",
"evictMap",
"(",
"SampleableConcurrentHashMap",
"<",
"?",
",",
"?",
">",
"map",
",",
"int",
"triggeringEvictionSize",
",",
"int",
"afterEvictionSize",
")",
"{",
"map",
".",
"purgeStaleEntries",
"(",
")",
";",
"int",
"mapSize",
"=",
"map",
... | It works on best effort basis. If multi-threaded calls involved it may evict all elements, but it's unlikely. | [
"It",
"works",
"on",
"best",
"effort",
"basis",
".",
"If",
"multi",
"-",
"threaded",
"calls",
"involved",
"it",
"may",
"evict",
"all",
"elements",
"but",
"it",
"s",
"unlikely",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/getters/EvictableGetterCache.java#L79-L87 |
kiegroup/drools | drools-compiler/src/main/java/org/drools/compiler/lang/DRL6StrictParser.java | DRL6StrictParser.lhsEval | private BaseDescr lhsEval(CEDescrBuilder<?, ?> ce) throws RecognitionException {
EvalDescrBuilder<?> eval = null;
try {
eval = helper.start(ce,
EvalDescrBuilder.class,
null);
match(input,
DRL6Lexer.ID,
DroolsSoftKeywords.EVAL,
null,
DroolsEditorType.KEYWORD);
if (state.failed)
return null;
if (!parseEvalExpression(eval))
return null;
} catch (RecognitionException e) {
throw e;
} finally {
helper.end(EvalDescrBuilder.class,
eval);
}
return eval != null ? eval.getDescr() : null;
} | java | private BaseDescr lhsEval(CEDescrBuilder<?, ?> ce) throws RecognitionException {
EvalDescrBuilder<?> eval = null;
try {
eval = helper.start(ce,
EvalDescrBuilder.class,
null);
match(input,
DRL6Lexer.ID,
DroolsSoftKeywords.EVAL,
null,
DroolsEditorType.KEYWORD);
if (state.failed)
return null;
if (!parseEvalExpression(eval))
return null;
} catch (RecognitionException e) {
throw e;
} finally {
helper.end(EvalDescrBuilder.class,
eval);
}
return eval != null ? eval.getDescr() : null;
} | [
"private",
"BaseDescr",
"lhsEval",
"(",
"CEDescrBuilder",
"<",
"?",
",",
"?",
">",
"ce",
")",
"throws",
"RecognitionException",
"{",
"EvalDescrBuilder",
"<",
"?",
">",
"eval",
"=",
"null",
";",
"try",
"{",
"eval",
"=",
"helper",
".",
"start",
"(",
"ce",
... | lhsEval := EVAL LEFT_PAREN conditionalExpression RIGHT_PAREN
@param ce
@return
@throws org.antlr.runtime.RecognitionException | [
"lhsEval",
":",
"=",
"EVAL",
"LEFT_PAREN",
"conditionalExpression",
"RIGHT_PAREN"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/DRL6StrictParser.java#L2864-L2891 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java | PageInBrowserStats.getTotalWindowLoadTime | public long getTotalWindowLoadTime(final String intervalName, final TimeUnit unit) {
return unit.transformMillis(totalWindowLoadTime.getValueAsLong(intervalName));
} | java | public long getTotalWindowLoadTime(final String intervalName, final TimeUnit unit) {
return unit.transformMillis(totalWindowLoadTime.getValueAsLong(intervalName));
} | [
"public",
"long",
"getTotalWindowLoadTime",
"(",
"final",
"String",
"intervalName",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"return",
"unit",
".",
"transformMillis",
"(",
"totalWindowLoadTime",
".",
"getValueAsLong",
"(",
"intervalName",
")",
")",
";",
"}"
] | Returns total page loads time for given interval and {@link TimeUnit}.
@param intervalName name of the interval
@param unit {@link TimeUnit}
@return total page loads time | [
"Returns",
"total",
"page",
"loads",
"time",
"for",
"given",
"interval",
"and",
"{",
"@link",
"TimeUnit",
"}",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L232-L234 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/postprocessor/google/closure/ClosureGlobalPostProcessor.java | ClosureGlobalPostProcessor.getCompilerArgValue | private String getCompilerArgValue(String compilerArgName, String compilerArgValue) {
if (compilerArgName.equals(COMPILATION_LEVEL)) {
if (!ADVANCED_OPTIMIZATIONS_COMPILATION_LEVEL.equalsIgnoreCase(compilerArgValue)
&& !WHITESPACE_ONLY_COMPILATION_LEVEL.equalsIgnoreCase(compilerArgValue)
&& !SIMPLE_OPTIMIZATIONS_COMPILATION_LEVEL.equalsIgnoreCase(compilerArgValue)) {
if (StringUtils.isNotEmpty(compilerArgValue)) {
LOGGER.debug("Closure compilation level defined in config '" + compilerArgValue
+ "' is not part of the available "
+ "ones [WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, ADVANCED_OPTIMIZATIONS");
}
compilerArgValue = WHITESPACE_ONLY_COMPILATION_LEVEL;
}
LOGGER.debug("Closure compilation level used : " + compilerArgValue);
}
return compilerArgValue;
} | java | private String getCompilerArgValue(String compilerArgName, String compilerArgValue) {
if (compilerArgName.equals(COMPILATION_LEVEL)) {
if (!ADVANCED_OPTIMIZATIONS_COMPILATION_LEVEL.equalsIgnoreCase(compilerArgValue)
&& !WHITESPACE_ONLY_COMPILATION_LEVEL.equalsIgnoreCase(compilerArgValue)
&& !SIMPLE_OPTIMIZATIONS_COMPILATION_LEVEL.equalsIgnoreCase(compilerArgValue)) {
if (StringUtils.isNotEmpty(compilerArgValue)) {
LOGGER.debug("Closure compilation level defined in config '" + compilerArgValue
+ "' is not part of the available "
+ "ones [WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, ADVANCED_OPTIMIZATIONS");
}
compilerArgValue = WHITESPACE_ONLY_COMPILATION_LEVEL;
}
LOGGER.debug("Closure compilation level used : " + compilerArgValue);
}
return compilerArgValue;
} | [
"private",
"String",
"getCompilerArgValue",
"(",
"String",
"compilerArgName",
",",
"String",
"compilerArgValue",
")",
"{",
"if",
"(",
"compilerArgName",
".",
"equals",
"(",
"COMPILATION_LEVEL",
")",
")",
"{",
"if",
"(",
"!",
"ADVANCED_OPTIMIZATIONS_COMPILATION_LEVEL",... | Returns the compiler argument value
@param compilerArgName
the compiler argument name
@param compilerArgValue
the compiler argument name
@return the compiler argument value | [
"Returns",
"the",
"compiler",
"argument",
"value"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/postprocessor/google/closure/ClosureGlobalPostProcessor.java#L436-L454 |
drewnoakes/metadata-extractor | Source/com/drew/lang/RandomAccessStreamReader.java | RandomAccessStreamReader.validateIndex | @Override
protected void validateIndex(int index, int bytesRequested) throws IOException
{
if (index < 0) {
throw new BufferBoundsException(String.format("Attempt to read from buffer using a negative index (%d)", index));
} else if (bytesRequested < 0) {
throw new BufferBoundsException("Number of requested bytes must be zero or greater");
} else if ((long)index + bytesRequested - 1 > Integer.MAX_VALUE) {
throw new BufferBoundsException(String.format("Number of requested bytes summed with starting index exceed maximum range of signed 32 bit integers (requested index: %d, requested count: %d)", index, bytesRequested));
}
if (!isValidIndex(index, bytesRequested)) {
assert(_isStreamFinished);
// TODO test that can continue using an instance of this type after this exception
throw new BufferBoundsException(index, bytesRequested, _streamLength);
}
} | java | @Override
protected void validateIndex(int index, int bytesRequested) throws IOException
{
if (index < 0) {
throw new BufferBoundsException(String.format("Attempt to read from buffer using a negative index (%d)", index));
} else if (bytesRequested < 0) {
throw new BufferBoundsException("Number of requested bytes must be zero or greater");
} else if ((long)index + bytesRequested - 1 > Integer.MAX_VALUE) {
throw new BufferBoundsException(String.format("Number of requested bytes summed with starting index exceed maximum range of signed 32 bit integers (requested index: %d, requested count: %d)", index, bytesRequested));
}
if (!isValidIndex(index, bytesRequested)) {
assert(_isStreamFinished);
// TODO test that can continue using an instance of this type after this exception
throw new BufferBoundsException(index, bytesRequested, _streamLength);
}
} | [
"@",
"Override",
"protected",
"void",
"validateIndex",
"(",
"int",
"index",
",",
"int",
"bytesRequested",
")",
"throws",
"IOException",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"throw",
"new",
"BufferBoundsException",
"(",
"String",
".",
"format",
"(",
... | Ensures that the buffered bytes extend to cover the specified index. If not, an attempt is made
to read to that point.
<p>
If the stream ends before the point is reached, a {@link BufferBoundsException} is raised.
@param index the index from which the required bytes start
@param bytesRequested the number of bytes which are required
@throws BufferBoundsException if the stream ends before the required number of bytes are acquired | [
"Ensures",
"that",
"the",
"buffered",
"bytes",
"extend",
"to",
"cover",
"the",
"specified",
"index",
".",
"If",
"not",
"an",
"attempt",
"is",
"made",
"to",
"read",
"to",
"that",
"point",
".",
"<p",
">",
"If",
"the",
"stream",
"ends",
"before",
"the",
"... | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/lang/RandomAccessStreamReader.java#L96-L112 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/databasetype/SybaseDatabaseType.java | SybaseDatabaseType.getTableColumnInfo | public TableColumnInfo getTableColumnInfo(Connection connection, String schema, String table) throws SQLException
{
if (schema == null || schema.length() == 0)
{
schema = connection.getCatalog();
}
PreparedStatement stmt = connection.prepareStatement("SELECT name,colid,length,usertype,prec,scale,status FROM "+getFullyQualifiedDboTableName(schema, "syscolumns")+" WHERE id=OBJECT_ID(?)");
ResultSet results = null;
ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
try
{
String objectName = getFullyQualifiedTableName(schema , table);
stmt.setString(1, objectName);
results = stmt.executeQuery();
while (results.next())
{
String name = results.getString("name");
int ordinalPosition = results.getInt("colid");
int size = results.getInt("length");
int type = sybaseToJDBCTypes.get(results.getInt("usertype"));
int precision = results.getInt("prec");
int scale = results.getInt("scale");
// http://www.sybase.com/detail?id=205883#syscol - How to Read syscolumns.status
boolean nullable = (results.getInt("status") & 8) != 0;
columns.add(new ColumnInfo(name, type, size, precision, scale, ordinalPosition, nullable));
}
}
finally
{
closeResultSet(results, "Ignoring error whilst closing ResultSet that was used to query the DatabaseInfo");
closeStatement(stmt, "Ignoring error whilst closing PreparedStatement that was used to query the DatabaseInfo");
}
Collections.sort(columns);
return columns.isEmpty() ? null : new TableColumnInfo(null, schema, table, columns.toArray(new ColumnInfo[columns.size()]));
} | java | public TableColumnInfo getTableColumnInfo(Connection connection, String schema, String table) throws SQLException
{
if (schema == null || schema.length() == 0)
{
schema = connection.getCatalog();
}
PreparedStatement stmt = connection.prepareStatement("SELECT name,colid,length,usertype,prec,scale,status FROM "+getFullyQualifiedDboTableName(schema, "syscolumns")+" WHERE id=OBJECT_ID(?)");
ResultSet results = null;
ArrayList<ColumnInfo> columns = new ArrayList<ColumnInfo>();
try
{
String objectName = getFullyQualifiedTableName(schema , table);
stmt.setString(1, objectName);
results = stmt.executeQuery();
while (results.next())
{
String name = results.getString("name");
int ordinalPosition = results.getInt("colid");
int size = results.getInt("length");
int type = sybaseToJDBCTypes.get(results.getInt("usertype"));
int precision = results.getInt("prec");
int scale = results.getInt("scale");
// http://www.sybase.com/detail?id=205883#syscol - How to Read syscolumns.status
boolean nullable = (results.getInt("status") & 8) != 0;
columns.add(new ColumnInfo(name, type, size, precision, scale, ordinalPosition, nullable));
}
}
finally
{
closeResultSet(results, "Ignoring error whilst closing ResultSet that was used to query the DatabaseInfo");
closeStatement(stmt, "Ignoring error whilst closing PreparedStatement that was used to query the DatabaseInfo");
}
Collections.sort(columns);
return columns.isEmpty() ? null : new TableColumnInfo(null, schema, table, columns.toArray(new ColumnInfo[columns.size()]));
} | [
"public",
"TableColumnInfo",
"getTableColumnInfo",
"(",
"Connection",
"connection",
",",
"String",
"schema",
",",
"String",
"table",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"schema",
"==",
"null",
"||",
"schema",
".",
"length",
"(",
")",
"==",
"0",
")... | <p>Overridden to create the table metadata by hand rather than using the JDBC
<code>DatabaseMetadata.getColumns()</code> method. This is because the Sybase driver fails
when the connection is an XA connection unless you allow transactional DDL in tempdb.</p> | [
"<p",
">",
"Overridden",
"to",
"create",
"the",
"table",
"metadata",
"by",
"hand",
"rather",
"than",
"using",
"the",
"JDBC",
"<code",
">",
"DatabaseMetadata",
".",
"getColumns",
"()",
"<",
"/",
"code",
">",
"method",
".",
"This",
"is",
"because",
"the",
... | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/databasetype/SybaseDatabaseType.java#L698-L738 |
onepf/OpenIAB | library/src/main/java/org/onepf/oms/appstore/googleUtils/Security.java | Security.verifyPurchase | public static boolean verifyPurchase(@NotNull String base64PublicKey, @NotNull String signedData, @NotNull String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey)
|| TextUtils.isEmpty(signature)) {
Logger.e("Purchase verification failed: missing data.");
return false;
}
PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);
} | java | public static boolean verifyPurchase(@NotNull String base64PublicKey, @NotNull String signedData, @NotNull String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey)
|| TextUtils.isEmpty(signature)) {
Logger.e("Purchase verification failed: missing data.");
return false;
}
PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);
} | [
"public",
"static",
"boolean",
"verifyPurchase",
"(",
"@",
"NotNull",
"String",
"base64PublicKey",
",",
"@",
"NotNull",
"String",
"signedData",
",",
"@",
"NotNull",
"String",
"signature",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"signedData",
")"... | Verifies that the data was signed with the given signature, and returns
the verified purchase. The data is in JSON format and signed
with a private key. The data also contains the {@link com.amazon.inapp.purchasing.PurchaseResponse.PurchaseRequestStatus}
and product ID of the purchase.
@param base64PublicKey the base64-encoded public key to use for verifying.
@param signedData the signed JSON string (signed, not encrypted)
@param signature the signature for the data, signed with the private key | [
"Verifies",
"that",
"the",
"data",
"was",
"signed",
"with",
"the",
"given",
"signature",
"and",
"returns",
"the",
"verified",
"purchase",
".",
"The",
"data",
"is",
"in",
"JSON",
"format",
"and",
"signed",
"with",
"a",
"private",
"key",
".",
"The",
"data",
... | train | https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/appstore/googleUtils/Security.java#L57-L66 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java | TupleCombiner.findVarPath | private VarDef findVarPath( List<VarDef> combinedVars, String varPath)
{
int i;
for( i = 0;
i < combinedVars.size()
&& !varPath.equals( combinedVars.get(i).getPathName());
i++);
return
i < combinedVars.size()
? combinedVars.get(i)
: null;
} | java | private VarDef findVarPath( List<VarDef> combinedVars, String varPath)
{
int i;
for( i = 0;
i < combinedVars.size()
&& !varPath.equals( combinedVars.get(i).getPathName());
i++);
return
i < combinedVars.size()
? combinedVars.get(i)
: null;
} | [
"private",
"VarDef",
"findVarPath",
"(",
"List",
"<",
"VarDef",
">",
"combinedVars",
",",
"String",
"varPath",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"combinedVars",
".",
"size",
"(",
")",
"&&",
"!",
"varPath",
".",
"e... | Returns the member of the given variable list with the given path. | [
"Returns",
"the",
"member",
"of",
"the",
"given",
"variable",
"list",
"with",
"the",
"given",
"path",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java#L399-L411 |
talsma-ict/umldoclet | src/main/java/nl/talsmasoftware/umldoclet/util/UriUtils.java | UriUtils.appendEscapedByte | private static void appendEscapedByte(StringBuilder builder, byte value) {
builder.append('%');
builder.append(HEX[(value >> 4) & 0x0f]);
builder.append(HEX[value & 0x0f]);
} | java | private static void appendEscapedByte(StringBuilder builder, byte value) {
builder.append('%');
builder.append(HEX[(value >> 4) & 0x0f]);
builder.append(HEX[value & 0x0f]);
} | [
"private",
"static",
"void",
"appendEscapedByte",
"(",
"StringBuilder",
"builder",
",",
"byte",
"value",
")",
"{",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"builder",
".",
"append",
"(",
"HEX",
"[",
"(",
"value",
">>",
"4",
")",
"&",
"0x0f",
... | Appends the byte as percent-encoded hex value (three characters).
@param builder The builder to append to
@param value the type to be appended as percent-encoded | [
"Appends",
"the",
"byte",
"as",
"percent",
"-",
"encoded",
"hex",
"value",
"(",
"three",
"characters",
")",
"."
] | train | https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/util/UriUtils.java#L118-L122 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java | AbstractTagLibrary.addValidator | protected final void addValidator(String name, String validatorId, Class<? extends TagHandler> type)
{
_factories.put(name, new UserValidatorHandlerFactory(validatorId, type));
} | java | protected final void addValidator(String name, String validatorId, Class<? extends TagHandler> type)
{
_factories.put(name, new UserValidatorHandlerFactory(validatorId, type));
} | [
"protected",
"final",
"void",
"addValidator",
"(",
"String",
"name",
",",
"String",
"validatorId",
",",
"Class",
"<",
"?",
"extends",
"TagHandler",
">",
"type",
")",
"{",
"_factories",
".",
"put",
"(",
"name",
",",
"new",
"UserValidatorHandlerFactory",
"(",
... | Add a ValidateHandler for the specified validatorId
@see javax.faces.view.facelets.ValidatorHandler
@see javax.faces.view.facelets.ValidatorConfig
@see javax.faces.application.Application#createValidator(java.lang.String)
@param name
name to use, "foo" would be <my:foo />
@param validatorId
id to pass to Application instance
@param type
TagHandler type that takes in a ValidatorConfig | [
"Add",
"a",
"ValidateHandler",
"for",
"the",
"specified",
"validatorId"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L248-L251 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Date.java | Date.convertToAbbr | private static final StringBuilder convertToAbbr(StringBuilder sb, String name) {
sb.append(Character.toUpperCase(name.charAt(0)));
sb.append(name.charAt(1)).append(name.charAt(2));
return sb;
} | java | private static final StringBuilder convertToAbbr(StringBuilder sb, String name) {
sb.append(Character.toUpperCase(name.charAt(0)));
sb.append(name.charAt(1)).append(name.charAt(2));
return sb;
} | [
"private",
"static",
"final",
"StringBuilder",
"convertToAbbr",
"(",
"StringBuilder",
"sb",
",",
"String",
"name",
")",
"{",
"sb",
".",
"append",
"(",
"Character",
".",
"toUpperCase",
"(",
"name",
".",
"charAt",
"(",
"0",
")",
")",
")",
";",
"sb",
".",
... | Converts the given name to its 3-letter abbreviation (e.g.,
"monday" -> "Mon") and stored the abbreviation in the given
<code>StringBuilder</code>. | [
"Converts",
"the",
"given",
"name",
"to",
"its",
"3",
"-",
"letter",
"abbreviation",
"(",
"e",
".",
"g",
".",
"monday",
"-",
">",
"Mon",
")",
"and",
"stored",
"the",
"abbreviation",
"in",
"the",
"given",
"<code",
">",
"StringBuilder<",
"/",
"code",
">"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Date.java#L1077-L1081 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/util/ListUtil.java | ListUtil.arrayToList | public static String arrayToList(String[] array, String delimiter) {
if (ArrayUtil.isEmpty(array)) return "";
StringBuilder sb = new StringBuilder(array[0]);
if (delimiter.length() == 1) {
char c = delimiter.charAt(0);
for (int i = 1; i < array.length; i++) {
sb.append(c);
sb.append(array[i]);
}
}
else {
for (int i = 1; i < array.length; i++) {
sb.append(delimiter);
sb.append(array[i]);
}
}
return sb.toString();
} | java | public static String arrayToList(String[] array, String delimiter) {
if (ArrayUtil.isEmpty(array)) return "";
StringBuilder sb = new StringBuilder(array[0]);
if (delimiter.length() == 1) {
char c = delimiter.charAt(0);
for (int i = 1; i < array.length; i++) {
sb.append(c);
sb.append(array[i]);
}
}
else {
for (int i = 1; i < array.length; i++) {
sb.append(delimiter);
sb.append(array[i]);
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"arrayToList",
"(",
"String",
"[",
"]",
"array",
",",
"String",
"delimiter",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"array",
")",
")",
"return",
"\"\"",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
... | convert a string array to string list
@param array array to convert
@param delimiter delimiter for the new list
@return list generated from string array | [
"convert",
"a",
"string",
"array",
"to",
"string",
"list"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ListUtil.java#L901-L920 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/metadata/ArgumentDescriptor.java | ArgumentDescriptor.setValue | public void setValue(String fieldRefName, boolean returnedByProcedure)
{
this.fieldSource = SOURCE_FIELD;
this.fieldRefName = fieldRefName;
this.returnedByProcedure = returnedByProcedure;
this.constantValue = null;
// If the field reference is not valid, then disregard the value
// of the returnedByProcedure argument.
if (this.getFieldRef() == null)
{
this.returnedByProcedure = false;
}
// If the field reference is not valid, then disregard the value
// of the returnedByProcedure argument.
if (this.getFieldRef() == null)
{
this.returnedByProcedure = false;
}
} | java | public void setValue(String fieldRefName, boolean returnedByProcedure)
{
this.fieldSource = SOURCE_FIELD;
this.fieldRefName = fieldRefName;
this.returnedByProcedure = returnedByProcedure;
this.constantValue = null;
// If the field reference is not valid, then disregard the value
// of the returnedByProcedure argument.
if (this.getFieldRef() == null)
{
this.returnedByProcedure = false;
}
// If the field reference is not valid, then disregard the value
// of the returnedByProcedure argument.
if (this.getFieldRef() == null)
{
this.returnedByProcedure = false;
}
} | [
"public",
"void",
"setValue",
"(",
"String",
"fieldRefName",
",",
"boolean",
"returnedByProcedure",
")",
"{",
"this",
".",
"fieldSource",
"=",
"SOURCE_FIELD",
";",
"this",
".",
"fieldRefName",
"=",
"fieldRefName",
";",
"this",
".",
"returnedByProcedure",
"=",
"r... | Sets up this object to represent a value that is derived from a field
in the corresponding class-descriptor.
<p>
If the value of <code>fieldRefName</code> is blank or refers to an
invalid field reference, then the value of the corresponding argument
will be set to null. In this case, {@link #getIsReturnedByProcedure}
will be set to <code>false</code>, regardless of the value of the
<code>returnedByProcedure</code> argument.
@param fieldRefName the name of the field reference that provides the
value of this argument.
@param returnedByProcedure indicates that the value of the argument
is returned by the procedure that is invoked. | [
"Sets",
"up",
"this",
"object",
"to",
"represent",
"a",
"value",
"that",
"is",
"derived",
"from",
"a",
"field",
"in",
"the",
"corresponding",
"class",
"-",
"descriptor",
".",
"<p",
">",
"If",
"the",
"value",
"of",
"<code",
">",
"fieldRefName<",
"/",
"cod... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ArgumentDescriptor.java#L94-L114 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.lastIndexOf | @NullSafe
public static int lastIndexOf(String text, String value) {
return text != null && value != null ? text.lastIndexOf(value) : -1;
} | java | @NullSafe
public static int lastIndexOf(String text, String value) {
return text != null && value != null ? text.lastIndexOf(value) : -1;
} | [
"@",
"NullSafe",
"public",
"static",
"int",
"lastIndexOf",
"(",
"String",
"text",
",",
"String",
"value",
")",
"{",
"return",
"text",
"!=",
"null",
"&&",
"value",
"!=",
"null",
"?",
"text",
".",
"lastIndexOf",
"(",
"value",
")",
":",
"-",
"1",
";",
"... | Determines the index of the last occurrence of token in the String value. This lastIndexOf operation is null-safe
and returns a -1 if the String value is null, or the token does not exist in the String value.
@param text the String value used to search for the token.
@param value the text to search for in the String value.
@return the index of the last occurrence of the token in the String value, or -1 if the token does not exist, or
the String value is blank, empty or null.
@see java.lang.String#lastIndexOf(String)
@see #indexOf(String, String) | [
"Determines",
"the",
"index",
"of",
"the",
"last",
"occurrence",
"of",
"token",
"in",
"the",
"String",
"value",
".",
"This",
"lastIndexOf",
"operation",
"is",
"null",
"-",
"safe",
"and",
"returns",
"a",
"-",
"1",
"if",
"the",
"String",
"value",
"is",
"nu... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L404-L407 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/db/util/RidUtils.java | RidUtils.trackIdChange | public static void trackIdChange(final ODocument document, final Object pojo) {
if (document.getIdentity().isNew()) {
ORecordInternal.addIdentityChangeListener(document, new OIdentityChangeListener() {
@Override
public void onBeforeIdentityChange(final ORecord record) {
// not needed
}
@Override
public void onAfterIdentityChange(final ORecord record) {
OObjectSerializerHelper.setObjectID(record.getIdentity(), pojo);
OObjectSerializerHelper.setObjectVersion(record.getVersion(), pojo);
}
});
}
} | java | public static void trackIdChange(final ODocument document, final Object pojo) {
if (document.getIdentity().isNew()) {
ORecordInternal.addIdentityChangeListener(document, new OIdentityChangeListener() {
@Override
public void onBeforeIdentityChange(final ORecord record) {
// not needed
}
@Override
public void onAfterIdentityChange(final ORecord record) {
OObjectSerializerHelper.setObjectID(record.getIdentity(), pojo);
OObjectSerializerHelper.setObjectVersion(record.getVersion(), pojo);
}
});
}
} | [
"public",
"static",
"void",
"trackIdChange",
"(",
"final",
"ODocument",
"document",
",",
"final",
"Object",
"pojo",
")",
"{",
"if",
"(",
"document",
".",
"getIdentity",
"(",
")",
".",
"isNew",
"(",
")",
")",
"{",
"ORecordInternal",
".",
"addIdentityChangeLis... | When just created object is detached to pure pojo it gets temporary id.
Real id is assigned only after transaction commit. This method tracks original
document, intercepts its id change and sets correct id and version into pojo.
So it become safe to use such pojo id outside of transaction.
@param document original document
@param pojo pojo | [
"When",
"just",
"created",
"object",
"is",
"detached",
"to",
"pure",
"pojo",
"it",
"gets",
"temporary",
"id",
".",
"Real",
"id",
"is",
"assigned",
"only",
"after",
"transaction",
"commit",
".",
"This",
"method",
"tracks",
"original",
"document",
"intercepts",
... | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/db/util/RidUtils.java#L89-L104 |
playn/playn | core/src/playn/core/Graphics.java | Graphics.createTexture | public Texture createTexture (float width, float height, Texture.Config config) {
int texWidth = config.toTexWidth(scale.scaledCeil(width));
int texHeight = config.toTexHeight(scale.scaledCeil(height));
if (texWidth <= 0 || texHeight <= 0) throw new IllegalArgumentException(
"Invalid texture size: " + texWidth + "x" + texHeight);
int id = createTexture(config);
gl.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texWidth, texHeight,
0, GL_RGBA, GL_UNSIGNED_BYTE, null);
return new Texture(this, id, config, texWidth, texHeight, scale, width, height);
} | java | public Texture createTexture (float width, float height, Texture.Config config) {
int texWidth = config.toTexWidth(scale.scaledCeil(width));
int texHeight = config.toTexHeight(scale.scaledCeil(height));
if (texWidth <= 0 || texHeight <= 0) throw new IllegalArgumentException(
"Invalid texture size: " + texWidth + "x" + texHeight);
int id = createTexture(config);
gl.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texWidth, texHeight,
0, GL_RGBA, GL_UNSIGNED_BYTE, null);
return new Texture(this, id, config, texWidth, texHeight, scale, width, height);
} | [
"public",
"Texture",
"createTexture",
"(",
"float",
"width",
",",
"float",
"height",
",",
"Texture",
".",
"Config",
"config",
")",
"{",
"int",
"texWidth",
"=",
"config",
".",
"toTexWidth",
"(",
"scale",
".",
"scaledCeil",
"(",
"width",
")",
")",
";",
"in... | Creates an empty texture into which one can render. The supplied width and height are in
display units and will be converted to pixels based on the current scale factor. | [
"Creates",
"an",
"empty",
"texture",
"into",
"which",
"one",
"can",
"render",
".",
"The",
"supplied",
"width",
"and",
"height",
"are",
"in",
"display",
"units",
"and",
"will",
"be",
"converted",
"to",
"pixels",
"based",
"on",
"the",
"current",
"scale",
"fa... | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Graphics.java#L124-L134 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/util/BuildRetentionFactory.java | BuildRetentionFactory.createBuildRetention | public static BuildRetention createBuildRetention(Run build, boolean discardOldArtifacts) {
BuildRetention buildRetention = new BuildRetention(discardOldArtifacts);
LogRotator rotator = null;
BuildDiscarder buildDiscarder = build.getParent().getBuildDiscarder();
if (buildDiscarder != null && buildDiscarder instanceof LogRotator) {
rotator = (LogRotator) buildDiscarder;
}
if (rotator == null) {
return buildRetention;
}
if (rotator.getNumToKeep() > -1) {
buildRetention.setCount(rotator.getNumToKeep());
}
if (rotator.getDaysToKeep() > -1) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_YEAR, -rotator.getDaysToKeep());
buildRetention.setMinimumBuildDate(new Date(calendar.getTimeInMillis()));
}
List<String> notToBeDeleted = ExtractorUtils.getBuildNumbersNotToBeDeleted(build);
buildRetention.setBuildNumbersNotToBeDiscarded(notToBeDeleted);
return buildRetention;
} | java | public static BuildRetention createBuildRetention(Run build, boolean discardOldArtifacts) {
BuildRetention buildRetention = new BuildRetention(discardOldArtifacts);
LogRotator rotator = null;
BuildDiscarder buildDiscarder = build.getParent().getBuildDiscarder();
if (buildDiscarder != null && buildDiscarder instanceof LogRotator) {
rotator = (LogRotator) buildDiscarder;
}
if (rotator == null) {
return buildRetention;
}
if (rotator.getNumToKeep() > -1) {
buildRetention.setCount(rotator.getNumToKeep());
}
if (rotator.getDaysToKeep() > -1) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_YEAR, -rotator.getDaysToKeep());
buildRetention.setMinimumBuildDate(new Date(calendar.getTimeInMillis()));
}
List<String> notToBeDeleted = ExtractorUtils.getBuildNumbersNotToBeDeleted(build);
buildRetention.setBuildNumbersNotToBeDiscarded(notToBeDeleted);
return buildRetention;
} | [
"public",
"static",
"BuildRetention",
"createBuildRetention",
"(",
"Run",
"build",
",",
"boolean",
"discardOldArtifacts",
")",
"{",
"BuildRetention",
"buildRetention",
"=",
"new",
"BuildRetention",
"(",
"discardOldArtifacts",
")",
";",
"LogRotator",
"rotator",
"=",
"n... | Create a Build retention object out of the build
@param build The build to create the build retention out of
@param discardOldArtifacts Flag whether to discard artifacts of those builds that are to be discarded.
@return a new Build retention | [
"Create",
"a",
"Build",
"retention",
"object",
"out",
"of",
"the",
"build"
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/BuildRetentionFactory.java#L24-L45 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.setWaveform | public void setWaveform(WaveformDetail waveform, CueList cueList, BeatGrid beatGrid) {
this.waveform.set(waveform);
this.cueList.set(cueList);
this.beatGrid.set(beatGrid);
clearPlaybackState();
repaint();
if (!autoScroll.get()) {
invalidate();
}
} | java | public void setWaveform(WaveformDetail waveform, CueList cueList, BeatGrid beatGrid) {
this.waveform.set(waveform);
this.cueList.set(cueList);
this.beatGrid.set(beatGrid);
clearPlaybackState();
repaint();
if (!autoScroll.get()) {
invalidate();
}
} | [
"public",
"void",
"setWaveform",
"(",
"WaveformDetail",
"waveform",
",",
"CueList",
"cueList",
",",
"BeatGrid",
"beatGrid",
")",
"{",
"this",
".",
"waveform",
".",
"set",
"(",
"waveform",
")",
";",
"this",
".",
"cueList",
".",
"set",
"(",
"cueList",
")",
... | Change the waveform preview being drawn. This will be quickly overruled if a player is being monitored, but
can be used in other contexts.
@param waveform the waveform detail to display
@param cueList used to draw cue and memory points
@param beatGrid the locations of the beats, so they can be drawn | [
"Change",
"the",
"waveform",
"preview",
"being",
"drawn",
".",
"This",
"will",
"be",
"quickly",
"overruled",
"if",
"a",
"player",
"is",
"being",
"monitored",
"but",
"can",
"be",
"used",
"in",
"other",
"contexts",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L364-L373 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/SRTServletResponse.java | SRTServletResponse.setInternalHeader | public void setInternalHeader(String name, String s) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"setInternalHeader", " name --> " + name + " value --> " + s,"["+this+"]");
}
setHeader(name, s, false);
} | java | public void setInternalHeader(String name, String s) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"setInternalHeader", " name --> " + name + " value --> " + s,"["+this+"]");
}
setHeader(name, s, false);
} | [
"public",
"void",
"setInternalHeader",
"(",
"String",
"name",
",",
"String",
"s",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level"... | Adds a header field with the specified string value.
Does not check to see if this is an include. If this is
called more than once, the current value will replace the previous value.
@param name The header field name.
@param s The field's string value. | [
"Adds",
"a",
"header",
"field",
"with",
"the",
"specified",
"string",
"value",
".",
"Does",
"not",
"check",
"to",
"see",
"if",
"this",
"is",
"an",
"include",
".",
"If",
"this",
"is",
"called",
"more",
"than",
"once",
"the",
"current",
"value",
"will",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/SRTServletResponse.java#L1846-L1851 |
beangle/beangle3 | ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java | BeanDefinitionParser.parsePropertyElements | public void parsePropertyElements(Element beanEle, BeanDefinition bd) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(node, PROPERTY_ELEMENT))
parsePropertyElement((Element) node, bd);
}
} | java | public void parsePropertyElements(Element beanEle, BeanDefinition bd) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(node, PROPERTY_ELEMENT))
parsePropertyElement((Element) node, bd);
}
} | [
"public",
"void",
"parsePropertyElements",
"(",
"Element",
"beanEle",
",",
"BeanDefinition",
"bd",
")",
"{",
"NodeList",
"nl",
"=",
"beanEle",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nl",
".",
"getLength",
... | Parse property sub-elements of the given bean element.
@param beanEle a {@link org.w3c.dom.Element} object.
@param bd a {@link org.springframework.beans.factory.config.BeanDefinition} object. | [
"Parse",
"property",
"sub",
"-",
"elements",
"of",
"the",
"given",
"bean",
"element",
"."
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L392-L399 |
bwkimmel/jdcp | jdcp-core/src/main/java/ca/eandb/jdcp/job/ParallelizableJobRunner.java | ParallelizableJobRunner.submitResults | private void submitResults(Object task, Object results) throws JobExecutionException {
synchronized (monitor) {
this.job.submitTaskResults(task, results, monitor);
}
} | java | private void submitResults(Object task, Object results) throws JobExecutionException {
synchronized (monitor) {
this.job.submitTaskResults(task, results, monitor);
}
} | [
"private",
"void",
"submitResults",
"(",
"Object",
"task",
",",
"Object",
"results",
")",
"throws",
"JobExecutionException",
"{",
"synchronized",
"(",
"monitor",
")",
"{",
"this",
".",
"job",
".",
"submitTaskResults",
"(",
"task",
",",
"results",
",",
"monitor... | Submits results for a task.
@param task An <code>Object</code> describing the task for which results
are being submitted.
@param results An <code>Object</code> describing the results.
@throws JobExecutionException | [
"Submits",
"results",
"for",
"a",
"task",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/job/ParallelizableJobRunner.java#L367-L371 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/SearchIndex.java | SearchIndex.findByIp | public ManagedEntity findByIp(Datacenter datacenter, String ip, boolean vmOnly) throws RuntimeFault, RemoteException {
ManagedObjectReference mor = getVimService().findByIp(getMOR(), datacenter == null ? null : datacenter.getMOR(), ip, vmOnly);
return MorUtil.createExactManagedEntity(getServerConnection(), mor);
} | java | public ManagedEntity findByIp(Datacenter datacenter, String ip, boolean vmOnly) throws RuntimeFault, RemoteException {
ManagedObjectReference mor = getVimService().findByIp(getMOR(), datacenter == null ? null : datacenter.getMOR(), ip, vmOnly);
return MorUtil.createExactManagedEntity(getServerConnection(), mor);
} | [
"public",
"ManagedEntity",
"findByIp",
"(",
"Datacenter",
"datacenter",
",",
"String",
"ip",
",",
"boolean",
"vmOnly",
")",
"throws",
"RuntimeFault",
",",
"RemoteException",
"{",
"ManagedObjectReference",
"mor",
"=",
"getVimService",
"(",
")",
".",
"findByIp",
"("... | Find a Virtual Machine or Host System by its IP address.
@param datacenter The datacenter within which it searches. If null is passed, all inventory is searched.
@param ip The IP address of the VM or Host.
@param vmOnly When set true only searches for VM; otherwise only for Host.
@return A ManagedEntity to either HostSystem or VirtualMachine having the IP address.
@throws RuntimeFault
@throws RemoteException | [
"Find",
"a",
"Virtual",
"Machine",
"or",
"Host",
"System",
"by",
"its",
"IP",
"address",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/SearchIndex.java#L74-L77 |
PureSolTechnologies/commons | osgi/src/main/java/com/puresoltechnologies/commons/osgi/AbstractActivator.java | AbstractActivator.registerService | public final <T> ServiceRegistration<?> registerService(Class<T> iface, T instance) {
Hashtable<String, String> properties = new Hashtable<String, String>();
return registerService(iface, instance, properties);
} | java | public final <T> ServiceRegistration<?> registerService(Class<T> iface, T instance) {
Hashtable<String, String> properties = new Hashtable<String, String>();
return registerService(iface, instance, properties);
} | [
"public",
"final",
"<",
"T",
">",
"ServiceRegistration",
"<",
"?",
">",
"registerService",
"(",
"Class",
"<",
"T",
">",
"iface",
",",
"T",
"instance",
")",
"{",
"Hashtable",
"<",
"String",
",",
"String",
">",
"properties",
"=",
"new",
"Hashtable",
"<",
... | This method should be used to register services. Services registered with
this method auto deregistered during bundle stop.
@param iface
is the interface of the service to be used for later retrieval.
@param instance
is an instance of the object to be registered as service for
interface iface.
@param <T>
is the service interface.
@return A {@link ServiceRegistration} is returned of the newly registered
service. | [
"This",
"method",
"should",
"be",
"used",
"to",
"register",
"services",
".",
"Services",
"registered",
"with",
"this",
"method",
"auto",
"deregistered",
"during",
"bundle",
"stop",
"."
] | train | https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/osgi/src/main/java/com/puresoltechnologies/commons/osgi/AbstractActivator.java#L112-L115 |
kmbulebu/dsc-it100-java | src/main/java/com/github/kmbulebu/dsc/it100/ConfigurationBuilder.java | ConfigurationBuilder.withSerialPort | public ConfigurationBuilder withSerialPort(String serialPort, int baudRate) {
configuration.connector = new SerialConnector();
configuration.address = new SerialAddress(serialPort, baudRate, DataBits.DATABITS_8, StopBits.BITS_1, Parity.NONE, FlowControl.NONE );
return this;
} | java | public ConfigurationBuilder withSerialPort(String serialPort, int baudRate) {
configuration.connector = new SerialConnector();
configuration.address = new SerialAddress(serialPort, baudRate, DataBits.DATABITS_8, StopBits.BITS_1, Parity.NONE, FlowControl.NONE );
return this;
} | [
"public",
"ConfigurationBuilder",
"withSerialPort",
"(",
"String",
"serialPort",
",",
"int",
"baudRate",
")",
"{",
"configuration",
".",
"connector",
"=",
"new",
"SerialConnector",
"(",
")",
";",
"configuration",
".",
"address",
"=",
"new",
"SerialAddress",
"(",
... | Use a local serial port for communicating with the IT-100.
@param serialPort The serial port name. (/dev/ttyUSB0, COM1:, etc).
@param baudRate The baud rate to use while communicating with the IT-100. IT-100 default is 19200.
@return This builder instance. | [
"Use",
"a",
"local",
"serial",
"port",
"for",
"communicating",
"with",
"the",
"IT",
"-",
"100",
"."
] | train | https://github.com/kmbulebu/dsc-it100-java/blob/69c170ba50c870cce6dbbe04b488c6b1c6a0e10f/src/main/java/com/github/kmbulebu/dsc/it100/ConfigurationBuilder.java#L50-L54 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java | WikipediaInfo.getArticlesWithOverlappingCategories | private int getArticlesWithOverlappingCategories(Wikipedia pWiki, CategoryGraph pGraph) throws WikiPageNotFoundException {
Set<Integer> overlappingArticles = new HashSet<Integer>();
// iterate over all node pairs
Set<Integer> nodes = pGraph.getGraph().vertexSet();
Map<Integer,Set<Integer>> categoryArticleMap = getCategoryArticleMap(pWiki, nodes);
// sort the Array so we can use a simple iteration with two for loops to access all pairs
Object[] nodeArray = nodes.toArray();
Arrays.sort(nodeArray);
int progress = 0;
for (int i=0; i<nodes.size(); i++) {
progress++;
ApiUtilities.printProgressInfo(progress, nodes.size(), 100, ApiUtilities.ProgressInfoMode.TEXT, "");
int outerNode = (Integer) nodeArray[i];
for (int j=i+1; j<nodes.size(); j++) {
int innerNode = (Integer) nodeArray[j];
// test whether the categories have pages in common
Set<Integer> outerPages = categoryArticleMap.get(outerNode);
Set<Integer> innerPages = categoryArticleMap.get(innerNode);
for (int outerPage : outerPages) {
if (innerPages.contains(outerPage)) {
if (!overlappingArticles.contains(outerPage)) {
overlappingArticles.add(outerPage);
}
}
}
}
}
return overlappingArticles.size();
} | java | private int getArticlesWithOverlappingCategories(Wikipedia pWiki, CategoryGraph pGraph) throws WikiPageNotFoundException {
Set<Integer> overlappingArticles = new HashSet<Integer>();
// iterate over all node pairs
Set<Integer> nodes = pGraph.getGraph().vertexSet();
Map<Integer,Set<Integer>> categoryArticleMap = getCategoryArticleMap(pWiki, nodes);
// sort the Array so we can use a simple iteration with two for loops to access all pairs
Object[] nodeArray = nodes.toArray();
Arrays.sort(nodeArray);
int progress = 0;
for (int i=0; i<nodes.size(); i++) {
progress++;
ApiUtilities.printProgressInfo(progress, nodes.size(), 100, ApiUtilities.ProgressInfoMode.TEXT, "");
int outerNode = (Integer) nodeArray[i];
for (int j=i+1; j<nodes.size(); j++) {
int innerNode = (Integer) nodeArray[j];
// test whether the categories have pages in common
Set<Integer> outerPages = categoryArticleMap.get(outerNode);
Set<Integer> innerPages = categoryArticleMap.get(innerNode);
for (int outerPage : outerPages) {
if (innerPages.contains(outerPage)) {
if (!overlappingArticles.contains(outerPage)) {
overlappingArticles.add(outerPage);
}
}
}
}
}
return overlappingArticles.size();
} | [
"private",
"int",
"getArticlesWithOverlappingCategories",
"(",
"Wikipedia",
"pWiki",
",",
"CategoryGraph",
"pGraph",
")",
"throws",
"WikiPageNotFoundException",
"{",
"Set",
"<",
"Integer",
">",
"overlappingArticles",
"=",
"new",
"HashSet",
"<",
"Integer",
">",
"(",
... | Articles in wikipedia may be tagged with multiple categories.
It may be interesting to know how many articles have at least one category in common.
Such articles would have a very high semantic relatedness even if they share a quite secondary category.
@param pWiki The wikipedia object.
@param pGraph The category graph.
@return The number of articles that have at least one category in common.
@throws WikiPageNotFoundException | [
"Articles",
"in",
"wikipedia",
"may",
"be",
"tagged",
"with",
"multiple",
"categories",
".",
"It",
"may",
"be",
"interesting",
"to",
"know",
"how",
"many",
"articles",
"have",
"at",
"least",
"one",
"category",
"in",
"common",
".",
"Such",
"articles",
"would"... | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java#L216-L254 |
Pi4J/pi4j | pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java | MicrochipPotentiometerDeviceController.increase | public void increase(final DeviceControllerChannel channel, final int steps)
throws IOException {
if (channel == null) {
throw new RuntimeException("null-channel is not allowed. For devices "
+ "knowing just one wiper Channel.A is mandatory for "
+ "parameter 'channel'");
}
// decrease only works on volatile-wiper
byte memAddr = channel.getVolatileMemoryAddress();
increaseOrDecrease(memAddr, true, steps);
} | java | public void increase(final DeviceControllerChannel channel, final int steps)
throws IOException {
if (channel == null) {
throw new RuntimeException("null-channel is not allowed. For devices "
+ "knowing just one wiper Channel.A is mandatory for "
+ "parameter 'channel'");
}
// decrease only works on volatile-wiper
byte memAddr = channel.getVolatileMemoryAddress();
increaseOrDecrease(memAddr, true, steps);
} | [
"public",
"void",
"increase",
"(",
"final",
"DeviceControllerChannel",
"channel",
",",
"final",
"int",
"steps",
")",
"throws",
"IOException",
"{",
"if",
"(",
"channel",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"null-channel is not allowed... | Increments the volatile wiper for the given number steps.
@param channel Which wiper
@param steps The number of steps
@throws IOException Thrown if communication fails or device returned a malformed result | [
"Increments",
"the",
"volatile",
"wiper",
"for",
"the",
"given",
"number",
"steps",
"."
] | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L158-L172 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java | ExpressRoutePortsInner.createOrUpdateAsync | public Observable<ExpressRoutePortInner> createOrUpdateAsync(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).map(new Func1<ServiceResponse<ExpressRoutePortInner>, ExpressRoutePortInner>() {
@Override
public ExpressRoutePortInner call(ServiceResponse<ExpressRoutePortInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRoutePortInner> createOrUpdateAsync(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).map(new Func1<ServiceResponse<ExpressRoutePortInner>, ExpressRoutePortInner>() {
@Override
public ExpressRoutePortInner call(ServiceResponse<ExpressRoutePortInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRoutePortInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRoutePortName",
",",
"ExpressRoutePortInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourc... | Creates or updates the specified ExpressRoutePort resource.
@param resourceGroupName The name of the resource group.
@param expressRoutePortName The name of the ExpressRoutePort resource.
@param parameters Parameters supplied to the create ExpressRoutePort operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"the",
"specified",
"ExpressRoutePort",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java#L389-L396 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java | Stylesheet.setNonXslTopLevel | public void setNonXslTopLevel(QName name, Object obj)
{
if (null == m_NonXslTopLevel)
m_NonXslTopLevel = new Hashtable();
m_NonXslTopLevel.put(name, obj);
} | java | public void setNonXslTopLevel(QName name, Object obj)
{
if (null == m_NonXslTopLevel)
m_NonXslTopLevel = new Hashtable();
m_NonXslTopLevel.put(name, obj);
} | [
"public",
"void",
"setNonXslTopLevel",
"(",
"QName",
"name",
",",
"Object",
"obj",
")",
"{",
"if",
"(",
"null",
"==",
"m_NonXslTopLevel",
")",
"m_NonXslTopLevel",
"=",
"new",
"Hashtable",
"(",
")",
";",
"m_NonXslTopLevel",
".",
"put",
"(",
"name",
",",
"ob... | Set found a non-xslt element.
@see <a href="http://www.w3.org/TR/xslt#stylesheet-element">stylesheet-element in XSLT Specification</a>
@param name Qualified name of the element
@param obj The element object | [
"Set",
"found",
"a",
"non",
"-",
"xslt",
"element",
".",
"@see",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"xslt#stylesheet",
"-",
"element",
">",
"stylesheet",
"-",
"element",
"in",
"XSLT",
"Specification<",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java#L1163-L1170 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java | CommonOps_DDF3.elementMult | public static void elementMult( DMatrix3 a , DMatrix3 b , DMatrix3 c ) {
c.a1 = a.a1*b.a1;
c.a2 = a.a2*b.a2;
c.a3 = a.a3*b.a3;
} | java | public static void elementMult( DMatrix3 a , DMatrix3 b , DMatrix3 c ) {
c.a1 = a.a1*b.a1;
c.a2 = a.a2*b.a2;
c.a3 = a.a3*b.a3;
} | [
"public",
"static",
"void",
"elementMult",
"(",
"DMatrix3",
"a",
",",
"DMatrix3",
"b",
",",
"DMatrix3",
"c",
")",
"{",
"c",
".",
"a1",
"=",
"a",
".",
"a1",
"*",
"b",
".",
"a1",
";",
"c",
".",
"a2",
"=",
"a",
".",
"a2",
"*",
"b",
".",
"a2",
... | <p>Performs an element by element multiplication operation:<br>
<br>
c<sub>i</sub> = a<sub>i</sub> * b<sub>j</sub> <br>
</p>
@param a The left vector in the multiplication operation. Not modified.
@param b The right vector in the multiplication operation. Not modified.
@param c Where the results of the operation are stored. Modified. | [
"<p",
">",
"Performs",
"an",
"element",
"by",
"element",
"multiplication",
"operation",
":",
"<br",
">",
"<br",
">",
"c<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"*",
"b<sub",
">",
"j<",
"/",
"sub",
">",
"<br",
"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java#L1083-L1087 |
google/closure-templates | java/src/com/google/template/soy/jssrc/dsl/Statement.java | Statement.forLoop | public static Statement forLoop(String localVar, Expression limit, Statement body) {
return For.create(localVar, Expression.number(0), limit, Expression.number(1), body);
} | java | public static Statement forLoop(String localVar, Expression limit, Statement body) {
return For.create(localVar, Expression.number(0), limit, Expression.number(1), body);
} | [
"public",
"static",
"Statement",
"forLoop",
"(",
"String",
"localVar",
",",
"Expression",
"limit",
",",
"Statement",
"body",
")",
"{",
"return",
"For",
".",
"create",
"(",
"localVar",
",",
"Expression",
".",
"number",
"(",
"0",
")",
",",
"limit",
",",
"E... | Creates a code chunk representing a for loop, with default values for initial & increment. | [
"Creates",
"a",
"code",
"chunk",
"representing",
"a",
"for",
"loop",
"with",
"default",
"values",
"for",
"initial",
"&",
"increment",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/Statement.java#L73-L75 |
skuzzle/TinyPlugz | tiny-plugz/src/main/java/de/skuzzle/tinyplugz/internal/DelegateClassLoader.java | DelegateClassLoader.forPlugins | public static DelegateClassLoader forPlugins(Stream<URL> urls,
ClassLoader appClassLoader) {
Require.nonNull(urls, "urls");
Require.nonNull(appClassLoader, "parent");
final Collection<DependencyResolver> plugins = new ArrayList<>();
final Collection<PluginInformation> information = new ArrayList<>();
final DependencyResolver delegator = new DelegateDependencyResolver(plugins);
final Iterator<URL> it = urls.iterator();
while (it.hasNext()) {
final URL pluginURL = it.next();
// Plugin classloaders must be created with the application
// classloader as parent. This is mandatory for establishing a sound
// locking strategy during class lookup.
final PluginClassLoader pluginCl = PluginClassLoader.create(pluginURL,
appClassLoader, delegator);
plugins.add(pluginCl);
information.add(pluginCl.getPluginInformation());
}
return AccessController.doPrivileged(new PrivilegedAction<DelegateClassLoader>() {
@Override
public DelegateClassLoader run() {
return new DelegateClassLoader(appClassLoader, delegator, information);
}
});
} | java | public static DelegateClassLoader forPlugins(Stream<URL> urls,
ClassLoader appClassLoader) {
Require.nonNull(urls, "urls");
Require.nonNull(appClassLoader, "parent");
final Collection<DependencyResolver> plugins = new ArrayList<>();
final Collection<PluginInformation> information = new ArrayList<>();
final DependencyResolver delegator = new DelegateDependencyResolver(plugins);
final Iterator<URL> it = urls.iterator();
while (it.hasNext()) {
final URL pluginURL = it.next();
// Plugin classloaders must be created with the application
// classloader as parent. This is mandatory for establishing a sound
// locking strategy during class lookup.
final PluginClassLoader pluginCl = PluginClassLoader.create(pluginURL,
appClassLoader, delegator);
plugins.add(pluginCl);
information.add(pluginCl.getPluginInformation());
}
return AccessController.doPrivileged(new PrivilegedAction<DelegateClassLoader>() {
@Override
public DelegateClassLoader run() {
return new DelegateClassLoader(appClassLoader, delegator, information);
}
});
} | [
"public",
"static",
"DelegateClassLoader",
"forPlugins",
"(",
"Stream",
"<",
"URL",
">",
"urls",
",",
"ClassLoader",
"appClassLoader",
")",
"{",
"Require",
".",
"nonNull",
"(",
"urls",
",",
"\"urls\"",
")",
";",
"Require",
".",
"nonNull",
"(",
"appClassLoader"... | Creates a new ClassLoader which provides access to all plugins given by
the collection of URLs.
@param urls The URLs, each pointing to a plugin to be loaded.
@param appClassLoader The ClassLoader to use as parent.
@return The created ClassLoader. | [
"Creates",
"a",
"new",
"ClassLoader",
"which",
"provides",
"access",
"to",
"all",
"plugins",
"given",
"by",
"the",
"collection",
"of",
"URLs",
"."
] | train | https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/internal/DelegateClassLoader.java#L63-L89 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java | CeCPMain.calculateMinCP | protected static CPRange calculateMinCP(int[] block, int blockLen, int ca2len, int minCPlength) {
CPRange range = new CPRange();
// Find the cut point within the alignment.
// Either returns the index i of the alignment such that block[i] == ca2len,
// or else returns -i-1 where block[i] is the first element > ca2len.
int middle = Arrays.binarySearch(block, ca2len);
if(middle < 0) {
middle = -middle -1;
}
// Middle is now the first res after the duplication
range.mid = middle;
int minCPntermIndex = middle-minCPlength;
if(minCPntermIndex >= 0) {
range.n = block[minCPntermIndex];
} else {
range.n = -1;
}
int minCPctermIndex = middle+minCPlength-1;
if(minCPctermIndex < blockLen) {
range.c = block[minCPctermIndex];
} else {
range.c = ca2len*2;
}
// Stub:
// Best-case: assume all residues in the termini are aligned
//range.n = ca2len - minCPlength;
//range.c = ca2len + minCPlength-1;
return range;
} | java | protected static CPRange calculateMinCP(int[] block, int blockLen, int ca2len, int minCPlength) {
CPRange range = new CPRange();
// Find the cut point within the alignment.
// Either returns the index i of the alignment such that block[i] == ca2len,
// or else returns -i-1 where block[i] is the first element > ca2len.
int middle = Arrays.binarySearch(block, ca2len);
if(middle < 0) {
middle = -middle -1;
}
// Middle is now the first res after the duplication
range.mid = middle;
int minCPntermIndex = middle-minCPlength;
if(minCPntermIndex >= 0) {
range.n = block[minCPntermIndex];
} else {
range.n = -1;
}
int minCPctermIndex = middle+minCPlength-1;
if(minCPctermIndex < blockLen) {
range.c = block[minCPctermIndex];
} else {
range.c = ca2len*2;
}
// Stub:
// Best-case: assume all residues in the termini are aligned
//range.n = ca2len - minCPlength;
//range.c = ca2len + minCPlength-1;
return range;
} | [
"protected",
"static",
"CPRange",
"calculateMinCP",
"(",
"int",
"[",
"]",
"block",
",",
"int",
"blockLen",
",",
"int",
"ca2len",
",",
"int",
"minCPlength",
")",
"{",
"CPRange",
"range",
"=",
"new",
"CPRange",
"(",
")",
";",
"// Find the cut point within the al... | Finds the alignment index of the residues minCPlength before and after
the duplication.
@param block The permuted block being considered, generally optAln[0][1]
@param blockLen The length of the block (in case extra memory was allocated in block)
@param ca2len The length, in residues, of the protein specified by block
@param minCPlength The minimum number of residues allowed for a CP
@return a CPRange with the following components:
<dl><dt>n</dt><dd>Index into <code>block</code> of the residue such that
<code>minCPlength</code> residues remain to the end of <code>ca2len</code>,
or -1 if no residue fits that criterium.</dd>
<dt>mid</dt><dd>Index of the first residue higher than <code>ca2len</code>.</dd>
<dt>c</dt><dd>Index of <code>minCPlength</code>-th residue after ca2len,
or ca2len*2 if no residue fits that criterium.</dd>
</dl> | [
"Finds",
"the",
"alignment",
"index",
"of",
"the",
"residues",
"minCPlength",
"before",
"and",
"after",
"the",
"duplication",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java#L635-L668 |
rollbar/rollbar-java | rollbar-log4j2/src/main/java/com/rollbar/log4j2/RollbarAppender.java | RollbarAppender.createAppender | @PluginFactory
public static RollbarAppender createAppender(
@PluginAttribute("accessToken") @Required final String accessToken,
@PluginAttribute("endpoint") final String endpoint,
@PluginAttribute("environment") final String environment,
@PluginAttribute("language") final String language,
@PluginAttribute("configProviderClassName") final String configProviderClassName,
@PluginAttribute("name") @Required final String name,
@PluginElement("Layout") Layout<? extends Serializable> layout,
@PluginElement("Filter") Filter filter,
@PluginAttribute("ignoreExceptions") final String ignore
) {
ConfigProvider configProvider = ConfigProviderHelper
.getConfigProvider(configProviderClassName);
Config config;
ConfigBuilder configBuilder = withAccessToken(accessToken)
.environment(environment)
.endpoint(endpoint)
.server(new ServerProvider())
.language(language);
if (configProvider != null) {
config = configProvider.provide(configBuilder);
} else {
config = configBuilder.build();
}
Rollbar rollbar = new Rollbar(config);
boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
return new RollbarAppender(name, filter, layout, ignoreExceptions, rollbar);
} | java | @PluginFactory
public static RollbarAppender createAppender(
@PluginAttribute("accessToken") @Required final String accessToken,
@PluginAttribute("endpoint") final String endpoint,
@PluginAttribute("environment") final String environment,
@PluginAttribute("language") final String language,
@PluginAttribute("configProviderClassName") final String configProviderClassName,
@PluginAttribute("name") @Required final String name,
@PluginElement("Layout") Layout<? extends Serializable> layout,
@PluginElement("Filter") Filter filter,
@PluginAttribute("ignoreExceptions") final String ignore
) {
ConfigProvider configProvider = ConfigProviderHelper
.getConfigProvider(configProviderClassName);
Config config;
ConfigBuilder configBuilder = withAccessToken(accessToken)
.environment(environment)
.endpoint(endpoint)
.server(new ServerProvider())
.language(language);
if (configProvider != null) {
config = configProvider.provide(configBuilder);
} else {
config = configBuilder.build();
}
Rollbar rollbar = new Rollbar(config);
boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
return new RollbarAppender(name, filter, layout, ignoreExceptions, rollbar);
} | [
"@",
"PluginFactory",
"public",
"static",
"RollbarAppender",
"createAppender",
"(",
"@",
"PluginAttribute",
"(",
"\"accessToken\"",
")",
"@",
"Required",
"final",
"String",
"accessToken",
",",
"@",
"PluginAttribute",
"(",
"\"endpoint\"",
")",
"final",
"String",
"end... | Create appender plugin factory method.
@param accessToken the Rollbar access token.
@param endpoint the Rollbar endpoint to be used.
@param environment the environment.
@param language the language.
@param configProviderClassName The class name of the config provider implementation to get
the configuration.
@param name the name.
@param layout the layout.
@param filter the filter.
@param ignore the ignore exceptions flag.
@return the rollbar appender. | [
"Create",
"appender",
"plugin",
"factory",
"method",
"."
] | train | https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-log4j2/src/main/java/com/rollbar/log4j2/RollbarAppender.java#L75-L109 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java | DiagnosticsInner.listSiteDetectorResponsesAsync | public Observable<Page<DetectorResponseInner>> listSiteDetectorResponsesAsync(final String resourceGroupName, final String siteName) {
return listSiteDetectorResponsesWithServiceResponseAsync(resourceGroupName, siteName)
.map(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Page<DetectorResponseInner>>() {
@Override
public Page<DetectorResponseInner> call(ServiceResponse<Page<DetectorResponseInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<DetectorResponseInner>> listSiteDetectorResponsesAsync(final String resourceGroupName, final String siteName) {
return listSiteDetectorResponsesWithServiceResponseAsync(resourceGroupName, siteName)
.map(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Page<DetectorResponseInner>>() {
@Override
public Page<DetectorResponseInner> call(ServiceResponse<Page<DetectorResponseInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DetectorResponseInner",
">",
">",
"listSiteDetectorResponsesAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"siteName",
")",
"{",
"return",
"listSiteDetectorResponsesWithServiceResponseAsync",
"(",
"r... | List Site Detector Responses.
List Site Detector Responses.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DetectorResponseInner> object | [
"List",
"Site",
"Detector",
"Responses",
".",
"List",
"Site",
"Detector",
"Responses",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java#L578-L586 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java | SparkComputationGraph.evaluateRegressionMDS | public <T extends RegressionEvaluation> T evaluateRegressionMDS(JavaRDD<MultiDataSet> data) {
return evaluateRegressionMDS(data, DEFAULT_EVAL_SCORE_BATCH_SIZE);
} | java | public <T extends RegressionEvaluation> T evaluateRegressionMDS(JavaRDD<MultiDataSet> data) {
return evaluateRegressionMDS(data, DEFAULT_EVAL_SCORE_BATCH_SIZE);
} | [
"public",
"<",
"T",
"extends",
"RegressionEvaluation",
">",
"T",
"evaluateRegressionMDS",
"(",
"JavaRDD",
"<",
"MultiDataSet",
">",
"data",
")",
"{",
"return",
"evaluateRegressionMDS",
"(",
"data",
",",
"DEFAULT_EVAL_SCORE_BATCH_SIZE",
")",
";",
"}"
] | Evaluate the network (regression performance) in a distributed manner on the provided data
@param data Data to evaluate
@return {@link RegressionEvaluation} instance with regression performance | [
"Evaluate",
"the",
"network",
"(",
"regression",
"performance",
")",
"in",
"a",
"distributed",
"manner",
"on",
"the",
"provided",
"data"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L743-L745 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/tracer/Tracer.java | Tracer.clearConnection | public static synchronized void clearConnection(String poolName, Object mcp, Object cl, Object connection)
{
log.tracef("%s", new TraceEvent(poolName,
Integer.toHexString(System.identityHashCode(mcp)),
TraceEvent.CLEAR_CONNECTION,
Integer.toHexString(System.identityHashCode(cl)),
Integer.toHexString(System.identityHashCode(connection))));
} | java | public static synchronized void clearConnection(String poolName, Object mcp, Object cl, Object connection)
{
log.tracef("%s", new TraceEvent(poolName,
Integer.toHexString(System.identityHashCode(mcp)),
TraceEvent.CLEAR_CONNECTION,
Integer.toHexString(System.identityHashCode(cl)),
Integer.toHexString(System.identityHashCode(connection))));
} | [
"public",
"static",
"synchronized",
"void",
"clearConnection",
"(",
"String",
"poolName",
",",
"Object",
"mcp",
",",
"Object",
"cl",
",",
"Object",
"connection",
")",
"{",
"log",
".",
"tracef",
"(",
"\"%s\"",
",",
"new",
"TraceEvent",
"(",
"poolName",
",",
... | Clear connection
@param poolName The name of the pool
@param mcp The managed connection pool
@param cl The connection listener
@param connection The connection | [
"Clear",
"connection"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/Tracer.java#L405-L412 |
jaxio/celerio | celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java | RelationCollisionUtil.getManyToOneNamer | public Namer getManyToOneNamer(Attribute fromAttribute, Namer targetEntityNamer) {
// configuration
Namer result = getManyToOneNamerFromConf(fromAttribute.getColumnConfig(), targetEntityNamer);
// fall back
if (result == null) {
result = getXToOneNamerFallBack(fromAttribute, targetEntityNamer);
}
return result;
} | java | public Namer getManyToOneNamer(Attribute fromAttribute, Namer targetEntityNamer) {
// configuration
Namer result = getManyToOneNamerFromConf(fromAttribute.getColumnConfig(), targetEntityNamer);
// fall back
if (result == null) {
result = getXToOneNamerFallBack(fromAttribute, targetEntityNamer);
}
return result;
} | [
"public",
"Namer",
"getManyToOneNamer",
"(",
"Attribute",
"fromAttribute",
",",
"Namer",
"targetEntityNamer",
")",
"{",
"// configuration",
"Namer",
"result",
"=",
"getManyToOneNamerFromConf",
"(",
"fromAttribute",
".",
"getColumnConfig",
"(",
")",
",",
"targetEntityNam... | Compute the appropriate namer for the Java field marked by @ManyToOne
@param fromAttribute the column that is the foreign key.
@param targetEntityNamer the default namer for the entity on the other side of the relation. | [
"Compute",
"the",
"appropriate",
"namer",
"for",
"the",
"Java",
"field",
"marked",
"by",
"@ManyToOne"
] | train | https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java#L56-L66 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/VerticalText.java | VerticalText.setVerticalLayout | public void setVerticalLayout(float startX, float startY, float height, int maxLines, float leading) {
this.startX = startX;
this.startY = startY;
this.height = height;
this.maxLines = maxLines;
setLeading(leading);
} | java | public void setVerticalLayout(float startX, float startY, float height, int maxLines, float leading) {
this.startX = startX;
this.startY = startY;
this.height = height;
this.maxLines = maxLines;
setLeading(leading);
} | [
"public",
"void",
"setVerticalLayout",
"(",
"float",
"startX",
",",
"float",
"startY",
",",
"float",
"height",
",",
"int",
"maxLines",
",",
"float",
"leading",
")",
"{",
"this",
".",
"startX",
"=",
"startX",
";",
"this",
".",
"startY",
"=",
"startY",
";"... | Sets the layout.
@param startX the top right X line position
@param startY the top right Y line position
@param height the height of the lines
@param maxLines the maximum number of lines
@param leading the separation between the lines | [
"Sets",
"the",
"layout",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/VerticalText.java#L141-L147 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java | Download.toStream | public static void toStream(final HttpConfig config, final OutputStream ostream) {
toStream(config, ContentTypes.ANY.getAt(0), ostream);
} | java | public static void toStream(final HttpConfig config, final OutputStream ostream) {
toStream(config, ContentTypes.ANY.getAt(0), ostream);
} | [
"public",
"static",
"void",
"toStream",
"(",
"final",
"HttpConfig",
"config",
",",
"final",
"OutputStream",
"ostream",
")",
"{",
"toStream",
"(",
"config",
",",
"ContentTypes",
".",
"ANY",
".",
"getAt",
"(",
"0",
")",
",",
"ostream",
")",
";",
"}"
] | Downloads the content into an `OutputStream`.
@param config the `HttpConfig` instance
@param ostream the `OutputStream` to contain the content. | [
"Downloads",
"the",
"content",
"into",
"an",
"OutputStream",
"."
] | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java#L103-L105 |
canoo/dolphin-platform | platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerAttribute.java | ServerAttribute.firePropertyChange | @Override
protected void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) {
verbosely(new Runnable() {
@Override
public void run() {
ServerAttribute.super.firePropertyChange(propertyName, oldValue, newValue);
}
});
} | java | @Override
protected void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) {
verbosely(new Runnable() {
@Override
public void run() {
ServerAttribute.super.firePropertyChange(propertyName, oldValue, newValue);
}
});
} | [
"@",
"Override",
"protected",
"void",
"firePropertyChange",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Object",
"oldValue",
",",
"final",
"Object",
"newValue",
")",
"{",
"verbosely",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",... | Overriding the standard behavior of PCLs such that firing is enforced to be done
verbosely. This is safe since on the server side PCLs are never used for the control
of the client notification as part of the OpenDolphin infrastructure
(as opposed to the java client).
That is: all remaining PCLs are application specific and _must_ be called verbosely. | [
"Overriding",
"the",
"standard",
"behavior",
"of",
"PCLs",
"such",
"that",
"firing",
"is",
"enforced",
"to",
"be",
"done",
"verbosely",
".",
"This",
"is",
"safe",
"since",
"on",
"the",
"server",
"side",
"PCLs",
"are",
"never",
"used",
"for",
"the",
"contro... | train | https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerAttribute.java#L125-L134 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitAuthorizationsInner.java | ExpressRouteCircuitAuthorizationsInner.beginCreateOrUpdate | public ExpressRouteCircuitAuthorizationInner beginCreateOrUpdate(String resourceGroupName, String circuitName, String authorizationName, ExpressRouteCircuitAuthorizationInner authorizationParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, authorizationName, authorizationParameters).toBlocking().single().body();
} | java | public ExpressRouteCircuitAuthorizationInner beginCreateOrUpdate(String resourceGroupName, String circuitName, String authorizationName, ExpressRouteCircuitAuthorizationInner authorizationParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, authorizationName, authorizationParameters).toBlocking().single().body();
} | [
"public",
"ExpressRouteCircuitAuthorizationInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"String",
"authorizationName",
",",
"ExpressRouteCircuitAuthorizationInner",
"authorizationParameters",
")",
"{",
"return",
"beginCreat... | Creates or updates an authorization in the specified express route circuit.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param authorizationName The name of the authorization.
@param authorizationParameters Parameters supplied to the create or update express route circuit authorization operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRouteCircuitAuthorizationInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"authorization",
"in",
"the",
"specified",
"express",
"route",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitAuthorizationsInner.java#L444-L446 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.copy | @SuppressWarnings({ "unchecked" })
public static <T> T copy(final Class<? extends T> targetClass, final Object entity, final Collection<String> selectPropNames) {
final Class<?> srcCls = entity.getClass();
T copy = null;
if (selectPropNames == null && Utils.kryoParser != null && targetClass.equals(srcCls) && !notKryoCompatible.contains(srcCls)) {
try {
copy = (T) Utils.kryoParser.copy(entity);
} catch (Exception e) {
notKryoCompatible.add(srcCls);
// ignore
}
}
if (copy != null) {
return copy;
}
copy = N.newInstance(targetClass);
merge(entity, copy, selectPropNames);
setDirtyMarker(entity, copy);
return copy;
} | java | @SuppressWarnings({ "unchecked" })
public static <T> T copy(final Class<? extends T> targetClass, final Object entity, final Collection<String> selectPropNames) {
final Class<?> srcCls = entity.getClass();
T copy = null;
if (selectPropNames == null && Utils.kryoParser != null && targetClass.equals(srcCls) && !notKryoCompatible.contains(srcCls)) {
try {
copy = (T) Utils.kryoParser.copy(entity);
} catch (Exception e) {
notKryoCompatible.add(srcCls);
// ignore
}
}
if (copy != null) {
return copy;
}
copy = N.newInstance(targetClass);
merge(entity, copy, selectPropNames);
setDirtyMarker(entity, copy);
return copy;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"static",
"<",
"T",
">",
"T",
"copy",
"(",
"final",
"Class",
"<",
"?",
"extends",
"T",
">",
"targetClass",
",",
"final",
"Object",
"entity",
",",
"final",
"Collection",
"<",
"String"... | Returns a new created instance of the specified {@code cls} and set with
same properties retrieved by 'getXXX' method in the specified
{@code entity}.
@param targetClass
a Java Object what allows access to properties using getter
and setter methods.
@param entity
a Java Object what allows access to properties using getter
and setter methods.
@param selectPropNames
@return | [
"Returns",
"a",
"new",
"created",
"instance",
"of",
"the",
"specified",
"{",
"@code",
"cls",
"}",
"and",
"set",
"with",
"same",
"properties",
"retrieved",
"by",
"getXXX",
"method",
"in",
"the",
"specified",
"{",
"@code",
"entity",
"}",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L4146-L4172 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/MatrixOps_DDRB.java | MatrixOps_DDRB.identity | public static DMatrixRBlock identity(int numRows, int numCols, int blockLength ) {
DMatrixRBlock A = new DMatrixRBlock(numRows,numCols,blockLength);
int minLength = Math.min(numRows,numCols);
for( int i = 0; i < minLength; i += blockLength ) {
int h = Math.min(blockLength,A.numRows-i);
int w = Math.min(blockLength,A.numCols-i);
int index = i*A.numCols + h*i;
int m = Math.min(h,w);
for( int k = 0; k < m; k++ ) {
A.data[index + k*w + k ] = 1;
}
}
return A;
} | java | public static DMatrixRBlock identity(int numRows, int numCols, int blockLength ) {
DMatrixRBlock A = new DMatrixRBlock(numRows,numCols,blockLength);
int minLength = Math.min(numRows,numCols);
for( int i = 0; i < minLength; i += blockLength ) {
int h = Math.min(blockLength,A.numRows-i);
int w = Math.min(blockLength,A.numCols-i);
int index = i*A.numCols + h*i;
int m = Math.min(h,w);
for( int k = 0; k < m; k++ ) {
A.data[index + k*w + k ] = 1;
}
}
return A;
} | [
"public",
"static",
"DMatrixRBlock",
"identity",
"(",
"int",
"numRows",
",",
"int",
"numCols",
",",
"int",
"blockLength",
")",
"{",
"DMatrixRBlock",
"A",
"=",
"new",
"DMatrixRBlock",
"(",
"numRows",
",",
"numCols",
",",
"blockLength",
")",
";",
"int",
"minLe... | <p>
Returns a new matrix with ones along the diagonal and zeros everywhere else.
</p>
@param numRows Number of rows.
@param numCols NUmber of columns.
@param blockLength Block length.
@return An identify matrix. | [
"<p",
">",
"Returns",
"a",
"new",
"matrix",
"with",
"ones",
"along",
"the",
"diagonal",
"and",
"zeros",
"everywhere",
"else",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/MatrixOps_DDRB.java#L519-L537 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java | ComparableTimSort.pushRun | private void pushRun(int runBase, int runLen) {
this.runBase[stackSize] = runBase;
this.runLen[stackSize] = runLen;
stackSize++;
} | java | private void pushRun(int runBase, int runLen) {
this.runBase[stackSize] = runBase;
this.runLen[stackSize] = runLen;
stackSize++;
} | [
"private",
"void",
"pushRun",
"(",
"int",
"runBase",
",",
"int",
"runLen",
")",
"{",
"this",
".",
"runBase",
"[",
"stackSize",
"]",
"=",
"runBase",
";",
"this",
".",
"runLen",
"[",
"stackSize",
"]",
"=",
"runLen",
";",
"stackSize",
"++",
";",
"}"
] | Pushes the specified run onto the pending-run stack.
@param runBase index of the first element in the run
@param runLen the number of elements in the run | [
"Pushes",
"the",
"specified",
"run",
"onto",
"the",
"pending",
"-",
"run",
"stack",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java#L381-L385 |
deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/v2/transport/impl/AeronUdpTransport.java | AeronUdpTransport.addPrecursor | public <T extends VoidMessage> void addPrecursor(@NonNull Class<T> cls, @NonNull MessageCallable<T> callable) {
precursors.put(cls.getCanonicalName(), callable);
} | java | public <T extends VoidMessage> void addPrecursor(@NonNull Class<T> cls, @NonNull MessageCallable<T> callable) {
precursors.put(cls.getCanonicalName(), callable);
} | [
"public",
"<",
"T",
"extends",
"VoidMessage",
">",
"void",
"addPrecursor",
"(",
"@",
"NonNull",
"Class",
"<",
"T",
">",
"cls",
",",
"@",
"NonNull",
"MessageCallable",
"<",
"T",
">",
"callable",
")",
"{",
"precursors",
".",
"put",
"(",
"cls",
".",
"getC... | This method add precursor for incoming messages. If precursor is defined for given message class - runnable will be executed before processMessage()
@param cls
@param callable | [
"This",
"method",
"add",
"precursor",
"for",
"incoming",
"messages",
".",
"If",
"precursor",
"is",
"defined",
"for",
"given",
"message",
"class",
"-",
"runnable",
"will",
"be",
"executed",
"before",
"processMessage",
"()"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/v2/transport/impl/AeronUdpTransport.java#L540-L542 |
andrehertwig/admintool | admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java | ReflectUtils.invokeSetter | public static void invokeSetter(Object object, Field field, Object value, boolean ignoreNonExisting)
{
if(null == field && ignoreNonExisting) {
return;
}
ReflectionUtils.invokeMethod(ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toSetter(field.getName()), field.getType()), object, value);
} | java | public static void invokeSetter(Object object, Field field, Object value, boolean ignoreNonExisting)
{
if(null == field && ignoreNonExisting) {
return;
}
ReflectionUtils.invokeMethod(ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toSetter(field.getName()), field.getType()), object, value);
} | [
"public",
"static",
"void",
"invokeSetter",
"(",
"Object",
"object",
",",
"Field",
"field",
",",
"Object",
"value",
",",
"boolean",
"ignoreNonExisting",
")",
"{",
"if",
"(",
"null",
"==",
"field",
"&&",
"ignoreNonExisting",
")",
"{",
"return",
";",
"}",
"R... | invokes the setter on the filed
@param object
@param field
@return | [
"invokes",
"the",
"setter",
"on",
"the",
"filed"
] | train | https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java#L165-L171 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper._hasSideEffects | protected Boolean _hasSideEffects(XBlockExpression expression, ISideEffectContext context) {
final List<XExpression> exprs = expression.getExpressions();
if (exprs != null && !exprs.isEmpty()) {
context.open();
for (final XExpression ex : exprs) {
if (hasSideEffects(ex, context)) {
return true;
}
}
context.close();
}
return false;
} | java | protected Boolean _hasSideEffects(XBlockExpression expression, ISideEffectContext context) {
final List<XExpression> exprs = expression.getExpressions();
if (exprs != null && !exprs.isEmpty()) {
context.open();
for (final XExpression ex : exprs) {
if (hasSideEffects(ex, context)) {
return true;
}
}
context.close();
}
return false;
} | [
"protected",
"Boolean",
"_hasSideEffects",
"(",
"XBlockExpression",
"expression",
",",
"ISideEffectContext",
"context",
")",
"{",
"final",
"List",
"<",
"XExpression",
">",
"exprs",
"=",
"expression",
".",
"getExpressions",
"(",
")",
";",
"if",
"(",
"exprs",
"!="... | Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects. | [
"Test",
"if",
"the",
"given",
"expression",
"has",
"side",
"effects",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L588-L600 |
ontop/ontop | engine/reformulation/sql/src/main/java/it/unibz/inf/ontop/answering/reformulation/generation/dialect/impl/PostgreSQLDialectAdapter.java | PostgreSQLDialectAdapter.sqlRegex | @Override
public String sqlRegex(String columnname, String pattern, boolean caseinSensitive, boolean multiLine, boolean dotAllMode) {
if(quotes.matcher(pattern).matches() ) {
pattern = pattern.substring(1, pattern.length() - 1); // remove the
// enclosing
// quotes
}
//An ARE can begin with embedded options: a sequence (?n) specifies options affecting the rest of the RE.
//n is newline-sensitive matching
String flags = "";
if (multiLine)
flags = "(?w)"; //inverse partial newline-sensitive matching
else
if(dotAllMode)
flags = "(?p)"; //partial newline-sensitive matching
return columnname + " ~" + ((caseinSensitive)? "* " : " ") + "'"+ ((multiLine && dotAllMode)? "(?n)" : flags) + pattern + "'";
} | java | @Override
public String sqlRegex(String columnname, String pattern, boolean caseinSensitive, boolean multiLine, boolean dotAllMode) {
if(quotes.matcher(pattern).matches() ) {
pattern = pattern.substring(1, pattern.length() - 1); // remove the
// enclosing
// quotes
}
//An ARE can begin with embedded options: a sequence (?n) specifies options affecting the rest of the RE.
//n is newline-sensitive matching
String flags = "";
if (multiLine)
flags = "(?w)"; //inverse partial newline-sensitive matching
else
if(dotAllMode)
flags = "(?p)"; //partial newline-sensitive matching
return columnname + " ~" + ((caseinSensitive)? "* " : " ") + "'"+ ((multiLine && dotAllMode)? "(?n)" : flags) + pattern + "'";
} | [
"@",
"Override",
"public",
"String",
"sqlRegex",
"(",
"String",
"columnname",
",",
"String",
"pattern",
",",
"boolean",
"caseinSensitive",
",",
"boolean",
"multiLine",
",",
"boolean",
"dotAllMode",
")",
"{",
"if",
"(",
"quotes",
".",
"matcher",
"(",
"pattern",... | Based on documentation of postgres 9.1 at
http://www.postgresql.org/docs/9.3/static/functions-matching.html | [
"Based",
"on",
"documentation",
"of",
"postgres",
"9",
".",
"1",
"at",
"http",
":",
"//",
"www",
".",
"postgresql",
".",
"org",
"/",
"docs",
"/",
"9",
".",
"3",
"/",
"static",
"/",
"functions",
"-",
"matching",
".",
"html"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/reformulation/sql/src/main/java/it/unibz/inf/ontop/answering/reformulation/generation/dialect/impl/PostgreSQLDialectAdapter.java#L129-L147 |
jiaqi/caff | src/main/java/org/cyclopsgroup/caff/util/ByteUtils.java | ByteUtils.readLong | public static long readLong(byte[] src, int offset) throws IllegalArgumentException {
if (src.length < offset) {
throw new IllegalArgumentException("There's nothing to read in src from offset " + offset);
}
long r = 0;
for (int i = offset, j = 0; i < src.length && j < 64; i++, j += 8) {
r += ((long) src[i] & 0xff) << j;
}
return r;
} | java | public static long readLong(byte[] src, int offset) throws IllegalArgumentException {
if (src.length < offset) {
throw new IllegalArgumentException("There's nothing to read in src from offset " + offset);
}
long r = 0;
for (int i = offset, j = 0; i < src.length && j < 64; i++, j += 8) {
r += ((long) src[i] & 0xff) << j;
}
return r;
} | [
"public",
"static",
"long",
"readLong",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"offset",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"src",
".",
"length",
"<",
"offset",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"There's ... | Read long value from given source byte array
@param src Source byte array value is read from
@param offset The starting point where value is read from
@return The long value
@throws IllegalArgumentException When the length of input byte array conflicts offset | [
"Read",
"long",
"value",
"from",
"given",
"source",
"byte",
"array"
] | train | https://github.com/jiaqi/caff/blob/dba4b937a0afc844eb37ccf74dd04dd78f0c1314/src/main/java/org/cyclopsgroup/caff/util/ByteUtils.java#L41-L51 |
mpetazzoni/ttorrent | ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java | CommunicationManager.handleAnnounceResponse | @Override
public void handleAnnounceResponse(int interval, int complete, int incomplete, String hexInfoHash) {
final SharedTorrent sharedTorrent = this.torrentsStorage.getTorrent(hexInfoHash);
if (sharedTorrent != null) {
sharedTorrent.setSeedersCount(complete);
sharedTorrent.setLastAnnounceTime(System.currentTimeMillis());
}
setAnnounceInterval(interval);
} | java | @Override
public void handleAnnounceResponse(int interval, int complete, int incomplete, String hexInfoHash) {
final SharedTorrent sharedTorrent = this.torrentsStorage.getTorrent(hexInfoHash);
if (sharedTorrent != null) {
sharedTorrent.setSeedersCount(complete);
sharedTorrent.setLastAnnounceTime(System.currentTimeMillis());
}
setAnnounceInterval(interval);
} | [
"@",
"Override",
"public",
"void",
"handleAnnounceResponse",
"(",
"int",
"interval",
",",
"int",
"complete",
",",
"int",
"incomplete",
",",
"String",
"hexInfoHash",
")",
"{",
"final",
"SharedTorrent",
"sharedTorrent",
"=",
"this",
".",
"torrentsStorage",
".",
"g... | Handle an announce response event.
@param interval The announce interval requested by the tracker.
@param complete The number of seeders on this torrent.
@param incomplete The number of leechers on this torrent. | [
"Handle",
"an",
"announce",
"response",
"event",
"."
] | train | https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java#L604-L612 |
sporniket/core | sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java | ComponentFactory.createPanelWithVerticalLayout | public static JPanel createPanelWithVerticalLayout()
{
JPanel _panel = new JPanel();
_panel.setLayout(new BoxLayout(_panel, BoxLayout.Y_AXIS));
return _panel;
} | java | public static JPanel createPanelWithVerticalLayout()
{
JPanel _panel = new JPanel();
_panel.setLayout(new BoxLayout(_panel, BoxLayout.Y_AXIS));
return _panel;
} | [
"public",
"static",
"JPanel",
"createPanelWithVerticalLayout",
"(",
")",
"{",
"JPanel",
"_panel",
"=",
"new",
"JPanel",
"(",
")",
";",
"_panel",
".",
"setLayout",
"(",
"new",
"BoxLayout",
"(",
"_panel",
",",
"BoxLayout",
".",
"Y_AXIS",
")",
")",
";",
"retu... | Create a panel that lays out components vertically.
@return a panel with a vertical layout.
@since 15.02.00 | [
"Create",
"a",
"panel",
"that",
"lays",
"out",
"components",
"vertically",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java#L87-L92 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java | TransformerRegistry.resolveHost | public OperationTransformerRegistry resolveHost(final ModelVersion mgmtVersion, final ModelNode subsystems) {
return resolveHost(mgmtVersion, resolveVersions(subsystems));
} | java | public OperationTransformerRegistry resolveHost(final ModelVersion mgmtVersion, final ModelNode subsystems) {
return resolveHost(mgmtVersion, resolveVersions(subsystems));
} | [
"public",
"OperationTransformerRegistry",
"resolveHost",
"(",
"final",
"ModelVersion",
"mgmtVersion",
",",
"final",
"ModelNode",
"subsystems",
")",
"{",
"return",
"resolveHost",
"(",
"mgmtVersion",
",",
"resolveVersions",
"(",
"subsystems",
")",
")",
";",
"}"
] | Resolve the host registry.
@param mgmtVersion the mgmt version
@param subsystems the subsystems
@return the transformer registry | [
"Resolve",
"the",
"host",
"registry",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L197-L200 |
inversoft/restify | src/main/java/com/inversoft/rest/RESTClient.java | RESTClient.urlSegment | public RESTClient<RS, ERS> urlSegment(Object value) {
if (value != null) {
if (url.charAt(url.length() - 1) != '/') {
url.append('/');
}
url.append(value.toString());
}
return this;
} | java | public RESTClient<RS, ERS> urlSegment(Object value) {
if (value != null) {
if (url.charAt(url.length() - 1) != '/') {
url.append('/');
}
url.append(value.toString());
}
return this;
} | [
"public",
"RESTClient",
"<",
"RS",
",",
"ERS",
">",
"urlSegment",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"url",
".",
"charAt",
"(",
"url",
".",
"length",
"(",
")",
"-",
"1",
")",
"!=",
"'",
"'",... | Append a url path segment. <p>
For Example: <pre>
.url("http://www.foo.com")
.urlSegment("bar")
</pre>
This will result in a url of <code>http://www.foo.com/bar</code>
@param value The url path segment. A null value will be ignored.
@return This. | [
"Append",
"a",
"url",
"path",
"segment",
".",
"<p",
">",
"For",
"Example",
":",
"<pre",
">",
".",
"url",
"(",
"http",
":",
"//",
"www",
".",
"foo",
".",
"com",
")",
".",
"urlSegment",
"(",
"bar",
")",
"<",
"/",
"pre",
">",
"This",
"will",
"resu... | train | https://github.com/inversoft/restify/blob/f2426d9082e00a9d958af28f78ccda61802c6700/src/main/java/com/inversoft/rest/RESTClient.java#L352-L360 |
jroyalty/jglm | src/main/java/com/hackoeur/jglm/support/FastMathCalc.java | FastMathCalc.splitReciprocal | static void splitReciprocal(final double in[], final double result[]) {
final double b = 1.0/4194304.0;
final double a = 1.0 - b;
if (in[0] == 0.0) {
in[0] = in[1];
in[1] = 0.0;
}
result[0] = a / in[0];
result[1] = (b*in[0]-a*in[1]) / (in[0]*in[0] + in[0]*in[1]);
if (result[1] != result[1]) { // can happen if result[1] is NAN
result[1] = 0.0;
}
/* Resplit */
resplit(result);
for (int i = 0; i < 2; i++) {
/* this may be overkill, probably once is enough */
double err = 1.0 - result[0] * in[0] - result[0] * in[1] -
result[1] * in[0] - result[1] * in[1];
/*err = 1.0 - err; */
err = err * (result[0] + result[1]);
/*printf("err = %16e\n", err); */
result[1] += err;
}
} | java | static void splitReciprocal(final double in[], final double result[]) {
final double b = 1.0/4194304.0;
final double a = 1.0 - b;
if (in[0] == 0.0) {
in[0] = in[1];
in[1] = 0.0;
}
result[0] = a / in[0];
result[1] = (b*in[0]-a*in[1]) / (in[0]*in[0] + in[0]*in[1]);
if (result[1] != result[1]) { // can happen if result[1] is NAN
result[1] = 0.0;
}
/* Resplit */
resplit(result);
for (int i = 0; i < 2; i++) {
/* this may be overkill, probably once is enough */
double err = 1.0 - result[0] * in[0] - result[0] * in[1] -
result[1] * in[0] - result[1] * in[1];
/*err = 1.0 - err; */
err = err * (result[0] + result[1]);
/*printf("err = %16e\n", err); */
result[1] += err;
}
} | [
"static",
"void",
"splitReciprocal",
"(",
"final",
"double",
"in",
"[",
"]",
",",
"final",
"double",
"result",
"[",
"]",
")",
"{",
"final",
"double",
"b",
"=",
"1.0",
"/",
"4194304.0",
";",
"final",
"double",
"a",
"=",
"1.0",
"-",
"b",
";",
"if",
"... | Compute the reciprocal of in. Use the following algorithm.
in = c + d.
want to find x + y such that x+y = 1/(c+d) and x is much
larger than y and x has several zero bits on the right.
Set b = 1/(2^22), a = 1 - b. Thus (a+b) = 1.
Use following identity to compute (a+b)/(c+d)
(a+b)/(c+d) = a/c + (bc - ad) / (c^2 + cd)
set x = a/c and y = (bc - ad) / (c^2 + cd)
This will be close to the right answer, but there will be
some rounding in the calculation of X. So by carefully
computing 1 - (c+d)(x+y) we can compute an error and
add that back in. This is done carefully so that terms
of similar size are subtracted first.
@param in initial number, in split form
@param result placeholder where to put the result | [
"Compute",
"the",
"reciprocal",
"of",
"in",
".",
"Use",
"the",
"following",
"algorithm",
".",
"in",
"=",
"c",
"+",
"d",
".",
"want",
"to",
"find",
"x",
"+",
"y",
"such",
"that",
"x",
"+",
"y",
"=",
"1",
"/",
"(",
"c",
"+",
"d",
")",
"and",
"x... | train | https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMathCalc.java#L401-L429 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxLegalHoldPolicy.java | BoxLegalHoldPolicy.getAll | public static Iterable<BoxLegalHoldPolicy.Info> getAll(final BoxAPIConnection api) {
return getAll(api, null, DEFAULT_LIMIT);
} | java | public static Iterable<BoxLegalHoldPolicy.Info> getAll(final BoxAPIConnection api) {
return getAll(api, null, DEFAULT_LIMIT);
} | [
"public",
"static",
"Iterable",
"<",
"BoxLegalHoldPolicy",
".",
"Info",
">",
"getAll",
"(",
"final",
"BoxAPIConnection",
"api",
")",
"{",
"return",
"getAll",
"(",
"api",
",",
"null",
",",
"DEFAULT_LIMIT",
")",
";",
"}"
] | Retrieves a list of Legal Hold Policies that belong to your Enterprise as an Iterable.
@param api api the API connection to be used by the resource.
@return the Iterable of Legal Hold Policies in your Enterprise. | [
"Retrieves",
"a",
"list",
"of",
"Legal",
"Hold",
"Policies",
"that",
"belong",
"to",
"your",
"Enterprise",
"as",
"an",
"Iterable",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxLegalHoldPolicy.java#L161-L163 |
paoding-code/paoding-rose | paoding-rose-web/src/main/java/net/paoding/rose/web/impl/mapping/EngineGroupImpl.java | EngineGroupImpl.addEngine | public void addEngine(ReqMethod method, LinkedEngine engine) {
for (ReqMethod md : method.parse()) {
LinkedEngine[] methodEngines = engines[md.ordinal()];
if (methodEngines.length == 0) {
methodEngines = new LinkedEngine[] { engine };
} else {
methodEngines = Arrays.copyOf(methodEngines, methodEngines.length + 1);
methodEngines[methodEngines.length - 1] = engine;
}
engines[md.ordinal()] = methodEngines;
engineCount++;
}
clearCache();
} | java | public void addEngine(ReqMethod method, LinkedEngine engine) {
for (ReqMethod md : method.parse()) {
LinkedEngine[] methodEngines = engines[md.ordinal()];
if (methodEngines.length == 0) {
methodEngines = new LinkedEngine[] { engine };
} else {
methodEngines = Arrays.copyOf(methodEngines, methodEngines.length + 1);
methodEngines[methodEngines.length - 1] = engine;
}
engines[md.ordinal()] = methodEngines;
engineCount++;
}
clearCache();
} | [
"public",
"void",
"addEngine",
"(",
"ReqMethod",
"method",
",",
"LinkedEngine",
"engine",
")",
"{",
"for",
"(",
"ReqMethod",
"md",
":",
"method",
".",
"parse",
"(",
")",
")",
"{",
"LinkedEngine",
"[",
"]",
"methodEngines",
"=",
"engines",
"[",
"md",
".",... | 添加一个 {@link Engine} ;如果所给的 method 是 {@link ReqMethod#ALL},则优先级最低。
@param method
@param engine | [
"添加一个",
"{",
"@link",
"Engine",
"}",
";如果所给的",
"method",
"是",
"{",
"@link",
"ReqMethod#ALL",
"}",
",则优先级最低。"
] | train | https://github.com/paoding-code/paoding-rose/blob/8b512704174dd6cba95e544c7d6ab66105cb8ec4/paoding-rose-web/src/main/java/net/paoding/rose/web/impl/mapping/EngineGroupImpl.java#L76-L89 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/DiscoveryResources.java | DiscoveryResources.getRecords | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/metrics/schemarecords")
@Description("Discover metric schema records. If type is specified, then records of that particular type are returned.")
public List<? extends Object> getRecords(@Context HttpServletRequest req,
@DefaultValue("*") @QueryParam("namespace") final String namespaceRegex,
@QueryParam("scope") final String scopeRegex,
@QueryParam("metric") final String metricRegex,
@DefaultValue("*") @QueryParam("tagk") final String tagkRegex,
@DefaultValue("*") @QueryParam("tagv") final String tagvRegex,
@DefaultValue("50") @QueryParam("limit") final int limit,
@DefaultValue("1") @QueryParam("page") final int page,
@QueryParam("type") String type) {
if (type == null) {
MetricSchemaRecordQuery query = new MetricSchemaRecordQueryBuilder().namespace(namespaceRegex)
.scope(scopeRegex)
.metric(metricRegex)
.tagKey(tagkRegex)
.tagValue(tagvRegex)
.limit(limit * page)
.build();
List<MetricSchemaRecord> schemaRecords = _discoveryService.filterRecords(query);
if(_isFormat(req)) {
List<String> records = new ArrayList<>(schemaRecords.size());
_formatToString(schemaRecords, records);
return _getSubList(records, limit * (page - 1), records.size());
}
return _getSubList(schemaRecords, limit * (page - 1), schemaRecords.size());
} else {
MetricSchemaRecordQuery query = new MetricSchemaRecordQueryBuilder().namespace(namespaceRegex)
.scope(scopeRegex)
.metric(metricRegex)
.tagKey(tagkRegex)
.tagValue(tagvRegex)
.limit(limit * page)
.build();
List<MetricSchemaRecord> records = _discoveryService.getUniqueRecords(query, RecordType.fromName(type));
return _getValueForType(_getSubList(records, limit*(page-1), records.size()), RecordType.fromName(type));
}
} | java | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/metrics/schemarecords")
@Description("Discover metric schema records. If type is specified, then records of that particular type are returned.")
public List<? extends Object> getRecords(@Context HttpServletRequest req,
@DefaultValue("*") @QueryParam("namespace") final String namespaceRegex,
@QueryParam("scope") final String scopeRegex,
@QueryParam("metric") final String metricRegex,
@DefaultValue("*") @QueryParam("tagk") final String tagkRegex,
@DefaultValue("*") @QueryParam("tagv") final String tagvRegex,
@DefaultValue("50") @QueryParam("limit") final int limit,
@DefaultValue("1") @QueryParam("page") final int page,
@QueryParam("type") String type) {
if (type == null) {
MetricSchemaRecordQuery query = new MetricSchemaRecordQueryBuilder().namespace(namespaceRegex)
.scope(scopeRegex)
.metric(metricRegex)
.tagKey(tagkRegex)
.tagValue(tagvRegex)
.limit(limit * page)
.build();
List<MetricSchemaRecord> schemaRecords = _discoveryService.filterRecords(query);
if(_isFormat(req)) {
List<String> records = new ArrayList<>(schemaRecords.size());
_formatToString(schemaRecords, records);
return _getSubList(records, limit * (page - 1), records.size());
}
return _getSubList(schemaRecords, limit * (page - 1), schemaRecords.size());
} else {
MetricSchemaRecordQuery query = new MetricSchemaRecordQueryBuilder().namespace(namespaceRegex)
.scope(scopeRegex)
.metric(metricRegex)
.tagKey(tagkRegex)
.tagValue(tagvRegex)
.limit(limit * page)
.build();
List<MetricSchemaRecord> records = _discoveryService.getUniqueRecords(query, RecordType.fromName(type));
return _getValueForType(_getSubList(records, limit*(page-1), records.size()), RecordType.fromName(type));
}
} | [
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/metrics/schemarecords\"",
")",
"@",
"Description",
"(",
"\"Discover metric schema records. If type is specified, then records of that particular type are returned.\"",
")",
"publi... | Discover metric schema records. If type is specified, then records of that particular type are returned.
@param req The HTTP request.
@param namespaceRegex The namespace filter.
@param scopeRegex The scope filter.
@param metricRegex The metric name filter.
@param tagkRegex The tag key filter.
@param tagvRegex The tag value filter.
@param limit The maximum number of records to return.
@param page The page of results to return
@param type The field for which to retrieve unique values. If null, the entire schema record including all the fields is returned.
@return The filtered set of schema records or unique values if a specific field is requested. | [
"Discover",
"metric",
"schema",
"records",
".",
"If",
"type",
"is",
"specified",
"then",
"records",
"of",
"that",
"particular",
"type",
"are",
"returned",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/DiscoveryResources.java#L89-L135 |
inmite/android-validation-komensky | library/src/main/java/eu/inmite/android/lib/validations/form/FormValidator.java | FormValidator.startLiveValidation | public static void startLiveValidation(final Fragment fragment, final IValidationCallback callback) {
startLiveValidation(fragment, fragment.getView(), callback);
} | java | public static void startLiveValidation(final Fragment fragment, final IValidationCallback callback) {
startLiveValidation(fragment, fragment.getView(), callback);
} | [
"public",
"static",
"void",
"startLiveValidation",
"(",
"final",
"Fragment",
"fragment",
",",
"final",
"IValidationCallback",
"callback",
")",
"{",
"startLiveValidation",
"(",
"fragment",
",",
"fragment",
".",
"getView",
"(",
")",
",",
"callback",
")",
";",
"}"
... | Start live validation - whenever focus changes from view with validations upon itself, validators will run. <br/>
Don't forget to call {@link #stopLiveValidation(Object)} once you are done.
@param fragment fragment with views to validate, there can be only one continuous validation per target object (fragment)
@param callback callback invoked whenever there is some validation fail | [
"Start",
"live",
"validation",
"-",
"whenever",
"focus",
"changes",
"from",
"view",
"with",
"validations",
"upon",
"itself",
"validators",
"will",
"run",
".",
"<br",
"/",
">",
"Don",
"t",
"forget",
"to",
"call",
"{"
] | train | https://github.com/inmite/android-validation-komensky/blob/7c544f2d9f104a9800fcf4757eecb3caa8e76451/library/src/main/java/eu/inmite/android/lib/validations/form/FormValidator.java#L125-L127 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java | Levenshtein.weightedLevenshtein | @SuppressWarnings("unchecked")
public static <T extends Levenshtein> T weightedLevenshtein(
String baseTarget, String compareTarget, CharacterSubstitution characterSubstitution) {
return (T) new WeightedLevenshtein(baseTarget, characterSubstitution).update(compareTarget);
} | java | @SuppressWarnings("unchecked")
public static <T extends Levenshtein> T weightedLevenshtein(
String baseTarget, String compareTarget, CharacterSubstitution characterSubstitution) {
return (T) new WeightedLevenshtein(baseTarget, characterSubstitution).update(compareTarget);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Levenshtein",
">",
"T",
"weightedLevenshtein",
"(",
"String",
"baseTarget",
",",
"String",
"compareTarget",
",",
"CharacterSubstitution",
"characterSubstitution",
")",
"{",
... | Returns a new Weighted Levenshtein edit distance instance with compare target string
@see WeightedLevenshtein
@param baseTarget
@param compareTarget
@param characterSubstitution
@return | [
"Returns",
"a",
"new",
"Weighted",
"Levenshtein",
"edit",
"distance",
"instance",
"with",
"compare",
"target",
"string"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java#L87-L91 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/internal/crypto/S3CryptoModuleBase.java | S3CryptoModuleBase.newContentCryptoMaterial | private ContentCryptoMaterial newContentCryptoMaterial(
EncryptionMaterialsProvider kekMaterialProvider,
Map<String, String> materialsDescription, Provider provider,
AmazonWebServiceRequest req) {
EncryptionMaterials kekMaterials =
kekMaterialProvider.getEncryptionMaterials(materialsDescription);
if (kekMaterials == null) {
return null;
}
return buildContentCryptoMaterial(kekMaterials, provider, req);
} | java | private ContentCryptoMaterial newContentCryptoMaterial(
EncryptionMaterialsProvider kekMaterialProvider,
Map<String, String> materialsDescription, Provider provider,
AmazonWebServiceRequest req) {
EncryptionMaterials kekMaterials =
kekMaterialProvider.getEncryptionMaterials(materialsDescription);
if (kekMaterials == null) {
return null;
}
return buildContentCryptoMaterial(kekMaterials, provider, req);
} | [
"private",
"ContentCryptoMaterial",
"newContentCryptoMaterial",
"(",
"EncryptionMaterialsProvider",
"kekMaterialProvider",
",",
"Map",
"<",
"String",
",",
"String",
">",
"materialsDescription",
",",
"Provider",
"provider",
",",
"AmazonWebServiceRequest",
"req",
")",
"{",
... | Returns the content encryption material generated with the given kek
material, material description and security providers; or null if
the encryption material cannot be found for the specified description. | [
"Returns",
"the",
"content",
"encryption",
"material",
"generated",
"with",
"the",
"given",
"kek",
"material",
"material",
"description",
"and",
"security",
"providers",
";",
"or",
"null",
"if",
"the",
"encryption",
"material",
"cannot",
"be",
"found",
"for",
"t... | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/internal/crypto/S3CryptoModuleBase.java#L466-L476 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/accounts/A_CmsGroupUsersList.java | A_CmsGroupUsersList.setUserData | protected void setUserData(CmsUser user, CmsListItem item) {
item.set(LIST_COLUMN_LOGIN, user.getName());
item.set(LIST_COLUMN_NAME, user.getSimpleName());
item.set(LIST_COLUMN_ORGUNIT, CmsOrganizationalUnit.SEPARATOR + user.getOuFqn());
item.set(LIST_COLUMN_FULLNAME, user.getFullName());
} | java | protected void setUserData(CmsUser user, CmsListItem item) {
item.set(LIST_COLUMN_LOGIN, user.getName());
item.set(LIST_COLUMN_NAME, user.getSimpleName());
item.set(LIST_COLUMN_ORGUNIT, CmsOrganizationalUnit.SEPARATOR + user.getOuFqn());
item.set(LIST_COLUMN_FULLNAME, user.getFullName());
} | [
"protected",
"void",
"setUserData",
"(",
"CmsUser",
"user",
",",
"CmsListItem",
"item",
")",
"{",
"item",
".",
"set",
"(",
"LIST_COLUMN_LOGIN",
",",
"user",
".",
"getName",
"(",
")",
")",
";",
"item",
".",
"set",
"(",
"LIST_COLUMN_NAME",
",",
"user",
"."... | Sets all needed data of the user into the list item object.<p>
@param user the user to set the data for
@param item the list item object to set the data into | [
"Sets",
"all",
"needed",
"data",
"of",
"the",
"user",
"into",
"the",
"list",
"item",
"object",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/accounts/A_CmsGroupUsersList.java#L344-L350 |
hawkular/hawkular-commons | hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/bus/BusCommandContextFactory.java | BusCommandContextFactory.newCommandContext | public BusCommandContext newCommandContext(Endpoint endpoint) {
return new BusCommandContext(endpoint, connectionFactoryProvider.getConnectionFactory(),
wsEndpoints.getUiClientSessions(), wsEndpoints.getFeedSessions());
} | java | public BusCommandContext newCommandContext(Endpoint endpoint) {
return new BusCommandContext(endpoint, connectionFactoryProvider.getConnectionFactory(),
wsEndpoints.getUiClientSessions(), wsEndpoints.getFeedSessions());
} | [
"public",
"BusCommandContext",
"newCommandContext",
"(",
"Endpoint",
"endpoint",
")",
"{",
"return",
"new",
"BusCommandContext",
"(",
"endpoint",
",",
"connectionFactoryProvider",
".",
"getConnectionFactory",
"(",
")",
",",
"wsEndpoints",
".",
"getUiClientSessions",
"("... | Creates a new {@link BusCommandContext} with the given {@code endpoint}.
@param endpoint the queue or topic the present request came from
@return a new {@link BusCommandContext} | [
"Creates",
"a",
"new",
"{",
"@link",
"BusCommandContext",
"}",
"with",
"the",
"given",
"{",
"@code",
"endpoint",
"}",
"."
] | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/bus/BusCommandContextFactory.java#L51-L54 |
jhunters/jprotobuf | src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java | CodedConstant.getEnumName | public static String getEnumName(Enum[] e, int value) {
if (e != null) {
int toCompareValue;
for (Enum en : e) {
if (en instanceof EnumReadable) {
toCompareValue = ((EnumReadable) en).value();
} else {
toCompareValue = en.ordinal();
}
if (value == toCompareValue) {
return en.name();
}
}
}
return "";
} | java | public static String getEnumName(Enum[] e, int value) {
if (e != null) {
int toCompareValue;
for (Enum en : e) {
if (en instanceof EnumReadable) {
toCompareValue = ((EnumReadable) en).value();
} else {
toCompareValue = en.ordinal();
}
if (value == toCompareValue) {
return en.name();
}
}
}
return "";
} | [
"public",
"static",
"String",
"getEnumName",
"(",
"Enum",
"[",
"]",
"e",
",",
"int",
"value",
")",
"{",
"if",
"(",
"e",
"!=",
"null",
")",
"{",
"int",
"toCompareValue",
";",
"for",
"(",
"Enum",
"en",
":",
"e",
")",
"{",
"if",
"(",
"en",
"instance... | Gets the enum name.
@param e the e
@param value the value
@return the enum name | [
"Gets",
"the",
"enum",
"name",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L632-L647 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/apple/PropertyListSerialization.java | PropertyListSerialization.serializeElement | private static void serializeElement(final String tag, final String content, final ContentHandler handler)
throws SAXException {
final AttributesImpl attributes = new AttributesImpl();
handler.startElement(null, tag, tag, attributes);
handler.characters(content.toCharArray(), 0, content.length());
handler.endElement(null, tag, tag);
} | java | private static void serializeElement(final String tag, final String content, final ContentHandler handler)
throws SAXException {
final AttributesImpl attributes = new AttributesImpl();
handler.startElement(null, tag, tag, attributes);
handler.characters(content.toCharArray(), 0, content.length());
handler.endElement(null, tag, tag);
} | [
"private",
"static",
"void",
"serializeElement",
"(",
"final",
"String",
"tag",
",",
"final",
"String",
"content",
",",
"final",
"ContentHandler",
"handler",
")",
"throws",
"SAXException",
"{",
"final",
"AttributesImpl",
"attributes",
"=",
"new",
"AttributesImpl",
... | Creates an element with the specified tag name and character content.
@param tag
tag name.
@param content
character content.
@param handler
destination of serialization events.
@throws SAXException
if exception during serialization. | [
"Creates",
"an",
"element",
"with",
"the",
"specified",
"tag",
"name",
"and",
"character",
"content",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/PropertyListSerialization.java#L113-L119 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubAnnotationPropertyOfAxiomImpl_CustomFieldSerializer.java | OWLSubAnnotationPropertyOfAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLSubAnnotationPropertyOfAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLSubAnnotationPropertyOfAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLSubAnnotationPropertyOfAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"... | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubAnnotationPropertyOfAxiomImpl_CustomFieldSerializer.java#L75-L78 |
albfernandez/itext2 | src/main/java/com/lowagie/text/xml/simpleparser/SimpleXMLParser.java | SimpleXMLParser.escapeXML | public static String escapeXML(String s, boolean onlyASCII) {
char cc[] = s.toCharArray();
int len = cc.length;
StringBuffer sb = new StringBuffer();
for (int k = 0; k < len; ++k) {
int c = cc[k];
switch (c) {
case '<':
sb.append("<");
break;
case '>':
sb.append(">");
break;
case '&':
sb.append("&");
break;
case '"':
sb.append(""");
break;
case '\'':
sb.append("'");
break;
default:
if ((c == 0x9) || (c == 0xA) || (c == 0xD)
|| ((c >= 0x20) && (c <= 0xD7FF))
|| ((c >= 0xE000) && (c <= 0xFFFD))
|| ((c >= 0x10000) && (c <= 0x10FFFF))) {
if (onlyASCII && c > 127)
sb.append("&#").append(c).append(';');
else
sb.append((char)c);
}
}
}
return sb.toString();
} | java | public static String escapeXML(String s, boolean onlyASCII) {
char cc[] = s.toCharArray();
int len = cc.length;
StringBuffer sb = new StringBuffer();
for (int k = 0; k < len; ++k) {
int c = cc[k];
switch (c) {
case '<':
sb.append("<");
break;
case '>':
sb.append(">");
break;
case '&':
sb.append("&");
break;
case '"':
sb.append(""");
break;
case '\'':
sb.append("'");
break;
default:
if ((c == 0x9) || (c == 0xA) || (c == 0xD)
|| ((c >= 0x20) && (c <= 0xD7FF))
|| ((c >= 0xE000) && (c <= 0xFFFD))
|| ((c >= 0x10000) && (c <= 0x10FFFF))) {
if (onlyASCII && c > 127)
sb.append("&#").append(c).append(';');
else
sb.append((char)c);
}
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"escapeXML",
"(",
"String",
"s",
",",
"boolean",
"onlyASCII",
")",
"{",
"char",
"cc",
"[",
"]",
"=",
"s",
".",
"toCharArray",
"(",
")",
";",
"int",
"len",
"=",
"cc",
".",
"length",
";",
"StringBuffer",
"sb",
"=",
"new",
... | Escapes a string with the appropriated XML codes.
@param s the string to be escaped
@param onlyASCII codes above 127 will always be escaped with &#nn; if <CODE>true</CODE>
@return the escaped string | [
"Escapes",
"a",
"string",
"with",
"the",
"appropriated",
"XML",
"codes",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/xml/simpleparser/SimpleXMLParser.java#L657-L692 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/engine/QuerySources.java | QuerySources.sharedNodesFilter | protected NodeFilter sharedNodesFilter() {
return new NodeFilter() {
private final Set<NodeKey> shareableNodeKeys = new HashSet<>();
@Override
public boolean includeNode( CachedNode node,
NodeCache cache ) {
if (nodeTypes.isShareable(node.getPrimaryType(cache), node.getMixinTypes(cache))) {
NodeKey key = node.getKey();
if (shareableNodeKeys.contains(key)) {
return false;
}
// we're seeing the original shareable node, so we need to process it
shareableNodeKeys.add(key);
return true;
}
return true;
}
@Override
public boolean continueProcessingChildren( CachedNode node, NodeCache cache ) {
return !shareableNodeKeys.contains(node.getKey());
}
@Override
public String toString() {
return "(excludes-sharables)";
}
};
} | java | protected NodeFilter sharedNodesFilter() {
return new NodeFilter() {
private final Set<NodeKey> shareableNodeKeys = new HashSet<>();
@Override
public boolean includeNode( CachedNode node,
NodeCache cache ) {
if (nodeTypes.isShareable(node.getPrimaryType(cache), node.getMixinTypes(cache))) {
NodeKey key = node.getKey();
if (shareableNodeKeys.contains(key)) {
return false;
}
// we're seeing the original shareable node, so we need to process it
shareableNodeKeys.add(key);
return true;
}
return true;
}
@Override
public boolean continueProcessingChildren( CachedNode node, NodeCache cache ) {
return !shareableNodeKeys.contains(node.getKey());
}
@Override
public String toString() {
return "(excludes-sharables)";
}
};
} | [
"protected",
"NodeFilter",
"sharedNodesFilter",
"(",
")",
"{",
"return",
"new",
"NodeFilter",
"(",
")",
"{",
"private",
"final",
"Set",
"<",
"NodeKey",
">",
"shareableNodeKeys",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"@",
"Override",
"public",
"boolean"... | Creates a node filter which doesn't include any of the nodes from the shared set in the query result. This is per
JSR-283/#14.16: if a query matches a descendant node of a shared set, it appears in query results only once.
@return a new {@link org.modeshape.jcr.cache.document.NodeCacheIterator.NodeFilter} instance | [
"Creates",
"a",
"node",
"filter",
"which",
"doesn",
"t",
"include",
"any",
"of",
"the",
"nodes",
"from",
"the",
"shared",
"set",
"in",
"the",
"query",
"result",
".",
"This",
"is",
"per",
"JSR",
"-",
"283",
"/",
"#14",
".",
"16",
":",
"if",
"a",
"qu... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/engine/QuerySources.java#L478-L507 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java | ImageModerationsImpl.matchFileInputAsync | public Observable<MatchResponse> matchFileInputAsync(byte[] imageStream, MatchFileInputOptionalParameter matchFileInputOptionalParameter) {
return matchFileInputWithServiceResponseAsync(imageStream, matchFileInputOptionalParameter).map(new Func1<ServiceResponse<MatchResponse>, MatchResponse>() {
@Override
public MatchResponse call(ServiceResponse<MatchResponse> response) {
return response.body();
}
});
} | java | public Observable<MatchResponse> matchFileInputAsync(byte[] imageStream, MatchFileInputOptionalParameter matchFileInputOptionalParameter) {
return matchFileInputWithServiceResponseAsync(imageStream, matchFileInputOptionalParameter).map(new Func1<ServiceResponse<MatchResponse>, MatchResponse>() {
@Override
public MatchResponse call(ServiceResponse<MatchResponse> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"MatchResponse",
">",
"matchFileInputAsync",
"(",
"byte",
"[",
"]",
"imageStream",
",",
"MatchFileInputOptionalParameter",
"matchFileInputOptionalParameter",
")",
"{",
"return",
"matchFileInputWithServiceResponseAsync",
"(",
"imageStream",
",",
... | Fuzzily match an image against one of your custom Image Lists. You can create and manage your custom image lists using <a href="/docs/services/578ff44d2703741568569ab9/operations/578ff7b12703741568569abe">this</a> API.
Returns ID and tags of matching image.<br/>
<br/>
Note: Refresh Index must be run on the corresponding Image List before additions and removals are reflected in the response.
@param imageStream The image file.
@param matchFileInputOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the MatchResponse object | [
"Fuzzily",
"match",
"an",
"image",
"against",
"one",
"of",
"your",
"custom",
"Image",
"Lists",
".",
"You",
"can",
"create",
"and",
"manage",
"your",
"custom",
"image",
"lists",
"using",
"<",
";",
"a",
"href",
"=",
"/",
"docs",
"/",
"services",
"/",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1978-L1985 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java | BingImagesImpl.searchAsync | public Observable<ImagesModel> searchAsync(String query, SearchOptionalParameter searchOptionalParameter) {
return searchWithServiceResponseAsync(query, searchOptionalParameter).map(new Func1<ServiceResponse<ImagesModel>, ImagesModel>() {
@Override
public ImagesModel call(ServiceResponse<ImagesModel> response) {
return response.body();
}
});
} | java | public Observable<ImagesModel> searchAsync(String query, SearchOptionalParameter searchOptionalParameter) {
return searchWithServiceResponseAsync(query, searchOptionalParameter).map(new Func1<ServiceResponse<ImagesModel>, ImagesModel>() {
@Override
public ImagesModel call(ServiceResponse<ImagesModel> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImagesModel",
">",
"searchAsync",
"(",
"String",
"query",
",",
"SearchOptionalParameter",
"searchOptionalParameter",
")",
"{",
"return",
"searchWithServiceResponseAsync",
"(",
"query",
",",
"searchOptionalParameter",
")",
".",
"map",
"(",
... | The Image Search API lets you send a search query to Bing and get back a list of relevant images. This section provides technical details about the query parameters and headers that you use to request images and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
@param query The user's search query term. The term cannot be empty. The term may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit images to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help improve relevance of an insights query (see [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)), you should always include the user's query term. Use this parameter only with the Image Search API.Do not specify this parameter when calling the Trending Images API.
@param searchOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImagesModel object | [
"The",
"Image",
"Search",
"API",
"lets",
"you",
"send",
"a",
"search",
"query",
"to",
"Bing",
"and",
"get",
"back",
"a",
"list",
"of",
"relevant",
"images",
".",
"This",
"section",
"provides",
"technical",
"details",
"about",
"the",
"query",
"parameters",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java#L123-L130 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectClient.java | ProjectClient.moveDiskProject | @BetaApi
public final Operation moveDiskProject(String project, DiskMoveRequest diskMoveRequestResource) {
MoveDiskProjectHttpRequest request =
MoveDiskProjectHttpRequest.newBuilder()
.setProject(project)
.setDiskMoveRequestResource(diskMoveRequestResource)
.build();
return moveDiskProject(request);
} | java | @BetaApi
public final Operation moveDiskProject(String project, DiskMoveRequest diskMoveRequestResource) {
MoveDiskProjectHttpRequest request =
MoveDiskProjectHttpRequest.newBuilder()
.setProject(project)
.setDiskMoveRequestResource(diskMoveRequestResource)
.build();
return moveDiskProject(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"moveDiskProject",
"(",
"String",
"project",
",",
"DiskMoveRequest",
"diskMoveRequestResource",
")",
"{",
"MoveDiskProjectHttpRequest",
"request",
"=",
"MoveDiskProjectHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setPr... | Moves a persistent disk from one zone to another.
<p>Sample code:
<pre><code>
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
Operation response = projectClient.moveDiskProject(project.toString(), diskMoveRequestResource);
}
</code></pre>
@param project Project ID for this request.
@param diskMoveRequestResource
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Moves",
"a",
"persistent",
"disk",
"from",
"one",
"zone",
"to",
"another",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ProjectClient.java#L1114-L1123 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java | TaskContext.getTaskLevelPolicyChecker | public TaskLevelPolicyChecker getTaskLevelPolicyChecker(TaskState taskState, int index) throws Exception {
return TaskLevelPolicyCheckerBuilderFactory.newPolicyCheckerBuilder(taskState, index).build();
} | java | public TaskLevelPolicyChecker getTaskLevelPolicyChecker(TaskState taskState, int index) throws Exception {
return TaskLevelPolicyCheckerBuilderFactory.newPolicyCheckerBuilder(taskState, index).build();
} | [
"public",
"TaskLevelPolicyChecker",
"getTaskLevelPolicyChecker",
"(",
"TaskState",
"taskState",
",",
"int",
"index",
")",
"throws",
"Exception",
"{",
"return",
"TaskLevelPolicyCheckerBuilderFactory",
".",
"newPolicyCheckerBuilder",
"(",
"taskState",
",",
"index",
")",
"."... | Get a post-fork {@link TaskLevelPolicyChecker} for executing task-level
{@link org.apache.gobblin.qualitychecker.task.TaskLevelPolicy} in the given branch.
@param taskState {@link TaskState} of a {@link Task}
@param index branch index
@return a {@link TaskLevelPolicyChecker}
@throws Exception | [
"Get",
"a",
"post",
"-",
"fork",
"{",
"@link",
"TaskLevelPolicyChecker",
"}",
"for",
"executing",
"task",
"-",
"level",
"{",
"@link",
"org",
".",
"apache",
".",
"gobblin",
".",
"qualitychecker",
".",
"task",
".",
"TaskLevelPolicy",
"}",
"in",
"the",
"given... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java#L342-L344 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java | PascalTemplate.writeToFieldValueCounter | public void writeToFieldValueCounter(Counter<String>[] fieldValueCounter, double score) {
for (int i = 0; i < fields.length; i++) {
if ((values[i] != null) && !values[i].equals("NULL")) {
fieldValueCounter[i].incrementCount(values[i], score);
}
}
} | java | public void writeToFieldValueCounter(Counter<String>[] fieldValueCounter, double score) {
for (int i = 0; i < fields.length; i++) {
if ((values[i] != null) && !values[i].equals("NULL")) {
fieldValueCounter[i].incrementCount(values[i], score);
}
}
} | [
"public",
"void",
"writeToFieldValueCounter",
"(",
"Counter",
"<",
"String",
">",
"[",
"]",
"fieldValueCounter",
",",
"double",
"score",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fields",
".",
"length",
";",
"i",
"++",
")",
"{",
"if... | Should be passed a <code>Counter[]</code>, each entry of which
keeps scores for possibilities in that template slot. The counter
for each template value is incremented by the corresponding score of
this PascalTemplate.
@param fieldValueCounter an array of counters, each of which holds label possibilities for one field
@param score increment counts by this much. | [
"Should",
"be",
"passed",
"a",
"<code",
">",
"Counter",
"[]",
"<",
"/",
"code",
">",
"each",
"entry",
"of",
"which",
"keeps",
"scores",
"for",
"possibilities",
"in",
"that",
"template",
"slot",
".",
"The",
"counter",
"for",
"each",
"template",
"value",
"... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java#L238-L244 |
drallgood/jpasskit | jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java | PKSigningInformationUtil.loadPKCS12File | @Deprecated
public KeyStore loadPKCS12File(InputStream inputStreamOfP12, String password) throws CertificateException, IOException {
try {
return CertUtils.toKeyStore(inputStreamOfP12, password.toCharArray());
} catch (IllegalStateException ex) {
throw new IOException("Key from the input stream could not be decrypted", ex);
}
} | java | @Deprecated
public KeyStore loadPKCS12File(InputStream inputStreamOfP12, String password) throws CertificateException, IOException {
try {
return CertUtils.toKeyStore(inputStreamOfP12, password.toCharArray());
} catch (IllegalStateException ex) {
throw new IOException("Key from the input stream could not be decrypted", ex);
}
} | [
"@",
"Deprecated",
"public",
"KeyStore",
"loadPKCS12File",
"(",
"InputStream",
"inputStreamOfP12",
",",
"String",
"password",
")",
"throws",
"CertificateException",
",",
"IOException",
"{",
"try",
"{",
"return",
"CertUtils",
".",
"toKeyStore",
"(",
"inputStreamOfP12",... | Load the keystore from an already opened input stream.
The caller is responsible for closing the stream after this method returns successfully or fails.
@param inputStreamOfP12
<code>InputStream</code> containing the signing key store.
@param password
Password to access the key store
@return Key store loaded from <code>inputStreamOfP12</code>
@throws IOException
@throws CertificateException
@throws IllegalArgumentException
If the parameter <code>inputStreamOfP12</code> is <code>null</code>.
@deprecated | [
"Load",
"the",
"keystore",
"from",
"an",
"already",
"opened",
"input",
"stream",
"."
] | train | https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java#L147-L154 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/CharUtils.java | CharUtils.toIntValue | public static int toIntValue(final Character ch, final int defaultValue) {
if (ch == null) {
return defaultValue;
}
return toIntValue(ch.charValue(), defaultValue);
} | java | public static int toIntValue(final Character ch, final int defaultValue) {
if (ch == null) {
return defaultValue;
}
return toIntValue(ch.charValue(), defaultValue);
} | [
"public",
"static",
"int",
"toIntValue",
"(",
"final",
"Character",
"ch",
",",
"final",
"int",
"defaultValue",
")",
"{",
"if",
"(",
"ch",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"toIntValue",
"(",
"ch",
".",
"charValue",
"("... | <p>Converts the character to the Integer it represents, throwing an
exception if the character is not numeric.</p>
<p>This method converts the char '1' to the int 1 and so on.</p>
<pre>
CharUtils.toIntValue(null, -1) = -1
CharUtils.toIntValue('3', -1) = 3
CharUtils.toIntValue('A', -1) = -1
</pre>
@param ch the character to convert
@param defaultValue the default value to use if the character is not numeric
@return the int value of the character | [
"<p",
">",
"Converts",
"the",
"character",
"to",
"the",
"Integer",
"it",
"represents",
"throwing",
"an",
"exception",
"if",
"the",
"character",
"is",
"not",
"numeric",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/CharUtils.java#L227-L232 |
infinispan/infinispan | query-dsl/src/main/java/org/infinispan/query/dsl/impl/QueryStringCreator.java | QueryStringCreator.parentIsNotOfClass | private boolean parentIsNotOfClass(BaseCondition condition, Class<? extends BooleanCondition> expectedParentClass) {
BaseCondition parent = condition.getParent();
return parent != null && parent.getClass() != expectedParentClass;
} | java | private boolean parentIsNotOfClass(BaseCondition condition, Class<? extends BooleanCondition> expectedParentClass) {
BaseCondition parent = condition.getParent();
return parent != null && parent.getClass() != expectedParentClass;
} | [
"private",
"boolean",
"parentIsNotOfClass",
"(",
"BaseCondition",
"condition",
",",
"Class",
"<",
"?",
"extends",
"BooleanCondition",
">",
"expectedParentClass",
")",
"{",
"BaseCondition",
"parent",
"=",
"condition",
".",
"getParent",
"(",
")",
";",
"return",
"par... | We check if the parent if of the expected class, hoping that if it is then we can avoid wrapping this condition in
parentheses and still maintain the same logic.
@return {@code true} if wrapping is needed, {@code false} otherwise | [
"We",
"check",
"if",
"the",
"parent",
"if",
"of",
"the",
"expected",
"class",
"hoping",
"that",
"if",
"it",
"is",
"then",
"we",
"can",
"avoid",
"wrapping",
"this",
"condition",
"in",
"parentheses",
"and",
"still",
"maintain",
"the",
"same",
"logic",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query-dsl/src/main/java/org/infinispan/query/dsl/impl/QueryStringCreator.java#L264-L267 |
bbottema/outlook-message-parser | src/main/java/org/simplejavamail/outlookmessageparser/OutlookMessageParser.java | OutlookMessageParser.checkDirectoryEntry | private void checkDirectoryEntry(final DirectoryEntry dir, final OutlookMessage msg)
throws IOException {
// we iterate through all entries in the current directory
for (final Iterator<?> iter = dir.getEntries(); iter.hasNext(); ) {
final Entry entry = (Entry) iter.next();
// check whether the entry is either a directory entry or a document entry
if (entry.isDirectoryEntry()) {
final DirectoryEntry de = (DirectoryEntry) entry;
// outlookAttachments have a special name and have to be handled separately at this point
if (de.getName().startsWith("__attach_version1.0")) {
parseAttachment(de, msg);
} else if (de.getName().startsWith("__recip_version1.0")) {
// a recipient entry has been found (which is also a directory entry itself)
checkRecipientDirectoryEntry(de, msg);
} else {
// a directory entry has been found. this node will be recursively checked
checkDirectoryEntry(de, msg);
}
} else if (entry.isDocumentEntry()) {
// a document entry contains information about the mail (e.g, from, to, subject, ...)
final DocumentEntry de = (DocumentEntry) entry;
checkDirectoryDocumentEntry(de, msg);
} /* else {
// any other type is not supported
} */
}
} | java | private void checkDirectoryEntry(final DirectoryEntry dir, final OutlookMessage msg)
throws IOException {
// we iterate through all entries in the current directory
for (final Iterator<?> iter = dir.getEntries(); iter.hasNext(); ) {
final Entry entry = (Entry) iter.next();
// check whether the entry is either a directory entry or a document entry
if (entry.isDirectoryEntry()) {
final DirectoryEntry de = (DirectoryEntry) entry;
// outlookAttachments have a special name and have to be handled separately at this point
if (de.getName().startsWith("__attach_version1.0")) {
parseAttachment(de, msg);
} else if (de.getName().startsWith("__recip_version1.0")) {
// a recipient entry has been found (which is also a directory entry itself)
checkRecipientDirectoryEntry(de, msg);
} else {
// a directory entry has been found. this node will be recursively checked
checkDirectoryEntry(de, msg);
}
} else if (entry.isDocumentEntry()) {
// a document entry contains information about the mail (e.g, from, to, subject, ...)
final DocumentEntry de = (DocumentEntry) entry;
checkDirectoryDocumentEntry(de, msg);
} /* else {
// any other type is not supported
} */
}
} | [
"private",
"void",
"checkDirectoryEntry",
"(",
"final",
"DirectoryEntry",
"dir",
",",
"final",
"OutlookMessage",
"msg",
")",
"throws",
"IOException",
"{",
"// we iterate through all entries in the current directory",
"for",
"(",
"final",
"Iterator",
"<",
"?",
">",
"iter... | Recursively parses the complete .msg file with the help of the POI library. The parsed information is put into the {@link OutlookMessage} object.
@param dir The current node in the .msg file.
@param msg The resulting {@link OutlookMessage} object.
@throws IOException Thrown if the .msg file could not be parsed. | [
"Recursively",
"parses",
"the",
"complete",
".",
"msg",
"file",
"with",
"the",
"help",
"of",
"the",
"POI",
"library",
".",
"The",
"parsed",
"information",
"is",
"put",
"into",
"the",
"{",
"@link",
"OutlookMessage",
"}",
"object",
"."
] | train | https://github.com/bbottema/outlook-message-parser/blob/ea7d59da33c8a62dfc2e0aa64d2f8f7c903ccb0e/src/main/java/org/simplejavamail/outlookmessageparser/OutlookMessageParser.java#L143-L171 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/MetadataCache.java | MetadataCache.addCacheDetailsEntry | private static void addCacheDetailsEntry(SlotReference slot, ZipOutputStream zos, WritableByteChannel channel) throws IOException {
// Record the details of the media being cached, to make it easier to recognize now that we can.
MediaDetails details = MetadataFinder.getInstance().getMediaDetailsFor(slot);
if (details != null) {
zos.putNextEntry(new ZipEntry(CACHE_DETAILS_ENTRY));
Util.writeFully(details.getRawBytes(), channel);
}
} | java | private static void addCacheDetailsEntry(SlotReference slot, ZipOutputStream zos, WritableByteChannel channel) throws IOException {
// Record the details of the media being cached, to make it easier to recognize now that we can.
MediaDetails details = MetadataFinder.getInstance().getMediaDetailsFor(slot);
if (details != null) {
zos.putNextEntry(new ZipEntry(CACHE_DETAILS_ENTRY));
Util.writeFully(details.getRawBytes(), channel);
}
} | [
"private",
"static",
"void",
"addCacheDetailsEntry",
"(",
"SlotReference",
"slot",
",",
"ZipOutputStream",
"zos",
",",
"WritableByteChannel",
"channel",
")",
"throws",
"IOException",
"{",
"// Record the details of the media being cached, to make it easier to recognize now that we c... | Record the details of the media being cached, to make it easier to recognize, now that we have access to that
information.
@param slot the slot from which a metadata cache is being created
@param zos the stream to which the ZipFile is being written
@param channel the low-level channel to which the cache is being written
@throws IOException if there is a problem writing the media details entry | [
"Record",
"the",
"details",
"of",
"the",
"media",
"being",
"cached",
"to",
"make",
"it",
"easier",
"to",
"recognize",
"now",
"that",
"we",
"have",
"access",
"to",
"that",
"information",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataCache.java#L364-L371 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/SecureClassLoader.java | SecureClassLoader.getProtectionDomain | private ProtectionDomain getProtectionDomain(CodeSource cs) {
if (cs == null)
return null;
ProtectionDomain pd = null;
synchronized (pdcache) {
pd = pdcache.get(cs);
if (pd == null) {
PermissionCollection perms = getPermissions(cs);
pd = new ProtectionDomain(cs, perms, this, null);
pdcache.put(cs, pd);
if (debug != null) {
debug.println(" getPermissions "+ pd);
debug.println("");
}
}
}
return pd;
} | java | private ProtectionDomain getProtectionDomain(CodeSource cs) {
if (cs == null)
return null;
ProtectionDomain pd = null;
synchronized (pdcache) {
pd = pdcache.get(cs);
if (pd == null) {
PermissionCollection perms = getPermissions(cs);
pd = new ProtectionDomain(cs, perms, this, null);
pdcache.put(cs, pd);
if (debug != null) {
debug.println(" getPermissions "+ pd);
debug.println("");
}
}
}
return pd;
} | [
"private",
"ProtectionDomain",
"getProtectionDomain",
"(",
"CodeSource",
"cs",
")",
"{",
"if",
"(",
"cs",
"==",
"null",
")",
"return",
"null",
";",
"ProtectionDomain",
"pd",
"=",
"null",
";",
"synchronized",
"(",
"pdcache",
")",
"{",
"pd",
"=",
"pdcache",
... | /*
Returned cached ProtectionDomain for the specified CodeSource. | [
"/",
"*",
"Returned",
"cached",
"ProtectionDomain",
"for",
"the",
"specified",
"CodeSource",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/SecureClassLoader.java#L198-L216 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java | PersonGroupPersonsImpl.addPersonFaceFromStreamAsync | public Observable<PersistedFace> addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, AddPersonFaceFromStreamOptionalParameter addPersonFaceFromStreamOptionalParameter) {
return addPersonFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image, addPersonFaceFromStreamOptionalParameter).map(new Func1<ServiceResponse<PersistedFace>, PersistedFace>() {
@Override
public PersistedFace call(ServiceResponse<PersistedFace> response) {
return response.body();
}
});
} | java | public Observable<PersistedFace> addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, AddPersonFaceFromStreamOptionalParameter addPersonFaceFromStreamOptionalParameter) {
return addPersonFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image, addPersonFaceFromStreamOptionalParameter).map(new Func1<ServiceResponse<PersistedFace>, PersistedFace>() {
@Override
public PersistedFace call(ServiceResponse<PersistedFace> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PersistedFace",
">",
"addPersonFaceFromStreamAsync",
"(",
"String",
"personGroupId",
",",
"UUID",
"personId",
",",
"byte",
"[",
"]",
"image",
",",
"AddPersonFaceFromStreamOptionalParameter",
"addPersonFaceFromStreamOptionalParameter",
")",
"{",... | Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle.
@param personGroupId Id referencing a particular person group.
@param personId Id referencing a particular person.
@param image An image stream.
@param addPersonFaceFromStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PersistedFace object | [
"Add",
"a",
"representative",
"face",
"to",
"a",
"person",
"for",
"identification",
".",
"The",
"input",
"face",
"is",
"specified",
"as",
"an",
"image",
"with",
"a",
"targetFace",
"rectangle",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java#L1400-L1407 |
CloudBees-community/syslog-java-client | src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java | LogManagerHelper.getBooleanProperty | public static boolean getBooleanProperty(@Nonnull LogManager manager, @Nullable String name, boolean defaultValue) {
if (name == null) {
return defaultValue;
}
String val = manager.getProperty(name);
if (val == null) {
return defaultValue;
}
val = val.toLowerCase();
if (val.equals("true") || val.equals("1")) {
return true;
} else if (val.equals("false") || val.equals("0")) {
return false;
}
return defaultValue;
} | java | public static boolean getBooleanProperty(@Nonnull LogManager manager, @Nullable String name, boolean defaultValue) {
if (name == null) {
return defaultValue;
}
String val = manager.getProperty(name);
if (val == null) {
return defaultValue;
}
val = val.toLowerCase();
if (val.equals("true") || val.equals("1")) {
return true;
} else if (val.equals("false") || val.equals("0")) {
return false;
}
return defaultValue;
} | [
"public",
"static",
"boolean",
"getBooleanProperty",
"(",
"@",
"Nonnull",
"LogManager",
"manager",
",",
"@",
"Nullable",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}"... | Visible version of {@link java.util.logging.LogManager#getIntProperty(String, int)}.
Method to get a boolean property.
If the property is not defined or cannot be parsed we return the given default value. | [
"Visible",
"version",
"of",
"{",
"@link",
"java",
".",
"util",
".",
"logging",
".",
"LogManager#getIntProperty",
"(",
"String",
"int",
")",
"}",
"."
] | train | https://github.com/CloudBees-community/syslog-java-client/blob/41e01206e4ce17c6d225ffb443bf19792a3f3c3a/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java#L159-L174 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java | XBaseGridScreen.printEndGridScreenData | public void printEndGridScreenData(PrintWriter out, int iPrintOptions)
{
out.println(Utility.endTag(XMLTags.DATA));
} | java | public void printEndGridScreenData(PrintWriter out, int iPrintOptions)
{
out.println(Utility.endTag(XMLTags.DATA));
} | [
"public",
"void",
"printEndGridScreenData",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"out",
".",
"println",
"(",
"Utility",
".",
"endTag",
"(",
"XMLTags",
".",
"DATA",
")",
")",
";",
"}"
] | Display the start grid in input format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception. | [
"Display",
"the",
"start",
"grid",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java#L157-L160 |
ziccardi/jnrpe | jnrpe-plugins/src/main/java/it/jnrpe/plugin/mysql/CheckMysql.java | CheckMysql.configureThresholdEvaluatorBuilder | @Override
public final void configureThresholdEvaluatorBuilder(final ThresholdsEvaluatorBuilder thrb, final ICommandLine cl) throws BadThresholdException {
if (cl.hasOption("th")) {
super.configureThresholdEvaluatorBuilder(thrb, cl);
} else {
thrb.withLegacyThreshold("time", null, cl.getOptionValue("warning"), cl.getOptionValue("critical")).withLegacyThreshold(
"secondsBehindMaster", null, cl.getOptionValue("warning"), cl.getOptionValue("critical"));
}
} | java | @Override
public final void configureThresholdEvaluatorBuilder(final ThresholdsEvaluatorBuilder thrb, final ICommandLine cl) throws BadThresholdException {
if (cl.hasOption("th")) {
super.configureThresholdEvaluatorBuilder(thrb, cl);
} else {
thrb.withLegacyThreshold("time", null, cl.getOptionValue("warning"), cl.getOptionValue("critical")).withLegacyThreshold(
"secondsBehindMaster", null, cl.getOptionValue("warning"), cl.getOptionValue("critical"));
}
} | [
"@",
"Override",
"public",
"final",
"void",
"configureThresholdEvaluatorBuilder",
"(",
"final",
"ThresholdsEvaluatorBuilder",
"thrb",
",",
"final",
"ICommandLine",
"cl",
")",
"throws",
"BadThresholdException",
"{",
"if",
"(",
"cl",
".",
"hasOption",
"(",
"\"th\"",
"... | Configures the threshold evaluator. This plugin supports both the legacy
threshold format and the new format specification.
@param thrb
- the evaluator to be configured
@param cl
- the received command line
@throws BadThresholdException
- if the threshold can't be parsed | [
"Configures",
"the",
"threshold",
"evaluator",
".",
"This",
"plugin",
"supports",
"both",
"the",
"legacy",
"threshold",
"format",
"and",
"the",
"new",
"format",
"specification",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/mysql/CheckMysql.java#L58-L66 |
samskivert/samskivert | src/main/java/com/samskivert/util/IntIntMap.java | IntIntMap.put | public void put (int key, int value)
{
_modCount++;
// check to see if we've passed our load factor, if so: resize
ensureCapacity(_size + 1);
int index = Math.abs(key)%_buckets.length;
Record rec = _buckets[index];
// either we start a new chain
if (rec == null) {
_buckets[index] = new Record(key, value);
_size++; // we're bigger
return;
}
// or we replace an element in an existing chain
Record prev = rec;
for (; rec != null; rec = rec.next) {
if (rec.key == key) {
rec.value = value; // we're not bigger
return;
}
prev = rec;
}
// or we append it to this chain
prev.next = new Record(key, value);
_size++; // we're bigger
} | java | public void put (int key, int value)
{
_modCount++;
// check to see if we've passed our load factor, if so: resize
ensureCapacity(_size + 1);
int index = Math.abs(key)%_buckets.length;
Record rec = _buckets[index];
// either we start a new chain
if (rec == null) {
_buckets[index] = new Record(key, value);
_size++; // we're bigger
return;
}
// or we replace an element in an existing chain
Record prev = rec;
for (; rec != null; rec = rec.next) {
if (rec.key == key) {
rec.value = value; // we're not bigger
return;
}
prev = rec;
}
// or we append it to this chain
prev.next = new Record(key, value);
_size++; // we're bigger
} | [
"public",
"void",
"put",
"(",
"int",
"key",
",",
"int",
"value",
")",
"{",
"_modCount",
"++",
";",
"// check to see if we've passed our load factor, if so: resize",
"ensureCapacity",
"(",
"_size",
"+",
"1",
")",
";",
"int",
"index",
"=",
"Math",
".",
"abs",
"(... | Adds the supplied key/value mapping. Any previous mapping for that key will be overwritten. | [
"Adds",
"the",
"supplied",
"key",
"/",
"value",
"mapping",
".",
"Any",
"previous",
"mapping",
"for",
"that",
"key",
"will",
"be",
"overwritten",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntIntMap.java#L76-L106 |
pebble/pebble-android-sdk | PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java | PebbleDictionary.addBytes | public void addBytes(int key, byte[] bytes) {
PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.BYTES, PebbleTuple.Width.NONE, bytes);
addTuple(t);
} | java | public void addBytes(int key, byte[] bytes) {
PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.BYTES, PebbleTuple.Width.NONE, bytes);
addTuple(t);
} | [
"public",
"void",
"addBytes",
"(",
"int",
"key",
",",
"byte",
"[",
"]",
"bytes",
")",
"{",
"PebbleTuple",
"t",
"=",
"PebbleTuple",
".",
"create",
"(",
"key",
",",
"PebbleTuple",
".",
"TupleType",
".",
"BYTES",
",",
"PebbleTuple",
".",
"Width",
".",
"NO... | Associate the specified byte array with the provided key in the dictionary. If another key-value pair with the
same key is already present in the dictionary, it will be replaced.
@param key
key with which the specified value is associated
@param bytes
value to be associated with the specified key | [
"Associate",
"the",
"specified",
"byte",
"array",
"with",
"the",
"provided",
"key",
"in",
"the",
"dictionary",
".",
"If",
"another",
"key",
"-",
"value",
"pair",
"with",
"the",
"same",
"key",
"is",
"already",
"present",
"in",
"the",
"dictionary",
"it",
"wi... | train | https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java#L78-L81 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java | Partitioner.getUpdatedInterval | private static int getUpdatedInterval(int inputInterval, ExtractType extractType, WatermarkType watermarkType) {
LOG.debug("Getting updated interval");
if ((extractType == ExtractType.SNAPSHOT && watermarkType == WatermarkType.DATE)) {
return inputInterval * 24;
} else if (extractType == ExtractType.APPEND_DAILY) {
return (inputInterval < 1 ? 1 : inputInterval) * 24;
} else {
return inputInterval;
}
} | java | private static int getUpdatedInterval(int inputInterval, ExtractType extractType, WatermarkType watermarkType) {
LOG.debug("Getting updated interval");
if ((extractType == ExtractType.SNAPSHOT && watermarkType == WatermarkType.DATE)) {
return inputInterval * 24;
} else if (extractType == ExtractType.APPEND_DAILY) {
return (inputInterval < 1 ? 1 : inputInterval) * 24;
} else {
return inputInterval;
}
} | [
"private",
"static",
"int",
"getUpdatedInterval",
"(",
"int",
"inputInterval",
",",
"ExtractType",
"extractType",
",",
"WatermarkType",
"watermarkType",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Getting updated interval\"",
")",
";",
"if",
"(",
"(",
"extractType",
"=... | Calculate interval in hours with the given interval
@param inputInterval input interval
@param extractType Extract type
@param watermarkType Watermark type
@return interval in range | [
"Calculate",
"interval",
"in",
"hours",
"with",
"the",
"given",
"interval"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java#L312-L321 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.