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 |
|---|---|---|---|---|---|---|---|---|---|---|
google/closure-compiler | src/com/google/javascript/jscomp/ExploitAssigns.java | ExploitAssigns.isSafeReplacement | private boolean isSafeReplacement(Node node, Node replacement) {
// No checks are needed for simple names.
if (node.isName()) {
return true;
}
checkArgument(node.isGetProp());
while (node.isGetProp()) {
node = node.getFirstChild();
}
return !(node.isName() && isNameAssignedTo(node.getString(), replacement));
} | java | private boolean isSafeReplacement(Node node, Node replacement) {
// No checks are needed for simple names.
if (node.isName()) {
return true;
}
checkArgument(node.isGetProp());
while (node.isGetProp()) {
node = node.getFirstChild();
}
return !(node.isName() && isNameAssignedTo(node.getString(), replacement));
} | [
"private",
"boolean",
"isSafeReplacement",
"(",
"Node",
"node",
",",
"Node",
"replacement",
")",
"{",
"// No checks are needed for simple names.",
"if",
"(",
"node",
".",
"isName",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"checkArgument",
"(",
"node",
"... | Checks name referenced in node to determine if it might have
changed.
@return Whether the replacement can be made. | [
"Checks",
"name",
"referenced",
"in",
"node",
"to",
"determine",
"if",
"it",
"might",
"have",
"changed",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExploitAssigns.java#L207-L219 |
threerings/nenya | core/src/main/java/com/threerings/media/tile/TileUtil.java | TileUtil.getTileHash | public static int getTileHash (int x, int y)
{
long seed = (((x << 2) ^ y) ^ MULTIPLIER) & MASK;
long hash = (seed * MULTIPLIER + ADDEND) & MASK;
return (int) (hash >>> 30);
} | java | public static int getTileHash (int x, int y)
{
long seed = (((x << 2) ^ y) ^ MULTIPLIER) & MASK;
long hash = (seed * MULTIPLIER + ADDEND) & MASK;
return (int) (hash >>> 30);
} | [
"public",
"static",
"int",
"getTileHash",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"long",
"seed",
"=",
"(",
"(",
"(",
"x",
"<<",
"2",
")",
"^",
"y",
")",
"^",
"MULTIPLIER",
")",
"&",
"MASK",
";",
"long",
"hash",
"=",
"(",
"seed",
"*",
"MU... | Compute some hash value for "randomizing" tileset picks
based on x and y coordinates.
@return a positive, seemingly random number based on x and y. | [
"Compute",
"some",
"hash",
"value",
"for",
"randomizing",
"tileset",
"picks",
"based",
"on",
"x",
"and",
"y",
"coordinates",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TileUtil.java#L58-L63 |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java | GeometryIndexService.getNextVertex | public GeometryIndex getNextVertex(GeometryIndex index) {
if (index.hasChild()) {
return new GeometryIndex(index.getType(), index.getValue(), getNextVertex(index.getChild()));
} else {
return new GeometryIndex(GeometryIndexType.TYPE_VERTEX, index.getValue() + 1, null);
}
} | java | public GeometryIndex getNextVertex(GeometryIndex index) {
if (index.hasChild()) {
return new GeometryIndex(index.getType(), index.getValue(), getNextVertex(index.getChild()));
} else {
return new GeometryIndex(GeometryIndexType.TYPE_VERTEX, index.getValue() + 1, null);
}
} | [
"public",
"GeometryIndex",
"getNextVertex",
"(",
"GeometryIndex",
"index",
")",
"{",
"if",
"(",
"index",
".",
"hasChild",
"(",
")",
")",
"{",
"return",
"new",
"GeometryIndex",
"(",
"index",
".",
"getType",
"(",
")",
",",
"index",
".",
"getValue",
"(",
")... | Given a certain index, find the next vertex in line.
@param index
The index to start out from. Must point to either a vertex or and edge.
@return Returns the next vertex index. Note that no geometry is given, and so no actual checking is done. It just
returns the theoretical answer. | [
"Given",
"a",
"certain",
"index",
"find",
"the",
"next",
"vertex",
"in",
"line",
"."
] | train | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java#L500-L506 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.countMatches | public static int countMatches(String str, String sub) {
if (isEmpty(str) || isEmpty(sub)) {
return 0;
}
int count = 0;
int idx = 0;
while ((idx = str.indexOf(sub, idx)) != -1) {
count++;
idx += sub.length();
}
return count;
} | java | public static int countMatches(String str, String sub) {
if (isEmpty(str) || isEmpty(sub)) {
return 0;
}
int count = 0;
int idx = 0;
while ((idx = str.indexOf(sub, idx)) != -1) {
count++;
idx += sub.length();
}
return count;
} | [
"public",
"static",
"int",
"countMatches",
"(",
"String",
"str",
",",
"String",
"sub",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"str",
")",
"||",
"isEmpty",
"(",
"sub",
")",
")",
"{",
"return",
"0",
";",
"}",
"int",
"count",
"=",
"0",
";",
"int",
"id... | <p>Counts how many times the substring appears in the larger String.</p>
<p>A <code>null</code> or empty ("") String input returns <code>0</code>.</p>
<pre>
GosuStringUtil.countMatches(null, *) = 0
GosuStringUtil.countMatches("", *) = 0
GosuStringUtil.countMatches("abba", null) = 0
GosuStringUtil.countMatches("abba", "") = 0
GosuStringUtil.countMatches("abba", "a") = 2
GosuStringUtil.countMatches("abba", "ab") = 1
GosuStringUtil.countMatches("abba", "xxx") = 0
</pre>
@param str the String to check, may be null
@param sub the substring to count, may be null
@return the number of occurrences, 0 if either String is <code>null</code> | [
"<p",
">",
"Counts",
"how",
"many",
"times",
"the",
"substring",
"appears",
"in",
"the",
"larger",
"String",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L4859-L4870 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/resultset/ResultSetUtil.java | ResultSetUtil.convertValue | public static Object convertValue(final Object value, final Class<?> convertType) {
if (null == value) {
return convertNullValue(convertType);
}
if (value.getClass() == convertType) {
return value;
}
if (value instanceof Number) {
return convertNumberValue(value, convertType);
}
if (value instanceof Date) {
return convertDateValue(value, convertType);
}
if (String.class.equals(convertType)) {
return value.toString();
} else {
return value;
}
} | java | public static Object convertValue(final Object value, final Class<?> convertType) {
if (null == value) {
return convertNullValue(convertType);
}
if (value.getClass() == convertType) {
return value;
}
if (value instanceof Number) {
return convertNumberValue(value, convertType);
}
if (value instanceof Date) {
return convertDateValue(value, convertType);
}
if (String.class.equals(convertType)) {
return value.toString();
} else {
return value;
}
} | [
"public",
"static",
"Object",
"convertValue",
"(",
"final",
"Object",
"value",
",",
"final",
"Class",
"<",
"?",
">",
"convertType",
")",
"{",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"return",
"convertNullValue",
"(",
"convertType",
")",
";",
"}",
"if... | Convert value via expected class type.
@param value original value
@param convertType expected class type
@return converted value | [
"Convert",
"value",
"via",
"expected",
"class",
"type",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/resultset/ResultSetUtil.java#L44-L62 |
jamesagnew/hapi-fhir | hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/client/ResourceAddress.java | ResourceAddress.parseCreateLocation | public static ResourceAddress.ResourceVersionedIdentifier parseCreateLocation(String locationResponseHeader) {
Pattern pattern = Pattern.compile(REGEX_ID_WITH_HISTORY);
Matcher matcher = pattern.matcher(locationResponseHeader);
ResourceVersionedIdentifier parsedHeader = null;
if(matcher.matches()){
String serviceRoot = matcher.group(1);
String resourceType = matcher.group(3);
String id = matcher.group(5);
String version = matcher.group(7);
parsedHeader = new ResourceVersionedIdentifier(serviceRoot, resourceType, id, version);
}
return parsedHeader;
} | java | public static ResourceAddress.ResourceVersionedIdentifier parseCreateLocation(String locationResponseHeader) {
Pattern pattern = Pattern.compile(REGEX_ID_WITH_HISTORY);
Matcher matcher = pattern.matcher(locationResponseHeader);
ResourceVersionedIdentifier parsedHeader = null;
if(matcher.matches()){
String serviceRoot = matcher.group(1);
String resourceType = matcher.group(3);
String id = matcher.group(5);
String version = matcher.group(7);
parsedHeader = new ResourceVersionedIdentifier(serviceRoot, resourceType, id, version);
}
return parsedHeader;
} | [
"public",
"static",
"ResourceAddress",
".",
"ResourceVersionedIdentifier",
"parseCreateLocation",
"(",
"String",
"locationResponseHeader",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"REGEX_ID_WITH_HISTORY",
")",
";",
"Matcher",
"matcher",
"=",
... | For now, assume this type of location header structure.
Generalize later: http://hl7connect.healthintersections.com.au/svc/fhir/318/_history/1
@param serviceBase
@param locationHeader | [
"For",
"now",
"assume",
"this",
"type",
"of",
"location",
"header",
"structure",
".",
"Generalize",
"later",
":",
"http",
":",
"//",
"hl7connect",
".",
"healthintersections",
".",
"com",
".",
"au",
"/",
"svc",
"/",
"fhir",
"/",
"318",
"/",
"_history",
"/... | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/client/ResourceAddress.java#L232-L244 |
eiichiro/gig | gig-appengine/src/main/java/org/eiichiro/gig/appengine/KeyConverter.java | KeyConverter.convertToType | @SuppressWarnings("rawtypes")
@Override
protected Object convertToType(Class type, Object value) throws Throwable {
return KeyFactory.stringToKey(value.toString());
} | java | @SuppressWarnings("rawtypes")
@Override
protected Object convertToType(Class type, Object value) throws Throwable {
return KeyFactory.stringToKey(value.toString());
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"protected",
"Object",
"convertToType",
"(",
"Class",
"type",
",",
"Object",
"value",
")",
"throws",
"Throwable",
"{",
"return",
"KeyFactory",
".",
"stringToKey",
"(",
"value",
".",
"toString",
... | Converts the specified value to
{@code com.google.appengine.api.datastore.Key}.
@see org.apache.commons.beanutils.converters.AbstractConverter#convertToType(java.lang.Class, java.lang.Object) | [
"Converts",
"the",
"specified",
"value",
"to",
"{",
"@code",
"com",
".",
"google",
".",
"appengine",
".",
"api",
".",
"datastore",
".",
"Key",
"}",
"."
] | train | https://github.com/eiichiro/gig/blob/21181fb36a17d2154f989e5e8c6edbb39fc81900/gig-appengine/src/main/java/org/eiichiro/gig/appengine/KeyConverter.java#L39-L43 |
mgormley/prim | src/main/java_generated/edu/jhu/prim/vector/IntDoubleDenseVector.java | IntDoubleDenseVector.add | public void add(IntDoubleVector other) {
if (other instanceof IntDoubleUnsortedVector) {
IntDoubleUnsortedVector vec = (IntDoubleUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntDoubleDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.DoubleAdd()));
}
} | java | public void add(IntDoubleVector other) {
if (other instanceof IntDoubleUnsortedVector) {
IntDoubleUnsortedVector vec = (IntDoubleUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntDoubleDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.DoubleAdd()));
}
} | [
"public",
"void",
"add",
"(",
"IntDoubleVector",
"other",
")",
"{",
"if",
"(",
"other",
"instanceof",
"IntDoubleUnsortedVector",
")",
"{",
"IntDoubleUnsortedVector",
"vec",
"=",
"(",
"IntDoubleUnsortedVector",
")",
"other",
";",
"for",
"(",
"int",
"i",
"=",
"0... | Updates this vector to be the entrywise sum of this vector with the other. | [
"Updates",
"this",
"vector",
"to",
"be",
"the",
"entrywise",
"sum",
"of",
"this",
"vector",
"with",
"the",
"other",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/vector/IntDoubleDenseVector.java#L143-L153 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckMissingAndExtraRequires.java | CheckMissingAndExtraRequires.maybeAddWeakUsage | private void maybeAddWeakUsage(NodeTraversal t, Node n, Node typeNode) {
maybeAddUsage(t, n, typeNode, false, Predicates.alwaysTrue());
} | java | private void maybeAddWeakUsage(NodeTraversal t, Node n, Node typeNode) {
maybeAddUsage(t, n, typeNode, false, Predicates.alwaysTrue());
} | [
"private",
"void",
"maybeAddWeakUsage",
"(",
"NodeTraversal",
"t",
",",
"Node",
"n",
",",
"Node",
"typeNode",
")",
"{",
"maybeAddUsage",
"(",
"t",
",",
"n",
",",
"typeNode",
",",
"false",
",",
"Predicates",
".",
"alwaysTrue",
"(",
")",
")",
";",
"}"
] | Adds a weak usage for the given type expression (unless it references a variable that is
defined in the externs, in which case no goog.require() is needed). When a "weak usage" is
added, it means that a goog.require for that type is optional: No warning is given whether the
require is there or not. | [
"Adds",
"a",
"weak",
"usage",
"for",
"the",
"given",
"type",
"expression",
"(",
"unless",
"it",
"references",
"a",
"variable",
"that",
"is",
"defined",
"in",
"the",
"externs",
"in",
"which",
"case",
"no",
"goog",
".",
"require",
"()",
"is",
"needed",
")"... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckMissingAndExtraRequires.java#L708-L710 |
jenkinsci/jenkins | core/src/main/java/hudson/model/listeners/RunListener.java | RunListener.setUpEnvironment | public Environment setUpEnvironment( AbstractBuild build, Launcher launcher, BuildListener listener ) throws IOException, InterruptedException, RunnerAbortedException {
return new Environment() {};
} | java | public Environment setUpEnvironment( AbstractBuild build, Launcher launcher, BuildListener listener ) throws IOException, InterruptedException, RunnerAbortedException {
return new Environment() {};
} | [
"public",
"Environment",
"setUpEnvironment",
"(",
"AbstractBuild",
"build",
",",
"Launcher",
"launcher",
",",
"BuildListener",
"listener",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"RunnerAbortedException",
"{",
"return",
"new",
"Environment",
"(",... | Runs before the {@link SCM#checkout(AbstractBuild, Launcher, FilePath, BuildListener, File)} runs, and performs a set up.
Can contribute additional properties/env vars to the environment.
<p>
A typical strategy is for implementations to check {@link JobProperty}s and other configuration
of the project to determine the environment to inject, which allows you to achieve the equivalent of
{@link BuildWrapper}, but without UI.
@param build
The build in progress for which an {@link Environment} object is created.
Never null.
@param launcher
This launcher can be used to launch processes for this build.
If the build runs remotely, launcher will also run a job on that remote machine.
Never null.
@param listener
Can be used to send any message.
@return
non-null if the build can continue, null if there was an error
and the build needs to be aborted.
@throws IOException
terminates the build abnormally. Hudson will handle the exception
and reports a nice error message.
@throws RunnerAbortedException
If a fatal error is detected and the callee handled it gracefully, throw this exception
to suppress a stack trace by the receiver.
@since 1.410 | [
"Runs",
"before",
"the",
"{",
"@link",
"SCM#checkout",
"(",
"AbstractBuild",
"Launcher",
"FilePath",
"BuildListener",
"File",
")",
"}",
"runs",
"and",
"performs",
"a",
"set",
"up",
".",
"Can",
"contribute",
"additional",
"properties",
"/",
"env",
"vars",
"to",... | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/listeners/RunListener.java#L161-L163 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/AbstractEphemeralKey.java | AbstractEphemeralKey.writeToParcel | @Override
public void writeToParcel(Parcel out, int flags) {
out.writeLong(mCreated);
out.writeString(mObjectId);
out.writeLong(mExpires);
out.writeString(mId);
// There is no writeBoolean
out.writeInt(mLiveMode ? 1 : 0);
out.writeString(mObject);
out.writeString(mSecret);
out.writeString(mType);
} | java | @Override
public void writeToParcel(Parcel out, int flags) {
out.writeLong(mCreated);
out.writeString(mObjectId);
out.writeLong(mExpires);
out.writeString(mId);
// There is no writeBoolean
out.writeInt(mLiveMode ? 1 : 0);
out.writeString(mObject);
out.writeString(mSecret);
out.writeString(mType);
} | [
"@",
"Override",
"public",
"void",
"writeToParcel",
"(",
"Parcel",
"out",
",",
"int",
"flags",
")",
"{",
"out",
".",
"writeLong",
"(",
"mCreated",
")",
";",
"out",
".",
"writeString",
"(",
"mObjectId",
")",
";",
"out",
".",
"writeLong",
"(",
"mExpires",
... | Write the object into a {@link Parcel}. Note that if the order of these
write operations is changed, an identical change must be made to
{@link #AbstractEphemeralKey(Parcel)} constructor above.
@param out a {@link Parcel} into which to write this object
@param flags any flags (unused) for writing this object | [
"Write",
"the",
"object",
"into",
"a",
"{",
"@link",
"Parcel",
"}",
".",
"Note",
"that",
"if",
"the",
"order",
"of",
"these",
"write",
"operations",
"is",
"changed",
"an",
"identical",
"change",
"must",
"be",
"made",
"to",
"{",
"@link",
"#AbstractEphemeral... | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/AbstractEphemeralKey.java#L163-L174 |
GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/scrollfire/MaterialScrollfire.java | MaterialScrollfire.apply | public static void apply(String selector, Functions.Func callback) {
apply($(selector).asElement(), 100, callback);
} | java | public static void apply(String selector, Functions.Func callback) {
apply($(selector).asElement(), 100, callback);
} | [
"public",
"static",
"void",
"apply",
"(",
"String",
"selector",
",",
"Functions",
".",
"Func",
"callback",
")",
"{",
"apply",
"(",
"$",
"(",
"selector",
")",
".",
"asElement",
"(",
")",
",",
"100",
",",
"callback",
")",
";",
"}"
] | Executes callback method depending on how far into the page you've scrolled | [
"Executes",
"callback",
"method",
"depending",
"on",
"how",
"far",
"into",
"the",
"page",
"you",
"ve",
"scrolled"
] | train | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/scrollfire/MaterialScrollfire.java#L119-L121 |
box/box-java-sdk | src/main/java/com/box/sdk/MetadataTemplate.java | MetadataTemplate.getEnterpriseMetadataTemplates | public static Iterable<MetadataTemplate> getEnterpriseMetadataTemplates(
String scope, BoxAPIConnection api, String ... fields) {
return getEnterpriseMetadataTemplates(ENTERPRISE_METADATA_SCOPE, DEFAULT_ENTRIES_LIMIT, api, fields);
} | java | public static Iterable<MetadataTemplate> getEnterpriseMetadataTemplates(
String scope, BoxAPIConnection api, String ... fields) {
return getEnterpriseMetadataTemplates(ENTERPRISE_METADATA_SCOPE, DEFAULT_ENTRIES_LIMIT, api, fields);
} | [
"public",
"static",
"Iterable",
"<",
"MetadataTemplate",
">",
"getEnterpriseMetadataTemplates",
"(",
"String",
"scope",
",",
"BoxAPIConnection",
"api",
",",
"String",
"...",
"fields",
")",
"{",
"return",
"getEnterpriseMetadataTemplates",
"(",
"ENTERPRISE_METADATA_SCOPE",
... | Returns all metadata templates within a user's scope. Currently only the enterprise scope is supported.
@param scope the scope of the metadata templates.
@param api the API connection to be used.
@param fields the fields to retrieve.
@return the metadata template returned from the server. | [
"Returns",
"all",
"metadata",
"templates",
"within",
"a",
"user",
"s",
"scope",
".",
"Currently",
"only",
"the",
"enterprise",
"scope",
"is",
"supported",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/MetadataTemplate.java#L485-L488 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/util/HierarchicalTable.java | HierarchicalTable.doRecordChange | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
return iErrorCode;
} | java | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
return iErrorCode;
} | [
"public",
"int",
"doRecordChange",
"(",
"FieldInfo",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"{",
"int",
"iErrorCode",
"=",
"super",
".",
"doRecordChange",
"(",
"field",
",",
"iChangeType",
",",
"bDisplayOption",
")",
";",
"r... | doRecordChange Method.
If this is an update or add type, grab the bookmark.
@param field The field that is changing.
@param iChangeType The type of change.
@param bDisplayOption not used here. | [
"doRecordChange",
"Method",
".",
"If",
"this",
"is",
"an",
"update",
"or",
"add",
"type",
"grab",
"the",
"bookmark",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/HierarchicalTable.java#L146-L150 |
fabric8io/fabric8-forge | addons/devops/src/main/java/io/fabric8/forge/devops/springboot/UnzipHelper.java | UnzipHelper.unzip | public static void unzip(File file, File destDir) throws IOException {
if (!destDir.exists()) {
destDir.mkdir();
}
ZipInputStream zipIn = new ZipInputStream(new FileInputStream(file));
ZipEntry entry = zipIn.getNextEntry();
// iterates over entries in the zip file
while (entry != null) {
File entryFile = new File(destDir, entry.getName());
if (!entry.isDirectory()) {
// if the entry is a file, extracts it
extractFile(zipIn, entryFile);
} else {
// if the entry is a directory, make the directory
entryFile.mkdir();
}
zipIn.closeEntry();
entry = zipIn.getNextEntry();
}
zipIn.close();
} | java | public static void unzip(File file, File destDir) throws IOException {
if (!destDir.exists()) {
destDir.mkdir();
}
ZipInputStream zipIn = new ZipInputStream(new FileInputStream(file));
ZipEntry entry = zipIn.getNextEntry();
// iterates over entries in the zip file
while (entry != null) {
File entryFile = new File(destDir, entry.getName());
if (!entry.isDirectory()) {
// if the entry is a file, extracts it
extractFile(zipIn, entryFile);
} else {
// if the entry is a directory, make the directory
entryFile.mkdir();
}
zipIn.closeEntry();
entry = zipIn.getNextEntry();
}
zipIn.close();
} | [
"public",
"static",
"void",
"unzip",
"(",
"File",
"file",
",",
"File",
"destDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"destDir",
".",
"exists",
"(",
")",
")",
"{",
"destDir",
".",
"mkdir",
"(",
")",
";",
"}",
"ZipInputStream",
"zipIn",
... | Extracts a zip file specified by the zipFilePath to a directory specified by
destDirectory (will be created if does not exists) | [
"Extracts",
"a",
"zip",
"file",
"specified",
"by",
"the",
"zipFilePath",
"to",
"a",
"directory",
"specified",
"by",
"destDirectory",
"(",
"will",
"be",
"created",
"if",
"does",
"not",
"exists",
")"
] | train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/devops/src/main/java/io/fabric8/forge/devops/springboot/UnzipHelper.java#L37-L57 |
alibaba/vlayout | vlayout/src/main/java/com/alibaba/android/vlayout/Cantor.java | Cantor.reverseCantor | public static void reverseCantor(long cantor, long[] result) {
if (result == null || result.length < 2) {
result = new long[2];
}
// reverse Cantor Function
long w = (long) (Math.floor(Math.sqrt(8 * cantor + 1) - 1) / 2);
long t = (w * w + w) / 2;
long k2 = cantor - t;
long k1 = w - k2;
result[0] = k1;
result[1] = k2;
} | java | public static void reverseCantor(long cantor, long[] result) {
if (result == null || result.length < 2) {
result = new long[2];
}
// reverse Cantor Function
long w = (long) (Math.floor(Math.sqrt(8 * cantor + 1) - 1) / 2);
long t = (w * w + w) / 2;
long k2 = cantor - t;
long k1 = w - k2;
result[0] = k1;
result[1] = k2;
} | [
"public",
"static",
"void",
"reverseCantor",
"(",
"long",
"cantor",
",",
"long",
"[",
"]",
"result",
")",
"{",
"if",
"(",
"result",
"==",
"null",
"||",
"result",
".",
"length",
"<",
"2",
")",
"{",
"result",
"=",
"new",
"long",
"[",
"2",
"]",
";",
... | reverse cantor pair to origin number k1 and k2, k1 is stored in result[0], and k2 is stored in result[1]
@param cantor a computed cantor number
@param result the array to store output values | [
"reverse",
"cantor",
"pair",
"to",
"origin",
"number",
"k1",
"and",
"k2",
"k1",
"is",
"stored",
"in",
"result",
"[",
"0",
"]",
"and",
"k2",
"is",
"stored",
"in",
"result",
"[",
"1",
"]"
] | train | https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/Cantor.java#L26-L38 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.transformLine | public static void transformLine(Reader reader, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
BufferedReader br = new BufferedReader(reader);
BufferedWriter bw = new BufferedWriter(writer);
String line;
try {
while ((line = br.readLine()) != null) {
Object o = closure.call(line);
if (o != null) {
bw.write(o.toString());
bw.newLine();
}
}
bw.flush();
Writer temp2 = writer;
writer = null;
temp2.close();
Reader temp1 = reader;
reader = null;
temp1.close();
} finally {
closeWithWarning(br);
closeWithWarning(reader);
closeWithWarning(bw);
closeWithWarning(writer);
}
} | java | public static void transformLine(Reader reader, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
BufferedReader br = new BufferedReader(reader);
BufferedWriter bw = new BufferedWriter(writer);
String line;
try {
while ((line = br.readLine()) != null) {
Object o = closure.call(line);
if (o != null) {
bw.write(o.toString());
bw.newLine();
}
}
bw.flush();
Writer temp2 = writer;
writer = null;
temp2.close();
Reader temp1 = reader;
reader = null;
temp1.close();
} finally {
closeWithWarning(br);
closeWithWarning(reader);
closeWithWarning(bw);
closeWithWarning(writer);
}
} | [
"public",
"static",
"void",
"transformLine",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String\"",
")",
"Closure",
"closure",
")",
"throws",
"IOE... | Transforms the lines from a reader with a Closure and
write them to a writer. Both Reader and Writer are
closed after the operation.
@param reader Lines of text to be transformed. Reader is closed afterwards.
@param writer Where transformed lines are written. Writer is closed afterwards.
@param closure Single parameter closure that is called to transform each line of
text from the reader, before writing it to the writer.
@throws IOException if an IOException occurs.
@since 1.0 | [
"Transforms",
"the",
"lines",
"from",
"a",
"reader",
"with",
"a",
"Closure",
"and",
"write",
"them",
"to",
"a",
"writer",
".",
"Both",
"Reader",
"and",
"Writer",
"are",
"closed",
"after",
"the",
"operation",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1413-L1439 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/FunctionPattern.java | FunctionPattern.fixupVariables | public void fixupVariables(java.util.Vector vars, int globalsSize)
{
super.fixupVariables(vars, globalsSize);
m_functionExpr.fixupVariables(vars, globalsSize);
} | java | public void fixupVariables(java.util.Vector vars, int globalsSize)
{
super.fixupVariables(vars, globalsSize);
m_functionExpr.fixupVariables(vars, globalsSize);
} | [
"public",
"void",
"fixupVariables",
"(",
"java",
".",
"util",
".",
"Vector",
"vars",
",",
"int",
"globalsSize",
")",
"{",
"super",
".",
"fixupVariables",
"(",
"vars",
",",
"globalsSize",
")",
";",
"m_functionExpr",
".",
"fixupVariables",
"(",
"vars",
",",
... | This function is used to fixup variables from QNames to stack frame
indexes at stylesheet build time.
@param vars List of QNames that correspond to variables. This list
should be searched backwards for the first qualified name that
corresponds to the variable reference qname. The position of the
QName in the vector from the start of the vector will be its position
in the stack frame (but variables above the globalsTop value will need
to be offset to the current stack frame). | [
"This",
"function",
"is",
"used",
"to",
"fixup",
"variables",
"from",
"QNames",
"to",
"stack",
"frame",
"indexes",
"at",
"stylesheet",
"build",
"time",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/FunctionPattern.java#L82-L86 |
medallia/Word2VecJava | src/main/java/com/medallia/word2vec/util/FileUtils.java | FileUtils.getDir | public static File getDir(File parent, String item) {
File dir = new File(parent, item);
return (dir.exists() && dir.isDirectory()) ? dir : null;
} | java | public static File getDir(File parent, String item) {
File dir = new File(parent, item);
return (dir.exists() && dir.isDirectory()) ? dir : null;
} | [
"public",
"static",
"File",
"getDir",
"(",
"File",
"parent",
",",
"String",
"item",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"parent",
",",
"item",
")",
";",
"return",
"(",
"dir",
".",
"exists",
"(",
")",
"&&",
"dir",
".",
"isDirectory",
"... | Returns a subdirectory of a given directory; the subdirectory is expected to already exist.
@param parent the directory in which to find the specified subdirectory
@param item the name of the subdirectory
@return the subdirectory having the specified name; null if no such directory exists or
exists but is a regular file. | [
"Returns",
"a",
"subdirectory",
"of",
"a",
"given",
"directory",
";",
"the",
"subdirectory",
"is",
"expected",
"to",
"already",
"exist",
"."
] | train | https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/FileUtils.java#L36-L39 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.importData | public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final Connection conn,
final String insertSQL, final int batchSize, final int batchInterval) throws UncheckedSQLException {
return importData(dataset, selectColumnNames, offset, count, Fn.alwaysTrue(), conn, insertSQL, batchSize, batchInterval);
} | java | public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final Connection conn,
final String insertSQL, final int batchSize, final int batchInterval) throws UncheckedSQLException {
return importData(dataset, selectColumnNames, offset, count, Fn.alwaysTrue(), conn, insertSQL, batchSize, batchInterval);
} | [
"public",
"static",
"int",
"importData",
"(",
"final",
"DataSet",
"dataset",
",",
"final",
"Collection",
"<",
"String",
">",
"selectColumnNames",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"count",
",",
"final",
"Connection",
"conn",
",",
"final",
"... | Imports the data from <code>DataSet</code> to database.
@param dataset
@param selectColumnNames
@param offset
@param count
@param conn
@param insertSQL the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:
<pre><code>
List<String> columnNameList = new ArrayList<>(dataset.columnNameList());
columnNameList.retainAll(yourSelectColumnNames);
String sql = RE.insert(columnNameList).into(tableName).sql();
</code></pre>
@param batchSize
@param batchInterval
@return
@throws UncheckedSQLException | [
"Imports",
"the",
"data",
"from",
"<code",
">",
"DataSet<",
"/",
"code",
">",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L1919-L1922 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java | SVGUtil.makeMarginTransform | public static String makeMarginTransform(double owidth, double oheight, double iwidth, double iheight, double xmargin, double ymargin) {
return makeMarginTransform(owidth, oheight, iwidth, iheight, xmargin, ymargin, xmargin, ymargin);
} | java | public static String makeMarginTransform(double owidth, double oheight, double iwidth, double iheight, double xmargin, double ymargin) {
return makeMarginTransform(owidth, oheight, iwidth, iheight, xmargin, ymargin, xmargin, ymargin);
} | [
"public",
"static",
"String",
"makeMarginTransform",
"(",
"double",
"owidth",
",",
"double",
"oheight",
",",
"double",
"iwidth",
",",
"double",
"iheight",
",",
"double",
"xmargin",
",",
"double",
"ymargin",
")",
"{",
"return",
"makeMarginTransform",
"(",
"owidth... | Make a transform string to add margins
@param owidth Width of outer (embedding) canvas
@param oheight Height of outer (embedding) canvas
@param iwidth Width of inner (embedded) canvas
@param iheight Height of inner (embedded) canvas
@param xmargin Left and right margin (in inner canvas' units)
@param ymargin Top and bottom margin (in inner canvas' units)
@return Transform string | [
"Make",
"a",
"transform",
"string",
"to",
"add",
"margins"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L600-L602 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.maxBy | public static <T, V extends Comparable<? super V>> T maxBy(Iterable<T> iterable, Function<? super T, ? extends V> function)
{
if (iterable instanceof RichIterable)
{
return ((RichIterable<T>) iterable).maxBy(function);
}
if (iterable instanceof RandomAccess)
{
return RandomAccessListIterate.maxBy((List<T>) iterable, function);
}
if (iterable != null)
{
return IterableIterate.maxBy(iterable, function);
}
throw new IllegalArgumentException("Cannot perform a maxBy on null");
} | java | public static <T, V extends Comparable<? super V>> T maxBy(Iterable<T> iterable, Function<? super T, ? extends V> function)
{
if (iterable instanceof RichIterable)
{
return ((RichIterable<T>) iterable).maxBy(function);
}
if (iterable instanceof RandomAccess)
{
return RandomAccessListIterate.maxBy((List<T>) iterable, function);
}
if (iterable != null)
{
return IterableIterate.maxBy(iterable, function);
}
throw new IllegalArgumentException("Cannot perform a maxBy on null");
} | [
"public",
"static",
"<",
"T",
",",
"V",
"extends",
"Comparable",
"<",
"?",
"super",
"V",
">",
">",
"T",
"maxBy",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"V",
">",
"function",
")",
... | Returns the maximum element out of the iterable based on the natural order of the attribute returned by the function. | [
"Returns",
"the",
"maximum",
"element",
"out",
"of",
"the",
"iterable",
"based",
"on",
"the",
"natural",
"order",
"of",
"the",
"attribute",
"returned",
"by",
"the",
"function",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L3546-L3561 |
mailin-api/sendinblue-java-mvn | src/main/java/com/sendinblue/Sendinblue.java | Sendinblue.get_processes | public String get_processes(Object data) {
Gson gson = new Gson();
String json = gson.toJson(data);
return get("process", json);
} | java | public String get_processes(Object data) {
Gson gson = new Gson();
String json = gson.toJson(data);
return get("process", json);
} | [
"public",
"String",
"get_processes",
"(",
"Object",
"data",
")",
"{",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"String",
"json",
"=",
"gson",
".",
"toJson",
"(",
"data",
")",
";",
"return",
"get",
"(",
"\"process\"",
",",
"json",
")",
";",
... | /*
Get all the processes information under the account.
@param {Object} data contains json objects as a key value pair from HashMap.
@options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
@options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory] | [
"/",
"*",
"Get",
"all",
"the",
"processes",
"information",
"under",
"the",
"account",
"."
] | train | https://github.com/mailin-api/sendinblue-java-mvn/blob/3a186b004003450f18d619aa084adc8d75086183/src/main/java/com/sendinblue/Sendinblue.java#L558-L562 |
jbundle/jbundle | thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java | JScreen.addScreenControl | public JComponent addScreenControl(Container parent, Converter fieldInfo)
{
JComponent component = this.createScreenComponent(fieldInfo);
if (component instanceof ScreenComponent)
if (((ScreenComponent)component).getConverter() != null)
fieldInfo = (Converter)((ScreenComponent)component).getConverter();
this.addScreenComponent(parent, fieldInfo, component);
return component;
} | java | public JComponent addScreenControl(Container parent, Converter fieldInfo)
{
JComponent component = this.createScreenComponent(fieldInfo);
if (component instanceof ScreenComponent)
if (((ScreenComponent)component).getConverter() != null)
fieldInfo = (Converter)((ScreenComponent)component).getConverter();
this.addScreenComponent(parent, fieldInfo, component);
return component;
} | [
"public",
"JComponent",
"addScreenControl",
"(",
"Container",
"parent",
",",
"Converter",
"fieldInfo",
")",
"{",
"JComponent",
"component",
"=",
"this",
".",
"createScreenComponent",
"(",
"fieldInfo",
")",
";",
"if",
"(",
"component",
"instanceof",
"ScreenComponent"... | Add the screen controls to the second column of the grid.
@param parent The container to add the control(s) to.
@param fieldInfo the field to add a control for.
@param gridbag The screen layout.
@param c The constraint to use. | [
"Add",
"the",
"screen",
"controls",
"to",
"the",
"second",
"column",
"of",
"the",
"grid",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L283-L291 |
liaochong/spring-boot-starter-converter | src/main/java/com/github/liaochong/converter/core/BeansConvertStrategy.java | BeansConvertStrategy.parallelConvertBeans | public static <E, T> List<E> parallelConvertBeans(List<T> source, Class<E> targetClass, boolean nonNullFilter) {
return convertBeans(source, targetClass, null, true, nonNullFilter);
} | java | public static <E, T> List<E> parallelConvertBeans(List<T> source, Class<E> targetClass, boolean nonNullFilter) {
return convertBeans(source, targetClass, null, true, nonNullFilter);
} | [
"public",
"static",
"<",
"E",
",",
"T",
">",
"List",
"<",
"E",
">",
"parallelConvertBeans",
"(",
"List",
"<",
"T",
">",
"source",
",",
"Class",
"<",
"E",
">",
"targetClass",
",",
"boolean",
"nonNullFilter",
")",
"{",
"return",
"convertBeans",
"(",
"sou... | 集合并行转换,无指定异常提供
@param source 需要转换的集合
@param targetClass 需要转换到的类型
@param nonNullFilter 是否非空过滤
@param <E> 转换后的类型
@param <T> 转换前的类型
@return 结果 | [
"集合并行转换,无指定异常提供"
] | train | https://github.com/liaochong/spring-boot-starter-converter/blob/a36bea44bd23330a6f43b0372906a804a09285c5/src/main/java/com/github/liaochong/converter/core/BeansConvertStrategy.java#L83-L85 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_service_serviceName_previousVoiceConsumption_GET | public ArrayList<Long> billingAccount_service_serviceName_previousVoiceConsumption_GET(String billingAccount, String serviceName, Date creationDatetime_from, Date creationDatetime_to, OvhVoiceConsumptionDestinationTypeEnum destinationType, OvhVoiceConsumptionPlanTypeEnum planType, OvhVoiceConsumptionWayTypeEnum wayType) throws IOException {
String qPath = "/telephony/{billingAccount}/service/{serviceName}/previousVoiceConsumption";
StringBuilder sb = path(qPath, billingAccount, serviceName);
query(sb, "creationDatetime.from", creationDatetime_from);
query(sb, "creationDatetime.to", creationDatetime_to);
query(sb, "destinationType", destinationType);
query(sb, "planType", planType);
query(sb, "wayType", wayType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> billingAccount_service_serviceName_previousVoiceConsumption_GET(String billingAccount, String serviceName, Date creationDatetime_from, Date creationDatetime_to, OvhVoiceConsumptionDestinationTypeEnum destinationType, OvhVoiceConsumptionPlanTypeEnum planType, OvhVoiceConsumptionWayTypeEnum wayType) throws IOException {
String qPath = "/telephony/{billingAccount}/service/{serviceName}/previousVoiceConsumption";
StringBuilder sb = path(qPath, billingAccount, serviceName);
query(sb, "creationDatetime.from", creationDatetime_from);
query(sb, "creationDatetime.to", creationDatetime_to);
query(sb, "destinationType", destinationType);
query(sb, "planType", planType);
query(sb, "wayType", wayType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"billingAccount_service_serviceName_previousVoiceConsumption_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Date",
"creationDatetime_from",
",",
"Date",
"creationDatetime_to",
",",
"OvhVoiceConsumptionDestinat... | Call delivery records of the previous month.
REST: GET /telephony/{billingAccount}/service/{serviceName}/previousVoiceConsumption
@param creationDatetime_from [required] Filter the value of creationDatetime property (>=)
@param creationDatetime_to [required] Filter the value of creationDatetime property (<=)
@param wayType [required] Filter the value of wayType property (=)
@param destinationType [required] Filter the value of destinationType property (=)
@param planType [required] Filter the value of planType property (=)
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Call",
"delivery",
"records",
"of",
"the",
"previous",
"month",
"."
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3824-L3834 |
alkacon/opencms-core | src/org/opencms/ui/apps/scheduler/CmsJobEditView.java | CmsJobEditView.loadFromBean | public void loadFromBean(CmsScheduledJobInfo info) {
// all other fields already populated by field group, we still need to handle the parameters
for (Map.Entry<String, String> entry : info.getParameters().entrySet()) {
addParamLine(entry.getKey(), entry.getValue());
}
} | java | public void loadFromBean(CmsScheduledJobInfo info) {
// all other fields already populated by field group, we still need to handle the parameters
for (Map.Entry<String, String> entry : info.getParameters().entrySet()) {
addParamLine(entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"loadFromBean",
"(",
"CmsScheduledJobInfo",
"info",
")",
"{",
"// all other fields already populated by field group, we still need to handle the parameters",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"info",
".",
... | Initializes the form fields with values from the given job bean.<P>
@param info the job bean with which to fill the form | [
"Initializes",
"the",
"form",
"fields",
"with",
"values",
"from",
"the",
"given",
"job",
"bean",
".",
"<P",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/scheduler/CmsJobEditView.java#L407-L414 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/api/QrcodeAPI.java | QrcodeAPI.createQrcode | public QrcodeResponse createQrcode(QrcodeType actionName, String sceneId, Integer expireSeconds) {
return createQrcode(actionName, sceneId, null, expireSeconds);
} | java | public QrcodeResponse createQrcode(QrcodeType actionName, String sceneId, Integer expireSeconds) {
return createQrcode(actionName, sceneId, null, expireSeconds);
} | [
"public",
"QrcodeResponse",
"createQrcode",
"(",
"QrcodeType",
"actionName",
",",
"String",
"sceneId",
",",
"Integer",
"expireSeconds",
")",
"{",
"return",
"createQrcode",
"(",
"actionName",
",",
"sceneId",
",",
"null",
",",
"expireSeconds",
")",
";",
"}"
] | 创建二维码
@param actionName 二维码类型,QR_SCENE为临时,QR_LIMIT_SCENE为永久
@param sceneId 场景值ID,临时二维码时为32位非0整型,永久二维码时最大值为100000(目前参数只支持1--100000)
@param expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒
@return 二维码对象 | [
"创建二维码"
] | train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/QrcodeAPI.java#L38-L40 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.isTyping | public Observable<ComapiResult<Void>> isTyping(@NonNull final String conversationId) {
final String token = getToken();
if (sessionController.isCreatingSession() || TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doIsTyping(token, conversationId, true);
}
} | java | public Observable<ComapiResult<Void>> isTyping(@NonNull final String conversationId) {
final String token = getToken();
if (sessionController.isCreatingSession() || TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doIsTyping(token, conversationId, true);
}
} | [
"public",
"Observable",
"<",
"ComapiResult",
"<",
"Void",
">",
">",
"isTyping",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
")",
"{",
"final",
"String",
"token",
"=",
"getToken",
"(",
")",
";",
"if",
"(",
"sessionController",
".",
"isCreatingSe... | Send 'user is typing'.
@param conversationId ID of a conversation.
@return Observable to send event. | [
"Send",
"user",
"is",
"typing",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L912-L921 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java | LocalQPConsumerKeyGroup.addMemberToList | private void addMemberToList(JSConsumerKey key, boolean specificList)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry( tc, "addMemberToList", new Object[] {key, Boolean.valueOf(specificList)});
if(specificList)
{
if(specificKeyMembers == null)
{
// Our first specific member, create a list for them
specificKeyMembers = new ArrayList<LocalQPConsumerKey>();
}
specificKeyMembers.add((LocalQPConsumerKey)key);
}
else
{
if(generalKeyMembers == null)
{
// Our first specific member, create a list for them
generalKeyMembers = new ArrayList<LocalQPConsumerKey>();
}
generalKeyMembers.add((LocalQPConsumerKey)key);
// As we've modified the list we need to reset the index
generalMemberIndex = 0;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addMemberToList");
} | java | private void addMemberToList(JSConsumerKey key, boolean specificList)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry( tc, "addMemberToList", new Object[] {key, Boolean.valueOf(specificList)});
if(specificList)
{
if(specificKeyMembers == null)
{
// Our first specific member, create a list for them
specificKeyMembers = new ArrayList<LocalQPConsumerKey>();
}
specificKeyMembers.add((LocalQPConsumerKey)key);
}
else
{
if(generalKeyMembers == null)
{
// Our first specific member, create a list for them
generalKeyMembers = new ArrayList<LocalQPConsumerKey>();
}
generalKeyMembers.add((LocalQPConsumerKey)key);
// As we've modified the list we need to reset the index
generalMemberIndex = 0;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "addMemberToList");
} | [
"private",
"void",
"addMemberToList",
"(",
"JSConsumerKey",
"key",
",",
"boolean",
"specificList",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc"... | Add the member to the correct list
@param key
@param specificList | [
"Add",
"the",
"member",
"to",
"the",
"correct",
"list"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java#L364-L393 |
roboconf/roboconf-platform | core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/PluginScript.java | PluginScript.generateTemplate | protected File generateTemplate(File template, Instance instance) throws IOException {
String scriptName = instance.getName().replace( "\\s+", "_" );
File generated = File.createTempFile( scriptName, ".script");
InstanceTemplateHelper.injectInstanceImports(instance, template, generated);
return generated;
} | java | protected File generateTemplate(File template, Instance instance) throws IOException {
String scriptName = instance.getName().replace( "\\s+", "_" );
File generated = File.createTempFile( scriptName, ".script");
InstanceTemplateHelper.injectInstanceImports(instance, template, generated);
return generated;
} | [
"protected",
"File",
"generateTemplate",
"(",
"File",
"template",
",",
"Instance",
"instance",
")",
"throws",
"IOException",
"{",
"String",
"scriptName",
"=",
"instance",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"\"\\\\s+\"",
",",
"\"_\"",
")",
";",
"F... | Generates a file from the template and the instance.
@param template
@param instance
@return the generated file
@throws IOException | [
"Generates",
"a",
"file",
"from",
"the",
"template",
"and",
"the",
"instance",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/PluginScript.java#L215-L222 |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/LPIntegerNormDistanceFunction.java | LPIntegerNormDistanceFunction.preNorm | private double preNorm(NumberVector v, final int start, final int end) {
double agg = 0.;
for(int d = start; d < end; d++) {
final double xd = v.doubleValue(d);
final double delta = xd >= 0. ? xd : -xd;
agg += MathUtil.powi(delta, intp);
}
return agg;
} | java | private double preNorm(NumberVector v, final int start, final int end) {
double agg = 0.;
for(int d = start; d < end; d++) {
final double xd = v.doubleValue(d);
final double delta = xd >= 0. ? xd : -xd;
agg += MathUtil.powi(delta, intp);
}
return agg;
} | [
"private",
"double",
"preNorm",
"(",
"NumberVector",
"v",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
")",
"{",
"double",
"agg",
"=",
"0.",
";",
"for",
"(",
"int",
"d",
"=",
"start",
";",
"d",
"<",
"end",
";",
"d",
"++",
")",
"{",
... | Compute unscaled norm in a range of dimensions.
@param v Data object
@param start First dimension
@param end Exclusive last dimension
@return Aggregated values. | [
"Compute",
"unscaled",
"norm",
"in",
"a",
"range",
"of",
"dimensions",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/LPIntegerNormDistanceFunction.java#L135-L143 |
redbox-mint/redbox | plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java | CurationManager.emailObjectLink | private void emailObjectLink(JsonSimple response, String oid, String message) {
String link = urlBase + "default/detail/" + oid;
String text = "This is an automated message from the ";
text += "ReDBox Curation Manager.\n\n" + message;
text += "\n\nYou can find this object here:\n" + link;
email(response, oid, text);
} | java | private void emailObjectLink(JsonSimple response, String oid, String message) {
String link = urlBase + "default/detail/" + oid;
String text = "This is an automated message from the ";
text += "ReDBox Curation Manager.\n\n" + message;
text += "\n\nYou can find this object here:\n" + link;
email(response, oid, text);
} | [
"private",
"void",
"emailObjectLink",
"(",
"JsonSimple",
"response",
",",
"String",
"oid",
",",
"String",
"message",
")",
"{",
"String",
"link",
"=",
"urlBase",
"+",
"\"default/detail/\"",
"+",
"oid",
";",
"String",
"text",
"=",
"\"This is an automated message fro... | Generate an order to send an email to the intended recipient with a link
to an object
@param response
The response to add an order to
@param message
The message we want to send | [
"Generate",
"an",
"order",
"to",
"send",
"an",
"email",
"to",
"the",
"intended",
"recipient",
"with",
"a",
"link",
"to",
"an",
"object"
] | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java#L1563-L1569 |
lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/expression/var/VariableImpl.java | VariableImpl.methodExists | private static Boolean methodExists(Class clazz, String methodName, Type[] args, Type returnType) {
try {
Class<?>[] _args = new Class[args.length];
for (int i = 0; i < _args.length; i++) {
_args[i] = Types.toClass(args[i]);
}
Class<?> rtn = Types.toClass(returnType);
try {
java.lang.reflect.Method m = clazz.getMethod(methodName, _args);
return m.getReturnType() == rtn;
}
catch (Exception e) {
return false;
}
}
catch (Exception e) {
SystemOut.printDate(e);
return null;
}
} | java | private static Boolean methodExists(Class clazz, String methodName, Type[] args, Type returnType) {
try {
Class<?>[] _args = new Class[args.length];
for (int i = 0; i < _args.length; i++) {
_args[i] = Types.toClass(args[i]);
}
Class<?> rtn = Types.toClass(returnType);
try {
java.lang.reflect.Method m = clazz.getMethod(methodName, _args);
return m.getReturnType() == rtn;
}
catch (Exception e) {
return false;
}
}
catch (Exception e) {
SystemOut.printDate(e);
return null;
}
} | [
"private",
"static",
"Boolean",
"methodExists",
"(",
"Class",
"clazz",
",",
"String",
"methodName",
",",
"Type",
"[",
"]",
"args",
",",
"Type",
"returnType",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"_args",
"=",
"new",
"Class",
"[",
"... | checks if a method exists
@param clazz
@param methodName
@param args
@param returnType
@return returns null when checking fi | [
"checks",
"if",
"a",
"method",
"exists"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/expression/var/VariableImpl.java#L545-L564 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java | SequenceGibbsSampler.collectSamples | public List<int[]> collectSamples(SequenceModel model, int numSamples, int sampleInterval) {
int[] initialSequence = getRandomSequence(model);
return collectSamples(model, numSamples, sampleInterval, initialSequence);
} | java | public List<int[]> collectSamples(SequenceModel model, int numSamples, int sampleInterval) {
int[] initialSequence = getRandomSequence(model);
return collectSamples(model, numSamples, sampleInterval, initialSequence);
} | [
"public",
"List",
"<",
"int",
"[",
"]",
">",
"collectSamples",
"(",
"SequenceModel",
"model",
",",
"int",
"numSamples",
",",
"int",
"sampleInterval",
")",
"{",
"int",
"[",
"]",
"initialSequence",
"=",
"getRandomSequence",
"(",
"model",
")",
";",
"return",
... | Collects numSamples samples of sequences, from the distribution over sequences defined
by the sequence model passed on construction.
All samples collected are sampleInterval samples apart, in an attempt to reduce
autocorrelation.
@return a List containing the sequence samples, as arrays of type int, and their scores | [
"Collects",
"numSamples",
"samples",
"of",
"sequences",
"from",
"the",
"distribution",
"over",
"sequences",
"defined",
"by",
"the",
"sequence",
"model",
"passed",
"on",
"construction",
".",
"All",
"samples",
"collected",
"are",
"sampleInterval",
"samples",
"apart",
... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java#L132-L135 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/writer/BeanDefinitionWriter.java | BeanDefinitionWriter.visitBeanFactoryMethod | public void visitBeanFactoryMethod(Object factoryClass,
Object producedType,
String methodName,
AnnotationMetadata methodAnnotationMetadata,
Map<String, Object> argumentTypes,
Map<String, AnnotationMetadata> argumentAnnotationMetadata,
Map<String, Map<String, Object>> genericTypes) {
if (constructorVisitor != null) {
throw new IllegalStateException("Only a single call to visitBeanFactoryMethod(..) is permitted");
} else {
// now prepare the implementation of the build method. See BeanFactory interface
visitBuildFactoryMethodDefinition(factoryClass, methodName, argumentTypes, argumentAnnotationMetadata, methodAnnotationMetadata);
// now implement the constructor
buildFactoryMethodClassConstructor(
factoryClass,
producedType,
methodName,
methodAnnotationMetadata,
argumentTypes,
argumentAnnotationMetadata,
genericTypes);
// now override the injectBean method
visitInjectMethodDefinition();
}
} | java | public void visitBeanFactoryMethod(Object factoryClass,
Object producedType,
String methodName,
AnnotationMetadata methodAnnotationMetadata,
Map<String, Object> argumentTypes,
Map<String, AnnotationMetadata> argumentAnnotationMetadata,
Map<String, Map<String, Object>> genericTypes) {
if (constructorVisitor != null) {
throw new IllegalStateException("Only a single call to visitBeanFactoryMethod(..) is permitted");
} else {
// now prepare the implementation of the build method. See BeanFactory interface
visitBuildFactoryMethodDefinition(factoryClass, methodName, argumentTypes, argumentAnnotationMetadata, methodAnnotationMetadata);
// now implement the constructor
buildFactoryMethodClassConstructor(
factoryClass,
producedType,
methodName,
methodAnnotationMetadata,
argumentTypes,
argumentAnnotationMetadata,
genericTypes);
// now override the injectBean method
visitInjectMethodDefinition();
}
} | [
"public",
"void",
"visitBeanFactoryMethod",
"(",
"Object",
"factoryClass",
",",
"Object",
"producedType",
",",
"String",
"methodName",
",",
"AnnotationMetadata",
"methodAnnotationMetadata",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"argumentTypes",
",",
"Map",
... | <p>In the case where the produced class is produced by a factory method annotated with
{@link io.micronaut.context.annotation.Bean} this method should be called.</p>
@param factoryClass The factory class
@param producedType The produced type
@param methodName The method name
@param methodAnnotationMetadata The method annotation metadata
@param argumentTypes The arguments to the method
@param argumentAnnotationMetadata The argument annotation metadata
@param genericTypes The generic types for the method parameters | [
"<p",
">",
"In",
"the",
"case",
"where",
"the",
"produced",
"class",
"is",
"produced",
"by",
"a",
"factory",
"method",
"annotated",
"with",
"{",
"@link",
"io",
".",
"micronaut",
".",
"context",
".",
"annotation",
".",
"Bean",
"}",
"this",
"method",
"shou... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/writer/BeanDefinitionWriter.java#L375-L401 |
LearnLib/automatalib | visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java | DOT.runDOT | public static InputStream runDOT(File dotFile, String format, String... additionalOpts) throws IOException {
return runDOT(IOUtil.asBufferedUTF8Reader(dotFile), format, additionalOpts);
} | java | public static InputStream runDOT(File dotFile, String format, String... additionalOpts) throws IOException {
return runDOT(IOUtil.asBufferedUTF8Reader(dotFile), format, additionalOpts);
} | [
"public",
"static",
"InputStream",
"runDOT",
"(",
"File",
"dotFile",
",",
"String",
"format",
",",
"String",
"...",
"additionalOpts",
")",
"throws",
"IOException",
"{",
"return",
"runDOT",
"(",
"IOUtil",
".",
"asBufferedUTF8Reader",
"(",
"dotFile",
")",
",",
"... | Invokes the DOT utility on a file. Convenience method, see {@link #runDOT(Reader, String, String...)}. | [
"Invokes",
"the",
"DOT",
"utility",
"on",
"a",
"file",
".",
"Convenience",
"method",
"see",
"{"
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java#L149-L151 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/sender/http2/Http2ConnectionManager.java | Http2ConnectionManager.removeClientChannel | void removeClientChannel(HttpRoute httpRoute, Http2ClientChannel http2ClientChannel) {
EventLoopPool.PerRouteConnectionPool perRouteConnectionPool = fetchPerRoutePool(httpRoute,
http2ClientChannel.getChannel()
.eventLoop());
if (perRouteConnectionPool != null) {
perRouteConnectionPool.removeChannel(http2ClientChannel);
}
} | java | void removeClientChannel(HttpRoute httpRoute, Http2ClientChannel http2ClientChannel) {
EventLoopPool.PerRouteConnectionPool perRouteConnectionPool = fetchPerRoutePool(httpRoute,
http2ClientChannel.getChannel()
.eventLoop());
if (perRouteConnectionPool != null) {
perRouteConnectionPool.removeChannel(http2ClientChannel);
}
} | [
"void",
"removeClientChannel",
"(",
"HttpRoute",
"httpRoute",
",",
"Http2ClientChannel",
"http2ClientChannel",
")",
"{",
"EventLoopPool",
".",
"PerRouteConnectionPool",
"perRouteConnectionPool",
"=",
"fetchPerRoutePool",
"(",
"httpRoute",
",",
"http2ClientChannel",
".",
"ge... | Remove http/2 client channel from per route pool.
@param httpRoute the http route
@param http2ClientChannel represents the http/2 client channel to be removed | [
"Remove",
"http",
"/",
"2",
"client",
"channel",
"from",
"per",
"route",
"pool",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/sender/http2/Http2ConnectionManager.java#L156-L163 |
pac4j/pac4j | pac4j-saml/src/main/java/org/pac4j/saml/profile/impl/AbstractSAML2ResponseValidator.java | AbstractSAML2ResponseValidator.validateIssuer | protected final void validateIssuer(final Issuer issuer, final SAML2MessageContext context) {
if (issuer.getFormat() != null && !issuer.getFormat().equals(NameIDType.ENTITY)) {
throw new SAMLIssuerException("Issuer type is not entity but " + issuer.getFormat());
}
final String entityId = context.getSAMLPeerEntityContext().getEntityId();
if (entityId == null || !entityId.equals(issuer.getValue())) {
throw new SAMLIssuerException("Issuer " + issuer.getValue() + " does not match idp entityId " + entityId);
}
} | java | protected final void validateIssuer(final Issuer issuer, final SAML2MessageContext context) {
if (issuer.getFormat() != null && !issuer.getFormat().equals(NameIDType.ENTITY)) {
throw new SAMLIssuerException("Issuer type is not entity but " + issuer.getFormat());
}
final String entityId = context.getSAMLPeerEntityContext().getEntityId();
if (entityId == null || !entityId.equals(issuer.getValue())) {
throw new SAMLIssuerException("Issuer " + issuer.getValue() + " does not match idp entityId " + entityId);
}
} | [
"protected",
"final",
"void",
"validateIssuer",
"(",
"final",
"Issuer",
"issuer",
",",
"final",
"SAML2MessageContext",
"context",
")",
"{",
"if",
"(",
"issuer",
".",
"getFormat",
"(",
")",
"!=",
"null",
"&&",
"!",
"issuer",
".",
"getFormat",
"(",
")",
".",... | Validate issuer format and value.
@param issuer the issuer
@param context the context | [
"Validate",
"issuer",
"format",
"and",
"value",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/profile/impl/AbstractSAML2ResponseValidator.java#L137-L146 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java | Blacklist.write | public void write(OutputStream os)
{
List<String> ids = new ArrayList<String>(score.keySet());
final Map<String, Integer> score = this.score;
Collections.sort(ids, new Comparator<String>()
{
@Override
public int compare(String o1, String o2)
{
return score.get(o2).compareTo(score.get(o1));
}
});
try
{
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os));
boolean notFirst = false;
for (String id : ids)
{
if (notFirst) writer.write("\n");
else notFirst = true;
writer.write(id + DELIM + score.get(id) + DELIM + convertContext(context.get(id)));
}
writer.close();
}
catch (IOException e)
{
e.printStackTrace();
}
} | java | public void write(OutputStream os)
{
List<String> ids = new ArrayList<String>(score.keySet());
final Map<String, Integer> score = this.score;
Collections.sort(ids, new Comparator<String>()
{
@Override
public int compare(String o1, String o2)
{
return score.get(o2).compareTo(score.get(o1));
}
});
try
{
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os));
boolean notFirst = false;
for (String id : ids)
{
if (notFirst) writer.write("\n");
else notFirst = true;
writer.write(id + DELIM + score.get(id) + DELIM + convertContext(context.get(id)));
}
writer.close();
}
catch (IOException e)
{
e.printStackTrace();
}
} | [
"public",
"void",
"write",
"(",
"OutputStream",
"os",
")",
"{",
"List",
"<",
"String",
">",
"ids",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"score",
".",
"keySet",
"(",
")",
")",
";",
"final",
"Map",
"<",
"String",
",",
"Integer",
">",
"sc... | Dumps data to the given output stream.
@param os output stream | [
"Dumps",
"data",
"to",
"the",
"given",
"output",
"stream",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/Blacklist.java#L152-L185 |
lamydev/Android-Notification | core/src/zemin/notification/NotificationRemote.java | NotificationRemote.getActionIntent | public PendingIntent getActionIntent(NotificationEntry entry, NotificationEntry.Action act) {
Intent intent = new Intent(ACTION_ACTION);
intent.putExtra(KEY_ENTRY_ID, entry.ID);
intent.putExtra(KEY_ACTION_ID, entry.mActions.indexOf(act));
return PendingIntent.getBroadcast(mContext, genIdForPendingIntent(), intent, 0);
} | java | public PendingIntent getActionIntent(NotificationEntry entry, NotificationEntry.Action act) {
Intent intent = new Intent(ACTION_ACTION);
intent.putExtra(KEY_ENTRY_ID, entry.ID);
intent.putExtra(KEY_ACTION_ID, entry.mActions.indexOf(act));
return PendingIntent.getBroadcast(mContext, genIdForPendingIntent(), intent, 0);
} | [
"public",
"PendingIntent",
"getActionIntent",
"(",
"NotificationEntry",
"entry",
",",
"NotificationEntry",
".",
"Action",
"act",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"ACTION_ACTION",
")",
";",
"intent",
".",
"putExtra",
"(",
"KEY_ENTRY_ID",
"... | Create an PendingIntent to be fired when the notification action is invoked.
@see android.app.Notification#addAction(int, CharSequence, PendingIntent)
@param entry
@param act
@return PendingIntent | [
"Create",
"an",
"PendingIntent",
"to",
"be",
"fired",
"when",
"the",
"notification",
"action",
"is",
"invoked",
"."
] | train | https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationRemote.java#L158-L163 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassHash.java | ClassHash.setMethodHash | public void setMethodHash(XMethod method, byte[] methodHash) {
methodHashMap.put(method, new MethodHash(method.getName(), method.getSignature(), method.isStatic(), methodHash));
} | java | public void setMethodHash(XMethod method, byte[] methodHash) {
methodHashMap.put(method, new MethodHash(method.getName(), method.getSignature(), method.isStatic(), methodHash));
} | [
"public",
"void",
"setMethodHash",
"(",
"XMethod",
"method",
",",
"byte",
"[",
"]",
"methodHash",
")",
"{",
"methodHashMap",
".",
"put",
"(",
"method",
",",
"new",
"MethodHash",
"(",
"method",
".",
"getName",
"(",
")",
",",
"method",
".",
"getSignature",
... | Set method hash for given method.
@param method
the method
@param methodHash
the method hash | [
"Set",
"method",
"hash",
"for",
"given",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassHash.java#L93-L95 |
roskart/dropwizard-jaxws | dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSBundle.java | JAXWSBundle.publishEndpoint | public Endpoint publishEndpoint(String path, Object service, BasicAuthentication authentication) {
return this.publishEndpoint(path, service, authentication, null);
} | java | public Endpoint publishEndpoint(String path, Object service, BasicAuthentication authentication) {
return this.publishEndpoint(path, service, authentication, null);
} | [
"public",
"Endpoint",
"publishEndpoint",
"(",
"String",
"path",
",",
"Object",
"service",
",",
"BasicAuthentication",
"authentication",
")",
"{",
"return",
"this",
".",
"publishEndpoint",
"(",
"path",
",",
"service",
",",
"authentication",
",",
"null",
")",
";",... | Publish JAX-WS protected endpoint using Dropwizard BasicAuthentication. EndpointBuilder is published relative
to the CXF servlet path.
@param path Relative endpoint path.
@param service Service implementation.
@param authentication BasicAuthentication implementation.
@return javax.xml.ws.Endpoint
@deprecated Use the {@link #publishEndpoint(EndpointBuilder)} publishEndpoint} method instead. | [
"Publish",
"JAX",
"-",
"WS",
"protected",
"endpoint",
"using",
"Dropwizard",
"BasicAuthentication",
".",
"EndpointBuilder",
"is",
"published",
"relative",
"to",
"the",
"CXF",
"servlet",
"path",
".",
"@param",
"path",
"Relative",
"endpoint",
"path",
".",
"@param",
... | train | https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSBundle.java#L124-L126 |
EdwardRaff/JSAT | JSAT/src/jsat/utils/QuickSort.java | QuickSort.swapC | public static void swapC(double[] array, int i, int j)
{
double tmp_i= array[i];
double tmp_j = array[j];
if(tmp_i > tmp_j)
{
array[i] = tmp_j;
array[j] = tmp_i;
}
} | java | public static void swapC(double[] array, int i, int j)
{
double tmp_i= array[i];
double tmp_j = array[j];
if(tmp_i > tmp_j)
{
array[i] = tmp_j;
array[j] = tmp_i;
}
} | [
"public",
"static",
"void",
"swapC",
"(",
"double",
"[",
"]",
"array",
",",
"int",
"i",
",",
"int",
"j",
")",
"{",
"double",
"tmp_i",
"=",
"array",
"[",
"i",
"]",
";",
"double",
"tmp_j",
"=",
"array",
"[",
"j",
"]",
";",
"if",
"(",
"tmp_i",
">"... | Conditional swap, only swaps the values if array[i] > array[j]
@param array the array to potentially swap values in
@param i the 1st index
@param j the 2nd index | [
"Conditional",
"swap",
"only",
"swaps",
"the",
"values",
"if",
"array",
"[",
"i",
"]",
">",
";",
"array",
"[",
"j",
"]"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/QuickSort.java#L92-L102 |
VoltDB/voltdb | src/frontend/org/voltdb/StatsAgent.java | StatsAgent.aggregateProcedureStats | private VoltTable[] aggregateProcedureStats(VoltTable[] baseStats)
{
if (baseStats == null || baseStats.length != 1) {
return baseStats;
}
VoltTable result = new VoltTable(
new ColumnInfo("TIMESTAMP", VoltType.BIGINT),
new ColumnInfo(VoltSystemProcedure.CNAME_HOST_ID, VoltSystemProcedure.CTYPE_ID),
new ColumnInfo("HOSTNAME", VoltType.STRING),
new ColumnInfo(VoltSystemProcedure.CNAME_SITE_ID, VoltSystemProcedure.CTYPE_ID),
new ColumnInfo("PARTITION_ID", VoltType.INTEGER),
new ColumnInfo("PROCEDURE", VoltType.STRING),
new ColumnInfo("INVOCATIONS", VoltType.BIGINT),
new ColumnInfo("TIMED_INVOCATIONS", VoltType.BIGINT),
new ColumnInfo("MIN_EXECUTION_TIME", VoltType.BIGINT),
new ColumnInfo("MAX_EXECUTION_TIME", VoltType.BIGINT),
new ColumnInfo("AVG_EXECUTION_TIME", VoltType.BIGINT),
new ColumnInfo("MIN_RESULT_SIZE", VoltType.INTEGER),
new ColumnInfo("MAX_RESULT_SIZE", VoltType.INTEGER),
new ColumnInfo("AVG_RESULT_SIZE", VoltType.INTEGER),
new ColumnInfo("MIN_PARAMETER_SET_SIZE", VoltType.INTEGER),
new ColumnInfo("MAX_PARAMETER_SET_SIZE", VoltType.INTEGER),
new ColumnInfo("AVG_PARAMETER_SET_SIZE", VoltType.INTEGER),
new ColumnInfo("ABORTS", VoltType.BIGINT),
new ColumnInfo("FAILURES", VoltType.BIGINT),
new ColumnInfo("TRANSACTIONAL", VoltType.TINYINT));
baseStats[0].resetRowPosition();
while (baseStats[0].advanceRow()) {
if (baseStats[0].getString("STATEMENT").equalsIgnoreCase("<ALL>")) {
result.addRow(
baseStats[0].getLong("TIMESTAMP"),
baseStats[0].getLong(VoltSystemProcedure.CNAME_HOST_ID),
baseStats[0].getString("HOSTNAME"),
baseStats[0].getLong(VoltSystemProcedure.CNAME_SITE_ID),
baseStats[0].getLong("PARTITION_ID"),
baseStats[0].getString("PROCEDURE"),
baseStats[0].getLong("INVOCATIONS"),
baseStats[0].getLong("TIMED_INVOCATIONS"),
baseStats[0].getLong("MIN_EXECUTION_TIME"),
baseStats[0].getLong("MAX_EXECUTION_TIME"),
baseStats[0].getLong("AVG_EXECUTION_TIME"),
baseStats[0].getLong("MIN_RESULT_SIZE"),
baseStats[0].getLong("MAX_RESULT_SIZE"),
baseStats[0].getLong("AVG_RESULT_SIZE"),
baseStats[0].getLong("MIN_PARAMETER_SET_SIZE"),
baseStats[0].getLong("MAX_PARAMETER_SET_SIZE"),
baseStats[0].getLong("AVG_PARAMETER_SET_SIZE"),
baseStats[0].getLong("ABORTS"),
baseStats[0].getLong("FAILURES"),
(byte) baseStats[0].getLong("TRANSACTIONAL"));
}
}
return new VoltTable[] { result };
} | java | private VoltTable[] aggregateProcedureStats(VoltTable[] baseStats)
{
if (baseStats == null || baseStats.length != 1) {
return baseStats;
}
VoltTable result = new VoltTable(
new ColumnInfo("TIMESTAMP", VoltType.BIGINT),
new ColumnInfo(VoltSystemProcedure.CNAME_HOST_ID, VoltSystemProcedure.CTYPE_ID),
new ColumnInfo("HOSTNAME", VoltType.STRING),
new ColumnInfo(VoltSystemProcedure.CNAME_SITE_ID, VoltSystemProcedure.CTYPE_ID),
new ColumnInfo("PARTITION_ID", VoltType.INTEGER),
new ColumnInfo("PROCEDURE", VoltType.STRING),
new ColumnInfo("INVOCATIONS", VoltType.BIGINT),
new ColumnInfo("TIMED_INVOCATIONS", VoltType.BIGINT),
new ColumnInfo("MIN_EXECUTION_TIME", VoltType.BIGINT),
new ColumnInfo("MAX_EXECUTION_TIME", VoltType.BIGINT),
new ColumnInfo("AVG_EXECUTION_TIME", VoltType.BIGINT),
new ColumnInfo("MIN_RESULT_SIZE", VoltType.INTEGER),
new ColumnInfo("MAX_RESULT_SIZE", VoltType.INTEGER),
new ColumnInfo("AVG_RESULT_SIZE", VoltType.INTEGER),
new ColumnInfo("MIN_PARAMETER_SET_SIZE", VoltType.INTEGER),
new ColumnInfo("MAX_PARAMETER_SET_SIZE", VoltType.INTEGER),
new ColumnInfo("AVG_PARAMETER_SET_SIZE", VoltType.INTEGER),
new ColumnInfo("ABORTS", VoltType.BIGINT),
new ColumnInfo("FAILURES", VoltType.BIGINT),
new ColumnInfo("TRANSACTIONAL", VoltType.TINYINT));
baseStats[0].resetRowPosition();
while (baseStats[0].advanceRow()) {
if (baseStats[0].getString("STATEMENT").equalsIgnoreCase("<ALL>")) {
result.addRow(
baseStats[0].getLong("TIMESTAMP"),
baseStats[0].getLong(VoltSystemProcedure.CNAME_HOST_ID),
baseStats[0].getString("HOSTNAME"),
baseStats[0].getLong(VoltSystemProcedure.CNAME_SITE_ID),
baseStats[0].getLong("PARTITION_ID"),
baseStats[0].getString("PROCEDURE"),
baseStats[0].getLong("INVOCATIONS"),
baseStats[0].getLong("TIMED_INVOCATIONS"),
baseStats[0].getLong("MIN_EXECUTION_TIME"),
baseStats[0].getLong("MAX_EXECUTION_TIME"),
baseStats[0].getLong("AVG_EXECUTION_TIME"),
baseStats[0].getLong("MIN_RESULT_SIZE"),
baseStats[0].getLong("MAX_RESULT_SIZE"),
baseStats[0].getLong("AVG_RESULT_SIZE"),
baseStats[0].getLong("MIN_PARAMETER_SET_SIZE"),
baseStats[0].getLong("MAX_PARAMETER_SET_SIZE"),
baseStats[0].getLong("AVG_PARAMETER_SET_SIZE"),
baseStats[0].getLong("ABORTS"),
baseStats[0].getLong("FAILURES"),
(byte) baseStats[0].getLong("TRANSACTIONAL"));
}
}
return new VoltTable[] { result };
} | [
"private",
"VoltTable",
"[",
"]",
"aggregateProcedureStats",
"(",
"VoltTable",
"[",
"]",
"baseStats",
")",
"{",
"if",
"(",
"baseStats",
"==",
"null",
"||",
"baseStats",
".",
"length",
"!=",
"1",
")",
"{",
"return",
"baseStats",
";",
"}",
"VoltTable",
"resu... | Produce PROCEDURE aggregation of PROCEDURE subselector
Basically it leaves out the rows that were not labeled as "<ALL>". | [
"Produce",
"PROCEDURE",
"aggregation",
"of",
"PROCEDURE",
"subselector",
"Basically",
"it",
"leaves",
"out",
"the",
"rows",
"that",
"were",
"not",
"labeled",
"as",
"<ALL",
">",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/StatsAgent.java#L130-L184 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/cache/keyproviders/BasicAuthCacheKeyProvider.java | BasicAuthCacheKeyProvider.createLookupKey | public static String createLookupKey(String realm, String userid) {
String key = null;
if (realm != null && userid != null) {
key = realm + KEY_SEPARATOR + userid;
}
return key;
} | java | public static String createLookupKey(String realm, String userid) {
String key = null;
if (realm != null && userid != null) {
key = realm + KEY_SEPARATOR + userid;
}
return key;
} | [
"public",
"static",
"String",
"createLookupKey",
"(",
"String",
"realm",
",",
"String",
"userid",
")",
"{",
"String",
"key",
"=",
"null",
";",
"if",
"(",
"realm",
"!=",
"null",
"&&",
"userid",
"!=",
"null",
")",
"{",
"key",
"=",
"realm",
"+",
"KEY_SEPA... | Creates a key to be used with the AuthCacheService.
The parameters must not be null, otherwise a null key is returned.
@param realm
@param userid
@return | [
"Creates",
"a",
"key",
"to",
"be",
"used",
"with",
"the",
"AuthCacheService",
".",
"The",
"parameters",
"must",
"not",
"be",
"null",
"otherwise",
"a",
"null",
"key",
"is",
"returned",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/cache/keyproviders/BasicAuthCacheKeyProvider.java#L132-L138 |
stickfigure/batchfb | src/main/java/com/googlecode/batchfb/util/StringUtils.java | StringUtils.stringifyValue | public static String stringifyValue(Param param, ObjectMapper mapper) {
assert !(param instanceof BinaryParam);
if (param.value instanceof String)
return (String)param.value;
if (param.value instanceof Date)
return Long.toString(((Date)param.value).getTime() / 1000);
else if (param.value instanceof Number)
return param.value.toString();
else
return JSONUtils.toJSON(param.value, mapper);
} | java | public static String stringifyValue(Param param, ObjectMapper mapper) {
assert !(param instanceof BinaryParam);
if (param.value instanceof String)
return (String)param.value;
if (param.value instanceof Date)
return Long.toString(((Date)param.value).getTime() / 1000);
else if (param.value instanceof Number)
return param.value.toString();
else
return JSONUtils.toJSON(param.value, mapper);
} | [
"public",
"static",
"String",
"stringifyValue",
"(",
"Param",
"param",
",",
"ObjectMapper",
"mapper",
")",
"{",
"assert",
"!",
"(",
"param",
"instanceof",
"BinaryParam",
")",
";",
"if",
"(",
"param",
".",
"value",
"instanceof",
"String",
")",
"return",
"(",
... | Stringify the parameter value in an appropriate way. Note that Facebook fucks up dates by using unix time-since-epoch
some places and ISO-8601 others. However, maybe unix times always work as parameters? | [
"Stringify",
"the",
"parameter",
"value",
"in",
"an",
"appropriate",
"way",
".",
"Note",
"that",
"Facebook",
"fucks",
"up",
"dates",
"by",
"using",
"unix",
"time",
"-",
"since",
"-",
"epoch",
"some",
"places",
"and",
"ISO",
"-",
"8601",
"others",
".",
"H... | train | https://github.com/stickfigure/batchfb/blob/ceeda78aa6d8397eec032ab1d8997adb7378e9e2/src/main/java/com/googlecode/batchfb/util/StringUtils.java#L70-L81 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/api/RevisionApi.java | RevisionApi.getMapping | private int getMapping(final String mapping, final int revisionCounter)
{
String tempA, tempB;
int length = 0;
int revC = -1, mapC = -1;
int index, max = mapping.length();
while (length < max && revC < revisionCounter) {
// Read revisionCounter
index = mapping.indexOf(' ', length);
tempA = mapping.substring(length, index);
length = index + 1;
// Read mappedCounter
index = mapping.indexOf(' ', length);
if (index == -1) {
index = mapping.length();
}
tempB = mapping.substring(length, index);
length = index + 1;
// Parse values
revC = Integer.parseInt(tempA);
mapC = Integer.parseInt(tempB);
// System.out.println(revC + " -> " + mapC);
}
if (revC == revisionCounter) {
// System.out.println(revC + " >> " + mapC);
return mapC;
}
return revisionCounter;
} | java | private int getMapping(final String mapping, final int revisionCounter)
{
String tempA, tempB;
int length = 0;
int revC = -1, mapC = -1;
int index, max = mapping.length();
while (length < max && revC < revisionCounter) {
// Read revisionCounter
index = mapping.indexOf(' ', length);
tempA = mapping.substring(length, index);
length = index + 1;
// Read mappedCounter
index = mapping.indexOf(' ', length);
if (index == -1) {
index = mapping.length();
}
tempB = mapping.substring(length, index);
length = index + 1;
// Parse values
revC = Integer.parseInt(tempA);
mapC = Integer.parseInt(tempB);
// System.out.println(revC + " -> " + mapC);
}
if (revC == revisionCounter) {
// System.out.println(revC + " >> " + mapC);
return mapC;
}
return revisionCounter;
} | [
"private",
"int",
"getMapping",
"(",
"final",
"String",
"mapping",
",",
"final",
"int",
"revisionCounter",
")",
"{",
"String",
"tempA",
",",
"tempB",
";",
"int",
"length",
"=",
"0",
";",
"int",
"revC",
"=",
"-",
"1",
",",
"mapC",
"=",
"-",
"1",
";",
... | This method returns the correct mapping of the given input.
@param mapping
mapping sequence
@param revisionCounter
index to map
@return mapped index | [
"This",
"method",
"returns",
"the",
"correct",
"mapping",
"of",
"the",
"given",
"input",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/api/RevisionApi.java#L1666-L1703 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java | BitsUtil.nextSetBit | public static int nextSetBit(long v, int start) {
if(start >= Long.SIZE) {
return -1;
}
start = start < 0 ? 0 : start;
long cur = v & (LONG_ALL_BITS << start);
return cur == 0 ? -1 : cur == LONG_ALL_BITS ? 0 : Long.numberOfTrailingZeros(cur);
} | java | public static int nextSetBit(long v, int start) {
if(start >= Long.SIZE) {
return -1;
}
start = start < 0 ? 0 : start;
long cur = v & (LONG_ALL_BITS << start);
return cur == 0 ? -1 : cur == LONG_ALL_BITS ? 0 : Long.numberOfTrailingZeros(cur);
} | [
"public",
"static",
"int",
"nextSetBit",
"(",
"long",
"v",
",",
"int",
"start",
")",
"{",
"if",
"(",
"start",
">=",
"Long",
".",
"SIZE",
")",
"{",
"return",
"-",
"1",
";",
"}",
"start",
"=",
"start",
"<",
"0",
"?",
"0",
":",
"start",
";",
"long... | Find the next set bit.
@param v Value to process
@param start Start position (inclusive)
@return Position of next set bit, or -1. | [
"Find",
"the",
"next",
"set",
"bit",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java#L1307-L1314 |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/CharRange.java | CharRange.removeOverlap | public static List<CharRange> removeOverlap(CharRange r1, CharRange r2)
{
assert r1.intersect(r2);
List<CharRange> list = new ArrayList<CharRange>();
Set<Integer> set = new TreeSet<Integer>();
set.add(r1.getFrom());
set.add(r1.getTo());
set.add(r2.getFrom());
set.add(r2.getTo());
int p = 0;
for (int r : set)
{
if (p != 0)
{
list.add(new CharRange(p, r));
}
p = r;
}
return list;
} | java | public static List<CharRange> removeOverlap(CharRange r1, CharRange r2)
{
assert r1.intersect(r2);
List<CharRange> list = new ArrayList<CharRange>();
Set<Integer> set = new TreeSet<Integer>();
set.add(r1.getFrom());
set.add(r1.getTo());
set.add(r2.getFrom());
set.add(r2.getTo());
int p = 0;
for (int r : set)
{
if (p != 0)
{
list.add(new CharRange(p, r));
}
p = r;
}
return list;
} | [
"public",
"static",
"List",
"<",
"CharRange",
">",
"removeOverlap",
"(",
"CharRange",
"r1",
",",
"CharRange",
"r2",
")",
"{",
"assert",
"r1",
".",
"intersect",
"(",
"r2",
")",
";",
"List",
"<",
"CharRange",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"C... | Returns a list of ranges that together gather the same characters as r1 and r2.
None of the resulting ranges doesn't intersect each other.
@param r1
@param r2
@return | [
"Returns",
"a",
"list",
"of",
"ranges",
"that",
"together",
"gather",
"the",
"same",
"characters",
"as",
"r1",
"and",
"r2",
".",
"None",
"of",
"the",
"resulting",
"ranges",
"doesn",
"t",
"intersect",
"each",
"other",
"."
] | train | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/CharRange.java#L154-L173 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.shopGet | public static ShopGetResult shopGet(String accessToken, ShopInfo shopInfo) {
return shopGet(accessToken, JsonUtil.toJSONString(shopInfo));
} | java | public static ShopGetResult shopGet(String accessToken, ShopInfo shopInfo) {
return shopGet(accessToken, JsonUtil.toJSONString(shopInfo));
} | [
"public",
"static",
"ShopGetResult",
"shopGet",
"(",
"String",
"accessToken",
",",
"ShopInfo",
"shopInfo",
")",
"{",
"return",
"shopGet",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"shopInfo",
")",
")",
";",
"}"
] | Wi-Fi门店管理-查询门店WiFi信息接口
@param accessToken accessToken
@param shopInfo shopInfo
@return BaseResult | [
"Wi",
"-",
"Fi门店管理",
"-",
"查询门店WiFi信息接口"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L188-L190 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupDb.java | CmsSetupDb.executeSqlStatement | public CmsSetupDBWrapper executeSqlStatement(String query, Map<String, String> replacer) throws SQLException {
CmsSetupDBWrapper dbwrapper = new CmsSetupDBWrapper(m_con);
dbwrapper.createStatement();
String queryToExecute = query;
// Check if a map of replacements is given
if (replacer != null) {
queryToExecute = replaceTokens(query, replacer);
}
// do the query
dbwrapper.excecuteQuery(queryToExecute);
// return the result
return dbwrapper;
} | java | public CmsSetupDBWrapper executeSqlStatement(String query, Map<String, String> replacer) throws SQLException {
CmsSetupDBWrapper dbwrapper = new CmsSetupDBWrapper(m_con);
dbwrapper.createStatement();
String queryToExecute = query;
// Check if a map of replacements is given
if (replacer != null) {
queryToExecute = replaceTokens(query, replacer);
}
// do the query
dbwrapper.excecuteQuery(queryToExecute);
// return the result
return dbwrapper;
} | [
"public",
"CmsSetupDBWrapper",
"executeSqlStatement",
"(",
"String",
"query",
",",
"Map",
"<",
"String",
",",
"String",
">",
"replacer",
")",
"throws",
"SQLException",
"{",
"CmsSetupDBWrapper",
"dbwrapper",
"=",
"new",
"CmsSetupDBWrapper",
"(",
"m_con",
")",
";",
... | Creates and executes a database statement from a String returning the result set.<p>
@param query the query to execute
@param replacer the replacements to perform in the script
@return the result set of the query
@throws SQLException if something goes wrong | [
"Creates",
"and",
"executes",
"a",
"database",
"statement",
"from",
"a",
"String",
"returning",
"the",
"result",
"set",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupDb.java#L315-L332 |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java | POJOService.addGetter | private void addGetter(final TypeSpec.Builder classBuilder, final String attributeName, final TypeName type) {
final String getterMethodName = "get" + attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1);
final MethodSpec.Builder getterBuilder = MethodSpec.methodBuilder(getterMethodName);
getterBuilder.returns(type);
getterBuilder.addModifiers(Modifier.PUBLIC);
getterBuilder.addCode("return this." + attributeName + ";");
classBuilder.addMethod(getterBuilder.build());
} | java | private void addGetter(final TypeSpec.Builder classBuilder, final String attributeName, final TypeName type) {
final String getterMethodName = "get" + attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1);
final MethodSpec.Builder getterBuilder = MethodSpec.methodBuilder(getterMethodName);
getterBuilder.returns(type);
getterBuilder.addModifiers(Modifier.PUBLIC);
getterBuilder.addCode("return this." + attributeName + ";");
classBuilder.addMethod(getterBuilder.build());
} | [
"private",
"void",
"addGetter",
"(",
"final",
"TypeSpec",
".",
"Builder",
"classBuilder",
",",
"final",
"String",
"attributeName",
",",
"final",
"TypeName",
"type",
")",
"{",
"final",
"String",
"getterMethodName",
"=",
"\"get\"",
"+",
"attributeName",
".",
"subs... | adds getter for field to class
@param classBuilder class to modify
@param attributeName name of attribute to be referenced
@param type type of attribue to be referenced | [
"adds",
"getter",
"for",
"field",
"to",
"class"
] | train | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/service/POJOService.java#L203-L211 |
opencb/java-common-libs | commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/GenericDocumentComplexConverter.java | GenericDocumentComplexConverter.restoreDots | public static Document restoreDots(Document document) {
return modifyKeys(document, key -> key.replace(TO_REPLACE_DOTS, "."), TO_REPLACE_DOTS);
} | java | public static Document restoreDots(Document document) {
return modifyKeys(document, key -> key.replace(TO_REPLACE_DOTS, "."), TO_REPLACE_DOTS);
} | [
"public",
"static",
"Document",
"restoreDots",
"(",
"Document",
"document",
")",
"{",
"return",
"modifyKeys",
"(",
"document",
",",
"key",
"->",
"key",
".",
"replace",
"(",
"TO_REPLACE_DOTS",
",",
"\".\"",
")",
",",
"TO_REPLACE_DOTS",
")",
";",
"}"
] | Restore all the dots in the keys where {@link #TO_REPLACE_DOTS} is found.
@param document Document to modify
@return Restored document | [
"Restore",
"all",
"the",
"dots",
"in",
"the",
"keys",
"where",
"{"
] | train | https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/GenericDocumentComplexConverter.java#L118-L120 |
Jasig/uPortal | uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ConcurrentMapUtils.java | ConcurrentMapUtils.putIfAbsent | public static <K, V> V putIfAbsent(ConcurrentMap<K, V> map, K key, V value) {
final V existingValue = map.putIfAbsent(key, value);
if (existingValue == null) {
return value;
}
return existingValue;
} | java | public static <K, V> V putIfAbsent(ConcurrentMap<K, V> map, K key, V value) {
final V existingValue = map.putIfAbsent(key, value);
if (existingValue == null) {
return value;
}
return existingValue;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"V",
"putIfAbsent",
"(",
"ConcurrentMap",
"<",
"K",
",",
"V",
">",
"map",
",",
"K",
"key",
",",
"V",
"value",
")",
"{",
"final",
"V",
"existingValue",
"=",
"map",
".",
"putIfAbsent",
"(",
"key",
",",
"... | How putIfAbsent should work, returns the one value that actually ends up in the {@link
ConcurrentMap}
@param map The map
@param key The key
@param value The value to put
@return The value that exists in the Map for this key at the point in time that {@link
ConcurrentMap#putIfAbsent(Object, Object)} is called | [
"How",
"putIfAbsent",
"should",
"work",
"returns",
"the",
"one",
"value",
"that",
"actually",
"ends",
"up",
"in",
"the",
"{",
"@link",
"ConcurrentMap",
"}"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ConcurrentMapUtils.java#L35-L42 |
alkacon/opencms-core | src/org/opencms/file/CmsProject.java | CmsProject.isInsideProject | public static boolean isInsideProject(List<String> projectResources, CmsResource resource) {
String resourcename = resource.getRootPath();
return isInsideProject(projectResources, resourcename);
} | java | public static boolean isInsideProject(List<String> projectResources, CmsResource resource) {
String resourcename = resource.getRootPath();
return isInsideProject(projectResources, resourcename);
} | [
"public",
"static",
"boolean",
"isInsideProject",
"(",
"List",
"<",
"String",
">",
"projectResources",
",",
"CmsResource",
"resource",
")",
"{",
"String",
"resourcename",
"=",
"resource",
".",
"getRootPath",
"(",
")",
";",
"return",
"isInsideProject",
"(",
"proj... | Checks if the full resource name (including the site root) of a resource matches
any of the project resources of a project.<p>
@param projectResources a List of project resources as Strings
@param resource the resource to check
@return true, if the resource is "inside" the project resources | [
"Checks",
"if",
"the",
"full",
"resource",
"name",
"(",
"including",
"the",
"site",
"root",
")",
"of",
"a",
"resource",
"matches",
"any",
"of",
"the",
"project",
"resources",
"of",
"a",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsProject.java#L226-L230 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeValue | @Pure
public static String getAttributeValue(Node document, boolean casesSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeValue(document, casesSensitive, 0, path);
} | java | @Pure
public static String getAttributeValue(Node document, boolean casesSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeValue(document, casesSensitive, 0, path);
} | [
"@",
"Pure",
"public",
"static",
"String",
"getAttributeValue",
"(",
"Node",
"document",
",",
"boolean",
"casesSensitive",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")"... | Replies the value that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
@param document is the XML document to explore.
@param casesSensitive indicates of the {@code path}'s components are case sensitive.
@param path is the list of and ended by the attribute's name.
@return the value of the specified attribute or <code>null</code> if
it was node found in the document | [
"Replies",
"the",
"value",
"that",
"corresponds",
"to",
"the",
"specified",
"attribute",
"s",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1235-L1239 |
gwtplus/google-gin | src/main/java/com/google/gwt/inject/rebind/resolution/BindingInstaller.java | BindingInstaller.ensureAccessible | private void ensureAccessible(Key<?> key, GinjectorBindings parent, GinjectorBindings child) {
// Parent will be null if it is was an optional dependency and it couldn't be created.
if (parent != null && !child.equals(parent) && !child.isBound(key)) {
PrettyPrinter.log(logger, TreeLogger.DEBUG,
"In %s: inheriting binding for %s from the parent %s", child, key, parent);
Context context = Context.format("Inheriting %s from parent", key);
// We don't strictly need all the extra checks in addBinding, but it can't hurt. We know, for
// example, that there will not be any unresolved bindings for this key.
child.addBinding(key, bindingFactory.getParentBinding(key, parent, context));
}
} | java | private void ensureAccessible(Key<?> key, GinjectorBindings parent, GinjectorBindings child) {
// Parent will be null if it is was an optional dependency and it couldn't be created.
if (parent != null && !child.equals(parent) && !child.isBound(key)) {
PrettyPrinter.log(logger, TreeLogger.DEBUG,
"In %s: inheriting binding for %s from the parent %s", child, key, parent);
Context context = Context.format("Inheriting %s from parent", key);
// We don't strictly need all the extra checks in addBinding, but it can't hurt. We know, for
// example, that there will not be any unresolved bindings for this key.
child.addBinding(key, bindingFactory.getParentBinding(key, parent, context));
}
} | [
"private",
"void",
"ensureAccessible",
"(",
"Key",
"<",
"?",
">",
"key",
",",
"GinjectorBindings",
"parent",
",",
"GinjectorBindings",
"child",
")",
"{",
"// Parent will be null if it is was an optional dependency and it couldn't be created.",
"if",
"(",
"parent",
"!=",
"... | Ensure that the binding for key which exists in the parent Ginjector is also available to the
child Ginjector. | [
"Ensure",
"that",
"the",
"binding",
"for",
"key",
"which",
"exists",
"in",
"the",
"parent",
"Ginjector",
"is",
"also",
"available",
"to",
"the",
"child",
"Ginjector",
"."
] | train | https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/resolution/BindingInstaller.java#L116-L127 |
nabedge/mixer2 | src/main/java/org/mixer2/xhtml/AbstractJaxb.java | AbstractJaxb.setStyleByTreeMap | public <T extends AbstractJaxb> void setStyleByTreeMap(
TreeMap<String, String> styleMap) {
String str = "";
for (String key : styleMap.keySet()) {
str += key + ":" + styleMap.get(key) + "; ";
}
this.setStyle(str);
} | java | public <T extends AbstractJaxb> void setStyleByTreeMap(
TreeMap<String, String> styleMap) {
String str = "";
for (String key : styleMap.keySet()) {
str += key + ":" + styleMap.get(key) + "; ";
}
this.setStyle(str);
} | [
"public",
"<",
"T",
"extends",
"AbstractJaxb",
">",
"void",
"setStyleByTreeMap",
"(",
"TreeMap",
"<",
"String",
",",
"String",
">",
"styleMap",
")",
"{",
"String",
"str",
"=",
"\"\"",
";",
"for",
"(",
"String",
"key",
":",
"styleMap",
".",
"keySet",
"(",... | <p>
write style attribute by TreeMap
</p>
<pre>
// usage:
TreeMap<String, String> styleMap = new TreeMap<String, String>();
styleMap.put("border-color", "red");
html.getById(Div.class, "hellomsg").setStyleByTreeMap(styleMap);
// output:
// <div id="hellomsg" style="border-color:red;">...</div>
</pre>
@param styleMap | [
"<p",
">",
"write",
"style",
"attribute",
"by",
"TreeMap",
"<",
"/",
"p",
">"
] | train | https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/xhtml/AbstractJaxb.java#L551-L558 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.takeWhile | public static <T> List<T> takeWhile(List<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
int num = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
for (T value : self) {
if (bcw.call(value)) {
num += 1;
} else {
break;
}
}
return take(self, num);
} | java | public static <T> List<T> takeWhile(List<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
int num = 0;
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
for (T value : self) {
if (bcw.call(value)) {
num += 1;
} else {
break;
}
}
return take(self, num);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"takeWhile",
"(",
"List",
"<",
"T",
">",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"FirstGenericType",
".",
"class",
")",
"Closure",
"condition",
")",
"{",
"int",
"num",
"=",
... | Returns the longest prefix of this list where each element
passed to the given closure condition evaluates to true.
Similar to {@link #takeWhile(Iterable, groovy.lang.Closure)}
except that it attempts to preserve the type of the original list.
<pre class="groovyTestCase">
def nums = [ 1, 3, 2 ]
assert nums.takeWhile{ it {@code <} 1 } == []
assert nums.takeWhile{ it {@code <} 3 } == [ 1 ]
assert nums.takeWhile{ it {@code <} 4 } == [ 1, 3, 2 ]
</pre>
@param self the original list
@param condition the closure that must evaluate to true to
continue taking elements
@return a prefix of the given list where each element passed to
the given closure evaluates to true
@since 1.8.7 | [
"Returns",
"the",
"longest",
"prefix",
"of",
"this",
"list",
"where",
"each",
"element",
"passed",
"to",
"the",
"given",
"closure",
"condition",
"evaluates",
"to",
"true",
".",
"Similar",
"to",
"{",
"@link",
"#takeWhile",
"(",
"Iterable",
"groovy",
".",
"lan... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L10885-L10896 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.anySatisfy | @Deprecated
public static boolean anySatisfy(String string, CodePointPredicate predicate)
{
return StringIterate.anySatisfyCodePoint(string, predicate);
} | java | @Deprecated
public static boolean anySatisfy(String string, CodePointPredicate predicate)
{
return StringIterate.anySatisfyCodePoint(string, predicate);
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"anySatisfy",
"(",
"String",
"string",
",",
"CodePointPredicate",
"predicate",
")",
"{",
"return",
"StringIterate",
".",
"anySatisfyCodePoint",
"(",
"string",
",",
"predicate",
")",
";",
"}"
] | @return true if any of the code points in the {@code string} answer true for the specified {@code predicate}.
@deprecated since 7.0. Use {@link #anySatisfyCodePoint(String, CodePointPredicate)} instead. | [
"@return",
"true",
"if",
"any",
"of",
"the",
"code",
"points",
"in",
"the",
"{",
"@code",
"string",
"}",
"answer",
"true",
"for",
"the",
"specified",
"{",
"@code",
"predicate",
"}",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L819-L823 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java | AttributedString.mapsDiffer | private static boolean mapsDiffer(Map last, Map attrs) {
if (last == null) {
return (attrs != null && attrs.size() > 0);
}
return (!last.equals(attrs));
} | java | private static boolean mapsDiffer(Map last, Map attrs) {
if (last == null) {
return (attrs != null && attrs.size() > 0);
}
return (!last.equals(attrs));
} | [
"private",
"static",
"boolean",
"mapsDiffer",
"(",
"Map",
"last",
",",
"Map",
"attrs",
")",
"{",
"if",
"(",
"last",
"==",
"null",
")",
"{",
"return",
"(",
"attrs",
"!=",
"null",
"&&",
"attrs",
".",
"size",
"(",
")",
">",
"0",
")",
";",
"}",
"retu... | Returns true if the attributes specified in last and attrs differ. | [
"Returns",
"true",
"if",
"the",
"attributes",
"specified",
"in",
"last",
"and",
"attrs",
"differ",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L720-L725 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.price_GET | public OvhPrice price_GET(String flavorId, String region) throws IOException {
String qPath = "/cloud/price";
StringBuilder sb = path(qPath);
query(sb, "flavorId", flavorId);
query(sb, "region", region);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | java | public OvhPrice price_GET(String flavorId, String region) throws IOException {
String qPath = "/cloud/price";
StringBuilder sb = path(qPath);
query(sb, "flavorId", flavorId);
query(sb, "region", region);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | [
"public",
"OvhPrice",
"price_GET",
"(",
"String",
"flavorId",
",",
"String",
"region",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/price\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query",
"(",
"sb",
",",
... | Get services prices
REST: GET /cloud/price
@param region [required] Region
@param flavorId [required] OVH cloud flavor id
@deprecated | [
"Get",
"services",
"prices"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2388-L2395 |
fuinorg/srcgen4javassist | src/main/java/org/fuin/srcgen4javassist/SgUtils.java | SgUtils.checkFieldModifiers | public static void checkFieldModifiers(final int modifiers) {
// Basic checks
checkModifiers(FIELD, modifiers);
// Check final and volatile
if (Modifier.isFinal(modifiers) && Modifier.isVolatile(modifiers)) {
throw new IllegalArgumentException(FIELD_FINAL_VOLATILE_ERROR + " ["
+ Modifier.toString(modifiers) + "]");
}
} | java | public static void checkFieldModifiers(final int modifiers) {
// Basic checks
checkModifiers(FIELD, modifiers);
// Check final and volatile
if (Modifier.isFinal(modifiers) && Modifier.isVolatile(modifiers)) {
throw new IllegalArgumentException(FIELD_FINAL_VOLATILE_ERROR + " ["
+ Modifier.toString(modifiers) + "]");
}
} | [
"public",
"static",
"void",
"checkFieldModifiers",
"(",
"final",
"int",
"modifiers",
")",
"{",
"// Basic checks\r",
"checkModifiers",
"(",
"FIELD",
",",
"modifiers",
")",
";",
"// Check final and volatile\r",
"if",
"(",
"Modifier",
".",
"isFinal",
"(",
"modifiers",
... | Checks if the modifiers are valid for a field. If any of the modifiers is
not valid an <code>IllegalArgumentException</code> is thrown.
@param modifiers
Modifiers. | [
"Checks",
"if",
"the",
"modifiers",
"are",
"valid",
"for",
"a",
"field",
".",
"If",
"any",
"of",
"the",
"modifiers",
"is",
"not",
"valid",
"an",
"<code",
">",
"IllegalArgumentException<",
"/",
"code",
">",
"is",
"thrown",
"."
] | train | https://github.com/fuinorg/srcgen4javassist/blob/355828113cfce3cdd3d69ba242c5bdfc7d899f2f/src/main/java/org/fuin/srcgen4javassist/SgUtils.java#L189-L200 |
ManfredTremmel/gwt-bean-validators | gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/CollectionUtils.java | CollectionUtils.findFirstMatch | @SuppressWarnings("unchecked")
@Nullable
public static <E> E findFirstMatch(final Collection<?> source, final Collection<E> candidates) {
if (CollectionUtils.isEmpty(source) || CollectionUtils.isEmpty(candidates)) {
return null;
}
for (final Object candidate : candidates) {
if (source.contains(candidate)) {
return (E) candidate;
}
}
return null;
} | java | @SuppressWarnings("unchecked")
@Nullable
public static <E> E findFirstMatch(final Collection<?> source, final Collection<E> candidates) {
if (CollectionUtils.isEmpty(source) || CollectionUtils.isEmpty(candidates)) {
return null;
}
for (final Object candidate : candidates) {
if (source.contains(candidate)) {
return (E) candidate;
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Nullable",
"public",
"static",
"<",
"E",
">",
"E",
"findFirstMatch",
"(",
"final",
"Collection",
"<",
"?",
">",
"source",
",",
"final",
"Collection",
"<",
"E",
">",
"candidates",
")",
"{",
"if",
"... | Return the first element in '{@code candidates}' that is contained in '{@code source}'. If no
element in '{@code candidates}' is present in '{@code source}' returns {@code null}. Iteration
order is {@link Collection} implementation specific.
@param source the source Collection
@param candidates the candidates to search for
@return the first present object, or {@code null} if not found | [
"Return",
"the",
"first",
"element",
"in",
"{",
"@code",
"candidates",
"}",
"that",
"is",
"contained",
"in",
"{",
"@code",
"source",
"}",
".",
"If",
"no",
"element",
"in",
"{",
"@code",
"candidates",
"}",
"is",
"present",
"in",
"{",
"@code",
"source",
... | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/CollectionUtils.java#L220-L232 |
indeedeng/util | util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java | Quicksortables.vecswap | private static void vecswap(Quicksortable q, int a, int b, int n) {
for (int i = 0; i < n; i++, a++, b++)
q.swap(a, b);
} | java | private static void vecswap(Quicksortable q, int a, int b, int n) {
for (int i = 0; i < n; i++, a++, b++)
q.swap(a, b);
} | [
"private",
"static",
"void",
"vecswap",
"(",
"Quicksortable",
"q",
",",
"int",
"a",
",",
"int",
"b",
",",
"int",
"n",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
",",
"a",
"++",
",",
"b",
"++",
")",
"q",
... | Swaps x[a .. (a+n-1)] with x[b .. (b+n-1)].
@param q The quicksortable.
@param a The first pointer to swap
@param b The second pointer to swap
@param n The number of elements to swap | [
"Swaps",
"x",
"[",
"a",
"..",
"(",
"a",
"+",
"n",
"-",
"1",
")",
"]",
"with",
"x",
"[",
"b",
"..",
"(",
"b",
"+",
"n",
"-",
"1",
")",
"]",
"."
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L221-L224 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/multi/MultiMediaManager.java | MultiMediaManager.createMediaSession | @Override
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
for (JingleMediaManager manager : managers) {
if (manager.getPayloads().contains(payloadType)) {
return manager.createMediaSession(payloadType, remote, local, jingleSession);
}
}
return null;
} | java | @Override
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
for (JingleMediaManager manager : managers) {
if (manager.getPayloads().contains(payloadType)) {
return manager.createMediaSession(payloadType, remote, local, jingleSession);
}
}
return null;
} | [
"@",
"Override",
"public",
"JingleMediaSession",
"createMediaSession",
"(",
"PayloadType",
"payloadType",
",",
"final",
"TransportCandidate",
"remote",
",",
"final",
"TransportCandidate",
"local",
",",
"final",
"JingleSession",
"jingleSession",
")",
"{",
"for",
"(",
"... | Returns a new JingleMediaSession.
@param payloadType payloadType
@param remote remote Candidate
@param local local Candidate
@return JingleMediaSession JingleMediaSession | [
"Returns",
"a",
"new",
"JingleMediaSession",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/multi/MultiMediaManager.java#L82-L90 |
gondor/kbop | src/main/java/org/pacesys/kbop/internal/AbstractKeyedObjectPool.java | AbstractKeyedObjectPool.await | protected boolean await(final PoolWaitFuture<E> future, final PoolKey<K> key, Date deadline) throws InterruptedException {
try
{
waiting.add(future);
return future.await(deadline);
}
finally {
waiting.remove(future);
}
} | java | protected boolean await(final PoolWaitFuture<E> future, final PoolKey<K> key, Date deadline) throws InterruptedException {
try
{
waiting.add(future);
return future.await(deadline);
}
finally {
waiting.remove(future);
}
} | [
"protected",
"boolean",
"await",
"(",
"final",
"PoolWaitFuture",
"<",
"E",
">",
"future",
",",
"final",
"PoolKey",
"<",
"K",
">",
"key",
",",
"Date",
"deadline",
")",
"throws",
"InterruptedException",
"{",
"try",
"{",
"waiting",
".",
"add",
"(",
"future",
... | Adds the current PoolWaitFuture into the waiting list. The future will wait up until the specified deadline. If the future is woken up before the
specified deadline then true is returned otherwise false. The future will always be removed from the wait list regardless
of the outcome.
@param future the PoolWaitFuture who is waiting for an object
@param key the Pool Key associated with this wait
@param deadline the max timeout to wait for
@return true if
@throws InterruptedException the interrupted exception | [
"Adds",
"the",
"current",
"PoolWaitFuture",
"into",
"the",
"waiting",
"list",
".",
"The",
"future",
"will",
"wait",
"up",
"until",
"the",
"specified",
"deadline",
".",
"If",
"the",
"future",
"is",
"woken",
"up",
"before",
"the",
"specified",
"deadline",
"the... | train | https://github.com/gondor/kbop/blob/a176fd845f1e146610f03a1cb3cb0d661ebf4faa/src/main/java/org/pacesys/kbop/internal/AbstractKeyedObjectPool.java#L217-L226 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java | SeleniumHelper.clickWithKeyDown | public void clickWithKeyDown(WebElement element, CharSequence key) {
getActions().keyDown(key).click(element).keyUp(key).perform();
} | java | public void clickWithKeyDown(WebElement element, CharSequence key) {
getActions().keyDown(key).click(element).keyUp(key).perform();
} | [
"public",
"void",
"clickWithKeyDown",
"(",
"WebElement",
"element",
",",
"CharSequence",
"key",
")",
"{",
"getActions",
"(",
")",
".",
"keyDown",
"(",
"key",
")",
".",
"click",
"(",
"element",
")",
".",
"keyUp",
"(",
"key",
")",
".",
"perform",
"(",
")... | Simulates clicking with the supplied key pressed on the supplied element.
Key will be released after click.
@param element element to click on | [
"Simulates",
"clicking",
"with",
"the",
"supplied",
"key",
"pressed",
"on",
"the",
"supplied",
"element",
".",
"Key",
"will",
"be",
"released",
"after",
"click",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L573-L575 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java | AbstractCodeGen.writeSimpleMethodSignature | protected void writeSimpleMethodSignature(Writer out, int indent, String javadoc, String signature)
throws IOException
{
writeWithIndent(out, indent, "/**\n");
writeIndent(out, indent);
out.write(javadoc);
writeEol(out);
writeWithIndent(out, indent, " */\n");
writeIndent(out, indent);
out.write(signature);
} | java | protected void writeSimpleMethodSignature(Writer out, int indent, String javadoc, String signature)
throws IOException
{
writeWithIndent(out, indent, "/**\n");
writeIndent(out, indent);
out.write(javadoc);
writeEol(out);
writeWithIndent(out, indent, " */\n");
writeIndent(out, indent);
out.write(signature);
} | [
"protected",
"void",
"writeSimpleMethodSignature",
"(",
"Writer",
"out",
",",
"int",
"indent",
",",
"String",
"javadoc",
",",
"String",
"signature",
")",
"throws",
"IOException",
"{",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\"/**\\n\"",
")",
";",
"... | write a simple method signature
@param out the writer
@param indent indent
@param javadoc javadoc strinf
@param signature signatore of the method
@throws IOException excption | [
"write",
"a",
"simple",
"method",
"signature"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java#L93-L104 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.listCapabilities | public List<CapabilityInner> listCapabilities(String resourceGroupName, String name) {
return listCapabilitiesWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public List<CapabilityInner> listCapabilities(String resourceGroupName, String name) {
return listCapabilitiesWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"List",
"<",
"CapabilityInner",
">",
"listCapabilities",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"listCapabilitiesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
"."... | List all capabilities of an App Service plan.
List all capabilities of an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@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 List<CapabilityInner> object if successful. | [
"List",
"all",
"capabilities",
"of",
"an",
"App",
"Service",
"plan",
".",
"List",
"all",
"capabilities",
"of",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1043-L1045 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/WSEJBProxy.java | WSEJBProxy.addEJBMethod | private static void addEJBMethod(ClassWriter cw,
String className,
String implClassName,
Method method)
{
GeneratorAdapter mg;
String methodName = method.getName();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, INDENT + "adding method : " + methodName + " " +
MethodAttribUtils.jdiMethodSignature(method) +
" : isBridge = " + method.isBridge() +
" : aroundInvoke = false");
// Convert the return value, arguments, and exception classes to
// ASM Type objects, and create the ASM Method object which will
// be used to actually add the method and method code.
Type returnType = Type.getType(method.getReturnType());
Type[] argTypes = getTypes(method.getParameterTypes());
Type[] exceptionTypes = getTypes(method.getExceptionTypes());
org.objectweb.asm.commons.Method m =
new org.objectweb.asm.commons.Method(methodName,
returnType,
argTypes);
// Create an ASM GeneratorAdapter object for the ASM Method, which
// makes generating dynamic code much easier... as it keeps track
// of the position of the arguements and local variables, etc.
mg = new GeneratorAdapter(ACC_PUBLIC, m, null, exceptionTypes, cw);
// -----------------------------------------------------------------------
// Begin Method Code...
// -----------------------------------------------------------------------
mg.visitCode();
// -----------------------------------------------------------------------
// Now invoke the business method;
// - Directly, by calling the method on the bean instance.
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// ((bean impl)ivEjbInstance).<method>(<args...>);
// or
// return ((bean impl)ivEjbInstance).<method>(<args...>);
// -----------------------------------------------------------------------
Type implType = Type.getType("L" + implClassName + ";");
mg.loadThis();
mg.visitFieldInsn(GETFIELD, className, "ivEjbInstance", "Ljava/lang/Object;");
mg.checkCast(implType);
mg.loadArgs(0, argTypes.length); // do not pass "this"
mg.visitMethodInsn(INVOKEVIRTUAL, implClassName, methodName,
m.getDescriptor());
// -----------------------------------------------------------------------
// return
// -----------------------------------------------------------------------
mg.returnValue();
// -----------------------------------------------------------------------
// End Method Code...
// -----------------------------------------------------------------------
mg.endMethod(); // GeneratorAdapter accounts for visitMaxs(x,y)
mg.visitEnd();
} | java | private static void addEJBMethod(ClassWriter cw,
String className,
String implClassName,
Method method)
{
GeneratorAdapter mg;
String methodName = method.getName();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, INDENT + "adding method : " + methodName + " " +
MethodAttribUtils.jdiMethodSignature(method) +
" : isBridge = " + method.isBridge() +
" : aroundInvoke = false");
// Convert the return value, arguments, and exception classes to
// ASM Type objects, and create the ASM Method object which will
// be used to actually add the method and method code.
Type returnType = Type.getType(method.getReturnType());
Type[] argTypes = getTypes(method.getParameterTypes());
Type[] exceptionTypes = getTypes(method.getExceptionTypes());
org.objectweb.asm.commons.Method m =
new org.objectweb.asm.commons.Method(methodName,
returnType,
argTypes);
// Create an ASM GeneratorAdapter object for the ASM Method, which
// makes generating dynamic code much easier... as it keeps track
// of the position of the arguements and local variables, etc.
mg = new GeneratorAdapter(ACC_PUBLIC, m, null, exceptionTypes, cw);
// -----------------------------------------------------------------------
// Begin Method Code...
// -----------------------------------------------------------------------
mg.visitCode();
// -----------------------------------------------------------------------
// Now invoke the business method;
// - Directly, by calling the method on the bean instance.
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// ((bean impl)ivEjbInstance).<method>(<args...>);
// or
// return ((bean impl)ivEjbInstance).<method>(<args...>);
// -----------------------------------------------------------------------
Type implType = Type.getType("L" + implClassName + ";");
mg.loadThis();
mg.visitFieldInsn(GETFIELD, className, "ivEjbInstance", "Ljava/lang/Object;");
mg.checkCast(implType);
mg.loadArgs(0, argTypes.length); // do not pass "this"
mg.visitMethodInsn(INVOKEVIRTUAL, implClassName, methodName,
m.getDescriptor());
// -----------------------------------------------------------------------
// return
// -----------------------------------------------------------------------
mg.returnValue();
// -----------------------------------------------------------------------
// End Method Code...
// -----------------------------------------------------------------------
mg.endMethod(); // GeneratorAdapter accounts for visitMaxs(x,y)
mg.visitEnd();
} | [
"private",
"static",
"void",
"addEJBMethod",
"(",
"ClassWriter",
"cw",
",",
"String",
"className",
",",
"String",
"implClassName",
",",
"Method",
"method",
")",
"{",
"GeneratorAdapter",
"mg",
";",
"String",
"methodName",
"=",
"method",
".",
"getName",
"(",
")"... | Adds a standard EJB Proxy Method. <p>
The method added just calls the EJB instance method directly. <p>
@param cw ASM Class writer to add the method to.
@param className name of the proxy class being generated.
@param implClassName name of the EJB implementation class.
@param method reflection method from the interface defining
method to be added to the proxy. | [
"Adds",
"a",
"standard",
"EJB",
"Proxy",
"Method",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/WSEJBProxy.java#L256-L320 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.listWaterMark | public ListWaterMarkResponse listWaterMark(ListWaterMarkRequest request) {
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, WATER_MARK);
return invokeHttpClient(internalRequest, ListWaterMarkResponse.class);
} | java | public ListWaterMarkResponse listWaterMark(ListWaterMarkRequest request) {
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, WATER_MARK);
return invokeHttpClient(internalRequest, ListWaterMarkResponse.class);
} | [
"public",
"ListWaterMarkResponse",
"listWaterMark",
"(",
"ListWaterMarkRequest",
"request",
")",
"{",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"HttpMethodName",
".",
"GET",
",",
"request",
",",
"WATER_MARK",
")",
";",
"return",
"invokeHttpClient"... | List all water mark.
@return The list of all user's water mark. | [
"List",
"all",
"water",
"mark",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L1151-L1155 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java | CommonOps_DSCC.permuteInv | public static void permuteInv( int[] perm , double []input , double[]output , int N ) {
for (int k = 0; k < N; k++) {
output[perm[k]] = input[k];
}
} | java | public static void permuteInv( int[] perm , double []input , double[]output , int N ) {
for (int k = 0; k < N; k++) {
output[perm[k]] = input[k];
}
} | [
"public",
"static",
"void",
"permuteInv",
"(",
"int",
"[",
"]",
"perm",
",",
"double",
"[",
"]",
"input",
",",
"double",
"[",
"]",
"output",
",",
"int",
"N",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"N",
";",
"k",
"++",
")",... | Permutes a vector in the inverse. output[perm[k]] = input[k]
@param perm (Input) permutation vector
@param input (Input) Vector which is to be permuted
@param output (Output) Where the permuted vector is stored.
@param N Number of elements in the vector. | [
"Permutes",
"a",
"vector",
"in",
"the",
"inverse",
".",
"output",
"[",
"perm",
"[",
"k",
"]]",
"=",
"input",
"[",
"k",
"]"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L967-L971 |
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java | UnsafeOperations.deepSizeOf | public final long deepSizeOf(Object o) {
IdentityHashMap<Object, Boolean> seenObjects = new IdentityHashMap<Object, Boolean>(10);
return doDeepSizeOf(o, seenObjects);
} | java | public final long deepSizeOf(Object o) {
IdentityHashMap<Object, Boolean> seenObjects = new IdentityHashMap<Object, Boolean>(10);
return doDeepSizeOf(o, seenObjects);
} | [
"public",
"final",
"long",
"deepSizeOf",
"(",
"Object",
"o",
")",
"{",
"IdentityHashMap",
"<",
"Object",
",",
"Boolean",
">",
"seenObjects",
"=",
"new",
"IdentityHashMap",
"<",
"Object",
",",
"Boolean",
">",
"(",
"10",
")",
";",
"return",
"doDeepSizeOf",
"... | Determines the deep memory size of the given object (object or array), visiting all its references
@param o The object instance to calculate the deep size for
@return Size in bytes | [
"Determines",
"the",
"deep",
"memory",
"size",
"of",
"the",
"given",
"object",
"(",
"object",
"or",
"array",
")",
"visiting",
"all",
"its",
"references"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L670-L674 |
d-sauer/JCalcAPI | src/main/java/org/jdice/calc/Num.java | Num.isEqual | public boolean isEqual(Object value, int scale, Rounding rounding) {
Num numA = this;
Num numB = null;
if (value instanceof Num)
numB = (Num) value;
else
numB = new Num(value);
BigDecimal a = numA.toBigDecimal();
BigDecimal b = numB.toBigDecimal();
if (rounding != null) {
a = a.setScale(scale, rounding.getBigDecimalRound());
b = b.setScale(scale, rounding.getBigDecimalRound());
} else {
a = a.setScale(scale, getProperties().getRoundingMode().getBigDecimalRound());
b = b.setScale(scale, getProperties().getRoundingMode().getBigDecimalRound());
}
return a.equals(b);
} | java | public boolean isEqual(Object value, int scale, Rounding rounding) {
Num numA = this;
Num numB = null;
if (value instanceof Num)
numB = (Num) value;
else
numB = new Num(value);
BigDecimal a = numA.toBigDecimal();
BigDecimal b = numB.toBigDecimal();
if (rounding != null) {
a = a.setScale(scale, rounding.getBigDecimalRound());
b = b.setScale(scale, rounding.getBigDecimalRound());
} else {
a = a.setScale(scale, getProperties().getRoundingMode().getBigDecimalRound());
b = b.setScale(scale, getProperties().getRoundingMode().getBigDecimalRound());
}
return a.equals(b);
} | [
"public",
"boolean",
"isEqual",
"(",
"Object",
"value",
",",
"int",
"scale",
",",
"Rounding",
"rounding",
")",
"{",
"Num",
"numA",
"=",
"this",
";",
"Num",
"numB",
"=",
"null",
";",
"if",
"(",
"value",
"instanceof",
"Num",
")",
"numB",
"=",
"(",
"Num... | Convert <tt>value</tt> to {@link Num}, and scale both value before
comparing them.
@param value
@return | [
"Convert",
"<tt",
">",
"value<",
"/",
"tt",
">",
"to",
"{",
"@link",
"Num",
"}",
"and",
"scale",
"both",
"value",
"before",
"comparing",
"them",
"."
] | train | https://github.com/d-sauer/JCalcAPI/blob/36ae1f9adfe611a6f1bd8ef87cf1dc0ec88ac035/src/main/java/org/jdice/calc/Num.java#L720-L740 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java | HashtableOnDisk.createInstance | static public long createInstance(FileManager fm,
int tablesize,
int load)
throws IOException,
HashtableOnDiskException {
HashHeader header = new HashHeader(fm, magic, load, tablesize);
return header.disklocation;
} | java | static public long createInstance(FileManager fm,
int tablesize,
int load)
throws IOException,
HashtableOnDiskException {
HashHeader header = new HashHeader(fm, magic, load, tablesize);
return header.disklocation;
} | [
"static",
"public",
"long",
"createInstance",
"(",
"FileManager",
"fm",
",",
"int",
"tablesize",
",",
"int",
"load",
")",
"throws",
"IOException",
",",
"HashtableOnDiskException",
"{",
"HashHeader",
"header",
"=",
"new",
"HashHeader",
"(",
"fm",
",",
"magic",
... | ***********************************************************************
createInstance Creates a new instance of a HTOD and stores a pointer
to its header on disk so it can be retrived later, when
reinitializing the HTOD.
@param filemgr The FileManager instance over which the HTOD is
implemented.
@param instanceid The unique id for this new instance. If a persistent
structure already exists with this instance the
createInstance method will return false.
@param tablesize The initial number of entries in the hashtable.
@param load The hashtable load factor. This is what determines when
the hashtable automatically increases its size. Let
num_objects the number of objects in the hashtable, and
ht_size be the number of buckets. When
num_objects > (tablesize * load) the hashtable will automatically
double the number of buckets and rehash each existing object.
Note that is is used only if auto_rehash is "true" when
instantiating the HTOD object via getInstance.
@return true if the instance was created
@return false if an instance with the specified id already exists.
*********************************************************************** | [
"***********************************************************************",
"createInstance",
"Creates",
"a",
"new",
"instance",
"of",
"a",
"HTOD",
"and",
"stores",
"a",
"pointer",
"to",
"its",
"header",
"on",
"disk",
"so",
"it",
"can",
"be",
"retrived",
"later",
"when... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L428-L435 |
arquillian/arquillian-cube | openshift/openshift/src/main/java/org/arquillian/cube/openshift/impl/resources/OpenShiftResourceFactory.java | OpenShiftResourceFactory.createImageStreamRequest | private static String createImageStreamRequest(String name, String version, String image, boolean insecure) {
JSONObject imageStream = new JSONObject();
JSONObject metadata = new JSONObject();
JSONObject annotations = new JSONObject();
metadata.put("name", name);
annotations.put("openshift.io/image.insecureRepository", insecure);
metadata.put("annotations", annotations);
// Definition of the image
JSONObject from = new JSONObject();
from.put("kind", "DockerImage");
from.put("name", image);
JSONObject importPolicy = new JSONObject();
importPolicy.put("insecure", insecure);
JSONObject tag = new JSONObject();
tag.put("name", version);
tag.put("from", from);
tag.put("importPolicy", importPolicy);
JSONObject tagAnnotations = new JSONObject();
tagAnnotations.put("version", version);
tag.put("annotations", tagAnnotations);
JSONArray tags = new JSONArray();
tags.add(tag);
// Add image definition to image stream
JSONObject spec = new JSONObject();
spec.put("tags", tags);
imageStream.put("kind", "ImageStream");
imageStream.put("apiVersion", "v1");
imageStream.put("metadata", metadata);
imageStream.put("spec", spec);
return imageStream.toJSONString();
} | java | private static String createImageStreamRequest(String name, String version, String image, boolean insecure) {
JSONObject imageStream = new JSONObject();
JSONObject metadata = new JSONObject();
JSONObject annotations = new JSONObject();
metadata.put("name", name);
annotations.put("openshift.io/image.insecureRepository", insecure);
metadata.put("annotations", annotations);
// Definition of the image
JSONObject from = new JSONObject();
from.put("kind", "DockerImage");
from.put("name", image);
JSONObject importPolicy = new JSONObject();
importPolicy.put("insecure", insecure);
JSONObject tag = new JSONObject();
tag.put("name", version);
tag.put("from", from);
tag.put("importPolicy", importPolicy);
JSONObject tagAnnotations = new JSONObject();
tagAnnotations.put("version", version);
tag.put("annotations", tagAnnotations);
JSONArray tags = new JSONArray();
tags.add(tag);
// Add image definition to image stream
JSONObject spec = new JSONObject();
spec.put("tags", tags);
imageStream.put("kind", "ImageStream");
imageStream.put("apiVersion", "v1");
imageStream.put("metadata", metadata);
imageStream.put("spec", spec);
return imageStream.toJSONString();
} | [
"private",
"static",
"String",
"createImageStreamRequest",
"(",
"String",
"name",
",",
"String",
"version",
",",
"String",
"image",
",",
"boolean",
"insecure",
")",
"{",
"JSONObject",
"imageStream",
"=",
"new",
"JSONObject",
"(",
")",
";",
"JSONObject",
"metadat... | Creates image stream request and returns it in JSON formatted string.
@param name Name of the image stream
@param insecure If the registry where the image is stored is insecure
@param image Image name, includes registry information and tag
@param version Image stream version.
@return JSON formatted string | [
"Creates",
"image",
"stream",
"request",
"and",
"returns",
"it",
"in",
"JSON",
"formatted",
"string",
"."
] | train | https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/openshift/openshift/src/main/java/org/arquillian/cube/openshift/impl/resources/OpenShiftResourceFactory.java#L159-L198 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getActionOutput | public static Object getActionOutput( String name, ServletRequest request )
{
Map map = InternalUtils.getActionOutputMap( request, false );
return map != null ? map.get( name ) : null;
} | java | public static Object getActionOutput( String name, ServletRequest request )
{
Map map = InternalUtils.getActionOutputMap( request, false );
return map != null ? map.get( name ) : null;
} | [
"public",
"static",
"Object",
"getActionOutput",
"(",
"String",
"name",
",",
"ServletRequest",
"request",
")",
"{",
"Map",
"map",
"=",
"InternalUtils",
".",
"getActionOutputMap",
"(",
"request",
",",
"false",
")",
";",
"return",
"map",
"!=",
"null",
"?",
"ma... | Get a named action output that was registered in the current request.
@param name the name of the action output.
@param request the current ServletRequest
@see #addActionOutput | [
"Get",
"a",
"named",
"action",
"output",
"that",
"was",
"registered",
"in",
"the",
"current",
"request",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L969-L973 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/IntArray.java | IntArray.getInstance | public static IntArray getInstance(int[] buffer, int offset, int length)
{
return getInstance(IntBuffer.wrap(buffer, offset, length));
} | java | public static IntArray getInstance(int[] buffer, int offset, int length)
{
return getInstance(IntBuffer.wrap(buffer, offset, length));
} | [
"public",
"static",
"IntArray",
"getInstance",
"(",
"int",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"getInstance",
"(",
"IntBuffer",
".",
"wrap",
"(",
"buffer",
",",
"offset",
",",
"length",
")",
")",
";",
"}"... | Creates IntArray backed by int array
@param buffer
@param offset
@param length
@return | [
"Creates",
"IntArray",
"backed",
"by",
"int",
"array"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/IntArray.java#L137-L140 |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java | ContextTreeRenderer.isHidden | @SuppressWarnings("checkstyle:BooleanExpressionComplexity")
private boolean isHidden(final ContextTreeConfig config, final ItemInfo info, final Class<?> scope) {
// item explicitly hidden
final boolean hidden = config.getHiddenItems().contains(info.getItemType());
// installer disabled
final boolean disabled = config.isHideDisables() && isDisabled(info);
// duplicate registration
final boolean ignored = config.isHideDuplicateRegistrations() && isDuplicateRegistration(info, scope);
// item in scope hidden by config (special case for bundle: when its hidden by config)
final boolean hiddenScope = !isScopeVisible(config, null, scope) || isHiddenBundle(config, info);
// installer without any extension
final boolean notUsedInstaller = config.isHideNotUsedInstallers() && isNotUsedInstaller(info);
return hidden
|| disabled
|| ignored
|| hiddenScope
|| notUsedInstaller;
} | java | @SuppressWarnings("checkstyle:BooleanExpressionComplexity")
private boolean isHidden(final ContextTreeConfig config, final ItemInfo info, final Class<?> scope) {
// item explicitly hidden
final boolean hidden = config.getHiddenItems().contains(info.getItemType());
// installer disabled
final boolean disabled = config.isHideDisables() && isDisabled(info);
// duplicate registration
final boolean ignored = config.isHideDuplicateRegistrations() && isDuplicateRegistration(info, scope);
// item in scope hidden by config (special case for bundle: when its hidden by config)
final boolean hiddenScope = !isScopeVisible(config, null, scope) || isHiddenBundle(config, info);
// installer without any extension
final boolean notUsedInstaller = config.isHideNotUsedInstallers() && isNotUsedInstaller(info);
return hidden
|| disabled
|| ignored
|| hiddenScope
|| notUsedInstaller;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:BooleanExpressionComplexity\"",
")",
"private",
"boolean",
"isHidden",
"(",
"final",
"ContextTreeConfig",
"config",
",",
"final",
"ItemInfo",
"info",
",",
"final",
"Class",
"<",
"?",
">",
"scope",
")",
"{",
"// item explic... | Checks element visibility according to config. Universal place to check visibility for either simple config
items or bundles and special scopes.
@param config tree configuration
@param info current item info
@param scope current item rendering scope
@return true if item is hidden, false otherwise | [
"Checks",
"element",
"visibility",
"according",
"to",
"config",
".",
"Universal",
"place",
"to",
"check",
"visibility",
"for",
"either",
"simple",
"config",
"items",
"or",
"bundles",
"and",
"special",
"scopes",
"."
] | train | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java#L203-L220 |
auth0/auth0-java | src/main/java/com/auth0/json/mgmt/guardian/TwilioFactorProvider.java | TwilioFactorProvider.setFrom | @Deprecated
@JsonProperty("from")
public void setFrom(String from) throws IllegalArgumentException {
if (messagingServiceSID != null) {
throw new IllegalArgumentException("You must specify either `from` or `messagingServiceSID`, but not both");
}
this.from = from;
} | java | @Deprecated
@JsonProperty("from")
public void setFrom(String from) throws IllegalArgumentException {
if (messagingServiceSID != null) {
throw new IllegalArgumentException("You must specify either `from` or `messagingServiceSID`, but not both");
}
this.from = from;
} | [
"@",
"Deprecated",
"@",
"JsonProperty",
"(",
"\"from\"",
")",
"public",
"void",
"setFrom",
"(",
"String",
"from",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"messagingServiceSID",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Setter for the Twilio From number.
@param from the from number to set.
@throws IllegalArgumentException when both `from` and `messagingServiceSID` are set
@deprecated use the constructor instead | [
"Setter",
"for",
"the",
"Twilio",
"From",
"number",
"."
] | train | https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/json/mgmt/guardian/TwilioFactorProvider.java#L75-L82 |
cloudfoundry/cf-java-client | cloudfoundry-util/src/main/java/org/cloudfoundry/util/JobUtils.java | JobUtils.waitForCompletion | public static Mono<Void> waitForCompletion(CloudFoundryClient cloudFoundryClient, Duration completionTimeout, String jobId) {
return requestJobV3(cloudFoundryClient, jobId)
.filter(job -> JobState.PROCESSING != job.getState())
.repeatWhenEmpty(exponentialBackOff(Duration.ofSeconds(1), Duration.ofSeconds(15), completionTimeout))
.filter(job -> JobState.FAILED == job.getState())
.flatMap(JobUtils::getError);
} | java | public static Mono<Void> waitForCompletion(CloudFoundryClient cloudFoundryClient, Duration completionTimeout, String jobId) {
return requestJobV3(cloudFoundryClient, jobId)
.filter(job -> JobState.PROCESSING != job.getState())
.repeatWhenEmpty(exponentialBackOff(Duration.ofSeconds(1), Duration.ofSeconds(15), completionTimeout))
.filter(job -> JobState.FAILED == job.getState())
.flatMap(JobUtils::getError);
} | [
"public",
"static",
"Mono",
"<",
"Void",
">",
"waitForCompletion",
"(",
"CloudFoundryClient",
"cloudFoundryClient",
",",
"Duration",
"completionTimeout",
",",
"String",
"jobId",
")",
"{",
"return",
"requestJobV3",
"(",
"cloudFoundryClient",
",",
"jobId",
")",
".",
... | Waits for a job V3 to complete
@param cloudFoundryClient the client to use to request job status
@param completionTimeout the amount of time to wait for the job to complete.
@param jobId the id of the job
@return {@code onComplete} once job has completed | [
"Waits",
"for",
"a",
"job",
"V3",
"to",
"complete"
] | train | https://github.com/cloudfoundry/cf-java-client/blob/caa1cb889cfe8717614c071703d833a1540784df/cloudfoundry-util/src/main/java/org/cloudfoundry/util/JobUtils.java#L93-L99 |
apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/table/RowSignature.java | RowSignature.getRelDataType | public RelDataType getRelDataType(final RelDataTypeFactory typeFactory)
{
final RelDataTypeFactory.Builder builder = typeFactory.builder();
for (final String columnName : columnNames) {
final ValueType columnType = getColumnType(columnName);
final RelDataType type;
if (ColumnHolder.TIME_COLUMN_NAME.equals(columnName)) {
type = Calcites.createSqlType(typeFactory, SqlTypeName.TIMESTAMP);
} else {
switch (columnType) {
case STRING:
// Note that there is no attempt here to handle multi-value in any special way. Maybe one day...
type = Calcites.createSqlTypeWithNullability(typeFactory, SqlTypeName.VARCHAR, true);
break;
case LONG:
type = Calcites.createSqlType(typeFactory, SqlTypeName.BIGINT);
break;
case FLOAT:
type = Calcites.createSqlType(typeFactory, SqlTypeName.FLOAT);
break;
case DOUBLE:
type = Calcites.createSqlType(typeFactory, SqlTypeName.DOUBLE);
break;
case COMPLEX:
// Loses information about exactly what kind of complex column this is.
type = Calcites.createSqlTypeWithNullability(typeFactory, SqlTypeName.OTHER, true);
break;
default:
throw new ISE("WTF?! valueType[%s] not translatable?", columnType);
}
}
builder.add(columnName, type);
}
return builder.build();
} | java | public RelDataType getRelDataType(final RelDataTypeFactory typeFactory)
{
final RelDataTypeFactory.Builder builder = typeFactory.builder();
for (final String columnName : columnNames) {
final ValueType columnType = getColumnType(columnName);
final RelDataType type;
if (ColumnHolder.TIME_COLUMN_NAME.equals(columnName)) {
type = Calcites.createSqlType(typeFactory, SqlTypeName.TIMESTAMP);
} else {
switch (columnType) {
case STRING:
// Note that there is no attempt here to handle multi-value in any special way. Maybe one day...
type = Calcites.createSqlTypeWithNullability(typeFactory, SqlTypeName.VARCHAR, true);
break;
case LONG:
type = Calcites.createSqlType(typeFactory, SqlTypeName.BIGINT);
break;
case FLOAT:
type = Calcites.createSqlType(typeFactory, SqlTypeName.FLOAT);
break;
case DOUBLE:
type = Calcites.createSqlType(typeFactory, SqlTypeName.DOUBLE);
break;
case COMPLEX:
// Loses information about exactly what kind of complex column this is.
type = Calcites.createSqlTypeWithNullability(typeFactory, SqlTypeName.OTHER, true);
break;
default:
throw new ISE("WTF?! valueType[%s] not translatable?", columnType);
}
}
builder.add(columnName, type);
}
return builder.build();
} | [
"public",
"RelDataType",
"getRelDataType",
"(",
"final",
"RelDataTypeFactory",
"typeFactory",
")",
"{",
"final",
"RelDataTypeFactory",
".",
"Builder",
"builder",
"=",
"typeFactory",
".",
"builder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"columnName",
":",
... | Returns a Calcite RelDataType corresponding to this row signature.
@param typeFactory factory for type construction
@return Calcite row type | [
"Returns",
"a",
"Calcite",
"RelDataType",
"corresponding",
"to",
"this",
"row",
"signature",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/table/RowSignature.java#L146-L183 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/StrUtils.java | StrUtils.lastIndexOfIgnoreCase | public static int lastIndexOfIgnoreCase(String str, String searchStr) {
if (searchStr.isEmpty() || str.isEmpty())
return -1;
return str.toLowerCase().lastIndexOf(searchStr.toLowerCase());
} | java | public static int lastIndexOfIgnoreCase(String str, String searchStr) {
if (searchStr.isEmpty() || str.isEmpty())
return -1;
return str.toLowerCase().lastIndexOf(searchStr.toLowerCase());
} | [
"public",
"static",
"int",
"lastIndexOfIgnoreCase",
"(",
"String",
"str",
",",
"String",
"searchStr",
")",
"{",
"if",
"(",
"searchStr",
".",
"isEmpty",
"(",
")",
"||",
"str",
".",
"isEmpty",
"(",
")",
")",
"return",
"-",
"1",
";",
"return",
"str",
".",... | Return last sub-String position ignore case, return -1 if not found | [
"Return",
"last",
"sub",
"-",
"String",
"position",
"ignore",
"case",
"return",
"-",
"1",
"if",
"not",
"found"
] | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/StrUtils.java#L394-L398 |
intuit/QuickBooks-V3-Java-SDK | oauth2-platform-api/src/main/java/com/intuit/oauth2/http/HttpRequestClient.java | HttpRequestClient.makeJsonRequest | public Response makeJsonRequest(Request request, OAuthMigrationRequest migrationRequest) throws InvalidRequestException {
logger.debug("Enter HttpRequestClient::makeJsonRequest");
//create oauth consumer using tokens
OAuthConsumer consumer = new CommonsHttpOAuthConsumer(migrationRequest.getConsumerKey(), migrationRequest.getConsumerSecret());
consumer.setTokenWithSecret(migrationRequest.getAccessToken(), migrationRequest.getAccessSecret());
HttpPost post = new HttpPost(request.constructURL().toString());
//sign
try {
consumer.sign(post);
} catch (OAuthMessageSignerException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
} catch (OAuthExpectationFailedException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
} catch (OAuthCommunicationException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
}
//add headers
post.setHeader("Accept", "application/json");
post.setHeader("Content-Type", "application/json");
// add post data
HttpEntity entity = new StringEntity(request.getPostJson(), "UTF-8");
post.setEntity(entity);
CloseableHttpResponse httpResponse = null;
try {
//make the call
httpResponse = client.execute(post);
//prepare response
return new Response(httpResponse.getEntity() == null ? null : httpResponse.getEntity().getContent(), httpResponse.getStatusLine().getStatusCode());
} catch (ClientProtocolException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
} catch (IOException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
}
} | java | public Response makeJsonRequest(Request request, OAuthMigrationRequest migrationRequest) throws InvalidRequestException {
logger.debug("Enter HttpRequestClient::makeJsonRequest");
//create oauth consumer using tokens
OAuthConsumer consumer = new CommonsHttpOAuthConsumer(migrationRequest.getConsumerKey(), migrationRequest.getConsumerSecret());
consumer.setTokenWithSecret(migrationRequest.getAccessToken(), migrationRequest.getAccessSecret());
HttpPost post = new HttpPost(request.constructURL().toString());
//sign
try {
consumer.sign(post);
} catch (OAuthMessageSignerException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
} catch (OAuthExpectationFailedException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
} catch (OAuthCommunicationException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
}
//add headers
post.setHeader("Accept", "application/json");
post.setHeader("Content-Type", "application/json");
// add post data
HttpEntity entity = new StringEntity(request.getPostJson(), "UTF-8");
post.setEntity(entity);
CloseableHttpResponse httpResponse = null;
try {
//make the call
httpResponse = client.execute(post);
//prepare response
return new Response(httpResponse.getEntity() == null ? null : httpResponse.getEntity().getContent(), httpResponse.getStatusLine().getStatusCode());
} catch (ClientProtocolException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
} catch (IOException e) {
logger.error("Exception while making httpRequest", e);
throw new InvalidRequestException(e.getMessage());
}
} | [
"public",
"Response",
"makeJsonRequest",
"(",
"Request",
"request",
",",
"OAuthMigrationRequest",
"migrationRequest",
")",
"throws",
"InvalidRequestException",
"{",
"logger",
".",
"debug",
"(",
"\"Enter HttpRequestClient::makeJsonRequest\"",
")",
";",
"//create oauth consumer... | Method to make the HTTP POST request using the request attributes supplied
@param request
@return
@throws InvalidRequestException | [
"Method",
"to",
"make",
"the",
"HTTP",
"POST",
"request",
"using",
"the",
"request",
"attributes",
"supplied"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/oauth2-platform-api/src/main/java/com/intuit/oauth2/http/HttpRequestClient.java#L215-L262 |
RKumsher/utils | src/main/java/com/github/rkumsher/number/RandomNumberUtils.java | RandomNumberUtils.randomLongLessThan | public static long randomLongLessThan(long maxExclusive) {
checkArgument(
maxExclusive > Long.MIN_VALUE, "Cannot produce long less than %s", Long.MIN_VALUE);
return randomLong(Long.MIN_VALUE, maxExclusive);
} | java | public static long randomLongLessThan(long maxExclusive) {
checkArgument(
maxExclusive > Long.MIN_VALUE, "Cannot produce long less than %s", Long.MIN_VALUE);
return randomLong(Long.MIN_VALUE, maxExclusive);
} | [
"public",
"static",
"long",
"randomLongLessThan",
"(",
"long",
"maxExclusive",
")",
"{",
"checkArgument",
"(",
"maxExclusive",
">",
"Long",
".",
"MIN_VALUE",
",",
"\"Cannot produce long less than %s\"",
",",
"Long",
".",
"MIN_VALUE",
")",
";",
"return",
"randomLong"... | Returns a random long that is less than the given long.
@param maxExclusive the value that returned long must be less than
@return the random long
@throws IllegalArgumentException if maxExclusive is less than or equal to {@link
Long#MIN_VALUE} | [
"Returns",
"a",
"random",
"long",
"that",
"is",
"less",
"than",
"the",
"given",
"long",
"."
] | train | https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/number/RandomNumberUtils.java#L153-L157 |
crnk-project/crnk-framework | crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PropertyUtils.java | PropertyUtils.getProperty | public static Object getProperty(Object bean, List<String> propertyPath) {
Object current = bean;
for (String propertyName : propertyPath) {
if (current == null) {
return null;
}
if (current instanceof Iterable) {
// follow multi-valued property
List<Object> result = new ArrayList<>();
Iterable<?> iterable = (Iterable<?>) current;
for (Object currentElem : iterable) {
result.add(getProperty(currentElem, propertyName));
}
current = result;
} else {
// follow single-valued property
current = getProperty(current, propertyName);
}
}
return current;
} | java | public static Object getProperty(Object bean, List<String> propertyPath) {
Object current = bean;
for (String propertyName : propertyPath) {
if (current == null) {
return null;
}
if (current instanceof Iterable) {
// follow multi-valued property
List<Object> result = new ArrayList<>();
Iterable<?> iterable = (Iterable<?>) current;
for (Object currentElem : iterable) {
result.add(getProperty(currentElem, propertyName));
}
current = result;
} else {
// follow single-valued property
current = getProperty(current, propertyName);
}
}
return current;
} | [
"public",
"static",
"Object",
"getProperty",
"(",
"Object",
"bean",
",",
"List",
"<",
"String",
">",
"propertyPath",
")",
"{",
"Object",
"current",
"=",
"bean",
";",
"for",
"(",
"String",
"propertyName",
":",
"propertyPath",
")",
"{",
"if",
"(",
"current",... | Similar to {@link PropertyUtils#getProperty(Object, String)} but returns the property value for the tail of the given
property path.
@param bean bean to be accessed
@param propertyPath property path
@return value | [
"Similar",
"to",
"{",
"@link",
"PropertyUtils#getProperty",
"(",
"Object",
"String",
")",
"}",
"but",
"returns",
"the",
"property",
"value",
"for",
"the",
"tail",
"of",
"the",
"given",
"property",
"path",
"."
] | train | https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PropertyUtils.java#L87-L107 |
line/armeria | saml/src/main/java/com/linecorp/armeria/server/saml/SamlEndpoint.java | SamlEndpoint.ofHttpRedirect | public static SamlEndpoint ofHttpRedirect(URI uri) {
requireNonNull(uri, "uri");
return new SamlEndpoint(uri, SamlBindingProtocol.HTTP_REDIRECT);
} | java | public static SamlEndpoint ofHttpRedirect(URI uri) {
requireNonNull(uri, "uri");
return new SamlEndpoint(uri, SamlBindingProtocol.HTTP_REDIRECT);
} | [
"public",
"static",
"SamlEndpoint",
"ofHttpRedirect",
"(",
"URI",
"uri",
")",
"{",
"requireNonNull",
"(",
"uri",
",",
"\"uri\"",
")",
";",
"return",
"new",
"SamlEndpoint",
"(",
"uri",
",",
"SamlBindingProtocol",
".",
"HTTP_REDIRECT",
")",
";",
"}"
] | Creates a {@link SamlEndpoint} of the specified {@code uri} and the HTTP Redirect binding protocol. | [
"Creates",
"a",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/saml/src/main/java/com/linecorp/armeria/server/saml/SamlEndpoint.java#L48-L51 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/UNode.java | UNode.addXMLAttributes | private void addXMLAttributes(Map<String, String> attrMap) {
if (m_children != null) {
for (UNode childNode : m_children) {
// A child node must not contain a tag name to be considered an attribute.
if (childNode.m_type == NodeType.VALUE && childNode.m_bAttribute && Utils.isEmpty(childNode.m_tagName)) {
assert m_name != null && m_name.length() > 0;
attrMap.put(childNode.m_name, childNode.m_value);
}
}
}
} | java | private void addXMLAttributes(Map<String, String> attrMap) {
if (m_children != null) {
for (UNode childNode : m_children) {
// A child node must not contain a tag name to be considered an attribute.
if (childNode.m_type == NodeType.VALUE && childNode.m_bAttribute && Utils.isEmpty(childNode.m_tagName)) {
assert m_name != null && m_name.length() > 0;
attrMap.put(childNode.m_name, childNode.m_value);
}
}
}
} | [
"private",
"void",
"addXMLAttributes",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"attrMap",
")",
"{",
"if",
"(",
"m_children",
"!=",
"null",
")",
"{",
"for",
"(",
"UNode",
"childNode",
":",
"m_children",
")",
"{",
"// A child node must not contain a tag n... | Get the child nodes of this UNode that are VALUE nodes marked as attributes. | [
"Get",
"the",
"child",
"nodes",
"of",
"this",
"UNode",
"that",
"are",
"VALUE",
"nodes",
"marked",
"as",
"attributes",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/UNode.java#L1232-L1242 |
Chorus-bdd/Chorus | interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/filter/ClassFilterDecorator.java | ClassFilterDecorator.decorateWithPackageNameFilters | public ClassFilter decorateWithPackageNameFilters(ClassFilter filterToDecorate, List<String> userSpecifiedPrefixes) {
DenyAllPackageNames denyAllPackageNames = new DenyAllPackageNames(filterToDecorate);
//if user has specified package prefixes, restrict to those
ClassFilter packagePrefixFilter = new AcceptNamedPackagePrefixes(denyAllPackageNames, userSpecifiedPrefixes);
//always permit built in handlers, deny other chorus packages
return new AlwaysAllowBuiltInPackageRule(packagePrefixFilter);
} | java | public ClassFilter decorateWithPackageNameFilters(ClassFilter filterToDecorate, List<String> userSpecifiedPrefixes) {
DenyAllPackageNames denyAllPackageNames = new DenyAllPackageNames(filterToDecorate);
//if user has specified package prefixes, restrict to those
ClassFilter packagePrefixFilter = new AcceptNamedPackagePrefixes(denyAllPackageNames, userSpecifiedPrefixes);
//always permit built in handlers, deny other chorus packages
return new AlwaysAllowBuiltInPackageRule(packagePrefixFilter);
} | [
"public",
"ClassFilter",
"decorateWithPackageNameFilters",
"(",
"ClassFilter",
"filterToDecorate",
",",
"List",
"<",
"String",
">",
"userSpecifiedPrefixes",
")",
"{",
"DenyAllPackageNames",
"denyAllPackageNames",
"=",
"new",
"DenyAllPackageNames",
"(",
"filterToDecorate",
"... | @return a ClassFilter chain to use when discovering Handler classes in the classpath
@param filterToDecorate this filter will be decorated with extra rules to check package names
@param userSpecifiedPrefixes any handler package prefixes specified by user | [
"@return",
"a",
"ClassFilter",
"chain",
"to",
"use",
"when",
"discovering",
"Handler",
"classes",
"in",
"the",
"classpath"
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/filter/ClassFilterDecorator.java#L55-L63 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java | ID3v2Tag.parseFrames | private void parseFrames(RandomAccessInputStream raf) throws FileNotFoundException, IOException, ID3v2FormatException
{
int offset = head.getHeaderSize();
int framesLength = head.getTagSize();
if (head.getExtendedHeader())
{
framesLength -= ext_head.getSize();
offset += ext_head.getSize();
}
raf.seek(offset);
int bytesRead = 0;
boolean done = false;
while ((bytesRead < framesLength) && !done)
{
byte[] buf = new byte[4];
bytesRead += raf.read(buf);
if (buf[0] != 0)
{
String id = new String(buf);
bytesRead += raf.read(buf);
int curLength = Helpers.convertDWordToInt(buf, 0);
byte [] flags = new byte[2];
bytesRead += raf.read(flags);
byte [] data = new byte[curLength];
bytesRead += raf.read(data);
ID3v2Frame frame = new ID3v2Frame(id, flags, data);
frames.put(id, frame);
}
else
{
done = true;
padding = framesLength - bytesRead - buf.length;
}
}
} | java | private void parseFrames(RandomAccessInputStream raf) throws FileNotFoundException, IOException, ID3v2FormatException
{
int offset = head.getHeaderSize();
int framesLength = head.getTagSize();
if (head.getExtendedHeader())
{
framesLength -= ext_head.getSize();
offset += ext_head.getSize();
}
raf.seek(offset);
int bytesRead = 0;
boolean done = false;
while ((bytesRead < framesLength) && !done)
{
byte[] buf = new byte[4];
bytesRead += raf.read(buf);
if (buf[0] != 0)
{
String id = new String(buf);
bytesRead += raf.read(buf);
int curLength = Helpers.convertDWordToInt(buf, 0);
byte [] flags = new byte[2];
bytesRead += raf.read(flags);
byte [] data = new byte[curLength];
bytesRead += raf.read(data);
ID3v2Frame frame = new ID3v2Frame(id, flags, data);
frames.put(id, frame);
}
else
{
done = true;
padding = framesLength - bytesRead - buf.length;
}
}
} | [
"private",
"void",
"parseFrames",
"(",
"RandomAccessInputStream",
"raf",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
",",
"ID3v2FormatException",
"{",
"int",
"offset",
"=",
"head",
".",
"getHeaderSize",
"(",
")",
";",
"int",
"framesLength",
"=",
"h... | Read the frames from the file and create ID3v2Frame objects from the
data found.
@param raf the open file to read from
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
@exception ID3v2FormatException if an error occurs | [
"Read",
"the",
"frames",
"from",
"the",
"file",
"and",
"create",
"ID3v2Frame",
"objects",
"from",
"the",
"data",
"found",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L103-L141 |
meraki-analytics/datapipelines-java | src/main/java/com/merakianalytics/datapipelines/SinkHandler.java | SinkHandler.putMany | public void putMany(final Iterable<A> items, final PipelineContext context) {
final Iterable<S> transforming = new TransformingIterable(items, context);
sink.putMany(storedType, transforming, context);
} | java | public void putMany(final Iterable<A> items, final PipelineContext context) {
final Iterable<S> transforming = new TransformingIterable(items, context);
sink.putMany(storedType, transforming, context);
} | [
"public",
"void",
"putMany",
"(",
"final",
"Iterable",
"<",
"A",
">",
"items",
",",
"final",
"PipelineContext",
"context",
")",
"{",
"final",
"Iterable",
"<",
"S",
">",
"transforming",
"=",
"new",
"TransformingIterable",
"(",
"items",
",",
"context",
")",
... | Converts multiple data elements and provides them to the underlying {@link com.merakianalytics.datapipelines.sinks.DataSink}
@param items
the data to provide to the underlying {@link com.merakianalytics.datapipelines.sinks.DataSink}
@param context
information about the context of the request such as what {@link com.merakianalytics.datapipelines.DataPipeline} called this method | [
"Converts",
"multiple",
"data",
"elements",
"and",
"provides",
"them",
"to",
"the",
"underlying",
"{",
"@link",
"com",
".",
"merakianalytics",
".",
"datapipelines",
".",
"sinks",
".",
"DataSink",
"}"
] | train | https://github.com/meraki-analytics/datapipelines-java/blob/376ff1e8e1f7c67f2f2a5521d2a66e91467e56b0/src/main/java/com/merakianalytics/datapipelines/SinkHandler.java#L105-L108 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/xa/PGXADataSource.java | PGXADataSource.getXAConnection | public XAConnection getXAConnection(String user, String password) throws SQLException {
Connection con = super.getConnection(user, password);
return new PGXAConnection((BaseConnection) con);
} | java | public XAConnection getXAConnection(String user, String password) throws SQLException {
Connection con = super.getConnection(user, password);
return new PGXAConnection((BaseConnection) con);
} | [
"public",
"XAConnection",
"getXAConnection",
"(",
"String",
"user",
",",
"String",
"password",
")",
"throws",
"SQLException",
"{",
"Connection",
"con",
"=",
"super",
".",
"getConnection",
"(",
"user",
",",
"password",
")",
";",
"return",
"new",
"PGXAConnection",... | Gets a XA-enabled connection to the PostgreSQL database. The database is identified by the
DataSource properties serverName, databaseName, and portNumber. The user to connect as is
identified by the arguments user and password, which override the DataSource properties by the
same name.
@return A valid database connection.
@throws SQLException Occurs when the database connection cannot be established. | [
"Gets",
"a",
"XA",
"-",
"enabled",
"connection",
"to",
"the",
"PostgreSQL",
"database",
".",
"The",
"database",
"is",
"identified",
"by",
"the",
"DataSource",
"properties",
"serverName",
"databaseName",
"and",
"portNumber",
".",
"The",
"user",
"to",
"connect",
... | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/xa/PGXADataSource.java#L45-L48 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsVfsSitemapService.java | CmsVfsSitemapService.ensureLockAndGetInfo | protected LockInfo ensureLockAndGetInfo(CmsResource resource) throws CmsException {
CmsObject cms = getCmsObject();
boolean justLocked = false;
List<CmsResource> blockingResources = cms.getBlockingLockedResources(resource);
if ((blockingResources != null) && !blockingResources.isEmpty()) {
throw new CmsException(
org.opencms.gwt.Messages.get().container(
org.opencms.gwt.Messages.ERR_RESOURCE_HAS_BLOCKING_LOCKED_CHILDREN_1,
cms.getSitePath(resource)));
}
CmsUser user = cms.getRequestContext().getCurrentUser();
CmsLock lock = cms.getLock(resource);
if (!lock.isOwnedBy(user)) {
cms.lockResourceTemporary(resource);
lock = cms.getLock(resource);
justLocked = true;
} else if (!lock.isOwnedInProjectBy(user, cms.getRequestContext().getCurrentProject())) {
cms.changeLock(resource);
lock = cms.getLock(resource);
justLocked = true;
}
return new LockInfo(lock, justLocked);
} | java | protected LockInfo ensureLockAndGetInfo(CmsResource resource) throws CmsException {
CmsObject cms = getCmsObject();
boolean justLocked = false;
List<CmsResource> blockingResources = cms.getBlockingLockedResources(resource);
if ((blockingResources != null) && !blockingResources.isEmpty()) {
throw new CmsException(
org.opencms.gwt.Messages.get().container(
org.opencms.gwt.Messages.ERR_RESOURCE_HAS_BLOCKING_LOCKED_CHILDREN_1,
cms.getSitePath(resource)));
}
CmsUser user = cms.getRequestContext().getCurrentUser();
CmsLock lock = cms.getLock(resource);
if (!lock.isOwnedBy(user)) {
cms.lockResourceTemporary(resource);
lock = cms.getLock(resource);
justLocked = true;
} else if (!lock.isOwnedInProjectBy(user, cms.getRequestContext().getCurrentProject())) {
cms.changeLock(resource);
lock = cms.getLock(resource);
justLocked = true;
}
return new LockInfo(lock, justLocked);
} | [
"protected",
"LockInfo",
"ensureLockAndGetInfo",
"(",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"CmsObject",
"cms",
"=",
"getCmsObject",
"(",
")",
";",
"boolean",
"justLocked",
"=",
"false",
";",
"List",
"<",
"CmsResource",
">",
"blockingResou... | Locks the given resource with a temporary, if not already locked by the current user.
Will throw an exception if the resource could not be locked for the current user.<p>
@param resource the resource to lock
@return the assigned lock
@throws CmsException if the resource could not be locked | [
"Locks",
"the",
"given",
"resource",
"with",
"a",
"temporary",
"if",
"not",
"already",
"locked",
"by",
"the",
"current",
"user",
".",
"Will",
"throw",
"an",
"exception",
"if",
"the",
"resource",
"could",
"not",
"be",
"locked",
"for",
"the",
"current",
"use... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L1199-L1222 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/split/ST_Split.java | ST_Split.splitLineWithPoint | private static MultiLineString splitLineWithPoint(LineString line, Point pointToSplit, double tolerance) {
return FACTORY.createMultiLineString(splitLineStringWithPoint(line, pointToSplit, tolerance));
} | java | private static MultiLineString splitLineWithPoint(LineString line, Point pointToSplit, double tolerance) {
return FACTORY.createMultiLineString(splitLineStringWithPoint(line, pointToSplit, tolerance));
} | [
"private",
"static",
"MultiLineString",
"splitLineWithPoint",
"(",
"LineString",
"line",
",",
"Point",
"pointToSplit",
",",
"double",
"tolerance",
")",
"{",
"return",
"FACTORY",
".",
"createMultiLineString",
"(",
"splitLineStringWithPoint",
"(",
"line",
",",
"pointToS... | Split a linestring with a point The point must be on the linestring
@param line
@param pointToSplit
@return | [
"Split",
"a",
"linestring",
"with",
"a",
"point",
"The",
"point",
"must",
"be",
"on",
"the",
"linestring"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/split/ST_Split.java#L138-L140 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/AbstractDirector.java | AbstractDirector.fireProgressEvent | void fireProgressEvent(int state, int progress, String message) {
try {
fireProgressEvent(state, progress, message, false);
} catch (InstallException e) {
}
} | java | void fireProgressEvent(int state, int progress, String message) {
try {
fireProgressEvent(state, progress, message, false);
} catch (InstallException e) {
}
} | [
"void",
"fireProgressEvent",
"(",
"int",
"state",
",",
"int",
"progress",
",",
"String",
"message",
")",
"{",
"try",
"{",
"fireProgressEvent",
"(",
"state",
",",
"progress",
",",
"message",
",",
"false",
")",
";",
"}",
"catch",
"(",
"InstallException",
"e"... | Creates a Progress event message.
@param state the state integer
@param progress the progress integer
@param message the message to be displayed | [
"Creates",
"a",
"Progress",
"event",
"message",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/AbstractDirector.java#L58-L63 |
chrisjenx/Calligraphy | calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java | CalligraphyUtils.applyTypefaceSpan | public static CharSequence applyTypefaceSpan(CharSequence s, Typeface typeface) {
if (s != null && s.length() > 0) {
if (!(s instanceof Spannable)) {
s = new SpannableString(s);
}
((Spannable) s).setSpan(TypefaceUtils.getSpan(typeface), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return s;
} | java | public static CharSequence applyTypefaceSpan(CharSequence s, Typeface typeface) {
if (s != null && s.length() > 0) {
if (!(s instanceof Spannable)) {
s = new SpannableString(s);
}
((Spannable) s).setSpan(TypefaceUtils.getSpan(typeface), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return s;
} | [
"public",
"static",
"CharSequence",
"applyTypefaceSpan",
"(",
"CharSequence",
"s",
",",
"Typeface",
"typeface",
")",
"{",
"if",
"(",
"s",
"!=",
"null",
"&&",
"s",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"!",
"(",
"s",
"instanceof",
"S... | Applies a custom typeface span to the text.
@param s text to apply it too.
@param typeface typeface to apply.
@return Either the passed in Object or new Spannable with the typeface span applied. | [
"Applies",
"a",
"custom",
"typeface",
"span",
"to",
"the",
"text",
"."
] | train | https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L34-L42 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java | QrCodeDecoderBits.updateModeLogic | private QrCode.Mode updateModeLogic( QrCode.Mode current , QrCode.Mode candidate )
{
if( current == candidate )
return current;
else if( current == QrCode.Mode.UNKNOWN ) {
return candidate;
} else {
return QrCode.Mode.MIXED;
}
} | java | private QrCode.Mode updateModeLogic( QrCode.Mode current , QrCode.Mode candidate )
{
if( current == candidate )
return current;
else if( current == QrCode.Mode.UNKNOWN ) {
return candidate;
} else {
return QrCode.Mode.MIXED;
}
} | [
"private",
"QrCode",
".",
"Mode",
"updateModeLogic",
"(",
"QrCode",
".",
"Mode",
"current",
",",
"QrCode",
".",
"Mode",
"candidate",
")",
"{",
"if",
"(",
"current",
"==",
"candidate",
")",
"return",
"current",
";",
"else",
"if",
"(",
"current",
"==",
"Qr... | If only one mode then that mode is used. If more than one mode is used then set to multiple | [
"If",
"only",
"one",
"mode",
"then",
"that",
"mode",
"is",
"used",
".",
"If",
"more",
"than",
"one",
"mode",
"is",
"used",
"then",
"set",
"to",
"multiple"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java#L188-L197 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.forEachTrimmedToken | public static void forEachTrimmedToken(String string, String separator, Procedure<String> procedure)
{
for (StringTokenizer stringTokenizer = new StringTokenizer(string, separator); stringTokenizer.hasMoreTokens(); )
{
String token = stringTokenizer.nextToken().trim();
procedure.value(token);
}
} | java | public static void forEachTrimmedToken(String string, String separator, Procedure<String> procedure)
{
for (StringTokenizer stringTokenizer = new StringTokenizer(string, separator); stringTokenizer.hasMoreTokens(); )
{
String token = stringTokenizer.nextToken().trim();
procedure.value(token);
}
} | [
"public",
"static",
"void",
"forEachTrimmedToken",
"(",
"String",
"string",
",",
"String",
"separator",
",",
"Procedure",
"<",
"String",
">",
"procedure",
")",
"{",
"for",
"(",
"StringTokenizer",
"stringTokenizer",
"=",
"new",
"StringTokenizer",
"(",
"string",
"... | For each token in a {@code string} separated by the specified {@code separator}, execute the specified
{@link Procedure}. | [
"For",
"each",
"token",
"in",
"a",
"{"
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L318-L325 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.