repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
interedition/collatex | collatex-core/src/main/java/eu/interedition/collatex/suffixarray/SuffixArrays.java | SuffixArrays.createWithLCP | public static SuffixData createWithLCP(int[] input, int start, int length) {
final ISuffixArrayBuilder builder = new DensePositiveDecorator(
new ExtraTrailingCellsDecorator(defaultAlgorithm(), 3));
return createWithLCP(input, start, length, builder);
} | java | public static SuffixData createWithLCP(int[] input, int start, int length) {
final ISuffixArrayBuilder builder = new DensePositiveDecorator(
new ExtraTrailingCellsDecorator(defaultAlgorithm(), 3));
return createWithLCP(input, start, length, builder);
} | [
"public",
"static",
"SuffixData",
"createWithLCP",
"(",
"int",
"[",
"]",
"input",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"final",
"ISuffixArrayBuilder",
"builder",
"=",
"new",
"DensePositiveDecorator",
"(",
"new",
"ExtraTrailingCellsDecorator",
"(",
... | Create a suffix array and an LCP array for a given input sequence of symbols. | [
"Create",
"a",
"suffix",
"array",
"and",
"an",
"LCP",
"array",
"for",
"a",
"given",
"input",
"sequence",
"of",
"symbols",
"."
] | train | https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/SuffixArrays.java#L84-L88 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java | CPOptionPersistenceImpl.fetchByUUID_G | @Override
public CPOption fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | java | @Override
public CPOption fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CPOption",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the cp option where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching cp option, or <code>null</code> if a matching cp option could not be found | [
"Returns",
"the",
"cp",
"option",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"cache",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L694-L697 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/LabeledChunkIdentifier.java | LabeledChunkIdentifier.isEndOfChunk | public static boolean isEndOfChunk(LabelTagType prev, LabelTagType cur)
{
if (prev == null) return false;
return isEndOfChunk(prev.tag, prev.type, cur.tag, cur.type);
} | java | public static boolean isEndOfChunk(LabelTagType prev, LabelTagType cur)
{
if (prev == null) return false;
return isEndOfChunk(prev.tag, prev.type, cur.tag, cur.type);
} | [
"public",
"static",
"boolean",
"isEndOfChunk",
"(",
"LabelTagType",
"prev",
",",
"LabelTagType",
"cur",
")",
"{",
"if",
"(",
"prev",
"==",
"null",
")",
"return",
"false",
";",
"return",
"isEndOfChunk",
"(",
"prev",
".",
"tag",
",",
"prev",
".",
"type",
"... | Returns whether a chunk ended between the previous and current token
@param prev - the label/tag/type of the previous token
@param cur - the label/tag/type of the current token
@return true if the previous token was the last token of a chunk | [
"Returns",
"whether",
"a",
"chunk",
"ended",
"between",
"the",
"previous",
"and",
"current",
"token"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/LabeledChunkIdentifier.java#L155-L159 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ConfigurationsInner.java | ConfigurationsInner.listAsync | public Observable<ClusterConfigurationsInner> listAsync(String resourceGroupName, String clusterName) {
return listWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<ClusterConfigurationsInner>, ClusterConfigurationsInner>() {
@Override
public ClusterConfigurationsInner call(ServiceResponse<ClusterConfigurationsInner> response) {
return response.body();
}
});
} | java | public Observable<ClusterConfigurationsInner> listAsync(String resourceGroupName, String clusterName) {
return listWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<ClusterConfigurationsInner>, ClusterConfigurationsInner>() {
@Override
public ClusterConfigurationsInner call(ServiceResponse<ClusterConfigurationsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ClusterConfigurationsInner",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
".",
"map",
"(",
"new"... | Gets all configuration information for an HDI cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ClusterConfigurationsInner object | [
"Gets",
"all",
"configuration",
"information",
"for",
"an",
"HDI",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ConfigurationsInner.java#L111-L118 |
udoprog/ffwd-client-java | src/main/java/com/google/protobuf250/FieldSet.java | FieldSet.computeFieldSize | public static int computeFieldSize(final FieldDescriptorLite<?> descriptor,
final Object value) {
WireFormat.FieldType type = descriptor.getLiteType();
int number = descriptor.getNumber();
if (descriptor.isRepeated()) {
if (descriptor.isPacked()) {
int dataSize = 0;
for (final Object element : (List<?>)value) {
dataSize += computeElementSizeNoTag(type, element);
}
return dataSize +
CodedOutputStream.computeTagSize(number) +
CodedOutputStream.computeRawVarint32Size(dataSize);
} else {
int size = 0;
for (final Object element : (List<?>)value) {
size += computeElementSize(type, number, element);
}
return size;
}
} else {
return computeElementSize(type, number, value);
}
} | java | public static int computeFieldSize(final FieldDescriptorLite<?> descriptor,
final Object value) {
WireFormat.FieldType type = descriptor.getLiteType();
int number = descriptor.getNumber();
if (descriptor.isRepeated()) {
if (descriptor.isPacked()) {
int dataSize = 0;
for (final Object element : (List<?>)value) {
dataSize += computeElementSizeNoTag(type, element);
}
return dataSize +
CodedOutputStream.computeTagSize(number) +
CodedOutputStream.computeRawVarint32Size(dataSize);
} else {
int size = 0;
for (final Object element : (List<?>)value) {
size += computeElementSize(type, number, element);
}
return size;
}
} else {
return computeElementSize(type, number, value);
}
} | [
"public",
"static",
"int",
"computeFieldSize",
"(",
"final",
"FieldDescriptorLite",
"<",
"?",
">",
"descriptor",
",",
"final",
"Object",
"value",
")",
"{",
"WireFormat",
".",
"FieldType",
"type",
"=",
"descriptor",
".",
"getLiteType",
"(",
")",
";",
"int",
"... | Compute the number of bytes needed to encode a particular field. | [
"Compute",
"the",
"number",
"of",
"bytes",
"needed",
"to",
"encode",
"a",
"particular",
"field",
"."
] | train | https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/FieldSet.java#L837-L860 |
Impetus/Kundera | src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java | CouchDBSchemaManager.createViewForSelectAll | private void createViewForSelectAll(TableInfo tableInfo, Map<String, MapReduce> views)
{
MapReduce mapr = new MapReduce();
mapr.setMap("function(doc){if(doc." + tableInfo.getIdColumnName() + "){emit(null, doc);}}");
views.put("all", mapr);
} | java | private void createViewForSelectAll(TableInfo tableInfo, Map<String, MapReduce> views)
{
MapReduce mapr = new MapReduce();
mapr.setMap("function(doc){if(doc." + tableInfo.getIdColumnName() + "){emit(null, doc);}}");
views.put("all", mapr);
} | [
"private",
"void",
"createViewForSelectAll",
"(",
"TableInfo",
"tableInfo",
",",
"Map",
"<",
"String",
",",
"MapReduce",
">",
"views",
")",
"{",
"MapReduce",
"mapr",
"=",
"new",
"MapReduce",
"(",
")",
";",
"mapr",
".",
"setMap",
"(",
"\"function(doc){if(doc.\"... | Creates the view for select all.
@param tableInfo
the table info
@param views
the views | [
"Creates",
"the",
"view",
"for",
"select",
"all",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java#L658-L663 |
apache/flink | flink-core/src/main/java/org/apache/flink/util/AbstractID.java | AbstractID.longToByteArray | private static void longToByteArray(long l, byte[] ba, int offset) {
for (int i = 0; i < SIZE_OF_LONG; ++i) {
final int shift = i << 3; // i * 8
ba[offset + SIZE_OF_LONG - 1 - i] = (byte) ((l & (0xffL << shift)) >>> shift);
}
} | java | private static void longToByteArray(long l, byte[] ba, int offset) {
for (int i = 0; i < SIZE_OF_LONG; ++i) {
final int shift = i << 3; // i * 8
ba[offset + SIZE_OF_LONG - 1 - i] = (byte) ((l & (0xffL << shift)) >>> shift);
}
} | [
"private",
"static",
"void",
"longToByteArray",
"(",
"long",
"l",
",",
"byte",
"[",
"]",
"ba",
",",
"int",
"offset",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"SIZE_OF_LONG",
";",
"++",
"i",
")",
"{",
"final",
"int",
"shift",
"="... | Converts a long to a byte array.
@param l the long variable to be converted
@param ba the byte array to store the result the of the conversion
@param offset offset indicating at what position inside the byte array the result of the conversion shall be stored | [
"Converts",
"a",
"long",
"to",
"a",
"byte",
"array",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/AbstractID.java#L210-L215 |
ujmp/universal-java-matrix-package | ujmp-core/src/main/java/org/ujmp/core/util/MathUtil.java | MathUtil.nextInteger | public static final int nextInteger(int min, int max) {
return min == max ? min : min + getRandom().nextInt(max - min);
} | java | public static final int nextInteger(int min, int max) {
return min == max ? min : min + getRandom().nextInt(max - min);
} | [
"public",
"static",
"final",
"int",
"nextInteger",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"return",
"min",
"==",
"max",
"?",
"min",
":",
"min",
"+",
"getRandom",
"(",
")",
".",
"nextInt",
"(",
"max",
"-",
"min",
")",
";",
"}"
] | Returns a random value in the desired interval
@param min
minimum value (inclusive)
@param max
maximum value (exclusive)
@return a random value | [
"Returns",
"a",
"random",
"value",
"in",
"the",
"desired",
"interval"
] | train | https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/util/MathUtil.java#L303-L305 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java | PathBuilder.get | @SuppressWarnings("unchecked")
public <A extends Enum<A>> EnumPath<A> get(EnumPath<A> path) {
EnumPath<A> newPath = getEnum(toString(path), (Class<A>) path.getType());
return addMetadataOf(newPath, path);
} | java | @SuppressWarnings("unchecked")
public <A extends Enum<A>> EnumPath<A> get(EnumPath<A> path) {
EnumPath<A> newPath = getEnum(toString(path), (Class<A>) path.getType());
return addMetadataOf(newPath, path);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"A",
"extends",
"Enum",
"<",
"A",
">",
">",
"EnumPath",
"<",
"A",
">",
"get",
"(",
"EnumPath",
"<",
"A",
">",
"path",
")",
"{",
"EnumPath",
"<",
"A",
">",
"newPath",
"=",
"getEnum",
... | Create a new Enum path
@param <A>
@param path existing path
@return property path | [
"Create",
"a",
"new",
"Enum",
"path"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java#L327-L331 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/XmlUtils.java | XmlUtils.appendElement | public static void appendElement(Element parent, Element child) {
Node tmp = parent.getOwnerDocument().importNode(child, true);
parent.appendChild(tmp);
} | java | public static void appendElement(Element parent, Element child) {
Node tmp = parent.getOwnerDocument().importNode(child, true);
parent.appendChild(tmp);
} | [
"public",
"static",
"void",
"appendElement",
"(",
"Element",
"parent",
",",
"Element",
"child",
")",
"{",
"Node",
"tmp",
"=",
"parent",
".",
"getOwnerDocument",
"(",
")",
".",
"importNode",
"(",
"child",
",",
"true",
")",
";",
"parent",
".",
"appendChild",... | Appends another element as a child element.
@param parent the parent element
@param child the child element to append | [
"Appends",
"another",
"element",
"as",
"a",
"child",
"element",
"."
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L376-L379 |
lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java | ASMUtil.toType | public static Type toType(String cfType, boolean axistype) throws PageException {
return toType(Caster.cfTypeToClass(cfType), axistype);
} | java | public static Type toType(String cfType, boolean axistype) throws PageException {
return toType(Caster.cfTypeToClass(cfType), axistype);
} | [
"public",
"static",
"Type",
"toType",
"(",
"String",
"cfType",
",",
"boolean",
"axistype",
")",
"throws",
"PageException",
"{",
"return",
"toType",
"(",
"Caster",
".",
"cfTypeToClass",
"(",
"cfType",
")",
",",
"axistype",
")",
";",
"}"
] | translate a string cfml type definition to a Type Object
@param cfType
@param axistype
@return
@throws PageException | [
"translate",
"a",
"string",
"cfml",
"type",
"definition",
"to",
"a",
"Type",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java#L646-L648 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readIdForUrlName | public CmsUUID readIdForUrlName(CmsDbContext dbc, String name) throws CmsDataAccessException {
List<CmsUrlNameMappingEntry> entries = getVfsDriver(dbc).readUrlNameMappingEntries(
dbc,
dbc.currentProject().isOnlineProject(),
CmsUrlNameMappingFilter.ALL.filterName(name));
if (entries.isEmpty()) {
return null;
}
return entries.get(0).getStructureId();
} | java | public CmsUUID readIdForUrlName(CmsDbContext dbc, String name) throws CmsDataAccessException {
List<CmsUrlNameMappingEntry> entries = getVfsDriver(dbc).readUrlNameMappingEntries(
dbc,
dbc.currentProject().isOnlineProject(),
CmsUrlNameMappingFilter.ALL.filterName(name));
if (entries.isEmpty()) {
return null;
}
return entries.get(0).getStructureId();
} | [
"public",
"CmsUUID",
"readIdForUrlName",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"name",
")",
"throws",
"CmsDataAccessException",
"{",
"List",
"<",
"CmsUrlNameMappingEntry",
">",
"entries",
"=",
"getVfsDriver",
"(",
"dbc",
")",
".",
"readUrlNameMappingEntries",
"... | Reads the structure id which is mapped to a given URL name.<p>
@param dbc the current database context
@param name the name for which the mapped structure id should be looked up
@return the structure id which is mapped to the given name, or null if there is no such id
@throws CmsDataAccessException if something goes wrong | [
"Reads",
"the",
"structure",
"id",
"which",
"is",
"mapped",
"to",
"a",
"given",
"URL",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7014-L7024 |
JOML-CI/JOML | src/org/joml/Quaternionf.java | Quaternionf.fromAxisAngleDeg | public Quaternionf fromAxisAngleDeg(Vector3fc axis, float angle) {
return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), (float) Math.toRadians(angle));
} | java | public Quaternionf fromAxisAngleDeg(Vector3fc axis, float angle) {
return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), (float) Math.toRadians(angle));
} | [
"public",
"Quaternionf",
"fromAxisAngleDeg",
"(",
"Vector3fc",
"axis",
",",
"float",
"angle",
")",
"{",
"return",
"fromAxisAngleRad",
"(",
"axis",
".",
"x",
"(",
")",
",",
"axis",
".",
"y",
"(",
")",
",",
"axis",
".",
"z",
"(",
")",
",",
"(",
"float"... | Set this quaternion to be a representation of the supplied axis and
angle (in degrees).
@param axis
the rotation axis
@param angle
the angle in degrees
@return this | [
"Set",
"this",
"quaternion",
"to",
"be",
"a",
"representation",
"of",
"the",
"supplied",
"axis",
"and",
"angle",
"(",
"in",
"degrees",
")",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaternionf.java#L920-L922 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java | ManagedDatabasesInner.createOrUpdate | public ManagedDatabaseInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body();
} | java | public ManagedDatabaseInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body();
} | [
"public",
"ManagedDatabaseInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"String",
"databaseName",
",",
"ManagedDatabaseInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resource... | Creates a new database or updates an existing database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@param databaseName The name of the database.
@param parameters The requested database resource state.
@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 ManagedDatabaseInner object if successful. | [
"Creates",
"a",
"new",
"database",
"or",
"updates",
"an",
"existing",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java#L515-L517 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java | Scopes.scopedElementsFor | public static <T extends EObject> Iterable<IEObjectDescription> scopedElementsFor(Iterable<? extends T> elements,
final Function<T, QualifiedName> nameComputation) {
Iterable<IEObjectDescription> transformed = Iterables.transform(elements,
new Function<T, IEObjectDescription>() {
@Override
public IEObjectDescription apply(T from) {
final QualifiedName qualifiedName = nameComputation.apply(from);
if (qualifiedName != null)
return new EObjectDescription(qualifiedName, from, null);
return null;
}
});
return Iterables.filter(transformed, Predicates.notNull());
} | java | public static <T extends EObject> Iterable<IEObjectDescription> scopedElementsFor(Iterable<? extends T> elements,
final Function<T, QualifiedName> nameComputation) {
Iterable<IEObjectDescription> transformed = Iterables.transform(elements,
new Function<T, IEObjectDescription>() {
@Override
public IEObjectDescription apply(T from) {
final QualifiedName qualifiedName = nameComputation.apply(from);
if (qualifiedName != null)
return new EObjectDescription(qualifiedName, from, null);
return null;
}
});
return Iterables.filter(transformed, Predicates.notNull());
} | [
"public",
"static",
"<",
"T",
"extends",
"EObject",
">",
"Iterable",
"<",
"IEObjectDescription",
">",
"scopedElementsFor",
"(",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"elements",
",",
"final",
"Function",
"<",
"T",
",",
"QualifiedName",
">",
"nameComputati... | transforms an {@link Iterable} of {@link EObject}s into an {@link Iterable} of {@link IEObjectDescription}s computing
the name of the elements using the passed {@link Function} If the passed function returns null the object is
filtered out. | [
"transforms",
"an",
"{"
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java#L87-L100 |
pietermartin/sqlg | sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java | Schema.removeGlobalUniqueIndex | void removeGlobalUniqueIndex(GlobalUniqueIndex index, boolean preserveData) {
getTopology().lock();
String fn = index.getName();
if (!uncommittedRemovedGlobalUniqueIndexes.contains(fn)) {
uncommittedRemovedGlobalUniqueIndexes.add(fn);
TopologyManager.removeGlobalUniqueIndex(sqlgGraph, fn);
if (!preserveData) {
getVertexLabel(index.getName()).ifPresent(
(VertexLabel vl) -> vl.remove(false));
}
getTopology().fire(index, "", TopologyChangeAction.DELETE);
}
} | java | void removeGlobalUniqueIndex(GlobalUniqueIndex index, boolean preserveData) {
getTopology().lock();
String fn = index.getName();
if (!uncommittedRemovedGlobalUniqueIndexes.contains(fn)) {
uncommittedRemovedGlobalUniqueIndexes.add(fn);
TopologyManager.removeGlobalUniqueIndex(sqlgGraph, fn);
if (!preserveData) {
getVertexLabel(index.getName()).ifPresent(
(VertexLabel vl) -> vl.remove(false));
}
getTopology().fire(index, "", TopologyChangeAction.DELETE);
}
} | [
"void",
"removeGlobalUniqueIndex",
"(",
"GlobalUniqueIndex",
"index",
",",
"boolean",
"preserveData",
")",
"{",
"getTopology",
"(",
")",
".",
"lock",
"(",
")",
";",
"String",
"fn",
"=",
"index",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"uncommittedRe... | remove the given global unique index
@param index the index to remove
@param preserveData should we keep the sql data? | [
"remove",
"the",
"given",
"global",
"unique",
"index"
] | train | https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1810-L1822 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java | ClustersInner.beginExecuteScriptActions | public void beginExecuteScriptActions(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) {
beginExecuteScriptActionsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body();
} | java | public void beginExecuteScriptActions(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) {
beginExecuteScriptActionsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body();
} | [
"public",
"void",
"beginExecuteScriptActions",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"ExecuteScriptActionParameters",
"parameters",
")",
"{",
"beginExecuteScriptActionsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
",",... | Executes script actions on the specified HDInsight cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param parameters The parameters for executing script actions.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Executes",
"script",
"actions",
"on",
"the",
"specified",
"HDInsight",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1795-L1797 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariableFactory.java | RandomVariableUniqueVariableFactory.createRandomVariable | public RandomVariable createRandomVariable(RandomVariable randomvariable, boolean isConstant, ArrayList<RandomVariableUniqueVariable> parentVariables, RandomVariableUniqueVariable.OperatorType parentOperatorType) {
int factoryID = currentFactoryID++;
listOfAllVariables.add(
factoryID,
randomvariable
);
return new RandomVariableUniqueVariable(factoryID, isConstant, parentVariables, parentOperatorType);
} | java | public RandomVariable createRandomVariable(RandomVariable randomvariable, boolean isConstant, ArrayList<RandomVariableUniqueVariable> parentVariables, RandomVariableUniqueVariable.OperatorType parentOperatorType) {
int factoryID = currentFactoryID++;
listOfAllVariables.add(
factoryID,
randomvariable
);
return new RandomVariableUniqueVariable(factoryID, isConstant, parentVariables, parentOperatorType);
} | [
"public",
"RandomVariable",
"createRandomVariable",
"(",
"RandomVariable",
"randomvariable",
",",
"boolean",
"isConstant",
",",
"ArrayList",
"<",
"RandomVariableUniqueVariable",
">",
"parentVariables",
",",
"RandomVariableUniqueVariable",
".",
"OperatorType",
"parentOperatorTyp... | Add an object of {@link RandomVariable} to variable list at the index of the current ID
and rises the current ID to the next one.
@param randomvariable object of {@link RandomVariable} to add to ArrayList and return as {@link RandomVariableUniqueVariable}
@param isConstant boolean such that if true the derivative will be set to zero
@param parentVariables List of {@link RandomVariableUniqueVariable} that are the parents of the new instance
@param parentOperatorType Operator type
@return new instance of {@link RandomVariableUniqueVariable} | [
"Add",
"an",
"object",
"of",
"{"
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariableFactory.java#L49-L59 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftDataResultHelper.java | ThriftDataResultHelper.transformThriftResultAndAddToList | public <T> List<T> transformThriftResultAndAddToList(Map<ByteBuffer, List<ColumnOrSuperColumn>> coscResultMap,
ColumnFamilyType columnFamilyType, ThriftRow row)
{
List<ColumnOrSuperColumn> coscList = new ArrayList<ColumnOrSuperColumn>();
for (List<ColumnOrSuperColumn> list : coscResultMap.values())
{
coscList.addAll(list);
}
return transformThriftResult(coscList, columnFamilyType, row);
} | java | public <T> List<T> transformThriftResultAndAddToList(Map<ByteBuffer, List<ColumnOrSuperColumn>> coscResultMap,
ColumnFamilyType columnFamilyType, ThriftRow row)
{
List<ColumnOrSuperColumn> coscList = new ArrayList<ColumnOrSuperColumn>();
for (List<ColumnOrSuperColumn> list : coscResultMap.values())
{
coscList.addAll(list);
}
return transformThriftResult(coscList, columnFamilyType, row);
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"transformThriftResultAndAddToList",
"(",
"Map",
"<",
"ByteBuffer",
",",
"List",
"<",
"ColumnOrSuperColumn",
">",
">",
"coscResultMap",
",",
"ColumnFamilyType",
"columnFamilyType",
",",
"ThriftRow",
"row",
")",
"{"... | Transforms data retrieved as result via thrift to a List whose content
type is determined by {@link ColumnFamilyType}.
@param <T> the generic type
@param coscResultMap the cosc result map
@param columnFamilyType the column family type
@param row the row
@return the list | [
"Transforms",
"data",
"retrieved",
"as",
"result",
"via",
"thrift",
"to",
"a",
"List",
"whose",
"content",
"type",
"is",
"determined",
"by",
"{",
"@link",
"ColumnFamilyType",
"}",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftDataResultHelper.java#L191-L203 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java | AssertKripton.assertTrueOrInvalidPropertyName | public static void assertTrueOrInvalidPropertyName(boolean expression, SQLProperty item1, SQLProperty item2) {
if (!expression) {
String msg = String.format("Properties '%s#%s' and '%s#%s' must have same column name",
item1.getParent().name, item1.name, item2.getParent().name, item2.name);
throw (new InvalidPropertyToColumnConversion(msg));
}
} | java | public static void assertTrueOrInvalidPropertyName(boolean expression, SQLProperty item1, SQLProperty item2) {
if (!expression) {
String msg = String.format("Properties '%s#%s' and '%s#%s' must have same column name",
item1.getParent().name, item1.name, item2.getParent().name, item2.name);
throw (new InvalidPropertyToColumnConversion(msg));
}
} | [
"public",
"static",
"void",
"assertTrueOrInvalidPropertyName",
"(",
"boolean",
"expression",
",",
"SQLProperty",
"item1",
",",
"SQLProperty",
"item2",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"String",
"msg",
"=",
"String",
".",
"format",
"(",
"\"Prop... | Assert true or invalid property name.
@param expression
the expression
@param item1
the item 1
@param item2
the item 2 | [
"Assert",
"true",
"or",
"invalid",
"property",
"name",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java#L327-L334 |
samskivert/samskivert | src/main/java/com/samskivert/swing/Label.java | Label.textIterator | protected AttributedCharacterIterator textIterator (Graphics2D gfx)
{
// first set up any attributes that apply to the entire text
Font font = (_font == null) ? gfx.getFont() : _font;
HashMap<TextAttribute,Object> map = new HashMap<TextAttribute,Object>();
map.put(TextAttribute.FONT, font);
if ((_style & UNDERLINE) != 0) {
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
}
AttributedString text = new AttributedString(_text, map);
addAttributes(text);
return text.getIterator();
} | java | protected AttributedCharacterIterator textIterator (Graphics2D gfx)
{
// first set up any attributes that apply to the entire text
Font font = (_font == null) ? gfx.getFont() : _font;
HashMap<TextAttribute,Object> map = new HashMap<TextAttribute,Object>();
map.put(TextAttribute.FONT, font);
if ((_style & UNDERLINE) != 0) {
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
}
AttributedString text = new AttributedString(_text, map);
addAttributes(text);
return text.getIterator();
} | [
"protected",
"AttributedCharacterIterator",
"textIterator",
"(",
"Graphics2D",
"gfx",
")",
"{",
"// first set up any attributes that apply to the entire text",
"Font",
"font",
"=",
"(",
"_font",
"==",
"null",
")",
"?",
"gfx",
".",
"getFont",
"(",
")",
":",
"_font",
... | Constructs an attributed character iterator with our text and the appropriate font. | [
"Constructs",
"an",
"attributed",
"character",
"iterator",
"with",
"our",
"text",
"and",
"the",
"appropriate",
"font",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/Label.java#L611-L624 |
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor | MapCore/src/main/java/org/wwarn/mapcore/client/common/types/Range.java | Range.calcCI95 | public static Range<Double> calcCI95(Double percentageValue, Integer sampleSize) {
// GWT.log("calcCI95", null);
GWT.log("percentageValue: " + percentageValue.toString(), null);
GWT.log("sampleSize: " + sampleSize, null);
if (sampleSize==0) {
return null;
}
if ( (sampleSize < 0) ||(percentageValue < 0.0) || (percentageValue > 100.0) ) {
throw new IllegalArgumentException("sampleSize < 0, percentageValue < 0.0, or percentageValue > 100.0");
}
//convert percentageValue to ratio
Double ratio = percentageValue/100.0;
Double oneMinusRatio = 1.0 - ratio;
Double sqrtSD = Math.sqrt(zStdDevSqrd + (4*sampleSize*ratio*oneMinusRatio));
Double denom = 2*(sampleSize + zStdDevSqrd);
Double lowerLimit = ((2*sampleSize*ratio) + zStdDevSqrd - (zStdDev *sqrtSD))/denom;
Double upperLimit = ((2*sampleSize*ratio) + zStdDevSqrd + (zStdDev *sqrtSD))/denom;
//convert back to percentages, to 1 d.p.
lowerLimit = Math.rint(lowerLimit*1000)/10.0;
upperLimit = Math.rint(upperLimit*1000)/10.0;
if(lowerLimit<0.0) {
lowerLimit = 0.0;
}
if(upperLimit>100.0) {
upperLimit = 100.0;
}
// GWT.log("lowerLimit: " + lowerLimit.toString(), null);
// GWT.log("upperLimit: " + upperLimit.toString(), null);
return new Range<Double>(lowerLimit, upperLimit);
} | java | public static Range<Double> calcCI95(Double percentageValue, Integer sampleSize) {
// GWT.log("calcCI95", null);
GWT.log("percentageValue: " + percentageValue.toString(), null);
GWT.log("sampleSize: " + sampleSize, null);
if (sampleSize==0) {
return null;
}
if ( (sampleSize < 0) ||(percentageValue < 0.0) || (percentageValue > 100.0) ) {
throw new IllegalArgumentException("sampleSize < 0, percentageValue < 0.0, or percentageValue > 100.0");
}
//convert percentageValue to ratio
Double ratio = percentageValue/100.0;
Double oneMinusRatio = 1.0 - ratio;
Double sqrtSD = Math.sqrt(zStdDevSqrd + (4*sampleSize*ratio*oneMinusRatio));
Double denom = 2*(sampleSize + zStdDevSqrd);
Double lowerLimit = ((2*sampleSize*ratio) + zStdDevSqrd - (zStdDev *sqrtSD))/denom;
Double upperLimit = ((2*sampleSize*ratio) + zStdDevSqrd + (zStdDev *sqrtSD))/denom;
//convert back to percentages, to 1 d.p.
lowerLimit = Math.rint(lowerLimit*1000)/10.0;
upperLimit = Math.rint(upperLimit*1000)/10.0;
if(lowerLimit<0.0) {
lowerLimit = 0.0;
}
if(upperLimit>100.0) {
upperLimit = 100.0;
}
// GWT.log("lowerLimit: " + lowerLimit.toString(), null);
// GWT.log("upperLimit: " + upperLimit.toString(), null);
return new Range<Double>(lowerLimit, upperLimit);
} | [
"public",
"static",
"Range",
"<",
"Double",
">",
"calcCI95",
"(",
"Double",
"percentageValue",
",",
"Integer",
"sampleSize",
")",
"{",
"// GWT.log(\"calcCI95\", null);",
"GWT",
".",
"log",
"(",
"\"percentageValue: \"",
"+",
"percentageValue",
".",
"toString",
... | /*
Calculate CI95% value using the no continuity correction formula found here: http://faculty.vassar.edu/lowry/prop1.html | [
"/",
"*",
"Calculate",
"CI95%",
"value",
"using",
"the",
"no",
"continuity",
"correction",
"formula",
"found",
"here",
":",
"http",
":",
"//",
"faculty",
".",
"vassar",
".",
"edu",
"/",
"lowry",
"/",
"prop1",
".",
"html"
] | train | https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/common/types/Range.java#L64-L100 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/Beta.java | Beta.PowerSeries | public static double PowerSeries(double a, double b, double x) {
double s, t, u, v, n, t1, z, ai;
ai = 1.0 / a;
u = (1.0 - b) * x;
v = u / (a + 1.0);
t1 = v;
t = u;
n = 2.0;
s = 0.0;
z = Constants.DoubleEpsilon * ai;
while (Math.abs(v) > z) {
u = (n - b) * x / n;
t *= u;
v = t / (a + n);
s += v;
n += 1.0;
}
s += t1;
s += ai;
u = a * Math.log(x);
if ((a + b) < Gamma.GammaMax && Math.abs(u) < Constants.LogMax) {
t = Gamma.Function(a + b) / (Gamma.Function(a) * Gamma.Function(b));
s = s * t * Math.pow(x, a);
} else {
t = Gamma.Log(a + b) - Gamma.Log(a) - Gamma.Log(b) + u + Math.log(s);
if (t < Constants.LogMin) s = 0.0;
else s = Math.exp(t);
}
return s;
} | java | public static double PowerSeries(double a, double b, double x) {
double s, t, u, v, n, t1, z, ai;
ai = 1.0 / a;
u = (1.0 - b) * x;
v = u / (a + 1.0);
t1 = v;
t = u;
n = 2.0;
s = 0.0;
z = Constants.DoubleEpsilon * ai;
while (Math.abs(v) > z) {
u = (n - b) * x / n;
t *= u;
v = t / (a + n);
s += v;
n += 1.0;
}
s += t1;
s += ai;
u = a * Math.log(x);
if ((a + b) < Gamma.GammaMax && Math.abs(u) < Constants.LogMax) {
t = Gamma.Function(a + b) / (Gamma.Function(a) * Gamma.Function(b));
s = s * t * Math.pow(x, a);
} else {
t = Gamma.Log(a + b) - Gamma.Log(a) - Gamma.Log(b) + u + Math.log(s);
if (t < Constants.LogMin) s = 0.0;
else s = Math.exp(t);
}
return s;
} | [
"public",
"static",
"double",
"PowerSeries",
"(",
"double",
"a",
",",
"double",
"b",
",",
"double",
"x",
")",
"{",
"double",
"s",
",",
"t",
",",
"u",
",",
"v",
",",
"n",
",",
"t1",
",",
"z",
",",
"ai",
";",
"ai",
"=",
"1.0",
"/",
"a",
";",
... | Power series for incomplete beta integral. Use when b*x is small and x not too close to 1.
@param a Value.
@param b Value.
@param x Value.
@return Result. | [
"Power",
"series",
"for",
"incomplete",
"beta",
"integral",
".",
"Use",
"when",
"b",
"*",
"x",
"is",
"small",
"and",
"x",
"not",
"too",
"close",
"to",
"1",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Beta.java#L345-L376 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/tsdb/model/ValueFilter.java | ValueFilter.createValueFilter | public static ValueFilter createValueFilter(String operation, String value) {
checkArgument(STRING_SUPPORTED_OPERATION.contains(operation), "String value only support operations in "
+ STRING_SUPPORTED_OPERATION.toString());
ValueFilter valueFilter = new ValueFilter(operation, SINGLE_QUOTATION + value + SINGLE_QUOTATION);
return valueFilter;
} | java | public static ValueFilter createValueFilter(String operation, String value) {
checkArgument(STRING_SUPPORTED_OPERATION.contains(operation), "String value only support operations in "
+ STRING_SUPPORTED_OPERATION.toString());
ValueFilter valueFilter = new ValueFilter(operation, SINGLE_QUOTATION + value + SINGLE_QUOTATION);
return valueFilter;
} | [
"public",
"static",
"ValueFilter",
"createValueFilter",
"(",
"String",
"operation",
",",
"String",
"value",
")",
"{",
"checkArgument",
"(",
"STRING_SUPPORTED_OPERATION",
".",
"contains",
"(",
"operation",
")",
",",
"\"String value only support operations in \"",
"+",
"S... | Create value filter for String type.
@param operation Operation for comparing which only support =, !=, >, <, >= and <=.
@param value Value for comparing with.
@return ValueFilter | [
"Create",
"value",
"filter",
"for",
"String",
"type",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/ValueFilter.java#L79-L84 |
calimero-project/calimero-core | src/tuwien/auto/calimero/knxnetip/util/CRI.java | CRI.createRequest | public static CRI createRequest(final byte[] data, final int offset) throws KNXFormatException
{
return (CRI) create(true, data, offset);
} | java | public static CRI createRequest(final byte[] data, final int offset) throws KNXFormatException
{
return (CRI) create(true, data, offset);
} | [
"public",
"static",
"CRI",
"createRequest",
"(",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"int",
"offset",
")",
"throws",
"KNXFormatException",
"{",
"return",
"(",
"CRI",
")",
"create",
"(",
"true",
",",
"data",
",",
"offset",
")",
";",
"}"
] | Creates a new CRI out of a byte array.
<p>
If possible, a matching, more specific, CRI subtype is returned. Note, that CRIs
for specific communication types might expect certain characteristics on
<code>data</code> (regarding contained data).<br>
@param data byte array containing the CRI structure
@param offset start offset of CRI in <code>data</code>
@return the new CRI object
@throws KNXFormatException if no CRI found or invalid structure | [
"Creates",
"a",
"new",
"CRI",
"out",
"of",
"a",
"byte",
"array",
".",
"<p",
">",
"If",
"possible",
"a",
"matching",
"more",
"specific",
"CRI",
"subtype",
"is",
"returned",
".",
"Note",
"that",
"CRIs",
"for",
"specific",
"communication",
"types",
"might",
... | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/knxnetip/util/CRI.java#L100-L103 |
talenguyen/PrettySharedPreferences | prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java | PrettySharedPreferences.getIntegerEditor | protected IntegerEditor getIntegerEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new IntegerEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof IntegerEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (IntegerEditor) typeEditor;
} | java | protected IntegerEditor getIntegerEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new IntegerEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof IntegerEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (IntegerEditor) typeEditor;
} | [
"protected",
"IntegerEditor",
"getIntegerEditor",
"(",
"String",
"key",
")",
"{",
"TypeEditor",
"typeEditor",
"=",
"TYPE_EDITOR_MAP",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"typeEditor",
"==",
"null",
")",
"{",
"typeEditor",
"=",
"new",
"IntegerEditor",
... | Call to get a {@link com.tale.prettysharedpreferences.IntegerEditor} object for the specific
key. <code>NOTE:</code> There is a unique {@link com.tale.prettysharedpreferences.TypeEditor}
object for a unique key.
@param key The name of the preference.
@return {@link com.tale.prettysharedpreferences.IntegerEditor} object to be store or retrieve
a {@link java.lang.Integer} value. | [
"Call",
"to",
"get",
"a",
"{",
"@link",
"com",
".",
"tale",
".",
"prettysharedpreferences",
".",
"IntegerEditor",
"}",
"object",
"for",
"the",
"specific",
"key",
".",
"<code",
">",
"NOTE",
":",
"<",
"/",
"code",
">",
"There",
"is",
"a",
"unique",
"{",
... | train | https://github.com/talenguyen/PrettySharedPreferences/blob/b97edf86c8fa65be2165f2cd790545c78c971c22/prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java#L52-L61 |
grails/grails-core | grails-encoder/src/main/groovy/org/grails/encoder/DefaultEncodingStateRegistry.java | DefaultEncodingStateRegistry.shouldEncodeWith | public static boolean shouldEncodeWith(Encoder encoderToApply, EncodingState currentEncodingState) {
if(isNoneEncoder(encoderToApply)) return false;
if (currentEncodingState != null && currentEncodingState.getEncoders() != null) {
for (Encoder encoder : currentEncodingState.getEncoders()) {
if (isPreviousEncoderSafeOrEqual(encoderToApply, encoder)) {
return false;
}
}
}
return true;
} | java | public static boolean shouldEncodeWith(Encoder encoderToApply, EncodingState currentEncodingState) {
if(isNoneEncoder(encoderToApply)) return false;
if (currentEncodingState != null && currentEncodingState.getEncoders() != null) {
for (Encoder encoder : currentEncodingState.getEncoders()) {
if (isPreviousEncoderSafeOrEqual(encoderToApply, encoder)) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"shouldEncodeWith",
"(",
"Encoder",
"encoderToApply",
",",
"EncodingState",
"currentEncodingState",
")",
"{",
"if",
"(",
"isNoneEncoder",
"(",
"encoderToApply",
")",
")",
"return",
"false",
";",
"if",
"(",
"currentEncodingState",
"!=",... | Checks if encoder should be applied to a input with given encoding state
@param encoderToApply
the encoder to apply
@param currentEncodingState
the current encoding state
@return true, if should encode | [
"Checks",
"if",
"encoder",
"should",
"be",
"applied",
"to",
"a",
"input",
"with",
"given",
"encoding",
"state"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-encoder/src/main/groovy/org/grails/encoder/DefaultEncodingStateRegistry.java#L100-L110 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheManagerBuilder.java | CacheManagerBuilder.withDefaultSizeOfMaxObjectSize | public CacheManagerBuilder<T> withDefaultSizeOfMaxObjectSize(long size, MemoryUnit unit) {
DefaultSizeOfEngineProviderConfiguration configuration = configBuilder.findServiceByClass(DefaultSizeOfEngineProviderConfiguration.class);
if (configuration == null) {
return new CacheManagerBuilder<>(this, configBuilder.addService(new DefaultSizeOfEngineProviderConfiguration(size, unit, DEFAULT_OBJECT_GRAPH_SIZE)));
} else {
ConfigurationBuilder builder = configBuilder.removeService(configuration);
return new CacheManagerBuilder<>(this, builder.addService(new DefaultSizeOfEngineProviderConfiguration(size, unit, configuration
.getMaxObjectGraphSize())));
}
} | java | public CacheManagerBuilder<T> withDefaultSizeOfMaxObjectSize(long size, MemoryUnit unit) {
DefaultSizeOfEngineProviderConfiguration configuration = configBuilder.findServiceByClass(DefaultSizeOfEngineProviderConfiguration.class);
if (configuration == null) {
return new CacheManagerBuilder<>(this, configBuilder.addService(new DefaultSizeOfEngineProviderConfiguration(size, unit, DEFAULT_OBJECT_GRAPH_SIZE)));
} else {
ConfigurationBuilder builder = configBuilder.removeService(configuration);
return new CacheManagerBuilder<>(this, builder.addService(new DefaultSizeOfEngineProviderConfiguration(size, unit, configuration
.getMaxObjectGraphSize())));
}
} | [
"public",
"CacheManagerBuilder",
"<",
"T",
">",
"withDefaultSizeOfMaxObjectSize",
"(",
"long",
"size",
",",
"MemoryUnit",
"unit",
")",
"{",
"DefaultSizeOfEngineProviderConfiguration",
"configuration",
"=",
"configBuilder",
".",
"findServiceByClass",
"(",
"DefaultSizeOfEngin... | Adds a default {@link SizeOfEngine} configuration, that limits the max object size, to
the returned builder.
@param size the max object size
@param unit the max object size unit
@return a new builder with the added configuration | [
"Adds",
"a",
"default",
"{",
"@link",
"SizeOfEngine",
"}",
"configuration",
"that",
"limits",
"the",
"max",
"object",
"size",
"to",
"the",
"returned",
"builder",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheManagerBuilder.java#L265-L274 |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.removeDnsCache | public static void removeDnsCache(String host) {
try {
InetAddressCacheUtil.removeInetAddressCache(host);
} catch (Exception e) {
final String message = String.format("Fail to removeDnsCache for host %s, cause: %s", host, e.toString());
throw new DnsCacheManipulatorException(message, e);
}
} | java | public static void removeDnsCache(String host) {
try {
InetAddressCacheUtil.removeInetAddressCache(host);
} catch (Exception e) {
final String message = String.format("Fail to removeDnsCache for host %s, cause: %s", host, e.toString());
throw new DnsCacheManipulatorException(message, e);
}
} | [
"public",
"static",
"void",
"removeDnsCache",
"(",
"String",
"host",
")",
"{",
"try",
"{",
"InetAddressCacheUtil",
".",
"removeInetAddressCache",
"(",
"host",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"final",
"String",
"message",
"=",
"String... | Remove dns cache entry, cause lookup dns server for host after.
@param host host
@throws DnsCacheManipulatorException Operation fail
@see DnsCacheManipulator#clearDnsCache | [
"Remove",
"dns",
"cache",
"entry",
"cause",
"lookup",
"dns",
"server",
"for",
"host",
"after",
"."
] | train | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L192-L199 |
alkacon/opencms-core | src/org/opencms/workplace/CmsDialog.java | CmsDialog.pageHtml | @Override
public String pageHtml(int segment, String helpUrl) {
return pageHtml(segment, helpUrl, null);
} | java | @Override
public String pageHtml(int segment, String helpUrl) {
return pageHtml(segment, helpUrl, null);
} | [
"@",
"Override",
"public",
"String",
"pageHtml",
"(",
"int",
"segment",
",",
"String",
"helpUrl",
")",
"{",
"return",
"pageHtml",
"(",
"segment",
",",
"helpUrl",
",",
"null",
")",
";",
"}"
] | Builds the start html of the page, including setting of DOCTYPE and
inserting a header with the content-type.<p>
This overloads the default method of the parent class.<p>
@param segment the HTML segment (START / END)
@param helpUrl the url for the online help to include on the page
@return the start html of the page | [
"Builds",
"the",
"start",
"html",
"of",
"the",
"page",
"including",
"setting",
"of",
"DOCTYPE",
"and",
"inserting",
"a",
"header",
"with",
"the",
"content",
"-",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L1458-L1462 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java | DFSAdmin.metaSave | public int metaSave(String[] argv, int idx) throws IOException {
String pathname = argv[idx];
DistributedFileSystem dfs = getDFS();
if (dfs == null) {
System.out.println("FileSystem is " + getFS().getUri());
return -1;
}
dfs.metaSave(pathname);
System.out.println("Created file " + pathname + " on server " +
dfs.getUri());
return 0;
} | java | public int metaSave(String[] argv, int idx) throws IOException {
String pathname = argv[idx];
DistributedFileSystem dfs = getDFS();
if (dfs == null) {
System.out.println("FileSystem is " + getFS().getUri());
return -1;
}
dfs.metaSave(pathname);
System.out.println("Created file " + pathname + " on server " +
dfs.getUri());
return 0;
} | [
"public",
"int",
"metaSave",
"(",
"String",
"[",
"]",
"argv",
",",
"int",
"idx",
")",
"throws",
"IOException",
"{",
"String",
"pathname",
"=",
"argv",
"[",
"idx",
"]",
";",
"DistributedFileSystem",
"dfs",
"=",
"getDFS",
"(",
")",
";",
"if",
"(",
"dfs",... | Dumps DFS data structures into specified file.
Usage: java DFSAdmin -metasave filename
@param argv List of of command line parameters.
@param idx The index of the command that is being processed.
@exception IOException if an error accoured wile accessing
the file or path. | [
"Dumps",
"DFS",
"data",
"structures",
"into",
"specified",
"file",
".",
"Usage",
":",
"java",
"DFSAdmin",
"-",
"metasave",
"filename"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java#L774-L785 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/datavec/iterator/IteratorUtils.java | IteratorUtils.mapRRMDSI | public static JavaRDD<MultiDataSet> mapRRMDSI(JavaRDD<List<Writable>> rdd, RecordReaderMultiDataSetIterator iterator){
checkIterator(iterator, 1, 0);
return mapRRMDSIRecords(rdd.map(new Function<List<Writable>,DataVecRecords>(){
@Override
public DataVecRecords call(List<Writable> v1) throws Exception {
return new DataVecRecords(Collections.singletonList(v1), null);
}
}), iterator);
} | java | public static JavaRDD<MultiDataSet> mapRRMDSI(JavaRDD<List<Writable>> rdd, RecordReaderMultiDataSetIterator iterator){
checkIterator(iterator, 1, 0);
return mapRRMDSIRecords(rdd.map(new Function<List<Writable>,DataVecRecords>(){
@Override
public DataVecRecords call(List<Writable> v1) throws Exception {
return new DataVecRecords(Collections.singletonList(v1), null);
}
}), iterator);
} | [
"public",
"static",
"JavaRDD",
"<",
"MultiDataSet",
">",
"mapRRMDSI",
"(",
"JavaRDD",
"<",
"List",
"<",
"Writable",
">",
">",
"rdd",
",",
"RecordReaderMultiDataSetIterator",
"iterator",
")",
"{",
"checkIterator",
"(",
"iterator",
",",
"1",
",",
"0",
")",
";"... | Apply a single reader {@link RecordReaderMultiDataSetIterator} to a {@code JavaRDD<List<Writable>>}.
<b>NOTE</b>: The RecordReaderMultiDataSetIterator <it>must</it> use {@link SparkSourceDummyReader} in place of
"real" RecordReader instances
@param rdd RDD with writables
@param iterator RecordReaderMultiDataSetIterator with {@link SparkSourceDummyReader} readers | [
"Apply",
"a",
"single",
"reader",
"{",
"@link",
"RecordReaderMultiDataSetIterator",
"}",
"to",
"a",
"{",
"@code",
"JavaRDD<List<Writable",
">>",
"}",
".",
"<b",
">",
"NOTE<",
"/",
"b",
">",
":",
"The",
"RecordReaderMultiDataSetIterator",
"<it",
">",
"must<",
"... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/datavec/iterator/IteratorUtils.java#L48-L56 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notContain | public static String notContain(String textToSearch, String substring) throws IllegalArgumentException {
return notContain(textToSearch, substring, "[Assertion failed] - this String argument must not contain the substring [{}]", substring);
} | java | public static String notContain(String textToSearch, String substring) throws IllegalArgumentException {
return notContain(textToSearch, substring, "[Assertion failed] - this String argument must not contain the substring [{}]", substring);
} | [
"public",
"static",
"String",
"notContain",
"(",
"String",
"textToSearch",
",",
"String",
"substring",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"notContain",
"(",
"textToSearch",
",",
"substring",
",",
"\"[Assertion failed] - this String argument must not c... | 断言给定字符串是否不被另一个字符串包含(既是否为子串)
<pre class="code">
Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");
</pre>
@param textToSearch 被搜索的字符串
@param substring 被检查的子串
@return 被检查的子串
@throws IllegalArgumentException 非子串抛出异常 | [
"断言给定字符串是否不被另一个字符串包含(既是否为子串)"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L261-L263 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java | WebhooksInner.beginCreate | public WebhookInner beginCreate(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).toBlocking().single().body();
} | java | public WebhookInner beginCreate(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).toBlocking().single().body();
} | [
"public",
"WebhookInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"webhookName",
",",
"WebhookCreateParameters",
"webhookCreateParameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupN... | Creates a webhook for a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param webhookName The name of the webhook.
@param webhookCreateParameters The parameters for creating a webhook.
@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 WebhookInner object if successful. | [
"Creates",
"a",
"webhook",
"for",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L307-L309 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.encryptBcd | public String encryptBcd(String data, KeyType keyType, Charset charset) {
return BCD.bcdToStr(encrypt(data, charset, keyType));
} | java | public String encryptBcd(String data, KeyType keyType, Charset charset) {
return BCD.bcdToStr(encrypt(data, charset, keyType));
} | [
"public",
"String",
"encryptBcd",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
",",
"Charset",
"charset",
")",
"{",
"return",
"BCD",
".",
"bcdToStr",
"(",
"encrypt",
"(",
"data",
",",
"charset",
",",
"keyType",
")",
")",
";",
"}"
] | 分组加密
@param data 数据
@param keyType 密钥类型
@param charset 加密前编码
@return 加密后的密文
@throws CryptoException 加密异常
@since 4.1.0 | [
"分组加密"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L212-L214 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java | TrueTypeFontUnicode.setCharAdvance | public boolean setCharAdvance(int c, int advance) {
int[] m = getMetricsTT(c);
if (m == null)
return false;
m[1] = advance;
return true;
} | java | public boolean setCharAdvance(int c, int advance) {
int[] m = getMetricsTT(c);
if (m == null)
return false;
m[1] = advance;
return true;
} | [
"public",
"boolean",
"setCharAdvance",
"(",
"int",
"c",
",",
"int",
"advance",
")",
"{",
"int",
"[",
"]",
"m",
"=",
"getMetricsTT",
"(",
"c",
")",
";",
"if",
"(",
"m",
"==",
"null",
")",
"return",
"false",
";",
"m",
"[",
"1",
"]",
"=",
"advance",... | Sets the character advance.
@param c the character
@param advance the character advance normalized to 1000 units
@return <CODE>true</CODE> if the advance was set,
<CODE>false</CODE> otherwise | [
"Sets",
"the",
"character",
"advance",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java#L535-L541 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.insertOrUpdate | public int insertOrUpdate(Entity record, String... keys) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.insertOrUpdate(conn, record, keys);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | java | public int insertOrUpdate(Entity record, String... keys) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.insertOrUpdate(conn, record, keys);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | [
"public",
"int",
"insertOrUpdate",
"(",
"Entity",
"record",
",",
"String",
"...",
"keys",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"this",
".",
"getConnection",
"(",
")",
";",
"return",
"runner",
... | 插入或更新数据<br>
根据给定的字段名查询数据,如果存在则更新这些数据,否则执行插入
@param record 记录
@param keys 需要检查唯一性的字段
@return 插入行数
@throws SQLException SQL执行异常
@since 4.0.10 | [
"插入或更新数据<br",
">",
"根据给定的字段名查询数据,如果存在则更新这些数据,否则执行插入"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L268-L278 |
JavaMoney/jsr354-ri | moneta-convert/moneta-convert-ecb/src/main/java/org/javamoney/moneta/convert/ecb/ECBRateReadingHandler.java | ECBRateReadingHandler.addRate | void addRate(CurrencyUnit term, LocalDate localDate, Number rate) {
RateType rateType = RateType.HISTORIC;
ExchangeRateBuilder builder;
if (Objects.nonNull(localDate)) {
// TODO check/test!
if (localDate.equals(LocalDate.now())) {
rateType = RateType.DEFERRED;
}
builder = new ExchangeRateBuilder(
ConversionContextBuilder.create(context, rateType).set(localDate).build());
} else {
builder = new ExchangeRateBuilder(ConversionContextBuilder.create(context, rateType).build());
}
builder.setBase(ECBHistoricRateProvider.BASE_CURRENCY);
builder.setTerm(term);
builder.setFactor(DefaultNumberValue.of(rate));
ExchangeRate exchangeRate = builder.build();
Map<String, ExchangeRate> rateMap = this.historicRates.get(localDate);
if (Objects.isNull(rateMap)) {
synchronized (this.historicRates) {
rateMap = Optional.ofNullable(this.historicRates.get(localDate)).orElse(new ConcurrentHashMap<>());
this.historicRates.putIfAbsent(localDate, rateMap);
}
}
rateMap.put(term.getCurrencyCode(), exchangeRate);
} | java | void addRate(CurrencyUnit term, LocalDate localDate, Number rate) {
RateType rateType = RateType.HISTORIC;
ExchangeRateBuilder builder;
if (Objects.nonNull(localDate)) {
// TODO check/test!
if (localDate.equals(LocalDate.now())) {
rateType = RateType.DEFERRED;
}
builder = new ExchangeRateBuilder(
ConversionContextBuilder.create(context, rateType).set(localDate).build());
} else {
builder = new ExchangeRateBuilder(ConversionContextBuilder.create(context, rateType).build());
}
builder.setBase(ECBHistoricRateProvider.BASE_CURRENCY);
builder.setTerm(term);
builder.setFactor(DefaultNumberValue.of(rate));
ExchangeRate exchangeRate = builder.build();
Map<String, ExchangeRate> rateMap = this.historicRates.get(localDate);
if (Objects.isNull(rateMap)) {
synchronized (this.historicRates) {
rateMap = Optional.ofNullable(this.historicRates.get(localDate)).orElse(new ConcurrentHashMap<>());
this.historicRates.putIfAbsent(localDate, rateMap);
}
}
rateMap.put(term.getCurrencyCode(), exchangeRate);
} | [
"void",
"addRate",
"(",
"CurrencyUnit",
"term",
",",
"LocalDate",
"localDate",
",",
"Number",
"rate",
")",
"{",
"RateType",
"rateType",
"=",
"RateType",
".",
"HISTORIC",
";",
"ExchangeRateBuilder",
"builder",
";",
"if",
"(",
"Objects",
".",
"nonNull",
"(",
"... | Method to add a currency exchange rate.
@param term the term (target) currency, mapped from EUR.
@param rate The rate. | [
"Method",
"to",
"add",
"a",
"currency",
"exchange",
"rate",
"."
] | train | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-convert/moneta-convert-ecb/src/main/java/org/javamoney/moneta/convert/ecb/ECBRateReadingHandler.java#L100-L126 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java | ThreadEx.setAttribute | public void setAttribute(String name, Object value) {
synchronized (attribute) {
attribute.put(name, value);
}
} | java | public void setAttribute(String name, Object value) {
synchronized (attribute) {
attribute.put(name, value);
}
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"synchronized",
"(",
"attribute",
")",
"{",
"attribute",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}",
"}"
] | Sets the named attribute to the specified value.
@param name Name of the attribute.
@param value Value to associate with the attribute. | [
"Sets",
"the",
"named",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java#L216-L220 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java | PAbstractObject.optInt | @Override
public final Integer optInt(final String key, final Integer defaultValue) {
Integer result = optInt(key);
return result == null ? defaultValue : result;
} | java | @Override
public final Integer optInt(final String key, final Integer defaultValue) {
Integer result = optInt(key);
return result == null ? defaultValue : result;
} | [
"@",
"Override",
"public",
"final",
"Integer",
"optInt",
"(",
"final",
"String",
"key",
",",
"final",
"Integer",
"defaultValue",
")",
"{",
"Integer",
"result",
"=",
"optInt",
"(",
"key",
")",
";",
"return",
"result",
"==",
"null",
"?",
"defaultValue",
":",... | Get a property as an int or default value.
@param key the property name
@param defaultValue the default value | [
"Get",
"a",
"property",
"as",
"an",
"int",
"or",
"default",
"value",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L65-L69 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getPublicMethod | public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException {
return ReflectUtil.getPublicMethod(clazz, methodName, paramTypes);
} | java | public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException {
return ReflectUtil.getPublicMethod(clazz, methodName, paramTypes);
} | [
"public",
"static",
"Method",
"getPublicMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"paramTypes",
")",
"throws",
"SecurityException",
"{",
"return",
"ReflectUtil",
".",
"getPublicMethod",
"(",... | 查找指定Public方法 如果找不到对应的方法或方法不为public的则返回<code>null</code>
@param clazz 类
@param methodName 方法名
@param paramTypes 参数类型
@return 方法
@throws SecurityException 无权访问抛出异常 | [
"查找指定Public方法",
"如果找不到对应的方法或方法不为public的则返回<code",
">",
"null<",
"/",
"code",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L294-L296 |
Netflix/ribbon | ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java | DefaultClientConfigImpl.loadProperties | @Override
public void loadProperties(String restClientName){
enableDynamicProperties = true;
setClientName(restClientName);
loadDefaultValues();
Configuration props = ConfigurationManager.getConfigInstance().subset(restClientName);
for (Iterator<String> keys = props.getKeys(); keys.hasNext(); ){
String key = keys.next();
String prop = key;
try {
if (prop.startsWith(getNameSpace())){
prop = prop.substring(getNameSpace().length() + 1);
}
setPropertyInternal(prop, getStringValue(props, key));
} catch (Exception ex) {
throw new RuntimeException(String.format("Property %s is invalid", prop));
}
}
} | java | @Override
public void loadProperties(String restClientName){
enableDynamicProperties = true;
setClientName(restClientName);
loadDefaultValues();
Configuration props = ConfigurationManager.getConfigInstance().subset(restClientName);
for (Iterator<String> keys = props.getKeys(); keys.hasNext(); ){
String key = keys.next();
String prop = key;
try {
if (prop.startsWith(getNameSpace())){
prop = prop.substring(getNameSpace().length() + 1);
}
setPropertyInternal(prop, getStringValue(props, key));
} catch (Exception ex) {
throw new RuntimeException(String.format("Property %s is invalid", prop));
}
}
} | [
"@",
"Override",
"public",
"void",
"loadProperties",
"(",
"String",
"restClientName",
")",
"{",
"enableDynamicProperties",
"=",
"true",
";",
"setClientName",
"(",
"restClientName",
")",
";",
"loadDefaultValues",
"(",
")",
";",
"Configuration",
"props",
"=",
"Confi... | Load properties for a given client. It first loads the default values for all properties,
and any properties already defined with Archaius ConfigurationManager. | [
"Load",
"properties",
"for",
"a",
"given",
"client",
".",
"It",
"first",
"loads",
"the",
"default",
"values",
"for",
"all",
"properties",
"and",
"any",
"properties",
"already",
"defined",
"with",
"Archaius",
"ConfigurationManager",
"."
] | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java#L625-L643 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java | SimpleDocTreeVisitor.visitUnknownInlineTag | @Override
public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) {
return defaultAction(node, p);
} | java | @Override
public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) {
return defaultAction(node, p);
} | [
"@",
"Override",
"public",
"R",
"visitUnknownInlineTag",
"(",
"UnknownInlineTagTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"node",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"calls",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L441-L444 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/AbstractExtensionDependency.java | AbstractExtensionDependency.setProperties | public void setProperties(Map<String, Object> properties)
{
this.properties.clear();
this.properties.putAll(properties);
} | java | public void setProperties(Map<String, Object> properties)
{
this.properties.clear();
this.properties.putAll(properties);
} | [
"public",
"void",
"setProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"this",
".",
"properties",
".",
"clear",
"(",
")",
";",
"this",
".",
"properties",
".",
"putAll",
"(",
"properties",
")",
";",
"}"
] | Replace existing properties with provided properties.
@param properties the properties | [
"Replace",
"existing",
"properties",
"with",
"provided",
"properties",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/AbstractExtensionDependency.java#L258-L262 |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/subconfigs/ValidatorConfig.java | ValidatorConfig.setWarningLevels | @BQConfigProperty("Specify the levels of specific warnings")
public void setWarningLevels(Map<String, Severity> levels) {
if (levels == null) {
this.warningLevels = new HashMap<>();
} else {
this.warningLevels = levels;
}
} | java | @BQConfigProperty("Specify the levels of specific warnings")
public void setWarningLevels(Map<String, Severity> levels) {
if (levels == null) {
this.warningLevels = new HashMap<>();
} else {
this.warningLevels = levels;
}
} | [
"@",
"BQConfigProperty",
"(",
"\"Specify the levels of specific warnings\"",
")",
"public",
"void",
"setWarningLevels",
"(",
"Map",
"<",
"String",
",",
"Severity",
">",
"levels",
")",
"{",
"if",
"(",
"levels",
"==",
"null",
")",
"{",
"this",
".",
"warningLevels"... | Change the specific warning levels.
@param levels the warnings levels. | [
"Change",
"the",
"specific",
"warning",
"levels",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/subconfigs/ValidatorConfig.java#L90-L97 |
apereo/cas | support/cas-server-support-saml-mdui/src/main/java/org/apereo/cas/support/saml/mdui/web/flow/SamlMetadataUIParserAction.java | SamlMetadataUIParserAction.getRegisteredServiceFromRequest | protected RegisteredService getRegisteredServiceFromRequest(final RequestContext requestContext, final String entityId) {
val currentService = WebUtils.getService(requestContext);
val service = this.serviceFactory.createService(entityId);
var registeredService = this.servicesManager.findServiceBy(service);
if (registeredService == null) {
LOGGER.debug("Entity id [{}] not found in the registry. Fallback onto [{}]", entityId, currentService);
registeredService = this.servicesManager.findServiceBy(currentService);
}
LOGGER.debug("Located service definition [{}]", registeredService);
return registeredService;
} | java | protected RegisteredService getRegisteredServiceFromRequest(final RequestContext requestContext, final String entityId) {
val currentService = WebUtils.getService(requestContext);
val service = this.serviceFactory.createService(entityId);
var registeredService = this.servicesManager.findServiceBy(service);
if (registeredService == null) {
LOGGER.debug("Entity id [{}] not found in the registry. Fallback onto [{}]", entityId, currentService);
registeredService = this.servicesManager.findServiceBy(currentService);
}
LOGGER.debug("Located service definition [{}]", registeredService);
return registeredService;
} | [
"protected",
"RegisteredService",
"getRegisteredServiceFromRequest",
"(",
"final",
"RequestContext",
"requestContext",
",",
"final",
"String",
"entityId",
")",
"{",
"val",
"currentService",
"=",
"WebUtils",
".",
"getService",
"(",
"requestContext",
")",
";",
"val",
"s... | Gets registered service from request.
@param requestContext the request context
@param entityId the entity id
@return the registered service from request | [
"Gets",
"registered",
"service",
"from",
"request",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-mdui/src/main/java/org/apereo/cas/support/saml/mdui/web/flow/SamlMetadataUIParserAction.java#L106-L116 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFormulaConfig.java | CollisionFormulaConfig.createCollision | public static CollisionFormula createCollision(Xml node)
{
Check.notNull(node);
final String name = node.readString(ATT_NAME);
final CollisionRange range = CollisionRangeConfig.imports(node.getChild(CollisionRangeConfig.NODE_RANGE));
final CollisionFunction function = CollisionFunctionConfig.imports(node);
final CollisionConstraint constraint = CollisionConstraintConfig.imports(node);
return new CollisionFormula(name, range, function, constraint);
} | java | public static CollisionFormula createCollision(Xml node)
{
Check.notNull(node);
final String name = node.readString(ATT_NAME);
final CollisionRange range = CollisionRangeConfig.imports(node.getChild(CollisionRangeConfig.NODE_RANGE));
final CollisionFunction function = CollisionFunctionConfig.imports(node);
final CollisionConstraint constraint = CollisionConstraintConfig.imports(node);
return new CollisionFormula(name, range, function, constraint);
} | [
"public",
"static",
"CollisionFormula",
"createCollision",
"(",
"Xml",
"node",
")",
"{",
"Check",
".",
"notNull",
"(",
"node",
")",
";",
"final",
"String",
"name",
"=",
"node",
".",
"readString",
"(",
"ATT_NAME",
")",
";",
"final",
"CollisionRange",
"range",... | Create a collision formula from its node.
@param node The collision formula node (must not be <code>null</code>).
@return The tile collision formula instance.
@throws LionEngineException If error when reading data. | [
"Create",
"a",
"collision",
"formula",
"from",
"its",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFormulaConfig.java#L98-L108 |
konmik/solid | collections/src/main/java/solid/collectors/ToSolidMap.java | ToSolidMap.toSolidMap | public static <T, K> Func1<Iterable<T>, SolidMap<K, T>> toSolidMap(final Func1<T, K> keyExtractor) {
return toSolidMap(keyExtractor, new Func1<T, T>() {
@Override
public T call(T value) {
return value;
}
});
} | java | public static <T, K> Func1<Iterable<T>, SolidMap<K, T>> toSolidMap(final Func1<T, K> keyExtractor) {
return toSolidMap(keyExtractor, new Func1<T, T>() {
@Override
public T call(T value) {
return value;
}
});
} | [
"public",
"static",
"<",
"T",
",",
"K",
">",
"Func1",
"<",
"Iterable",
"<",
"T",
">",
",",
"SolidMap",
"<",
"K",
",",
"T",
">",
">",
"toSolidMap",
"(",
"final",
"Func1",
"<",
"T",
",",
"K",
">",
"keyExtractor",
")",
"{",
"return",
"toSolidMap",
"... | Returns a function that converts a stream into {@link SolidMap} using a given key extractor method. | [
"Returns",
"a",
"function",
"that",
"converts",
"a",
"stream",
"into",
"{"
] | train | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/collections/src/main/java/solid/collectors/ToSolidMap.java#L34-L41 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java | ServiceBuilder.withDataLogFactory | public ServiceBuilder withDataLogFactory(Function<ComponentSetup, DurableDataLogFactory> dataLogFactoryCreator) {
Preconditions.checkNotNull(dataLogFactoryCreator, "dataLogFactoryCreator");
this.dataLogFactoryCreator = dataLogFactoryCreator;
return this;
} | java | public ServiceBuilder withDataLogFactory(Function<ComponentSetup, DurableDataLogFactory> dataLogFactoryCreator) {
Preconditions.checkNotNull(dataLogFactoryCreator, "dataLogFactoryCreator");
this.dataLogFactoryCreator = dataLogFactoryCreator;
return this;
} | [
"public",
"ServiceBuilder",
"withDataLogFactory",
"(",
"Function",
"<",
"ComponentSetup",
",",
"DurableDataLogFactory",
">",
"dataLogFactoryCreator",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"dataLogFactoryCreator",
",",
"\"dataLogFactoryCreator\"",
")",
";",
... | Attaches the given DurableDataLogFactory creator to this ServiceBuilder. The given Function will only not be invoked
right away; it will be called when needed.
@param dataLogFactoryCreator The Function to attach.
@return This ServiceBuilder. | [
"Attaches",
"the",
"given",
"DurableDataLogFactory",
"creator",
"to",
"this",
"ServiceBuilder",
".",
"The",
"given",
"Function",
"will",
"only",
"not",
"be",
"invoked",
"right",
"away",
";",
"it",
"will",
"be",
"called",
"when",
"needed",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java#L170-L174 |
skuzzle/jeve | jeve/src/main/java/de/skuzzle/jeve/providers/EventStackImpl.java | EventStackImpl.popEvent | public <L extends Listener> void popEvent(Event<?, L> expected) {
synchronized (this.stack) {
final Event<?, ?> actual = this.stack.pop();
if (actual != expected) {
throw new IllegalStateException(String.format(
"Unbalanced pop: expected '%s' but encountered '%s'",
expected.getListenerClass(), actual));
}
}
} | java | public <L extends Listener> void popEvent(Event<?, L> expected) {
synchronized (this.stack) {
final Event<?, ?> actual = this.stack.pop();
if (actual != expected) {
throw new IllegalStateException(String.format(
"Unbalanced pop: expected '%s' but encountered '%s'",
expected.getListenerClass(), actual));
}
}
} | [
"public",
"<",
"L",
"extends",
"Listener",
">",
"void",
"popEvent",
"(",
"Event",
"<",
"?",
",",
"L",
">",
"expected",
")",
"{",
"synchronized",
"(",
"this",
".",
"stack",
")",
"{",
"final",
"Event",
"<",
"?",
",",
"?",
">",
"actual",
"=",
"this",
... | Pops the top event off the current event stack. This action has to be
performed immediately after the event has been dispatched to all
listeners.
@param <L> Type of the listener.
@param expected The Event which is expected at the top of the stack.
@see #pushEvent(Event) | [
"Pops",
"the",
"top",
"event",
"off",
"the",
"current",
"event",
"stack",
".",
"This",
"action",
"has",
"to",
"be",
"performed",
"immediately",
"after",
"the",
"event",
"has",
"been",
"dispatched",
"to",
"all",
"listeners",
"."
] | train | https://github.com/skuzzle/jeve/blob/42cc18947c9c8596c34410336e4e375e9fcd7c47/jeve/src/main/java/de/skuzzle/jeve/providers/EventStackImpl.java#L114-L123 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/randomizers/text/StringRandomizer.java | StringRandomizer.aNewStringRandomizer | public static StringRandomizer aNewStringRandomizer(final int minLength, final int maxLength, final long seed) {
if (minLength > maxLength) {
throw new IllegalArgumentException("minLength should be less than or equal to maxLength");
}
return new StringRandomizer(minLength, maxLength, seed);
} | java | public static StringRandomizer aNewStringRandomizer(final int minLength, final int maxLength, final long seed) {
if (minLength > maxLength) {
throw new IllegalArgumentException("minLength should be less than or equal to maxLength");
}
return new StringRandomizer(minLength, maxLength, seed);
} | [
"public",
"static",
"StringRandomizer",
"aNewStringRandomizer",
"(",
"final",
"int",
"minLength",
",",
"final",
"int",
"maxLength",
",",
"final",
"long",
"seed",
")",
"{",
"if",
"(",
"minLength",
">",
"maxLength",
")",
"{",
"throw",
"new",
"IllegalArgumentExcept... | Create a new {@link StringRandomizer}.
@param maxLength of the String to generate
@param minLength of the String to generate
@param seed initial seed
@return a new {@link StringRandomizer}. | [
"Create",
"a",
"new",
"{",
"@link",
"StringRandomizer",
"}",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/text/StringRandomizer.java#L218-L223 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/KeyPointsCircleRegularGrid.java | KeyPointsCircleRegularGrid.addTangents | private boolean addTangents(Grid grid, int rowA, int colA, int rowB, int colB) {
EllipseRotated_F64 a = grid.get(rowA,colA);
EllipseRotated_F64 b = grid.get(rowB,colB);
if( !tangentFinder.process(a,b, A0, A1, A2, A3, B0, B1, B2, B3) ) {
return false;
}
Tangents ta = tangents.get(grid.getIndexOfRegEllipse(rowA,colA));
Tangents tb = tangents.get(grid.getIndexOfRegEllipse(rowB,colB));
// Which point is 0 or 3 is not defined and can swap arbitrarily. To fix this problem
// 0 will be defined as on the 'positive side' of the line connecting the ellipse centers
double slopeX = b.center.x-a.center.x;
double slopeY = b.center.y-a.center.y;
double dx0 = A0.x-a.center.x;
double dy0 = A0.y-a.center.y;
double z = slopeX*dy0 - slopeY*dx0;
if( z < 0 == (rowA == rowB)) {
Point2D_F64 tmp = A0; A0 = A3; A3 = tmp;
tmp = B0; B0 = B3; B3 = tmp;
}
// add tangent points from the two lines which do not cross the center line
if( rowA == rowB ) {
ta.t[ta.countT++].set(A0);
ta.b[ta.countB++].set(A3);
tb.t[tb.countT++].set(B0);
tb.b[tb.countB++].set(B3);
} else {
ta.r[ta.countL++].set(A0);
ta.l[ta.countR++].set(A3);
tb.r[tb.countL++].set(B0);
tb.l[tb.countR++].set(B3);
}
return true;
} | java | private boolean addTangents(Grid grid, int rowA, int colA, int rowB, int colB) {
EllipseRotated_F64 a = grid.get(rowA,colA);
EllipseRotated_F64 b = grid.get(rowB,colB);
if( !tangentFinder.process(a,b, A0, A1, A2, A3, B0, B1, B2, B3) ) {
return false;
}
Tangents ta = tangents.get(grid.getIndexOfRegEllipse(rowA,colA));
Tangents tb = tangents.get(grid.getIndexOfRegEllipse(rowB,colB));
// Which point is 0 or 3 is not defined and can swap arbitrarily. To fix this problem
// 0 will be defined as on the 'positive side' of the line connecting the ellipse centers
double slopeX = b.center.x-a.center.x;
double slopeY = b.center.y-a.center.y;
double dx0 = A0.x-a.center.x;
double dy0 = A0.y-a.center.y;
double z = slopeX*dy0 - slopeY*dx0;
if( z < 0 == (rowA == rowB)) {
Point2D_F64 tmp = A0; A0 = A3; A3 = tmp;
tmp = B0; B0 = B3; B3 = tmp;
}
// add tangent points from the two lines which do not cross the center line
if( rowA == rowB ) {
ta.t[ta.countT++].set(A0);
ta.b[ta.countB++].set(A3);
tb.t[tb.countT++].set(B0);
tb.b[tb.countB++].set(B3);
} else {
ta.r[ta.countL++].set(A0);
ta.l[ta.countR++].set(A3);
tb.r[tb.countL++].set(B0);
tb.l[tb.countR++].set(B3);
}
return true;
} | [
"private",
"boolean",
"addTangents",
"(",
"Grid",
"grid",
",",
"int",
"rowA",
",",
"int",
"colA",
",",
"int",
"rowB",
",",
"int",
"colB",
")",
"{",
"EllipseRotated_F64",
"a",
"=",
"grid",
".",
"get",
"(",
"rowA",
",",
"colA",
")",
";",
"EllipseRotated_... | Computes tangent points to the two ellipses specified by the grid coordinates | [
"Computes",
"tangent",
"points",
"to",
"the",
"two",
"ellipses",
"specified",
"by",
"the",
"grid",
"coordinates"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/KeyPointsCircleRegularGrid.java#L117-L155 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/helper/CheckPointHelper.java | CheckPointHelper.replaceExceptionCallback | public CheckPointHelper replaceExceptionCallback(BasicCheckRule checkRule, ValidationInvalidCallback cb) {
this.msgChecker.replaceCallback(checkRule, cb);
return this;
} | java | public CheckPointHelper replaceExceptionCallback(BasicCheckRule checkRule, ValidationInvalidCallback cb) {
this.msgChecker.replaceCallback(checkRule, cb);
return this;
} | [
"public",
"CheckPointHelper",
"replaceExceptionCallback",
"(",
"BasicCheckRule",
"checkRule",
",",
"ValidationInvalidCallback",
"cb",
")",
"{",
"this",
".",
"msgChecker",
".",
"replaceCallback",
"(",
"checkRule",
",",
"cb",
")",
";",
"return",
"this",
";",
"}"
] | Replace the callback to be used basic exception.
@param checkRule basic rule type ex,, BasicCheckRule.Mandatory
@param cb callback class with implement ValidationInvalidCallback
@return CheckPointHeler check point helper | [
"Replace",
"the",
"callback",
"to",
"be",
"used",
"basic",
"exception",
"."
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/helper/CheckPointHelper.java#L49-L52 |
koendeschacht/bow-utils | src/main/java/be/bagofwords/util/SerializationUtils.java | SerializationUtils.writeObject | public static void writeObject(Object object, OutputStream outputStream) {
try {
if (object instanceof Compactable) {
((Compactable) object).compact();
}
defaultObjectMapper.writeValue(outputStream, object);
} catch (IOException exp) {
throw new RuntimeException("Failed to write object to outputstream", exp);
}
} | java | public static void writeObject(Object object, OutputStream outputStream) {
try {
if (object instanceof Compactable) {
((Compactable) object).compact();
}
defaultObjectMapper.writeValue(outputStream, object);
} catch (IOException exp) {
throw new RuntimeException("Failed to write object to outputstream", exp);
}
} | [
"public",
"static",
"void",
"writeObject",
"(",
"Object",
"object",
",",
"OutputStream",
"outputStream",
")",
"{",
"try",
"{",
"if",
"(",
"object",
"instanceof",
"Compactable",
")",
"{",
"(",
"(",
"Compactable",
")",
"object",
")",
".",
"compact",
"(",
")"... | Careful! Not compatible with above method to convert objects to byte arrays! | [
"Careful!",
"Not",
"compatible",
"with",
"above",
"method",
"to",
"convert",
"objects",
"to",
"byte",
"arrays!"
] | train | https://github.com/koendeschacht/bow-utils/blob/f599da17cb7a40b8ffc5610a9761fa922e99d7cb/src/main/java/be/bagofwords/util/SerializationUtils.java#L352-L361 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.containsEntryFor | public boolean containsEntryFor(int maturityInMonths, int tenorInMonths, int moneynessBP) {
return entryMap.containsKey(new DataKey(maturityInMonths, tenorInMonths, moneynessBP));
} | java | public boolean containsEntryFor(int maturityInMonths, int tenorInMonths, int moneynessBP) {
return entryMap.containsKey(new DataKey(maturityInMonths, tenorInMonths, moneynessBP));
} | [
"public",
"boolean",
"containsEntryFor",
"(",
"int",
"maturityInMonths",
",",
"int",
"tenorInMonths",
",",
"int",
"moneynessBP",
")",
"{",
"return",
"entryMap",
".",
"containsKey",
"(",
"new",
"DataKey",
"(",
"maturityInMonths",
",",
"tenorInMonths",
",",
"moneyne... | Returns true if the lattice contains an entry at the specified location.
@param maturityInMonths The maturity in months to check.
@param tenorInMonths The tenor in months to check.
@param moneynessBP The moneyness in bp to check.
@return True iff there is an entry at the specified location. | [
"Returns",
"true",
"if",
"the",
"lattice",
"contains",
"an",
"entry",
"at",
"the",
"specified",
"location",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L547-L549 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F2.applyOrElse | public R applyOrElse(P1 p1, P2 p2, F2<? super P1, ? super P2, ? extends R> fallback) {
try {
return apply(p1, p2);
} catch (RuntimeException e) {
return fallback.apply(p1, p2);
}
} | java | public R applyOrElse(P1 p1, P2 p2, F2<? super P1, ? super P2, ? extends R> fallback) {
try {
return apply(p1, p2);
} catch (RuntimeException e) {
return fallback.apply(p1, p2);
}
} | [
"public",
"R",
"applyOrElse",
"(",
"P1",
"p1",
",",
"P2",
"p2",
",",
"F2",
"<",
"?",
"super",
"P1",
",",
"?",
"super",
"P2",
",",
"?",
"extends",
"R",
">",
"fallback",
")",
"{",
"try",
"{",
"return",
"apply",
"(",
"p1",
",",
"p2",
")",
";",
"... | Applies this partial function to the given argument when it is contained in the function domain.
Applies fallback function where this partial function is not defined.
@param p1
the first param with type P1
@param p2
the second param with type P2
@param fallback
the function to be called when an {@link RuntimeException} caught
@return the result of this function or the fallback function application | [
"Applies",
"this",
"partial",
"function",
"to",
"the",
"given",
"argument",
"when",
"it",
"is",
"contained",
"in",
"the",
"function",
"domain",
".",
"Applies",
"fallback",
"function",
"where",
"this",
"partial",
"function",
"is",
"not",
"defined",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L945-L951 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/maven2/MavenDependenciesRecorder.java | MavenDependenciesRecorder.postBuild | @Override
public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener)
throws InterruptedException, IOException {
build.executeAsync(new BuildCallable<Void, IOException>() {
// record is transient, so needs to make a copy first
private final Set<MavenDependency> d = dependencies;
public Void call(MavenBuild build) throws IOException, InterruptedException {
// add the action
//TODO: [by yl] These actions are persisted into the build.xml of each build run - we need another
//context to store these actions
build.getActions().add(new MavenDependenciesRecord(build, d));
return null;
}
});
return true;
} | java | @Override
public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener)
throws InterruptedException, IOException {
build.executeAsync(new BuildCallable<Void, IOException>() {
// record is transient, so needs to make a copy first
private final Set<MavenDependency> d = dependencies;
public Void call(MavenBuild build) throws IOException, InterruptedException {
// add the action
//TODO: [by yl] These actions are persisted into the build.xml of each build run - we need another
//context to store these actions
build.getActions().add(new MavenDependenciesRecord(build, d));
return null;
}
});
return true;
} | [
"@",
"Override",
"public",
"boolean",
"postBuild",
"(",
"MavenBuildProxy",
"build",
",",
"MavenProject",
"pom",
",",
"BuildListener",
"listener",
")",
"throws",
"InterruptedException",
",",
"IOException",
"{",
"build",
".",
"executeAsync",
"(",
"new",
"BuildCallable... | Sends the collected dependencies over to the master and record them. | [
"Sends",
"the",
"collected",
"dependencies",
"over",
"to",
"the",
"master",
"and",
"record",
"them",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/maven2/MavenDependenciesRecorder.java#L66-L82 |
google/closure-compiler | src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java | FixedPointGraphTraversal.computeFixedPoint | public void computeFixedPoint(DiGraph<N, E> graph) {
Set<N> nodes = new LinkedHashSet<>();
for (DiGraphNode<N, E> node : graph.getDirectedGraphNodes()) {
nodes.add(node.getValue());
}
computeFixedPoint(graph, nodes);
} | java | public void computeFixedPoint(DiGraph<N, E> graph) {
Set<N> nodes = new LinkedHashSet<>();
for (DiGraphNode<N, E> node : graph.getDirectedGraphNodes()) {
nodes.add(node.getValue());
}
computeFixedPoint(graph, nodes);
} | [
"public",
"void",
"computeFixedPoint",
"(",
"DiGraph",
"<",
"N",
",",
"E",
">",
"graph",
")",
"{",
"Set",
"<",
"N",
">",
"nodes",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"DiGraphNode",
"<",
"N",
",",
"E",
">",
"node",
":",
"... | Compute a fixed point for the given graph.
@param graph The graph to traverse. | [
"Compute",
"a",
"fixed",
"point",
"for",
"the",
"given",
"graph",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java#L67-L73 |
lessthanoptimal/ddogleg | src/org/ddogleg/solver/impl/FindRealRootsSturm.java | FindRealRootsSturm.bisectionRoot | private void bisectionRoot( double l , double u , int index ) {
// use bisection until there is an estimate within tolerance
int iter = 0;
while( u-l > boundTolerance*Math.abs(l) && iter++ < maxBoundIterations) {
double m = (l+u)/2.0;
int numRoots = sturm.countRealRoots(m,u);
if( numRoots == 1 ) {
l = m;
} else {
// In systems where some coefficients are close to zero the Sturm sequence starts to yield erratic results.
// In this case, certain basic assumptions are broken and a garbage solution is returned. The EVD method
// still seems to yield a solution in these cases. Maybe a different formulation would improve its numerical
// stability? The problem seems to lie with polynomial division by very small coefficients
// if( sturm.countRealRoots(l,m) != 1 ) {
// throw new RuntimeException("Oh Crap");
// }
u = m;
}
}
// assign the root to the mid point between the bounds
roots[index] = (l+u)/2.0;
} | java | private void bisectionRoot( double l , double u , int index ) {
// use bisection until there is an estimate within tolerance
int iter = 0;
while( u-l > boundTolerance*Math.abs(l) && iter++ < maxBoundIterations) {
double m = (l+u)/2.0;
int numRoots = sturm.countRealRoots(m,u);
if( numRoots == 1 ) {
l = m;
} else {
// In systems where some coefficients are close to zero the Sturm sequence starts to yield erratic results.
// In this case, certain basic assumptions are broken and a garbage solution is returned. The EVD method
// still seems to yield a solution in these cases. Maybe a different formulation would improve its numerical
// stability? The problem seems to lie with polynomial division by very small coefficients
// if( sturm.countRealRoots(l,m) != 1 ) {
// throw new RuntimeException("Oh Crap");
// }
u = m;
}
}
// assign the root to the mid point between the bounds
roots[index] = (l+u)/2.0;
} | [
"private",
"void",
"bisectionRoot",
"(",
"double",
"l",
",",
"double",
"u",
",",
"int",
"index",
")",
"{",
"// use bisection until there is an estimate within tolerance",
"int",
"iter",
"=",
"0",
";",
"while",
"(",
"u",
"-",
"l",
">",
"boundTolerance",
"*",
"M... | Searches for a single real root inside the range. Only one root is assumed to be inside
@param l lower value of search range
@param u upper value of search range
@param index | [
"Searches",
"for",
"a",
"single",
"real",
"root",
"inside",
"the",
"range",
".",
"Only",
"one",
"root",
"is",
"assumed",
"to",
"be",
"inside"
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/impl/FindRealRootsSturm.java#L204-L226 |
netplex/json-smart-v2 | json-smart/src/main/java/net/minidev/json/JSONNavi.java | JSONNavi.set | public JSONNavi<T> set(String key, int value) {
return set(key, Integer.valueOf(value));
} | java | public JSONNavi<T> set(String key, int value) {
return set(key, Integer.valueOf(value));
} | [
"public",
"JSONNavi",
"<",
"T",
">",
"set",
"(",
"String",
"key",
",",
"int",
"value",
")",
"{",
"return",
"set",
"(",
"key",
",",
"Integer",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] | write an value in the current object
@param key
key to access
@param value
new value
@return this | [
"write",
"an",
"value",
"in",
"the",
"current",
"object"
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/JSONNavi.java#L252-L254 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java | DateTimeFormatter.formatTo | public void formatTo(TemporalAccessor temporal, Appendable appendable) {
Objects.requireNonNull(temporal, "temporal");
Objects.requireNonNull(appendable, "appendable");
try {
DateTimePrintContext context = new DateTimePrintContext(temporal, this);
if (appendable instanceof StringBuilder) {
printerParser.format(context, (StringBuilder) appendable);
} else {
// buffer output to avoid writing to appendable in case of error
StringBuilder buf = new StringBuilder(32);
printerParser.format(context, buf);
appendable.append(buf);
}
} catch (IOException ex) {
throw new DateTimeException(ex.getMessage(), ex);
}
} | java | public void formatTo(TemporalAccessor temporal, Appendable appendable) {
Objects.requireNonNull(temporal, "temporal");
Objects.requireNonNull(appendable, "appendable");
try {
DateTimePrintContext context = new DateTimePrintContext(temporal, this);
if (appendable instanceof StringBuilder) {
printerParser.format(context, (StringBuilder) appendable);
} else {
// buffer output to avoid writing to appendable in case of error
StringBuilder buf = new StringBuilder(32);
printerParser.format(context, buf);
appendable.append(buf);
}
} catch (IOException ex) {
throw new DateTimeException(ex.getMessage(), ex);
}
} | [
"public",
"void",
"formatTo",
"(",
"TemporalAccessor",
"temporal",
",",
"Appendable",
"appendable",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"temporal",
",",
"\"temporal\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"appendable",
",",
"\"appendable\... | Formats a date-time object to an {@code Appendable} using this formatter.
<p>
This outputs the formatted date-time to the specified destination.
{@link Appendable} is a general purpose interface that is implemented by all
key character output classes including {@code StringBuffer}, {@code StringBuilder},
{@code PrintStream} and {@code Writer}.
<p>
Although {@code Appendable} methods throw an {@code IOException}, this method does not.
Instead, any {@code IOException} is wrapped in a runtime exception.
@param temporal the temporal object to format, not null
@param appendable the appendable to format to, not null
@throws DateTimeException if an error occurs during formatting | [
"Formats",
"a",
"date",
"-",
"time",
"object",
"to",
"an",
"{",
"@code",
"Appendable",
"}",
"using",
"this",
"formatter",
".",
"<p",
">",
"This",
"outputs",
"the",
"formatted",
"date",
"-",
"time",
"to",
"the",
"specified",
"destination",
".",
"{",
"@lin... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L1740-L1756 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java | JPAIssues.visitClassContext | @Override
public void visitClassContext(ClassContext clsContext) {
try {
cls = clsContext.getJavaClass();
catalogClass(cls);
if (isEntity) {
if (hasHCEquals && hasId && hasGeneratedValue) {
bugReporter.reportBug(new BugInstance(this, BugType.JPAI_HC_EQUALS_ON_MANAGED_ENTITY.name(), LOW_PRIORITY).addClass(cls));
}
if (hasEagerOneToMany && !hasFetch) {
bugReporter.reportBug(new BugInstance(this, BugType.JPAI_INEFFICIENT_EAGER_FETCH.name(), LOW_PRIORITY).addClass(cls));
}
}
if (!transactionalMethods.isEmpty()) {
stack = new OpcodeStack();
super.visitClassContext(clsContext);
}
} finally {
transactionalMethods = null;
stack = null;
}
} | java | @Override
public void visitClassContext(ClassContext clsContext) {
try {
cls = clsContext.getJavaClass();
catalogClass(cls);
if (isEntity) {
if (hasHCEquals && hasId && hasGeneratedValue) {
bugReporter.reportBug(new BugInstance(this, BugType.JPAI_HC_EQUALS_ON_MANAGED_ENTITY.name(), LOW_PRIORITY).addClass(cls));
}
if (hasEagerOneToMany && !hasFetch) {
bugReporter.reportBug(new BugInstance(this, BugType.JPAI_INEFFICIENT_EAGER_FETCH.name(), LOW_PRIORITY).addClass(cls));
}
}
if (!transactionalMethods.isEmpty()) {
stack = new OpcodeStack();
super.visitClassContext(clsContext);
}
} finally {
transactionalMethods = null;
stack = null;
}
} | [
"@",
"Override",
"public",
"void",
"visitClassContext",
"(",
"ClassContext",
"clsContext",
")",
"{",
"try",
"{",
"cls",
"=",
"clsContext",
".",
"getJavaClass",
"(",
")",
";",
"catalogClass",
"(",
"cls",
")",
";",
"if",
"(",
"isEntity",
")",
"{",
"if",
"(... | implements the visitor to find @Entity classes that have both generated @Ids and have implemented hashCode/equals. Also looks for eager one to many join
fetches as that leads to 1+n queries.
@param clsContext
the context object of the currently parsed class | [
"implements",
"the",
"visitor",
"to",
"find",
"@Entity",
"classes",
"that",
"have",
"both",
"generated",
"@Ids",
"and",
"have",
"implemented",
"hashCode",
"/",
"equals",
".",
"Also",
"looks",
"for",
"eager",
"one",
"to",
"many",
"join",
"fetches",
"as",
"tha... | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java#L122-L145 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemElement.java | ElemElement.callChildVisitors | protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
{
if(callAttrs)
{
if(null != m_name_avt)
m_name_avt.callVisitors(visitor);
if(null != m_namespace_avt)
m_namespace_avt.callVisitors(visitor);
}
super.callChildVisitors(visitor, callAttrs);
} | java | protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
{
if(callAttrs)
{
if(null != m_name_avt)
m_name_avt.callVisitors(visitor);
if(null != m_namespace_avt)
m_namespace_avt.callVisitors(visitor);
}
super.callChildVisitors(visitor, callAttrs);
} | [
"protected",
"void",
"callChildVisitors",
"(",
"XSLTVisitor",
"visitor",
",",
"boolean",
"callAttrs",
")",
"{",
"if",
"(",
"callAttrs",
")",
"{",
"if",
"(",
"null",
"!=",
"m_name_avt",
")",
"m_name_avt",
".",
"callVisitors",
"(",
"visitor",
")",
";",
"if",
... | Call the children visitors.
@param visitor The visitor whose appropriate method will be called. | [
"Call",
"the",
"children",
"visitors",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemElement.java#L358-L370 |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java | Utils.tryAccessibilityAnnounce | public static void tryAccessibilityAnnounce(View view, CharSequence text) {
if (view != null && text != null) {
view.announceForAccessibility(text);
}
} | java | public static void tryAccessibilityAnnounce(View view, CharSequence text) {
if (view != null && text != null) {
view.announceForAccessibility(text);
}
} | [
"public",
"static",
"void",
"tryAccessibilityAnnounce",
"(",
"View",
"view",
",",
"CharSequence",
"text",
")",
"{",
"if",
"(",
"view",
"!=",
"null",
"&&",
"text",
"!=",
"null",
")",
"{",
"view",
".",
"announceForAccessibility",
"(",
"text",
")",
";",
"}",
... | Try to speak the specified text, for accessibility. Only available on JB or later.
@param text Text to announce. | [
"Try",
"to",
"speak",
"the",
"specified",
"text",
"for",
"accessibility",
".",
"Only",
"available",
"on",
"JB",
"or",
"later",
"."
] | train | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java#L53-L57 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java | Interceptors.doPreIntercept | public static void doPreIntercept( InterceptorContext context, List/*< Interceptor >*/ interceptors )
throws InterceptorException
{
if ( interceptors != null )
{
PreInvokeInterceptorChain chain = new PreInvokeInterceptorChain( context, interceptors );
chain.continueChain();
}
} | java | public static void doPreIntercept( InterceptorContext context, List/*< Interceptor >*/ interceptors )
throws InterceptorException
{
if ( interceptors != null )
{
PreInvokeInterceptorChain chain = new PreInvokeInterceptorChain( context, interceptors );
chain.continueChain();
}
} | [
"public",
"static",
"void",
"doPreIntercept",
"(",
"InterceptorContext",
"context",
",",
"List",
"/*< Interceptor >*/",
"interceptors",
")",
"throws",
"InterceptorException",
"{",
"if",
"(",
"interceptors",
"!=",
"null",
")",
"{",
"PreInvokeInterceptorChain",
"chain",
... | Execute a "pre" interceptor chain. This will execute the
{@link Interceptor#preInvoke(InterceptorContext, InterceptorChain)}
method to be invoked on each interceptor in a chain.
@param context the context for a set of interceptors
@param interceptors the list of interceptors
@throws InterceptorException | [
"Execute",
"a",
"pre",
"interceptor",
"chain",
".",
"This",
"will",
"execute",
"the",
"{",
"@link",
"Interceptor#preInvoke",
"(",
"InterceptorContext",
"InterceptorChain",
")",
"}",
"method",
"to",
"be",
"invoked",
"on",
"each",
"interceptor",
"in",
"a",
"chain"... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java#L40-L48 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201808/labelservice/CreateLabels.java | CreateLabels.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the LabelService.
LabelServiceInterface labelService =
adManagerServices.get(session, LabelServiceInterface.class);
// Create a competitive exclusion label.
Label competitiveExclusionLabel = new Label();
competitiveExclusionLabel.setName(
"Car company label #" + new Random().nextInt(Integer.MAX_VALUE));
competitiveExclusionLabel.setTypes(new LabelType[] {LabelType.COMPETITIVE_EXCLUSION});
// Create an ad unit frequency cap label.
Label adUnitFrequencyCapLabel = new Label();
adUnitFrequencyCapLabel.setName(
"Don't run too often label #" + new Random().nextInt(Integer.MAX_VALUE));
adUnitFrequencyCapLabel.setTypes(new LabelType[] {LabelType.AD_UNIT_FREQUENCY_CAP});
// Create the labels on the server.
Label[] labels =
labelService.createLabels(new Label[] {competitiveExclusionLabel, adUnitFrequencyCapLabel});
for (Label createdLabel : labels) {
System.out.printf("A label with ID %d and name '%s' was created.%n",
createdLabel.getId(), createdLabel.getName());
}
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the LabelService.
LabelServiceInterface labelService =
adManagerServices.get(session, LabelServiceInterface.class);
// Create a competitive exclusion label.
Label competitiveExclusionLabel = new Label();
competitiveExclusionLabel.setName(
"Car company label #" + new Random().nextInt(Integer.MAX_VALUE));
competitiveExclusionLabel.setTypes(new LabelType[] {LabelType.COMPETITIVE_EXCLUSION});
// Create an ad unit frequency cap label.
Label adUnitFrequencyCapLabel = new Label();
adUnitFrequencyCapLabel.setName(
"Don't run too often label #" + new Random().nextInt(Integer.MAX_VALUE));
adUnitFrequencyCapLabel.setTypes(new LabelType[] {LabelType.AD_UNIT_FREQUENCY_CAP});
// Create the labels on the server.
Label[] labels =
labelService.createLabels(new Label[] {competitiveExclusionLabel, adUnitFrequencyCapLabel});
for (Label createdLabel : labels) {
System.out.printf("A label with ID %d and name '%s' was created.%n",
createdLabel.getId(), createdLabel.getName());
}
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the LabelService.",
"LabelServiceInterface",
"labelService",
"=",
"adManagerServices",
".",
"get",
"("... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/labelservice/CreateLabels.java#L52-L78 |
google/closure-templates | java/src/com/google/template/soy/passes/StrictDepsPass.java | StrictDepsPass.checkBasicCall | private void checkBasicCall(CallBasicNode node, TemplateRegistry registry) {
TemplateMetadata callee = registry.getBasicTemplateOrElement(node.getCalleeName());
if (callee == null) {
String extraErrorMessage =
SoyErrors.getDidYouMeanMessage(
registry.getBasicTemplateOrElementNames(), node.getCalleeName());
errorReporter.report(
node.getSourceLocation(),
CALL_TO_UNDEFINED_TEMPLATE,
node.getCalleeName(),
extraErrorMessage);
} else {
SoyFileKind calleeKind = callee.getSoyFileKind();
String callerFilePath = node.getSourceLocation().getFilePath();
String calleeFilePath = callee.getSourceLocation().getFilePath();
if (calleeKind == SoyFileKind.INDIRECT_DEP) {
errorReporter.report(
node.getSourceLocation(),
CALL_TO_INDIRECT_DEPENDENCY,
calleeFilePath);
}
}
} | java | private void checkBasicCall(CallBasicNode node, TemplateRegistry registry) {
TemplateMetadata callee = registry.getBasicTemplateOrElement(node.getCalleeName());
if (callee == null) {
String extraErrorMessage =
SoyErrors.getDidYouMeanMessage(
registry.getBasicTemplateOrElementNames(), node.getCalleeName());
errorReporter.report(
node.getSourceLocation(),
CALL_TO_UNDEFINED_TEMPLATE,
node.getCalleeName(),
extraErrorMessage);
} else {
SoyFileKind calleeKind = callee.getSoyFileKind();
String callerFilePath = node.getSourceLocation().getFilePath();
String calleeFilePath = callee.getSourceLocation().getFilePath();
if (calleeKind == SoyFileKind.INDIRECT_DEP) {
errorReporter.report(
node.getSourceLocation(),
CALL_TO_INDIRECT_DEPENDENCY,
calleeFilePath);
}
}
} | [
"private",
"void",
"checkBasicCall",
"(",
"CallBasicNode",
"node",
",",
"TemplateRegistry",
"registry",
")",
"{",
"TemplateMetadata",
"callee",
"=",
"registry",
".",
"getBasicTemplateOrElement",
"(",
"node",
".",
"getCalleeName",
"(",
")",
")",
";",
"if",
"(",
"... | in a different part of the dependency graph (if it's late-bound). | [
"in",
"a",
"different",
"part",
"of",
"the",
"dependency",
"graph",
"(",
"if",
"it",
"s",
"late",
"-",
"bound",
")",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/StrictDepsPass.java#L66-L89 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/Circles.java | Circles.isInside | public static boolean isInside(Circle c1, Circle c2)
{
return distanceFromCenter(c1, c2.getX(), c2.getY())+c2.getRadius() < c1.getRadius();
} | java | public static boolean isInside(Circle c1, Circle c2)
{
return distanceFromCenter(c1, c2.getX(), c2.getY())+c2.getRadius() < c1.getRadius();
} | [
"public",
"static",
"boolean",
"isInside",
"(",
"Circle",
"c1",
",",
"Circle",
"c2",
")",
"{",
"return",
"distanceFromCenter",
"(",
"c1",
",",
"c2",
".",
"getX",
"(",
")",
",",
"c2",
".",
"getY",
"(",
")",
")",
"+",
"c2",
".",
"getRadius",
"(",
")"... | Returns true if c2 is inside of c1
@param c1
@param c2
@return | [
"Returns",
"true",
"if",
"c2",
"is",
"inside",
"of",
"c1"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Circles.java#L60-L63 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPDefinitionOptionRelWrapper.java | CPDefinitionOptionRelWrapper.getName | @Override
public String getName(String languageId, boolean useDefault) {
return _cpDefinitionOptionRel.getName(languageId, useDefault);
} | java | @Override
public String getName(String languageId, boolean useDefault) {
return _cpDefinitionOptionRel.getName(languageId, useDefault);
} | [
"@",
"Override",
"public",
"String",
"getName",
"(",
"String",
"languageId",
",",
"boolean",
"useDefault",
")",
"{",
"return",
"_cpDefinitionOptionRel",
".",
"getName",
"(",
"languageId",
",",
"useDefault",
")",
";",
"}"
] | Returns the localized name of this cp definition option rel in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@param useDefault whether to use the default language if no localization exists for the requested language
@return the localized name of this cp definition option rel | [
"Returns",
"the",
"localized",
"name",
"of",
"this",
"cp",
"definition",
"option",
"rel",
"in",
"the",
"language",
"optionally",
"using",
"the",
"default",
"language",
"if",
"no",
"localization",
"exists",
"for",
"the",
"requested",
"language",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPDefinitionOptionRelWrapper.java#L451-L454 |
davidmarquis/fluent-interface-proxy | src/main/java/com/fluentinterface/beans/ObjectWrapper.java | ObjectWrapper.setIndexedValue | public void setIndexedValue(String propertyName, int index, Object value) {
setIndexedValue(object, getPropertyOrThrow(bean, propertyName), index, value, this);
} | java | public void setIndexedValue(String propertyName, int index, Object value) {
setIndexedValue(object, getPropertyOrThrow(bean, propertyName), index, value, this);
} | [
"public",
"void",
"setIndexedValue",
"(",
"String",
"propertyName",
",",
"int",
"index",
",",
"Object",
"value",
")",
"{",
"setIndexedValue",
"(",
"object",
",",
"getPropertyOrThrow",
"(",
"bean",
",",
"propertyName",
")",
",",
"index",
",",
"value",
",",
"t... | Sets the value of the specified indexed property in the wrapped object.
@param propertyName the name of the indexed property whose value is to be updated, cannot be {@code null}
@param index the index position of the property value to be set
@param value the indexed value to set, can be {@code null}
@throws ReflectionException if a reflection error occurs
@throws IllegalArgumentException if the propertyName parameter is {@code null}
@throws IllegalArgumentException if the indexed object in the wrapped object is not a {@link List} or {@code array} type
@throws IndexOutOfBoundsException if the indexed object in the wrapped object is out of bounds with the given index and autogrowing is disabled
@throws NullPointerException if the indexed object in the wrapped object is {@code null}
@throws NullPointerException if the indexed object in the wrapped object is out of bounds with the given index, but autogrowing (if enabled) is unable to fill the blank positions with {@code null}
@throws NullPointerException if the wrapped object does not have a property with the given name | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"indexed",
"property",
"in",
"the",
"wrapped",
"object",
"."
] | train | https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/ObjectWrapper.java#L343-L345 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/server/support/EmbeddedSolrServerFactory.java | EmbeddedSolrServerFactory.createCoreContainer | private CoreContainer createCoreContainer(String solrHomeDirectory, File solrXmlFile) {
Method createAndLoadMethod = ClassUtils.getStaticMethod(CoreContainer.class, "createAndLoad", String.class,
File.class);
if (createAndLoadMethod != null) {
return (CoreContainer) ReflectionUtils.invokeMethod(createAndLoadMethod, null, solrHomeDirectory, solrXmlFile);
}
createAndLoadMethod = ClassUtils.getStaticMethod(CoreContainer.class, "createAndLoad", Path.class, Path.class);
return (CoreContainer) ReflectionUtils.invokeMethod(createAndLoadMethod, null,
FileSystems.getDefault().getPath(solrHomeDirectory), FileSystems.getDefault().getPath(solrXmlFile.getPath()));
} | java | private CoreContainer createCoreContainer(String solrHomeDirectory, File solrXmlFile) {
Method createAndLoadMethod = ClassUtils.getStaticMethod(CoreContainer.class, "createAndLoad", String.class,
File.class);
if (createAndLoadMethod != null) {
return (CoreContainer) ReflectionUtils.invokeMethod(createAndLoadMethod, null, solrHomeDirectory, solrXmlFile);
}
createAndLoadMethod = ClassUtils.getStaticMethod(CoreContainer.class, "createAndLoad", Path.class, Path.class);
return (CoreContainer) ReflectionUtils.invokeMethod(createAndLoadMethod, null,
FileSystems.getDefault().getPath(solrHomeDirectory), FileSystems.getDefault().getPath(solrXmlFile.getPath()));
} | [
"private",
"CoreContainer",
"createCoreContainer",
"(",
"String",
"solrHomeDirectory",
",",
"File",
"solrXmlFile",
")",
"{",
"Method",
"createAndLoadMethod",
"=",
"ClassUtils",
".",
"getStaticMethod",
"(",
"CoreContainer",
".",
"class",
",",
"\"createAndLoad\"",
",",
... | Create {@link CoreContainer} for Solr version 4.4+ and handle changes in .
@param solrHomeDirectory
@param solrXmlFile
@return | [
"Create",
"{",
"@link",
"CoreContainer",
"}",
"for",
"Solr",
"version",
"4",
".",
"4",
"+",
"and",
"handle",
"changes",
"in",
"."
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/server/support/EmbeddedSolrServerFactory.java#L140-L152 |
Jasig/uPortal | uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java | PropertiesManager.getPropertyAsByte | public static byte getPropertyAsByte(String name)
throws MissingPropertyException, BadPropertyException {
if (PropertiesManager.props == null) loadProps();
try {
return Byte.parseByte(getProperty(name));
} catch (NumberFormatException nfe) {
throw new BadPropertyException(name, getProperty(name), "byte");
}
} | java | public static byte getPropertyAsByte(String name)
throws MissingPropertyException, BadPropertyException {
if (PropertiesManager.props == null) loadProps();
try {
return Byte.parseByte(getProperty(name));
} catch (NumberFormatException nfe) {
throw new BadPropertyException(name, getProperty(name), "byte");
}
} | [
"public",
"static",
"byte",
"getPropertyAsByte",
"(",
"String",
"name",
")",
"throws",
"MissingPropertyException",
",",
"BadPropertyException",
"{",
"if",
"(",
"PropertiesManager",
".",
"props",
"==",
"null",
")",
"loadProps",
"(",
")",
";",
"try",
"{",
"return"... | Returns the value of a property for a given name as a <code>byte</code>
@param name the name of the requested property
@return value the property's value as a <code>byte</code>
@throws MissingPropertyException - if the property is not set
@throws BadPropertyException - if the property cannot be parsed as a byte | [
"Returns",
"the",
"value",
"of",
"a",
"property",
"for",
"a",
"given",
"name",
"as",
"a",
"<code",
">",
"byte<",
"/",
"code",
">"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java#L201-L209 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java | ScriptingUtils.getObjectInstanceFromGroovyResource | public static <T> T getObjectInstanceFromGroovyResource(final Resource resource,
final Class<T> expectedType) {
return getObjectInstanceFromGroovyResource(resource, ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.EMPTY_OBJECT_ARRAY, expectedType);
} | java | public static <T> T getObjectInstanceFromGroovyResource(final Resource resource,
final Class<T> expectedType) {
return getObjectInstanceFromGroovyResource(resource, ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.EMPTY_OBJECT_ARRAY, expectedType);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getObjectInstanceFromGroovyResource",
"(",
"final",
"Resource",
"resource",
",",
"final",
"Class",
"<",
"T",
">",
"expectedType",
")",
"{",
"return",
"getObjectInstanceFromGroovyResource",
"(",
"resource",
",",
"ArrayUtils",
... | Gets object instance from groovy resource.
@param <T> the type parameter
@param resource the resource
@param expectedType the expected type
@return the object instance from groovy resource | [
"Gets",
"object",
"instance",
"from",
"groovy",
"resource",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java#L408-L411 |
sporniket/core | sporniket-core-io/src/main/java/com/sporniket/libre/io/parser/properties/LineByLinePropertyParser.java | LineByLinePropertyParser.fireMultipleLinePropertyParsedEvent | private void fireMultipleLinePropertyParsedEvent(String name, String[] value)
{
MultipleLinePropertyParsedEvent _event = new MultipleLinePropertyParsedEvent(name, value);
for (PropertiesParsingListener _listener : getListeners())
{
_listener.onMultipleLinePropertyParsed(_event);
}
} | java | private void fireMultipleLinePropertyParsedEvent(String name, String[] value)
{
MultipleLinePropertyParsedEvent _event = new MultipleLinePropertyParsedEvent(name, value);
for (PropertiesParsingListener _listener : getListeners())
{
_listener.onMultipleLinePropertyParsed(_event);
}
} | [
"private",
"void",
"fireMultipleLinePropertyParsedEvent",
"(",
"String",
"name",
",",
"String",
"[",
"]",
"value",
")",
"{",
"MultipleLinePropertyParsedEvent",
"_event",
"=",
"new",
"MultipleLinePropertyParsedEvent",
"(",
"name",
",",
"value",
")",
";",
"for",
"(",
... | Notify listeners that a multiple line property has been parsed.
@param name
property name.
@param value
property value. | [
"Notify",
"listeners",
"that",
"a",
"multiple",
"line",
"property",
"has",
"been",
"parsed",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-io/src/main/java/com/sporniket/libre/io/parser/properties/LineByLinePropertyParser.java#L553-L560 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConfigs.java | RpcConfigs.subscribe | public static synchronized void subscribe(String key, RpcConfigListener listener) {
List<RpcConfigListener> listeners = CFG_LISTENER.get(key);
if (listeners == null) {
listeners = new ArrayList<RpcConfigListener>();
CFG_LISTENER.put(key, listeners);
}
listeners.add(listener);
} | java | public static synchronized void subscribe(String key, RpcConfigListener listener) {
List<RpcConfigListener> listeners = CFG_LISTENER.get(key);
if (listeners == null) {
listeners = new ArrayList<RpcConfigListener>();
CFG_LISTENER.put(key, listeners);
}
listeners.add(listener);
} | [
"public",
"static",
"synchronized",
"void",
"subscribe",
"(",
"String",
"key",
",",
"RpcConfigListener",
"listener",
")",
"{",
"List",
"<",
"RpcConfigListener",
">",
"listeners",
"=",
"CFG_LISTENER",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"listeners",
... | 订阅配置变化
@param key 关键字
@param listener 配置监听器
@see RpcOptions | [
"订阅配置变化"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConfigs.java#L316-L323 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java | ConnectionMonitorsInner.beginStart | public void beginStart(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
beginStartWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).toBlocking().single().body();
} | java | public void beginStart(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
beginStartWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).toBlocking().single().body();
} | [
"public",
"void",
"beginStart",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"String",
"connectionMonitorName",
")",
"{",
"beginStartWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkWatcherName",
",",
"connectionMonitorName",
... | Starts the specified connection monitor.
@param resourceGroupName The name of the resource group containing Network Watcher.
@param networkWatcherName The name of the Network Watcher resource.
@param connectionMonitorName The name of the connection monitor.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Starts",
"the",
"specified",
"connection",
"monitor",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java#L794-L796 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.getLimit | protected int getLimit(int field, int limitType) {
switch (field) {
case DAY_OF_WEEK:
case AM_PM:
case HOUR:
case HOUR_OF_DAY:
case MINUTE:
case SECOND:
case MILLISECOND:
case ZONE_OFFSET:
case DST_OFFSET:
case DOW_LOCAL:
case JULIAN_DAY:
case MILLISECONDS_IN_DAY:
case IS_LEAP_MONTH:
return LIMITS[field][limitType];
case WEEK_OF_MONTH:
{
int limit;
if (limitType == MINIMUM) {
limit = getMinimalDaysInFirstWeek() == 1 ? 1 : 0;
} else if (limitType == GREATEST_MINIMUM){
limit = 1;
} else {
int minDaysInFirst = getMinimalDaysInFirstWeek();
int daysInMonth = handleGetLimit(DAY_OF_MONTH, limitType);
if (limitType == LEAST_MAXIMUM) {
limit = (daysInMonth + (7 - minDaysInFirst)) / 7;
} else { // limitType == MAXIMUM
limit = (daysInMonth + 6 + (7 - minDaysInFirst)) / 7;
}
}
return limit;
}
}
return handleGetLimit(field, limitType);
} | java | protected int getLimit(int field, int limitType) {
switch (field) {
case DAY_OF_WEEK:
case AM_PM:
case HOUR:
case HOUR_OF_DAY:
case MINUTE:
case SECOND:
case MILLISECOND:
case ZONE_OFFSET:
case DST_OFFSET:
case DOW_LOCAL:
case JULIAN_DAY:
case MILLISECONDS_IN_DAY:
case IS_LEAP_MONTH:
return LIMITS[field][limitType];
case WEEK_OF_MONTH:
{
int limit;
if (limitType == MINIMUM) {
limit = getMinimalDaysInFirstWeek() == 1 ? 1 : 0;
} else if (limitType == GREATEST_MINIMUM){
limit = 1;
} else {
int minDaysInFirst = getMinimalDaysInFirstWeek();
int daysInMonth = handleGetLimit(DAY_OF_MONTH, limitType);
if (limitType == LEAST_MAXIMUM) {
limit = (daysInMonth + (7 - minDaysInFirst)) / 7;
} else { // limitType == MAXIMUM
limit = (daysInMonth + 6 + (7 - minDaysInFirst)) / 7;
}
}
return limit;
}
}
return handleGetLimit(field, limitType);
} | [
"protected",
"int",
"getLimit",
"(",
"int",
"field",
",",
"int",
"limitType",
")",
"{",
"switch",
"(",
"field",
")",
"{",
"case",
"DAY_OF_WEEK",
":",
"case",
"AM_PM",
":",
"case",
"HOUR",
":",
"case",
"HOUR_OF_DAY",
":",
"case",
"MINUTE",
":",
"case",
... | Returns a limit for a field.
@param field the field, from 0..<code>getFieldCount()-1</code>
@param limitType the type specifier for the limit
@see #MINIMUM
@see #GREATEST_MINIMUM
@see #LEAST_MAXIMUM
@see #MAXIMUM | [
"Returns",
"a",
"limit",
"for",
"a",
"field",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L4296-L4334 |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/msgs/AirbornePositionV0Msg.java | AirbornePositionV0Msg.getLocalPosition | public Position getLocalPosition(Position ref) {
if (!horizontal_position_available)
return null;
// latitude zone size
double Dlat = isOddFormat() ? 360.0 / 59.0 : 360.0 / 60.0;
// latitude zone index
double j = Math.floor(ref.getLatitude() / Dlat) + Math.floor(
0.5 + mod(ref.getLatitude(), Dlat) / Dlat - ((double) getCPREncodedLatitude()) / ((double) (1 << 17)));
// decoded position latitude
double Rlat = Dlat * (j + ((double) getCPREncodedLatitude()) / ((double) (1 << 17)));
// longitude zone size
double Dlon = 360.0 / Math.max(1.0, NL(Rlat) - (isOddFormat() ? 1.0 : 0.0));
// longitude zone coordinate
double m = Math.floor(ref.getLongitude() / Dlon) + Math.floor(0.5 + mod(ref.getLongitude(), Dlon) / Dlon
- ((double) getCPREncodedLongitude()) / ((double) (1 << 17)));
// and finally the longitude
double Rlon = Dlon * (m + ((double) getCPREncodedLongitude()) / ((double) (1 << 17)));
Integer alt = this.getAltitude();
return new Position(Rlon, Rlat, alt != null ? alt.doubleValue() : null);
} | java | public Position getLocalPosition(Position ref) {
if (!horizontal_position_available)
return null;
// latitude zone size
double Dlat = isOddFormat() ? 360.0 / 59.0 : 360.0 / 60.0;
// latitude zone index
double j = Math.floor(ref.getLatitude() / Dlat) + Math.floor(
0.5 + mod(ref.getLatitude(), Dlat) / Dlat - ((double) getCPREncodedLatitude()) / ((double) (1 << 17)));
// decoded position latitude
double Rlat = Dlat * (j + ((double) getCPREncodedLatitude()) / ((double) (1 << 17)));
// longitude zone size
double Dlon = 360.0 / Math.max(1.0, NL(Rlat) - (isOddFormat() ? 1.0 : 0.0));
// longitude zone coordinate
double m = Math.floor(ref.getLongitude() / Dlon) + Math.floor(0.5 + mod(ref.getLongitude(), Dlon) / Dlon
- ((double) getCPREncodedLongitude()) / ((double) (1 << 17)));
// and finally the longitude
double Rlon = Dlon * (m + ((double) getCPREncodedLongitude()) / ((double) (1 << 17)));
Integer alt = this.getAltitude();
return new Position(Rlon, Rlat, alt != null ? alt.doubleValue() : null);
} | [
"public",
"Position",
"getLocalPosition",
"(",
"Position",
"ref",
")",
"{",
"if",
"(",
"!",
"horizontal_position_available",
")",
"return",
"null",
";",
"// latitude zone size",
"double",
"Dlat",
"=",
"isOddFormat",
"(",
")",
"?",
"360.0",
"/",
"59.0",
":",
"3... | This method uses a locally unambiguous decoding for airborne position messages. It
uses a reference position known to be within 180NM (= 333.36km) of the true target
airborne position. the reference point may be a previously tracked position that has
been confirmed by global decoding (see getGlobalPosition()).
@param ref reference position
@return decoded position. The positional
accuracy maintained by the Airborne CPR encoding will be approximately 5.1 meters.
Result will be null if message does not contain horizontal position information.
This can also be checked with {@link #hasPosition()}. | [
"This",
"method",
"uses",
"a",
"locally",
"unambiguous",
"decoding",
"for",
"airborne",
"position",
"messages",
".",
"It",
"uses",
"a",
"reference",
"position",
"known",
"to",
"be",
"within",
"180NM",
"(",
"=",
"333",
".",
"36km",
")",
"of",
"the",
"true",... | train | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/msgs/AirbornePositionV0Msg.java#L403-L429 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/ZoneOperationId.java | ZoneOperationId.of | public static ZoneOperationId of(String zone, String operation) {
return new ZoneOperationId(null, zone, operation);
} | java | public static ZoneOperationId of(String zone, String operation) {
return new ZoneOperationId(null, zone, operation);
} | [
"public",
"static",
"ZoneOperationId",
"of",
"(",
"String",
"zone",
",",
"String",
"operation",
")",
"{",
"return",
"new",
"ZoneOperationId",
"(",
"null",
",",
"zone",
",",
"operation",
")",
";",
"}"
] | Returns a zone operation identity given the zone and operation names. | [
"Returns",
"a",
"zone",
"operation",
"identity",
"given",
"the",
"zone",
"and",
"operation",
"names",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/ZoneOperationId.java#L96-L98 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.deleteHierarchicalEntityAsync | public Observable<OperationStatus> deleteHierarchicalEntityAsync(UUID appId, String versionId, UUID hEntityId) {
return deleteHierarchicalEntityWithServiceResponseAsync(appId, versionId, hEntityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> deleteHierarchicalEntityAsync(UUID appId, String versionId, UUID hEntityId) {
return deleteHierarchicalEntityWithServiceResponseAsync(appId, versionId, hEntityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"deleteHierarchicalEntityAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
")",
"{",
"return",
"deleteHierarchicalEntityWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",... | Deletes a hierarchical entity extractor from the application version.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Deletes",
"a",
"hierarchical",
"entity",
"extractor",
"from",
"the",
"application",
"version",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3873-L3880 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/version/Application.java | Application.getApplicationFromJarFile | public static Application getApplicationFromJarFile(final File _jarFile,
final List<String> _classpath)
throws InstallationException
{
try {
final URL url = new URL("jar", null, 0, _jarFile.toURI().toURL().toString() + "!/");
final URL url2 = new URL(url, "/META-INF/efaps/install.xml");
return Application.getApplication(url2, new URL(url2, "../../../"), _classpath);
} catch (final IOException e) {
throw new InstallationException("URL could not be parsed", e);
}
} | java | public static Application getApplicationFromJarFile(final File _jarFile,
final List<String> _classpath)
throws InstallationException
{
try {
final URL url = new URL("jar", null, 0, _jarFile.toURI().toURL().toString() + "!/");
final URL url2 = new URL(url, "/META-INF/efaps/install.xml");
return Application.getApplication(url2, new URL(url2, "../../../"), _classpath);
} catch (final IOException e) {
throw new InstallationException("URL could not be parsed", e);
}
} | [
"public",
"static",
"Application",
"getApplicationFromJarFile",
"(",
"final",
"File",
"_jarFile",
",",
"final",
"List",
"<",
"String",
">",
"_classpath",
")",
"throws",
"InstallationException",
"{",
"try",
"{",
"final",
"URL",
"url",
"=",
"new",
"URL",
"(",
"\... | Returns the application read from given JAR file <code>_jarFile</code>.
@param _jarFile JAR file with the application to install
@param _classpath class path (required to compile)
@return application instance
@throws InstallationException if application could not be fetched from
the JAR file or the version XML file could not be parsed | [
"Returns",
"the",
"application",
"read",
"from",
"given",
"JAR",
"file",
"<code",
">",
"_jarFile<",
"/",
"code",
">",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/version/Application.java#L421-L432 |
wildfly-extras/wildfly-camel | subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java | CamelEndpointDeployerService.deploy | public void deploy(URI uri, EndpointHttpHandler endpointHttpHandler) {
doDeploy(
uri,
servletInstance -> servletInstance.setEndpointHttpHandler(endpointHttpHandler), // plug the endpointHttpHandler into the servlet
deploymentInfo -> {}, // no need to customize the deploymentInfo
deployment -> {} // no need to customize the deployment
);
} | java | public void deploy(URI uri, EndpointHttpHandler endpointHttpHandler) {
doDeploy(
uri,
servletInstance -> servletInstance.setEndpointHttpHandler(endpointHttpHandler), // plug the endpointHttpHandler into the servlet
deploymentInfo -> {}, // no need to customize the deploymentInfo
deployment -> {} // no need to customize the deployment
);
} | [
"public",
"void",
"deploy",
"(",
"URI",
"uri",
",",
"EndpointHttpHandler",
"endpointHttpHandler",
")",
"{",
"doDeploy",
"(",
"uri",
",",
"servletInstance",
"->",
"servletInstance",
".",
"setEndpointHttpHandler",
"(",
"endpointHttpHandler",
")",
",",
"// plug the endpo... | Exposes an HTTP endpoint defined by the given {@link EndpointHttpHandler} under the given {@link URI}'s path.
@param uri determines the path and protocol under which the HTTP endpoint should be exposed
@param endpointHttpHandler an {@link EndpointHttpHandler} to use for handling HTTP requests sent to the given
{@link URI}'s path | [
"Exposes",
"an",
"HTTP",
"endpoint",
"defined",
"by",
"the",
"given",
"{",
"@link",
"EndpointHttpHandler",
"}",
"under",
"the",
"given",
"{",
"@link",
"URI",
"}",
"s",
"path",
"."
] | train | https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java#L424-L431 |
davidmarquis/fluent-interface-proxy | src/main/java/com/fluentinterface/beans/reflect/Property.java | Property.findAccessorField | private static Field findAccessorField(Class<?> type, String name, Class<?> requiredType) {
Class<?> current = type;
while (current != null) {
for (Field field : current.getDeclaredFields()) {
if (field.getName().equals(name)
&& field.getType().equals(requiredType)
&& !isStatic(field)
&& !field.isSynthetic()
&& (!isPrivate(field) || field.getDeclaringClass() == type)) {
return field;
}
}
current = current.getSuperclass();
}
return null;
} | java | private static Field findAccessorField(Class<?> type, String name, Class<?> requiredType) {
Class<?> current = type;
while (current != null) {
for (Field field : current.getDeclaredFields()) {
if (field.getName().equals(name)
&& field.getType().equals(requiredType)
&& !isStatic(field)
&& !field.isSynthetic()
&& (!isPrivate(field) || field.getDeclaringClass() == type)) {
return field;
}
}
current = current.getSuperclass();
}
return null;
} | [
"private",
"static",
"Field",
"findAccessorField",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"requiredType",
")",
"{",
"Class",
"<",
"?",
">",
"current",
"=",
"type",
";",
"while",
"(",
"current",
"!=",
... | Internal: Gets a {@link Field} with any valid modifier, evaluating its hierarchy.
@param type the class from where to search, cannot be null
@param name the name of the field to search, cannot be null
@param requiredType the required type to match, cannot be null
@return the field, if found, else {@code null} | [
"Internal",
":",
"Gets",
"a",
"{",
"@link",
"Field",
"}",
"with",
"any",
"valid",
"modifier",
"evaluating",
"its",
"hierarchy",
"."
] | train | https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/reflect/Property.java#L488-L506 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsFailedToUpgradeFrom | public FessMessages addErrorsFailedToUpgradeFrom(String property, String arg0, String arg1) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_failed_to_upgrade_from, arg0, arg1));
return this;
} | java | public FessMessages addErrorsFailedToUpgradeFrom(String property, String arg0, String arg1) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_failed_to_upgrade_from, arg0, arg1));
return this;
} | [
"public",
"FessMessages",
"addErrorsFailedToUpgradeFrom",
"(",
"String",
"property",
",",
"String",
"arg0",
",",
"String",
"arg1",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_failed_... | Add the created action message for the key 'errors.failed_to_upgrade_from' with parameters.
<pre>
message: Failed to upgrade from {0}: {1}
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@param arg1 The parameter arg1 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"failed_to_upgrade_from",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Failed",
"to",
"upgrade",
"from",
"{",
"0",
"}",
":",
"{",
"1",
"}",
"<",
"/",
"pre",
"... | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1919-L1923 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/AppGameContainer.java | AppGameContainer.setFullscreen | public void setFullscreen(boolean fullscreen) throws SlickException {
if (isFullscreen() == fullscreen) {
return;
}
if (!fullscreen) {
try {
Display.setFullscreen(fullscreen);
} catch (LWJGLException e) {
throw new SlickException("Unable to set fullscreen="+fullscreen, e);
}
} else {
setDisplayMode(width, height, fullscreen);
}
getDelta();
} | java | public void setFullscreen(boolean fullscreen) throws SlickException {
if (isFullscreen() == fullscreen) {
return;
}
if (!fullscreen) {
try {
Display.setFullscreen(fullscreen);
} catch (LWJGLException e) {
throw new SlickException("Unable to set fullscreen="+fullscreen, e);
}
} else {
setDisplayMode(width, height, fullscreen);
}
getDelta();
} | [
"public",
"void",
"setFullscreen",
"(",
"boolean",
"fullscreen",
")",
"throws",
"SlickException",
"{",
"if",
"(",
"isFullscreen",
"(",
")",
"==",
"fullscreen",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"fullscreen",
")",
"{",
"try",
"{",
"Display",
"... | Indicate whether we want to be in fullscreen mode. Note that the current
display mode must be valid as a fullscreen mode for this to work
@param fullscreen True if we want to be in fullscreen mode
@throws SlickException Indicates we failed to change the display mode | [
"Indicate",
"whether",
"we",
"want",
"to",
"be",
"in",
"fullscreen",
"mode",
".",
"Note",
"that",
"the",
"current",
"display",
"mode",
"must",
"be",
"valid",
"as",
"a",
"fullscreen",
"mode",
"for",
"this",
"to",
"work"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/AppGameContainer.java#L186-L201 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.addClass2FacetComponent | public static void addClass2FacetComponent(UIComponent f, String cname, String aclass) {
// If the facet contains only one component, getChildCount()=0 and the
// Facet is the UIComponent
if (f.getClass().getName().endsWith(cname)) {
addClass2Component(f, aclass);
} else {
if (f.getChildCount() > 0) {
for (UIComponent c : f.getChildren()) {
if (c.getClass().getName().endsWith(cname)) {
addClass2Component(c, aclass);
}
}
}
}
} | java | public static void addClass2FacetComponent(UIComponent f, String cname, String aclass) {
// If the facet contains only one component, getChildCount()=0 and the
// Facet is the UIComponent
if (f.getClass().getName().endsWith(cname)) {
addClass2Component(f, aclass);
} else {
if (f.getChildCount() > 0) {
for (UIComponent c : f.getChildren()) {
if (c.getClass().getName().endsWith(cname)) {
addClass2Component(c, aclass);
}
}
}
}
} | [
"public",
"static",
"void",
"addClass2FacetComponent",
"(",
"UIComponent",
"f",
",",
"String",
"cname",
",",
"String",
"aclass",
")",
"{",
"// If the facet contains only one component, getChildCount()=0 and the",
"// Facet is the UIComponent",
"if",
"(",
"f",
".",
"getClass... | Adds a CSS class to a component within a facet.
@param f
the facet
@param cname
the class name of the component to be manipulated.
@param aclass
the CSS class to be added | [
"Adds",
"a",
"CSS",
"class",
"to",
"a",
"component",
"within",
"a",
"facet",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L171-L185 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRange.java | ResidueRange.multiIterator | public static Iterator<ResidueNumber> multiIterator(AtomPositionMap map, List<? extends ResidueRange> rrs) {
ResidueRange[] ranges = new ResidueRange[rrs.size()];
for (int i = 0; i < rrs.size(); i++) {
ranges[i] = rrs.get(i);
}
return multiIterator(map, ranges);
} | java | public static Iterator<ResidueNumber> multiIterator(AtomPositionMap map, List<? extends ResidueRange> rrs) {
ResidueRange[] ranges = new ResidueRange[rrs.size()];
for (int i = 0; i < rrs.size(); i++) {
ranges[i] = rrs.get(i);
}
return multiIterator(map, ranges);
} | [
"public",
"static",
"Iterator",
"<",
"ResidueNumber",
">",
"multiIterator",
"(",
"AtomPositionMap",
"map",
",",
"List",
"<",
"?",
"extends",
"ResidueRange",
">",
"rrs",
")",
"{",
"ResidueRange",
"[",
"]",
"ranges",
"=",
"new",
"ResidueRange",
"[",
"rrs",
"."... | Returns a new Iterator over every {@link ResidueNumber} in the list of ResidueRanges.
Stores the contents of {@code map} until the iterator is finished, so calling code should set the iterator to {@code null} if it did not finish. | [
"Returns",
"a",
"new",
"Iterator",
"over",
"every",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRange.java#L346-L352 |
jnr/jnr-x86asm | src/main/java/jnr/x86asm/Asm.java | Asm.tword_ptr_abs | public static final Mem tword_ptr_abs(long target, long disp, SEGMENT segmentPrefix) {
return _ptr_build_abs(target, disp, segmentPrefix, SIZE_TWORD);
} | java | public static final Mem tword_ptr_abs(long target, long disp, SEGMENT segmentPrefix) {
return _ptr_build_abs(target, disp, segmentPrefix, SIZE_TWORD);
} | [
"public",
"static",
"final",
"Mem",
"tword_ptr_abs",
"(",
"long",
"target",
",",
"long",
"disp",
",",
"SEGMENT",
"segmentPrefix",
")",
"{",
"return",
"_ptr_build_abs",
"(",
"target",
",",
"disp",
",",
"segmentPrefix",
",",
"SIZE_TWORD",
")",
";",
"}"
] | Create tword (10 Bytes) pointer operand (used for 80 bit floating points). | [
"Create",
"tword",
"(",
"10",
"Bytes",
")",
"pointer",
"operand",
"(",
"used",
"for",
"80",
"bit",
"floating",
"points",
")",
"."
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/Asm.java#L421-L423 |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java | StandaloneConfiguration.loadJsonFromResourceOrFile | protected static JsonInput loadJsonFromResourceOrFile(String resource) {
try {
return new Json().newInput(readFileOrResource(resource));
} catch (RuntimeException e) {
throw new GridConfigurationException("Unable to read input", e);
}
} | java | protected static JsonInput loadJsonFromResourceOrFile(String resource) {
try {
return new Json().newInput(readFileOrResource(resource));
} catch (RuntimeException e) {
throw new GridConfigurationException("Unable to read input", e);
}
} | [
"protected",
"static",
"JsonInput",
"loadJsonFromResourceOrFile",
"(",
"String",
"resource",
")",
"{",
"try",
"{",
"return",
"new",
"Json",
"(",
")",
".",
"newInput",
"(",
"readFileOrResource",
"(",
"resource",
")",
")",
";",
"}",
"catch",
"(",
"RuntimeExcepti... | load a JSON file from the resource or file system. As a fallback, treats {@code resource} as a
JSON string to be parsed.
@param resource file or jar resource location
@return A JsonObject representing the passed resource argument. | [
"load",
"a",
"JSON",
"file",
"from",
"the",
"resource",
"or",
"file",
"system",
".",
"As",
"a",
"fallback",
"treats",
"{",
"@code",
"resource",
"}",
"as",
"a",
"JSON",
"string",
"to",
"be",
"parsed",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java#L304-L310 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java | RespokeEndpoint.startCall | public RespokeCall startCall(RespokeCall.Listener callListener, Context context, GLSurfaceView glView, boolean audioOnly) {
RespokeCall call = null;
if ((null != signalingChannel) && (signalingChannel.connected)) {
call = new RespokeCall(signalingChannel, this, false);
call.setListener(callListener);
call.startCall(context, glView, audioOnly);
}
return call;
} | java | public RespokeCall startCall(RespokeCall.Listener callListener, Context context, GLSurfaceView glView, boolean audioOnly) {
RespokeCall call = null;
if ((null != signalingChannel) && (signalingChannel.connected)) {
call = new RespokeCall(signalingChannel, this, false);
call.setListener(callListener);
call.startCall(context, glView, audioOnly);
}
return call;
} | [
"public",
"RespokeCall",
"startCall",
"(",
"RespokeCall",
".",
"Listener",
"callListener",
",",
"Context",
"context",
",",
"GLSurfaceView",
"glView",
",",
"boolean",
"audioOnly",
")",
"{",
"RespokeCall",
"call",
"=",
"null",
";",
"if",
"(",
"(",
"null",
"!=",
... | Create a new call with audio and optionally video.
@param callListener A listener to receive notifications of call related events
@param context An application context with which to access system resources
@param glView A GLSurfaceView into which video from the call should be rendered, or null if the call is audio only
@param audioOnly Specify true for an audio-only call
@return A new RespokeCall instance | [
"Create",
"a",
"new",
"call",
"with",
"audio",
"and",
"optionally",
"video",
"."
] | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java#L145-L156 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/message/analytics/RawAnalyticsRequest.java | RawAnalyticsRequest.jsonQuery | public static RawAnalyticsRequest jsonQuery(String jsonQuery, String bucket, String password) {
return new RawAnalyticsRequest(jsonQuery, bucket, bucket, password, null, GenericAnalyticsRequest.NO_PRIORITY);
} | java | public static RawAnalyticsRequest jsonQuery(String jsonQuery, String bucket, String password) {
return new RawAnalyticsRequest(jsonQuery, bucket, bucket, password, null, GenericAnalyticsRequest.NO_PRIORITY);
} | [
"public",
"static",
"RawAnalyticsRequest",
"jsonQuery",
"(",
"String",
"jsonQuery",
",",
"String",
"bucket",
",",
"String",
"password",
")",
"{",
"return",
"new",
"RawAnalyticsRequest",
"(",
"jsonQuery",
",",
"bucket",
",",
"bucket",
",",
"password",
",",
"null"... | Create a {@link RawAnalyticsRequest} containing a full Analytics query in Json form (including additional
query parameters).
The simplest form of such a query is a single statement encapsulated in a json query object:
<pre>{"statement":"SELECT * FROM default"}</pre>.
@param jsonQuery the Analytics query in json form.
@param bucket the bucket on which to perform the query.
@param password the password for the target bucket.
@return a {@link RawAnalyticsRequest} for this full query. | [
"Create",
"a",
"{",
"@link",
"RawAnalyticsRequest",
"}",
"containing",
"a",
"full",
"Analytics",
"query",
"in",
"Json",
"form",
"(",
"including",
"additional",
"query",
"parameters",
")",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/analytics/RawAnalyticsRequest.java#L53-L55 |
fabric8io/kubernetes-client | kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java | OperationSupport.assertResponseCode | protected void assertResponseCode(Request request, Response response) {
int statusCode = response.code();
String customMessage = config.getErrorMessages().get(statusCode);
if (response.isSuccessful()) {
return;
} else if (customMessage != null) {
throw requestFailure(request, createStatus(statusCode, combineMessages(customMessage, createStatus(response))));
} else {
throw requestFailure(request, createStatus(response));
}
} | java | protected void assertResponseCode(Request request, Response response) {
int statusCode = response.code();
String customMessage = config.getErrorMessages().get(statusCode);
if (response.isSuccessful()) {
return;
} else if (customMessage != null) {
throw requestFailure(request, createStatus(statusCode, combineMessages(customMessage, createStatus(response))));
} else {
throw requestFailure(request, createStatus(response));
}
} | [
"protected",
"void",
"assertResponseCode",
"(",
"Request",
"request",
",",
"Response",
"response",
")",
"{",
"int",
"statusCode",
"=",
"response",
".",
"code",
"(",
")",
";",
"String",
"customMessage",
"=",
"config",
".",
"getErrorMessages",
"(",
")",
".",
"... | Checks if the response status code is the expected and throws the appropriate KubernetesClientException if not.
@param request The {#link Request} object.
@param response The {@link Response} object.
@throws KubernetesClientException When the response code is not the expected. | [
"Checks",
"if",
"the",
"response",
"status",
"code",
"is",
"the",
"expected",
"and",
"throws",
"the",
"appropriate",
"KubernetesClientException",
"if",
"not",
"."
] | train | https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java#L433-L444 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newDataAccessException | public static DataAccessException newDataAccessException(String message, Object... args) {
return newDataAccessException(null, message, args);
} | java | public static DataAccessException newDataAccessException(String message, Object... args) {
return newDataAccessException(null, message, args);
} | [
"public",
"static",
"DataAccessException",
"newDataAccessException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newDataAccessException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link DataAccessException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link DataAccessException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link DataAccessException} with the given {@link String message}.
@see #newDataAccessException(Throwable, String, Object...)
@see org.cp.elements.dao.DataAccessException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"DataAccessException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L153-L155 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ObjectListAttributeDefinition.java | ObjectListAttributeDefinition.resolveValue | @Override
public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException {
// Pass non-LIST values through the superclass so it can reject weird values and, in the odd chance
// that's how this object is set up, turn undefined into a default list value.
ModelNode superResult = value.getType() == ModelType.LIST ? value : super.resolveValue(resolver, value);
// If it's not a LIST (almost certainly UNDEFINED), then nothing more we can do
if (superResult.getType() != ModelType.LIST) {
return superResult;
}
// Resolve each element.
// Don't mess with the original value
ModelNode clone = superResult == value ? value.clone() : superResult;
ModelNode result = new ModelNode();
result.setEmptyList();
for (ModelNode element : clone.asList()) {
result.add(valueType.resolveValue(resolver, element));
}
// Validate the entire list
getValidator().validateParameter(getName(), result);
return result;
} | java | @Override
public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException {
// Pass non-LIST values through the superclass so it can reject weird values and, in the odd chance
// that's how this object is set up, turn undefined into a default list value.
ModelNode superResult = value.getType() == ModelType.LIST ? value : super.resolveValue(resolver, value);
// If it's not a LIST (almost certainly UNDEFINED), then nothing more we can do
if (superResult.getType() != ModelType.LIST) {
return superResult;
}
// Resolve each element.
// Don't mess with the original value
ModelNode clone = superResult == value ? value.clone() : superResult;
ModelNode result = new ModelNode();
result.setEmptyList();
for (ModelNode element : clone.asList()) {
result.add(valueType.resolveValue(resolver, element));
}
// Validate the entire list
getValidator().validateParameter(getName(), result);
return result;
} | [
"@",
"Override",
"public",
"ModelNode",
"resolveValue",
"(",
"ExpressionResolver",
"resolver",
",",
"ModelNode",
"value",
")",
"throws",
"OperationFailedException",
"{",
"// Pass non-LIST values through the superclass so it can reject weird values and, in the odd chance",
"// that's ... | Overrides the superclass implementation to allow the value type's AttributeDefinition to in turn
resolve each element.
{@inheritDoc} | [
"Overrides",
"the",
"superclass",
"implementation",
"to",
"allow",
"the",
"value",
"type",
"s",
"AttributeDefinition",
"to",
"in",
"turn",
"resolve",
"each",
"element",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ObjectListAttributeDefinition.java#L133-L155 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java | Annotation.getFieldAccessors | public static JMapAccessor getFieldAccessors(Class<?> clazz, Field field){
return getFieldAccessors(clazz,field,false, field.getName(),Constants.DEFAULT_FIELD_VALUE);
} | java | public static JMapAccessor getFieldAccessors(Class<?> clazz, Field field){
return getFieldAccessors(clazz,field,false, field.getName(),Constants.DEFAULT_FIELD_VALUE);
} | [
"public",
"static",
"JMapAccessor",
"getFieldAccessors",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Field",
"field",
")",
"{",
"return",
"getFieldAccessors",
"(",
"clazz",
",",
"field",
",",
"false",
",",
"field",
".",
"getName",
"(",
")",
",",
"Constants... | Returns JMapAccessor relative to this field, null if not present.
@param clazz field's class
@param field to check
@return JMapAccessor if exists, null otherwise | [
"Returns",
"JMapAccessor",
"relative",
"to",
"this",
"field",
"null",
"if",
"not",
"present",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java#L104-L106 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java | ListManagementTermsImpl.getAllTermsWithServiceResponseAsync | public Observable<ServiceResponse<Terms>> getAllTermsWithServiceResponseAsync(String listId, String language, GetAllTermsOptionalParameter getAllTermsOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (listId == null) {
throw new IllegalArgumentException("Parameter listId is required and cannot be null.");
}
if (language == null) {
throw new IllegalArgumentException("Parameter language is required and cannot be null.");
}
final Integer offset = getAllTermsOptionalParameter != null ? getAllTermsOptionalParameter.offset() : null;
final Integer limit = getAllTermsOptionalParameter != null ? getAllTermsOptionalParameter.limit() : null;
return getAllTermsWithServiceResponseAsync(listId, language, offset, limit);
} | java | public Observable<ServiceResponse<Terms>> getAllTermsWithServiceResponseAsync(String listId, String language, GetAllTermsOptionalParameter getAllTermsOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (listId == null) {
throw new IllegalArgumentException("Parameter listId is required and cannot be null.");
}
if (language == null) {
throw new IllegalArgumentException("Parameter language is required and cannot be null.");
}
final Integer offset = getAllTermsOptionalParameter != null ? getAllTermsOptionalParameter.offset() : null;
final Integer limit = getAllTermsOptionalParameter != null ? getAllTermsOptionalParameter.limit() : null;
return getAllTermsWithServiceResponseAsync(listId, language, offset, limit);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Terms",
">",
">",
"getAllTermsWithServiceResponseAsync",
"(",
"String",
"listId",
",",
"String",
"language",
",",
"GetAllTermsOptionalParameter",
"getAllTermsOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"c... | Gets all terms from the list with list Id equal to the list Id passed.
@param listId List Id of the image list.
@param language Language of the terms.
@param getAllTermsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Terms object | [
"Gets",
"all",
"terms",
"from",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"the",
"list",
"Id",
"passed",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java#L317-L331 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/ColumnText.java | ColumnText.setSimpleColumn | public void setSimpleColumn(float llx, float lly, float urx, float ury) {
leftX = Math.min(llx, urx);
maxY = Math.max(lly, ury);
minY = Math.min(lly, ury);
rightX = Math.max(llx, urx);
yLine = maxY;
rectangularWidth = rightX - leftX;
if (rectangularWidth < 0)
rectangularWidth = 0;
rectangularMode = true;
} | java | public void setSimpleColumn(float llx, float lly, float urx, float ury) {
leftX = Math.min(llx, urx);
maxY = Math.max(lly, ury);
minY = Math.min(lly, ury);
rightX = Math.max(llx, urx);
yLine = maxY;
rectangularWidth = rightX - leftX;
if (rectangularWidth < 0)
rectangularWidth = 0;
rectangularMode = true;
} | [
"public",
"void",
"setSimpleColumn",
"(",
"float",
"llx",
",",
"float",
"lly",
",",
"float",
"urx",
",",
"float",
"ury",
")",
"{",
"leftX",
"=",
"Math",
".",
"min",
"(",
"llx",
",",
"urx",
")",
";",
"maxY",
"=",
"Math",
".",
"max",
"(",
"lly",
",... | Simplified method for rectangular columns.
@param llx
@param lly
@param urx
@param ury | [
"Simplified",
"method",
"for",
"rectangular",
"columns",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/ColumnText.java#L638-L648 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.listVnets | public List<VnetInfoInner> listVnets(String resourceGroupName, String name) {
return listVnetsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public List<VnetInfoInner> listVnets(String resourceGroupName, String name) {
return listVnetsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"List",
"<",
"VnetInfoInner",
">",
"listVnets",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"listVnetsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Get all Virtual Networks associated with an App Service plan.
Get all Virtual Networks associated with an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@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 List<VnetInfoInner> object if successful. | [
"Get",
"all",
"Virtual",
"Networks",
"associated",
"with",
"an",
"App",
"Service",
"plan",
".",
"Get",
"all",
"Virtual",
"Networks",
"associated",
"with",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L2984-L2986 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java | CoinbaseMarketDataServiceRaw.getCoinbaseSellPrice | public CoinbasePrice getCoinbaseSellPrice(Currency base, Currency counter) throws IOException {
return coinbase.getSellPrice(Coinbase.CB_VERSION_VALUE, base + "-" + counter).getData();
} | java | public CoinbasePrice getCoinbaseSellPrice(Currency base, Currency counter) throws IOException {
return coinbase.getSellPrice(Coinbase.CB_VERSION_VALUE, base + "-" + counter).getData();
} | [
"public",
"CoinbasePrice",
"getCoinbaseSellPrice",
"(",
"Currency",
"base",
",",
"Currency",
"counter",
")",
"throws",
"IOException",
"{",
"return",
"coinbase",
".",
"getSellPrice",
"(",
"Coinbase",
".",
"CB_VERSION_VALUE",
",",
"base",
"+",
"\"-\"",
"+",
"counter... | Unauthenticated resource that tells you the amount you can get if you sell one unit.
@param pair The currency pair.
@return The price in the desired {@code currency} to sell one unit.
@throws IOException
@see <a
href="https://developers.coinbase.com/api/v2#get-sell-price">developers.coinbase.com/api/v2#get-sell-price</a> | [
"Unauthenticated",
"resource",
"that",
"tells",
"you",
"the",
"amount",
"you",
"can",
"get",
"if",
"you",
"sell",
"one",
"unit",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java#L58-L61 |
samskivert/samskivert | src/main/java/com/samskivert/util/StringUtil.java | StringUtil.listToString | public static String listToString (Object val, Formatter formatter)
{
StringBuilder buf = new StringBuilder();
listToString(buf, val, formatter);
return buf.toString();
} | java | public static String listToString (Object val, Formatter formatter)
{
StringBuilder buf = new StringBuilder();
listToString(buf, val, formatter);
return buf.toString();
} | [
"public",
"static",
"String",
"listToString",
"(",
"Object",
"val",
",",
"Formatter",
"formatter",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"listToString",
"(",
"buf",
",",
"val",
",",
"formatter",
")",
";",
"return",
"... | Formats a collection of elements (either an array of objects, an {@link Iterator}, an {@link
Iterable} or an {@link Enumeration}) using the supplied formatter on each element. Note
that if you simply wish to format a collection of elements by calling {@link
Object#toString} on each element, you can just pass the list to the {@link
#toString(Object)} method which will do just that. | [
"Formats",
"a",
"collection",
"of",
"elements",
"(",
"either",
"an",
"array",
"of",
"objects",
"an",
"{"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/StringUtil.java#L450-L455 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.