repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
jbundle/jbundle | base/message/service/src/main/java/org/jbundle/base/message/service/BaseMessageServiceActivator.java | BaseMessageServiceActivator.startupService | public Object startupService(BundleContext bundleContext)
{
Map<String,Object> props = this.getServiceProperties();
Environment env = (Environment)this.getService(Env.class);
props = Utility.putAllIfNew(props, env.getProperties()); // Use the same params as environment
// Note the order that I do this... this is because MainApplication may need access to the remoteapp during initialization
App app = env.getMessageApplication(true, props);
Task task = new AutoTask(app, null, props);
return this.createMessageService(task, null, props);
} | java | public Object startupService(BundleContext bundleContext)
{
Map<String,Object> props = this.getServiceProperties();
Environment env = (Environment)this.getService(Env.class);
props = Utility.putAllIfNew(props, env.getProperties()); // Use the same params as environment
// Note the order that I do this... this is because MainApplication may need access to the remoteapp during initialization
App app = env.getMessageApplication(true, props);
Task task = new AutoTask(app, null, props);
return this.createMessageService(task, null, props);
} | [
"public",
"Object",
"startupService",
"(",
"BundleContext",
"bundleContext",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"this",
".",
"getServiceProperties",
"(",
")",
";",
"Environment",
"env",
"=",
"(",
"Environment",
")",
"this",
"."... | Start this service.
Override this to do all the startup.
@return true if successful. | [
"Start",
"this",
"service",
".",
"Override",
"this",
"to",
"do",
"all",
"the",
"startup",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/service/src/main/java/org/jbundle/base/message/service/BaseMessageServiceActivator.java#L84-L94 |
op4j/op4j | src/main/java/org/op4j/functions/Call.java | Call.arrayOfString | public static Function<Object,String[]> arrayOfString(final String methodName, final Object... optionalParameters) {
return methodForArrayOfString(methodName, optionalParameters);
} | java | public static Function<Object,String[]> arrayOfString(final String methodName, final Object... optionalParameters) {
return methodForArrayOfString(methodName, optionalParameters);
} | [
"public",
"static",
"Function",
"<",
"Object",
",",
"String",
"[",
"]",
">",
"arrayOfString",
"(",
"final",
"String",
"methodName",
",",
"final",
"Object",
"...",
"optionalParameters",
")",
"{",
"return",
"methodForArrayOfString",
"(",
"methodName",
",",
"option... | <p>
Abbreviation for {{@link #methodForArrayOfString(String, Object...)}.
</p>
@since 1.1
@param methodName the name of the method
@param optionalParameters the (optional) parameters of the method.
@return the result of the method execution | [
"<p",
">",
"Abbreviation",
"for",
"{{",
"@link",
"#methodForArrayOfString",
"(",
"String",
"Object",
"...",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/Call.java#L612-L614 |
google/flogger | api/src/main/java/com/google/common/flogger/backend/system/AbstractBackend.java | AbstractBackend.publish | private static void publish(Logger logger, LogRecord record) {
// Annoyingly this method appears to copy the array every time it is called, but there's
// nothing much we can do about this (and there could be synchronization issues even if we
// could access things directly because handlers can be changed at any time). Most of the
// time this returns the singleton empty array however, so it's not as bad as all that.
for (Handler handler : logger.getHandlers()) {
handler.publish(record);
}
if (logger.getUseParentHandlers()) {
logger = logger.getParent();
if (logger != null) {
publish(logger, record);
}
}
} | java | private static void publish(Logger logger, LogRecord record) {
// Annoyingly this method appears to copy the array every time it is called, but there's
// nothing much we can do about this (and there could be synchronization issues even if we
// could access things directly because handlers can be changed at any time). Most of the
// time this returns the singleton empty array however, so it's not as bad as all that.
for (Handler handler : logger.getHandlers()) {
handler.publish(record);
}
if (logger.getUseParentHandlers()) {
logger = logger.getParent();
if (logger != null) {
publish(logger, record);
}
}
} | [
"private",
"static",
"void",
"publish",
"(",
"Logger",
"logger",
",",
"LogRecord",
"record",
")",
"{",
"// Annoyingly this method appears to copy the array every time it is called, but there's",
"// nothing much we can do about this (and there could be synchronization issues even if we",
... | rate limiting. Thus we don't have to care about using iterative methods vs recursion here. | [
"rate",
"limiting",
".",
"Thus",
"we",
"don",
"t",
"have",
"to",
"care",
"about",
"using",
"iterative",
"methods",
"vs",
"recursion",
"here",
"."
] | train | https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/backend/system/AbstractBackend.java#L123-L137 |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java | JCusolverSp.cusolverSpScsrlsvqr | public static int cusolverSpScsrlsvqr(
cusolverSpHandle handle,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrVal,
Pointer csrRowPtr,
Pointer csrColInd,
Pointer b,
float tol,
int reorder,
Pointer x,
int[] singularity)
{
return checkResult(cusolverSpScsrlsvqrNative(handle, m, nnz, descrA, csrVal, csrRowPtr, csrColInd, b, tol, reorder, x, singularity));
} | java | public static int cusolverSpScsrlsvqr(
cusolverSpHandle handle,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrVal,
Pointer csrRowPtr,
Pointer csrColInd,
Pointer b,
float tol,
int reorder,
Pointer x,
int[] singularity)
{
return checkResult(cusolverSpScsrlsvqrNative(handle, m, nnz, descrA, csrVal, csrRowPtr, csrColInd, b, tol, reorder, x, singularity));
} | [
"public",
"static",
"int",
"cusolverSpScsrlsvqr",
"(",
"cusolverSpHandle",
"handle",
",",
"int",
"m",
",",
"int",
"nnz",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrVal",
",",
"Pointer",
"csrRowPtr",
",",
"Pointer",
"csrColInd",
",",
"Pointer",
"b",
... | <pre>
-------- GPU linear solver by QR factorization
solve A*x = b, A can be singular
[ls] stands for linear solve
[v] stands for vector
[qr] stands for QR factorization
</pre> | [
"<pre",
">",
"--------",
"GPU",
"linear",
"solver",
"by",
"QR",
"factorization",
"solve",
"A",
"*",
"x",
"=",
"b",
"A",
"can",
"be",
"singular",
"[",
"ls",
"]",
"stands",
"for",
"linear",
"solve",
"[",
"v",
"]",
"stands",
"for",
"vector",
"[",
"qr",
... | train | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java#L270-L285 |
ZenHarbinger/l2fprod-properties-editor | src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java | JCollapsiblePane.setAnimationParams | private void setAnimationParams(AnimationParams params) {
if (params == null) {
throw new IllegalArgumentException(
"params can't be null");
}
if (animateTimer != null) {
animateTimer.stop();
}
animationParams = params;
animateTimer = new Timer(animationParams.waitTime, animator);
animateTimer.setInitialDelay(0);
} | java | private void setAnimationParams(AnimationParams params) {
if (params == null) {
throw new IllegalArgumentException(
"params can't be null");
}
if (animateTimer != null) {
animateTimer.stop();
}
animationParams = params;
animateTimer = new Timer(animationParams.waitTime, animator);
animateTimer.setInitialDelay(0);
} | [
"private",
"void",
"setAnimationParams",
"(",
"AnimationParams",
"params",
")",
"{",
"if",
"(",
"params",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"params can't be null\"",
")",
";",
"}",
"if",
"(",
"animateTimer",
"!=",
"null",... | Sets the parameters controlling the animation.
@param params
@throws IllegalArgumentException if params is null | [
"Sets",
"the",
"parameters",
"controlling",
"the",
"animation",
"."
] | train | https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java#L417-L428 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderAttributeUrl.java | OrderAttributeUrl.updateCheckoutAttributeUrl | public static MozuUrl updateCheckoutAttributeUrl(String checkoutId, Boolean removeMissing)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/attributes?removeMissing={removeMissing}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("removeMissing", removeMissing);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateCheckoutAttributeUrl(String checkoutId, Boolean removeMissing)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/attributes?removeMissing={removeMissing}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("removeMissing", removeMissing);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateCheckoutAttributeUrl",
"(",
"String",
"checkoutId",
",",
"Boolean",
"removeMissing",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checkoutId}/attributes?removeMissing={removeMissing}\"",
... | Get Resource Url for UpdateCheckoutAttribute
@param checkoutId The unique identifier of the checkout.
@param removeMissing If true, the operation removes missing properties so that the updated checkout attributes will not show properties with a null value.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateCheckoutAttribute"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/checkouts/OrderAttributeUrl.java#L46-L52 |
EasyinnovaSL/Tiff-Library-4J | src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java | TiffITProfile.validateIfdLW | private void validateIfdLW(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
if (p == 0) {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{4});
} else {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8});
}
checkRequiredTag(metadata, "Compression", 1, new long[]{32896});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
if (p == 1) {
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ColorTable", -1);
} | java | private void validateIfdLW(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
if (p == 0) {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{4});
} else {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8});
}
checkRequiredTag(metadata, "Compression", 1, new long[]{32896});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
if (p == 1) {
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ColorTable", -1);
} | [
"private",
"void",
"validateIfdLW",
"(",
"IFD",
"ifd",
",",
"int",
"p",
")",
"{",
"IfdTags",
"metadata",
"=",
"ifd",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NewSubfileType\"",
... | Validate Line Work.
@param ifd the ifd
@param p the profile (default = 0, P1 = 1, P2 = 2) | [
"Validate",
"Line",
"Work",
"."
] | train | https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L332-L364 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/DOC.java | DOC.findNeighbors | protected DBIDs findNeighbors(DBIDRef q, long[] nD, ArrayModifiableDBIDs S, Relation<V> relation) {
// Weights for distance (= rectangle query)
DistanceQuery<V> dq = relation.getDistanceQuery(new SubspaceMaximumDistanceFunction(nD));
// TODO: add filtering capabilities into query API!
// Until then, using the range query API will be unnecessarily slow.
// RangeQuery<V> rq = relation.getRangeQuery(df, DatabaseQuery.HINT_SINGLE);
ArrayModifiableDBIDs nC = DBIDUtil.newArray();
for(DBIDIter it = S.iter(); it.valid(); it.advance()) {
if(dq.distance(q, it) <= w) {
nC.add(it);
}
}
return nC;
} | java | protected DBIDs findNeighbors(DBIDRef q, long[] nD, ArrayModifiableDBIDs S, Relation<V> relation) {
// Weights for distance (= rectangle query)
DistanceQuery<V> dq = relation.getDistanceQuery(new SubspaceMaximumDistanceFunction(nD));
// TODO: add filtering capabilities into query API!
// Until then, using the range query API will be unnecessarily slow.
// RangeQuery<V> rq = relation.getRangeQuery(df, DatabaseQuery.HINT_SINGLE);
ArrayModifiableDBIDs nC = DBIDUtil.newArray();
for(DBIDIter it = S.iter(); it.valid(); it.advance()) {
if(dq.distance(q, it) <= w) {
nC.add(it);
}
}
return nC;
} | [
"protected",
"DBIDs",
"findNeighbors",
"(",
"DBIDRef",
"q",
",",
"long",
"[",
"]",
"nD",
",",
"ArrayModifiableDBIDs",
"S",
",",
"Relation",
"<",
"V",
">",
"relation",
")",
"{",
"// Weights for distance (= rectangle query)",
"DistanceQuery",
"<",
"V",
">",
"dq",
... | Find the neighbors of point q in the given subspace
@param q Query point
@param nD Subspace mask
@param S Remaining data points
@param relation Data relation
@return Neighbors | [
"Find",
"the",
"neighbors",
"of",
"point",
"q",
"in",
"the",
"given",
"subspace"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/DOC.java#L280-L294 |
wealthfront/kawala | kawala-common/src/main/java/com/kaching/platform/common/reflect/ReflectUtils.java | ReflectUtils.getField | public static Object getField(Object obj, String name) {
try {
Class<? extends Object> klass = obj.getClass();
do {
try {
Field field = klass.getDeclaredField(name);
field.setAccessible(true);
return field.get(obj);
} catch (NoSuchFieldException e) {
klass = klass.getSuperclass();
}
} while (klass != null);
throw new RuntimeException(); // true no such field exception
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | java | public static Object getField(Object obj, String name) {
try {
Class<? extends Object> klass = obj.getClass();
do {
try {
Field field = klass.getDeclaredField(name);
field.setAccessible(true);
return field.get(obj);
} catch (NoSuchFieldException e) {
klass = klass.getSuperclass();
}
} while (klass != null);
throw new RuntimeException(); // true no such field exception
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"Object",
"getField",
"(",
"Object",
"obj",
",",
"String",
"name",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
"extends",
"Object",
">",
"klass",
"=",
"obj",
".",
"getClass",
"(",
")",
";",
"do",
"{",
"try",
"{",
"Field",
"field",
... | Gets a field from an object.
@param obj object from which to read the field
@param name the field name to read | [
"Gets",
"a",
"field",
"from",
"an",
"object",
"."
] | train | https://github.com/wealthfront/kawala/blob/acf24b7a9ef6e2f0fc1e862d44cfa4dcc4da8f6e/kawala-common/src/main/java/com/kaching/platform/common/reflect/ReflectUtils.java#L30-L50 |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java | DefaultErrorWebExceptionHandler.isIncludeStackTrace | protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) {
ErrorProperties.IncludeStacktrace include = this.errorProperties
.getIncludeStacktrace();
if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
return true;
}
if (include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM) {
return isTraceEnabled(request);
}
return false;
} | java | protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) {
ErrorProperties.IncludeStacktrace include = this.errorProperties
.getIncludeStacktrace();
if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
return true;
}
if (include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM) {
return isTraceEnabled(request);
}
return false;
} | [
"protected",
"boolean",
"isIncludeStackTrace",
"(",
"ServerRequest",
"request",
",",
"MediaType",
"produces",
")",
"{",
"ErrorProperties",
".",
"IncludeStacktrace",
"include",
"=",
"this",
".",
"errorProperties",
".",
"getIncludeStacktrace",
"(",
")",
";",
"if",
"("... | Determine if the stacktrace attribute should be included.
@param request the source request
@param produces the media type produced (or {@code MediaType.ALL})
@return if the stacktrace attribute should be included | [
"Determine",
"if",
"the",
"stacktrace",
"attribute",
"should",
"be",
"included",
"."
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java#L148-L158 |
jenkinsci/jenkins | core/src/main/java/hudson/util/TextFile.java | TextFile.fastTail | public @Nonnull String fastTail(int numChars, Charset cs) throws IOException {
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
long len = raf.length();
// err on the safe side and assume each char occupies 4 bytes
// additional 1024 byte margin is to bring us back in sync in case we started reading from non-char boundary.
long pos = Math.max(0, len - (numChars * 4 + 1024));
raf.seek(pos);
byte[] tail = new byte[(int) (len - pos)];
raf.readFully(tail);
String tails = cs.decode(java.nio.ByteBuffer.wrap(tail)).toString();
return new String(tails.substring(Math.max(0, tails.length() - numChars))); // trim the baggage of substring by allocating a new String
}
} | java | public @Nonnull String fastTail(int numChars, Charset cs) throws IOException {
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
long len = raf.length();
// err on the safe side and assume each char occupies 4 bytes
// additional 1024 byte margin is to bring us back in sync in case we started reading from non-char boundary.
long pos = Math.max(0, len - (numChars * 4 + 1024));
raf.seek(pos);
byte[] tail = new byte[(int) (len - pos)];
raf.readFully(tail);
String tails = cs.decode(java.nio.ByteBuffer.wrap(tail)).toString();
return new String(tails.substring(Math.max(0, tails.length() - numChars))); // trim the baggage of substring by allocating a new String
}
} | [
"public",
"@",
"Nonnull",
"String",
"fastTail",
"(",
"int",
"numChars",
",",
"Charset",
"cs",
")",
"throws",
"IOException",
"{",
"try",
"(",
"RandomAccessFile",
"raf",
"=",
"new",
"RandomAccessFile",
"(",
"file",
",",
"\"r\"",
")",
")",
"{",
"long",
"len",... | Efficiently reads the last N characters (or shorter, if the whole file is shorter than that.)
<p>
This method first tries to just read the tail section of the file to get the necessary chars.
To handle multi-byte variable length encoding (such as UTF-8), we read a larger than
necessary chunk.
<p>
Some multi-byte encoding, such as Shift-JIS (http://en.wikipedia.org/wiki/Shift_JIS) doesn't
allow the first byte and the second byte of a single char to be unambiguously identified,
so it is possible that we end up decoding incorrectly if we start reading in the middle of a multi-byte
character. All the CJK multi-byte encodings that I know of are self-correcting; as they are ASCII-compatible,
any ASCII characters or control characters will bring the decoding back in sync, so the worst
case we just have some garbage in the beginning that needs to be discarded. To accommodate this,
we read additional 1024 bytes.
<p>
Other encodings, such as UTF-8, are better in that the character boundary is unambiguous,
so there can be at most one garbage char. For dealing with UTF-16 and UTF-32, we read at
4 bytes boundary (all the constants and multipliers are multiples of 4.)
<p>
Note that it is possible to construct a contrived input that fools this algorithm, and in this method
we are willing to live with a small possibility of that to avoid reading the whole text. In practice,
such an input is very unlikely.
<p>
So all in all, this algorithm should work decently, and it works quite efficiently on a large text. | [
"Efficiently",
"reads",
"the",
"last",
"N",
"characters",
"(",
"or",
"shorter",
"if",
"the",
"whole",
"file",
"is",
"shorter",
"than",
"that",
".",
")"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/TextFile.java#L173-L189 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java | FirewallRulesInner.getAsync | public Observable<FirewallRuleInner> getAsync(String resourceGroupName, String accountName, String firewallRuleName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName).map(new Func1<ServiceResponse<FirewallRuleInner>, FirewallRuleInner>() {
@Override
public FirewallRuleInner call(ServiceResponse<FirewallRuleInner> response) {
return response.body();
}
});
} | java | public Observable<FirewallRuleInner> getAsync(String resourceGroupName, String accountName, String firewallRuleName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName).map(new Func1<ServiceResponse<FirewallRuleInner>, FirewallRuleInner>() {
@Override
public FirewallRuleInner call(ServiceResponse<FirewallRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FirewallRuleInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"firewallRuleName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
... | Gets the specified Data Lake Store firewall rule.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@param firewallRuleName The name of the firewall rule to retrieve.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FirewallRuleInner object | [
"Gets",
"the",
"specified",
"Data",
"Lake",
"Store",
"firewall",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java#L355-L362 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/types/Transform.java | Transform.scaleAboutPoint | public Transform scaleAboutPoint(final double scale, final double x, final double y)
{
translate(x, y);
scale(scale, scale);
translate(-x, -y);
return this;
} | java | public Transform scaleAboutPoint(final double scale, final double x, final double y)
{
translate(x, y);
scale(scale, scale);
translate(-x, -y);
return this;
} | [
"public",
"Transform",
"scaleAboutPoint",
"(",
"final",
"double",
"scale",
",",
"final",
"double",
"x",
",",
"final",
"double",
"y",
")",
"{",
"translate",
"(",
"x",
",",
"y",
")",
";",
"scale",
"(",
"scale",
",",
"scale",
")",
";",
"translate",
"(",
... | Concatenates this transform with a translation, a rotation and another translation transformation,
resulting in an scaling with respect to the specified point (x,y).
<p>
Equivalent to:
<pre>
translate(x, y);
scale(scale, scale);
translate(-x, -y);
</pre>
@param scale
@param x
@param y | [
"Concatenates",
"this",
"transform",
"with",
"a",
"translation",
"a",
"rotation",
"and",
"another",
"translation",
"transformation",
"resulting",
"in",
"an",
"scaling",
"with",
"respect",
"to",
"the",
"specified",
"point",
"(",
"x",
"y",
")",
".",
"<p",
">",
... | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/types/Transform.java#L324-L333 |
arnaudroger/SimpleFlatMapper | sfm-springjdbc/src/main/java/org/simpleflatmapper/jdbc/spring/JdbcTemplateCrud.java | JdbcTemplateCrud.read | public <RH extends CheckedConsumer<? super T>> RH read(final Collection<K> keys, final RH consumer) throws DataAccessException {
return
jdbcTemplate.execute(new ConnectionCallback<RH>() {
@Override
public RH doInConnection(Connection connection) throws SQLException, DataAccessException {
return crud.read(connection, keys, consumer);
}
});
} | java | public <RH extends CheckedConsumer<? super T>> RH read(final Collection<K> keys, final RH consumer) throws DataAccessException {
return
jdbcTemplate.execute(new ConnectionCallback<RH>() {
@Override
public RH doInConnection(Connection connection) throws SQLException, DataAccessException {
return crud.read(connection, keys, consumer);
}
});
} | [
"public",
"<",
"RH",
"extends",
"CheckedConsumer",
"<",
"?",
"super",
"T",
">",
">",
"RH",
"read",
"(",
"final",
"Collection",
"<",
"K",
">",
"keys",
",",
"final",
"RH",
"consumer",
")",
"throws",
"DataAccessException",
"{",
"return",
"jdbcTemplate",
".",
... | retrieve the objects with the specified keys and pass them to the consumer.
@param keys the keys
@param consumer the handler that is callback for each row
@throws DataAccessException if an error occurs | [
"retrieve",
"the",
"objects",
"with",
"the",
"specified",
"keys",
"and",
"pass",
"them",
"to",
"the",
"consumer",
"."
] | train | https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-springjdbc/src/main/java/org/simpleflatmapper/jdbc/spring/JdbcTemplateCrud.java#L121-L129 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java | AbstractValidate.validIndex | public <T> T[] validIndex(final T[] array, final int index) {
return validIndex(array, index, DEFAULT_VALID_INDEX_ARRAY_EX_MESSAGE, index);
} | java | public <T> T[] validIndex(final T[] array, final int index) {
return validIndex(array, index, DEFAULT_VALID_INDEX_ARRAY_EX_MESSAGE, index);
} | [
"public",
"<",
"T",
">",
"T",
"[",
"]",
"validIndex",
"(",
"final",
"T",
"[",
"]",
"array",
",",
"final",
"int",
"index",
")",
"{",
"return",
"validIndex",
"(",
"array",
",",
"index",
",",
"DEFAULT_VALID_INDEX_ARRAY_EX_MESSAGE",
",",
"index",
")",
";",
... | <p>Validates that the index is within the bounds of the argument array; otherwise throwing an exception.</p>
<pre>Validate.validIndex(myArray, 2);</pre>
<p>If the array is {@code null}, then the message of the exception is "The validated object is null".</p><p>If the index is invalid, then the message of the exception is "The
validated array index is invalid: " followed by the index.</p>
@param <T>
the array type
@param array
the array to check, validated not null by this method
@param index
the index to check
@return the validated array (never {@code null} for method chaining)
@throws NullPointerValidationException
if the array is {@code null}
@throws IndexOutOfBoundsException
if the index is invalid
@see #validIndex(Object[], int, String, Object...) | [
"<p",
">",
"Validates",
"that",
"the",
"index",
"is",
"within",
"the",
"bounds",
"of",
"the",
"argument",
"array",
";",
"otherwise",
"throwing",
"an",
"exception",
".",
"<",
"/",
"p",
">",
"<pre",
">",
"Validate",
".",
"validIndex",
"(",
"myArray",
"2",
... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L981-L983 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.deleteSynonym | public JSONObject deleteSynonym(String objectID, boolean forwardToReplicas) throws AlgoliaException {
return this.deleteSynonym(objectID, forwardToReplicas, RequestOptions.empty);
} | java | public JSONObject deleteSynonym(String objectID, boolean forwardToReplicas) throws AlgoliaException {
return this.deleteSynonym(objectID, forwardToReplicas, RequestOptions.empty);
} | [
"public",
"JSONObject",
"deleteSynonym",
"(",
"String",
"objectID",
",",
"boolean",
"forwardToReplicas",
")",
"throws",
"AlgoliaException",
"{",
"return",
"this",
".",
"deleteSynonym",
"(",
"objectID",
",",
"forwardToReplicas",
",",
"RequestOptions",
".",
"empty",
"... | Delete one synonym
@param objectID The objectId of the synonym to delete
@param forwardToReplicas Forward the operation to the replica indices | [
"Delete",
"one",
"synonym"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1487-L1489 |
VoltDB/voltdb | src/frontend/org/voltdb/planner/FilterMatcher.java | FilterMatcher.argsMatch | private static boolean argsMatch(AbstractExpression e1, AbstractExpression e2) {
final List<AbstractExpression> args1 = e1.getArgs(), args2 = e2.getArgs();
if (args1 == null || args2 == null) {
return args1 == args2;
} else {
return args1.size() == args2.size() &&
IntStream.range(0, args1.size())
.mapToObj(index -> (new FilterMatcher(args1.get(index), args2.get(index))).match())
.reduce(Boolean::logicalAnd).get();
}
} | java | private static boolean argsMatch(AbstractExpression e1, AbstractExpression e2) {
final List<AbstractExpression> args1 = e1.getArgs(), args2 = e2.getArgs();
if (args1 == null || args2 == null) {
return args1 == args2;
} else {
return args1.size() == args2.size() &&
IntStream.range(0, args1.size())
.mapToObj(index -> (new FilterMatcher(args1.get(index), args2.get(index))).match())
.reduce(Boolean::logicalAnd).get();
}
} | [
"private",
"static",
"boolean",
"argsMatch",
"(",
"AbstractExpression",
"e1",
",",
"AbstractExpression",
"e2",
")",
"{",
"final",
"List",
"<",
"AbstractExpression",
">",
"args1",
"=",
"e1",
".",
"getArgs",
"(",
")",
",",
"args2",
"=",
"e2",
".",
"getArgs",
... | Checks that args() of two expressions match.
@param e1 first expression
@param e2 second expression
@return whether their getArgs()'s results match | [
"Checks",
"that",
"args",
"()",
"of",
"two",
"expressions",
"match",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/FilterMatcher.java#L94-L104 |
glyptodon/guacamole-client | guacamole/src/main/java/org/apache/guacamole/extension/LanguageResourceService.java | LanguageResourceService.addLanguageResources | public void addLanguageResources(ServletContext context) {
// Get the paths of all the translation files
Set<?> resourcePaths = context.getResourcePaths(TRANSLATION_PATH);
// If no translation files found, nothing to add
if (resourcePaths == null)
return;
// Iterate through all the found language files and add them to the map
for (Object resourcePathObject : resourcePaths) {
// Each resource path is guaranteed to be a string
String resourcePath = (String) resourcePathObject;
// Parse language key from path
String languageKey = getLanguageKey(resourcePath);
if (languageKey == null) {
logger.warn("Invalid language file name: \"{}\"", resourcePath);
continue;
}
// Add/overlay new resource
addLanguageResource(
languageKey,
new WebApplicationResource(context, "application/json", resourcePath)
);
}
} | java | public void addLanguageResources(ServletContext context) {
// Get the paths of all the translation files
Set<?> resourcePaths = context.getResourcePaths(TRANSLATION_PATH);
// If no translation files found, nothing to add
if (resourcePaths == null)
return;
// Iterate through all the found language files and add them to the map
for (Object resourcePathObject : resourcePaths) {
// Each resource path is guaranteed to be a string
String resourcePath = (String) resourcePathObject;
// Parse language key from path
String languageKey = getLanguageKey(resourcePath);
if (languageKey == null) {
logger.warn("Invalid language file name: \"{}\"", resourcePath);
continue;
}
// Add/overlay new resource
addLanguageResource(
languageKey,
new WebApplicationResource(context, "application/json", resourcePath)
);
}
} | [
"public",
"void",
"addLanguageResources",
"(",
"ServletContext",
"context",
")",
"{",
"// Get the paths of all the translation files",
"Set",
"<",
"?",
">",
"resourcePaths",
"=",
"context",
".",
"getResourcePaths",
"(",
"TRANSLATION_PATH",
")",
";",
"// If no translation ... | Adds or overlays all languages defined within the /translations
directory of the given ServletContext. If no such language files exist,
nothing is done. If a language is already defined, the strings from the
will be overlaid on top of the existing strings, augmenting or
overriding the available strings for that language. The language key
for each language file is derived from the filename.
@param context
The ServletContext from which language files should be loaded. | [
"Adds",
"or",
"overlays",
"all",
"languages",
"defined",
"within",
"the",
"/",
"translations",
"directory",
"of",
"the",
"given",
"ServletContext",
".",
"If",
"no",
"such",
"language",
"files",
"exist",
"nothing",
"is",
"done",
".",
"If",
"a",
"language",
"i... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/extension/LanguageResourceService.java#L336-L366 |
alkacon/opencms-core | src/org/opencms/workplace/editors/CmsWorkplaceEditorConfiguration.java | CmsWorkplaceEditorConfiguration.logConfigurationError | private void logConfigurationError(String message, Throwable t) {
setValidConfiguration(false);
if (LOG.isErrorEnabled()) {
if (t == null) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_EDITOR_CONFIG_ERROR_1, message));
} else {
LOG.error(Messages.get().getBundle().key(Messages.LOG_EDITOR_CONFIG_ERROR_1, message), t);
}
}
} | java | private void logConfigurationError(String message, Throwable t) {
setValidConfiguration(false);
if (LOG.isErrorEnabled()) {
if (t == null) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_EDITOR_CONFIG_ERROR_1, message));
} else {
LOG.error(Messages.get().getBundle().key(Messages.LOG_EDITOR_CONFIG_ERROR_1, message), t);
}
}
} | [
"private",
"void",
"logConfigurationError",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"setValidConfiguration",
"(",
"false",
")",
";",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"if",
"(",
"t",
"==",
"null",
")",
"{",
... | Logs configuration errors and invalidates the current configuration.<p>
@param message the message specifying the configuration error
@param t the Throwable object or null | [
"Logs",
"configuration",
"errors",
"and",
"invalidates",
"the",
"current",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsWorkplaceEditorConfiguration.java#L450-L460 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/Widgets.java | Widgets.newImageButton | public static PushButton newImageButton (String style, ClickHandler onClick)
{
PushButton button = new PushButton();
maybeAddClickHandler(button, onClick);
return setStyleNames(button, style, "actionLabel");
} | java | public static PushButton newImageButton (String style, ClickHandler onClick)
{
PushButton button = new PushButton();
maybeAddClickHandler(button, onClick);
return setStyleNames(button, style, "actionLabel");
} | [
"public",
"static",
"PushButton",
"newImageButton",
"(",
"String",
"style",
",",
"ClickHandler",
"onClick",
")",
"{",
"PushButton",
"button",
"=",
"new",
"PushButton",
"(",
")",
";",
"maybeAddClickHandler",
"(",
"button",
",",
"onClick",
")",
";",
"return",
"s... | Creates an image button that changes appearance when you click and hover over it. | [
"Creates",
"an",
"image",
"button",
"that",
"changes",
"appearance",
"when",
"you",
"click",
"and",
"hover",
"over",
"it",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L417-L422 |
httl/httl | httl/src/main/java/httl/Engine.java | Engine.getProperty | public String getProperty(String key, String defaultValue) {
String value = getProperty(key, String.class);
return StringUtils.isEmpty(value) ? defaultValue : value;
} | java | public String getProperty(String key, String defaultValue) {
String value = getProperty(key, String.class);
return StringUtils.isEmpty(value) ? defaultValue : value;
} | [
"public",
"String",
"getProperty",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getProperty",
"(",
"key",
",",
"String",
".",
"class",
")",
";",
"return",
"StringUtils",
".",
"isEmpty",
"(",
"value",
")",
"?",
"... | Get config value.
@param key - config key
@param defaultValue - default value
@return config value
@see #getEngine() | [
"Get",
"config",
"value",
"."
] | train | https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/Engine.java#L194-L197 |
paypal/SeLion | dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/ReflectionUtils.java | ReflectionUtils.instantiatePrimitiveObject | public static Object instantiatePrimitiveObject(Class<?> type, Object objectToInvokeUpon, String valueToAssign) {
logger.entering(new Object[] { type, objectToInvokeUpon, valueToAssign });
validateParams(type, objectToInvokeUpon, valueToAssign);
checkArgument(type.isPrimitive(), type + " is NOT a primitive data type.");
try {
Object objectToReturn = getParserMethod(type).invoke(objectToInvokeUpon, valueToAssign);
logger.exiting(objectToInvokeUpon);
return objectToReturn;
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new ReflectionException(e);
}
} | java | public static Object instantiatePrimitiveObject(Class<?> type, Object objectToInvokeUpon, String valueToAssign) {
logger.entering(new Object[] { type, objectToInvokeUpon, valueToAssign });
validateParams(type, objectToInvokeUpon, valueToAssign);
checkArgument(type.isPrimitive(), type + " is NOT a primitive data type.");
try {
Object objectToReturn = getParserMethod(type).invoke(objectToInvokeUpon, valueToAssign);
logger.exiting(objectToInvokeUpon);
return objectToReturn;
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new ReflectionException(e);
}
} | [
"public",
"static",
"Object",
"instantiatePrimitiveObject",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Object",
"objectToInvokeUpon",
",",
"String",
"valueToAssign",
")",
"{",
"logger",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"type",
",",
"obje... | This helper method facilitates creation of primitive data type object and initialize it with the provided value.
@param type
The type to instantiate. It has to be only a primitive data type [ such as int, float, boolean
etc.,]
@param objectToInvokeUpon
The object upon which the invocation is to be carried out.
@param valueToAssign
The value to initialize with.
@return An initialized object that represents the primitive data type. | [
"This",
"helper",
"method",
"facilitates",
"creation",
"of",
"primitive",
"data",
"type",
"object",
"and",
"initialize",
"it",
"with",
"the",
"provided",
"value",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/ReflectionUtils.java#L194-L207 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/ModifyBeanHelper.java | ModifyBeanHelper.extractSQLForJavaDoc | private String extractSQLForJavaDoc(final SQLiteModelMethod method) {
final One<Boolean> usedInWhere = new One<>(false);
String sqlForJavaDoc = JQLChecker.getInstance().replace(method, method.jql, new JQLReplacerListenerImpl(method) {
@Override
public String onColumnNameToUpdate(String columnName) {
return currentEntity.findPropertyByName(columnName).columnName;
}
@Override
public String onColumnName(String columnName) {
return currentEntity.findPropertyByName(columnName).columnName;
}
@Override
public String onBindParameter(String bindParameterName, boolean inStatement) {
if (!usedInWhere.value0) {
if (bindParameterName.contains(".")) {
String[] a = bindParameterName.split("\\.");
if (a.length == 2) {
bindParameterName = a[1];
}
}
return ":" + bindParameterName;
} else {
return null;
}
}
@Override
public void onWhereStatementBegin(Where_stmtContext ctx) {
usedInWhere.value0 = true;
}
@Override
public void onWhereStatementEnd(Where_stmtContext ctx) {
usedInWhere.value0 = false;
};
});
return sqlForJavaDoc;
} | java | private String extractSQLForJavaDoc(final SQLiteModelMethod method) {
final One<Boolean> usedInWhere = new One<>(false);
String sqlForJavaDoc = JQLChecker.getInstance().replace(method, method.jql, new JQLReplacerListenerImpl(method) {
@Override
public String onColumnNameToUpdate(String columnName) {
return currentEntity.findPropertyByName(columnName).columnName;
}
@Override
public String onColumnName(String columnName) {
return currentEntity.findPropertyByName(columnName).columnName;
}
@Override
public String onBindParameter(String bindParameterName, boolean inStatement) {
if (!usedInWhere.value0) {
if (bindParameterName.contains(".")) {
String[] a = bindParameterName.split("\\.");
if (a.length == 2) {
bindParameterName = a[1];
}
}
return ":" + bindParameterName;
} else {
return null;
}
}
@Override
public void onWhereStatementBegin(Where_stmtContext ctx) {
usedInWhere.value0 = true;
}
@Override
public void onWhereStatementEnd(Where_stmtContext ctx) {
usedInWhere.value0 = false;
};
});
return sqlForJavaDoc;
} | [
"private",
"String",
"extractSQLForJavaDoc",
"(",
"final",
"SQLiteModelMethod",
"method",
")",
"{",
"final",
"One",
"<",
"Boolean",
">",
"usedInWhere",
"=",
"new",
"One",
"<>",
"(",
"false",
")",
";",
"String",
"sqlForJavaDoc",
"=",
"JQLChecker",
".",
"getInst... | Extract SQL for java doc.
@param method
the method
@return the string | [
"Extract",
"SQL",
"for",
"java",
"doc",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/ModifyBeanHelper.java#L416-L459 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/Program.java | Program.addInput | public <T extends Number> Variable addInput(String name, T from, T to, T step) {
return addInput(new Variable(name, from, to, step));
} | java | public <T extends Number> Variable addInput(String name, T from, T to, T step) {
return addInput(new Variable(name, from, to, step));
} | [
"public",
"<",
"T",
"extends",
"Number",
">",
"Variable",
"addInput",
"(",
"String",
"name",
",",
"T",
"from",
",",
"T",
"to",
",",
"T",
"step",
")",
"{",
"return",
"addInput",
"(",
"new",
"Variable",
"(",
"name",
",",
"from",
",",
"to",
",",
"step... | Add an input variable to this program.
<p>
@param <T> the type
@param name the variable name
@param from start of interval
@param to end of interval
@param step the step
@return the variable | [
"Add",
"an",
"input",
"variable",
"to",
"this",
"program",
".",
"<p",
">"
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/Program.java#L297-L299 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java | X500Name.generateRFC1779DN | private String generateRFC1779DN(Map<String, String> oidMap) {
if (names.length == 1) {
return names[0].toRFC1779String(oidMap);
}
StringBuilder sb = new StringBuilder(48);
if (names != null) {
for (int i = names.length - 1; i >= 0; i--) {
if (i != names.length - 1) {
sb.append(", ");
}
sb.append(names[i].toRFC1779String(oidMap));
}
}
return sb.toString();
} | java | private String generateRFC1779DN(Map<String, String> oidMap) {
if (names.length == 1) {
return names[0].toRFC1779String(oidMap);
}
StringBuilder sb = new StringBuilder(48);
if (names != null) {
for (int i = names.length - 1; i >= 0; i--) {
if (i != names.length - 1) {
sb.append(", ");
}
sb.append(names[i].toRFC1779String(oidMap));
}
}
return sb.toString();
} | [
"private",
"String",
"generateRFC1779DN",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"oidMap",
")",
"{",
"if",
"(",
"names",
".",
"length",
"==",
"1",
")",
"{",
"return",
"names",
"[",
"0",
"]",
".",
"toRFC1779String",
"(",
"oidMap",
")",
";",
"}... | /*
Dump the printable form of a distinguished name. Each relative
name is separated from the next by a ",", and assertions in the
relative names have "label=value" syntax.
Uses RFC 1779 syntax (i.e. little-endian, comma separators)
Valid keywords from RFC 1779 are used. Additional keywords can be
specified in the OID/keyword map. | [
"/",
"*",
"Dump",
"the",
"printable",
"form",
"of",
"a",
"distinguished",
"name",
".",
"Each",
"relative",
"name",
"is",
"separated",
"from",
"the",
"next",
"by",
"a",
"and",
"assertions",
"in",
"the",
"relative",
"names",
"have",
"label",
"=",
"value",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java#L1113-L1128 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java | KeyVaultCredentials.supportsMessageProtection | private Boolean supportsMessageProtection(String url, Map<String, String> challengeMap) {
if (!"true".equals(challengeMap.get("supportspop"))) {
return false;
}
// Message protection is enabled only for subset of keys operations.
if (!url.toLowerCase().contains("/keys/")) {
return false;
}
String[] tokens = url.split("\\?")[0].split("/");
return supportedMethods.contains(tokens[tokens.length - 1]);
} | java | private Boolean supportsMessageProtection(String url, Map<String, String> challengeMap) {
if (!"true".equals(challengeMap.get("supportspop"))) {
return false;
}
// Message protection is enabled only for subset of keys operations.
if (!url.toLowerCase().contains("/keys/")) {
return false;
}
String[] tokens = url.split("\\?")[0].split("/");
return supportedMethods.contains(tokens[tokens.length - 1]);
} | [
"private",
"Boolean",
"supportsMessageProtection",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"String",
">",
"challengeMap",
")",
"{",
"if",
"(",
"!",
"\"true\"",
".",
"equals",
"(",
"challengeMap",
".",
"get",
"(",
"\"supportspop\"",
")",
")",
... | Checks if resource supports message protection.
@param url
resource url.
@param challengeMap
the challenge map.
@return true if message protection is supported. | [
"Checks",
"if",
"resource",
"supports",
"message",
"protection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java#L186-L199 |
jbundle/jbundle | base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java | BaseHttpTask.doProcess | public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter out)
throws ServletException, IOException
{
// Override this
} | java | public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter out)
throws ServletException, IOException
{
// Override this
} | [
"public",
"void",
"doProcess",
"(",
"BasicServlet",
"servlet",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"PrintWriter",
"out",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"// Override this",
"}"
] | Process an HTML get or post.
@exception ServletException From inherited class.
@exception IOException From inherited class. | [
"Process",
"an",
"HTML",
"get",
"or",
"post",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L227-L231 |
RestComm/jain-slee.xcap | resources/xcap-client/api/src/main/java/org/restcomm/xcap/client/uri/encoding/UriComponentEncoder.java | UriComponentEncoder.encodePath | public static String encodePath(String path) throws NullPointerException {
return new String(encode(path, UriComponentEncoderBitSets.allowed_abs_path));
} | java | public static String encodePath(String path) throws NullPointerException {
return new String(encode(path, UriComponentEncoderBitSets.allowed_abs_path));
} | [
"public",
"static",
"String",
"encodePath",
"(",
"String",
"path",
")",
"throws",
"NullPointerException",
"{",
"return",
"new",
"String",
"(",
"encode",
"(",
"path",
",",
"UriComponentEncoderBitSets",
".",
"allowed_abs_path",
")",
")",
";",
"}"
] | Encodes an HTTP URI Path.
@param path
@return
@throws NullPointerException | [
"Encodes",
"an",
"HTTP",
"URI",
"Path",
"."
] | train | https://github.com/RestComm/jain-slee.xcap/blob/0caa9ab481a545e52c31401f19e99bdfbbfb7bf0/resources/xcap-client/api/src/main/java/org/restcomm/xcap/client/uri/encoding/UriComponentEncoder.java#L58-L60 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Chunk.java | Chunk.setUnderline | public Chunk setUnderline(float thickness, float yPosition) {
return setUnderline(null, thickness, 0f, yPosition, 0f,
PdfContentByte.LINE_CAP_BUTT);
} | java | public Chunk setUnderline(float thickness, float yPosition) {
return setUnderline(null, thickness, 0f, yPosition, 0f,
PdfContentByte.LINE_CAP_BUTT);
} | [
"public",
"Chunk",
"setUnderline",
"(",
"float",
"thickness",
",",
"float",
"yPosition",
")",
"{",
"return",
"setUnderline",
"(",
"null",
",",
"thickness",
",",
"0f",
",",
"yPosition",
",",
"0f",
",",
"PdfContentByte",
".",
"LINE_CAP_BUTT",
")",
";",
"}"
] | Sets an horizontal line that can be an underline or a strikethrough.
Actually, the line can be anywhere vertically and has always the <CODE>
Chunk</CODE> width. Multiple call to this method will produce multiple
lines.
@param thickness
the absolute thickness of the line
@param yPosition
the absolute y position relative to the baseline
@return this <CODE>Chunk</CODE> | [
"Sets",
"an",
"horizontal",
"line",
"that",
"can",
"be",
"an",
"underline",
"or",
"a",
"strikethrough",
".",
"Actually",
"the",
"line",
"can",
"be",
"anywhere",
"vertically",
"and",
"has",
"always",
"the",
"<CODE",
">",
"Chunk<",
"/",
"CODE",
">",
"width",... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Chunk.java#L497-L500 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/UserApi.java | UserApi.createUser | public User createUser(User user, CharSequence password, Integer projectsLimit) throws GitLabApiException {
Form formData = userToForm(user, projectsLimit, password, null, true);
Response response = post(Response.Status.CREATED, formData, "users");
return (response.readEntity(User.class));
} | java | public User createUser(User user, CharSequence password, Integer projectsLimit) throws GitLabApiException {
Form formData = userToForm(user, projectsLimit, password, null, true);
Response response = post(Response.Status.CREATED, formData, "users");
return (response.readEntity(User.class));
} | [
"public",
"User",
"createUser",
"(",
"User",
"user",
",",
"CharSequence",
"password",
",",
"Integer",
"projectsLimit",
")",
"throws",
"GitLabApiException",
"{",
"Form",
"formData",
"=",
"userToForm",
"(",
"user",
",",
"projectsLimit",
",",
"password",
",",
"null... | <p>Creates a new user. Note only administrators can create new users.
Either password or reset_password should be specified (reset_password takes priority).</p>
<p>If both the User object's projectsLimit and the parameter projectsLimit is specified
the parameter will take precedence.</p>
<pre><code>GitLab Endpoint: POST /users</code></pre>
<p>The following properties of the provided User instance can be set during creation:<pre><code> email (required) - Email
username (required) - Username
name (required) - Name
skype (optional) - Skype ID
linkedin (optional) - LinkedIn
twitter (optional) - Twitter account
websiteUrl (optional) - Website URL
organization (optional) - Organization name
projectsLimit (optional) - Number of projects user can create
externUid (optional) - External UID
provider (optional) - External provider name
bio (optional) - User's biography
location (optional) - User's location
admin (optional) - User is admin - true or false (default)
canCreateGroup (optional) - User can create groups - true or false
skipConfirmation (optional) - Skip confirmation - true or false (default)
external (optional) - Flags the user as external - true or false(default)
sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this user
</code></pre>
@param user the User instance with the user info to create
@param password the password for the new user
@param projectsLimit the maximum number of project
@return created User instance
@throws GitLabApiException if any exception occurs
@deprecated Will be removed in version 5.0, replaced by {@link #createUser(User, CharSequence, boolean)} | [
"<p",
">",
"Creates",
"a",
"new",
"user",
".",
"Note",
"only",
"administrators",
"can",
"create",
"new",
"users",
".",
"Either",
"password",
"or",
"reset_password",
"should",
"be",
"specified",
"(",
"reset_password",
"takes",
"priority",
")",
".",
"<",
"/",
... | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L418-L422 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/runtime/JbcSrcRuntime.java | JbcSrcRuntime.compareNullableString | public static boolean compareNullableString(@Nullable String string, SoyValue other) {
// This is a parallel version of SharedRuntime.compareString except it can handle a null LHS.
// This follows similarly to the Javascript specification, to ensure similar operation
// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
if (other instanceof StringData || other instanceof SanitizedContent) {
return Objects.equals(string, other.toString());
}
if (other instanceof NumberData) {
if (string == null) {
return false;
}
try {
// Parse the string as a number.
return Double.parseDouble(string) == other.numberValue();
} catch (NumberFormatException nfe) {
// Didn't parse as a number.
return false;
}
}
return false;
} | java | public static boolean compareNullableString(@Nullable String string, SoyValue other) {
// This is a parallel version of SharedRuntime.compareString except it can handle a null LHS.
// This follows similarly to the Javascript specification, to ensure similar operation
// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
if (other instanceof StringData || other instanceof SanitizedContent) {
return Objects.equals(string, other.toString());
}
if (other instanceof NumberData) {
if (string == null) {
return false;
}
try {
// Parse the string as a number.
return Double.parseDouble(string) == other.numberValue();
} catch (NumberFormatException nfe) {
// Didn't parse as a number.
return false;
}
}
return false;
} | [
"public",
"static",
"boolean",
"compareNullableString",
"(",
"@",
"Nullable",
"String",
"string",
",",
"SoyValue",
"other",
")",
"{",
"// This is a parallel version of SharedRuntime.compareString except it can handle a null LHS.",
"// This follows similarly to the Javascript specificat... | Determines if the operand's string form can be equality-compared with a string. | [
"Determines",
"if",
"the",
"operand",
"s",
"string",
"form",
"can",
"be",
"equality",
"-",
"compared",
"with",
"a",
"string",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/runtime/JbcSrcRuntime.java#L634-L656 |
VoltDB/voltdb | src/frontend/org/voltcore/zk/CoreZK.java | CoreZK.removeRejoinNodeIndicatorForHost | public static boolean removeRejoinNodeIndicatorForHost(ZooKeeper zk, int hostId)
{
try {
Stat stat = new Stat();
final int rejoiningHost = ByteBuffer.wrap(zk.getData(rejoin_node_blocker, false, stat)).getInt();
if (hostId == rejoiningHost) {
zk.delete(rejoin_node_blocker, stat.getVersion());
return true;
}
} catch (KeeperException e) {
if (e.code() == KeeperException.Code.NONODE ||
e.code() == KeeperException.Code.BADVERSION) {
// Okay if the rejoin blocker for the given hostId is already gone.
return true;
}
} catch (InterruptedException e) {
return false;
}
return false;
} | java | public static boolean removeRejoinNodeIndicatorForHost(ZooKeeper zk, int hostId)
{
try {
Stat stat = new Stat();
final int rejoiningHost = ByteBuffer.wrap(zk.getData(rejoin_node_blocker, false, stat)).getInt();
if (hostId == rejoiningHost) {
zk.delete(rejoin_node_blocker, stat.getVersion());
return true;
}
} catch (KeeperException e) {
if (e.code() == KeeperException.Code.NONODE ||
e.code() == KeeperException.Code.BADVERSION) {
// Okay if the rejoin blocker for the given hostId is already gone.
return true;
}
} catch (InterruptedException e) {
return false;
}
return false;
} | [
"public",
"static",
"boolean",
"removeRejoinNodeIndicatorForHost",
"(",
"ZooKeeper",
"zk",
",",
"int",
"hostId",
")",
"{",
"try",
"{",
"Stat",
"stat",
"=",
"new",
"Stat",
"(",
")",
";",
"final",
"int",
"rejoiningHost",
"=",
"ByteBuffer",
".",
"wrap",
"(",
... | Removes the rejoin blocker if the current rejoin blocker contains the given host ID.
@return true if the blocker is removed successfully, false otherwise. | [
"Removes",
"the",
"rejoin",
"blocker",
"if",
"the",
"current",
"rejoin",
"blocker",
"contains",
"the",
"given",
"host",
"ID",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/zk/CoreZK.java#L143-L162 |
JodaOrg/joda-money | src/main/java/org/joda/money/BigMoney.java | BigMoney.multiplyRetainScale | public BigMoney multiplyRetainScale(BigDecimal valueToMultiplyBy, RoundingMode roundingMode) {
MoneyUtils.checkNotNull(valueToMultiplyBy, "Multiplier must not be null");
MoneyUtils.checkNotNull(roundingMode, "RoundingMode must not be null");
if (valueToMultiplyBy.compareTo(BigDecimal.ONE) == 0) {
return this;
}
BigDecimal newAmount = amount.multiply(valueToMultiplyBy);
newAmount = newAmount.setScale(getScale(), roundingMode);
return BigMoney.of(currency, newAmount);
} | java | public BigMoney multiplyRetainScale(BigDecimal valueToMultiplyBy, RoundingMode roundingMode) {
MoneyUtils.checkNotNull(valueToMultiplyBy, "Multiplier must not be null");
MoneyUtils.checkNotNull(roundingMode, "RoundingMode must not be null");
if (valueToMultiplyBy.compareTo(BigDecimal.ONE) == 0) {
return this;
}
BigDecimal newAmount = amount.multiply(valueToMultiplyBy);
newAmount = newAmount.setScale(getScale(), roundingMode);
return BigMoney.of(currency, newAmount);
} | [
"public",
"BigMoney",
"multiplyRetainScale",
"(",
"BigDecimal",
"valueToMultiplyBy",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"MoneyUtils",
".",
"checkNotNull",
"(",
"valueToMultiplyBy",
",",
"\"Multiplier must not be null\"",
")",
";",
"MoneyUtils",
".",
"checkNotN... | Returns a copy of this monetary value multiplied by the specified value
using the specified rounding mode to adjust the scale of the result.
<p>
This multiplies this money by the specified value, retaining the scale of this money.
This will frequently lose precision, hence the need for a rounding mode.
For example, 'USD 1.13' multiplied by '2.5' and rounding down gives 'USD 2.82'.
<p>
This instance is immutable and unaffected by this method.
@param valueToMultiplyBy the scalar value to multiply by, not null
@param roundingMode the rounding mode to use to bring the decimal places back in line, not null
@return the new multiplied instance, never null
@throws ArithmeticException if the rounding fails | [
"Returns",
"a",
"copy",
"of",
"this",
"monetary",
"value",
"multiplied",
"by",
"the",
"specified",
"value",
"using",
"the",
"specified",
"rounding",
"mode",
"to",
"adjust",
"the",
"scale",
"of",
"the",
"result",
".",
"<p",
">",
"This",
"multiplies",
"this",
... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/BigMoney.java#L1319-L1328 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/DetectorsExtensionHelper.java | DetectorsExtensionHelper.resolvePluginClassesDir | @CheckForNull
private static String resolvePluginClassesDir(String bundleName, File sourceDir) {
if (sourceDir.listFiles() == null) {
FindbugsPlugin.getDefault().logException(new IllegalStateException("No files in the bundle!"),
"Failed to create temporary detector package for bundle " + sourceDir);
return null;
}
String outputDir = getBuildDirectory(bundleName, sourceDir);
if (outputDir.length() == 0) {
FindbugsPlugin.getDefault().logException(new IllegalStateException("No output directory in build.properties"),
"No output directory in build.properties " + sourceDir);
return null;
}
File classDir = new File(sourceDir, outputDir);
if (classDir.listFiles() == null) {
FindbugsPlugin.getDefault().logException(new IllegalStateException("No files in the bundle output dir!"),
"Failed to create temporary detector package for bundle " + sourceDir);
return null;
}
File etcDir = new File(sourceDir, "etc");
if (etcDir.listFiles() == null) {
FindbugsPlugin.getDefault().logException(new IllegalStateException("No files in the bundle etc dir!"),
"Failed to create temporary detector package for bundle " + sourceDir);
return null;
}
return classDir.getAbsolutePath();
} | java | @CheckForNull
private static String resolvePluginClassesDir(String bundleName, File sourceDir) {
if (sourceDir.listFiles() == null) {
FindbugsPlugin.getDefault().logException(new IllegalStateException("No files in the bundle!"),
"Failed to create temporary detector package for bundle " + sourceDir);
return null;
}
String outputDir = getBuildDirectory(bundleName, sourceDir);
if (outputDir.length() == 0) {
FindbugsPlugin.getDefault().logException(new IllegalStateException("No output directory in build.properties"),
"No output directory in build.properties " + sourceDir);
return null;
}
File classDir = new File(sourceDir, outputDir);
if (classDir.listFiles() == null) {
FindbugsPlugin.getDefault().logException(new IllegalStateException("No files in the bundle output dir!"),
"Failed to create temporary detector package for bundle " + sourceDir);
return null;
}
File etcDir = new File(sourceDir, "etc");
if (etcDir.listFiles() == null) {
FindbugsPlugin.getDefault().logException(new IllegalStateException("No files in the bundle etc dir!"),
"Failed to create temporary detector package for bundle " + sourceDir);
return null;
}
return classDir.getAbsolutePath();
} | [
"@",
"CheckForNull",
"private",
"static",
"String",
"resolvePluginClassesDir",
"(",
"String",
"bundleName",
",",
"File",
"sourceDir",
")",
"{",
"if",
"(",
"sourceDir",
".",
"listFiles",
"(",
")",
"==",
"null",
")",
"{",
"FindbugsPlugin",
".",
"getDefault",
"("... | Used for Eclipse instances running inside debugger. During development Eclipse plugins
are just directories. The code below tries to locate plugin's
"bin" directory. It doesn't work if the plugin build.properties are not
existing or contain invalid content | [
"Used",
"for",
"Eclipse",
"instances",
"running",
"inside",
"debugger",
".",
"During",
"development",
"Eclipse",
"plugins",
"are",
"just",
"directories",
".",
"The",
"code",
"below",
"tries",
"to",
"locate",
"plugin",
"s",
"bin",
"directory",
".",
"It",
"doesn... | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/DetectorsExtensionHelper.java#L154-L183 |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleIncomingResponseMessage | private void handleIncomingResponseMessage(SerialMessage incomingMessage) {
logger.debug("Message type = RESPONSE");
switch (incomingMessage.getMessageClass()) {
case GetVersion:
handleGetVersionResponse(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case MemoryGetId:
handleMemoryGetId(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case SerialApiGetInitData:
handleSerialApiGetInitDataResponse(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case IdentifyNode:
handleIdentifyNodeResponse(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case RequestNodeInfo:
handleRequestNodeInfoResponse(incomingMessage);
break;
case SerialApiGetCapabilities:
handleSerialAPIGetCapabilitiesResponse(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case SendData:
handleSendDataResponse(incomingMessage);
break;
default:
logger.warn(String.format("TODO: Implement processing of Response Message = %s (0x%02X)",
incomingMessage.getMessageClass().getLabel(),
incomingMessage.getMessageClass().getKey()));
break;
}
} | java | private void handleIncomingResponseMessage(SerialMessage incomingMessage) {
logger.debug("Message type = RESPONSE");
switch (incomingMessage.getMessageClass()) {
case GetVersion:
handleGetVersionResponse(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case MemoryGetId:
handleMemoryGetId(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case SerialApiGetInitData:
handleSerialApiGetInitDataResponse(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case IdentifyNode:
handleIdentifyNodeResponse(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case RequestNodeInfo:
handleRequestNodeInfoResponse(incomingMessage);
break;
case SerialApiGetCapabilities:
handleSerialAPIGetCapabilitiesResponse(incomingMessage);
if (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {
notifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));
transactionCompleted.release();
logger.trace("Released. Transaction completed permit count -> {}", transactionCompleted.availablePermits());
}
break;
case SendData:
handleSendDataResponse(incomingMessage);
break;
default:
logger.warn(String.format("TODO: Implement processing of Response Message = %s (0x%02X)",
incomingMessage.getMessageClass().getLabel(),
incomingMessage.getMessageClass().getKey()));
break;
}
} | [
"private",
"void",
"handleIncomingResponseMessage",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Message type = RESPONSE\"",
")",
";",
"switch",
"(",
"incomingMessage",
".",
"getMessageClass",
"(",
")",
")",
"{",
"case",
"GetVer... | Handles an incoming response message.
An incoming response message is a response, based one of our own requests.
@param incomingMessage the response message to process. | [
"Handles",
"an",
"incoming",
"response",
"message",
".",
"An",
"incoming",
"response",
"message",
"is",
"a",
"response",
"based",
"one",
"of",
"our",
"own",
"requests",
"."
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L419-L474 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/ByteBufferConfiguration.java | ByteBufferConfiguration.updateBufferManager | private void updateBufferManager(Map<String, Object> properties) {
if (properties.isEmpty()) {
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Ignoring runtime changes to WSBB config; " + properties);
}
// TODO: should be able to flip leak detection on or off
} | java | private void updateBufferManager(Map<String, Object> properties) {
if (properties.isEmpty()) {
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Ignoring runtime changes to WSBB config; " + properties);
}
// TODO: should be able to flip leak detection on or off
} | [
"private",
"void",
"updateBufferManager",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"properties",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
... | This is used to provide the runtime configuration changes to an
existing pool manager, which is a small subset of the possible
creation properties.
@param properties | [
"This",
"is",
"used",
"to",
"provide",
"the",
"runtime",
"configuration",
"changes",
"to",
"an",
"existing",
"pool",
"manager",
"which",
"is",
"a",
"small",
"subset",
"of",
"the",
"possible",
"creation",
"properties",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/ByteBufferConfiguration.java#L175-L183 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java | AtomCache.getStructureForDomain | public Structure getStructureForDomain(String scopId, ScopDatabase scopDatabase) throws IOException,
StructureException {
ScopDomain domain = scopDatabase.getDomainByScopID(scopId);
return getStructureForDomain(domain, scopDatabase);
} | java | public Structure getStructureForDomain(String scopId, ScopDatabase scopDatabase) throws IOException,
StructureException {
ScopDomain domain = scopDatabase.getDomainByScopID(scopId);
return getStructureForDomain(domain, scopDatabase);
} | [
"public",
"Structure",
"getStructureForDomain",
"(",
"String",
"scopId",
",",
"ScopDatabase",
"scopDatabase",
")",
"throws",
"IOException",
",",
"StructureException",
"{",
"ScopDomain",
"domain",
"=",
"scopDatabase",
".",
"getDomainByScopID",
"(",
"scopId",
")",
";",
... | Returns the representation of a {@link ScopDomain} as a BioJava {@link Structure} object.
@param scopId
a SCOP Id
@param scopDatabase
A {@link ScopDatabase} to use
@return a Structure object
@throws IOException
@throws StructureException | [
"Returns",
"the",
"representation",
"of",
"a",
"{",
"@link",
"ScopDomain",
"}",
"as",
"a",
"BioJava",
"{",
"@link",
"Structure",
"}",
"object",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java#L659-L663 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/MapperFactory.java | MapperFactory.setDefaultMapper | public void setDefaultMapper(Type type, Mapper mapper) {
if (mapper == null) {
throw new IllegalArgumentException("mapper cannot be null");
}
lock.lock();
try {
cache.put(type, mapper);
} finally {
lock.unlock();
}
} | java | public void setDefaultMapper(Type type, Mapper mapper) {
if (mapper == null) {
throw new IllegalArgumentException("mapper cannot be null");
}
lock.lock();
try {
cache.put(type, mapper);
} finally {
lock.unlock();
}
} | [
"public",
"void",
"setDefaultMapper",
"(",
"Type",
"type",
",",
"Mapper",
"mapper",
")",
"{",
"if",
"(",
"mapper",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"mapper cannot be null\"",
")",
";",
"}",
"lock",
".",
"lock",
"(",
... | Sets or registers the given mapper for the given type. This method must be called before
performing any persistence operations, preferably, during application startup. Entities that
were introspected before calling this method will NOT use the new mapper.
@param type
the type
@param mapper
the mapper to use for the given type | [
"Sets",
"or",
"registers",
"the",
"given",
"mapper",
"for",
"the",
"given",
"type",
".",
"This",
"method",
"must",
"be",
"called",
"before",
"performing",
"any",
"persistence",
"operations",
"preferably",
"during",
"application",
"startup",
".",
"Entities",
"tha... | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/MapperFactory.java#L160-L170 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/FlushManager.java | FlushManager.buildFlushStack | public void buildFlushStack(Node headNode, EventType eventType)
{
if (headNode != null)
{
headNode.setTraversed(false);
addNodesToFlushStack(headNode, eventType);
}
} | java | public void buildFlushStack(Node headNode, EventType eventType)
{
if (headNode != null)
{
headNode.setTraversed(false);
addNodesToFlushStack(headNode, eventType);
}
} | [
"public",
"void",
"buildFlushStack",
"(",
"Node",
"headNode",
",",
"EventType",
"eventType",
")",
"{",
"if",
"(",
"headNode",
"!=",
"null",
")",
"{",
"headNode",
".",
"setTraversed",
"(",
"false",
")",
";",
"addNodesToFlushStack",
"(",
"headNode",
",",
"even... | Builds the flush stack.
@param headNode
the head node
@param eventType
the event type | [
"Builds",
"the",
"flush",
"stack",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/FlushManager.java#L125-L132 |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/java2sec/PermissionManager.java | PermissionManager.getCombinedPermissions | @Override
public PermissionCollection getCombinedPermissions(PermissionCollection staticPolicyPermissionCollection, CodeSource codesource) {
Permissions effectivePermissions = new Permissions();
List<Permission> staticPolicyPermissions = Collections.list(staticPolicyPermissionCollection.elements());
String codeBase = codesource.getLocation().getPath(); // TODO: This should be using the CodeSource itself to compare with existing code sources
ArrayList<Permission> permissions = getEffectivePermissions(staticPolicyPermissions, codeBase);
for (Permission permission : permissions) {
effectivePermissions.add(permission);
}
return effectivePermissions;
} | java | @Override
public PermissionCollection getCombinedPermissions(PermissionCollection staticPolicyPermissionCollection, CodeSource codesource) {
Permissions effectivePermissions = new Permissions();
List<Permission> staticPolicyPermissions = Collections.list(staticPolicyPermissionCollection.elements());
String codeBase = codesource.getLocation().getPath(); // TODO: This should be using the CodeSource itself to compare with existing code sources
ArrayList<Permission> permissions = getEffectivePermissions(staticPolicyPermissions, codeBase);
for (Permission permission : permissions) {
effectivePermissions.add(permission);
}
return effectivePermissions;
} | [
"@",
"Override",
"public",
"PermissionCollection",
"getCombinedPermissions",
"(",
"PermissionCollection",
"staticPolicyPermissionCollection",
",",
"CodeSource",
"codesource",
")",
"{",
"Permissions",
"effectivePermissions",
"=",
"new",
"Permissions",
"(",
")",
";",
"List",
... | Combine the static permissions with the server.xml and permissions.xml permissions, removing any restricted permission.
This is called back from the dynamic policy to obtain the permissions for the JSP classes. | [
"Combine",
"the",
"static",
"permissions",
"with",
"the",
"server",
".",
"xml",
"and",
"permissions",
".",
"xml",
"permissions",
"removing",
"any",
"restricted",
"permission",
".",
"This",
"is",
"called",
"back",
"from",
"the",
"dynamic",
"policy",
"to",
"obta... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/java2sec/PermissionManager.java#L573-L585 |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/ReflectionHelper.java | ReflectionHelper.getMethod | Method getMethod(Class<?> type, Class<?> returnType, String name, Class<?>... parameters) {
Method method = null;
try {
// first try for public methods
method = type.getMethod(name, parameters);
if (null != returnType && !returnType.isAssignableFrom(method.getReturnType())) {
method = null;
}
} catch (NoSuchMethodException nsme) {
// ignore
log.trace(nsme.getMessage(), nsme);
}
if (null == method) {
method = getNonPublicMethod(type, returnType, name, parameters);
}
return method;
} | java | Method getMethod(Class<?> type, Class<?> returnType, String name, Class<?>... parameters) {
Method method = null;
try {
// first try for public methods
method = type.getMethod(name, parameters);
if (null != returnType && !returnType.isAssignableFrom(method.getReturnType())) {
method = null;
}
} catch (NoSuchMethodException nsme) {
// ignore
log.trace(nsme.getMessage(), nsme);
}
if (null == method) {
method = getNonPublicMethod(type, returnType, name, parameters);
}
return method;
} | [
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Class",
"<",
"?",
">",
"returnType",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"...",
"parameters",
")",
"{",
"Method",
"method",
"=",
"null",
";",
"try",
"{",
"// first try ... | Get method with given name and parameters and given return type.
@param type class on which method should be found
@param returnType required return type (or null for void or no check)
@param name method name
@param parameters method parameter types
@return method or null when method not found | [
"Get",
"method",
"with",
"given",
"name",
"and",
"parameters",
"and",
"given",
"return",
"type",
"."
] | train | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/ReflectionHelper.java#L178-L194 |
Netflix/spectator | spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java | HttpLogEntry.logClientRequest | @Deprecated
public static void logClientRequest(Logger logger, HttpLogEntry entry) {
log(logger, CLIENT, entry);
} | java | @Deprecated
public static void logClientRequest(Logger logger, HttpLogEntry entry) {
log(logger, CLIENT, entry);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"logClientRequest",
"(",
"Logger",
"logger",
",",
"HttpLogEntry",
"entry",
")",
"{",
"log",
"(",
"logger",
",",
"CLIENT",
",",
"entry",
")",
";",
"}"
] | Log a client request.
@deprecated Use {@link #logClientRequest(HttpLogEntry)} instead. | [
"Log",
"a",
"client",
"request",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L111-L114 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java | BuildState.flattenArtifacts | public void flattenArtifacts(Map<String,Module> m) {
modules = m;
// Extract all the found packages.
for (Module i : modules.values()) {
for (Map.Entry<String,Package> j : i.packages().entrySet()) {
Package p = packages.get(j.getKey());
// Check that no two different packages are stored under same name.
Assert.check(p == null || p == j.getValue());
p = j.getValue();
packages.put(j.getKey(),j.getValue());
for (Map.Entry<String,File> g : p.artifacts().entrySet()) {
File f = artifacts.get(g.getKey());
// Check that no two artifacts are stored under the same file.
Assert.check(f == null || f == g.getValue());
artifacts.put(g.getKey(), g.getValue());
}
}
}
} | java | public void flattenArtifacts(Map<String,Module> m) {
modules = m;
// Extract all the found packages.
for (Module i : modules.values()) {
for (Map.Entry<String,Package> j : i.packages().entrySet()) {
Package p = packages.get(j.getKey());
// Check that no two different packages are stored under same name.
Assert.check(p == null || p == j.getValue());
p = j.getValue();
packages.put(j.getKey(),j.getValue());
for (Map.Entry<String,File> g : p.artifacts().entrySet()) {
File f = artifacts.get(g.getKey());
// Check that no two artifacts are stored under the same file.
Assert.check(f == null || f == g.getValue());
artifacts.put(g.getKey(), g.getValue());
}
}
}
} | [
"public",
"void",
"flattenArtifacts",
"(",
"Map",
"<",
"String",
",",
"Module",
">",
"m",
")",
"{",
"modules",
"=",
"m",
";",
"// Extract all the found packages.",
"for",
"(",
"Module",
"i",
":",
"modules",
".",
"values",
"(",
")",
")",
"{",
"for",
"(",
... | Store references to all artifacts found in the module tree into the maps
stored in the build state.
@param m The set of modules. | [
"Store",
"references",
"to",
"all",
"artifacts",
"found",
"in",
"the",
"module",
"tree",
"into",
"the",
"maps",
"stored",
"in",
"the",
"build",
"state",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java#L133-L151 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ClassUtils.java | ClassUtils.getClass | @GwtIncompatible("incompatible method")
public static Class<?> getClass(final ClassLoader classLoader, final String className) throws ClassNotFoundException {
return getClass(classLoader, className, true);
} | java | @GwtIncompatible("incompatible method")
public static Class<?> getClass(final ClassLoader classLoader, final String className) throws ClassNotFoundException {
return getClass(classLoader, className, true);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"Class",
"<",
"?",
">",
"getClass",
"(",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"String",
"className",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"getClass",
... | Returns the (initialized) class represented by {@code className}
using the {@code classLoader}. This implementation supports
the syntaxes "{@code java.util.Map.Entry[]}",
"{@code java.util.Map$Entry[]}", "{@code [Ljava.util.Map.Entry;}",
and "{@code [Ljava.util.Map$Entry;}".
@param classLoader the class loader to use to load the class
@param className the class name
@return the class represented by {@code className} using the {@code classLoader}
@throws ClassNotFoundException if the class is not found | [
"Returns",
"the",
"(",
"initialized",
")",
"class",
"represented",
"by",
"{",
"@code",
"className",
"}",
"using",
"the",
"{",
"@code",
"classLoader",
"}",
".",
"This",
"implementation",
"supports",
"the",
"syntaxes",
"{",
"@code",
"java",
".",
"util",
".",
... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L1037-L1040 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java | CategoryGraph.serializeMap | private void serializeMap(Map<?,?> map, File file) {
try(ObjectOutputStream os = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)))){
os.writeObject(map);
} catch (Exception e) {
logger.error(e.getLocalizedMessage(), e);
}
} | java | private void serializeMap(Map<?,?> map, File file) {
try(ObjectOutputStream os = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)))){
os.writeObject(map);
} catch (Exception e) {
logger.error(e.getLocalizedMessage(), e);
}
} | [
"private",
"void",
"serializeMap",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"File",
"file",
")",
"{",
"try",
"(",
"ObjectOutputStream",
"os",
"=",
"new",
"ObjectOutputStream",
"(",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
... | Serialize a Map.
@param map The map to serialize.
@param file The file for saving the map. | [
"Serialize",
"a",
"Map",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java#L1644-L1650 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java | JQLBuilder.checkFieldsDefinitions | private static void checkFieldsDefinitions(SQLiteModelMethod method, Class<? extends Annotation> annotation) {
List<String> includedFields = AnnotationUtility.extractAsStringArray(method.getElement(), annotation, AnnotationAttributeType.FIELDS);
List<String> excludedFields = AnnotationUtility.extractAsStringArray(method.getElement(), annotation, AnnotationAttributeType.EXCLUDED_FIELDS);
// both elements can not be defined
if (includedFields.size() > 0 && excludedFields.size() > 0) {
throw (new IncompatibleAttributesInAnnotationException(method.getParent(), method, method.getAnnotation(annotation), AnnotationAttributeType.FIELDS,
AnnotationAttributeType.EXCLUDED_FIELDS));
}
} | java | private static void checkFieldsDefinitions(SQLiteModelMethod method, Class<? extends Annotation> annotation) {
List<String> includedFields = AnnotationUtility.extractAsStringArray(method.getElement(), annotation, AnnotationAttributeType.FIELDS);
List<String> excludedFields = AnnotationUtility.extractAsStringArray(method.getElement(), annotation, AnnotationAttributeType.EXCLUDED_FIELDS);
// both elements can not be defined
if (includedFields.size() > 0 && excludedFields.size() > 0) {
throw (new IncompatibleAttributesInAnnotationException(method.getParent(), method, method.getAnnotation(annotation), AnnotationAttributeType.FIELDS,
AnnotationAttributeType.EXCLUDED_FIELDS));
}
} | [
"private",
"static",
"void",
"checkFieldsDefinitions",
"(",
"SQLiteModelMethod",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"List",
"<",
"String",
">",
"includedFields",
"=",
"AnnotationUtility",
".",
"extractAsStringArra... | Check fields definitions.
@param method
the method
@param annotation
the annotation | [
"Check",
"fields",
"definitions",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java#L196-L205 |
openbase/jul | communication/controller/src/main/java/org/openbase/jul/communication/controller/RPCHelper.java | RPCHelper.registerInterface | public static <I, T extends I> void registerInterface(final Class<I> interfaceClass, final T instance, final RSBLocalServer server) throws CouldNotPerformException {
for (final Method method : interfaceClass.getMethods()) {
if (method.getAnnotation(RPCMethod.class) != null) {
boolean legacy = false;
try {
legacy = JPService.getProperty(JPRSBLegacyMode.class).getValue();
} catch (JPNotAvailableException e) {
// if not available just register legacy methods
}
// if legacy register always, else only register if not marked as legacy
if (legacy || !method.getAnnotation(RPCMethod.class).legacy()) {
registerMethod(method, instance, server);
}
}
}
} | java | public static <I, T extends I> void registerInterface(final Class<I> interfaceClass, final T instance, final RSBLocalServer server) throws CouldNotPerformException {
for (final Method method : interfaceClass.getMethods()) {
if (method.getAnnotation(RPCMethod.class) != null) {
boolean legacy = false;
try {
legacy = JPService.getProperty(JPRSBLegacyMode.class).getValue();
} catch (JPNotAvailableException e) {
// if not available just register legacy methods
}
// if legacy register always, else only register if not marked as legacy
if (legacy || !method.getAnnotation(RPCMethod.class).legacy()) {
registerMethod(method, instance, server);
}
}
}
} | [
"public",
"static",
"<",
"I",
",",
"T",
"extends",
"I",
">",
"void",
"registerInterface",
"(",
"final",
"Class",
"<",
"I",
">",
"interfaceClass",
",",
"final",
"T",
"instance",
",",
"final",
"RSBLocalServer",
"server",
")",
"throws",
"CouldNotPerformException"... | public static SyncObject syncObject = new SyncObject("MapSync"); | [
"public",
"static",
"SyncObject",
"syncObject",
"=",
"new",
"SyncObject",
"(",
"MapSync",
")",
";"
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/RPCHelper.java#L65-L80 |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/scoping/extensions/numbers/comparison/ShortComparisonExtensions.java | ShortComparisonExtensions.operator_spaceship | @Pure
@Inline(value = "$3.compare($1.shortValue(), $2)", constantExpression = true, imported = Short.class)
public static int operator_spaceship(Short left, byte right) {
return Short.compare(left.shortValue(), right);
} | java | @Pure
@Inline(value = "$3.compare($1.shortValue(), $2)", constantExpression = true, imported = Short.class)
public static int operator_spaceship(Short left, byte right) {
return Short.compare(left.shortValue(), right);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"$3.compare($1.shortValue(), $2)\"",
",",
"constantExpression",
"=",
"true",
",",
"imported",
"=",
"Short",
".",
"class",
")",
"public",
"static",
"int",
"operator_spaceship",
"(",
"Short",
"left",
",",
"byte",
... | The number comparison operator. This is equivalent to the Java
{@code compareTo} function on numbers. This function is null-safe.
@param left a number
@param right a number.
@return the value {@code 0} if {@code left == right};
a value less than {@code 0} if {@code left < right}; and
a value greater than {@code 0} if {@code left > right}. | [
"The",
"number",
"comparison",
"operator",
".",
"This",
"is",
"equivalent",
"to",
"the",
"Java",
"{",
"@code",
"compareTo",
"}",
"function",
"on",
"numbers",
".",
"This",
"function",
"is",
"null",
"-",
"safe",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/scoping/extensions/numbers/comparison/ShortComparisonExtensions.java#L615-L619 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java | DiscreteFourierTransformOps.checkImageArguments | public static void checkImageArguments( ImageBase image , ImageInterleaved transform ) {
InputSanityCheck.checkSameShape(image,transform);
if( 2 != transform.getNumBands() )
throw new IllegalArgumentException("The transform must have two bands");
} | java | public static void checkImageArguments( ImageBase image , ImageInterleaved transform ) {
InputSanityCheck.checkSameShape(image,transform);
if( 2 != transform.getNumBands() )
throw new IllegalArgumentException("The transform must have two bands");
} | [
"public",
"static",
"void",
"checkImageArguments",
"(",
"ImageBase",
"image",
",",
"ImageInterleaved",
"transform",
")",
"{",
"InputSanityCheck",
".",
"checkSameShape",
"(",
"image",
",",
"transform",
")",
";",
"if",
"(",
"2",
"!=",
"transform",
".",
"getNumBand... | Checks to see if the image and its transform are appropriate sizes . The transform should have
twice the width and twice the height as the image.
@param image Storage for an image
@param transform Storage for a Fourier Transform | [
"Checks",
"to",
"see",
"if",
"the",
"image",
"and",
"its",
"transform",
"are",
"appropriate",
"sizes",
".",
"The",
"transform",
"should",
"have",
"twice",
"the",
"width",
"and",
"twice",
"the",
"height",
"as",
"the",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java#L98-L102 |
bazaarvoice/emodb | mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/EmoFileSystem.java | EmoFileSystem.create | @Override
public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress)
throws IOException {
throw new IOException("Create not supported for EmoFileSystem: " + f);
} | java | @Override
public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress)
throws IOException {
throw new IOException("Create not supported for EmoFileSystem: " + f);
} | [
"@",
"Override",
"public",
"FSDataOutputStream",
"create",
"(",
"Path",
"f",
",",
"FsPermission",
"permission",
",",
"boolean",
"overwrite",
",",
"int",
"bufferSize",
",",
"short",
"replication",
",",
"long",
"blockSize",
",",
"Progressable",
"progress",
")",
"t... | All remaining FileSystem operations are not supported and will throw exceptions. | [
"All",
"remaining",
"FileSystem",
"operations",
"are",
"not",
"supported",
"and",
"will",
"throw",
"exceptions",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/EmoFileSystem.java#L483-L487 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.parseFiat | public Fiat parseFiat(String currencyCode, String str) throws NumberFormatException {
return Fiat.valueOf(currencyCode, parseValue(str, Fiat.SMALLEST_UNIT_EXPONENT));
} | java | public Fiat parseFiat(String currencyCode, String str) throws NumberFormatException {
return Fiat.valueOf(currencyCode, parseValue(str, Fiat.SMALLEST_UNIT_EXPONENT));
} | [
"public",
"Fiat",
"parseFiat",
"(",
"String",
"currencyCode",
",",
"String",
"str",
")",
"throws",
"NumberFormatException",
"{",
"return",
"Fiat",
".",
"valueOf",
"(",
"currencyCode",
",",
"parseValue",
"(",
"str",
",",
"Fiat",
".",
"SMALLEST_UNIT_EXPONENT",
")"... | Parse a human readable fiat value to a {@link Fiat} instance.
@throws NumberFormatException
if the string cannot be parsed for some reason | [
"Parse",
"a",
"human",
"readable",
"fiat",
"value",
"to",
"a",
"{",
"@link",
"Fiat",
"}",
"instance",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L422-L424 |
galenframework/galen | galen-core/src/main/java/com/galenframework/utils/GalenUtils.java | GalenUtils.resizeScreenshotIfNeeded | public static BufferedImage resizeScreenshotIfNeeded(WebDriver driver, BufferedImage screenshotImage) {
Double devicePixelRatio = 1.0;
try {
devicePixelRatio = ((Number) ((JavascriptExecutor) driver).executeScript(JS_RETRIEVE_DEVICE_PIXEL_RATIO)).doubleValue();
} catch (Exception ex) {
ex.printStackTrace();
}
if (devicePixelRatio > 1.0 && screenshotImage.getWidth() > 0) {
Long screenSize = ((Number) ((JavascriptExecutor) driver).executeScript("return Math.max(" +
"document.body.scrollWidth, document.documentElement.scrollWidth," +
"document.body.offsetWidth, document.documentElement.offsetWidth," +
"document.body.clientWidth, document.documentElement.clientWidth);"
)).longValue();
Double estimatedPixelRatio = ((double)screenshotImage.getWidth()) / ((double)screenSize);
if (estimatedPixelRatio > 1.0) {
int newWidth = (int) (screenshotImage.getWidth() / estimatedPixelRatio);
int newHeight = (int) (screenshotImage.getHeight() / estimatedPixelRatio);
Image tmp = screenshotImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH);
BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = scaledImage.createGraphics();
g2d.drawImage(tmp, 0, 0, null);
g2d.dispose();
return scaledImage;
}
else return screenshotImage;
}
else return screenshotImage;
} | java | public static BufferedImage resizeScreenshotIfNeeded(WebDriver driver, BufferedImage screenshotImage) {
Double devicePixelRatio = 1.0;
try {
devicePixelRatio = ((Number) ((JavascriptExecutor) driver).executeScript(JS_RETRIEVE_DEVICE_PIXEL_RATIO)).doubleValue();
} catch (Exception ex) {
ex.printStackTrace();
}
if (devicePixelRatio > 1.0 && screenshotImage.getWidth() > 0) {
Long screenSize = ((Number) ((JavascriptExecutor) driver).executeScript("return Math.max(" +
"document.body.scrollWidth, document.documentElement.scrollWidth," +
"document.body.offsetWidth, document.documentElement.offsetWidth," +
"document.body.clientWidth, document.documentElement.clientWidth);"
)).longValue();
Double estimatedPixelRatio = ((double)screenshotImage.getWidth()) / ((double)screenSize);
if (estimatedPixelRatio > 1.0) {
int newWidth = (int) (screenshotImage.getWidth() / estimatedPixelRatio);
int newHeight = (int) (screenshotImage.getHeight() / estimatedPixelRatio);
Image tmp = screenshotImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH);
BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = scaledImage.createGraphics();
g2d.drawImage(tmp, 0, 0, null);
g2d.dispose();
return scaledImage;
}
else return screenshotImage;
}
else return screenshotImage;
} | [
"public",
"static",
"BufferedImage",
"resizeScreenshotIfNeeded",
"(",
"WebDriver",
"driver",
",",
"BufferedImage",
"screenshotImage",
")",
"{",
"Double",
"devicePixelRatio",
"=",
"1.0",
";",
"try",
"{",
"devicePixelRatio",
"=",
"(",
"(",
"Number",
")",
"(",
"(",
... | Check the devicePixelRatio and adapts the size of the screenshot as if the ratio was 1.0
@param driver
@param screenshotImage
@return | [
"Check",
"the",
"devicePixelRatio",
"and",
"adapts",
"the",
"size",
"of",
"the",
"screenshot",
"as",
"if",
"the",
"ratio",
"was",
"1",
".",
"0"
] | train | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/utils/GalenUtils.java#L187-L222 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_csp2_options_GET | public ArrayList<OvhGenericOptionDefinition> cart_cartId_csp2_options_GET(String cartId, String planCode) throws IOException {
String qPath = "/order/cart/{cartId}/csp2/options";
StringBuilder sb = path(qPath, cartId);
query(sb, "planCode", planCode);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<OvhGenericOptionDefinition> cart_cartId_csp2_options_GET(String cartId, String planCode) throws IOException {
String qPath = "/order/cart/{cartId}/csp2/options";
StringBuilder sb = path(qPath, cartId);
query(sb, "planCode", planCode);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"OvhGenericOptionDefinition",
">",
"cart_cartId_csp2_options_GET",
"(",
"String",
"cartId",
",",
"String",
"planCode",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/csp2/options\"",
";",
"StringBuilder",
"sb... | Get informations about SaaS CSP2 options
REST: GET /order/cart/{cartId}/csp2/options
@param cartId [required] Cart identifier
@param planCode [required] Identifier of a SaaS CSP2 main offer | [
"Get",
"informations",
"about",
"SaaS",
"CSP2",
"options"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L10293-L10299 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java | BingImagesImpl.detailsWithServiceResponseAsync | public Observable<ServiceResponse<ImageInsights>> detailsWithServiceResponseAsync(String query, DetailsOptionalParameter detailsOptionalParameter) {
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
final String acceptLanguage = detailsOptionalParameter != null ? detailsOptionalParameter.acceptLanguage() : null;
final String contentType = detailsOptionalParameter != null ? detailsOptionalParameter.contentType() : null;
final String userAgent = detailsOptionalParameter != null ? detailsOptionalParameter.userAgent() : this.client.userAgent();
final String clientId = detailsOptionalParameter != null ? detailsOptionalParameter.clientId() : null;
final String clientIp = detailsOptionalParameter != null ? detailsOptionalParameter.clientIp() : null;
final String location = detailsOptionalParameter != null ? detailsOptionalParameter.location() : null;
final Double cropBottom = detailsOptionalParameter != null ? detailsOptionalParameter.cropBottom() : null;
final Double cropLeft = detailsOptionalParameter != null ? detailsOptionalParameter.cropLeft() : null;
final Double cropRight = detailsOptionalParameter != null ? detailsOptionalParameter.cropRight() : null;
final Double cropTop = detailsOptionalParameter != null ? detailsOptionalParameter.cropTop() : null;
final ImageCropType cropType = detailsOptionalParameter != null ? detailsOptionalParameter.cropType() : null;
final String countryCode = detailsOptionalParameter != null ? detailsOptionalParameter.countryCode() : null;
final String id = detailsOptionalParameter != null ? detailsOptionalParameter.id() : null;
final String imageUrl = detailsOptionalParameter != null ? detailsOptionalParameter.imageUrl() : null;
final String insightsToken = detailsOptionalParameter != null ? detailsOptionalParameter.insightsToken() : null;
final List<ImageInsightModule> modules = detailsOptionalParameter != null ? detailsOptionalParameter.modules() : null;
final String market = detailsOptionalParameter != null ? detailsOptionalParameter.market() : null;
final SafeSearch safeSearch = detailsOptionalParameter != null ? detailsOptionalParameter.safeSearch() : null;
final String setLang = detailsOptionalParameter != null ? detailsOptionalParameter.setLang() : null;
return detailsWithServiceResponseAsync(query, acceptLanguage, contentType, userAgent, clientId, clientIp, location, cropBottom, cropLeft, cropRight, cropTop, cropType, countryCode, id, imageUrl, insightsToken, modules, market, safeSearch, setLang);
} | java | public Observable<ServiceResponse<ImageInsights>> detailsWithServiceResponseAsync(String query, DetailsOptionalParameter detailsOptionalParameter) {
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
final String acceptLanguage = detailsOptionalParameter != null ? detailsOptionalParameter.acceptLanguage() : null;
final String contentType = detailsOptionalParameter != null ? detailsOptionalParameter.contentType() : null;
final String userAgent = detailsOptionalParameter != null ? detailsOptionalParameter.userAgent() : this.client.userAgent();
final String clientId = detailsOptionalParameter != null ? detailsOptionalParameter.clientId() : null;
final String clientIp = detailsOptionalParameter != null ? detailsOptionalParameter.clientIp() : null;
final String location = detailsOptionalParameter != null ? detailsOptionalParameter.location() : null;
final Double cropBottom = detailsOptionalParameter != null ? detailsOptionalParameter.cropBottom() : null;
final Double cropLeft = detailsOptionalParameter != null ? detailsOptionalParameter.cropLeft() : null;
final Double cropRight = detailsOptionalParameter != null ? detailsOptionalParameter.cropRight() : null;
final Double cropTop = detailsOptionalParameter != null ? detailsOptionalParameter.cropTop() : null;
final ImageCropType cropType = detailsOptionalParameter != null ? detailsOptionalParameter.cropType() : null;
final String countryCode = detailsOptionalParameter != null ? detailsOptionalParameter.countryCode() : null;
final String id = detailsOptionalParameter != null ? detailsOptionalParameter.id() : null;
final String imageUrl = detailsOptionalParameter != null ? detailsOptionalParameter.imageUrl() : null;
final String insightsToken = detailsOptionalParameter != null ? detailsOptionalParameter.insightsToken() : null;
final List<ImageInsightModule> modules = detailsOptionalParameter != null ? detailsOptionalParameter.modules() : null;
final String market = detailsOptionalParameter != null ? detailsOptionalParameter.market() : null;
final SafeSearch safeSearch = detailsOptionalParameter != null ? detailsOptionalParameter.safeSearch() : null;
final String setLang = detailsOptionalParameter != null ? detailsOptionalParameter.setLang() : null;
return detailsWithServiceResponseAsync(query, acceptLanguage, contentType, userAgent, clientId, clientIp, location, cropBottom, cropLeft, cropRight, cropTop, cropType, countryCode, id, imageUrl, insightsToken, modules, market, safeSearch, setLang);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"ImageInsights",
">",
">",
"detailsWithServiceResponseAsync",
"(",
"String",
"query",
",",
"DetailsOptionalParameter",
"detailsOptionalParameter",
")",
"{",
"if",
"(",
"query",
"==",
"null",
")",
"{",
"throw",
"ne... | The Image Detail Search API lets you search on Bing and get back insights about an image, such as webpages that include the image. This section provides technical details about the query parameters and headers that you use to request insights of images and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
@param query The user's search query term. The term cannot be empty. The term may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit images to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help improve relevance of an insights query (see [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)), you should always include the user's query term. Use this parameter only with the Image Search API.Do not specify this parameter when calling the Trending Images API.
@param detailsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageInsights object | [
"The",
"Image",
"Detail",
"Search",
"API",
"lets",
"you",
"search",
"on",
"Bing",
"and",
"get",
"back",
"insights",
"about",
"an",
"image",
"such",
"as",
"webpages",
"that",
"include",
"the",
"image",
".",
"This",
"section",
"provides",
"technical",
"details... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java#L519-L544 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/writable/WritableFactory.java | WritableFactory.registerWritableType | public void registerWritableType(short writableTypeKey, @NonNull Class<? extends Writable> writableClass) {
if (map.containsKey(writableTypeKey)) {
throw new UnsupportedOperationException("Key " + writableTypeKey + " is already registered to type "
+ map.get(writableTypeKey) + " and cannot be registered to " + writableClass);
}
Constructor<? extends Writable> c;
try {
c = writableClass.getDeclaredConstructor();
} catch (NoSuchMethodException e) {
throw new RuntimeException("Cannot find no-arg constructor for class " + writableClass);
}
map.put(writableTypeKey, writableClass);
constructorMap.put(writableTypeKey, c);
} | java | public void registerWritableType(short writableTypeKey, @NonNull Class<? extends Writable> writableClass) {
if (map.containsKey(writableTypeKey)) {
throw new UnsupportedOperationException("Key " + writableTypeKey + " is already registered to type "
+ map.get(writableTypeKey) + " and cannot be registered to " + writableClass);
}
Constructor<? extends Writable> c;
try {
c = writableClass.getDeclaredConstructor();
} catch (NoSuchMethodException e) {
throw new RuntimeException("Cannot find no-arg constructor for class " + writableClass);
}
map.put(writableTypeKey, writableClass);
constructorMap.put(writableTypeKey, c);
} | [
"public",
"void",
"registerWritableType",
"(",
"short",
"writableTypeKey",
",",
"@",
"NonNull",
"Class",
"<",
"?",
"extends",
"Writable",
">",
"writableClass",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"writableTypeKey",
")",
")",
"{",
"throw",
"n... | Register a writable class with a specific key (as a short). Note that key values must be unique for each type of
Writable, as they are used as type information in certain types of serialisation. Consequently, an exception will
be thrown If the key value is not unique or is already assigned.<br>
Note that in general, this method needs to only be used for custom Writable types; Care should be taken to ensure
that the given key does not change once assigned.
@param writableTypeKey Key for the Writable
@param writableClass Class for the given key. Must have a no-arg constructor | [
"Register",
"a",
"writable",
"class",
"with",
"a",
"specific",
"key",
"(",
"as",
"a",
"short",
")",
".",
"Note",
"that",
"key",
"values",
"must",
"be",
"unique",
"for",
"each",
"type",
"of",
"Writable",
"as",
"they",
"are",
"used",
"as",
"type",
"infor... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/writable/WritableFactory.java#L65-L80 |
mangstadt/biweekly | src/main/java/biweekly/io/chain/ChainingJsonWriter.java | ChainingJsonWriter.go | public void go(File file) throws IOException {
JCalWriter writer = new JCalWriter(file, wrapInArray());
try {
go(writer);
} finally {
writer.close();
}
} | java | public void go(File file) throws IOException {
JCalWriter writer = new JCalWriter(file, wrapInArray());
try {
go(writer);
} finally {
writer.close();
}
} | [
"public",
"void",
"go",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"JCalWriter",
"writer",
"=",
"new",
"JCalWriter",
"(",
"file",
",",
"wrapInArray",
"(",
")",
")",
";",
"try",
"{",
"go",
"(",
"writer",
")",
";",
"}",
"finally",
"{",
"wr... | Writes the iCalendar objects to a file.
@param file the file to write to
@throws IOException if there's a problem writing to the file | [
"Writes",
"the",
"iCalendar",
"objects",
"to",
"a",
"file",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/chain/ChainingJsonWriter.java#L115-L122 |
Netflix/denominator | cli/src/main/java/denominator/cli/Denominator.java | Denominator.logModule | static Object logModule(boolean quiet, boolean verbose) {
checkArgument(!(quiet && verbose), "quiet and verbose flags cannot be used at the same time!");
Logger.Level logLevel;
if (quiet) {
return null;
} else if (verbose) {
logLevel = Logger.Level.FULL;
} else {
logLevel = Logger.Level.BASIC;
}
return new LogModule(logLevel);
} | java | static Object logModule(boolean quiet, boolean verbose) {
checkArgument(!(quiet && verbose), "quiet and verbose flags cannot be used at the same time!");
Logger.Level logLevel;
if (quiet) {
return null;
} else if (verbose) {
logLevel = Logger.Level.FULL;
} else {
logLevel = Logger.Level.BASIC;
}
return new LogModule(logLevel);
} | [
"static",
"Object",
"logModule",
"(",
"boolean",
"quiet",
",",
"boolean",
"verbose",
")",
"{",
"checkArgument",
"(",
"!",
"(",
"quiet",
"&&",
"verbose",
")",
",",
"\"quiet and verbose flags cannot be used at the same time!\"",
")",
";",
"Logger",
".",
"Level",
"lo... | Returns a log configuration module or null if none is needed. | [
"Returns",
"a",
"log",
"configuration",
"module",
"or",
"null",
"if",
"none",
"is",
"needed",
"."
] | train | https://github.com/Netflix/denominator/blob/c565e3b8c6043051252e0947029511f9ac5d306f/cli/src/main/java/denominator/cli/Denominator.java#L179-L190 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.analyzeImageByDomain | public DomainModelResults analyzeImageByDomain(String model, String url, AnalyzeImageByDomainOptionalParameter analyzeImageByDomainOptionalParameter) {
return analyzeImageByDomainWithServiceResponseAsync(model, url, analyzeImageByDomainOptionalParameter).toBlocking().single().body();
} | java | public DomainModelResults analyzeImageByDomain(String model, String url, AnalyzeImageByDomainOptionalParameter analyzeImageByDomainOptionalParameter) {
return analyzeImageByDomainWithServiceResponseAsync(model, url, analyzeImageByDomainOptionalParameter).toBlocking().single().body();
} | [
"public",
"DomainModelResults",
"analyzeImageByDomain",
"(",
"String",
"model",
",",
"String",
"url",
",",
"AnalyzeImageByDomainOptionalParameter",
"analyzeImageByDomainOptionalParameter",
")",
"{",
"return",
"analyzeImageByDomainWithServiceResponseAsync",
"(",
"model",
",",
"u... | This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API only provides a single domain-specific model: celebrities. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
@param model The domain-specific content to recognize.
@param url Publicly reachable URL of an image
@param analyzeImageByDomainOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ComputerVisionErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DomainModelResults object if successful. | [
"This",
"operation",
"recognizes",
"content",
"within",
"an",
"image",
"by",
"applying",
"a",
"domain",
"-",
"specific",
"model",
".",
"The",
"list",
"of",
"domain",
"-",
"specific",
"models",
"that",
"are",
"supported",
"by",
"the",
"Computer",
"Vision",
"A... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1414-L1416 |
mytechia/mytechia_commons | mytechia-commons-modelaction/src/main/java/com/mytechia/commons/framework/modelaction/action/async/AsyncActionPool.java | AsyncActionPool.addAction | public void addAction(ModelAction action, ModelActionListener listener)
{
synchronized(actionQueue) {
this.actionQueue.add(new ModelActionEntry(action, listener));
}
wakeUp();
} | java | public void addAction(ModelAction action, ModelActionListener listener)
{
synchronized(actionQueue) {
this.actionQueue.add(new ModelActionEntry(action, listener));
}
wakeUp();
} | [
"public",
"void",
"addAction",
"(",
"ModelAction",
"action",
",",
"ModelActionListener",
"listener",
")",
"{",
"synchronized",
"(",
"actionQueue",
")",
"{",
"this",
".",
"actionQueue",
".",
"add",
"(",
"new",
"ModelActionEntry",
"(",
"action",
",",
"listener",
... | Adds an action to the processing queue
@param action the action to execute
@param listener an optional listener object to be notified of the action end state | [
"Adds",
"an",
"action",
"to",
"the",
"processing",
"queue"
] | train | https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia-commons-modelaction/src/main/java/com/mytechia/commons/framework/modelaction/action/async/AsyncActionPool.java#L95-L104 |
OWASP/java-html-sanitizer | src/main/java/org/owasp/html/FilterUrlByProtocolAttributePolicy.java | FilterUrlByProtocolAttributePolicy.normalizeUri | static String normalizeUri(String s) {
int n = s.length();
boolean colonsIrrelevant = false;
for (int i = 0; i < n; ++i) {
char ch = s.charAt(i);
switch (ch) {
case '/': case '#': case '?': case ':':
colonsIrrelevant = true;
break;
case '(': case ')':
case '{': case '}':
return normalizeUriFrom(s, i, colonsIrrelevant);
case '\u0589':
case '\u05c3':
case '\u2236':
case '\uff1a':
if (!colonsIrrelevant) {
return normalizeUriFrom(s, i, false);
}
break;
default:
if (ch <= 0x20) {
return normalizeUriFrom(s, i, false);
}
break;
}
}
return s;
} | java | static String normalizeUri(String s) {
int n = s.length();
boolean colonsIrrelevant = false;
for (int i = 0; i < n; ++i) {
char ch = s.charAt(i);
switch (ch) {
case '/': case '#': case '?': case ':':
colonsIrrelevant = true;
break;
case '(': case ')':
case '{': case '}':
return normalizeUriFrom(s, i, colonsIrrelevant);
case '\u0589':
case '\u05c3':
case '\u2236':
case '\uff1a':
if (!colonsIrrelevant) {
return normalizeUriFrom(s, i, false);
}
break;
default:
if (ch <= 0x20) {
return normalizeUriFrom(s, i, false);
}
break;
}
}
return s;
} | [
"static",
"String",
"normalizeUri",
"(",
"String",
"s",
")",
"{",
"int",
"n",
"=",
"s",
".",
"length",
"(",
")",
";",
"boolean",
"colonsIrrelevant",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"++",
"i",
")",
"... | Percent encodes anything that looks like a colon, or a parenthesis. | [
"Percent",
"encodes",
"anything",
"that",
"looks",
"like",
"a",
"colon",
"or",
"a",
"parenthesis",
"."
] | train | https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/FilterUrlByProtocolAttributePolicy.java#L97-L125 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java | ContainerServicesInner.getByResourceGroupAsync | public Observable<ContainerServiceInner> getByResourceGroupAsync(String resourceGroupName, String containerServiceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, containerServiceName).map(new Func1<ServiceResponse<ContainerServiceInner>, ContainerServiceInner>() {
@Override
public ContainerServiceInner call(ServiceResponse<ContainerServiceInner> response) {
return response.body();
}
});
} | java | public Observable<ContainerServiceInner> getByResourceGroupAsync(String resourceGroupName, String containerServiceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, containerServiceName).map(new Func1<ServiceResponse<ContainerServiceInner>, ContainerServiceInner>() {
@Override
public ContainerServiceInner call(ServiceResponse<ContainerServiceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ContainerServiceInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerServiceName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerServiceNam... | Gets the properties of the specified container service.
Gets the properties of the specified container service in the specified subscription and resource group. The operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters and agents.
@param resourceGroupName The name of the resource group.
@param containerServiceName The name of the container service in the specified subscription and resource group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ContainerServiceInner object | [
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"container",
"service",
".",
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"container",
"service",
"in",
"the",
"specified",
"subscription",
"and",
"resource",
"group",
".",
"The",
"operation",
"ret... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java#L434-L441 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.optionalEnd | public DateTimeFormatterBuilder optionalEnd() {
if (active.parent == null) {
throw new IllegalStateException("Cannot call optionalEnd() as there was no previous call to optionalStart()");
}
if (active.printerParsers.size() > 0) {
CompositePrinterParser cpp = new CompositePrinterParser(active.printerParsers, active.optional);
active = active.parent;
appendInternal(cpp);
} else {
active = active.parent;
}
return this;
} | java | public DateTimeFormatterBuilder optionalEnd() {
if (active.parent == null) {
throw new IllegalStateException("Cannot call optionalEnd() as there was no previous call to optionalStart()");
}
if (active.printerParsers.size() > 0) {
CompositePrinterParser cpp = new CompositePrinterParser(active.printerParsers, active.optional);
active = active.parent;
appendInternal(cpp);
} else {
active = active.parent;
}
return this;
} | [
"public",
"DateTimeFormatterBuilder",
"optionalEnd",
"(",
")",
"{",
"if",
"(",
"active",
".",
"parent",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot call optionalEnd() as there was no previous call to optionalStart()\"",
")",
";",
"}",
... | Ends an optional section.
<p>
The output of printing can include optional sections, which may be nested.
An optional section is started by calling {@link #optionalStart()} and ended
using this method (or at the end of the builder).
<p>
Calling this method without having previously called {@code optionalStart}
will throw an exception.
Calling this method immediately after calling {@code optionalStart} has no effect
on the formatter other than ending the (empty) optional section.
<p>
All elements in the optional section are treated as optional.
During printing, the section is only output if data is available in the
{@code TemporalAccessor} for all the elements in the section.
During parsing, the whole section may be missing from the parsed string.
<p>
For example, consider a builder setup as
{@code builder.appendValue(HOUR_OF_DAY,2).optionalStart().appendValue(MINUTE_OF_HOUR,2).optionalEnd()}.
During printing, the minute will only be output if its value can be obtained from the date-time.
During parsing, the input will be successfully parsed whether the minute is present or not.
@return this, for chaining, not null
@throws IllegalStateException if there was no previous call to {@code optionalStart} | [
"Ends",
"an",
"optional",
"section",
".",
"<p",
">",
"The",
"output",
"of",
"printing",
"can",
"include",
"optional",
"sections",
"which",
"may",
"be",
"nested",
".",
"An",
"optional",
"section",
"is",
"started",
"by",
"calling",
"{",
"@link",
"#optionalStar... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L1813-L1825 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyDomainAxiomImpl_CustomFieldSerializer.java | OWLObjectPropertyDomainAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectPropertyDomainAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectPropertyDomainAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLObjectPropertyDomainAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyDomainAxiomImpl_CustomFieldSerializer.java#L76-L79 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java | ProcessGroovyMethods.consumeProcessOutputStream | public static Thread consumeProcessOutputStream(Process self, OutputStream output) {
Thread thread = new Thread(new ByteDumper(self.getInputStream(), output));
thread.start();
return thread;
} | java | public static Thread consumeProcessOutputStream(Process self, OutputStream output) {
Thread thread = new Thread(new ByteDumper(self.getInputStream(), output));
thread.start();
return thread;
} | [
"public",
"static",
"Thread",
"consumeProcessOutputStream",
"(",
"Process",
"self",
",",
"OutputStream",
"output",
")",
"{",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"new",
"ByteDumper",
"(",
"self",
".",
"getInputStream",
"(",
")",
",",
"output",
")",
... | Gets the output stream from a process and reads it
to keep the process from blocking due to a full output buffer.
The processed stream data is appended to the supplied OutputStream.
A new Thread is started, so this method will return immediately.
@param self a Process
@param output an OutputStream to capture the process stdout
@return the Thread
@since 1.5.2 | [
"Gets",
"the",
"output",
"stream",
"from",
"a",
"process",
"and",
"reads",
"it",
"to",
"keep",
"the",
"process",
"from",
"blocking",
"due",
"to",
"a",
"full",
"output",
"buffer",
".",
"The",
"processed",
"stream",
"data",
"is",
"appended",
"to",
"the",
"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L334-L338 |
samskivert/samskivert | src/main/java/com/samskivert/util/RandomUtil.java | RandomUtil.getWeightedIndex | public static int getWeightedIndex (float[] weights, Random r)
{
float sum = 0.0f;
for (float weight : weights) {
if (weight < 0.0f) {
return -1;
}
sum += weight;
}
if (sum <= 0.0) {
return -1;
}
float pick = getFloat(sum, r);
for (int ii = 0, nn = weights.length; ii < nn; ii++) {
pick -= weights[ii];
if (pick < 0.0) {
return ii;
}
}
log.warning("getWeightedIndex failed", new Throwable()); // Impossible!
return 0;
} | java | public static int getWeightedIndex (float[] weights, Random r)
{
float sum = 0.0f;
for (float weight : weights) {
if (weight < 0.0f) {
return -1;
}
sum += weight;
}
if (sum <= 0.0) {
return -1;
}
float pick = getFloat(sum, r);
for (int ii = 0, nn = weights.length; ii < nn; ii++) {
pick -= weights[ii];
if (pick < 0.0) {
return ii;
}
}
log.warning("getWeightedIndex failed", new Throwable()); // Impossible!
return 0;
} | [
"public",
"static",
"int",
"getWeightedIndex",
"(",
"float",
"[",
"]",
"weights",
",",
"Random",
"r",
")",
"{",
"float",
"sum",
"=",
"0.0f",
";",
"for",
"(",
"float",
"weight",
":",
"weights",
")",
"{",
"if",
"(",
"weight",
"<",
"0.0f",
")",
"{",
"... | Pick a random index from the array, weighted by the value of the corresponding array
element.
@param weights an array of non-negative floats.
@return an index into the array, or -1 if the sum of the weights is less than or equal to
0.0 or any individual element is negative. For example, passing in {0.2, 0.0, 0.6, 0.8}
will return:
<pre>{@code
0 - 1/8th of the time
1 - never
2 - 3/8th of the time
3 - half of the time
}</pre> | [
"Pick",
"a",
"random",
"index",
"from",
"the",
"array",
"weighted",
"by",
"the",
"value",
"of",
"the",
"corresponding",
"array",
"element",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/RandomUtil.java#L252-L275 |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisRepository.java | CmsCmisRepository.createPermission | private static PermissionDefinition createPermission(String permission, String description) {
PermissionDefinitionDataImpl pd = new PermissionDefinitionDataImpl();
pd.setId(permission);
pd.setDescription(description);
return pd;
} | java | private static PermissionDefinition createPermission(String permission, String description) {
PermissionDefinitionDataImpl pd = new PermissionDefinitionDataImpl();
pd.setId(permission);
pd.setDescription(description);
return pd;
} | [
"private",
"static",
"PermissionDefinition",
"createPermission",
"(",
"String",
"permission",
",",
"String",
"description",
")",
"{",
"PermissionDefinitionDataImpl",
"pd",
"=",
"new",
"PermissionDefinitionDataImpl",
"(",
")",
";",
"pd",
".",
"setId",
"(",
"permission"... | Creates a permission definition.<p>
@param permission the permission name
@param description the permission description
@return the new permission definition | [
"Creates",
"a",
"permission",
"definition",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisRepository.java#L245-L252 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/AssetRendition.java | AssetRendition.toDimension | private static @Nullable Dimension toDimension(long width, long height) {
if (width > 0L && height > 0L) {
return new Dimension(width, height);
}
return null;
} | java | private static @Nullable Dimension toDimension(long width, long height) {
if (width > 0L && height > 0L) {
return new Dimension(width, height);
}
return null;
} | [
"private",
"static",
"@",
"Nullable",
"Dimension",
"toDimension",
"(",
"long",
"width",
",",
"long",
"height",
")",
"{",
"if",
"(",
"width",
">",
"0L",
"&&",
"height",
">",
"0L",
")",
"{",
"return",
"new",
"Dimension",
"(",
"width",
",",
"height",
")",... | Convert with/height to dimension
@param width Width
@param height Height
@return Dimension or null if width or height are not valid | [
"Convert",
"with",
"/",
"height",
"to",
"dimension"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/AssetRendition.java#L209-L214 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/element/MergedVertex.java | MergedVertex.applyMatrix | public void applyMatrix()
{
transformMatrix.translate(new Vector3f(-0.5F, -0.5F, -0.5F));
for (Vertex v : vertexes)
v.applyMatrix(transformMatrix);
resetMatrix();
return;
} | java | public void applyMatrix()
{
transformMatrix.translate(new Vector3f(-0.5F, -0.5F, -0.5F));
for (Vertex v : vertexes)
v.applyMatrix(transformMatrix);
resetMatrix();
return;
} | [
"public",
"void",
"applyMatrix",
"(",
")",
"{",
"transformMatrix",
".",
"translate",
"(",
"new",
"Vector3f",
"(",
"-",
"0.5F",
",",
"-",
"0.5F",
",",
"-",
"0.5F",
")",
")",
";",
"for",
"(",
"Vertex",
"v",
":",
"vertexes",
")",
"v",
".",
"applyMatrix"... | Applies the transformations matrices to this {@link MergedVertex}. This modifies the position of the vertexes. | [
"Applies",
"the",
"transformations",
"matrices",
"to",
"this",
"{"
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/element/MergedVertex.java#L215-L225 |
saxsys/SynchronizeFX | transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SychronizeFXWebsocketServer.java | SychronizeFXWebsocketServer.onMessage | public void onMessage(final byte[] message, final Session session) {
final SynchronizeFXWebsocketChannel channel = getChannelOrFail(session);
channel.newMessage(message, session);
} | java | public void onMessage(final byte[] message, final Session session) {
final SynchronizeFXWebsocketChannel channel = getChannelOrFail(session);
channel.newMessage(message, session);
} | [
"public",
"void",
"onMessage",
"(",
"final",
"byte",
"[",
"]",
"message",
",",
"final",
"Session",
"session",
")",
"{",
"final",
"SynchronizeFXWebsocketChannel",
"channel",
"=",
"getChannelOrFail",
"(",
"session",
")",
";",
"channel",
".",
"newMessage",
"(",
"... | Pass {@link OnMessage} events of the Websocket API to this method to handle incoming commands of other peers.
@param message The message that was received.
@param session The client that has send the message | [
"Pass",
"{",
"@link",
"OnMessage",
"}",
"events",
"of",
"the",
"Websocket",
"API",
"to",
"this",
"method",
"to",
"handle",
"incoming",
"commands",
"of",
"other",
"peers",
"."
] | train | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SychronizeFXWebsocketServer.java#L187-L191 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java | Configurer.getStringDefault | public final String getStringDefault(String defaultValue, String attribute, String... path)
{
return getNodeStringDefault(defaultValue, attribute, path);
} | java | public final String getStringDefault(String defaultValue, String attribute, String... path)
{
return getNodeStringDefault(defaultValue, attribute, path);
} | [
"public",
"final",
"String",
"getStringDefault",
"(",
"String",
"defaultValue",
",",
"String",
"attribute",
",",
"String",
"...",
"path",
")",
"{",
"return",
"getNodeStringDefault",
"(",
"defaultValue",
",",
"attribute",
",",
"path",
")",
";",
"}"
] | Get a string in the xml tree.
@param defaultValue Value used if node does not exist.
@param attribute The attribute to get as string.
@param path The node path (child list)
@return The string value.
@throws LionEngineException If unable to read node. | [
"Get",
"a",
"string",
"in",
"the",
"xml",
"tree",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L172-L175 |
samskivert/samskivert | src/main/java/com/samskivert/velocity/FormTool.java | FormTool.textarea | public String textarea (String name, String extra, Object defaultValue)
{
return fixedTextarea(name, extra, getValue(name, defaultValue));
} | java | public String textarea (String name, String extra, Object defaultValue)
{
return fixedTextarea(name, extra, getValue(name, defaultValue));
} | [
"public",
"String",
"textarea",
"(",
"String",
"name",
",",
"String",
"extra",
",",
"Object",
"defaultValue",
")",
"{",
"return",
"fixedTextarea",
"(",
"name",
",",
"extra",
",",
"getValue",
"(",
"name",
",",
"defaultValue",
")",
")",
";",
"}"
] | Constructs a text area with the specified name, optional extra
parameters, and default text. | [
"Constructs",
"a",
"text",
"area",
"with",
"the",
"specified",
"name",
"optional",
"extra",
"parameters",
"and",
"default",
"text",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/velocity/FormTool.java#L343-L346 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2/CloudTasksClient.java | CloudTasksClient.createQueue | public final Queue createQueue(String parent, Queue queue) {
CreateQueueRequest request =
CreateQueueRequest.newBuilder().setParent(parent).setQueue(queue).build();
return createQueue(request);
} | java | public final Queue createQueue(String parent, Queue queue) {
CreateQueueRequest request =
CreateQueueRequest.newBuilder().setParent(parent).setQueue(queue).build();
return createQueue(request);
} | [
"public",
"final",
"Queue",
"createQueue",
"(",
"String",
"parent",
",",
"Queue",
"queue",
")",
"{",
"CreateQueueRequest",
"request",
"=",
"CreateQueueRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setQueue",
"(",
"queue",
... | Creates a queue.
<p>Queues created with this method allow tasks to live for a maximum of 31 days. After a task
is 31 days old, the task will be deleted regardless of whether it was dispatched or not.
<p>WARNING: Using this method may have unintended side effects if you are using an App Engine
`queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and
queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
<p>Sample code:
<pre><code>
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Queue queue = Queue.newBuilder().build();
Queue response = cloudTasksClient.createQueue(parent.toString(), queue);
}
</code></pre>
@param parent Required.
<p>The location name in which the queue will be created. For example:
`projects/PROJECT_ID/locations/LOCATION_ID`
<p>The list of allowed locations can be obtained by calling Cloud Tasks' implementation of
[ListLocations][google.cloud.location.Locations.ListLocations].
@param queue Required.
<p>The queue to create.
<p>[Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an existing
queue.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"queue",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2/CloudTasksClient.java#L469-L474 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java | Window.failAll | public List<WindowFuture<K,R,P>> failAll(Throwable t) throws InterruptedException {
if (this.futures.size() <= 0) {
return null;
}
List<WindowFuture<K,R,P>> failed = new ArrayList<WindowFuture<K,R,P>>();
long now = System.currentTimeMillis();
this.lock.lock();
try {
// check every request this window contains and see if it's expired
for (DefaultWindowFuture<K,R,P> future : this.futures.values()) {
failed.add(future);
future.failedHelper(t, now);
}
if (failed.size() > 0) {
this.futures.clear();
// signal that a future is completed
this.completedCondition.signalAll();
}
} finally {
this.lock.unlock();
}
return failed;
} | java | public List<WindowFuture<K,R,P>> failAll(Throwable t) throws InterruptedException {
if (this.futures.size() <= 0) {
return null;
}
List<WindowFuture<K,R,P>> failed = new ArrayList<WindowFuture<K,R,P>>();
long now = System.currentTimeMillis();
this.lock.lock();
try {
// check every request this window contains and see if it's expired
for (DefaultWindowFuture<K,R,P> future : this.futures.values()) {
failed.add(future);
future.failedHelper(t, now);
}
if (failed.size() > 0) {
this.futures.clear();
// signal that a future is completed
this.completedCondition.signalAll();
}
} finally {
this.lock.unlock();
}
return failed;
} | [
"public",
"List",
"<",
"WindowFuture",
"<",
"K",
",",
"R",
",",
"P",
">",
">",
"failAll",
"(",
"Throwable",
"t",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"this",
".",
"futures",
".",
"size",
"(",
")",
"<=",
"0",
")",
"{",
"return",
"n... | Fails (completes) all requests by setting the same cause of the failure
on all associated futures. Any callers/threads waiting for completion
will be signaled. Also, since this frees up all slots in the window, all
callers/threads blocked with pending offers will be signaled to continue.
@param t The throwable to set as the failure cause on all associated futures.
Null values are not accepted (use cancelAll()) instead.
@return A list of all futures that were failed.
@throws InterruptedException Thrown if the calling thread is interrupted
and we're currently waiting to acquire the internal "windowLock". | [
"Fails",
"(",
"completes",
")",
"all",
"requests",
"by",
"setting",
"the",
"same",
"cause",
"of",
"the",
"failure",
"on",
"all",
"associated",
"futures",
".",
"Any",
"callers",
"/",
"threads",
"waiting",
"for",
"completion",
"will",
"be",
"signaled",
".",
... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L565-L589 |
landawn/AbacusUtil | src/com/landawn/abacus/util/StringUtil.java | StringUtil.commonPrefix | public static String commonPrefix(final String a, final String b) {
if (N.isNullOrEmpty(a) || N.isNullOrEmpty(b)) {
return N.EMPTY_STRING;
}
int maxPrefixLength = Math.min(a.length(), b.length());
int p = 0;
while (p < maxPrefixLength && a.charAt(p) == b.charAt(p)) {
p++;
}
if (validSurrogatePairAt(a, p - 1) || validSurrogatePairAt(b, p - 1)) {
p--;
}
if (p == a.length()) {
return a.toString();
} else if (p == b.length()) {
return b.toString();
} else {
return a.subSequence(0, p).toString();
}
} | java | public static String commonPrefix(final String a, final String b) {
if (N.isNullOrEmpty(a) || N.isNullOrEmpty(b)) {
return N.EMPTY_STRING;
}
int maxPrefixLength = Math.min(a.length(), b.length());
int p = 0;
while (p < maxPrefixLength && a.charAt(p) == b.charAt(p)) {
p++;
}
if (validSurrogatePairAt(a, p - 1) || validSurrogatePairAt(b, p - 1)) {
p--;
}
if (p == a.length()) {
return a.toString();
} else if (p == b.length()) {
return b.toString();
} else {
return a.subSequence(0, p).toString();
}
} | [
"public",
"static",
"String",
"commonPrefix",
"(",
"final",
"String",
"a",
",",
"final",
"String",
"b",
")",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"a",
")",
"||",
"N",
".",
"isNullOrEmpty",
"(",
"b",
")",
")",
"{",
"return",
"N",
".",
"EM... | Note: copy rights: Google Guava.
Returns the longest string {@code prefix} such that
{@code a.toString().startsWith(prefix) && b.toString().startsWith(prefix)}
, taking care not to split surrogate pairs. If {@code a} and {@code b}
have no common prefix, returns the empty string. | [
"Note",
":",
"copy",
"rights",
":",
"Google",
"Guava",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L4192-L4215 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/view/CalendarHeaderView.java | CalendarHeaderView.setCellFactory | public final void setCellFactory(Callback<Calendar, Node> factory) {
requireNonNull(factory);
cellFactoryProperty().set(factory);
} | java | public final void setCellFactory(Callback<Calendar, Node> factory) {
requireNonNull(factory);
cellFactoryProperty().set(factory);
} | [
"public",
"final",
"void",
"setCellFactory",
"(",
"Callback",
"<",
"Calendar",
",",
"Node",
">",
"factory",
")",
"{",
"requireNonNull",
"(",
"factory",
")",
";",
"cellFactoryProperty",
"(",
")",
".",
"set",
"(",
"factory",
")",
";",
"}"
] | Sets the value of {@link #cellFactoryProperty()}.
@param factory
the factory | [
"Sets",
"the",
"value",
"of",
"{",
"@link",
"#cellFactoryProperty",
"()",
"}",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/view/CalendarHeaderView.java#L119-L122 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java | Director.installFeature | public void installFeature(String esaLocation, String toExtension, boolean acceptLicense) throws InstallException {
fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING"));
ArrayList<InstallAsset> installAssets = new ArrayList<InstallAsset>();
String feature = getResolveDirector().resolve(esaLocation, toExtension, product.getInstalledFeatures(), installAssets, 10, 40);
if (installAssets.isEmpty()) {
throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.feature.exists", feature), InstallException.ALREADY_EXISTS);
}
this.installAssets = new ArrayList<List<InstallAsset>>(1);
this.installAssets.add(installAssets);
} | java | public void installFeature(String esaLocation, String toExtension, boolean acceptLicense) throws InstallException {
fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING"));
ArrayList<InstallAsset> installAssets = new ArrayList<InstallAsset>();
String feature = getResolveDirector().resolve(esaLocation, toExtension, product.getInstalledFeatures(), installAssets, 10, 40);
if (installAssets.isEmpty()) {
throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.feature.exists", feature), InstallException.ALREADY_EXISTS);
}
this.installAssets = new ArrayList<List<InstallAsset>>(1);
this.installAssets.add(installAssets);
} | [
"public",
"void",
"installFeature",
"(",
"String",
"esaLocation",
",",
"String",
"toExtension",
",",
"boolean",
"acceptLicense",
")",
"throws",
"InstallException",
"{",
"fireProgressEvent",
"(",
"InstallProgressEvent",
".",
"CHECK",
",",
"1",
",",
"Messages",
".",
... | Installs the feature found in the given esa location
@param esaLocation location of esa
@param toExtension location of a product extension
@param acceptLicense if license is accepted
@throws InstallException | [
"Installs",
"the",
"feature",
"found",
"in",
"the",
"given",
"esa",
"location"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L374-L383 |
JOML-CI/JOML | src/org/joml/Matrix3x2f.java | Matrix3x2f.scaleAroundLocal | public Matrix3x2f scaleAroundLocal(float sx, float sy, float sz, float ox, float oy, float oz) {
return scaleAroundLocal(sx, sy, ox, oy, this);
} | java | public Matrix3x2f scaleAroundLocal(float sx, float sy, float sz, float ox, float oy, float oz) {
return scaleAroundLocal(sx, sy, ox, oy, this);
} | [
"public",
"Matrix3x2f",
"scaleAroundLocal",
"(",
"float",
"sx",
",",
"float",
"sy",
",",
"float",
"sz",
",",
"float",
"ox",
",",
"float",
"oy",
",",
"float",
"oz",
")",
"{",
"return",
"scaleAroundLocal",
"(",
"sx",
",",
"sy",
",",
"ox",
",",
"oy",
",... | Pre-multiply scaling to this matrix by scaling the base axes by the given sx and
sy factors while using <code>(ox, oy)</code> as the scaling origin.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>S * M</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>S * M * v</code>, the
scaling will be applied last!
<p>
This method is equivalent to calling: <code>new Matrix3x2f().translate(ox, oy).scale(sx, sy).translate(-ox, -oy).mul(this, this)</code>
@param sx
the scaling factor of the x component
@param sy
the scaling factor of the y component
@param sz
the scaling factor of the z component
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param oz
the z coordinate of the scaling origin
@return this | [
"Pre",
"-",
"multiply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"the",
"base",
"axes",
"by",
"the",
"given",
"sx",
"and",
"sy",
"factors",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
")",
"<",
"/",
"code",
">",
"as",
"the",
"scaling"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2f.java#L1529-L1531 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java | OpenAPIConnection.openAPIUIConnection | public static OpenAPIConnection openAPIUIConnection(LibertyServer server, boolean secure) {
return new OpenAPIConnection(server, OPEN_API_UI).secure(secure);
} | java | public static OpenAPIConnection openAPIUIConnection(LibertyServer server, boolean secure) {
return new OpenAPIConnection(server, OPEN_API_UI).secure(secure);
} | [
"public",
"static",
"OpenAPIConnection",
"openAPIUIConnection",
"(",
"LibertyServer",
"server",
",",
"boolean",
"secure",
")",
"{",
"return",
"new",
"OpenAPIConnection",
"(",
"server",
",",
"OPEN_API_UI",
")",
".",
"secure",
"(",
"secure",
")",
";",
"}"
] | creates default connection for OpenAPI UI endpoint
@param server - server to connect to
@param secure - if true connection uses HTTPS
@return | [
"creates",
"default",
"connection",
"for",
"OpenAPI",
"UI",
"endpoint"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java#L281-L283 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java | Http2Exception.streamError | public static Http2Exception streamError(int id, Http2Error error, Throwable cause,
String fmt, Object... args) {
return CONNECTION_STREAM_ID == id ?
Http2Exception.connectionError(error, cause, fmt, args) :
new StreamException(id, error, String.format(fmt, args), cause);
} | java | public static Http2Exception streamError(int id, Http2Error error, Throwable cause,
String fmt, Object... args) {
return CONNECTION_STREAM_ID == id ?
Http2Exception.connectionError(error, cause, fmt, args) :
new StreamException(id, error, String.format(fmt, args), cause);
} | [
"public",
"static",
"Http2Exception",
"streamError",
"(",
"int",
"id",
",",
"Http2Error",
"error",
",",
"Throwable",
"cause",
",",
"String",
"fmt",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"CONNECTION_STREAM_ID",
"==",
"id",
"?",
"Http2Exception",
"."... | Use if an error which can be isolated to a single stream has occurred. If the {@code id} is not
{@link Http2CodecUtil#CONNECTION_STREAM_ID} then a {@link Http2Exception.StreamException} will be returned.
Otherwise the error is considered a connection error and a {@link Http2Exception} is returned.
@param id The stream id for which the error is isolated to.
@param error The type of error as defined by the HTTP/2 specification.
@param cause The object which caused the error.
@param fmt String with the content and format for the additional debug data.
@param args Objects which fit into the format defined by {@code fmt}.
@return If the {@code id} is not
{@link Http2CodecUtil#CONNECTION_STREAM_ID} then a {@link Http2Exception.StreamException} will be returned.
Otherwise the error is considered a connection error and a {@link Http2Exception} is returned. | [
"Use",
"if",
"an",
"error",
"which",
"can",
"be",
"isolated",
"to",
"a",
"single",
"stream",
"has",
"occurred",
".",
"If",
"the",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java#L145-L150 |
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/UpdateOperationWithCacheFileTask.java | UpdateOperationWithCacheFileTask.isNewerData | protected static boolean isNewerData(@Nonnull final Data older, @Nonnull final Data newer) {
return newer.getVersion().compareTo(older.getVersion()) > 0;
} | java | protected static boolean isNewerData(@Nonnull final Data older, @Nonnull final Data newer) {
return newer.getVersion().compareTo(older.getVersion()) > 0;
} | [
"protected",
"static",
"boolean",
"isNewerData",
"(",
"@",
"Nonnull",
"final",
"Data",
"older",
",",
"@",
"Nonnull",
"final",
"Data",
"newer",
")",
"{",
"return",
"newer",
".",
"getVersion",
"(",
")",
".",
"compareTo",
"(",
"older",
".",
"getVersion",
"(",... | Checks that {@code older} {@link Data} has a lower version number than the {@code newer} one.
@param older
possibly older {@code Data}
@param newer
possibly newer {@code Data}
@return {@code true} if the {@code newer} Data is really newer, otherwise {@code false} | [
"Checks",
"that",
"{",
"@code",
"older",
"}",
"{",
"@link",
"Data",
"}",
"has",
"a",
"lower",
"version",
"number",
"than",
"the",
"{",
"@code",
"newer",
"}",
"one",
"."
] | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/UpdateOperationWithCacheFileTask.java#L115-L117 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java | TmdbGenres.getGenreTVList | public ResultList<Genre> getGenreTVList(String language) throws MovieDbException {
return getGenreList(language, MethodSub.TV_LIST);
} | java | public ResultList<Genre> getGenreTVList(String language) throws MovieDbException {
return getGenreList(language, MethodSub.TV_LIST);
} | [
"public",
"ResultList",
"<",
"Genre",
">",
"getGenreTVList",
"(",
"String",
"language",
")",
"throws",
"MovieDbException",
"{",
"return",
"getGenreList",
"(",
"language",
",",
"MethodSub",
".",
"TV_LIST",
")",
";",
"}"
] | Get the list of TV genres.
@param language
@return
@throws MovieDbException | [
"Get",
"the",
"list",
"of",
"TV",
"genres",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java#L73-L75 |
JOML-CI/JOML | src/org/joml/Quaterniond.java | Quaterniond.premul | public Quaterniond premul(double qx, double qy, double qz, double qw) {
return premul(qx, qy, qz, qw, this);
} | java | public Quaterniond premul(double qx, double qy, double qz, double qw) {
return premul(qx, qy, qz, qw, this);
} | [
"public",
"Quaterniond",
"premul",
"(",
"double",
"qx",
",",
"double",
"qy",
",",
"double",
"qz",
",",
"double",
"qw",
")",
"{",
"return",
"premul",
"(",
"qx",
",",
"qy",
",",
"qz",
",",
"qw",
",",
"this",
")",
";",
"}"
] | Pre-multiply this quaternion by the quaternion represented via <code>(qx, qy, qz, qw)</code>.
<p>
If <code>T</code> is <code>this</code> and <code>Q</code> is the given quaternion, then the resulting quaternion <code>R</code> is:
<p>
<code>R = Q * T</code>
<p>
So, this method uses pre-multiplication, resulting in a vector to be transformed by <code>T</code> first, and then by <code>Q</code>.
@param qx
the x component of the quaternion to multiply <code>this</code> by
@param qy
the y component of the quaternion to multiply <code>this</code> by
@param qz
the z component of the quaternion to multiply <code>this</code> by
@param qw
the w component of the quaternion to multiply <code>this</code> by
@return this | [
"Pre",
"-",
"multiply",
"this",
"quaternion",
"by",
"the",
"quaternion",
"represented",
"via",
"<code",
">",
"(",
"qx",
"qy",
"qz",
"qw",
")",
"<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"T<",
"/",
"code",
">",
"is",
"<code",
">",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L825-L827 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java | SourceTreeManager.getSourceTree | public int getSourceTree(Source source, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
int n = getNode(source);
if (DTM.NULL != n)
return n;
n = parseToNode(source, locator, xctxt);
if (DTM.NULL != n)
putDocumentInCache(n, source);
return n;
} | java | public int getSourceTree(Source source, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
int n = getNode(source);
if (DTM.NULL != n)
return n;
n = parseToNode(source, locator, xctxt);
if (DTM.NULL != n)
putDocumentInCache(n, source);
return n;
} | [
"public",
"int",
"getSourceTree",
"(",
"Source",
"source",
",",
"SourceLocator",
"locator",
",",
"XPathContext",
"xctxt",
")",
"throws",
"TransformerException",
"{",
"int",
"n",
"=",
"getNode",
"(",
"source",
")",
";",
"if",
"(",
"DTM",
".",
"NULL",
"!=",
... | Get the source tree from the input source.
@param source The Source object that should identify the desired node.
@param locator The location of the caller, for diagnostic purposes.
@return non-null reference to a node.
@throws TransformerException if the Source argument can't be resolved to
a node. | [
"Get",
"the",
"source",
"tree",
"from",
"the",
"input",
"source",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java#L272-L287 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java | PubSubManager.tryToPublishAndPossibleAutoCreate | public <I extends Item> LeafNode tryToPublishAndPossibleAutoCreate(String id, I item)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
LeafNode leafNode = new LeafNode(this, id);
leafNode.publish(item);
// If LeafNode.publish() did not throw then we have successfully published an item and possible auto-created
// (XEP-0163 § 3., XEP-0060 § 7.1.4) the node. So we can put the node into the nodeMap.
nodeMap.put(id, leafNode);
return leafNode;
} | java | public <I extends Item> LeafNode tryToPublishAndPossibleAutoCreate(String id, I item)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
LeafNode leafNode = new LeafNode(this, id);
leafNode.publish(item);
// If LeafNode.publish() did not throw then we have successfully published an item and possible auto-created
// (XEP-0163 § 3., XEP-0060 § 7.1.4) the node. So we can put the node into the nodeMap.
nodeMap.put(id, leafNode);
return leafNode;
} | [
"public",
"<",
"I",
"extends",
"Item",
">",
"LeafNode",
"tryToPublishAndPossibleAutoCreate",
"(",
"String",
"id",
",",
"I",
"item",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"LeafNo... | Try to publish an item and, if the node with the given ID does not exists, auto-create the node.
<p>
Not every PubSub service supports automatic node creation. You can discover if this service supports it by using
{@link #supportsAutomaticNodeCreation()}.
</p>
@param id The unique id of the node.
@param item The item to publish.
@param <I> type of the item.
@return the LeafNode on which the item was published.
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException
@since 4.2.1 | [
"Try",
"to",
"publish",
"an",
"item",
"and",
"if",
"the",
"node",
"with",
"the",
"given",
"ID",
"does",
"not",
"exists",
"auto",
"-",
"create",
"the",
"node",
".",
"<p",
">",
"Not",
"every",
"PubSub",
"service",
"supports",
"automatic",
"node",
"creation... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java#L433-L443 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java | IOUtil.copyFile | public static void copyFile(File source, File target, long sourceCount) {
if (!source.exists()) {
throw new IllegalArgumentException("Source does not exist " + source.getAbsolutePath());
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source is not a file " + source.getAbsolutePath());
}
if (!target.exists() && !target.mkdirs()) {
throw new HazelcastException("Could not create the target directory " + target.getAbsolutePath());
}
final File destination = target.isDirectory() ? new File(target, source.getName()) : target;
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(destination);
final FileChannel inChannel = in.getChannel();
final FileChannel outChannel = out.getChannel();
final long transferCount = sourceCount > 0 ? sourceCount : inChannel.size();
inChannel.transferTo(0, transferCount, outChannel);
} catch (Exception e) {
throw new HazelcastException("Error occurred while copying file", e);
} finally {
closeResource(in);
closeResource(out);
}
} | java | public static void copyFile(File source, File target, long sourceCount) {
if (!source.exists()) {
throw new IllegalArgumentException("Source does not exist " + source.getAbsolutePath());
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source is not a file " + source.getAbsolutePath());
}
if (!target.exists() && !target.mkdirs()) {
throw new HazelcastException("Could not create the target directory " + target.getAbsolutePath());
}
final File destination = target.isDirectory() ? new File(target, source.getName()) : target;
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(destination);
final FileChannel inChannel = in.getChannel();
final FileChannel outChannel = out.getChannel();
final long transferCount = sourceCount > 0 ? sourceCount : inChannel.size();
inChannel.transferTo(0, transferCount, outChannel);
} catch (Exception e) {
throw new HazelcastException("Error occurred while copying file", e);
} finally {
closeResource(in);
closeResource(out);
}
} | [
"public",
"static",
"void",
"copyFile",
"(",
"File",
"source",
",",
"File",
"target",
",",
"long",
"sourceCount",
")",
"{",
"if",
"(",
"!",
"source",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Source does not exist... | Copies source file to target and creates the target if necessary. The target can be a directory or file. If the target
is a file, nests the new file under the target directory, otherwise copies to the given target.
@param source the source file
@param target the destination file or directory
@param sourceCount the maximum number of bytes to be transferred (if negative transfers the entire source file)
@throws IllegalArgumentException if the source was not found or the source not a file
@throws HazelcastException if there was any exception while creating directories or copying | [
"Copies",
"source",
"file",
"to",
"target",
"and",
"creates",
"the",
"target",
"if",
"necessary",
".",
"The",
"target",
"can",
"be",
"a",
"directory",
"or",
"file",
".",
"If",
"the",
"target",
"is",
"a",
"file",
"nests",
"the",
"new",
"file",
"under",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java#L587-L613 |
brettonw/Bag | src/main/java/com/brettonw/bag/Bag.java | Bag.getBagObject | public BagObject getBagObject (String key, Supplier<BagObject> notFound) {
Object object = getObject (key);
return (object instanceof BagObject) ? (BagObject) object : notFound.get ();
} | java | public BagObject getBagObject (String key, Supplier<BagObject> notFound) {
Object object = getObject (key);
return (object instanceof BagObject) ? (BagObject) object : notFound.get ();
} | [
"public",
"BagObject",
"getBagObject",
"(",
"String",
"key",
",",
"Supplier",
"<",
"BagObject",
">",
"notFound",
")",
"{",
"Object",
"object",
"=",
"getObject",
"(",
"key",
")",
";",
"return",
"(",
"object",
"instanceof",
"BagObject",
")",
"?",
"(",
"BagOb... | Retrieve a mapped element and return it as a BagObject.
@param key A string value used to index the element.
@param notFound A function to create a new BagObject if the requested key was not found
@return The element as a BagObject, or notFound if the element is not found. | [
"Retrieve",
"a",
"mapped",
"element",
"and",
"return",
"it",
"as",
"a",
"BagObject",
"."
] | train | https://github.com/brettonw/Bag/blob/25c0ff74893b6c9a2c61bf0f97189ab82e0b2f56/src/main/java/com/brettonw/bag/Bag.java#L108-L111 |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAtomTypeMatcher.java | MmffAtomTypeMatcher.symbolicTypes | String[] symbolicTypes(final IAtomContainer container, final int[][] graph, final EdgeToBondMap bonds, final Set<IBond> mmffArom) {
// Array of symbolic types, MMFF refers to these as 'SYMB' and the numeric
// value a s 'TYPE'.
final String[] symbs = new String[container.getAtomCount()];
checkPreconditions(container);
assignPreliminaryTypes(container, symbs);
// aromatic types, set by upgrading preliminary types in specified positions
// and conditions. This requires a fair bit of code and is delegated to a separate class.
aromaticTypes.assign(container, symbs, bonds, graph, mmffArom);
// special case, 'NCN+' matches entries that the validation suite say should
// actually be 'NC=N'. We can achieve 100% compliance by checking if NCN+ is still
// next to CNN+ or CIM+ after aromatic types are assigned
fixNCNTypes(symbs, graph);
assignHydrogenTypes(container, symbs, graph);
return symbs;
} | java | String[] symbolicTypes(final IAtomContainer container, final int[][] graph, final EdgeToBondMap bonds, final Set<IBond> mmffArom) {
// Array of symbolic types, MMFF refers to these as 'SYMB' and the numeric
// value a s 'TYPE'.
final String[] symbs = new String[container.getAtomCount()];
checkPreconditions(container);
assignPreliminaryTypes(container, symbs);
// aromatic types, set by upgrading preliminary types in specified positions
// and conditions. This requires a fair bit of code and is delegated to a separate class.
aromaticTypes.assign(container, symbs, bonds, graph, mmffArom);
// special case, 'NCN+' matches entries that the validation suite say should
// actually be 'NC=N'. We can achieve 100% compliance by checking if NCN+ is still
// next to CNN+ or CIM+ after aromatic types are assigned
fixNCNTypes(symbs, graph);
assignHydrogenTypes(container, symbs, graph);
return symbs;
} | [
"String",
"[",
"]",
"symbolicTypes",
"(",
"final",
"IAtomContainer",
"container",
",",
"final",
"int",
"[",
"]",
"[",
"]",
"graph",
",",
"final",
"EdgeToBondMap",
"bonds",
",",
"final",
"Set",
"<",
"IBond",
">",
"mmffArom",
")",
"{",
"// Array of symbolic ty... | Obtain the MMFF symbolic types to the atoms of the provided structure.
@param container structure representation
@param graph adj list data structure
@param bonds bond lookup map
@param mmffArom flags which bonds are aromatic by MMFF model
@return MMFF symbolic types for each atom index | [
"Obtain",
"the",
"MMFF",
"symbolic",
"types",
"to",
"the",
"atoms",
"of",
"the",
"provided",
"structure",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAtomTypeMatcher.java#L117-L139 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java | MD5FileUtils.saveMD5File | public static void saveMD5File(File dataFile, MD5Hash digest)
throws IOException {
File md5File = getDigestFileForFile(dataFile);
String digestString = StringUtils.byteToHexString(
digest.getDigest());
String md5Line = digestString + " *" + dataFile.getName() + "\n";
AtomicFileOutputStream afos = new AtomicFileOutputStream(md5File);
afos.write(md5Line.getBytes());
afos.close();
LOG.info("Saved MD5 " + digest + " to " + md5File);
} | java | public static void saveMD5File(File dataFile, MD5Hash digest)
throws IOException {
File md5File = getDigestFileForFile(dataFile);
String digestString = StringUtils.byteToHexString(
digest.getDigest());
String md5Line = digestString + " *" + dataFile.getName() + "\n";
AtomicFileOutputStream afos = new AtomicFileOutputStream(md5File);
afos.write(md5Line.getBytes());
afos.close();
LOG.info("Saved MD5 " + digest + " to " + md5File);
} | [
"public",
"static",
"void",
"saveMD5File",
"(",
"File",
"dataFile",
",",
"MD5Hash",
"digest",
")",
"throws",
"IOException",
"{",
"File",
"md5File",
"=",
"getDigestFileForFile",
"(",
"dataFile",
")",
";",
"String",
"digestString",
"=",
"StringUtils",
".",
"byteTo... | Save the ".md5" file that lists the md5sum of another file.
@param dataFile the original file whose md5 was computed
@param digest the computed digest
@throws IOException | [
"Save",
"the",
".",
"md5",
"file",
"that",
"lists",
"the",
"md5sum",
"of",
"another",
"file",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java#L133-L144 |
landawn/AbacusUtil | src/com/landawn/abacus/http/okhttp/OkHttpRequest.java | OkHttpRequest.addHeader | public OkHttpRequest addHeader(String name, String value) {
builder.addHeader(name, value);
return this;
} | java | public OkHttpRequest addHeader(String name, String value) {
builder.addHeader(name, value);
return this;
} | [
"public",
"OkHttpRequest",
"addHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"builder",
".",
"addHeader",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a header with {@code name} and {@code value}. Prefer this method for multiply-valued
headers like "Cookie".
<p>Note that for some headers including {@code Content-Length} and {@code Content-Encoding},
OkHttp may replace {@code value} with a header derived from the request body. | [
"Adds",
"a",
"header",
"with",
"{",
"@code",
"name",
"}",
"and",
"{",
"@code",
"value",
"}",
".",
"Prefer",
"this",
"method",
"for",
"multiply",
"-",
"valued",
"headers",
"like",
"Cookie",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/http/okhttp/OkHttpRequest.java#L178-L181 |
alkacon/opencms-core | src/org/opencms/security/CmsRoleManager.java | CmsRoleManager.hasRoleForResource | public boolean hasRoleForResource(CmsObject cms, String userName, CmsRole role, String resourceName) {
CmsResource resource;
try {
resource = cms.readResource(resourceName, CmsResourceFilter.ALL);
} catch (CmsException e) {
// ignore
return false;
}
CmsUser user;
try {
user = cms.readUser(userName);
} catch (CmsException e) {
// ignore
return false;
}
return m_securityManager.hasRoleForResource(cms.getRequestContext(), user, role, resource);
} | java | public boolean hasRoleForResource(CmsObject cms, String userName, CmsRole role, String resourceName) {
CmsResource resource;
try {
resource = cms.readResource(resourceName, CmsResourceFilter.ALL);
} catch (CmsException e) {
// ignore
return false;
}
CmsUser user;
try {
user = cms.readUser(userName);
} catch (CmsException e) {
// ignore
return false;
}
return m_securityManager.hasRoleForResource(cms.getRequestContext(), user, role, resource);
} | [
"public",
"boolean",
"hasRoleForResource",
"(",
"CmsObject",
"cms",
",",
"String",
"userName",
",",
"CmsRole",
"role",
",",
"String",
"resourceName",
")",
"{",
"CmsResource",
"resource",
";",
"try",
"{",
"resource",
"=",
"cms",
".",
"readResource",
"(",
"resou... | Checks if the given context user has the given role for the given resource.<p>
@param cms the opencms context
@param userName the name of the user to check the role for
@param role the role to check
@param resourceName the name of the resource to check
@return <code>true</code> if the given context user has the given role for the given resource | [
"Checks",
"if",
"the",
"given",
"context",
"user",
"has",
"the",
"given",
"role",
"for",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsRoleManager.java#L505-L522 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupResourceVaultConfigsInner.java | BackupResourceVaultConfigsInner.getAsync | public Observable<BackupResourceVaultConfigResourceInner> getAsync(String vaultName, String resourceGroupName) {
return getWithServiceResponseAsync(vaultName, resourceGroupName).map(new Func1<ServiceResponse<BackupResourceVaultConfigResourceInner>, BackupResourceVaultConfigResourceInner>() {
@Override
public BackupResourceVaultConfigResourceInner call(ServiceResponse<BackupResourceVaultConfigResourceInner> response) {
return response.body();
}
});
} | java | public Observable<BackupResourceVaultConfigResourceInner> getAsync(String vaultName, String resourceGroupName) {
return getWithServiceResponseAsync(vaultName, resourceGroupName).map(new Func1<ServiceResponse<BackupResourceVaultConfigResourceInner>, BackupResourceVaultConfigResourceInner>() {
@Override
public BackupResourceVaultConfigResourceInner call(ServiceResponse<BackupResourceVaultConfigResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BackupResourceVaultConfigResourceInner",
">",
"getAsync",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"vaultName",
",",
"resourceGroupName",
")",
".",
"map",
"(",
... | Fetches resource vault config.
@param vaultName The name of the recovery services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BackupResourceVaultConfigResourceInner object | [
"Fetches",
"resource",
"vault",
"config",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupResourceVaultConfigsInner.java#L102-L109 |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java | AbsSetting.getStr | public String getStr(String key, String group, String defaultValue) {
final String value = getByGroup(key, group);
if (StrUtil.isBlank(value)) {
return defaultValue;
}
return value;
} | java | public String getStr(String key, String group, String defaultValue) {
final String value = getByGroup(key, group);
if (StrUtil.isBlank(value)) {
return defaultValue;
}
return value;
} | [
"public",
"String",
"getStr",
"(",
"String",
"key",
",",
"String",
"group",
",",
"String",
"defaultValue",
")",
"{",
"final",
"String",
"value",
"=",
"getByGroup",
"(",
"key",
",",
"group",
")",
";",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"value",
... | 获得字符串类型值
@param key KEY
@param group 分组
@param defaultValue 默认值
@return 值或默认值 | [
"获得字符串类型值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L43-L49 |
geomajas/geomajas-project-client-gwt2 | plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/map/layercontrolpanel/LayerControlPanelPresenterImpl.java | LayerControlPanelPresenterImpl.isLayerVisibleAtViewPortResolution | public boolean isLayerVisibleAtViewPortResolution(ViewPort viewPort, Layer layer) {
if (viewPort.getResolution() > layer.getMinResolution()
&& viewPort.getResolution() <= layer.getMaxResolution()) {
return true;
}
return false;
} | java | public boolean isLayerVisibleAtViewPortResolution(ViewPort viewPort, Layer layer) {
if (viewPort.getResolution() > layer.getMinResolution()
&& viewPort.getResolution() <= layer.getMaxResolution()) {
return true;
}
return false;
} | [
"public",
"boolean",
"isLayerVisibleAtViewPortResolution",
"(",
"ViewPort",
"viewPort",
",",
"Layer",
"layer",
")",
"{",
"if",
"(",
"viewPort",
".",
"getResolution",
"(",
")",
">",
"layer",
".",
"getMinResolution",
"(",
")",
"&&",
"viewPort",
".",
"getResolution... | Check if current viewPort resolution is between the minimum (inclusive) and
the maximum scale (exclusive) of the layer.
Inclusive/exclusive follows SLD convention: exclusive minResolution, inclusive maxResolution.
@param viewPort the viewPort
@param layer layer
@return whether the layer is visible in the provided viewPort resolution | [
"Check",
"if",
"current",
"viewPort",
"resolution",
"is",
"between",
"the",
"minimum",
"(",
"inclusive",
")",
"and",
"the",
"maximum",
"scale",
"(",
"exclusive",
")",
"of",
"the",
"layer",
".",
"Inclusive",
"/",
"exclusive",
"follows",
"SLD",
"convention",
"... | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/map/layercontrolpanel/LayerControlPanelPresenterImpl.java#L117-L123 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_ipMigration_duration_POST | public OvhOrder dedicated_server_serviceName_ipMigration_duration_POST(String serviceName, String duration, String ip, String token) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/ipMigration/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ip", ip);
addBody(o, "token", token);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_server_serviceName_ipMigration_duration_POST(String serviceName, String duration, String ip, String token) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/ipMigration/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ip", ip);
addBody(o, "token", token);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_server_serviceName_ipMigration_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"String",
"ip",
",",
"String",
"token",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{ser... | Create order
REST: POST /order/dedicated/server/{serviceName}/ipMigration/{duration}
@param ip [required] The IP to move to this server
@param token [required] IP migration token
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2590-L2598 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityHelper.java | J2CSecurityHelper.addSubjectCustomData | public static void addSubjectCustomData(Subject callSubject, Hashtable<String, Object> newCred) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "addSubjectCustomData", newCred);
}
AddPrivateCredentials action = new AddPrivateCredentials(callSubject, newCred);
AccessController.doPrivileged(action);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "addSubjectCustomData");
}
} | java | public static void addSubjectCustomData(Subject callSubject, Hashtable<String, Object> newCred) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "addSubjectCustomData", newCred);
}
AddPrivateCredentials action = new AddPrivateCredentials(callSubject, newCred);
AccessController.doPrivileged(action);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "addSubjectCustomData");
}
} | [
"public",
"static",
"void",
"addSubjectCustomData",
"(",
"Subject",
"callSubject",
",",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"newCred",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"... | This method adds the custom Hashtable provided to the private credentials of the
Subject passed in.
@param callSubject The Subject which should have its private credentials updated with the custom Hashtable
@param newCred The custom Hashtable with information in the format required for WebSphere
to do a Hashtable login. | [
"This",
"method",
"adds",
"the",
"custom",
"Hashtable",
"provided",
"to",
"the",
"private",
"credentials",
"of",
"the",
"Subject",
"passed",
"in",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityHelper.java#L161-L170 |
b3dgs/lionengine | lionengine-network/src/main/java/com/b3dgs/lionengine/network/ServerImpl.java | ServerImpl.receiveMessage | private void receiveMessage(ClientSocket client, DataInputStream buffer, byte from, StateConnection expected)
throws IOException
{
if (ServerImpl.checkValidity(client, from, expected))
{
final byte dest = buffer.readByte();
final byte type = buffer.readByte();
final int size = buffer.readInt();
if (size > 0)
{
final byte[] clientData = new byte[size];
if (buffer.read(clientData) != -1) // CHECKSTYLE IGNORE LINE: TrailingComment|NestedIfDepth
{
final DataInputStream clientBuffer = new DataInputStream(new ByteArrayInputStream(clientData));
decodeMessage(type, from, dest, clientBuffer);
}
}
final int headerSize = 4;
bandwidth += headerSize + size;
}
} | java | private void receiveMessage(ClientSocket client, DataInputStream buffer, byte from, StateConnection expected)
throws IOException
{
if (ServerImpl.checkValidity(client, from, expected))
{
final byte dest = buffer.readByte();
final byte type = buffer.readByte();
final int size = buffer.readInt();
if (size > 0)
{
final byte[] clientData = new byte[size];
if (buffer.read(clientData) != -1) // CHECKSTYLE IGNORE LINE: TrailingComment|NestedIfDepth
{
final DataInputStream clientBuffer = new DataInputStream(new ByteArrayInputStream(clientData));
decodeMessage(type, from, dest, clientBuffer);
}
}
final int headerSize = 4;
bandwidth += headerSize + size;
}
} | [
"private",
"void",
"receiveMessage",
"(",
"ClientSocket",
"client",
",",
"DataInputStream",
"buffer",
",",
"byte",
"from",
",",
"StateConnection",
"expected",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ServerImpl",
".",
"checkValidity",
"(",
"client",
",",
"... | Update the receive standard message state.
@param client The client to test.
@param buffer The data buffer.
@param from The id from.
@param expected The expected client state.
@throws IOException If error. | [
"Update",
"the",
"receive",
"standard",
"message",
"state",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/ServerImpl.java#L360-L380 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeExceptions | private void writeExceptions(Project.Calendars.Calendar calendar, List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions)
{
// Always write legacy exception data:
// Powerproject appears not to recognise new format data at all,
// and legacy data is ignored in preference to new data post MSP 2003
writeExceptions9(dayList, exceptions);
if (m_saveVersion.getValue() > SaveVersion.Project2003.getValue())
{
writeExceptions12(calendar, exceptions);
}
} | java | private void writeExceptions(Project.Calendars.Calendar calendar, List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions)
{
// Always write legacy exception data:
// Powerproject appears not to recognise new format data at all,
// and legacy data is ignored in preference to new data post MSP 2003
writeExceptions9(dayList, exceptions);
if (m_saveVersion.getValue() > SaveVersion.Project2003.getValue())
{
writeExceptions12(calendar, exceptions);
}
} | [
"private",
"void",
"writeExceptions",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"calendar",
",",
"List",
"<",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
">",
"dayList",
",",
"List",
"<",
"ProjectCalendarException",
... | Main entry point used to determine the format used to write
calendar exceptions.
@param calendar parent calendar
@param dayList list of calendar days
@param exceptions list of exceptions | [
"Main",
"entry",
"point",
"used",
"to",
"determine",
"the",
"format",
"used",
"to",
"write",
"calendar",
"exceptions",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L469-L480 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java | WorkbookUtil.createSXSSFBook | public static SXSSFWorkbook createSXSSFBook(File excelFile, String password) {
return toSXSSFBook(createBook(excelFile, password));
} | java | public static SXSSFWorkbook createSXSSFBook(File excelFile, String password) {
return toSXSSFBook(createBook(excelFile, password));
} | [
"public",
"static",
"SXSSFWorkbook",
"createSXSSFBook",
"(",
"File",
"excelFile",
",",
"String",
"password",
")",
"{",
"return",
"toSXSSFBook",
"(",
"createBook",
"(",
"excelFile",
",",
"password",
")",
")",
";",
"}"
] | 创建或加载SXSSFWorkbook工作簿,只读模式
@param excelFile Excel文件
@param password Excel工作簿密码,如果无密码传{@code null}
@return {@link SXSSFWorkbook}
@since 4.1.13 | [
"创建或加载SXSSFWorkbook工作簿,只读模式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java#L145-L147 |
facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java | FairSchedulerServlet.showAdminFormJobComparator | private void showAdminFormJobComparator(PrintWriter out, boolean advancedView) {
out.print("<h2>Scheduling Mode</h2>\n");
String curMode = scheduler.getJobComparator().toString();
String advParam = advancedView ? "&advanced" : "";
out.printf("<p>The scheduler is currently using <b>%s mode</b>.",
generateSelect((Collection<String>)
Arrays.asList("FAIR,DEFICIT,FIFO".split(",")),
curMode, "/fairscheduler?setJobComparator=<CHOICE>" + advParam));
} | java | private void showAdminFormJobComparator(PrintWriter out, boolean advancedView) {
out.print("<h2>Scheduling Mode</h2>\n");
String curMode = scheduler.getJobComparator().toString();
String advParam = advancedView ? "&advanced" : "";
out.printf("<p>The scheduler is currently using <b>%s mode</b>.",
generateSelect((Collection<String>)
Arrays.asList("FAIR,DEFICIT,FIFO".split(",")),
curMode, "/fairscheduler?setJobComparator=<CHOICE>" + advParam));
} | [
"private",
"void",
"showAdminFormJobComparator",
"(",
"PrintWriter",
"out",
",",
"boolean",
"advancedView",
")",
"{",
"out",
".",
"print",
"(",
"\"<h2>Scheduling Mode</h2>\\n\"",
")",
";",
"String",
"curMode",
"=",
"scheduler",
".",
"getJobComparator",
"(",
")",
"... | Print the administration form at the bottom of the page, which currently
only includes the button for switching between FIFO and Fair Scheduling. | [
"Print",
"the",
"administration",
"form",
"at",
"the",
"bottom",
"of",
"the",
"page",
"which",
"currently",
"only",
"includes",
"the",
"button",
"for",
"switching",
"between",
"FIFO",
"and",
"Fair",
"Scheduling",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java#L703-L711 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java | CommerceOrderPersistenceImpl.findByUUID_G | @Override
public CommerceOrder findByUUID_G(String uuid, long groupId)
throws NoSuchOrderException {
CommerceOrder commerceOrder = fetchByUUID_G(uuid, groupId);
if (commerceOrder == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchOrderException(msg.toString());
}
return commerceOrder;
} | java | @Override
public CommerceOrder findByUUID_G(String uuid, long groupId)
throws NoSuchOrderException {
CommerceOrder commerceOrder = fetchByUUID_G(uuid, groupId);
if (commerceOrder == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchOrderException(msg.toString());
}
return commerceOrder;
} | [
"@",
"Override",
"public",
"CommerceOrder",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchOrderException",
"{",
"CommerceOrder",
"commerceOrder",
"=",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"if",
"(",
"comm... | Returns the commerce order where uuid = ? and groupId = ? or throws a {@link NoSuchOrderException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce order
@throws NoSuchOrderException if a matching commerce order could not be found | [
"Returns",
"the",
"commerce",
"order",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchOrderException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L665-L691 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.