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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rupertlssmith/lojix | lojix/search/src/main/com/thesett/aima/search/examples/eightpuzzle/EightPuzzleState.java | EightPuzzleState.getRandomStartState | public static EightPuzzleState getRandomStartState()
{
EightPuzzleState newState;
// Turn the goal string into a list of characters.
List<Character> charList = stringToCharList(GOAL_STRING);
// Generate random puzzles until a solvable one is found.
do
{
... | java | public static EightPuzzleState getRandomStartState()
{
EightPuzzleState newState;
// Turn the goal string into a list of characters.
List<Character> charList = stringToCharList(GOAL_STRING);
// Generate random puzzles until a solvable one is found.
do
{
... | [
"public",
"static",
"EightPuzzleState",
"getRandomStartState",
"(",
")",
"{",
"EightPuzzleState",
"newState",
";",
"// Turn the goal string into a list of characters.",
"List",
"<",
"Character",
">",
"charList",
"=",
"stringToCharList",
"(",
"GOAL_STRING",
")",
";",
"// G... | Generates a random starting position.
@return A random board state. | [
"Generates",
"a",
"random",
"starting",
"position",
"."
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/search/src/main/com/thesett/aima/search/examples/eightpuzzle/EightPuzzleState.java#L134-L155 | test | Get a random start state. | Of course, here is the Java code you requested:
```java
public static EightPuzzleState getRandomStartState()
{
EightPuzzleState newState;
// Turn the goal string into a list of characters.
List<Character> charList = stringToCharList(GOAL_STRING);
// Generate random puzzles until a... |
real-logic/aeron | aeron-client/src/main/java/io/aeron/logbuffer/TermReader.java | TermReader.read | public static int read(
final UnsafeBuffer termBuffer,
final int termOffset,
final FragmentHandler handler,
final int fragmentsLimit,
final Header header,
final ErrorHandler errorHandler,
final long currentPosition,
final Position subscriberPosition)
{... | java | public static int read(
final UnsafeBuffer termBuffer,
final int termOffset,
final FragmentHandler handler,
final int fragmentsLimit,
final Header header,
final ErrorHandler errorHandler,
final long currentPosition,
final Position subscriberPosition)
{... | [
"public",
"static",
"int",
"read",
"(",
"final",
"UnsafeBuffer",
"termBuffer",
",",
"final",
"int",
"termOffset",
",",
"final",
"FragmentHandler",
"handler",
",",
"final",
"int",
"fragmentsLimit",
",",
"final",
"Header",
"header",
",",
"final",
"ErrorHandler",
"... | Reads data from a term in a log buffer and updates a passed {@link Position} so progress is not lost in the
event of an exception.
@param termBuffer to be read for fragments.
@param termOffset within the buffer that the read should begin.
@param handler the handler for data that has been rea... | [
"Reads",
"data",
"from",
"a",
"term",
"in",
"a",
"log",
"buffer",
"and",
"updates",
"a",
"passed",
"{",
"@link",
"Position",
"}",
"so",
"progress",
"is",
"not",
"lost",
"in",
"the",
"event",
"of",
"an",
"exception",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-client/src/main/java/io/aeron/logbuffer/TermReader.java#L44-L95 | test | Read a sequence of bytes from a buffer. | Of course, here is the Java code you requested:
```java
public static int read(
final UnsafeBuffer termBuffer,
final int termOffset,
final FragmentHandler handler,
final int fragmentsLimit,
final Header header,
final ErrorHandler errorHandler,
final long currentP... |
orientechnologies/orientdb | graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java | OrientBaseGraph.getVertexBaseType | public OrientVertexType getVertexBaseType() {
makeActive();
return new OrientVertexType(this, getRawGraph().getMetadata().getSchema().getClass(OrientVertexType.CLASS_NAME));
} | java | public OrientVertexType getVertexBaseType() {
makeActive();
return new OrientVertexType(this, getRawGraph().getMetadata().getSchema().getClass(OrientVertexType.CLASS_NAME));
} | [
"public",
"OrientVertexType",
"getVertexBaseType",
"(",
")",
"{",
"makeActive",
"(",
")",
";",
"return",
"new",
"OrientVertexType",
"(",
"this",
",",
"getRawGraph",
"(",
")",
".",
"getMetadata",
"(",
")",
".",
"getSchema",
"(",
")",
".",
"getClass",
"(",
"... | Returns the V persistent class as OrientVertexType instance. | [
"Returns",
"the",
"V",
"persistent",
"class",
"as",
"OrientVertexType",
"instance",
"."
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java#L1268-L1272 | test | Returns the base type of the vertex. | Of course, here is the Java code you requested:
```java
public OrientVertexType getVertexBaseType() {
makeActive();
return new OrientVertexType(this, getRawGraph().getMetadata().getSchema().getClass(OrientVertexType.CLASS_NAME));
}
```
Hope this helps! |
Netflix/hollow | hollow/src/main/java/com/netflix/hollow/api/producer/AbstractHollowProducer.java | AbstractHollowProducer.restore | public HollowProducer.ReadState restore(long versionDesired, HollowConsumer.BlobRetriever blobRetriever) {
return restore(versionDesired, blobRetriever,
(restoreFrom, restoreTo) -> restoreTo.restoreFrom(restoreFrom));
} | java | public HollowProducer.ReadState restore(long versionDesired, HollowConsumer.BlobRetriever blobRetriever) {
return restore(versionDesired, blobRetriever,
(restoreFrom, restoreTo) -> restoreTo.restoreFrom(restoreFrom));
} | [
"public",
"HollowProducer",
".",
"ReadState",
"restore",
"(",
"long",
"versionDesired",
",",
"HollowConsumer",
".",
"BlobRetriever",
"blobRetriever",
")",
"{",
"return",
"restore",
"(",
"versionDesired",
",",
"blobRetriever",
",",
"(",
"restoreFrom",
",",
"restoreTo... | Restores the data state to a desired version.
<p>
Data model {@link #initializeDataModel(Class[]) initialization} is required prior to
restoring the producer. This ensures that restoration can correctly compare the producer's
current data model with the data model of the restored data state and manage any differences
... | [
"Restores",
"the",
"data",
"state",
"to",
"a",
"desired",
"version",
".",
"<p",
">",
"Data",
"model",
"{",
"@link",
"#initializeDataModel",
"(",
"Class",
"[]",
")",
"initialization",
"}",
"is",
"required",
"prior",
"to",
"restoring",
"the",
"producer",
".",
... | 43ca100034a01050fb764170bd32b085ac9a3c22 | https://github.com/Netflix/hollow/blob/43ca100034a01050fb764170bd32b085ac9a3c22/hollow/src/main/java/com/netflix/hollow/api/producer/AbstractHollowProducer.java#L234-L237 | test | Restore the Hollow version from the source to the target. | Of course, here is the Java code you requested:
```java
public HollowProducer.ReadState restore(long versionDesired, HollowConsumer.BlobRetriever blobRetriever) {
return restore(versionDesired, blobRetriever,
(restoreFrom, restoreTo) -> restoreTo.restoreFrom(restoreFrom));
}
```
Hope this ... |
1gravity/Android-RTEditor | RTEditor/src/main/java/com/onegravity/rteditor/utils/io/IOUtils.java | IOUtils.toByteArray | public static byte[] toByteArray(Reader input, String encoding) throws IOException {
return toByteArray(input, Charsets.toCharset(encoding));
} | java | public static byte[] toByteArray(Reader input, String encoding) throws IOException {
return toByteArray(input, Charsets.toCharset(encoding));
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"Reader",
"input",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"return",
"toByteArray",
"(",
"input",
",",
"Charsets",
".",
"toCharset",
"(",
"encoding",
")",
")",
";",
"}"
] | Get the contents of a <code>Reader</code> as a <code>byte[]</code>
using the specified character encoding.
<p/>
Character encoding names can be found at
<a href="http://www.iana.org/assignments/character-sets">IANA</a>.
<p/>
This method buffers the input internally, so there is no need to use a
<code>BufferedReader</co... | [
"Get",
"the",
"contents",
"of",
"a",
"<code",
">",
"Reader<",
"/",
"code",
">",
"as",
"a",
"<code",
">",
"byte",
"[]",
"<",
"/",
"code",
">",
"using",
"the",
"specified",
"character",
"encoding",
".",
"<p",
"/",
">",
"Character",
"encoding",
"names",
... | 9d8fb4bb865b3b3d011e7633afedcdfb8d21754f | https://github.com/1gravity/Android-RTEditor/blob/9d8fb4bb865b3b3d011e7633afedcdfb8d21754f/RTEditor/src/main/java/com/onegravity/rteditor/utils/io/IOUtils.java#L584-L586 | test | Convert a Reader to a byte array using the specified encoding. | Of course, here is the Java code you requested:
```java
public static byte[] toByteArray(Reader input, String encoding) throws IOException {
return toByteArray(input, Charsets.toCharset(encoding));
}
```
Hope this helps! |
jboss/jboss-common-core | src/main/java/org/jboss/util/collection/CachedList.java | CachedList.getObject | private Object getObject(final int index) {
Object obj = list.get(index);
return Objects.deref(obj);
} | java | private Object getObject(final int index) {
Object obj = list.get(index);
return Objects.deref(obj);
} | [
"private",
"Object",
"getObject",
"(",
"final",
"int",
"index",
")",
"{",
"Object",
"obj",
"=",
"list",
".",
"get",
"(",
"index",
")",
";",
"return",
"Objects",
".",
"deref",
"(",
"obj",
")",
";",
"}"
] | Dereference the object at the given index. | [
"Dereference",
"the",
"object",
"at",
"the",
"given",
"index",
"."
] | c191bb18db83fa106c6913cf34ed47989b65dc97 | https://github.com/jboss/jboss-common-core/blob/c191bb18db83fa106c6913cf34ed47989b65dc97/src/main/java/org/jboss/util/collection/CachedList.java#L67-L71 | test | Get the object at the given index. | Of course, here is the Java code you requested:
```java
private Object getObject(final int index) {
Object obj = list.get(index);
return Objects.deref(obj);
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/ucar/nc2/ParsedSectionSpec.java | ParsedSectionSpec.parseVariableSelector | private static ParsedSectionSpec parseVariableSelector(Object parent, String selector) throws InvalidRangeException {
String varNameEsc, indexSelect = null;
int pos1 = EscapeStrings.indexOf(selector, '(');
if (pos1 < 0) { // no index
varNameEsc = selector;
} else {
varNameEsc = selector.sub... | java | private static ParsedSectionSpec parseVariableSelector(Object parent, String selector) throws InvalidRangeException {
String varNameEsc, indexSelect = null;
int pos1 = EscapeStrings.indexOf(selector, '(');
if (pos1 < 0) { // no index
varNameEsc = selector;
} else {
varNameEsc = selector.sub... | [
"private",
"static",
"ParsedSectionSpec",
"parseVariableSelector",
"(",
"Object",
"parent",
",",
"String",
"selector",
")",
"throws",
"InvalidRangeException",
"{",
"String",
"varNameEsc",
",",
"indexSelect",
"=",
"null",
";",
"int",
"pos1",
"=",
"EscapeStrings",
"."... | parse variable name and index selector out of the selector String. variable name must be escaped | [
"parse",
"variable",
"name",
"and",
"index",
"selector",
"out",
"of",
"the",
"selector",
"String",
".",
"variable",
"name",
"must",
"be",
"escaped"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/ParsedSectionSpec.java#L73-L112 | test | Parse a variable selector. | Of course, here is the Java code you requested:
```java
private static ParsedSectionSpec parseVariableSelector(Object parent, String selector) throws InvalidRangeException {
String varNameEsc, indexSelect = null;
int pos1 = EscapeStrings.indexOf(selector, '(');
if (pos1 < 0) { // no index
varNameEsc... |
artclarke/humble-video | humble-video-noarch/src/main/java/io/humble/video/FilterPictureSource.java | FilterPictureSource.addPicture | public void addPicture(MediaPicture picture) {
VideoJNI.FilterPictureSource_addPicture(swigCPtr, this, MediaPicture.getCPtr(picture), picture);
} | java | public void addPicture(MediaPicture picture) {
VideoJNI.FilterPictureSource_addPicture(swigCPtr, this, MediaPicture.getCPtr(picture), picture);
} | [
"public",
"void",
"addPicture",
"(",
"MediaPicture",
"picture",
")",
"{",
"VideoJNI",
".",
"FilterPictureSource_addPicture",
"(",
"swigCPtr",
",",
"this",
",",
"MediaPicture",
".",
"getCPtr",
"(",
"picture",
")",
",",
"picture",
")",
";",
"}"
] | Adds a picture to this source. NOTE: If you add a picture to a FilterSource<br>
be careful with re-using or rewriting the underlying data. Filters will<br>
try hard to avoid copying data, so if you change the data out from under<br>
them unexpected results can occur.<br>
@param picture the picture to add. Must be non-n... | [
"Adds",
"a",
"picture",
"to",
"this",
"source",
".",
"NOTE",
":",
"If",
"you",
"add",
"a",
"picture",
"to",
"a",
"FilterSource<br",
">",
"be",
"careful",
"with",
"re",
"-",
"using",
"or",
"rewriting",
"the",
"underlying",
"data",
".",
"Filters",
"will<br... | aa349ae2d7ef74160b7074feac8d298cf90394d1 | https://github.com/artclarke/humble-video/blob/aa349ae2d7ef74160b7074feac8d298cf90394d1/humble-video-noarch/src/main/java/io/humble/video/FilterPictureSource.java#L123-L125 | test | Add a picture to this filter. | Of course, here is the Java code you requested:
```java
public void addPicture(MediaPicture picture) {
VideoJNI.FilterPictureSource_addPicture(swigCPtr, this, MediaPicture.getCPtr(picture), picture);
}
```
Hope this helps! |
wildfly/wildfly | iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/service/CorbaPOAService.java | CorbaPOAService.createPolicies | private Policy[] createPolicies(POA poa) {
List<Policy> policies = new ArrayList<Policy>();
if(this.sslOnly)
policies.add(ZeroPortPolicy.getPolicy());
if (this.idAssignmentPolicyValue != null)
policies.add(poa.create_id_assignment_policy(this.idAssignmentPolicyValue));
... | java | private Policy[] createPolicies(POA poa) {
List<Policy> policies = new ArrayList<Policy>();
if(this.sslOnly)
policies.add(ZeroPortPolicy.getPolicy());
if (this.idAssignmentPolicyValue != null)
policies.add(poa.create_id_assignment_policy(this.idAssignmentPolicyValue));
... | [
"private",
"Policy",
"[",
"]",
"createPolicies",
"(",
"POA",
"poa",
")",
"{",
"List",
"<",
"Policy",
">",
"policies",
"=",
"new",
"ArrayList",
"<",
"Policy",
">",
"(",
")",
";",
"if",
"(",
"this",
".",
"sslOnly",
")",
"policies",
".",
"add",
"(",
"... | <p>
Create the {@code Policy} array containing the {@code POA} policies using the values specified in the constructor.
When creating a {@code POA}, the parent {@code POA} is responsible for generating the relevant policies beforehand.
</p>
@param poa the {@code POA} used to create the {@code Policy} objects.
@return t... | [
"<p",
">",
"Create",
"the",
"{",
"@code",
"Policy",
"}",
"array",
"containing",
"the",
"{",
"@code",
"POA",
"}",
"policies",
"using",
"the",
"values",
"specified",
"in",
"the",
"constructor",
".",
"When",
"creating",
"a",
"{",
"@code",
"POA",
"}",
"the",... | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/service/CorbaPOAService.java#L223-L244 | test | Create the policies. | Of course, here is the Java code you requested:
```java
private Policy[] createPolicies(POA poa) {
List<Policy> policies = new ArrayList<Policy>();
if(this.sslOnly)
policies.add(ZeroPortPolicy.getPolicy());
if (this.idAssignmentPolicyValue != null)
policies.add(poa.creat... |
Unidata/thredds | visad/src/main/java/ucar/nc2/iosp/gempak/GempakStationFileIOSP.java | GempakStationFileIOSP.get1DArray | private Array get1DArray(DataType type, int len) {
Array varArray = null;
if (type.equals(DataType.FLOAT)) {
varArray = new ArrayFloat.D1(len);
} else if (type.equals(DataType.DOUBLE)) {
varArray = new ArrayDouble.D1(len);
} else if (type.equals(DataType.INT)) {
varArray = new A... | java | private Array get1DArray(DataType type, int len) {
Array varArray = null;
if (type.equals(DataType.FLOAT)) {
varArray = new ArrayFloat.D1(len);
} else if (type.equals(DataType.DOUBLE)) {
varArray = new ArrayDouble.D1(len);
} else if (type.equals(DataType.INT)) {
varArray = new A... | [
"private",
"Array",
"get1DArray",
"(",
"DataType",
"type",
",",
"int",
"len",
")",
"{",
"Array",
"varArray",
"=",
"null",
";",
"if",
"(",
"type",
".",
"equals",
"(",
"DataType",
".",
"FLOAT",
")",
")",
"{",
"varArray",
"=",
"new",
"ArrayFloat",
".",
... | Get a 1DArray for the type and length
@param type DataType
@param len length
@return the array | [
"Get",
"a",
"1DArray",
"for",
"the",
"type",
"and",
"length"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/visad/src/main/java/ucar/nc2/iosp/gempak/GempakStationFileIOSP.java#L401-L411 | test | Returns the Array object for the given data type and len. | Of course, here is the Java code you requested:
```java
private Array get1DArray(DataType type, int len) {
Array varArray = null;
if (type.equals(DataType.FLOAT)) {
varArray = new ArrayFloat.D1(len);
} else if (type.equals(DataType.DOUBLE)) {
varArray = new ArrayDouble.D1(len);
} else... |
snakerflow/snakerflow | snaker-core/src/main/java/org/snaker/engine/helper/StreamHelper.java | StreamHelper.copy | public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException {
return copy( inputStream, outputStream, DEFAULT_CHUNK_SIZE );
} | java | public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException {
return copy( inputStream, outputStream, DEFAULT_CHUNK_SIZE );
} | [
"public",
"static",
"long",
"copy",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"return",
"copy",
"(",
"inputStream",
",",
"outputStream",
",",
"DEFAULT_CHUNK_SIZE",
")",
";",
"}"
] | input->output字节流copy
@param inputStream
@param outputStream
@return
@throws IOException | [
"input",
"-",
">",
"output字节流copy"
] | 9c8cb3148a76702f1eda22f1d113053cb44b1eff | https://github.com/snakerflow/snakerflow/blob/9c8cb3148a76702f1eda22f1d113053cb44b1eff/snaker-core/src/main/java/org/snaker/engine/helper/StreamHelper.java#L133-L135 | test | Copy the contents of the input stream to the output stream using the default chunk size. | Of course, here is the Java code you requested:
```java
public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException {
return copy( inputStream, outputStream, DEFAULT_CHUNK_SIZE );
}
```
Hope this helps! |
google/guice | core/src/com/google/inject/internal/ProvisionListenerCallbackStore.java | ProvisionListenerCallbackStore.get | @SuppressWarnings(
"unchecked") // the ProvisionListenerStackCallback type always agrees with the passed type
public <T> ProvisionListenerStackCallback<T> get(Binding<T> binding) {
// Never notify any listeners for internal bindings.
if (!INTERNAL_BINDINGS.contains(binding.getKey())) {
ProvisionLi... | java | @SuppressWarnings(
"unchecked") // the ProvisionListenerStackCallback type always agrees with the passed type
public <T> ProvisionListenerStackCallback<T> get(Binding<T> binding) {
// Never notify any listeners for internal bindings.
if (!INTERNAL_BINDINGS.contains(binding.getKey())) {
ProvisionLi... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// the ProvisionListenerStackCallback type always agrees with the passed type",
"public",
"<",
"T",
">",
"ProvisionListenerStackCallback",
"<",
"T",
">",
"get",
"(",
"Binding",
"<",
"T",
">",
"binding",
")",
"{",
"// ... | Returns a new {@link ProvisionListenerStackCallback} for the key or {@code null} if there are
no listeners | [
"Returns",
"a",
"new",
"{"
] | a0552a16d813ead98fe73737fb001db336650251 | https://github.com/google/guice/blob/a0552a16d813ead98fe73737fb001db336650251/core/src/com/google/inject/internal/ProvisionListenerCallbackStore.java#L66-L77 | test | Get the callback for the passed binding. | Of course, here is the Java code you requested:
```java
@SuppressWarnings(
"unchecked") // the ProvisionListenerStackCallback type always agrees with the passed type
public <T> ProvisionListenerStackCallback<T> get(Binding<T> binding) {
// Never notify any listeners for internal bindings.
if (!INTERNAL... |
tiefaces/TieFaces | src/org/tiefaces/components/websheet/utility/WebSheetUtility.java | WebSheetUtility.parseDate | public static String parseDate(final String entry) {
Pattern pattern = Pattern.compile(DATE_REGEX_4_DIGIT_YEAR);
String[] terms = entry.split(" ");
Matcher matcher;
for (String term : terms) {
matcher = pattern.matcher(term);
if (matcher.matches()) {
return matcher.group();
}
}
patter... | java | public static String parseDate(final String entry) {
Pattern pattern = Pattern.compile(DATE_REGEX_4_DIGIT_YEAR);
String[] terms = entry.split(" ");
Matcher matcher;
for (String term : terms) {
matcher = pattern.matcher(term);
if (matcher.matches()) {
return matcher.group();
}
}
patter... | [
"public",
"static",
"String",
"parseDate",
"(",
"final",
"String",
"entry",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"DATE_REGEX_4_DIGIT_YEAR",
")",
";",
"String",
"[",
"]",
"terms",
"=",
"entry",
".",
"split",
"(",
"\" \"",
")"... | Parses the date.
@param entry
the entry
@return the string | [
"Parses",
"the",
"date",
"."
] | 3b57b9701ed0f080b5fa4fa78269cc0c422b34ba | https://github.com/tiefaces/TieFaces/blob/3b57b9701ed0f080b5fa4fa78269cc0c422b34ba/src/org/tiefaces/components/websheet/utility/WebSheetUtility.java#L400-L419 | test | Parses the specified date string. | Of course, here is the Java code you requested:
```java
public static String parseDate(final String entry) {
Pattern pattern = Pattern.compile(DATE_REGEX_4_DIGIT_YEAR);
String[] terms = entry.split(" ");
Matcher matcher;
for (String term : terms) {
matcher = pattern.matcher(term);
if (matcher.match... |
orientechnologies/orientdb | lucene/src/main/java/com/orientechnologies/lucene/engine/OLuceneIndexEngineUtils.java | OLuceneIndexEngineUtils.buildSortField | public static SortField buildSortField(Map<String, Object> conf) {
final String field = Optional.ofNullable((String) conf.get("field")).orElse(null);
final String type = Optional.ofNullable(((String) conf.get("type")).toUpperCase()).orElse(SortField.Type.STRING.name());
final Boolean reverse = Optional.ofN... | java | public static SortField buildSortField(Map<String, Object> conf) {
final String field = Optional.ofNullable((String) conf.get("field")).orElse(null);
final String type = Optional.ofNullable(((String) conf.get("type")).toUpperCase()).orElse(SortField.Type.STRING.name());
final Boolean reverse = Optional.ofN... | [
"public",
"static",
"SortField",
"buildSortField",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"conf",
")",
"{",
"final",
"String",
"field",
"=",
"Optional",
".",
"ofNullable",
"(",
"(",
"String",
")",
"conf",
".",
"get",
"(",
"\"field\"",
")",
")",
... | Builds a {@link SortField} from a configuration map. The map can contains up to three fields: field (name), reverse
(true/false) and type {@link SortField.Type}.
@param conf
@return | [
"Builds",
"a",
"{",
"@link",
"SortField",
"}",
"from",
"a",
"configuration",
"map",
".",
"The",
"map",
"can",
"contains",
"up",
"to",
"three",
"fields",
":",
"field",
"(",
"name",
")",
"reverse",
"(",
"true",
"/",
"false",
")",
"and",
"type",
"{",
"@... | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/lucene/src/main/java/com/orientechnologies/lucene/engine/OLuceneIndexEngineUtils.java#L122-L131 | test | Build a SortField object from a configuration map. | Of course, here is the Java code you requested:
```java
public static SortField buildSortField(Map<String, Object> conf) {
final String field = Optional.ofNullable((String) conf.get("field")).orElse(null);
final String type = Optional.ofNullable(((String) conf.get("type")).toUpperCase()).orElse(SortField.Type... |
jcodec/jcodec | src/main/java/org/jcodec/api/FrameGrab.java | FrameGrab.getFrameFromChannel | public static Picture getFrameFromChannel(SeekableByteChannel file, int frameNumber)
throws JCodecException, IOException {
return createFrameGrab(file).seekToFramePrecise(frameNumber).getNativeFrame();
} | java | public static Picture getFrameFromChannel(SeekableByteChannel file, int frameNumber)
throws JCodecException, IOException {
return createFrameGrab(file).seekToFramePrecise(frameNumber).getNativeFrame();
} | [
"public",
"static",
"Picture",
"getFrameFromChannel",
"(",
"SeekableByteChannel",
"file",
",",
"int",
"frameNumber",
")",
"throws",
"JCodecException",
",",
"IOException",
"{",
"return",
"createFrameGrab",
"(",
"file",
")",
".",
"seekToFramePrecise",
"(",
"frameNumber"... | Get frame at a specified frame number as JCodec image
@param file
@param second
@return
@throws IOException
@throws JCodecException | [
"Get",
"frame",
"at",
"a",
"specified",
"frame",
"number",
"as",
"JCodec",
"image"
] | cd6efa51ef05f409a8ba8cfb7521f4b4f10ccc75 | https://github.com/jcodec/jcodec/blob/cd6efa51ef05f409a8ba8cfb7521f4b4f10ccc75/src/main/java/org/jcodec/api/FrameGrab.java#L310-L313 | test | Get a Picture from a given frame number. | Of course, here is the Java code you requested:
```java
public static Picture getFrameFromChannel(SeekableByteChannel file, int frameNumber)
throws JCodecException, IOException {
return createFrameGrab(file).seekToFramePrecise(frameNumber).getNativeFrame();
}
```
Hope this helps! |
wildfly/wildfly | ejb3/src/main/java/org/jboss/as/ejb3/component/session/SessionBeanComponentDescription.java | SessionBeanComponentDescription.addTxManagementInterceptorForView | protected static void addTxManagementInterceptorForView(ViewDescription view) {
// add a Tx configurator
view.getConfigurators().add(new ViewConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescrip... | java | protected static void addTxManagementInterceptorForView(ViewDescription view) {
// add a Tx configurator
view.getConfigurators().add(new ViewConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescrip... | [
"protected",
"static",
"void",
"addTxManagementInterceptorForView",
"(",
"ViewDescription",
"view",
")",
"{",
"// add a Tx configurator",
"view",
".",
"getConfigurators",
"(",
")",
".",
"add",
"(",
"new",
"ViewConfigurator",
"(",
")",
"{",
"@",
"Override",
"public",... | Sets up the transaction management interceptor for all methods of the passed view.
@param view The EJB bean view | [
"Sets",
"up",
"the",
"transaction",
"management",
"interceptor",
"for",
"all",
"methods",
"of",
"the",
"passed",
"view",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ejb3/src/main/java/org/jboss/as/ejb3/component/session/SessionBeanComponentDescription.java#L358-L370 | test | Add a TxManagementInterceptor for a view. | Of course, here is the Java code you requested:
```java
protected static void addTxManagementInterceptorForView(ViewDescription view) {
// add a Tx configurator
view.getConfigurators().add(new ViewConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, C... |
oblac/jodd | jodd-lagarto/src/main/java/jodd/lagarto/dom/Node.java | Node.getChild | public Node getChild(final int index) {
if (childNodes == null) {
return null;
}
if ((index < 0) || (index >= childNodes.size())) {
return null;
}
return childNodes.get(index);
} | java | public Node getChild(final int index) {
if (childNodes == null) {
return null;
}
if ((index < 0) || (index >= childNodes.size())) {
return null;
}
return childNodes.get(index);
} | [
"public",
"Node",
"getChild",
"(",
"final",
"int",
"index",
")",
"{",
"if",
"(",
"childNodes",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"(",
"index",
"<",
"0",
")",
"||",
"(",
"index",
">=",
"childNodes",
".",
"size",
"(",
"... | Returns a child node at given index or <code>null</code>
if child doesn't exist for that index. | [
"Returns",
"a",
"child",
"node",
"at",
"given",
"index",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"child",
"doesn",
"t",
"exist",
"for",
"that",
"index",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-lagarto/src/main/java/jodd/lagarto/dom/Node.java#L587-L595 | test | Gets the child node at the specified index. | Of course, here is the Java code you requested:
```java
public Node getChild(final int index) {
if (childNodes == null) {
return null;
}
if ((index < 0) || (index >= childNodes.size())) {
return null;
}
return childNodes.get(index);
}
```
Hope this helps! |
apache/parquet-mr | parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetInputFormat.java | ClientSideMetadataSplitStrategy.generateSplits | static <T> List<ParquetInputSplit> generateSplits(
List<BlockMetaData> rowGroupBlocks,
BlockLocation[] hdfsBlocksArray,
FileStatus fileStatus,
String requestedSchema,
Map<String, String> readSupportMetadata, long minSplitSize, long maxSplitSize) throws IOException {
... | java | static <T> List<ParquetInputSplit> generateSplits(
List<BlockMetaData> rowGroupBlocks,
BlockLocation[] hdfsBlocksArray,
FileStatus fileStatus,
String requestedSchema,
Map<String, String> readSupportMetadata, long minSplitSize, long maxSplitSize) throws IOException {
... | [
"static",
"<",
"T",
">",
"List",
"<",
"ParquetInputSplit",
">",
"generateSplits",
"(",
"List",
"<",
"BlockMetaData",
">",
"rowGroupBlocks",
",",
"BlockLocation",
"[",
"]",
"hdfsBlocksArray",
",",
"FileStatus",
"fileStatus",
",",
"String",
"requestedSchema",
",",
... | groups together all the data blocks for the same HDFS block
@param rowGroupBlocks data blocks (row groups)
@param hdfsBlocksArray hdfs blocks
@param fileStatus the containing file
@param requestedSchema the schema requested by the user
@param readSupportMetadata the metadata provided by the readS... | [
"groups",
"together",
"all",
"the",
"data",
"blocks",
"for",
"the",
"same",
"HDFS",
"block"
] | 62dcc68acaf64012bf731e103be780956f1f446d | https://github.com/apache/parquet-mr/blob/62dcc68acaf64012bf731e103be780956f1f446d/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetInputFormat.java#L762-L779 | test | Generate splits from rowGroupBlocks and hdfsBlocksArray. | Of course, here is the Java code you requested:
```java
static <T> List<ParquetInputSplit> generateSplits(
List<BlockMetaData> rowGroupBlocks,
BlockLocation[] hdfsBlocksArray,
FileStatus fileStatus,
String requestedSchema,
Map<String, String> readSupportMetadata, long ... |
alipay/sofa-bolt | src/main/java/com/alipay/remoting/RemotingContext.java | RemotingContext.isRequestTimeout | public boolean isRequestTimeout() {
if (this.timeout > 0 && (this.rpcCommandType != RpcCommandType.REQUEST_ONEWAY)
&& (System.currentTimeMillis() - this.arriveTimestamp) > this.timeout) {
return true;
}
return false;
} | java | public boolean isRequestTimeout() {
if (this.timeout > 0 && (this.rpcCommandType != RpcCommandType.REQUEST_ONEWAY)
&& (System.currentTimeMillis() - this.arriveTimestamp) > this.timeout) {
return true;
}
return false;
} | [
"public",
"boolean",
"isRequestTimeout",
"(",
")",
"{",
"if",
"(",
"this",
".",
"timeout",
">",
"0",
"&&",
"(",
"this",
".",
"rpcCommandType",
"!=",
"RpcCommandType",
".",
"REQUEST_ONEWAY",
")",
"&&",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",... | whether this request already timeout
@return | [
"whether",
"this",
"request",
"already",
"timeout"
] | 0ad7b46b2649bfc4e2ecc1f5e1c1f935d179c046 | https://github.com/alipay/sofa-bolt/blob/0ad7b46b2649bfc4e2ecc1f5e1c1f935d179c046/src/main/java/com/alipay/remoting/RemotingContext.java#L120-L126 | test | Is request timeout. | Of course, here is the Java code you requested:
```java
public boolean isRequestTimeout() {
if (this.timeout > 0 && (this.rpcCommandType != RpcCommandType.REQUEST_ONEWAY)
&& (System.currentTimeMillis() - this.arriveTimestamp) > this.timeout) {
return true;
}
return false... |
streamsets/datacollector | jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcMySqlBinLogRecordReader.java | JdbcMySqlBinLogRecordReader.getFieldPath | @Override
String getFieldPath(String columnName, Map<String, String> columnsToField, int op) {
if (op == OperationType.DELETE_CODE){
String fieldPath = columnsToField.get(columnName);
if (fieldPath == null){
LOG.error("Column name {} is not defined in column-filed mapping", columnName);
... | java | @Override
String getFieldPath(String columnName, Map<String, String> columnsToField, int op) {
if (op == OperationType.DELETE_CODE){
String fieldPath = columnsToField.get(columnName);
if (fieldPath == null){
LOG.error("Column name {} is not defined in column-filed mapping", columnName);
... | [
"@",
"Override",
"String",
"getFieldPath",
"(",
"String",
"columnName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"columnsToField",
",",
"int",
"op",
")",
"{",
"if",
"(",
"op",
"==",
"OperationType",
".",
"DELETE_CODE",
")",
"{",
"String",
"fieldPath"... | Return a fieldpath for the corresponding column name. The columnToField Map
contains column-to-field mapping, so simply get fieldpath for the column name
if operation is INSERT or UPDATE.
We replace /Data to /OldData for delete operation because that's where records
store primary key info.
@param columnName column name... | [
"Return",
"a",
"fieldpath",
"for",
"the",
"corresponding",
"column",
"name",
".",
"The",
"columnToField",
"Map",
"contains",
"column",
"-",
"to",
"-",
"field",
"mapping",
"so",
"simply",
"get",
"fieldpath",
"for",
"the",
"column",
"name",
"if",
"operation",
... | ea63245ea14d59d5229248387f0628f46131eae5 | https://github.com/streamsets/datacollector/blob/ea63245ea14d59d5229248387f0628f46131eae5/jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcMySqlBinLogRecordReader.java#L82-L94 | test | Override the getFieldPath method. | Of course, here is the Java code you requested:
```java
@Override
String getFieldPath(String columnName, Map<String, String> columnsToField, int op) {
if (op == OperationType.DELETE_CODE){
String fieldPath = columnsToField.get(columnName);
if (fieldPath == null){
LOG.error("Column name {} is ... |
wildfly/wildfly | iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/rmi/ir/ValueDefImpl.java | ValueDefImpl.getValueMembersForTypeCode | private ValueMember[] getValueMembersForTypeCode() {
LocalContained[] c = _contents(DefinitionKind.dk_ValueMember, false);
ValueMember[] vms = new ValueMember[c.length];
for (int i = 0; i < c.length; ++i) {
ValueMemberDefImpl vmdi = (ValueMemberDefImpl) c[i];
vms[i] = ne... | java | private ValueMember[] getValueMembersForTypeCode() {
LocalContained[] c = _contents(DefinitionKind.dk_ValueMember, false);
ValueMember[] vms = new ValueMember[c.length];
for (int i = 0; i < c.length; ++i) {
ValueMemberDefImpl vmdi = (ValueMemberDefImpl) c[i];
vms[i] = ne... | [
"private",
"ValueMember",
"[",
"]",
"getValueMembersForTypeCode",
"(",
")",
"{",
"LocalContained",
"[",
"]",
"c",
"=",
"_contents",
"(",
"DefinitionKind",
".",
"dk_ValueMember",
",",
"false",
")",
";",
"ValueMember",
"[",
"]",
"vms",
"=",
"new",
"ValueMember",... | Create a valueMembers array for TypeCode creation only, and return it. | [
"Create",
"a",
"valueMembers",
"array",
"for",
"TypeCode",
"creation",
"only",
"and",
"return",
"it",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/rmi/ir/ValueDefImpl.java#L526-L542 | test | Get the ValueMember objects for the TypeCode. | Of course, here is the Java code you requested:
```java
private ValueMember[] getValueMembersForTypeCode() {
LocalContained[] c = _contents(DefinitionKind.dk_ValueMember, false);
ValueMember[] vms = new ValueMember[c.length];
for (int i = 0; i < c.length; ++i) {
ValueMemberDefImpl v... |
real-logic/aeron | aeron-archive/src/main/java/io/aeron/archive/client/ArchiveProxy.java | ArchiveProxy.getRecordingPosition | public boolean getRecordingPosition(final long recordingId, final long correlationId, final long controlSessionId)
{
recordingPositionRequestEncoder
.wrapAndApplyHeader(buffer, 0, messageHeaderEncoder)
.controlSessionId(controlSessionId)
.correlationId(correlationId)
... | java | public boolean getRecordingPosition(final long recordingId, final long correlationId, final long controlSessionId)
{
recordingPositionRequestEncoder
.wrapAndApplyHeader(buffer, 0, messageHeaderEncoder)
.controlSessionId(controlSessionId)
.correlationId(correlationId)
... | [
"public",
"boolean",
"getRecordingPosition",
"(",
"final",
"long",
"recordingId",
",",
"final",
"long",
"correlationId",
",",
"final",
"long",
"controlSessionId",
")",
"{",
"recordingPositionRequestEncoder",
".",
"wrapAndApplyHeader",
"(",
"buffer",
",",
"0",
",",
"... | Get the recorded position of an active recording.
@param recordingId of the active recording that the position is being requested for.
@param correlationId for this request.
@param controlSessionId for this request.
@return true if successfully offered otherwise false. | [
"Get",
"the",
"recorded",
"position",
"of",
"an",
"active",
"recording",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-archive/src/main/java/io/aeron/archive/client/ArchiveProxy.java#L446-L455 | test | Gets the recording position. | Of course, here is the Java code you requested:
```java
public boolean getRecordingPosition(final long recordingId, final long correlationId, final long controlSessionId)
{
recordingPositionRequestEncoder
.wrapAndApplyHeader(buffer, 0, messageHeaderEncoder)
.controlSessionId(control... |
Unidata/thredds | cdm/src/main/java/ucar/nc2/ft2/simpgeometry/SimpleGeometryReader.java | SimpleGeometryReader.getGeometryType | public GeometryType getGeometryType(String name) {
Variable geometryVar = ds.findVariable(name);
if(geometryVar == null) return null;
// CFConvention
if(ds.findGlobalAttribute(CF.CONVENTIONS) != null)
if(ucar.nc2.dataset.conv.CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringV... | java | public GeometryType getGeometryType(String name) {
Variable geometryVar = ds.findVariable(name);
if(geometryVar == null) return null;
// CFConvention
if(ds.findGlobalAttribute(CF.CONVENTIONS) != null)
if(ucar.nc2.dataset.conv.CF1Convention.getVersion(ds.findGlobalAttribute(CF.CONVENTIONS).getStringV... | [
"public",
"GeometryType",
"getGeometryType",
"(",
"String",
"name",
")",
"{",
"Variable",
"geometryVar",
"=",
"ds",
".",
"findVariable",
"(",
"name",
")",
";",
"if",
"(",
"geometryVar",
"==",
"null",
")",
"return",
"null",
";",
"// CFConvention\r",
"if",
"("... | Given a variable name, returns the geometry type which that variable is associated with.
If the variable has no simple geometry information, null will be returned.
@param name variable name which will have geometry type be checked
@return Geometry Type if holds geometry information, null if not | [
"Given",
"a",
"variable",
"name",
"returns",
"the",
"geometry",
"type",
"which",
"that",
"variable",
"is",
"associated",
"with",
".",
"If",
"the",
"variable",
"has",
"no",
"simple",
"geometry",
"information",
"null",
"will",
"be",
"returned",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/ft2/simpgeometry/SimpleGeometryReader.java#L95-L124 | test | Gets the GeometryType object with the specified name. | Of course, here is the Java code you requested:
```java
public GeometryType getGeometryType(String name) {
Variable geometryVar = ds.findVariable(name);
if(geometryVar == null) return null;
// CFConvention
if(ds.findGlobalAttribute(CF.CONVENTIONS) != null)
if(ucar.nc2.dataset.conv.CF1Convention.get... |
rupertlssmith/lojix | lojix/search/src/main/com/thesett/aima/search/util/informed/BaseHeuristicSearch.java | BaseHeuristicSearch.createSearchNode | public SearchNode<O, T> createSearchNode(T state)
{
return new HeuristicSearchNode<O, T>(state, heuristic);
} | java | public SearchNode<O, T> createSearchNode(T state)
{
return new HeuristicSearchNode<O, T>(state, heuristic);
} | [
"public",
"SearchNode",
"<",
"O",
",",
"T",
">",
"createSearchNode",
"(",
"T",
"state",
")",
"{",
"return",
"new",
"HeuristicSearchNode",
"<",
"O",
",",
"T",
">",
"(",
"state",
",",
"heuristic",
")",
";",
"}"
] | Creates the correct type of search nodes for this search. This search uses heuristic search nodes.
@param state The search space state to create a search node for.
@return The state encapsulated in a heuristic search node. | [
"Creates",
"the",
"correct",
"type",
"of",
"search",
"nodes",
"for",
"this",
"search",
".",
"This",
"search",
"uses",
"heuristic",
"search",
"nodes",
"."
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/search/src/main/com/thesett/aima/search/util/informed/BaseHeuristicSearch.java#L54-L57 | test | Create a search node. | Of course, here is the Java code you requested:
```java
public SearchNode<O, T> createSearchNode(T state)
{
return new HeuristicSearchNode<O, T>(state, heuristic);
}
```
Hope this helps! |
tiefaces/TieFaces | src/org/tiefaces/components/websheet/utility/WebSheetUtility.java | WebSheetUtility.clearHiddenColumns | public static void clearHiddenColumns(final Sheet sheet) {
for (Row row : sheet) {
if (row.getLastCellNum() > TieConstants.MAX_COLUMNS_IN_SHEET) {
deleteHiddenColumnsInRow(row);
}
}
} | java | public static void clearHiddenColumns(final Sheet sheet) {
for (Row row : sheet) {
if (row.getLastCellNum() > TieConstants.MAX_COLUMNS_IN_SHEET) {
deleteHiddenColumnsInRow(row);
}
}
} | [
"public",
"static",
"void",
"clearHiddenColumns",
"(",
"final",
"Sheet",
"sheet",
")",
"{",
"for",
"(",
"Row",
"row",
":",
"sheet",
")",
"{",
"if",
"(",
"row",
".",
"getLastCellNum",
"(",
")",
">",
"TieConstants",
".",
"MAX_COLUMNS_IN_SHEET",
")",
"{",
"... | Clear hidden columns.
@param sheet
the sheet | [
"Clear",
"hidden",
"columns",
"."
] | 3b57b9701ed0f080b5fa4fa78269cc0c422b34ba | https://github.com/tiefaces/TieFaces/blob/3b57b9701ed0f080b5fa4fa78269cc0c422b34ba/src/org/tiefaces/components/websheet/utility/WebSheetUtility.java#L683-L691 | test | Clear the hidden columns from a sheet. | Of course, here is the Java code you requested:
```java
public static void clearHiddenColumns(final Sheet sheet) {
for (Row row : sheet) {
if (row.getLastCellNum() > TieConstants.MAX_COLUMNS_IN_SHEET) {
deleteHiddenColumnsInRow(row);
}
}
}
```
Hope this helps! |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/OVarIntSerializer.java | OVarIntSerializer.readSignedVarLong | public static long readSignedVarLong(final BytesContainer bytes) {
final long raw = readUnsignedVarLong(bytes);
// This undoes the trick in writeSignedVarLong()
final long temp = (((raw << 63) >> 63) ^ raw) >> 1;
// This extra step lets us deal with the largest signed values by
// treating
// ne... | java | public static long readSignedVarLong(final BytesContainer bytes) {
final long raw = readUnsignedVarLong(bytes);
// This undoes the trick in writeSignedVarLong()
final long temp = (((raw << 63) >> 63) ^ raw) >> 1;
// This extra step lets us deal with the largest signed values by
// treating
// ne... | [
"public",
"static",
"long",
"readSignedVarLong",
"(",
"final",
"BytesContainer",
"bytes",
")",
"{",
"final",
"long",
"raw",
"=",
"readUnsignedVarLong",
"(",
"bytes",
")",
";",
"// This undoes the trick in writeSignedVarLong()",
"final",
"long",
"temp",
"=",
"(",
"("... | @param bytes to read bytes from
@return decode value
@throws IllegalArgumentException if variable-length value does not terminate after 9 bytes have been read | [
"@param",
"bytes",
"to",
"read",
"bytes",
"from"
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/binary/OVarIntSerializer.java#L90-L99 | test | Read a signed var long from the bytes container. | Of course, here is the Java code you requested:
```java
public static long readSignedVarLong(final BytesContainer bytes) {
final long raw = readUnsignedVarLong(bytes);
// This undoes the trick in writeSignedVarLong()
final long temp = (((raw << 63) >> 63) ^ raw) >> 1;
// This extra step lets us deal wi... |
Unidata/thredds | dap4/d4core/src/main/java/dap4/core/util/DapDump.java | DapDump.dumpbytes | static public void
dumpbytes(ByteBuffer buf0)
{
int stop = buf0.limit();
int size = stop + 8;
int savepos = buf0.position();
assert savepos == 0;
byte[] bytes = new byte[size];
Arrays.fill(bytes, (byte) 0);
buf0.get(bytes,0,stop);
buf0.position(sav... | java | static public void
dumpbytes(ByteBuffer buf0)
{
int stop = buf0.limit();
int size = stop + 8;
int savepos = buf0.position();
assert savepos == 0;
byte[] bytes = new byte[size];
Arrays.fill(bytes, (byte) 0);
buf0.get(bytes,0,stop);
buf0.position(sav... | [
"static",
"public",
"void",
"dumpbytes",
"(",
"ByteBuffer",
"buf0",
")",
"{",
"int",
"stop",
"=",
"buf0",
".",
"limit",
"(",
")",
";",
"int",
"size",
"=",
"stop",
"+",
"8",
";",
"int",
"savepos",
"=",
"buf0",
".",
"position",
"(",
")",
";",
"assert... | Dump the contents of a buffer from 0 to position
@param buf0 byte buffer to dump | [
"Dump",
"the",
"contents",
"of",
"a",
"buffer",
"from",
"0",
"to",
"position"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/dap4/d4core/src/main/java/dap4/core/util/DapDump.java#L59-L107 | test | Dump bytes of a single SEGMENT_CODE file. | Of course, here is the Java code you requested:
```java
static public void
dumpbytes(ByteBuffer buf0)
{
int stop = buf0.limit();
int size = stop + 8;
int savepos = buf0.position();
assert savepos == 0;
byte[] bytes = new byte[size];
Arrays.fill(bytes, (byte) 0);
... |
subchen/jetbrick-all-1x | jetbrick-orm/src/main/java/jetbrick/dao/orm/tx/JdbcTransaction.java | JdbcTransaction.close | @Override
public void close() {
try {
if (conn.isClosed()) {
throw new TransactionException("the connection is closed in transaction.");
}
DbUtils.closeQuietly(conn);
} catch (SQLException e) {
throw new TransactionException(e);
... | java | @Override
public void close() {
try {
if (conn.isClosed()) {
throw new TransactionException("the connection is closed in transaction.");
}
DbUtils.closeQuietly(conn);
} catch (SQLException e) {
throw new TransactionException(e);
... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"conn",
".",
"isClosed",
"(",
")",
")",
"{",
"throw",
"new",
"TransactionException",
"(",
"\"the connection is closed in transaction.\"",
")",
";",
"}",
"DbUtils",
".",
"closeQ... | 结束一个事务 | [
"结束一个事务"
] | abe54629a508592287afe5ca4ffc93bf8bf4940c | https://github.com/subchen/jetbrick-all-1x/blob/abe54629a508592287afe5ca4ffc93bf8bf4940c/jetbrick-orm/src/main/java/jetbrick/dao/orm/tx/JdbcTransaction.java#L85-L97 | test | Close the database connection. | Of course, here is the Java code you requested:
```java
@Override
public void close() {
try {
if (conn.isClosed()) {
throw new TransactionException("the connection is closed in transaction.");
}
DbUtils.closeQuietly(conn);
} catch (SQLException e)... |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/statistic/OPerformanceStatisticManager.java | OPerformanceStatisticManager.fetchSystemCounters | private void fetchSystemCounters(PerformanceCountersHolder countersHolder) {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThreadsStatistic field, then result statistic from this field
... | java | private void fetchSystemCounters(PerformanceCountersHolder countersHolder) {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThreadsStatistic field, then result statistic from this field
... | [
"private",
"void",
"fetchSystemCounters",
"(",
"PerformanceCountersHolder",
"countersHolder",
")",
"{",
"//go through all threads and accumulate statistic only for live threads",
"//all dead threads will be removed and statistics from them will be",
"//later accumulated in #deadThreadsStatistic ... | Iterates over all live threads and accumulates performance statics gathered form threads on system level,
also accumulates statistic from dead threads which were alive when when gathering of performance measurements is started.
@param countersHolder Holder which is used to accumulate all performance statistic data | [
"Iterates",
"over",
"all",
"live",
"threads",
"and",
"accumulates",
"performance",
"statics",
"gathered",
"form",
"threads",
"on",
"system",
"level",
"also",
"accumulates",
"statistic",
"from",
"dead",
"threads",
"which",
"were",
"alive",
"when",
"when",
"gatherin... | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/statistic/OPerformanceStatisticManager.java#L1289-L1326 | test | Fetch system counters from the statistics. | Of course, here is the Java code you requested:
```java
private void fetchSystemCounters(PerformanceCountersHolder countersHolder) {
//go through all threads and accumulate statistic only for live threads
//all dead threads will be removed and statistics from them will be
//later accumulated in #deadThread... |
ReactiveX/RxJava | src/main/java/io/reactivex/disposables/SerialDisposable.java | SerialDisposable.get | @Nullable
public Disposable get() {
Disposable d = resource.get();
if (d == DisposableHelper.DISPOSED) {
return Disposables.disposed();
}
return d;
} | java | @Nullable
public Disposable get() {
Disposable d = resource.get();
if (d == DisposableHelper.DISPOSED) {
return Disposables.disposed();
}
return d;
} | [
"@",
"Nullable",
"public",
"Disposable",
"get",
"(",
")",
"{",
"Disposable",
"d",
"=",
"resource",
".",
"get",
"(",
")",
";",
"if",
"(",
"d",
"==",
"DisposableHelper",
".",
"DISPOSED",
")",
"{",
"return",
"Disposables",
".",
"disposed",
"(",
")",
";",
... | Returns the currently contained Disposable or null if this container is empty.
@return the current Disposable, may be null | [
"Returns",
"the",
"currently",
"contained",
"Disposable",
"or",
"null",
"if",
"this",
"container",
"is",
"empty",
"."
] | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/disposables/SerialDisposable.java#L70-L77 | test | Gets the object. | Of course, here is the Java code you requested:
```java
@Nullable
public Disposable get() {
Disposable d = resource.get();
if (d == DisposableHelper.DISPOSED) {
return Disposables.disposed();
}
return d;
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/ucar/unidata/util/StringUtil2.java | StringUtil2.cleanup | public static String cleanup(byte[] h) {
byte[] bb = new byte[h.length];
int count = 0;
for (byte b : h) {
if (b >= 32 && b < 127)
bb[count++] = b;
}
return new String(bb, 0, count, CDM.utf8Charset);
} | java | public static String cleanup(byte[] h) {
byte[] bb = new byte[h.length];
int count = 0;
for (byte b : h) {
if (b >= 32 && b < 127)
bb[count++] = b;
}
return new String(bb, 0, count, CDM.utf8Charset);
} | [
"public",
"static",
"String",
"cleanup",
"(",
"byte",
"[",
"]",
"h",
")",
"{",
"byte",
"[",
"]",
"bb",
"=",
"new",
"byte",
"[",
"h",
".",
"length",
"]",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"byte",
"b",
":",
"h",
")",
"{",
"if",
... | Delete any non-printable characters
@param h byte array
@return cleaned up string | [
"Delete",
"any",
"non",
"-",
"printable",
"characters"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/unidata/util/StringUtil2.java#L89-L97 | test | Clean up a sequence of bytes. | Of course, here is the Java code you requested:
```java
public static String cleanup(byte[] h) {
byte[] bb = new byte[h.length];
int count = 0;
for (byte b : h) {
if (b >= 32 && b < 127)
bb[count++] = b;
}
return new String(bb, 0, count, CDM.utf8Charset);
}
```
Hope this he... |
oblac/jodd | jodd-proxetta/src/main/java/jodd/asm7/ClassVisitor.java | ClassVisitor.visitInnerClass | public void visitInnerClass(
final String name, final String outerName, final String innerName, final int access) {
if (cv != null) {
cv.visitInnerClass(name, outerName, innerName, access);
}
} | java | public void visitInnerClass(
final String name, final String outerName, final String innerName, final int access) {
if (cv != null) {
cv.visitInnerClass(name, outerName, innerName, access);
}
} | [
"public",
"void",
"visitInnerClass",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"outerName",
",",
"final",
"String",
"innerName",
",",
"final",
"int",
"access",
")",
"{",
"if",
"(",
"cv",
"!=",
"null",
")",
"{",
"cv",
".",
"visitInnerClass",
... | Visits information about an inner class. This inner class is not necessarily a member of the
class being visited.
@param name the internal name of an inner class (see {@link Type#getInternalName()}).
@param outerName the internal name of the class to which the inner class belongs (see {@link
Type#getInternalName()}). ... | [
"Visits",
"information",
"about",
"an",
"inner",
"class",
".",
"This",
"inner",
"class",
"is",
"not",
"necessarily",
"a",
"member",
"of",
"the",
"class",
"being",
"visited",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-proxetta/src/main/java/jodd/asm7/ClassVisitor.java#L255-L260 | test | Visit an inner class. | Of course, here is the Java code you requested:
```java
public void visitInnerClass(
final String name, final String outerName, final String innerName, final int access) {
if (cv != null) {
cv.visitInnerClass(name, outerName, innerName, access);
}
}
```
Hope this helps! |
Netflix-Skunkworks/Numerus | numerus/src/main/java/com/netflix/numerus/LongMaxUpdater.java | LongMaxUpdater.max | public long max() {
Cell[] as = cells;
long max = base;
if (as != null) {
int n = as.length;
long v;
for (int i = 0; i < n; ++i) {
Cell a = as[i];
if (a != null && (v = a.value) > max)
max = v;
}
... | java | public long max() {
Cell[] as = cells;
long max = base;
if (as != null) {
int n = as.length;
long v;
for (int i = 0; i < n; ++i) {
Cell a = as[i];
if (a != null && (v = a.value) > max)
max = v;
}
... | [
"public",
"long",
"max",
"(",
")",
"{",
"Cell",
"[",
"]",
"as",
"=",
"cells",
";",
"long",
"max",
"=",
"base",
";",
"if",
"(",
"as",
"!=",
"null",
")",
"{",
"int",
"n",
"=",
"as",
".",
"length",
";",
"long",
"v",
";",
"for",
"(",
"int",
"i"... | Returns the current maximum. The returned value is
<em>NOT</em> an atomic snapshot: Invocation in the absence of
concurrent updates returns an accurate result, but concurrent
updates that occur while the value is being calculated might
not be incorporated.
@return the maximum | [
"Returns",
"the",
"current",
"maximum",
".",
"The",
"returned",
"value",
"is",
"<em",
">",
"NOT<",
"/",
"em",
">",
"an",
"atomic",
"snapshot",
":",
"Invocation",
"in",
"the",
"absence",
"of",
"concurrent",
"updates",
"returns",
"an",
"accurate",
"result",
... | 08beb44403ddc2a045e7c2c71fc3f23f5d32723d | https://github.com/Netflix-Skunkworks/Numerus/blob/08beb44403ddc2a045e7c2c71fc3f23f5d32723d/numerus/src/main/java/com/netflix/numerus/LongMaxUpdater.java#L96-L109 | test | Get the max value of the set of records. | Of course, here is the Java code you requested:
```java
public long max() {
Cell[] as = cells;
long max = base;
if (as != null) {
int n = as.length;
long v;
for (int i = 0; i < n; ++i) {
Cell a = as[i];
if (a != null && (v = a.... |
deeplearning4j/nd4j | nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java | DifferentialFunction.diff | public List<SDVariable> diff(List<SDVariable> i_v1) {
List<SDVariable> vals = doDiff(i_v1);
if(vals == null){
throw new IllegalStateException("Error executing diff operation: doDiff returned null for op: " + this.opName());
}
val outputVars = args();
for(int i = 0; i... | java | public List<SDVariable> diff(List<SDVariable> i_v1) {
List<SDVariable> vals = doDiff(i_v1);
if(vals == null){
throw new IllegalStateException("Error executing diff operation: doDiff returned null for op: " + this.opName());
}
val outputVars = args();
for(int i = 0; i... | [
"public",
"List",
"<",
"SDVariable",
">",
"diff",
"(",
"List",
"<",
"SDVariable",
">",
"i_v1",
")",
"{",
"List",
"<",
"SDVariable",
">",
"vals",
"=",
"doDiff",
"(",
"i_v1",
")",
";",
"if",
"(",
"vals",
"==",
"null",
")",
"{",
"throw",
"new",
"Illeg... | Perform automatic differentiation
wrt the input variables
@param i_v1 the input variables
@return the differentiated output
wrt each input variable | [
"Perform",
"automatic",
"differentiation",
"wrt",
"the",
"input",
"variables"
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java#L504-L532 | test | Diff operation for a single attribute | Of course, here is the Java code you requested:
```java
public List<SDVariable> diff(List<SDVariable> i_v1) {
List<SDVariable> vals = doDiff(i_v1);
if(vals == null){
throw new IllegalStateException("Error executing diff operation: doDiff returned null for op: " + this.opName());
}
... |
OpenEstate/OpenEstate-IO | Core/src/main/java/org/openestate/io/core/CsvRecord.java | CsvRecord.print | protected Iterable<String> print() {
final int length = this.getRecordLenth();
List<String> row = new ArrayList<>();
for (int i = 0; i < length; i++) {
row.add(this.get(i));
}
return row;
} | java | protected Iterable<String> print() {
final int length = this.getRecordLenth();
List<String> row = new ArrayList<>();
for (int i = 0; i < length; i++) {
row.add(this.get(i));
}
return row;
} | [
"protected",
"Iterable",
"<",
"String",
">",
"print",
"(",
")",
"{",
"final",
"int",
"length",
"=",
"this",
".",
"getRecordLenth",
"(",
")",
";",
"List",
"<",
"String",
">",
"row",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i... | Returns a list of values for this record as they are written into CSV.
@return CSV values to write | [
"Returns",
"a",
"list",
"of",
"values",
"for",
"this",
"record",
"as",
"they",
"are",
"written",
"into",
"CSV",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/Core/src/main/java/org/openestate/io/core/CsvRecord.java#L142-L149 | test | Print the content of the record as a list of strings. | Of course, here is the Java code you requested:
```java
protected Iterable<String> print() {
final int length = this.getRecordLenth();
List<String> row = new ArrayList<>();
for (int i = 0; i < length; i++) {
row.add(this.get(i));
}
return row;
}
```
Hope this he... |
ReactiveX/RxJava | src/main/java/io/reactivex/Flowable.java | Flowable.rangeLong | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public static Flowable<Long> rangeLong(long start, long count) {
if (count < 0) {
throw new IllegalArgumentException("count >= 0 required but it was " + count);
}
if (c... | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public static Flowable<Long> rangeLong(long start, long count) {
if (count < 0) {
throw new IllegalArgumentException("count >= 0 required but it was " + count);
}
if (c... | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"FULL",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"static",
"Flowable",
"<",
"Long",
">",
"rangeLong",
"(",
"long",
"start",
",",
"long",
... | Returns a Flowable that emits a sequence of Longs within a specified range.
<p>
<img width="640" height="195" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/range.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors backpressure from downstream and signals values on-demand (i.e... | [
"Returns",
"a",
"Flowable",
"that",
"emits",
"a",
"sequence",
"of",
"Longs",
"within",
"a",
"specified",
"range",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"195",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/"... | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/Flowable.java#L4009-L4031 | test | Returns an Flowable of Long from start to start + count | Of course, here is the Java code you requested:
```java
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public static Flowable<Long> rangeLong(long start, long count) {
if (count < 0) {
throw new IllegalArgumentException("count >= 0... |
deeplearning4j/nd4j | nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.deconv2d | public SDVariable deconv2d(SDVariable[] inputs, DeConv2DConfig deconv2DConfig) {
return deconv2d(null, inputs, deconv2DConfig);
} | java | public SDVariable deconv2d(SDVariable[] inputs, DeConv2DConfig deconv2DConfig) {
return deconv2d(null, inputs, deconv2DConfig);
} | [
"public",
"SDVariable",
"deconv2d",
"(",
"SDVariable",
"[",
"]",
"inputs",
",",
"DeConv2DConfig",
"deconv2DConfig",
")",
"{",
"return",
"deconv2d",
"(",
"null",
",",
"inputs",
",",
"deconv2DConfig",
")",
";",
"}"
] | Deconv2d operation.
@param inputs the inputs to sconv2d
@param deconv2DConfig the configuration
@return | [
"Deconv2d",
"operation",
"."
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1902-L1904 | test | Deconv2d operation. | Of course, here is the Java code you requested:
```java
public SDVariable deconv2d(SDVariable[] inputs, DeConv2DConfig deconv2DConfig) {
return deconv2d(null, inputs, deconv2DConfig);
}
```
Hope this helps! |
wildfly/wildfly | jaxrs/src/main/java/org/jboss/as/jaxrs/deployment/JaxrsMethodParameterProcessor.java | JaxrsMethodParameterProcessor.validateBaseType | private void validateBaseType(Method method, String defaultValue, ParamDetail detail)
throws DeploymentUnitProcessingException {
if (defaultValue != null) {
try {
method.invoke(method.getDeclaringClass(), defaultValue);
} catch (Exception e) {
JAXR... | java | private void validateBaseType(Method method, String defaultValue, ParamDetail detail)
throws DeploymentUnitProcessingException {
if (defaultValue != null) {
try {
method.invoke(method.getDeclaringClass(), defaultValue);
} catch (Exception e) {
JAXR... | [
"private",
"void",
"validateBaseType",
"(",
"Method",
"method",
",",
"String",
"defaultValue",
",",
"ParamDetail",
"detail",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"if",
"(",
"defaultValue",
"!=",
"null",
")",
"{",
"try",
"{",
"method",
".",
"i... | Confirm the method can handle the default value without throwing
and exception.
@param method
@param defaultValue | [
"Confirm",
"the",
"method",
"can",
"handle",
"the",
"default",
"value",
"without",
"throwing",
"and",
"exception",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/jaxrs/src/main/java/org/jboss/as/jaxrs/deployment/JaxrsMethodParameterProcessor.java#L588-L600 | test | Validate the type of a class. | Of course, here is the Java code you requested:
```java
private void validateBaseType(Method method, String defaultValue, ParamDetail detail)
throws DeploymentUnitProcessingException {
if (defaultValue != null) {
try {
method.invoke(method.getDeclaringClass(), defaultValue);... |
rackerlabs/blueflood | blueflood-core/src/main/java/com/rackspacecloud/blueflood/io/datastax/DSetIO.java | DSetIO.toByteBuffer | @Override
protected ByteBuffer toByteBuffer(Object value) {
if ( ! (value instanceof BluefloodSetRollup) ) {
throw new IllegalArgumentException("toByteBuffer(): expecting BluefloodSetRollup class but got " + value.getClass().getSimpleName());
}
BluefloodSetRollup setRollup = (Blu... | java | @Override
protected ByteBuffer toByteBuffer(Object value) {
if ( ! (value instanceof BluefloodSetRollup) ) {
throw new IllegalArgumentException("toByteBuffer(): expecting BluefloodSetRollup class but got " + value.getClass().getSimpleName());
}
BluefloodSetRollup setRollup = (Blu... | [
"@",
"Override",
"protected",
"ByteBuffer",
"toByteBuffer",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"BluefloodSetRollup",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"toByteBuffer(): expecting BluefloodSetRol... | Provides a way for the sub class to get a {@link java.nio.ByteBuffer}
representation of a certain Rollup object.
@param value
@return | [
"Provides",
"a",
"way",
"for",
"the",
"sub",
"class",
"to",
"get",
"a",
"{",
"@link",
"java",
".",
"nio",
".",
"ByteBuffer",
"}",
"representation",
"of",
"a",
"certain",
"Rollup",
"object",
"."
] | 4722a3449b1a7f8e88889ea8c340c6f24396b5b0 | https://github.com/rackerlabs/blueflood/blob/4722a3449b1a7f8e88889ea8c340c6f24396b5b0/blueflood-core/src/main/java/com/rackspacecloud/blueflood/io/datastax/DSetIO.java#L46-L53 | test | Serialize a BluefloodSetRollup object to a ByteBuffer. | Of course, here is the Java code you requested:
```java
@Override
protected ByteBuffer toByteBuffer(Object value) {
if ( ! (value instanceof BluefloodSetRollup) ) {
throw new IllegalArgumentException("toByteBuffer(): expecting BluefloodSetRollup class but got " + value.getClass().getSimpleName(... |
deeplearning4j/nd4j | nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/loss/LossFunctions.java | LossFunctions.mse | public static LossInfo mse(String outputName, SDVariable predictions, SDVariable label, SDVariable weights,
Reduction reduction, int... dimensions){
LossInfo.Builder b = validate("mse", predictions, label, reduction);
SameDiff sd = predictions.getSameDiff();
if(we... | java | public static LossInfo mse(String outputName, SDVariable predictions, SDVariable label, SDVariable weights,
Reduction reduction, int... dimensions){
LossInfo.Builder b = validate("mse", predictions, label, reduction);
SameDiff sd = predictions.getSameDiff();
if(we... | [
"public",
"static",
"LossInfo",
"mse",
"(",
"String",
"outputName",
",",
"SDVariable",
"predictions",
",",
"SDVariable",
"label",
",",
"SDVariable",
"weights",
",",
"Reduction",
"reduction",
",",
"int",
"...",
"dimensions",
")",
"{",
"LossInfo",
".",
"Builder",
... | Mean squared error: L = mean( (predicted - label)^2)
@param outputName Name of the output SDVariable
@param predictions Predictions variable
@param label Label variable
@param weights Weights array. May be null, or any broadcastable shape (with predictions/label arrays).
Note that this is also used for mask... | [
"Mean",
"squared",
"error",
":",
"L",
"=",
"mean",
"(",
"(",
"predicted",
"-",
"label",
")",
"^2",
")"
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/loss/LossFunctions.java#L89-L103 | test | MSE loss operation | Of course, here is the Java code you requested:
```java
public static LossInfo mse(String outputName, SDVariable predictions, SDVariable label, SDVariable weights,
Reduction reduction, int... dimensions){
LossInfo.Builder b = validate("mse", predictions, label, reduction);
... |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataTiff.java | CoverageDataTiff.drawTileData | public byte[] drawTileData(float[][] pixelValues) {
CoverageDataTiffImage image = drawTile(pixelValues);
byte[] bytes = image.getImageBytes();
return bytes;
} | java | public byte[] drawTileData(float[][] pixelValues) {
CoverageDataTiffImage image = drawTile(pixelValues);
byte[] bytes = image.getImageBytes();
return bytes;
} | [
"public",
"byte",
"[",
"]",
"drawTileData",
"(",
"float",
"[",
"]",
"[",
"]",
"pixelValues",
")",
"{",
"CoverageDataTiffImage",
"image",
"=",
"drawTile",
"(",
"pixelValues",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"image",
".",
"getImageBytes",
"(",
")... | Draw a coverage data image tile and format as TIFF bytes from the double
array of float pixel values formatted as float[row][width]
@param pixelValues float pixel values as [row][width]
@return coverage data image tile bytes | [
"Draw",
"a",
"coverage",
"data",
"image",
"tile",
"and",
"format",
"as",
"TIFF",
"bytes",
"from",
"the",
"double",
"array",
"of",
"float",
"pixel",
"values",
"formatted",
"as",
"float",
"[",
"row",
"]",
"[",
"width",
"]"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataTiff.java#L274-L278 | test | Draw the coverage data for the specified pixel values. | Of course, here is the Java code you requested:
```java
public byte[] drawTileData(float[][] pixelValues) {
CoverageDataTiffImage image = drawTile(pixelValues);
byte[] bytes = image.getImageBytes();
return bytes;
}
```
Hope this helps! |
lessthanoptimal/GeoRegression | main/src/georegression/transform/twist/TwistOps_F64.java | TwistOps_F64.homogenous | public static DMatrixRMaj homogenous( TwistCoordinate_F64 twist , DMatrixRMaj H ) {
if( H == null ) {
H = new DMatrixRMaj(4,4);
} else {
H.reshape(4,4);
H.data[12] = 0; H.data[13] = 0; H.data[14] = 0; H.data[15] = 0;
}
H.data[0] = 0; H.data[1] = -twist.w.z; H.data[2] = twist.w.y; H.data[3] ... | java | public static DMatrixRMaj homogenous( TwistCoordinate_F64 twist , DMatrixRMaj H ) {
if( H == null ) {
H = new DMatrixRMaj(4,4);
} else {
H.reshape(4,4);
H.data[12] = 0; H.data[13] = 0; H.data[14] = 0; H.data[15] = 0;
}
H.data[0] = 0; H.data[1] = -twist.w.z; H.data[2] = twist.w.y; H.data[3] ... | [
"public",
"static",
"DMatrixRMaj",
"homogenous",
"(",
"TwistCoordinate_F64",
"twist",
",",
"DMatrixRMaj",
"H",
")",
"{",
"if",
"(",
"H",
"==",
"null",
")",
"{",
"H",
"=",
"new",
"DMatrixRMaj",
"(",
"4",
",",
"4",
")",
";",
"}",
"else",
"{",
"H",
".",... | Converts the twist coordinate into homogenous format.<br>
H = [hat(w), v; 0 , 0]
@param twist Twist coordinate
@param H (Optional) Storage for homogenous 4x4 matrix. If null a new matrix is declared.
@return Homogenous matrix | [
"Converts",
"the",
"twist",
"coordinate",
"into",
"homogenous",
"format",
".",
"<br",
">",
"H",
"=",
"[",
"hat",
"(",
"w",
")",
"v",
";",
"0",
"0",
"]"
] | c067cd44a4e95bd826119f6e658bd82386ef289f | https://github.com/lessthanoptimal/GeoRegression/blob/c067cd44a4e95bd826119f6e658bd82386ef289f/main/src/georegression/transform/twist/TwistOps_F64.java#L71-L84 | test | Computes the homogenous coordinate matrix from the twist coordinate. | Of course, here is the Java code you requested:
```java
public static DMatrixRMaj homogenous( TwistCoordinate_F64 twist , DMatrixRMaj H ) {
if( H == null ) {
H = new DMatrixRMaj(4,4);
} else {
H.reshape(4,4);
H.data[12] = 0; H.data[13] = 0; H.data[14] = 0; H.data[15] = 0;
}
H.data[0] = 0; H.... |
oblac/jodd | jodd-bean/src/main/java/jodd/bean/BeanCopy.java | BeanCopy.copy | public void copy() {
beanUtil = new BeanUtilBean()
.declared(declared)
.forced(forced)
.silent(true);
visit();
} | java | public void copy() {
beanUtil = new BeanUtilBean()
.declared(declared)
.forced(forced)
.silent(true);
visit();
} | [
"public",
"void",
"copy",
"(",
")",
"{",
"beanUtil",
"=",
"new",
"BeanUtilBean",
"(",
")",
".",
"declared",
"(",
"declared",
")",
".",
"forced",
"(",
"forced",
")",
".",
"silent",
"(",
"true",
")",
";",
"visit",
"(",
")",
";",
"}"
] | Performs the copying. | [
"Performs",
"the",
"copying",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-bean/src/main/java/jodd/bean/BeanCopy.java#L164-L170 | test | Copy the BeanUtilBean to this BeanUtilBean | Of course, here is the Java code you requested:
```java
public void copy() {
beanUtil = new BeanUtilBean()
.declared(declared)
.forced(forced)
.silent(true);
visit();
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/ucar/nc2/iosp/nids/Nidsheader.java | Nidsheader.convert | protected Object convert( byte[] barray, DataType dataType, int nelems, int byteOrder) {
if (dataType == DataType.BYTE) {
return barray;
}
if (dataType == DataType.CHAR) {
return IospHelper.convertByteToChar( barray);
}
ByteBuffer bbuff = ByteBuff... | java | protected Object convert( byte[] barray, DataType dataType, int nelems, int byteOrder) {
if (dataType == DataType.BYTE) {
return barray;
}
if (dataType == DataType.CHAR) {
return IospHelper.convertByteToChar( barray);
}
ByteBuffer bbuff = ByteBuff... | [
"protected",
"Object",
"convert",
"(",
"byte",
"[",
"]",
"barray",
",",
"DataType",
"dataType",
",",
"int",
"nelems",
",",
"int",
"byteOrder",
")",
"{",
"if",
"(",
"dataType",
"==",
"DataType",
".",
"BYTE",
")",
"{",
"return",
"barray",
";",
"}",
"if",... | this converts a byte array to another primitive array
@param barray
@param dataType
@param nelems
@param byteOrder
@return | [
"this",
"converts",
"a",
"byte",
"array",
"to",
"another",
"primitive",
"array"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/iosp/nids/Nidsheader.java#L3332-L3372 | test | This method is used to convert a byte array to a java. nio. ByteBuffer. | Of course, here is the Java code you requested:
```java
protected Object convert( byte[] barray, DataType dataType, int nelems, int byteOrder) {
if (dataType == DataType.BYTE) {
return barray;
}
if (dataType == DataType.CHAR) {
return IospHelper.convertByteToChar( b... |
intellimate/IzouSDK | src/main/java/org/intellimate/izou/sdk/frameworks/presence/provider/Presence.java | Presence.importPresence | public static Optional<Presence> importPresence(ResourceModel resourceModel) {
Object resource = resourceModel.getResource();
try {
//noinspection unchecked
HashMap<String, Object> data = (HashMap<String, Object>) resource;
PresenceIndicatorLevel level;
tr... | java | public static Optional<Presence> importPresence(ResourceModel resourceModel) {
Object resource = resourceModel.getResource();
try {
//noinspection unchecked
HashMap<String, Object> data = (HashMap<String, Object>) resource;
PresenceIndicatorLevel level;
tr... | [
"public",
"static",
"Optional",
"<",
"Presence",
">",
"importPresence",
"(",
"ResourceModel",
"resourceModel",
")",
"{",
"Object",
"resource",
"=",
"resourceModel",
".",
"getResource",
"(",
")",
";",
"try",
"{",
"//noinspection unchecked",
"HashMap",
"<",
"String"... | imports (if no errors occurred) the Presence from the ResourceModel
@param resourceModel the resourcemodel to import from
@return the (optional) presence | [
"imports",
"(",
"if",
"no",
"errors",
"occurred",
")",
"the",
"Presence",
"from",
"the",
"ResourceModel"
] | bc8705ad48a6ca12a722f2b787be435949fa5d08 | https://github.com/intellimate/IzouSDK/blob/bc8705ad48a6ca12a722f2b787be435949fa5d08/src/main/java/org/intellimate/izou/sdk/frameworks/presence/provider/Presence.java#L88-L106 | test | Import Presence from ResourceModel | Of course, here is the Java code you requested:
```java
public static Optional<Presence> importPresence(ResourceModel resourceModel) {
Object resource = resourceModel.getResource();
try {
//noinspection unchecked
HashMap<String, Object> data = (HashMap<String, Object>) resource;... |
fabric8io/fabric8-maven-plugin | enricher/standard/src/main/java/io/fabric8/maven/enricher/standard/DefaultServiceEnricher.java | DefaultServiceEnricher.extractPortsFromConfig | private List<ServicePort> extractPortsFromConfig() {
List<ServicePort> ret = new LinkedList<>();
String ports = getConfig(Config.port);
if (ports != null) {
for (String port : StringUtils.split(ports, ",")) {
ret.add(parsePortMapping(port));
}
}
... | java | private List<ServicePort> extractPortsFromConfig() {
List<ServicePort> ret = new LinkedList<>();
String ports = getConfig(Config.port);
if (ports != null) {
for (String port : StringUtils.split(ports, ",")) {
ret.add(parsePortMapping(port));
}
}
... | [
"private",
"List",
"<",
"ServicePort",
">",
"extractPortsFromConfig",
"(",
")",
"{",
"List",
"<",
"ServicePort",
">",
"ret",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"String",
"ports",
"=",
"getConfig",
"(",
"Config",
".",
"port",
")",
";",
"if",
... | Config can override ports | [
"Config",
"can",
"override",
"ports"
] | b0e7ad860a5bbe4ab71be3d0613862a1f14a8be3 | https://github.com/fabric8io/fabric8-maven-plugin/blob/b0e7ad860a5bbe4ab71be3d0613862a1f14a8be3/enricher/standard/src/main/java/io/fabric8/maven/enricher/standard/DefaultServiceEnricher.java#L297-L306 | test | Extract ports from config. | Of course, here is the Java code you requested:
```java
private List<ServicePort> extractPortsFromConfig() {
List<ServicePort> ret = new LinkedList<>();
String ports = getConfig(Config.port);
if (ports != null) {
for (String port : StringUtils.split(ports, ",")) {
re... |
Jasig/NotificationPortlet | notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/ssp/SSPTaskNotificationService.java | SSPTaskNotificationService.mapToNotificationResponse | private NotificationResponse mapToNotificationResponse(PortletRequest request, ResponseEntity<String> response) {
Configuration config = Configuration.builder().options(
Option.DEFAULT_PATH_LEAF_TO_NULL
).build();
ReadContext readContext = JsonPath
.using(config)
... | java | private NotificationResponse mapToNotificationResponse(PortletRequest request, ResponseEntity<String> response) {
Configuration config = Configuration.builder().options(
Option.DEFAULT_PATH_LEAF_TO_NULL
).build();
ReadContext readContext = JsonPath
.using(config)
... | [
"private",
"NotificationResponse",
"mapToNotificationResponse",
"(",
"PortletRequest",
"request",
",",
"ResponseEntity",
"<",
"String",
">",
"response",
")",
"{",
"Configuration",
"config",
"=",
"Configuration",
".",
"builder",
"(",
")",
".",
"options",
"(",
"Option... | Map and SSP Response to a NotificationResponse.
@param request the portlet request
@param response the response from the REST call to SSP
@return the mapped notification response | [
"Map",
"and",
"SSP",
"Response",
"to",
"a",
"NotificationResponse",
"."
] | a74b87c145b66166a2cb6849d17ce9b0f2c98f3b | https://github.com/Jasig/NotificationPortlet/blob/a74b87c145b66166a2cb6849d17ce9b0f2c98f3b/notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/ssp/SSPTaskNotificationService.java#L165-L208 | test | Maps the response entity to a NotificationResponse object. | Of course, here is the Java code you requested:
```java
private NotificationResponse mapToNotificationResponse(PortletRequest request, ResponseEntity<String> response) {
Configuration config = Configuration.builder().options(
Option.DEFAULT_PATH_LEAF_TO_NULL
).build();
ReadConte... |
tiefaces/TieFaces | src/org/tiefaces/components/websheet/utility/ColorUtility.java | ColorUtility.assembleXcolor | private static XColor assembleXcolor(final XSSFColor bcolor,
final double preTint, final int lumOff, final int lumMod,
final int alphaInt) {
if (bcolor == null) {
return null;
}
double tint = preTint;
if (Double.compare(tint, 0) == 0) {
// no preTint
if (lumOff > 0) {
tint = lu... | java | private static XColor assembleXcolor(final XSSFColor bcolor,
final double preTint, final int lumOff, final int lumMod,
final int alphaInt) {
if (bcolor == null) {
return null;
}
double tint = preTint;
if (Double.compare(tint, 0) == 0) {
// no preTint
if (lumOff > 0) {
tint = lu... | [
"private",
"static",
"XColor",
"assembleXcolor",
"(",
"final",
"XSSFColor",
"bcolor",
",",
"final",
"double",
"preTint",
",",
"final",
"int",
"lumOff",
",",
"final",
"int",
"lumMod",
",",
"final",
"int",
"alphaInt",
")",
"{",
"if",
"(",
"bcolor",
"==",
"nu... | assemble xssfcolor with tint/lumoff/lummod/alpha to xcolor.
@param bcolor
xssfcolor
@param preTint
tint
@param lumOff
lumOff
@param lumMod
lummod
@param alphaInt
alpha
@return xcolor | [
"assemble",
"xssfcolor",
"with",
"tint",
"/",
"lumoff",
"/",
"lummod",
"/",
"alpha",
"to",
"xcolor",
"."
] | 3b57b9701ed0f080b5fa4fa78269cc0c422b34ba | https://github.com/tiefaces/TieFaces/blob/3b57b9701ed0f080b5fa4fa78269cc0c422b34ba/src/org/tiefaces/components/websheet/utility/ColorUtility.java#L166-L195 | test | Assembles a XSSFColor object from the given values. | Of course, here is the Java code you requested:
```java
private static XColor assembleXcolor(final XSSFColor bcolor,
final double preTint, final int lumOff, final int lumMod,
final int alphaInt) {
if (bcolor == null) {
return null;
}
double tint = preTint;
if (Double.compare(tint, 0) == 0)... |
grzesiek-galezowski/AutoFixtureGenerator | src/main/java/autofixture/publicinterface/thirdpartysupport/AnyVavr.java | AnyVavr.validationSuccess | @NonNull
public static <T,U> Validation<T, U> validationSuccess(final Class<U> type) {
assertIsNotParameterized(type, msgInline("validationSuccess"));
return Validation.valid(Any.instanceOf(type));
} | java | @NonNull
public static <T,U> Validation<T, U> validationSuccess(final Class<U> type) {
assertIsNotParameterized(type, msgInline("validationSuccess"));
return Validation.valid(Any.instanceOf(type));
} | [
"@",
"NonNull",
"public",
"static",
"<",
"T",
",",
"U",
">",
"Validation",
"<",
"T",
",",
"U",
">",
"validationSuccess",
"(",
"final",
"Class",
"<",
"U",
">",
"type",
")",
"{",
"assertIsNotParameterized",
"(",
"type",
",",
"msgInline",
"(",
"\"validation... | validations - successful | [
"validations",
"-",
"successful"
] | a5e1146ec5109e6505f8aff604a20461ec86a57d | https://github.com/grzesiek-galezowski/AutoFixtureGenerator/blob/a5e1146ec5109e6505f8aff604a20461ec86a57d/src/main/java/autofixture/publicinterface/thirdpartysupport/AnyVavr.java#L283-L287 | test | Validate that a type is a valid type. | Of course, here is the Java code you requested:
```java
@NonNull
public static <T,U> Validation<T, U> validationSuccess(final Class<U> type) {
assertIsNotParameterized(type, msgInline("validationSuccess"));
return Validation.valid(Any.instanceOf(type));
}
```
Hope this helps! |
Unidata/thredds | dap4/d4core/src/main/java/dap4/core/dmr/parser/DOM4Parser.java | DOM4Parser.parse | public boolean
parse(String input)
throws SAXException
{
try {
DocumentBuilderFactory domfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dombuilder = domfactory.newDocumentBuilder();
StringReader rdr = new StringReader(input);
I... | java | public boolean
parse(String input)
throws SAXException
{
try {
DocumentBuilderFactory domfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dombuilder = domfactory.newDocumentBuilder();
StringReader rdr = new StringReader(input);
I... | [
"public",
"boolean",
"parse",
"(",
"String",
"input",
")",
"throws",
"SAXException",
"{",
"try",
"{",
"DocumentBuilderFactory",
"domfactory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"DocumentBuilder",
"dombuilder",
"=",
"domfactory",
".",
... | Parser API | [
"Parser",
"API"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/dap4/d4core/src/main/java/dap4/core/dmr/parser/DOM4Parser.java#L205-L222 | test | Parses the input string. | Of course, here is the Java code you requested:
```java
public boolean
parse(String input)
throws SAXException
{
try {
DocumentBuilderFactory domfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dombuilder = domfactory.newDocumentBuilder();
... |
deeplearning4j/nd4j | nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/BaseLevel1.java | BaseLevel1.scal | @Override
public void scal(long N, IComplexNumber alpha, IComplexNDArray X) {
if (X.data().dataType() == DataBuffer.Type.DOUBLE)
zscal(N, alpha.asDouble(), X, BlasBufferUtil.getBlasStride(X));
else
cscal(N, alpha.asFloat(), X, BlasBufferUtil.getBlasStride(X));
} | java | @Override
public void scal(long N, IComplexNumber alpha, IComplexNDArray X) {
if (X.data().dataType() == DataBuffer.Type.DOUBLE)
zscal(N, alpha.asDouble(), X, BlasBufferUtil.getBlasStride(X));
else
cscal(N, alpha.asFloat(), X, BlasBufferUtil.getBlasStride(X));
} | [
"@",
"Override",
"public",
"void",
"scal",
"(",
"long",
"N",
",",
"IComplexNumber",
"alpha",
",",
"IComplexNDArray",
"X",
")",
"{",
"if",
"(",
"X",
".",
"data",
"(",
")",
".",
"dataType",
"(",
")",
"==",
"DataBuffer",
".",
"Type",
".",
"DOUBLE",
")",... | computes a vector by a scalar product.
@param N
@param alpha
@param X | [
"computes",
"a",
"vector",
"by",
"a",
"scalar",
"product",
"."
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/BaseLevel1.java#L563-L570 | test | Scal using the complex number alpha and the data array X | Of course, here is the Java code you requested:
```java
@Override
public void scal(long N, IComplexNumber alpha, IComplexNDArray X) {
if (X.data().dataType() == DataBuffer.Type.DOUBLE)
zscal(N, alpha.asDouble(), X, BlasBufferUtil.getBlasStride(X));
else
cscal(N, alpha.asFloa... |
google/guice | core/src/com/google/inject/internal/Messages.java | Messages.convert | static Object convert(Object o) {
ElementSource source = null;
if (o instanceof ElementSource) {
source = (ElementSource) o;
o = source.getDeclaringSource();
}
return convert(o, source);
} | java | static Object convert(Object o) {
ElementSource source = null;
if (o instanceof ElementSource) {
source = (ElementSource) o;
o = source.getDeclaringSource();
}
return convert(o, source);
} | [
"static",
"Object",
"convert",
"(",
"Object",
"o",
")",
"{",
"ElementSource",
"source",
"=",
"null",
";",
"if",
"(",
"o",
"instanceof",
"ElementSource",
")",
"{",
"source",
"=",
"(",
"ElementSource",
")",
"o",
";",
"o",
"=",
"source",
".",
"getDeclaringS... | Formats an object in a user friendly way. | [
"Formats",
"an",
"object",
"in",
"a",
"user",
"friendly",
"way",
"."
] | a0552a16d813ead98fe73737fb001db336650251 | https://github.com/google/guice/blob/a0552a16d813ead98fe73737fb001db336650251/core/src/com/google/inject/internal/Messages.java#L155-L162 | test | Convert a CID object to a CID object. | Of course, here is the Java code you requested:
```java
static Object convert(Object o) {
ElementSource source = null;
if (o instanceof ElementSource) {
source = (ElementSource) o;
o = source.getDeclaringSource();
}
return convert(o, source);
}
```
Hope this helps! |
Unidata/thredds | opendap/src/main/java/opendap/dap/parsers/Dap2Lex.java | Dap2Lex.reset | public void reset(Dap2Parse state)
{
this.parsestate = state;
this.text = new TextStream();
yytext = new StringBuilder();
lval = null;
} | java | public void reset(Dap2Parse state)
{
this.parsestate = state;
this.text = new TextStream();
yytext = new StringBuilder();
lval = null;
} | [
"public",
"void",
"reset",
"(",
"Dap2Parse",
"state",
")",
"{",
"this",
".",
"parsestate",
"=",
"state",
";",
"this",
".",
"text",
"=",
"new",
"TextStream",
"(",
")",
";",
"yytext",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"lval",
"=",
"null",
";"... | /* Reset the lexer | [
"/",
"*",
"Reset",
"the",
"lexer"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/opendap/src/main/java/opendap/dap/parsers/Dap2Lex.java#L239-L245 | test | Resets the parse state. | Of course, here is the Java code you requested:
```java
public void reset(Dap2Parse state)
{
this.parsestate = state;
this.text = new TextStream();
yytext = new StringBuilder();
lval = null;
}
```
Hope this helps! |
blademainer/common_utils | common_code/src/main/java/com/xiongyingqi/utils/code/CodeCondition.java | CodeCondition.or | public CodeCondition or(CodeCondition anotherCodeCondition) {
if (anotherCodeCondition == null) {
System.out.println("CodeCondition为空!");
return this;
}
orCodeConditions = CollectionHelper.checkOrInitHashSet(orCodeConditions);
return this;
} | java | public CodeCondition or(CodeCondition anotherCodeCondition) {
if (anotherCodeCondition == null) {
System.out.println("CodeCondition为空!");
return this;
}
orCodeConditions = CollectionHelper.checkOrInitHashSet(orCodeConditions);
return this;
} | [
"public",
"CodeCondition",
"or",
"(",
"CodeCondition",
"anotherCodeCondition",
")",
"{",
"if",
"(",
"anotherCodeCondition",
"==",
"null",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"CodeCondition为空!\");",
"",
"",
"return",
"this",
";",
"}",
"orCode... | 条件或
@param anotherCodeCondition
@return | [
"条件或"
] | ef6baf0367c16de95a28caab67a7d5842a6d13db | https://github.com/blademainer/common_utils/blob/ef6baf0367c16de95a28caab67a7d5842a6d13db/common_code/src/main/java/com/xiongyingqi/utils/code/CodeCondition.java#L109-L116 | test | or code condition. | Of course, here is the Java code you requested:
```java
public CodeCondition or(CodeCondition anotherCodeCondition) {
if (anotherCodeCondition == null) {
System.out.println("CodeCondition为空!");
return this;
}
orCodeConditions = CollectionHelper.checkOrInitHashSet(orCodeC... |
Unidata/thredds | ui/src/main/java/ucar/nc2/ui/widget/TextHistoryPane.java | TextHistoryPane.appendLine | public void appendLine( String line) {
if (count >= nlines) {
try {
int remove = Math.max(removeIncr, count - nlines); // nlines may have changed
int offset = ta.getLineEndOffset( remove);
ta.replaceRange( "", 0, offset);
} catch (Exception e) {
log.error("Problem in Tex... | java | public void appendLine( String line) {
if (count >= nlines) {
try {
int remove = Math.max(removeIncr, count - nlines); // nlines may have changed
int offset = ta.getLineEndOffset( remove);
ta.replaceRange( "", 0, offset);
} catch (Exception e) {
log.error("Problem in Tex... | [
"public",
"void",
"appendLine",
"(",
"String",
"line",
")",
"{",
"if",
"(",
"count",
">=",
"nlines",
")",
"{",
"try",
"{",
"int",
"remove",
"=",
"Math",
".",
"max",
"(",
"removeIncr",
",",
"count",
"-",
"nlines",
")",
";",
"// nlines may have changed",
... | Append this line to the bottom of the JTextArea.
A newline is added and JTextArea is scrolled to bottom;
remove lines at top if needed.
@param line append this line. Ok to have multiple lines (ie embedded newlines)
but not too many. | [
"Append",
"this",
"line",
"to",
"the",
"bottom",
"of",
"the",
"JTextArea",
".",
"A",
"newline",
"is",
"added",
"and",
"JTextArea",
"is",
"scrolled",
"to",
"bottom",
";",
"remove",
"lines",
"at",
"top",
"if",
"needed",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/ui/src/main/java/ucar/nc2/ui/widget/TextHistoryPane.java#L87-L105 | test | Append a line to the text history pane. | Of course, here is the Java code you requested:
```java
public void appendLine( String line) {
if (count >= nlines) {
try {
int remove = Math.max(removeIncr, count - nlines); // nlines may have changed
int offset = ta.getLineEndOffset( remove);
ta.replaceRange( "", 0, offset);
... |
wro4j/wro4j | wro4j-core/src/main/java/ro/isdc/wro/model/factory/XmlModelFactory.java | XmlModelFactory.createResource | protected Resource createResource(final Element resourceElement) {
final String uri = resourceElement.getTextContent();
final String minimizeAsString = resourceElement.getAttribute(ATTR_MINIMIZE);
final boolean minimize = StringUtils.isEmpty(minimizeAsString) || Boolean.valueOf(minimizeAsString);
fi... | java | protected Resource createResource(final Element resourceElement) {
final String uri = resourceElement.getTextContent();
final String minimizeAsString = resourceElement.getAttribute(ATTR_MINIMIZE);
final boolean minimize = StringUtils.isEmpty(minimizeAsString) || Boolean.valueOf(minimizeAsString);
fi... | [
"protected",
"Resource",
"createResource",
"(",
"final",
"Element",
"resourceElement",
")",
"{",
"final",
"String",
"uri",
"=",
"resourceElement",
".",
"getTextContent",
"(",
")",
";",
"final",
"String",
"minimizeAsString",
"=",
"resourceElement",
".",
"getAttribute... | Creates a resource from a given resourceElement. The element is guaranteed to be of a simple non-recursive type
(i.e. css or js).
@param resourceElement
Resource element to parse. | [
"Creates",
"a",
"resource",
"from",
"a",
"given",
"resourceElement",
".",
"The",
"element",
"is",
"guaranteed",
"to",
"be",
"of",
"a",
"simple",
"non",
"-",
"recursive",
"type",
"(",
"i",
".",
"e",
".",
"css",
"or",
"js",
")",
"."
] | d2a3de71ab8bf0af7061fb6327501e08198338df | https://github.com/wro4j/wro4j/blob/d2a3de71ab8bf0af7061fb6327501e08198338df/wro4j-core/src/main/java/ro/isdc/wro/model/factory/XmlModelFactory.java#L394-L401 | test | Create a resource from a XML Element. | Of course, here is the Java code you requested:
```java
protected Resource createResource(final Element resourceElement) {
final String uri = resourceElement.getTextContent();
final String minimizeAsString = resourceElement.getAttribute(ATTR_MINIMIZE);
final boolean minimize = StringUtils.isEmpty(minimi... |
ieb/sparsemapcontent | core/src/main/java/org/sakaiproject/nakamura/api/lite/accesscontrol/AclModification.java | AclModification.removeAcl | public static void removeAcl(boolean grant, Permission permssion, String key,
List<AclModification> modifications) {
if (grant) {
key = AclModification.grantKey(key);
} else {
key = AclModification.denyKey(key);
}
modifications.add(new AclModification(... | java | public static void removeAcl(boolean grant, Permission permssion, String key,
List<AclModification> modifications) {
if (grant) {
key = AclModification.grantKey(key);
} else {
key = AclModification.denyKey(key);
}
modifications.add(new AclModification(... | [
"public",
"static",
"void",
"removeAcl",
"(",
"boolean",
"grant",
",",
"Permission",
"permssion",
",",
"String",
"key",
",",
"List",
"<",
"AclModification",
">",
"modifications",
")",
"{",
"if",
"(",
"grant",
")",
"{",
"key",
"=",
"AclModification",
".",
"... | TODO: Unit test | [
"TODO",
":",
"Unit",
"test"
] | 0570fdf868adbbf7734790cbc09fe66480e5f2dc | https://github.com/ieb/sparsemapcontent/blob/0570fdf868adbbf7734790cbc09fe66480e5f2dc/core/src/main/java/org/sakaiproject/nakamura/api/lite/accesscontrol/AclModification.java#L153-L162 | test | Remove an ACL. | Of course, here is the Java code you requested:
```java
public static void removeAcl(boolean grant, Permission permssion, String key,
List<AclModification> modifications) {
if (grant) {
key = AclModification.grantKey(key);
} else {
key = AclModification.denyKey(key);... |
GoogleCloudPlatform/cloud-sql-jdbc-socket-factory | core/src/main/java/com/google/cloud/sql/core/CoreSocketFactory.java | CoreSocketFactory.connect | public Socket connect(Properties props, String socketPathFormat) throws IOException {
// Gather parameters
final String csqlInstanceName = props.getProperty(CLOUD_SQL_INSTANCE_PROPERTY);
final List<String> ipTypes = listIpTypes(props.getProperty("ipTypes", DEFAULT_IP_TYPES));
final boolean forceUnixSock... | java | public Socket connect(Properties props, String socketPathFormat) throws IOException {
// Gather parameters
final String csqlInstanceName = props.getProperty(CLOUD_SQL_INSTANCE_PROPERTY);
final List<String> ipTypes = listIpTypes(props.getProperty("ipTypes", DEFAULT_IP_TYPES));
final boolean forceUnixSock... | [
"public",
"Socket",
"connect",
"(",
"Properties",
"props",
",",
"String",
"socketPathFormat",
")",
"throws",
"IOException",
"{",
"// Gather parameters",
"final",
"String",
"csqlInstanceName",
"=",
"props",
".",
"getProperty",
"(",
"CLOUD_SQL_INSTANCE_PROPERTY",
")",
"... | Creates a socket representing a connection to a Cloud SQL instance.
<p>Depending on the environment, it may return either a SSL Socket or a Unix Socket.
@param props Properties used to configure the connection.
@return the newly created Socket.
@throws IOException if error occurs during socket creation. | [
"Creates",
"a",
"socket",
"representing",
"a",
"connection",
"to",
"a",
"Cloud",
"SQL",
"instance",
"."
] | f108b0d5c7332a86075d32b8a648fb1b98288852 | https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/blob/f108b0d5c7332a86075d32b8a648fb1b98288852/core/src/main/java/com/google/cloud/sql/core/CoreSocketFactory.java#L175-L200 | test | Connect to the Cloud SQL instance using the specified properties. | Of course, here is the Java code you requested:
```java
public Socket connect(Properties props, String socketPathFormat) throws IOException {
// Gather parameters
final String csqlInstanceName = props.getProperty(CLOUD_SQL_INSTANCE_PROPERTY);
final List<String> ipTypes = listIpTypes(props.getProperty("ipTy... |
spring-projects/spring-security | config/src/main/java/org/springframework/security/config/annotation/web/configurers/RememberMeConfigurer.java | RememberMeConfigurer.createPersistentRememberMeServices | private AbstractRememberMeServices createPersistentRememberMeServices(H http,
String key) {
UserDetailsService userDetailsService = getUserDetailsService(http);
return new PersistentTokenBasedRememberMeServices(key, userDetailsService,
this.tokenRepository);
} | java | private AbstractRememberMeServices createPersistentRememberMeServices(H http,
String key) {
UserDetailsService userDetailsService = getUserDetailsService(http);
return new PersistentTokenBasedRememberMeServices(key, userDetailsService,
this.tokenRepository);
} | [
"private",
"AbstractRememberMeServices",
"createPersistentRememberMeServices",
"(",
"H",
"http",
",",
"String",
"key",
")",
"{",
"UserDetailsService",
"userDetailsService",
"=",
"getUserDetailsService",
"(",
"http",
")",
";",
"return",
"new",
"PersistentTokenBasedRememberMe... | Creates {@link PersistentTokenBasedRememberMeServices}
@param http the {@link HttpSecurity} to lookup shared objects
@param key the {@link #key(String)}
@return the {@link PersistentTokenBasedRememberMeServices} | [
"Creates",
"{",
"@link",
"PersistentTokenBasedRememberMeServices",
"}"
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/config/src/main/java/org/springframework/security/config/annotation/web/configurers/RememberMeConfigurer.java#L405-L410 | test | Create a PersistentTokenBasedRememberMeServices object. | Of course, here is the Java code you requested:
```java
private AbstractRememberMeServices createPersistentRememberMeServices(H http,
String key) {
UserDetailsService userDetailsService = getUserDetailsService(http);
return new PersistentTokenBasedRememberMeServices(key, userDetailsService,
this.tokenReposi... |
Unidata/thredds | legacy/src/main/java/thredds/catalog/InvCatalog.java | InvCatalog.resolveUri | public URI resolveUri(String uriString) throws URISyntaxException {
URI want = new URI(uriString);
if ((baseURI == null) || want.isAbsolute())
return want;
// gotta deal with file ourself
String scheme = baseURI.getScheme();
if ((scheme != null) && scheme.equals("file")) { // LOOK at ucar.nc... | java | public URI resolveUri(String uriString) throws URISyntaxException {
URI want = new URI(uriString);
if ((baseURI == null) || want.isAbsolute())
return want;
// gotta deal with file ourself
String scheme = baseURI.getScheme();
if ((scheme != null) && scheme.equals("file")) { // LOOK at ucar.nc... | [
"public",
"URI",
"resolveUri",
"(",
"String",
"uriString",
")",
"throws",
"URISyntaxException",
"{",
"URI",
"want",
"=",
"new",
"URI",
"(",
"uriString",
")",
";",
"if",
"(",
"(",
"baseURI",
"==",
"null",
")",
"||",
"want",
".",
"isAbsolute",
"(",
")",
... | Resolve reletive URIs, using the catalog's base URI. If the uriString is not reletive, then
no resolution is done. This also allows baseURI to be a file: scheme.
@param uriString any url, reletive or absolute
@return resolved url string, or null on error
@throws URISyntaxException if uriString violates RFC 2396
@see j... | [
"Resolve",
"reletive",
"URIs",
"using",
"the",
"catalog",
"s",
"base",
"URI",
".",
"If",
"the",
"uriString",
"is",
"not",
"reletive",
"then",
"no",
"resolution",
"is",
"done",
".",
"This",
"also",
"allows",
"baseURI",
"to",
"be",
"a",
"file",
":",
"schem... | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/legacy/src/main/java/thredds/catalog/InvCatalog.java#L160-L181 | test | This method is used to resolve a URI string. | Of course, here is the Java code you requested:
```java
public URI resolveUri(String uriString) throws URISyntaxException {
URI want = new URI(uriString);
if ((baseURI == null) || want.isAbsolute())
return want;
// gotta deal with file ourself
String scheme = baseURI.getScheme();
if ((schem... |
oblac/jodd | jodd-proxetta/src/main/java/jodd/asm7/SymbolTable.java | SymbolTable.copyBootstrapMethods | private void copyBootstrapMethods(final ClassReader classReader, final char[] charBuffer) {
// Find attributOffset of the 'bootstrap_methods' array.
byte[] inputBytes = classReader.b;
int currentAttributeOffset = classReader.getFirstAttributeOffset();
for (int i = classReader.readUnsignedShort(currentAt... | java | private void copyBootstrapMethods(final ClassReader classReader, final char[] charBuffer) {
// Find attributOffset of the 'bootstrap_methods' array.
byte[] inputBytes = classReader.b;
int currentAttributeOffset = classReader.getFirstAttributeOffset();
for (int i = classReader.readUnsignedShort(currentAt... | [
"private",
"void",
"copyBootstrapMethods",
"(",
"final",
"ClassReader",
"classReader",
",",
"final",
"char",
"[",
"]",
"charBuffer",
")",
"{",
"// Find attributOffset of the 'bootstrap_methods' array.",
"byte",
"[",
"]",
"inputBytes",
"=",
"classReader",
".",
"b",
";"... | Read the BootstrapMethods 'bootstrap_methods' array binary content and add them as entries of
the SymbolTable.
@param classReader the ClassReader whose bootstrap methods must be copied to initialize the
SymbolTable.
@param charBuffer a buffer used to read strings in the constant pool. | [
"Read",
"the",
"BootstrapMethods",
"bootstrap_methods",
"array",
"binary",
"content",
"and",
"add",
"them",
"as",
"entries",
"of",
"the",
"SymbolTable",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-proxetta/src/main/java/jodd/asm7/SymbolTable.java#L243-L279 | test | Copy bootstrap_methods. | Of course, here is the Java code you requested:
```java
private void copyBootstrapMethods(final ClassReader classReader, final char[] charBuffer) {
// Find attributOffset of the 'bootstrap_methods' array.
byte[] inputBytes = classReader.b;
int currentAttributeOffset = classReader.getFirstAttributeOffset();... |
playframework/playframework | core/play-guice/src/main/java/play/inject/guice/GuiceApplicationLoader.java | GuiceApplicationLoader.builder | public GuiceApplicationBuilder builder(ApplicationLoader.Context context) {
return initialBuilder
.in(context.environment())
.loadConfig(context.initialConfig())
.overrides(overrides(context));
} | java | public GuiceApplicationBuilder builder(ApplicationLoader.Context context) {
return initialBuilder
.in(context.environment())
.loadConfig(context.initialConfig())
.overrides(overrides(context));
} | [
"public",
"GuiceApplicationBuilder",
"builder",
"(",
"ApplicationLoader",
".",
"Context",
"context",
")",
"{",
"return",
"initialBuilder",
".",
"in",
"(",
"context",
".",
"environment",
"(",
")",
")",
".",
"loadConfig",
"(",
"context",
".",
"initialConfig",
"(",... | Construct a builder to use for loading the given context.
@param context the context the returned builder will load
@return the builder | [
"Construct",
"a",
"builder",
"to",
"use",
"for",
"loading",
"the",
"given",
"context",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/core/play-guice/src/main/java/play/inject/guice/GuiceApplicationLoader.java#L41-L46 | test | Creates a new GuiceApplicationBuilder with the specified context. | Of course, here is the Java code you requested:
```java
public GuiceApplicationBuilder builder(ApplicationLoader.Context context) {
return initialBuilder
.in(context.environment())
.loadConfig(context.initialConfig())
.overrides(overrides(context));
}
```
Hope this helps! |
sikuli/sikuli-slides | src/main/java/org/sikuli/slides/api/sikuli/CrossSearchStrategy.java | CrossSearchStrategy.sortBySize | static public List<Rectangle> sortBySize(List<Rectangle> list){
List<Rectangle> result = Lists.newArrayList();
Collections.sort(list, new Comparator<Rectangle>(){
@Override
public int compare(Rectangle r1, Rectangle r2) {
return (r1.height * r1.width) - (r2.height * r2.width);
}
});
return resul... | java | static public List<Rectangle> sortBySize(List<Rectangle> list){
List<Rectangle> result = Lists.newArrayList();
Collections.sort(list, new Comparator<Rectangle>(){
@Override
public int compare(Rectangle r1, Rectangle r2) {
return (r1.height * r1.width) - (r2.height * r2.width);
}
});
return resul... | [
"static",
"public",
"List",
"<",
"Rectangle",
">",
"sortBySize",
"(",
"List",
"<",
"Rectangle",
">",
"list",
")",
"{",
"List",
"<",
"Rectangle",
">",
"result",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"Collections",
".",
"sort",
"(",
"list",
"... | sort a list of rectangles by their sizes in ascending order | [
"sort",
"a",
"list",
"of",
"rectangles",
"by",
"their",
"sizes",
"in",
"ascending",
"order"
] | 1a4a82cd97f577e0d7abe4218bf702e053acf003 | https://github.com/sikuli/sikuli-slides/blob/1a4a82cd97f577e0d7abe4218bf702e053acf003/src/main/java/org/sikuli/slides/api/sikuli/CrossSearchStrategy.java#L68-L77 | test | Sort the list by size. | Of course, here is the Java code you requested:
```java
static public List<Rectangle> sortBySize(List<Rectangle> list){
List<Rectangle> result = Lists.newArrayList();
Collections.sort(list, new Comparator<Rectangle>(){
@Override
public int compare(Rectangle r1, Rectangle r2) {
return (r1.height * r1.widt... |
Unidata/thredds | dap4/d4core/src/main/java/dap4/core/data/DSPRegistry.java | DSPRegistry.register | synchronized public void
register(Class<? extends DSP> klass, boolean last)
{
// is this already defined?
if(registered(klass)) return;
if(last)
registry.add(new Registration(klass));
else
registry.add(0, new Registration(klass));
} | java | synchronized public void
register(Class<? extends DSP> klass, boolean last)
{
// is this already defined?
if(registered(klass)) return;
if(last)
registry.add(new Registration(klass));
else
registry.add(0, new Registration(klass));
} | [
"synchronized",
"public",
"void",
"register",
"(",
"Class",
"<",
"?",
"extends",
"DSP",
">",
"klass",
",",
"boolean",
"last",
")",
"{",
"// is this already defined?",
"if",
"(",
"registered",
"(",
"klass",
")",
")",
"return",
";",
"if",
"(",
"last",
")",
... | Register a DSP class.
@param klass Class that implements DSP.
@param last true=>insert at the end of the list; otherwise front
@throws IllegalAccessException if class is not accessible.
@throws InstantiationException if class doesnt have a no-arg constructor.
@throws ClassCastException if class doesnt implement D... | [
"Register",
"a",
"DSP",
"class",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/dap4/d4core/src/main/java/dap4/core/data/DSPRegistry.java#L109-L118 | test | Register a single DSP class. | Of course, here is the Java code you requested:
```java
synchronized public void
register(Class<? extends DSP> klass, boolean last)
{
// is this already defined?
if(registered(klass)) return;
if(last)
registry.add(new Registration(klass));
else
registry.a... |
rupertlssmith/lojix | base/common/src/main/com/thesett/common/throttle/BatchedThrottle.java | BatchedThrottle.setRate | public void setRate(float hertz)
{
// Pass the rate unaltered down to the base implementation, for the check method.
super.setRate(hertz);
// Log base 10 over 2 is used here to get a feel for what power of 100 the total rate is.
// As the total rate goes up the powers of 100 the bat... | java | public void setRate(float hertz)
{
// Pass the rate unaltered down to the base implementation, for the check method.
super.setRate(hertz);
// Log base 10 over 2 is used here to get a feel for what power of 100 the total rate is.
// As the total rate goes up the powers of 100 the bat... | [
"public",
"void",
"setRate",
"(",
"float",
"hertz",
")",
"{",
"// Pass the rate unaltered down to the base implementation, for the check method.",
"super",
".",
"setRate",
"(",
"hertz",
")",
";",
"// Log base 10 over 2 is used here to get a feel for what power of 100 the total rate i... | Specifies the throttling rate in operations per second.
@param hertz The throttling rate in cycles per second. | [
"Specifies",
"the",
"throttling",
"rate",
"in",
"operations",
"per",
"second",
"."
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/base/common/src/main/com/thesett/common/throttle/BatchedThrottle.java#L59-L77 | test | Sets the rate of the check method. | Of course, here is the Java code you requested:
```java
public void setRate(float hertz)
{
// Pass the rate unaltered down to the base implementation, for the check method.
super.setRate(hertz);
// Log base 10 over 2 is used here to get a feel for what power of 100 the total rate is.
... |
oblac/jodd | jodd-proxetta/src/main/java/jodd/proxetta/asm/ProxettaAsmUtil.java | ProxettaAsmUtil.checkArgumentIndex | public static void checkArgumentIndex(final MethodInfo methodInfo, final int argIndex) {
if ((argIndex < 1) || (argIndex > methodInfo.getArgumentsCount())) {
throw new ProxettaException("Invalid argument index: " + argIndex);
}
} | java | public static void checkArgumentIndex(final MethodInfo methodInfo, final int argIndex) {
if ((argIndex < 1) || (argIndex > methodInfo.getArgumentsCount())) {
throw new ProxettaException("Invalid argument index: " + argIndex);
}
} | [
"public",
"static",
"void",
"checkArgumentIndex",
"(",
"final",
"MethodInfo",
"methodInfo",
",",
"final",
"int",
"argIndex",
")",
"{",
"if",
"(",
"(",
"argIndex",
"<",
"1",
")",
"||",
"(",
"argIndex",
">",
"methodInfo",
".",
"getArgumentsCount",
"(",
")",
... | Validates argument index. | [
"Validates",
"argument",
"index",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-proxetta/src/main/java/jodd/proxetta/asm/ProxettaAsmUtil.java#L138-L142 | test | Check that the given argument index is valid. | Of course, here is the Java code you requested:
```java
public static void checkArgumentIndex(final MethodInfo methodInfo, final int argIndex) {
if ((argIndex < 1) || (argIndex > methodInfo.getArgumentsCount())) {
throw new ProxettaException("Invalid argument index: " + argIndex);
}
}
```
Hope this helps! |
algolia/algoliasearch-client-android | algoliasearch/src/main/java/com/algolia/search/saas/Query.java | Query.getNumericFilters | public @Nullable
JSONArray getNumericFilters() {
try {
String value = get(KEY_NUMERIC_FILTERS);
if (value != null) {
return new JSONArray(value);
}
} catch (JSONException e) {
// Will return null
}
return null;
} | java | public @Nullable
JSONArray getNumericFilters() {
try {
String value = get(KEY_NUMERIC_FILTERS);
if (value != null) {
return new JSONArray(value);
}
} catch (JSONException e) {
// Will return null
}
return null;
} | [
"public",
"@",
"Nullable",
"JSONArray",
"getNumericFilters",
"(",
")",
"{",
"try",
"{",
"String",
"value",
"=",
"get",
"(",
"KEY_NUMERIC_FILTERS",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"new",
"JSONArray",
"(",
"value",
")",
";",... | Get the value of <b>deprecated</b> {@code facetFilters} parameter.
@deprecated Use {@link Query#getFilters()} instead. | [
"Get",
"the",
"value",
"of",
"<b",
">",
"deprecated<",
"/",
"b",
">",
"{",
"@code",
"facetFilters",
"}",
"parameter",
"."
] | 3293ba6e6116a4f6c1face2cc606bc047d6d4a3c | https://github.com/algolia/algoliasearch-client-android/blob/3293ba6e6116a4f6c1face2cc606bc047d6d4a3c/algoliasearch/src/main/java/com/algolia/search/saas/Query.java#L1202-L1213 | test | Gets the numeric filters. | Of course, here is the Java code you requested:
```java
public @Nullable
JSONArray getNumericFilters() {
try {
String value = get(KEY_NUMERIC_FILTERS);
if (value != null) {
return new JSONArray(value);
}
} catch (JSONException e) {
// ... |
OpenEstate/OpenEstate-IO | Examples/src/main/java/org/openestate/io/examples/CasaItWritingExample.java | CasaItWritingExample.createRealestate | protected static Realestate createRealestate() {
// create an example real estate
Realestate obj = FACTORY.createContainerRealestateitemsRealestate();
obj.setAction(BigInteger.ONE);
obj.setAgencycode(0);
obj.setBathrooms(BigInteger.valueOf(RandomUtils.nextLong(1, 5)));
ob... | java | protected static Realestate createRealestate() {
// create an example real estate
Realestate obj = FACTORY.createContainerRealestateitemsRealestate();
obj.setAction(BigInteger.ONE);
obj.setAgencycode(0);
obj.setBathrooms(BigInteger.valueOf(RandomUtils.nextLong(1, 5)));
ob... | [
"protected",
"static",
"Realestate",
"createRealestate",
"(",
")",
"{",
"// create an example real estate",
"Realestate",
"obj",
"=",
"FACTORY",
".",
"createContainerRealestateitemsRealestate",
"(",
")",
";",
"obj",
".",
"setAction",
"(",
"BigInteger",
".",
"ONE",
")"... | Create a {@link Realestate} with some example data.
@return created example object | [
"Create",
"a",
"{",
"@link",
"Realestate",
"}",
"with",
"some",
"example",
"data",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/Examples/src/main/java/org/openestate/io/examples/CasaItWritingExample.java#L111-L179 | test | Creates a realestate object. | Of course, here is the Java code you requested:
```java
protected static Realestate createRealestate() {
// create an example real estate
Realestate obj = FACTORY.createContainerRealestateitemsRealestate();
obj.setAction(BigInteger.ONE);
obj.setAgencycode(0);
obj.setBathrooms(Bi... |
kiegroup/droolsjbpm-tools | drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/GuvnorMetadataUtils.java | GuvnorMetadataUtils.findGuvnorMetadata | public static IFile findGuvnorMetadata(IResource resource) {
IFile res = null;
IPath dir = resource.getFullPath().removeLastSegments(1);
IPath mdpath = dir.append(".guvnorinfo").append("." + resource.getName()); //$NON-NLS-1$ //$NON-NLS-2$
IResource mdResource = resource.getWorkspace().g... | java | public static IFile findGuvnorMetadata(IResource resource) {
IFile res = null;
IPath dir = resource.getFullPath().removeLastSegments(1);
IPath mdpath = dir.append(".guvnorinfo").append("." + resource.getName()); //$NON-NLS-1$ //$NON-NLS-2$
IResource mdResource = resource.getWorkspace().g... | [
"public",
"static",
"IFile",
"findGuvnorMetadata",
"(",
"IResource",
"resource",
")",
"{",
"IFile",
"res",
"=",
"null",
";",
"IPath",
"dir",
"=",
"resource",
".",
"getFullPath",
"(",
")",
".",
"removeLastSegments",
"(",
"1",
")",
";",
"IPath",
"mdpath",
"=... | Finds the local Guvnor metadata file associated with a given resource.
@param resource The resource to locate metadata for.
@return The metadata file for the given resource, null if metadata is not found. | [
"Finds",
"the",
"local",
"Guvnor",
"metadata",
"file",
"associated",
"with",
"a",
"given",
"resource",
"."
] | 05e1f73c591178360a198dca29f99d73918991db | https://github.com/kiegroup/droolsjbpm-tools/blob/05e1f73c591178360a198dca29f99d73918991db/drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/GuvnorMetadataUtils.java#L65-L76 | test | Find the Guvnor metadata for the given resource. | Of course, here is the Java code you requested:
```java
public static IFile findGuvnorMetadata(IResource resource) {
IFile res = null;
IPath dir = resource.getFullPath().removeLastSegments(1);
IPath mdpath = dir.append(".guvnorinfo").append("." + resource.getName()); //$NON-NLS-1$ //$NON-NLS-2$... |
jkuhnert/ognl | src/main/java/ognl/OgnlContext.java | OgnlContext.getPreviousType | public Class getPreviousType()
{
if (_typeStack.isEmpty())
return null;
if (_typeStack.size() > 1)
return _typeStack.get(_typeStack.size() - 2);
else
return null;
} | java | public Class getPreviousType()
{
if (_typeStack.isEmpty())
return null;
if (_typeStack.size() > 1)
return _typeStack.get(_typeStack.size() - 2);
else
return null;
} | [
"public",
"Class",
"getPreviousType",
"(",
")",
"{",
"if",
"(",
"_typeStack",
".",
"isEmpty",
"(",
")",
")",
"return",
"null",
";",
"if",
"(",
"_typeStack",
".",
"size",
"(",
")",
">",
"1",
")",
"return",
"_typeStack",
".",
"get",
"(",
"_typeStack",
... | Represents the last known object type on the evaluation stack, will be the value of
the last known {@link #getCurrentType()}.
@return The previous type of object on the stack, may be null. | [
"Represents",
"the",
"last",
"known",
"object",
"type",
"on",
"the",
"evaluation",
"stack",
"will",
"be",
"the",
"value",
"of",
"the",
"last",
"known",
"{",
"@link",
"#getCurrentType",
"()",
"}",
"."
] | 53d51a30c8c299b750dede779d05cb84beee73c3 | https://github.com/jkuhnert/ognl/blob/53d51a30c8c299b750dede779d05cb84beee73c3/src/main/java/ognl/OgnlContext.java#L325-L334 | test | Get the previous type of the class. | Of course, here is the Java code you requested:
```java
public Class getPreviousType()
{
if (_typeStack.isEmpty())
return null;
if (_typeStack.size() > 1)
return _typeStack.get(_typeStack.size() - 2);
else
return null;
}
```
Hope this helps! |
amedia/meteo | meteo-jaxb/src/main/java/no/api/meteo/jaxb/locationforecast/v1_9/ObjectFactory.java | ObjectFactory.createLocationTypeNumberofobservations | @XmlElementDecl(namespace = "", name = "numberofobservations", scope = LocationType.class)
public JAXBElement<UnitValue> createLocationTypeNumberofobservations(UnitValue value) {
return new JAXBElement<UnitValue>(_LocationTypeNumberofobservations_QNAME, UnitValue.class, LocationType.class, value);
} | java | @XmlElementDecl(namespace = "", name = "numberofobservations", scope = LocationType.class)
public JAXBElement<UnitValue> createLocationTypeNumberofobservations(UnitValue value) {
return new JAXBElement<UnitValue>(_LocationTypeNumberofobservations_QNAME, UnitValue.class, LocationType.class, value);
} | [
"@",
"XmlElementDecl",
"(",
"namespace",
"=",
"\"\"",
",",
"name",
"=",
"\"numberofobservations\"",
",",
"scope",
"=",
"LocationType",
".",
"class",
")",
"public",
"JAXBElement",
"<",
"UnitValue",
">",
"createLocationTypeNumberofobservations",
"(",
"UnitValue",
"val... | Create an instance of {@link JAXBElement }{@code <}{@link UnitValue }{@code >}} | [
"Create",
"an",
"instance",
"of",
"{",
"@link",
"JAXBElement",
"}",
"{",
"@code",
"<",
"}",
"{",
"@link",
"UnitValue",
"}",
"{",
"@code",
">",
"}}"
] | cbb59e1c2f889d15c24f3625d1769b543d4af595 | https://github.com/amedia/meteo/blob/cbb59e1c2f889d15c24f3625d1769b543d4af595/meteo-jaxb/src/main/java/no/api/meteo/jaxb/locationforecast/v1_9/ObjectFactory.java#L447-L450 | test | Create an instance of the JAXBElement required to represent a number of units of the LocationType. | Of course, here is the Java code you requested:
```java
@XmlElementDecl(namespace = "", name = "numberofobservations", scope = LocationType.class)
public JAXBElement<UnitValue> createLocationTypeNumberofobservations(UnitValue value) {
return new JAXBElement<UnitValue>(_LocationTypeNumberofobservations_QNAM... |
kocakosm/pitaya | src/org/kocakosm/pitaya/time/Dates.java | Dates.isSameMonth | public static boolean isSameMonth(Date date1, Date date2)
{
return isSameMonth(toCalendar(date1), toCalendar(date2));
} | java | public static boolean isSameMonth(Date date1, Date date2)
{
return isSameMonth(toCalendar(date1), toCalendar(date2));
} | [
"public",
"static",
"boolean",
"isSameMonth",
"(",
"Date",
"date1",
",",
"Date",
"date2",
")",
"{",
"return",
"isSameMonth",
"(",
"toCalendar",
"(",
"date1",
")",
",",
"toCalendar",
"(",
"date2",
")",
")",
";",
"}"
] | Returns whether the given {@code Date}s represent the same month.
@param date1 the first {@code Date}.
@param date2 the second {@code Date}.
@return whether the given {@code Date}s represent the same month.
@throws NullPointerException if one of the arguments is {@code null}. | [
"Returns",
"whether",
"the",
"given",
"{",
"@code",
"Date",
"}",
"s",
"represent",
"the",
"same",
"month",
"."
] | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/time/Dates.java#L200-L203 | test | Checks if two dates are in the same month. | Of course, here is the Java code you requested:
```java
public static boolean isSameMonth(Date date1, Date date2)
{
return isSameMonth(toCalendar(date1), toCalendar(date2));
}
```
Hope this helps! |
Unidata/thredds | tds/src/main/java/thredds/featurecollection/InvDatasetFeatureCollection.java | InvDatasetFeatureCollection.checkState | protected State checkState() throws IOException {
State localState;
synchronized (lock) {
if (first) {
firstInit();
updateCollection(state, config.updateConfig.updateType);
// makeDatasetTop(state);
first = false;
}
localState = state.copy();
}
return ... | java | protected State checkState() throws IOException {
State localState;
synchronized (lock) {
if (first) {
firstInit();
updateCollection(state, config.updateConfig.updateType);
// makeDatasetTop(state);
first = false;
}
localState = state.copy();
}
return ... | [
"protected",
"State",
"checkState",
"(",
")",
"throws",
"IOException",
"{",
"State",
"localState",
";",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"first",
")",
"{",
"firstInit",
"(",
")",
";",
"updateCollection",
"(",
"state",
",",
"config",
".",
... | A request has come in, check that the state has been initialized.
this is called from the request thread.
@return a copy of the State | [
"A",
"request",
"has",
"come",
"in",
"check",
"that",
"the",
"state",
"has",
"been",
"initialized",
".",
"this",
"is",
"called",
"from",
"the",
"request",
"thread",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/tds/src/main/java/thredds/featurecollection/InvDatasetFeatureCollection.java#L268-L282 | test | Check the state of the CRA file. | Of course, here is the Java code you requested:
```java
protected State checkState() throws IOException {
State localState;
synchronized (lock) {
if (first) {
firstInit();
updateCollection(state, config.updateConfig.updateType);
// makeDatasetTop(state);
first = false;
... |
js-lib-com/tiny-container | src/main/java/js/net/EventStream.java | EventStream.sendEvent | protected void sendEvent(Event event) {
write("data:");
if (secretKey == null) {
json.serialize(writer, event);
} else {
try {
Cipher cipher = Cipher.getInstance(secretKey.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
// this overload of doFinal from Cipher class is a... | java | protected void sendEvent(Event event) {
write("data:");
if (secretKey == null) {
json.serialize(writer, event);
} else {
try {
Cipher cipher = Cipher.getInstance(secretKey.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
// this overload of doFinal from Cipher class is a... | [
"protected",
"void",
"sendEvent",
"(",
"Event",
"event",
")",
"{",
"write",
"(",
"\"data:\"",
")",
";",
"if",
"(",
"secretKey",
"==",
"null",
")",
"{",
"json",
".",
"serialize",
"(",
"writer",
",",
"event",
")",
";",
"}",
"else",
"{",
"try",
"{",
"... | Send event instance to this event stream consumer. Compile a W3C Server-Sent event from <code>event</code> instance
argument and write it to this {@link #writer}. This event stream implementation does not use all W3C server-sent event
fields: only <code>event</code> and <code>data</code>, as folows:
<ul>
<li>event fiel... | [
"Send",
"event",
"instance",
"to",
"this",
"event",
"stream",
"consumer",
".",
"Compile",
"a",
"W3C",
"Server",
"-",
"Sent",
"event",
"from",
"<code",
">",
"event<",
"/",
"code",
">",
"instance",
"argument",
"and",
"write",
"it",
"to",
"this",
"{",
"@lin... | ef68deb9ec40b217b4cd2df56d9c5a213dd6b89e | https://github.com/js-lib-com/tiny-container/blob/ef68deb9ec40b217b4cd2df56d9c5a213dd6b89e/src/main/java/js/net/EventStream.java#L386-L421 | test | Sends an event to the client. | Of course, here is the Java code you requested:
```java
protected void sendEvent(Event event) {
write("data:");
if (secretKey == null) {
json.serialize(writer, event);
} else {
try {
Cipher cipher = Cipher.getInstance(secretKey.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
... |
liveontologies/elk-reasoner | elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/conclusions/classes/ClassConclusionTimer.java | ClassConclusionTimer.add | public synchronized void add(ClassConclusionTimer timer) {
this.timeComposedSubsumers += timer.timeComposedSubsumers;
this.timeDecomposedSubsumers += timer.timeDecomposedSubsumers;
this.timeBackwardLinks += timer.timeBackwardLinks;
this.timeForwardLinks += timer.timeForwardLinks;
this.timeContradictions += ti... | java | public synchronized void add(ClassConclusionTimer timer) {
this.timeComposedSubsumers += timer.timeComposedSubsumers;
this.timeDecomposedSubsumers += timer.timeDecomposedSubsumers;
this.timeBackwardLinks += timer.timeBackwardLinks;
this.timeForwardLinks += timer.timeForwardLinks;
this.timeContradictions += ti... | [
"public",
"synchronized",
"void",
"add",
"(",
"ClassConclusionTimer",
"timer",
")",
"{",
"this",
".",
"timeComposedSubsumers",
"+=",
"timer",
".",
"timeComposedSubsumers",
";",
"this",
".",
"timeDecomposedSubsumers",
"+=",
"timer",
".",
"timeDecomposedSubsumers",
";",... | Adds all timers of the argument to the corresponding counters of this
object. The timers should not be directly modified other than using this
method during this operation. The timers in the argument will be reseted
after this operation.
@param timer
the object which counters should be added | [
"Adds",
"all",
"timers",
"of",
"the",
"argument",
"to",
"the",
"corresponding",
"counters",
"of",
"this",
"object",
".",
"The",
"timers",
"should",
"not",
"be",
"directly",
"modified",
"other",
"than",
"using",
"this",
"method",
"during",
"this",
"operation",
... | cfbe5279a57e0433d45c1676c7658ddb6e29b9eb | https://github.com/liveontologies/elk-reasoner/blob/cfbe5279a57e0433d45c1676c7658ddb6e29b9eb/elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/conclusions/classes/ClassConclusionTimer.java#L142-L152 | test | Adds the given timer to the list of classes. | Of course, here is the Java code you requested:
```java
public synchronized void add(ClassConclusionTimer timer) {
this.timeComposedSubsumers += timer.timeComposedSubsumers;
this.timeDecomposedSubsumers += timer.timeDecomposedSubsumers;
this.timeBackwardLinks += timer.timeBackwardLinks;
this.timeForwardLinks +... |
Unidata/thredds | waterml/src/main/java/ucar/nc2/ogc/erddap/util/ErddapString2.java | ErddapString2.toRational | public static int[] toRational(double d) {
if (d == 0)
return new int[]{0, 0};
if (!ErddapMath2.isFinite(d))
return new int[]{1, Integer.MAX_VALUE};
String s = "" + d; //-12.0 or 6.6260755E-24
//String2.log("\nd=" + d + "\ns=" + s);
int ten = 0;
... | java | public static int[] toRational(double d) {
if (d == 0)
return new int[]{0, 0};
if (!ErddapMath2.isFinite(d))
return new int[]{1, Integer.MAX_VALUE};
String s = "" + d; //-12.0 or 6.6260755E-24
//String2.log("\nd=" + d + "\ns=" + s);
int ten = 0;
... | [
"public",
"static",
"int",
"[",
"]",
"toRational",
"(",
"double",
"d",
")",
"{",
"if",
"(",
"d",
"==",
"0",
")",
"return",
"new",
"int",
"[",
"]",
"{",
"0",
",",
"0",
"}",
";",
"if",
"(",
"!",
"ErddapMath2",
".",
"isFinite",
"(",
"d",
")",
")... | This converts a double to a rational number (m * 10^t).
This is similar to Math2.mantissa and Math2.intExponent, but works via string manipulation
to avoid roundoff problems (e.g., with 6.6260755e-24).
@param d
@return int[2]: [0]=m, [1]=t.
(or {0, 0} if d=0, or {1, Integer.MAX_VALUE} if !finite(d)) | [
"This",
"converts",
"a",
"double",
"to",
"a",
"rational",
"number",
"(",
"m",
"*",
"10^t",
")",
".",
"This",
"is",
"similar",
"to",
"Math2",
".",
"mantissa",
"and",
"Math2",
".",
"intExponent",
"but",
"works",
"via",
"string",
"manipulation",
"to",
"avoi... | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/waterml/src/main/java/ucar/nc2/ogc/erddap/util/ErddapString2.java#L216-L269 | test | To rational. | Of course, here is the Java code you requested:
```java
public static int[] toRational(double d) {
if (d == 0)
return new int[]{0, 0};
if (!ErddapMath2.isFinite(d))
return new int[]{1, Integer.MAX_VALUE};
String s = "" + d; //-12.0 or 6.6260755E-24
//St... |
spring-projects/spring-security | web/src/main/java/org/springframework/security/web/util/UrlUtils.java | UrlUtils.buildRequestUrl | public static String buildRequestUrl(HttpServletRequest r) {
return buildRequestUrl(r.getServletPath(), r.getRequestURI(), r.getContextPath(),
r.getPathInfo(), r.getQueryString());
} | java | public static String buildRequestUrl(HttpServletRequest r) {
return buildRequestUrl(r.getServletPath(), r.getRequestURI(), r.getContextPath(),
r.getPathInfo(), r.getQueryString());
} | [
"public",
"static",
"String",
"buildRequestUrl",
"(",
"HttpServletRequest",
"r",
")",
"{",
"return",
"buildRequestUrl",
"(",
"r",
".",
"getServletPath",
"(",
")",
",",
"r",
".",
"getRequestURI",
"(",
")",
",",
"r",
".",
"getContextPath",
"(",
")",
",",
"r"... | Obtains the web application-specific fragment of the request URL.
<p>
Under normal spec conditions,
<pre>
requestURI = contextPath + servletPath + pathInfo
</pre>
But the requestURI is not decoded, whereas the servletPath and pathInfo are
(SEC-1255). This method is typically used to return a URL for matching against
... | [
"Obtains",
"the",
"web",
"application",
"-",
"specific",
"fragment",
"of",
"the",
"request",
"URL",
".",
"<p",
">",
"Under",
"normal",
"spec",
"conditions"
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/web/src/main/java/org/springframework/security/web/util/UrlUtils.java#L98-L101 | test | Build request url from servlet request. | Of course, here is the Java code you requested:
```java
public static String buildRequestUrl(HttpServletRequest r) {
return buildRequestUrl(r.getServletPath(), r.getRequestURI(), r.getContextPath(),
r.getPathInfo(), r.getQueryString());
}
```
Hope this helps! |
kocakosm/pitaya | src/org/kocakosm/pitaya/util/Splitter.java | Splitter.on | public static Splitter on(String separator)
{
return on(Pattern.compile(Pattern.quote(separator)));
} | java | public static Splitter on(String separator)
{
return on(Pattern.compile(Pattern.quote(separator)));
} | [
"public",
"static",
"Splitter",
"on",
"(",
"String",
"separator",
")",
"{",
"return",
"on",
"(",
"Pattern",
".",
"compile",
"(",
"Pattern",
".",
"quote",
"(",
"separator",
")",
")",
")",
";",
"}"
] | Returns a new {@code Splitter} that will use the specified separator
to split {@code String}s.
@param separator the separator.
@return the created {@code Splitter}.
@throws NullPointerException if {@code separator} is {@code null}. | [
"Returns",
"a",
"new",
"{",
"@code",
"Splitter",
"}",
"that",
"will",
"use",
"the",
"specified",
"separator",
"to",
"split",
"{",
"@code",
"String",
"}",
"s",
"."
] | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/util/Splitter.java#L44-L47 | test | Creates a splitter that splits a string on the specified separator. | Of course, here is the Java code you requested:
```java
public static Splitter on(String separator)
{
return on(Pattern.compile(Pattern.quote(separator)));
}
```
Hope this helps! |
google/guice | extensions/grapher/src/com/google/inject/grapher/ShortNameFactory.java | ShortNameFactory.getSourceName | @Override
public String getSourceName(Object source) {
if (source instanceof ElementSource) {
source = ((ElementSource) source).getDeclaringSource();
}
if (source instanceof Method) {
source = StackTraceElements.forMember((Method) source);
}
if (source instanceof StackTraceElement) {
... | java | @Override
public String getSourceName(Object source) {
if (source instanceof ElementSource) {
source = ((ElementSource) source).getDeclaringSource();
}
if (source instanceof Method) {
source = StackTraceElements.forMember((Method) source);
}
if (source instanceof StackTraceElement) {
... | [
"@",
"Override",
"public",
"String",
"getSourceName",
"(",
"Object",
"source",
")",
"{",
"if",
"(",
"source",
"instanceof",
"ElementSource",
")",
"{",
"source",
"=",
"(",
"(",
"ElementSource",
")",
"source",
")",
".",
"getDeclaringSource",
"(",
")",
";",
"... | Returns a name for a Guice "source" object. This will typically be either a {@link
StackTraceElement} for when the binding is made to the instance, or a {@link Method} when a
provider method is used. | [
"Returns",
"a",
"name",
"for",
"a",
"Guice",
"source",
"object",
".",
"This",
"will",
"typically",
"be",
"either",
"a",
"{"
] | a0552a16d813ead98fe73737fb001db336650251 | https://github.com/google/guice/blob/a0552a16d813ead98fe73737fb001db336650251/extensions/grapher/src/com/google/inject/grapher/ShortNameFactory.java#L103-L117 | test | Get the source name from the given object. | Of course, here is the Java code you requested:
```java
@Override
public String getSourceName(Object source) {
if (source instanceof ElementSource) {
source = ((ElementSource) source).getDeclaringSource();
}
if (source instanceof Method) {
source = StackTraceElements.forMember((Method) source... |
CloudI/cloudi_api_java | src/main/java/org/cloudi/API.java | API.send_async | public TransId send_async(final String name,
final byte[] request)
throws InvalidInputException,
MessageDecodingException,
TerminateException
{
return send_async(name, ("").getBytes(), request,
this.timeout_async, ... | java | public TransId send_async(final String name,
final byte[] request)
throws InvalidInputException,
MessageDecodingException,
TerminateException
{
return send_async(name, ("").getBytes(), request,
this.timeout_async, ... | [
"public",
"TransId",
"send_async",
"(",
"final",
"String",
"name",
",",
"final",
"byte",
"[",
"]",
"request",
")",
"throws",
"InvalidInputException",
",",
"MessageDecodingException",
",",
"TerminateException",
"{",
"return",
"send_async",
"(",
"name",
",",
"(",
... | Asynchronous point-to-point communication to a service
subscribed that matches the destination service <code>name</code>.
@param name the destination service name
@param request the request data
@return a transaction ID
@throws InvalidInputException invalid input to internal function call
@throws Message... | [
"Asynchronous",
"point",
"-",
"to",
"-",
"point",
"communication",
"to",
"a",
"service",
"subscribed",
"that",
"matches",
"the",
"destination",
"service",
"<code",
">",
"name<",
"/",
"code",
">",
"."
] | e8ccaeb9ad562c82d742dc31a5f06bcb1b637446 | https://github.com/CloudI/cloudi_api_java/blob/e8ccaeb9ad562c82d742dc31a5f06bcb1b637446/src/main/java/org/cloudi/API.java#L356-L364 | test | Send an async message to a single target server. | Of course, here is the Java code you requested:
```java
public TransId send_async(final String name,
final byte[] request)
throws InvalidInputException,
MessageDecodingException,
TerminateException
{
return send_async(name, ("").getBytes()... |
fabric8io/fabric8-maven-plugin | core/src/main/java/io/fabric8/maven/core/util/kubernetes/KubernetesHelper.java | KubernetesHelper.createIntOrString | public static IntOrString createIntOrString(String nameOrNumber) {
if (StringUtils.isBlank(nameOrNumber)) {
return null;
} else {
IntOrString answer = new IntOrString();
Integer intVal = null;
try {
intVal = Integer.parseInt(nameOrNumber);
... | java | public static IntOrString createIntOrString(String nameOrNumber) {
if (StringUtils.isBlank(nameOrNumber)) {
return null;
} else {
IntOrString answer = new IntOrString();
Integer intVal = null;
try {
intVal = Integer.parseInt(nameOrNumber);
... | [
"public",
"static",
"IntOrString",
"createIntOrString",
"(",
"String",
"nameOrNumber",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"nameOrNumber",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"IntOrString",
"answer",
"=",
"new",
"IntO... | Creates an IntOrString from the given string which could be a number or a name | [
"Creates",
"an",
"IntOrString",
"from",
"the",
"given",
"string",
"which",
"could",
"be",
"a",
"number",
"or",
"a",
"name"
] | b0e7ad860a5bbe4ab71be3d0613862a1f14a8be3 | https://github.com/fabric8io/fabric8-maven-plugin/blob/b0e7ad860a5bbe4ab71be3d0613862a1f14a8be3/core/src/main/java/io/fabric8/maven/core/util/kubernetes/KubernetesHelper.java#L233-L253 | test | Create IntOrString from String or Integer | Of course, here is the Java code you requested:
```java
public static IntOrString createIntOrString(String nameOrNumber) {
if (StringUtils.isBlank(nameOrNumber)) {
return null;
} else {
IntOrString answer = new IntOrString();
Integer intVal = null;
try {
... |
playframework/playframework | persistence/play-java-jdbc/src/main/java/play/db/Databases.java | Databases.createFrom | public static Database createFrom(String name, String driver, String url) {
return createFrom(name, driver, url, ImmutableMap.<String, Object>of());
} | java | public static Database createFrom(String name, String driver, String url) {
return createFrom(name, driver, url, ImmutableMap.<String, Object>of());
} | [
"public",
"static",
"Database",
"createFrom",
"(",
"String",
"name",
",",
"String",
"driver",
",",
"String",
"url",
")",
"{",
"return",
"createFrom",
"(",
"name",
",",
"driver",
",",
"url",
",",
"ImmutableMap",
".",
"<",
"String",
",",
"Object",
">",
"of... | Create a pooled database with the given configuration.
@param name the database name
@param driver the database driver class
@param url the database url
@return a configured database | [
"Create",
"a",
"pooled",
"database",
"with",
"the",
"given",
"configuration",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/persistence/play-java-jdbc/src/main/java/play/db/Databases.java#L48-L50 | test | Create a database from a name driver and url. | Of course, here is the Java code you requested:
```java
public static Database createFrom(String name, String driver, String url) {
return createFrom(name, driver, url, ImmutableMap.<String, Object>of());
}
```
Hope this helps! |
jryans/jless | src/main/java/com/bazaarvoice/jless/parser/Parser.java | Parser.String | Rule String() {
return FirstOf(
Sequence('\'', ZeroOrMore(TestNot('\'' ), ANY), '\'' ),
Sequence('"', ZeroOrMore(TestNot('"' ), ANY), '"' )
);
} | java | Rule String() {
return FirstOf(
Sequence('\'', ZeroOrMore(TestNot('\'' ), ANY), '\'' ),
Sequence('"', ZeroOrMore(TestNot('"' ), ANY), '"' )
);
} | [
"Rule",
"String",
"(",
")",
"{",
"return",
"FirstOf",
"(",
"Sequence",
"(",
"'",
"'",
",",
"ZeroOrMore",
"(",
"TestNot",
"(",
"'",
"'",
")",
",",
"ANY",
")",
",",
"'",
"'",
")",
",",
"Sequence",
"(",
"'",
"'",
",",
"ZeroOrMore",
"(",
"TestNot",
... | Ex: 'hello' / "hello" | [
"Ex",
":",
"hello",
"/",
"hello"
] | 0e448fac752b4fc7bfef6b220ed1c64a490c29c0 | https://github.com/jryans/jless/blob/0e448fac752b4fc7bfef6b220ed1c64a490c29c0/src/main/java/com/bazaarvoice/jless/parser/Parser.java#L702-L707 | test | A single - character code for a CIDCTYPE. | Of course, here is the Java code you requested:
```java
Rule String() {
return FirstOf(
Sequence('\'', ZeroOrMore(TestNot('\'' ), ANY), '\'' ),
Sequence('"', ZeroOrMore(TestNot('"' ), ANY), '"' )
);
}
```
Hope this helps! |
spring-projects/spring-security | config/src/main/java/org/springframework/security/config/annotation/authentication/configurers/provisioning/UserDetailsManagerConfigurer.java | UserDetailsManagerConfigurer.withUser | @SuppressWarnings("unchecked")
public final C withUser(User.UserBuilder userBuilder) {
this.users.add(userBuilder.build());
return (C) this;
} | java | @SuppressWarnings("unchecked")
public final C withUser(User.UserBuilder userBuilder) {
this.users.add(userBuilder.build());
return (C) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"C",
"withUser",
"(",
"User",
".",
"UserBuilder",
"userBuilder",
")",
"{",
"this",
".",
"users",
".",
"add",
"(",
"userBuilder",
".",
"build",
"(",
")",
")",
";",
"return",
"(",
"C",
... | Allows adding a user to the {@link UserDetailsManager} that is being created. This
method can be invoked multiple times to add multiple users.
@param userBuilder the user to add. Cannot be null.
@return the {@link UserDetailsBuilder} for further customizations | [
"Allows",
"adding",
"a",
"user",
"to",
"the",
"{",
"@link",
"UserDetailsManager",
"}",
"that",
"is",
"being",
"created",
".",
"This",
"method",
"can",
"be",
"invoked",
"multiple",
"times",
"to",
"add",
"multiple",
"users",
"."
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/config/src/main/java/org/springframework/security/config/annotation/authentication/configurers/provisioning/UserDetailsManagerConfigurer.java#L87-L91 | test | Adds a user to the users list. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public final C withUser(User.UserBuilder userBuilder) {
this.users.add(userBuilder.build());
return (C) this;
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/thredds/client/catalog/builder/CatalogBuilder.java | CatalogBuilder.readXML | private void readXML(String location) throws IOException {
try {
SAXBuilder saxBuilder = new SAXBuilder();
Document jdomDoc = saxBuilder.build(location);
readCatalog(jdomDoc.getRootElement());
}
catch (Exception e) {
errlog.format("failed to read catalog at '%s' err='%s'%n", l... | java | private void readXML(String location) throws IOException {
try {
SAXBuilder saxBuilder = new SAXBuilder();
Document jdomDoc = saxBuilder.build(location);
readCatalog(jdomDoc.getRootElement());
}
catch (Exception e) {
errlog.format("failed to read catalog at '%s' err='%s'%n", l... | [
"private",
"void",
"readXML",
"(",
"String",
"location",
")",
"throws",
"IOException",
"{",
"try",
"{",
"SAXBuilder",
"saxBuilder",
"=",
"new",
"SAXBuilder",
"(",
")",
";",
"Document",
"jdomDoc",
"=",
"saxBuilder",
".",
"build",
"(",
"location",
")",
";",
... | /* private void readXML(String fileName) throws IOException {
try {
StAXStreamBuilder staxBuilder = new StAXStreamBuilder();
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(new FileInputStream(fileName));
Document jdomDoc = staxBu... | [
"/",
"*",
"private",
"void",
"readXML",
"(",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"try",
"{",
"StAXStreamBuilder",
"staxBuilder",
"=",
"new",
"StAXStreamBuilder",
"()",
";",
"XMLInputFactory",
"xmlInputFactory",
"=",
"XMLInputFactory",
".",
"ne... | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/thredds/client/catalog/builder/CatalogBuilder.java#L297-L311 | test | Reads the XML file at the given location. | Of course, here is the Java code you requested:
```java
private void readXML(String location) throws IOException {
try {
SAXBuilder saxBuilder = new SAXBuilder();
Document jdomDoc = saxBuilder.build(location);
readCatalog(jdomDoc.getRootElement());
}
catch (Exception e) {
err... |
Unidata/thredds | opendap/src/main/java/opendap/dap/DSequence.java | DSequence.readMarker | private byte readMarker(DataInputStream source) throws IOException {
byte marker = source.readByte();
// pad out to a multiple of four bytes
byte unused;
for (int i = 0; i < 3; i++)
unused = source.readByte();
return marker;
} | java | private byte readMarker(DataInputStream source) throws IOException {
byte marker = source.readByte();
// pad out to a multiple of four bytes
byte unused;
for (int i = 0; i < 3; i++)
unused = source.readByte();
return marker;
} | [
"private",
"byte",
"readMarker",
"(",
"DataInputStream",
"source",
")",
"throws",
"IOException",
"{",
"byte",
"marker",
"=",
"source",
".",
"readByte",
"(",
")",
";",
"// pad out to a multiple of four bytes\r",
"byte",
"unused",
";",
"for",
"(",
"int",
"i",
"=",... | Reads a marker byte from the input stream. | [
"Reads",
"a",
"marker",
"byte",
"from",
"the",
"input",
"stream",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/opendap/src/main/java/opendap/dap/DSequence.java#L544-L552 | test | Reads the marker from the specified input stream. | Of course, here is the Java code you requested:
```java
private byte readMarker(DataInputStream source) throws IOException {
byte marker = source.readByte();
// pad out to a multiple of four bytes
byte unused;
for (int i = 0; i < 3; i++)
unused = source.readByte();
... |
wildfly/wildfly | ee/src/main/java/org/jboss/as/ee/naming/ModuleContextProcessor.java | ModuleContextProcessor.deploy | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
return;
}
EEModuleDescription modu... | java | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
return;
}
EEModuleDescription modu... | [
"public",
"void",
"deploy",
"(",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"DeploymentUnit",
"deploymentUnit",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
";",
"if",
"(",
"DeploymentTypeMarker"... | Add a ContextService for this module.
@param phaseContext the deployment unit context
@throws org.jboss.as.server.deployment.DeploymentUnitProcessingException | [
"Add",
"a",
"ContextService",
"for",
"this",
"module",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ee/src/main/java/org/jboss/as/ee/naming/ModuleContextProcessor.java#L63-L107 | test | Add the services for the AZ service. | Of course, here is the Java code you requested:
```java
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
... |
orientechnologies/orientdb | distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastPlugin.java | OHazelcastPlugin.electNewLockManager | @Override
public String electNewLockManager() {
if (hazelcastInstance == null)
throw new HazelcastInstanceNotActiveException();
final ILock lock = hazelcastInstance.getLock("orientdb.lockManagerElection");
lock.lock();
try {
// TRY ALL THE SERVERS IN ORDER (ALL THE SERVERS HAVE THE SAME ... | java | @Override
public String electNewLockManager() {
if (hazelcastInstance == null)
throw new HazelcastInstanceNotActiveException();
final ILock lock = hazelcastInstance.getLock("orientdb.lockManagerElection");
lock.lock();
try {
// TRY ALL THE SERVERS IN ORDER (ALL THE SERVERS HAVE THE SAME ... | [
"@",
"Override",
"public",
"String",
"electNewLockManager",
"(",
")",
"{",
"if",
"(",
"hazelcastInstance",
"==",
"null",
")",
"throw",
"new",
"HazelcastInstanceNotActiveException",
"(",
")",
";",
"final",
"ILock",
"lock",
"=",
"hazelcastInstance",
".",
"getLock",
... | Elects a new server as coordinator. The election browse the ordered server list. | [
"Elects",
"a",
"new",
"server",
"as",
"coordinator",
".",
"The",
"election",
"browse",
"the",
"ordered",
"server",
"list",
"."
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastPlugin.java#L1603-L1674 | test | This method is called to get the server name of the new lock manager. | Of course, here is the Java code you requested:
```java
@Override
public String electNewLockManager() {
if (hazelcastInstance == null)
throw new HazelcastInstanceNotActiveException();
final ILock lock = hazelcastInstance.getLock("orientdb.lockManagerElection");
lock.lock();
try {
// TRY... |
wildfly/wildfly | ee/src/main/java/org/jboss/as/ee/component/ComponentConfiguration.java | ComponentConfiguration.getComponentInterceptors | public List<InterceptorFactory> getComponentInterceptors(Method method) {
Map<Method, OrderedItemContainer<List<InterceptorFactory>>> map = componentInterceptors;
OrderedItemContainer<List<InterceptorFactory>> interceptors = map.get(method);
if (interceptors == null) {
return Collect... | java | public List<InterceptorFactory> getComponentInterceptors(Method method) {
Map<Method, OrderedItemContainer<List<InterceptorFactory>>> map = componentInterceptors;
OrderedItemContainer<List<InterceptorFactory>> interceptors = map.get(method);
if (interceptors == null) {
return Collect... | [
"public",
"List",
"<",
"InterceptorFactory",
">",
"getComponentInterceptors",
"(",
"Method",
"method",
")",
"{",
"Map",
"<",
"Method",
",",
"OrderedItemContainer",
"<",
"List",
"<",
"InterceptorFactory",
">",
">",
">",
"map",
"=",
"componentInterceptors",
";",
"... | Gets the interceptor list for a given method. This should not be called until
all interceptors have been added.
@param method the component method
@return the deque | [
"Gets",
"the",
"interceptor",
"list",
"for",
"a",
"given",
"method",
".",
"This",
"should",
"not",
"be",
"called",
"until",
"all",
"interceptors",
"have",
"been",
"added",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ee/src/main/java/org/jboss/as/ee/component/ComponentConfiguration.java#L148-L160 | test | Get the component interceptors for a given method. | Of course, here is the Java code you requested:
```java
public List<InterceptorFactory> getComponentInterceptors(Method method) {
Map<Method, OrderedItemContainer<List<InterceptorFactory>>> map = componentInterceptors;
OrderedItemContainer<List<InterceptorFactory>> interceptors = map.get(method);
... |
alipay/sofa-bolt | src/main/java/com/alipay/remoting/RandomSelectStrategy.java | RandomSelectStrategy.randomGet | private Connection randomGet(List<Connection> conns) {
if (null == conns || conns.isEmpty()) {
return null;
}
int size = conns.size();
int tries = 0;
Connection result = null;
while ((result == null || !result.isFine()) && tries++ < MAX_TIMES) {
r... | java | private Connection randomGet(List<Connection> conns) {
if (null == conns || conns.isEmpty()) {
return null;
}
int size = conns.size();
int tries = 0;
Connection result = null;
while ((result == null || !result.isFine()) && tries++ < MAX_TIMES) {
r... | [
"private",
"Connection",
"randomGet",
"(",
"List",
"<",
"Connection",
">",
"conns",
")",
"{",
"if",
"(",
"null",
"==",
"conns",
"||",
"conns",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"int",
"size",
"=",
"conns",
".",
"size",
... | get one connection randomly
@param conns
@return | [
"get",
"one",
"connection",
"randomly"
] | 0ad7b46b2649bfc4e2ecc1f5e1c1f935d179c046 | https://github.com/alipay/sofa-bolt/blob/0ad7b46b2649bfc4e2ecc1f5e1c1f935d179c046/src/main/java/com/alipay/remoting/RandomSelectStrategy.java#L100-L116 | test | Random Get Connection. | Of course, here is the Java code you requested:
```java
private Connection randomGet(List<Connection> conns) {
if (null == conns || conns.isEmpty()) {
return null;
}
int size = conns.size();
int tries = 0;
Connection result = null;
while ((result == null || ... |
artclarke/humble-video | humble-video-noarch/src/main/java/io/humble/video/BitStreamFilter.java | BitStreamFilter.make | public static BitStreamFilter make(String filtername) {
long cPtr = VideoJNI.BitStreamFilter_make__SWIG_0(filtername);
return (cPtr == 0) ? null : new BitStreamFilter(cPtr, false);
} | java | public static BitStreamFilter make(String filtername) {
long cPtr = VideoJNI.BitStreamFilter_make__SWIG_0(filtername);
return (cPtr == 0) ? null : new BitStreamFilter(cPtr, false);
} | [
"public",
"static",
"BitStreamFilter",
"make",
"(",
"String",
"filtername",
")",
"{",
"long",
"cPtr",
"=",
"VideoJNI",
".",
"BitStreamFilter_make__SWIG_0",
"(",
"filtername",
")",
";",
"return",
"(",
"cPtr",
"==",
"0",
")",
"?",
"null",
":",
"new",
"BitStrea... | Create a filter given the name.<br>
<br>
@param filtername The name of the filter.<br>
<br>
@see BitStreamFilterType | [
"Create",
"a",
"filter",
"given",
"the",
"name",
".",
"<br",
">",
"<br",
">"
] | aa349ae2d7ef74160b7074feac8d298cf90394d1 | https://github.com/artclarke/humble-video/blob/aa349ae2d7ef74160b7074feac8d298cf90394d1/humble-video-noarch/src/main/java/io/humble/video/BitStreamFilter.java#L139-L142 | test | Create a BitStreamFilter from a filtername. | Of course, here is the Java code you requested:
```java
public static BitStreamFilter make(String filtername) {
long cPtr = VideoJNI.BitStreamFilter_make__SWIG_0(filtername);
return (cPtr == 0) ? null : new BitStreamFilter(cPtr, false);
}
```
Hope this helps! |
jboss/jboss-common-core | src/main/java/org/jboss/util/file/JarUtils.java | JarUtils.extractNestedJar | public static URL extractNestedJar(URL jarURL, File dest)
throws IOException
{
// This may not be a jar URL so validate the protocol
if( jarURL.getProtocol().equals("jar") == false )
return jarURL;
String destPath = dest.getAbsolutePath();
URLConnection urlConn = jarURL.openC... | java | public static URL extractNestedJar(URL jarURL, File dest)
throws IOException
{
// This may not be a jar URL so validate the protocol
if( jarURL.getProtocol().equals("jar") == false )
return jarURL;
String destPath = dest.getAbsolutePath();
URLConnection urlConn = jarURL.openC... | [
"public",
"static",
"URL",
"extractNestedJar",
"(",
"URL",
"jarURL",
",",
"File",
"dest",
")",
"throws",
"IOException",
"{",
"// This may not be a jar URL so validate the protocol ",
"if",
"(",
"jarURL",
".",
"getProtocol",
"(",
")",
".",
"equals",
"(",
"\"jar\"",
... | Given a URL check if its a jar url(jar:<url>!/archive) and if it is,
extract the archive entry into the given dest directory and return a file
URL to its location. If jarURL is not a jar url then it is simply returned
as the URL for the jar.
@param jarURL the URL to validate and extract the referenced entry if its
a j... | [
"Given",
"a",
"URL",
"check",
"if",
"its",
"a",
"jar",
"url",
"(",
"jar",
":",
"<url",
">",
"!",
"/",
"archive",
")",
"and",
"if",
"it",
"is",
"extract",
"the",
"archive",
"entry",
"into",
"the",
"given",
"dest",
"directory",
"and",
"return",
"a",
... | c191bb18db83fa106c6913cf34ed47989b65dc97 | https://github.com/jboss/jboss-common-core/blob/c191bb18db83fa106c6913cf34ed47989b65dc97/src/main/java/org/jboss/util/file/JarUtils.java#L350-L398 | test | Extract a jar URL from a URL and return the URL. | Of course, here is the Java code you requested:
```java
public static URL extractNestedJar(URL jarURL, File dest)
throws IOException
{
// This may not be a jar URL so validate the protocol
if( jarURL.getProtocol().equals("jar") == false )
return jarURL;
String destPath = dest.getA... |
yunify/qingstor-sdk-java | src/main/java/com/qingstor/sdk/utils/QSSignatureUtil.java | QSSignatureUtil.generateAuthorization | public static String generateAuthorization(
String accessKey,
String secretKey,
String strToSign) {
String signature = generateSignature(secretKey, strToSign);
return String.format("QS %s:%s", accessKey, signature);
} | java | public static String generateAuthorization(
String accessKey,
String secretKey,
String strToSign) {
String signature = generateSignature(secretKey, strToSign);
return String.format("QS %s:%s", accessKey, signature);
} | [
"public",
"static",
"String",
"generateAuthorization",
"(",
"String",
"accessKey",
",",
"String",
"secretKey",
",",
"String",
"strToSign",
")",
"{",
"String",
"signature",
"=",
"generateSignature",
"(",
"secretKey",
",",
"strToSign",
")",
";",
"return",
"String",
... | Generate signature for request against QingStor.
@param accessKey: API access key ID
@param secretKey: API secret access key ID
@param strToSign: strToSign
@return a string which can be used as value of HTTP request header field "Authorization"
directly.
<p>See <a href="https://docs.qingcloud.com/qingstor/api/common/s... | [
"Generate",
"signature",
"for",
"request",
"against",
"QingStor",
"."
] | b44a228a99e60e4d6e5a450b7c05972552ab9962 | https://github.com/yunify/qingstor-sdk-java/blob/b44a228a99e60e4d6e5a450b7c05972552ab9962/src/main/java/com/qingstor/sdk/utils/QSSignatureUtil.java#L130-L136 | test | Generate Authorization header for a single request. | Of course, here is the Java code you requested:
```java
public static String generateAuthorization(
String accessKey,
String secretKey,
String strToSign) {
String signature = generateSignature(secretKey, strToSign);
return String.format("QS %s:%s", accessKey, signatu... |
cglib/cglib | cglib/src/main/java/net/sf/cglib/core/CodeEmitter.java | CodeEmitter.unbox | public void unbox(Type type) {
Type t = Constants.TYPE_NUMBER;
Signature sig = null;
switch (type.getSort()) {
case Type.VOID:
return;
case Type.CHAR:
t = Constants.TYPE_CHARACTER;
sig = CHAR_VALUE;
break;
case Type.BOOLEAN:... | java | public void unbox(Type type) {
Type t = Constants.TYPE_NUMBER;
Signature sig = null;
switch (type.getSort()) {
case Type.VOID:
return;
case Type.CHAR:
t = Constants.TYPE_CHARACTER;
sig = CHAR_VALUE;
break;
case Type.BOOLEAN:... | [
"public",
"void",
"unbox",
"(",
"Type",
"type",
")",
"{",
"Type",
"t",
"=",
"Constants",
".",
"TYPE_NUMBER",
";",
"Signature",
"sig",
"=",
"null",
";",
"switch",
"(",
"type",
".",
"getSort",
"(",
")",
")",
"{",
"case",
"Type",
".",
"VOID",
":",
"re... | If the argument is a primitive class, replaces the object
on the top of the stack with the unwrapped (primitive)
equivalent. For example, Character -> char.
@param type the class indicating the desired type of the top stack value
@return true if the value was unboxed | [
"If",
"the",
"argument",
"is",
"a",
"primitive",
"class",
"replaces",
"the",
"object",
"on",
"the",
"top",
"of",
"the",
"stack",
"with",
"the",
"unwrapped",
"(",
"primitive",
")",
"equivalent",
".",
"For",
"example",
"Character",
"-",
">",
"char",
"."
] | cd01695c11fd3c66641b295b9596f74cf13c548b | https://github.com/cglib/cglib/blob/cd01695c11fd3c66641b295b9596f74cf13c548b/cglib/src/main/java/net/sf/cglib/core/CodeEmitter.java#L733-L768 | test | Unbox a type. | Of course, here is the Java code you requested:
```java
public void unbox(Type type) {
Type t = Constants.TYPE_NUMBER;
Signature sig = null;
switch (type.getSort()) {
case Type.VOID:
return;
case Type.CHAR:
t = Constants.TYPE_CHARACTER;
sig = ... |
mikolajmitura/java-properties-to-json | src/main/java/pl/jalokim/propertiestojson/util/PropertiesToJsonConverter.java | PropertiesToJsonConverter.convertPropertiesFromFileToJson | public String convertPropertiesFromFileToJson(File file, String... includeDomainKeys) throws ReadInputException, ParsePropertiesException {
try {
InputStream targetStream = new FileInputStream(file);
return convertToJson(targetStream, includeDomainKeys);
} catch (FileNotFoundExce... | java | public String convertPropertiesFromFileToJson(File file, String... includeDomainKeys) throws ReadInputException, ParsePropertiesException {
try {
InputStream targetStream = new FileInputStream(file);
return convertToJson(targetStream, includeDomainKeys);
} catch (FileNotFoundExce... | [
"public",
"String",
"convertPropertiesFromFileToJson",
"(",
"File",
"file",
",",
"String",
"...",
"includeDomainKeys",
")",
"throws",
"ReadInputException",
",",
"ParsePropertiesException",
"{",
"try",
"{",
"InputStream",
"targetStream",
"=",
"new",
"FileInputStream",
"(... | Generate Json by given file with properties with only included domain keys.
@param file file with properties
@param includeDomainKeys domain head keys which should be parsed to json <br>
example properties:<br>
object1.field1=value1<br>
object1.field2=value2<br>
someObject2.field2=value3<br>
filter "objec... | [
"Generate",
"Json",
"by",
"given",
"file",
"with",
"properties",
"with",
"only",
"included",
"domain",
"keys",
"."
] | 8f264a6e9e34aaba10f81ad5832dcfe821c3576d | https://github.com/mikolajmitura/java-properties-to-json/blob/8f264a6e9e34aaba10f81ad5832dcfe821c3576d/src/main/java/pl/jalokim/propertiestojson/util/PropertiesToJsonConverter.java#L138-L145 | test | Convert properties from a file to a json string. | Of course, here is the Java code you requested:
```java
public String convertPropertiesFromFileToJson(File file, String... includeDomainKeys) throws ReadInputException, ParsePropertiesException {
try {
InputStream targetStream = new FileInputStream(file);
return convertToJson(targetStre... |
firepick1/firerest-client | src/main/java/org/firepick/JSONResult.java | JSONResult.get | public JSONResult get(int index) {
if (value instanceof JSONArray) {
JSONArray array = (JSONArray) value;
Object result = array.get(index);
return new JSONResult(result);
} else if (value instanceof JSONObject) {
return get(String.valueOf(index));
}
return new JSONResult(null);
... | java | public JSONResult get(int index) {
if (value instanceof JSONArray) {
JSONArray array = (JSONArray) value;
Object result = array.get(index);
return new JSONResult(result);
} else if (value instanceof JSONObject) {
return get(String.valueOf(index));
}
return new JSONResult(null);
... | [
"public",
"JSONResult",
"get",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"value",
"instanceof",
"JSONArray",
")",
"{",
"JSONArray",
"array",
"=",
"(",
"JSONArray",
")",
"value",
";",
"Object",
"result",
"=",
"array",
".",
"get",
"(",
"index",
")",
";",... | Advance current JSON value to specified element in JSON array.
Set current JSON value to null otherwise.
@param index zero-based JSON array index
@return JSONResult for fluent method chaining | [
"Advance",
"current",
"JSON",
"value",
"to",
"specified",
"element",
"in",
"JSON",
"array",
".",
"Set",
"current",
"JSON",
"value",
"to",
"null",
"otherwise",
"."
] | f43c85ca093b1f9f62f0375f905adae9351de1e6 | https://github.com/firepick1/firerest-client/blob/f43c85ca093b1f9f62f0375f905adae9351de1e6/src/main/java/org/firepick/JSONResult.java#L45-L54 | test | Gets the value at the specified index. | Of course, here is the Java code you requested:
```java
public JSONResult get(int index) {
if (value instanceof JSONArray) {
JSONArray array = (JSONArray) value;
Object result = array.get(index);
return new JSONResult(result);
} else if (value instanceof JSONObject) {
return get(String.... |
playframework/playframework | core/play/src/main/java/play/mvc/Results.java | Results.unauthorized | public static Result unauthorized(JsonNode content, JsonEncoding encoding) {
return status(UNAUTHORIZED, content, encoding);
} | java | public static Result unauthorized(JsonNode content, JsonEncoding encoding) {
return status(UNAUTHORIZED, content, encoding);
} | [
"public",
"static",
"Result",
"unauthorized",
"(",
"JsonNode",
"content",
",",
"JsonEncoding",
"encoding",
")",
"{",
"return",
"status",
"(",
"UNAUTHORIZED",
",",
"content",
",",
"encoding",
")",
";",
"}"
] | Generates a 401 Unauthorized result.
@param content the result's body content as a play-json object
@param encoding the encoding into which the json should be encoded
@return the result | [
"Generates",
"a",
"401",
"Unauthorized",
"result",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/core/play/src/main/java/play/mvc/Results.java#L1329-L1331 | test | A status code of UNAUTHORIZED | Of course, here is the Java code you requested:
```java
public static Result unauthorized(JsonNode content, JsonEncoding encoding) {
return status(UNAUTHORIZED, content, encoding);
}
```
Hope this helps! |
fuinorg/srcgen4j-core | src/main/java/org/fuin/srcgen4j/core/velocity/TargetFile.java | TargetFile.init | public final void init(final Map<String, String> vars) {
path = Utils4J.replaceVars(path, vars);
name = Utils4J.replaceVars(name, vars);
if (arguments != null) {
for (final Argument argument : arguments) {
argument.init(vars);
}
}
} | java | public final void init(final Map<String, String> vars) {
path = Utils4J.replaceVars(path, vars);
name = Utils4J.replaceVars(name, vars);
if (arguments != null) {
for (final Argument argument : arguments) {
argument.init(vars);
}
}
} | [
"public",
"final",
"void",
"init",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"vars",
")",
"{",
"path",
"=",
"Utils4J",
".",
"replaceVars",
"(",
"path",
",",
"vars",
")",
";",
"name",
"=",
"Utils4J",
".",
"replaceVars",
"(",
"name",
",",... | Replaces variables (if defined) in the path, name and arguments.
@param vars
Variables to use. | [
"Replaces",
"variables",
"(",
"if",
"defined",
")",
"in",
"the",
"path",
"name",
"and",
"arguments",
"."
] | da2bc58370993e6294ddc4eb7e696fe255f979db | https://github.com/fuinorg/srcgen4j-core/blob/da2bc58370993e6294ddc4eb7e696fe255f979db/src/main/java/org/fuin/srcgen4j/core/velocity/TargetFile.java#L180-L188 | test | Initializes the related attributes of the related class. | Of course, here is the Java code you requested:
```java
public final void init(final Map<String, String> vars) {
path = Utils4J.replaceVars(path, vars);
name = Utils4J.replaceVars(name, vars);
if (arguments != null) {
for (final Argument argument : arguments) {
... |
Unidata/thredds | visad/src/main/java/ucar/nc2/iosp/grid/GridIndexToNC.java | GridIndexToNC.open | public void open(GridIndex index, GridTableLookup lookup, int version,
NetcdfFile ncfile, CancelTask cancelTask) throws IOException {
// create the HorizCoord Systems : one for each gds
List<GridDefRecord> hcsList = index.getHorizCoordSys();
boolean needGroups = (hcsList.size() > 1);
... | java | public void open(GridIndex index, GridTableLookup lookup, int version,
NetcdfFile ncfile, CancelTask cancelTask) throws IOException {
// create the HorizCoord Systems : one for each gds
List<GridDefRecord> hcsList = index.getHorizCoordSys();
boolean needGroups = (hcsList.size() > 1);
... | [
"public",
"void",
"open",
"(",
"GridIndex",
"index",
",",
"GridTableLookup",
"lookup",
",",
"int",
"version",
",",
"NetcdfFile",
"ncfile",
",",
"CancelTask",
"cancelTask",
")",
"throws",
"IOException",
"{",
"// create the HorizCoord Systems : one for each gds",
"List",
... | Fill in the netCDF file
@param index grid index
@param lookup lookup table
@param version version of data
@param ncfile netCDF file to fill in
@param cancelTask cancel task
@throws IOException Problem reading from the file | [
"Fill",
"in",
"the",
"netCDF",
"file"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/visad/src/main/java/ucar/nc2/iosp/grid/GridIndexToNC.java#L56-L203 | test | Open the index file. | Of course, here is the Java code you requested:
```java
public void open(GridIndex index, GridTableLookup lookup, int version,
NetcdfFile ncfile, CancelTask cancelTask) throws IOException {
// create the HorizCoord Systems : one for each gds
List<GridDefRecord> hcsList = index.getHorizCoord... |
OpenEstate/OpenEstate-IO | Examples/src/main/java/org/openestate/io/examples/FilemakerReadingExample.java | FilemakerReadingExample.read | @SuppressWarnings("Duplicates")
protected static void read(File xmlFile) throws SAXException, IOException, ParserConfigurationException, JAXBException {
LOGGER.info("process file: " + xmlFile.getAbsolutePath());
if (!xmlFile.isFile()) {
LOGGER.warn("> provided file is invalid");
... | java | @SuppressWarnings("Duplicates")
protected static void read(File xmlFile) throws SAXException, IOException, ParserConfigurationException, JAXBException {
LOGGER.info("process file: " + xmlFile.getAbsolutePath());
if (!xmlFile.isFile()) {
LOGGER.warn("> provided file is invalid");
... | [
"@",
"SuppressWarnings",
"(",
"\"Duplicates\"",
")",
"protected",
"static",
"void",
"read",
"(",
"File",
"xmlFile",
")",
"throws",
"SAXException",
",",
"IOException",
",",
"ParserConfigurationException",
",",
"JAXBException",
"{",
"LOGGER",
".",
"info",
"(",
"\"pr... | Read a {@link File} into a {@link FilemakerResultDocument} or
{@link FilemakerLayoutDocument} and print some of their content to
console.
@param xmlFile the file to read
@throws SAXException if the file is not readable by the XML parser
@throws IOException if the file is not readable
@... | [
"Read",
"a",
"{",
"@link",
"File",
"}",
"into",
"a",
"{",
"@link",
"FilemakerResultDocument",
"}",
"or",
"{",
"@link",
"FilemakerLayoutDocument",
"}",
"and",
"print",
"some",
"of",
"their",
"content",
"to",
"console",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/Examples/src/main/java/org/openestate/io/examples/FilemakerReadingExample.java#L106-L124 | test | read the XML file and print it to console. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("Duplicates")
protected static void read(File xmlFile) throws SAXException, IOException, ParserConfigurationException, JAXBException {
LOGGER.info("process file: " + xmlFile.getAbsolutePath());
if (!xmlFile.isFile()) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.