repo stringclasses 199
values | path stringlengths 28 169 | func_name stringlengths 6 98 | original_string stringlengths 91 27.2k | language stringclasses 1
value | code stringlengths 91 27.2k | code_tokens listlengths 21 5.01k | docstring stringlengths 1 6.47k | docstring_tokens listlengths 1 587 | sha stringclasses 199
values | url stringlengths 117 257 | partition stringclasses 1
value | summary stringlengths 3 207 | output stringlengths 170 27.3k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Unidata/thredds | ui/src/main/java/ucar/nc2/ui/op/FmrcCollectionTable.java | FmrcCollectionTable.save | public void save() {
collectionNameTable.saveState(false);
dataTable.saveState(false);
prefs.putBeanObject("InfoWindowBounds", infoWindow.getBounds());
prefs.putInt("splitPos", split.getDividerLocation());
} | java | public void save() {
collectionNameTable.saveState(false);
dataTable.saveState(false);
prefs.putBeanObject("InfoWindowBounds", infoWindow.getBounds());
prefs.putInt("splitPos", split.getDividerLocation());
} | [
"public",
"void",
"save",
"(",
")",
"{",
"collectionNameTable",
".",
"saveState",
"(",
"false",
")",
";",
"dataTable",
".",
"saveState",
"(",
"false",
")",
";",
"prefs",
".",
"putBeanObject",
"(",
"\"InfoWindowBounds\"",
",",
"infoWindow",
".",
"getBounds",
... | private MetadataManager mm; | [
"private",
"MetadataManager",
"mm",
";"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/ui/src/main/java/ucar/nc2/ui/op/FmrcCollectionTable.java#L109-L114 | test | Saves the state of the data set. | Of course, here is the Java code you requested:
```java
public void save() {
collectionNameTable.saveState(false);
dataTable.saveState(false);
prefs.putBeanObject("InfoWindowBounds", infoWindow.getBounds());
prefs.putInt("splitPos", split.getDividerLocation());
}
```
Hope this helps! |
spring-projects/spring-security | web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java | AbstractPreAuthenticatedProcessingFilter.doFilter | public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if (logger.isDebugEnabled()) {
logger.debug("Checking secure context token: "
+ SecurityContextHolder.getContext().getAuthentication());
}
if (requiresAuthentication((HttpS... | java | public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if (logger.isDebugEnabled()) {
logger.debug("Checking secure context token: "
+ SecurityContextHolder.getContext().getAuthentication());
}
if (requiresAuthentication((HttpS... | [
"public",
"void",
"doFilter",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",... | Try to authenticate a pre-authenticated user with Spring Security if the user has
not yet been authenticated. | [
"Try",
"to",
"authenticate",
"a",
"pre",
"-",
"authenticated",
"user",
"with",
"Spring",
"Security",
"if",
"the",
"user",
"has",
"not",
"yet",
"been",
"authenticated",
"."
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java#L109-L122 | test | Check secure context token. | Of course, here is the Java code you requested:
```java
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if (logger.isDebugEnabled()) {
logger.debug("Checking secure context token: "
+ SecurityContextHolder.getContext().getAu... |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/tiles/features/FeatureTileCanvas.java | FeatureTileCanvas.createBitmapAndCanvas | private void createBitmapAndCanvas(int layer) {
layeredBitmap[layer] = Bitmap.createBitmap(tileWidth,
tileHeight, Bitmap.Config.ARGB_8888);
layeredCanvas[layer] = new Canvas(layeredBitmap[layer]);
} | java | private void createBitmapAndCanvas(int layer) {
layeredBitmap[layer] = Bitmap.createBitmap(tileWidth,
tileHeight, Bitmap.Config.ARGB_8888);
layeredCanvas[layer] = new Canvas(layeredBitmap[layer]);
} | [
"private",
"void",
"createBitmapAndCanvas",
"(",
"int",
"layer",
")",
"{",
"layeredBitmap",
"[",
"layer",
"]",
"=",
"Bitmap",
".",
"createBitmap",
"(",
"tileWidth",
",",
"tileHeight",
",",
"Bitmap",
".",
"Config",
".",
"ARGB_8888",
")",
";",
"layeredCanvas",
... | Create a new empty Bitmap and Canvas
@param layer layer index | [
"Create",
"a",
"new",
"empty",
"Bitmap",
"and",
"Canvas"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/tiles/features/FeatureTileCanvas.java#L220-L224 | test | Create bitmap and canvas for a given layer | Of course, here is the Java code you requested:
```java
private void createBitmapAndCanvas(int layer) {
layeredBitmap[layer] = Bitmap.createBitmap(tileWidth,
tileHeight, Bitmap.Config.ARGB_8888);
layeredCanvas[layer] = new Canvas(layeredBitmap[layer]);
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/ucar/nc2/util/EscapeStrings.java | EscapeStrings.backslashUnescape | static public String backslashUnescape(String x) {
if (!x.contains("\\")) return x;
// gotta do it
StringBuilder sb = new StringBuilder(x.length());
for (int pos = 0; pos < x.length(); pos++) {
char c = x.charAt(pos);
if (c == '\\') {
c = x.charAt(++pos); // skip backslash, get next... | java | static public String backslashUnescape(String x) {
if (!x.contains("\\")) return x;
// gotta do it
StringBuilder sb = new StringBuilder(x.length());
for (int pos = 0; pos < x.length(); pos++) {
char c = x.charAt(pos);
if (c == '\\') {
c = x.charAt(++pos); // skip backslash, get next... | [
"static",
"public",
"String",
"backslashUnescape",
"(",
"String",
"x",
")",
"{",
"if",
"(",
"!",
"x",
".",
"contains",
"(",
"\"\\\\\"",
")",
")",
"return",
"x",
";",
"// gotta do it",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"x",
".",
"le... | backslash unescape a string
@param x unescape this
@return string with \c -> c | [
"backslash",
"unescape",
"a",
"string"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/util/EscapeStrings.java#L390-L404 | test | Unescapes a string. | Of course, here is the Java code you requested:
```java
static public String backslashUnescape(String x) {
if (!x.contains("\\")) return x;
// gotta do it
StringBuilder sb = new StringBuilder(x.length());
for (int pos = 0; pos < x.length(); pos++) {
char c = x.charAt(pos);
if (c == '\\') {... |
jboss/jboss-common-core | src/main/java/org/jboss/util/collection/WeakSet.java | WeakSet.maintain | protected final void maintain() {
WeakObject weak;
while ((weak = (WeakObject)queue.poll()) != null) {
set.remove(weak);
}
} | java | protected final void maintain() {
WeakObject weak;
while ((weak = (WeakObject)queue.poll()) != null) {
set.remove(weak);
}
} | [
"protected",
"final",
"void",
"maintain",
"(",
")",
"{",
"WeakObject",
"weak",
";",
"while",
"(",
"(",
"weak",
"=",
"(",
"WeakObject",
")",
"queue",
".",
"poll",
"(",
")",
")",
"!=",
"null",
")",
"{",
"set",
".",
"remove",
"(",
"weak",
")",
";",
... | Maintain the elements in the set. Removes objects from the set that
have been reclaimed due to GC. | [
"Maintain",
"the",
"elements",
"in",
"the",
"set",
".",
"Removes",
"objects",
"from",
"the",
"set",
"that",
"have",
"been",
"reclaimed",
"due",
"to",
"GC",
"."
] | c191bb18db83fa106c6913cf34ed47989b65dc97 | https://github.com/jboss/jboss-common-core/blob/c191bb18db83fa106c6913cf34ed47989b65dc97/src/main/java/org/jboss/util/collection/WeakSet.java#L87-L92 | test | Maintain the weak objects in the set. | Of course, here is the Java code you requested:
```java
protected final void maintain() {
WeakObject weak;
while ((weak = (WeakObject)queue.poll()) != null) {
set.remove(weak);
}
}
```
Hope this helps! |
oblac/jodd | jodd-core/src/main/java/jodd/util/StringUtil.java | StringUtil.toHexString | public static String toHexString(final byte[] bytes) {
char[] chars = new char[bytes.length * 2];
int i = 0;
for (byte b : bytes) {
chars[i++] = CharUtil.int2hex((b & 0xF0) >> 4);
chars[i++] = CharUtil.int2hex(b & 0x0F);
}
return new String(chars);
} | java | public static String toHexString(final byte[] bytes) {
char[] chars = new char[bytes.length * 2];
int i = 0;
for (byte b : bytes) {
chars[i++] = CharUtil.int2hex((b & 0xF0) >> 4);
chars[i++] = CharUtil.int2hex(b & 0x0F);
}
return new String(chars);
} | [
"public",
"static",
"String",
"toHexString",
"(",
"final",
"byte",
"[",
"]",
"bytes",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"new",
"char",
"[",
"bytes",
".",
"length",
"*",
"2",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"byte",
"b",
... | Converts bytes to hex string. | [
"Converts",
"bytes",
"to",
"hex",
"string",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-core/src/main/java/jodd/util/StringUtil.java#L2769-L2779 | test | Converts a byte array to a hex string. | Of course, here is the Java code you requested:
```java
public static String toHexString(final byte[] bytes) {
char[] chars = new char[bytes.length * 2];
int i = 0;
for (byte b : bytes) {
chars[i++] = CharUtil.int2hex((b & 0xF0) >> 4);
chars[i++] = CharUtil.int2hex(b & 0x0F);
}
return new String(char... |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/orient/core/record/ORecordInternal.java | ORecordInternal.setIdentity | public static ORecordAbstract setIdentity(final ORecord record, final ORecordId iIdentity) {
final ORecordAbstract rec = (ORecordAbstract) record;
rec.setIdentity(iIdentity);
return rec;
} | java | public static ORecordAbstract setIdentity(final ORecord record, final ORecordId iIdentity) {
final ORecordAbstract rec = (ORecordAbstract) record;
rec.setIdentity(iIdentity);
return rec;
} | [
"public",
"static",
"ORecordAbstract",
"setIdentity",
"(",
"final",
"ORecord",
"record",
",",
"final",
"ORecordId",
"iIdentity",
")",
"{",
"final",
"ORecordAbstract",
"rec",
"=",
"(",
"ORecordAbstract",
")",
"record",
";",
"rec",
".",
"setIdentity",
"(",
"iIdent... | Internal only. Changes the identity of the record. | [
"Internal",
"only",
".",
"Changes",
"the",
"identity",
"of",
"the",
"record",
"."
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/orient/core/record/ORecordInternal.java#L61-L65 | test | Sets the identity of the record. | Of course, here is the Java code you requested:
```java
public static ORecordAbstract setIdentity(final ORecord record, final ORecordId iIdentity) {
final ORecordAbstract rec = (ORecordAbstract) record;
rec.setIdentity(iIdentity);
return rec;
}
```
Hope this helps! |
rupertlssmith/lojix | lojix/logic/src/main/com/thesett/aima/logic/fol/builder/TermBuilder.java | TermBuilder.functor | public Functor functor(String name, Term... args)
{
int internedName = interner.internFunctorName(name, args.length);
return new Functor(internedName, args);
} | java | public Functor functor(String name, Term... args)
{
int internedName = interner.internFunctorName(name, args.length);
return new Functor(internedName, args);
} | [
"public",
"Functor",
"functor",
"(",
"String",
"name",
",",
"Term",
"...",
"args",
")",
"{",
"int",
"internedName",
"=",
"interner",
".",
"internFunctorName",
"(",
"name",
",",
"args",
".",
"length",
")",
";",
"return",
"new",
"Functor",
"(",
"internedName... | Creates a functor.
@param name The name of the functor.
@param args The functors arguments.
@return A functor. | [
"Creates",
"a",
"functor",
"."
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/logic/src/main/com/thesett/aima/logic/fol/builder/TermBuilder.java#L71-L76 | test | Create a functor object from a name and a list of terms. | Of course, here is the Java code you requested:
```java
public Functor functor(String name, Term... args)
{
int internedName = interner.internFunctorName(name, args.length);
return new Functor(internedName, args);
}
```
Hope this helps! |
Unidata/thredds | tds/src/main/java/thredds/server/ncss/params/NcssParamsBean.java | NcssParamsBean.getCalendarDateRange | public CalendarDateRange getCalendarDateRange(Calendar cal) {
if (dateRange == null) return null;
if (cal.equals(Calendar.getDefault())) return dateRange;
// otherwise must reparse
return makeCalendarDateRange(cal);
} | java | public CalendarDateRange getCalendarDateRange(Calendar cal) {
if (dateRange == null) return null;
if (cal.equals(Calendar.getDefault())) return dateRange;
// otherwise must reparse
return makeCalendarDateRange(cal);
} | [
"public",
"CalendarDateRange",
"getCalendarDateRange",
"(",
"Calendar",
"cal",
")",
"{",
"if",
"(",
"dateRange",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"cal",
".",
"equals",
"(",
"Calendar",
".",
"getDefault",
"(",
")",
")",
")",
"return",
... | return requested CalendarDateRange. | [
"return",
"requested",
"CalendarDateRange",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/tds/src/main/java/thredds/server/ncss/params/NcssParamsBean.java#L261-L267 | test | Get a CalendarDateRange object for the given Calendar. | Of course, here is the Java code you requested:
```java
public CalendarDateRange getCalendarDateRange(Calendar cal) {
if (dateRange == null) return null;
if (cal.equals(Calendar.getDefault())) return dateRange;
// otherwise must reparse
return makeCalendarDateRange(cal);
}
```
Hope this helps! |
apache/parquet-mr | parquet-thrift/src/main/java/org/apache/parquet/thrift/ParquetWriteProtocol.java | ParquetWriteProtocol.writeBool | @Override
public void writeBool(boolean b) throws TException {
LOG.debug("writeBool({})", b);
currentProtocol.writeBool(b);
} | java | @Override
public void writeBool(boolean b) throws TException {
LOG.debug("writeBool({})", b);
currentProtocol.writeBool(b);
} | [
"@",
"Override",
"public",
"void",
"writeBool",
"(",
"boolean",
"b",
")",
"throws",
"TException",
"{",
"LOG",
".",
"debug",
"(",
"\"writeBool({})\"",
",",
"b",
")",
";",
"currentProtocol",
".",
"writeBool",
"(",
"b",
")",
";",
"}"
] | {@inheritDoc}
@see org.apache.parquet.thrift.ParquetProtocol#writeBool(boolean) | [
"{"
] | 62dcc68acaf64012bf731e103be780956f1f446d | https://github.com/apache/parquet-mr/blob/62dcc68acaf64012bf731e103be780956f1f446d/parquet-thrift/src/main/java/org/apache/parquet/thrift/ParquetWriteProtocol.java#L571-L575 | test | Write a boolean value. | Of course, here is the Java code you requested:
```java
@Override
public void writeBool(boolean b) throws TException {
LOG.debug("writeBool({})", b);
currentProtocol.writeBool(b);
}
```
Hope this helps! |
oblac/jodd | jodd-madvoc/src/main/java/jodd/madvoc/component/ActionConfigManager.java | ActionConfigManager.registerAnnotation | public void registerAnnotation(final Class<? extends Annotation> annotationType) {
final ActionConfiguredBy actionConfiguredBy = annotationType.getAnnotation(ActionConfiguredBy.class);
if (actionConfiguredBy == null) {
throw new MadvocException("Action annotation is missing it's " + ActionConfiguredBy.class.get... | java | public void registerAnnotation(final Class<? extends Annotation> annotationType) {
final ActionConfiguredBy actionConfiguredBy = annotationType.getAnnotation(ActionConfiguredBy.class);
if (actionConfiguredBy == null) {
throw new MadvocException("Action annotation is missing it's " + ActionConfiguredBy.class.get... | [
"public",
"void",
"registerAnnotation",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"final",
"ActionConfiguredBy",
"actionConfiguredBy",
"=",
"annotationType",
".",
"getAnnotation",
"(",
"ActionConfiguredBy",
".",
"class"... | Registers action configuration for given annotation. New {@link ActionConfig} is created
and stored. | [
"Registers",
"action",
"configuration",
"for",
"given",
"annotation",
".",
"New",
"{"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-madvoc/src/main/java/jodd/madvoc/component/ActionConfigManager.java#L58-L66 | test | Registers an annotation. | Of course, here is the Java code you requested:
```java
public void registerAnnotation(final Class<? extends Annotation> annotationType) {
final ActionConfiguredBy actionConfiguredBy = annotationType.getAnnotation(ActionConfiguredBy.class);
if (actionConfiguredBy == null) {
throw new MadvocException("Action an... |
tony19/logback-android | logback-android/src/main/java/ch/qos/logback/core/FileAppender.java | FileAppender.setFile | public void setFile(String file) {
if (file == null) {
fileName = null;
} else {
// Trim spaces from both ends. The users probably does not want
// trailing spaces in file names.
fileName = file.trim();
}
} | java | public void setFile(String file) {
if (file == null) {
fileName = null;
} else {
// Trim spaces from both ends. The users probably does not want
// trailing spaces in file names.
fileName = file.trim();
}
} | [
"public",
"void",
"setFile",
"(",
"String",
"file",
")",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"fileName",
"=",
"null",
";",
"}",
"else",
"{",
"// Trim spaces from both ends. The users probably does not want",
"// trailing spaces in file names.",
"fileName",... | The <b>File</b> property takes a string value which should be the name of
the file to append to.
@param file path to destination log file | [
"The",
"<b",
">",
"File<",
"/",
"b",
">",
"property",
"takes",
"a",
"string",
"value",
"which",
"should",
"be",
"the",
"name",
"of",
"the",
"file",
"to",
"append",
"to",
"."
] | 028489c11ccfc1237a53923db06f22a90b41809c | https://github.com/tony19/logback-android/blob/028489c11ccfc1237a53923db06f22a90b41809c/logback-android/src/main/java/ch/qos/logback/core/FileAppender.java#L67-L75 | test | Sets the file name. | Of course, here is the Java code you requested:
```java
public void setFile(String file) {
if (file == null) {
fileName = null;
} else {
// Trim spaces from both ends. The users probably does not want
// trailing spaces in file names.
fileName = file.trim();
}
}
```
Hope this hel... |
Unidata/thredds | cdm/src/main/java/ucar/nc2/ft2/simpgeometry/CFPolygon.java | CFPolygon.setupPolygon | public Polygon setupPolygon(NetcdfDataset dataset, Variable polyvar, int index)
{
this.points.clear();
Array xPts = null;
Array yPts = null;
Variable nodeCounts = null;
Variable partNodeCounts = null;
Variable interiorRings = null;
List<CoordinateAxis> axes = dataset.getCoordinateAxes();
Coo... | java | public Polygon setupPolygon(NetcdfDataset dataset, Variable polyvar, int index)
{
this.points.clear();
Array xPts = null;
Array yPts = null;
Variable nodeCounts = null;
Variable partNodeCounts = null;
Variable interiorRings = null;
List<CoordinateAxis> axes = dataset.getCoordinateAxes();
Coo... | [
"public",
"Polygon",
"setupPolygon",
"(",
"NetcdfDataset",
"dataset",
",",
"Variable",
"polyvar",
",",
"int",
"index",
")",
"{",
"this",
".",
"points",
".",
"clear",
"(",
")",
";",
"Array",
"xPts",
"=",
"null",
";",
"Array",
"yPts",
"=",
"null",
";",
"... | Given a dataset, variable and index, automatically sets up a previously constructed polygon.
If the specified polygon is not found in the dataset, returns null
@param dataset which the variable is a part of
@param polyvar the variable which has a geometry attribute
@param index of the polygon within the variable | [
"Given",
"a",
"dataset",
"variable",
"and",
"index",
"automatically",
"sets",
"up",
"a",
"previously",
"constructed",
"polygon",
".",
"If",
"the",
"specified",
"polygon",
"is",
"not",
"found",
"in",
"the",
"dataset",
"returns",
"null"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/ft2/simpgeometry/CFPolygon.java#L188-L360 | test | Creates a new Polygon object based on the data in the specified polyvar. | Of course, here is the Java code you requested:
```java
public Polygon setupPolygon(NetcdfDataset dataset, Variable polyvar, int index)
{
this.points.clear();
Array xPts = null;
Array yPts = null;
Variable nodeCounts = null;
Variable partNodeCounts = null;
Variable interiorRings = null;
List<C... |
arnohaase/a-foundation | a-foundation-benchmark/src/main/java/com/ajjpj/afoundation/concurrent/jdk/j9new/ForkJoinPool.java | ForkJoinPool.tryCompensate | private boolean tryCompensate(WorkQueue w) {
boolean canBlock;
WorkQueue[] ws; long c; int m, pc, sp;
if (w == null || w.qlock < 0 || // caller terminating
(ws = workQueues) == null || (m = ws.length - 1) <= 0 ||
(pc = config & SMASK) == 0) // parallel... | java | private boolean tryCompensate(WorkQueue w) {
boolean canBlock;
WorkQueue[] ws; long c; int m, pc, sp;
if (w == null || w.qlock < 0 || // caller terminating
(ws = workQueues) == null || (m = ws.length - 1) <= 0 ||
(pc = config & SMASK) == 0) // parallel... | [
"private",
"boolean",
"tryCompensate",
"(",
"WorkQueue",
"w",
")",
"{",
"boolean",
"canBlock",
";",
"WorkQueue",
"[",
"]",
"ws",
";",
"long",
"c",
";",
"int",
"m",
",",
"pc",
",",
"sp",
";",
"if",
"(",
"w",
"==",
"null",
"||",
"w",
".",
"qlock",
... | Tries to decrement active count (sometimes implicitly) and
possibly release or create a compensating worker in preparation
for blocking. Returns false (retryable by caller), on
contention, detected staleness, instability, or termination.
@param w caller | [
"Tries",
"to",
"decrement",
"active",
"count",
"(",
"sometimes",
"implicitly",
")",
"and",
"possibly",
"release",
"or",
"create",
"a",
"compensating",
"worker",
"in",
"preparation",
"for",
"blocking",
".",
"Returns",
"false",
"(",
"retryable",
"by",
"caller",
... | f3eef2ca89d67775f202a4c28140230a6229291e | https://github.com/arnohaase/a-foundation/blob/f3eef2ca89d67775f202a4c28140230a6229291e/a-foundation-benchmark/src/main/java/com/ajjpj/afoundation/concurrent/jdk/j9new/ForkJoinPool.java#L1983-L2026 | test | Try to compensate a worker. | Of course, here is the Java code you requested:
```java
private boolean tryCompensate(WorkQueue w) {
boolean canBlock;
WorkQueue[] ws; long c; int m, pc, sp;
if (w == null || w.qlock < 0 || // caller terminating
(ws = workQueues) == null || (m = ws.length - 1) <= 0 ||
... |
kocakosm/pitaya | src/org/kocakosm/pitaya/util/Strings.java | Strings.stripLeft | public static String stripLeft(String str, int n)
{
Parameters.checkCondition(n >= 0);
int start = Math.min(str.length(), n);
return str.substring(start);
} | java | public static String stripLeft(String str, int n)
{
Parameters.checkCondition(n >= 0);
int start = Math.min(str.length(), n);
return str.substring(start);
} | [
"public",
"static",
"String",
"stripLeft",
"(",
"String",
"str",
",",
"int",
"n",
")",
"{",
"Parameters",
".",
"checkCondition",
"(",
"n",
">=",
"0",
")",
";",
"int",
"start",
"=",
"Math",
".",
"min",
"(",
"str",
".",
"length",
"(",
")",
",",
"n",
... | Returns the new {@code String} obtained by stripping the first
{@code n} characters from the given one.
@param str the {@code String} to be stripped.
@param n the number of characters to strip.
@return the stripped {@code String}.
@throws NullPointerException if {@code str} is {@code null}.
@throws IllegalArgumentEx... | [
"Returns",
"the",
"new",
"{",
"@code",
"String",
"}",
"obtained",
"by",
"stripping",
"the",
"first",
"{",
"@code",
"n",
"}",
"characters",
"from",
"the",
"given",
"one",
"."
] | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/util/Strings.java#L394-L399 | test | Strips the left n chars from the beginning of the string. | Of course, here is the Java code you requested:
```java
public static String stripLeft(String str, int n)
{
Parameters.checkCondition(n >= 0);
int start = Math.min(str.length(), n);
return str.substring(start);
}
```
Hope this helps! |
eclipse/packagedrone | bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/Parser.java | Parser.parseDeclaration | private void parseDeclaration(Node parent) throws JasperException {
start = reader.mark();
Mark stop = reader.skipUntil("%>");
if (stop == null) {
err.jspError(start, "jsp.error.unterminated", "<%!");
}
new Node.Declaration(parseScriptText(reader.getText(start, stop)),
start, parent);
} | java | private void parseDeclaration(Node parent) throws JasperException {
start = reader.mark();
Mark stop = reader.skipUntil("%>");
if (stop == null) {
err.jspError(start, "jsp.error.unterminated", "<%!");
}
new Node.Declaration(parseScriptText(reader.getText(start, stop)),
start, parent);
} | [
"private",
"void",
"parseDeclaration",
"(",
"Node",
"parent",
")",
"throws",
"JasperException",
"{",
"start",
"=",
"reader",
".",
"mark",
"(",
")",
";",
"Mark",
"stop",
"=",
"reader",
".",
"skipUntil",
"(",
"\"%>\"",
")",
";",
"if",
"(",
"stop",
"==",
... | /*
DeclarationBody ::= (Char* - (char* '%>')) '%>' | [
"/",
"*",
"DeclarationBody",
"::",
"=",
"(",
"Char",
"*",
"-",
"(",
"char",
"*",
"%",
">",
"))",
"%",
">"
] | 3869c1643cdc6f7cb8b26097a7b6994683b13d7e | https://github.com/eclipse/packagedrone/blob/3869c1643cdc6f7cb8b26097a7b6994683b13d7e/bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/Parser.java#L741-L750 | test | Parse a declaration. | Of course, here is the Java code you requested:
```java
private void parseDeclaration(Node parent) throws JasperException {
start = reader.mark();
Mark stop = reader.skipUntil("%>");
if (stop == null) {
err.jspError(start, "jsp.error.unterminated", "<%!");
}
new Node.Declaration(parseScriptText(reader.ge... |
rockagen/commons-lib | src/main/java/com/rockagen/commons/http/HttpConn.java | HttpConn.getResponse | public static String getResponse(HttpResponse response, String encoding) throws IOException {
log.debug("status: {}", response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
String retval = "";
if (entity != null) {
try {
if (CommU... | java | public static String getResponse(HttpResponse response, String encoding) throws IOException {
log.debug("status: {}", response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
String retval = "";
if (entity != null) {
try {
if (CommU... | [
"public",
"static",
"String",
"getResponse",
"(",
"HttpResponse",
"response",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"log",
".",
"debug",
"(",
"\"status: {}\"",
",",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
... | Handle response (resolve response to String,httpClient close,etc.)
@param response {@link HttpResponse}
@param encoding the encoding,default is {@link #ENCODING}
@return result String
@throws IOException if an I/O error occurs | [
"Handle",
"response",
"(",
"resolve",
"response",
"to",
"String",
"httpClient",
"close",
"etc",
".",
")"
] | f37141cf40be79d130db804c39ce61690541d5f1 | https://github.com/rockagen/commons-lib/blob/f37141cf40be79d130db804c39ce61690541d5f1/src/main/java/com/rockagen/commons/http/HttpConn.java#L1446-L1463 | test | Gets the response as a String. | Of course, here is the Java code you requested:
```java
public static String getResponse(HttpResponse response, String encoding) throws IOException {
log.debug("status: {}", response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
String retval = "";
if (enti... |
fabric8io/fabric8-maven-plugin | core/src/main/java/io/fabric8/maven/core/util/ProfileUtil.java | ProfileUtil.getMetaInfProfilePaths | private static List<String> getMetaInfProfilePaths(String ext) {
List<String> ret = new ArrayList<>(PROFILE_FILENAMES.length);
for (String p : PROFILE_FILENAMES) {
ret.add("META-INF/fabric8/" + getProfileFileName(p,ext));
}
return ret;
} | java | private static List<String> getMetaInfProfilePaths(String ext) {
List<String> ret = new ArrayList<>(PROFILE_FILENAMES.length);
for (String p : PROFILE_FILENAMES) {
ret.add("META-INF/fabric8/" + getProfileFileName(p,ext));
}
return ret;
} | [
"private",
"static",
"List",
"<",
"String",
">",
"getMetaInfProfilePaths",
"(",
"String",
"ext",
")",
"{",
"List",
"<",
"String",
">",
"ret",
"=",
"new",
"ArrayList",
"<>",
"(",
"PROFILE_FILENAMES",
".",
"length",
")",
";",
"for",
"(",
"String",
"p",
":"... | prepend meta-inf location | [
"prepend",
"meta",
"-",
"inf",
"location"
] | b0e7ad860a5bbe4ab71be3d0613862a1f14a8be3 | https://github.com/fabric8io/fabric8-maven-plugin/blob/b0e7ad860a5bbe4ab71be3d0613862a1f14a8be3/core/src/main/java/io/fabric8/maven/core/util/ProfileUtil.java#L214-L220 | test | Get the list of profile paths for the specified file extension. | Of course, here is the Java code you requested:
```java
private static List<String> getMetaInfProfilePaths(String ext) {
List<String> ret = new ArrayList<>(PROFILE_FILENAMES.length);
for (String p : PROFILE_FILENAMES) {
ret.add("META-INF/fabric8/" + getProfileFileName(p,ext));
}
... |
Unidata/thredds | opendap/src/main/java/opendap/dap/DDS.java | DDS.parseXML | public void parseXML(InputStream is, boolean validation) throws DAP2Exception
{
DDSXMLParser dp = new DDSXMLParser(opendapNameSpace);
dp.parse(is, this, factory, validation);
// Check for name conflicts. IN the XML representation
// of the DDS it is syntactically possible for a
... | java | public void parseXML(InputStream is, boolean validation) throws DAP2Exception
{
DDSXMLParser dp = new DDSXMLParser(opendapNameSpace);
dp.parse(is, this, factory, validation);
// Check for name conflicts. IN the XML representation
// of the DDS it is syntactically possible for a
... | [
"public",
"void",
"parseXML",
"(",
"InputStream",
"is",
",",
"boolean",
"validation",
")",
"throws",
"DAP2Exception",
"{",
"DDSXMLParser",
"dp",
"=",
"new",
"DDSXMLParser",
"(",
"opendapNameSpace",
")",
";",
"dp",
".",
"parse",
"(",
"is",
",",
"this",
",",
... | Reads a <b>DDX</b> from the named <code>InputStream</code>. This
method calls a generated parser to interpret an XML representation of a
<code>DDS</code> (aka a <b>DDX</b>), and instantiate that
<code>DDS</code> in memory. This method does the following:
<ul>
<li> Gets a new <code>DDSXMLParser</code> using the <code>Ba... | [
"Reads",
"a",
"<b",
">",
"DDX<",
"/",
"b",
">",
"from",
"the",
"named",
"<code",
">",
"InputStream<",
"/",
"code",
">",
".",
"This",
"method",
"calls",
"a",
"generated",
"parser",
"to",
"interpret",
"an",
"XML",
"representation",
"of",
"a",
"<code",
">... | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/opendap/src/main/java/opendap/dap/DDS.java#L1105-L1134 | test | Parse the XML representation of the a
specification. | Of course, here is the Java code you requested:
```java
public void parseXML(InputStream is, boolean validation) throws DAP2Exception
{
DDSXMLParser dp = new DDSXMLParser(opendapNameSpace);
dp.parse(is, this, factory, validation);
// Check for name conflicts. IN the XML representation
... |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/factory/GeoPackageManagerImpl.java | GeoPackageManagerImpl.importGeoPackage | @Override
public boolean importGeoPackage(String database, InputStream stream) {
return importGeoPackage(database, stream, false, null);
} | java | @Override
public boolean importGeoPackage(String database, InputStream stream) {
return importGeoPackage(database, stream, false, null);
} | [
"@",
"Override",
"public",
"boolean",
"importGeoPackage",
"(",
"String",
"database",
",",
"InputStream",
"stream",
")",
"{",
"return",
"importGeoPackage",
"(",
"database",
",",
"stream",
",",
"false",
",",
"null",
")",
";",
"}"
] | {@inheritDoc} | [
"{"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/factory/GeoPackageManagerImpl.java#L592-L595 | test | Import a CRS package from a GeoPackage file. | Of course, here is the Java code you requested:
```java
@Override
public boolean importGeoPackage(String database, InputStream stream) {
return importGeoPackage(database, stream, false, null);
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/ucar/nc2/dataset/conv/ADASConvention.java | ADASConvention.makeCoordAxis | private CoordinateAxis makeCoordAxis(NetcdfDataset ds, String axisName) throws IOException {
Variable stagV = ds.findVariable(axisName + "_stag");
Array data_stag = stagV.read();
int n = (int) data_stag.getSize() - 1;
DataType dt = DataType.getType(data_stag);
Array data = Array.factory(dt, new... | java | private CoordinateAxis makeCoordAxis(NetcdfDataset ds, String axisName) throws IOException {
Variable stagV = ds.findVariable(axisName + "_stag");
Array data_stag = stagV.read();
int n = (int) data_stag.getSize() - 1;
DataType dt = DataType.getType(data_stag);
Array data = Array.factory(dt, new... | [
"private",
"CoordinateAxis",
"makeCoordAxis",
"(",
"NetcdfDataset",
"ds",
",",
"String",
"axisName",
")",
"throws",
"IOException",
"{",
"Variable",
"stagV",
"=",
"ds",
".",
"findVariable",
"(",
"axisName",
"+",
"\"_stag\"",
")",
";",
"Array",
"data_stag",
"=",
... | //////////////////////////////////////////////////////////////////////////////////////////// | [
"////////////////////////////////////////////////////////////////////////////////////////////"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/dataset/conv/ADASConvention.java#L242-L260 | test | Make a coordinate axis from a sparse dataset. | Of course, here is the Java code you requested:
```java
private CoordinateAxis makeCoordAxis(NetcdfDataset ds, String axisName) throws IOException {
Variable stagV = ds.findVariable(axisName + "_stag");
Array data_stag = stagV.read();
int n = (int) data_stag.getSize() - 1;
DataType dt = DataType.ge... |
oblac/jodd | jodd-servlet/src/main/java/jodd/servlet/wrapper/BufferResponseWrapper.java | BufferResponseWrapper.writeContentToResponse | public void writeContentToResponse(final char[] content) throws IOException {
if (buffer == null) {
return;
}
if (buffer.isUsingStream()) {
ServletOutputStream outputStream = getResponse().getOutputStream();
String encoding = getContentTypeEncoding();
if (encoding == null) {
outputStream.write(Ch... | java | public void writeContentToResponse(final char[] content) throws IOException {
if (buffer == null) {
return;
}
if (buffer.isUsingStream()) {
ServletOutputStream outputStream = getResponse().getOutputStream();
String encoding = getContentTypeEncoding();
if (encoding == null) {
outputStream.write(Ch... | [
"public",
"void",
"writeContentToResponse",
"(",
"final",
"char",
"[",
"]",
"content",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"buffer",
".",
"isUsingStream",
"(",
")",
")",
"{",
"S... | Writes content to original output stream, using either output stream or writer, depending
on how the content was buffered. It is assumed that provided content is a modified
wrapped content. | [
"Writes",
"content",
"to",
"original",
"output",
"stream",
"using",
"either",
"output",
"stream",
"or",
"writer",
"depending",
"on",
"how",
"the",
"content",
"was",
"buffered",
".",
"It",
"is",
"assumed",
"that",
"provided",
"content",
"is",
"a",
"modified",
... | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-servlet/src/main/java/jodd/servlet/wrapper/BufferResponseWrapper.java#L233-L253 | test | Write the content to the response. | Of course, here is the Java code you requested:
```java
public void writeContentToResponse(final char[] content) throws IOException {
if (buffer == null) {
return;
}
if (buffer.isUsingStream()) {
ServletOutputStream outputStream = getResponse().getOutputStream();
String encoding = getContentTypeEncodin... |
RestComm/jain-slee | container/components/components/src/main/java/org/mobicents/slee/container/component/deployment/DeployableUnitImpl.java | DeployableUnitImpl.getDeployableUnitComponents | public Set<SleeComponent> getDeployableUnitComponents() {
Set<SleeComponent> result = new HashSet<SleeComponent>();
result.addAll(getEventTypeComponents().values());
result.addAll(getLibraryComponents().values());
result.addAll(getProfileSpecificationComponents().values());
result.addAll(getResourceAdapt... | java | public Set<SleeComponent> getDeployableUnitComponents() {
Set<SleeComponent> result = new HashSet<SleeComponent>();
result.addAll(getEventTypeComponents().values());
result.addAll(getLibraryComponents().values());
result.addAll(getProfileSpecificationComponents().values());
result.addAll(getResourceAdapt... | [
"public",
"Set",
"<",
"SleeComponent",
">",
"getDeployableUnitComponents",
"(",
")",
"{",
"Set",
"<",
"SleeComponent",
">",
"result",
"=",
"new",
"HashSet",
"<",
"SleeComponent",
">",
"(",
")",
";",
"result",
".",
"addAll",
"(",
"getEventTypeComponents",
"(",
... | Returns an unmodifiable set with all {@link AbstractSleeComponent}s of the
deployable unit.
@return | [
"Returns",
"an",
"unmodifiable",
"set",
"with",
"all",
"{",
"@link",
"AbstractSleeComponent",
"}",
"s",
"of",
"the",
"deployable",
"unit",
"."
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/components/components/src/main/java/org/mobicents/slee/container/component/deployment/DeployableUnitImpl.java#L264-L274 | test | Gets the components that are deployable by this deployable unit. | Of course, here is the Java code you requested:
```java
public Set<SleeComponent> getDeployableUnitComponents() {
Set<SleeComponent> result = new HashSet<SleeComponent>();
result.addAll(getEventTypeComponents().values());
result.addAll(getLibraryComponents().values());
result.addAll(getProfileSpecification... |
Unidata/thredds | dap4/d4core/src/main/java/dap4/core/data/DSPRegistry.java | DSPRegistry.unregister | synchronized public void
unregister(Class<? extends DSP> klass)
{
for(int i = 0; i < registry.size(); i++) {
if(registry.get(i).dspclass == klass) {
registry.remove(i);
break;
}
}
} | java | synchronized public void
unregister(Class<? extends DSP> klass)
{
for(int i = 0; i < registry.size(); i++) {
if(registry.get(i).dspclass == klass) {
registry.remove(i);
break;
}
}
} | [
"synchronized",
"public",
"void",
"unregister",
"(",
"Class",
"<",
"?",
"extends",
"DSP",
">",
"klass",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"registry",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"registry",... | Unregister dsp.
@param klass Class for which to search | [
"Unregister",
"dsp",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/dap4/d4core/src/main/java/dap4/core/data/DSPRegistry.java#L140-L149 | test | Unregister a single DSP class from the list of DSP classes. | Of course, here is the Java code you requested:
```java
synchronized public void
unregister(Class<? extends DSP> klass)
{
for(int i = 0; i < registry.size(); i++) {
if(registry.get(i).dspclass == klass) {
registry.remove(i);
break;
}
}
... |
spring-projects/spring-security | oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupport.java | NimbusJwtDecoderJwkSupport.setJwtValidator | public void setJwtValidator(OAuth2TokenValidator<Jwt> jwtValidator) {
Assert.notNull(jwtValidator, "jwtValidator cannot be null");
this.jwtValidator = jwtValidator;
this.delegate.setJwtValidator(jwtValidator);
} | java | public void setJwtValidator(OAuth2TokenValidator<Jwt> jwtValidator) {
Assert.notNull(jwtValidator, "jwtValidator cannot be null");
this.jwtValidator = jwtValidator;
this.delegate.setJwtValidator(jwtValidator);
} | [
"public",
"void",
"setJwtValidator",
"(",
"OAuth2TokenValidator",
"<",
"Jwt",
">",
"jwtValidator",
")",
"{",
"Assert",
".",
"notNull",
"(",
"jwtValidator",
",",
"\"jwtValidator cannot be null\"",
")",
";",
"this",
".",
"jwtValidator",
"=",
"jwtValidator",
";",
"th... | Use this {@link Jwt} Validator
@param jwtValidator - the Jwt Validator to use | [
"Use",
"this",
"{",
"@link",
"Jwt",
"}",
"Validator"
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupport.java#L100-L104 | test | Sets the JWT validator. | Of course, here is the Java code you requested:
```java
public void setJwtValidator(OAuth2TokenValidator<Jwt> jwtValidator) {
Assert.notNull(jwtValidator, "jwtValidator cannot be null");
this.jwtValidator = jwtValidator;
this.delegate.setJwtValidator(jwtValidator);
}
```
Hope this helps! |
TooTallNate/Java-WebSocket | src/main/java/org/java_websocket/drafts/Draft_6455.java | Draft_6455.getByteBufferListSize | private long getByteBufferListSize() {
long totalSize = 0;
synchronized (byteBufferList) {
for (ByteBuffer buffer : byteBufferList) {
totalSize += buffer.limit();
}
}
return totalSize;
} | java | private long getByteBufferListSize() {
long totalSize = 0;
synchronized (byteBufferList) {
for (ByteBuffer buffer : byteBufferList) {
totalSize += buffer.limit();
}
}
return totalSize;
} | [
"private",
"long",
"getByteBufferListSize",
"(",
")",
"{",
"long",
"totalSize",
"=",
"0",
";",
"synchronized",
"(",
"byteBufferList",
")",
"{",
"for",
"(",
"ByteBuffer",
"buffer",
":",
"byteBufferList",
")",
"{",
"totalSize",
"+=",
"buffer",
".",
"limit",
"(... | Get the current size of the resulting bytebuffer in the bytebuffer list
@return the size as long (to not get an integer overflow) | [
"Get",
"the",
"current",
"size",
"of",
"the",
"resulting",
"bytebuffer",
"in",
"the",
"bytebuffer",
"list"
] | 73c6805ca2c7801b2828ffd3ec12e5cb0daefcf9 | https://github.com/TooTallNate/Java-WebSocket/blob/73c6805ca2c7801b2828ffd3ec12e5cb0daefcf9/src/main/java/org/java_websocket/drafts/Draft_6455.java#L1032-L1040 | test | Returns the total size of the byte buffer list. | Of course, here is the Java code you requested:
```java
private long getByteBufferListSize() {
long totalSize = 0;
synchronized (byteBufferList) {
for (ByteBuffer buffer : byteBufferList) {
totalSize += buffer.limit();
}
}
return totalSize;
}
```
Hope this helps! |
CAFapi/caf-common | util-ref/src/main/java/com/hpe/caf/util/ref/ReferencedObject.java | ReferencedObject.acquire | public synchronized T acquire(final DataSource source)
throws DataSourceException
{
if (object == null) {
if (getReference() == null) {
throw new IllegalStateException("No reference or object present");
} else {
object = source.getObject(getRef... | java | public synchronized T acquire(final DataSource source)
throws DataSourceException
{
if (object == null) {
if (getReference() == null) {
throw new IllegalStateException("No reference or object present");
} else {
object = source.getObject(getRef... | [
"public",
"synchronized",
"T",
"acquire",
"(",
"final",
"DataSource",
"source",
")",
"throws",
"DataSourceException",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"if",
"(",
"getReference",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalSta... | Return the referenced object, potentially performing a remote DataStore lookup and deserialisation. If the object is already
present or has been previously acquired, it is immediately returned.
@param source the implementation that provides object instances given the provided references
@return the object that this co... | [
"Return",
"the",
"referenced",
"object",
"potentially",
"performing",
"a",
"remote",
"DataStore",
"lookup",
"and",
"deserialisation",
".",
"If",
"the",
"object",
"is",
"already",
"present",
"or",
"has",
"been",
"previously",
"acquired",
"it",
"is",
"immediately",
... | c9e617cd0b39e19d9480653f8c82efee53dee885 | https://github.com/CAFapi/caf-common/blob/c9e617cd0b39e19d9480653f8c82efee53dee885/util-ref/src/main/java/com/hpe/caf/util/ref/ReferencedObject.java#L64-L75 | test | Get the object from the source. | Of course, here is the Java code you requested:
```java
public synchronized T acquire(final DataSource source)
throws DataSourceException
{
if (object == null) {
if (getReference() == null) {
throw new IllegalStateException("No reference or object present");
... |
oblac/jodd | jodd-petite/src/main/java/jodd/petite/scope/ShutdownAwareScope.java | ShutdownAwareScope.isBeanDestroyable | protected boolean isBeanDestroyable(final BeanData beanData) {
DestroyMethodPoint[] dmp = beanData.definition().destroyMethodPoints();
return dmp != null && dmp.length != 0;
} | java | protected boolean isBeanDestroyable(final BeanData beanData) {
DestroyMethodPoint[] dmp = beanData.definition().destroyMethodPoints();
return dmp != null && dmp.length != 0;
} | [
"protected",
"boolean",
"isBeanDestroyable",
"(",
"final",
"BeanData",
"beanData",
")",
"{",
"DestroyMethodPoint",
"[",
"]",
"dmp",
"=",
"beanData",
".",
"definition",
"(",
")",
".",
"destroyMethodPoints",
"(",
")",
";",
"return",
"dmp",
"!=",
"null",
"&&",
... | Returns <code>true</code> if bean is destroyable. | [
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"bean",
"is",
"destroyable",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-petite/src/main/java/jodd/petite/scope/ShutdownAwareScope.java#L45-L48 | test | Checks if the bean is destroyable. | Of course, here is the Java code you requested:
```java
protected boolean isBeanDestroyable(final BeanData beanData) {
DestroyMethodPoint[] dmp = beanData.definition().destroyMethodPoints();
return dmp != null && dmp.length != 0;
}
```
Hope this helps! |
spring-projects/spring-security | ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java | SpringSecurityLdapTemplate.searchForSingleAttributeValues | public Set<String> searchForSingleAttributeValues(final String base,
final String filter, final Object[] params, final String attributeName) {
String[] attributeNames = new String[] { attributeName };
Set<Map<String, List<String>>> multipleAttributeValues = searchForMultipleAttributeValues(
base, filter, par... | java | public Set<String> searchForSingleAttributeValues(final String base,
final String filter, final Object[] params, final String attributeName) {
String[] attributeNames = new String[] { attributeName };
Set<Map<String, List<String>>> multipleAttributeValues = searchForMultipleAttributeValues(
base, filter, par... | [
"public",
"Set",
"<",
"String",
">",
"searchForSingleAttributeValues",
"(",
"final",
"String",
"base",
",",
"final",
"String",
"filter",
",",
"final",
"Object",
"[",
"]",
"params",
",",
"final",
"String",
"attributeName",
")",
"{",
"String",
"[",
"]",
"attri... | Performs a search using the supplied filter and returns the union of the values of
the named attribute found in all entries matched by the search. Note that one
directory entry may have several values for the attribute. Intended for role
searches and similar scenarios.
@param base the DN to search in
@param filter sea... | [
"Performs",
"a",
"search",
"using",
"the",
"supplied",
"filter",
"and",
"returns",
"the",
"union",
"of",
"the",
"values",
"of",
"the",
"named",
"attribute",
"found",
"in",
"all",
"entries",
"matched",
"by",
"the",
"search",
".",
"Note",
"that",
"one",
"dir... | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java#L163-L176 | test | Search for single attribute values. | Of course, here is the Java code you requested:
```java
public Set<String> searchForSingleAttributeValues(final String base,
final String filter, final Object[] params, final String attributeName) {
String[] attributeNames = new String[] { attributeName };
Set<Map<String, List<String>>> multipleAttributeValues ... |
sikuli/sikuli-slides | src/main/java/org/sikuli/slides/api/Context.java | Context.render | public String render(String templateText) {
checkNotNull(templateText);
ST st = new ST(templateText);
for (Map.Entry<String, Object> e : parameters.entrySet()){
st.add(e.getKey(), e.getValue());
}
return st.render();
} | java | public String render(String templateText) {
checkNotNull(templateText);
ST st = new ST(templateText);
for (Map.Entry<String, Object> e : parameters.entrySet()){
st.add(e.getKey(), e.getValue());
}
return st.render();
} | [
"public",
"String",
"render",
"(",
"String",
"templateText",
")",
"{",
"checkNotNull",
"(",
"templateText",
")",
";",
"ST",
"st",
"=",
"new",
"ST",
"(",
"templateText",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"e",
... | Render the given template string as a string based on the parameter values
associated with this context
@param templateText the template string
@return the rendered string | [
"Render",
"the",
"given",
"template",
"string",
"as",
"a",
"string",
"based",
"on",
"the",
"parameter",
"values",
"associated",
"with",
"this",
"context"
] | 1a4a82cd97f577e0d7abe4218bf702e053acf003 | https://github.com/sikuli/sikuli-slides/blob/1a4a82cd97f577e0d7abe4218bf702e053acf003/src/main/java/org/sikuli/slides/api/Context.java#L146-L153 | test | Render the template with the parameters. | Of course, here is the Java code you requested:
```java
public String render(String templateText) {
checkNotNull(templateText);
ST st = new ST(templateText);
for (Map.Entry<String, Object> e : parameters.entrySet()){
st.add(e.getKey(), e.getValue());
}
return st.render();
}
```
Hope this helps! |
redraiment/jactiverecord | src/main/java/me/zzp/util/Seq.java | Seq.join | public static String join(Collection<?> list, String delimiter) {
if (list == null || list.isEmpty()) {
return "";
}
if (delimiter == null) {
delimiter = "";
}
StringBuilder s = new StringBuilder();
boolean first = true;
for (Object e : list) {
if (first) {
first =... | java | public static String join(Collection<?> list, String delimiter) {
if (list == null || list.isEmpty()) {
return "";
}
if (delimiter == null) {
delimiter = "";
}
StringBuilder s = new StringBuilder();
boolean first = true;
for (Object e : list) {
if (first) {
first =... | [
"public",
"static",
"String",
"join",
"(",
"Collection",
"<",
"?",
">",
"list",
",",
"String",
"delimiter",
")",
"{",
"if",
"(",
"list",
"==",
"null",
"||",
"list",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"delimit... | 将容器里的元素连接成字符串。
@param list 包含任意多个元素的容器。
@param delimiter 分隔符。
@return 连接后的字符串。 | [
"将容器里的元素连接成字符串。"
] | d051709c93204658e7f2cc96c9898201c7337269 | https://github.com/redraiment/jactiverecord/blob/d051709c93204658e7f2cc96c9898201c7337269/src/main/java/me/zzp/util/Seq.java#L83-L102 | test | Join a Collection of objects into a single String. | Of course, here is the Java code you requested:
```java
public static String join(Collection<?> list, String delimiter) {
if (list == null || list.isEmpty()) {
return "";
}
if (delimiter == null) {
delimiter = "";
}
StringBuilder s = new StringBuilder();
boolean first = true;
f... |
kocakosm/pitaya | src/org/kocakosm/pitaya/collection/Iterables.java | Iterables.limit | public static <T> Iterable<T> limit(Iterable<? extends T> iterable, int limit)
{
return new LimitIterable<T>(iterable, limit);
} | java | public static <T> Iterable<T> limit(Iterable<? extends T> iterable, int limit)
{
return new LimitIterable<T>(iterable, limit);
} | [
"public",
"static",
"<",
"T",
">",
"Iterable",
"<",
"T",
">",
"limit",
"(",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"iterable",
",",
"int",
"limit",
")",
"{",
"return",
"new",
"LimitIterable",
"<",
"T",
">",
"(",
"iterable",
",",
"limit",
")",
"... | Returns an {@code Iterable} view of the given {@code Iterable} that
will only return its first {@code limit} items. The returned view's
{@code Iterator}s support {@link Iterator#remove()} if the original
{@code Iterator} does.
@param <T> the type of the returned {@code Iterable}'s elements.
@param iterable the {@code ... | [
"Returns",
"an",
"{",
"@code",
"Iterable",
"}",
"view",
"of",
"the",
"given",
"{",
"@code",
"Iterable",
"}",
"that",
"will",
"only",
"return",
"its",
"first",
"{",
"@code",
"limit",
"}",
"items",
".",
"The",
"returned",
"view",
"s",
"{",
"@code",
"Iter... | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/collection/Iterables.java#L164-L167 | test | Returns an iterable that returns a limited iterable of the given iterable. | Of course, here is the Java code you requested:
```java
public static <T> Iterable<T> limit(Iterable<? extends T> iterable, int limit)
{
return new LimitIterable<T>(iterable, limit);
}
```
Hope this helps! |
playframework/playframework | core/play/src/main/java/play/mvc/Results.java | Results.status | public static Result status(int status, Path content, String fileName) {
return status(status, content, fileName, StaticFileMimeTypes.fileMimeTypes());
} | java | public static Result status(int status, Path content, String fileName) {
return status(status, content, fileName, StaticFileMimeTypes.fileMimeTypes());
} | [
"public",
"static",
"Result",
"status",
"(",
"int",
"status",
",",
"Path",
"content",
",",
"String",
"fileName",
")",
"{",
"return",
"status",
"(",
"status",
",",
"content",
",",
"fileName",
",",
"StaticFileMimeTypes",
".",
"fileMimeTypes",
"(",
")",
")",
... | Generates a result.
@param status the HTTP status for this result e.g. 200 (OK), 404 (NOT_FOUND)
@param content the path to send
@param fileName the name that the client should receive this path as
@return the result | [
"Generates",
"a",
"result",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/core/play/src/main/java/play/mvc/Results.java#L329-L331 | test | Returns a Result object with the given status code content and mime type. | Of course, here is the Java code you requested:
```java
public static Result status(int status, Path content, String fileName) {
return status(status, content, fileName, StaticFileMimeTypes.fileMimeTypes());
}
```
Hope this helps! |
boonproject/boon | boon/src/main/java/org/boon/collections/FloatList.java | FloatList.reduceBy | public double reduceBy(Object function, String name) {
return Flt.reduceBy(values, end, function, name);
} | java | public double reduceBy(Object function, String name) {
return Flt.reduceBy(values, end, function, name);
} | [
"public",
"double",
"reduceBy",
"(",
"Object",
"function",
",",
"String",
"name",
")",
"{",
"return",
"Flt",
".",
"reduceBy",
"(",
"values",
",",
"end",
",",
"function",
",",
"name",
")",
";",
"}"
] | This would be a good opportunity to reintroduce dynamic invoke
@param function function
@return | [
"This",
"would",
"be",
"a",
"good",
"opportunity",
"to",
"reintroduce",
"dynamic",
"invoke"
] | 9bc6870dbe5dd58c45c18d8edb493e8efc089463 | https://github.com/boonproject/boon/blob/9bc6870dbe5dd58c45c18d8edb493e8efc089463/boon/src/main/java/org/boon/collections/FloatList.java#L332-L334 | test | Reduce by function. | Of course, here is the Java code you requested:
```java
public double reduceBy(Object function, String name) {
return Flt.reduceBy(values, end, function, name);
}
```
Hope this helps! |
cologneintelligence/FitGoodies | fitgoodies-core/src/main/java/de/cologneintelligence/fitgoodies/Fixture.java | Fixture.doTable | public void doTable(FitTable table) {
copyParamsToFixture();
try {
setUp();
try {
doRows(table.rows());
} catch (Exception e) {
table.exception(e);
}
tearDown();
} catch (final Exception e) {
... | java | public void doTable(FitTable table) {
copyParamsToFixture();
try {
setUp();
try {
doRows(table.rows());
} catch (Exception e) {
table.exception(e);
}
tearDown();
} catch (final Exception e) {
... | [
"public",
"void",
"doTable",
"(",
"FitTable",
"table",
")",
"{",
"copyParamsToFixture",
"(",
")",
";",
"try",
"{",
"setUp",
"(",
")",
";",
"try",
"{",
"doRows",
"(",
"table",
".",
"rows",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")"... | Initializes the fixture arguments, call {@code setUp},
{@code fit.Fixture.doTable(Parse)} and {@code tearDown()}.
@param table the table to be processed | [
"Initializes",
"the",
"fixture",
"arguments",
"call",
"{",
"@code",
"setUp",
"}",
"{",
"@code",
"fit",
".",
"Fixture",
".",
"doTable",
"(",
"Parse",
")",
"}",
"and",
"{",
"@code",
"tearDown",
"()",
"}",
"."
] | 834e42d1f41b4b9226060b1e83a80cc69ea88c7b | https://github.com/cologneintelligence/FitGoodies/blob/834e42d1f41b4b9226060b1e83a80cc69ea88c7b/fitgoodies-core/src/main/java/de/cologneintelligence/fitgoodies/Fixture.java#L108-L125 | test | Do the table. | Of course, here is the Java code you requested:
```java
public void doTable(FitTable table) {
copyParamsToFixture();
try {
setUp();
try {
doRows(table.rows());
} catch (Exception e) {
table.exception(e);
}
te... |
rupertlssmith/lojix | base/common/src/main/com/thesett/common/util/queues/WrapperQueue.java | WrapperQueue.release | public void release(Object owner, Object o)
{
// Look up the element wrapper record for the element to be released, and release it.
RequeueElementWrapper<E> record = requeuedElementMap.get(o);
if (record != null)
{
record.state = AcquireState.Free;
record.own... | java | public void release(Object owner, Object o)
{
// Look up the element wrapper record for the element to be released, and release it.
RequeueElementWrapper<E> record = requeuedElementMap.get(o);
if (record != null)
{
record.state = AcquireState.Free;
record.own... | [
"public",
"void",
"release",
"(",
"Object",
"owner",
",",
"Object",
"o",
")",
"{",
"// Look up the element wrapper record for the element to be released, and release it.",
"RequeueElementWrapper",
"<",
"E",
">",
"record",
"=",
"requeuedElementMap",
".",
"get",
"(",
"o",
... | {@inheritDoc} | [
"{"
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/base/common/src/main/com/thesett/common/util/queues/WrapperQueue.java#L526-L536 | test | Release the element wrapper. | Of course, here is the Java code you requested:
```java
public void release(Object owner, Object o)
{
// Look up the element wrapper record for the element to be released, and release it.
RequeueElementWrapper<E> record = requeuedElementMap.get(o);
if (record != null)
{
... |
Unidata/thredds | legacy/src/main/java/thredds/catalog/query/DqcFactory.java | DqcFactory.writeXML | public void writeXML(QueryCapability dqc, OutputStream os) throws IOException {
String ns = versionToNamespaceHash.get( dqc.getVersion() );
DqcConvertIF fac = namespaceToDqcConverterHash.get( ns );
if ( fac == null )
fac = defaultConverter;
fac.writeXML( dqc, os );
} | java | public void writeXML(QueryCapability dqc, OutputStream os) throws IOException {
String ns = versionToNamespaceHash.get( dqc.getVersion() );
DqcConvertIF fac = namespaceToDqcConverterHash.get( ns );
if ( fac == null )
fac = defaultConverter;
fac.writeXML( dqc, os );
} | [
"public",
"void",
"writeXML",
"(",
"QueryCapability",
"dqc",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"String",
"ns",
"=",
"versionToNamespaceHash",
".",
"get",
"(",
"dqc",
".",
"getVersion",
"(",
")",
")",
";",
"DqcConvertIF",
"fac",
"=... | Write the catalog as an XML document to the specified stream.
@param dqc : write this QueryCapability to an XML representation.
@param os write to this OutputStream
@throws IOException on an error. | [
"Write",
"the",
"catalog",
"as",
"an",
"XML",
"document",
"to",
"the",
"specified",
"stream",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/legacy/src/main/java/thredds/catalog/query/DqcFactory.java#L313-L321 | test | Write XML from a QueryCapability to an OutputStream. | Of course, here is the Java code you requested:
```java
public void writeXML(QueryCapability dqc, OutputStream os) throws IOException {
String ns = versionToNamespaceHash.get( dqc.getVersion() );
DqcConvertIF fac = namespaceToDqcConverterHash.get( ns );
if ( fac == null )
fac = defaultConverter;
... |
Unidata/thredds | cdm/src/main/java/ucar/unidata/io/http/HTTPRandomAccessFile.java | HTTPRandomAccessFile.read_ | @Override
protected int read_(long pos, byte[] buff, int offset, int len) throws IOException {
long end = pos + len - 1;
if (end >= total_length)
end = total_length - 1;
if (debug) System.out.println(" HTTPRandomAccessFile bytes=" + pos + "-" + end + ": ");
try (HTTPMethod method = HTTPFactory... | java | @Override
protected int read_(long pos, byte[] buff, int offset, int len) throws IOException {
long end = pos + len - 1;
if (end >= total_length)
end = total_length - 1;
if (debug) System.out.println(" HTTPRandomAccessFile bytes=" + pos + "-" + end + ": ");
try (HTTPMethod method = HTTPFactory... | [
"@",
"Override",
"protected",
"int",
"read_",
"(",
"long",
"pos",
",",
"byte",
"[",
"]",
"buff",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"long",
"end",
"=",
"pos",
"+",
"len",
"-",
"1",
";",
"if",
"(",
"end",
"... | Read directly from file, without going through the buffer.
All reading goes through here or readToByteChannel;
@param pos start here in the file
@param buff put data into this buffer
@param offset buffer offset
@param len this number of bytes
@return actual number of bytes read
@throws IOException on io error | [
"Read",
"directly",
"from",
"file",
"without",
"going",
"through",
"the",
"buffer",
".",
"All",
"reading",
"goes",
"through",
"here",
"or",
"readToByteChannel",
";"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/unidata/io/http/HTTPRandomAccessFile.java#L171-L200 | test | read_ method. | Of course, here is the Java code you requested:
```java
@Override
protected int read_(long pos, byte[] buff, int offset, int len) throws IOException {
long end = pos + len - 1;
if (end >= total_length)
end = total_length - 1;
if (debug) System.out.println(" HTTPRandomAccessFile bytes=" + pos + "-"... |
playframework/playframework | core/play/src/main/java/play/Logger.java | Logger.of | public static ALogger of(Class<?> clazz) {
return new ALogger(play.api.Logger.apply(clazz));
} | java | public static ALogger of(Class<?> clazz) {
return new ALogger(play.api.Logger.apply(clazz));
} | [
"public",
"static",
"ALogger",
"of",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"return",
"new",
"ALogger",
"(",
"play",
".",
"api",
".",
"Logger",
".",
"apply",
"(",
"clazz",
")",
")",
";",
"}"
] | Obtain a logger instance.
@param clazz a class whose name will be used as logger name
@return a logger | [
"Obtain",
"a",
"logger",
"instance",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/core/play/src/main/java/play/Logger.java#L68-L70 | test | Creates an ALogger instance from a class. | Of course, here is the Java code you requested:
```java
public static ALogger of(Class<?> clazz) {
return new ALogger(play.api.Logger.apply(clazz));
}
```
Hope this helps! |
lessthanoptimal/GeoRegression | main/src/georegression/metric/Intersection2D_I32.java | Intersection2D_I32.contains | public static boolean contains( RectangleLength2D_I32 a, int x, int y ) {
if( a.getX() <= x && a.getX() + a.getWidth() > x ) {
return a.getY() <= y && a.getY() + a.getHeight() > y;
}
return false;
} | java | public static boolean contains( RectangleLength2D_I32 a, int x, int y ) {
if( a.getX() <= x && a.getX() + a.getWidth() > x ) {
return a.getY() <= y && a.getY() + a.getHeight() > y;
}
return false;
} | [
"public",
"static",
"boolean",
"contains",
"(",
"RectangleLength2D_I32",
"a",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"a",
".",
"getX",
"(",
")",
"<=",
"x",
"&&",
"a",
".",
"getX",
"(",
")",
"+",
"a",
".",
"getWidth",
"(",
")",
"... | True if the point is contained inside the rectangle
@param a Rectangle
@param x x-coordinate of point
@param y y-coordinate of point
@return true if the point is inside and false it is not | [
"True",
"if",
"the",
"point",
"is",
"contained",
"inside",
"the",
"rectangle"
] | c067cd44a4e95bd826119f6e658bd82386ef289f | https://github.com/lessthanoptimal/GeoRegression/blob/c067cd44a4e95bd826119f6e658bd82386ef289f/main/src/georegression/metric/Intersection2D_I32.java#L142-L147 | test | Checks if the rectangle is contained in the specified rectangle. | Of course, here is the Java code you requested:
```java
public static boolean contains( RectangleLength2D_I32 a, int x, int y ) {
if( a.getX() <= x && a.getX() + a.getWidth() > x ) {
return a.getY() <= y && a.getY() + a.getHeight() > y;
}
return false;
}
```
Hope this helps! |
oblac/jodd | jodd-petite/src/main/java/jodd/petite/scope/ThreadLocalScope.java | ThreadLocalScope.accept | @Override
public boolean accept(final Scope referenceScope) {
Class<? extends Scope> refScopeType = referenceScope.getClass();
if (refScopeType == ProtoScope.class) {
return true;
}
if (refScopeType == SingletonScope.class) {
return true;
}
if (refScopeType == ThreadLocalScope.class) {
return t... | java | @Override
public boolean accept(final Scope referenceScope) {
Class<? extends Scope> refScopeType = referenceScope.getClass();
if (refScopeType == ProtoScope.class) {
return true;
}
if (refScopeType == SingletonScope.class) {
return true;
}
if (refScopeType == ThreadLocalScope.class) {
return t... | [
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"final",
"Scope",
"referenceScope",
")",
"{",
"Class",
"<",
"?",
"extends",
"Scope",
">",
"refScopeType",
"=",
"referenceScope",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"refScopeType",
"==",
"ProtoScope... | Defines allowed referenced scopes that can be injected into the
thread-local scoped bean. | [
"Defines",
"allowed",
"referenced",
"scopes",
"that",
"can",
"be",
"injected",
"into",
"the",
"thread",
"-",
"local",
"scoped",
"bean",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-petite/src/main/java/jodd/petite/scope/ThreadLocalScope.java#L83-L100 | test | Accept a reference scope. | Of course, here is the Java code you requested:
```java
@Override
public boolean accept(final Scope referenceScope) {
Class<? extends Scope> refScopeType = referenceScope.getClass();
if (refScopeType == ProtoScope.class) {
return true;
}
if (refScopeType == SingletonScope.class) {
return true;
}
... |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/features/user/ManualFeatureQuery.java | ManualFeatureQuery.query | public ManualFeatureQueryResults query(BoundingBox boundingBox,
Projection projection) {
BoundingBox featureBoundingBox = featureDao.projectBoundingBox(
boundingBox, projection);
return query(featureBoundingBox);
} | java | public ManualFeatureQueryResults query(BoundingBox boundingBox,
Projection projection) {
BoundingBox featureBoundingBox = featureDao.projectBoundingBox(
boundingBox, projection);
return query(featureBoundingBox);
} | [
"public",
"ManualFeatureQueryResults",
"query",
"(",
"BoundingBox",
"boundingBox",
",",
"Projection",
"projection",
")",
"{",
"BoundingBox",
"featureBoundingBox",
"=",
"featureDao",
".",
"projectBoundingBox",
"(",
"boundingBox",
",",
"projection",
")",
";",
"return",
... | Manually query for rows within the bounding box in the provided
projection
@param boundingBox bounding box
@param projection projection
@return results | [
"Manually",
"query",
"for",
"rows",
"within",
"the",
"bounding",
"box",
"in",
"the",
"provided",
"projection"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/features/user/ManualFeatureQuery.java#L192-L197 | test | Query for a subset of a CRASS AFFA feature | Of course, here is the Java code you requested:
```java
public ManualFeatureQueryResults query(BoundingBox boundingBox,
Projection projection) {
BoundingBox featureBoundingBox = featureDao.projectBoundingBox(
boundingBox, projection);
return qu... |
oblac/jodd | jodd-proxetta/src/main/java/jodd/asm/AsmUtil.java | AsmUtil.doubleValue | public static void doubleValue(final MethodVisitor mv) {
mv.visitTypeInsn(CHECKCAST, SIGNATURE_JAVA_LANG_DOUBLE);
mv.visitMethodInsn(INVOKEVIRTUAL, SIGNATURE_JAVA_LANG_DOUBLE, "doubleValue", "()D", false);
} | java | public static void doubleValue(final MethodVisitor mv) {
mv.visitTypeInsn(CHECKCAST, SIGNATURE_JAVA_LANG_DOUBLE);
mv.visitMethodInsn(INVOKEVIRTUAL, SIGNATURE_JAVA_LANG_DOUBLE, "doubleValue", "()D", false);
} | [
"public",
"static",
"void",
"doubleValue",
"(",
"final",
"MethodVisitor",
"mv",
")",
"{",
"mv",
".",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"SIGNATURE_JAVA_LANG_DOUBLE",
")",
";",
"mv",
".",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"SIGNATURE_JAVA_LANG_DOUBLE"... | Converts <code>Double</code> object to a <code>double</code>. | [
"Converts",
"<code",
">",
"Double<",
"/",
"code",
">",
"object",
"to",
"a",
"<code",
">",
"double<",
"/",
"code",
">",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-proxetta/src/main/java/jodd/asm/AsmUtil.java#L342-L345 | test | Generates the instruction to convert a double to a double. | Of course, here is the Java code you requested:
```java
public static void doubleValue(final MethodVisitor mv) {
mv.visitTypeInsn(CHECKCAST, SIGNATURE_JAVA_LANG_DOUBLE);
mv.visitMethodInsn(INVOKEVIRTUAL, SIGNATURE_JAVA_LANG_DOUBLE, "doubleValue", "()D", false);
}
```
Hope this helps! |
real-logic/aeron | aeron-driver/src/main/java/io/aeron/driver/PublicationImage.java | PublicationImage.addSubscriber | public void addSubscriber(final SubscriptionLink subscriptionLink, final ReadablePosition subscriberPosition)
{
subscriberPositions = ArrayUtil.add(subscriberPositions, subscriberPosition);
if (!subscriptionLink.isTether())
{
untetheredSubscriptions.add(new UntetheredSubscription... | java | public void addSubscriber(final SubscriptionLink subscriptionLink, final ReadablePosition subscriberPosition)
{
subscriberPositions = ArrayUtil.add(subscriberPositions, subscriberPosition);
if (!subscriptionLink.isTether())
{
untetheredSubscriptions.add(new UntetheredSubscription... | [
"public",
"void",
"addSubscriber",
"(",
"final",
"SubscriptionLink",
"subscriptionLink",
",",
"final",
"ReadablePosition",
"subscriberPosition",
")",
"{",
"subscriberPositions",
"=",
"ArrayUtil",
".",
"add",
"(",
"subscriberPositions",
",",
"subscriberPosition",
")",
";... | {@inheritDoc} | [
"{"
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-driver/src/main/java/io/aeron/driver/PublicationImage.java#L303-L311 | test | Add a subscriber to the list of subscriber positions. | Of course, here is the Java code you requested:
```java
public void addSubscriber(final SubscriptionLink subscriptionLink, final ReadablePosition subscriberPosition)
{
subscriberPositions = ArrayUtil.add(subscriberPositions, subscriberPosition);
if (!subscriptionLink.isTether())
{
... |
Unidata/thredds | cdm/src/main/java/ucar/nc2/Structure.java | Structure.calcElementSize | public void calcElementSize() {
int total = 0;
for (Variable v : members) {
total += v.getElementSize() * v.getSize();
}
elementSize = total;
} | java | public void calcElementSize() {
int total = 0;
for (Variable v : members) {
total += v.getElementSize() * v.getSize();
}
elementSize = total;
} | [
"public",
"void",
"calcElementSize",
"(",
")",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"Variable",
"v",
":",
"members",
")",
"{",
"total",
"+=",
"v",
".",
"getElementSize",
"(",
")",
"*",
"v",
".",
"getSize",
"(",
")",
";",
"}",
"elementSiz... | Force recalculation of size of one element of this structure - equals the sum of sizes of its members.
This is used only by low level classes like IOSPs. | [
"Force",
"recalculation",
"of",
"size",
"of",
"one",
"element",
"of",
"this",
"structure",
"-",
"equals",
"the",
"sum",
"of",
"sizes",
"of",
"its",
"members",
".",
"This",
"is",
"used",
"only",
"by",
"low",
"level",
"classes",
"like",
"IOSPs",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/Structure.java#L311-L317 | test | Calculates the element size of the group. | Of course, here is the Java code you requested:
```java
public void calcElementSize() {
int total = 0;
for (Variable v : members) {
total += v.getElementSize() * v.getSize();
}
elementSize = total;
}
```
Hope this helps! |
spring-projects/spring-security | config/src/main/java/org/springframework/security/config/annotation/web/configurers/openid/OpenIDLoginConfigurer.java | OpenIDLoginConfigurer.getConsumer | private OpenIDConsumer getConsumer() throws ConsumerException {
if (this.openIDConsumer == null) {
this.openIDConsumer = new OpenID4JavaConsumer(getConsumerManager(),
attributesToFetchFactory());
}
return this.openIDConsumer;
} | java | private OpenIDConsumer getConsumer() throws ConsumerException {
if (this.openIDConsumer == null) {
this.openIDConsumer = new OpenID4JavaConsumer(getConsumerManager(),
attributesToFetchFactory());
}
return this.openIDConsumer;
} | [
"private",
"OpenIDConsumer",
"getConsumer",
"(",
")",
"throws",
"ConsumerException",
"{",
"if",
"(",
"this",
".",
"openIDConsumer",
"==",
"null",
")",
"{",
"this",
".",
"openIDConsumer",
"=",
"new",
"OpenID4JavaConsumer",
"(",
"getConsumerManager",
"(",
")",
","... | Gets the {@link OpenIDConsumer} that was configured or defaults to an
{@link OpenID4JavaConsumer}.
@return the {@link OpenIDConsumer} to use
@throws ConsumerException | [
"Gets",
"the",
"{"
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/config/src/main/java/org/springframework/security/config/annotation/web/configurers/openid/OpenIDLoginConfigurer.java#L297-L303 | test | Gets the OpenIDConsumer. | Of course, here is the Java code you requested:
```java
private OpenIDConsumer getConsumer() throws ConsumerException {
if (this.openIDConsumer == null) {
this.openIDConsumer = new OpenID4JavaConsumer(getConsumerManager(),
attributesToFetchFactory());
}
return this.openIDConsumer;
}
```
Hope this helps... |
oblac/jodd | jodd-jtx/src/main/java/jodd/jtx/JtxTransactionManager.java | JtxTransactionManager.requestTransaction | public JtxTransaction requestTransaction(final JtxTransactionMode mode, final Object scope) {
if (log.isDebugEnabled()) {
log.debug("Requesting TX " + mode.toString());
}
JtxTransaction currentTx = getTransaction();
if (!isNewTxScope(currentTx, scope)) {
return currentTx;
}
switch (mode.getPropagation... | java | public JtxTransaction requestTransaction(final JtxTransactionMode mode, final Object scope) {
if (log.isDebugEnabled()) {
log.debug("Requesting TX " + mode.toString());
}
JtxTransaction currentTx = getTransaction();
if (!isNewTxScope(currentTx, scope)) {
return currentTx;
}
switch (mode.getPropagation... | [
"public",
"JtxTransaction",
"requestTransaction",
"(",
"final",
"JtxTransactionMode",
"mode",
",",
"final",
"Object",
"scope",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Requesting TX \"",
"+",
"mode",
... | Requests transaction with specified {@link JtxTransactionMode mode}.
Depending on propagation behavior, it will return either <b>existing</b> or <b>new</b> transaction.
Only one transaction can be opened over one scope.
The exception may be thrown indicating propagation mismatch. | [
"Requests",
"transaction",
"with",
"specified",
"{"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-jtx/src/main/java/jodd/jtx/JtxTransactionManager.java#L270-L287 | test | Request a transaction. | Of course, here is the Java code you requested:
```java
public JtxTransaction requestTransaction(final JtxTransactionMode mode, final Object scope) {
if (log.isDebugEnabled()) {
log.debug("Requesting TX " + mode.toString());
}
JtxTransaction currentTx = getTransaction();
if (!isNewTxScope(currentTx, scope))... |
xmlet/XsdParser | src/main/java/org/xmlet/xsdparser/xsdelements/XsdExtension.java | XsdExtension.replaceUnsolvedElements | @Override
public void replaceUnsolvedElements(NamedConcreteElement element) {
super.replaceUnsolvedElements(element);
XsdNamedElements elem = element.getElement();
String elemName = elem.getRawName();
boolean isComplexOrSimpleType = elem instanceof XsdComplexType || elem instanceof... | java | @Override
public void replaceUnsolvedElements(NamedConcreteElement element) {
super.replaceUnsolvedElements(element);
XsdNamedElements elem = element.getElement();
String elemName = elem.getRawName();
boolean isComplexOrSimpleType = elem instanceof XsdComplexType || elem instanceof... | [
"@",
"Override",
"public",
"void",
"replaceUnsolvedElements",
"(",
"NamedConcreteElement",
"element",
")",
"{",
"super",
".",
"replaceUnsolvedElements",
"(",
"element",
")",
";",
"XsdNamedElements",
"elem",
"=",
"element",
".",
"getElement",
"(",
")",
";",
"String... | This method should always receive two elements, one to replace the {@link UnsolvedReference} created due to
the value present in the base attribute and another if it has an {@link UnsolvedReference} as a child element.
@param element A concrete element with a name that will replace the {@link UnsolvedReference} object ... | [
"This",
"method",
"should",
"always",
"receive",
"two",
"elements",
"one",
"to",
"replace",
"the",
"{"
] | 0044681d77400e1568d1e7b1024a38ec76caa2cb | https://github.com/xmlet/XsdParser/blob/0044681d77400e1568d1e7b1024a38ec76caa2cb/src/main/java/org/xmlet/xsdparser/xsdelements/XsdExtension.java#L76-L95 | test | Replace the elements of the element with the new ones. | Of course, here is the Java code you requested:
```java
@Override
public void replaceUnsolvedElements(NamedConcreteElement element) {
super.replaceUnsolvedElements(element);
XsdNamedElements elem = element.getElement();
String elemName = elem.getRawName();
boolean isComplexOrSimpl... |
liveontologies/elk-reasoner | elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/ForwardLinkOfObjectSomeValuesFrom.java | ForwardLinkOfObjectSomeValuesFrom.getConclusion | public ForwardLink getConclusion(ClassConclusion.Factory factory) {
return factory.getForwardLink(getDestination(),
existential_.getProperty(),
IndexedObjectSomeValuesFrom.Helper.getTarget(existential_));
} | java | public ForwardLink getConclusion(ClassConclusion.Factory factory) {
return factory.getForwardLink(getDestination(),
existential_.getProperty(),
IndexedObjectSomeValuesFrom.Helper.getTarget(existential_));
} | [
"public",
"ForwardLink",
"getConclusion",
"(",
"ClassConclusion",
".",
"Factory",
"factory",
")",
"{",
"return",
"factory",
".",
"getForwardLink",
"(",
"getDestination",
"(",
")",
",",
"existential_",
".",
"getProperty",
"(",
")",
",",
"IndexedObjectSomeValuesFrom",... | @param factory
the factory for creating conclusions
@return the conclusion produced by this inference | [
"@param",
"factory",
"the",
"factory",
"for",
"creating",
"conclusions"
] | cfbe5279a57e0433d45c1676c7658ddb6e29b9eb | https://github.com/liveontologies/elk-reasoner/blob/cfbe5279a57e0433d45c1676c7658ddb6e29b9eb/elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/ForwardLinkOfObjectSomeValuesFrom.java#L84-L88 | test | Gets the conclusion of this object. | Of course, here is the Java code you requested:
```java
public ForwardLink getConclusion(ClassConclusion.Factory factory) {
return factory.getForwardLink(getDestination(),
existential_.getProperty(),
IndexedObjectSomeValuesFrom.Helper.getTarget(existential_));
}
```
Hope this helps! |
stanfy/enroscar | net/src/main/java/com/stanfy/enroscar/rest/request/net/multipart/Part.java | Part.length | public long length() throws IOException {
if (DEBUG) { Log.v(TAG, "enter length()"); }
if (lengthOfData() < 0) {
return -1;
}
final ByteArrayOutputStream overhead = new ByteArrayOutputStream();
sendStart(overhead);
sendDispositionHeader(overhead);
sendContentTypeHeader(overhead);
s... | java | public long length() throws IOException {
if (DEBUG) { Log.v(TAG, "enter length()"); }
if (lengthOfData() < 0) {
return -1;
}
final ByteArrayOutputStream overhead = new ByteArrayOutputStream();
sendStart(overhead);
sendDispositionHeader(overhead);
sendContentTypeHeader(overhead);
s... | [
"public",
"long",
"length",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"DEBUG",
")",
"{",
"Log",
".",
"v",
"(",
"TAG",
",",
"\"enter length()\"",
")",
";",
"}",
"if",
"(",
"lengthOfData",
"(",
")",
"<",
"0",
")",
"{",
"return",
"-",
"1",
... | Return the full length of all the data.
If you override this method make sure to override
#send(OutputStream) as well
@return long The length.
@throws IOException If an IO problem occurs | [
"Return",
"the",
"full",
"length",
"of",
"all",
"the",
"data",
".",
"If",
"you",
"override",
"this",
"method",
"make",
"sure",
"to",
"override",
"#send",
"(",
"OutputStream",
")",
"as",
"well"
] | 0e64f3c309d62e359b55ddcba10e3cc592f5e083 | https://github.com/stanfy/enroscar/blob/0e64f3c309d62e359b55ddcba10e3cc592f5e083/net/src/main/java/com/stanfy/enroscar/rest/request/net/multipart/Part.java#L267-L280 | test | Returns the length of the file. | Of course, here is the Java code you requested:
```java
public long length() throws IOException {
if (DEBUG) { Log.v(TAG, "enter length()"); }
if (lengthOfData() < 0) {
return -1;
}
final ByteArrayOutputStream overhead = new ByteArrayOutputStream();
sendStart(overhead);
sendDispositionHea... |
eclipse/packagedrone | bundles/org.tukani.xz/src/org/tukaani/xz/LZMA2Options.java | LZMA2Options.setMatchFinder | public void setMatchFinder(int mf) throws UnsupportedOptionsException {
if (mf != MF_HC4 && mf != MF_BT4)
throw new UnsupportedOptionsException(
"Unsupported match finder: " + mf);
this.mf = mf;
} | java | public void setMatchFinder(int mf) throws UnsupportedOptionsException {
if (mf != MF_HC4 && mf != MF_BT4)
throw new UnsupportedOptionsException(
"Unsupported match finder: " + mf);
this.mf = mf;
} | [
"public",
"void",
"setMatchFinder",
"(",
"int",
"mf",
")",
"throws",
"UnsupportedOptionsException",
"{",
"if",
"(",
"mf",
"!=",
"MF_HC4",
"&&",
"mf",
"!=",
"MF_BT4",
")",
"throw",
"new",
"UnsupportedOptionsException",
"(",
"\"Unsupported match finder: \"",
"+",
"m... | Sets the match finder type.
<p>
Match finder has a major effect on compression speed, memory usage,
and compression ratio. Usually Hash Chain match finders are faster
than Binary Tree match finders. The default depends on the preset:
0-3 use <code>MF_HC4</code> and 4-9 use <code>MF_BT4</code>.
@throws Unsupported... | [
"Sets",
"the",
"match",
"finder",
"type",
".",
"<p",
">",
"Match",
"finder",
"has",
"a",
"major",
"effect",
"on",
"compression",
"speed",
"memory",
"usage",
"and",
"compression",
"ratio",
".",
"Usually",
"Hash",
"Chain",
"match",
"finders",
"are",
"faster",
... | 3869c1643cdc6f7cb8b26097a7b6994683b13d7e | https://github.com/eclipse/packagedrone/blob/3869c1643cdc6f7cb8b26097a7b6994683b13d7e/bundles/org.tukani.xz/src/org/tukaani/xz/LZMA2Options.java#L479-L485 | test | Set the match finder. | Of course, here is the Java code you requested:
```java
public void setMatchFinder(int mf) throws UnsupportedOptionsException {
if (mf != MF_HC4 && mf != MF_BT4)
throw new UnsupportedOptionsException(
"Unsupported match finder: " + mf);
this.mf = mf;
}
```
Hope thi... |
spring-projects/spring-security | config/src/main/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurer.java | ExceptionHandlingConfigurer.getAuthenticationEntryPoint | AuthenticationEntryPoint getAuthenticationEntryPoint(H http) {
AuthenticationEntryPoint entryPoint = this.authenticationEntryPoint;
if (entryPoint == null) {
entryPoint = createDefaultEntryPoint(http);
}
return entryPoint;
} | java | AuthenticationEntryPoint getAuthenticationEntryPoint(H http) {
AuthenticationEntryPoint entryPoint = this.authenticationEntryPoint;
if (entryPoint == null) {
entryPoint = createDefaultEntryPoint(http);
}
return entryPoint;
} | [
"AuthenticationEntryPoint",
"getAuthenticationEntryPoint",
"(",
"H",
"http",
")",
"{",
"AuthenticationEntryPoint",
"entryPoint",
"=",
"this",
".",
"authenticationEntryPoint",
";",
"if",
"(",
"entryPoint",
"==",
"null",
")",
"{",
"entryPoint",
"=",
"createDefaultEntryPoi... | Gets the {@link AuthenticationEntryPoint} according to the rules specified by
{@link #authenticationEntryPoint(AuthenticationEntryPoint)}
@param http the {@link HttpSecurity} used to look up shared
{@link AuthenticationEntryPoint}
@return the {@link AuthenticationEntryPoint} to use | [
"Gets",
"the",
"{"
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/config/src/main/java/org/springframework/security/config/annotation/web/configurers/ExceptionHandlingConfigurer.java#L223-L229 | test | Get the AuthenticationEntryPoint for this request. | Of course, here is the Java code you requested:
```java
AuthenticationEntryPoint getAuthenticationEntryPoint(H http) {
AuthenticationEntryPoint entryPoint = this.authenticationEntryPoint;
if (entryPoint == null) {
entryPoint = createDefaultEntryPoint(http);
}
return entryPoint;
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/ucar/nc2/iosp/IospHelper.java | IospHelper.convertByteToChar | static public char[] convertByteToChar(byte[] byteArray) {
int size = byteArray.length;
char[] cbuff = new char[size];
for (int i = 0; i < size; i++)
cbuff[i] = (char) DataType.unsignedByteToShort(byteArray[i]); // NOTE: not Unicode !
return cbuff;
}
// convert char array to byte arra... | java | static public char[] convertByteToChar(byte[] byteArray) {
int size = byteArray.length;
char[] cbuff = new char[size];
for (int i = 0; i < size; i++)
cbuff[i] = (char) DataType.unsignedByteToShort(byteArray[i]); // NOTE: not Unicode !
return cbuff;
}
// convert char array to byte arra... | [
"static",
"public",
"char",
"[",
"]",
"convertByteToChar",
"(",
"byte",
"[",
"]",
"byteArray",
")",
"{",
"int",
"size",
"=",
"byteArray",
".",
"length",
";",
"char",
"[",
"]",
"cbuff",
"=",
"new",
"char",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"... | convert byte array to char array | [
"convert",
"byte",
"array",
"to",
"char",
"array"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/iosp/IospHelper.java#L718-L737 | test | Convert a byte array to a char array. | Of course, here is the Java code you requested:
```java
static public char[] convertByteToChar(byte[] byteArray) {
int size = byteArray.length;
char[] cbuff = new char[size];
for (int i = 0; i < size; i++)
cbuff[i] = (char) DataType.unsignedByteToShort(byteArray[i]); // NOTE: not Unicode !
r... |
retog/wymiwyg-commons-core | src/main/java/org/wymiwyg/commons/util/io/IndentWriter.java | IndentWriter.write | public void write(char[] cbuf, int off, int len) throws IOException {
int posInSeparatorChars = 0;
for (int i = 0; i < len; i++) {
if (identBeforeNextChar) {
base.write('\t');
identBeforeNextChar = false;
}
base.write(cbuf[i]);
if (cbuf[i] == separatorChars[posInSeparatorChars]) {
posInSepar... | java | public void write(char[] cbuf, int off, int len) throws IOException {
int posInSeparatorChars = 0;
for (int i = 0; i < len; i++) {
if (identBeforeNextChar) {
base.write('\t');
identBeforeNextChar = false;
}
base.write(cbuf[i]);
if (cbuf[i] == separatorChars[posInSeparatorChars]) {
posInSepar... | [
"public",
"void",
"write",
"(",
"char",
"[",
"]",
"cbuf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"posInSeparatorChars",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++"... | /* (non-Javadoc)
@see java.io.Writer#write(char[], int, int) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | f64530a2690e2d9ee0184c5671214ee32572482d | https://github.com/retog/wymiwyg-commons-core/blob/f64530a2690e2d9ee0184c5671214ee32572482d/src/main/java/org/wymiwyg/commons/util/io/IndentWriter.java#L61-L80 | test | Write a sequence of characters to the underlying output stream. | Of course, here is the Java code you requested:
```java
public void write(char[] cbuf, int off, int len) throws IOException {
int posInSeparatorChars = 0;
for (int i = 0; i < len; i++) {
if (identBeforeNextChar) {
base.write('\t');
identBeforeNextChar = false;
}
base.write(cbuf[i]);
if (cbuf[i]... |
ReactiveX/RxJava | src/main/java/io/reactivex/Observable.java | Observable.subscribe | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError) {
return subscribe(onNext, onError, Functions.EMPTY_ACTION, Functions.emptyConsumer());
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError) {
return subscribe(onNext, onError, Functions.EMPTY_ACTION, Functions.emptyConsumer());
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Disposable",
"subscribe",
"(",
"Consumer",
"<",
"?",
"super",
"T",
">",
"onNext",
",",
"Consumer",
"<",
"?",
"super",
"Throwable",
">",
"onError",
... | Subscribes to an ObservableSource and provides callbacks to handle the items it emits and any error
notification it issues.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code subscribe} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param onNext
the {@code Consumer<T>} you have designed to accept e... | [
"Subscribes",
"to",
"an",
"ObservableSource",
"and",
"provides",
"callbacks",
"to",
"handle",
"the",
"items",
"it",
"emits",
"and",
"any",
"error",
"notification",
"it",
"issues",
".",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Scheduler",
":",
"<",
"/",
"b",
"... | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/Observable.java#L12178-L12182 | test | Subscribes to the source with an empty action and an empty consumer. | Of course, here is the Java code you requested:
```java
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError) {
return subscribe(onNext, onError, Functions.EMPTY_ACTION, Functions.emptyConsumer());
... |
sialcasa/mvvmFX | mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/WeakValueHashMap.java | WeakValueHashMap.processQueue | private void processQueue() {
WeakValue wv = null;
while ((wv = (WeakValue) this.queue.poll()) != null) {
// "super" is not really necessary but use it
// to be on the safe side
super.remove(wv.key);
}
} | java | private void processQueue() {
WeakValue wv = null;
while ((wv = (WeakValue) this.queue.poll()) != null) {
// "super" is not really necessary but use it
// to be on the safe side
super.remove(wv.key);
}
} | [
"private",
"void",
"processQueue",
"(",
")",
"{",
"WeakValue",
"wv",
"=",
"null",
";",
"while",
"(",
"(",
"wv",
"=",
"(",
"WeakValue",
")",
"this",
".",
"queue",
".",
"poll",
"(",
")",
")",
"!=",
"null",
")",
"{",
"// \"super\" is not really necessary bu... | Removes all garbage collected values with their keys from the map. Since we don't know how much the
ReferenceQueue.poll() operation costs, we should not call it every map operation. | [
"Removes",
"all",
"garbage",
"collected",
"values",
"with",
"their",
"keys",
"from",
"the",
"map",
".",
"Since",
"we",
"don",
"t",
"know",
"how",
"much",
"the",
"ReferenceQueue",
".",
"poll",
"()",
"operation",
"costs",
"we",
"should",
"not",
"call",
"it",... | 240566a358a8e01c94c0bbb99228140a69690d02 | https://github.com/sialcasa/mvvmFX/blob/240566a358a8e01c94c0bbb99228140a69690d02/mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/WeakValueHashMap.java#L188-L196 | test | Process the queue. | Of course, here is the Java code you requested:
```java
private void processQueue() {
WeakValue wv = null;
while ((wv = (WeakValue) this.queue.poll()) != null) {
// "super" is not really necessary but use it
// to be on the safe side
super.remove(wv.key);
}
}
```
Hope this helps! |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSystemUser.java | OSystemUser.createRole | protected ORole createRole(final ODocument roleDoc) {
ORole role = null;
// If databaseName is set, then only allow roles with the same databaseName.
if (databaseName != null && !databaseName.isEmpty()) {
if (roleDoc != null && roleDoc.containsField(OSystemRole.DB_FILTER) && roleDoc.fieldType(OSystem... | java | protected ORole createRole(final ODocument roleDoc) {
ORole role = null;
// If databaseName is set, then only allow roles with the same databaseName.
if (databaseName != null && !databaseName.isEmpty()) {
if (roleDoc != null && roleDoc.containsField(OSystemRole.DB_FILTER) && roleDoc.fieldType(OSystem... | [
"protected",
"ORole",
"createRole",
"(",
"final",
"ODocument",
"roleDoc",
")",
"{",
"ORole",
"role",
"=",
"null",
";",
"// If databaseName is set, then only allow roles with the same databaseName.",
"if",
"(",
"databaseName",
"!=",
"null",
"&&",
"!",
"databaseName",
"."... | Derived classes can override createRole() to return an extended ORole implementation. | [
"Derived",
"classes",
"can",
"override",
"createRole",
"()",
"to",
"return",
"an",
"extended",
"ORole",
"implementation",
"."
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSystemUser.java#L66-L104 | test | Create a role from the document. | Of course, here is the Java code you requested:
```java
protected ORole createRole(final ODocument roleDoc) {
ORole role = null;
// If databaseName is set, then only allow roles with the same databaseName.
if (databaseName != null && !databaseName.isEmpty()) {
if (roleDoc != null && roleDoc.contains... |
lessthanoptimal/GeoRegression | main/src/georegression/geometry/GeometryMath_F64.java | GeometryMath_F64.divide | public static void divide( GeoTuple3D_F64 p , double v ) {
p.x /= v;
p.y /= v;
p.z /= v;
} | java | public static void divide( GeoTuple3D_F64 p , double v ) {
p.x /= v;
p.y /= v;
p.z /= v;
} | [
"public",
"static",
"void",
"divide",
"(",
"GeoTuple3D_F64",
"p",
",",
"double",
"v",
")",
"{",
"p",
".",
"x",
"/=",
"v",
";",
"p",
".",
"y",
"/=",
"v",
";",
"p",
".",
"z",
"/=",
"v",
";",
"}"
] | Divides each element by 'v'
@param p tuple
@param v divisor | [
"Divides",
"each",
"element",
"by",
"v"
] | c067cd44a4e95bd826119f6e658bd82386ef289f | https://github.com/lessthanoptimal/GeoRegression/blob/c067cd44a4e95bd826119f6e658bd82386ef289f/main/src/georegression/geometry/GeometryMath_F64.java#L855-L859 | test | Divides the coordinates by the given value | Of course, here is the Java code you requested:
```java
public static void divide( GeoTuple3D_F64 p , double v ) {
p.x /= v;
p.y /= v;
p.z /= v;
}
```
Hope this helps! |
OpenEstate/OpenEstate-IO | DaftIE/src/main/java/org/openestate/io/daft_ie/DaftIeUtils.java | DaftIeUtils.createDocument | public static DaftIeDocument createDocument(Document doc) {
if (DaftIeDocument.isReadable(doc))
return new DaftIeDocument(doc);
else
return null;
} | java | public static DaftIeDocument createDocument(Document doc) {
if (DaftIeDocument.isReadable(doc))
return new DaftIeDocument(doc);
else
return null;
} | [
"public",
"static",
"DaftIeDocument",
"createDocument",
"(",
"Document",
"doc",
")",
"{",
"if",
"(",
"DaftIeDocument",
".",
"isReadable",
"(",
"doc",
")",
")",
"return",
"new",
"DaftIeDocument",
"(",
"doc",
")",
";",
"else",
"return",
"null",
";",
"}"
] | Creates a {@link DaftIeDocument} from a {@link Document}.
@param doc XML document
@return created document or null, of the document is not supported by this format | [
"Creates",
"a",
"{",
"@link",
"DaftIeDocument",
"}",
"from",
"a",
"{",
"@link",
"Document",
"}",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/DaftIE/src/main/java/org/openestate/io/daft_ie/DaftIeUtils.java#L138-L143 | test | Create a DaftIeDocument from a Document object. | Of course, here is the Java code you requested:
```java
public static DaftIeDocument createDocument(Document doc) {
if (DaftIeDocument.isReadable(doc))
return new DaftIeDocument(doc);
else
return null;
}
```
Hope this helps! |
TeachingKidsProgramming/TeachingKidsProgramming.Source.Java | src/main/java/org/teachingextensions/logo/Sound.java | Sound.setSound | public synchronized void setSound(TKPSound mySound)
{
String sound = "soundFiles/" + mySound + ".wav";
URL resource = this.getClass().getResource(sound);
if (resource == null)
{
resource = this.getClass().getClassLoader().getResource(sound);
}
if (resource == null) { throw new IllegalSta... | java | public synchronized void setSound(TKPSound mySound)
{
String sound = "soundFiles/" + mySound + ".wav";
URL resource = this.getClass().getResource(sound);
if (resource == null)
{
resource = this.getClass().getClassLoader().getResource(sound);
}
if (resource == null) { throw new IllegalSta... | [
"public",
"synchronized",
"void",
"setSound",
"(",
"TKPSound",
"mySound",
")",
"{",
"String",
"sound",
"=",
"\"soundFiles/\"",
"+",
"mySound",
"+",
"\".wav\"",
";",
"URL",
"resource",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getResource",
"(",
"sound",
... | Sets a sound that you can play through your speakers.
Use a TKPSound (there is a list)<br>
<b>Example:</b> {@code Sound.setSound(TKPSound.Ahem)} | [
"Sets",
"a",
"sound",
"that",
"you",
"can",
"play",
"through",
"your",
"speakers",
".",
"Use",
"a",
"TKPSound",
"(",
"there",
"is",
"a",
"list",
")",
"<br",
">",
"<b",
">",
"Example",
":",
"<",
"/",
"b",
">",
"{"
] | 516fee15e537ecdb3f4dcbe3695c5cfde7e930da | https://github.com/TeachingKidsProgramming/TeachingKidsProgramming.Source.Java/blob/516fee15e537ecdb3f4dcbe3695c5cfde7e930da/src/main/java/org/teachingextensions/logo/Sound.java#L38-L48 | test | Set the sound file | Of course, here is the Java code you requested:
```java
public synchronized void setSound(TKPSound mySound)
{
String sound = "soundFiles/" + mySound + ".wav";
URL resource = this.getClass().getResource(sound);
if (resource == null)
{
resource = this.getClass().getClassLoader().getResource(sound... |
Koekiebox-PTY-LTD/Fluid | fluid-api/src/main/java/com/fluidbpm/program/api/vo/ws/auth/ServiceTicket.java | ServiceTicket.toJsonObject | @Override
public JSONObject toJsonObject() throws JSONException {
JSONObject returnVal = new JSONObject();
returnVal.put(JSONMapping.CLIENT, this.getPrincipalClient());
returnVal.put(JSONMapping.SESSION_KEY, this.getSessionKeyBase64());
returnVal.put(JSONMapping.TICKET_EXPIRES, thi... | java | @Override
public JSONObject toJsonObject() throws JSONException {
JSONObject returnVal = new JSONObject();
returnVal.put(JSONMapping.CLIENT, this.getPrincipalClient());
returnVal.put(JSONMapping.SESSION_KEY, this.getSessionKeyBase64());
returnVal.put(JSONMapping.TICKET_EXPIRES, thi... | [
"@",
"Override",
"public",
"JSONObject",
"toJsonObject",
"(",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"returnVal",
"=",
"new",
"JSONObject",
"(",
")",
";",
"returnVal",
".",
"put",
"(",
"JSONMapping",
".",
"CLIENT",
",",
"this",
".",
"getPrincipalCl... | Conversion to {@code JSONObject} from Java Object.
@return {@code JSONObject} representation of {@code ServiceTicket}
@throws JSONException If there is a problem with the JSON Body. | [
"Conversion",
"to",
"{",
"@code",
"JSONObject",
"}",
"from",
"Java",
"Object",
"."
] | 81153d865f71b84ca933532c7115717bc3979270 | https://github.com/Koekiebox-PTY-LTD/Fluid/blob/81153d865f71b84ca933532c7115717bc3979270/fluid-api/src/main/java/com/fluidbpm/program/api/vo/ws/auth/ServiceTicket.java#L97-L108 | test | Returns the object representation of the IdentityBase64 object. | Of course, here is the Java code you requested:
```java
@Override
public JSONObject toJsonObject() throws JSONException {
JSONObject returnVal = new JSONObject();
returnVal.put(JSONMapping.CLIENT, this.getPrincipalClient());
returnVal.put(JSONMapping.SESSION_KEY, this.getSessionKeyBase64(... |
algolia/algoliasearch-client-android | algoliasearch/src/main/java/com/algolia/search/saas/Query.java | Query.setAroundLatLng | public @NonNull
Query setAroundLatLng(@Nullable LatLng location) {
if (location == null) {
return set(KEY_AROUND_LAT_LNG, null);
} else {
return set(KEY_AROUND_LAT_LNG, location.lat + "," + location.lng);
}
} | java | public @NonNull
Query setAroundLatLng(@Nullable LatLng location) {
if (location == null) {
return set(KEY_AROUND_LAT_LNG, null);
} else {
return set(KEY_AROUND_LAT_LNG, location.lat + "," + location.lng);
}
} | [
"public",
"@",
"NonNull",
"Query",
"setAroundLatLng",
"(",
"@",
"Nullable",
"LatLng",
"location",
")",
"{",
"if",
"(",
"location",
"==",
"null",
")",
"{",
"return",
"set",
"(",
"KEY_AROUND_LAT_LNG",
",",
"null",
")",
";",
"}",
"else",
"{",
"return",
"set... | Search for entries around a given latitude/longitude. | [
"Search",
"for",
"entries",
"around",
"a",
"given",
"latitude",
"/",
"longitude",
"."
] | 3293ba6e6116a4f6c1face2cc606bc047d6d4a3c | https://github.com/algolia/algoliasearch-client-android/blob/3293ba6e6116a4f6c1face2cc606bc047d6d4a3c/algoliasearch/src/main/java/com/algolia/search/saas/Query.java#L370-L377 | test | Sets the AroundLatLng parameter. | Of course, here is the Java code you requested:
```java
public @NonNull
Query setAroundLatLng(@Nullable LatLng location) {
if (location == null) {
return set(KEY_AROUND_LAT_LNG, null);
} else {
return set(KEY_AROUND_LAT_LNG, location.lat + "," + location.lng);
}
... |
real-logic/aeron | aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java | AeronArchive.listRecording | public int listRecording(final long recordingId, final RecordingDescriptorConsumer consumer)
{
lock.lock();
try
{
ensureOpen();
final long correlationId = aeron.nextCorrelationId();
if (!archiveProxy.listRecording(recordingId, correlationId, controlSessi... | java | public int listRecording(final long recordingId, final RecordingDescriptorConsumer consumer)
{
lock.lock();
try
{
ensureOpen();
final long correlationId = aeron.nextCorrelationId();
if (!archiveProxy.listRecording(recordingId, correlationId, controlSessi... | [
"public",
"int",
"listRecording",
"(",
"final",
"long",
"recordingId",
",",
"final",
"RecordingDescriptorConsumer",
"consumer",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"ensureOpen",
"(",
")",
";",
"final",
"long",
"correlationId",
"=",
"aer... | List a recording descriptor for a single recording id.
<p>
If the recording id is greater than the largest known id then nothing is returned.
@param recordingId at which to begin the listing.
@param consumer to which the descriptors are dispatched.
@return the number of descriptors found and consumed. | [
"List",
"a",
"recording",
"descriptor",
"for",
"a",
"single",
"recording",
"id",
".",
"<p",
">",
"If",
"the",
"recording",
"id",
"is",
"greater",
"than",
"the",
"largest",
"known",
"id",
"then",
"nothing",
"is",
"returned",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java#L875-L895 | test | List a single recording. | Of course, here is the Java code you requested:
```java
public int listRecording(final long recordingId, final RecordingDescriptorConsumer consumer)
{
lock.lock();
try
{
ensureOpen();
final long correlationId = aeron.nextCorrelationId();
if (!archivePro... |
Unidata/thredds | cdm/src/main/java/ucar/nc2/ft/point/standard/CoordSysEvaluator.java | CoordSysEvaluator.findCoordNameByType | static public String findCoordNameByType(NetcdfDataset ds, AxisType atype) {
CoordinateAxis coordAxis = findCoordByType(ds, atype);
return coordAxis == null ? null : coordAxis.getFullName();
} | java | static public String findCoordNameByType(NetcdfDataset ds, AxisType atype) {
CoordinateAxis coordAxis = findCoordByType(ds, atype);
return coordAxis == null ? null : coordAxis.getFullName();
} | [
"static",
"public",
"String",
"findCoordNameByType",
"(",
"NetcdfDataset",
"ds",
",",
"AxisType",
"atype",
")",
"{",
"CoordinateAxis",
"coordAxis",
"=",
"findCoordByType",
"(",
"ds",
",",
"atype",
")",
";",
"return",
"coordAxis",
"==",
"null",
"?",
"null",
":"... | search for Axis by Type.
@param ds search in this dataset's "Best" coordinate system.
@param atype search for this type of CoordinateAxis. takes the first one it finds.
@return the found CoordinateAxis name, or null if none | [
"search",
"for",
"Axis",
"by",
"Type",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/ft/point/standard/CoordSysEvaluator.java#L47-L50 | test | Find the full name of the coordinate axis of the specified type. | Of course, here is the Java code you requested:
```java
static public String findCoordNameByType(NetcdfDataset ds, AxisType atype) {
CoordinateAxis coordAxis = findCoordByType(ds, atype);
return coordAxis == null ? null : coordAxis.getFullName();
}
```
Hope this helps! |
kocakosm/pitaya | src/org/kocakosm/pitaya/util/XArrays.java | XArrays.reverse | public static <T> T[] reverse(T[] a)
{
int len = a.length;
T[] copy = newArray(a.getClass().getComponentType(), len);
for (int i = 0; i < len; i++) {
copy[i] = a[len - i - 1];
}
return copy;
} | java | public static <T> T[] reverse(T[] a)
{
int len = a.length;
T[] copy = newArray(a.getClass().getComponentType(), len);
for (int i = 0; i < len; i++) {
copy[i] = a[len - i - 1];
}
return copy;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"reverse",
"(",
"T",
"[",
"]",
"a",
")",
"{",
"int",
"len",
"=",
"a",
".",
"length",
";",
"T",
"[",
"]",
"copy",
"=",
"newArray",
"(",
"a",
".",
"getClass",
"(",
")",
".",
"getComponentType",
... | Returns a new array containing the same elements as the given one,
but in reverse order.
@param <T> the type of the elements in the array to reverse.
@param a the array to reverse.
@return the reversed array.
@throws NullPointerException if {@code a} is {@code null}. | [
"Returns",
"a",
"new",
"array",
"containing",
"the",
"same",
"elements",
"as",
"the",
"given",
"one",
"but",
"in",
"reverse",
"order",
"."
] | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/util/XArrays.java#L931-L939 | test | Reverses the elements of an array. | Of course, here is the Java code you requested:
```java
public static <T> T[] reverse(T[] a)
{
int len = a.length;
T[] copy = newArray(a.getClass().getComponentType(), len);
for (int i = 0; i < len; i++) {
copy[i] = a[len - i - 1];
}
return copy;
}
```
Hope this helps! |
spring-projects/spring-security | oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequest.java | OAuth2AuthorizationRequest.from | public static Builder from(OAuth2AuthorizationRequest authorizationRequest) {
Assert.notNull(authorizationRequest, "authorizationRequest cannot be null");
return new Builder(authorizationRequest.getGrantType())
.authorizationUri(authorizationRequest.getAuthorizationUri())
.clientId(authorizationRequest.get... | java | public static Builder from(OAuth2AuthorizationRequest authorizationRequest) {
Assert.notNull(authorizationRequest, "authorizationRequest cannot be null");
return new Builder(authorizationRequest.getGrantType())
.authorizationUri(authorizationRequest.getAuthorizationUri())
.clientId(authorizationRequest.get... | [
"public",
"static",
"Builder",
"from",
"(",
"OAuth2AuthorizationRequest",
"authorizationRequest",
")",
"{",
"Assert",
".",
"notNull",
"(",
"authorizationRequest",
",",
"\"authorizationRequest cannot be null\"",
")",
";",
"return",
"new",
"Builder",
"(",
"authorizationRequ... | Returns a new {@link Builder}, initialized with the values
from the provided {@code authorizationRequest}.
@since 5.1
@param authorizationRequest the authorization request used for initializing the {@link Builder}
@return the {@link Builder} | [
"Returns",
"a",
"new",
"{",
"@link",
"Builder",
"}",
"initialized",
"with",
"the",
"values",
"from",
"the",
"provided",
"{",
"@code",
"authorizationRequest",
"}",
"."
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequest.java#L199-L210 | test | Creates a new builder from the given OAuth2AuthorizationRequest object. | Of course, here is the Java code you requested:
```java
public static Builder from(OAuth2AuthorizationRequest authorizationRequest) {
Assert.notNull(authorizationRequest, "authorizationRequest cannot be null");
return new Builder(authorizationRequest.getGrantType())
.authorizationUri(authorizationRequest.getA... |
apache/parquet-mr | parquet-column/src/main/java/org/apache/parquet/io/ValidatingRecordConsumer.java | ValidatingRecordConsumer.endMessage | public void endMessage() {
delegate.endMessage();
validateMissingFields(types.peek().asGroupType().getFieldCount());
previousField.pop();
} | java | public void endMessage() {
delegate.endMessage();
validateMissingFields(types.peek().asGroupType().getFieldCount());
previousField.pop();
} | [
"public",
"void",
"endMessage",
"(",
")",
"{",
"delegate",
".",
"endMessage",
"(",
")",
";",
"validateMissingFields",
"(",
"types",
".",
"peek",
"(",
")",
".",
"asGroupType",
"(",
")",
".",
"getFieldCount",
"(",
")",
")",
";",
"previousField",
".",
"pop"... | {@inheritDoc} | [
"{"
] | 62dcc68acaf64012bf731e103be780956f1f446d | https://github.com/apache/parquet-mr/blob/62dcc68acaf64012bf731e103be780956f1f446d/parquet-column/src/main/java/org/apache/parquet/io/ValidatingRecordConsumer.java#L71-L75 | test | End a message. | Of course, here is the Java code you requested:
```java
public void endMessage() {
delegate.endMessage();
validateMissingFields(types.peek().asGroupType().getFieldCount());
previousField.pop();
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/ucar/unidata/geoloc/projection/LambertAzimuthalEqualArea.java | LambertAzimuthalEqualArea.projToLatLon | public float[][] projToLatLon(float[][] from, float[][] to) {
int cnt = from[0].length;
float[] fromXA = from[INDEX_X];
float[] fromYA = from[INDEX_Y];
float[] toLatA = to[INDEX_LAT];
float[] toLonA = to[INDEX_LON];
double toLat, toLon;
for (int i = 0; i < cnt; i++) {
double ... | java | public float[][] projToLatLon(float[][] from, float[][] to) {
int cnt = from[0].length;
float[] fromXA = from[INDEX_X];
float[] fromYA = from[INDEX_Y];
float[] toLatA = to[INDEX_LAT];
float[] toLonA = to[INDEX_LON];
double toLat, toLon;
for (int i = 0; i < cnt; i++) {
double ... | [
"public",
"float",
"[",
"]",
"[",
"]",
"projToLatLon",
"(",
"float",
"[",
"]",
"[",
"]",
"from",
",",
"float",
"[",
"]",
"[",
"]",
"to",
")",
"{",
"int",
"cnt",
"=",
"from",
"[",
"0",
"]",
".",
"length",
";",
"float",
"[",
"]",
"fromXA",
"=",... | Convert lat/lon coordinates to projection coordinates.
@param from array of lat/lon coordinates: from[2][n], where
(from[0][i], from[1][i]) is the (lat,lon) coordinate
of the ith point
@param to resulting array of projection coordinates: to[2][n]
where (to[0][i], to[1][i]) is the (x,y) coordinate
of the ith point
@r... | [
"Convert",
"lat",
"/",
"lon",
"coordinates",
"to",
"projection",
"coordinates",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/unidata/geoloc/projection/LambertAzimuthalEqualArea.java#L464-L511 | test | Converts a projection matrix from LatLon to LatLon. | Of course, here is the Java code you requested:
```java
public float[][] projToLatLon(float[][] from, float[][] to) {
int cnt = from[0].length;
float[] fromXA = from[INDEX_X];
float[] fromYA = from[INDEX_Y];
float[] toLatA = to[INDEX_LAT];
float[] toLonA = to[INDEX_LON];
double toLat, t... |
redraiment/jactiverecord | src/main/java/me/zzp/util/Seq.java | Seq.valuesAt | public static <E> E[] valuesAt(E[] a, int... indexes) {
List<E> list = valuesAt(Arrays.asList(a), indexes);
return (E[])list.toArray();
} | java | public static <E> E[] valuesAt(E[] a, int... indexes) {
List<E> list = valuesAt(Arrays.asList(a), indexes);
return (E[])list.toArray();
} | [
"public",
"static",
"<",
"E",
">",
"E",
"[",
"]",
"valuesAt",
"(",
"E",
"[",
"]",
"a",
",",
"int",
"...",
"indexes",
")",
"{",
"List",
"<",
"E",
">",
"list",
"=",
"valuesAt",
"(",
"Arrays",
".",
"asList",
"(",
"a",
")",
",",
"indexes",
")",
"... | 根据给定的下标,选出多个元素,并组成新的数组。
@param <E> 元素类型。
@param a 给定数组。
@param indexes 任意多个要获取的元素下标。
@return 根据下标获得的元素组成的新数组。 | [
"根据给定的下标,选出多个元素,并组成新的数组。"
] | d051709c93204658e7f2cc96c9898201c7337269 | https://github.com/redraiment/jactiverecord/blob/d051709c93204658e7f2cc96c9898201c7337269/src/main/java/me/zzp/util/Seq.java#L171-L174 | test | Returns an array of the values at the specified indexes. | Of course, here is the Java code you requested:
```java
public static <E> E[] valuesAt(E[] a, int... indexes) {
List<E> list = valuesAt(Arrays.asList(a), indexes);
return (E[])list.toArray();
}
```
Hope this helps! |
turbomanage/storm-gen | storm-apt/impl/src/main/java/com/turbomanage/storm/apt/entity/FieldModel.java | FieldModel.capFirst | private String capFirst(String anyName) {
// obscure Java convention:
// if second letter capitalized, leave it alone
if (anyName.length() > 1)
if (anyName.charAt(1) >= 'A' && anyName.charAt(1) <= 'Z')
return anyName;
String capFirstLetter = anyName.substring(0, 1).toUpperCase();
return capFirstLetter ... | java | private String capFirst(String anyName) {
// obscure Java convention:
// if second letter capitalized, leave it alone
if (anyName.length() > 1)
if (anyName.charAt(1) >= 'A' && anyName.charAt(1) <= 'Z')
return anyName;
String capFirstLetter = anyName.substring(0, 1).toUpperCase();
return capFirstLetter ... | [
"private",
"String",
"capFirst",
"(",
"String",
"anyName",
")",
"{",
"// obscure Java convention:",
"// if second letter capitalized, leave it alone",
"if",
"(",
"anyName",
".",
"length",
"(",
")",
">",
"1",
")",
"if",
"(",
"anyName",
".",
"charAt",
"(",
"1",
")... | Capitalizes the first letter to create a valid getter/setter name.
@param String
@return String | [
"Capitalizes",
"the",
"first",
"letter",
"to",
"create",
"a",
"valid",
"getter",
"/",
"setter",
"name",
"."
] | 22caa69439548a074d035745215bce5aff55853d | https://github.com/turbomanage/storm-gen/blob/22caa69439548a074d035745215bce5aff55853d/storm-apt/impl/src/main/java/com/turbomanage/storm/apt/entity/FieldModel.java#L137-L145 | test | Cap first letter of an object name. | Of course, here is the Java code you requested:
```java
private String capFirst(String anyName) {
// obscure Java convention:
// if second letter capitalized, leave it alone
if (anyName.length() > 1)
if (anyName.charAt(1) >= 'A' && anyName.charAt(1) <= 'Z')
return anyName;
String capFirstLetter = anyNam... |
3pillarlabs/spring-integration-aws | spring-integration-aws/src/main/java/org/springframework/integration/aws/sqs/config/SqsNamespaceHandler.java | SqsNamespaceHandler.init | @Override
public void init() {
this.registerBeanDefinitionParser("inbound-channel-adapter",
new SqsInboundChannelAdapterParser());
this.registerBeanDefinitionParser("outbound-channel-adapter",
new SqsOutboundChannelAdapterParser());
this.registerBeanDefinitionParser("outbound-gateway",
new SqsOutboun... | java | @Override
public void init() {
this.registerBeanDefinitionParser("inbound-channel-adapter",
new SqsInboundChannelAdapterParser());
this.registerBeanDefinitionParser("outbound-channel-adapter",
new SqsOutboundChannelAdapterParser());
this.registerBeanDefinitionParser("outbound-gateway",
new SqsOutboun... | [
"@",
"Override",
"public",
"void",
"init",
"(",
")",
"{",
"this",
".",
"registerBeanDefinitionParser",
"(",
"\"inbound-channel-adapter\"",
",",
"new",
"SqsInboundChannelAdapterParser",
"(",
")",
")",
";",
"this",
".",
"registerBeanDefinitionParser",
"(",
"\"outbound-c... | /*
(non-Javadoc)
@see org.springframework.beans.factory.xml.NamespaceHandler#init() | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 6d2e8c63cc0cd5b666356a696e80674952302495 | https://github.com/3pillarlabs/spring-integration-aws/blob/6d2e8c63cc0cd5b666356a696e80674952302495/spring-integration-aws/src/main/java/org/springframework/integration/aws/sqs/config/SqsNamespaceHandler.java#L19-L28 | test | Initialize the BeanDefinitions. | Of course, here is the Java code you requested:
```java
@Override
public void init() {
this.registerBeanDefinitionParser("inbound-channel-adapter",
new SqsInboundChannelAdapterParser());
this.registerBeanDefinitionParser("outbound-channel-adapter",
new SqsOutboundChannelAdapterParser());
this.registerBe... |
Unidata/thredds | udunits/src/main/java/ucar/units/SI.java | SI.baseUnitDB | private static UnitDBImpl baseUnitDB() throws NameException, UnitExistsException, NoSuchUnitException {
final UnitDBImpl db = new UnitDBImpl(9, 9);
db.addUnit(AMPERE);
db.addUnit(CANDELA);
db.addUnit(KELVIN);
db.addUnit(KILOGRAM);
db.addUnit(METER);
db.addUnit(MOLE);
db.addUnit(SECOND);
... | java | private static UnitDBImpl baseUnitDB() throws NameException, UnitExistsException, NoSuchUnitException {
final UnitDBImpl db = new UnitDBImpl(9, 9);
db.addUnit(AMPERE);
db.addUnit(CANDELA);
db.addUnit(KELVIN);
db.addUnit(KILOGRAM);
db.addUnit(METER);
db.addUnit(MOLE);
db.addUnit(SECOND);
... | [
"private",
"static",
"UnitDBImpl",
"baseUnitDB",
"(",
")",
"throws",
"NameException",
",",
"UnitExistsException",
",",
"NoSuchUnitException",
"{",
"final",
"UnitDBImpl",
"db",
"=",
"new",
"UnitDBImpl",
"(",
"9",
",",
"9",
")",
";",
"db",
".",
"addUnit",
"(",
... | Returns the base unit database of the SI.
@return The base unit database of the SI.
@throws NameException Bad unit name.
@throws UnitExistsException Attempt to redefine an existing unit.
@throws NoSuchUnitException Necessary unit not found. | [
"Returns",
"the",
"base",
"unit",
"database",
"of",
"the",
"SI",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/udunits/src/main/java/ucar/units/SI.java#L642-L655 | test | Create a base unit database. | Of course, here is the Java code you requested:
```java
private static UnitDBImpl baseUnitDB() throws NameException, UnitExistsException, NoSuchUnitException {
final UnitDBImpl db = new UnitDBImpl(9, 9);
db.addUnit(AMPERE);
db.addUnit(CANDELA);
db.addUnit(KELVIN);
db.addUnit(KILOGRAM);
db.addUn... |
DigitalPebble/storm-crawler | core/src/main/java/com/digitalpebble/stormcrawler/filtering/basic/BasicURLNormalizer.java | BasicURLNormalizer.unescapePath | private String unescapePath(String path) {
Matcher matcher = illegalEscapePattern.matcher(path);
StringBuilder sb = null;
int end = 0;
while (matcher.find()) {
if (sb == null) {
sb = new StringBuilder();
}
// Append everything up to t... | java | private String unescapePath(String path) {
Matcher matcher = illegalEscapePattern.matcher(path);
StringBuilder sb = null;
int end = 0;
while (matcher.find()) {
if (sb == null) {
sb = new StringBuilder();
}
// Append everything up to t... | [
"private",
"String",
"unescapePath",
"(",
"String",
"path",
")",
"{",
"Matcher",
"matcher",
"=",
"illegalEscapePattern",
".",
"matcher",
"(",
"path",
")",
";",
"StringBuilder",
"sb",
"=",
"null",
";",
"int",
"end",
"=",
"0",
";",
"while",
"(",
"matcher",
... | Remove % encoding from path segment in URL for characters which should be
unescaped according to <a
href="https://tools.ietf.org/html/rfc3986#section-2.2">RFC3986</a> as
well as non-standard implementations of percent encoding, see
<https://en.
wikipedia.org/wiki/Percent-encoding#Non-standard_implementations>. | [
"Remove",
"%",
"encoding",
"from",
"path",
"segment",
"in",
"URL",
"for",
"characters",
"which",
"should",
"be",
"unescaped",
"according",
"to",
"<a",
"href",
"=",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc3986#section",
... | 5d0465192ab8fbd89a90db32cb20960a282411ea | https://github.com/DigitalPebble/storm-crawler/blob/5d0465192ab8fbd89a90db32cb20960a282411ea/core/src/main/java/com/digitalpebble/stormcrawler/filtering/basic/BasicURLNormalizer.java#L344-L401 | test | Unescapes the path. | Of course, here is the Java code you requested:
```java
private String unescapePath(String path) {
Matcher matcher = illegalEscapePattern.matcher(path);
StringBuilder sb = null;
int end = 0;
while (matcher.find()) {
if (sb == null) {
sb = new StringBuilder(... |
algolia/algoliasearch-client-android | algoliasearch/src/offline/java/com/algolia/search/saas/OfflineIndex.java | OfflineIndex.multipleQueriesAsync | public Request multipleQueriesAsync(final @NonNull List<Query> queries, @Nullable final Client.MultipleQueriesStrategy strategy, @NonNull CompletionHandler completionHandler) {
final List<Query> queriesCopy = new ArrayList<>(queries);
return getClient().new AsyncTaskRequest(completionHandler) {
... | java | public Request multipleQueriesAsync(final @NonNull List<Query> queries, @Nullable final Client.MultipleQueriesStrategy strategy, @NonNull CompletionHandler completionHandler) {
final List<Query> queriesCopy = new ArrayList<>(queries);
return getClient().new AsyncTaskRequest(completionHandler) {
... | [
"public",
"Request",
"multipleQueriesAsync",
"(",
"final",
"@",
"NonNull",
"List",
"<",
"Query",
">",
"queries",
",",
"@",
"Nullable",
"final",
"Client",
".",
"MultipleQueriesStrategy",
"strategy",
",",
"@",
"NonNull",
"CompletionHandler",
"completionHandler",
")",
... | Run multiple queries on this index with one API call.
A variant of {@link Client#multipleQueriesAsync(List, Client.MultipleQueriesStrategy, CompletionHandler)}
where the targeted index is always the receiver.
@param queries The queries to run.
@param strategy The strategy to use.
@param completionHandler The listener ... | [
"Run",
"multiple",
"queries",
"on",
"this",
"index",
"with",
"one",
"API",
"call",
".",
"A",
"variant",
"of",
"{",
"@link",
"Client#multipleQueriesAsync",
"(",
"List",
"Client",
".",
"MultipleQueriesStrategy",
"CompletionHandler",
")",
"}",
"where",
"the",
"targ... | 3293ba6e6116a4f6c1face2cc606bc047d6d4a3c | https://github.com/algolia/algoliasearch-client-android/blob/3293ba6e6116a4f6c1face2cc606bc047d6d4a3c/algoliasearch/src/offline/java/com/algolia/search/saas/OfflineIndex.java#L242-L251 | test | Asynchronously sends a list of multiple queries to Algolia API. | Of course, here is the Java code you requested:
```java
public Request multipleQueriesAsync(final @NonNull List<Query> queries, @Nullable final Client.MultipleQueriesStrategy strategy, @NonNull CompletionHandler completionHandler) {
final List<Query> queriesCopy = new ArrayList<>(queries);
return getCl... |
oblac/jodd | jodd-core/src/main/java/jodd/cli/Cli.java | Cli.printUsage | public void printUsage(final String commandName) {
final StringBuilder usage = new StringBuilder(commandName);
for (final Option option : options) {
if (option.shortName != null) {
usage.append(" [-").append(option.shortName).append("]");
} else if (option.longName != null) {
usage.append(" [--").app... | java | public void printUsage(final String commandName) {
final StringBuilder usage = new StringBuilder(commandName);
for (final Option option : options) {
if (option.shortName != null) {
usage.append(" [-").append(option.shortName).append("]");
} else if (option.longName != null) {
usage.append(" [--").app... | [
"public",
"void",
"printUsage",
"(",
"final",
"String",
"commandName",
")",
"{",
"final",
"StringBuilder",
"usage",
"=",
"new",
"StringBuilder",
"(",
"commandName",
")",
";",
"for",
"(",
"final",
"Option",
"option",
":",
"options",
")",
"{",
"if",
"(",
"op... | Prints the usage line. | [
"Prints",
"the",
"usage",
"line",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-core/src/main/java/jodd/cli/Cli.java#L215-L231 | test | Prints the usage of the command. | Of course, here is the Java code you requested:
```java
public void printUsage(final String commandName) {
final StringBuilder usage = new StringBuilder(commandName);
for (final Option option : options) {
if (option.shortName != null) {
usage.append(" [-").append(option.shortName).append("]");
} else if... |
playframework/playframework | core/play/src/main/java/play/mvc/Results.java | Results.notFound | public static Result notFound(Path content, boolean inline) {
return notFound(content, inline, StaticFileMimeTypes.fileMimeTypes());
} | java | public static Result notFound(Path content, boolean inline) {
return notFound(content, inline, StaticFileMimeTypes.fileMimeTypes());
} | [
"public",
"static",
"Result",
"notFound",
"(",
"Path",
"content",
",",
"boolean",
"inline",
")",
"{",
"return",
"notFound",
"(",
"content",
",",
"inline",
",",
"StaticFileMimeTypes",
".",
"fileMimeTypes",
"(",
")",
")",
";",
"}"
] | Generates a 404 Not Found result.
@param content The path to send.
@param inline Whether the file should be sent inline, or as an attachment.
@return the result | [
"Generates",
"a",
"404",
"Not",
"Found",
"result",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/core/play/src/main/java/play/mvc/Results.java#L2355-L2357 | test | Returns a Result indicating that the content is not found. | Of course, here is the Java code you requested:
```java
public static Result notFound(Path content, boolean inline) {
return notFound(content, inline, StaticFileMimeTypes.fileMimeTypes());
}
```
Hope this helps! |
wildfly/wildfly | iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/rmi/ir/TypedefDefImpl.java | TypedefDefImpl.describe | public Description describe() {
String defined_in_id = "IR";
if (defined_in instanceof ContainedOperations)
defined_in_id = ((ContainedOperations) defined_in).id();
TypeDescription td = new TypeDescription(name, id, defined_in_id,
version, typeCode);
Any an... | java | public Description describe() {
String defined_in_id = "IR";
if (defined_in instanceof ContainedOperations)
defined_in_id = ((ContainedOperations) defined_in).id();
TypeDescription td = new TypeDescription(name, id, defined_in_id,
version, typeCode);
Any an... | [
"public",
"Description",
"describe",
"(",
")",
"{",
"String",
"defined_in_id",
"=",
"\"IR\"",
";",
"if",
"(",
"defined_in",
"instanceof",
"ContainedOperations",
")",
"defined_in_id",
"=",
"(",
"(",
"ContainedOperations",
")",
"defined_in",
")",
".",
"id",
"(",
... | ContainedImpl implementation ---------------------------------- | [
"ContainedImpl",
"implementation",
"----------------------------------"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/rmi/ir/TypedefDefImpl.java#L56-L70 | test | This method is used to describe the type. | Of course, here is the Java code you requested:
```java
public Description describe() {
String defined_in_id = "IR";
if (defined_in instanceof ContainedOperations)
defined_in_id = ((ContainedOperations) defined_in).id();
TypeDescription td = new TypeDescription(name, id, defined_i... |
DDTH/ddth-cql-utils | src/main/java/com/github/ddth/cql/SessionManager.java | SessionManager.wrapCallbackRow | private FutureCallback<ResultSet> wrapCallbackRow(FutureCallback<Row> callback) {
return new FutureCallback<ResultSet>() {
@Override
public void onSuccess(ResultSet result) {
try {
callback.onSuccess(result.one());
} finally {
... | java | private FutureCallback<ResultSet> wrapCallbackRow(FutureCallback<Row> callback) {
return new FutureCallback<ResultSet>() {
@Override
public void onSuccess(ResultSet result) {
try {
callback.onSuccess(result.one());
} finally {
... | [
"private",
"FutureCallback",
"<",
"ResultSet",
">",
"wrapCallbackRow",
"(",
"FutureCallback",
"<",
"Row",
">",
"callback",
")",
"{",
"return",
"new",
"FutureCallback",
"<",
"ResultSet",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onSuccess",
"(",
... | /*---------------------------------------------------------------------- | [
"/",
"*",
"----------------------------------------------------------------------"
] | debd5d86f64fe06e43d6f0f58cb2f7f0f6a84489 | https://github.com/DDTH/ddth-cql-utils/blob/debd5d86f64fe06e43d6f0f58cb2f7f0f6a84489/src/main/java/com/github/ddth/cql/SessionManager.java#L2144-L2164 | test | Wrap a FutureCallback<ResultSet > in a FutureCallback<ResultSet > | Of course, here is the Java code you requested:
```java
private FutureCallback<ResultSet> wrapCallbackRow(FutureCallback<Row> callback) {
return new FutureCallback<ResultSet>() {
@Override
public void onSuccess(ResultSet result) {
try {
callback.onSuc... |
Unidata/thredds | visad/src/main/java/ucar/nc2/iosp/vis5d/Vis5DIosp.java | Vis5DIosp.open | public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException {
super.open(raf, ncfile, cancelTask);
if (unitTable == null) {
initUnitTable();
}
if (v5dstruct == null) {
makeFile(raf, ncfile, cancelTask);
}
} | java | public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException {
super.open(raf, ncfile, cancelTask);
if (unitTable == null) {
initUnitTable();
}
if (v5dstruct == null) {
makeFile(raf, ncfile, cancelTask);
}
} | [
"public",
"void",
"open",
"(",
"RandomAccessFile",
"raf",
",",
"NetcdfFile",
"ncfile",
",",
"CancelTask",
"cancelTask",
")",
"throws",
"IOException",
"{",
"super",
".",
"open",
"(",
"raf",
",",
"ncfile",
",",
"cancelTask",
")",
";",
"if",
"(",
"unitTable",
... | Open the service provider for reading.
@param raf file to read from
@param ncfile netCDF file we are writing to (memory)
@param cancelTask task for cancelling
@throws IOException problem reading file | [
"Open",
"the",
"service",
"provider",
"for",
"reading",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/visad/src/main/java/ucar/nc2/iosp/vis5d/Vis5DIosp.java#L186-L194 | test | Create the file. | Of course, here is the Java code you requested:
```java
public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException {
super.open(raf, ncfile, cancelTask);
if (unitTable == null) {
initUnitTable();
}
if (v5dstruct == null) {
makeFile(raf, ncfile, cance... |
orientechnologies/orientdb | client/src/main/java/com/orientechnologies/orient/core/metadata/schema/OClassRemote.java | OClassRemote.truncateCluster | @Override
public OClass truncateCluster(String clusterName) {
final ODatabaseDocumentInternal database = getDatabase();
database.checkSecurity(ORule.ResourceGeneric.CLASS, ORole.PERMISSION_DELETE, name);
acquireSchemaReadLock();
try {
final String cmd = String.format("truncate cluster %s", clus... | java | @Override
public OClass truncateCluster(String clusterName) {
final ODatabaseDocumentInternal database = getDatabase();
database.checkSecurity(ORule.ResourceGeneric.CLASS, ORole.PERMISSION_DELETE, name);
acquireSchemaReadLock();
try {
final String cmd = String.format("truncate cluster %s", clus... | [
"@",
"Override",
"public",
"OClass",
"truncateCluster",
"(",
"String",
"clusterName",
")",
"{",
"final",
"ODatabaseDocumentInternal",
"database",
"=",
"getDatabase",
"(",
")",
";",
"database",
".",
"checkSecurity",
"(",
"ORule",
".",
"ResourceGeneric",
".",
"CLASS... | {@inheritDoc} | [
"{"
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/client/src/main/java/com/orientechnologies/orient/core/metadata/schema/OClassRemote.java#L261-L275 | test | Truncate the cluster. | Of course, here is the Java code you requested:
```java
@Override
public OClass truncateCluster(String clusterName) {
final ODatabaseDocumentInternal database = getDatabase();
database.checkSecurity(ORule.ResourceGeneric.CLASS, ORole.PERMISSION_DELETE, name);
acquireSchemaReadLock();
try {
fin... |
nyla-solutions/gedi-geode | gedi-geode-extensions-core/src/main/java/gedi/solutions/geode/wan/GetEntriesChecksumFunction.java | GetEntriesChecksumFunction.buildCheckSumMap | HashMap<Serializable,BigInteger> buildCheckSumMap(Region<Serializable,Object> region)
{
if(region.getAttributes().getDataPolicy().withPartitioning())
{
region = PartitionRegionHelper.getLocalData(region);
}
Set<Serializable> keySet = region.keySet();
if(keySet == null || keySet.isEmpty())
ret... | java | HashMap<Serializable,BigInteger> buildCheckSumMap(Region<Serializable,Object> region)
{
if(region.getAttributes().getDataPolicy().withPartitioning())
{
region = PartitionRegionHelper.getLocalData(region);
}
Set<Serializable> keySet = region.keySet();
if(keySet == null || keySet.isEmpty())
ret... | [
"HashMap",
"<",
"Serializable",
",",
"BigInteger",
">",
"buildCheckSumMap",
"(",
"Region",
"<",
"Serializable",
",",
"Object",
">",
"region",
")",
"{",
"if",
"(",
"region",
".",
"getAttributes",
"(",
")",
".",
"getDataPolicy",
"(",
")",
".",
"withPartitionin... | Build check sum map
@param region the region to build the information
@return the map of the keys/checksums | [
"Build",
"check",
"sum",
"map"
] | 3dd71d6e66e941ce350b306b70677ee95a7d9eee | https://github.com/nyla-solutions/gedi-geode/blob/3dd71d6e66e941ce350b306b70677ee95a7d9eee/gedi-geode-extensions-core/src/main/java/gedi/solutions/geode/wan/GetEntriesChecksumFunction.java#L78-L121 | test | Build a HashMap of check sums from a Region. | Of course, here is the Java code you requested:
```java
HashMap<Serializable,BigInteger> buildCheckSumMap(Region<Serializable,Object> region)
{
if(region.getAttributes().getDataPolicy().withPartitioning())
{
region = PartitionRegionHelper.getLocalData(region);
}
Set<Serializable> keySet = region.key... |
streamsets/datacollector | httpcommonlib/src/main/java/com/streamsets/pipeline/lib/http/JerseyClientUtil.java | JerseyClientUtil.upgradeToJerseyConfigBean | public static void upgradeToJerseyConfigBean(List<Config> configs) {
List<Config> configsToAdd = new ArrayList<>();
List<Config> configsToRemove = new ArrayList<>();
List<String> movedConfigs = ImmutableList.of(
"conf.requestTimeoutMillis",
"conf.numThreads",
"conf.authType",
... | java | public static void upgradeToJerseyConfigBean(List<Config> configs) {
List<Config> configsToAdd = new ArrayList<>();
List<Config> configsToRemove = new ArrayList<>();
List<String> movedConfigs = ImmutableList.of(
"conf.requestTimeoutMillis",
"conf.numThreads",
"conf.authType",
... | [
"public",
"static",
"void",
"upgradeToJerseyConfigBean",
"(",
"List",
"<",
"Config",
">",
"configs",
")",
"{",
"List",
"<",
"Config",
">",
"configsToAdd",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"Config",
">",
"configsToRemove",
"=",
"ne... | Helper method to upgrade both HTTP stages to the JerseyConfigBean
@param configs List of configs to upgrade. | [
"Helper",
"method",
"to",
"upgrade",
"both",
"HTTP",
"stages",
"to",
"the",
"JerseyConfigBean"
] | ea63245ea14d59d5229248387f0628f46131eae5 | https://github.com/streamsets/datacollector/blob/ea63245ea14d59d5229248387f0628f46131eae5/httpcommonlib/src/main/java/com/streamsets/pipeline/lib/http/JerseyClientUtil.java#L122-L146 | test | Upgrade the configuration to the Jersey config bean. | Of course, here is the Java code you requested:
```java
public static void upgradeToJerseyConfigBean(List<Config> configs) {
List<Config> configsToAdd = new ArrayList<>();
List<Config> configsToRemove = new ArrayList<>();
List<String> movedConfigs = ImmutableList.of(
"conf.requestTimeoutMillis",
... |
oaqa/baseqa | src/main/java/edu/cmu/lti/oaqa/type/retrieval/ComplexQueryConcept.java | ComplexQueryConcept.setOperatorArgs | public void setOperatorArgs(FSList v) {
if (ComplexQueryConcept_Type.featOkTst && ((ComplexQueryConcept_Type)jcasType).casFeat_operatorArgs == null)
jcasType.jcas.throwFeatMissing("operatorArgs", "edu.cmu.lti.oaqa.type.retrieval.ComplexQueryConcept");
jcasType.ll_cas.ll_setRefValue(addr, ((ComplexQueryCon... | java | public void setOperatorArgs(FSList v) {
if (ComplexQueryConcept_Type.featOkTst && ((ComplexQueryConcept_Type)jcasType).casFeat_operatorArgs == null)
jcasType.jcas.throwFeatMissing("operatorArgs", "edu.cmu.lti.oaqa.type.retrieval.ComplexQueryConcept");
jcasType.ll_cas.ll_setRefValue(addr, ((ComplexQueryCon... | [
"public",
"void",
"setOperatorArgs",
"(",
"FSList",
"v",
")",
"{",
"if",
"(",
"ComplexQueryConcept_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"ComplexQueryConcept_Type",
")",
"jcasType",
")",
".",
"casFeat_operatorArgs",
"==",
"null",
")",
"jcasType",
".",
"jcas",... | setter for operatorArgs - sets The operator arguments in a complex query concept.
@generated
@param v value to set into the feature | [
"setter",
"for",
"operatorArgs",
"-",
"sets",
"The",
"operator",
"arguments",
"in",
"a",
"complex",
"query",
"concept",
"."
] | 6ea632d8e51e3e617d4876fc1185c49be0ad7eb8 | https://github.com/oaqa/baseqa/blob/6ea632d8e51e3e617d4876fc1185c49be0ad7eb8/src/main/java/edu/cmu/lti/oaqa/type/retrieval/ComplexQueryConcept.java#L105-L108 | test | setter for operatorArgs - sets | Of course, here is the Java code you requested:
```java
public void setOperatorArgs(FSList v) {
if (ComplexQueryConcept_Type.featOkTst && ((ComplexQueryConcept_Type)jcasType).casFeat_operatorArgs == null)
jcasType.jcas.throwFeatMissing("operatorArgs", "edu.cmu.lti.oaqa.type.retrieval.ComplexQueryConcept");
... |
liveontologies/elk-reasoner | elk-util-parent/elk-util-logging/src/main/java/org/semanticweb/elk/util/logging/statistics/StatisticsPrinter.java | StatisticsPrinter.printHeader | public void printHeader() {
printSeparator();
addPadding(' ', headerParams_);
logger_.debug(String.format(headerFormat_, headerParams_));
printSeparator();
} | java | public void printHeader() {
printSeparator();
addPadding(' ', headerParams_);
logger_.debug(String.format(headerFormat_, headerParams_));
printSeparator();
} | [
"public",
"void",
"printHeader",
"(",
")",
"{",
"printSeparator",
"(",
")",
";",
"addPadding",
"(",
"'",
"'",
",",
"headerParams_",
")",
";",
"logger_",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"headerFormat_",
",",
"headerParams_",
")",
")",
";"... | Prints the heading together with the separators | [
"Prints",
"the",
"heading",
"together",
"with",
"the",
"separators"
] | cfbe5279a57e0433d45c1676c7658ddb6e29b9eb | https://github.com/liveontologies/elk-reasoner/blob/cfbe5279a57e0433d45c1676c7658ddb6e29b9eb/elk-util-parent/elk-util-logging/src/main/java/org/semanticweb/elk/util/logging/statistics/StatisticsPrinter.java#L136-L141 | test | Print the header of the response. | Of course, here is the Java code you requested:
```java
public void printHeader() {
printSeparator();
addPadding(' ', headerParams_);
logger_.debug(String.format(headerFormat_, headerParams_));
printSeparator();
}
```
Hope this helps! |
OpenEstate/OpenEstate-IO | ImmoXML/src/main/jaxb/org/openestate/io/immoxml/xml/BebaubarNach.java | BebaubarNach.setBebaubarAttr | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public void setBebaubarAttr(BebaubarNach.BebaubarAttr value) {
this.bebaubarAttr = value;
} | java | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public void setBebaubarAttr(BebaubarNach.BebaubarAttr value) {
this.bebaubarAttr = value;
} | [
"@",
"Generated",
"(",
"value",
"=",
"\"com.sun.tools.xjc.Driver\"",
",",
"date",
"=",
"\"2018-10-12T02:50:55+02:00\"",
",",
"comments",
"=",
"\"JAXB RI v2.2.11\"",
")",
"public",
"void",
"setBebaubarAttr",
"(",
"BebaubarNach",
".",
"BebaubarAttr",
"value",
")",
"{",
... | Sets the value of the bebaubarAttr property.
@param value
allowed object is
{@link BebaubarNach.BebaubarAttr } | [
"Sets",
"the",
"value",
"of",
"the",
"bebaubarAttr",
"property",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/ImmoXML/src/main/jaxb/org/openestate/io/immoxml/xml/BebaubarNach.java#L64-L67 | test | Sets the value of the beaconAttr property. | Of course, here is the Java code you requested:
```java
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public void setBebaubarAttr(BebaubarNach.BebaubarAttr value) {
this.bebaubarAttr = value;
}
```
Hope this helps! |
agentsoz/jill | jill/src/main/java/io/github/agentsoz/jill/Main.java | Main.arePoolsIdle | public static boolean arePoolsIdle() {
boolean idle = true;
for (int i = 0; i < npools; i++) {
idle &= (intentionSelectors[i] == null) || intentionSelectors[i].isIdle();
}
return idle;
} | java | public static boolean arePoolsIdle() {
boolean idle = true;
for (int i = 0; i < npools; i++) {
idle &= (intentionSelectors[i] == null) || intentionSelectors[i].isIdle();
}
return idle;
} | [
"public",
"static",
"boolean",
"arePoolsIdle",
"(",
")",
"{",
"boolean",
"idle",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"npools",
";",
"i",
"++",
")",
"{",
"idle",
"&=",
"(",
"intentionSelectors",
"[",
"i",
"]",
"==",
... | Checks if the system is idle, i.e., all the agents pools are idle
@return true if idle, false otherwise | [
"Checks",
"if",
"the",
"system",
"is",
"idle",
"i",
".",
"e",
".",
"all",
"the",
"agents",
"pools",
"are",
"idle"
] | 13126fc78350465b477386132465f84cad719426 | https://github.com/agentsoz/jill/blob/13126fc78350465b477386132465f84cad719426/jill/src/main/java/io/github/agentsoz/jill/Main.java#L255-L261 | test | Returns true if all the pools in the pool are idle. | Of course, here is the Java code you requested:
```java
public static boolean arePoolsIdle() {
boolean idle = true;
for (int i = 0; i < npools; i++) {
idle &= (intentionSelectors[i] == null) || intentionSelectors[i].isIdle();
}
return idle;
}
```
Hope this helps! |
RuedigerMoeller/fast-serialization | src/main/java/org/nustaq/serialization/coders/FSTBytezEncoder.java | FSTBytezEncoder.writeRawBytes | public void writeRawBytes(byte[] array, int start, int length) throws IOException {
ensureFree((int) (pos+length));
buffout.set(pos,array,start,length);
pos += length;
} | java | public void writeRawBytes(byte[] array, int start, int length) throws IOException {
ensureFree((int) (pos+length));
buffout.set(pos,array,start,length);
pos += length;
} | [
"public",
"void",
"writeRawBytes",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"ensureFree",
"(",
"(",
"int",
")",
"(",
"pos",
"+",
"length",
")",
")",
";",
"buffout",
".",
"set",
"(",... | does not write length, just plain bytes
@param array
@param length
@throws java.io.IOException | [
"does",
"not",
"write",
"length",
"just",
"plain",
"bytes"
] | 59f8f800b79479d0b9c80901cf55903d9b027f26 | https://github.com/RuedigerMoeller/fast-serialization/blob/59f8f800b79479d0b9c80901cf55903d9b027f26/src/main/java/org/nustaq/serialization/coders/FSTBytezEncoder.java#L150-L154 | test | Write raw bytes. | Of course, here is the Java code you requested:
```java
public void writeRawBytes(byte[] array, int start, int length) throws IOException {
ensureFree((int) (pos+length));
buffout.set(pos,array,start,length);
pos += length;
}
```
Hope this helps! |
rupertlssmith/lojix | lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/machine/WAMResolvingJavaMachine.java | WAMResolvingJavaMachine.reset | public void reset()
{
// Create fresh heaps, code areas and stacks.
data = ByteBuffer.allocateDirect(TOP << 2).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
codeBuffer = ByteBuffer.allocateDirect(CODE_SIZE);
codeBuffer.order(ByteOrder.LITTLE_ENDIAN);
// Registers are on the ... | java | public void reset()
{
// Create fresh heaps, code areas and stacks.
data = ByteBuffer.allocateDirect(TOP << 2).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
codeBuffer = ByteBuffer.allocateDirect(CODE_SIZE);
codeBuffer.order(ByteOrder.LITTLE_ENDIAN);
// Registers are on the ... | [
"public",
"void",
"reset",
"(",
")",
"{",
"// Create fresh heaps, code areas and stacks.",
"data",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"TOP",
"<<",
"2",
")",
".",
"order",
"(",
"ByteOrder",
".",
"LITTLE_ENDIAN",
")",
".",
"asIntBuffer",
"(",
")",
";... | Resets the machine, to its initial state. This clears any programs from the machine, and clears all of its stacks
and heaps. | [
"Resets",
"the",
"machine",
"to",
"its",
"initial",
"state",
".",
"This",
"clears",
"any",
"programs",
"from",
"the",
"machine",
"and",
"clears",
"all",
"of",
"its",
"stacks",
"and",
"heaps",
"."
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/machine/WAMResolvingJavaMachine.java#L242-L290 | test | Resets the internal code structures. | Of course, here is the Java code you requested:
```java
public void reset()
{
// Create fresh heaps, code areas and stacks.
data = ByteBuffer.allocateDirect(TOP << 2).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
codeBuffer = ByteBuffer.allocateDirect(CODE_SIZE);
codeBuffer.order(By... |
Unidata/thredds | ui/src/main/java/ucar/nc2/ui/geoloc/Rubberband.java | Rubberband.end | public void end(Point p) {
lastPt.x = endPt.x = p.x;
lastPt.y = endPt.y = p.y;
Graphics2D g = (Graphics2D) component.getGraphics();
if(g != null) {
try {
g.setXORMode(component.getBackground());
drawLast(g);
}
finally {
g.dispose();
}
}
} | java | public void end(Point p) {
lastPt.x = endPt.x = p.x;
lastPt.y = endPt.y = p.y;
Graphics2D g = (Graphics2D) component.getGraphics();
if(g != null) {
try {
g.setXORMode(component.getBackground());
drawLast(g);
}
finally {
g.dispose();
}
}
} | [
"public",
"void",
"end",
"(",
"Point",
"p",
")",
"{",
"lastPt",
".",
"x",
"=",
"endPt",
".",
"x",
"=",
"p",
".",
"x",
";",
"lastPt",
".",
"y",
"=",
"endPt",
".",
"y",
"=",
"p",
".",
"y",
";",
"Graphics2D",
"g",
"=",
"(",
"Graphics2D",
")",
... | Last point, done with drawing. | [
"Last",
"point",
"done",
"with",
"drawing",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/ui/src/main/java/ucar/nc2/ui/geoloc/Rubberband.java#L112-L126 | test | End the polygon. | Of course, here is the Java code you requested:
```java
public void end(Point p) {
lastPt.x = endPt.x = p.x;
lastPt.y = endPt.y = p.y;
Graphics2D g = (Graphics2D) component.getGraphics();
if(g != null) {
try {
g.setXORMode(component.getBackground());
drawLast(g);
}
finally... |
wildfly/wildfly | undertow/src/main/java/org/wildfly/extension/undertow/deployment/WarAnnotationDeploymentProcessor.java | WarAnnotationDeploymentProcessor.deploy | public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
return; // Skip non web deployments
... | java | public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
return; // Skip non web deployments
... | [
"public",
"void",
"deploy",
"(",
"final",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"DeploymentUnit",
"deploymentUnit",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
";",
"if",
"(",
"!",
"Dep... | Process web annotations. | [
"Process",
"web",
"annotations",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/undertow/src/main/java/org/wildfly/extension/undertow/deployment/WarAnnotationDeploymentProcessor.java#L108-L139 | test | Process the deployment. | Of course, here is the Java code you requested:
```java
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) ... |
tony19/logback-android | logback-android/src/main/java/ch/qos/logback/core/android/SystemPropertiesProxy.java | SystemPropertiesProxy.getBoolean | public Boolean getBoolean(String key, boolean def)
throws IllegalArgumentException {
if (SystemProperties == null || getBoolean == null) return def;
Boolean ret = def;
try {
ret = (Boolean) getBoolean.invoke(SystemProperties, new Object[]{ key, def });
} catch (IllegalArgumentException e) ... | java | public Boolean getBoolean(String key, boolean def)
throws IllegalArgumentException {
if (SystemProperties == null || getBoolean == null) return def;
Boolean ret = def;
try {
ret = (Boolean) getBoolean.invoke(SystemProperties, new Object[]{ key, def });
} catch (IllegalArgumentException e) ... | [
"public",
"Boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"def",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"SystemProperties",
"==",
"null",
"||",
"getBoolean",
"==",
"null",
")",
"return",
"def",
";",
"Boolean",
"ret",
"=",
"... | Get the value for the given key in the Android system properties, returned
as a boolean.
Values 'n', 'no', '0', 'false' or 'off' are considered false. Values 'y',
'yes', '1', 'true' or 'on' are considered true. (case insensitive). If the
key does not exist, or has any other value, then the default result is
returned.
... | [
"Get",
"the",
"value",
"for",
"the",
"given",
"key",
"in",
"the",
"Android",
"system",
"properties",
"returned",
"as",
"a",
"boolean",
"."
] | 028489c11ccfc1237a53923db06f22a90b41809c | https://github.com/tony19/logback-android/blob/028489c11ccfc1237a53923db06f22a90b41809c/logback-android/src/main/java/ch/qos/logback/core/android/SystemPropertiesProxy.java#L112-L125 | test | Get the value of the specified key as a Boolean. | Of course, here is the Java code you requested:
```java
public Boolean getBoolean(String key, boolean def)
throws IllegalArgumentException {
if (SystemProperties == null || getBoolean == null) return def;
Boolean ret = def;
try {
ret = (Boolean) getBoolean.invoke(SystemProperties, new Object[... |
oblac/jodd | jodd-mail/src/main/java/jodd/mail/EmailAttachmentBuilder.java | EmailAttachmentBuilder.resolveContentType | protected String resolveContentType(final String contentType) {
if (contentType != null) {
return contentType;
}
if (name == null) {
return MimeTypes.MIME_APPLICATION_OCTET_STREAM;
}
final String extension = FileNameUtil.getExtension(name);
return MimeTypes.getMimeType(extension);
} | java | protected String resolveContentType(final String contentType) {
if (contentType != null) {
return contentType;
}
if (name == null) {
return MimeTypes.MIME_APPLICATION_OCTET_STREAM;
}
final String extension = FileNameUtil.getExtension(name);
return MimeTypes.getMimeType(extension);
} | [
"protected",
"String",
"resolveContentType",
"(",
"final",
"String",
"contentType",
")",
"{",
"if",
"(",
"contentType",
"!=",
"null",
")",
"{",
"return",
"contentType",
";",
"}",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"MimeTypes",
".",
"MIME_... | Resolves content type from all data.
@param contentType Content type if we know it. {@code null} is fine to use.
@return content type | [
"Resolves",
"content",
"type",
"from",
"all",
"data",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-mail/src/main/java/jodd/mail/EmailAttachmentBuilder.java#L279-L289 | test | Resolves the content type. | Of course, here is the Java code you requested:
```java
protected String resolveContentType(final String contentType) {
if (contentType != null) {
return contentType;
}
if (name == null) {
return MimeTypes.MIME_APPLICATION_OCTET_STREAM;
}
final String extension = FileNameUtil.getExtension(name);
ret... |
jcuda/jcublas | JCublasJava/src/main/java/jcuda/jcublas/JCublas2.java | JCublas2.cublasDnrm2 | public static int cublasDnrm2(
cublasHandle handle,
int n,
Pointer x,
int incx,
Pointer result)/** host or device pointer */
{
return checkResult(cublasDnrm2Native(handle, n, x, incx, result));
} | java | public static int cublasDnrm2(
cublasHandle handle,
int n,
Pointer x,
int incx,
Pointer result)/** host or device pointer */
{
return checkResult(cublasDnrm2Native(handle, n, x, incx, result));
} | [
"public",
"static",
"int",
"cublasDnrm2",
"(",
"cublasHandle",
"handle",
",",
"int",
"n",
",",
"Pointer",
"x",
",",
"int",
"incx",
",",
"Pointer",
"result",
")",
"/** host or device pointer */",
"{",
"return",
"checkResult",
"(",
"cublasDnrm2Native",
"(",
"handl... | host or device pointer | [
"host",
"or",
"device",
"pointer"
] | 80875235d24562073f4d66651dd17263f306427d | https://github.com/jcuda/jcublas/blob/80875235d24562073f4d66651dd17263f306427d/JCublasJava/src/main/java/jcuda/jcublas/JCublas2.java#L683-L691 | test | Deduce a matrix from real to real. | Of course, here is the Java code you requested:
```java
public static int cublasDnrm2(
cublasHandle handle,
int n,
Pointer x,
int incx,
Pointer result)/** host or device pointer */
{
return checkResult(cublasDnrm2Native(handle, n, x, incx, result));
}... |
Unidata/thredds | opendap/src/main/java/opendap/dap/Util.java | Util.swap | static private void swap(String a[], int i, int j) {
String T;
T = a[i];
a[i] = a[j];
a[j] = T;
} | java | static private void swap(String a[], int i, int j) {
String T;
T = a[i];
a[i] = a[j];
a[j] = T;
} | [
"static",
"private",
"void",
"swap",
"(",
"String",
"a",
"[",
"]",
",",
"int",
"i",
",",
"int",
"j",
")",
"{",
"String",
"T",
";",
"T",
"=",
"a",
"[",
"i",
"]",
";",
"a",
"[",
"i",
"]",
"=",
"a",
"[",
"j",
"]",
";",
"a",
"[",
"j",
"]",
... | Private method to swap two elements in the array
@param a an array of <code>String</code>.
@param i the index of the first element.
@param j the index of the second element. | [
"Private",
"method",
"to",
"swap",
"two",
"elements",
"in",
"the",
"array"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/opendap/src/main/java/opendap/dap/Util.java#L172-L177 | test | Swaps two elements of the array. | Of course, here is the Java code you requested:
```java
static private void swap(String a[], int i, int j) {
String T;
T = a[i];
a[i] = a[j];
a[j] = T;
}
```
Hope this helps! |
oblac/jodd | jodd-madvoc/src/main/java/jodd/madvoc/component/ActionPathRewriter.java | ActionPathRewriter.rewrite | @SuppressWarnings({"UnusedDeclaration"})
public String rewrite(final HttpServletRequest servletRequest, final String actionPath, final String httpMethod) {
return actionPath;
} | java | @SuppressWarnings({"UnusedDeclaration"})
public String rewrite(final HttpServletRequest servletRequest, final String actionPath, final String httpMethod) {
return actionPath;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"UnusedDeclaration\"",
"}",
")",
"public",
"String",
"rewrite",
"(",
"final",
"HttpServletRequest",
"servletRequest",
",",
"final",
"String",
"actionPath",
",",
"final",
"String",
"httpMethod",
")",
"{",
"return",
"actionPath",
... | Rewrites action path. | [
"Rewrites",
"action",
"path",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-madvoc/src/main/java/jodd/madvoc/component/ActionPathRewriter.java#L38-L41 | test | Rewrite the action path. | Of course, here is the Java code you requested:
```java
@SuppressWarnings({"UnusedDeclaration"})
public String rewrite(final HttpServletRequest servletRequest, final String actionPath, final String httpMethod) {
return actionPath;
}
```
Hope this helps! |
google/openrtb | openrtb-core/src/main/java/com/google/openrtb/json/OpenRtbJsonWriter.java | OpenRtbJsonWriter.writeBidRequest | public String writeBidRequest(BidRequest req) throws IOException {
try (StringWriter writer = new StringWriter()) {
writeBidRequest(req, writer);
return writer.toString();
}
} | java | public String writeBidRequest(BidRequest req) throws IOException {
try (StringWriter writer = new StringWriter()) {
writeBidRequest(req, writer);
return writer.toString();
}
} | [
"public",
"String",
"writeBidRequest",
"(",
"BidRequest",
"req",
")",
"throws",
"IOException",
"{",
"try",
"(",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
")",
"{",
"writeBidRequest",
"(",
"req",
",",
"writer",
")",
";",
"return",
"write... | Serializes a {@link BidRequest} to JSON, returned as a {@code String}. | [
"Serializes",
"a",
"{"
] | 384ed8dde6bd16ac2faab9afbe5b33367836fdec | https://github.com/google/openrtb/blob/384ed8dde6bd16ac2faab9afbe5b33367836fdec/openrtb-core/src/main/java/com/google/openrtb/json/OpenRtbJsonWriter.java#L76-L81 | test | Write a bid request to a String. | Of course, here is the Java code you requested:
```java
public String writeBidRequest(BidRequest req) throws IOException {
try (StringWriter writer = new StringWriter()) {
writeBidRequest(req, writer);
return writer.toString();
}
}
```
Hope this helps! |
OpenEstate/OpenEstate-IO | Examples/src/main/java/org/openestate/io/examples/DaftIeWritingExample.java | DaftIeWritingExample.createAdForRent | @SuppressWarnings("CatchMayIgnoreException")
protected static OverseasRentalAdType createAdForRent() {
// create an example real estate for rent
OverseasRentalAdType ad = FACTORY.createOverseasRentalAdType();
ad.setAddress("Beispielstraße 123");
ad.setAgentId("123");
ad.setAr... | java | @SuppressWarnings("CatchMayIgnoreException")
protected static OverseasRentalAdType createAdForRent() {
// create an example real estate for rent
OverseasRentalAdType ad = FACTORY.createOverseasRentalAdType();
ad.setAddress("Beispielstraße 123");
ad.setAgentId("123");
ad.setAr... | [
"@",
"SuppressWarnings",
"(",
"\"CatchMayIgnoreException\"",
")",
"protected",
"static",
"OverseasRentalAdType",
"createAdForRent",
"(",
")",
"{",
"// create an example real estate for rent",
"OverseasRentalAdType",
"ad",
"=",
"FACTORY",
".",
"createOverseasRentalAdType",
"(",
... | Create an {@link OverseasRentalAdType} with some example data.
@return created example object | [
"Create",
"an",
"{",
"@link",
"OverseasRentalAdType",
"}",
"with",
"some",
"example",
"data",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/Examples/src/main/java/org/openestate/io/examples/DaftIeWritingExample.java#L121-L173 | test | Creates an instance of the OverseasRentalAdType class. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("CatchMayIgnoreException")
protected static OverseasRentalAdType createAdForRent() {
// create an example real estate for rent
OverseasRentalAdType ad = FACTORY.createOverseasRentalAdType();
ad.setAddress("Beispielstr... |
streamsets/datacollector | sso/src/main/java/com/streamsets/lib/security/http/AbstractSSOAuthenticator.java | AbstractSSOAuthenticator.returnUnauthorized | protected Authentication returnUnauthorized(
HttpServletRequest httpReq, HttpServletResponse httpRes, String principalId, String logMessageTemplate
) throws ServerAuthException {
return returnUnauthorized(httpReq, httpRes, UNAUTHORIZED_JSON, principalId, logMessageTemplate);
} | java | protected Authentication returnUnauthorized(
HttpServletRequest httpReq, HttpServletResponse httpRes, String principalId, String logMessageTemplate
) throws ServerAuthException {
return returnUnauthorized(httpReq, httpRes, UNAUTHORIZED_JSON, principalId, logMessageTemplate);
} | [
"protected",
"Authentication",
"returnUnauthorized",
"(",
"HttpServletRequest",
"httpReq",
",",
"HttpServletResponse",
"httpRes",
",",
"String",
"principalId",
",",
"String",
"logMessageTemplate",
")",
"throws",
"ServerAuthException",
"{",
"return",
"returnUnauthorized",
"(... | /*
Terminates the request with an HTTP Unauthorized response | [
"/",
"*",
"Terminates",
"the",
"request",
"with",
"an",
"HTTP",
"Unauthorized",
"response"
] | ea63245ea14d59d5229248387f0628f46131eae5 | https://github.com/streamsets/datacollector/blob/ea63245ea14d59d5229248387f0628f46131eae5/sso/src/main/java/com/streamsets/lib/security/http/AbstractSSOAuthenticator.java#L87-L91 | test | This method is called by the authentication provider to return an unauthorized authentication. | Of course, here is the Java code you requested:
```java
protected Authentication returnUnauthorized(
HttpServletRequest httpReq, HttpServletResponse httpRes, String principalId, String logMessageTemplate
) throws ServerAuthException {
return returnUnauthorized(httpReq, httpRes, UNAUTHORIZED_JSON, principal... |
lexicalscope/jewelcli | jewelcli/src/main/java/com/lexicalscope/jewel/cli/CliFactory.java | CliFactory.parseArguments | public static <O> O parseArguments(final Class<O> klass, final String... arguments)
throws ArgumentValidationException, InvalidOptionSpecificationException
{
return createCli(klass).parseArguments(arguments);
} | java | public static <O> O parseArguments(final Class<O> klass, final String... arguments)
throws ArgumentValidationException, InvalidOptionSpecificationException
{
return createCli(klass).parseArguments(arguments);
} | [
"public",
"static",
"<",
"O",
">",
"O",
"parseArguments",
"(",
"final",
"Class",
"<",
"O",
">",
"klass",
",",
"final",
"String",
"...",
"arguments",
")",
"throws",
"ArgumentValidationException",
",",
"InvalidOptionSpecificationException",
"{",
"return",
"createCli... | Parse arguments from an annotated interface definition
@param <O>
The type of the interface that will be used to present the
arguments
@param klass
The annotated interface definition
@param arguments
@return The parsed arguments
@throws ArgumentValidationException the arguments do not meet the CLI specification
@thr... | [
"Parse",
"arguments",
"from",
"an",
"annotated",
"interface",
"definition"
] | d282f87b937355f8a9d2b91d3b08ee668840cf61 | https://github.com/lexicalscope/jewelcli/blob/d282f87b937355f8a9d2b91d3b08ee668840cf61/jewelcli/src/main/java/com/lexicalscope/jewel/cli/CliFactory.java#L64-L68 | test | Parses the arguments for the
CTYPE command. | Of course, here is the Java code you requested:
```java
public static <O> O parseArguments(final Class<O> klass, final String... arguments)
throws ArgumentValidationException, InvalidOptionSpecificationException
{
return createCli(klass).parseArguments(arguments);
}
```
Hope this helps... |
boonproject/boon | boon/src/main/java/org/boon/collections/LongList.java | LongList.toLongList | public static LongList toLongList(Collection<?> inputList, String propertyPath) {
if (inputList.size() == 0) {
return new LongList(0);
}
LongList outputList = new LongList(inputList.size());
if (propertyPath.contains(".") || propertyPath.contains("[")) {
String... | java | public static LongList toLongList(Collection<?> inputList, String propertyPath) {
if (inputList.size() == 0) {
return new LongList(0);
}
LongList outputList = new LongList(inputList.size());
if (propertyPath.contains(".") || propertyPath.contains("[")) {
String... | [
"public",
"static",
"LongList",
"toLongList",
"(",
"Collection",
"<",
"?",
">",
"inputList",
",",
"String",
"propertyPath",
")",
"{",
"if",
"(",
"inputList",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"new",
"LongList",
"(",
"0",
")",
";",
... | Creates a primitive list based on an input list and a property path
@param inputList input list
@param propertyPath property path
@return primitive list | [
"Creates",
"a",
"primitive",
"list",
"based",
"on",
"an",
"input",
"list",
"and",
"a",
"property",
"path"
] | 9bc6870dbe5dd58c45c18d8edb493e8efc089463 | https://github.com/boonproject/boon/blob/9bc6870dbe5dd58c45c18d8edb493e8efc089463/boon/src/main/java/org/boon/collections/LongList.java#L97-L122 | test | Converts a collection of objects to a LongList. | Of course, here is the Java code you requested:
```java
public static LongList toLongList(Collection<?> inputList, String propertyPath) {
if (inputList.size() == 0) {
return new LongList(0);
}
LongList outputList = new LongList(inputList.size());
if (propertyPath.contains(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.