repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java | GenericUtils.getBytes | static public int getBytes(WsByteBuffer wsbb, byte[] dst, int offset) {
try {
// Use the buffers bulk get method
wsbb.get(dst, offset, dst.length - offset);
return dst.length;
} catch (BufferUnderflowException bue) {
// no FFDC required
int numOfBytesAvail = wsbb.remaining();
wsbb.get(dst, offset, numOfBytesAvail);
return (offset + numOfBytesAvail);
}
} | java | static public int getBytes(WsByteBuffer wsbb, byte[] dst, int offset) {
try {
// Use the buffers bulk get method
wsbb.get(dst, offset, dst.length - offset);
return dst.length;
} catch (BufferUnderflowException bue) {
// no FFDC required
int numOfBytesAvail = wsbb.remaining();
wsbb.get(dst, offset, numOfBytesAvail);
return (offset + numOfBytesAvail);
}
} | [
"static",
"public",
"int",
"getBytes",
"(",
"WsByteBuffer",
"wsbb",
",",
"byte",
"[",
"]",
"dst",
",",
"int",
"offset",
")",
"{",
"try",
"{",
"// Use the buffers bulk get method",
"wsbb",
".",
"get",
"(",
"dst",
",",
"offset",
",",
"dst",
".",
"length",
... | This method reads data from the WsByteBuffer and writes it
to the byte array. The number of the bytes read is the length
of the passed byte array. if the data in the WsByteBuffer is not
sufficient then it reads the max. no. of bytes possible.
It returns the <b>total</b> number of bytes read into the byte
array.
@param wsbb Read WsBytebuffer
@param dst Write byte array
@param offset start of write position in the byte array
@return (offset + no. of bytes read) | [
"This",
"method",
"reads",
"data",
"from",
"the",
"WsByteBuffer",
"and",
"writes",
"it",
"to",
"the",
"byte",
"array",
".",
"The",
"number",
"of",
"the",
"bytes",
"read",
"is",
"the",
"length",
"of",
"the",
"passed",
"byte",
"array",
".",
"if",
"the",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/GenericUtils.java#L299-L310 |
PawelAdamski/HttpClientMock | src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java | HttpClientMockBuilder.withParameter | public HttpClientMockBuilder withParameter(String name, Matcher<String> matcher) {
ruleBuilder.addParameterCondition(name, matcher);
return this;
} | java | public HttpClientMockBuilder withParameter(String name, Matcher<String> matcher) {
ruleBuilder.addParameterCondition(name, matcher);
return this;
} | [
"public",
"HttpClientMockBuilder",
"withParameter",
"(",
"String",
"name",
",",
"Matcher",
"<",
"String",
">",
"matcher",
")",
"{",
"ruleBuilder",
".",
"addParameterCondition",
"(",
"name",
",",
"matcher",
")",
";",
"return",
"this",
";",
"}"
] | Adds parameter condition. Parameter value must match.
@param name parameter name
@param matcher parameter value matcher
@return condition builder | [
"Adds",
"parameter",
"condition",
".",
"Parameter",
"value",
"must",
"match",
"."
] | train | https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java#L86-L89 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java | XLogPDescriptor.getDoubleBondedNitrogenCount | private int getDoubleBondedNitrogenCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
IBond bond;
int ndbcounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("N")) {
bond = ac.getBond(neighbour, atom);
if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) {
if (bond.getOrder() == IBond.Order.DOUBLE) {
ndbcounter += 1;
}
}
}
}
return ndbcounter;
} | java | private int getDoubleBondedNitrogenCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
IBond bond;
int ndbcounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("N")) {
bond = ac.getBond(neighbour, atom);
if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) {
if (bond.getOrder() == IBond.Order.DOUBLE) {
ndbcounter += 1;
}
}
}
}
return ndbcounter;
} | [
"private",
"int",
"getDoubleBondedNitrogenCount",
"(",
"IAtomContainer",
"ac",
",",
"IAtom",
"atom",
")",
"{",
"List",
"<",
"IAtom",
">",
"neighbours",
"=",
"ac",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
"IBond",
"bond",
";",
"int",
"ndbcounter",
... | Gets the doubleBondedNitrogenCount attribute of the XLogPDescriptor object.
@param ac Description of the Parameter
@param atom Description of the Parameter
@return The doubleBondedNitrogenCount value | [
"Gets",
"the",
"doubleBondedNitrogenCount",
"attribute",
"of",
"the",
"XLogPDescriptor",
"object",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1212-L1227 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java | AttributedString.valuesMatch | private final static boolean valuesMatch(Object value1, Object value2) {
if (value1 == null) {
return value2 == null;
} else {
return value1.equals(value2);
}
} | java | private final static boolean valuesMatch(Object value1, Object value2) {
if (value1 == null) {
return value2 == null;
} else {
return value1.equals(value2);
}
} | [
"private",
"final",
"static",
"boolean",
"valuesMatch",
"(",
"Object",
"value1",
",",
"Object",
"value2",
")",
"{",
"if",
"(",
"value1",
"==",
"null",
")",
"{",
"return",
"value2",
"==",
"null",
";",
"}",
"else",
"{",
"return",
"value1",
".",
"equals",
... | returns whether the two objects are either both null or equal | [
"returns",
"whether",
"the",
"two",
"objects",
"are",
"either",
"both",
"null",
"or",
"equal"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L665-L671 |
apache/flink | flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java | QueryableStateClient.getKvState | private <K, N, S extends State, V> CompletableFuture<S> getKvState(
final JobID jobId,
final String queryableStateName,
final K key,
final N namespace,
final TypeInformation<K> keyTypeInfo,
final TypeInformation<N> namespaceTypeInfo,
final StateDescriptor<S, V> stateDescriptor) {
Preconditions.checkNotNull(jobId);
Preconditions.checkNotNull(queryableStateName);
Preconditions.checkNotNull(key);
Preconditions.checkNotNull(namespace);
Preconditions.checkNotNull(keyTypeInfo);
Preconditions.checkNotNull(namespaceTypeInfo);
Preconditions.checkNotNull(stateDescriptor);
TypeSerializer<K> keySerializer = keyTypeInfo.createSerializer(executionConfig);
TypeSerializer<N> namespaceSerializer = namespaceTypeInfo.createSerializer(executionConfig);
stateDescriptor.initializeSerializerUnlessSet(executionConfig);
final byte[] serializedKeyAndNamespace;
try {
serializedKeyAndNamespace = KvStateSerializer
.serializeKeyAndNamespace(key, keySerializer, namespace, namespaceSerializer);
} catch (IOException e) {
return FutureUtils.getFailedFuture(e);
}
return getKvState(jobId, queryableStateName, key.hashCode(), serializedKeyAndNamespace)
.thenApply(stateResponse -> createState(stateResponse, stateDescriptor));
} | java | private <K, N, S extends State, V> CompletableFuture<S> getKvState(
final JobID jobId,
final String queryableStateName,
final K key,
final N namespace,
final TypeInformation<K> keyTypeInfo,
final TypeInformation<N> namespaceTypeInfo,
final StateDescriptor<S, V> stateDescriptor) {
Preconditions.checkNotNull(jobId);
Preconditions.checkNotNull(queryableStateName);
Preconditions.checkNotNull(key);
Preconditions.checkNotNull(namespace);
Preconditions.checkNotNull(keyTypeInfo);
Preconditions.checkNotNull(namespaceTypeInfo);
Preconditions.checkNotNull(stateDescriptor);
TypeSerializer<K> keySerializer = keyTypeInfo.createSerializer(executionConfig);
TypeSerializer<N> namespaceSerializer = namespaceTypeInfo.createSerializer(executionConfig);
stateDescriptor.initializeSerializerUnlessSet(executionConfig);
final byte[] serializedKeyAndNamespace;
try {
serializedKeyAndNamespace = KvStateSerializer
.serializeKeyAndNamespace(key, keySerializer, namespace, namespaceSerializer);
} catch (IOException e) {
return FutureUtils.getFailedFuture(e);
}
return getKvState(jobId, queryableStateName, key.hashCode(), serializedKeyAndNamespace)
.thenApply(stateResponse -> createState(stateResponse, stateDescriptor));
} | [
"private",
"<",
"K",
",",
"N",
",",
"S",
"extends",
"State",
",",
"V",
">",
"CompletableFuture",
"<",
"S",
">",
"getKvState",
"(",
"final",
"JobID",
"jobId",
",",
"final",
"String",
"queryableStateName",
",",
"final",
"K",
"key",
",",
"final",
"N",
"na... | Returns a future holding the request result.
@param jobId JobID of the job the queryable state belongs to.
@param queryableStateName Name under which the state is queryable.
@param key The key that the state we request is associated with.
@param namespace The namespace of the state.
@param keyTypeInfo The {@link TypeInformation} of the keys.
@param namespaceTypeInfo The {@link TypeInformation} of the namespace.
@param stateDescriptor The {@link StateDescriptor} of the state we want to query.
@return Future holding the immutable {@link State} object containing the result. | [
"Returns",
"a",
"future",
"holding",
"the",
"request",
"result",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java#L242-L275 |
js-lib-com/commons | src/main/java/js/util/Params.java | Params.LTE | public static void LTE(long parameter, long value, String name) throws IllegalArgumentException {
if (parameter > value) {
throw new IllegalArgumentException(String.format("%s is not less than or equal %d.", name, value));
}
} | java | public static void LTE(long parameter, long value, String name) throws IllegalArgumentException {
if (parameter > value) {
throw new IllegalArgumentException(String.format("%s is not less than or equal %d.", name, value));
}
} | [
"public",
"static",
"void",
"LTE",
"(",
"long",
"parameter",
",",
"long",
"value",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
">",
"value",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",... | Test if numeric parameter is less than or equal to given threshold value.
@param parameter invocation numeric parameter,
@param value threshold value,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is not less than or equal to threshold value. | [
"Test",
"if",
"numeric",
"parameter",
"is",
"less",
"than",
"or",
"equal",
"to",
"given",
"threshold",
"value",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L471-L475 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/StoredBlock.java | StoredBlock.build | public StoredBlock build(Block block) throws VerificationException {
// Stored blocks track total work done in this chain, because the canonical chain is the one that represents
// the largest amount of work done not the tallest.
BigInteger chainWork = this.chainWork.add(block.getWork());
int height = this.height + 1;
return new StoredBlock(block, chainWork, height);
} | java | public StoredBlock build(Block block) throws VerificationException {
// Stored blocks track total work done in this chain, because the canonical chain is the one that represents
// the largest amount of work done not the tallest.
BigInteger chainWork = this.chainWork.add(block.getWork());
int height = this.height + 1;
return new StoredBlock(block, chainWork, height);
} | [
"public",
"StoredBlock",
"build",
"(",
"Block",
"block",
")",
"throws",
"VerificationException",
"{",
"// Stored blocks track total work done in this chain, because the canonical chain is the one that represents",
"// the largest amount of work done not the tallest.",
"BigInteger",
"chainW... | Creates a new StoredBlock, calculating the additional fields by adding to the values in this block. | [
"Creates",
"a",
"new",
"StoredBlock",
"calculating",
"the",
"additional",
"fields",
"by",
"adding",
"to",
"the",
"values",
"in",
"this",
"block",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/StoredBlock.java#L100-L106 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.mulsubLong | private int mulsubLong(int[] q, int dh, int dl, int x, int offset) {
long xLong = x & LONG_MASK;
offset += 2;
long product = (dl & LONG_MASK) * xLong;
long difference = q[offset] - product;
q[offset--] = (int)difference;
long carry = (product >>> 32)
+ (((difference & LONG_MASK) >
(((~(int)product) & LONG_MASK))) ? 1:0);
product = (dh & LONG_MASK) * xLong + carry;
difference = q[offset] - product;
q[offset--] = (int)difference;
carry = (product >>> 32)
+ (((difference & LONG_MASK) >
(((~(int)product) & LONG_MASK))) ? 1:0);
return (int)carry;
} | java | private int mulsubLong(int[] q, int dh, int dl, int x, int offset) {
long xLong = x & LONG_MASK;
offset += 2;
long product = (dl & LONG_MASK) * xLong;
long difference = q[offset] - product;
q[offset--] = (int)difference;
long carry = (product >>> 32)
+ (((difference & LONG_MASK) >
(((~(int)product) & LONG_MASK))) ? 1:0);
product = (dh & LONG_MASK) * xLong + carry;
difference = q[offset] - product;
q[offset--] = (int)difference;
carry = (product >>> 32)
+ (((difference & LONG_MASK) >
(((~(int)product) & LONG_MASK))) ? 1:0);
return (int)carry;
} | [
"private",
"int",
"mulsubLong",
"(",
"int",
"[",
"]",
"q",
",",
"int",
"dh",
",",
"int",
"dl",
",",
"int",
"x",
",",
"int",
"offset",
")",
"{",
"long",
"xLong",
"=",
"x",
"&",
"LONG_MASK",
";",
"offset",
"+=",
"2",
";",
"long",
"product",
"=",
... | This method is used for division by long.
Specialized version of the method sulsub.
dh is a high part of the divisor, dl is a low part | [
"This",
"method",
"is",
"used",
"for",
"division",
"by",
"long",
".",
"Specialized",
"version",
"of",
"the",
"method",
"sulsub",
".",
"dh",
"is",
"a",
"high",
"part",
"of",
"the",
"divisor",
"dl",
"is",
"a",
"low",
"part"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1808-L1824 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java | StringUtil.toDate | public static Date toDate(final String pString, final DateFormat pFormat) {
try {
synchronized (pFormat) {
// Parse date using given format
return pFormat.parse(pString);
}
}
catch (ParseException pe) {
// Wrap in RuntimeException
throw new IllegalArgumentException(pe.getMessage());
}
} | java | public static Date toDate(final String pString, final DateFormat pFormat) {
try {
synchronized (pFormat) {
// Parse date using given format
return pFormat.parse(pString);
}
}
catch (ParseException pe) {
// Wrap in RuntimeException
throw new IllegalArgumentException(pe.getMessage());
}
} | [
"public",
"static",
"Date",
"toDate",
"(",
"final",
"String",
"pString",
",",
"final",
"DateFormat",
"pFormat",
")",
"{",
"try",
"{",
"synchronized",
"(",
"pFormat",
")",
"{",
"// Parse date using given format\r",
"return",
"pFormat",
".",
"parse",
"(",
"pString... | Converts the string to a date, using the given format.
@param pString the string to convert
@param pFormat the date format
@return the date
@see SimpleDateFormat
@see SimpleDateFormat#SimpleDateFormat(String)
@see DateFormat | [
"Converts",
"the",
"string",
"to",
"a",
"date",
"using",
"the",
"given",
"format",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java#L896-L907 |
app55/app55-java | src/support/java/com/googlecode/openbeans/PersistenceDelegate.java | PersistenceDelegate.mutatesTo | protected boolean mutatesTo(Object o1, Object o2)
{
return null != o1 && null != o2 && o1.getClass() == o2.getClass();
} | java | protected boolean mutatesTo(Object o1, Object o2)
{
return null != o1 && null != o2 && o1.getClass() == o2.getClass();
} | [
"protected",
"boolean",
"mutatesTo",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"return",
"null",
"!=",
"o1",
"&&",
"null",
"!=",
"o2",
"&&",
"o1",
".",
"getClass",
"(",
")",
"==",
"o2",
".",
"getClass",
"(",
")",
";",
"}"
] | Determines whether one object mutates to the other object. One object is considered able to mutate to another object if they are indistinguishable in
terms of behaviors of all public APIs. The default implementation here is to return true only if the two objects are instances of the same class.
@param o1
one object
@param o2
the other object
@return true if second object mutates to the first object, otherwise false | [
"Determines",
"whether",
"one",
"object",
"mutates",
"to",
"the",
"other",
"object",
".",
"One",
"object",
"is",
"considered",
"able",
"to",
"mutate",
"to",
"another",
"object",
"if",
"they",
"are",
"indistinguishable",
"in",
"terms",
"of",
"behaviors",
"of",
... | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/PersistenceDelegate.java#L84-L87 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoScheme.java | ContentCryptoScheme.newCipherLite | protected CipherLite newCipherLite(Cipher cipher, SecretKey cek, int cipherMode) {
return new CipherLite(cipher, this, cek, cipherMode);
} | java | protected CipherLite newCipherLite(Cipher cipher, SecretKey cek, int cipherMode) {
return new CipherLite(cipher, this, cek, cipherMode);
} | [
"protected",
"CipherLite",
"newCipherLite",
"(",
"Cipher",
"cipher",
",",
"SecretKey",
"cek",
",",
"int",
"cipherMode",
")",
"{",
"return",
"new",
"CipherLite",
"(",
"cipher",
",",
"this",
",",
"cek",
",",
"cipherMode",
")",
";",
"}"
] | This is a factory method intended to be overridden by sublcasses to
return the appropriate instance of cipher lite. | [
"This",
"is",
"a",
"factory",
"method",
"intended",
"to",
"be",
"overridden",
"by",
"sublcasses",
"to",
"return",
"the",
"appropriate",
"instance",
"of",
"cipher",
"lite",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoScheme.java#L233-L235 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java | TitlePaneButtonForegroundPainter.paintPressed | public void paintPressed(Graphics2D g, JComponent c, int width, int height) {
paint(g, c, width, height, pressedBorder, pressedCorner, pressedInterior);
} | java | public void paintPressed(Graphics2D g, JComponent c, int width, int height) {
paint(g, c, width, height, pressedBorder, pressedCorner, pressedInterior);
} | [
"public",
"void",
"paintPressed",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"paint",
"(",
"g",
",",
"c",
",",
"width",
",",
"height",
",",
"pressedBorder",
",",
"pressedCorner",
",",
"pressedInte... | Paint the pressed state of the button foreground.
@param g the Graphics2D context to paint with.
@param c the button to paint.
@param width the width to paint.
@param height the height to paint. | [
"Paint",
"the",
"pressed",
"state",
"of",
"the",
"button",
"foreground",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java#L58-L60 |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/util/IntegerList.java | IntegerList.get | protected boolean get(int offset, int[] tofill) {
if (this.values != null) {
int idxTab = 0;
for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) {
for (int n = this.values[idxStart]; n <= this.values[idxStart + 1]; ++n) {
if (offset == idxTab) {
tofill[0] = idxStart;
tofill[1] = n;
return true;
}
++idxTab;
}
}
}
tofill[0] = -1;
tofill[1] = 0;
return false;
} | java | protected boolean get(int offset, int[] tofill) {
if (this.values != null) {
int idxTab = 0;
for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) {
for (int n = this.values[idxStart]; n <= this.values[idxStart + 1]; ++n) {
if (offset == idxTab) {
tofill[0] = idxStart;
tofill[1] = n;
return true;
}
++idxTab;
}
}
}
tofill[0] = -1;
tofill[1] = 0;
return false;
} | [
"protected",
"boolean",
"get",
"(",
"int",
"offset",
",",
"int",
"[",
"]",
"tofill",
")",
"{",
"if",
"(",
"this",
".",
"values",
"!=",
"null",
")",
"{",
"int",
"idxTab",
"=",
"0",
";",
"for",
"(",
"int",
"idxStart",
"=",
"0",
";",
"idxStart",
"<"... | Replies the segment index for the specified value.
<p>The given array must be pre-allocated with at least 2 cells.
The first cell will the the index of the segment. The
second cell will be the first integer value.
@param offset is the number of integer values to skip from the
begining of the value set.
@param tofill is the 2-cell array to fill
@return <code>true</code> on success, <code>false</code> otherwise. | [
"Replies",
"the",
"segment",
"index",
"for",
"the",
"specified",
"value",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/IntegerList.java#L687-L704 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/NativeAppCallAttachmentStore.java | NativeAppCallAttachmentStore.addAttachmentsForCall | public void addAttachmentsForCall(Context context, UUID callId, Map<String, Bitmap> imageAttachments) {
Validate.notNull(context, "context");
Validate.notNull(callId, "callId");
Validate.containsNoNulls(imageAttachments.values(), "imageAttachments");
Validate.containsNoNullOrEmpty(imageAttachments.keySet(), "imageAttachments");
addAttachments(context, callId, imageAttachments, new ProcessAttachment<Bitmap>() {
@Override
public void processAttachment(Bitmap attachment, File outputFile) throws IOException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
attachment.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
} finally {
Utility.closeQuietly(outputStream);
}
}
});
} | java | public void addAttachmentsForCall(Context context, UUID callId, Map<String, Bitmap> imageAttachments) {
Validate.notNull(context, "context");
Validate.notNull(callId, "callId");
Validate.containsNoNulls(imageAttachments.values(), "imageAttachments");
Validate.containsNoNullOrEmpty(imageAttachments.keySet(), "imageAttachments");
addAttachments(context, callId, imageAttachments, new ProcessAttachment<Bitmap>() {
@Override
public void processAttachment(Bitmap attachment, File outputFile) throws IOException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
try {
attachment.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
} finally {
Utility.closeQuietly(outputStream);
}
}
});
} | [
"public",
"void",
"addAttachmentsForCall",
"(",
"Context",
"context",
",",
"UUID",
"callId",
",",
"Map",
"<",
"String",
",",
"Bitmap",
">",
"imageAttachments",
")",
"{",
"Validate",
".",
"notNull",
"(",
"context",
",",
"\"context\"",
")",
";",
"Validate",
".... | Adds a number of bitmap attachments associated with a native app call. The attachments will be
served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
@param context the Context the call is being made from
@param callId the unique ID of the call
@param imageAttachments a Map of attachment names to Bitmaps; the attachment names will be part of
the URI processed by openFile
@throws java.io.IOException | [
"Adds",
"a",
"number",
"of",
"bitmap",
"attachments",
"associated",
"with",
"a",
"native",
"app",
"call",
".",
"The",
"attachments",
"will",
"be",
"served",
"via",
"{",
"@link",
"NativeAppCallContentProvider#openFile",
"(",
"android",
".",
"net",
".",
"Uri",
"... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/NativeAppCallAttachmentStore.java#L59-L76 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSphere3F.java | AbstractSphere3F.containsSphereAlignedBox | @Pure
public static boolean containsSphereAlignedBox(
double cx, double cy, double cz, double radius,
double bx, double by, double bz, double bsx, double bsy, double bsz) {
double rcx = (bx + bsx/2f);
double rcy = (by + bsy/2f);
double rcz = (bz + bsz/2f);
double farX;
if (cx<=rcx) farX = bx + bsx;
else farX = bx;
double farY;
if (cy<=rcy) farY = by + bsy;
else farY = by;
double farZ;
if (cz<=rcz) farZ = bz + bsz;
else farZ = bz;
return containsSpherePoint(cx, cy, cz, radius, farX, farY, farZ);
} | java | @Pure
public static boolean containsSphereAlignedBox(
double cx, double cy, double cz, double radius,
double bx, double by, double bz, double bsx, double bsy, double bsz) {
double rcx = (bx + bsx/2f);
double rcy = (by + bsy/2f);
double rcz = (bz + bsz/2f);
double farX;
if (cx<=rcx) farX = bx + bsx;
else farX = bx;
double farY;
if (cy<=rcy) farY = by + bsy;
else farY = by;
double farZ;
if (cz<=rcz) farZ = bz + bsz;
else farZ = bz;
return containsSpherePoint(cx, cy, cz, radius, farX, farY, farZ);
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"containsSphereAlignedBox",
"(",
"double",
"cx",
",",
"double",
"cy",
",",
"double",
"cz",
",",
"double",
"radius",
",",
"double",
"bx",
",",
"double",
"by",
",",
"double",
"bz",
",",
"double",
"bsx",
",",
"dou... | Replies if an aligned box is inside in the sphere.
@param cx is the center of the sphere.
@param cy is the center of the sphere.
@param cz is the center of the sphere.
@param radius is the radius of the sphere.
@param bx is the lowest corner of the box.
@param by is the lowest corner of the box.
@param bz is the lowest corner of the box.
@param bsx is the X size of the box.
@param bsy is the Y size of the box.
@param bsz is the Z size of the box.
@return <code>true</code> if the given box is inside the sphere;
otherwise <code>false</code>. | [
"Replies",
"if",
"an",
"aligned",
"box",
"is",
"inside",
"in",
"the",
"sphere",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSphere3F.java#L414-L431 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/AStarPathFinder.java | AStarPathFinder.isValidLocation | protected boolean isValidLocation(Mover mover, int sx, int sy, int x, int y) {
boolean invalid = (x < 0) || (y < 0) || (x >= map.getWidthInTiles()) || (y >= map.getHeightInTiles());
if ((!invalid) && ((sx != x) || (sy != y))) {
this.mover = mover;
this.sourceX = sx;
this.sourceY = sy;
invalid = map.blocked(this, x, y);
}
return !invalid;
} | java | protected boolean isValidLocation(Mover mover, int sx, int sy, int x, int y) {
boolean invalid = (x < 0) || (y < 0) || (x >= map.getWidthInTiles()) || (y >= map.getHeightInTiles());
if ((!invalid) && ((sx != x) || (sy != y))) {
this.mover = mover;
this.sourceX = sx;
this.sourceY = sy;
invalid = map.blocked(this, x, y);
}
return !invalid;
} | [
"protected",
"boolean",
"isValidLocation",
"(",
"Mover",
"mover",
",",
"int",
"sx",
",",
"int",
"sy",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"boolean",
"invalid",
"=",
"(",
"x",
"<",
"0",
")",
"||",
"(",
"y",
"<",
"0",
")",
"||",
"(",
"x",... | Check if a given location is valid for the supplied mover
@param mover The mover that would hold a given location
@param sx The starting x coordinate
@param sy The starting y coordinate
@param x The x coordinate of the location to check
@param y The y coordinate of the location to check
@return True if the location is valid for the given mover | [
"Check",
"if",
"a",
"given",
"location",
"is",
"valid",
"for",
"the",
"supplied",
"mover"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/AStarPathFinder.java#L317-L328 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/DynamicFactory.java | DynamicFactory.ofClass | public <T extends ICDKObject> T ofClass(Class<T> intf) {
try {
if (!intf.isInterface()) throw new IllegalArgumentException("expected interface, got " + intf.getClass());
Creator<T> creator = get(new ClassBasedKey(intf, EMPTY_CLASS_ARRAY));
return creator.create(null); // throws an exception if no impl was found
} catch (InstantiationException e) {
throw new IllegalArgumentException("unable to instantiate chem object: ", e);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("constructor is not accessible: ", e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException("invocation target exception: ", e);
}
} | java | public <T extends ICDKObject> T ofClass(Class<T> intf) {
try {
if (!intf.isInterface()) throw new IllegalArgumentException("expected interface, got " + intf.getClass());
Creator<T> creator = get(new ClassBasedKey(intf, EMPTY_CLASS_ARRAY));
return creator.create(null); // throws an exception if no impl was found
} catch (InstantiationException e) {
throw new IllegalArgumentException("unable to instantiate chem object: ", e);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("constructor is not accessible: ", e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException("invocation target exception: ", e);
}
} | [
"public",
"<",
"T",
"extends",
"ICDKObject",
">",
"T",
"ofClass",
"(",
"Class",
"<",
"T",
">",
"intf",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"intf",
".",
"isInterface",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expected interface... | Construct an implementation using the default constructor. This provides
some speed boost over invoking {@link #ofClass(Class, Object...)}.
@param intf the interface to construct an instance of
@param <T> the type of the class
@return an implementation of provided interface constructed using the
default constructor.
@throws IllegalArgumentException thrown if the implementation can not be
constructed
@throws IllegalArgumentException thrown if the provided class is not an
interface | [
"Construct",
"an",
"implementation",
"using",
"the",
"default",
"constructor",
".",
"This",
"provides",
"some",
"speed",
"boost",
"over",
"invoking",
"{",
"@link",
"#ofClass",
"(",
"Class",
"Object",
"...",
")",
"}",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/DynamicFactory.java#L544-L561 |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java | PlayerStatsService.retrievePlayerStatsByAccountId | public PlayerLifetimeStats retrievePlayerStatsByAccountId(long accountId, Season season) {
return client.sendRpcAndWait(SERVICE, "retrievePlayerStatsByAccountId", accountId, season);
} | java | public PlayerLifetimeStats retrievePlayerStatsByAccountId(long accountId, Season season) {
return client.sendRpcAndWait(SERVICE, "retrievePlayerStatsByAccountId", accountId, season);
} | [
"public",
"PlayerLifetimeStats",
"retrievePlayerStatsByAccountId",
"(",
"long",
"accountId",
",",
"Season",
"season",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"retrievePlayerStatsByAccountId\"",
",",
"accountId",
",",
"season",
")",
... | Retrieve player stats
@param accountId The player's id
@param season The target season
@return Player stats | [
"Retrieve",
"player",
"stats"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java#L53-L55 |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java | StorageWriter.checkFreeDiskSpace | private void checkFreeDiskSpace(List<File> inputFiles) {
//Check for free space
long usableSpace = 0;
long totalSize = 0;
for (File f : inputFiles) {
if (f.exists()) {
totalSize += f.length();
usableSpace = f.getUsableSpace();
}
}
LOGGER.log(Level.INFO, "Total expected store size is {0} Mb",
new DecimalFormat("#,##0.0").format(totalSize / (1024 * 1024)));
LOGGER.log(Level.INFO, "Usable free space on the system is {0} Mb",
new DecimalFormat("#,##0.0").format(usableSpace / (1024 * 1024)));
if (totalSize / (double) usableSpace >= 0.66) {
throw new RuntimeException("Aborting because there isn' enough free disk space");
}
} | java | private void checkFreeDiskSpace(List<File> inputFiles) {
//Check for free space
long usableSpace = 0;
long totalSize = 0;
for (File f : inputFiles) {
if (f.exists()) {
totalSize += f.length();
usableSpace = f.getUsableSpace();
}
}
LOGGER.log(Level.INFO, "Total expected store size is {0} Mb",
new DecimalFormat("#,##0.0").format(totalSize / (1024 * 1024)));
LOGGER.log(Level.INFO, "Usable free space on the system is {0} Mb",
new DecimalFormat("#,##0.0").format(usableSpace / (1024 * 1024)));
if (totalSize / (double) usableSpace >= 0.66) {
throw new RuntimeException("Aborting because there isn' enough free disk space");
}
} | [
"private",
"void",
"checkFreeDiskSpace",
"(",
"List",
"<",
"File",
">",
"inputFiles",
")",
"{",
"//Check for free space",
"long",
"usableSpace",
"=",
"0",
";",
"long",
"totalSize",
"=",
"0",
";",
"for",
"(",
"File",
"f",
":",
"inputFiles",
")",
"{",
"if",
... | Fail if the size of the expected store file exceed 2/3rd of the free disk space | [
"Fail",
"if",
"the",
"size",
"of",
"the",
"expected",
"store",
"file",
"exceed",
"2",
"/",
"3rd",
"of",
"the",
"free",
"disk",
"space"
] | train | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java#L365-L382 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MCsvWriter.java | MCsvWriter.formatCsv | protected String formatCsv(final String text, final char csvSeparator) {
String result = text;
if (result.indexOf('\n') != -1) {
// le retour chariot fonctionne dans les dernières versions d'excel entre des doubles quotes
// mais il ne fonctionne pas dans OpenOffice 1.1.2
result = result.replace('\n', ' ');
}
int index = result.indexOf('"');
while (index != -1) {
// on double les double-quote pour csv (non performant mais rare)
result = new StringBuilder(result).insert(index, '"').toString();
index = result.indexOf('"', index + 2);
}
if (text.indexOf(csvSeparator) != -1 || text.indexOf('"') != -1) {
final String tmp = '"' + result + '"';
result = tmp;
}
return result;
} | java | protected String formatCsv(final String text, final char csvSeparator) {
String result = text;
if (result.indexOf('\n') != -1) {
// le retour chariot fonctionne dans les dernières versions d'excel entre des doubles quotes
// mais il ne fonctionne pas dans OpenOffice 1.1.2
result = result.replace('\n', ' ');
}
int index = result.indexOf('"');
while (index != -1) {
// on double les double-quote pour csv (non performant mais rare)
result = new StringBuilder(result).insert(index, '"').toString();
index = result.indexOf('"', index + 2);
}
if (text.indexOf(csvSeparator) != -1 || text.indexOf('"') != -1) {
final String tmp = '"' + result + '"';
result = tmp;
}
return result;
} | [
"protected",
"String",
"formatCsv",
"(",
"final",
"String",
"text",
",",
"final",
"char",
"csvSeparator",
")",
"{",
"String",
"result",
"=",
"text",
";",
"if",
"(",
"result",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"{",
"// le retour c... | Encode un texte pour l'export au format csv ou csv local.
@return String
@param text
String
@param csvSeparator
char | [
"Encode",
"un",
"texte",
"pour",
"l",
"export",
"au",
"format",
"csv",
"ou",
"csv",
"local",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MCsvWriter.java#L84-L102 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasAsset.java | BaasAsset.fetchData | public static RequestToken fetchData(String id, int flags, BaasHandler<JsonObject> handler){
if(id==null) throw new IllegalArgumentException("asset id cannot be null");
BaasBox box = BaasBox.getDefaultChecked();
AssetDataRequest req = new AssetDataRequest(box,id,flags,handler);
return box.submitAsync(req);
} | java | public static RequestToken fetchData(String id, int flags, BaasHandler<JsonObject> handler){
if(id==null) throw new IllegalArgumentException("asset id cannot be null");
BaasBox box = BaasBox.getDefaultChecked();
AssetDataRequest req = new AssetDataRequest(box,id,flags,handler);
return box.submitAsync(req);
} | [
"public",
"static",
"RequestToken",
"fetchData",
"(",
"String",
"id",
",",
"int",
"flags",
",",
"BaasHandler",
"<",
"JsonObject",
">",
"handler",
")",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"asset id cannot ... | Asynchronously retrieves named assets data,
If the named asset is a document, the document is retrieved
otherwise attached data to the file are returned.
@param id the name of the asset
@param flags used for the request a bit or of {@link RequestOptions} constants
@param handler an handler that will be handed the response
@return a request token | [
"Asynchronously",
"retrieves",
"named",
"assets",
"data",
"If",
"the",
"named",
"asset",
"is",
"a",
"document",
"the",
"document",
"is",
"retrieved",
"otherwise",
"attached",
"data",
"to",
"the",
"file",
"are",
"returned",
"."
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasAsset.java#L55-L60 |
jqm4gwt/jqm4gwt | library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java | JQMForm.validate | protected boolean validate(Validator validator, UIObject ui) {
if (notifiedWidgets.containsKey(validator))
ui = notifiedWidgets.get(validator);
String msg = validator.validate();
if (msg == null || msg.length() == 0) {
validationStyles(validator, null, ui, true);
return true;
} else {
validationStyles(validator, msg, ui, false);
return false;
}
} | java | protected boolean validate(Validator validator, UIObject ui) {
if (notifiedWidgets.containsKey(validator))
ui = notifiedWidgets.get(validator);
String msg = validator.validate();
if (msg == null || msg.length() == 0) {
validationStyles(validator, null, ui, true);
return true;
} else {
validationStyles(validator, msg, ui, false);
return false;
}
} | [
"protected",
"boolean",
"validate",
"(",
"Validator",
"validator",
",",
"UIObject",
"ui",
")",
"{",
"if",
"(",
"notifiedWidgets",
".",
"containsKey",
"(",
"validator",
")",
")",
"ui",
"=",
"notifiedWidgets",
".",
"get",
"(",
"validator",
")",
";",
"String",
... | Perform validation for a single validator
@param ui the {@link UIObject} to change the stylesheet on
@return true if this validator was successfully applied or false otherwise | [
"Perform",
"validation",
"for",
"a",
"single",
"validator"
] | train | https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/JQMForm.java#L578-L591 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Collectors.java | Collectors.summingLong | @NotNull
public static <T> Collector<T, ?, Long> summingLong(@NotNull final ToLongFunction<? super T> mapper) {
return new CollectorsImpl<T, long[], Long>(
LONG_2ELEMENTS_ARRAY_SUPPLIER,
new BiConsumer<long[], T>() {
@Override
public void accept(long[] t, T u) {
t[0] += mapper.applyAsLong(u);
}
},
new Function<long[], Long>() {
@Override
public Long apply(long[] value) {
return value[0];
}
}
);
} | java | @NotNull
public static <T> Collector<T, ?, Long> summingLong(@NotNull final ToLongFunction<? super T> mapper) {
return new CollectorsImpl<T, long[], Long>(
LONG_2ELEMENTS_ARRAY_SUPPLIER,
new BiConsumer<long[], T>() {
@Override
public void accept(long[] t, T u) {
t[0] += mapper.applyAsLong(u);
}
},
new Function<long[], Long>() {
@Override
public Long apply(long[] value) {
return value[0];
}
}
);
} | [
"@",
"NotNull",
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Long",
">",
"summingLong",
"(",
"@",
"NotNull",
"final",
"ToLongFunction",
"<",
"?",
"super",
"T",
">",
"mapper",
")",
"{",
"return",
"new",
"CollectorsImpl",
"<"... | Returns a {@code Collector} that summing long-valued input elements.
@param <T> the type of the input elements
@param mapper the mapping function which extracts value from element to calculate result
@return a {@code Collector}
@since 1.1.3 | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"that",
"summing",
"long",
"-",
"valued",
"input",
"elements",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L613-L633 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.getIteratorByQuery | public Iterator getIteratorByQuery(Query query) throws PersistenceBrokerException
{
Class itemClass = query.getSearchClass();
ClassDescriptor cld = getClassDescriptor(itemClass);
return getIteratorFromQuery(query, cld);
} | java | public Iterator getIteratorByQuery(Query query) throws PersistenceBrokerException
{
Class itemClass = query.getSearchClass();
ClassDescriptor cld = getClassDescriptor(itemClass);
return getIteratorFromQuery(query, cld);
} | [
"public",
"Iterator",
"getIteratorByQuery",
"(",
"Query",
"query",
")",
"throws",
"PersistenceBrokerException",
"{",
"Class",
"itemClass",
"=",
"query",
".",
"getSearchClass",
"(",
")",
";",
"ClassDescriptor",
"cld",
"=",
"getClassDescriptor",
"(",
"itemClass",
")",... | returns an Iterator that iterates Objects of class c if calling the .next()
method. The Elements returned come from a SELECT ... WHERE Statement
that is defined by the Query query.
If itemProxy is null, no proxies are used. | [
"returns",
"an",
"Iterator",
"that",
"iterates",
"Objects",
"of",
"class",
"c",
"if",
"calling",
"the",
".",
"next",
"()",
"method",
".",
"The",
"Elements",
"returned",
"come",
"from",
"a",
"SELECT",
"...",
"WHERE",
"Statement",
"that",
"is",
"defined",
"b... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1651-L1656 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java | QuorumJournalManager.saveDigestAndRenameCheckpointImage | @Override
public boolean saveDigestAndRenameCheckpointImage(long txid, MD5Hash digest) {
try {
LOG.info("Saving md5: " + digest + " for txid: " + txid);
QuorumCall<AsyncLogger, Void> q = loggers
.saveDigestAndRenameCheckpointImage(txid, digest);
loggers.waitForWriteQuorum(q, writeTxnsTimeoutMs,
"saveDigestAndRenameCheckpointImage(" + txid + ")");
return true;
} catch (IOException e) {
LOG.error("Exception when rolling the image:", e);
return false;
}
} | java | @Override
public boolean saveDigestAndRenameCheckpointImage(long txid, MD5Hash digest) {
try {
LOG.info("Saving md5: " + digest + " for txid: " + txid);
QuorumCall<AsyncLogger, Void> q = loggers
.saveDigestAndRenameCheckpointImage(txid, digest);
loggers.waitForWriteQuorum(q, writeTxnsTimeoutMs,
"saveDigestAndRenameCheckpointImage(" + txid + ")");
return true;
} catch (IOException e) {
LOG.error("Exception when rolling the image:", e);
return false;
}
} | [
"@",
"Override",
"public",
"boolean",
"saveDigestAndRenameCheckpointImage",
"(",
"long",
"txid",
",",
"MD5Hash",
"digest",
")",
"{",
"try",
"{",
"LOG",
".",
"info",
"(",
"\"Saving md5: \"",
"+",
"digest",
"+",
"\" for txid: \"",
"+",
"txid",
")",
";",
"QuorumC... | Roll image and save md5 digest to the underlying nodes. This is a quorum
roll, and we ensure that it can succeed only on the nodes that consumed
entirely the uploaded image. | [
"Roll",
"image",
"and",
"save",
"md5",
"digest",
"to",
"the",
"underlying",
"nodes",
".",
"This",
"is",
"a",
"quorum",
"roll",
"and",
"we",
"ensure",
"that",
"it",
"can",
"succeed",
"only",
"on",
"the",
"nodes",
"that",
"consumed",
"entirely",
"the",
"up... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L682-L695 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.isInnerSubClass | private boolean isInnerSubClass(ClassSymbol c, Symbol base) {
while (c != null && !c.isSubClass(base, types)) {
c = c.owner.enclClass();
}
return c != null;
} | java | private boolean isInnerSubClass(ClassSymbol c, Symbol base) {
while (c != null && !c.isSubClass(base, types)) {
c = c.owner.enclClass();
}
return c != null;
} | [
"private",
"boolean",
"isInnerSubClass",
"(",
"ClassSymbol",
"c",
",",
"Symbol",
"base",
")",
"{",
"while",
"(",
"c",
"!=",
"null",
"&&",
"!",
"c",
".",
"isSubClass",
"(",
"base",
",",
"types",
")",
")",
"{",
"c",
"=",
"c",
".",
"owner",
".",
"encl... | Is given class a subclass of given base class, or an inner class
of a subclass?
Return null if no such class exists.
@param c The class which is the subclass or is contained in it.
@param base The base class | [
"Is",
"given",
"class",
"a",
"subclass",
"of",
"given",
"base",
"class",
"or",
"an",
"inner",
"class",
"of",
"a",
"subclass?",
"Return",
"null",
"if",
"no",
"such",
"class",
"exists",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L365-L370 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/SpriteSheet.java | SpriteSheet.getSubImage | public Image getSubImage(int x, int y) {
init();
if ((x < 0) || (x >= subImages.length)) {
throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y);
}
if ((y < 0) || (y >= subImages[0].length)) {
throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y);
}
return subImages[x][y];
} | java | public Image getSubImage(int x, int y) {
init();
if ((x < 0) || (x >= subImages.length)) {
throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y);
}
if ((y < 0) || (y >= subImages[0].length)) {
throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y);
}
return subImages[x][y];
} | [
"public",
"Image",
"getSubImage",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"init",
"(",
")",
";",
"if",
"(",
"(",
"x",
"<",
"0",
")",
"||",
"(",
"x",
">=",
"subImages",
".",
"length",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"... | Get the sub image cached in this sprite sheet
@param x The x position in tiles of the image to get
@param y The y position in tiles of the image to get
@return The subimage at that location on the sheet | [
"Get",
"the",
"sub",
"image",
"cached",
"in",
"this",
"sprite",
"sheet"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/SpriteSheet.java#L198-L209 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/job/InstallRequest.java | InstallRequest.setExtensionProperty | public Object setExtensionProperty(String key, Object value)
{
return getExtensionProperties().put(key, value);
} | java | public Object setExtensionProperty(String key, Object value)
{
return getExtensionProperties().put(key, value);
} | [
"public",
"Object",
"setExtensionProperty",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"return",
"getExtensionProperties",
"(",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Sets a custom extension property to be set on each of the extensions that are going to be installed from this
request.
@param key the property name
@param value the new property value
@return the previous property value
@since 7.0M2 | [
"Sets",
"a",
"custom",
"extension",
"property",
"to",
"be",
"set",
"on",
"each",
"of",
"the",
"extensions",
"that",
"are",
"going",
"to",
"be",
"installed",
"from",
"this",
"request",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/job/InstallRequest.java#L84-L87 |
zxing/zxing | core/src/main/java/com/google/zxing/pdf417/encoder/PDF417.java | PDF417.setDimensions | public void setDimensions(int maxCols, int minCols, int maxRows, int minRows) {
this.maxCols = maxCols;
this.minCols = minCols;
this.maxRows = maxRows;
this.minRows = minRows;
} | java | public void setDimensions(int maxCols, int minCols, int maxRows, int minRows) {
this.maxCols = maxCols;
this.minCols = minCols;
this.maxRows = maxRows;
this.minRows = minRows;
} | [
"public",
"void",
"setDimensions",
"(",
"int",
"maxCols",
",",
"int",
"minCols",
",",
"int",
"maxRows",
",",
"int",
"minRows",
")",
"{",
"this",
".",
"maxCols",
"=",
"maxCols",
";",
"this",
".",
"minCols",
"=",
"minCols",
";",
"this",
".",
"maxRows",
"... | Sets max/min row/col values
@param maxCols maximum allowed columns
@param minCols minimum allowed columns
@param maxRows maximum allowed rows
@param minRows minimum allowed rows | [
"Sets",
"max",
"/",
"min",
"row",
"/",
"col",
"values"
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/encoder/PDF417.java#L739-L744 |
CleverTap/clevertap-android-sdk | clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DataHandler.java | DataHandler.pushGcmRegistrationId | @Deprecated
public void pushGcmRegistrationId(String gcmId, boolean register) {
CleverTapAPI cleverTapAPI = weakReference.get();
if (cleverTapAPI == null) {
Logger.d("CleverTap Instance is null.");
} else {
cleverTapAPI.pushGcmRegistrationId(gcmId, register);
}
} | java | @Deprecated
public void pushGcmRegistrationId(String gcmId, boolean register) {
CleverTapAPI cleverTapAPI = weakReference.get();
if (cleverTapAPI == null) {
Logger.d("CleverTap Instance is null.");
} else {
cleverTapAPI.pushGcmRegistrationId(gcmId, register);
}
} | [
"@",
"Deprecated",
"public",
"void",
"pushGcmRegistrationId",
"(",
"String",
"gcmId",
",",
"boolean",
"register",
")",
"{",
"CleverTapAPI",
"cleverTapAPI",
"=",
"weakReference",
".",
"get",
"(",
")",
";",
"if",
"(",
"cleverTapAPI",
"==",
"null",
")",
"{",
"L... | Sends the GCM registration ID to CleverTap.
@param gcmId The GCM registration ID
@param register Boolean indicating whether to register
or not for receiving push messages from CleverTap.
Set this to true to receive push messages from CleverTap,
and false to not receive any messages from CleverTap.
@deprecated use {@link CleverTapAPI#pushGcmRegistrationId(String gcmId, boolean register)} | [
"Sends",
"the",
"GCM",
"registration",
"ID",
"to",
"CleverTap",
"."
] | train | https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DataHandler.java#L23-L31 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/managers/GuildController.java | GuildController.createRole | @CheckReturnValue
public RoleAction createRole()
{
checkPermission(Permission.MANAGE_ROLES);
Route.CompiledRoute route = Route.Roles.CREATE_ROLE.compile(getGuild().getId());
return new RoleAction(route, getGuild());
} | java | @CheckReturnValue
public RoleAction createRole()
{
checkPermission(Permission.MANAGE_ROLES);
Route.CompiledRoute route = Route.Roles.CREATE_ROLE.compile(getGuild().getId());
return new RoleAction(route, getGuild());
} | [
"@",
"CheckReturnValue",
"public",
"RoleAction",
"createRole",
"(",
")",
"{",
"checkPermission",
"(",
"Permission",
".",
"MANAGE_ROLES",
")",
";",
"Route",
".",
"CompiledRoute",
"route",
"=",
"Route",
".",
"Roles",
".",
"CREATE_ROLE",
".",
"compile",
"(",
"get... | Creates a new {@link net.dv8tion.jda.core.entities.Role Role} in this Guild.
<br>It will be placed at the bottom (just over the Public Role) to avoid permission hierarchy conflicts.
<br>For this to be successful, the logged in account has to have the {@link net.dv8tion.jda.core.Permission#MANAGE_ROLES MANAGE_ROLES} Permission
<p>Possible {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} caused by
the returned {@link net.dv8tion.jda.core.requests.RestAction RestAction} include the following:
<ul>
<li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS}
<br>The role could not be created due to a permission discrepancy</li>
<li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS}
<br>We were removed from the Guild before finishing the task</li>
<li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MAX_ROLES_PER_GUILD MAX_ROLES_PER_GUILD}
<br>There are too many roles in this Guild</li>
</ul>
@throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException
If the logged in account does not have the {@link net.dv8tion.jda.core.Permission#MANAGE_ROLES} Permission
@return {@link net.dv8tion.jda.core.requests.restaction.RoleAction RoleAction}
<br>Creates a new role with previously selected field values | [
"Creates",
"a",
"new",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"entities",
".",
"Role",
"Role",
"}",
"in",
"this",
"Guild",
".",
"<br",
">",
"It",
"will",
"be",
"placed",
"at",
"the",
"bottom",
"(",
"just",
"over",
"the",... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/managers/GuildController.java#L1920-L1927 |
infinispan/infinispan | core/src/main/java/org/infinispan/factories/InternalCacheFactory.java | InternalCacheFactory.createCache | public Cache<K, V> createCache(Configuration configuration, GlobalComponentRegistry globalComponentRegistry,
String cacheName) throws CacheConfigurationException {
try {
if (configuration.compatibility().enabled()) {
log.warnCompatibilityDeprecated(cacheName);
}
if (configuration.simpleCache()) {
return createSimpleCache(configuration, globalComponentRegistry, cacheName);
} else {
return createAndWire(configuration, globalComponentRegistry, cacheName);
}
} catch (RuntimeException re) {
throw re;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public Cache<K, V> createCache(Configuration configuration, GlobalComponentRegistry globalComponentRegistry,
String cacheName) throws CacheConfigurationException {
try {
if (configuration.compatibility().enabled()) {
log.warnCompatibilityDeprecated(cacheName);
}
if (configuration.simpleCache()) {
return createSimpleCache(configuration, globalComponentRegistry, cacheName);
} else {
return createAndWire(configuration, globalComponentRegistry, cacheName);
}
} catch (RuntimeException re) {
throw re;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"Cache",
"<",
"K",
",",
"V",
">",
"createCache",
"(",
"Configuration",
"configuration",
",",
"GlobalComponentRegistry",
"globalComponentRegistry",
",",
"String",
"cacheName",
")",
"throws",
"CacheConfigurationException",
"{",
"try",
"{",
"if",
"(",
"config... | This implementation clones the configuration passed in before using it.
@param configuration to use
@param globalComponentRegistry global component registry to attach the cache to
@param cacheName name of the cache
@return a cache
@throws CacheConfigurationException if there are problems with the cfg | [
"This",
"implementation",
"clones",
"the",
"configuration",
"passed",
"in",
"before",
"using",
"it",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/factories/InternalCacheFactory.java#L83-L99 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_debt_operation_operationId_GET | public OvhOperation order_orderId_debt_operation_operationId_GET(Long orderId, Long operationId) throws IOException {
String qPath = "/me/order/{orderId}/debt/operation/{operationId}";
StringBuilder sb = path(qPath, orderId, operationId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOperation.class);
} | java | public OvhOperation order_orderId_debt_operation_operationId_GET(Long orderId, Long operationId) throws IOException {
String qPath = "/me/order/{orderId}/debt/operation/{operationId}";
StringBuilder sb = path(qPath, orderId, operationId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOperation.class);
} | [
"public",
"OvhOperation",
"order_orderId_debt_operation_operationId_GET",
"(",
"Long",
"orderId",
",",
"Long",
"operationId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/debt/operation/{operationId}\"",
";",
"StringBuilder",
"sb",
"=",
... | Get this object properties
REST: GET /me/order/{orderId}/debt/operation/{operationId}
@param orderId [required]
@param operationId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2001-L2006 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java | MerkleTreeUtil.getLeftMostLeafUnderNode | static int getLeftMostLeafUnderNode(int nodeOrder, int depth) {
if (isLeaf(nodeOrder, depth)) {
return nodeOrder;
}
int leafLevel = depth - 1;
int levelOfNode = getLevelOfNode(nodeOrder);
int distanceFromLeafLevel = depth - levelOfNode - 1;
int leftMostNodeOrderOnLevel = getLeftMostNodeOrderOnLevel(levelOfNode);
int relativeLevelOrder = nodeOrder - leftMostNodeOrderOnLevel;
int leftMostLeaf = getLeftMostNodeOrderOnLevel(leafLevel);
return leftMostLeaf + (2 << distanceFromLeafLevel - 1) * relativeLevelOrder;
} | java | static int getLeftMostLeafUnderNode(int nodeOrder, int depth) {
if (isLeaf(nodeOrder, depth)) {
return nodeOrder;
}
int leafLevel = depth - 1;
int levelOfNode = getLevelOfNode(nodeOrder);
int distanceFromLeafLevel = depth - levelOfNode - 1;
int leftMostNodeOrderOnLevel = getLeftMostNodeOrderOnLevel(levelOfNode);
int relativeLevelOrder = nodeOrder - leftMostNodeOrderOnLevel;
int leftMostLeaf = getLeftMostNodeOrderOnLevel(leafLevel);
return leftMostLeaf + (2 << distanceFromLeafLevel - 1) * relativeLevelOrder;
} | [
"static",
"int",
"getLeftMostLeafUnderNode",
"(",
"int",
"nodeOrder",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"isLeaf",
"(",
"nodeOrder",
",",
"depth",
")",
")",
"{",
"return",
"nodeOrder",
";",
"}",
"int",
"leafLevel",
"=",
"depth",
"-",
"1",
";",
"... | Returns the breadth-first order of the leftmost leaf in the
subtree selected by {@code nodeOrder} as the root of the subtree
@param nodeOrder The order of the node as the root of the subtree
@param depth The depth of the tree
@return the breadth-first order of the leftmost leaf under the
provided node | [
"Returns",
"the",
"breadth",
"-",
"first",
"order",
"of",
"the",
"leftmost",
"leaf",
"in",
"the",
"subtree",
"selected",
"by",
"{",
"@code",
"nodeOrder",
"}",
"as",
"the",
"root",
"of",
"the",
"subtree"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java#L270-L283 |
qspin/qtaste | plugins_src/javagui/src/main/java/com/qspin/qtaste/javagui/server/ComponentCommander.java | ComponentCommander.lookForComponent | protected Component lookForComponent(String name, Component[] components) {
for (int i = 0; i < components.length && !mFindWithEqual; i++) {
//String componentName = ComponentNamer.getInstance().getNameForComponent(components[c]);
Component c = components[i];
checkName(name, c);
if (!mFindWithEqual) {
if (c instanceof Container) {
Component result = lookForComponent(name, ((Container) c).getComponents());
if (result != null) {
return result;
}
}
}
}
return null;
} | java | protected Component lookForComponent(String name, Component[] components) {
for (int i = 0; i < components.length && !mFindWithEqual; i++) {
//String componentName = ComponentNamer.getInstance().getNameForComponent(components[c]);
Component c = components[i];
checkName(name, c);
if (!mFindWithEqual) {
if (c instanceof Container) {
Component result = lookForComponent(name, ((Container) c).getComponents());
if (result != null) {
return result;
}
}
}
}
return null;
} | [
"protected",
"Component",
"lookForComponent",
"(",
"String",
"name",
",",
"Component",
"[",
"]",
"components",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"components",
".",
"length",
"&&",
"!",
"mFindWithEqual",
";",
"i",
"++",
")",
"{"... | Browses recursively the components in order to find components with the name.
@param name the component's name.
@param components components to browse.
@return the first component with the name. | [
"Browses",
"recursively",
"the",
"components",
"in",
"order",
"to",
"find",
"components",
"with",
"the",
"name",
"."
] | train | https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/plugins_src/javagui/src/main/java/com/qspin/qtaste/javagui/server/ComponentCommander.java#L97-L112 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java | AutoRegisterActionServlet.ensureModuleRegistered | public ModuleConfig ensureModuleRegistered( String modulePath, ServletRequest request )
throws IOException, ServletException
{
return ensureModuleRegistered(modulePath);
} | java | public ModuleConfig ensureModuleRegistered( String modulePath, ServletRequest request )
throws IOException, ServletException
{
return ensureModuleRegistered(modulePath);
} | [
"public",
"ModuleConfig",
"ensureModuleRegistered",
"(",
"String",
"modulePath",
",",
"ServletRequest",
"request",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"return",
"ensureModuleRegistered",
"(",
"modulePath",
")",
";",
"}"
] | Ensures that the Struts module for the given path is registered (dynamically, if necessary).
@deprecated Use #ensureModuleRegistered(String) instead.
@param modulePath the module path, from the request URI.
@param request the current ServletRequest
@throws IOException
@throws ServletException | [
"Ensures",
"that",
"the",
"Struts",
"module",
"for",
"the",
"given",
"path",
"is",
"registered",
"(",
"dynamically",
"if",
"necessary",
")",
".",
"@deprecated",
"Use",
"#ensureModuleRegistered",
"(",
"String",
")",
"instead",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java#L739-L743 |
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java | CachingXmlDataStore.isEmpty | private static boolean isEmpty(@Nonnull final File file, @Nonnull final Charset charset) {
try {
return FileUtil.isEmpty(file, charset);
} catch (final IOException e) {
throw new IllegalStateOfArgumentException("The given file could not be read.", e);
}
} | java | private static boolean isEmpty(@Nonnull final File file, @Nonnull final Charset charset) {
try {
return FileUtil.isEmpty(file, charset);
} catch (final IOException e) {
throw new IllegalStateOfArgumentException("The given file could not be read.", e);
}
} | [
"private",
"static",
"boolean",
"isEmpty",
"(",
"@",
"Nonnull",
"final",
"File",
"file",
",",
"@",
"Nonnull",
"final",
"Charset",
"charset",
")",
"{",
"try",
"{",
"return",
"FileUtil",
".",
"isEmpty",
"(",
"file",
",",
"charset",
")",
";",
"}",
"catch",
... | Checks if the given file is empty.
@param file
the file that could be empty
@return {@code true} when the file is accessible and empty otherwise {@code false}
@throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException
if an I/O error occurs | [
"Checks",
"if",
"the",
"given",
"file",
"is",
"empty",
"."
] | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java#L262-L268 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/preference/DiSHPreferenceVectorIndex.java | DiSHPreferenceVectorIndex.determinePreferenceVector | private long[] determinePreferenceVector(Relation<V> relation, ModifiableDBIDs[] neighborIDs, StringBuilder msg) {
if(strategy.equals(Strategy.APRIORI)) {
return determinePreferenceVectorByApriori(relation, neighborIDs, msg);
}
if(strategy.equals(Strategy.MAX_INTERSECTION)) {
return determinePreferenceVectorByMaxIntersection(neighborIDs, msg);
}
throw new IllegalStateException("Should never happen!");
} | java | private long[] determinePreferenceVector(Relation<V> relation, ModifiableDBIDs[] neighborIDs, StringBuilder msg) {
if(strategy.equals(Strategy.APRIORI)) {
return determinePreferenceVectorByApriori(relation, neighborIDs, msg);
}
if(strategy.equals(Strategy.MAX_INTERSECTION)) {
return determinePreferenceVectorByMaxIntersection(neighborIDs, msg);
}
throw new IllegalStateException("Should never happen!");
} | [
"private",
"long",
"[",
"]",
"determinePreferenceVector",
"(",
"Relation",
"<",
"V",
">",
"relation",
",",
"ModifiableDBIDs",
"[",
"]",
"neighborIDs",
",",
"StringBuilder",
"msg",
")",
"{",
"if",
"(",
"strategy",
".",
"equals",
"(",
"Strategy",
".",
"APRIORI... | Determines the preference vector according to the specified neighbor ids.
@param relation the database storing the objects
@param neighborIDs the list of ids of the neighbors in each dimension
@param msg a string buffer for debug messages
@return the preference vector | [
"Determines",
"the",
"preference",
"vector",
"according",
"to",
"the",
"specified",
"neighbor",
"ids",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/preference/DiSHPreferenceVectorIndex.java#L197-L205 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java | SynchronousRequest.getContinentFloorInfo | public List<ContinentFloor> getContinentFloorInfo(int continentID, int[] ids) throws GuildWars2Exception {
isParamValid(new ParamChecker(ids));
try {
Response<List<ContinentFloor>> response = gw2API.getContinentFloorInfo(Integer.toString(continentID), processIds(ids), GuildWars2.lang.getValue()).execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | java | public List<ContinentFloor> getContinentFloorInfo(int continentID, int[] ids) throws GuildWars2Exception {
isParamValid(new ParamChecker(ids));
try {
Response<List<ContinentFloor>> response = gw2API.getContinentFloorInfo(Integer.toString(continentID), processIds(ids), GuildWars2.lang.getValue()).execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | [
"public",
"List",
"<",
"ContinentFloor",
">",
"getContinentFloorInfo",
"(",
"int",
"continentID",
",",
"int",
"[",
"]",
"ids",
")",
"throws",
"GuildWars2Exception",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
")",
")",
";",
"try",
"{",
"Resp... | For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/>
Get continent info for the given continent floor id(s)
@param continentID {@link Continent#id}
@param ids list of continent floor id
@return list of continent floor info
@throws GuildWars2Exception see {@link ErrorCode} for detail
@see ContinentFloor continent floor info | [
"For",
"more",
"info",
"on",
"continents",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"continents",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Get",
"cont... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L1412-L1421 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/user/UserClient.java | UserClient.getAdminListByAppkey | public UserListResult getAdminListByAppkey(int start, int count)
throws APIConnectionException, APIRequestException {
if (start < 0 || count <= 0 || count > 500) {
throw new IllegalArgumentException("negative index or count must more than 0 and less than 501");
}
ResponseWrapper response = _httpClient.sendGet(_baseUrl + adminPath + "?start=" + start + "&count=" + count);
return UserListResult.fromResponse(response, UserListResult.class);
} | java | public UserListResult getAdminListByAppkey(int start, int count)
throws APIConnectionException, APIRequestException {
if (start < 0 || count <= 0 || count > 500) {
throw new IllegalArgumentException("negative index or count must more than 0 and less than 501");
}
ResponseWrapper response = _httpClient.sendGet(_baseUrl + adminPath + "?start=" + start + "&count=" + count);
return UserListResult.fromResponse(response, UserListResult.class);
} | [
"public",
"UserListResult",
"getAdminListByAppkey",
"(",
"int",
"start",
",",
"int",
"count",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"if",
"(",
"start",
"<",
"0",
"||",
"count",
"<=",
"0",
"||",
"count",
">",
"500",
")",
"{... | Get admins by appkey
@param start The start index of the list
@param count The number that how many you want to get from list
@return admin user info list
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"admins",
"by",
"appkey"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L230-L238 |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java | UserService.retrieveHistory | public List<ActivityRecord> retrieveHistory(ModeledAuthenticatedUser authenticatedUser,
ModeledUser user) throws GuacamoleException {
String username = user.getIdentifier();
// Retrieve history only if READ permission is granted
if (hasObjectPermission(authenticatedUser, username, ObjectPermission.Type.READ))
return getObjectInstances(userRecordMapper.select(username));
// The user does not have permission to read the history
throw new GuacamoleSecurityException("Permission denied.");
} | java | public List<ActivityRecord> retrieveHistory(ModeledAuthenticatedUser authenticatedUser,
ModeledUser user) throws GuacamoleException {
String username = user.getIdentifier();
// Retrieve history only if READ permission is granted
if (hasObjectPermission(authenticatedUser, username, ObjectPermission.Type.READ))
return getObjectInstances(userRecordMapper.select(username));
// The user does not have permission to read the history
throw new GuacamoleSecurityException("Permission denied.");
} | [
"public",
"List",
"<",
"ActivityRecord",
">",
"retrieveHistory",
"(",
"ModeledAuthenticatedUser",
"authenticatedUser",
",",
"ModeledUser",
"user",
")",
"throws",
"GuacamoleException",
"{",
"String",
"username",
"=",
"user",
".",
"getIdentifier",
"(",
")",
";",
"// R... | Retrieves the login history of the given user, including any active
sessions.
@param authenticatedUser
The user retrieving the login history.
@param user
The user whose history is being retrieved.
@return
The login history of the given user, including any active sessions.
@throws GuacamoleException
If permission to read the login history is denied. | [
"Retrieves",
"the",
"login",
"history",
"of",
"the",
"given",
"user",
"including",
"any",
"active",
"sessions",
"."
] | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java#L576-L588 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/record/compiler/ant/RccTask.java | RccTask.execute | public void execute() throws BuildException {
if (src == null && filesets.size()==0) {
throw new BuildException("There must be a file attribute or a fileset child element");
}
if (src != null) {
doCompile(src);
}
Project myProject = getProject();
for (int i = 0; i < filesets.size(); i++) {
FileSet fs = filesets.get(i);
DirectoryScanner ds = fs.getDirectoryScanner(myProject);
File dir = fs.getDir(myProject);
String[] srcs = ds.getIncludedFiles();
for (int j = 0; j < srcs.length; j++) {
doCompile(new File(dir, srcs[j]));
}
}
} | java | public void execute() throws BuildException {
if (src == null && filesets.size()==0) {
throw new BuildException("There must be a file attribute or a fileset child element");
}
if (src != null) {
doCompile(src);
}
Project myProject = getProject();
for (int i = 0; i < filesets.size(); i++) {
FileSet fs = filesets.get(i);
DirectoryScanner ds = fs.getDirectoryScanner(myProject);
File dir = fs.getDir(myProject);
String[] srcs = ds.getIncludedFiles();
for (int j = 0; j < srcs.length; j++) {
doCompile(new File(dir, srcs[j]));
}
}
} | [
"public",
"void",
"execute",
"(",
")",
"throws",
"BuildException",
"{",
"if",
"(",
"src",
"==",
"null",
"&&",
"filesets",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"There must be a file attribute or a fileset child elem... | Invoke the Hadoop record compiler on each record definition file | [
"Invoke",
"the",
"Hadoop",
"record",
"compiler",
"on",
"each",
"record",
"definition",
"file"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/record/compiler/ant/RccTask.java#L105-L122 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/permissions/CmsPrincipalSelect.java | CmsPrincipalSelect.setPrincipal | protected void setPrincipal(int type, String principalName) {
m_principalName.setValue(principalName);
String typeName = null;
switch (type) {
case 0:
typeName = I_CmsPrincipal.PRINCIPAL_GROUP;
break;
case 1:
default:
typeName = I_CmsPrincipal.PRINCIPAL_USER;
break;
}
if (typeName != null) {
m_principalTypeSelect.setValue(typeName);
}
} | java | protected void setPrincipal(int type, String principalName) {
m_principalName.setValue(principalName);
String typeName = null;
switch (type) {
case 0:
typeName = I_CmsPrincipal.PRINCIPAL_GROUP;
break;
case 1:
default:
typeName = I_CmsPrincipal.PRINCIPAL_USER;
break;
}
if (typeName != null) {
m_principalTypeSelect.setValue(typeName);
}
} | [
"protected",
"void",
"setPrincipal",
"(",
"int",
"type",
",",
"String",
"principalName",
")",
"{",
"m_principalName",
".",
"setValue",
"(",
"principalName",
")",
";",
"String",
"typeName",
"=",
"null",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"0",
":"... | Sets the principal type and name.<p>
@param type the principal type
@param principalName the principal name | [
"Sets",
"the",
"principal",
"type",
"and",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/permissions/CmsPrincipalSelect.java#L593-L610 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/normalize/SMSDNormalizer.java | SMSDNormalizer.makeDeepCopy | public static IAtomContainer makeDeepCopy(IAtomContainer container) {
IAtomContainer newAtomContainer = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class);
int lonePairCount = container.getLonePairCount();
int singleElectronCount = container.getSingleElectronCount();
ILonePair[] lonePairs = new ILonePair[lonePairCount];
ISingleElectron[] singleElectrons = new ISingleElectron[singleElectronCount];
// Deep copy of the Atoms
IAtom[] atoms = copyAtoms(container, newAtomContainer);
// Deep copy of the bonds
copyBonds(atoms, container, newAtomContainer);
// Deep copy of the LonePairs
for (int index = 0; index < container.getLonePairCount(); index++) {
if (container.getAtom(index).getSymbol().equalsIgnoreCase("R")) {
lonePairs[index] = DefaultChemObjectBuilder.getInstance().newInstance(ILonePair.class,
container.getAtom(index));
}
newAtomContainer.addLonePair(lonePairs[index]);
}
for (int index = 0; index < container.getSingleElectronCount(); index++) {
singleElectrons[index] = DefaultChemObjectBuilder.getInstance().newInstance(ISingleElectron.class,
container.getAtom(index));
newAtomContainer.addSingleElectron(singleElectrons[index]);
}
newAtomContainer.addProperties(container.getProperties());
newAtomContainer.setFlags(container.getFlags());
newAtomContainer.setID(container.getID());
newAtomContainer.notifyChanged();
return newAtomContainer;
} | java | public static IAtomContainer makeDeepCopy(IAtomContainer container) {
IAtomContainer newAtomContainer = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class);
int lonePairCount = container.getLonePairCount();
int singleElectronCount = container.getSingleElectronCount();
ILonePair[] lonePairs = new ILonePair[lonePairCount];
ISingleElectron[] singleElectrons = new ISingleElectron[singleElectronCount];
// Deep copy of the Atoms
IAtom[] atoms = copyAtoms(container, newAtomContainer);
// Deep copy of the bonds
copyBonds(atoms, container, newAtomContainer);
// Deep copy of the LonePairs
for (int index = 0; index < container.getLonePairCount(); index++) {
if (container.getAtom(index).getSymbol().equalsIgnoreCase("R")) {
lonePairs[index] = DefaultChemObjectBuilder.getInstance().newInstance(ILonePair.class,
container.getAtom(index));
}
newAtomContainer.addLonePair(lonePairs[index]);
}
for (int index = 0; index < container.getSingleElectronCount(); index++) {
singleElectrons[index] = DefaultChemObjectBuilder.getInstance().newInstance(ISingleElectron.class,
container.getAtom(index));
newAtomContainer.addSingleElectron(singleElectrons[index]);
}
newAtomContainer.addProperties(container.getProperties());
newAtomContainer.setFlags(container.getFlags());
newAtomContainer.setID(container.getID());
newAtomContainer.notifyChanged();
return newAtomContainer;
} | [
"public",
"static",
"IAtomContainer",
"makeDeepCopy",
"(",
"IAtomContainer",
"container",
")",
"{",
"IAtomContainer",
"newAtomContainer",
"=",
"DefaultChemObjectBuilder",
".",
"getInstance",
"(",
")",
".",
"newInstance",
"(",
"IAtomContainer",
".",
"class",
")",
";",
... | Returns deep copy of the molecule
@param container
@return deep copy of the mol | [
"Returns",
"deep",
"copy",
"of",
"the",
"molecule"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/normalize/SMSDNormalizer.java#L76-L116 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java | StringUtils.removeEnd | public static String removeEnd(String str, String remove) {
if (isNullOrEmpty(str) || isNullOrEmpty(remove)) {
return str;
}
if (str.endsWith(remove)) {
return str.substring(0, str.length() - remove.length());
}
return str;
} | java | public static String removeEnd(String str, String remove) {
if (isNullOrEmpty(str) || isNullOrEmpty(remove)) {
return str;
}
if (str.endsWith(remove)) {
return str.substring(0, str.length() - remove.length());
}
return str;
} | [
"public",
"static",
"String",
"removeEnd",
"(",
"String",
"str",
",",
"String",
"remove",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"str",
")",
"||",
"isNullOrEmpty",
"(",
"remove",
")",
")",
"{",
"return",
"str",
";",
"}",
"if",
"(",
"str",
".",
"e... | <p>Removes a substring only if it is at the end of a source string,
otherwise returns the source string.</p>
<p/>
<p>A {@code null} source string will return {@code null}.
An empty ("") source string will return the empty string.
A {@code null} search string will return the source string.</p>
<p/>
<pre>
StringUtils.removeEnd(null, *) = null
StringUtils.removeEnd("", *) = ""
StringUtils.removeEnd(*, null) = *
StringUtils.removeEnd("www.domain.com", ".com.") = "www.domain.com"
StringUtils.removeEnd("www.domain.com", ".com") = "www.domain"
StringUtils.removeEnd("www.domain.com", "domain") = "www.domain.com"
StringUtils.removeEnd("abc", "") = "abc"
</pre>
@param str the source String to search, may be null
@param remove the String to search for and remove, may be null
@return the substring with the string removed if found,
{@code null} if null String input | [
"<p",
">",
"Removes",
"a",
"substring",
"only",
"if",
"it",
"is",
"at",
"the",
"end",
"of",
"a",
"source",
"string",
"otherwise",
"returns",
"the",
"source",
"string",
".",
"<",
"/",
"p",
">",
"<p",
"/",
">",
"<p",
">",
"A",
"{",
"@code",
"null",
... | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java#L111-L121 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Multimap.java | Multimap.replaceAllIf | public <X extends Exception> boolean replaceAllIf(Try.Predicate<? super K, X> predicate, Collection<?> oldValues, E newValue) throws X {
boolean modified = false;
for (Map.Entry<K, V> entry : this.valueMap.entrySet()) {
if (predicate.test(entry.getKey())) {
if (entry.getValue().removeAll(oldValues)) {
entry.getValue().add(newValue);
modified = true;
}
}
}
return modified;
} | java | public <X extends Exception> boolean replaceAllIf(Try.Predicate<? super K, X> predicate, Collection<?> oldValues, E newValue) throws X {
boolean modified = false;
for (Map.Entry<K, V> entry : this.valueMap.entrySet()) {
if (predicate.test(entry.getKey())) {
if (entry.getValue().removeAll(oldValues)) {
entry.getValue().add(newValue);
modified = true;
}
}
}
return modified;
} | [
"public",
"<",
"X",
"extends",
"Exception",
">",
"boolean",
"replaceAllIf",
"(",
"Try",
".",
"Predicate",
"<",
"?",
"super",
"K",
",",
"X",
">",
"predicate",
",",
"Collection",
"<",
"?",
">",
"oldValues",
",",
"E",
"newValue",
")",
"throws",
"X",
"{",
... | Replace the specified value (all occurrences) from the value set associated with keys which satisfy the specified <code>predicate</code>.
@param predicate
@param oldValues
@param newValue
@return <code>true</code> if this Multimap is modified by this operation, otherwise <code>false</code>. | [
"Replace",
"the",
"specified",
"value",
"(",
"all",
"occurrences",
")",
"from",
"the",
"value",
"set",
"associated",
"with",
"keys",
"which",
"satisfy",
"the",
"specified",
"<code",
">",
"predicate<",
"/",
"code",
">",
".",
"@param",
"predicate",
"@param",
"... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multimap.java#L885-L898 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.addRelationToResource | public void addRelationToResource(String resourceName, String targetPath, String type) throws CmsException {
createRelation(resourceName, targetPath, type, false);
} | java | public void addRelationToResource(String resourceName, String targetPath, String type) throws CmsException {
createRelation(resourceName, targetPath, type, false);
} | [
"public",
"void",
"addRelationToResource",
"(",
"String",
"resourceName",
",",
"String",
"targetPath",
",",
"String",
"type",
")",
"throws",
"CmsException",
"{",
"createRelation",
"(",
"resourceName",
",",
"targetPath",
",",
"type",
",",
"false",
")",
";",
"}"
] | Adds a new relation to the given resource.<p>
@param resourceName the name of the source resource
@param targetPath the path of the target resource
@param type the type of the relation
@throws CmsException if something goes wrong | [
"Adds",
"a",
"new",
"relation",
"to",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L146-L149 |
jenkinsci/multi-branch-project-plugin | src/main/java/com/github/mjdetullio/jenkins/plugins/multibranch/TemplateDrivenBranchProjectFactory.java | TemplateDrivenBranchProjectFactory.updateByXml | @SuppressWarnings("ThrowFromFinallyBlock")
private void updateByXml(final P project, Source source) throws IOException {
project.checkPermission(Item.CONFIGURE);
final String projectName = project.getName();
XmlFile configXmlFile = project.getConfigFile();
final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile());
try {
try {
XMLUtils.safeTransform(source, new StreamResult(out));
out.close();
} catch (SAXException | TransformerException e) {
throw new IOException("Failed to persist config.xml", e);
}
// try to reflect the changes by reloading
Object o = new XmlFile(Items.XSTREAM, out.getTemporaryFile()).unmarshal(project);
if (o != project) {
// ensure that we've got the same job type. extending this code to support updating
// to different job type requires destroying & creating a new job type
throw new IOException("Expecting " + project.getClass() + " but got " + o.getClass() + " instead");
}
Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<Void, IOException>() {
@SuppressWarnings("unchecked")
@Override
public Void call() throws IOException {
project.onLoad(project.getParent(), projectName);
return null;
}
});
Jenkins.getActiveInstance().rebuildDependencyGraphAsync();
// if everything went well, commit this new version
out.commit();
} finally {
out.abort();
}
} | java | @SuppressWarnings("ThrowFromFinallyBlock")
private void updateByXml(final P project, Source source) throws IOException {
project.checkPermission(Item.CONFIGURE);
final String projectName = project.getName();
XmlFile configXmlFile = project.getConfigFile();
final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile());
try {
try {
XMLUtils.safeTransform(source, new StreamResult(out));
out.close();
} catch (SAXException | TransformerException e) {
throw new IOException("Failed to persist config.xml", e);
}
// try to reflect the changes by reloading
Object o = new XmlFile(Items.XSTREAM, out.getTemporaryFile()).unmarshal(project);
if (o != project) {
// ensure that we've got the same job type. extending this code to support updating
// to different job type requires destroying & creating a new job type
throw new IOException("Expecting " + project.getClass() + " but got " + o.getClass() + " instead");
}
Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<Void, IOException>() {
@SuppressWarnings("unchecked")
@Override
public Void call() throws IOException {
project.onLoad(project.getParent(), projectName);
return null;
}
});
Jenkins.getActiveInstance().rebuildDependencyGraphAsync();
// if everything went well, commit this new version
out.commit();
} finally {
out.abort();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"ThrowFromFinallyBlock\"",
")",
"private",
"void",
"updateByXml",
"(",
"final",
"P",
"project",
",",
"Source",
"source",
")",
"throws",
"IOException",
"{",
"project",
".",
"checkPermission",
"(",
"Item",
".",
"CONFIGURE",
")",
";"... | This is a mirror of {@link hudson.model.AbstractItem#updateByXml(Source)} without the
{@link hudson.model.listeners.SaveableListener#fireOnChange(Saveable, XmlFile)} trigger.
@param project project to update by XML
@param source source of XML
@throws IOException if error performing update | [
"This",
"is",
"a",
"mirror",
"of",
"{",
"@link",
"hudson",
".",
"model",
".",
"AbstractItem#updateByXml",
"(",
"Source",
")",
"}",
"without",
"the",
"{",
"@link",
"hudson",
".",
"model",
".",
"listeners",
".",
"SaveableListener#fireOnChange",
"(",
"Saveable",
... | train | https://github.com/jenkinsci/multi-branch-project-plugin/blob/a98828f6b5ea4e0f69a83f3d274fe05063caad52/src/main/java/com/github/mjdetullio/jenkins/plugins/multibranch/TemplateDrivenBranchProjectFactory.java#L169-L206 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/ObjectCellFormatter.java | ObjectCellFormatter.formatAsString | public String formatAsString(final ObjectCell<?> cell, final Locale locale) {
return format(cell, locale).getText();
} | java | public String formatAsString(final ObjectCell<?> cell, final Locale locale) {
return format(cell, locale).getText();
} | [
"public",
"String",
"formatAsString",
"(",
"final",
"ObjectCell",
"<",
"?",
">",
"cell",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"format",
"(",
"cell",
",",
"locale",
")",
".",
"getText",
"(",
")",
";",
"}"
] | ロケールを指定してセルの値を文字列として取得する
@param cell Javaの仮想的なオブジェクトを表現するセル。
@param locale locale フォーマットしたロケール。nullでも可能。
ロケールに依存する場合、指定したロケールにより自動的に切り替わります。
@return フォーマットした文字列。cellがnullの場合、空文字を返す。 | [
"ロケールを指定してセルの値を文字列として取得する"
] | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/ObjectCellFormatter.java#L224-L226 |
korpling/ANNIS | annis-gui/src/main/java/annis/gui/ExampleQueriesPanel.java | ExampleQueriesPanel.setSelectedCorpusInBackground | public void setSelectedCorpusInBackground(final Set<String> selectedCorpora) {
loadingIndicator.setVisible(true);
table.setVisible(false);
Background.run(new ExampleFetcher(selectedCorpora, UI.getCurrent()));
} | java | public void setSelectedCorpusInBackground(final Set<String> selectedCorpora) {
loadingIndicator.setVisible(true);
table.setVisible(false);
Background.run(new ExampleFetcher(selectedCorpora, UI.getCurrent()));
} | [
"public",
"void",
"setSelectedCorpusInBackground",
"(",
"final",
"Set",
"<",
"String",
">",
"selectedCorpora",
")",
"{",
"loadingIndicator",
".",
"setVisible",
"(",
"true",
")",
";",
"table",
".",
"setVisible",
"(",
"false",
")",
";",
"Background",
".",
"run",... | Sets the selected corpora and causes a reload
@param selectedCorpora Specifies the corpora example queries are fetched for.
If it is null, all available example queries are
fetched. | [
"Sets",
"the",
"selected",
"corpora",
"and",
"causes",
"a",
"reload"
] | train | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-gui/src/main/java/annis/gui/ExampleQueriesPanel.java#L249-L253 |
jroyalty/jglm | src/main/java/com/hackoeur/jglm/support/FastMath.java | FastMath.copySign | public static double copySign(double magnitude, double sign){
long m = Double.doubleToLongBits(magnitude);
long s = Double.doubleToLongBits(sign);
if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
return magnitude;
}
return -magnitude; // flip sign
} | java | public static double copySign(double magnitude, double sign){
long m = Double.doubleToLongBits(magnitude);
long s = Double.doubleToLongBits(sign);
if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
return magnitude;
}
return -magnitude; // flip sign
} | [
"public",
"static",
"double",
"copySign",
"(",
"double",
"magnitude",
",",
"double",
"sign",
")",
"{",
"long",
"m",
"=",
"Double",
".",
"doubleToLongBits",
"(",
"magnitude",
")",
";",
"long",
"s",
"=",
"Double",
".",
"doubleToLongBits",
"(",
"sign",
")",
... | Returns the first argument with the sign of the second argument.
A NaN {@code sign} argument is treated as positive.
@param magnitude the value to return
@param sign the sign for the returned value
@return the magnitude with the same sign as the {@code sign} argument | [
"Returns",
"the",
"first",
"argument",
"with",
"the",
"sign",
"of",
"the",
"second",
"argument",
".",
"A",
"NaN",
"{",
"@code",
"sign",
"}",
"argument",
"is",
"treated",
"as",
"positive",
"."
] | train | https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMath.java#L3672-L3679 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.readAsString | public static String readAsString(final URL url, final String encoding, final int bufSize) {
try (final Reader reader = new InputStreamReader(url.openStream(), encoding)) {
final StringBuilder sb = new StringBuilder();
final char[] cbuf = new char[bufSize];
int count;
while ((count = reader.read(cbuf)) > -1) {
sb.append(String.valueOf(cbuf, 0, count));
}
return sb.toString();
} catch (final IOException ex) {
throw new RuntimeException(ex);
}
} | java | public static String readAsString(final URL url, final String encoding, final int bufSize) {
try (final Reader reader = new InputStreamReader(url.openStream(), encoding)) {
final StringBuilder sb = new StringBuilder();
final char[] cbuf = new char[bufSize];
int count;
while ((count = reader.read(cbuf)) > -1) {
sb.append(String.valueOf(cbuf, 0, count));
}
return sb.toString();
} catch (final IOException ex) {
throw new RuntimeException(ex);
}
} | [
"public",
"static",
"String",
"readAsString",
"(",
"final",
"URL",
"url",
",",
"final",
"String",
"encoding",
",",
"final",
"int",
"bufSize",
")",
"{",
"try",
"(",
"final",
"Reader",
"reader",
"=",
"new",
"InputStreamReader",
"(",
"url",
".",
"openStream",
... | Reads a given URL and returns the content as String.
@param url
URL to read.
@param encoding
Encoding (like 'utf-8').
@param bufSize
Size of the buffer to use.
@return File content as String. | [
"Reads",
"a",
"given",
"URL",
"and",
"returns",
"the",
"content",
"as",
"String",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1469-L1481 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java | ABITrace.getSubArray | private void getSubArray(byte[] b, int traceDataOffset) {
for (int x = 0; x <= b.length - 1; x++) {
b[x] = traceData[traceDataOffset + x];
}
} | java | private void getSubArray(byte[] b, int traceDataOffset) {
for (int x = 0; x <= b.length - 1; x++) {
b[x] = traceData[traceDataOffset + x];
}
} | [
"private",
"void",
"getSubArray",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"traceDataOffset",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<=",
"b",
".",
"length",
"-",
"1",
";",
"x",
"++",
")",
"{",
"b",
"[",
"x",
"]",
"=",
"traceDa... | A utility method which fills array b with data from the trace starting at traceDataOffset.
@param b - trace byte array
@param traceDataOffset - starting point | [
"A",
"utility",
"method",
"which",
"fills",
"array",
"b",
"with",
"data",
"from",
"the",
"trace",
"starting",
"at",
"traceDataOffset",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L562-L566 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java | CmsForm.validateField | public void validateField(final I_CmsFormField field) {
CmsValidationController validationController = new CmsValidationController(field, createValidationHandler());
validationController.setFormValidator(m_validatorClass);
validationController.setFormValidatorConfig(createValidatorConfig());
startValidation(validationController);
} | java | public void validateField(final I_CmsFormField field) {
CmsValidationController validationController = new CmsValidationController(field, createValidationHandler());
validationController.setFormValidator(m_validatorClass);
validationController.setFormValidatorConfig(createValidatorConfig());
startValidation(validationController);
} | [
"public",
"void",
"validateField",
"(",
"final",
"I_CmsFormField",
"field",
")",
"{",
"CmsValidationController",
"validationController",
"=",
"new",
"CmsValidationController",
"(",
"field",
",",
"createValidationHandler",
"(",
")",
")",
";",
"validationController",
".",... | Validates a single field.<p>
@param field the field to validate | [
"Validates",
"a",
"single",
"field",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java#L405-L411 |
waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java | FatLfnDirectory.addDirectory | @Override
public FatLfnDirectoryEntry addDirectory(String name) throws IOException {
checkWritable();
checkUniqueName(name);
name = name.trim();
final ShortName sn = makeShortName(name);
final FatDirectoryEntry real = dir.createSub(fat);
real.setShortName(sn);
final FatLfnDirectoryEntry e =
new FatLfnDirectoryEntry(this, real, name);
try {
dir.addEntries(e.compactForm());
} catch (IOException ex) {
final ClusterChain cc =
new ClusterChain(fat, real.getStartCluster(), false);
cc.setChainLength(0);
dir.removeEntry(real);
throw ex;
}
shortNameIndex.put(sn, e);
longNameIndex.put(name.toLowerCase(Locale.ROOT), e);
getDirectory(real);
flush();
return e;
} | java | @Override
public FatLfnDirectoryEntry addDirectory(String name) throws IOException {
checkWritable();
checkUniqueName(name);
name = name.trim();
final ShortName sn = makeShortName(name);
final FatDirectoryEntry real = dir.createSub(fat);
real.setShortName(sn);
final FatLfnDirectoryEntry e =
new FatLfnDirectoryEntry(this, real, name);
try {
dir.addEntries(e.compactForm());
} catch (IOException ex) {
final ClusterChain cc =
new ClusterChain(fat, real.getStartCluster(), false);
cc.setChainLength(0);
dir.removeEntry(real);
throw ex;
}
shortNameIndex.put(sn, e);
longNameIndex.put(name.toLowerCase(Locale.ROOT), e);
getDirectory(real);
flush();
return e;
} | [
"@",
"Override",
"public",
"FatLfnDirectoryEntry",
"addDirectory",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"checkWritable",
"(",
")",
";",
"checkUniqueName",
"(",
"name",
")",
";",
"name",
"=",
"name",
".",
"trim",
"(",
")",
";",
"final",
... | <p>
{@inheritDoc}
</p><p>
According to the FAT file system specification, leading and trailing
spaces in the {@code name} are ignored by this method.
</p>
@param name {@inheritDoc}
@return {@inheritDoc}
@throws IOException {@inheritDoc} | [
"<p",
">",
"{",
"@inheritDoc",
"}",
"<",
"/",
"p",
">",
"<p",
">",
"According",
"to",
"the",
"FAT",
"file",
"system",
"specification",
"leading",
"and",
"trailing",
"spaces",
"in",
"the",
"{",
"@code",
"name",
"}",
"are",
"ignored",
"by",
"this",
"meth... | train | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java#L194-L223 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcUtil.java | WSJdbcUtil.mapException | public static SQLException mapException(WSJdbcWrapper jdbcWrapper, SQLException sqlX) {
Object mapper = null;
WSJdbcConnection connWrapper = null;
if (jdbcWrapper instanceof WSJdbcObject) {
// Use the connection and managed connection.
connWrapper = (WSJdbcConnection) ((WSJdbcObject) jdbcWrapper).getConnectionWrapper();
if (connWrapper != null) {
mapper = connWrapper.isClosed() ? connWrapper.mcf : connWrapper.managedConn;
}
} else
mapper = jdbcWrapper.mcf;
return (SQLException) AdapterUtil.mapException(sqlX, connWrapper, mapper, true);
} | java | public static SQLException mapException(WSJdbcWrapper jdbcWrapper, SQLException sqlX) {
Object mapper = null;
WSJdbcConnection connWrapper = null;
if (jdbcWrapper instanceof WSJdbcObject) {
// Use the connection and managed connection.
connWrapper = (WSJdbcConnection) ((WSJdbcObject) jdbcWrapper).getConnectionWrapper();
if (connWrapper != null) {
mapper = connWrapper.isClosed() ? connWrapper.mcf : connWrapper.managedConn;
}
} else
mapper = jdbcWrapper.mcf;
return (SQLException) AdapterUtil.mapException(sqlX, connWrapper, mapper, true);
} | [
"public",
"static",
"SQLException",
"mapException",
"(",
"WSJdbcWrapper",
"jdbcWrapper",
",",
"SQLException",
"sqlX",
")",
"{",
"Object",
"mapper",
"=",
"null",
";",
"WSJdbcConnection",
"connWrapper",
"=",
"null",
";",
"if",
"(",
"jdbcWrapper",
"instanceof",
"WSJd... | Map a SQLException. And, if it's a connection error, send a CONNECTION_ERROR_OCCURRED
ConnectionEvent to all listeners of the Managed Connection.
@param jdbcWrapper the WebSphere JDBC wrapper object throwing the exception.
@param sqlX the SQLException to map.
@return A mapped SQLException subclass, if the SQLException maps. Otherwise, the
original exception. | [
"Map",
"a",
"SQLException",
".",
"And",
"if",
"it",
"s",
"a",
"connection",
"error",
"send",
"a",
"CONNECTION_ERROR_OCCURRED",
"ConnectionEvent",
"to",
"all",
"listeners",
"of",
"the",
"Managed",
"Connection",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcUtil.java#L95-L109 |
NessComputing/components-ness-jms | src/main/java/com/nesscomputing/jms/JmsRunnableFactory.java | JmsRunnableFactory.createTopicListener | public TopicConsumer createTopicListener(final String topic, final ConsumerCallback<Message> messageCallback)
{
Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
return new TopicConsumer(connectionFactory, jmsConfig, topic, messageCallback);
} | java | public TopicConsumer createTopicListener(final String topic, final ConsumerCallback<Message> messageCallback)
{
Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
return new TopicConsumer(connectionFactory, jmsConfig, topic, messageCallback);
} | [
"public",
"TopicConsumer",
"createTopicListener",
"(",
"final",
"String",
"topic",
",",
"final",
"ConsumerCallback",
"<",
"Message",
">",
"messageCallback",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"connectionFactory",
"!=",
"null",
",",
"\"connection factor... | Creates a new {@link TopicConsumer}. For every message received (or when the timeout waiting for messages is hit), the callback
is invoked with the message received. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/NessComputing/components-ness-jms/blob/29e0d320ada3a1a375483437a9f3ff629822b714/src/main/java/com/nesscomputing/jms/JmsRunnableFactory.java#L124-L128 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java | ResolvableType.forClassWithGenerics | public static ResolvableType forClassWithGenerics(Class<?> sourceClass, ResolvableType... generics) {
Assert.notNull(sourceClass, "Source class must not be null");
Assert.notNull(generics, "Generics must not be null");
TypeVariable<?>[] variables = sourceClass.getTypeParameters();
Assert.isTrue(variables.length == generics.length, "Mismatched number of generics specified");
return forType(sourceClass, new TypeVariablesVariableResolver(variables, generics));
} | java | public static ResolvableType forClassWithGenerics(Class<?> sourceClass, ResolvableType... generics) {
Assert.notNull(sourceClass, "Source class must not be null");
Assert.notNull(generics, "Generics must not be null");
TypeVariable<?>[] variables = sourceClass.getTypeParameters();
Assert.isTrue(variables.length == generics.length, "Mismatched number of generics specified");
return forType(sourceClass, new TypeVariablesVariableResolver(variables, generics));
} | [
"public",
"static",
"ResolvableType",
"forClassWithGenerics",
"(",
"Class",
"<",
"?",
">",
"sourceClass",
",",
"ResolvableType",
"...",
"generics",
")",
"{",
"Assert",
".",
"notNull",
"(",
"sourceClass",
",",
"\"Source class must not be null\"",
")",
";",
"Assert",
... | Return a {@link ResolvableType} for the specified {@link Class} with pre-declared generics.
@param sourceClass the source class
@param generics the generics of the class
@return a {@link ResolvableType} for the specific class and generics
@see #forClassWithGenerics(Class, Class...) | [
"Return",
"a",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java#L908-L914 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java | HelpDoclet.startProcessDocs | protected boolean startProcessDocs(final RootDoc rootDoc) throws IOException {
for (String[] options : rootDoc.options()) {
parseOption(options);
}
// Make sure the user specified a settings directory OR that we should use the defaults.
// Both are not allowed.
// Neither are not allowed.
if ( (useDefaultTemplates && isSettingsDirSet) ||
(!useDefaultTemplates && !isSettingsDirSet)) {
throw new RuntimeException("ERROR: must specify only ONE of: " + USE_DEFAULT_TEMPLATES_OPTION + " , " + SETTINGS_DIR_OPTION);
}
// Make sure we can use the directory for settings we have set:
if (!useDefaultTemplates) {
validateSettingsDir();
}
// Make sure we're in a good state to run:
validateDocletStartingState();
processDocs(rootDoc);
return true;
} | java | protected boolean startProcessDocs(final RootDoc rootDoc) throws IOException {
for (String[] options : rootDoc.options()) {
parseOption(options);
}
// Make sure the user specified a settings directory OR that we should use the defaults.
// Both are not allowed.
// Neither are not allowed.
if ( (useDefaultTemplates && isSettingsDirSet) ||
(!useDefaultTemplates && !isSettingsDirSet)) {
throw new RuntimeException("ERROR: must specify only ONE of: " + USE_DEFAULT_TEMPLATES_OPTION + " , " + SETTINGS_DIR_OPTION);
}
// Make sure we can use the directory for settings we have set:
if (!useDefaultTemplates) {
validateSettingsDir();
}
// Make sure we're in a good state to run:
validateDocletStartingState();
processDocs(rootDoc);
return true;
} | [
"protected",
"boolean",
"startProcessDocs",
"(",
"final",
"RootDoc",
"rootDoc",
")",
"throws",
"IOException",
"{",
"for",
"(",
"String",
"[",
"]",
"options",
":",
"rootDoc",
".",
"options",
"(",
")",
")",
"{",
"parseOption",
"(",
"options",
")",
";",
"}",
... | Extracts the contents of certain types of javadoc and adds them to an output file.
@param rootDoc The documentation root.
@return Whether the JavaDoc run succeeded.
@throws java.io.IOException if output can't be written. | [
"Extracts",
"the",
"contents",
"of",
"certain",
"types",
"of",
"javadoc",
"and",
"adds",
"them",
"to",
"an",
"output",
"file",
"."
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java#L139-L164 |
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.addCollaborator | public void addCollaborator(String appName, String collaborator) {
connection.execute(new SharingAdd(appName, collaborator), apiKey);
} | java | public void addCollaborator(String appName, String collaborator) {
connection.execute(new SharingAdd(appName, collaborator), apiKey);
} | [
"public",
"void",
"addCollaborator",
"(",
"String",
"appName",
",",
"String",
"collaborator",
")",
"{",
"connection",
".",
"execute",
"(",
"new",
"SharingAdd",
"(",
"appName",
",",
"collaborator",
")",
",",
"apiKey",
")",
";",
"}"
] | Add a collaborator to an app.
@param appName App name. See {@link #listApps} for a list of apps that can be used.
@param collaborator Username of the collaborator to add. This is usually in the form of "user@company.com". | [
"Add",
"a",
"collaborator",
"to",
"an",
"app",
"."
] | train | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L311-L313 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/util/CommandLineUtil.java | CommandLineUtil.getOptionValue | public static String getOptionValue(String[] args, String optionName) {
String opt = "-" + optionName + "=";
for (String arg : args) {
if (arg.startsWith(opt))
return arg.substring(opt.length());
}
return null;
} | java | public static String getOptionValue(String[] args, String optionName) {
String opt = "-" + optionName + "=";
for (String arg : args) {
if (arg.startsWith(opt))
return arg.substring(opt.length());
}
return null;
} | [
"public",
"static",
"String",
"getOptionValue",
"(",
"String",
"[",
"]",
"args",
",",
"String",
"optionName",
")",
"{",
"String",
"opt",
"=",
"\"-\"",
"+",
"optionName",
"+",
"\"=\"",
";",
"for",
"(",
"String",
"arg",
":",
"args",
")",
"{",
"if",
"(",
... | Search for an argument "-<option>=<value>" where option is the given option name, and return the value. | [
"Search",
"for",
"an",
"argument",
"-",
"<",
";",
"option>",
";",
"=",
"<",
";",
"value>",
";",
"where",
"option",
"is",
"the",
"given",
"option",
"name",
"and",
"return",
"the",
"value",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/CommandLineUtil.java#L11-L18 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.getCurrentStyle | public static String getCurrentStyle(Element element, Style style) {
return getStyleImpl().getCurrentStyle(element, style.toString());
} | java | public static String getCurrentStyle(Element element, Style style) {
return getStyleImpl().getCurrentStyle(element, style.toString());
} | [
"public",
"static",
"String",
"getCurrentStyle",
"(",
"Element",
"element",
",",
"Style",
"style",
")",
"{",
"return",
"getStyleImpl",
"(",
")",
".",
"getCurrentStyle",
"(",
"element",
",",
"style",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Returns the computed style of the given element.<p>
@param element the element
@param style the CSS property
@return the currently computed style | [
"Returns",
"the",
"computed",
"style",
"of",
"the",
"given",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L1205-L1208 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newObjectNotFoundException | public static ObjectNotFoundException newObjectNotFoundException(Throwable cause, String message, Object... args) {
return new ObjectNotFoundException(format(message, args), cause);
} | java | public static ObjectNotFoundException newObjectNotFoundException(Throwable cause, String message, Object... args) {
return new ObjectNotFoundException(format(message, args), cause);
} | [
"public",
"static",
"ObjectNotFoundException",
"newObjectNotFoundException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"ObjectNotFoundException",
"(",
"format",
"(",
"message",
",",
"args",
")",
"... | Constructs and initializes a new {@link ObjectNotFoundException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link ObjectNotFoundException} was thrown.
@param message {@link String} describing the {@link ObjectNotFoundException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link ObjectNotFoundException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.lang.ObjectNotFoundException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"ObjectNotFoundException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L481-L483 |
VoltDB/voltdb | src/frontend/org/voltdb/client/Distributer.java | Distributer.getPartitionForParameter | public long getPartitionForParameter(byte typeValue, Object value) {
if (m_hashinator == null) {
return -1;
}
return m_hashinator.getHashedPartitionForParameter(typeValue, value);
} | java | public long getPartitionForParameter(byte typeValue, Object value) {
if (m_hashinator == null) {
return -1;
}
return m_hashinator.getHashedPartitionForParameter(typeValue, value);
} | [
"public",
"long",
"getPartitionForParameter",
"(",
"byte",
"typeValue",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"m_hashinator",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"m_hashinator",
".",
"getHashedPartitionForParameter",
"(",
"ty... | This is used by clients such as CSVLoader which puts processing into buckets.
@param typeValue volt Type
@param value the representative value
@return | [
"This",
"is",
"used",
"by",
"clients",
"such",
"as",
"CSVLoader",
"which",
"puts",
"processing",
"into",
"buckets",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/Distributer.java#L1546-L1551 |
soklet/soklet | src/main/java/com/soklet/classindex/ClassIndex.java | ClassIndex.getClassSummary | public static String getClassSummary(Class<?> klass, ClassLoader classLoader) {
URL resource = classLoader.getResource(JAVADOC_PREFIX + klass.getCanonicalName());
if (resource == null) {
return null;
}
try {
try (@SuppressWarnings("resource")
BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream(), "UTF-8"))) {
StringBuilder builder = new StringBuilder();
String line = reader.readLine();
while (line != null) {
int dotIndex = line.indexOf('.');
if (dotIndex == -1) {
builder.append(line);
} else {
builder.append(line.subSequence(0, dotIndex));
return builder.toString().trim();
}
line = reader.readLine();
}
return builder.toString().trim();
} catch (FileNotFoundException e) {
// catch this just in case some compiler actually throws that
return null;
}
} catch (IOException e) {
throw new RuntimeException("ClassIndex: Cannot read Javadoc index", e);
}
} | java | public static String getClassSummary(Class<?> klass, ClassLoader classLoader) {
URL resource = classLoader.getResource(JAVADOC_PREFIX + klass.getCanonicalName());
if (resource == null) {
return null;
}
try {
try (@SuppressWarnings("resource")
BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream(), "UTF-8"))) {
StringBuilder builder = new StringBuilder();
String line = reader.readLine();
while (line != null) {
int dotIndex = line.indexOf('.');
if (dotIndex == -1) {
builder.append(line);
} else {
builder.append(line.subSequence(0, dotIndex));
return builder.toString().trim();
}
line = reader.readLine();
}
return builder.toString().trim();
} catch (FileNotFoundException e) {
// catch this just in case some compiler actually throws that
return null;
}
} catch (IOException e) {
throw new RuntimeException("ClassIndex: Cannot read Javadoc index", e);
}
} | [
"public",
"static",
"String",
"getClassSummary",
"(",
"Class",
"<",
"?",
">",
"klass",
",",
"ClassLoader",
"classLoader",
")",
"{",
"URL",
"resource",
"=",
"classLoader",
".",
"getResource",
"(",
"JAVADOC_PREFIX",
"+",
"klass",
".",
"getCanonicalName",
"(",
")... | Returns the Javadoc summary for given class.
<p>
Javadoc summary is the first sentence of a Javadoc.
</p>
<p>
You need to use {@link IndexSubclasses} or {@link IndexAnnotated} with {@link IndexAnnotated#storeJavadoc()}
set to true.
</p>
@param klass class to retrieve summary for
@param classLoader classloader for loading classes
@return summary for given class, or null if it does not exists
@see <a href="http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#writingdoccomments">Writing doc comments</a> | [
"Returns",
"the",
"Javadoc",
"summary",
"for",
"given",
"class",
".",
"<p",
">",
"Javadoc",
"summary",
"is",
"the",
"first",
"sentence",
"of",
"a",
"Javadoc",
".",
"<",
"/",
"p",
">",
"<p",
">",
"You",
"need",
"to",
"use",
"{",
"@link",
"IndexSubclasse... | train | https://github.com/soklet/soklet/blob/4f12de07d9c132e0126d50ad11cc1d8576594700/src/main/java/com/soklet/classindex/ClassIndex.java#L341-L369 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/gsi/trustmanager/PKITrustManager.java | PKITrustManager.checkClientTrusted | public void checkClientTrusted(X509Certificate[] x509Certificates, String authType)
throws CertificateException {
// JGLOBUS-97 : anonymous clients?
CertPath certPath = CertificateUtil.getCertPath(x509Certificates);
try {
this.result = this.validator.engineValidate(certPath, parameters);
} catch (CertPathValidatorException exception) {
throw new CertificateException("Path validation failed: " + exception.getMessage(), exception);
} catch (InvalidAlgorithmParameterException exception) {
throw new CertificateException("Path validation failed: " + exception.getMessage(), exception);
}
} | java | public void checkClientTrusted(X509Certificate[] x509Certificates, String authType)
throws CertificateException {
// JGLOBUS-97 : anonymous clients?
CertPath certPath = CertificateUtil.getCertPath(x509Certificates);
try {
this.result = this.validator.engineValidate(certPath, parameters);
} catch (CertPathValidatorException exception) {
throw new CertificateException("Path validation failed: " + exception.getMessage(), exception);
} catch (InvalidAlgorithmParameterException exception) {
throw new CertificateException("Path validation failed: " + exception.getMessage(), exception);
}
} | [
"public",
"void",
"checkClientTrusted",
"(",
"X509Certificate",
"[",
"]",
"x509Certificates",
",",
"String",
"authType",
")",
"throws",
"CertificateException",
"{",
"// JGLOBUS-97 : anonymous clients?",
"CertPath",
"certPath",
"=",
"CertificateUtil",
".",
"getCertPath",
"... | Test if the client is trusted based on the certificate chain. Does not currently support anonymous clients.
@param x509Certificates The certificate chain to test for validity.
@param authType The authentication type based on the client certificate.
@throws CertificateException If the path validation fails. | [
"Test",
"if",
"the",
"client",
"is",
"trusted",
"based",
"on",
"the",
"certificate",
"chain",
".",
"Does",
"not",
"currently",
"support",
"anonymous",
"clients",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/trustmanager/PKITrustManager.java#L89-L100 |
infinispan/infinispan | core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java | ParseUtils.requireSingleAttribute | public static String requireSingleAttribute(final XMLStreamReader reader, final String attributeName)
throws XMLStreamException {
final int count = reader.getAttributeCount();
if (count == 0) {
throw missingRequired(reader, Collections.singleton(attributeName));
}
requireNoNamespaceAttribute(reader, 0);
if (!attributeName.equals(reader.getAttributeLocalName(0))) {
throw unexpectedAttribute(reader, 0);
}
if (count > 1) {
throw unexpectedAttribute(reader, 1);
}
return reader.getAttributeValue(0);
} | java | public static String requireSingleAttribute(final XMLStreamReader reader, final String attributeName)
throws XMLStreamException {
final int count = reader.getAttributeCount();
if (count == 0) {
throw missingRequired(reader, Collections.singleton(attributeName));
}
requireNoNamespaceAttribute(reader, 0);
if (!attributeName.equals(reader.getAttributeLocalName(0))) {
throw unexpectedAttribute(reader, 0);
}
if (count > 1) {
throw unexpectedAttribute(reader, 1);
}
return reader.getAttributeValue(0);
} | [
"public",
"static",
"String",
"requireSingleAttribute",
"(",
"final",
"XMLStreamReader",
"reader",
",",
"final",
"String",
"attributeName",
")",
"throws",
"XMLStreamException",
"{",
"final",
"int",
"count",
"=",
"reader",
".",
"getAttributeCount",
"(",
")",
";",
"... | Require that the current element have only a single attribute with the
given name.
@param reader the reader
@param attributeName the attribute name
@throws javax.xml.stream.XMLStreamException if an error occurs | [
"Require",
"that",
"the",
"current",
"element",
"have",
"only",
"a",
"single",
"attribute",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java#L210-L224 |
josueeduardo/snappy | plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/JarWriter.java | JarWriter.writeNestedLibrary | public void writeNestedLibrary(String destination, Library library)
throws IOException {
File file = library.getFile();
JarEntry entry = new JarEntry(destination + library.getName());
entry.setTime(getNestedLibraryTime(file));
if (library.isUnpackRequired()) {
entry.setComment("UNPACK:" + FileUtils.sha1Hash(file));
}
new CrcAndSize(file).setupStoredEntry(entry);
writeEntry(entry, new InputStreamEntryWriter(new FileInputStream(file), true));
} | java | public void writeNestedLibrary(String destination, Library library)
throws IOException {
File file = library.getFile();
JarEntry entry = new JarEntry(destination + library.getName());
entry.setTime(getNestedLibraryTime(file));
if (library.isUnpackRequired()) {
entry.setComment("UNPACK:" + FileUtils.sha1Hash(file));
}
new CrcAndSize(file).setupStoredEntry(entry);
writeEntry(entry, new InputStreamEntryWriter(new FileInputStream(file), true));
} | [
"public",
"void",
"writeNestedLibrary",
"(",
"String",
"destination",
",",
"Library",
"library",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"library",
".",
"getFile",
"(",
")",
";",
"JarEntry",
"entry",
"=",
"new",
"JarEntry",
"(",
"destination",
... | Write a nested library.
@param destination the destination of the library
@param library the library
@throws IOException if the write fails | [
"Write",
"a",
"nested",
"library",
"."
] | train | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/JarWriter.java#L165-L175 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/ImplDisparityScoreSadRectFive_U8.java | ImplDisparityScoreSadRectFive_U8.computeFirstRow | private void computeFirstRow(GrayU8 left, GrayU8 right ) {
int firstRow[] = verticalScore[0];
activeVerticalScore = 1;
// compute horizontal scores for first row block
for( int row = 0; row < regionHeight; row++ ) {
int scores[] = horizontalScore[row];
UtilDisparityScore.computeScoreRow(left, right, row, scores,
minDisparity, maxDisparity, regionWidth, elementScore);
}
// compute score for the top possible row
for( int i = 0; i < lengthHorizontal; i++ ) {
int sum = 0;
for( int row = 0; row < regionHeight; row++ ) {
sum += horizontalScore[row][i];
}
firstRow[i] = sum;
}
} | java | private void computeFirstRow(GrayU8 left, GrayU8 right ) {
int firstRow[] = verticalScore[0];
activeVerticalScore = 1;
// compute horizontal scores for first row block
for( int row = 0; row < regionHeight; row++ ) {
int scores[] = horizontalScore[row];
UtilDisparityScore.computeScoreRow(left, right, row, scores,
minDisparity, maxDisparity, regionWidth, elementScore);
}
// compute score for the top possible row
for( int i = 0; i < lengthHorizontal; i++ ) {
int sum = 0;
for( int row = 0; row < regionHeight; row++ ) {
sum += horizontalScore[row][i];
}
firstRow[i] = sum;
}
} | [
"private",
"void",
"computeFirstRow",
"(",
"GrayU8",
"left",
",",
"GrayU8",
"right",
")",
"{",
"int",
"firstRow",
"[",
"]",
"=",
"verticalScore",
"[",
"0",
"]",
";",
"activeVerticalScore",
"=",
"1",
";",
"// compute horizontal scores for first row block",
"for",
... | Initializes disparity calculation by finding the scores for the initial block of horizontal
rows. | [
"Initializes",
"disparity",
"calculation",
"by",
"finding",
"the",
"scores",
"for",
"the",
"initial",
"block",
"of",
"horizontal",
"rows",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/ImplDisparityScoreSadRectFive_U8.java#L85-L106 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftsInner.java | RunbookDraftsInner.publishAsync | public Observable<Void> publishAsync(String resourceGroupName, String automationAccountName, String runbookName) {
return publishWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName).map(new Func1<ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> publishAsync(String resourceGroupName, String automationAccountName, String runbookName) {
return publishWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName).map(new Func1<ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"publishAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"runbookName",
")",
"{",
"return",
"publishWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName... | Publish runbook draft.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param runbookName The parameters supplied to the publish runbook operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Publish",
"runbook",
"draft",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftsInner.java#L490-L497 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java | AbstractBigtableAdmin.snapshotTable | protected Operation snapshotTable(String snapshotName, TableName tableName)
throws IOException {
SnapshotTableRequest.Builder requestBuilder = SnapshotTableRequest.newBuilder()
.setCluster(getSnapshotClusterName().toString())
.setSnapshotId(snapshotName)
.setName(options.getInstanceName().toTableNameStr(tableName.getNameAsString()));
int ttlSecs = configuration.getInt(BigtableOptionsFactory.BIGTABLE_SNAPSHOT_DEFAULT_TTL_SECS_KEY, -1);
if (ttlSecs > 0) {
requestBuilder.setTtl(
Duration.newBuilder().setSeconds(ttlSecs).build()
);
}
ApiFuture<Operation> future = tableAdminClientWrapper
.snapshotTableAsync(requestBuilder.build());
return Futures.getChecked(future, IOException.class);
} | java | protected Operation snapshotTable(String snapshotName, TableName tableName)
throws IOException {
SnapshotTableRequest.Builder requestBuilder = SnapshotTableRequest.newBuilder()
.setCluster(getSnapshotClusterName().toString())
.setSnapshotId(snapshotName)
.setName(options.getInstanceName().toTableNameStr(tableName.getNameAsString()));
int ttlSecs = configuration.getInt(BigtableOptionsFactory.BIGTABLE_SNAPSHOT_DEFAULT_TTL_SECS_KEY, -1);
if (ttlSecs > 0) {
requestBuilder.setTtl(
Duration.newBuilder().setSeconds(ttlSecs).build()
);
}
ApiFuture<Operation> future = tableAdminClientWrapper
.snapshotTableAsync(requestBuilder.build());
return Futures.getChecked(future, IOException.class);
} | [
"protected",
"Operation",
"snapshotTable",
"(",
"String",
"snapshotName",
",",
"TableName",
"tableName",
")",
"throws",
"IOException",
"{",
"SnapshotTableRequest",
".",
"Builder",
"requestBuilder",
"=",
"SnapshotTableRequest",
".",
"newBuilder",
"(",
")",
".",
"setClu... | Creates a snapshot from an existing table. NOTE: Cloud Bigtable has a cleanup policy
@param snapshotName a {@link String} object.
@param tableName a {@link TableName} object.
@return a {@link Operation} object.
@throws IOException if any. | [
"Creates",
"a",
"snapshot",
"from",
"an",
"existing",
"table",
".",
"NOTE",
":",
"Cloud",
"Bigtable",
"has",
"a",
"cleanup",
"policy"
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java#L838-L857 |
i-net-software/jlessc | src/com/inet/lib/less/LessException.java | LessException.addPosition | void addPosition( String filename, int line, int column ) {
LessFilePosition pos = new LessFilePosition( filename, line, column );
if( !positions.contains( pos ) ) {
this.positions.add( pos );
}
} | java | void addPosition( String filename, int line, int column ) {
LessFilePosition pos = new LessFilePosition( filename, line, column );
if( !positions.contains( pos ) ) {
this.positions.add( pos );
}
} | [
"void",
"addPosition",
"(",
"String",
"filename",
",",
"int",
"line",
",",
"int",
"column",
")",
"{",
"LessFilePosition",
"pos",
"=",
"new",
"LessFilePosition",
"(",
"filename",
",",
"line",
",",
"column",
")",
";",
"if",
"(",
"!",
"positions",
".",
"con... | Add a position to the less file stacktrace
@param filename the less file, can be null if a string was parsed
@param line the line number in the less file
@param column the column in the less file | [
"Add",
"a",
"position",
"to",
"the",
"less",
"file",
"stacktrace"
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessException.java#L77-L82 |
JOML-CI/JOML | src/org/joml/Intersectiond.java | Intersectiond.intersectRayPlane | public static double intersectRayPlane(Rayd ray, Planed plane, double epsilon) {
return intersectRayPlane(ray.oX, ray.oY, ray.oZ, ray.dX, ray.dY, ray.dZ, plane.a, plane.b, plane.c, plane.d, epsilon);
} | java | public static double intersectRayPlane(Rayd ray, Planed plane, double epsilon) {
return intersectRayPlane(ray.oX, ray.oY, ray.oZ, ray.dX, ray.dY, ray.dZ, plane.a, plane.b, plane.c, plane.d, epsilon);
} | [
"public",
"static",
"double",
"intersectRayPlane",
"(",
"Rayd",
"ray",
",",
"Planed",
"plane",
",",
"double",
"epsilon",
")",
"{",
"return",
"intersectRayPlane",
"(",
"ray",
".",
"oX",
",",
"ray",
".",
"oY",
",",
"ray",
".",
"oZ",
",",
"ray",
".",
"dX"... | Test whether the given ray intersects the given plane, and return the
value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point.
<p>
This method returns <code>-1.0</code> if the ray does not intersect the plane, because it is either parallel to the plane or its direction points
away from the plane or the ray's origin is on the <i>negative</i> side of the plane (i.e. the plane's normal points away from the ray's origin).
<p>
Reference: <a href="https://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm">https://www.siggraph.org/</a>
@param ray
the ray
@param plane
the plane
@param epsilon
some small epsilon for when the ray is parallel to the plane
@return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if the ray
intersects the plane; <code>-1.0</code> otherwise | [
"Test",
"whether",
"the",
"given",
"ray",
"intersects",
"the",
"given",
"plane",
"and",
"return",
"the",
"value",
"of",
"the",
"parameter",
"<i",
">",
"t<",
"/",
"i",
">",
"in",
"the",
"ray",
"equation",
"<i",
">",
"p",
"(",
"t",
")",
"=",
"origin",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L1106-L1108 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/GVRAsynchronousResourceLoader.java | GVRAsynchronousResourceLoader.decodeStream | public static Bitmap decodeStream(InputStream stream, boolean closeStream) {
return AsyncBitmapTexture.decodeStream(stream,
AsyncBitmapTexture.glMaxTextureSize,
AsyncBitmapTexture.glMaxTextureSize, true, null, closeStream);
} | java | public static Bitmap decodeStream(InputStream stream, boolean closeStream) {
return AsyncBitmapTexture.decodeStream(stream,
AsyncBitmapTexture.glMaxTextureSize,
AsyncBitmapTexture.glMaxTextureSize, true, null, closeStream);
} | [
"public",
"static",
"Bitmap",
"decodeStream",
"(",
"InputStream",
"stream",
",",
"boolean",
"closeStream",
")",
"{",
"return",
"AsyncBitmapTexture",
".",
"decodeStream",
"(",
"stream",
",",
"AsyncBitmapTexture",
".",
"glMaxTextureSize",
",",
"AsyncBitmapTexture",
".",... | An internal method, public only so that GVRContext can make cross-package
calls.
A synchronous (blocking) wrapper around
{@link android.graphics.BitmapFactory#decodeStream(InputStream)
BitmapFactory.decodeStream} that uses an
{@link android.graphics.BitmapFactory.Options} <code>inTempStorage</code>
decode buffer. On low memory, returns half (quarter, eighth, ...) size
images.
<p>
If {@code stream} is a {@link FileInputStream} and is at offset 0 (zero),
uses
{@link android.graphics.BitmapFactory#decodeFileDescriptor(FileDescriptor)
BitmapFactory.decodeFileDescriptor()} instead of
{@link android.graphics.BitmapFactory#decodeStream(InputStream)
BitmapFactory.decodeStream()}.
@param stream
Bitmap stream
@param closeStream
If {@code true}, closes {@code stream}
@return Bitmap, or null if cannot be decoded into a bitmap | [
"An",
"internal",
"method",
"public",
"only",
"so",
"that",
"GVRContext",
"can",
"make",
"cross",
"-",
"package",
"calls",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/GVRAsynchronousResourceLoader.java#L668-L672 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/store/AbstractStoreResource.java | AbstractStoreResource.getGeneralID | private void getGeneralID(final String _complStmt)
throws EFapsException
{
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
while (rs.next()) {
this.generalID = rs.getLong(1);
this.fileName = rs.getString(2);
if (this.fileName != null && !this.fileName.isEmpty()) {
this.fileName = this.fileName.trim();
}
this.fileLength = rs.getLong(3);
for (int i = 0; i < this.exist.length; i++) {
this.exist[i] = rs.getLong(4 + i) > 0;
}
getAdditionalInfo(rs);
}
rs.close();
stmt.close();
} catch (final SQLException e) {
throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e);
}
} | java | private void getGeneralID(final String _complStmt)
throws EFapsException
{
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
while (rs.next()) {
this.generalID = rs.getLong(1);
this.fileName = rs.getString(2);
if (this.fileName != null && !this.fileName.isEmpty()) {
this.fileName = this.fileName.trim();
}
this.fileLength = rs.getLong(3);
for (int i = 0; i < this.exist.length; i++) {
this.exist[i] = rs.getLong(4 + i) > 0;
}
getAdditionalInfo(rs);
}
rs.close();
stmt.close();
} catch (final SQLException e) {
throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e);
}
} | [
"private",
"void",
"getGeneralID",
"(",
"final",
"String",
"_complStmt",
")",
"throws",
"EFapsException",
"{",
"ConnectionResource",
"con",
"=",
"null",
";",
"try",
"{",
"con",
"=",
"Context",
".",
"getThreadContext",
"(",
")",
".",
"getConnectionResource",
"(",... | Get the generalID etc. from the eFasp DataBase.
@param _complStmt Statement to be executed
@throws EFapsException on error | [
"Get",
"the",
"generalID",
"etc",
".",
"from",
"the",
"eFasp",
"DataBase",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/AbstractStoreResource.java#L305-L333 |
jamesagnew/hapi-fhir | hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/client/ClientUtils.java | ClientUtils.unmarshalReference | @SuppressWarnings("unchecked")
protected <T extends Resource> T unmarshalReference(HttpResponse response, String format) {
T resource = null;
OperationOutcome error = null;
byte[] cnt = log(response);
if (cnt != null) {
try {
resource = (T)getParser(format).parse(cnt);
if (resource instanceof OperationOutcome && hasError((OperationOutcome)resource)) {
error = (OperationOutcome) resource;
}
} catch(IOException ioe) {
throw new EFhirClientException("Error reading Http Response: "+ioe.getMessage(), ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message: "+e.getMessage(), e);
}
}
if(error != null) {
throw new EFhirClientException("Error from server: "+ResourceUtilities.getErrorDescription(error), error);
}
return resource;
} | java | @SuppressWarnings("unchecked")
protected <T extends Resource> T unmarshalReference(HttpResponse response, String format) {
T resource = null;
OperationOutcome error = null;
byte[] cnt = log(response);
if (cnt != null) {
try {
resource = (T)getParser(format).parse(cnt);
if (resource instanceof OperationOutcome && hasError((OperationOutcome)resource)) {
error = (OperationOutcome) resource;
}
} catch(IOException ioe) {
throw new EFhirClientException("Error reading Http Response: "+ioe.getMessage(), ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message: "+e.getMessage(), e);
}
}
if(error != null) {
throw new EFhirClientException("Error from server: "+ResourceUtilities.getErrorDescription(error), error);
}
return resource;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"T",
"extends",
"Resource",
">",
"T",
"unmarshalReference",
"(",
"HttpResponse",
"response",
",",
"String",
"format",
")",
"{",
"T",
"resource",
"=",
"null",
";",
"OperationOutcome",
"error",
... | Unmarshals a resource from the response stream.
@param response
@return | [
"Unmarshals",
"a",
"resource",
"from",
"the",
"response",
"stream",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/client/ClientUtils.java#L324-L345 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/IoUtils.java | IoUtils.copy | public static long copy(InputStream input, OutputStream output) throws IOException {
byte[] buffer = new byte[2 * 1024];
long total = 0;
int count;
while ((count = input.read(buffer)) != -1) {
output.write(buffer, 0, count);
total += count;
}
return total;
} | java | public static long copy(InputStream input, OutputStream output) throws IOException {
byte[] buffer = new byte[2 * 1024];
long total = 0;
int count;
while ((count = input.read(buffer)) != -1) {
output.write(buffer, 0, count);
total += count;
}
return total;
} | [
"public",
"static",
"long",
"copy",
"(",
"InputStream",
"input",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"2",
"*",
"1024",
"]",
";",
"long",
"total",
"=",
"0",
";",
"int",
... | Copies all data from an InputStream to an OutputStream.
@return the number of bytes copied
@throws IOException if an I/O error occurs | [
"Copies",
"all",
"data",
"from",
"an",
"InputStream",
"to",
"an",
"OutputStream",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/IoUtils.java#L46-L56 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/plugins/util/DescriptionBuilder.java | DescriptionBuilder.frameworkMapping | public DescriptionBuilder frameworkMapping(final String key, final String name) {
fwkmapping.put(key, name);
return this;
} | java | public DescriptionBuilder frameworkMapping(final String key, final String name) {
fwkmapping.put(key, name);
return this;
} | [
"public",
"DescriptionBuilder",
"frameworkMapping",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"name",
")",
"{",
"fwkmapping",
".",
"put",
"(",
"key",
",",
"name",
")",
";",
"return",
"this",
";",
"}"
] | Add a property mapping for framework properties
@param key property key
@param name a property name mapping
@return this builder | [
"Add",
"a",
"property",
"mapping",
"for",
"framework",
"properties",
"@param",
"key",
"property",
"key",
"@param",
"name",
"a",
"property",
"name",
"mapping"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/plugins/util/DescriptionBuilder.java#L140-L143 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.sameValue | protected boolean sameValue(Object newValue, Object currentValue) {
if (newValue == NOT_FOUND) {
return true;
}
if (currentValue == NOT_FOUND) {
currentValue = Undefined.instance;
}
// Special rules for numbers: NaN is considered the same value,
// while zeroes with different signs are considered different.
if (currentValue instanceof Number && newValue instanceof Number) {
double d1 = ((Number)currentValue).doubleValue();
double d2 = ((Number)newValue).doubleValue();
if (Double.isNaN(d1) && Double.isNaN(d2)) {
return true;
}
if (d1 == 0.0 && Double.doubleToLongBits(d1) != Double.doubleToLongBits(d2)) {
return false;
}
}
return ScriptRuntime.shallowEq(currentValue, newValue);
} | java | protected boolean sameValue(Object newValue, Object currentValue) {
if (newValue == NOT_FOUND) {
return true;
}
if (currentValue == NOT_FOUND) {
currentValue = Undefined.instance;
}
// Special rules for numbers: NaN is considered the same value,
// while zeroes with different signs are considered different.
if (currentValue instanceof Number && newValue instanceof Number) {
double d1 = ((Number)currentValue).doubleValue();
double d2 = ((Number)newValue).doubleValue();
if (Double.isNaN(d1) && Double.isNaN(d2)) {
return true;
}
if (d1 == 0.0 && Double.doubleToLongBits(d1) != Double.doubleToLongBits(d2)) {
return false;
}
}
return ScriptRuntime.shallowEq(currentValue, newValue);
} | [
"protected",
"boolean",
"sameValue",
"(",
"Object",
"newValue",
",",
"Object",
"currentValue",
")",
"{",
"if",
"(",
"newValue",
"==",
"NOT_FOUND",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"currentValue",
"==",
"NOT_FOUND",
")",
"{",
"currentValue",
... | Implements SameValue as described in ES5 9.12, additionally checking
if new value is defined.
@param newValue the new value
@param currentValue the current value
@return true if values are the same as defined by ES5 9.12 | [
"Implements",
"SameValue",
"as",
"described",
"in",
"ES5",
"9",
".",
"12",
"additionally",
"checking",
"if",
"new",
"value",
"is",
"defined",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L2044-L2064 |
ACRA/acra | acra-http/src/main/java/org/acra/security/KeyStoreHelper.java | KeyStoreHelper.getKeyStore | @Nullable
public static KeyStore getKeyStore(@NonNull Context context, @NonNull CoreConfiguration config) {
final HttpSenderConfiguration senderConfiguration = ConfigUtils.getPluginConfiguration(config, HttpSenderConfiguration.class);
final InstanceCreator instanceCreator = new InstanceCreator();
KeyStore keyStore = instanceCreator.create(senderConfiguration.keyStoreFactoryClass(), NoKeyStoreFactory::new).create(context);
if(keyStore == null) {
//either users factory did not create a keystore, or the configuration is default {@link NoKeyStoreFactory}
final int certificateRes = senderConfiguration.resCertificate();
final String certificatePath = senderConfiguration.certificatePath();
final String certificateType = senderConfiguration.certificateType();
if(certificateRes != ACRAConstants.DEFAULT_RES_VALUE){
keyStore = new ResourceKeyStoreFactory(certificateType, certificateRes).create(context);
}else if(!certificatePath.equals(ACRAConstants.DEFAULT_STRING_VALUE)){
if(certificatePath.startsWith(ASSET_PREFIX)) {
keyStore = new AssetKeyStoreFactory(certificateType, certificatePath.substring(ASSET_PREFIX.length())).create(context);
} else {
keyStore = new FileKeyStoreFactory(certificateType, certificatePath).create(context);
}
}
}
return keyStore;
} | java | @Nullable
public static KeyStore getKeyStore(@NonNull Context context, @NonNull CoreConfiguration config) {
final HttpSenderConfiguration senderConfiguration = ConfigUtils.getPluginConfiguration(config, HttpSenderConfiguration.class);
final InstanceCreator instanceCreator = new InstanceCreator();
KeyStore keyStore = instanceCreator.create(senderConfiguration.keyStoreFactoryClass(), NoKeyStoreFactory::new).create(context);
if(keyStore == null) {
//either users factory did not create a keystore, or the configuration is default {@link NoKeyStoreFactory}
final int certificateRes = senderConfiguration.resCertificate();
final String certificatePath = senderConfiguration.certificatePath();
final String certificateType = senderConfiguration.certificateType();
if(certificateRes != ACRAConstants.DEFAULT_RES_VALUE){
keyStore = new ResourceKeyStoreFactory(certificateType, certificateRes).create(context);
}else if(!certificatePath.equals(ACRAConstants.DEFAULT_STRING_VALUE)){
if(certificatePath.startsWith(ASSET_PREFIX)) {
keyStore = new AssetKeyStoreFactory(certificateType, certificatePath.substring(ASSET_PREFIX.length())).create(context);
} else {
keyStore = new FileKeyStoreFactory(certificateType, certificatePath).create(context);
}
}
}
return keyStore;
} | [
"@",
"Nullable",
"public",
"static",
"KeyStore",
"getKeyStore",
"(",
"@",
"NonNull",
"Context",
"context",
",",
"@",
"NonNull",
"CoreConfiguration",
"config",
")",
"{",
"final",
"HttpSenderConfiguration",
"senderConfiguration",
"=",
"ConfigUtils",
".",
"getPluginConfi... | try to get the keystore
@param context a context
@param config the configuration
@return the keystore, or null if none provided / failure | [
"try",
"to",
"get",
"the",
"keystore"
] | train | https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-http/src/main/java/org/acra/security/KeyStoreHelper.java#L48-L69 |
JodaOrg/joda-time | src/main/java/org/joda/time/TimeOfDay.java | TimeOfDay.withHourOfDay | public TimeOfDay withHourOfDay(int hour) {
int[] newValues = getValues();
newValues = getChronology().hourOfDay().set(this, HOUR_OF_DAY, newValues, hour);
return new TimeOfDay(this, newValues);
} | java | public TimeOfDay withHourOfDay(int hour) {
int[] newValues = getValues();
newValues = getChronology().hourOfDay().set(this, HOUR_OF_DAY, newValues, hour);
return new TimeOfDay(this, newValues);
} | [
"public",
"TimeOfDay",
"withHourOfDay",
"(",
"int",
"hour",
")",
"{",
"int",
"[",
"]",
"newValues",
"=",
"getValues",
"(",
")",
";",
"newValues",
"=",
"getChronology",
"(",
")",
".",
"hourOfDay",
"(",
")",
".",
"set",
"(",
"this",
",",
"HOUR_OF_DAY",
"... | Returns a copy of this time with the hour of day field updated.
<p>
TimeOfDay is immutable, so there are no set methods.
Instead, this method returns a new instance with the value of
hour of day changed.
@param hour the hour of day to set
@return a copy of this object with the field set
@throws IllegalArgumentException if the value is invalid
@since 1.3 | [
"Returns",
"a",
"copy",
"of",
"this",
"time",
"with",
"the",
"hour",
"of",
"day",
"field",
"updated",
".",
"<p",
">",
"TimeOfDay",
"is",
"immutable",
"so",
"there",
"are",
"no",
"set",
"methods",
".",
"Instead",
"this",
"method",
"returns",
"a",
"new",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/TimeOfDay.java#L900-L904 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java | ConvertBufferedImage.checkInputs | public static BufferedImage checkInputs(ImageBase src, BufferedImage dst) {
if (dst != null) {
if (dst.getWidth() != src.getWidth() || dst.getHeight() != src.getHeight()) {
throw new IllegalArgumentException("Shapes do not match: "+
"src = ( "+src.width+" , "+src.height+" ) " +
"dst = ( "+dst.getWidth()+" , "+dst.getHeight()+" )");
}
} else {
if(src instanceof GrayI8)
dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
else if(src instanceof GrayF)
// no good equivalent. Just assume the image is a regular gray scale image
// with pixel values from 0 to 255
dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
// throw new RuntimeException("Fail!");
else if(src instanceof GrayI)
// no good equivalent. I'm giving it the biggest pixel for the range
dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_USHORT_GRAY);
else
dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
}
return dst;
} | java | public static BufferedImage checkInputs(ImageBase src, BufferedImage dst) {
if (dst != null) {
if (dst.getWidth() != src.getWidth() || dst.getHeight() != src.getHeight()) {
throw new IllegalArgumentException("Shapes do not match: "+
"src = ( "+src.width+" , "+src.height+" ) " +
"dst = ( "+dst.getWidth()+" , "+dst.getHeight()+" )");
}
} else {
if(src instanceof GrayI8)
dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
else if(src instanceof GrayF)
// no good equivalent. Just assume the image is a regular gray scale image
// with pixel values from 0 to 255
dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
// throw new RuntimeException("Fail!");
else if(src instanceof GrayI)
// no good equivalent. I'm giving it the biggest pixel for the range
dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_USHORT_GRAY);
else
dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
}
return dst;
} | [
"public",
"static",
"BufferedImage",
"checkInputs",
"(",
"ImageBase",
"src",
",",
"BufferedImage",
"dst",
")",
"{",
"if",
"(",
"dst",
"!=",
"null",
")",
"{",
"if",
"(",
"dst",
".",
"getWidth",
"(",
")",
"!=",
"src",
".",
"getWidth",
"(",
")",
"||",
"... | If null the dst is declared, otherwise it checks to see if the 'dst' as the same shape as 'src'. | [
"If",
"null",
"the",
"dst",
"is",
"declared",
"otherwise",
"it",
"checks",
"to",
"see",
"if",
"the",
"dst",
"as",
"the",
"same",
"shape",
"as",
"src",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L884-L906 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/extension/index/FeatureTableIndex.java | FeatureTableIndex.indexRows | private int indexRows(TableIndex tableIndex, FeatureResultSet resultSet) {
int count = -1;
try {
while ((progress == null || progress.isActive())
&& resultSet.moveToNext()) {
if (count < 0) {
count++;
}
try {
FeatureRow row = resultSet.getRow();
boolean indexed = index(tableIndex, row.getId(),
row.getGeometry());
if (indexed) {
count++;
}
if (progress != null) {
progress.addProgress(1);
}
} catch (Exception e) {
log.log(Level.SEVERE, "Failed to index feature. Table: "
+ tableIndex.getTableName() + ", Position: "
+ resultSet.getPosition(), e);
}
}
} finally {
resultSet.close();
}
return count;
} | java | private int indexRows(TableIndex tableIndex, FeatureResultSet resultSet) {
int count = -1;
try {
while ((progress == null || progress.isActive())
&& resultSet.moveToNext()) {
if (count < 0) {
count++;
}
try {
FeatureRow row = resultSet.getRow();
boolean indexed = index(tableIndex, row.getId(),
row.getGeometry());
if (indexed) {
count++;
}
if (progress != null) {
progress.addProgress(1);
}
} catch (Exception e) {
log.log(Level.SEVERE, "Failed to index feature. Table: "
+ tableIndex.getTableName() + ", Position: "
+ resultSet.getPosition(), e);
}
}
} finally {
resultSet.close();
}
return count;
} | [
"private",
"int",
"indexRows",
"(",
"TableIndex",
"tableIndex",
",",
"FeatureResultSet",
"resultSet",
")",
"{",
"int",
"count",
"=",
"-",
"1",
";",
"try",
"{",
"while",
"(",
"(",
"progress",
"==",
"null",
"||",
"progress",
".",
"isActive",
"(",
")",
")",... | Index the feature rows in the cursor
@param tableIndex
table index
@param resultSet
feature result
@return count, -1 if no results or canceled | [
"Index",
"the",
"feature",
"rows",
"in",
"the",
"cursor"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/extension/index/FeatureTableIndex.java#L160-L191 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java | CustomerNoteUrl.deleteAccountNoteUrl | public static MozuUrl deleteAccountNoteUrl(Integer accountId, Integer noteId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes/{noteId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("noteId", noteId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteAccountNoteUrl(Integer accountId, Integer noteId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/notes/{noteId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("noteId", noteId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteAccountNoteUrl",
"(",
"Integer",
"accountId",
",",
"Integer",
"noteId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/accounts/{accountId}/notes/{noteId}\"",
")",
";",
"formatter",
"... | Get Resource Url for DeleteAccountNote
@param accountId Unique identifier of the customer account.
@param noteId Unique identifier of a particular note to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteAccountNote"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerNoteUrl.java#L90-L96 |
alkacon/opencms-core | src/org/opencms/ui/apps/dbmanager/CmsPropertyTable.java | CmsPropertyTable.filterTable | public void filterTable(String search) {
m_container.removeAllContainerFilters();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) {
m_container.addContainerFilter(new Or(new SimpleStringFilter(TableColumn.Name, search, true, false)));
}
} | java | public void filterTable(String search) {
m_container.removeAllContainerFilters();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) {
m_container.addContainerFilter(new Or(new SimpleStringFilter(TableColumn.Name, search, true, false)));
}
} | [
"public",
"void",
"filterTable",
"(",
"String",
"search",
")",
"{",
"m_container",
".",
"removeAllContainerFilters",
"(",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmptyOrWhitespaceOnly",
"(",
"search",
")",
")",
"{",
"m_container",
".",
"addContainerFilter... | Filters the table according to given search string.<p>
@param search string to be looked for. | [
"Filters",
"the",
"table",
"according",
"to",
"given",
"search",
"string",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/CmsPropertyTable.java#L270-L276 |
casmi/casmi | src/main/java/casmi/graphics/element/Element.java | Element.setScale | public void setScale(double scaleX, double scaleY, double scaleZ) {
this.scaleX = scaleX;
this.scaleY = scaleY;
this.scaleZ = scaleZ;
} | java | public void setScale(double scaleX, double scaleY, double scaleZ) {
this.scaleX = scaleX;
this.scaleY = scaleY;
this.scaleZ = scaleZ;
} | [
"public",
"void",
"setScale",
"(",
"double",
"scaleX",
",",
"double",
"scaleY",
",",
"double",
"scaleZ",
")",
"{",
"this",
".",
"scaleX",
"=",
"scaleX",
";",
"this",
".",
"scaleY",
"=",
"scaleY",
";",
"this",
".",
"scaleZ",
"=",
"scaleZ",
";",
"}"
] | Sets the scale of the Element
@param scaleX
The scale of the Element of x-axis direction
@param scaleY
The scale of the Element of y-axis direction
@param scaleZ
The scale of the Element of z-axis direction | [
"Sets",
"the",
"scale",
"of",
"the",
"Element"
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Element.java#L627-L631 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_replicateconfig.java | br_replicateconfig.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_replicateconfig_responses result = (br_replicateconfig_responses) service.get_payload_formatter().string_to_resource(br_replicateconfig_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_replicateconfig_response_array);
}
br_replicateconfig[] result_br_replicateconfig = new br_replicateconfig[result.br_replicateconfig_response_array.length];
for(int i = 0; i < result.br_replicateconfig_response_array.length; i++)
{
result_br_replicateconfig[i] = result.br_replicateconfig_response_array[i].br_replicateconfig[0];
}
return result_br_replicateconfig;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_replicateconfig_responses result = (br_replicateconfig_responses) service.get_payload_formatter().string_to_resource(br_replicateconfig_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_replicateconfig_response_array);
}
br_replicateconfig[] result_br_replicateconfig = new br_replicateconfig[result.br_replicateconfig_response_array.length];
for(int i = 0; i < result.br_replicateconfig_response_array.length; i++)
{
result_br_replicateconfig[i] = result.br_replicateconfig_response_array[i].br_replicateconfig[0];
}
return result_br_replicateconfig;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"br_replicateconfig_responses",
"result",
"=",
"(",
"br_replicateconfig_responses",
")",
"service",
".",
"get_... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_replicateconfig.java#L157-L174 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java | GeometryTools.getClosestAtom | public static IAtom getClosestAtom(IAtomContainer atomCon, IAtom atom) {
IAtom closestAtom = null;
double min = Double.MAX_VALUE;
Point2d atomPosition = atom.getPoint2d();
for (int i = 0; i < atomCon.getAtomCount(); i++) {
IAtom currentAtom = atomCon.getAtom(i);
if (!currentAtom.equals(atom)) {
double d = atomPosition.distance(currentAtom.getPoint2d());
if (d < min) {
min = d;
closestAtom = currentAtom;
}
}
}
return closestAtom;
} | java | public static IAtom getClosestAtom(IAtomContainer atomCon, IAtom atom) {
IAtom closestAtom = null;
double min = Double.MAX_VALUE;
Point2d atomPosition = atom.getPoint2d();
for (int i = 0; i < atomCon.getAtomCount(); i++) {
IAtom currentAtom = atomCon.getAtom(i);
if (!currentAtom.equals(atom)) {
double d = atomPosition.distance(currentAtom.getPoint2d());
if (d < min) {
min = d;
closestAtom = currentAtom;
}
}
}
return closestAtom;
} | [
"public",
"static",
"IAtom",
"getClosestAtom",
"(",
"IAtomContainer",
"atomCon",
",",
"IAtom",
"atom",
")",
"{",
"IAtom",
"closestAtom",
"=",
"null",
";",
"double",
"min",
"=",
"Double",
".",
"MAX_VALUE",
";",
"Point2d",
"atomPosition",
"=",
"atom",
".",
"ge... | Returns the atom of the given molecule that is closest to the given atom
(excluding itself).
@param atomCon The molecule that is searched for the closest atom
@param atom The atom to search around
@return The atom that is closest to the given coordinates | [
"Returns",
"the",
"atom",
"of",
"the",
"given",
"molecule",
"that",
"is",
"closest",
"to",
"the",
"given",
"atom",
"(",
"excluding",
"itself",
")",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L707-L722 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/Client.java | Client.deleteApplication | public boolean deleteApplication(String appName, String key) {
Utils.require(!m_restClient.isClosed(), "Client has been closed");
Utils.require(appName != null && appName.length() > 0, "appName");
try {
// Send a DELETE request to "/_applications/{application}/{key}".
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_apiPrefix) ? "" : "/" + m_apiPrefix);
uri.append("/_applications/");
uri.append(Utils.urlEncode(appName));
if (!Utils.isEmpty(key)) {
uri.append("/");
uri.append(Utils.urlEncode(key));
}
RESTResponse response = m_restClient.sendRequest(HttpMethod.DELETE, uri.toString());
m_logger.debug("deleteApplication() response: {}", response.toString());
if (response.getCode() != HttpCode.NOT_FOUND) {
// Notfound is acceptable
throwIfErrorResponse(response);
}
return true;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public boolean deleteApplication(String appName, String key) {
Utils.require(!m_restClient.isClosed(), "Client has been closed");
Utils.require(appName != null && appName.length() > 0, "appName");
try {
// Send a DELETE request to "/_applications/{application}/{key}".
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_apiPrefix) ? "" : "/" + m_apiPrefix);
uri.append("/_applications/");
uri.append(Utils.urlEncode(appName));
if (!Utils.isEmpty(key)) {
uri.append("/");
uri.append(Utils.urlEncode(key));
}
RESTResponse response = m_restClient.sendRequest(HttpMethod.DELETE, uri.toString());
m_logger.debug("deleteApplication() response: {}", response.toString());
if (response.getCode() != HttpCode.NOT_FOUND) {
// Notfound is acceptable
throwIfErrorResponse(response);
}
return true;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"boolean",
"deleteApplication",
"(",
"String",
"appName",
",",
"String",
"key",
")",
"{",
"Utils",
".",
"require",
"(",
"!",
"m_restClient",
".",
"isClosed",
"(",
")",
",",
"\"Client has been closed\"",
")",
";",
"Utils",
".",
"require",
"(",
"appN... | Delete an existing application from the current Doradus tenant, including all of
its tables and data. Because updates are idempotent, deleting an already-deleted
application is acceptable. Hence, if no error is thrown, the result is always true.
An exception is thrown if an error occurs.
@param appName Name of existing application to delete.
@param key Key of application to delete. Can be null if the application has
no key.
@return True if the application was deleted or already deleted. | [
"Delete",
"an",
"existing",
"application",
"from",
"the",
"current",
"Doradus",
"tenant",
"including",
"all",
"of",
"its",
"tables",
"and",
"data",
".",
"Because",
"updates",
"are",
"idempotent",
"deleting",
"an",
"already",
"-",
"deleted",
"application",
"is",
... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/Client.java#L403-L426 |
elibom/jogger | src/main/java/com/elibom/jogger/http/servlet/multipart/ParameterParser.java | ParameterParser.parse | public Map<String,String> parse(final char[] chars, char separator) {
if (chars == null) {
return new HashMap<String,String>();
}
return parse(chars, 0, chars.length, separator);
} | java | public Map<String,String> parse(final char[] chars, char separator) {
if (chars == null) {
return new HashMap<String,String>();
}
return parse(chars, 0, chars.length, separator);
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"parse",
"(",
"final",
"char",
"[",
"]",
"chars",
",",
"char",
"separator",
")",
"{",
"if",
"(",
"chars",
"==",
"null",
")",
"{",
"return",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"("... | Extracts a map of name/value pairs from the given array of characters. Names are expected to be unique.
@param chars the array of characters that contains a sequence of name/value pairs
@param separator the name/value pairs separator
@return a map of name/value pairs | [
"Extracts",
"a",
"map",
"of",
"name",
"/",
"value",
"pairs",
"from",
"the",
"given",
"array",
"of",
"characters",
".",
"Names",
"are",
"expected",
"to",
"be",
"unique",
"."
] | train | https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/http/servlet/multipart/ParameterParser.java#L251-L256 |
bekkopen/NoCommons | src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java | NorwegianDateUtil.checkDate | private static boolean checkDate(Calendar cal, Calendar other) {
return checkDate(cal, other.get(Calendar.DATE), other.get(Calendar.MONTH));
} | java | private static boolean checkDate(Calendar cal, Calendar other) {
return checkDate(cal, other.get(Calendar.DATE), other.get(Calendar.MONTH));
} | [
"private",
"static",
"boolean",
"checkDate",
"(",
"Calendar",
"cal",
",",
"Calendar",
"other",
")",
"{",
"return",
"checkDate",
"(",
"cal",
",",
"other",
".",
"get",
"(",
"Calendar",
".",
"DATE",
")",
",",
"other",
".",
"get",
"(",
"Calendar",
".",
"MO... | Check if the given dates match on day and month.
@param cal
The Calendar representing the first date.
@param other
The Calendar representing the second date.
@return true if they match, false otherwise. | [
"Check",
"if",
"the",
"given",
"dates",
"match",
"on",
"day",
"and",
"month",
"."
] | train | https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L216-L218 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/CommonSuffixExtractor.java | CommonSuffixExtractor.extractSuffix | public List<String> extractSuffix(int length, int size, boolean extend)
{
TFDictionary suffixTreeSet = new TFDictionary();
for (String key : tfDictionary.keySet())
{
if (key.length() > length)
{
suffixTreeSet.add(key.substring(key.length() - length, key.length()));
if (extend)
{
for (int l = 1; l < length; ++l)
{
suffixTreeSet.add(key.substring(key.length() - l, key.length()));
}
}
}
}
if (extend)
{
size *= length;
}
return extract(suffixTreeSet, size);
} | java | public List<String> extractSuffix(int length, int size, boolean extend)
{
TFDictionary suffixTreeSet = new TFDictionary();
for (String key : tfDictionary.keySet())
{
if (key.length() > length)
{
suffixTreeSet.add(key.substring(key.length() - length, key.length()));
if (extend)
{
for (int l = 1; l < length; ++l)
{
suffixTreeSet.add(key.substring(key.length() - l, key.length()));
}
}
}
}
if (extend)
{
size *= length;
}
return extract(suffixTreeSet, size);
} | [
"public",
"List",
"<",
"String",
">",
"extractSuffix",
"(",
"int",
"length",
",",
"int",
"size",
",",
"boolean",
"extend",
")",
"{",
"TFDictionary",
"suffixTreeSet",
"=",
"new",
"TFDictionary",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"tfDictionary... | 提取公共后缀
@param length 公共后缀长度
@param size 频率最高的前多少个公共后缀
@param extend 长度是否拓展为从1到length为止的后缀
@return 公共后缀列表 | [
"提取公共后缀"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/CommonSuffixExtractor.java#L54-L78 |
GerdHolz/TOVAL | src/de/invation/code/toval/graphic/util/GraphicUtils.java | GraphicUtils.fillCircle | public static void fillCircle(Graphics g, Point center, int diameter){
fillCircle(g, (int) center.getX(), (int) center.getY(), diameter);
} | java | public static void fillCircle(Graphics g, Point center, int diameter){
fillCircle(g, (int) center.getX(), (int) center.getY(), diameter);
} | [
"public",
"static",
"void",
"fillCircle",
"(",
"Graphics",
"g",
",",
"Point",
"center",
",",
"int",
"diameter",
")",
"{",
"fillCircle",
"(",
"g",
",",
"(",
"int",
")",
"center",
".",
"getX",
"(",
")",
",",
"(",
"int",
")",
"center",
".",
"getY",
"(... | Draws a circle with the specified diameter using the given point as center
and fills it with the current color of the graphics context.
@param g Graphics context
@param center Circle center
@param diameter Circle diameter | [
"Draws",
"a",
"circle",
"with",
"the",
"specified",
"diameter",
"using",
"the",
"given",
"point",
"as",
"center",
"and",
"fills",
"it",
"with",
"the",
"current",
"color",
"of",
"the",
"graphics",
"context",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L41-L43 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java | PoiUtil.addImage | @SneakyThrows
public static void addImage(Sheet sheet, String cpImageName, String anchorCellReference) {
// add a picture shape
val anchor = sheet.getWorkbook().getCreationHelper().createClientAnchor();
anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
// subsequent call of Picture#resize() will operate relative to it
val cr = new CellReference(anchorCellReference);
anchor.setCol1(cr.getCol());
anchor.setRow1(cr.getRow());
// Create the drawing patriarch. This is the top level container for all shapes.
@Cleanup val p = Classpath.loadRes(cpImageName);
val picIndex = sheet.getWorkbook().addPicture(toByteArray(p), getPictureType(cpImageName));
val pic = sheet.createDrawingPatriarch().createPicture(anchor, picIndex);
// auto-size picture relative to its top-left corner
pic.resize();
} | java | @SneakyThrows
public static void addImage(Sheet sheet, String cpImageName, String anchorCellReference) {
// add a picture shape
val anchor = sheet.getWorkbook().getCreationHelper().createClientAnchor();
anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
// subsequent call of Picture#resize() will operate relative to it
val cr = new CellReference(anchorCellReference);
anchor.setCol1(cr.getCol());
anchor.setRow1(cr.getRow());
// Create the drawing patriarch. This is the top level container for all shapes.
@Cleanup val p = Classpath.loadRes(cpImageName);
val picIndex = sheet.getWorkbook().addPicture(toByteArray(p), getPictureType(cpImageName));
val pic = sheet.createDrawingPatriarch().createPicture(anchor, picIndex);
// auto-size picture relative to its top-left corner
pic.resize();
} | [
"@",
"SneakyThrows",
"public",
"static",
"void",
"addImage",
"(",
"Sheet",
"sheet",
",",
"String",
"cpImageName",
",",
"String",
"anchorCellReference",
")",
"{",
"// add a picture shape",
"val",
"anchor",
"=",
"sheet",
".",
"getWorkbook",
"(",
")",
".",
"getCrea... | 增加一张图片。
@param sheet 表单
@param cpImageName 类路径中的图片文件名称
@param anchorCellReference 图片锚定单元格索引 | [
"增加一张图片。"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L427-L444 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java | SARLProjectConfigurator.configureSARLSourceFolders | public static void configureSARLSourceFolders(IProject project, boolean createFolders, IProgressMonitor monitor) {
try {
final SubMonitor subMonitor = SubMonitor.convert(monitor, 8);
final OutParameter<IFolder[]> sourceFolders = new OutParameter<>();
final OutParameter<IFolder[]> testSourceFolders = new OutParameter<>();
final OutParameter<IFolder[]> generationFolders = new OutParameter<>();
final OutParameter<IFolder[]> testGenerationFolders = new OutParameter<>();
final OutParameter<IFolder> testOutputFolder = new OutParameter<>();
ensureSourceFolders(project, createFolders, subMonitor,
sourceFolders, testSourceFolders,
generationFolders, testGenerationFolders,
null,
null,
testOutputFolder);
final IJavaProject javaProject = JavaCore.create(project);
subMonitor.worked(1);
// Build path
BuildPathsBlock.flush(
buildClassPathEntries(javaProject,
sourceFolders.get(),
testSourceFolders.get(),
generationFolders.get(),
testGenerationFolders.get(),
testOutputFolder.get().getFullPath(),
true, false),
javaProject.getOutputLocation(), javaProject, null, subMonitor.newChild(1));
subMonitor.done();
} catch (CoreException exception) {
SARLEclipsePlugin.getDefault().log(exception);
}
} | java | public static void configureSARLSourceFolders(IProject project, boolean createFolders, IProgressMonitor monitor) {
try {
final SubMonitor subMonitor = SubMonitor.convert(monitor, 8);
final OutParameter<IFolder[]> sourceFolders = new OutParameter<>();
final OutParameter<IFolder[]> testSourceFolders = new OutParameter<>();
final OutParameter<IFolder[]> generationFolders = new OutParameter<>();
final OutParameter<IFolder[]> testGenerationFolders = new OutParameter<>();
final OutParameter<IFolder> testOutputFolder = new OutParameter<>();
ensureSourceFolders(project, createFolders, subMonitor,
sourceFolders, testSourceFolders,
generationFolders, testGenerationFolders,
null,
null,
testOutputFolder);
final IJavaProject javaProject = JavaCore.create(project);
subMonitor.worked(1);
// Build path
BuildPathsBlock.flush(
buildClassPathEntries(javaProject,
sourceFolders.get(),
testSourceFolders.get(),
generationFolders.get(),
testGenerationFolders.get(),
testOutputFolder.get().getFullPath(),
true, false),
javaProject.getOutputLocation(), javaProject, null, subMonitor.newChild(1));
subMonitor.done();
} catch (CoreException exception) {
SARLEclipsePlugin.getDefault().log(exception);
}
} | [
"public",
"static",
"void",
"configureSARLSourceFolders",
"(",
"IProject",
"project",
",",
"boolean",
"createFolders",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"try",
"{",
"final",
"SubMonitor",
"subMonitor",
"=",
"SubMonitor",
".",
"convert",
"(",
"monitor",
... | Configure the source folders for a SARL project.
@param project the project.
@param createFolders indicates if the folders must be created or not.
@param monitor the monitor.
@since 0.8
@see #addSarlNatures(IProject, IProgressMonitor)
@see #configureSARLProject(IProject, boolean, boolean, boolean, IProgressMonitor) | [
"Configure",
"the",
"source",
"folders",
"for",
"a",
"SARL",
"project",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L369-L403 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.chunkedUploadAppend | public long chunkedUploadAppend(String uploadId, long uploadOffset, byte[] data)
throws DbxException
{
return chunkedUploadAppend(uploadId, uploadOffset, data, 0, data.length);
} | java | public long chunkedUploadAppend(String uploadId, long uploadOffset, byte[] data)
throws DbxException
{
return chunkedUploadAppend(uploadId, uploadOffset, data, 0, data.length);
} | [
"public",
"long",
"chunkedUploadAppend",
"(",
"String",
"uploadId",
",",
"long",
"uploadOffset",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"DbxException",
"{",
"return",
"chunkedUploadAppend",
"(",
"uploadId",
",",
"uploadOffset",
",",
"data",
",",
"0",
",... | Equivalent to {@link #chunkedUploadAppend(String, long, byte[], int, int)
chunkedUploadAppend(uploadId, uploadOffset, data, 0, data.length)}. | [
"Equivalent",
"to",
"{"
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1071-L1075 |
yshrsmz/KeyboardVisibilityEvent | keyboardvisibilityevent/src/main/java/net/yslibrary/android/keyboardvisibilityevent/util/UIUtil.java | UIUtil.showKeyboardInDialog | public static void showKeyboardInDialog(Dialog dialog, EditText target) {
if (dialog == null || target == null) {
return;
}
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
target.requestFocus();
} | java | public static void showKeyboardInDialog(Dialog dialog, EditText target) {
if (dialog == null || target == null) {
return;
}
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
target.requestFocus();
} | [
"public",
"static",
"void",
"showKeyboardInDialog",
"(",
"Dialog",
"dialog",
",",
"EditText",
"target",
")",
"{",
"if",
"(",
"dialog",
"==",
"null",
"||",
"target",
"==",
"null",
")",
"{",
"return",
";",
"}",
"dialog",
".",
"getWindow",
"(",
")",
".",
... | Show keyboard and focus to given EditText.
Use this method if target EditText is in Dialog.
@param dialog Dialog
@param target EditText to focus | [
"Show",
"keyboard",
"and",
"focus",
"to",
"given",
"EditText",
".",
"Use",
"this",
"method",
"if",
"target",
"EditText",
"is",
"in",
"Dialog",
"."
] | train | https://github.com/yshrsmz/KeyboardVisibilityEvent/blob/fbde29a2c28ff1b2fa44f43cdd1ff3ec1d3321d8/keyboardvisibilityevent/src/main/java/net/yslibrary/android/keyboardvisibilityevent/util/UIUtil.java#L47-L54 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/Strings.java | Strings.defaultIfBlank | public static <T extends CharSequence> T defaultIfBlank(T str, T defaultStr) {
return isBlank(str) ? defaultStr : str;
} | java | public static <T extends CharSequence> T defaultIfBlank(T str, T defaultStr) {
return isBlank(str) ? defaultStr : str;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"defaultIfBlank",
"(",
"T",
"str",
",",
"T",
"defaultStr",
")",
"{",
"return",
"isBlank",
"(",
"str",
")",
"?",
"defaultStr",
":",
"str",
";",
"}"
] | <p>
Returns either the passed in CharSequence, or if the CharSequence is whitespace, empty ("") or
{@code null}, the value of {@code defaultStr}.
</p>
@param str
@param defaultStr | [
"<p",
">",
"Returns",
"either",
"the",
"passed",
"in",
"CharSequence",
"or",
"if",
"the",
"CharSequence",
"is",
"whitespace",
"empty",
"(",
")",
"or",
"{",
"@code",
"null",
"}",
"the",
"value",
"of",
"{",
"@code",
"defaultStr",
"}",
".",
"<",
"/",
"p",... | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L1428-L1430 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsXmlContent.java | CmsXmlContent.setValueForOtherLocales | private void setValueForOtherLocales(CmsObject cms, I_CmsXmlContentValue value, String requiredParent) {
if (!value.isSimpleType()) {
throw new IllegalArgumentException();
}
for (Locale locale : getLocales()) {
if (locale.equals(value.getLocale())) {
continue;
}
String valuePath = value.getPath();
if (CmsStringUtil.isEmptyOrWhitespaceOnly(requiredParent) || hasValue(requiredParent, locale)) {
ensureParentValues(cms, valuePath, locale);
if (hasValue(valuePath, locale)) {
I_CmsXmlContentValue localeValue = getValue(valuePath, locale);
localeValue.setStringValue(cms, value.getStringValue(cms));
} else {
int index = CmsXmlUtils.getXpathIndexInt(valuePath) - 1;
I_CmsXmlContentValue localeValue = addValue(cms, valuePath, locale, index);
localeValue.setStringValue(cms, value.getStringValue(cms));
}
}
}
} | java | private void setValueForOtherLocales(CmsObject cms, I_CmsXmlContentValue value, String requiredParent) {
if (!value.isSimpleType()) {
throw new IllegalArgumentException();
}
for (Locale locale : getLocales()) {
if (locale.equals(value.getLocale())) {
continue;
}
String valuePath = value.getPath();
if (CmsStringUtil.isEmptyOrWhitespaceOnly(requiredParent) || hasValue(requiredParent, locale)) {
ensureParentValues(cms, valuePath, locale);
if (hasValue(valuePath, locale)) {
I_CmsXmlContentValue localeValue = getValue(valuePath, locale);
localeValue.setStringValue(cms, value.getStringValue(cms));
} else {
int index = CmsXmlUtils.getXpathIndexInt(valuePath) - 1;
I_CmsXmlContentValue localeValue = addValue(cms, valuePath, locale, index);
localeValue.setStringValue(cms, value.getStringValue(cms));
}
}
}
} | [
"private",
"void",
"setValueForOtherLocales",
"(",
"CmsObject",
"cms",
",",
"I_CmsXmlContentValue",
"value",
",",
"String",
"requiredParent",
")",
"{",
"if",
"(",
"!",
"value",
".",
"isSimpleType",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Sets the value in all other locales.<p>
@param cms the cms context
@param value the value
@param requiredParent the path to the required parent value | [
"Sets",
"the",
"value",
"in",
"all",
"other",
"locales",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContent.java#L1131-L1153 |
jhy/jsoup | src/main/java/org/jsoup/internal/StringUtil.java | StringUtil.appendNormalisedWhitespace | public static void appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading) {
boolean lastWasWhite = false;
boolean reachedNonWhite = false;
int len = string.length();
int c;
for (int i = 0; i < len; i+= Character.charCount(c)) {
c = string.codePointAt(i);
if (isActuallyWhitespace(c)) {
if ((stripLeading && !reachedNonWhite) || lastWasWhite)
continue;
accum.append(' ');
lastWasWhite = true;
}
else if (!isInvisibleChar(c)) {
accum.appendCodePoint(c);
lastWasWhite = false;
reachedNonWhite = true;
}
}
} | java | public static void appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading) {
boolean lastWasWhite = false;
boolean reachedNonWhite = false;
int len = string.length();
int c;
for (int i = 0; i < len; i+= Character.charCount(c)) {
c = string.codePointAt(i);
if (isActuallyWhitespace(c)) {
if ((stripLeading && !reachedNonWhite) || lastWasWhite)
continue;
accum.append(' ');
lastWasWhite = true;
}
else if (!isInvisibleChar(c)) {
accum.appendCodePoint(c);
lastWasWhite = false;
reachedNonWhite = true;
}
}
} | [
"public",
"static",
"void",
"appendNormalisedWhitespace",
"(",
"StringBuilder",
"accum",
",",
"String",
"string",
",",
"boolean",
"stripLeading",
")",
"{",
"boolean",
"lastWasWhite",
"=",
"false",
";",
"boolean",
"reachedNonWhite",
"=",
"false",
";",
"int",
"len",... | After normalizing the whitespace within a string, appends it to a string builder.
@param accum builder to append to
@param string string to normalize whitespace within
@param stripLeading set to true if you wish to remove any leading whitespace | [
"After",
"normalizing",
"the",
"whitespace",
"within",
"a",
"string",
"appends",
"it",
"to",
"a",
"string",
"builder",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/internal/StringUtil.java#L157-L177 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.