repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/stats/StatsInterface.java | StatsInterface.getPhotostreamReferrers | public ReferrerList getPhotostreamReferrers(Date date, String domain, int perPage, int page) throws FlickrException {
"""
Get a list of referrers from a given domain to a user's photostream.
@param date
(Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will
automatically be rounded down to the start of the day.
@param domain
(Required) The domain to return referrers for. This should be a hostname (eg: "flickr.com") with no protocol or pathname.
@param perPage
(Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.
@param page
(Optional) The page of results to return. If this argument is omitted, it defaults to 1.
@see "http://www.flickr.com/services/api/flickr.stats.getPhotostreamReferrers.html"
"""
return getReferrers(METHOD_GET_PHOTOSTREAM_REFERRERS, domain, null, null, date, perPage, page);
} | java | public ReferrerList getPhotostreamReferrers(Date date, String domain, int perPage, int page) throws FlickrException {
return getReferrers(METHOD_GET_PHOTOSTREAM_REFERRERS, domain, null, null, date, perPage, page);
} | [
"public",
"ReferrerList",
"getPhotostreamReferrers",
"(",
"Date",
"date",
",",
"String",
"domain",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"return",
"getReferrers",
"(",
"METHOD_GET_PHOTOSTREAM_REFERRERS",
",",
"domain",
","... | Get a list of referrers from a given domain to a user's photostream.
@param date
(Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will
automatically be rounded down to the start of the day.
@param domain
(Required) The domain to return referrers for. This should be a hostname (eg: "flickr.com") with no protocol or pathname.
@param perPage
(Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.
@param page
(Optional) The page of results to return. If this argument is omitted, it defaults to 1.
@see "http://www.flickr.com/services/api/flickr.stats.getPhotostreamReferrers.html" | [
"Get",
"a",
"list",
"of",
"referrers",
"from",
"a",
"given",
"domain",
"to",
"a",
"user",
"s",
"photostream",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L289-L291 |
inloop/easygcm | easygcm-lib/src/main/java/eu/inloop/easygcm/EasyGcm.java | EasyGcm.storeRegistrationId | private static void storeRegistrationId(Context context, String regId) {
"""
Stores the registration ID and the app versionCode in the application's
{@code SharedPreferences}.
@param context application's context.
@param regId registration ID
"""
final int appVersion = GcmUtils.getAppVersion(context);
Logger.d("Saving regId on app version " + appVersion);
final SharedPreferences.Editor editor = getGcmPreferences(context).edit();
editor.putString(PROPERTY_REG_ID, regId);
editor.putInt(PROPERTY_APP_VERSION, appVersion);
editor.apply();
} | java | private static void storeRegistrationId(Context context, String regId) {
final int appVersion = GcmUtils.getAppVersion(context);
Logger.d("Saving regId on app version " + appVersion);
final SharedPreferences.Editor editor = getGcmPreferences(context).edit();
editor.putString(PROPERTY_REG_ID, regId);
editor.putInt(PROPERTY_APP_VERSION, appVersion);
editor.apply();
} | [
"private",
"static",
"void",
"storeRegistrationId",
"(",
"Context",
"context",
",",
"String",
"regId",
")",
"{",
"final",
"int",
"appVersion",
"=",
"GcmUtils",
".",
"getAppVersion",
"(",
"context",
")",
";",
"Logger",
".",
"d",
"(",
"\"Saving regId on app versio... | Stores the registration ID and the app versionCode in the application's
{@code SharedPreferences}.
@param context application's context.
@param regId registration ID | [
"Stores",
"the",
"registration",
"ID",
"and",
"the",
"app",
"versionCode",
"in",
"the",
"application",
"s",
"{",
"@code",
"SharedPreferences",
"}",
"."
] | train | https://github.com/inloop/easygcm/blob/d06bbff11e52b956c3a7b1a2dc4f9799f20cf2c6/easygcm-lib/src/main/java/eu/inloop/easygcm/EasyGcm.java#L89-L97 |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java | CSRFServiceImpl.clearTokenIfInvalid | @Override
public Result clearTokenIfInvalid(Context context, String msg) {
"""
Clears the token from the request
@param context the context
@param msg the error message
@return the result
"""
Result error = handler.onError(context, msg);
final String cookieName = getCookieName();
if (cookieName != null) {
Cookie cookie = context.cookie(cookieName);
if (cookie != null) {
return error.without(cookieName);
}
} else {
context.session().remove(getTokenName());
}
return error;
} | java | @Override
public Result clearTokenIfInvalid(Context context, String msg) {
Result error = handler.onError(context, msg);
final String cookieName = getCookieName();
if (cookieName != null) {
Cookie cookie = context.cookie(cookieName);
if (cookie != null) {
return error.without(cookieName);
}
} else {
context.session().remove(getTokenName());
}
return error;
} | [
"@",
"Override",
"public",
"Result",
"clearTokenIfInvalid",
"(",
"Context",
"context",
",",
"String",
"msg",
")",
"{",
"Result",
"error",
"=",
"handler",
".",
"onError",
"(",
"context",
",",
"msg",
")",
";",
"final",
"String",
"cookieName",
"=",
"getCookieNa... | Clears the token from the request
@param context the context
@param msg the error message
@return the result | [
"Clears",
"the",
"token",
"from",
"the",
"request"
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java#L264-L277 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/ColumnText.java | ColumnText.setSimpleColumn | public void setSimpleColumn(Phrase phrase, float llx, float lly, float urx, float ury, float leading, int alignment) {
"""
Simplified method for rectangular columns.
@param phrase a <CODE>Phrase</CODE>
@param llx the lower left x corner
@param lly the lower left y corner
@param urx the upper right x corner
@param ury the upper right y corner
@param leading the leading
@param alignment the column alignment
"""
addText(phrase);
setSimpleColumn(llx, lly, urx, ury, leading, alignment);
} | java | public void setSimpleColumn(Phrase phrase, float llx, float lly, float urx, float ury, float leading, int alignment) {
addText(phrase);
setSimpleColumn(llx, lly, urx, ury, leading, alignment);
} | [
"public",
"void",
"setSimpleColumn",
"(",
"Phrase",
"phrase",
",",
"float",
"llx",
",",
"float",
"lly",
",",
"float",
"urx",
",",
"float",
"ury",
",",
"float",
"leading",
",",
"int",
"alignment",
")",
"{",
"addText",
"(",
"phrase",
")",
";",
"setSimpleCo... | Simplified method for rectangular columns.
@param phrase a <CODE>Phrase</CODE>
@param llx the lower left x corner
@param lly the lower left y corner
@param urx the upper right x corner
@param ury the upper right y corner
@param leading the leading
@param alignment the column alignment | [
"Simplified",
"method",
"for",
"rectangular",
"columns",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/ColumnText.java#L609-L612 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/cli/validation/Utils.java | Utils.isMountingPoint | public static boolean isMountingPoint(String path, String[] fsTypes) throws IOException {
"""
Checks whether a path is the mounting point of a RAM disk volume.
@param path a string represents the path to be checked
@param fsTypes an array of strings represents expected file system type
@return true if the path is the mounting point of volume with one of the given fsTypes,
false otherwise
@throws IOException if the function fails to get the mount information of the system
"""
List<UnixMountInfo> infoList = ShellUtils.getUnixMountInfo();
for (UnixMountInfo info : infoList) {
Optional<String> mountPoint = info.getMountPoint();
Optional<String> fsType = info.getFsType();
if (mountPoint.isPresent() && mountPoint.get().equals(path) && fsType.isPresent()) {
for (String expectedType : fsTypes) {
if (fsType.get().equalsIgnoreCase(expectedType)) {
return true;
}
}
}
}
return false;
} | java | public static boolean isMountingPoint(String path, String[] fsTypes) throws IOException {
List<UnixMountInfo> infoList = ShellUtils.getUnixMountInfo();
for (UnixMountInfo info : infoList) {
Optional<String> mountPoint = info.getMountPoint();
Optional<String> fsType = info.getFsType();
if (mountPoint.isPresent() && mountPoint.get().equals(path) && fsType.isPresent()) {
for (String expectedType : fsTypes) {
if (fsType.get().equalsIgnoreCase(expectedType)) {
return true;
}
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"isMountingPoint",
"(",
"String",
"path",
",",
"String",
"[",
"]",
"fsTypes",
")",
"throws",
"IOException",
"{",
"List",
"<",
"UnixMountInfo",
">",
"infoList",
"=",
"ShellUtils",
".",
"getUnixMountInfo",
"(",
")",
";",
"for",
"... | Checks whether a path is the mounting point of a RAM disk volume.
@param path a string represents the path to be checked
@param fsTypes an array of strings represents expected file system type
@return true if the path is the mounting point of volume with one of the given fsTypes,
false otherwise
@throws IOException if the function fails to get the mount information of the system | [
"Checks",
"whether",
"a",
"path",
"is",
"the",
"mounting",
"point",
"of",
"a",
"RAM",
"disk",
"volume",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/cli/validation/Utils.java#L115-L129 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java | CmsContainerpageController.getElements | public void getElements(Set<String> clientIds, I_CmsSimpleCallback<Map<String, CmsContainerElementData>> callback) {
"""
Requests the data for container elements specified by the client id. The data will be provided to the given call-back function.<p>
@param clientIds the element id's
@param callback the call-back to execute with the requested data
"""
MultiElementAction action = new MultiElementAction(clientIds, callback);
action.execute();
} | java | public void getElements(Set<String> clientIds, I_CmsSimpleCallback<Map<String, CmsContainerElementData>> callback) {
MultiElementAction action = new MultiElementAction(clientIds, callback);
action.execute();
} | [
"public",
"void",
"getElements",
"(",
"Set",
"<",
"String",
">",
"clientIds",
",",
"I_CmsSimpleCallback",
"<",
"Map",
"<",
"String",
",",
"CmsContainerElementData",
">",
">",
"callback",
")",
"{",
"MultiElementAction",
"action",
"=",
"new",
"MultiElementAction",
... | Requests the data for container elements specified by the client id. The data will be provided to the given call-back function.<p>
@param clientIds the element id's
@param callback the call-back to execute with the requested data | [
"Requests",
"the",
"data",
"for",
"container",
"elements",
"specified",
"by",
"the",
"client",
"id",
".",
"The",
"data",
"will",
"be",
"provided",
"to",
"the",
"given",
"call",
"-",
"back",
"function",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L1523-L1527 |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java | ContextAwarePolicyAdapter.createUserProvidedPublicationPolicy | public static ContextAwarePolicy createUserProvidedPublicationPolicy(PublicationData publicationData, Extender extender) {
"""
Creates context aware policy using {@link UserProvidedPublicationBasedVerificationPolicy} for verification.
If extender is set, signature is extended within verification process.
@param publicationData
User provided publication data.
@param extender
Extender.
@return User provided publication based verification policy with suitable context.
"""
Util.notNull(publicationData, "Publication data");
return new ContextAwarePolicyAdapter(new UserProvidedPublicationBasedVerificationPolicy(),
new PolicyContext(publicationData, extender != null ? extender.getExtendingService() : null));
} | java | public static ContextAwarePolicy createUserProvidedPublicationPolicy(PublicationData publicationData, Extender extender) {
Util.notNull(publicationData, "Publication data");
return new ContextAwarePolicyAdapter(new UserProvidedPublicationBasedVerificationPolicy(),
new PolicyContext(publicationData, extender != null ? extender.getExtendingService() : null));
} | [
"public",
"static",
"ContextAwarePolicy",
"createUserProvidedPublicationPolicy",
"(",
"PublicationData",
"publicationData",
",",
"Extender",
"extender",
")",
"{",
"Util",
".",
"notNull",
"(",
"publicationData",
",",
"\"Publication data\"",
")",
";",
"return",
"new",
"Co... | Creates context aware policy using {@link UserProvidedPublicationBasedVerificationPolicy} for verification.
If extender is set, signature is extended within verification process.
@param publicationData
User provided publication data.
@param extender
Extender.
@return User provided publication based verification policy with suitable context. | [
"Creates",
"context",
"aware",
"policy",
"using",
"{",
"@link",
"UserProvidedPublicationBasedVerificationPolicy",
"}",
"for",
"verification",
".",
"If",
"extender",
"is",
"set",
"signature",
"is",
"extended",
"within",
"verification",
"process",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L128-L132 |
LearnLib/learnlib | algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/model/ObservationTree.java | ObservationTree.addTrace | public void addTrace(final S state, final Word<I> input, final Word<O> output) {
"""
Store input/output information about a hypothesis state in the internal data structure.
@param state
the hypothesis state for which information should be stored
@param input
the input sequence applied when in the given state
@param output
the observed output sequence
"""
this.addTrace(this.nodeToObservationMap.get(state), input, output);
} | java | public void addTrace(final S state, final Word<I> input, final Word<O> output) {
this.addTrace(this.nodeToObservationMap.get(state), input, output);
} | [
"public",
"void",
"addTrace",
"(",
"final",
"S",
"state",
",",
"final",
"Word",
"<",
"I",
">",
"input",
",",
"final",
"Word",
"<",
"O",
">",
"output",
")",
"{",
"this",
".",
"addTrace",
"(",
"this",
".",
"nodeToObservationMap",
".",
"get",
"(",
"stat... | Store input/output information about a hypothesis state in the internal data structure.
@param state
the hypothesis state for which information should be stored
@param input
the input sequence applied when in the given state
@param output
the observed output sequence | [
"Store",
"input",
"/",
"output",
"information",
"about",
"a",
"hypothesis",
"state",
"in",
"the",
"internal",
"data",
"structure",
"."
] | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/model/ObservationTree.java#L114-L116 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java | Agg.percentRank | public static <T extends Comparable<? super T>> Collector<T, ?, Optional<Double>> percentRank(T value) {
"""
Get a {@link Collector} that calculates the <code>PERCENT_RANK()</code> function given natural ordering.
"""
return percentRankBy(value, t -> t, naturalOrder());
} | java | public static <T extends Comparable<? super T>> Collector<T, ?, Optional<Double>> percentRank(T value) {
return percentRankBy(value, t -> t, naturalOrder());
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Optional",
"<",
"Double",
">",
">",
"percentRank",
"(",
"T",
"value",
")",
"{",
"return",
"percentRankBy",
"(",
"value",
"... | Get a {@link Collector} that calculates the <code>PERCENT_RANK()</code> function given natural ordering. | [
"Get",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L747-L749 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F64.java | ImplRectifyImageOps_F64.adjustUncalibrated | private static void adjustUncalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
RectangleLength2D_F64 bound, double scale) {
"""
Internal function which applies the rectification adjustment to an uncalibrated stereo pair
"""
// translation
double deltaX = -bound.x0*scale;
double deltaY = -bound.y0*scale;
// adjustment matrix
SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
rectifyLeft.set(A.mult(rL).getDDRM());
rectifyRight.set(A.mult(rR).getDDRM());
} | java | private static void adjustUncalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
RectangleLength2D_F64 bound, double scale) {
// translation
double deltaX = -bound.x0*scale;
double deltaY = -bound.y0*scale;
// adjustment matrix
SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
rectifyLeft.set(A.mult(rL).getDDRM());
rectifyRight.set(A.mult(rR).getDDRM());
} | [
"private",
"static",
"void",
"adjustUncalibrated",
"(",
"DMatrixRMaj",
"rectifyLeft",
",",
"DMatrixRMaj",
"rectifyRight",
",",
"RectangleLength2D_F64",
"bound",
",",
"double",
"scale",
")",
"{",
"// translation",
"double",
"deltaX",
"=",
"-",
"bound",
".",
"x0",
"... | Internal function which applies the rectification adjustment to an uncalibrated stereo pair | [
"Internal",
"function",
"which",
"applies",
"the",
"rectification",
"adjustment",
"to",
"an",
"uncalibrated",
"stereo",
"pair"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F64.java#L156-L169 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java | AtomicBiInteger.compareAndSetLo | public boolean compareAndSetLo(int expectLo, int lo) {
"""
<p>Atomically sets the lo value to the given updated value
only if the current value {@code ==} the expected value.</p>
<p>Concurrent changes to the hi value result in a retry.</p>
@param expectLo the expected lo value
@param lo the new lo value
@return {@code true} if successful. False return indicates that
the actual lo value was not equal to the expected lo value.
"""
while (true) {
long encoded = get();
if (getLo(encoded) != expectLo)
return false;
long update = encodeLo(encoded, lo);
if (compareAndSet(encoded, update))
return true;
}
} | java | public boolean compareAndSetLo(int expectLo, int lo) {
while (true) {
long encoded = get();
if (getLo(encoded) != expectLo)
return false;
long update = encodeLo(encoded, lo);
if (compareAndSet(encoded, update))
return true;
}
} | [
"public",
"boolean",
"compareAndSetLo",
"(",
"int",
"expectLo",
",",
"int",
"lo",
")",
"{",
"while",
"(",
"true",
")",
"{",
"long",
"encoded",
"=",
"get",
"(",
")",
";",
"if",
"(",
"getLo",
"(",
"encoded",
")",
"!=",
"expectLo",
")",
"return",
"false... | <p>Atomically sets the lo value to the given updated value
only if the current value {@code ==} the expected value.</p>
<p>Concurrent changes to the hi value result in a retry.</p>
@param expectLo the expected lo value
@param lo the new lo value
@return {@code true} if successful. False return indicates that
the actual lo value was not equal to the expected lo value. | [
"<p",
">",
"Atomically",
"sets",
"the",
"lo",
"value",
"to",
"the",
"given",
"updated",
"value",
"only",
"if",
"the",
"current",
"value",
"{",
"@code",
"==",
"}",
"the",
"expected",
"value",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Concurrent",
"changes",
... | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java#L94-L103 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optBinder | @Nullable
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static IBinder optBinder(@Nullable Bundle bundle, @Nullable String key) {
"""
Returns a optional {@link android.os.IBinder} value. In other words, returns the value mapped by key if it exists and is a {@link android.os.IBinder}.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return null.
@param key a key for the value.
@return a {@link android.os.IBinder} value if exists, null otherwise.
@see android.os.Bundle#getBinder(String)
"""
return optBinder(bundle, key, null);
} | java | @Nullable
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static IBinder optBinder(@Nullable Bundle bundle, @Nullable String key) {
return optBinder(bundle, key, null);
} | [
"@",
"Nullable",
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"JELLY_BEAN_MR2",
")",
"public",
"static",
"IBinder",
"optBinder",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optBinder",
"... | Returns a optional {@link android.os.IBinder} value. In other words, returns the value mapped by key if it exists and is a {@link android.os.IBinder}.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return null.
@param key a key for the value.
@return a {@link android.os.IBinder} value if exists, null otherwise.
@see android.os.Bundle#getBinder(String) | [
"Returns",
"a",
"optional",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L93-L97 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipAssert.java | SipAssert.assertBodyNotContains | public static void assertBodyNotContains(String msg, SipMessage sipMessage, String value) {
"""
Asserts that the body in the given SIP message does not contain the value given, or that there
is no body in the message. The assertion fails if the body is present and contains the value.
Assertion failure output includes the given message text.
@param msg message text to output if the assertion fails.
@param sipMessage the SIP message.
@param value the string value to look for in the body. An exact string match is done against
the entire contents of the body. The assertion will fail if any part of the body matches
the value given.
"""
assertNotNull("Null assert object passed in", sipMessage);
if (sipMessage.getContentLength() > 0) {
String body = new String(sipMessage.getRawContent());
if (body.indexOf(value) != -1) {
fail(msg);
}
}
assertTrue(true);
} | java | public static void assertBodyNotContains(String msg, SipMessage sipMessage, String value) {
assertNotNull("Null assert object passed in", sipMessage);
if (sipMessage.getContentLength() > 0) {
String body = new String(sipMessage.getRawContent());
if (body.indexOf(value) != -1) {
fail(msg);
}
}
assertTrue(true);
} | [
"public",
"static",
"void",
"assertBodyNotContains",
"(",
"String",
"msg",
",",
"SipMessage",
"sipMessage",
",",
"String",
"value",
")",
"{",
"assertNotNull",
"(",
"\"Null assert object passed in\"",
",",
"sipMessage",
")",
";",
"if",
"(",
"sipMessage",
".",
"getC... | Asserts that the body in the given SIP message does not contain the value given, or that there
is no body in the message. The assertion fails if the body is present and contains the value.
Assertion failure output includes the given message text.
@param msg message text to output if the assertion fails.
@param sipMessage the SIP message.
@param value the string value to look for in the body. An exact string match is done against
the entire contents of the body. The assertion will fail if any part of the body matches
the value given. | [
"Asserts",
"that",
"the",
"body",
"in",
"the",
"given",
"SIP",
"message",
"does",
"not",
"contain",
"the",
"value",
"given",
"or",
"that",
"there",
"is",
"no",
"body",
"in",
"the",
"message",
".",
"The",
"assertion",
"fails",
"if",
"the",
"body",
"is",
... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L735-L746 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Transformation2D.java | Transformation2D.setFlipX | public void setFlipX(double x0, double x1) {
"""
Sets the transformation to be a flip around the X axis. Flips the X
coordinates so that the x0 becomes x1 and vice verse.
@param x0
The X coordinate to flip.
@param x1
The X coordinate to flip to.
"""
xx = -1;
xy = 0;
xd = x0 + x1;
yx = 0;
yy = 1;
yd = 0;
} | java | public void setFlipX(double x0, double x1) {
xx = -1;
xy = 0;
xd = x0 + x1;
yx = 0;
yy = 1;
yd = 0;
} | [
"public",
"void",
"setFlipX",
"(",
"double",
"x0",
",",
"double",
"x1",
")",
"{",
"xx",
"=",
"-",
"1",
";",
"xy",
"=",
"0",
";",
"xd",
"=",
"x0",
"+",
"x1",
";",
"yx",
"=",
"0",
";",
"yy",
"=",
"1",
";",
"yd",
"=",
"0",
";",
"}"
] | Sets the transformation to be a flip around the X axis. Flips the X
coordinates so that the x0 becomes x1 and vice verse.
@param x0
The X coordinate to flip.
@param x1
The X coordinate to flip to. | [
"Sets",
"the",
"transformation",
"to",
"be",
"a",
"flip",
"around",
"the",
"X",
"axis",
".",
"Flips",
"the",
"X",
"coordinates",
"so",
"that",
"the",
"x0",
"becomes",
"x1",
"and",
"vice",
"verse",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L623-L630 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ExceptionRule.java | ExceptionRule.getMatchedDepth | private int getMatchedDepth(String exceptionType, Throwable ex) {
"""
Returns the matched depth.
@param exceptionType the exception type
@param ex the throwable exception
@return the matched depth
"""
Throwable t = ex.getCause();
if (t != null) {
return getMatchedDepth(exceptionType, t);
} else {
return getMatchedDepth(exceptionType, ex.getClass(), 0);
}
} | java | private int getMatchedDepth(String exceptionType, Throwable ex) {
Throwable t = ex.getCause();
if (t != null) {
return getMatchedDepth(exceptionType, t);
} else {
return getMatchedDepth(exceptionType, ex.getClass(), 0);
}
} | [
"private",
"int",
"getMatchedDepth",
"(",
"String",
"exceptionType",
",",
"Throwable",
"ex",
")",
"{",
"Throwable",
"t",
"=",
"ex",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"return",
"getMatchedDepth",
"(",
"exceptionType",
... | Returns the matched depth.
@param exceptionType the exception type
@param ex the throwable exception
@return the matched depth | [
"Returns",
"the",
"matched",
"depth",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ExceptionRule.java#L98-L105 |
belaban/JGroups | src/org/jgroups/protocols/KeyExchange.java | KeyExchange.setSecretKeyAbove | protected void setSecretKeyAbove(Tuple<SecretKey,byte[]> key) {
"""
Sets the secret key in a protocol above us
@param key The secret key and its version
"""
up_prot.up(new Event(Event.SET_SECRET_KEY, key));
} | java | protected void setSecretKeyAbove(Tuple<SecretKey,byte[]> key) {
up_prot.up(new Event(Event.SET_SECRET_KEY, key));
} | [
"protected",
"void",
"setSecretKeyAbove",
"(",
"Tuple",
"<",
"SecretKey",
",",
"byte",
"[",
"]",
">",
"key",
")",
"{",
"up_prot",
".",
"up",
"(",
"new",
"Event",
"(",
"Event",
".",
"SET_SECRET_KEY",
",",
"key",
")",
")",
";",
"}"
] | Sets the secret key in a protocol above us
@param key The secret key and its version | [
"Sets",
"the",
"secret",
"key",
"in",
"a",
"protocol",
"above",
"us"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/KeyExchange.java#L63-L65 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraTransaction.java | CassandraTransaction.createMutation | private static Mutation createMutation(byte[] colName, byte[] colValue, long timestamp) {
"""
Create a Mutation with the given column name and column value
"""
if (colValue == null) {
colValue = EMPTY_BYTES;
}
Column col = new Column();
col.setName(colName);
col.setValue(colValue);
col.setTimestamp(timestamp);
ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();
cosc.setColumn(col);
Mutation mutation = new Mutation();
mutation.setColumn_or_supercolumn(cosc);
return mutation;
} | java | private static Mutation createMutation(byte[] colName, byte[] colValue, long timestamp) {
if (colValue == null) {
colValue = EMPTY_BYTES;
}
Column col = new Column();
col.setName(colName);
col.setValue(colValue);
col.setTimestamp(timestamp);
ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();
cosc.setColumn(col);
Mutation mutation = new Mutation();
mutation.setColumn_or_supercolumn(cosc);
return mutation;
} | [
"private",
"static",
"Mutation",
"createMutation",
"(",
"byte",
"[",
"]",
"colName",
",",
"byte",
"[",
"]",
"colValue",
",",
"long",
"timestamp",
")",
"{",
"if",
"(",
"colValue",
"==",
"null",
")",
"{",
"colValue",
"=",
"EMPTY_BYTES",
";",
"}",
"Column",... | Create a Mutation with the given column name and column value | [
"Create",
"a",
"Mutation",
"with",
"the",
"given",
"column",
"name",
"and",
"column",
"value"
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraTransaction.java#L119-L134 |
jtablesaw/tablesaw | core/src/main/java/tech/tablesaw/api/Table.java | Table.sampleN | public Table sampleN(int nRows) {
"""
Returns a table consisting of randomly selected records from this table
@param nRows The number of rows to go in the sample
"""
Preconditions.checkArgument(nRows > 0 && nRows < rowCount(),
"The number of rows sampled must be greater than 0 and less than the number of rows in the table.");
return where(selectNRowsAtRandom(nRows, rowCount()));
} | java | public Table sampleN(int nRows) {
Preconditions.checkArgument(nRows > 0 && nRows < rowCount(),
"The number of rows sampled must be greater than 0 and less than the number of rows in the table.");
return where(selectNRowsAtRandom(nRows, rowCount()));
} | [
"public",
"Table",
"sampleN",
"(",
"int",
"nRows",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"nRows",
">",
"0",
"&&",
"nRows",
"<",
"rowCount",
"(",
")",
",",
"\"The number of rows sampled must be greater than 0 and less than the number of rows in the table.\"... | Returns a table consisting of randomly selected records from this table
@param nRows The number of rows to go in the sample | [
"Returns",
"a",
"table",
"consisting",
"of",
"randomly",
"selected",
"records",
"from",
"this",
"table"
] | train | https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L477-L481 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/shake/ShakeRenderer.java | ShakeRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
"""
This methods generates the HTML code of the current b:shake.
@param context the FacesContext.
@param component the current b:shake.
@throws IOException thrown if something goes wrong when writing the HTML code.
"""
if (!component.isRendered()) {
return;
}
Shake shake = (Shake) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = shake.getClientId();
rw.startElement("script", shake);
rw.writeAttribute("id", clientId, null);
rw.write("\nvar myShakeEvent = new Shake({\n");
rw.write(" threshold: " + shake.getThreshold() + ",\n");
rw.write(" timeout: " + shake.getInterval() + "\n");
rw.write("});\n");
if (!shake.isDisabled()) {
// Start listening to device motion:
rw.write("myShakeEvent.start();\n");
}
// Register a shake event listener on window with your callback:
rw.write("window.addEventListener('shake', function(){\n");
String code = new AJAXRenderer().generateBootsFacesAJAXAndJavaScriptForAnMobileEvent(context, shake, rw, "shake");
rw.write(code + "\n");
rw.write("}, false);\n");
rw.endElement("script");
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Shake shake = (Shake) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = shake.getClientId();
rw.startElement("script", shake);
rw.writeAttribute("id", clientId, null);
rw.write("\nvar myShakeEvent = new Shake({\n");
rw.write(" threshold: " + shake.getThreshold() + ",\n");
rw.write(" timeout: " + shake.getInterval() + "\n");
rw.write("});\n");
if (!shake.isDisabled()) {
// Start listening to device motion:
rw.write("myShakeEvent.start();\n");
}
// Register a shake event listener on window with your callback:
rw.write("window.addEventListener('shake', function(){\n");
String code = new AJAXRenderer().generateBootsFacesAJAXAndJavaScriptForAnMobileEvent(context, shake, rw, "shake");
rw.write(code + "\n");
rw.write("}, false);\n");
rw.endElement("script");
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Shake",
"shake",
... | This methods generates the HTML code of the current b:shake.
@param context the FacesContext.
@param component the current b:shake.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"shake",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/shake/ShakeRenderer.java#L78-L105 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/csv/CsvUtil.java | CsvUtil.getWriter | public static CsvWriter getWriter(String filePath, Charset charset, boolean isAppend) {
"""
获取CSV生成器(写出器),使用默认配置
@param filePath File CSV文件路径
@param charset 编码
@param isAppend 是否追加
"""
return new CsvWriter(filePath, charset, isAppend);
} | java | public static CsvWriter getWriter(String filePath, Charset charset, boolean isAppend) {
return new CsvWriter(filePath, charset, isAppend);
} | [
"public",
"static",
"CsvWriter",
"getWriter",
"(",
"String",
"filePath",
",",
"Charset",
"charset",
",",
"boolean",
"isAppend",
")",
"{",
"return",
"new",
"CsvWriter",
"(",
"filePath",
",",
"charset",
",",
"isAppend",
")",
";",
"}"
] | 获取CSV生成器(写出器),使用默认配置
@param filePath File CSV文件路径
@param charset 编码
@param isAppend 是否追加 | [
"获取CSV生成器(写出器),使用默认配置"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvUtil.java#L63-L65 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/MediaAPI.java | MediaAPI.mediaGet | public static MediaGetResult mediaGet(String access_token,String media_id,boolean use_http) {
"""
获取临时素材
@since 2.8.0
@param access_token access_token
@param media_id media_id
@param use_http 视频素材使用[http] true,其它使用[https] false.
@return MediaGetResult
"""
String http_s = use_http?BASE_URI.replace("https", "http"):BASE_URI;
HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(http_s + "/cgi-bin/media/get")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.addParameter("media_id", media_id)
.build();
return LocalHttpClient.execute(httpUriRequest,BytesOrJsonResponseHandler.createResponseHandler(MediaGetResult.class));
} | java | public static MediaGetResult mediaGet(String access_token,String media_id,boolean use_http){
String http_s = use_http?BASE_URI.replace("https", "http"):BASE_URI;
HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(http_s + "/cgi-bin/media/get")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.addParameter("media_id", media_id)
.build();
return LocalHttpClient.execute(httpUriRequest,BytesOrJsonResponseHandler.createResponseHandler(MediaGetResult.class));
} | [
"public",
"static",
"MediaGetResult",
"mediaGet",
"(",
"String",
"access_token",
",",
"String",
"media_id",
",",
"boolean",
"use_http",
")",
"{",
"String",
"http_s",
"=",
"use_http",
"?",
"BASE_URI",
".",
"replace",
"(",
"\"https\"",
",",
"\"http\"",
")",
":",... | 获取临时素材
@since 2.8.0
@param access_token access_token
@param media_id media_id
@param use_http 视频素材使用[http] true,其它使用[https] false.
@return MediaGetResult | [
"获取临时素材"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MediaAPI.java#L152-L160 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java | JavacParser.filterJavaFileObject | private static JavaFileObject filterJavaFileObject(JavaFileObject fobj) {
"""
To allow Java 9 libraries like GSON to be transpiled using -source 1.8, stub out
the module-info source. This creates an empty .o file, like package-info.java
files without annotations. Skipping the file isn't feasible because of build tool
output file expectations.
"""
String path = fobj.getName();
if (path.endsWith("module-info.java")) {
String pkgName = null;
try {
pkgName = moduleName(fobj.getCharContent(true).toString());
String source = "package " + pkgName + ";";
return new MemoryFileObject(path, JavaFileObject.Kind.SOURCE, source);
} catch (IOException e) {
// Fall-through
}
}
return fobj;
} | java | private static JavaFileObject filterJavaFileObject(JavaFileObject fobj) {
String path = fobj.getName();
if (path.endsWith("module-info.java")) {
String pkgName = null;
try {
pkgName = moduleName(fobj.getCharContent(true).toString());
String source = "package " + pkgName + ";";
return new MemoryFileObject(path, JavaFileObject.Kind.SOURCE, source);
} catch (IOException e) {
// Fall-through
}
}
return fobj;
} | [
"private",
"static",
"JavaFileObject",
"filterJavaFileObject",
"(",
"JavaFileObject",
"fobj",
")",
"{",
"String",
"path",
"=",
"fobj",
".",
"getName",
"(",
")",
";",
"if",
"(",
"path",
".",
"endsWith",
"(",
"\"module-info.java\"",
")",
")",
"{",
"String",
"p... | To allow Java 9 libraries like GSON to be transpiled using -source 1.8, stub out
the module-info source. This creates an empty .o file, like package-info.java
files without annotations. Skipping the file isn't feasible because of build tool
output file expectations. | [
"To",
"allow",
"Java",
"9",
"libraries",
"like",
"GSON",
"to",
"be",
"transpiled",
"using",
"-",
"source",
"1",
".",
"8",
"stub",
"out",
"the",
"module",
"-",
"info",
"source",
".",
"This",
"creates",
"an",
"empty",
".",
"o",
"file",
"like",
"package",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java#L220-L233 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/documents/XlsWorkbook.java | XlsWorkbook.createWorkbook | public static XlsWorkbook createWorkbook(OutputStream os, Workbook existing)
throws IOException {
"""
Creates a new workbook object.
@param os The output stream for the workbook
@param existing An existing workbook to add to
@return The new workbook object
@throws IOException if the workbook cannot be written
"""
try
{
if(existing != null)
return new XlsWorkbook(jxl.Workbook.createWorkbook(os,
(jxl.Workbook)existing.getWorkbook(), settings));
else
return new XlsWorkbook(jxl.Workbook.createWorkbook(os, settings));
}
catch(jxl.read.biff.BiffException e)
{
throw new IOException(e);
}
} | java | public static XlsWorkbook createWorkbook(OutputStream os, Workbook existing)
throws IOException
{
try
{
if(existing != null)
return new XlsWorkbook(jxl.Workbook.createWorkbook(os,
(jxl.Workbook)existing.getWorkbook(), settings));
else
return new XlsWorkbook(jxl.Workbook.createWorkbook(os, settings));
}
catch(jxl.read.biff.BiffException e)
{
throw new IOException(e);
}
} | [
"public",
"static",
"XlsWorkbook",
"createWorkbook",
"(",
"OutputStream",
"os",
",",
"Workbook",
"existing",
")",
"throws",
"IOException",
"{",
"try",
"{",
"if",
"(",
"existing",
"!=",
"null",
")",
"return",
"new",
"XlsWorkbook",
"(",
"jxl",
".",
"Workbook",
... | Creates a new workbook object.
@param os The output stream for the workbook
@param existing An existing workbook to add to
@return The new workbook object
@throws IOException if the workbook cannot be written | [
"Creates",
"a",
"new",
"workbook",
"object",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/XlsWorkbook.java#L213-L228 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/DateField.java | DateField.setupDefaultView | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) {
"""
Set up the default screen control for this field (Default using a DateConverter).
@param itsLocation Location of this component on screen (ie., GridBagConstraint).
@param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
@param converter The converter to set the screenfield to.
@param iDisplayFieldDesc Display the label? (optional).
@return Return the component or ScreenField that is created for this field.
For a Date field, use DateConverter.
"""
converter = new DateConverter((Converter)converter, DBConstants.DATE_FORMAT);
return super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
} | java | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
converter = new DateConverter((Converter)converter, DBConstants.DATE_FORMAT);
return super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
} | [
"public",
"ScreenComponent",
"setupDefaultView",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"Convert",
"converter",
",",
"int",
"iDisplayFieldDesc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"converter"... | Set up the default screen control for this field (Default using a DateConverter).
@param itsLocation Location of this component on screen (ie., GridBagConstraint).
@param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
@param converter The converter to set the screenfield to.
@param iDisplayFieldDesc Display the label? (optional).
@return Return the component or ScreenField that is created for this field.
For a Date field, use DateConverter. | [
"Set",
"up",
"the",
"default",
"screen",
"control",
"for",
"this",
"field",
"(",
"Default",
"using",
"a",
"DateConverter",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateField.java#L103-L107 |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java | PreprocessorContext.setSharedResource | public void setSharedResource(@Nonnull final String name, @Nonnull final Object obj) {
"""
Set a shared source, it is an object saved into the inside map for a name
@param name the name for the saved project, must not be null
@param obj the object to be saved in, must not be null
"""
assertNotNull("Name is null", name);
assertNotNull("Object is null", obj);
sharedResources.put(name, obj);
} | java | public void setSharedResource(@Nonnull final String name, @Nonnull final Object obj) {
assertNotNull("Name is null", name);
assertNotNull("Object is null", obj);
sharedResources.put(name, obj);
} | [
"public",
"void",
"setSharedResource",
"(",
"@",
"Nonnull",
"final",
"String",
"name",
",",
"@",
"Nonnull",
"final",
"Object",
"obj",
")",
"{",
"assertNotNull",
"(",
"\"Name is null\"",
",",
"name",
")",
";",
"assertNotNull",
"(",
"\"Object is null\"",
",",
"o... | Set a shared source, it is an object saved into the inside map for a name
@param name the name for the saved project, must not be null
@param obj the object to be saved in, must not be null | [
"Set",
"a",
"shared",
"source",
"it",
"is",
"an",
"object",
"saved",
"into",
"the",
"inside",
"map",
"for",
"a",
"name"
] | train | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java#L332-L337 |
akquinet/needle | src/main/java/de/akquinet/jbosscc/needle/db/transaction/TransactionHelper.java | TransactionHelper.executeInTransaction | public final <T> T executeInTransaction(final Runnable<T> runnable, final boolean clearAfterCommit)
throws Exception {
"""
Encapsulates execution of runnable.run() in transactions.
@param <T>
result type of runnable.run()
@param runnable
algorithm to execute
@param clearAfterCommit
<tt>true</tt> triggers entityManager.clear() after transaction
commit
@return return value of runnable.run()
@throws Exception
execution failed
"""
T result;
try {
entityManager.getTransaction().begin();
result = runnable.run(entityManager);
entityManager.flush();
entityManager.getTransaction().commit();
if (clearAfterCommit) {
entityManager.clear();
}
} finally {
if (entityManager.getTransaction().isActive()) {
entityManager.getTransaction().rollback();
}
}
return result;
} | java | public final <T> T executeInTransaction(final Runnable<T> runnable, final boolean clearAfterCommit)
throws Exception {
T result;
try {
entityManager.getTransaction().begin();
result = runnable.run(entityManager);
entityManager.flush();
entityManager.getTransaction().commit();
if (clearAfterCommit) {
entityManager.clear();
}
} finally {
if (entityManager.getTransaction().isActive()) {
entityManager.getTransaction().rollback();
}
}
return result;
} | [
"public",
"final",
"<",
"T",
">",
"T",
"executeInTransaction",
"(",
"final",
"Runnable",
"<",
"T",
">",
"runnable",
",",
"final",
"boolean",
"clearAfterCommit",
")",
"throws",
"Exception",
"{",
"T",
"result",
";",
"try",
"{",
"entityManager",
".",
"getTransa... | Encapsulates execution of runnable.run() in transactions.
@param <T>
result type of runnable.run()
@param runnable
algorithm to execute
@param clearAfterCommit
<tt>true</tt> triggers entityManager.clear() after transaction
commit
@return return value of runnable.run()
@throws Exception
execution failed | [
"Encapsulates",
"execution",
"of",
"runnable",
".",
"run",
"()",
"in",
"transactions",
"."
] | train | https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/db/transaction/TransactionHelper.java#L107-L127 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/SecureUberspector.java | SecureUberspector.getIterator | @Override
public Iterator getIterator(Object obj, Info i) throws Exception {
"""
Get an iterator from the given object. Since the superclass method this secure version checks for execute
permission.
@param obj object to iterate over
@param i line, column, template info
@return Iterator for object
@throws Exception when failing to get iterator
"""
if (obj != null) {
SecureIntrospectorControl sic = (SecureIntrospectorControl) this.introspector;
if (sic.checkObjectExecutePermission(obj.getClass(), null)) {
return super.getIterator(obj, i);
} else {
this.log.warn("Cannot retrieve iterator from " + obj.getClass() + " due to security restrictions.");
}
}
return null;
} | java | @Override
public Iterator getIterator(Object obj, Info i) throws Exception
{
if (obj != null) {
SecureIntrospectorControl sic = (SecureIntrospectorControl) this.introspector;
if (sic.checkObjectExecutePermission(obj.getClass(), null)) {
return super.getIterator(obj, i);
} else {
this.log.warn("Cannot retrieve iterator from " + obj.getClass() + " due to security restrictions.");
}
}
return null;
} | [
"@",
"Override",
"public",
"Iterator",
"getIterator",
"(",
"Object",
"obj",
",",
"Info",
"i",
")",
"throws",
"Exception",
"{",
"if",
"(",
"obj",
"!=",
"null",
")",
"{",
"SecureIntrospectorControl",
"sic",
"=",
"(",
"SecureIntrospectorControl",
")",
"this",
"... | Get an iterator from the given object. Since the superclass method this secure version checks for execute
permission.
@param obj object to iterate over
@param i line, column, template info
@return Iterator for object
@throws Exception when failing to get iterator | [
"Get",
"an",
"iterator",
"from",
"the",
"given",
"object",
".",
"Since",
"the",
"superclass",
"method",
"this",
"secure",
"version",
"checks",
"for",
"execute",
"permission",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/SecureUberspector.java#L63-L75 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/support/PropertyChangeSupportUtils.java | PropertyChangeSupportUtils.removePropertyChangeListener | public static void removePropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener) {
"""
Removes a named property change listener to the given JavaBean. The bean
must provide the optional support for listening on named properties
as described in section 7.4.5 of the
<a href="http://java.sun.com/products/javabeans/docs/spec.html">Java Bean
Specification</a>. The bean class must provide the method:
<pre>
public void removePropertyChangeHandler(String, PropertyChangeListener);
</pre>
@param bean the bean to remove the property change listener from
@param propertyName the name of the observed property
@param listener the listener to remove
@throws FatalBeanException
if the property change handler cannot be removed successfully
"""
Assert.notNull(propertyName, "The property name must not be null.");
Assert.notNull(listener, "The listener must not be null.");
if (bean instanceof PropertyChangePublisher) {
((PropertyChangePublisher)bean).removePropertyChangeListener(propertyName, listener);
}
else {
Class beanClass = bean.getClass();
Method namedPCLRemover = getNamedPCLRemover(beanClass);
if (namedPCLRemover == null)
throw new FatalBeanException("Could not find the bean method"
+ "/npublic void removePropertyChangeListener(String, PropertyChangeListener);/nin bean '"
+ bean + "'");
try {
namedPCLRemover.invoke(bean, new Object[] {propertyName, listener});
}
catch (InvocationTargetException e) {
throw new FatalBeanException("Due to an InvocationTargetException we failed to remove "
+ "a named PropertyChangeListener from bean '" + bean + "'", e);
}
catch (IllegalAccessException e) {
throw new FatalBeanException("Due to an IllegalAccessException we failed to remove "
+ "a named PropertyChangeListener from bean '" + bean + "'", e);
}
}
} | java | public static void removePropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener) {
Assert.notNull(propertyName, "The property name must not be null.");
Assert.notNull(listener, "The listener must not be null.");
if (bean instanceof PropertyChangePublisher) {
((PropertyChangePublisher)bean).removePropertyChangeListener(propertyName, listener);
}
else {
Class beanClass = bean.getClass();
Method namedPCLRemover = getNamedPCLRemover(beanClass);
if (namedPCLRemover == null)
throw new FatalBeanException("Could not find the bean method"
+ "/npublic void removePropertyChangeListener(String, PropertyChangeListener);/nin bean '"
+ bean + "'");
try {
namedPCLRemover.invoke(bean, new Object[] {propertyName, listener});
}
catch (InvocationTargetException e) {
throw new FatalBeanException("Due to an InvocationTargetException we failed to remove "
+ "a named PropertyChangeListener from bean '" + bean + "'", e);
}
catch (IllegalAccessException e) {
throw new FatalBeanException("Due to an IllegalAccessException we failed to remove "
+ "a named PropertyChangeListener from bean '" + bean + "'", e);
}
}
} | [
"public",
"static",
"void",
"removePropertyChangeListener",
"(",
"Object",
"bean",
",",
"String",
"propertyName",
",",
"PropertyChangeListener",
"listener",
")",
"{",
"Assert",
".",
"notNull",
"(",
"propertyName",
",",
"\"The property name must not be null.\"",
")",
";"... | Removes a named property change listener to the given JavaBean. The bean
must provide the optional support for listening on named properties
as described in section 7.4.5 of the
<a href="http://java.sun.com/products/javabeans/docs/spec.html">Java Bean
Specification</a>. The bean class must provide the method:
<pre>
public void removePropertyChangeHandler(String, PropertyChangeListener);
</pre>
@param bean the bean to remove the property change listener from
@param propertyName the name of the observed property
@param listener the listener to remove
@throws FatalBeanException
if the property change handler cannot be removed successfully | [
"Removes",
"a",
"named",
"property",
"change",
"listener",
"to",
"the",
"given",
"JavaBean",
".",
"The",
"bean",
"must",
"provide",
"the",
"optional",
"support",
"for",
"listening",
"on",
"named",
"properties",
"as",
"described",
"in",
"section",
"7",
".",
"... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/support/PropertyChangeSupportUtils.java#L120-L145 |
uber/AutoDispose | android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/AndroidLifecycleScopeProvider.java | AndroidLifecycleScopeProvider.from | public static AndroidLifecycleScopeProvider from(
Lifecycle lifecycle, CorrespondingEventsFunction<Lifecycle.Event> boundaryResolver) {
"""
Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles.
@param lifecycle the lifecycle to scope for.
@param boundaryResolver function that resolves the event boundary.
@return a {@link AndroidLifecycleScopeProvider} against this lifecycle.
"""
return new AndroidLifecycleScopeProvider(lifecycle, boundaryResolver);
} | java | public static AndroidLifecycleScopeProvider from(
Lifecycle lifecycle, CorrespondingEventsFunction<Lifecycle.Event> boundaryResolver) {
return new AndroidLifecycleScopeProvider(lifecycle, boundaryResolver);
} | [
"public",
"static",
"AndroidLifecycleScopeProvider",
"from",
"(",
"Lifecycle",
"lifecycle",
",",
"CorrespondingEventsFunction",
"<",
"Lifecycle",
".",
"Event",
">",
"boundaryResolver",
")",
"{",
"return",
"new",
"AndroidLifecycleScopeProvider",
"(",
"lifecycle",
",",
"b... | Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles.
@param lifecycle the lifecycle to scope for.
@param boundaryResolver function that resolves the event boundary.
@return a {@link AndroidLifecycleScopeProvider} against this lifecycle. | [
"Creates",
"a",
"{",
"@link",
"AndroidLifecycleScopeProvider",
"}",
"for",
"Android",
"Lifecycles",
"."
] | train | https://github.com/uber/AutoDispose/blob/1115b0274f7960354289bb3ae7ba75b0c5a47457/android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/AndroidLifecycleScopeProvider.java#L124-L127 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java | ReflectionUtils.isAnnotationPresent | public static boolean isAnnotationPresent(Field field, Class<? extends Annotation> annotationType) {
"""
Checks if field or corresponding read method is annotated with given annotationType.
@param field Field to check
@param annotationType Annotation you're looking for.
@return true if field or read method it annotated with given annotationType or false.
"""
final Optional<Method> readMethod = getReadMethod(field);
return field.isAnnotationPresent(annotationType) || readMethod.isPresent() && readMethod.get().isAnnotationPresent(annotationType);
} | java | public static boolean isAnnotationPresent(Field field, Class<? extends Annotation> annotationType) {
final Optional<Method> readMethod = getReadMethod(field);
return field.isAnnotationPresent(annotationType) || readMethod.isPresent() && readMethod.get().isAnnotationPresent(annotationType);
} | [
"public",
"static",
"boolean",
"isAnnotationPresent",
"(",
"Field",
"field",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"final",
"Optional",
"<",
"Method",
">",
"readMethod",
"=",
"getReadMethod",
"(",
"field",
")",
";",
... | Checks if field or corresponding read method is annotated with given annotationType.
@param field Field to check
@param annotationType Annotation you're looking for.
@return true if field or read method it annotated with given annotationType or false. | [
"Checks",
"if",
"field",
"or",
"corresponding",
"read",
"method",
"is",
"annotated",
"with",
"given",
"annotationType",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L419-L422 |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/key/PrivateKeyExtensions.java | PrivateKeyExtensions.toPemFormat | public static String toPemFormat(final PrivateKey privateKey) throws IOException {
"""
Transform the given private key that is in PKCS1 format and returns a {@link String} object
in pem format.
@param privateKey
the private key
@return the {@link String} object in pem format generated from the given private key.
@throws IOException
Signals that an I/O exception has occurred.
"""
return PemObjectReader.toPemFormat(
new PemObject(PrivateKeyReader.RSA_PRIVATE_KEY, toPKCS1Format(privateKey)));
} | java | public static String toPemFormat(final PrivateKey privateKey) throws IOException
{
return PemObjectReader.toPemFormat(
new PemObject(PrivateKeyReader.RSA_PRIVATE_KEY, toPKCS1Format(privateKey)));
} | [
"public",
"static",
"String",
"toPemFormat",
"(",
"final",
"PrivateKey",
"privateKey",
")",
"throws",
"IOException",
"{",
"return",
"PemObjectReader",
".",
"toPemFormat",
"(",
"new",
"PemObject",
"(",
"PrivateKeyReader",
".",
"RSA_PRIVATE_KEY",
",",
"toPKCS1Format",
... | Transform the given private key that is in PKCS1 format and returns a {@link String} object
in pem format.
@param privateKey
the private key
@return the {@link String} object in pem format generated from the given private key.
@throws IOException
Signals that an I/O exception has occurred. | [
"Transform",
"the",
"given",
"private",
"key",
"that",
"is",
"in",
"PKCS1",
"format",
"and",
"returns",
"a",
"{",
"@link",
"String",
"}",
"object",
"in",
"pem",
"format",
"."
] | train | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/PrivateKeyExtensions.java#L213-L217 |
gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/FormService.java | FormService.fillFormField_locator | public WebElement fillFormField_locator(String locator, String value) {
"""
Fill out a form field with the passed value
@param locator as specified in {@link ElementService#translateLocatorToWebElement(String)}
@param value the value to fill the field with
@return the {@link WebElement} representing the form field
"""
WebElement fieldEl = seleniumElementService.translateLocatorToWebElement(locator);
fieldEl.clear();
fieldEl.sendKeys(getReferenceService().namespaceString(value));
return fieldEl;
} | java | public WebElement fillFormField_locator(String locator, String value) {
WebElement fieldEl = seleniumElementService.translateLocatorToWebElement(locator);
fieldEl.clear();
fieldEl.sendKeys(getReferenceService().namespaceString(value));
return fieldEl;
} | [
"public",
"WebElement",
"fillFormField_locator",
"(",
"String",
"locator",
",",
"String",
"value",
")",
"{",
"WebElement",
"fieldEl",
"=",
"seleniumElementService",
".",
"translateLocatorToWebElement",
"(",
"locator",
")",
";",
"fieldEl",
".",
"clear",
"(",
")",
"... | Fill out a form field with the passed value
@param locator as specified in {@link ElementService#translateLocatorToWebElement(String)}
@param value the value to fill the field with
@return the {@link WebElement} representing the form field | [
"Fill",
"out",
"a",
"form",
"field",
"with",
"the",
"passed",
"value"
] | train | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/FormService.java#L32-L37 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.deleteUser | protected void deleteUser(CmsRequestContext context, CmsUser user, CmsUser replacement)
throws CmsException, CmsSecurityException, CmsRoleViolationException {
"""
Deletes a user, where all permissions and resources attributes of the user
were transfered to a replacement user, if given.<p>
@param context the current request context
@param user the user to be deleted
@param replacement the user to be transfered, can be <code>null</code>
@throws CmsRoleViolationException if the current user does not own the rule {@link CmsRole#ACCOUNT_MANAGER}
@throws CmsSecurityException in case the user is a default user
@throws CmsException if something goes wrong
"""
if (OpenCms.getDefaultUsers().isDefaultUser(user.getName())) {
throw new CmsSecurityException(
org.opencms.security.Messages.get().container(
org.opencms.security.Messages.ERR_CANT_DELETE_DEFAULT_USER_1,
user.getName()));
}
if (context.getCurrentUser().equals(user)) {
throw new CmsSecurityException(Messages.get().container(Messages.ERR_USER_CANT_DELETE_ITSELF_USER_0));
}
CmsDbContext dbc = null;
try {
dbc = getDbContextForDeletePrincipal(context);
CmsRole role = CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(user.getName()));
checkRoleForUserModification(dbc, user.getName(), role);
m_driverManager.deleteUser(
dbc,
dbc.getRequestContext().getCurrentProject(),
user.getName(),
null == replacement ? null : replacement.getName());
} catch (Exception e) {
CmsDbContext dbcForException = m_dbContextFactory.getDbContext(context);
dbcForException.report(null, Messages.get().container(Messages.ERR_DELETE_USER_1, user.getName()), e);
dbcForException.clear();
} finally {
if (null != dbc) {
dbc.clear();
}
}
} | java | protected void deleteUser(CmsRequestContext context, CmsUser user, CmsUser replacement)
throws CmsException, CmsSecurityException, CmsRoleViolationException {
if (OpenCms.getDefaultUsers().isDefaultUser(user.getName())) {
throw new CmsSecurityException(
org.opencms.security.Messages.get().container(
org.opencms.security.Messages.ERR_CANT_DELETE_DEFAULT_USER_1,
user.getName()));
}
if (context.getCurrentUser().equals(user)) {
throw new CmsSecurityException(Messages.get().container(Messages.ERR_USER_CANT_DELETE_ITSELF_USER_0));
}
CmsDbContext dbc = null;
try {
dbc = getDbContextForDeletePrincipal(context);
CmsRole role = CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(user.getName()));
checkRoleForUserModification(dbc, user.getName(), role);
m_driverManager.deleteUser(
dbc,
dbc.getRequestContext().getCurrentProject(),
user.getName(),
null == replacement ? null : replacement.getName());
} catch (Exception e) {
CmsDbContext dbcForException = m_dbContextFactory.getDbContext(context);
dbcForException.report(null, Messages.get().container(Messages.ERR_DELETE_USER_1, user.getName()), e);
dbcForException.clear();
} finally {
if (null != dbc) {
dbc.clear();
}
}
} | [
"protected",
"void",
"deleteUser",
"(",
"CmsRequestContext",
"context",
",",
"CmsUser",
"user",
",",
"CmsUser",
"replacement",
")",
"throws",
"CmsException",
",",
"CmsSecurityException",
",",
"CmsRoleViolationException",
"{",
"if",
"(",
"OpenCms",
".",
"getDefaultUser... | Deletes a user, where all permissions and resources attributes of the user
were transfered to a replacement user, if given.<p>
@param context the current request context
@param user the user to be deleted
@param replacement the user to be transfered, can be <code>null</code>
@throws CmsRoleViolationException if the current user does not own the rule {@link CmsRole#ACCOUNT_MANAGER}
@throws CmsSecurityException in case the user is a default user
@throws CmsException if something goes wrong | [
"Deletes",
"a",
"user",
"where",
"all",
"permissions",
"and",
"resources",
"attributes",
"of",
"the",
"user",
"were",
"transfered",
"to",
"a",
"replacement",
"user",
"if",
"given",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L7192-L7224 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java | JQLChecker.extractPlaceHoldersAsList | public List<JQLPlaceHolder> extractPlaceHoldersAsList(final JQLContext jqlContext, String jql) {
"""
Extract all bind parameters and dynamic part used in query.
@param jqlContext
the jql context
@param jql
the jql
@return the list
"""
return extractPlaceHolders(jqlContext, jql, new ArrayList<JQLPlaceHolder>());
} | java | public List<JQLPlaceHolder> extractPlaceHoldersAsList(final JQLContext jqlContext, String jql) {
return extractPlaceHolders(jqlContext, jql, new ArrayList<JQLPlaceHolder>());
} | [
"public",
"List",
"<",
"JQLPlaceHolder",
">",
"extractPlaceHoldersAsList",
"(",
"final",
"JQLContext",
"jqlContext",
",",
"String",
"jql",
")",
"{",
"return",
"extractPlaceHolders",
"(",
"jqlContext",
",",
"jql",
",",
"new",
"ArrayList",
"<",
"JQLPlaceHolder",
">"... | Extract all bind parameters and dynamic part used in query.
@param jqlContext
the jql context
@param jql
the jql
@return the list | [
"Extract",
"all",
"bind",
"parameters",
"and",
"dynamic",
"part",
"used",
"in",
"query",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L820-L822 |
forge/core | projects/api/src/main/java/org/jboss/forge/addon/projects/ui/AbstractProjectCommand.java | AbstractProjectCommand.filterValueChoicesFromStack | protected <T extends ProjectFacet> boolean filterValueChoicesFromStack(Project project, UISelectOne<T> select) {
"""
Filters the given value choices according the current enabled stack
@param select the {@link SelectComponent} containing the value choices to be filtered
@return <code>true</code> if it should be displayed in the UI
"""
boolean result = true;
Optional<Stack> stackOptional = project.getStack();
// Filtering only supported facets
if (stackOptional.isPresent())
{
Stack stack = stackOptional.get();
Iterable<T> valueChoices = select.getValueChoices();
Set<T> filter = stack.filter(select.getValueType(), valueChoices);
select.setValueChoices(filter);
if (filter.size() == 1)
{
select.setDefaultValue(filter.iterator().next());
result = false;
}
else if (filter.size() == 0)
{
result = false;
}
// FIXME: JBIDE-21584: Contains return false because of proxy class
// else if (!filter.contains(select.getValue()))
// {
// select.setDefaultValue((T) null);
// }
}
return result;
} | java | protected <T extends ProjectFacet> boolean filterValueChoicesFromStack(Project project, UISelectOne<T> select)
{
boolean result = true;
Optional<Stack> stackOptional = project.getStack();
// Filtering only supported facets
if (stackOptional.isPresent())
{
Stack stack = stackOptional.get();
Iterable<T> valueChoices = select.getValueChoices();
Set<T> filter = stack.filter(select.getValueType(), valueChoices);
select.setValueChoices(filter);
if (filter.size() == 1)
{
select.setDefaultValue(filter.iterator().next());
result = false;
}
else if (filter.size() == 0)
{
result = false;
}
// FIXME: JBIDE-21584: Contains return false because of proxy class
// else if (!filter.contains(select.getValue()))
// {
// select.setDefaultValue((T) null);
// }
}
return result;
} | [
"protected",
"<",
"T",
"extends",
"ProjectFacet",
">",
"boolean",
"filterValueChoicesFromStack",
"(",
"Project",
"project",
",",
"UISelectOne",
"<",
"T",
">",
"select",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"Optional",
"<",
"Stack",
">",
"stackOptio... | Filters the given value choices according the current enabled stack
@param select the {@link SelectComponent} containing the value choices to be filtered
@return <code>true</code> if it should be displayed in the UI | [
"Filters",
"the",
"given",
"value",
"choices",
"according",
"the",
"current",
"enabled",
"stack"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/projects/api/src/main/java/org/jboss/forge/addon/projects/ui/AbstractProjectCommand.java#L102-L129 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/io/TemporaryFilesystem.java | TemporaryFilesystem.createTempDir | public File createTempDir(String prefix, String suffix) {
"""
Create a temporary directory, and track it for deletion.
@param prefix the prefix to use when creating the temporary directory
@param suffix the suffix to use when creating the temporary directory
@return the temporary directory to create
"""
try {
// Create a tempfile, and delete it.
File file = File.createTempFile(prefix, suffix, baseDir);
file.delete();
// Create it as a directory.
File dir = new File(file.getAbsolutePath());
if (!dir.mkdirs()) {
throw new WebDriverException("Cannot create profile directory at " + dir.getAbsolutePath());
}
// Create the directory and mark it writable.
FileHandler.createDir(dir);
temporaryFiles.add(dir);
return dir;
} catch (IOException e) {
throw new WebDriverException(
"Unable to create temporary file at " + baseDir.getAbsolutePath());
}
} | java | public File createTempDir(String prefix, String suffix) {
try {
// Create a tempfile, and delete it.
File file = File.createTempFile(prefix, suffix, baseDir);
file.delete();
// Create it as a directory.
File dir = new File(file.getAbsolutePath());
if (!dir.mkdirs()) {
throw new WebDriverException("Cannot create profile directory at " + dir.getAbsolutePath());
}
// Create the directory and mark it writable.
FileHandler.createDir(dir);
temporaryFiles.add(dir);
return dir;
} catch (IOException e) {
throw new WebDriverException(
"Unable to create temporary file at " + baseDir.getAbsolutePath());
}
} | [
"public",
"File",
"createTempDir",
"(",
"String",
"prefix",
",",
"String",
"suffix",
")",
"{",
"try",
"{",
"// Create a tempfile, and delete it.",
"File",
"file",
"=",
"File",
".",
"createTempFile",
"(",
"prefix",
",",
"suffix",
",",
"baseDir",
")",
";",
"file... | Create a temporary directory, and track it for deletion.
@param prefix the prefix to use when creating the temporary directory
@param suffix the suffix to use when creating the temporary directory
@return the temporary directory to create | [
"Create",
"a",
"temporary",
"directory",
"and",
"track",
"it",
"for",
"deletion",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/io/TemporaryFilesystem.java#L90-L111 |
LearnLib/learnlib | commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java | GlobalSuffixFinders.fromLocalFinder | public static <I, D> GlobalSuffixFinder<I, D> fromLocalFinder(LocalSuffixFinder<I, D> localFinder) {
"""
Transforms a {@link LocalSuffixFinder} into a global one. This is a convenience method, behaving like
{@link #fromLocalFinder(LocalSuffixFinder, boolean)}.
@see #fromLocalFinder(LocalSuffixFinder, boolean)
"""
return fromLocalFinder(localFinder, false);
} | java | public static <I, D> GlobalSuffixFinder<I, D> fromLocalFinder(LocalSuffixFinder<I, D> localFinder) {
return fromLocalFinder(localFinder, false);
} | [
"public",
"static",
"<",
"I",
",",
"D",
">",
"GlobalSuffixFinder",
"<",
"I",
",",
"D",
">",
"fromLocalFinder",
"(",
"LocalSuffixFinder",
"<",
"I",
",",
"D",
">",
"localFinder",
")",
"{",
"return",
"fromLocalFinder",
"(",
"localFinder",
",",
"false",
")",
... | Transforms a {@link LocalSuffixFinder} into a global one. This is a convenience method, behaving like
{@link #fromLocalFinder(LocalSuffixFinder, boolean)}.
@see #fromLocalFinder(LocalSuffixFinder, boolean) | [
"Transforms",
"a",
"{",
"@link",
"LocalSuffixFinder",
"}",
"into",
"a",
"global",
"one",
".",
"This",
"is",
"a",
"convenience",
"method",
"behaving",
"like",
"{",
"@link",
"#fromLocalFinder",
"(",
"LocalSuffixFinder",
"boolean",
")",
"}",
"."
] | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java#L136-L138 |
OpenTSDB/opentsdb | src/tsd/AnnotationRpc.java | AnnotationRpc.executeBulk | void executeBulk(final TSDB tsdb, final HttpMethod method, HttpQuery query) {
"""
Performs CRUD methods on a list of annotation objects to reduce calls to
the API.
@param tsdb The TSD to which we belong
@param method The request method
@param query The query to parse and respond to
"""
if (method == HttpMethod.POST || method == HttpMethod.PUT) {
executeBulkUpdate(tsdb, method, query);
} else if (method == HttpMethod.DELETE) {
executeBulkDelete(tsdb, query);
} else {
throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed", "The HTTP method [" + query.method().getName() +
"] is not permitted for this endpoint");
}
} | java | void executeBulk(final TSDB tsdb, final HttpMethod method, HttpQuery query) {
if (method == HttpMethod.POST || method == HttpMethod.PUT) {
executeBulkUpdate(tsdb, method, query);
} else if (method == HttpMethod.DELETE) {
executeBulkDelete(tsdb, query);
} else {
throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed", "The HTTP method [" + query.method().getName() +
"] is not permitted for this endpoint");
}
} | [
"void",
"executeBulk",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"HttpMethod",
"method",
",",
"HttpQuery",
"query",
")",
"{",
"if",
"(",
"method",
"==",
"HttpMethod",
".",
"POST",
"||",
"method",
"==",
"HttpMethod",
".",
"PUT",
")",
"{",
"executeBulkUpda... | Performs CRUD methods on a list of annotation objects to reduce calls to
the API.
@param tsdb The TSD to which we belong
@param method The request method
@param query The query to parse and respond to | [
"Performs",
"CRUD",
"methods",
"on",
"a",
"list",
"of",
"annotation",
"objects",
"to",
"reduce",
"calls",
"to",
"the",
"API",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/AnnotationRpc.java#L143-L153 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java | UnitResponse.createException | public static UnitResponse createException(String errCode, Throwable exception, String errMsg) {
"""
Create a exception unit response.
This method is the same as {@link #createError(String, Object, String)}
@param errCode error code
@param exception exception
@param errMsg error message
@return a newly created unit response representing the exception.
"""
return UnitResponse.createException(errCode, exception).setMessage(errMsg);
} | java | public static UnitResponse createException(String errCode, Throwable exception, String errMsg) {
return UnitResponse.createException(errCode, exception).setMessage(errMsg);
} | [
"public",
"static",
"UnitResponse",
"createException",
"(",
"String",
"errCode",
",",
"Throwable",
"exception",
",",
"String",
"errMsg",
")",
"{",
"return",
"UnitResponse",
".",
"createException",
"(",
"errCode",
",",
"exception",
")",
".",
"setMessage",
"(",
"e... | Create a exception unit response.
This method is the same as {@link #createError(String, Object, String)}
@param errCode error code
@param exception exception
@param errMsg error message
@return a newly created unit response representing the exception. | [
"Create",
"a",
"exception",
"unit",
"response",
".",
"This",
"method",
"is",
"the",
"same",
"as",
"{",
"@link",
"#createError",
"(",
"String",
"Object",
"String",
")",
"}"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L152-L154 |
indeedeng/proctor | proctor-store-svn/src/main/java/com/indeed/proctor/store/SvnWorkspaceProviderImpl.java | SvnWorkspaceProviderImpl.getUserDirectory | private static File getUserDirectory(final String prefix, final String suffix, final File parent) {
"""
Returns a File object whose path is the expected user directory.
Does not create or check for existence.
@param prefix
@param suffix
@param parent
@return
"""
final String dirname = formatDirName(prefix, suffix);
return new File(parent, dirname);
} | java | private static File getUserDirectory(final String prefix, final String suffix, final File parent) {
final String dirname = formatDirName(prefix, suffix);
return new File(parent, dirname);
} | [
"private",
"static",
"File",
"getUserDirectory",
"(",
"final",
"String",
"prefix",
",",
"final",
"String",
"suffix",
",",
"final",
"File",
"parent",
")",
"{",
"final",
"String",
"dirname",
"=",
"formatDirName",
"(",
"prefix",
",",
"suffix",
")",
";",
"return... | Returns a File object whose path is the expected user directory.
Does not create or check for existence.
@param prefix
@param suffix
@param parent
@return | [
"Returns",
"a",
"File",
"object",
"whose",
"path",
"is",
"the",
"expected",
"user",
"directory",
".",
"Does",
"not",
"create",
"or",
"check",
"for",
"existence",
"."
] | train | https://github.com/indeedeng/proctor/blob/b7795acfc26a30d013655d0e0fa1d3f8d0576571/proctor-store-svn/src/main/java/com/indeed/proctor/store/SvnWorkspaceProviderImpl.java#L169-L172 |
metafacture/metafacture-core | metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/Iso646ByteBuffer.java | Iso646ByteBuffer.distanceTo | int distanceTo(final byte byteValue, final int fromIndex) {
"""
Returns the distance from {@code fromIndex} to the next occurrence of
{@code byteValue}. If the byte at {@code fromIndex} is equal to {@code
byteValue} zero is returned. If there are no matching bytes between
{@code fromIndex} and the end of the buffer then the distance to the end
of the buffer is returned.
@param byteValue byte to search for.
@param fromIndex the position in the buffer from which to start searching.
@return the distance in bytes to the next byte with the given value or if
none is found to the end of the buffer.
"""
assert 0 <= fromIndex && fromIndex < byteArray.length;
int index = fromIndex;
for (; index < byteArray.length; ++index) {
if (byteValue == byteArray[index]) {
break;
}
}
return index - fromIndex;
} | java | int distanceTo(final byte byteValue, final int fromIndex) {
assert 0 <= fromIndex && fromIndex < byteArray.length;
int index = fromIndex;
for (; index < byteArray.length; ++index) {
if (byteValue == byteArray[index]) {
break;
}
}
return index - fromIndex;
} | [
"int",
"distanceTo",
"(",
"final",
"byte",
"byteValue",
",",
"final",
"int",
"fromIndex",
")",
"{",
"assert",
"0",
"<=",
"fromIndex",
"&&",
"fromIndex",
"<",
"byteArray",
".",
"length",
";",
"int",
"index",
"=",
"fromIndex",
";",
"for",
"(",
";",
"index"... | Returns the distance from {@code fromIndex} to the next occurrence of
{@code byteValue}. If the byte at {@code fromIndex} is equal to {@code
byteValue} zero is returned. If there are no matching bytes between
{@code fromIndex} and the end of the buffer then the distance to the end
of the buffer is returned.
@param byteValue byte to search for.
@param fromIndex the position in the buffer from which to start searching.
@return the distance in bytes to the next byte with the given value or if
none is found to the end of the buffer. | [
"Returns",
"the",
"distance",
"from",
"{",
"@code",
"fromIndex",
"}",
"to",
"the",
"next",
"occurrence",
"of",
"{",
"@code",
"byteValue",
"}",
".",
"If",
"the",
"byte",
"at",
"{",
"@code",
"fromIndex",
"}",
"is",
"equal",
"to",
"{",
"@code",
"byteValue",... | train | https://github.com/metafacture/metafacture-core/blob/cb43933ec8eb01a4ddce4019c14b2415cc441918/metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/Iso646ByteBuffer.java#L82-L91 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java | AbstractRedisStorage.settLastTriggerReleaseTime | protected void settLastTriggerReleaseTime(long time, T jedis) {
"""
Set the last time at which orphaned triggers were released
@param time a unix timestamp in milliseconds
@param jedis a thread-safe Redis connection
"""
jedis.set(redisSchema.lastTriggerReleaseTime(), Long.toString(time));
} | java | protected void settLastTriggerReleaseTime(long time, T jedis){
jedis.set(redisSchema.lastTriggerReleaseTime(), Long.toString(time));
} | [
"protected",
"void",
"settLastTriggerReleaseTime",
"(",
"long",
"time",
",",
"T",
"jedis",
")",
"{",
"jedis",
".",
"set",
"(",
"redisSchema",
".",
"lastTriggerReleaseTime",
"(",
")",
",",
"Long",
".",
"toString",
"(",
"time",
")",
")",
";",
"}"
] | Set the last time at which orphaned triggers were released
@param time a unix timestamp in milliseconds
@param jedis a thread-safe Redis connection | [
"Set",
"the",
"last",
"time",
"at",
"which",
"orphaned",
"triggers",
"were",
"released"
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L726-L728 |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/paging/SkipLimitPaging.java | SkipLimitPaging.calcLastPageSkip | private int calcLastPageSkip(int total, int skip, int limit) {
"""
Calculate the number of items to skip for the last page.
@param total total number of items.
@param skip number of items to skip for the current page.
@param limit page size
@return skipped items
"""
if (skip > total - limit) {
return skip;
}
if (total % limit > 0) {
return total - total % limit;
}
return total - limit;
} | java | private int calcLastPageSkip(int total, int skip, int limit) {
if (skip > total - limit) {
return skip;
}
if (total % limit > 0) {
return total - total % limit;
}
return total - limit;
} | [
"private",
"int",
"calcLastPageSkip",
"(",
"int",
"total",
",",
"int",
"skip",
",",
"int",
"limit",
")",
"{",
"if",
"(",
"skip",
">",
"total",
"-",
"limit",
")",
"{",
"return",
"skip",
";",
"}",
"if",
"(",
"total",
"%",
"limit",
">",
"0",
")",
"{... | Calculate the number of items to skip for the last page.
@param total total number of items.
@param skip number of items to skip for the current page.
@param limit page size
@return skipped items | [
"Calculate",
"the",
"number",
"of",
"items",
"to",
"skip",
"for",
"the",
"last",
"page",
"."
] | train | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/paging/SkipLimitPaging.java#L278-L286 |
kite-sdk/kite | kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Marker.java | Marker.valueFor | @Nullable
public <S, T> T valueFor(FieldPartitioner<S, T> fp) {
"""
Return the value of a {@code FieldPartitioner} field for this {@link Marker}.
If the {@code Marker} has a value for the field's name, that value is
returned using {@link Marker#getAs(java.lang.String, java.lang.Class)}. If
the {@code Marker} only has a value for the the source field name, then
that value is retrieved using
{@link org.kitesdk.data.spi.Marker#getAs(java.lang.String,
java.lang.Class)} and the field's transformation is applied to it as the source value.
@param fp a {@code FieldPartitioner}
@return the value of the field for this {@code marker}, or null
@since 0.9.0
"""
if (has(fp.getName())) {
return getAs(fp.getName(), fp.getType());
} else if (has(fp.getSourceName())) {
return fp.apply(getAs(fp.getSourceName(), fp.getSourceType()));
} else {
return null;
}
} | java | @Nullable
public <S, T> T valueFor(FieldPartitioner<S, T> fp) {
if (has(fp.getName())) {
return getAs(fp.getName(), fp.getType());
} else if (has(fp.getSourceName())) {
return fp.apply(getAs(fp.getSourceName(), fp.getSourceType()));
} else {
return null;
}
} | [
"@",
"Nullable",
"public",
"<",
"S",
",",
"T",
">",
"T",
"valueFor",
"(",
"FieldPartitioner",
"<",
"S",
",",
"T",
">",
"fp",
")",
"{",
"if",
"(",
"has",
"(",
"fp",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"getAs",
"(",
"fp",
".",
"g... | Return the value of a {@code FieldPartitioner} field for this {@link Marker}.
If the {@code Marker} has a value for the field's name, that value is
returned using {@link Marker#getAs(java.lang.String, java.lang.Class)}. If
the {@code Marker} only has a value for the the source field name, then
that value is retrieved using
{@link org.kitesdk.data.spi.Marker#getAs(java.lang.String,
java.lang.Class)} and the field's transformation is applied to it as the source value.
@param fp a {@code FieldPartitioner}
@return the value of the field for this {@code marker}, or null
@since 0.9.0 | [
"Return",
"the",
"value",
"of",
"a",
"{",
"@code",
"FieldPartitioner",
"}",
"field",
"for",
"this",
"{",
"@link",
"Marker",
"}",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Marker.java#L111-L120 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/PeriodFormatterBuilder.java | PeriodFormatterBuilder.appendPrefix | private PeriodFormatterBuilder appendPrefix(PeriodFieldAffix prefix) {
"""
Append a field prefix which applies only to the next appended field. If
the field is not printed, neither is the prefix.
@param prefix custom prefix
@return this PeriodFormatterBuilder
@see #appendSuffix
"""
if (prefix == null) {
throw new IllegalArgumentException();
}
if (iPrefix != null) {
prefix = new CompositeAffix(iPrefix, prefix);
}
iPrefix = prefix;
return this;
} | java | private PeriodFormatterBuilder appendPrefix(PeriodFieldAffix prefix) {
if (prefix == null) {
throw new IllegalArgumentException();
}
if (iPrefix != null) {
prefix = new CompositeAffix(iPrefix, prefix);
}
iPrefix = prefix;
return this;
} | [
"private",
"PeriodFormatterBuilder",
"appendPrefix",
"(",
"PeriodFieldAffix",
"prefix",
")",
"{",
"if",
"(",
"prefix",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"if",
"(",
"iPrefix",
"!=",
"null",
")",
"{",
"pref... | Append a field prefix which applies only to the next appended field. If
the field is not printed, neither is the prefix.
@param prefix custom prefix
@return this PeriodFormatterBuilder
@see #appendSuffix | [
"Append",
"a",
"field",
"prefix",
"which",
"applies",
"only",
"to",
"the",
"next",
"appended",
"field",
".",
"If",
"the",
"field",
"is",
"not",
"printed",
"neither",
"is",
"the",
"prefix",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L432-L441 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java | UtilMath.wrapDouble | public static double wrapDouble(double value, double min, double max) {
"""
Wrap value (keep value between min and max). Useful to keep an angle between 0 and 360 for example.
@param value The input value.
@param min The minimum value (included).
@param max The maximum value (excluded).
@return The wrapped value.
"""
double newValue = value;
final double step = max - min;
if (Double.compare(newValue, max) >= 0)
{
while (Double.compare(newValue, max) >= 0)
{
newValue -= step;
}
}
else if (newValue < min)
{
while (newValue < min)
{
newValue += step;
}
}
return newValue;
} | java | public static double wrapDouble(double value, double min, double max)
{
double newValue = value;
final double step = max - min;
if (Double.compare(newValue, max) >= 0)
{
while (Double.compare(newValue, max) >= 0)
{
newValue -= step;
}
}
else if (newValue < min)
{
while (newValue < min)
{
newValue += step;
}
}
return newValue;
} | [
"public",
"static",
"double",
"wrapDouble",
"(",
"double",
"value",
",",
"double",
"min",
",",
"double",
"max",
")",
"{",
"double",
"newValue",
"=",
"value",
";",
"final",
"double",
"step",
"=",
"max",
"-",
"min",
";",
"if",
"(",
"Double",
".",
"compar... | Wrap value (keep value between min and max). Useful to keep an angle between 0 and 360 for example.
@param value The input value.
@param min The minimum value (included).
@param max The maximum value (excluded).
@return The wrapped value. | [
"Wrap",
"value",
"(",
"keep",
"value",
"between",
"min",
"and",
"max",
")",
".",
"Useful",
"to",
"keep",
"an",
"angle",
"between",
"0",
"and",
"360",
"for",
"example",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java#L275-L295 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/SessionApi.java | SessionApi.initializeProvisioning | public LoginSuccessResponse initializeProvisioning(InitProvData authenticationCode, String authorization) throws ApiException {
"""
Authenticate user
Initialize-provisioning operation will create a new sessionId and set default.yml:common.cookieName cookie (PROVISIONING_SESSIONID by default).
@param authenticationCode Authentication code received from the Auth service (optional)
@param authorization Bearer authorization. For example, 'Bearer access_token'. (optional)
@return LoginSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<LoginSuccessResponse> resp = initializeProvisioningWithHttpInfo(authenticationCode, authorization);
return resp.getData();
} | java | public LoginSuccessResponse initializeProvisioning(InitProvData authenticationCode, String authorization) throws ApiException {
ApiResponse<LoginSuccessResponse> resp = initializeProvisioningWithHttpInfo(authenticationCode, authorization);
return resp.getData();
} | [
"public",
"LoginSuccessResponse",
"initializeProvisioning",
"(",
"InitProvData",
"authenticationCode",
",",
"String",
"authorization",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"LoginSuccessResponse",
">",
"resp",
"=",
"initializeProvisioningWithHttpInfo",
"(",
... | Authenticate user
Initialize-provisioning operation will create a new sessionId and set default.yml:common.cookieName cookie (PROVISIONING_SESSIONID by default).
@param authenticationCode Authentication code received from the Auth service (optional)
@param authorization Bearer authorization. For example, 'Bearer access_token'. (optional)
@return LoginSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Authenticate",
"user",
"Initialize",
"-",
"provisioning",
"operation",
"will",
"create",
"a",
"new",
"sessionId",
"and",
"set",
"default",
".",
"yml",
":",
"common",
".",
"cookieName",
"cookie",
"(",
"PROVISIONING_SESSIONID",
"by",
"default",
")",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/SessionApi.java#L483-L486 |
alexvasilkov/GestureViews | library/src/main/java/com/alexvasilkov/gestures/Settings.java | Settings.setMovementArea | public Settings setMovementArea(int width, int height) {
"""
Setting movement area size. Viewport area will be used instead if no movement area is
specified.
@param width Movement area width
@param height Movement area height
@return Current settings object for calls chaining
"""
isMovementAreaSpecified = true;
movementAreaW = width;
movementAreaH = height;
return this;
} | java | public Settings setMovementArea(int width, int height) {
isMovementAreaSpecified = true;
movementAreaW = width;
movementAreaH = height;
return this;
} | [
"public",
"Settings",
"setMovementArea",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"isMovementAreaSpecified",
"=",
"true",
";",
"movementAreaW",
"=",
"width",
";",
"movementAreaH",
"=",
"height",
";",
"return",
"this",
";",
"}"
] | Setting movement area size. Viewport area will be used instead if no movement area is
specified.
@param width Movement area width
@param height Movement area height
@return Current settings object for calls chaining | [
"Setting",
"movement",
"area",
"size",
".",
"Viewport",
"area",
"will",
"be",
"used",
"instead",
"if",
"no",
"movement",
"area",
"is",
"specified",
"."
] | train | https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/Settings.java#L242-L247 |
lets-blade/blade | src/main/java/com/blade/validator/Validators.java | Validators.contains | public static Validation<String> contains(String c) {
"""
The input parameter must contain the string c. if yes, the check passes
@param c contained strings
@return Validation
"""
return contains(c, I18N_MAP.get(i18nPrefix + "CONTAINS"));
} | java | public static Validation<String> contains(String c) {
return contains(c, I18N_MAP.get(i18nPrefix + "CONTAINS"));
} | [
"public",
"static",
"Validation",
"<",
"String",
">",
"contains",
"(",
"String",
"c",
")",
"{",
"return",
"contains",
"(",
"c",
",",
"I18N_MAP",
".",
"get",
"(",
"i18nPrefix",
"+",
"\"CONTAINS\"",
")",
")",
";",
"}"
] | The input parameter must contain the string c. if yes, the check passes
@param c contained strings
@return Validation | [
"The",
"input",
"parameter",
"must",
"contain",
"the",
"string",
"c",
".",
"if",
"yes",
"the",
"check",
"passes"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/validator/Validators.java#L170-L172 |
grails/grails-core | grails-encoder/src/main/groovy/org/grails/buffer/StringCharArrayAccessor.java | StringCharArrayAccessor.writeStringAsCharArray | static public void writeStringAsCharArray(Writer writer, String str) throws IOException {
"""
Writes a portion of a string to a target java.io.Writer with direct access to the char[] of the java.lang.String
@param writer
target java.io.Writer for output
@param str
A String
@throws IOException
If an I/O error occurs
"""
writeStringAsCharArray(writer, str, 0, str.length());
} | java | static public void writeStringAsCharArray(Writer writer, String str) throws IOException {
writeStringAsCharArray(writer, str, 0, str.length());
} | [
"static",
"public",
"void",
"writeStringAsCharArray",
"(",
"Writer",
"writer",
",",
"String",
"str",
")",
"throws",
"IOException",
"{",
"writeStringAsCharArray",
"(",
"writer",
",",
"str",
",",
"0",
",",
"str",
".",
"length",
"(",
")",
")",
";",
"}"
] | Writes a portion of a string to a target java.io.Writer with direct access to the char[] of the java.lang.String
@param writer
target java.io.Writer for output
@param str
A String
@throws IOException
If an I/O error occurs | [
"Writes",
"a",
"portion",
"of",
"a",
"string",
"to",
"a",
"target",
"java",
".",
"io",
".",
"Writer",
"with",
"direct",
"access",
"to",
"the",
"char",
"[]",
"of",
"the",
"java",
".",
"lang",
".",
"String"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-encoder/src/main/groovy/org/grails/buffer/StringCharArrayAccessor.java#L91-L93 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java | WebhookCluster.broadcast | public List<RequestFuture<?>> broadcast(MessageEmbed first, MessageEmbed... embeds) {
"""
Sends the provided {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbeds}
to all registered {@link net.dv8tion.jda.webhook.WebhookClient WebhookClients}.
<p><b>You can send up to 10 embeds per message! If more are sent they will not be displayed.</b>
<p>Hint: Use {@link net.dv8tion.jda.core.EmbedBuilder EmbedBuilder} to
create a {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbeds} instance!
@param first
The first embed to send to the clients
@param embeds
The other embeds that should be sent to the clients
@throws java.lang.IllegalArgumentException
If any of the provided arguments is {@code null}
@throws java.util.concurrent.RejectedExecutionException
If any of the receivers has been shutdown
@return A list of {@link java.util.concurrent.Future Future} instances
representing all message tasks.
"""
return broadcast(WebhookMessage.embeds(first, embeds));
} | java | public List<RequestFuture<?>> broadcast(MessageEmbed first, MessageEmbed... embeds)
{
return broadcast(WebhookMessage.embeds(first, embeds));
} | [
"public",
"List",
"<",
"RequestFuture",
"<",
"?",
">",
">",
"broadcast",
"(",
"MessageEmbed",
"first",
",",
"MessageEmbed",
"...",
"embeds",
")",
"{",
"return",
"broadcast",
"(",
"WebhookMessage",
".",
"embeds",
"(",
"first",
",",
"embeds",
")",
")",
";",
... | Sends the provided {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbeds}
to all registered {@link net.dv8tion.jda.webhook.WebhookClient WebhookClients}.
<p><b>You can send up to 10 embeds per message! If more are sent they will not be displayed.</b>
<p>Hint: Use {@link net.dv8tion.jda.core.EmbedBuilder EmbedBuilder} to
create a {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbeds} instance!
@param first
The first embed to send to the clients
@param embeds
The other embeds that should be sent to the clients
@throws java.lang.IllegalArgumentException
If any of the provided arguments is {@code null}
@throws java.util.concurrent.RejectedExecutionException
If any of the receivers has been shutdown
@return A list of {@link java.util.concurrent.Future Future} instances
representing all message tasks. | [
"Sends",
"the",
"provided",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"entities",
".",
"MessageEmbed",
"MessageEmbeds",
"}",
"to",
"all",
"registered",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"webhook",
".",
"Webhoo... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java#L661-L664 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java | ApiOvhEmailpro.service_domain_domainName_disclaimer_PUT | public void service_domain_domainName_disclaimer_PUT(String service, String domainName, OvhDisclaimer body) throws IOException {
"""
Alter this object properties
REST: PUT /email/pro/{service}/domain/{domainName}/disclaimer
@param body [required] New object properties
@param service [required] The internal name of your pro organization
@param domainName [required] Domain name
API beta
"""
String qPath = "/email/pro/{service}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, service, domainName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void service_domain_domainName_disclaimer_PUT(String service, String domainName, OvhDisclaimer body) throws IOException {
String qPath = "/email/pro/{service}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, service, domainName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"service_domain_domainName_disclaimer_PUT",
"(",
"String",
"service",
",",
"String",
"domainName",
",",
"OvhDisclaimer",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/pro/{service}/domain/{domainName}/disclaimer\"",
";",
"Str... | Alter this object properties
REST: PUT /email/pro/{service}/domain/{domainName}/disclaimer
@param body [required] New object properties
@param service [required] The internal name of your pro organization
@param domainName [required] Domain name
API beta | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L788-L792 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafety.java | ThreadSafety.getInheritedAnnotation | public AnnotationInfo getInheritedAnnotation(Symbol sym, VisitorState state) {
"""
Gets the possibly inherited marker annotation on the given symbol, and reverse-propagates
containerOf spec's from super-classes.
"""
return getAnnotation(sym, markerAnnotations, state);
} | java | public AnnotationInfo getInheritedAnnotation(Symbol sym, VisitorState state) {
return getAnnotation(sym, markerAnnotations, state);
} | [
"public",
"AnnotationInfo",
"getInheritedAnnotation",
"(",
"Symbol",
"sym",
",",
"VisitorState",
"state",
")",
"{",
"return",
"getAnnotation",
"(",
"sym",
",",
"markerAnnotations",
",",
"state",
")",
";",
"}"
] | Gets the possibly inherited marker annotation on the given symbol, and reverse-propagates
containerOf spec's from super-classes. | [
"Gets",
"the",
"possibly",
"inherited",
"marker",
"annotation",
"on",
"the",
"given",
"symbol",
"and",
"reverse",
"-",
"propagates",
"containerOf",
"spec",
"s",
"from",
"super",
"-",
"classes",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ThreadSafety.java#L796-L798 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VFS.java | VFS.mountZipExpanded | public static Closeable mountZipExpanded(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
"""
Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and
close the filesystem when closed.
@param zipFile the zip file to mount
@param mountPoint the point at which the filesystem should be mounted
@param tempFileProvider the temporary file provider
@return a handle
@throws IOException if an error occurs
"""
boolean ok = false;
final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName());
try {
final File rootFile = tempDir.getRoot();
VFSUtils.unzip(zipFile, rootFile);
final MountHandle handle = doMount(new RealFileSystem(rootFile), mountPoint, tempDir);
ok = true;
return handle;
} finally {
if (!ok) {
VFSUtils.safeClose(tempDir);
}
}
} | java | public static Closeable mountZipExpanded(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
boolean ok = false;
final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName());
try {
final File rootFile = tempDir.getRoot();
VFSUtils.unzip(zipFile, rootFile);
final MountHandle handle = doMount(new RealFileSystem(rootFile), mountPoint, tempDir);
ok = true;
return handle;
} finally {
if (!ok) {
VFSUtils.safeClose(tempDir);
}
}
} | [
"public",
"static",
"Closeable",
"mountZipExpanded",
"(",
"File",
"zipFile",
",",
"VirtualFile",
"mountPoint",
",",
"TempFileProvider",
"tempFileProvider",
")",
"throws",
"IOException",
"{",
"boolean",
"ok",
"=",
"false",
";",
"final",
"TempDir",
"tempDir",
"=",
"... | Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and
close the filesystem when closed.
@param zipFile the zip file to mount
@param mountPoint the point at which the filesystem should be mounted
@param tempFileProvider the temporary file provider
@return a handle
@throws IOException if an error occurs | [
"Create",
"and",
"mount",
"an",
"expanded",
"zip",
"file",
"in",
"a",
"temporary",
"file",
"system",
"returning",
"a",
"single",
"handle",
"which",
"will",
"unmount",
"and",
"close",
"the",
"filesystem",
"when",
"closed",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L417-L431 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java | Log.logError | public static void logError(String message, Throwable t) {
"""
Error logging with cause.
@param message message
@param t cause
"""
logError(message + SEP + getMessage(t));
} | java | public static void logError(String message, Throwable t) {
logError(message + SEP + getMessage(t));
} | [
"public",
"static",
"void",
"logError",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"logError",
"(",
"message",
"+",
"SEP",
"+",
"getMessage",
"(",
"t",
")",
")",
";",
"}"
] | Error logging with cause.
@param message message
@param t cause | [
"Error",
"logging",
"with",
"cause",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/Log.java#L129-L131 |
groupe-sii/ogham | ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/javamail/MapContentHandler.java | MapContentHandler.addContentHandler | public void addContentHandler(Class<? extends Content> clazz, JavaMailContentHandler handler) {
"""
Register a new content handler.
@param clazz
the class of the content
@param handler
the content handler
"""
map.put(clazz, handler);
} | java | public void addContentHandler(Class<? extends Content> clazz, JavaMailContentHandler handler) {
map.put(clazz, handler);
} | [
"public",
"void",
"addContentHandler",
"(",
"Class",
"<",
"?",
"extends",
"Content",
">",
"clazz",
",",
"JavaMailContentHandler",
"handler",
")",
"{",
"map",
".",
"put",
"(",
"clazz",
",",
"handler",
")",
";",
"}"
] | Register a new content handler.
@param clazz
the class of the content
@param handler
the content handler | [
"Register",
"a",
"new",
"content",
"handler",
"."
] | train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/javamail/MapContentHandler.java#L61-L63 |
kmi/iserve | iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java | AbstractMatcher.listMatchesAtLeastOfType | @Override
public Table<URI, URI, MatchResult> listMatchesAtLeastOfType(Set<URI> origins, MatchType minType) {
"""
Obtains all the matching resources that have a MatchType with the URIs of {@code origin} of the type provided (inclusive) or more.
@param origins URIs to match
@param minType the minimum MatchType we want to obtain
@return a {@link com.google.common.collect.Table} with the result of the matching indexed by origin URI and then destination URI.
"""
return listMatchesWithinRange(origins, minType, this.matchTypesSupported.getHighest());
} | java | @Override
public Table<URI, URI, MatchResult> listMatchesAtLeastOfType(Set<URI> origins, MatchType minType) {
return listMatchesWithinRange(origins, minType, this.matchTypesSupported.getHighest());
} | [
"@",
"Override",
"public",
"Table",
"<",
"URI",
",",
"URI",
",",
"MatchResult",
">",
"listMatchesAtLeastOfType",
"(",
"Set",
"<",
"URI",
">",
"origins",
",",
"MatchType",
"minType",
")",
"{",
"return",
"listMatchesWithinRange",
"(",
"origins",
",",
"minType",
... | Obtains all the matching resources that have a MatchType with the URIs of {@code origin} of the type provided (inclusive) or more.
@param origins URIs to match
@param minType the minimum MatchType we want to obtain
@return a {@link com.google.common.collect.Table} with the result of the matching indexed by origin URI and then destination URI. | [
"Obtains",
"all",
"the",
"matching",
"resources",
"that",
"have",
"a",
"MatchType",
"with",
"the",
"URIs",
"of",
"{",
"@code",
"origin",
"}",
"of",
"the",
"type",
"provided",
"(",
"inclusive",
")",
"or",
"more",
"."
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java#L123-L126 |
GistLabs/mechanize | src/main/java/com/gistlabs/mechanize/impl/MechanizeAgent.java | MechanizeAgent.setupClient | private void setupClient(final AbstractHttpClient client) {
"""
This method is used to capture Location headers after HttpClient redirect handling.
"""
this.client.addResponseInterceptor(new HttpResponseInterceptor() {
@Override
public void process(final HttpResponse response, final HttpContext context)
throws HttpException, IOException {
Header header = response.getFirstHeader("Location");
if (header!=null)
context.setAttribute("Location", header.getValue());
}
});
} | java | private void setupClient(final AbstractHttpClient client) {
this.client.addResponseInterceptor(new HttpResponseInterceptor() {
@Override
public void process(final HttpResponse response, final HttpContext context)
throws HttpException, IOException {
Header header = response.getFirstHeader("Location");
if (header!=null)
context.setAttribute("Location", header.getValue());
}
});
} | [
"private",
"void",
"setupClient",
"(",
"final",
"AbstractHttpClient",
"client",
")",
"{",
"this",
".",
"client",
".",
"addResponseInterceptor",
"(",
"new",
"HttpResponseInterceptor",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"process",
"(",
"final",
"Htt... | This method is used to capture Location headers after HttpClient redirect handling. | [
"This",
"method",
"is",
"used",
"to",
"capture",
"Location",
"headers",
"after",
"HttpClient",
"redirect",
"handling",
"."
] | train | https://github.com/GistLabs/mechanize/blob/32ddd0774439a4c08513c05d7ac7416a3899efed/src/main/java/com/gistlabs/mechanize/impl/MechanizeAgent.java#L109-L119 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java | TransformersLogger.getAttributeWarning | public String getAttributeWarning(PathAddress address, ModelNode operation, String... attributes) {
"""
Get a warning message for the given operation at the provided address for the passed attributes
with a default message appended. Intended for use in providing a failure description for an operation
or an exception message for an {@link org.jboss.as.controller.OperationFailedException}.
The default appended message is 'Attributes are not understood in the target model version and this resource
will need to be ignored on the target host.'
@param address where warning occurred
@param operation where which problem occurred
@param attributes attributes we that have problems about
"""
return getAttributeWarning(address, operation, null, attributes);
} | java | public String getAttributeWarning(PathAddress address, ModelNode operation, String... attributes) {
return getAttributeWarning(address, operation, null, attributes);
} | [
"public",
"String",
"getAttributeWarning",
"(",
"PathAddress",
"address",
",",
"ModelNode",
"operation",
",",
"String",
"...",
"attributes",
")",
"{",
"return",
"getAttributeWarning",
"(",
"address",
",",
"operation",
",",
"null",
",",
"attributes",
")",
";",
"}... | Get a warning message for the given operation at the provided address for the passed attributes
with a default message appended. Intended for use in providing a failure description for an operation
or an exception message for an {@link org.jboss.as.controller.OperationFailedException}.
The default appended message is 'Attributes are not understood in the target model version and this resource
will need to be ignored on the target host.'
@param address where warning occurred
@param operation where which problem occurred
@param attributes attributes we that have problems about | [
"Get",
"a",
"warning",
"message",
"for",
"the",
"given",
"operation",
"at",
"the",
"provided",
"address",
"for",
"the",
"passed",
"attributes",
"with",
"a",
"default",
"message",
"appended",
".",
"Intended",
"for",
"use",
"in",
"providing",
"a",
"failure",
"... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L203-L205 |
b3dgs/lionengine | lionengine-network/src/main/java/com/b3dgs/lionengine/network/ServerImpl.java | ServerImpl.receiveConnected | private void receiveConnected(ClientSocket client, byte from, StateConnection expected) throws IOException {
"""
Update the receive connected state.
@param client The current client.
@param from The id from.
@param expected The expected client state.
@throws IOException If error.
"""
if (ServerImpl.checkValidity(client, from, expected))
{
// Terminate last connection step and accept it
Verbose.info(SERVER, client.getName(), " connected");
for (final ClientListener listener : listeners)
{
listener.notifyClientConnected(Byte.valueOf(client.getId()), client.getName());
}
// Notify other clients
for (final ClientSocket other : clients.values())
{
if (other.getId() == from)
{
continue;
}
other.getOut().writeByte(NetworkMessageSystemId.OTHER_CLIENT_CONNECTED);
ServerImpl.writeIdAndName(other, client.getId(), client.getName());
// Send
other.getOut().flush();
}
}
} | java | private void receiveConnected(ClientSocket client, byte from, StateConnection expected) throws IOException
{
if (ServerImpl.checkValidity(client, from, expected))
{
// Terminate last connection step and accept it
Verbose.info(SERVER, client.getName(), " connected");
for (final ClientListener listener : listeners)
{
listener.notifyClientConnected(Byte.valueOf(client.getId()), client.getName());
}
// Notify other clients
for (final ClientSocket other : clients.values())
{
if (other.getId() == from)
{
continue;
}
other.getOut().writeByte(NetworkMessageSystemId.OTHER_CLIENT_CONNECTED);
ServerImpl.writeIdAndName(other, client.getId(), client.getName());
// Send
other.getOut().flush();
}
}
} | [
"private",
"void",
"receiveConnected",
"(",
"ClientSocket",
"client",
",",
"byte",
"from",
",",
"StateConnection",
"expected",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ServerImpl",
".",
"checkValidity",
"(",
"client",
",",
"from",
",",
"expected",
")",
"... | Update the receive connected state.
@param client The current client.
@param from The id from.
@param expected The expected client state.
@throws IOException If error. | [
"Update",
"the",
"receive",
"connected",
"state",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/ServerImpl.java#L253-L277 |
myriadmobile/shove | library/src/main/java/com/myriadmobile/library/shove/SimpleNotificationDelegate.java | SimpleNotificationDelegate.onReceive | @Override
public void onReceive(Context context, Intent notification) {
"""
Called when a notification is received
@param context the service context
@param notification the notification intent
"""
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context);
String messageType = gcm.getMessageType(notification);
Bundle extras = notification.getExtras();
if (!extras.isEmpty() && GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
showNotification(context, extras);
}
} | java | @Override
public void onReceive(Context context, Intent notification) {
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context);
String messageType = gcm.getMessageType(notification);
Bundle extras = notification.getExtras();
if (!extras.isEmpty() && GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
showNotification(context, extras);
}
} | [
"@",
"Override",
"public",
"void",
"onReceive",
"(",
"Context",
"context",
",",
"Intent",
"notification",
")",
"{",
"GoogleCloudMessaging",
"gcm",
"=",
"GoogleCloudMessaging",
".",
"getInstance",
"(",
"context",
")",
";",
"String",
"messageType",
"=",
"gcm",
"."... | Called when a notification is received
@param context the service context
@param notification the notification intent | [
"Called",
"when",
"a",
"notification",
"is",
"received"
] | train | https://github.com/myriadmobile/shove/blob/71ab329cdbaef5bdc2b75e43af1393308c4c1eed/library/src/main/java/com/myriadmobile/library/shove/SimpleNotificationDelegate.java#L79-L88 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefAnalysis.java | UnconditionalValueDerefAnalysis.checkUnconditionalDerefDatabase | private void checkUnconditionalDerefDatabase(Location location, ValueNumberFrame vnaFrame, UnconditionalValueDerefSet fact)
throws DataflowAnalysisException {
"""
Check method call at given location to see if it unconditionally
dereferences a parameter. Mark any such arguments as derefs.
@param location
the Location of the method call
@param vnaFrame
ValueNumberFrame at the Location
@param fact
the dataflow value to modify
@throws DataflowAnalysisException
"""
ConstantPoolGen constantPool = methodGen.getConstantPool();
for (ValueNumber vn : checkUnconditionalDerefDatabase(location, vnaFrame, constantPool,
invDataflow.getFactAtLocation(location), typeDataflow)) {
fact.addDeref(vn, location);
}
} | java | private void checkUnconditionalDerefDatabase(Location location, ValueNumberFrame vnaFrame, UnconditionalValueDerefSet fact)
throws DataflowAnalysisException {
ConstantPoolGen constantPool = methodGen.getConstantPool();
for (ValueNumber vn : checkUnconditionalDerefDatabase(location, vnaFrame, constantPool,
invDataflow.getFactAtLocation(location), typeDataflow)) {
fact.addDeref(vn, location);
}
} | [
"private",
"void",
"checkUnconditionalDerefDatabase",
"(",
"Location",
"location",
",",
"ValueNumberFrame",
"vnaFrame",
",",
"UnconditionalValueDerefSet",
"fact",
")",
"throws",
"DataflowAnalysisException",
"{",
"ConstantPoolGen",
"constantPool",
"=",
"methodGen",
".",
"get... | Check method call at given location to see if it unconditionally
dereferences a parameter. Mark any such arguments as derefs.
@param location
the Location of the method call
@param vnaFrame
ValueNumberFrame at the Location
@param fact
the dataflow value to modify
@throws DataflowAnalysisException | [
"Check",
"method",
"call",
"at",
"given",
"location",
"to",
"see",
"if",
"it",
"unconditionally",
"dereferences",
"a",
"parameter",
".",
"Mark",
"any",
"such",
"arguments",
"as",
"derefs",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefAnalysis.java#L319-L327 |
CenturyLinkCloud/clc-java-sdk | sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java | GroupService.createSubgroups | private void createSubgroups(GroupHierarchyConfig config, String groupId) {
"""
Create sub groups in group with {@code groupId}
@param config group hierarchy config
@param groupId group id
"""
config.getSubitems().forEach(cfg -> {
if (cfg instanceof GroupHierarchyConfig) {
GroupMetadata curGroup = findGroup((GroupHierarchyConfig) cfg, groupId);
String subGroupId;
if (curGroup != null) {
subGroupId = curGroup.getId();
} else {
subGroupId = create(converter.createGroupConfig((GroupHierarchyConfig) cfg, groupId))
.getResult()
.as(GroupByIdRef.class)
.getId();
}
createSubgroups((GroupHierarchyConfig) cfg, subGroupId);
} else if (cfg instanceof CreateServerConfig) {
((CreateServerConfig) cfg).group(Group.refById(groupId));
} else {
((CompositeServerConfig) cfg).getServer().group(Group.refById(groupId));
}
});
} | java | private void createSubgroups(GroupHierarchyConfig config, String groupId) {
config.getSubitems().forEach(cfg -> {
if (cfg instanceof GroupHierarchyConfig) {
GroupMetadata curGroup = findGroup((GroupHierarchyConfig) cfg, groupId);
String subGroupId;
if (curGroup != null) {
subGroupId = curGroup.getId();
} else {
subGroupId = create(converter.createGroupConfig((GroupHierarchyConfig) cfg, groupId))
.getResult()
.as(GroupByIdRef.class)
.getId();
}
createSubgroups((GroupHierarchyConfig) cfg, subGroupId);
} else if (cfg instanceof CreateServerConfig) {
((CreateServerConfig) cfg).group(Group.refById(groupId));
} else {
((CompositeServerConfig) cfg).getServer().group(Group.refById(groupId));
}
});
} | [
"private",
"void",
"createSubgroups",
"(",
"GroupHierarchyConfig",
"config",
",",
"String",
"groupId",
")",
"{",
"config",
".",
"getSubitems",
"(",
")",
".",
"forEach",
"(",
"cfg",
"->",
"{",
"if",
"(",
"cfg",
"instanceof",
"GroupHierarchyConfig",
")",
"{",
... | Create sub groups in group with {@code groupId}
@param config group hierarchy config
@param groupId group id | [
"Create",
"sub",
"groups",
"in",
"group",
"with",
"{"
] | train | https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java#L265-L285 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsADESessionCache.java | CmsADESessionCache.addRecentFormatter | public void addRecentFormatter(String resType, CmsUUID formatterId) {
"""
Adds the formatter id to the recently used list for the given type.<p>
@param resType the resource type
@param formatterId the formatter id
"""
List<CmsUUID> formatterIds = m_recentFormatters.get(resType);
if (formatterIds == null) {
formatterIds = new ArrayList<CmsUUID>();
m_recentFormatters.put(resType, formatterIds);
}
formatterIds.remove(formatterId);
if (formatterIds.size() >= (RECENT_FORMATTERS_SIZE)) {
formatterIds.remove(RECENT_FORMATTERS_SIZE - 1);
}
formatterIds.add(0, formatterId);
} | java | public void addRecentFormatter(String resType, CmsUUID formatterId) {
List<CmsUUID> formatterIds = m_recentFormatters.get(resType);
if (formatterIds == null) {
formatterIds = new ArrayList<CmsUUID>();
m_recentFormatters.put(resType, formatterIds);
}
formatterIds.remove(formatterId);
if (formatterIds.size() >= (RECENT_FORMATTERS_SIZE)) {
formatterIds.remove(RECENT_FORMATTERS_SIZE - 1);
}
formatterIds.add(0, formatterId);
} | [
"public",
"void",
"addRecentFormatter",
"(",
"String",
"resType",
",",
"CmsUUID",
"formatterId",
")",
"{",
"List",
"<",
"CmsUUID",
">",
"formatterIds",
"=",
"m_recentFormatters",
".",
"get",
"(",
"resType",
")",
";",
"if",
"(",
"formatterIds",
"==",
"null",
... | Adds the formatter id to the recently used list for the given type.<p>
@param resType the resource type
@param formatterId the formatter id | [
"Adds",
"the",
"formatter",
"id",
"to",
"the",
"recently",
"used",
"list",
"for",
"the",
"given",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADESessionCache.java#L229-L241 |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/PopularityStratifiedRecall.java | PopularityStratifiedRecall.getValueAt | @Override
public double getValueAt(final U user, final int at) {
"""
Method to return the recall value at a particular cutoff level for a
given user.
@param user the user
@param at cutoff level
@return the recall corresponding to the requested user at the cutoff
level
"""
if (userRecallAtCutoff.containsKey(at) && userRecallAtCutoff.get(at).containsKey(user)) {
return userRecallAtCutoff.get(at).get(user) / userTotalRecall.get(user);
}
return Double.NaN;
} | java | @Override
public double getValueAt(final U user, final int at) {
if (userRecallAtCutoff.containsKey(at) && userRecallAtCutoff.get(at).containsKey(user)) {
return userRecallAtCutoff.get(at).get(user) / userTotalRecall.get(user);
}
return Double.NaN;
} | [
"@",
"Override",
"public",
"double",
"getValueAt",
"(",
"final",
"U",
"user",
",",
"final",
"int",
"at",
")",
"{",
"if",
"(",
"userRecallAtCutoff",
".",
"containsKey",
"(",
"at",
")",
"&&",
"userRecallAtCutoff",
".",
"get",
"(",
"at",
")",
".",
"contains... | Method to return the recall value at a particular cutoff level for a
given user.
@param user the user
@param at cutoff level
@return the recall corresponding to the requested user at the cutoff
level | [
"Method",
"to",
"return",
"the",
"recall",
"value",
"at",
"a",
"particular",
"cutoff",
"level",
"for",
"a",
"given",
"user",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/PopularityStratifiedRecall.java#L224-L230 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java | ManagedInstancesInner.getByResourceGroup | public ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName) {
"""
Gets a managed instance.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@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 ManagedInstanceInner object if successful.
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body();
} | java | public ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body();
} | [
"public",
"ManagedInstanceInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"managedInstanceName",
")",
".",
"toBlocking",
"(... | Gets a managed instance.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@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 ManagedInstanceInner object if successful. | [
"Gets",
"a",
"managed",
"instance",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java#L347-L349 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/PeriodFormatterBuilder.java | PeriodFormatterBuilder.appendSeparatorIfFieldsBefore | public PeriodFormatterBuilder appendSeparatorIfFieldsBefore(String text) {
"""
Append a separator, which is output only if fields are printed before the separator.
<p>
For example,
<code>builder.appendDays().appendSeparatorIfFieldsBefore(",").appendHours()</code>
will only output the comma if the days fields is output.
<p>
The text will be parsed case-insensitively.
<p>
Note: appending a separator discontinues any further work on the latest
appended field.
@param text the text to use as a separator
@return this PeriodFormatterBuilder
@throws IllegalStateException if this separator follows a previous one
"""
return appendSeparator(text, text, null, true, false);
} | java | public PeriodFormatterBuilder appendSeparatorIfFieldsBefore(String text) {
return appendSeparator(text, text, null, true, false);
} | [
"public",
"PeriodFormatterBuilder",
"appendSeparatorIfFieldsBefore",
"(",
"String",
"text",
")",
"{",
"return",
"appendSeparator",
"(",
"text",
",",
"text",
",",
"null",
",",
"true",
",",
"false",
")",
";",
"}"
] | Append a separator, which is output only if fields are printed before the separator.
<p>
For example,
<code>builder.appendDays().appendSeparatorIfFieldsBefore(",").appendHours()</code>
will only output the comma if the days fields is output.
<p>
The text will be parsed case-insensitively.
<p>
Note: appending a separator discontinues any further work on the latest
appended field.
@param text the text to use as a separator
@return this PeriodFormatterBuilder
@throws IllegalStateException if this separator follows a previous one | [
"Append",
"a",
"separator",
"which",
"is",
"output",
"only",
"if",
"fields",
"are",
"printed",
"before",
"the",
"separator",
".",
"<p",
">",
"For",
"example",
"<code",
">",
"builder",
".",
"appendDays",
"()",
".",
"appendSeparatorIfFieldsBefore",
"(",
")",
"... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L767-L769 |
alkacon/opencms-core | src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java | CmsNewResourceTypeDialog.addTypeMessages | private void addTypeMessages(CmsExplorerTypeSettings setting, String moduleFolder)
throws CmsException, UnsupportedEncodingException {
"""
Adds the explorer type messages to the modules workplace bundle.<p>
@param setting the explorer type settings
@param moduleFolder the module folder name
@throws CmsException if writing the bundle fails
@throws UnsupportedEncodingException in case of encoding issues
"""
Map<String, String> messages = new TreeMap<String, String>();
// check if any messages to set
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_typeName.getValue())) {
String key = String.format(MESSAGE_KEY_FORMATTER, m_typeShortName.getValue(), MESSAGE_KEY_FORMATTER_NAME);
messages.put(key, m_typeName.getValue());
setting.setKey(key);
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_typeDescription.getValue())) {
String key = String.format(
MESSAGE_KEY_FORMATTER,
m_typeShortName.getValue(),
MESSAGE_KEY_FORMATTER_DESCRIPTION);
messages.put(key, m_typeDescription.getValue());
setting.setInfo(key);
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_typeName.getValue())) {
String key = String.format(MESSAGE_KEY_FORMATTER, m_typeShortName.getValue(), MESSAGE_KEY_FORMATTER_TITLE);
messages.put(key, m_typeName.getValue());
String key2 = String.format(
MESSAGE_KEY_FORMATTER,
m_typeShortName.getValue(),
MESSAGE_KEY_FORMATTER_FORMATTER);
messages.put(key2, m_typeName.getValue());
setting.setTitleKey(key);
}
if (!messages.isEmpty()) {
addMessagesToPropertiesFile(messages, m_cms.readFile(m_bundle.getValue()), false);
}
} | java | private void addTypeMessages(CmsExplorerTypeSettings setting, String moduleFolder)
throws CmsException, UnsupportedEncodingException {
Map<String, String> messages = new TreeMap<String, String>();
// check if any messages to set
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_typeName.getValue())) {
String key = String.format(MESSAGE_KEY_FORMATTER, m_typeShortName.getValue(), MESSAGE_KEY_FORMATTER_NAME);
messages.put(key, m_typeName.getValue());
setting.setKey(key);
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_typeDescription.getValue())) {
String key = String.format(
MESSAGE_KEY_FORMATTER,
m_typeShortName.getValue(),
MESSAGE_KEY_FORMATTER_DESCRIPTION);
messages.put(key, m_typeDescription.getValue());
setting.setInfo(key);
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_typeName.getValue())) {
String key = String.format(MESSAGE_KEY_FORMATTER, m_typeShortName.getValue(), MESSAGE_KEY_FORMATTER_TITLE);
messages.put(key, m_typeName.getValue());
String key2 = String.format(
MESSAGE_KEY_FORMATTER,
m_typeShortName.getValue(),
MESSAGE_KEY_FORMATTER_FORMATTER);
messages.put(key2, m_typeName.getValue());
setting.setTitleKey(key);
}
if (!messages.isEmpty()) {
addMessagesToPropertiesFile(messages, m_cms.readFile(m_bundle.getValue()), false);
}
} | [
"private",
"void",
"addTypeMessages",
"(",
"CmsExplorerTypeSettings",
"setting",
",",
"String",
"moduleFolder",
")",
"throws",
"CmsException",
",",
"UnsupportedEncodingException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"messages",
"=",
"new",
"TreeMap",
"<",... | Adds the explorer type messages to the modules workplace bundle.<p>
@param setting the explorer type settings
@param moduleFolder the module folder name
@throws CmsException if writing the bundle fails
@throws UnsupportedEncodingException in case of encoding issues | [
"Adds",
"the",
"explorer",
"type",
"messages",
"to",
"the",
"modules",
"workplace",
"bundle",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java#L551-L584 |
sporniket/core | sporniket-core-lang/src/main/java/com/sporniket/libre/lang/DataTools.java | DataTools.appendBytesAsPaddedHexString | @Deprecated
public static StringBuffer appendBytesAsPaddedHexString(byte[] values, StringBuffer buffer) {
"""
Convert a sequence of bytes into a padded hexadecimal string.
@param values
the sequence to convert.
@param buffer
the buffer to append the result into.
@return the updated buffer.
@deprecated use <code>buffer.append(javax.xml.bind.DatatypeConverter.printHexBinary(value).toLowerCase())</code>
"""
return buffer.append(printHexBinary(values).toLowerCase());
} | java | @Deprecated
public static StringBuffer appendBytesAsPaddedHexString(byte[] values, StringBuffer buffer)
{
return buffer.append(printHexBinary(values).toLowerCase());
} | [
"@",
"Deprecated",
"public",
"static",
"StringBuffer",
"appendBytesAsPaddedHexString",
"(",
"byte",
"[",
"]",
"values",
",",
"StringBuffer",
"buffer",
")",
"{",
"return",
"buffer",
".",
"append",
"(",
"printHexBinary",
"(",
"values",
")",
".",
"toLowerCase",
"("... | Convert a sequence of bytes into a padded hexadecimal string.
@param values
the sequence to convert.
@param buffer
the buffer to append the result into.
@return the updated buffer.
@deprecated use <code>buffer.append(javax.xml.bind.DatatypeConverter.printHexBinary(value).toLowerCase())</code> | [
"Convert",
"a",
"sequence",
"of",
"bytes",
"into",
"a",
"padded",
"hexadecimal",
"string",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-lang/src/main/java/com/sporniket/libre/lang/DataTools.java#L159-L163 |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java | ErrorUtils.findProperLabelMatcher | static Matcher findProperLabelMatcher(MatcherPath path, int errorIndex) {
"""
Finds the Matcher in the given failedMatcherPath whose label is best for presentation in "expected" strings
of parse error messages, given the provided lastMatchPath.
@param path the path to the failed matcher
@param errorIndex the start index of the respective parse error
@return the matcher whose label is best for presentation in "expected" strings
"""
try { return findProperLabelMatcher0(path, errorIndex); }
catch(RuntimeException e) {
if (e == UnderneathTestNot) return null; else throw e;
}
} | java | static Matcher findProperLabelMatcher(MatcherPath path, int errorIndex) {
try { return findProperLabelMatcher0(path, errorIndex); }
catch(RuntimeException e) {
if (e == UnderneathTestNot) return null; else throw e;
}
} | [
"static",
"Matcher",
"findProperLabelMatcher",
"(",
"MatcherPath",
"path",
",",
"int",
"errorIndex",
")",
"{",
"try",
"{",
"return",
"findProperLabelMatcher0",
"(",
"path",
",",
"errorIndex",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"if"... | Finds the Matcher in the given failedMatcherPath whose label is best for presentation in "expected" strings
of parse error messages, given the provided lastMatchPath.
@param path the path to the failed matcher
@param errorIndex the start index of the respective parse error
@return the matcher whose label is best for presentation in "expected" strings | [
"Finds",
"the",
"Matcher",
"in",
"the",
"given",
"failedMatcherPath",
"whose",
"label",
"is",
"best",
"for",
"presentation",
"in",
"expected",
"strings",
"of",
"parse",
"error",
"messages",
"given",
"the",
"provided",
"lastMatchPath",
"."
] | train | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/errors/ErrorUtils.java#L47-L52 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.feed_publishTemplatizedAction | public boolean feed_publishTemplatizedAction(CharSequence titleTemplate, Long pageActorId)
throws FacebookException, IOException {
"""
Publishes a Mini-Feed story describing an action taken by the logged-in user (or, if
<code>pageActorId</code> is provided, page), and publishes aggregating News Feed stories
to the user's friends/page's fans.
Stories are identified as being combinable if they have matching templates and substituted values.
@param titleTemplate markup (up to 60 chars, tags excluded) for the feed story's title
section. Must include the token <code>{actor}</code>.
@param pageActorId (optional) the ID of the page into whose mini-feed the story is being published
@return whether the action story was successfully published; false in case
of a permission error
@see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction">
Developers Wiki: Feed.publishTemplatizedAction</a>
@see <a href="http://developers.facebook.com/tools.php?feed">
Developers Resources: Feed Preview Console </a>
"""
return feed_publishTemplatizedAction(titleTemplate, null, null, null, null, null, null, pageActorId);
} | java | public boolean feed_publishTemplatizedAction(CharSequence titleTemplate, Long pageActorId)
throws FacebookException, IOException {
return feed_publishTemplatizedAction(titleTemplate, null, null, null, null, null, null, pageActorId);
} | [
"public",
"boolean",
"feed_publishTemplatizedAction",
"(",
"CharSequence",
"titleTemplate",
",",
"Long",
"pageActorId",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"feed_publishTemplatizedAction",
"(",
"titleTemplate",
",",
"null",
",",
"null",
... | Publishes a Mini-Feed story describing an action taken by the logged-in user (or, if
<code>pageActorId</code> is provided, page), and publishes aggregating News Feed stories
to the user's friends/page's fans.
Stories are identified as being combinable if they have matching templates and substituted values.
@param titleTemplate markup (up to 60 chars, tags excluded) for the feed story's title
section. Must include the token <code>{actor}</code>.
@param pageActorId (optional) the ID of the page into whose mini-feed the story is being published
@return whether the action story was successfully published; false in case
of a permission error
@see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction">
Developers Wiki: Feed.publishTemplatizedAction</a>
@see <a href="http://developers.facebook.com/tools.php?feed">
Developers Resources: Feed Preview Console </a> | [
"Publishes",
"a",
"Mini",
"-",
"Feed",
"story",
"describing",
"an",
"action",
"taken",
"by",
"the",
"logged",
"-",
"in",
"user",
"(",
"or",
"if",
"<code",
">",
"pageActorId<",
"/",
"code",
">",
"is",
"provided",
"page",
")",
"and",
"publishes",
"aggregat... | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L427-L430 |
elki-project/elki | elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java | GeneratorXMLDatabaseConnection.processElementPoint | private void processElementPoint(List<double[]> points, Node cur) {
"""
Parse a 'point' element (point vector for a static cluster)
@param points current list of points (to append to)
@param cur Current document nod
"""
double[] point = null;
String vstr = ((Element) cur).getAttribute(ATTR_VECTOR);
if(vstr != null && vstr.length() > 0) {
point = parseVector(vstr);
}
if(point == null) {
throw new AbortException("No translation vector given.");
}
// *** add new point
points.add(point);
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
} | java | private void processElementPoint(List<double[]> points, Node cur) {
double[] point = null;
String vstr = ((Element) cur).getAttribute(ATTR_VECTOR);
if(vstr != null && vstr.length() > 0) {
point = parseVector(vstr);
}
if(point == null) {
throw new AbortException("No translation vector given.");
}
// *** add new point
points.add(point);
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
} | [
"private",
"void",
"processElementPoint",
"(",
"List",
"<",
"double",
"[",
"]",
">",
"points",
",",
"Node",
"cur",
")",
"{",
"double",
"[",
"]",
"point",
"=",
"null",
";",
"String",
"vstr",
"=",
"(",
"(",
"Element",
")",
"cur",
")",
".",
"getAttribut... | Parse a 'point' element (point vector for a static cluster)
@param points current list of points (to append to)
@param cur Current document nod | [
"Parse",
"a",
"point",
"element",
"(",
"point",
"vector",
"for",
"a",
"static",
"cluster",
")"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java#L668-L689 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java | AnnotationUtility.extractAsBoolean | public static <E extends ModelEntity<?>> boolean extractAsBoolean(E item, ModelAnnotation annotation, AnnotationAttributeType attribute) {
"""
Estract from an annotation of a method the attribute value specified.
@param <E> the element type
@param item entity to analyze
@param annotation annotation to analyze
@param attribute the attribute
@return true, if successful
"""
final Elements elementUtils=BaseProcessor.elementUtils;
final One<Boolean> result = new One<Boolean>(false);
extractAttributeValue(elementUtils, item.getElement(), annotation.getName(), attribute, new OnAttributeFoundListener() {
@Override
public void onFound(String value) {
result.value0 = Boolean.valueOf(value);
}
});
return result.value0;
} | java | public static <E extends ModelEntity<?>> boolean extractAsBoolean(E item, ModelAnnotation annotation, AnnotationAttributeType attribute) {
final Elements elementUtils=BaseProcessor.elementUtils;
final One<Boolean> result = new One<Boolean>(false);
extractAttributeValue(elementUtils, item.getElement(), annotation.getName(), attribute, new OnAttributeFoundListener() {
@Override
public void onFound(String value) {
result.value0 = Boolean.valueOf(value);
}
});
return result.value0;
} | [
"public",
"static",
"<",
"E",
"extends",
"ModelEntity",
"<",
"?",
">",
">",
"boolean",
"extractAsBoolean",
"(",
"E",
"item",
",",
"ModelAnnotation",
"annotation",
",",
"AnnotationAttributeType",
"attribute",
")",
"{",
"final",
"Elements",
"elementUtils",
"=",
"B... | Estract from an annotation of a method the attribute value specified.
@param <E> the element type
@param item entity to analyze
@param annotation annotation to analyze
@param attribute the attribute
@return true, if successful | [
"Estract",
"from",
"an",
"annotation",
"of",
"a",
"method",
"the",
"attribute",
"value",
"specified",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java#L580-L593 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | DateFormatUtils.formatUTC | public static String formatUTC(final Date date, final String pattern) {
"""
<p>Formats a date/time into a specific pattern using the UTC time zone.</p>
@param date the date to format, not null
@param pattern the pattern to use to format the date, not null
@return the formatted date
"""
return format(date, pattern, UTC_TIME_ZONE, null);
} | java | public static String formatUTC(final Date date, final String pattern) {
return format(date, pattern, UTC_TIME_ZONE, null);
} | [
"public",
"static",
"String",
"formatUTC",
"(",
"final",
"Date",
"date",
",",
"final",
"String",
"pattern",
")",
"{",
"return",
"format",
"(",
"date",
",",
"pattern",
",",
"UTC_TIME_ZONE",
",",
"null",
")",
";",
"}"
] | <p>Formats a date/time into a specific pattern using the UTC time zone.</p>
@param date the date to format, not null
@param pattern the pattern to use to format the date, not null
@return the formatted date | [
"<p",
">",
"Formats",
"a",
"date",
"/",
"time",
"into",
"a",
"specific",
"pattern",
"using",
"the",
"UTC",
"time",
"zone",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java#L228-L230 |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryColumn | public static <T> List<T> queryColumn(
String sql, String columnName, Class<T> columnType, Object[] params) throws YankSQLException {
"""
Return a List of Objects from a single table column given an SQL statement using the default
connection pool.
@param <T>
@param sql The SQL statement
@param params The replacement parameters
@param columnType The Class of the desired return Objects matching the table
@return The Column as a List
"""
return queryColumn(YankPoolManager.DEFAULT_POOL_NAME, sql, columnName, columnType, params);
} | java | public static <T> List<T> queryColumn(
String sql, String columnName, Class<T> columnType, Object[] params) throws YankSQLException {
return queryColumn(YankPoolManager.DEFAULT_POOL_NAME, sql, columnName, columnType, params);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"queryColumn",
"(",
"String",
"sql",
",",
"String",
"columnName",
",",
"Class",
"<",
"T",
">",
"columnType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"return",
... | Return a List of Objects from a single table column given an SQL statement using the default
connection pool.
@param <T>
@param sql The SQL statement
@param params The replacement parameters
@param columnType The Class of the desired return Objects matching the table
@return The Column as a List | [
"Return",
"a",
"List",
"of",
"Objects",
"from",
"a",
"single",
"table",
"column",
"given",
"an",
"SQL",
"statement",
"using",
"the",
"default",
"connection",
"pool",
"."
] | train | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L565-L569 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java | CommerceTierPriceEntryPersistenceImpl.findByGroupId | @Override
public List<CommerceTierPriceEntry> findByGroupId(long groupId) {
"""
Returns all the commerce tier price entries where groupId = ?.
@param groupId the group ID
@return the matching commerce tier price entries
"""
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceTierPriceEntry> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceTierPriceEntry",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}... | Returns all the commerce tier price entries where groupId = ?.
@param groupId the group ID
@return the matching commerce tier price entries | [
"Returns",
"all",
"the",
"commerce",
"tier",
"price",
"entries",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java#L1527-L1530 |
tvesalainen/lpg | src/main/java/org/vesalainen/parser/util/Input.java | Input.parseInt | @Override
public int parseInt(long s, int l, int radix) {
"""
Converts binary to int
@param s
@param l
@param radix
@return
"""
return Primitives.parseInt(getCharSequence(s, l), radix);
} | java | @Override
public int parseInt(long s, int l, int radix)
{
return Primitives.parseInt(getCharSequence(s, l), radix);
} | [
"@",
"Override",
"public",
"int",
"parseInt",
"(",
"long",
"s",
",",
"int",
"l",
",",
"int",
"radix",
")",
"{",
"return",
"Primitives",
".",
"parseInt",
"(",
"getCharSequence",
"(",
"s",
",",
"l",
")",
",",
"radix",
")",
";",
"}"
] | Converts binary to int
@param s
@param l
@param radix
@return | [
"Converts",
"binary",
"to",
"int"
] | train | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/Input.java#L1432-L1436 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/ConfigManager.java | ConfigManager.getPoolMaximum | public synchronized int getPoolMaximum(PoolInfo poolInfo, ResourceType type) {
"""
Get the configured maximum allocation for a given {@link ResourceType}
in a given pool
@param poolInfo Pool info to check
@param type the type of the resource
@return the maximum allocation for the resource in a pool
"""
Integer max = (typePoolInfoToMax == null) ? null :
typePoolInfoToMax.get(type, poolInfo);
return max == null ? Integer.MAX_VALUE : max;
} | java | public synchronized int getPoolMaximum(PoolInfo poolInfo, ResourceType type) {
Integer max = (typePoolInfoToMax == null) ? null :
typePoolInfoToMax.get(type, poolInfo);
return max == null ? Integer.MAX_VALUE : max;
} | [
"public",
"synchronized",
"int",
"getPoolMaximum",
"(",
"PoolInfo",
"poolInfo",
",",
"ResourceType",
"type",
")",
"{",
"Integer",
"max",
"=",
"(",
"typePoolInfoToMax",
"==",
"null",
")",
"?",
"null",
":",
"typePoolInfoToMax",
".",
"get",
"(",
"type",
",",
"p... | Get the configured maximum allocation for a given {@link ResourceType}
in a given pool
@param poolInfo Pool info to check
@param type the type of the resource
@return the maximum allocation for the resource in a pool | [
"Get",
"the",
"configured",
"maximum",
"allocation",
"for",
"a",
"given",
"{"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ConfigManager.java#L506-L510 |
Alluxio/alluxio | integration/fuse/src/main/java/alluxio/fuse/AlluxioFuseFileSystem.java | AlluxioFuseFileSystem.chmod | @Override
public int chmod(String path, @mode_t long mode) {
"""
Changes the mode of an Alluxio file.
@param path the path of the file
@param mode the mode to change to
@return 0 on success, a negative value on error
"""
AlluxioURI uri = mPathResolverCache.getUnchecked(path);
SetAttributePOptions options = SetAttributePOptions.newBuilder()
.setMode(new alluxio.security.authorization.Mode((short) mode).toProto()).build();
try {
mFileSystem.setAttribute(uri, options);
} catch (Throwable t) {
LOG.error("Failed to change {} to mode {}", path, mode, t);
return AlluxioFuseUtils.getErrorCode(t);
}
return 0;
} | java | @Override
public int chmod(String path, @mode_t long mode) {
AlluxioURI uri = mPathResolverCache.getUnchecked(path);
SetAttributePOptions options = SetAttributePOptions.newBuilder()
.setMode(new alluxio.security.authorization.Mode((short) mode).toProto()).build();
try {
mFileSystem.setAttribute(uri, options);
} catch (Throwable t) {
LOG.error("Failed to change {} to mode {}", path, mode, t);
return AlluxioFuseUtils.getErrorCode(t);
}
return 0;
} | [
"@",
"Override",
"public",
"int",
"chmod",
"(",
"String",
"path",
",",
"@",
"mode_t",
"long",
"mode",
")",
"{",
"AlluxioURI",
"uri",
"=",
"mPathResolverCache",
".",
"getUnchecked",
"(",
"path",
")",
";",
"SetAttributePOptions",
"options",
"=",
"SetAttributePOp... | Changes the mode of an Alluxio file.
@param path the path of the file
@param mode the mode to change to
@return 0 on success, a negative value on error | [
"Changes",
"the",
"mode",
"of",
"an",
"Alluxio",
"file",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/integration/fuse/src/main/java/alluxio/fuse/AlluxioFuseFileSystem.java#L148-L162 |
AltBeacon/android-beacon-library | lib/src/main/java/org/altbeacon/beacon/BeaconTransmitter.java | BeaconTransmitter.startAdvertising | public void startAdvertising(Beacon beacon, AdvertiseCallback callback) {
"""
Starts advertising with fields from the passed beacon
@param beacon
"""
mBeacon = beacon;
mAdvertisingClientCallback = callback;
startAdvertising();
} | java | public void startAdvertising(Beacon beacon, AdvertiseCallback callback) {
mBeacon = beacon;
mAdvertisingClientCallback = callback;
startAdvertising();
} | [
"public",
"void",
"startAdvertising",
"(",
"Beacon",
"beacon",
",",
"AdvertiseCallback",
"callback",
")",
"{",
"mBeacon",
"=",
"beacon",
";",
"mAdvertisingClientCallback",
"=",
"callback",
";",
"startAdvertising",
"(",
")",
";",
"}"
] | Starts advertising with fields from the passed beacon
@param beacon | [
"Starts",
"advertising",
"with",
"fields",
"from",
"the",
"passed",
"beacon"
] | train | https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/BeaconTransmitter.java#L156-L160 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/http/MultiPartFaxJob2HTTPRequestConverter.java | MultiPartFaxJob2HTTPRequestConverter.createHTTPRequest | public HTTPRequest createHTTPRequest(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob) {
"""
Creates the HTTP request from the fax job data.
@param faxClientSpi
The HTTP fax client SPI
@param faxActionType
The fax action type
@param faxJob
The fax job object
@return The HTTP request to send
"""
//setup common request data
HTTPRequest httpRequest=this.createCommonHTTPRequest(faxClientSpi,faxActionType);
//create content
List<ContentPart<?>> contentList=new LinkedList<HTTPRequest.ContentPart<?>>();
switch(faxActionType)
{
case SUBMIT_FAX_JOB:
String value=faxJob.getTargetAddress();
this.addContentPart(contentList,this.submitTargetAddressParameter,value);
value=faxJob.getTargetName();
this.addContentPart(contentList,this.submitTargetNameParameter,value);
value=faxJob.getSenderName();
this.addContentPart(contentList,this.submitSenderNameParameter,value);
value=faxJob.getSenderFaxNumber();
this.addContentPart(contentList,this.submitSenderFaxNumberParameter,value);
value=faxJob.getSenderEmail();
this.addContentPart(contentList,this.submitSenderEMailParameter,value);
File file=faxJob.getFile();
contentList.add(new ContentPart<File>(this.submitFileContentParameter,file,ContentPartType.FILE));
if(this.shouldAddFileNamePart())
{
value=file.getName();
this.addContentPart(contentList,this.submitFileNameParameter,value);
}
break;
case SUSPEND_FAX_JOB:
this.addContentPart(contentList,this.suspendFaxJobIDParameter,faxJob.getID());
break;
case RESUME_FAX_JOB:
this.addContentPart(contentList,this.resumeFaxJobIDParameter,faxJob.getID());
break;
case CANCEL_FAX_JOB:
this.addContentPart(contentList,this.cancelFaxJobIDParameter,faxJob.getID());
break;
case GET_FAX_JOB_STATUS:
this.addContentPart(contentList,this.getStatusFaxJobIDParameter,faxJob.getID());
break;
default:
throw new FaxException("Fax action type: "+faxActionType+" not supported.");
}
//add additional parameters
this.addAdditionalParameters(contentList);
//add additional parts
this.addAdditionalContentParts(faxClientSpi,faxActionType,faxJob,contentList);
//convert to array
ContentPart<?>[] content=contentList.toArray(new ContentPart<?>[contentList.size()]);
//set content
httpRequest.setContent(content);
return httpRequest;
} | java | public HTTPRequest createHTTPRequest(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob)
{
//setup common request data
HTTPRequest httpRequest=this.createCommonHTTPRequest(faxClientSpi,faxActionType);
//create content
List<ContentPart<?>> contentList=new LinkedList<HTTPRequest.ContentPart<?>>();
switch(faxActionType)
{
case SUBMIT_FAX_JOB:
String value=faxJob.getTargetAddress();
this.addContentPart(contentList,this.submitTargetAddressParameter,value);
value=faxJob.getTargetName();
this.addContentPart(contentList,this.submitTargetNameParameter,value);
value=faxJob.getSenderName();
this.addContentPart(contentList,this.submitSenderNameParameter,value);
value=faxJob.getSenderFaxNumber();
this.addContentPart(contentList,this.submitSenderFaxNumberParameter,value);
value=faxJob.getSenderEmail();
this.addContentPart(contentList,this.submitSenderEMailParameter,value);
File file=faxJob.getFile();
contentList.add(new ContentPart<File>(this.submitFileContentParameter,file,ContentPartType.FILE));
if(this.shouldAddFileNamePart())
{
value=file.getName();
this.addContentPart(contentList,this.submitFileNameParameter,value);
}
break;
case SUSPEND_FAX_JOB:
this.addContentPart(contentList,this.suspendFaxJobIDParameter,faxJob.getID());
break;
case RESUME_FAX_JOB:
this.addContentPart(contentList,this.resumeFaxJobIDParameter,faxJob.getID());
break;
case CANCEL_FAX_JOB:
this.addContentPart(contentList,this.cancelFaxJobIDParameter,faxJob.getID());
break;
case GET_FAX_JOB_STATUS:
this.addContentPart(contentList,this.getStatusFaxJobIDParameter,faxJob.getID());
break;
default:
throw new FaxException("Fax action type: "+faxActionType+" not supported.");
}
//add additional parameters
this.addAdditionalParameters(contentList);
//add additional parts
this.addAdditionalContentParts(faxClientSpi,faxActionType,faxJob,contentList);
//convert to array
ContentPart<?>[] content=contentList.toArray(new ContentPart<?>[contentList.size()]);
//set content
httpRequest.setContent(content);
return httpRequest;
} | [
"public",
"HTTPRequest",
"createHTTPRequest",
"(",
"HTTPFaxClientSpi",
"faxClientSpi",
",",
"FaxActionType",
"faxActionType",
",",
"FaxJob",
"faxJob",
")",
"{",
"//setup common request data",
"HTTPRequest",
"httpRequest",
"=",
"this",
".",
"createCommonHTTPRequest",
"(",
... | Creates the HTTP request from the fax job data.
@param faxClientSpi
The HTTP fax client SPI
@param faxActionType
The fax action type
@param faxJob
The fax job object
@return The HTTP request to send | [
"Creates",
"the",
"HTTP",
"request",
"from",
"the",
"fax",
"job",
"data",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/MultiPartFaxJob2HTTPRequestConverter.java#L392-L449 |
grails/grails-core | buildSrc/src/main/groovy/JavadocFixTool.java | JavadocFixTool.replaceStringInFile | public void replaceStringInFile(File folder, File file, String template, String[] replacement)
throws IOException {
"""
/*
Replace one line in the given file in the given folder with the lines given
@param folder Folder in which file should be created
@param file Original file to patch
@param template Trimmed String with the pattern we are have to find
@param replacement Array of String that has to be written in the place of first line matching the template
"""
System.out.println("Patching file: "+file.getCanonicalPath());
String name = file.getName();
File origFile = new File(folder, name+".orig");
file.renameTo(origFile);
File temporaryFile = new File(folder, name+".tmp");
if (temporaryFile.exists()) {
temporaryFile.delete();
}
temporaryFile.createNewFile();
String line;
FileInputStream fis = new FileInputStream(origFile);
PrintWriter pw = new PrintWriter(temporaryFile);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
while ((line = br.readLine()) != null) {
if (line.trim().equals(template)) {
for (String s : replacement) {
pw.println(s);
}
} else {
pw.println(line);
}
}
pw.flush();
pw.close();
if (!temporaryFile.renameTo(new File(folder, name))) {
throw new IOException("Unable to rename file in folder "+folder.getName()+
" from \""+temporaryFile.getName()+"\" into \""+name +
"\n Original file saved as "+origFile.getName());
}
origFile.delete();
} | java | public void replaceStringInFile(File folder, File file, String template, String[] replacement)
throws IOException {
System.out.println("Patching file: "+file.getCanonicalPath());
String name = file.getName();
File origFile = new File(folder, name+".orig");
file.renameTo(origFile);
File temporaryFile = new File(folder, name+".tmp");
if (temporaryFile.exists()) {
temporaryFile.delete();
}
temporaryFile.createNewFile();
String line;
FileInputStream fis = new FileInputStream(origFile);
PrintWriter pw = new PrintWriter(temporaryFile);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
while ((line = br.readLine()) != null) {
if (line.trim().equals(template)) {
for (String s : replacement) {
pw.println(s);
}
} else {
pw.println(line);
}
}
pw.flush();
pw.close();
if (!temporaryFile.renameTo(new File(folder, name))) {
throw new IOException("Unable to rename file in folder "+folder.getName()+
" from \""+temporaryFile.getName()+"\" into \""+name +
"\n Original file saved as "+origFile.getName());
}
origFile.delete();
} | [
"public",
"void",
"replaceStringInFile",
"(",
"File",
"folder",
",",
"File",
"file",
",",
"String",
"template",
",",
"String",
"[",
"]",
"replacement",
")",
"throws",
"IOException",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Patching file: \"",
"+",
... | /*
Replace one line in the given file in the given folder with the lines given
@param folder Folder in which file should be created
@param file Original file to patch
@param template Trimmed String with the pattern we are have to find
@param replacement Array of String that has to be written in the place of first line matching the template | [
"/",
"*",
"Replace",
"one",
"line",
"in",
"the",
"given",
"file",
"in",
"the",
"given",
"folder",
"with",
"the",
"lines",
"given"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/buildSrc/src/main/groovy/JavadocFixTool.java#L317-L349 |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.isEmailableFrom | public static boolean isEmailableFrom(String email, String syncAccountName) {
"""
Returns true if:
(1) the email is not a resource like a conference room or another calendar.
Catch most of these by filtering out suffix calendar.google.com.
(2) the email is not equal to the sync account to prevent mailing himself.
"""
return Utils.isValidEmail(email) && !email.equals(syncAccountName);
} | java | public static boolean isEmailableFrom(String email, String syncAccountName) {
return Utils.isValidEmail(email) && !email.equals(syncAccountName);
} | [
"public",
"static",
"boolean",
"isEmailableFrom",
"(",
"String",
"email",
",",
"String",
"syncAccountName",
")",
"{",
"return",
"Utils",
".",
"isValidEmail",
"(",
"email",
")",
"&&",
"!",
"email",
".",
"equals",
"(",
"syncAccountName",
")",
";",
"}"
] | Returns true if:
(1) the email is not a resource like a conference room or another calendar.
Catch most of these by filtering out suffix calendar.google.com.
(2) the email is not equal to the sync account to prevent mailing himself. | [
"Returns",
"true",
"if",
":",
"(",
"1",
")",
"the",
"email",
"is",
"not",
"a",
"resource",
"like",
"a",
"conference",
"room",
"or",
"another",
"calendar",
".",
"Catch",
"most",
"of",
"these",
"by",
"filtering",
"out",
"suffix",
"calendar",
".",
"google",... | train | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L876-L878 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.buildProjects | public Collection<BuildProject> buildProjects(BuildProjectFilter filter) {
"""
Get Build Projects filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter.
"""
return get(BuildProject.class, (filter != null) ? filter : new BuildProjectFilter());
} | java | public Collection<BuildProject> buildProjects(BuildProjectFilter filter) {
return get(BuildProject.class, (filter != null) ? filter : new BuildProjectFilter());
} | [
"public",
"Collection",
"<",
"BuildProject",
">",
"buildProjects",
"(",
"BuildProjectFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"BuildProject",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"BuildProjectFilter",
"(",
... | Get Build Projects filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter. | [
"Get",
"Build",
"Projects",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"in",
"filter",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L305-L307 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java | RPUtils.scanForLeaves | public static void scanForLeaves(List<RPNode> nodes,RPTree scan) {
"""
Scan for leaves accumulating
the nodes in the passed in list
@param nodes the nodes so far
@param scan the tree to scan
"""
scanForLeaves(nodes,scan.getRoot());
} | java | public static void scanForLeaves(List<RPNode> nodes,RPTree scan) {
scanForLeaves(nodes,scan.getRoot());
} | [
"public",
"static",
"void",
"scanForLeaves",
"(",
"List",
"<",
"RPNode",
">",
"nodes",
",",
"RPTree",
"scan",
")",
"{",
"scanForLeaves",
"(",
"nodes",
",",
"scan",
".",
"getRoot",
"(",
")",
")",
";",
"}"
] | Scan for leaves accumulating
the nodes in the passed in list
@param nodes the nodes so far
@param scan the tree to scan | [
"Scan",
"for",
"leaves",
"accumulating",
"the",
"nodes",
"in",
"the",
"passed",
"in",
"list"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java#L451-L453 |
l0s/fernet-java8 | fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/SecretsManager.java | SecretsManager.getSecretStage | public ByteBuffer getSecretStage(final String secretId, final Stage stage) {
"""
Retrieve a specific stage of the secret.
@param secretId the ARN of the secret
@param stage the stage of the secret to retrieve
@return the Fernet key or keys in binary form
"""
final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest();
getSecretValueRequest.setSecretId(secretId);
getSecretValueRequest.setVersionStage(stage.getAwsName());
final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest);
return result.getSecretBinary();
} | java | public ByteBuffer getSecretStage(final String secretId, final Stage stage) {
final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest();
getSecretValueRequest.setSecretId(secretId);
getSecretValueRequest.setVersionStage(stage.getAwsName());
final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest);
return result.getSecretBinary();
} | [
"public",
"ByteBuffer",
"getSecretStage",
"(",
"final",
"String",
"secretId",
",",
"final",
"Stage",
"stage",
")",
"{",
"final",
"GetSecretValueRequest",
"getSecretValueRequest",
"=",
"new",
"GetSecretValueRequest",
"(",
")",
";",
"getSecretValueRequest",
".",
"setSec... | Retrieve a specific stage of the secret.
@param secretId the ARN of the secret
@param stage the stage of the secret to retrieve
@return the Fernet key or keys in binary form | [
"Retrieve",
"a",
"specific",
"stage",
"of",
"the",
"secret",
"."
] | train | https://github.com/l0s/fernet-java8/blob/427244bc1af605ffca0ac2469d66b297ea9f77b3/fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/SecretsManager.java#L107-L113 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/WCApplicationHelper.java | WCApplicationHelper.addEarToServerApps | public static void addEarToServerApps(LibertyServer server, String dir, String earName) throws Exception {
"""
/*
Helper method to create a ear and placed it to the specified directory which is relative from /publish/servers/ directory.
"""
server.copyFileToLibertyServerRoot(DIR_PUBLISH + server.getServerName() + "/" + dir, DIR_APPS, earName);
} | java | public static void addEarToServerApps(LibertyServer server, String dir, String earName) throws Exception {
server.copyFileToLibertyServerRoot(DIR_PUBLISH + server.getServerName() + "/" + dir, DIR_APPS, earName);
} | [
"public",
"static",
"void",
"addEarToServerApps",
"(",
"LibertyServer",
"server",
",",
"String",
"dir",
",",
"String",
"earName",
")",
"throws",
"Exception",
"{",
"server",
".",
"copyFileToLibertyServerRoot",
"(",
"DIR_PUBLISH",
"+",
"server",
".",
"getServerName",
... | /*
Helper method to create a ear and placed it to the specified directory which is relative from /publish/servers/ directory. | [
"/",
"*",
"Helper",
"method",
"to",
"create",
"a",
"ear",
"and",
"placed",
"it",
"to",
"the",
"specified",
"directory",
"which",
"is",
"relative",
"from",
"/",
"publish",
"/",
"servers",
"/",
"directory",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/WCApplicationHelper.java#L187-L189 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/script/ExtensionScript.java | ExtensionScript.invokeProxyScript | public boolean invokeProxyScript(ScriptWrapper script, HttpMessage msg, boolean request) {
"""
Invokes the given {@code script}, synchronously, as a {@link ProxyScript}, handling any {@code Exception} thrown during
the invocation.
<p>
The context class loader of caller thread is replaced with the class loader {@code AddOnLoader} to allow the script to
access classes of add-ons.
@param script the script to invoke.
@param msg the HTTP message being proxied.
@param request {@code true} if processing the request, {@code false} otherwise.
@return {@code true} if the request should be forward to the server, {@code false} otherwise.
@since 2.2.0
@see #getInterface(ScriptWrapper, Class)
"""
validateScriptType(script, TYPE_PROXY);
Writer writer = getWriters(script);
try {
// Dont need to check if enabled as it can only be invoked manually
ProxyScript s = this.getInterface(script, ProxyScript.class);
if (s != null) {
if (request) {
return s.proxyRequest(msg);
} else {
return s.proxyResponse(msg);
}
} else {
handleUnspecifiedScriptError(script, writer, Constant.messages.getString("script.interface.proxy.error"));
}
} catch (Exception e) {
handleScriptException(script, writer, e);
}
// Return true so that the request is submitted - if we returned false all proxying would fail on script errors
return true;
} | java | public boolean invokeProxyScript(ScriptWrapper script, HttpMessage msg, boolean request) {
validateScriptType(script, TYPE_PROXY);
Writer writer = getWriters(script);
try {
// Dont need to check if enabled as it can only be invoked manually
ProxyScript s = this.getInterface(script, ProxyScript.class);
if (s != null) {
if (request) {
return s.proxyRequest(msg);
} else {
return s.proxyResponse(msg);
}
} else {
handleUnspecifiedScriptError(script, writer, Constant.messages.getString("script.interface.proxy.error"));
}
} catch (Exception e) {
handleScriptException(script, writer, e);
}
// Return true so that the request is submitted - if we returned false all proxying would fail on script errors
return true;
} | [
"public",
"boolean",
"invokeProxyScript",
"(",
"ScriptWrapper",
"script",
",",
"HttpMessage",
"msg",
",",
"boolean",
"request",
")",
"{",
"validateScriptType",
"(",
"script",
",",
"TYPE_PROXY",
")",
";",
"Writer",
"writer",
"=",
"getWriters",
"(",
"script",
")",... | Invokes the given {@code script}, synchronously, as a {@link ProxyScript}, handling any {@code Exception} thrown during
the invocation.
<p>
The context class loader of caller thread is replaced with the class loader {@code AddOnLoader} to allow the script to
access classes of add-ons.
@param script the script to invoke.
@param msg the HTTP message being proxied.
@param request {@code true} if processing the request, {@code false} otherwise.
@return {@code true} if the request should be forward to the server, {@code false} otherwise.
@since 2.2.0
@see #getInterface(ScriptWrapper, Class) | [
"Invokes",
"the",
"given",
"{",
"@code",
"script",
"}",
"synchronously",
"as",
"a",
"{",
"@link",
"ProxyScript",
"}",
"handling",
"any",
"{",
"@code",
"Exception",
"}",
"thrown",
"during",
"the",
"invocation",
".",
"<p",
">",
"The",
"context",
"class",
"lo... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ExtensionScript.java#L1482-L1506 |
jenetics/jpx | jpx/src/main/java/io/jenetics/jpx/IO.java | IO.writeNullableString | static void writeNullableString(final String value, final DataOutput out)
throws IOException {
"""
Write the given string, possible {@code null}, {@code value} to the given
data output.
@param value the string value to write
@param out the data output
@throws NullPointerException if the given data output is {@code null}
@throws IOException if an I/O error occurs
"""
writeNullable(value, IO::writeString, out);
} | java | static void writeNullableString(final String value, final DataOutput out)
throws IOException
{
writeNullable(value, IO::writeString, out);
} | [
"static",
"void",
"writeNullableString",
"(",
"final",
"String",
"value",
",",
"final",
"DataOutput",
"out",
")",
"throws",
"IOException",
"{",
"writeNullable",
"(",
"value",
",",
"IO",
"::",
"writeString",
",",
"out",
")",
";",
"}"
] | Write the given string, possible {@code null}, {@code value} to the given
data output.
@param value the string value to write
@param out the data output
@throws NullPointerException if the given data output is {@code null}
@throws IOException if an I/O error occurs | [
"Write",
"the",
"given",
"string",
"possible",
"{",
"@code",
"null",
"}",
"{",
"@code",
"value",
"}",
"to",
"the",
"given",
"data",
"output",
"."
] | train | https://github.com/jenetics/jpx/blob/58fefc10580602d07f1480d6a5886d13a553ff8f/jpx/src/main/java/io/jenetics/jpx/IO.java#L144-L148 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/ConfigValidation.java | ConfigValidation.fv | public static NestableFieldValidator fv(final Class cls, final boolean nullAllowed) {
"""
Returns a new NestableFieldValidator for a given class.
@param cls the Class the field should be a type of
@param nullAllowed whether or not a value of null is valid
@return a NestableFieldValidator for that class
"""
return new NestableFieldValidator() {
@Override
public void validateField(String pd, String name, Object field) throws IllegalArgumentException {
if (nullAllowed && field == null) {
return;
}
if (!cls.isInstance(field)) {
throw new IllegalArgumentException(pd + name + " must be a " + cls.getName() + ". (" + field + ")");
}
}
};
} | java | public static NestableFieldValidator fv(final Class cls, final boolean nullAllowed) {
return new NestableFieldValidator() {
@Override
public void validateField(String pd, String name, Object field) throws IllegalArgumentException {
if (nullAllowed && field == null) {
return;
}
if (!cls.isInstance(field)) {
throw new IllegalArgumentException(pd + name + " must be a " + cls.getName() + ". (" + field + ")");
}
}
};
} | [
"public",
"static",
"NestableFieldValidator",
"fv",
"(",
"final",
"Class",
"cls",
",",
"final",
"boolean",
"nullAllowed",
")",
"{",
"return",
"new",
"NestableFieldValidator",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"validateField",
"(",
"String",
"pd",... | Returns a new NestableFieldValidator for a given class.
@param cls the Class the field should be a type of
@param nullAllowed whether or not a value of null is valid
@return a NestableFieldValidator for that class | [
"Returns",
"a",
"new",
"NestableFieldValidator",
"for",
"a",
"given",
"class",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/ConfigValidation.java#L68-L80 |
micronaut-projects/micronaut-core | http-netty/src/main/java/io/micronaut/http/netty/stream/HttpStreamsHandler.java | HttpStreamsHandler.removeHandlerIfActive | private void removeHandlerIfActive(ChannelHandlerContext ctx, String name) {
"""
Most operations we want to do even if the channel is not active, because if it's not, then we want to encounter
the error that occurs when that operation happens and so that it can be passed up to the user. However, removing
handlers should only be done if the channel is active, because the error that is encountered when they aren't
makes no sense to the user (NoSuchElementException).
"""
if (ctx.channel().isActive()) {
ChannelPipeline pipeline = ctx.pipeline();
ChannelHandler handler = pipeline.get(name);
if (handler != null) {
pipeline.remove(name);
}
}
} | java | private void removeHandlerIfActive(ChannelHandlerContext ctx, String name) {
if (ctx.channel().isActive()) {
ChannelPipeline pipeline = ctx.pipeline();
ChannelHandler handler = pipeline.get(name);
if (handler != null) {
pipeline.remove(name);
}
}
} | [
"private",
"void",
"removeHandlerIfActive",
"(",
"ChannelHandlerContext",
"ctx",
",",
"String",
"name",
")",
"{",
"if",
"(",
"ctx",
".",
"channel",
"(",
")",
".",
"isActive",
"(",
")",
")",
"{",
"ChannelPipeline",
"pipeline",
"=",
"ctx",
".",
"pipeline",
"... | Most operations we want to do even if the channel is not active, because if it's not, then we want to encounter
the error that occurs when that operation happens and so that it can be passed up to the user. However, removing
handlers should only be done if the channel is active, because the error that is encountered when they aren't
makes no sense to the user (NoSuchElementException). | [
"Most",
"operations",
"we",
"want",
"to",
"do",
"even",
"if",
"the",
"channel",
"is",
"not",
"active",
"because",
"if",
"it",
"s",
"not",
"then",
"we",
"want",
"to",
"encounter",
"the",
"error",
"that",
"occurs",
"when",
"that",
"operation",
"happens",
"... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http-netty/src/main/java/io/micronaut/http/netty/stream/HttpStreamsHandler.java#L379-L387 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java | ServerUpdater.setIcon | public ServerUpdater setIcon(InputStream icon, String fileType) {
"""
Queues the icon to be updated.
@param icon The new icon of the server.
@param fileType The type of the icon, e.g. "png" or "jpg".
@return The current instance in order to chain call methods.
"""
delegate.setIcon(icon, fileType);
return this;
} | java | public ServerUpdater setIcon(InputStream icon, String fileType) {
delegate.setIcon(icon, fileType);
return this;
} | [
"public",
"ServerUpdater",
"setIcon",
"(",
"InputStream",
"icon",
",",
"String",
"fileType",
")",
"{",
"delegate",
".",
"setIcon",
"(",
"icon",
",",
"fileType",
")",
";",
"return",
"this",
";",
"}"
] | Queues the icon to be updated.
@param icon The new icon of the server.
@param fileType The type of the icon, e.g. "png" or "jpg".
@return The current instance in order to chain call methods. | [
"Queues",
"the",
"icon",
"to",
"be",
"updated",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L238-L241 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/QueryBuilder.java | QueryBuilder.addJoinInfo | private void addJoinInfo(JoinType type, String localColumnName, String joinedColumnName,
QueryBuilder<?, ?> joinedQueryBuilder, JoinWhereOperation operation) throws SQLException {
"""
Add join info to the query. This can be called multiple times to join with more than one table.
"""
JoinInfo joinInfo = new JoinInfo(type, joinedQueryBuilder, operation);
if (localColumnName == null) {
matchJoinedFields(joinInfo, joinedQueryBuilder);
} else {
matchJoinedFieldsByName(joinInfo, localColumnName, joinedColumnName, joinedQueryBuilder);
}
if (joinList == null) {
joinList = new ArrayList<JoinInfo>();
}
joinList.add(joinInfo);
} | java | private void addJoinInfo(JoinType type, String localColumnName, String joinedColumnName,
QueryBuilder<?, ?> joinedQueryBuilder, JoinWhereOperation operation) throws SQLException {
JoinInfo joinInfo = new JoinInfo(type, joinedQueryBuilder, operation);
if (localColumnName == null) {
matchJoinedFields(joinInfo, joinedQueryBuilder);
} else {
matchJoinedFieldsByName(joinInfo, localColumnName, joinedColumnName, joinedQueryBuilder);
}
if (joinList == null) {
joinList = new ArrayList<JoinInfo>();
}
joinList.add(joinInfo);
} | [
"private",
"void",
"addJoinInfo",
"(",
"JoinType",
"type",
",",
"String",
"localColumnName",
",",
"String",
"joinedColumnName",
",",
"QueryBuilder",
"<",
"?",
",",
"?",
">",
"joinedQueryBuilder",
",",
"JoinWhereOperation",
"operation",
")",
"throws",
"SQLException",... | Add join info to the query. This can be called multiple times to join with more than one table. | [
"Add",
"join",
"info",
"to",
"the",
"query",
".",
"This",
"can",
"be",
"called",
"multiple",
"times",
"to",
"join",
"with",
"more",
"than",
"one",
"table",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/QueryBuilder.java#L578-L590 |
alkacon/opencms-core | src/org/opencms/ui/apps/cacheadmin/CmsFlexCacheTable.java | CmsFlexCacheTable.showVariationsWindow | void showVariationsWindow(String resource) {
"""
Shows dialog for variations of given resource.<p>
@param resource to show variations for
"""
final Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
CmsVariationsDialog variationsDialog = new CmsVariationsDialog(resource, new Runnable() {
public void run() {
window.close();
}
}, Mode.FlexCache);
try {
CmsResource resourceObject = getRootCms().readResource(CmsFlexCacheKey.getResourceName(resource));
variationsDialog.displayResourceInfo(Collections.singletonList(resourceObject));
} catch (CmsException e) {
//
}
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_VIEW_FLEX_VARIATIONS_1, resource));
window.setContent(variationsDialog);
UI.getCurrent().addWindow(window);
} | java | void showVariationsWindow(String resource) {
final Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
CmsVariationsDialog variationsDialog = new CmsVariationsDialog(resource, new Runnable() {
public void run() {
window.close();
}
}, Mode.FlexCache);
try {
CmsResource resourceObject = getRootCms().readResource(CmsFlexCacheKey.getResourceName(resource));
variationsDialog.displayResourceInfo(Collections.singletonList(resourceObject));
} catch (CmsException e) {
//
}
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_VIEW_FLEX_VARIATIONS_1, resource));
window.setContent(variationsDialog);
UI.getCurrent().addWindow(window);
} | [
"void",
"showVariationsWindow",
"(",
"String",
"resource",
")",
"{",
"final",
"Window",
"window",
"=",
"CmsBasicDialog",
".",
"prepareWindow",
"(",
"DialogWidth",
".",
"max",
")",
";",
"CmsVariationsDialog",
"variationsDialog",
"=",
"new",
"CmsVariationsDialog",
"("... | Shows dialog for variations of given resource.<p>
@param resource to show variations for | [
"Shows",
"dialog",
"for",
"variations",
"of",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/cacheadmin/CmsFlexCacheTable.java#L282-L303 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationMetadataUpdater.java | OperationMetadataUpdater.fromMetadata | private <T> T fromMetadata(Function<ContainerMetadata, T> getter) {
"""
Returns the result of the given function applied either to the current UpdateTransaction (if any), or the base metadata,
if no UpdateTransaction exists.
@param getter The Function to apply.
@param <T> Result type.
@return The result of the given Function.
"""
ContainerMetadataUpdateTransaction txn = getActiveTransaction();
return getter.apply(txn == null ? this.metadata : txn);
} | java | private <T> T fromMetadata(Function<ContainerMetadata, T> getter) {
ContainerMetadataUpdateTransaction txn = getActiveTransaction();
return getter.apply(txn == null ? this.metadata : txn);
} | [
"private",
"<",
"T",
">",
"T",
"fromMetadata",
"(",
"Function",
"<",
"ContainerMetadata",
",",
"T",
">",
"getter",
")",
"{",
"ContainerMetadataUpdateTransaction",
"txn",
"=",
"getActiveTransaction",
"(",
")",
";",
"return",
"getter",
".",
"apply",
"(",
"txn",
... | Returns the result of the given function applied either to the current UpdateTransaction (if any), or the base metadata,
if no UpdateTransaction exists.
@param getter The Function to apply.
@param <T> Result type.
@return The result of the given Function. | [
"Returns",
"the",
"result",
"of",
"the",
"given",
"function",
"applied",
"either",
"to",
"the",
"current",
"UpdateTransaction",
"(",
"if",
"any",
")",
"or",
"the",
"base",
"metadata",
"if",
"no",
"UpdateTransaction",
"exists",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationMetadataUpdater.java#L251-L254 |
nightcode/yaranga | core/src/org/nightcode/common/base/Objects.java | Objects.validArgument | public static void validArgument(boolean expression, String message, Object... messageArgs) {
"""
Checks boolean expression.
@param expression a boolean expression
@param message error message
@param messageArgs array of parameters to the message
@throws IllegalArgumentException if boolean expression is false
"""
if (!expression) {
throw new IllegalArgumentException(format(message, messageArgs));
}
} | java | public static void validArgument(boolean expression, String message, Object... messageArgs) {
if (!expression) {
throw new IllegalArgumentException(format(message, messageArgs));
}
} | [
"public",
"static",
"void",
"validArgument",
"(",
"boolean",
"expression",
",",
"String",
"message",
",",
"Object",
"...",
"messageArgs",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"message... | Checks boolean expression.
@param expression a boolean expression
@param message error message
@param messageArgs array of parameters to the message
@throws IllegalArgumentException if boolean expression is false | [
"Checks",
"boolean",
"expression",
"."
] | train | https://github.com/nightcode/yaranga/blob/f02cf8d8bcd365b6b1d55638938631a00e9ee808/core/src/org/nightcode/common/base/Objects.java#L49-L53 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPPUtility.java | MPPUtility.getString | public static final String getString(byte[] data, int offset) {
"""
Reads a string of single byte characters from the input array.
This method assumes that the string finishes either at the
end of the array, or when char zero is encountered.
Reading begins at the supplied offset into the array.
@param data byte array of data
@param offset offset into the array
@return string value
"""
StringBuilder buffer = new StringBuilder();
char c;
for (int loop = 0; offset + loop < data.length; loop++)
{
c = (char) data[offset + loop];
if (c == 0)
{
break;
}
buffer.append(c);
}
return (buffer.toString());
} | java | public static final String getString(byte[] data, int offset)
{
StringBuilder buffer = new StringBuilder();
char c;
for (int loop = 0; offset + loop < data.length; loop++)
{
c = (char) data[offset + loop];
if (c == 0)
{
break;
}
buffer.append(c);
}
return (buffer.toString());
} | [
"public",
"static",
"final",
"String",
"getString",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"{",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"c",
";",
"for",
"(",
"int",
"loop",
"=",
"0",
";",
"off... | Reads a string of single byte characters from the input array.
This method assumes that the string finishes either at the
end of the array, or when char zero is encountered.
Reading begins at the supplied offset into the array.
@param data byte array of data
@param offset offset into the array
@return string value | [
"Reads",
"a",
"string",
"of",
"single",
"byte",
"characters",
"from",
"the",
"input",
"array",
".",
"This",
"method",
"assumes",
"that",
"the",
"string",
"finishes",
"either",
"at",
"the",
"end",
"of",
"the",
"array",
"or",
"when",
"char",
"zero",
"is",
... | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L492-L510 |
haifengl/smile | core/src/main/java/smile/association/TotalSupportTree.java | TotalSupportTree.add | private void add(Node node, int size, int index, int[] itemset, int support) {
"""
Inserts a node into a T-tree.
@param node the root of subtree.
@param size the size of the current array in T-tree.
@param index the index of the last item in the item set, which is also
used as a level counter.
@param itemset the given item set.
@param support the support value associated with the given item set.
"""
if (node.children == null) {
node.children = new Node[size];
}
int item = order[itemset[index]];
if (node.children[item] == null) {
node.children[item] = new Node(itemset[index]);
}
if (index == 0) {
node.children[item].support += support;
} else {
add(node.children[item], item, index - 1, itemset, support);
}
} | java | private void add(Node node, int size, int index, int[] itemset, int support) {
if (node.children == null) {
node.children = new Node[size];
}
int item = order[itemset[index]];
if (node.children[item] == null) {
node.children[item] = new Node(itemset[index]);
}
if (index == 0) {
node.children[item].support += support;
} else {
add(node.children[item], item, index - 1, itemset, support);
}
} | [
"private",
"void",
"add",
"(",
"Node",
"node",
",",
"int",
"size",
",",
"int",
"index",
",",
"int",
"[",
"]",
"itemset",
",",
"int",
"support",
")",
"{",
"if",
"(",
"node",
".",
"children",
"==",
"null",
")",
"{",
"node",
".",
"children",
"=",
"n... | Inserts a node into a T-tree.
@param node the root of subtree.
@param size the size of the current array in T-tree.
@param index the index of the last item in the item set, which is also
used as a level counter.
@param itemset the given item set.
@param support the support value associated with the given item set. | [
"Inserts",
"a",
"node",
"into",
"a",
"T",
"-",
"tree",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/TotalSupportTree.java#L108-L123 |
mfornos/humanize | humanize-icu/src/main/java/humanize/ICUHumanize.java | ICUHumanize.formatDate | public static String formatDate(final Date value, final String pattern) {
"""
<p>
Formats a date according to the given pattern.
</p>
@param value
Date to be formatted
@param pattern
The pattern. See {@link dateFormatInstance(String)}
@return a formatted date/time string
"""
return new SimpleDateFormat(pattern, context.get().getLocale()).format(value);
} | java | public static String formatDate(final Date value, final String pattern)
{
return new SimpleDateFormat(pattern, context.get().getLocale()).format(value);
} | [
"public",
"static",
"String",
"formatDate",
"(",
"final",
"Date",
"value",
",",
"final",
"String",
"pattern",
")",
"{",
"return",
"new",
"SimpleDateFormat",
"(",
"pattern",
",",
"context",
".",
"get",
"(",
")",
".",
"getLocale",
"(",
")",
")",
".",
"form... | <p>
Formats a date according to the given pattern.
</p>
@param value
Date to be formatted
@param pattern
The pattern. See {@link dateFormatInstance(String)}
@return a formatted date/time string | [
"<p",
">",
"Formats",
"a",
"date",
"according",
"to",
"the",
"given",
"pattern",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L706-L709 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/TerminalTextUtils.java | TerminalTextUtils.getColumnIndex | public static int getColumnIndex(String s, int stringCharacterIndex, TabBehaviour tabBehaviour, int firstCharacterColumnPosition) throws StringIndexOutOfBoundsException {
"""
Given a string and a character index inside that string, find out what the column index of that character would
be if printed in a terminal. If the string only contains non-CJK characters then the returned value will be same
as {@code stringCharacterIndex}, but if there are CJK characters the value will be different due to CJK
characters taking up two columns in width. If the character at the index in the string is a CJK character itself,
the returned value will be the index of the left-side of character.
@param s String to translate the index from
@param stringCharacterIndex Index within the string to get the terminal column index of
@param tabBehaviour The behavior to use when encountering the tab character
@param firstCharacterColumnPosition Where on the screen the first character in the string would be printed, this
applies only when you have an alignment-based {@link TabBehaviour}
@return Index of the character inside the String at {@code stringCharacterIndex} when it has been writted to a
terminal
@throws StringIndexOutOfBoundsException if the index given is outside the String length or negative
"""
int index = 0;
for(int i = 0; i < stringCharacterIndex; i++) {
if(s.charAt(i) == '\t') {
index += tabBehaviour.getTabReplacement(firstCharacterColumnPosition).length();
}
else {
if (isCharCJK(s.charAt(i))) {
index++;
}
index++;
}
}
return index;
} | java | public static int getColumnIndex(String s, int stringCharacterIndex, TabBehaviour tabBehaviour, int firstCharacterColumnPosition) throws StringIndexOutOfBoundsException {
int index = 0;
for(int i = 0; i < stringCharacterIndex; i++) {
if(s.charAt(i) == '\t') {
index += tabBehaviour.getTabReplacement(firstCharacterColumnPosition).length();
}
else {
if (isCharCJK(s.charAt(i))) {
index++;
}
index++;
}
}
return index;
} | [
"public",
"static",
"int",
"getColumnIndex",
"(",
"String",
"s",
",",
"int",
"stringCharacterIndex",
",",
"TabBehaviour",
"tabBehaviour",
",",
"int",
"firstCharacterColumnPosition",
")",
"throws",
"StringIndexOutOfBoundsException",
"{",
"int",
"index",
"=",
"0",
";",
... | Given a string and a character index inside that string, find out what the column index of that character would
be if printed in a terminal. If the string only contains non-CJK characters then the returned value will be same
as {@code stringCharacterIndex}, but if there are CJK characters the value will be different due to CJK
characters taking up two columns in width. If the character at the index in the string is a CJK character itself,
the returned value will be the index of the left-side of character.
@param s String to translate the index from
@param stringCharacterIndex Index within the string to get the terminal column index of
@param tabBehaviour The behavior to use when encountering the tab character
@param firstCharacterColumnPosition Where on the screen the first character in the string would be printed, this
applies only when you have an alignment-based {@link TabBehaviour}
@return Index of the character inside the String at {@code stringCharacterIndex} when it has been writted to a
terminal
@throws StringIndexOutOfBoundsException if the index given is outside the String length or negative | [
"Given",
"a",
"string",
"and",
"a",
"character",
"index",
"inside",
"that",
"string",
"find",
"out",
"what",
"the",
"column",
"index",
"of",
"that",
"character",
"would",
"be",
"if",
"printed",
"in",
"a",
"terminal",
".",
"If",
"the",
"string",
"only",
"... | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TerminalTextUtils.java#L199-L213 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.