repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
dvasilen/Hive-XML-SerDe | src/main/java/com/ibm/spss/hive/serde2/xml/objectinspector/XmlObjectInspectorFactory.java | XmlObjectInspectorFactory.getStandardJavaObjectInspectorFromTypeInfo | public static ObjectInspector getStandardJavaObjectInspectorFromTypeInfo(TypeInfo typeInfo, XmlProcessor xmlProcessor) {
switch (typeInfo.getCategory()) {
case PRIMITIVE: {
return PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory());
}
case LIST: {
ObjectInspector listElementObjectInspector = getStandardJavaObjectInspectorFromTypeInfo(((ListTypeInfo) typeInfo).getListElementTypeInfo(),
xmlProcessor);
return new XmlListObjectInspector(listElementObjectInspector, xmlProcessor);
}
case MAP: {
MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;
ObjectInspector mapKeyObjectInspector = getStandardJavaObjectInspectorFromTypeInfo(mapTypeInfo.getMapKeyTypeInfo(),
xmlProcessor);
ObjectInspector mapValueObjectInspector = getStandardJavaObjectInspectorFromTypeInfo(mapTypeInfo.getMapValueTypeInfo(),
xmlProcessor);
return new XmlMapObjectInspector(mapKeyObjectInspector, mapValueObjectInspector, xmlProcessor);
}
case STRUCT: {
StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
List<String> structFieldNames = structTypeInfo.getAllStructFieldNames();
List<TypeInfo> fieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
List<ObjectInspector> structFieldObjectInspectors = new ArrayList<ObjectInspector>(fieldTypeInfos.size());
for (int fieldIndex = 0; fieldIndex < fieldTypeInfos.size(); ++fieldIndex) {
structFieldObjectInspectors.add(getStandardJavaObjectInspectorFromTypeInfo(fieldTypeInfos.get(fieldIndex), xmlProcessor));
}
return getStandardStructObjectInspector(structFieldNames, structFieldObjectInspectors, xmlProcessor);
}
default: {
throw new IllegalStateException();
}
}
} | java | public static ObjectInspector getStandardJavaObjectInspectorFromTypeInfo(TypeInfo typeInfo, XmlProcessor xmlProcessor) {
switch (typeInfo.getCategory()) {
case PRIMITIVE: {
return PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory());
}
case LIST: {
ObjectInspector listElementObjectInspector = getStandardJavaObjectInspectorFromTypeInfo(((ListTypeInfo) typeInfo).getListElementTypeInfo(),
xmlProcessor);
return new XmlListObjectInspector(listElementObjectInspector, xmlProcessor);
}
case MAP: {
MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;
ObjectInspector mapKeyObjectInspector = getStandardJavaObjectInspectorFromTypeInfo(mapTypeInfo.getMapKeyTypeInfo(),
xmlProcessor);
ObjectInspector mapValueObjectInspector = getStandardJavaObjectInspectorFromTypeInfo(mapTypeInfo.getMapValueTypeInfo(),
xmlProcessor);
return new XmlMapObjectInspector(mapKeyObjectInspector, mapValueObjectInspector, xmlProcessor);
}
case STRUCT: {
StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
List<String> structFieldNames = structTypeInfo.getAllStructFieldNames();
List<TypeInfo> fieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
List<ObjectInspector> structFieldObjectInspectors = new ArrayList<ObjectInspector>(fieldTypeInfos.size());
for (int fieldIndex = 0; fieldIndex < fieldTypeInfos.size(); ++fieldIndex) {
structFieldObjectInspectors.add(getStandardJavaObjectInspectorFromTypeInfo(fieldTypeInfos.get(fieldIndex), xmlProcessor));
}
return getStandardStructObjectInspector(structFieldNames, structFieldObjectInspectors, xmlProcessor);
}
default: {
throw new IllegalStateException();
}
}
} | [
"public",
"static",
"ObjectInspector",
"getStandardJavaObjectInspectorFromTypeInfo",
"(",
"TypeInfo",
"typeInfo",
",",
"XmlProcessor",
"xmlProcessor",
")",
"{",
"switch",
"(",
"typeInfo",
".",
"getCategory",
"(",
")",
")",
"{",
"case",
"PRIMITIVE",
":",
"{",
"return... | Returns the standard java object inspector
@param typeInfo
the type info
@param xmlProcessor
the XML processor
@return the standard java object inspector | [
"Returns",
"the",
"standard",
"java",
"object",
"inspector"
] | train | https://github.com/dvasilen/Hive-XML-SerDe/blob/2a7a184b2cfaeb63008529a9851cd72edb8025d9/src/main/java/com/ibm/spss/hive/serde2/xml/objectinspector/XmlObjectInspectorFactory.java#L53-L85 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/nearcache/impl/preloader/NearCachePreloader.java | NearCachePreloader.storeKeys | public void storeKeys(Iterator<K> iterator) {
long startedNanos = System.nanoTime();
FileOutputStream fos = null;
try {
buf = allocate(BUFFER_SIZE);
lastWrittenBytes = 0;
lastKeyCount = 0;
fos = new FileOutputStream(tmpStoreFile, false);
// write header and keys
writeInt(fos, MAGIC_BYTES);
writeInt(fos, FileFormat.INTERLEAVED_LENGTH_FIELD.ordinal());
writeKeySet(fos, fos.getChannel(), iterator);
// cleanup if no keys have been written
if (lastKeyCount == 0) {
deleteQuietly(storeFile);
updatePersistenceStats(startedNanos);
return;
}
fos.flush();
closeResource(fos);
rename(tmpStoreFile, storeFile);
updatePersistenceStats(startedNanos);
} catch (Exception e) {
logger.warning(format("Could not store keys of Near Cache %s (%s)", nearCacheName, storeFile.getAbsolutePath()), e);
nearCacheStats.addPersistenceFailure(e);
} finally {
closeResource(fos);
deleteQuietly(tmpStoreFile);
}
} | java | public void storeKeys(Iterator<K> iterator) {
long startedNanos = System.nanoTime();
FileOutputStream fos = null;
try {
buf = allocate(BUFFER_SIZE);
lastWrittenBytes = 0;
lastKeyCount = 0;
fos = new FileOutputStream(tmpStoreFile, false);
// write header and keys
writeInt(fos, MAGIC_BYTES);
writeInt(fos, FileFormat.INTERLEAVED_LENGTH_FIELD.ordinal());
writeKeySet(fos, fos.getChannel(), iterator);
// cleanup if no keys have been written
if (lastKeyCount == 0) {
deleteQuietly(storeFile);
updatePersistenceStats(startedNanos);
return;
}
fos.flush();
closeResource(fos);
rename(tmpStoreFile, storeFile);
updatePersistenceStats(startedNanos);
} catch (Exception e) {
logger.warning(format("Could not store keys of Near Cache %s (%s)", nearCacheName, storeFile.getAbsolutePath()), e);
nearCacheStats.addPersistenceFailure(e);
} finally {
closeResource(fos);
deleteQuietly(tmpStoreFile);
}
} | [
"public",
"void",
"storeKeys",
"(",
"Iterator",
"<",
"K",
">",
"iterator",
")",
"{",
"long",
"startedNanos",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"FileOutputStream",
"fos",
"=",
"null",
";",
"try",
"{",
"buf",
"=",
"allocate",
"(",
"BUFFER_SIZE... | Stores the Near Cache keys from the supplied iterator.
@param iterator {@link Iterator} over the key set of a {@link com.hazelcast.internal.nearcache.NearCacheRecordStore} | [
"Stores",
"the",
"Near",
"Cache",
"keys",
"from",
"the",
"supplied",
"iterator",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/nearcache/impl/preloader/NearCachePreloader.java#L169-L204 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.beginResetPassword | public void beginResetPassword(String userName, ResetPasswordPayload resetPasswordPayload) {
beginResetPasswordWithServiceResponseAsync(userName, resetPasswordPayload).toBlocking().single().body();
} | java | public void beginResetPassword(String userName, ResetPasswordPayload resetPasswordPayload) {
beginResetPasswordWithServiceResponseAsync(userName, resetPasswordPayload).toBlocking().single().body();
} | [
"public",
"void",
"beginResetPassword",
"(",
"String",
"userName",
",",
"ResetPasswordPayload",
"resetPasswordPayload",
")",
"{",
"beginResetPasswordWithServiceResponseAsync",
"(",
"userName",
",",
"resetPasswordPayload",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Resets the user password on an environment This operation can take a while to complete.
@param userName The name of the user.
@param resetPasswordPayload Represents the payload for resetting passwords.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Resets",
"the",
"user",
"password",
"on",
"an",
"environment",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L998-L1000 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_input_inputId_allowedNetwork_POST | public OvhOperation serviceName_input_inputId_allowedNetwork_POST(String serviceName, String inputId, String network) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/input/{inputId}/allowedNetwork";
StringBuilder sb = path(qPath, serviceName, inputId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "network", network);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | java | public OvhOperation serviceName_input_inputId_allowedNetwork_POST(String serviceName, String inputId, String network) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/input/{inputId}/allowedNetwork";
StringBuilder sb = path(qPath, serviceName, inputId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "network", network);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | [
"public",
"OvhOperation",
"serviceName_input_inputId_allowedNetwork_POST",
"(",
"String",
"serviceName",
",",
"String",
"inputId",
",",
"String",
"network",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/input/{inputId}/allowedNetwork\""... | Allow an ip to join input
REST: POST /dbaas/logs/{serviceName}/input/{inputId}/allowedNetwork
@param serviceName [required] Service name
@param inputId [required] Input ID
@param network [required] IP block | [
"Allow",
"an",
"ip",
"to",
"join",
"input"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L497-L504 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SARLJvmGenerator.java | SARLJvmGenerator.generateStaticConstructor | protected ITreeAppendable generateStaticConstructor(JvmOperation it, ITreeAppendable appendable, GeneratorConfig config) {
appendable.newLine();
appendable.openScope();
generateJavaDoc(it, appendable, config);
final ITreeAppendable tracedAppendable = appendable.trace(it);
tracedAppendable.append("static "); //$NON-NLS-1$
generateExecutableBody(it, tracedAppendable, config);
return appendable;
} | java | protected ITreeAppendable generateStaticConstructor(JvmOperation it, ITreeAppendable appendable, GeneratorConfig config) {
appendable.newLine();
appendable.openScope();
generateJavaDoc(it, appendable, config);
final ITreeAppendable tracedAppendable = appendable.trace(it);
tracedAppendable.append("static "); //$NON-NLS-1$
generateExecutableBody(it, tracedAppendable, config);
return appendable;
} | [
"protected",
"ITreeAppendable",
"generateStaticConstructor",
"(",
"JvmOperation",
"it",
",",
"ITreeAppendable",
"appendable",
",",
"GeneratorConfig",
"config",
")",
"{",
"appendable",
".",
"newLine",
"(",
")",
";",
"appendable",
".",
"openScope",
"(",
")",
";",
"g... | Generate a static constructor from the given Jvm constructor.
@param it the container of the code.
@param appendable the output.
@param config the generation configuration.
@return the appendable. | [
"Generate",
"a",
"static",
"constructor",
"from",
"the",
"given",
"Jvm",
"constructor",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SARLJvmGenerator.java#L129-L137 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java | BNFHeadersImpl.parseTokenNonExtract | protected int parseTokenNonExtract(WsByteBuffer buff, byte bDelimiter, boolean bApproveCRLF) throws MalformedMessageException {
TokenCodes rc = findTokenLength(buff, bDelimiter, bApproveCRLF);
return (TokenCodes.TOKEN_RC_MOREDATA.equals(rc)) ? -1 : this.parsedTokenLength;
} | java | protected int parseTokenNonExtract(WsByteBuffer buff, byte bDelimiter, boolean bApproveCRLF) throws MalformedMessageException {
TokenCodes rc = findTokenLength(buff, bDelimiter, bApproveCRLF);
return (TokenCodes.TOKEN_RC_MOREDATA.equals(rc)) ? -1 : this.parsedTokenLength;
} | [
"protected",
"int",
"parseTokenNonExtract",
"(",
"WsByteBuffer",
"buff",
",",
"byte",
"bDelimiter",
",",
"boolean",
"bApproveCRLF",
")",
"throws",
"MalformedMessageException",
"{",
"TokenCodes",
"rc",
"=",
"findTokenLength",
"(",
"buff",
",",
"bDelimiter",
",",
"bAp... | Standard parsing of a token; however, instead of saving the data into
the global parsedToken variable, this merely returns the length of the
token. Used for occasions where we just need to find the length of
the token.
@param buff
@param bDelimiter
@param bApproveCRLF
@return int (-1 means we need more data)
@throws MalformedMessageException | [
"Standard",
"parsing",
"of",
"a",
"token",
";",
"however",
"instead",
"of",
"saving",
"the",
"data",
"into",
"the",
"global",
"parsedToken",
"variable",
"this",
"merely",
"returns",
"the",
"length",
"of",
"the",
"token",
".",
"Used",
"for",
"occasions",
"whe... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L3917-L3921 |
JCTools/JCTools | jctools-core/src/main/java/org/jctools/queues/atomic/BaseSpscLinkedAtomicArrayQueue.java | BaseSpscLinkedAtomicArrayQueue.peek | @SuppressWarnings("unchecked")
@Override
public E peek() {
final AtomicReferenceArray<E> buffer = consumerBuffer;
final long index = lpConsumerIndex();
final long mask = consumerMask;
final int offset = calcElementOffset(index, mask);
// LoadLoad
final Object e = lvElement(buffer, offset);
if (e == JUMP) {
return newBufferPeek(buffer, index);
}
return (E) e;
} | java | @SuppressWarnings("unchecked")
@Override
public E peek() {
final AtomicReferenceArray<E> buffer = consumerBuffer;
final long index = lpConsumerIndex();
final long mask = consumerMask;
final int offset = calcElementOffset(index, mask);
// LoadLoad
final Object e = lvElement(buffer, offset);
if (e == JUMP) {
return newBufferPeek(buffer, index);
}
return (E) e;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"E",
"peek",
"(",
")",
"{",
"final",
"AtomicReferenceArray",
"<",
"E",
">",
"buffer",
"=",
"consumerBuffer",
";",
"final",
"long",
"index",
"=",
"lpConsumerIndex",
"(",
")",
";",
... | {@inheritDoc}
<p>
This implementation is correct for single consumer thread use only. | [
"{"
] | train | https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-core/src/main/java/org/jctools/queues/atomic/BaseSpscLinkedAtomicArrayQueue.java#L316-L329 |
PureSolTechnologies/commons | types/src/main/java/com/puresoltechnologies/commons/types/StringUtils.java | StringUtils.wrapLinesByWords | public static String wrapLinesByWords(String text, int maxLen) {
StringBuffer buffer = new StringBuffer();
int lineLength = 0;
for (String token : text.split(" ")) {
if (lineLength + token.length() + 1 > maxLen) {
buffer.append("\n");
lineLength = 0;
} else if (lineLength > 0) {
buffer.append(" ");
lineLength++;
}
buffer.append(token);
lineLength += token.length();
}
text = buffer.toString();
return text;
} | java | public static String wrapLinesByWords(String text, int maxLen) {
StringBuffer buffer = new StringBuffer();
int lineLength = 0;
for (String token : text.split(" ")) {
if (lineLength + token.length() + 1 > maxLen) {
buffer.append("\n");
lineLength = 0;
} else if (lineLength > 0) {
buffer.append(" ");
lineLength++;
}
buffer.append(token);
lineLength += token.length();
}
text = buffer.toString();
return text;
} | [
"public",
"static",
"String",
"wrapLinesByWords",
"(",
"String",
"text",
",",
"int",
"maxLen",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"lineLength",
"=",
"0",
";",
"for",
"(",
"String",
"token",
":",
"text",
... | This methods auto breaks a long line of text into several lines by adding
line breaks.
@param text
is the {@link String} to be broken down into several line.
@param maxLen
is the maximum number of characters per line.
@return Returned is the original text with additional line breaks. | [
"This",
"methods",
"auto",
"breaks",
"a",
"long",
"line",
"of",
"text",
"into",
"several",
"lines",
"by",
"adding",
"line",
"breaks",
"."
] | train | https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/types/src/main/java/com/puresoltechnologies/commons/types/StringUtils.java#L21-L37 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java | StringUtil.containsIgnoreCase | public static boolean containsIgnoreCase(String pString, int pChar) {
return ((pString != null)
&& ((pString.indexOf(Character.toLowerCase((char) pChar)) >= 0)
|| (pString.indexOf(Character.toUpperCase((char) pChar)) >= 0)));
// NOTE: I don't convert the string to uppercase, but instead test
// the string (potentially) two times, as this is more efficient for
// long strings (in most cases).
} | java | public static boolean containsIgnoreCase(String pString, int pChar) {
return ((pString != null)
&& ((pString.indexOf(Character.toLowerCase((char) pChar)) >= 0)
|| (pString.indexOf(Character.toUpperCase((char) pChar)) >= 0)));
// NOTE: I don't convert the string to uppercase, but instead test
// the string (potentially) two times, as this is more efficient for
// long strings (in most cases).
} | [
"public",
"static",
"boolean",
"containsIgnoreCase",
"(",
"String",
"pString",
",",
"int",
"pChar",
")",
"{",
"return",
"(",
"(",
"pString",
"!=",
"null",
")",
"&&",
"(",
"(",
"pString",
".",
"indexOf",
"(",
"Character",
".",
"toLowerCase",
"(",
"(",
"ch... | Tests if a string contains a specific character, ignoring case.
@param pString The string to check.
@param pChar The character to search for.
@return true if the string contains the specific character. | [
"Tests",
"if",
"a",
"string",
"contains",
"a",
"specific",
"character",
"ignoring",
"case",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java#L227-L235 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxAPIRequest.java | BoxAPIRequest.addHeader | public void addHeader(String key, String value) {
if (key.equals("As-User")) {
for (int i = 0; i < this.headers.size(); i++) {
if (this.headers.get(i).getKey().equals("As-User")) {
this.headers.remove(i);
}
}
}
if (key.equals("X-Box-UA")) {
throw new IllegalArgumentException("Altering the X-Box-UA header is not permitted");
}
this.headers.add(new RequestHeader(key, value));
} | java | public void addHeader(String key, String value) {
if (key.equals("As-User")) {
for (int i = 0; i < this.headers.size(); i++) {
if (this.headers.get(i).getKey().equals("As-User")) {
this.headers.remove(i);
}
}
}
if (key.equals("X-Box-UA")) {
throw new IllegalArgumentException("Altering the X-Box-UA header is not permitted");
}
this.headers.add(new RequestHeader(key, value));
} | [
"public",
"void",
"addHeader",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"key",
".",
"equals",
"(",
"\"As-User\"",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"headers",
".",
"size",
"(",
... | Adds an HTTP header to this request.
@param key the header key.
@param value the header value. | [
"Adds",
"an",
"HTTP",
"header",
"to",
"this",
"request",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxAPIRequest.java#L178-L190 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/DiSH.java | DiSH.isParent | private boolean isParent(Relation<V> relation, Cluster<SubspaceModel> parent, It<Cluster<SubspaceModel>> iter, int db_dim) {
Subspace s_p = parent.getModel().getSubspace();
NumberVector parent_centroid = ProjectedCentroid.make(s_p.getDimensions(), relation, parent.getIDs());
int subspaceDim_parent = db_dim - s_p.dimensionality();
for(; iter.valid(); iter.advance()) {
Cluster<SubspaceModel> child = iter.get();
Subspace s_c = child.getModel().getSubspace();
NumberVector child_centroid = ProjectedCentroid.make(s_c.getDimensions(), relation, child.getIDs());
long[] commonPreferenceVector = BitsUtil.andCMin(s_p.getDimensions(), s_c.getDimensions());
int subspaceDim = subspaceDimensionality(parent_centroid, child_centroid, s_p.getDimensions(), s_c.getDimensions(), commonPreferenceVector);
if(subspaceDim == subspaceDim_parent) {
return true;
}
}
return false;
} | java | private boolean isParent(Relation<V> relation, Cluster<SubspaceModel> parent, It<Cluster<SubspaceModel>> iter, int db_dim) {
Subspace s_p = parent.getModel().getSubspace();
NumberVector parent_centroid = ProjectedCentroid.make(s_p.getDimensions(), relation, parent.getIDs());
int subspaceDim_parent = db_dim - s_p.dimensionality();
for(; iter.valid(); iter.advance()) {
Cluster<SubspaceModel> child = iter.get();
Subspace s_c = child.getModel().getSubspace();
NumberVector child_centroid = ProjectedCentroid.make(s_c.getDimensions(), relation, child.getIDs());
long[] commonPreferenceVector = BitsUtil.andCMin(s_p.getDimensions(), s_c.getDimensions());
int subspaceDim = subspaceDimensionality(parent_centroid, child_centroid, s_p.getDimensions(), s_c.getDimensions(), commonPreferenceVector);
if(subspaceDim == subspaceDim_parent) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"isParent",
"(",
"Relation",
"<",
"V",
">",
"relation",
",",
"Cluster",
"<",
"SubspaceModel",
">",
"parent",
",",
"It",
"<",
"Cluster",
"<",
"SubspaceModel",
">",
">",
"iter",
",",
"int",
"db_dim",
")",
"{",
"Subspace",
"s_p",
"=",
... | Returns true, if the specified parent cluster is a parent of one child of
the children clusters.
@param relation the database containing the objects
@param parent the parent to be tested
@param iter the list of children to be tested
@param db_dim Database dimensionality
@return true, if the specified parent cluster is a parent of one child of
the children clusters, false otherwise | [
"Returns",
"true",
"if",
"the",
"specified",
"parent",
"cluster",
"is",
"a",
"parent",
"of",
"one",
"child",
"of",
"the",
"children",
"clusters",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/DiSH.java#L548-L564 |
Axway/Grapes | commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java | DataModelFactory.createModule | public static Module createModule(final String name,final String version){
final Module module = new Module();
module.setName(name);
module.setVersion(version);
module.setPromoted(false);
return module;
} | java | public static Module createModule(final String name,final String version){
final Module module = new Module();
module.setName(name);
module.setVersion(version);
module.setPromoted(false);
return module;
} | [
"public",
"static",
"Module",
"createModule",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"version",
")",
"{",
"final",
"Module",
"module",
"=",
"new",
"Module",
"(",
")",
";",
"module",
".",
"setName",
"(",
"name",
")",
";",
"module",
".",
... | Generates a module regarding the parameters.
@param name String
@param version String
@return Module | [
"Generates",
"a",
"module",
"regarding",
"the",
"parameters",
"."
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L49-L58 |
xiaosunzhu/resource-utils | src/main/java/net/sunyijun/resource/config/Configs.java | Configs.modifySelfConfig | public static void modifySelfConfig(String configAbsoluteClassPath, Map<IConfigKey, String> modifyConfig)
throws IOException {
OneProperties configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
return;
}
configs.modifyConfig(modifyConfig);
} | java | public static void modifySelfConfig(String configAbsoluteClassPath, Map<IConfigKey, String> modifyConfig)
throws IOException {
OneProperties configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
return;
}
configs.modifyConfig(modifyConfig);
} | [
"public",
"static",
"void",
"modifySelfConfig",
"(",
"String",
"configAbsoluteClassPath",
",",
"Map",
"<",
"IConfigKey",
",",
"String",
">",
"modifyConfig",
")",
"throws",
"IOException",
"{",
"OneProperties",
"configs",
"=",
"otherConfigs",
".",
"get",
"(",
"confi... | Modify self configs.
@param configAbsoluteClassPath config path. {@link #addSelfConfigs(String, OneProperties)}
@param modifyConfig need update configs. If one value is null, will not update that one.
@throws IOException | [
"Modify",
"self",
"configs",
"."
] | train | https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L469-L476 |
notnoop/java-apns | src/main/java/com/notnoop/apns/ApnsServiceBuilder.java | ApnsServiceBuilder.withCert | public ApnsServiceBuilder withCert(String fileName, String password)
throws RuntimeIOException, InvalidSSLConfig {
FileInputStream stream = null;
try {
stream = new FileInputStream(fileName);
return withCert(stream, password);
} catch (FileNotFoundException e) {
throw new RuntimeIOException(e);
} finally {
Utilities.close(stream);
}
} | java | public ApnsServiceBuilder withCert(String fileName, String password)
throws RuntimeIOException, InvalidSSLConfig {
FileInputStream stream = null;
try {
stream = new FileInputStream(fileName);
return withCert(stream, password);
} catch (FileNotFoundException e) {
throw new RuntimeIOException(e);
} finally {
Utilities.close(stream);
}
} | [
"public",
"ApnsServiceBuilder",
"withCert",
"(",
"String",
"fileName",
",",
"String",
"password",
")",
"throws",
"RuntimeIOException",
",",
"InvalidSSLConfig",
"{",
"FileInputStream",
"stream",
"=",
"null",
";",
"try",
"{",
"stream",
"=",
"new",
"FileInputStream",
... | Specify the certificate used to connect to Apple APNS
servers. This relies on the path (absolute or relative to
working path) to the keystore (*.p12) containing the
certificate, along with the given password.
The keystore needs to be of PKCS12 and the keystore
needs to be encrypted using the SunX509 algorithm. Both
of these settings are the default.
This library does not support password-less p12 certificates, due to a
Oracle Java library <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6415637">
Bug 6415637</a>. There are three workarounds: use a password-protected
certificate, use a different boot Java SDK implementation, or construct
the `SSLContext` yourself! Needless to say, the password-protected
certificate is most recommended option.
@param fileName the path to the certificate
@param password the password of the keystore
@return this
@throws RuntimeIOException if it {@code fileName} cannot be
found or read
@throws InvalidSSLConfig if fileName is invalid Keystore
or the password is invalid | [
"Specify",
"the",
"certificate",
"used",
"to",
"connect",
"to",
"Apple",
"APNS",
"servers",
".",
"This",
"relies",
"on",
"the",
"path",
"(",
"absolute",
"or",
"relative",
"to",
"working",
"path",
")",
"to",
"the",
"keystore",
"(",
"*",
".",
"p12",
")",
... | train | https://github.com/notnoop/java-apns/blob/180a190d4cb49458441596ca7c69d50ec7f1dba5/src/main/java/com/notnoop/apns/ApnsServiceBuilder.java#L152-L163 |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateUploader.java | RocksDBStateUploader.uploadFilesToCheckpointFs | public Map<StateHandleID, StreamStateHandle> uploadFilesToCheckpointFs(
@Nonnull Map<StateHandleID, Path> files,
CheckpointStreamFactory checkpointStreamFactory,
CloseableRegistry closeableRegistry) throws Exception {
Map<StateHandleID, StreamStateHandle> handles = new HashMap<>();
Map<StateHandleID, CompletableFuture<StreamStateHandle>> futures =
createUploadFutures(files, checkpointStreamFactory, closeableRegistry);
try {
FutureUtils.waitForAll(futures.values()).get();
for (Map.Entry<StateHandleID, CompletableFuture<StreamStateHandle>> entry : futures.entrySet()) {
handles.put(entry.getKey(), entry.getValue().get());
}
} catch (ExecutionException e) {
Throwable throwable = ExceptionUtils.stripExecutionException(e);
throwable = ExceptionUtils.stripException(throwable, RuntimeException.class);
if (throwable instanceof IOException) {
throw (IOException) throwable;
} else {
throw new FlinkRuntimeException("Failed to download data for state handles.", e);
}
}
return handles;
} | java | public Map<StateHandleID, StreamStateHandle> uploadFilesToCheckpointFs(
@Nonnull Map<StateHandleID, Path> files,
CheckpointStreamFactory checkpointStreamFactory,
CloseableRegistry closeableRegistry) throws Exception {
Map<StateHandleID, StreamStateHandle> handles = new HashMap<>();
Map<StateHandleID, CompletableFuture<StreamStateHandle>> futures =
createUploadFutures(files, checkpointStreamFactory, closeableRegistry);
try {
FutureUtils.waitForAll(futures.values()).get();
for (Map.Entry<StateHandleID, CompletableFuture<StreamStateHandle>> entry : futures.entrySet()) {
handles.put(entry.getKey(), entry.getValue().get());
}
} catch (ExecutionException e) {
Throwable throwable = ExceptionUtils.stripExecutionException(e);
throwable = ExceptionUtils.stripException(throwable, RuntimeException.class);
if (throwable instanceof IOException) {
throw (IOException) throwable;
} else {
throw new FlinkRuntimeException("Failed to download data for state handles.", e);
}
}
return handles;
} | [
"public",
"Map",
"<",
"StateHandleID",
",",
"StreamStateHandle",
">",
"uploadFilesToCheckpointFs",
"(",
"@",
"Nonnull",
"Map",
"<",
"StateHandleID",
",",
"Path",
">",
"files",
",",
"CheckpointStreamFactory",
"checkpointStreamFactory",
",",
"CloseableRegistry",
"closeabl... | Upload all the files to checkpoint fileSystem using specified number of threads.
@param files The files will be uploaded to checkpoint filesystem.
@param checkpointStreamFactory The checkpoint streamFactory used to create outputstream.
@throws Exception Thrown if can not upload all the files. | [
"Upload",
"all",
"the",
"files",
"to",
"checkpoint",
"fileSystem",
"using",
"specified",
"number",
"of",
"threads",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateUploader.java#L62-L89 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/spi/base/BaseExchangeRateProvider.java | BaseExchangeRateProvider.isAvailable | public boolean isAvailable(String baseCode, String termCode){
return isAvailable(Monetary.getCurrency(baseCode), Monetary.getCurrency(termCode));
} | java | public boolean isAvailable(String baseCode, String termCode){
return isAvailable(Monetary.getCurrency(baseCode), Monetary.getCurrency(termCode));
} | [
"public",
"boolean",
"isAvailable",
"(",
"String",
"baseCode",
",",
"String",
"termCode",
")",
"{",
"return",
"isAvailable",
"(",
"Monetary",
".",
"getCurrency",
"(",
"baseCode",
")",
",",
"Monetary",
".",
"getCurrency",
"(",
"termCode",
")",
")",
";",
"}"
] | Checks if an {@link javax.money.convert.ExchangeRate} between two {@link javax.money.CurrencyUnit} is
available from this provider. This method should check, if a given rate
is <i>currently</i> defined.
@param baseCode the base currency code
@param termCode the terminal/target currency code
@return {@code true}, if such an {@link javax.money.convert.ExchangeRate} is currently
defined.
@throws javax.money.MonetaryException if one of the currency codes passed is not valid. | [
"Checks",
"if",
"an",
"{",
"@link",
"javax",
".",
"money",
".",
"convert",
".",
"ExchangeRate",
"}",
"between",
"two",
"{",
"@link",
"javax",
".",
"money",
".",
"CurrencyUnit",
"}",
"is",
"available",
"from",
"this",
"provider",
".",
"This",
"method",
"s... | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseExchangeRateProvider.java#L122-L124 |
indeedeng/util | util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java | Quicksortables.partialSortUsingHeap | public static void partialSortUsingHeap(Quicksortable q, int k, int size) {
Quicksortable revq = reverseQuicksortable(q);
makeHeap(revq, k);
for (int i = k; i < size; i++) {
if (q.compare(0, i) > 0) {
q.swap(0, i);
heapifyDown(revq, 0, k);
}
}
sortheap(revq, k);
} | java | public static void partialSortUsingHeap(Quicksortable q, int k, int size) {
Quicksortable revq = reverseQuicksortable(q);
makeHeap(revq, k);
for (int i = k; i < size; i++) {
if (q.compare(0, i) > 0) {
q.swap(0, i);
heapifyDown(revq, 0, k);
}
}
sortheap(revq, k);
} | [
"public",
"static",
"void",
"partialSortUsingHeap",
"(",
"Quicksortable",
"q",
",",
"int",
"k",
",",
"int",
"size",
")",
"{",
"Quicksortable",
"revq",
"=",
"reverseQuicksortable",
"(",
"q",
")",
";",
"makeHeap",
"(",
"revq",
",",
"k",
")",
";",
"for",
"(... | finds the lowest k elements of q and stores them in sorted order
at the beginning of q by using a heap of size k
@param q The quicksortable to heapsort.
@param k The number of elements to sort at the beginning of the
quicksortable.
@param size The size of the quicksortable. | [
"finds",
"the",
"lowest",
"k",
"elements",
"of",
"q",
"and",
"stores",
"them",
"in",
"sorted",
"order",
"at",
"the",
"beginning",
"of",
"q",
"by",
"using",
"a",
"heap",
"of",
"size",
"k"
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L269-L279 |
future-architect/uroborosql | src/main/java/jp/co/future/uroborosql/coverage/PassedRoute.java | PassedRoute.appendBranchState | public void appendBranchState(int start, int end, BranchCoverageState state) {
this.passed.put(new Range(start, end), state);
} | java | public void appendBranchState(int start, int end, BranchCoverageState state) {
this.passed.put(new Range(start, end), state);
} | [
"public",
"void",
"appendBranchState",
"(",
"int",
"start",
",",
"int",
"end",
",",
"BranchCoverageState",
"state",
")",
"{",
"this",
".",
"passed",
".",
"put",
"(",
"new",
"Range",
"(",
"start",
",",
"end",
")",
",",
"state",
")",
";",
"}"
] | 分岐情報追加
@param start 開始位置(文字index)
@param end 終了位置(文字index)
@param state カバレッジ状態 | [
"分岐情報追加"
] | train | https://github.com/future-architect/uroborosql/blob/4c26db51defdac3c6ed16866e33ab45e190e2e0c/src/main/java/jp/co/future/uroborosql/coverage/PassedRoute.java#L35-L37 |
elki-project/elki | addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java | XSplitter.add2MBR | private void add2MBR(int[] entrySorting, double[] ub, double[] lb, int index) {
SpatialComparable currMBR = node.getEntry(entrySorting[index]);
for(int d = 0; d < currMBR.getDimensionality(); d++) {
double max = currMBR.getMax(d);
if(max > ub[d]) {
ub[d] = max;
}
double min = currMBR.getMin(d);
if(min < lb[d]) {
lb[d] = min;
}
}
} | java | private void add2MBR(int[] entrySorting, double[] ub, double[] lb, int index) {
SpatialComparable currMBR = node.getEntry(entrySorting[index]);
for(int d = 0; d < currMBR.getDimensionality(); d++) {
double max = currMBR.getMax(d);
if(max > ub[d]) {
ub[d] = max;
}
double min = currMBR.getMin(d);
if(min < lb[d]) {
lb[d] = min;
}
}
} | [
"private",
"void",
"add2MBR",
"(",
"int",
"[",
"]",
"entrySorting",
",",
"double",
"[",
"]",
"ub",
",",
"double",
"[",
"]",
"lb",
",",
"int",
"index",
")",
"{",
"SpatialComparable",
"currMBR",
"=",
"node",
".",
"getEntry",
"(",
"entrySorting",
"[",
"in... | Adds the minimum and maximum bounds of the MBR of entry number
<code>entrySorting[index]</code> to the dimension-wise
upper and lower bounds, <code>ub</code> and <code>lb</code>. Note that if
this method is called for <code>ub</code> and <code>lb</code> which are
already owned by an MBR, this update operation also updates the MBR defined
by those bounds.
@param entrySorting a sorting providing the mapping of <code>index</code>
to the entry to be added
@param ub the upper bound of the MBR to be extended
@param lb the lower bound of the MBR to be extended
@param index the index in the sorting referencing the entry to be added | [
"Adds",
"the",
"minimum",
"and",
"maximum",
"bounds",
"of",
"the",
"MBR",
"of",
"entry",
"number",
"<code",
">",
"entrySorting",
"[",
"index",
"]",
"<",
"/",
"code",
">",
"to",
"the",
"dimension",
"-",
"wise",
"upper",
"and",
"lower",
"bounds",
"<code",
... | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java#L270-L282 |
pmwmedia/tinylog | tinylog-impl/src/main/java/org/tinylog/core/TinylogLoggingProvider.java | TinylogLoggingProvider.calculateMinimumLevel | private static Level calculateMinimumLevel(final Level globalLevel, final Map<String, Level> customLevels) {
Level minimumLevel = globalLevel;
for (Level level : customLevels.values()) {
if (level.ordinal() < minimumLevel.ordinal()) {
minimumLevel = level;
}
}
return minimumLevel;
} | java | private static Level calculateMinimumLevel(final Level globalLevel, final Map<String, Level> customLevels) {
Level minimumLevel = globalLevel;
for (Level level : customLevels.values()) {
if (level.ordinal() < minimumLevel.ordinal()) {
minimumLevel = level;
}
}
return minimumLevel;
} | [
"private",
"static",
"Level",
"calculateMinimumLevel",
"(",
"final",
"Level",
"globalLevel",
",",
"final",
"Map",
"<",
"String",
",",
"Level",
">",
"customLevels",
")",
"{",
"Level",
"minimumLevel",
"=",
"globalLevel",
";",
"for",
"(",
"Level",
"level",
":",
... | Calculates the minimum severity level that can output any log entries.
@param globalLevel
Global severity level
@param customLevels
Custom severity levels for packages and classes
@return Minimum severity level | [
"Calculates",
"the",
"minimum",
"severity",
"level",
"that",
"can",
"output",
"any",
"log",
"entries",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/core/TinylogLoggingProvider.java#L209-L217 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/database/CmsHtmlImportDialog.java | CmsHtmlImportDialog.getDialogParameter | protected CmsWidgetDialogParameter getDialogParameter(String property, I_CmsWidget widget) {
return new CmsWidgetDialogParameter(m_htmlimport, property, PAGES[0], widget);
} | java | protected CmsWidgetDialogParameter getDialogParameter(String property, I_CmsWidget widget) {
return new CmsWidgetDialogParameter(m_htmlimport, property, PAGES[0], widget);
} | [
"protected",
"CmsWidgetDialogParameter",
"getDialogParameter",
"(",
"String",
"property",
",",
"I_CmsWidget",
"widget",
")",
"{",
"return",
"new",
"CmsWidgetDialogParameter",
"(",
"m_htmlimport",
",",
"property",
",",
"PAGES",
"[",
"0",
"]",
",",
"widget",
")",
";... | This function creates a <code> {@link CmsWidgetDialogParameter} </code> Object based
on the given properties.<p>
@param property the base object property to map the parameter to / from
@param widget the widget used for this dialog-parameter
@return a <code> {@link CmsWidgetDialogParameter} </code> Object | [
"This",
"function",
"creates",
"a",
"<code",
">",
"{",
"@link",
"CmsWidgetDialogParameter",
"}",
"<",
"/",
"code",
">",
"Object",
"based",
"on",
"the",
"given",
"properties",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/database/CmsHtmlImportDialog.java#L421-L424 |
cdk/cdk | display/render/src/main/java/org/openscience/cdk/renderer/color/PartialAtomicChargeColors.java | PartialAtomicChargeColors.getAtomColor | @Override
public Color getAtomColor(IAtom atom, Color defaultColor) {
Color color = defaultColor;
if (atom.getCharge() == null) return defaultColor;
double charge = atom.getCharge();
if (charge > 0.0) {
if (charge < 1.0) {
int index = 255 - (int) (charge * 255.0);
color = new Color(index, index, 255);
} else {
color = Color.blue;
}
} else if (charge < 0.0) {
if (charge > -1.0) {
int index = 255 + (int) (charge * 255.0);
color = new Color(255, index, index);
} else {
color = Color.red;
}
}
return color;
} | java | @Override
public Color getAtomColor(IAtom atom, Color defaultColor) {
Color color = defaultColor;
if (atom.getCharge() == null) return defaultColor;
double charge = atom.getCharge();
if (charge > 0.0) {
if (charge < 1.0) {
int index = 255 - (int) (charge * 255.0);
color = new Color(index, index, 255);
} else {
color = Color.blue;
}
} else if (charge < 0.0) {
if (charge > -1.0) {
int index = 255 + (int) (charge * 255.0);
color = new Color(255, index, index);
} else {
color = Color.red;
}
}
return color;
} | [
"@",
"Override",
"public",
"Color",
"getAtomColor",
"(",
"IAtom",
"atom",
",",
"Color",
"defaultColor",
")",
"{",
"Color",
"color",
"=",
"defaultColor",
";",
"if",
"(",
"atom",
".",
"getCharge",
"(",
")",
"==",
"null",
")",
"return",
"defaultColor",
";",
... | Returns the a color reflecting the given atom's partial charge, or
defaults to the given color if no color is defined.
@param atom IAtom to get a color for
@param defaultColor Color returned if this scheme does not define
a color for the passed IAtom
@return the color for the given atom. | [
"Returns",
"the",
"a",
"color",
"reflecting",
"the",
"given",
"atom",
"s",
"partial",
"charge",
"or",
"defaults",
"to",
"the",
"given",
"color",
"if",
"no",
"color",
"is",
"defined",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/render/src/main/java/org/openscience/cdk/renderer/color/PartialAtomicChargeColors.java#L59-L80 |
google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.getParameterInFunction | public Symbol getParameterInFunction(Symbol sym, String paramName) {
SymbolScope scope = getScopeInFunction(sym);
if (scope != null) {
Symbol param = scope.getSlot(paramName);
if (param != null && param.scope == scope) {
return param;
}
}
return null;
} | java | public Symbol getParameterInFunction(Symbol sym, String paramName) {
SymbolScope scope = getScopeInFunction(sym);
if (scope != null) {
Symbol param = scope.getSlot(paramName);
if (param != null && param.scope == scope) {
return param;
}
}
return null;
} | [
"public",
"Symbol",
"getParameterInFunction",
"(",
"Symbol",
"sym",
",",
"String",
"paramName",
")",
"{",
"SymbolScope",
"scope",
"=",
"getScopeInFunction",
"(",
"sym",
")",
";",
"if",
"(",
"scope",
"!=",
"null",
")",
"{",
"Symbol",
"param",
"=",
"scope",
... | If {@code sym} is a function, try to find a Symbol for a parameter with the given name.
<p>Returns null if we couldn't find one.
<p>Notice that this just makes a best effort, and may not be able to find parameters for
non-conventional function definitions. For example, we would not be able to find "y" in this
code: <code>
var x = x() ? function(y) {} : function(y) {};
</code> | [
"If",
"{",
"@code",
"sym",
"}",
"is",
"a",
"function",
"try",
"to",
"find",
"a",
"Symbol",
"for",
"a",
"parameter",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L217-L226 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.getKeysForKeyNameAsync | public Observable<SharedAccessSignatureAuthorizationRuleInner> getKeysForKeyNameAsync(String resourceGroupName, String resourceName, String keyName) {
return getKeysForKeyNameWithServiceResponseAsync(resourceGroupName, resourceName, keyName).map(new Func1<ServiceResponse<SharedAccessSignatureAuthorizationRuleInner>, SharedAccessSignatureAuthorizationRuleInner>() {
@Override
public SharedAccessSignatureAuthorizationRuleInner call(ServiceResponse<SharedAccessSignatureAuthorizationRuleInner> response) {
return response.body();
}
});
} | java | public Observable<SharedAccessSignatureAuthorizationRuleInner> getKeysForKeyNameAsync(String resourceGroupName, String resourceName, String keyName) {
return getKeysForKeyNameWithServiceResponseAsync(resourceGroupName, resourceName, keyName).map(new Func1<ServiceResponse<SharedAccessSignatureAuthorizationRuleInner>, SharedAccessSignatureAuthorizationRuleInner>() {
@Override
public SharedAccessSignatureAuthorizationRuleInner call(ServiceResponse<SharedAccessSignatureAuthorizationRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SharedAccessSignatureAuthorizationRuleInner",
">",
"getKeysForKeyNameAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"keyName",
")",
"{",
"return",
"getKeysForKeyNameWithServiceResponseAsync",
"(",
"resou... | Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param keyName The name of the shared access policy.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SharedAccessSignatureAuthorizationRuleInner object | [
"Get",
"a",
"shared",
"access",
"policy",
"by",
"name",
"from",
"an",
"IoT",
"hub",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com",
"/",
"azure",
"/",
"iot",
"-",
"hub",
"/",
"iot",
"-",
"hub... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2999-L3006 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java | SourceToHTMLConverter.addLine | private void addLine(Content pre, String line, int currentLineNo) {
if (line != null) {
pre.addContent(Util.replaceTabs(configuration, line));
Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
pre.addContent(anchor);
pre.addContent(NEW_LINE);
}
} | java | private void addLine(Content pre, String line, int currentLineNo) {
if (line != null) {
pre.addContent(Util.replaceTabs(configuration, line));
Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
pre.addContent(anchor);
pre.addContent(NEW_LINE);
}
} | [
"private",
"void",
"addLine",
"(",
"Content",
"pre",
",",
"String",
"line",
",",
"int",
"currentLineNo",
")",
"{",
"if",
"(",
"line",
"!=",
"null",
")",
"{",
"pre",
".",
"addContent",
"(",
"Util",
".",
"replaceTabs",
"(",
"configuration",
",",
"line",
... | Add a line from source to the HTML file that is generated.
@param pre the content tree to which the line will be added.
@param line the string to format.
@param currentLineNo the current number. | [
"Add",
"a",
"line",
"from",
"source",
"to",
"the",
"HTML",
"file",
"that",
"is",
"generated",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java#L270-L277 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/graph/Cycles.java | Cycles._invoke | private static Cycles _invoke(CycleFinder finder, IAtomContainer container, int length) {
try {
return finder.find(container, length);
} catch (Intractable e) {
throw new RuntimeException("Cycle computation should not be intractable: ", e);
}
} | java | private static Cycles _invoke(CycleFinder finder, IAtomContainer container, int length) {
try {
return finder.find(container, length);
} catch (Intractable e) {
throw new RuntimeException("Cycle computation should not be intractable: ", e);
}
} | [
"private",
"static",
"Cycles",
"_invoke",
"(",
"CycleFinder",
"finder",
",",
"IAtomContainer",
"container",
",",
"int",
"length",
")",
"{",
"try",
"{",
"return",
"finder",
".",
"find",
"(",
"container",
",",
"length",
")",
";",
"}",
"catch",
"(",
"Intracta... | Internal method to wrap cycle computations which <i>should</i> be
tractable. That is they currently won't throw the exception - if the
method does throw an exception an internal error is triggered as a sanity
check.
@param finder the cycle finding method
@param container the molecule to find the cycles of
@param length maximum size or cycle to find
@return the cycles of the molecule | [
"Internal",
"method",
"to",
"wrap",
"cycle",
"computations",
"which",
"<i",
">",
"should<",
"/",
"i",
">",
"be",
"tractable",
".",
"That",
"is",
"they",
"currently",
"won",
"t",
"throw",
"the",
"exception",
"-",
"if",
"the",
"method",
"does",
"throw",
"a... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/graph/Cycles.java#L706-L712 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractArrayFieldValidator.java | AbstractArrayFieldValidator.error | public void error(final ArrayCellField<E> cellField, final String messageKey, final Map<String, Object> messageVariables) {
ArgUtils.notEmpty(messageKey, "messageKey");
ArgUtils.notNull(cellField, "cellField");
ArgUtils.notNull(messageVariables, "messageVariables");
cellField.rejectValue(messageKey, messageVariables);
} | java | public void error(final ArrayCellField<E> cellField, final String messageKey, final Map<String, Object> messageVariables) {
ArgUtils.notEmpty(messageKey, "messageKey");
ArgUtils.notNull(cellField, "cellField");
ArgUtils.notNull(messageVariables, "messageVariables");
cellField.rejectValue(messageKey, messageVariables);
} | [
"public",
"void",
"error",
"(",
"final",
"ArrayCellField",
"<",
"E",
">",
"cellField",
",",
"final",
"String",
"messageKey",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"messageVariables",
")",
"{",
"ArgUtils",
".",
"notEmpty",
"(",
"messageKey",... | メッセージキーを指定して、エラー情報を追加します。
@param cellField フィールド情報
@param messageKey メッセージキー
@param messageVariables メッセージ中の変数
@throws IllegalArgumentException {@literal cellField == null or messageKey == null or messageVariables == null}
@throws IllegalArgumentException {@literal messageKey.length() == 0} | [
"メッセージキーを指定して、エラー情報を追加します。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractArrayFieldValidator.java#L114-L121 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.findFirst | public static <T extends Model> T findFirst(String subQuery, Object... params) {
return ModelDelegate.findFirst(Model.<T>modelClass(), subQuery, params);
} | java | public static <T extends Model> T findFirst(String subQuery, Object... params) {
return ModelDelegate.findFirst(Model.<T>modelClass(), subQuery, params);
} | [
"public",
"static",
"<",
"T",
"extends",
"Model",
">",
"T",
"findFirst",
"(",
"String",
"subQuery",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"ModelDelegate",
".",
"findFirst",
"(",
"Model",
".",
"<",
"T",
">",
"modelClass",
"(",
")",
",",
"s... | Synonym of {@link #first(String, Object...)}.
@param subQuery selection criteria, example:
<pre>
Person johnTheTeenager = Person.findFirst("name = ? and age > 13 and age < 19 order by age", "John")
</pre>
Sometimes a query might be just a clause like this:
<pre>
Person oldest = Person.findFirst("order by age desc")
</pre>
@param params list of parameters if question marks are used as placeholders
@return a first result for this condition. May return null if nothing found. | [
"Synonym",
"of",
"{",
"@link",
"#first",
"(",
"String",
"Object",
"...",
")",
"}",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L2461-L2463 |
dbracewell/mango | src/main/java/com/davidbracewell/reflection/ReflectionUtils.java | ReflectionUtils.bestMatchingMethod | public static Method bestMatchingMethod(Collection<Method> methods, String methodName, Class[] types) {
if (methods == null || StringUtils.isNullOrBlank(methodName) || types == null) {
return null;
}
for (Method method : methods) {
if (method.getName().equals(methodName) && typesMatch(method.getParameterTypes(), types)) {
return method;
}
}
return null;
} | java | public static Method bestMatchingMethod(Collection<Method> methods, String methodName, Class[] types) {
if (methods == null || StringUtils.isNullOrBlank(methodName) || types == null) {
return null;
}
for (Method method : methods) {
if (method.getName().equals(methodName) && typesMatch(method.getParameterTypes(), types)) {
return method;
}
}
return null;
} | [
"public",
"static",
"Method",
"bestMatchingMethod",
"(",
"Collection",
"<",
"Method",
">",
"methods",
",",
"String",
"methodName",
",",
"Class",
"[",
"]",
"types",
")",
"{",
"if",
"(",
"methods",
"==",
"null",
"||",
"StringUtils",
".",
"isNullOrBlank",
"(",
... | Finds the best Method match for a given method name and types against a collection of methods.
@param methods The collections of methods to choose from
@param methodName The name of the method we want to match
@param types The types that we want to pass to the method.
@return Null if there is no match, otherwise the Method which bests fits the given method name and types | [
"Finds",
"the",
"best",
"Method",
"match",
"for",
"a",
"given",
"method",
"name",
"and",
"types",
"against",
"a",
"collection",
"of",
"methods",
"."
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/reflection/ReflectionUtils.java#L58-L68 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java | Contract.inBounds | public static void inBounds(final Integer input, final Integer min, final Integer max, final String inputName) {
notNull(input, inputName);
if ((min != null) && (input < min)) {
throw new IndexOutOfBoundsException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be less than " + min.toString());
}
if ((max != null) && (input > max)) {
throw new IndexOutOfBoundsException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be greater than " + max.toString());
}
} | java | public static void inBounds(final Integer input, final Integer min, final Integer max, final String inputName) {
notNull(input, inputName);
if ((min != null) && (input < min)) {
throw new IndexOutOfBoundsException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be less than " + min.toString());
}
if ((max != null) && (input > max)) {
throw new IndexOutOfBoundsException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be greater than " + max.toString());
}
} | [
"public",
"static",
"void",
"inBounds",
"(",
"final",
"Integer",
"input",
",",
"final",
"Integer",
"min",
",",
"final",
"Integer",
"max",
",",
"final",
"String",
"inputName",
")",
"{",
"notNull",
"(",
"input",
",",
"inputName",
")",
";",
"if",
"(",
"(",
... | Checks that the input value is within the bounds of a maximum or minimum value
@param input the input to check
@param min the minimum value of the input (if null, input is not bound by minimum value)
@param max the maximum value of the input (if null, input is not bound by maximum value)
@param inputName the name of the input to report in error
@throws IllegalArgumentException if input is null or if the input is less than min or greater than max | [
"Checks",
"that",
"the",
"input",
"value",
"is",
"within",
"the",
"bounds",
"of",
"a",
"maximum",
"or",
"minimum",
"value"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L145-L155 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java | SequenceManagerStoredProcedureImpl.buildNextSequence | protected long buildNextSequence(PersistenceBroker broker, ClassDescriptor cld, String sequenceName)
throws LookupException, SQLException, PlatformException
{
CallableStatement cs = null;
try
{
Connection con = broker.serviceConnectionManager().getConnection();
cs = getPlatform().prepareNextValProcedureStatement(con, PROCEDURE_NAME, sequenceName);
cs.executeUpdate();
return cs.getLong(1);
}
finally
{
try
{
if (cs != null)
cs.close();
}
catch (SQLException ignore)
{
// ignore it
}
}
} | java | protected long buildNextSequence(PersistenceBroker broker, ClassDescriptor cld, String sequenceName)
throws LookupException, SQLException, PlatformException
{
CallableStatement cs = null;
try
{
Connection con = broker.serviceConnectionManager().getConnection();
cs = getPlatform().prepareNextValProcedureStatement(con, PROCEDURE_NAME, sequenceName);
cs.executeUpdate();
return cs.getLong(1);
}
finally
{
try
{
if (cs != null)
cs.close();
}
catch (SQLException ignore)
{
// ignore it
}
}
} | [
"protected",
"long",
"buildNextSequence",
"(",
"PersistenceBroker",
"broker",
",",
"ClassDescriptor",
"cld",
",",
"String",
"sequenceName",
")",
"throws",
"LookupException",
",",
"SQLException",
",",
"PlatformException",
"{",
"CallableStatement",
"cs",
"=",
"null",
";... | Calls the stored procedure stored procedure throws an
error if it doesn't exist.
@param broker
@param cld
@param sequenceName
@return
@throws LookupException
@throws SQLException | [
"Calls",
"the",
"stored",
"procedure",
"stored",
"procedure",
"throws",
"an",
"error",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java#L241-L264 |
neo4j-contrib/neo4j-apoc-procedures | src/main/java/apoc/couchbase/CouchbaseManager.java | CouchbaseManager.getConnectionObjectsFromHost | protected static Pair<PasswordAuthenticator, List<String>> getConnectionObjectsFromHost(URI host) {
List<String> nodes = Collections.emptyList();
try {
nodes = Arrays.asList(new URI(host.getScheme(),
null, host.getHost(), host.getPort(),
null, null, null).toString());
} catch (URISyntaxException e) {
}
String[] credentials = host.getUserInfo().split(":");
return Pair.of(
new PasswordAuthenticator(credentials[0], credentials[1]),
nodes
);
} | java | protected static Pair<PasswordAuthenticator, List<String>> getConnectionObjectsFromHost(URI host) {
List<String> nodes = Collections.emptyList();
try {
nodes = Arrays.asList(new URI(host.getScheme(),
null, host.getHost(), host.getPort(),
null, null, null).toString());
} catch (URISyntaxException e) {
}
String[] credentials = host.getUserInfo().split(":");
return Pair.of(
new PasswordAuthenticator(credentials[0], credentials[1]),
nodes
);
} | [
"protected",
"static",
"Pair",
"<",
"PasswordAuthenticator",
",",
"List",
"<",
"String",
">",
">",
"getConnectionObjectsFromHost",
"(",
"URI",
"host",
")",
"{",
"List",
"<",
"String",
">",
"nodes",
"=",
"Collections",
".",
"emptyList",
"(",
")",
";",
"try",
... | Creates a {@link Pair} containing a {@link PasswordAuthenticator} and a {@link List} of (cluster) nodes from a URI
@param host a URI representing the connection to a single instance, for example couchbase://username:password@hostname:port
@return a tuple2, the connections objects that we need to establish a connection to a Couchbase Server | [
"Creates",
"a",
"{",
"@link",
"Pair",
"}",
"containing",
"a",
"{",
"@link",
"PasswordAuthenticator",
"}",
"and",
"a",
"{",
"@link",
"List",
"}",
"of",
"(",
"cluster",
")",
"nodes",
"from",
"a",
"URI"
] | train | https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/couchbase/CouchbaseManager.java#L99-L114 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java | Utils.storeDirectoryResourcesAsBytes | public static Map<String,byte[]> storeDirectoryResourcesAsBytes( File directory ) throws IOException {
return storeDirectoryResourcesAsBytes( directory, new ArrayList<String>( 0 ));
} | java | public static Map<String,byte[]> storeDirectoryResourcesAsBytes( File directory ) throws IOException {
return storeDirectoryResourcesAsBytes( directory, new ArrayList<String>( 0 ));
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"byte",
"[",
"]",
">",
"storeDirectoryResourcesAsBytes",
"(",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"return",
"storeDirectoryResourcesAsBytes",
"(",
"directory",
",",
"new",
"ArrayList",
"<",
"String... | Stores the resources from a directory into a map.
@param directory an existing directory
@return a non-null map (key = the file location, relative to the directory, value = file content)
@throws IOException if something went wrong while reading a file | [
"Stores",
"the",
"resources",
"from",
"a",
"directory",
"into",
"a",
"map",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L836-L838 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WRepeater.java | WRepeater.prepareRow | protected void prepareRow(final Request request, final int rowIndex) {
WComponent row = getRepeatedComponent();
row.preparePaint(request);
} | java | protected void prepareRow(final Request request, final int rowIndex) {
WComponent row = getRepeatedComponent();
row.preparePaint(request);
} | [
"protected",
"void",
"prepareRow",
"(",
"final",
"Request",
"request",
",",
"final",
"int",
"rowIndex",
")",
"{",
"WComponent",
"row",
"=",
"getRepeatedComponent",
"(",
")",
";",
"row",
".",
"preparePaint",
"(",
"request",
")",
";",
"}"
] | Prepares a single row for painting.
@param request the request being responded to.
@param rowIndex the row index. | [
"Prepares",
"a",
"single",
"row",
"for",
"painting",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WRepeater.java#L395-L398 |
alkacon/opencms-core | src/org/opencms/ui/apps/sitemanager/CmsWorkplaceServerWidget.java | CmsWorkplaceServerWidget.setUpWorkplaceComboBox | private static BeanItemContainer<CmsSite> setUpWorkplaceComboBox(
List<CmsSite> allSites,
final ComboBox combo,
boolean nullselect,
String defaultValue,
CmsSSLMode sslMode) {
final List<CmsSite> modSites = new ArrayList<CmsSite>();
CmsSite siteWithDefaultURL = null;
String defaultURL = defaultValue;
for (CmsSite site : allSites) {
CmsSite si = new CmsSite("dummy", site.getUrl());
si.setSSLMode(site.getSSLMode());
modSites.add(si);
if (defaultValue != null) {
if (defaultURL.equals(si.getUrl())) { //SSL sensitive ('http'!='https')
siteWithDefaultURL = si;
}
}
}
if (defaultValue != null) {
if (siteWithDefaultURL == null) {
siteWithDefaultURL = new CmsSite("dummy", defaultURL);
siteWithDefaultURL.setSSLMode(sslMode);
modSites.add(0, siteWithDefaultURL);
}
}
final BeanItemContainer<CmsSite> objects = new BeanItemContainer<CmsSite>(CmsSite.class, modSites);
combo.setContainerDataSource(objects);
combo.setNullSelectionAllowed(nullselect);
combo.setItemCaptionPropertyId("url");
combo.setValue(siteWithDefaultURL);
combo.setNewItemsAllowed(true);
combo.setImmediate(true);
combo.setNewItemHandler(new NewItemHandler() {
private static final long serialVersionUID = -4760590374697520609L;
public void addNewItem(String newItemCaption) {
CmsSite newItem = new CmsSite("dummy", newItemCaption);
newItem.setSSLMode(newItemCaption.contains("https:") ? CmsSSLMode.MANUAL : CmsSSLMode.NO);
objects.addBean(newItem);
combo.select(newItem);
}
});
return objects;
} | java | private static BeanItemContainer<CmsSite> setUpWorkplaceComboBox(
List<CmsSite> allSites,
final ComboBox combo,
boolean nullselect,
String defaultValue,
CmsSSLMode sslMode) {
final List<CmsSite> modSites = new ArrayList<CmsSite>();
CmsSite siteWithDefaultURL = null;
String defaultURL = defaultValue;
for (CmsSite site : allSites) {
CmsSite si = new CmsSite("dummy", site.getUrl());
si.setSSLMode(site.getSSLMode());
modSites.add(si);
if (defaultValue != null) {
if (defaultURL.equals(si.getUrl())) { //SSL sensitive ('http'!='https')
siteWithDefaultURL = si;
}
}
}
if (defaultValue != null) {
if (siteWithDefaultURL == null) {
siteWithDefaultURL = new CmsSite("dummy", defaultURL);
siteWithDefaultURL.setSSLMode(sslMode);
modSites.add(0, siteWithDefaultURL);
}
}
final BeanItemContainer<CmsSite> objects = new BeanItemContainer<CmsSite>(CmsSite.class, modSites);
combo.setContainerDataSource(objects);
combo.setNullSelectionAllowed(nullselect);
combo.setItemCaptionPropertyId("url");
combo.setValue(siteWithDefaultURL);
combo.setNewItemsAllowed(true);
combo.setImmediate(true);
combo.setNewItemHandler(new NewItemHandler() {
private static final long serialVersionUID = -4760590374697520609L;
public void addNewItem(String newItemCaption) {
CmsSite newItem = new CmsSite("dummy", newItemCaption);
newItem.setSSLMode(newItemCaption.contains("https:") ? CmsSSLMode.MANUAL : CmsSSLMode.NO);
objects.addBean(newItem);
combo.select(newItem);
}
});
return objects;
} | [
"private",
"static",
"BeanItemContainer",
"<",
"CmsSite",
">",
"setUpWorkplaceComboBox",
"(",
"List",
"<",
"CmsSite",
">",
"allSites",
",",
"final",
"ComboBox",
"combo",
",",
"boolean",
"nullselect",
",",
"String",
"defaultValue",
",",
"CmsSSLMode",
"sslMode",
")"... | Sets the combo box for workplace.<p>
@param allSites alls available sites
@param combo combo box to fill
@param nullselect if true, nothing is selected
@param defaultValue if set, this value gets chosen
@param sslMode CmsSSLMode
@return BeanItemContainer | [
"Sets",
"the",
"combo",
"box",
"for",
"workplace",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sitemanager/CmsWorkplaceServerWidget.java#L128-L178 |
davetcc/tcMenu | tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/util/MenuItemHelper.java | MenuItemHelper.asSubMenu | public static SubMenuItem asSubMenu(MenuItem item) {
return visitWithResult(item, new AbstractMenuItemVisitor<SubMenuItem>() {
@Override
public void visit(SubMenuItem item) {
setResult(item);
}
@Override
public void anyItem(MenuItem item) { /* ignored */ }
}).orElse(null);
} | java | public static SubMenuItem asSubMenu(MenuItem item) {
return visitWithResult(item, new AbstractMenuItemVisitor<SubMenuItem>() {
@Override
public void visit(SubMenuItem item) {
setResult(item);
}
@Override
public void anyItem(MenuItem item) { /* ignored */ }
}).orElse(null);
} | [
"public",
"static",
"SubMenuItem",
"asSubMenu",
"(",
"MenuItem",
"item",
")",
"{",
"return",
"visitWithResult",
"(",
"item",
",",
"new",
"AbstractMenuItemVisitor",
"<",
"SubMenuItem",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"visit",
"(",
"SubMen... | Returns the menu item as a sub menu or null
@param item the possible sub menu
@return the sub menu, or null. | [
"Returns",
"the",
"menu",
"item",
"as",
"a",
"sub",
"menu",
"or",
"null"
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/util/MenuItemHelper.java#L37-L47 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java | TraceComponent.uniquifyCountAndCopy | private static int uniquifyCountAndCopy(String[] in, String[] out) {
int count = 0;
outer: for (int i = 0; i < in.length; i++) {
if (in[i] != null) {
for (int j = 0; j < i; j++)
if (in[i].equals(in[j]))
continue outer;
if (out != null)
out[count] = in[i];
count++;
}
}
return count;
} | java | private static int uniquifyCountAndCopy(String[] in, String[] out) {
int count = 0;
outer: for (int i = 0; i < in.length; i++) {
if (in[i] != null) {
for (int j = 0; j < i; j++)
if (in[i].equals(in[j]))
continue outer;
if (out != null)
out[count] = in[i];
count++;
}
}
return count;
} | [
"private",
"static",
"int",
"uniquifyCountAndCopy",
"(",
"String",
"[",
"]",
"in",
",",
"String",
"[",
"]",
"out",
")",
"{",
"int",
"count",
"=",
"0",
";",
"outer",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"in",
".",
"length",
";",
... | Count the number of non-null non-duplicate elements in an array, and copy
those elements to an output array if provided.
@param in the input array
@param out an output array, or null to count rather than copying
@return the number of non-null non-duplicate elements | [
"Count",
"the",
"number",
"of",
"non",
"-",
"null",
"non",
"-",
"duplicate",
"elements",
"in",
"an",
"array",
"and",
"copy",
"those",
"elements",
"to",
"an",
"output",
"array",
"if",
"provided",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/TraceComponent.java#L174-L187 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.expectNumeric | public void expectNumeric(String name, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
if (!StringUtils.isNumeric(value)) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.NUMERIC_KEY.name(), name)));
}
} | java | public void expectNumeric(String name, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
if (!StringUtils.isNumeric(value)) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.NUMERIC_KEY.name(), name)));
}
} | [
"public",
"void",
"expectNumeric",
"(",
"String",
"name",
",",
"String",
"message",
")",
"{",
"String",
"value",
"=",
"Optional",
".",
"ofNullable",
"(",
"get",
"(",
"name",
")",
")",
".",
"orElse",
"(",
"\"\"",
")",
";",
"if",
"(",
"!",
"StringUtils",... | Validates that a given field has a numeric value
@param name The field to check
@param message A custom error message instead of the default one | [
"Validates",
"that",
"a",
"given",
"field",
"has",
"a",
"numeric",
"value"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L136-L142 |
geomajas/geomajas-project-client-gwt2 | impl/src/main/java/org/geomajas/gwt2/client/controller/NavigationController.java | NavigationController.calculatePosition | protected Coordinate calculatePosition(boolean zoomIn, Coordinate rescalePoint) {
ViewPort viewPort = mapPresenter.getViewPort();
Coordinate position = viewPort.getPosition();
int index = viewPort.getResolutionIndex(viewPort.getResolution());
double resolution = viewPort.getResolution();
if (zoomIn && index < viewPort.getResolutionCount() - 1) {
resolution = viewPort.getResolution(index + 1);
} else if (!zoomIn && index > 0) {
resolution = viewPort.getResolution(index - 1);
}
double factor = viewPort.getResolution() / resolution;
double dX = (rescalePoint.getX() - position.getX()) * (1 - 1 / factor);
double dY = (rescalePoint.getY() - position.getY()) * (1 - 1 / factor);
return new Coordinate(position.getX() + dX, position.getY() + dY);
} | java | protected Coordinate calculatePosition(boolean zoomIn, Coordinate rescalePoint) {
ViewPort viewPort = mapPresenter.getViewPort();
Coordinate position = viewPort.getPosition();
int index = viewPort.getResolutionIndex(viewPort.getResolution());
double resolution = viewPort.getResolution();
if (zoomIn && index < viewPort.getResolutionCount() - 1) {
resolution = viewPort.getResolution(index + 1);
} else if (!zoomIn && index > 0) {
resolution = viewPort.getResolution(index - 1);
}
double factor = viewPort.getResolution() / resolution;
double dX = (rescalePoint.getX() - position.getX()) * (1 - 1 / factor);
double dY = (rescalePoint.getY() - position.getY()) * (1 - 1 / factor);
return new Coordinate(position.getX() + dX, position.getY() + dY);
} | [
"protected",
"Coordinate",
"calculatePosition",
"(",
"boolean",
"zoomIn",
",",
"Coordinate",
"rescalePoint",
")",
"{",
"ViewPort",
"viewPort",
"=",
"mapPresenter",
".",
"getViewPort",
"(",
")",
";",
"Coordinate",
"position",
"=",
"viewPort",
".",
"getPosition",
"(... | Calculate the target position should there be a rescale point. The idea is that after zooming in or out, the
mouse cursor would still lie at the same position in world space. | [
"Calculate",
"the",
"target",
"position",
"should",
"there",
"be",
"a",
"rescale",
"point",
".",
"The",
"idea",
"is",
"that",
"after",
"zooming",
"in",
"or",
"out",
"the",
"mouse",
"cursor",
"would",
"still",
"lie",
"at",
"the",
"same",
"position",
"in",
... | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/controller/NavigationController.java#L318-L334 |
thinkaurelius/titan | titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/keycolumnvalue/KCVSUtil.java | KCVSUtil.containsKeyColumn | public static boolean containsKeyColumn(KeyColumnValueStore store, StaticBuffer key, StaticBuffer column, StoreTransaction txh) throws BackendException {
return get(store, key, column, txh) != null;
} | java | public static boolean containsKeyColumn(KeyColumnValueStore store, StaticBuffer key, StaticBuffer column, StoreTransaction txh) throws BackendException {
return get(store, key, column, txh) != null;
} | [
"public",
"static",
"boolean",
"containsKeyColumn",
"(",
"KeyColumnValueStore",
"store",
",",
"StaticBuffer",
"key",
",",
"StaticBuffer",
"column",
",",
"StoreTransaction",
"txh",
")",
"throws",
"BackendException",
"{",
"return",
"get",
"(",
"store",
",",
"key",
"... | Returns true if the specified key-column pair exists in the store.
@param store Store
@param key Key
@param column Column
@param txh Transaction
@return TRUE, if key has at least one column-value pair, else FALSE | [
"Returns",
"true",
"if",
"the",
"specified",
"key",
"-",
"column",
"pair",
"exists",
"in",
"the",
"store",
"."
] | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/keycolumnvalue/KCVSUtil.java#L70-L72 |
hal/core | gui/src/main/java/org/jboss/as/console/client/shared/subsys/undertow/ApplicationSecurityDomainResourceView.java | ApplicationSecurityDomainResourceView.populateRepackagedToCredentialReference | private void populateRepackagedToCredentialReference(ModelNode payload, String repackagedPropName, String propertyName) {
ModelNode value = payload.get(repackagedPropName);
if (payload.hasDefined(repackagedPropName) && value.asString().trim().length() > 0) {
payload.get(CREDENTIAL_REFERENCE).get(propertyName).set(value);
}
payload.remove(repackagedPropName);
} | java | private void populateRepackagedToCredentialReference(ModelNode payload, String repackagedPropName, String propertyName) {
ModelNode value = payload.get(repackagedPropName);
if (payload.hasDefined(repackagedPropName) && value.asString().trim().length() > 0) {
payload.get(CREDENTIAL_REFERENCE).get(propertyName).set(value);
}
payload.remove(repackagedPropName);
} | [
"private",
"void",
"populateRepackagedToCredentialReference",
"(",
"ModelNode",
"payload",
",",
"String",
"repackagedPropName",
",",
"String",
"propertyName",
")",
"{",
"ModelNode",
"value",
"=",
"payload",
".",
"get",
"(",
"repackagedPropName",
")",
";",
"if",
"(",... | create a flat node, copying the credential-reference complex attribute as regular attributes of the payload | [
"create",
"a",
"flat",
"node",
"copying",
"the",
"credential",
"-",
"reference",
"complex",
"attribute",
"as",
"regular",
"attributes",
"of",
"the",
"payload"
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/shared/subsys/undertow/ApplicationSecurityDomainResourceView.java#L328-L334 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault-webkey/src/main/java/com/microsoft/azure/keyvault/webkey/JsonWebKey.java | JsonWebKey.fromEC | public static JsonWebKey fromEC(KeyPair keyPair, Provider provider) {
ECPublicKey apub = (ECPublicKey) keyPair.getPublic();
ECPoint point = apub.getW();
ECPrivateKey apriv = (ECPrivateKey) keyPair.getPrivate();
if (apriv != null) {
return new JsonWebKey().withKty(JsonWebKeyType.EC).withCrv(getCurveFromKeyPair(keyPair, provider))
.withX(point.getAffineX().toByteArray()).withY(point.getAffineY().toByteArray())
.withD(apriv.getS().toByteArray()).withKty(JsonWebKeyType.EC);
} else {
return new JsonWebKey().withKty(JsonWebKeyType.EC).withCrv(getCurveFromKeyPair(keyPair, provider))
.withX(point.getAffineX().toByteArray()).withY(point.getAffineY().toByteArray())
.withKty(JsonWebKeyType.EC);
}
} | java | public static JsonWebKey fromEC(KeyPair keyPair, Provider provider) {
ECPublicKey apub = (ECPublicKey) keyPair.getPublic();
ECPoint point = apub.getW();
ECPrivateKey apriv = (ECPrivateKey) keyPair.getPrivate();
if (apriv != null) {
return new JsonWebKey().withKty(JsonWebKeyType.EC).withCrv(getCurveFromKeyPair(keyPair, provider))
.withX(point.getAffineX().toByteArray()).withY(point.getAffineY().toByteArray())
.withD(apriv.getS().toByteArray()).withKty(JsonWebKeyType.EC);
} else {
return new JsonWebKey().withKty(JsonWebKeyType.EC).withCrv(getCurveFromKeyPair(keyPair, provider))
.withX(point.getAffineX().toByteArray()).withY(point.getAffineY().toByteArray())
.withKty(JsonWebKeyType.EC);
}
} | [
"public",
"static",
"JsonWebKey",
"fromEC",
"(",
"KeyPair",
"keyPair",
",",
"Provider",
"provider",
")",
"{",
"ECPublicKey",
"apub",
"=",
"(",
"ECPublicKey",
")",
"keyPair",
".",
"getPublic",
"(",
")",
";",
"ECPoint",
"point",
"=",
"apub",
".",
"getW",
"("... | Converts EC key pair to JSON web key.
@param keyPair
EC key pair
@param provider
Java security provider
@return the JSON web key, converted from EC key pair. | [
"Converts",
"EC",
"key",
"pair",
"to",
"JSON",
"web",
"key",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault-webkey/src/main/java/com/microsoft/azure/keyvault/webkey/JsonWebKey.java#L818-L833 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java | ServerSentEvents.fromStream | public static HttpResponse fromStream(Stream<? extends ServerSentEvent> contentStream,
Executor executor) {
return fromStream(defaultHttpHeaders, contentStream, HttpHeaders.EMPTY_HEADERS, executor);
} | java | public static HttpResponse fromStream(Stream<? extends ServerSentEvent> contentStream,
Executor executor) {
return fromStream(defaultHttpHeaders, contentStream, HttpHeaders.EMPTY_HEADERS, executor);
} | [
"public",
"static",
"HttpResponse",
"fromStream",
"(",
"Stream",
"<",
"?",
"extends",
"ServerSentEvent",
">",
"contentStream",
",",
"Executor",
"executor",
")",
"{",
"return",
"fromStream",
"(",
"defaultHttpHeaders",
",",
"contentStream",
",",
"HttpHeaders",
".",
... | Creates a new Server-Sent Events stream from the specified {@link Stream}.
@param contentStream the {@link Stream} which publishes the objects supposed to send as contents
@param executor the executor which iterates the stream | [
"Creates",
"a",
"new",
"Server",
"-",
"Sent",
"Events",
"stream",
"from",
"the",
"specified",
"{",
"@link",
"Stream",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java#L169-L172 |
brettonw/Bag | src/main/java/com/brettonw/bag/SourceAdapterHttp.java | SourceAdapterHttp.trustAllHosts | public static void trustAllHosts () {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager () {
public X509Certificate[] getAcceptedIssuers () { return new X509Certificate[]{}; }
public void checkClientTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
public void checkServerTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
}
};
// Install the all-trusting trust manager
try {
SSLContext sslContext = SSLContext.getInstance ("TLS");
sslContext.init (null, trustAllCerts, new java.security.SecureRandom ());
HttpsURLConnection.setDefaultSSLSocketFactory (sslContext.getSocketFactory ());
HttpsURLConnection.setDefaultHostnameVerifier ((String var1, SSLSession var2) -> {
return true;
});
} catch (Exception exception) {
log.error (exception);
}
} | java | public static void trustAllHosts () {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager () {
public X509Certificate[] getAcceptedIssuers () { return new X509Certificate[]{}; }
public void checkClientTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
public void checkServerTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
}
};
// Install the all-trusting trust manager
try {
SSLContext sslContext = SSLContext.getInstance ("TLS");
sslContext.init (null, trustAllCerts, new java.security.SecureRandom ());
HttpsURLConnection.setDefaultSSLSocketFactory (sslContext.getSocketFactory ());
HttpsURLConnection.setDefaultHostnameVerifier ((String var1, SSLSession var2) -> {
return true;
});
} catch (Exception exception) {
log.error (exception);
}
} | [
"public",
"static",
"void",
"trustAllHosts",
"(",
")",
"{",
"// Create a trust manager that does not validate certificate chains\r",
"TrustManager",
"[",
"]",
"trustAllCerts",
"=",
"new",
"TrustManager",
"[",
"]",
"{",
"new",
"X509TrustManager",
"(",
")",
"{",
"public",... | Sometimes a remote source is self-signed or not otherwise trusted | [
"Sometimes",
"a",
"remote",
"source",
"is",
"self",
"-",
"signed",
"or",
"not",
"otherwise",
"trusted"
] | train | https://github.com/brettonw/Bag/blob/25c0ff74893b6c9a2c61bf0f97189ab82e0b2f56/src/main/java/com/brettonw/bag/SourceAdapterHttp.java#L113-L136 |
Grasia/phatsim | phat-audio/src/main/java/phat/audio/AudioFactory.java | AudioFactory.makeAudioSpeakerSource | public AudioSpeakerSource makeAudioSpeakerSource(String nodeName, String textToSpeech, Vector3f location) {
AudioSpeakerSource audioNode = createAudioSpeakingNode(textToSpeech);
audioNode.setPositional(true);
audioNode.setDirectional(false);
/*
audioNode.setInnerAngle(180f);
audioNode.setOuterAngle(90f);
*/
audioNode.setName(nodeName);
audioNode.setLocalTranslation(location);
audioNode.setVolume(1f);
audioNode.setMaxDistance(Float.MAX_VALUE);
audioNode.setRefDistance(1f);
//audioNode.setTimeOffset((float)Math.random());
return audioNode;
} | java | public AudioSpeakerSource makeAudioSpeakerSource(String nodeName, String textToSpeech, Vector3f location) {
AudioSpeakerSource audioNode = createAudioSpeakingNode(textToSpeech);
audioNode.setPositional(true);
audioNode.setDirectional(false);
/*
audioNode.setInnerAngle(180f);
audioNode.setOuterAngle(90f);
*/
audioNode.setName(nodeName);
audioNode.setLocalTranslation(location);
audioNode.setVolume(1f);
audioNode.setMaxDistance(Float.MAX_VALUE);
audioNode.setRefDistance(1f);
//audioNode.setTimeOffset((float)Math.random());
return audioNode;
} | [
"public",
"AudioSpeakerSource",
"makeAudioSpeakerSource",
"(",
"String",
"nodeName",
",",
"String",
"textToSpeech",
",",
"Vector3f",
"location",
")",
"{",
"AudioSpeakerSource",
"audioNode",
"=",
"createAudioSpeakingNode",
"(",
"textToSpeech",
")",
";",
"audioNode",
".",... | /*public AudioSource makeAudioSource(String name, String resource, Vector3f location) {
AudioNode audioNode = new AudioNode(assetManager, resource);
audioNode.setChannel(0);
audioNode.setPositional(true);
audioNode.setName(name);
audioNode.setLooping(true);
audioNode.setLocalTranslation(location);
audioNode.setVolume(0.03f);
audioNode.setMaxDistance(100000000);
audioNode.setRefDistance(5f);
audioNode.setTimeOffset((float)Math.random());
AudioSource as = new AudioSource(audioNode, rootNode,assetManager);
return as;
} | [
"/",
"*",
"public",
"AudioSource",
"makeAudioSource",
"(",
"String",
"name",
"String",
"resource",
"Vector3f",
"location",
")",
"{",
"AudioNode",
"audioNode",
"=",
"new",
"AudioNode",
"(",
"assetManager",
"resource",
")",
";",
"audioNode",
".",
"setChannel",
"("... | train | https://github.com/Grasia/phatsim/blob/2d4fc8189be9730b34c8e3e1a08fb4800e01c5df/phat-audio/src/main/java/phat/audio/AudioFactory.java#L109-L124 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java | Configurer.getNodeString | private String getNodeString(String attribute, String... path)
{
final Xml node = getNode(path);
return node.readString(attribute);
} | java | private String getNodeString(String attribute, String... path)
{
final Xml node = getNode(path);
return node.readString(attribute);
} | [
"private",
"String",
"getNodeString",
"(",
"String",
"attribute",
",",
"String",
"...",
"path",
")",
"{",
"final",
"Xml",
"node",
"=",
"getNode",
"(",
"path",
")",
";",
"return",
"node",
".",
"readString",
"(",
"attribute",
")",
";",
"}"
] | Get the string from a node.
@param attribute The attribute to get.
@param path The attribute node path.
@return The string found.
@throws LionEngineException If node not found. | [
"Get",
"the",
"string",
"from",
"a",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L492-L496 |
mikepenz/Crossfader | library/src/main/java/com/mikepenz/crossfader/Crossfader.java | Crossfader.withStructure | public Crossfader withStructure(View first, int firstWidth, View second, int secondWidth) {
withFirst(first, firstWidth);
withSecond(second, secondWidth);
return this;
} | java | public Crossfader withStructure(View first, int firstWidth, View second, int secondWidth) {
withFirst(first, firstWidth);
withSecond(second, secondWidth);
return this;
} | [
"public",
"Crossfader",
"withStructure",
"(",
"View",
"first",
",",
"int",
"firstWidth",
",",
"View",
"second",
",",
"int",
"secondWidth",
")",
"{",
"withFirst",
"(",
"first",
",",
"firstWidth",
")",
";",
"withSecond",
"(",
"second",
",",
"secondWidth",
")",... | define the default view and the slided view of the crossfader
@param first
@param firstWidth
@param second
@param secondWidth
@return | [
"define",
"the",
"default",
"view",
"and",
"the",
"slided",
"view",
"of",
"the",
"crossfader"
] | train | https://github.com/mikepenz/Crossfader/blob/b2e1ee461bc3bcdd897d83f0fad950663bdc73b4/library/src/main/java/com/mikepenz/crossfader/Crossfader.java#L111-L115 |
selenide/selenide | src/main/java/com/codeborne/selenide/impl/DownloadFileWithHttpRequest.java | DownloadFileWithHttpRequest.createTrustingHttpClient | protected CloseableHttpClient createTrustingHttpClient() throws IOException {
try {
HttpClientBuilder builder = HttpClientBuilder.create();
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustAllStrategy()).build();
builder.setSSLContext(sslContext);
HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;
SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", sslSocketFactory)
.build();
PoolingHttpClientConnectionManager connMgr = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
builder.setConnectionManager(connMgr);
return builder.build();
}
catch (Exception e) {
throw new IOException(e);
}
} | java | protected CloseableHttpClient createTrustingHttpClient() throws IOException {
try {
HttpClientBuilder builder = HttpClientBuilder.create();
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustAllStrategy()).build();
builder.setSSLContext(sslContext);
HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;
SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", sslSocketFactory)
.build();
PoolingHttpClientConnectionManager connMgr = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
builder.setConnectionManager(connMgr);
return builder.build();
}
catch (Exception e) {
throw new IOException(e);
}
} | [
"protected",
"CloseableHttpClient",
"createTrustingHttpClient",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"HttpClientBuilder",
"builder",
"=",
"HttpClientBuilder",
".",
"create",
"(",
")",
";",
"SSLContext",
"sslContext",
"=",
"new",
"SSLContextBuilder",
"("... | configure HttpClient to ignore self-signed certs
as described here: http://literatejava.com/networks/ignore-ssl-certificate-errors-apache-httpclient-4-4/ | [
"configure",
"HttpClient",
"to",
"ignore",
"self",
"-",
"signed",
"certs",
"as",
"described",
"here",
":",
"http",
":",
"//",
"literatejava",
".",
"com",
"/",
"networks",
"/",
"ignore",
"-",
"ssl",
"-",
"certificate",
"-",
"errors",
"-",
"apache",
"-",
"... | train | https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/impl/DownloadFileWithHttpRequest.java#L132-L153 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java | CoverageDataCore.getPixelValue | public short getPixelValue(GriddedTile griddedTile, Double value) {
int unsignedPixelValue = getUnsignedPixelValue(griddedTile, value);
short pixelValue = getPixelValue(unsignedPixelValue);
return pixelValue;
} | java | public short getPixelValue(GriddedTile griddedTile, Double value) {
int unsignedPixelValue = getUnsignedPixelValue(griddedTile, value);
short pixelValue = getPixelValue(unsignedPixelValue);
return pixelValue;
} | [
"public",
"short",
"getPixelValue",
"(",
"GriddedTile",
"griddedTile",
",",
"Double",
"value",
")",
"{",
"int",
"unsignedPixelValue",
"=",
"getUnsignedPixelValue",
"(",
"griddedTile",
",",
"value",
")",
";",
"short",
"pixelValue",
"=",
"getPixelValue",
"(",
"unsig... | Get the "unsigned short" pixel value of the coverage data value
@param griddedTile
gridded tile
@param value
coverage data value
@return "unsigned short" pixel value | [
"Get",
"the",
"unsigned",
"short",
"pixel",
"value",
"of",
"the",
"coverage",
"data",
"value"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1598-L1602 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/MasterSlaveDataSourceFactory.java | MasterSlaveDataSourceFactory.createDataSource | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final MasterSlaveRuleConfiguration masterSlaveRuleConfig, final Properties props) throws SQLException {
return new MasterSlaveDataSource(dataSourceMap, masterSlaveRuleConfig, props);
} | java | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final MasterSlaveRuleConfiguration masterSlaveRuleConfig, final Properties props) throws SQLException {
return new MasterSlaveDataSource(dataSourceMap, masterSlaveRuleConfig, props);
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"final",
"Map",
"<",
"String",
",",
"DataSource",
">",
"dataSourceMap",
",",
"final",
"MasterSlaveRuleConfiguration",
"masterSlaveRuleConfig",
",",
"final",
"Properties",
"props",
")",
"throws",
"SQLException",
... | Create master-slave data source.
@param dataSourceMap data source map
@param masterSlaveRuleConfig master-slave rule configuration
@param props props
@return master-slave data source
@throws SQLException SQL exception | [
"Create",
"master",
"-",
"slave",
"data",
"source",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/MasterSlaveDataSourceFactory.java#L48-L50 |
spring-projects/spring-security-oauth | spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java | DefaultRedirectResolver.hostMatches | protected boolean hostMatches(String registered, String requested) {
if (matchSubdomains) {
return registered.equals(requested) || requested.endsWith("." + registered);
}
return registered.equals(requested);
} | java | protected boolean hostMatches(String registered, String requested) {
if (matchSubdomains) {
return registered.equals(requested) || requested.endsWith("." + registered);
}
return registered.equals(requested);
} | [
"protected",
"boolean",
"hostMatches",
"(",
"String",
"registered",
",",
"String",
"requested",
")",
"{",
"if",
"(",
"matchSubdomains",
")",
"{",
"return",
"registered",
".",
"equals",
"(",
"requested",
")",
"||",
"requested",
".",
"endsWith",
"(",
"\".\"",
... | Check if host matches the registered value.
@param registered the registered host
@param requested the requested host
@return true if they match | [
"Check",
"if",
"host",
"matches",
"the",
"registered",
"value",
"."
] | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java#L190-L195 |
apache/incubator-heron | heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java | SchedulerStateManagerAdaptor.getSchedulerLocation | public Scheduler.SchedulerLocation getSchedulerLocation(String topologyName) {
return awaitResult(delegate.getSchedulerLocation(null, topologyName));
} | java | public Scheduler.SchedulerLocation getSchedulerLocation(String topologyName) {
return awaitResult(delegate.getSchedulerLocation(null, topologyName));
} | [
"public",
"Scheduler",
".",
"SchedulerLocation",
"getSchedulerLocation",
"(",
"String",
"topologyName",
")",
"{",
"return",
"awaitResult",
"(",
"delegate",
".",
"getSchedulerLocation",
"(",
"null",
",",
"topologyName",
")",
")",
";",
"}"
] | Get the scheduler location for the given topology
@return SchedulerLocation | [
"Get",
"the",
"scheduler",
"location",
"for",
"the",
"given",
"topology"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L256-L258 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/MethodUtils.java | MethodUtils.invokeMethod | public static Object invokeMethod(Object object, String methodName)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
return invokeMethod(object, methodName, EMPTY_OBJECT_ARRAY, EMPTY_CLASS_PARAMETERS);
} | java | public static Object invokeMethod(Object object, String methodName)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
return invokeMethod(object, methodName, EMPTY_OBJECT_ARRAY, EMPTY_CLASS_PARAMETERS);
} | [
"public",
"static",
"Object",
"invokeMethod",
"(",
"Object",
"object",
",",
"String",
"methodName",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"return",
"invokeMethod",
"(",
"object",
",",
"methodName",
... | <p>Invoke a named method whose parameter type matches the object type.</p>
@param object invoke method on this object
@param methodName get method with this name
@return the value returned by the invoked method
@throws NoSuchMethodException if there is no such accessible method
@throws InvocationTargetException wraps an exception thrown by the method invoked
@throws IllegalAccessException if the requested method is not accessible | [
"<p",
">",
"Invoke",
"a",
"named",
"method",
"whose",
"parameter",
"type",
"matches",
"the",
"object",
"type",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L152-L155 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/LegacyAddress.java | LegacyAddress.fromScriptHash | public static LegacyAddress fromScriptHash(NetworkParameters params, byte[] hash160) throws AddressFormatException {
return new LegacyAddress(params, true, hash160);
} | java | public static LegacyAddress fromScriptHash(NetworkParameters params, byte[] hash160) throws AddressFormatException {
return new LegacyAddress(params, true, hash160);
} | [
"public",
"static",
"LegacyAddress",
"fromScriptHash",
"(",
"NetworkParameters",
"params",
",",
"byte",
"[",
"]",
"hash160",
")",
"throws",
"AddressFormatException",
"{",
"return",
"new",
"LegacyAddress",
"(",
"params",
",",
"true",
",",
"hash160",
")",
";",
"}"... | Construct a {@link LegacyAddress} that represents the given P2SH script hash.
@param params
network this address is valid for
@param hash160
P2SH script hash
@return constructed address | [
"Construct",
"a",
"{",
"@link",
"LegacyAddress",
"}",
"that",
"represents",
"the",
"given",
"P2SH",
"script",
"hash",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/LegacyAddress.java#L111-L113 |
alkacon/opencms-core | src/org/opencms/workplace/CmsDialog.java | CmsDialog.dialogButtonsSetOkCancel | public String dialogButtonsSetOkCancel(String setAttributes, String okAttributes, String cancelAttributes) {
return dialogButtons(
new int[] {BUTTON_SET, BUTTON_OK, BUTTON_CANCEL},
new String[] {setAttributes, okAttributes, cancelAttributes});
} | java | public String dialogButtonsSetOkCancel(String setAttributes, String okAttributes, String cancelAttributes) {
return dialogButtons(
new int[] {BUTTON_SET, BUTTON_OK, BUTTON_CANCEL},
new String[] {setAttributes, okAttributes, cancelAttributes});
} | [
"public",
"String",
"dialogButtonsSetOkCancel",
"(",
"String",
"setAttributes",
",",
"String",
"okAttributes",
",",
"String",
"cancelAttributes",
")",
"{",
"return",
"dialogButtons",
"(",
"new",
"int",
"[",
"]",
"{",
"BUTTON_SET",
",",
"BUTTON_OK",
",",
"BUTTON_CA... | Builds a button row with a "set", an "ok", and a "cancel" button.<p>
@param setAttributes additional attributes for the "set" button
@param okAttributes additional attributes for the "ok" button
@param cancelAttributes additional attributes for the "cancel" button
@return the button row | [
"Builds",
"a",
"button",
"row",
"with",
"a",
"set",
"an",
"ok",
"and",
"a",
"cancel",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L754-L759 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/TriangularSolver_DDRM.java | TriangularSolver_DDRM.invertLower | public static void invertLower( double L[] , int m ) {
for( int i = 0; i < m; i++ ) {
double L_ii = L[ i*m + i ];
for( int j = 0; j < i; j++ ) {
double val = 0;
for( int k = j; k < i; k++ ) {
val += L[ i*m + k] * L[ k*m + j ];
}
L[ i*m + j ] = -val / L_ii;
}
L[ i*m + i ] = 1.0 / L_ii;
}
} | java | public static void invertLower( double L[] , int m ) {
for( int i = 0; i < m; i++ ) {
double L_ii = L[ i*m + i ];
for( int j = 0; j < i; j++ ) {
double val = 0;
for( int k = j; k < i; k++ ) {
val += L[ i*m + k] * L[ k*m + j ];
}
L[ i*m + j ] = -val / L_ii;
}
L[ i*m + i ] = 1.0 / L_ii;
}
} | [
"public",
"static",
"void",
"invertLower",
"(",
"double",
"L",
"[",
"]",
",",
"int",
"m",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m",
";",
"i",
"++",
")",
"{",
"double",
"L_ii",
"=",
"L",
"[",
"i",
"*",
"m",
"+",
"i",
... | <p>
Inverts a square lower triangular matrix: L = L<sup>-1</sup>
</p>
@param L
@param m | [
"<p",
">",
"Inverts",
"a",
"square",
"lower",
"triangular",
"matrix",
":",
"L",
"=",
"L<sup",
">",
"-",
"1<",
"/",
"sup",
">",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/TriangularSolver_DDRM.java#L48-L60 |
nextreports/nextreports-engine | src/ro/nextreports/engine/querybuilder/sql/dialect/DialectFactory.java | DialectFactory.addDialect | public static void addDialect(String dialectName, String dialectClass) {
MAPPERS.put(dialectName, new VersionInsensitiveMapper(dialectClass));
LOG.info("Dialect added: " + dialectName + " = " + dialectClass);
} | java | public static void addDialect(String dialectName, String dialectClass) {
MAPPERS.put(dialectName, new VersionInsensitiveMapper(dialectClass));
LOG.info("Dialect added: " + dialectName + " = " + dialectClass);
} | [
"public",
"static",
"void",
"addDialect",
"(",
"String",
"dialectName",
",",
"String",
"dialectClass",
")",
"{",
"MAPPERS",
".",
"put",
"(",
"dialectName",
",",
"new",
"VersionInsensitiveMapper",
"(",
"dialectClass",
")",
")",
";",
"LOG",
".",
"info",
"(",
"... | Add dialect
@param dialectName dialect name
@param dialectClass dialect class | [
"Add",
"dialect"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/querybuilder/sql/dialect/DialectFactory.java#L171-L174 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java | PathBuilder.get | @SuppressWarnings("unchecked")
public <A extends Comparable<?>> DatePath<A> get(DatePath<A> path) {
DatePath<A> newPath = getDate(toString(path), (Class<A>) path.getType());
return addMetadataOf(newPath, path);
} | java | @SuppressWarnings("unchecked")
public <A extends Comparable<?>> DatePath<A> get(DatePath<A> path) {
DatePath<A> newPath = getDate(toString(path), (Class<A>) path.getType());
return addMetadataOf(newPath, path);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"A",
"extends",
"Comparable",
"<",
"?",
">",
">",
"DatePath",
"<",
"A",
">",
"get",
"(",
"DatePath",
"<",
"A",
">",
"path",
")",
"{",
"DatePath",
"<",
"A",
">",
"newPath",
"=",
"getDa... | Create a new Date path
@param <A>
@param path existing path
@return property path | [
"Create",
"a",
"new",
"Date",
"path"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java#L260-L264 |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/ThingGroupDocument.java | ThingGroupDocument.withAttributes | public ThingGroupDocument withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public ThingGroupDocument withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"ThingGroupDocument",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The thing group attributes.
</p>
@param attributes
The thing group attributes.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"thing",
"group",
"attributes",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/ThingGroupDocument.java#L214-L217 |
adessoAG/wicked-charts | highcharts-wrapper/src/main/java/de/adesso/wickedcharts/highcharts/options/util/OptionsUtil.java | OptionsUtil.copyRenderTo | public void copyRenderTo(final Options from, final Options to) {
if (to.getChartOptions() == null) {
to.setChartOptions(new ChartOptions());
}
to.getChartOptions().setRenderTo(from.getChartOptions().getRenderTo());
} | java | public void copyRenderTo(final Options from, final Options to) {
if (to.getChartOptions() == null) {
to.setChartOptions(new ChartOptions());
}
to.getChartOptions().setRenderTo(from.getChartOptions().getRenderTo());
} | [
"public",
"void",
"copyRenderTo",
"(",
"final",
"Options",
"from",
",",
"final",
"Options",
"to",
")",
"{",
"if",
"(",
"to",
".",
"getChartOptions",
"(",
")",
"==",
"null",
")",
"{",
"to",
".",
"setChartOptions",
"(",
"new",
"ChartOptions",
"(",
")",
"... | Copies the renderTo configuration from one {@link Options} object to
another. Null-safe.
@param from Object to copy from
@param to Object to copy to | [
"Copies",
"the",
"renderTo",
"configuration",
"from",
"one",
"{",
"@link",
"Options",
"}",
"object",
"to",
"another",
".",
"Null",
"-",
"safe",
"."
] | train | https://github.com/adessoAG/wicked-charts/blob/498aceff025f612e22ba5135b26531afeabac03c/highcharts-wrapper/src/main/java/de/adesso/wickedcharts/highcharts/options/util/OptionsUtil.java#L43-L48 |
windup/windup | rules-java/api/src/main/java/org/jboss/windup/rules/apps/mavenize/PackagesToContainingMavenArtifactsIndex.java | PackagesToContainingMavenArtifactsIndex.moduleContainsPackagesFromAPI | public boolean moduleContainsPackagesFromAPI(ProjectModel projectModel, MavenCoord apiCoords)
{
ArchiveCoordinateModel archive = new ArchiveCoordinateService(graphContext, ArchiveCoordinateModel.class).findSingle(apiCoords.getGroupId(), apiCoords.getArtifactId(), null);
if (archive == null)
return false;
//return graphContext.testIncidence(projectModel.asVertex(), archive.asVertex(), EDGE_USES);
Iterator<Vertex> projectsVerts = archive.getElement().vertices(Direction.IN, EDGE_USES);
Iterator<ProjectModel> projects = (Iterator<ProjectModel>)graphContext.getFramed().frame(projectsVerts, ProjectModel.class);
while (projects.hasNext())
{
ProjectModel project = projects.next();
if (projectModel.equals(project))
return true;
}
return false;
} | java | public boolean moduleContainsPackagesFromAPI(ProjectModel projectModel, MavenCoord apiCoords)
{
ArchiveCoordinateModel archive = new ArchiveCoordinateService(graphContext, ArchiveCoordinateModel.class).findSingle(apiCoords.getGroupId(), apiCoords.getArtifactId(), null);
if (archive == null)
return false;
//return graphContext.testIncidence(projectModel.asVertex(), archive.asVertex(), EDGE_USES);
Iterator<Vertex> projectsVerts = archive.getElement().vertices(Direction.IN, EDGE_USES);
Iterator<ProjectModel> projects = (Iterator<ProjectModel>)graphContext.getFramed().frame(projectsVerts, ProjectModel.class);
while (projects.hasNext())
{
ProjectModel project = projects.next();
if (projectModel.equals(project))
return true;
}
return false;
} | [
"public",
"boolean",
"moduleContainsPackagesFromAPI",
"(",
"ProjectModel",
"projectModel",
",",
"MavenCoord",
"apiCoords",
")",
"{",
"ArchiveCoordinateModel",
"archive",
"=",
"new",
"ArchiveCoordinateService",
"(",
"graphContext",
",",
"ArchiveCoordinateModel",
".",
"class"... | For given API artifact, finds the projects whose Java classes use artifact's classes,
and links them in the graph. | [
"For",
"given",
"API",
"artifact",
"finds",
"the",
"projects",
"whose",
"Java",
"classes",
"use",
"artifact",
"s",
"classes",
"and",
"links",
"them",
"in",
"the",
"graph",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/mavenize/PackagesToContainingMavenArtifactsIndex.java#L93-L108 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java | AnalyzeSpark.sampleFromColumnSequence | public static List<Writable> sampleFromColumnSequence(int count, String columnName, Schema schema,
JavaRDD<List<List<Writable>>> sequenceData) {
JavaRDD<List<Writable>> flattenedSequence = sequenceData.flatMap(new SequenceFlatMapFunction());
return sampleFromColumn(count, columnName, schema, flattenedSequence);
} | java | public static List<Writable> sampleFromColumnSequence(int count, String columnName, Schema schema,
JavaRDD<List<List<Writable>>> sequenceData) {
JavaRDD<List<Writable>> flattenedSequence = sequenceData.flatMap(new SequenceFlatMapFunction());
return sampleFromColumn(count, columnName, schema, flattenedSequence);
} | [
"public",
"static",
"List",
"<",
"Writable",
">",
"sampleFromColumnSequence",
"(",
"int",
"count",
",",
"String",
"columnName",
",",
"Schema",
"schema",
",",
"JavaRDD",
"<",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
">",
"sequenceData",
")",
"{",
"Ja... | Randomly sample values from a single column, in all sequences.
Values may be taken from any sequence (i.e., sequence order is not preserved)
@param count Number of values to sample
@param columnName Name of the column to sample from
@param schema Schema
@param sequenceData Data to sample from
@return A list of random samples | [
"Randomly",
"sample",
"values",
"from",
"a",
"single",
"column",
"in",
"all",
"sequences",
".",
"Values",
"may",
"be",
"taken",
"from",
"any",
"sequence",
"(",
"i",
".",
"e",
".",
"sequence",
"order",
"is",
"not",
"preserved",
")"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java#L182-L186 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/reflection/Reflection.java | Reflection.isAnnotationPresent | public static boolean isAnnotationPresent(final Method method, final Class<? extends Annotation> annotationType) {
return method != null && method.isAnnotationPresent(annotationType);
} | java | public static boolean isAnnotationPresent(final Method method, final Class<? extends Annotation> annotationType) {
return method != null && method.isAnnotationPresent(annotationType);
} | [
"public",
"static",
"boolean",
"isAnnotationPresent",
"(",
"final",
"Method",
"method",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"return",
"method",
"!=",
"null",
"&&",
"method",
".",
"isAnnotationPresent",
"(",
... | Utility method kept for backwards compatibility. Annotation checking used to be problematic on GWT.
@param method might contain the specified annotation. Can be null.
@param annotationType class of the annotation that the method is checked against.
@return true if method is annotated with the specified annotation. | [
"Utility",
"method",
"kept",
"for",
"backwards",
"compatibility",
".",
"Annotation",
"checking",
"used",
"to",
"be",
"problematic",
"on",
"GWT",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/reflection/Reflection.java#L118-L120 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/autodiff/Tensor.java | Tensor.unravelIndex | public static int[] unravelIndex(int configIx, int... dims) {
int numConfigs = IntArrays.prod(dims);
assert configIx < numConfigs;
int[] strides = getStrides(dims);
return unravelIndexFromStrides(configIx, strides);
} | java | public static int[] unravelIndex(int configIx, int... dims) {
int numConfigs = IntArrays.prod(dims);
assert configIx < numConfigs;
int[] strides = getStrides(dims);
return unravelIndexFromStrides(configIx, strides);
} | [
"public",
"static",
"int",
"[",
"]",
"unravelIndex",
"(",
"int",
"configIx",
",",
"int",
"...",
"dims",
")",
"{",
"int",
"numConfigs",
"=",
"IntArrays",
".",
"prod",
"(",
"dims",
")",
";",
"assert",
"configIx",
"<",
"numConfigs",
";",
"int",
"[",
"]",
... | Returns an integer array of the same length as dims that matches the configIx'th configuration
if enumerated configurations in order such that the leftmost dimension changes slowest | [
"Returns",
"an",
"integer",
"array",
"of",
"the",
"same",
"length",
"as",
"dims",
"that",
"matches",
"the",
"configIx",
"th",
"configuration",
"if",
"enumerated",
"configurations",
"in",
"order",
"such",
"that",
"the",
"leftmost",
"dimension",
"changes",
"slowes... | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/autodiff/Tensor.java#L54-L59 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java | CPFriendlyURLEntryPersistenceImpl.removeByC_C | @Override
public void removeByC_C(long classNameId, long classPK) {
for (CPFriendlyURLEntry cpFriendlyURLEntry : findByC_C(classNameId,
classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpFriendlyURLEntry);
}
} | java | @Override
public void removeByC_C(long classNameId, long classPK) {
for (CPFriendlyURLEntry cpFriendlyURLEntry : findByC_C(classNameId,
classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpFriendlyURLEntry);
}
} | [
"@",
"Override",
"public",
"void",
"removeByC_C",
"(",
"long",
"classNameId",
",",
"long",
"classPK",
")",
"{",
"for",
"(",
"CPFriendlyURLEntry",
"cpFriendlyURLEntry",
":",
"findByC_C",
"(",
"classNameId",
",",
"classPK",
",",
"QueryUtil",
".",
"ALL_POS",
",",
... | Removes all the cp friendly url entries where classNameId = ? and classPK = ? from the database.
@param classNameId the class name ID
@param classPK the class pk | [
"Removes",
"all",
"the",
"cp",
"friendly",
"url",
"entries",
"where",
"classNameId",
"=",
"?",
";",
"and",
"classPK",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L1975-L1981 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbSearch.java | TmdbSearch.searchMovie | public ResultList<MovieInfo> searchMovie(String query,
Integer page,
String language,
Boolean includeAdult,
Integer searchYear,
Integer primaryReleaseYear,
SearchType searchType) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.QUERY, query);
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.ADULT, includeAdult);
parameters.add(Param.YEAR, searchYear);
parameters.add(Param.PRIMARY_RELEASE_YEAR, primaryReleaseYear);
if (searchType != null) {
parameters.add(Param.SEARCH_TYPE, searchType.getPropertyString());
}
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.MOVIE).buildUrl(parameters);
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "movie");
return wrapper.getResultsList();
} | java | public ResultList<MovieInfo> searchMovie(String query,
Integer page,
String language,
Boolean includeAdult,
Integer searchYear,
Integer primaryReleaseYear,
SearchType searchType) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.QUERY, query);
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.ADULT, includeAdult);
parameters.add(Param.YEAR, searchYear);
parameters.add(Param.PRIMARY_RELEASE_YEAR, primaryReleaseYear);
if (searchType != null) {
parameters.add(Param.SEARCH_TYPE, searchType.getPropertyString());
}
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.MOVIE).buildUrl(parameters);
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "movie");
return wrapper.getResultsList();
} | [
"public",
"ResultList",
"<",
"MovieInfo",
">",
"searchMovie",
"(",
"String",
"query",
",",
"Integer",
"page",
",",
"String",
"language",
",",
"Boolean",
"includeAdult",
",",
"Integer",
"searchYear",
",",
"Integer",
"primaryReleaseYear",
",",
"SearchType",
"searchT... | Search Movies This is a good starting point to start finding movies on TMDb.
@param query
@param searchYear Limit the search to the provided year. Zero (0) will get all years
@param language The language to include. Can be blank/null.
@param includeAdult true or false to include adult titles in the search
@param page The page of results to return. 0 to get the default (first page)
@param primaryReleaseYear
@param searchType
@return
@throws MovieDbException | [
"Search",
"Movies",
"This",
"is",
"a",
"good",
"starting",
"point",
"to",
"start",
"finding",
"movies",
"on",
"TMDb",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbSearch.java#L136-L157 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java | DatePicker.zSetPopupLocation | static void zSetPopupLocation(CustomPopup popup, int defaultX, int defaultY, JComponent picker,
JComponent verticalFlipReference, int verticalFlipDistance, int bottomOverlapAllowed) {
// Gather some variables that we will need.
Window topWindowOrNull = SwingUtilities.getWindowAncestor(picker);
Rectangle workingArea = InternalUtilities.getScreenWorkingArea(topWindowOrNull);
int popupWidth = popup.getBounds().width;
int popupHeight = popup.getBounds().height;
// Calculate the default rectangle for the popup.
Rectangle popupRectangle = new Rectangle(defaultX, defaultY, popupWidth, popupHeight);
// If the popup rectangle is below the bottom of the working area, then move it upwards by
// the minimum amount which will ensure that it will never cover the picker component.
if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
popupRectangle.y = verticalFlipReference.getLocationOnScreen().y - popupHeight
- verticalFlipDistance;
}
// Confine the popup to be within the working area.
if (popupRectangle.getMaxX() > (workingArea.getMaxX())) {
popupRectangle.x -= (popupRectangle.getMaxX() - workingArea.getMaxX());
}
if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
popupRectangle.y -= (popupRectangle.getMaxY() - workingArea.getMaxY());
}
if (popupRectangle.x < workingArea.x) {
popupRectangle.x += (workingArea.x - popupRectangle.x);
}
if (popupRectangle.y < workingArea.y) {
popupRectangle.y += (workingArea.y - popupRectangle.y);
}
// Set the location of the popup.
popup.setLocation(popupRectangle.x, popupRectangle.y);
} | java | static void zSetPopupLocation(CustomPopup popup, int defaultX, int defaultY, JComponent picker,
JComponent verticalFlipReference, int verticalFlipDistance, int bottomOverlapAllowed) {
// Gather some variables that we will need.
Window topWindowOrNull = SwingUtilities.getWindowAncestor(picker);
Rectangle workingArea = InternalUtilities.getScreenWorkingArea(topWindowOrNull);
int popupWidth = popup.getBounds().width;
int popupHeight = popup.getBounds().height;
// Calculate the default rectangle for the popup.
Rectangle popupRectangle = new Rectangle(defaultX, defaultY, popupWidth, popupHeight);
// If the popup rectangle is below the bottom of the working area, then move it upwards by
// the minimum amount which will ensure that it will never cover the picker component.
if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
popupRectangle.y = verticalFlipReference.getLocationOnScreen().y - popupHeight
- verticalFlipDistance;
}
// Confine the popup to be within the working area.
if (popupRectangle.getMaxX() > (workingArea.getMaxX())) {
popupRectangle.x -= (popupRectangle.getMaxX() - workingArea.getMaxX());
}
if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
popupRectangle.y -= (popupRectangle.getMaxY() - workingArea.getMaxY());
}
if (popupRectangle.x < workingArea.x) {
popupRectangle.x += (workingArea.x - popupRectangle.x);
}
if (popupRectangle.y < workingArea.y) {
popupRectangle.y += (workingArea.y - popupRectangle.y);
}
// Set the location of the popup.
popup.setLocation(popupRectangle.x, popupRectangle.y);
} | [
"static",
"void",
"zSetPopupLocation",
"(",
"CustomPopup",
"popup",
",",
"int",
"defaultX",
",",
"int",
"defaultY",
",",
"JComponent",
"picker",
",",
"JComponent",
"verticalFlipReference",
",",
"int",
"verticalFlipDistance",
",",
"int",
"bottomOverlapAllowed",
")",
... | zSetPopupLocation, This calculates and sets the appropriate location for the popup windows,
for both the DatePicker and the TimePicker. | [
"zSetPopupLocation",
"This",
"calculates",
"and",
"sets",
"the",
"appropriate",
"location",
"for",
"the",
"popup",
"windows",
"for",
"both",
"the",
"DatePicker",
"and",
"the",
"TimePicker",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java#L757-L787 |
azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/LoginAbstractAzkabanServlet.java | LoginAbstractAzkabanServlet.logRequest | private void logRequest(final HttpServletRequest req, final Session session) {
final StringBuilder buf = new StringBuilder();
buf.append(getRealClientIpAddr(req)).append(" ");
if (session != null && session.getUser() != null) {
buf.append(session.getUser().getUserId()).append(" ");
} else {
buf.append(" - ").append(" ");
}
buf.append("\"");
buf.append(req.getMethod()).append(" ");
buf.append(req.getRequestURI()).append(" ");
if (req.getQueryString() != null && !isIllegalPostRequest(req)) {
buf.append(req.getQueryString()).append(" ");
} else {
buf.append("-").append(" ");
}
buf.append(req.getProtocol()).append("\" ");
final String userAgent = req.getHeader("User-Agent");
if (this.shouldLogRawUserAgent) {
buf.append(userAgent);
} else {
// simply log a short string to indicate browser or not
if (StringUtils.isFromBrowser(userAgent)) {
buf.append("browser");
} else {
buf.append("not-browser");
}
}
logger.info(buf.toString());
} | java | private void logRequest(final HttpServletRequest req, final Session session) {
final StringBuilder buf = new StringBuilder();
buf.append(getRealClientIpAddr(req)).append(" ");
if (session != null && session.getUser() != null) {
buf.append(session.getUser().getUserId()).append(" ");
} else {
buf.append(" - ").append(" ");
}
buf.append("\"");
buf.append(req.getMethod()).append(" ");
buf.append(req.getRequestURI()).append(" ");
if (req.getQueryString() != null && !isIllegalPostRequest(req)) {
buf.append(req.getQueryString()).append(" ");
} else {
buf.append("-").append(" ");
}
buf.append(req.getProtocol()).append("\" ");
final String userAgent = req.getHeader("User-Agent");
if (this.shouldLogRawUserAgent) {
buf.append(userAgent);
} else {
// simply log a short string to indicate browser or not
if (StringUtils.isFromBrowser(userAgent)) {
buf.append("browser");
} else {
buf.append("not-browser");
}
}
logger.info(buf.toString());
} | [
"private",
"void",
"logRequest",
"(",
"final",
"HttpServletRequest",
"req",
",",
"final",
"Session",
"session",
")",
"{",
"final",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buf",
".",
"append",
"(",
"getRealClientIpAddr",
"(",
"req",... | Log out request - the format should be close to Apache access log format | [
"Log",
"out",
"request",
"-",
"the",
"format",
"should",
"be",
"close",
"to",
"Apache",
"access",
"log",
"format"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/webapp/servlet/LoginAbstractAzkabanServlet.java#L137-L169 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java | UsersInner.beginCreateOrUpdate | public UserInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, UserInner user) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, user).toBlocking().single().body();
} | java | public UserInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, UserInner user) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, user).toBlocking().single().body();
} | [
"public",
"UserInner",
"beginCreateOrUpdate",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"UserInner",
"user",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",",
"res... | Creates a new user or updates an existing user's information on a data box edge/gateway device.
@param deviceName The device name.
@param name The user name.
@param resourceGroupName The resource group name.
@param user The user details.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UserInner object if successful. | [
"Creates",
"a",
"new",
"user",
"or",
"updates",
"an",
"existing",
"user",
"s",
"information",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java#L406-L408 |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getFullString | public final String getFullString(final int pos, final int len, String charsetName) {
if (pos + len > limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + len)));
try {
return new String(buffer, origin + pos, len, charsetName);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException("Unsupported encoding: " + charsetName, e);
}
} | java | public final String getFullString(final int pos, final int len, String charsetName) {
if (pos + len > limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + len)));
try {
return new String(buffer, origin + pos, len, charsetName);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException("Unsupported encoding: " + charsetName, e);
}
} | [
"public",
"final",
"String",
"getFullString",
"(",
"final",
"int",
"pos",
",",
"final",
"int",
"len",
",",
"String",
"charsetName",
")",
"{",
"if",
"(",
"pos",
"+",
"len",
">",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentExceptio... | Return fix-length string from buffer without null-terminate checking. Fix
bug #17 {@link https://github.com/AlibabaTech/canal/issues/17 } | [
"Return",
"fix",
"-",
"length",
"string",
"from",
"buffer",
"without",
"null",
"-",
"terminate",
"checking",
".",
"Fix",
"bug",
"#17",
"{"
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L1106-L1115 |
mediathekview/MLib | src/main/java/de/mediathekview/mlib/daten/ListeFilme.java | ListeFilme.getAgeAsDate | public Date getAgeAsDate() {
String date;
if (!metaDaten[ListeFilme.FILMLISTE_DATUM_GMT_NR].isEmpty()) {
date = metaDaten[ListeFilme.FILMLISTE_DATUM_GMT_NR];
sdf.setTimeZone(new SimpleTimeZone(SimpleTimeZone.UTC_TIME, "UTC"));
} else {
date = metaDaten[ListeFilme.FILMLISTE_DATUM_NR];
}
Date filmDate = null;
try {
filmDate = sdf.parse(date);
} catch (ParseException ignored) {
}
return filmDate;
} | java | public Date getAgeAsDate() {
String date;
if (!metaDaten[ListeFilme.FILMLISTE_DATUM_GMT_NR].isEmpty()) {
date = metaDaten[ListeFilme.FILMLISTE_DATUM_GMT_NR];
sdf.setTimeZone(new SimpleTimeZone(SimpleTimeZone.UTC_TIME, "UTC"));
} else {
date = metaDaten[ListeFilme.FILMLISTE_DATUM_NR];
}
Date filmDate = null;
try {
filmDate = sdf.parse(date);
} catch (ParseException ignored) {
}
return filmDate;
} | [
"public",
"Date",
"getAgeAsDate",
"(",
")",
"{",
"String",
"date",
";",
"if",
"(",
"!",
"metaDaten",
"[",
"ListeFilme",
".",
"FILMLISTE_DATUM_GMT_NR",
"]",
".",
"isEmpty",
"(",
")",
")",
"{",
"date",
"=",
"metaDaten",
"[",
"ListeFilme",
".",
"FILMLISTE_DAT... | Get the age of the film list.
@return Age as a {@link java.util.Date} object. | [
"Get",
"the",
"age",
"of",
"the",
"film",
"list",
"."
] | train | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/daten/ListeFilme.java#L369-L384 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java | OrdersInner.beginCreateOrUpdateAsync | public Observable<OrderInner> beginCreateOrUpdateAsync(String deviceName, String resourceGroupName, OrderInner order) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, order).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | java | public Observable<OrderInner> beginCreateOrUpdateAsync(String deviceName, String resourceGroupName, OrderInner order) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, order).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OrderInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"OrderInner",
"order",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGro... | Creates or updates an order.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param order The order to be created or updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OrderInner object | [
"Creates",
"or",
"updates",
"an",
"order",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java#L419-L426 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskId.java | DiskId.of | public static DiskId of(String zone, String disk) {
return new DiskId(null, zone, disk);
} | java | public static DiskId of(String zone, String disk) {
return new DiskId(null, zone, disk);
} | [
"public",
"static",
"DiskId",
"of",
"(",
"String",
"zone",
",",
"String",
"disk",
")",
"{",
"return",
"new",
"DiskId",
"(",
"null",
",",
"zone",
",",
"disk",
")",
";",
"}"
] | Returns a disk identity given the zone and disk names. The disk name must be 1-63 characters
long and comply with RFC1035. Specifically, the name must match the regular expression {@code
[a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter, and all
following characters must be a dash, lowercase letter, or digit, except the last character,
which cannot be a dash.
@see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a> | [
"Returns",
"a",
"disk",
"identity",
"given",
"the",
"zone",
"and",
"disk",
"names",
".",
"The",
"disk",
"name",
"must",
"be",
"1",
"-",
"63",
"characters",
"long",
"and",
"comply",
"with",
"RFC1035",
".",
"Specifically",
"the",
"name",
"must",
"match",
"... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskId.java#L123-L125 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphGetRootNodes | public static int cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode rootNodes[], long numRootNodes[])
{
return checkResult(cuGraphGetRootNodesNative(hGraph, rootNodes, numRootNodes));
} | java | public static int cuGraphGetRootNodes(CUgraph hGraph, CUgraphNode rootNodes[], long numRootNodes[])
{
return checkResult(cuGraphGetRootNodesNative(hGraph, rootNodes, numRootNodes));
} | [
"public",
"static",
"int",
"cuGraphGetRootNodes",
"(",
"CUgraph",
"hGraph",
",",
"CUgraphNode",
"rootNodes",
"[",
"]",
",",
"long",
"numRootNodes",
"[",
"]",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphGetRootNodesNative",
"(",
"hGraph",
",",
"rootNodes",
",... | Returns a graph's root nodes.<br>
<br>
Returns a list of \p hGraph's root nodes. \p rootNodes may be NULL, in which case this
function will return the number of root nodes in \p numRootNodes. Otherwise,
\p numRootNodes entries will be filled in. If \p numRootNodes is higher than the actual
number of root nodes, the remaining entries in \p rootNodes will be set to NULL, and the
number of nodes actually obtained will be returned in \p numRootNodes.
@param hGraph - Graph to query
@param rootNodes - Pointer to return the root nodes
@param numRootNodes - See description
@return
CUDA_SUCCESS,
CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_VALUE
@see
JCudaDriver#cuGraphCreate
JCudaDriver#cuGraphGetNodes
JCudaDriver#cuGraphGetEdges
JCudaDriver#cuGraphNodeGetType
JCudaDriver#cuGraphNodeGetDependencies
JCudaDriver#cuGraphNodeGetDependentNodes | [
"Returns",
"a",
"graph",
"s",
"root",
"nodes",
".",
"<br",
">",
"<br",
">",
"Returns",
"a",
"list",
"of",
"\\",
"p",
"hGraph",
"s",
"root",
"nodes",
".",
"\\",
"p",
"rootNodes",
"may",
"be",
"NULL",
"in",
"which",
"case",
"this",
"function",
"will",
... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12710-L12713 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java | JaiDebug.dumpTexCoords | public static void dumpTexCoords(AiMesh mesh, int coords) {
if (!mesh.hasTexCoords(coords)) {
System.out.println("mesh has no texture coordinate set " + coords);
return;
}
for (int i = 0; i < mesh.getNumVertices(); i++) {
int numComponents = mesh.getNumUVComponents(coords);
System.out.print("[" + mesh.getTexCoordU(i, coords));
if (numComponents > 1) {
System.out.print(", " + mesh.getTexCoordV(i, coords));
}
if (numComponents > 2) {
System.out.print(", " + mesh.getTexCoordW(i, coords));
}
System.out.println("]");
}
} | java | public static void dumpTexCoords(AiMesh mesh, int coords) {
if (!mesh.hasTexCoords(coords)) {
System.out.println("mesh has no texture coordinate set " + coords);
return;
}
for (int i = 0; i < mesh.getNumVertices(); i++) {
int numComponents = mesh.getNumUVComponents(coords);
System.out.print("[" + mesh.getTexCoordU(i, coords));
if (numComponents > 1) {
System.out.print(", " + mesh.getTexCoordV(i, coords));
}
if (numComponents > 2) {
System.out.print(", " + mesh.getTexCoordW(i, coords));
}
System.out.println("]");
}
} | [
"public",
"static",
"void",
"dumpTexCoords",
"(",
"AiMesh",
"mesh",
",",
"int",
"coords",
")",
"{",
"if",
"(",
"!",
"mesh",
".",
"hasTexCoords",
"(",
"coords",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"mesh has no texture coordinate set \"... | Dumps a texture coordinate set of a mesh to stdout.
@param mesh the mesh
@param coords the coordinates | [
"Dumps",
"a",
"texture",
"coordinate",
"set",
"of",
"a",
"mesh",
"to",
"stdout",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java#L139-L159 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/TileBoundingBoxMapUtils.java | TileBoundingBoxMapUtils.getLatitudeDistance | public static double getLatitudeDistance(double minLatitude,
double maxLatitude) {
LatLng lowerMiddle = new LatLng(minLatitude, 0);
LatLng upperMiddle = new LatLng(maxLatitude, 0);
double latDistance = SphericalUtil.computeDistanceBetween(lowerMiddle,
upperMiddle);
return latDistance;
} | java | public static double getLatitudeDistance(double minLatitude,
double maxLatitude) {
LatLng lowerMiddle = new LatLng(minLatitude, 0);
LatLng upperMiddle = new LatLng(maxLatitude, 0);
double latDistance = SphericalUtil.computeDistanceBetween(lowerMiddle,
upperMiddle);
return latDistance;
} | [
"public",
"static",
"double",
"getLatitudeDistance",
"(",
"double",
"minLatitude",
",",
"double",
"maxLatitude",
")",
"{",
"LatLng",
"lowerMiddle",
"=",
"new",
"LatLng",
"(",
"minLatitude",
",",
"0",
")",
";",
"LatLng",
"upperMiddle",
"=",
"new",
"LatLng",
"("... | Get the latitude distance
@param minLatitude min latitude
@param maxLatitude max latitude
@return distance | [
"Get",
"the",
"latitude",
"distance"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/TileBoundingBoxMapUtils.java#L86-L93 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java | ModuleSummaryBuilder.buildModuleTags | public void buildModuleTags(XMLNode node, Content moduleContentTree) {
if (!configuration.nocomment) {
moduleWriter.addModuleTags(moduleContentTree);
}
} | java | public void buildModuleTags(XMLNode node, Content moduleContentTree) {
if (!configuration.nocomment) {
moduleWriter.addModuleTags(moduleContentTree);
}
} | [
"public",
"void",
"buildModuleTags",
"(",
"XMLNode",
"node",
",",
"Content",
"moduleContentTree",
")",
"{",
"if",
"(",
"!",
"configuration",
".",
"nocomment",
")",
"{",
"moduleWriter",
".",
"addModuleTags",
"(",
"moduleContentTree",
")",
";",
"}",
"}"
] | Build the tags of the summary.
@param node the XML element that specifies which components to document
@param moduleContentTree the tree to which the module tags will be added | [
"Build",
"the",
"tags",
"of",
"the",
"summary",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java#L219-L223 |
aws/aws-sdk-java | aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/DocumentVersionMetadata.java | DocumentVersionMetadata.withSource | public DocumentVersionMetadata withSource(java.util.Map<String, String> source) {
setSource(source);
return this;
} | java | public DocumentVersionMetadata withSource(java.util.Map<String, String> source) {
setSource(source);
return this;
} | [
"public",
"DocumentVersionMetadata",
"withSource",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"source",
")",
"{",
"setSource",
"(",
"source",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The source of the document.
</p>
@param source
The source of the document.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"source",
"of",
"the",
"document",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/DocumentVersionMetadata.java#L679-L682 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setDateHeader | @Deprecated
public static void setDateHeader(HttpMessage message, String name, Date value) {
setDateHeader(message, (CharSequence) name, value);
} | java | @Deprecated
public static void setDateHeader(HttpMessage message, String name, Date value) {
setDateHeader(message, (CharSequence) name, value);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setDateHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"Date",
"value",
")",
"{",
"setDateHeader",
"(",
"message",
",",
"(",
"CharSequence",
")",
"name",
",",
"value",
")",
";",
"}"
] | @deprecated Use {@link #set(CharSequence, Object)} instead.
@see #setDateHeader(HttpMessage, CharSequence, Date) | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Object",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L887-L890 |
jenkinsci/jenkins | core/src/main/java/hudson/tasks/UserAvatarResolver.java | UserAvatarResolver.resolveOrNull | public static @CheckForNull String resolveOrNull(User u, String avatarSize) {
Matcher matcher = iconSizeRegex.matcher(avatarSize);
if (matcher.matches() && matcher.groupCount() == 2) {
int width = Integer.parseInt(matcher.group(1));
int height = Integer.parseInt(matcher.group(2));
for (UserAvatarResolver r : all()) {
String name = r.findAvatarFor(u, width, height);
if(name!=null) return name;
}
} else {
LOGGER.warning(String.format("Could not split up the avatar size (%s) into a width and height.", avatarSize));
}
return null;
} | java | public static @CheckForNull String resolveOrNull(User u, String avatarSize) {
Matcher matcher = iconSizeRegex.matcher(avatarSize);
if (matcher.matches() && matcher.groupCount() == 2) {
int width = Integer.parseInt(matcher.group(1));
int height = Integer.parseInt(matcher.group(2));
for (UserAvatarResolver r : all()) {
String name = r.findAvatarFor(u, width, height);
if(name!=null) return name;
}
} else {
LOGGER.warning(String.format("Could not split up the avatar size (%s) into a width and height.", avatarSize));
}
return null;
} | [
"public",
"static",
"@",
"CheckForNull",
"String",
"resolveOrNull",
"(",
"User",
"u",
",",
"String",
"avatarSize",
")",
"{",
"Matcher",
"matcher",
"=",
"iconSizeRegex",
".",
"matcher",
"(",
"avatarSize",
")",
";",
"if",
"(",
"matcher",
".",
"matches",
"(",
... | Like {@link #resolve} but returns null rather than a fallback URL in case there is no special avatar.
@since 1.518 | [
"Like",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tasks/UserAvatarResolver.java#L97-L111 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java | SqlFunctionUtils.lpad | public static String lpad(String base, int len, String pad) {
if (len < 0 || "".equals(pad)) {
return null;
} else if (len == 0) {
return "";
}
char[] data = new char[len];
char[] baseChars = base.toCharArray();
char[] padChars = pad.toCharArray();
// the length of the padding needed
int pos = Math.max(len - base.length(), 0);
// copy the padding
for (int i = 0; i < pos; i += pad.length()) {
for (int j = 0; j < pad.length() && j < pos - i; j++) {
data[i + j] = padChars[j];
}
}
// copy the base
int i = 0;
while (pos + i < len && i < base.length()) {
data[pos + i] = baseChars[i];
i += 1;
}
return new String(data);
} | java | public static String lpad(String base, int len, String pad) {
if (len < 0 || "".equals(pad)) {
return null;
} else if (len == 0) {
return "";
}
char[] data = new char[len];
char[] baseChars = base.toCharArray();
char[] padChars = pad.toCharArray();
// the length of the padding needed
int pos = Math.max(len - base.length(), 0);
// copy the padding
for (int i = 0; i < pos; i += pad.length()) {
for (int j = 0; j < pad.length() && j < pos - i; j++) {
data[i + j] = padChars[j];
}
}
// copy the base
int i = 0;
while (pos + i < len && i < base.length()) {
data[pos + i] = baseChars[i];
i += 1;
}
return new String(data);
} | [
"public",
"static",
"String",
"lpad",
"(",
"String",
"base",
",",
"int",
"len",
",",
"String",
"pad",
")",
"{",
"if",
"(",
"len",
"<",
"0",
"||",
"\"\"",
".",
"equals",
"(",
"pad",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"... | Returns the string str left-padded with the string pad to a length of len characters.
If str is longer than len, the return value is shortened to len characters. | [
"Returns",
"the",
"string",
"str",
"left",
"-",
"padded",
"with",
"the",
"string",
"pad",
"to",
"a",
"length",
"of",
"len",
"characters",
".",
"If",
"str",
"is",
"longer",
"than",
"len",
"the",
"return",
"value",
"is",
"shortened",
"to",
"len",
"characte... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java#L221-L250 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java | BoxApiMetadata.getAddFileMetadataRequest | public BoxRequestsMetadata.AddFileMetadata getAddFileMetadataRequest(String id, LinkedHashMap<String, Object> values, String scope, String template) {
BoxRequestsMetadata.AddFileMetadata request = new BoxRequestsMetadata.AddFileMetadata(values, getFileMetadataUrl(id, scope, template), mSession);
return request;
} | java | public BoxRequestsMetadata.AddFileMetadata getAddFileMetadataRequest(String id, LinkedHashMap<String, Object> values, String scope, String template) {
BoxRequestsMetadata.AddFileMetadata request = new BoxRequestsMetadata.AddFileMetadata(values, getFileMetadataUrl(id, scope, template), mSession);
return request;
} | [
"public",
"BoxRequestsMetadata",
".",
"AddFileMetadata",
"getAddFileMetadataRequest",
"(",
"String",
"id",
",",
"LinkedHashMap",
"<",
"String",
",",
"Object",
">",
"values",
",",
"String",
"scope",
",",
"String",
"template",
")",
"{",
"BoxRequestsMetadata",
".",
"... | Gets a request that adds metadata to a file
@param id id of the file to add metadata to
@param values mapping of the template keys to their values
@param scope currently only global and enterprise scopes are supported
@param template metadata template to use
@return request to add metadata to a file | [
"Gets",
"a",
"request",
"that",
"adds",
"metadata",
"to",
"a",
"file"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java#L115-L118 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.lastIndexOf | public static int lastIndexOf(final CharSequence seq, final int searchChar) {
if (isEmpty(seq)) {
return INDEX_NOT_FOUND;
}
return CharSequenceUtils.lastIndexOf(seq, searchChar, seq.length());
} | java | public static int lastIndexOf(final CharSequence seq, final int searchChar) {
if (isEmpty(seq)) {
return INDEX_NOT_FOUND;
}
return CharSequenceUtils.lastIndexOf(seq, searchChar, seq.length());
} | [
"public",
"static",
"int",
"lastIndexOf",
"(",
"final",
"CharSequence",
"seq",
",",
"final",
"int",
"searchChar",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"seq",
")",
")",
"{",
"return",
"INDEX_NOT_FOUND",
";",
"}",
"return",
"CharSequenceUtils",
".",
"lastIndex... | Returns the index within <code>seq</code> of the last occurrence of
the specified character. For values of <code>searchChar</code> in the
range from 0 to 0xFFFF (inclusive), the index (in Unicode code
units) returned is the largest value <i>k</i> such that:
<blockquote><pre>
this.charAt(<i>k</i>) == searchChar
</pre></blockquote>
is true. For other values of <code>searchChar</code>, it is the
largest value <i>k</i> such that:
<blockquote><pre>
this.codePointAt(<i>k</i>) == searchChar
</pre></blockquote>
is true. In either case, if no such character occurs in this
string, then <code>-1</code> is returned. Furthermore, a {@code null} or empty ("")
<code>CharSequence</code> will return {@code -1}. The
<code>seq</code> <code>CharSequence</code> object is searched backwards
starting at the last character.
<pre>
StringUtils.lastIndexOf(null, *) = -1
StringUtils.lastIndexOf("", *) = -1
StringUtils.lastIndexOf("aabaabaa", 'a') = 7
StringUtils.lastIndexOf("aabaabaa", 'b') = 5
</pre>
@param seq the <code>CharSequence</code> to check, may be null
@param searchChar the character to find
@return the last index of the search character,
-1 if no match or {@code null} string input
@since 2.0
@since 3.0 Changed signature from lastIndexOf(String, int) to lastIndexOf(CharSequence, int)
@since 3.6 Updated {@link CharSequenceUtils} call to behave more like <code>String</code> | [
"Returns",
"the",
"index",
"within",
"<code",
">",
"seq<",
"/",
"code",
">",
"of",
"the",
"last",
"occurrence",
"of",
"the",
"specified",
"character",
".",
"For",
"values",
"of",
"<code",
">",
"searchChar<",
"/",
"code",
">",
"in",
"the",
"range",
"from"... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L1675-L1680 |
Netflix/conductor | redis-persistence/src/main/java/com/netflix/conductor/jedis/JedisMock.java | JedisMock.zcount | @Override public Long zcount(final String key, final double min, final double max) {
try {
return redis.zcount(key, min, max);
}
catch (Exception e) {
throw new JedisException(e);
}
} | java | @Override public Long zcount(final String key, final double min, final double max) {
try {
return redis.zcount(key, min, max);
}
catch (Exception e) {
throw new JedisException(e);
}
} | [
"@",
"Override",
"public",
"Long",
"zcount",
"(",
"final",
"String",
"key",
",",
"final",
"double",
"min",
",",
"final",
"double",
"max",
")",
"{",
"try",
"{",
"return",
"redis",
".",
"zcount",
"(",
"key",
",",
"min",
",",
"max",
")",
";",
"}",
"ca... | /*
public List<String> sort(final String key) {
checkIsInMulti();
client.sort(key);
return client.getMultiBulkReply();
}
public List<String> sort(final String key, final SortingParams sortingParameters) {
checkIsInMulti();
client.sort(key, sortingParameters);
return client.getMultiBulkReply();
}
public List<String> blpop(final int timeout, final String... keys) {
return blpop(getArgsAddTimeout(timeout, keys));
}
private String[] getArgsAddTimeout(int timeout, String[] keys) {
final int keyCount = keys.length;
final String[] args = new String[keyCount + 1];
for (int at = 0; at != keyCount; ++at) {
args[at] = keys[at];
}
args[keyCount] = String.valueOf(timeout);
return args;
}
public List<String> blpop(String... args) {
checkIsInMulti();
client.blpop(args);
client.setTimeoutInfinite();
try {
return client.getMultiBulkReply();
} finally {
client.rollbackTimeout();
}
}
public List<String> brpop(String... args) {
checkIsInMulti();
client.brpop(args);
client.setTimeoutInfinite();
try {
return client.getMultiBulkReply();
} finally {
client.rollbackTimeout();
}
}
@Deprecated
public List<String> blpop(String arg) {
return blpop(new String[] { arg });
}
public List<String> brpop(String arg) {
return brpop(new String[] { arg });
}
public Long sort(final String key, final SortingParams sortingParameters, final String dstkey) {
checkIsInMulti();
client.sort(key, sortingParameters, dstkey);
return client.getIntegerReply();
}
public Long sort(final String key, final String dstkey) {
checkIsInMulti();
client.sort(key, dstkey);
return client.getIntegerReply();
}
public List<String> brpop(final int timeout, final String... keys) {
return brpop(getArgsAddTimeout(timeout, keys));
} | [
"/",
"*",
"public",
"List<String",
">",
"sort",
"(",
"final",
"String",
"key",
")",
"{",
"checkIsInMulti",
"()",
";",
"client",
".",
"sort",
"(",
"key",
")",
";",
"return",
"client",
".",
"getMultiBulkReply",
"()",
";",
"}"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/redis-persistence/src/main/java/com/netflix/conductor/jedis/JedisMock.java#L964-L971 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java | ClassesManager.areMappedObjects | public static boolean areMappedObjects(Class<?> dClass,Class<?> sClass,XML xml){
return isMapped(dClass,xml) || isMapped(sClass,xml);
} | java | public static boolean areMappedObjects(Class<?> dClass,Class<?> sClass,XML xml){
return isMapped(dClass,xml) || isMapped(sClass,xml);
} | [
"public",
"static",
"boolean",
"areMappedObjects",
"(",
"Class",
"<",
"?",
">",
"dClass",
",",
"Class",
"<",
"?",
">",
"sClass",
",",
"XML",
"xml",
")",
"{",
"return",
"isMapped",
"(",
"dClass",
",",
"xml",
")",
"||",
"isMapped",
"(",
"sClass",
",",
... | returns true if almost one class is configured, false otherwise.
@param dClass class to verify
@param sClass class to verify
@param xml xml to check
@return true if almost one class is configured, false otherwise. | [
"returns",
"true",
"if",
"almost",
"one",
"class",
"is",
"configured",
"false",
"otherwise",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L428-L430 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java | ZoneRules.getTransitions | public List<ZoneOffsetTransition> getTransitions() {
List<ZoneOffsetTransition> list = new ArrayList<>();
for (int i = 0; i < savingsInstantTransitions.length; i++) {
list.add(new ZoneOffsetTransition(savingsInstantTransitions[i], wallOffsets[i], wallOffsets[i + 1]));
}
return Collections.unmodifiableList(list);
} | java | public List<ZoneOffsetTransition> getTransitions() {
List<ZoneOffsetTransition> list = new ArrayList<>();
for (int i = 0; i < savingsInstantTransitions.length; i++) {
list.add(new ZoneOffsetTransition(savingsInstantTransitions[i], wallOffsets[i], wallOffsets[i + 1]));
}
return Collections.unmodifiableList(list);
} | [
"public",
"List",
"<",
"ZoneOffsetTransition",
">",
"getTransitions",
"(",
")",
"{",
"List",
"<",
"ZoneOffsetTransition",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"savingsInstantTransitions... | Gets the complete list of fully defined transitions.
<p>
The complete set of transitions for this rules instance is defined by this method
and {@link #getTransitionRules()}. This method returns those transitions that have
been fully defined. These are typically historical, but may be in the future.
<p>
The list will be empty for fixed offset rules and for any time-zone where there has
only ever been a single offset. The list will also be empty if the transition rules are unknown.
@return an immutable list of fully defined transitions, not null | [
"Gets",
"the",
"complete",
"list",
"of",
"fully",
"defined",
"transitions",
".",
"<p",
">",
"The",
"complete",
"set",
"of",
"transitions",
"for",
"this",
"rules",
"instance",
"is",
"defined",
"by",
"this",
"method",
"and",
"{",
"@link",
"#getTransitionRules",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java#L943-L949 |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisProducer.java | FlinkKinesisProducer.checkAndPropagateAsyncError | private void checkAndPropagateAsyncError() throws Exception {
if (thrownException != null) {
String errorMessages = "";
if (thrownException instanceof UserRecordFailedException) {
List<Attempt> attempts = ((UserRecordFailedException) thrownException).getResult().getAttempts();
for (Attempt attempt: attempts) {
if (attempt.getErrorMessage() != null) {
errorMessages += attempt.getErrorMessage() + "\n";
}
}
}
if (failOnError) {
throw new RuntimeException("An exception was thrown while processing a record: " + errorMessages, thrownException);
} else {
LOG.warn("An exception was thrown while processing a record: {}", thrownException, errorMessages);
// reset, prevent double throwing
thrownException = null;
}
}
} | java | private void checkAndPropagateAsyncError() throws Exception {
if (thrownException != null) {
String errorMessages = "";
if (thrownException instanceof UserRecordFailedException) {
List<Attempt> attempts = ((UserRecordFailedException) thrownException).getResult().getAttempts();
for (Attempt attempt: attempts) {
if (attempt.getErrorMessage() != null) {
errorMessages += attempt.getErrorMessage() + "\n";
}
}
}
if (failOnError) {
throw new RuntimeException("An exception was thrown while processing a record: " + errorMessages, thrownException);
} else {
LOG.warn("An exception was thrown while processing a record: {}", thrownException, errorMessages);
// reset, prevent double throwing
thrownException = null;
}
}
} | [
"private",
"void",
"checkAndPropagateAsyncError",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"thrownException",
"!=",
"null",
")",
"{",
"String",
"errorMessages",
"=",
"\"\"",
";",
"if",
"(",
"thrownException",
"instanceof",
"UserRecordFailedException",
")",
... | Check if there are any asynchronous exceptions. If so, rethrow the exception. | [
"Check",
"if",
"there",
"are",
"any",
"asynchronous",
"exceptions",
".",
"If",
"so",
"rethrow",
"the",
"exception",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisProducer.java#L350-L370 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/Matrix.java | Matrix.mutableSubtract | public void mutableSubtract(double c, Matrix B, ExecutorService threadPool)
{
mutableAdd(-c, B, threadPool);
} | java | public void mutableSubtract(double c, Matrix B, ExecutorService threadPool)
{
mutableAdd(-c, B, threadPool);
} | [
"public",
"void",
"mutableSubtract",
"(",
"double",
"c",
",",
"Matrix",
"B",
",",
"ExecutorService",
"threadPool",
")",
"{",
"mutableAdd",
"(",
"-",
"c",
",",
"B",
",",
"threadPool",
")",
";",
"}"
] | Alters the current matrix to store <i>A-c*B</i>
@param c the scalar constant to multiply <i>B</i> by
@param B the matrix to subtract from <i>this</i>.
@param threadPool the source of threads to do computation in parallel | [
"Alters",
"the",
"current",
"matrix",
"to",
"store",
"<i",
">",
"A",
"-",
"c",
"*",
"B<",
"/",
"i",
">"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L247-L250 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/attribute/IntegerAttribute.java | IntegerAttribute.asSet | public MutableIntSet asSet(List<T> list, MutableIntSet setToAppend)
{
asSet(list, this, setToAppend);
return setToAppend;
} | java | public MutableIntSet asSet(List<T> list, MutableIntSet setToAppend)
{
asSet(list, this, setToAppend);
return setToAppend;
} | [
"public",
"MutableIntSet",
"asSet",
"(",
"List",
"<",
"T",
">",
"list",
",",
"MutableIntSet",
"setToAppend",
")",
"{",
"asSet",
"(",
"list",
",",
"this",
",",
"setToAppend",
")",
";",
"return",
"setToAppend",
";",
"}"
] | extracts the int values represented by this attribute from the list and adds them to the setToAppend.
If the int attribute is null, it's ignored.
@param list incoming list
@param setToAppend the set to append to | [
"extracts",
"the",
"int",
"values",
"represented",
"by",
"this",
"attribute",
"from",
"the",
"list",
"and",
"adds",
"them",
"to",
"the",
"setToAppend",
".",
"If",
"the",
"int",
"attribute",
"is",
"null",
"it",
"s",
"ignored",
"."
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/attribute/IntegerAttribute.java#L135-L139 |
josueeduardo/snappy | plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/MainClassFinder.java | MainClassFinder.findSingleMainClass | public static String findSingleMainClass(JarFile jarFile, String classesLocation)
throws IOException {
MainClassesCallback callback = new MainClassesCallback();
MainClassFinder.doWithMainClasses(jarFile, classesLocation, callback);
return callback.getMainClass();
} | java | public static String findSingleMainClass(JarFile jarFile, String classesLocation)
throws IOException {
MainClassesCallback callback = new MainClassesCallback();
MainClassFinder.doWithMainClasses(jarFile, classesLocation, callback);
return callback.getMainClass();
} | [
"public",
"static",
"String",
"findSingleMainClass",
"(",
"JarFile",
"jarFile",
",",
"String",
"classesLocation",
")",
"throws",
"IOException",
"{",
"MainClassesCallback",
"callback",
"=",
"new",
"MainClassesCallback",
"(",
")",
";",
"MainClassFinder",
".",
"doWithMai... | Find a single main class in a given jar file.
@param jarFile the jar file to search
@param classesLocation the location within the jar containing classes
@return the main class or {@code null}
@throws IOException if the jar file cannot be read | [
"Find",
"a",
"single",
"main",
"class",
"in",
"a",
"given",
"jar",
"file",
"."
] | train | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/MainClassFinder.java#L190-L195 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java | AbstractService.bindMessage | private void bindMessage(final ServiceTask<?> task, final StringProperty messageProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Message for " + task.getServiceHandlerName(),
// Bind the task title
() -> messageProperty.bind(task.messageProperty()));
} | java | private void bindMessage(final ServiceTask<?> task, final StringProperty messageProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Message for " + task.getServiceHandlerName(),
// Bind the task title
() -> messageProperty.bind(task.messageProperty()));
} | [
"private",
"void",
"bindMessage",
"(",
"final",
"ServiceTask",
"<",
"?",
">",
"task",
",",
"final",
"StringProperty",
"messageProperty",
")",
"{",
"// Perform this binding into the JAT to respect widget and task API",
"JRebirth",
".",
"runIntoJAT",
"(",
"\"Bind Message for ... | Bind a task to a string property that will display the task message.
@param task the service task that we need to follow the progression
@param messageProperty the message presenter | [
"Bind",
"a",
"task",
"to",
"a",
"string",
"property",
"that",
"will",
"display",
"the",
"task",
"message",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L238-L244 |
protostuff/protostuff | protostuff-api/src/main/java/io/protostuff/UnsignedNumberUtil.java | UnsignedNumberUtil.parseUnsignedLong | private static long parseUnsignedLong(String s, int radix)
{
if (s.length() == 0)
{
throw new NumberFormatException("empty string");
}
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
{
throw new NumberFormatException("illegal radix: " + radix);
}
int max_safe_pos = maxSafeDigits[radix] - 1;
long value = 0;
for (int pos = 0; pos < s.length(); pos++)
{
int digit = Character.digit(s.charAt(pos), radix);
if (digit == -1)
{
throw new NumberFormatException(s);
}
if (pos > max_safe_pos && overflowInParse(value, digit, radix))
{
throw new NumberFormatException("Too large for unsigned long: " + s);
}
value = (value * radix) + digit;
}
return value;
} | java | private static long parseUnsignedLong(String s, int radix)
{
if (s.length() == 0)
{
throw new NumberFormatException("empty string");
}
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
{
throw new NumberFormatException("illegal radix: " + radix);
}
int max_safe_pos = maxSafeDigits[radix] - 1;
long value = 0;
for (int pos = 0; pos < s.length(); pos++)
{
int digit = Character.digit(s.charAt(pos), radix);
if (digit == -1)
{
throw new NumberFormatException(s);
}
if (pos > max_safe_pos && overflowInParse(value, digit, radix))
{
throw new NumberFormatException("Too large for unsigned long: " + s);
}
value = (value * radix) + digit;
}
return value;
} | [
"private",
"static",
"long",
"parseUnsignedLong",
"(",
"String",
"s",
",",
"int",
"radix",
")",
"{",
"if",
"(",
"s",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"NumberFormatException",
"(",
"\"empty string\"",
")",
";",
"}",
"if",
"(... | Returns the unsigned {@code long} value represented by a string with the given radix.
@param s
the string containing the unsigned {@code long} representation to be parsed.
@param radix
the radix to use while parsing {@code s}
@throws NumberFormatException
if the string does not contain a valid unsigned {@code long} with the given radix, or if
{@code radix} is not between {@link Character#MIN_RADIX} and {@link Character#MAX_RADIX}.
@throws NullPointerException
if {@code s} is null (in contrast to {@link Long#parseLong(String)}) | [
"Returns",
"the",
"unsigned",
"{",
"@code",
"long",
"}",
"value",
"represented",
"by",
"a",
"string",
"with",
"the",
"given",
"radix",
"."
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-api/src/main/java/io/protostuff/UnsignedNumberUtil.java#L282-L310 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/geometry/BondTools.java | BondTools.isValidDoubleBondConfiguration | public static boolean isValidDoubleBondConfiguration(IAtomContainer container, IBond bond) {
//org.openscience.cdk.interfaces.IAtom[] atoms = bond.getAtoms();
List<IAtom> connectedAtoms = container.getConnectedAtomsList(bond.getBegin());
IAtom from = null;
for (IAtom connectedAtom : connectedAtoms) {
if (!connectedAtom.equals(bond.getEnd())) {
from = connectedAtom;
}
}
boolean[] array = new boolean[container.getBondCount()];
for (int i = 0; i < array.length; i++) {
array[i] = true;
}
if (isStartOfDoubleBond(container, bond.getBegin(), from, array)
&& isEndOfDoubleBond(container, bond.getEnd(), bond.getBegin(), array)
&& !bond.getFlag(CDKConstants.ISAROMATIC)) {
return (true);
} else {
return (false);
}
} | java | public static boolean isValidDoubleBondConfiguration(IAtomContainer container, IBond bond) {
//org.openscience.cdk.interfaces.IAtom[] atoms = bond.getAtoms();
List<IAtom> connectedAtoms = container.getConnectedAtomsList(bond.getBegin());
IAtom from = null;
for (IAtom connectedAtom : connectedAtoms) {
if (!connectedAtom.equals(bond.getEnd())) {
from = connectedAtom;
}
}
boolean[] array = new boolean[container.getBondCount()];
for (int i = 0; i < array.length; i++) {
array[i] = true;
}
if (isStartOfDoubleBond(container, bond.getBegin(), from, array)
&& isEndOfDoubleBond(container, bond.getEnd(), bond.getBegin(), array)
&& !bond.getFlag(CDKConstants.ISAROMATIC)) {
return (true);
} else {
return (false);
}
} | [
"public",
"static",
"boolean",
"isValidDoubleBondConfiguration",
"(",
"IAtomContainer",
"container",
",",
"IBond",
"bond",
")",
"{",
"//org.openscience.cdk.interfaces.IAtom[] atoms = bond.getAtoms();",
"List",
"<",
"IAtom",
">",
"connectedAtoms",
"=",
"container",
".",
"get... | Tells if a certain bond is center of a valid double bond configuration.
@param container The atomcontainer.
@param bond The bond.
@return true=is a potential configuration, false=is not. | [
"Tells",
"if",
"a",
"certain",
"bond",
"is",
"center",
"of",
"a",
"valid",
"double",
"bond",
"configuration",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/geometry/BondTools.java#L60-L80 |
alkacon/opencms-core | src/org/opencms/ui/login/CmsLoginHelper.java | CmsLoginHelper.validateUserAndPasswordNotEmpty | public static CmsMessageContainer validateUserAndPasswordNotEmpty(String username, String password) {
boolean userEmpty = CmsStringUtil.isEmpty(username);
boolean passwordEmpty = CmsStringUtil.isEmpty(password);
// login was requested
if (userEmpty && passwordEmpty) {
return Messages.get().container(Messages.GUI_LOGIN_NO_DATA_0);
} else if (userEmpty) {
return Messages.get().container(Messages.GUI_LOGIN_NO_NAME_0);
} else if (passwordEmpty) {
return Messages.get().container(Messages.GUI_LOGIN_NO_PASSWORD_0);
}
return null;
} | java | public static CmsMessageContainer validateUserAndPasswordNotEmpty(String username, String password) {
boolean userEmpty = CmsStringUtil.isEmpty(username);
boolean passwordEmpty = CmsStringUtil.isEmpty(password);
// login was requested
if (userEmpty && passwordEmpty) {
return Messages.get().container(Messages.GUI_LOGIN_NO_DATA_0);
} else if (userEmpty) {
return Messages.get().container(Messages.GUI_LOGIN_NO_NAME_0);
} else if (passwordEmpty) {
return Messages.get().container(Messages.GUI_LOGIN_NO_PASSWORD_0);
}
return null;
} | [
"public",
"static",
"CmsMessageContainer",
"validateUserAndPasswordNotEmpty",
"(",
"String",
"username",
",",
"String",
"password",
")",
"{",
"boolean",
"userEmpty",
"=",
"CmsStringUtil",
".",
"isEmpty",
"(",
"username",
")",
";",
"boolean",
"passwordEmpty",
"=",
"C... | Checks that the user name and password are not empty, and returns an error message if they are.<p>
@param username the user name
@param password the password
@return the error message, or null if the user name and password are OK | [
"Checks",
"that",
"the",
"user",
"name",
"and",
"password",
"are",
"not",
"empty",
"and",
"returns",
"an",
"error",
"message",
"if",
"they",
"are",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsLoginHelper.java#L575-L589 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jndi.url.contexts/src/com/ibm/ws/jndi/url/contexts/javacolon/JavaJNDIComponentMetaDataAccessor.java | JavaJNDIComponentMetaDataAccessor.getComponentMetaData | public static ComponentMetaData getComponentMetaData(JavaColonNamespace namespace, String name) throws NamingException {
ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();
if (cmd == null) {
String fullName = name.isEmpty() ? namespace.toString() : namespace + "/" + name;
String msg = Tr.formatMessage(tc, "JNDI_NON_JEE_THREAD_CWWKN0100E", fullName);
NamingException nex = new NamingException(msg);
throw nex;
}
return cmd;
} | java | public static ComponentMetaData getComponentMetaData(JavaColonNamespace namespace, String name) throws NamingException {
ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();
if (cmd == null) {
String fullName = name.isEmpty() ? namespace.toString() : namespace + "/" + name;
String msg = Tr.formatMessage(tc, "JNDI_NON_JEE_THREAD_CWWKN0100E", fullName);
NamingException nex = new NamingException(msg);
throw nex;
}
return cmd;
} | [
"public",
"static",
"ComponentMetaData",
"getComponentMetaData",
"(",
"JavaColonNamespace",
"namespace",
",",
"String",
"name",
")",
"throws",
"NamingException",
"{",
"ComponentMetaData",
"cmd",
"=",
"ComponentMetaDataAccessorImpl",
".",
"getComponentMetaDataAccessor",
"(",
... | Helper method to get the component metadata from the thread context.
@return the component metadata data for the thread.
@throws NamingException Throws NamingException if running on a non-Java EE thread. | [
"Helper",
"method",
"to",
"get",
"the",
"component",
"metadata",
"from",
"the",
"thread",
"context",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jndi.url.contexts/src/com/ibm/ws/jndi/url/contexts/javacolon/JavaJNDIComponentMetaDataAccessor.java#L36-L45 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java | PoolOperations.getPool | public CloudPool getPool(String poolId, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors)
throws BatchErrorException, IOException {
PoolGetOptions options = new PoolGetOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().pools().get(poolId, options);
} | java | public CloudPool getPool(String poolId, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors)
throws BatchErrorException, IOException {
PoolGetOptions options = new PoolGetOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().pools().get(poolId, options);
} | [
"public",
"CloudPool",
"getPool",
"(",
"String",
"poolId",
",",
"DetailLevel",
"detailLevel",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"PoolGetOptions",
"options",
"=",
"new... | Gets the specified {@link CloudPool}.
@param poolId
The ID of the pool to get.
@param detailLevel
A {@link DetailLevel} used for controlling which properties are
retrieved from the service.
@param additionalBehaviors
A collection of {@link BatchClientBehavior} instances that are
applied to the Batch service request.
@return A {@link CloudPool} containing information about the specified Azure
Batch pool.
@throws BatchErrorException
Exception thrown when an error response is received from the
Batch service.
@throws IOException
Exception thrown when there is an error in
serialization/deserialization of data sent to/received from the
Batch service. | [
"Gets",
"the",
"specified",
"{",
"@link",
"CloudPool",
"}",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java#L215-L223 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java | IterableOfProtosSubject.usingFloatToleranceForFieldDescriptors | public IterableOfProtosFluentAssertion<M> usingFloatToleranceForFieldDescriptors(
float tolerance, Iterable<FieldDescriptor> fieldDescriptors) {
return usingConfig(config.usingFloatToleranceForFieldDescriptors(tolerance, fieldDescriptors));
} | java | public IterableOfProtosFluentAssertion<M> usingFloatToleranceForFieldDescriptors(
float tolerance, Iterable<FieldDescriptor> fieldDescriptors) {
return usingConfig(config.usingFloatToleranceForFieldDescriptors(tolerance, fieldDescriptors));
} | [
"public",
"IterableOfProtosFluentAssertion",
"<",
"M",
">",
"usingFloatToleranceForFieldDescriptors",
"(",
"float",
"tolerance",
",",
"Iterable",
"<",
"FieldDescriptor",
">",
"fieldDescriptors",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"usingFloatToleranceFo... | Compares float fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance. | [
"Compares",
"float",
"fields",
"with",
"these",
"explicitly",
"specified",
"top",
"-",
"level",
"field",
"numbers",
"using",
"the",
"provided",
"absolute",
"tolerance",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java#L845-L848 |
IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/client/rb/CloudResourceBundle.java | CloudResourceBundle.loadBundle | static CloudResourceBundle loadBundle(ServiceAccount serviceAccount, String bundleId, Locale locale) {
CloudResourceBundle crb = null;
ServiceClient client = ServiceClient.getInstance(serviceAccount);
try {
Map<String, String> resStrings = client.getResourceStrings(bundleId, locale.toLanguageTag(), false);
crb = new CloudResourceBundle(resStrings);
} catch (ServiceException e) {
logger.info("Could not fetch resource data for " + locale
+ " from the translation bundle " + bundleId + ": " + e.getMessage());
}
return crb;
} | java | static CloudResourceBundle loadBundle(ServiceAccount serviceAccount, String bundleId, Locale locale) {
CloudResourceBundle crb = null;
ServiceClient client = ServiceClient.getInstance(serviceAccount);
try {
Map<String, String> resStrings = client.getResourceStrings(bundleId, locale.toLanguageTag(), false);
crb = new CloudResourceBundle(resStrings);
} catch (ServiceException e) {
logger.info("Could not fetch resource data for " + locale
+ " from the translation bundle " + bundleId + ": " + e.getMessage());
}
return crb;
} | [
"static",
"CloudResourceBundle",
"loadBundle",
"(",
"ServiceAccount",
"serviceAccount",
",",
"String",
"bundleId",
",",
"Locale",
"locale",
")",
"{",
"CloudResourceBundle",
"crb",
"=",
"null",
";",
"ServiceClient",
"client",
"=",
"ServiceClient",
".",
"getInstance",
... | Package local factory method creating a new CloundResourceBundle instance
for the specified service account, bundle ID and locale.
@param serviceAccount The service account for IBM Globalization Pipeline
@param bundleId The bundle ID
@param locale The locale
@return An instance of CloundResourceBundle. | [
"Package",
"local",
"factory",
"method",
"creating",
"a",
"new",
"CloundResourceBundle",
"instance",
"for",
"the",
"specified",
"service",
"account",
"bundle",
"ID",
"and",
"locale",
"."
] | train | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/rb/CloudResourceBundle.java#L50-L61 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/config/loaderwriter/DefaultCacheLoaderWriterProviderConfiguration.java | DefaultCacheLoaderWriterProviderConfiguration.addLoaderFor | public DefaultCacheLoaderWriterProviderConfiguration addLoaderFor(String alias, Class<? extends CacheLoaderWriter<?, ?>> clazz, Object... arguments) {
getDefaults().put(alias, new DefaultCacheLoaderWriterConfiguration(clazz, arguments));
return this;
} | java | public DefaultCacheLoaderWriterProviderConfiguration addLoaderFor(String alias, Class<? extends CacheLoaderWriter<?, ?>> clazz, Object... arguments) {
getDefaults().put(alias, new DefaultCacheLoaderWriterConfiguration(clazz, arguments));
return this;
} | [
"public",
"DefaultCacheLoaderWriterProviderConfiguration",
"addLoaderFor",
"(",
"String",
"alias",
",",
"Class",
"<",
"?",
"extends",
"CacheLoaderWriter",
"<",
"?",
",",
"?",
">",
">",
"clazz",
",",
"Object",
"...",
"arguments",
")",
"{",
"getDefaults",
"(",
")"... | Adds a default {@link CacheLoaderWriter} class and associated constuctor arguments to be used with a cache matching
the provided alias.
@param alias the cache alias
@param clazz the cache loader writer class
@param arguments the constructor arguments
@return this configuration instance | [
"Adds",
"a",
"default",
"{",
"@link",
"CacheLoaderWriter",
"}",
"class",
"and",
"associated",
"constuctor",
"arguments",
"to",
"be",
"used",
"with",
"a",
"cache",
"matching",
"the",
"provided",
"alias",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/config/loaderwriter/DefaultCacheLoaderWriterProviderConfiguration.java#L47-L50 |
triceo/splitlog | splitlog-core/src/main/java/com/github/triceo/splitlog/DefaultLogWatch.java | DefaultLogWatch.stop | @Override
public synchronized boolean stop() {
if (!this.isStarted()) {
throw new IllegalStateException("Cannot terminate what was not started.");
} else if (!this.isStopped.compareAndSet(false, true)) {
return false;
}
DefaultLogWatch.LOGGER.info("Terminating {}.", this);
this.tailing.stop();
this.consumers.stop();
this.handingDown.clear();
this.storage.logWatchTerminated();
DefaultLogWatch.LOGGER.info("Terminated {}.", this);
return true;
} | java | @Override
public synchronized boolean stop() {
if (!this.isStarted()) {
throw new IllegalStateException("Cannot terminate what was not started.");
} else if (!this.isStopped.compareAndSet(false, true)) {
return false;
}
DefaultLogWatch.LOGGER.info("Terminating {}.", this);
this.tailing.stop();
this.consumers.stop();
this.handingDown.clear();
this.storage.logWatchTerminated();
DefaultLogWatch.LOGGER.info("Terminated {}.", this);
return true;
} | [
"@",
"Override",
"public",
"synchronized",
"boolean",
"stop",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isStarted",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot terminate what was not started.\"",
")",
";",
"}",
"else",
"if",
... | Invoking this method will cause the running message sweep to be
de-scheduled. Any currently present {@link Message}s will only be removed
from memory when this watch instance is removed from memory. | [
"Invoking",
"this",
"method",
"will",
"cause",
"the",
"running",
"message",
"sweep",
"to",
"be",
"de",
"-",
"scheduled",
".",
"Any",
"currently",
"present",
"{"
] | train | https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-core/src/main/java/com/github/triceo/splitlog/DefaultLogWatch.java#L265-L279 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.