repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.isModifed | public static boolean isModifed(File file, long lastModifyTime) {
if (null == file || false == file.exists()) {
return true;
}
return file.lastModified() != lastModifyTime;
} | java | public static boolean isModifed(File file, long lastModifyTime) {
if (null == file || false == file.exists()) {
return true;
}
return file.lastModified() != lastModifyTime;
} | [
"public",
"static",
"boolean",
"isModifed",
"(",
"File",
"file",
",",
"long",
"lastModifyTime",
")",
"{",
"if",
"(",
"null",
"==",
"file",
"||",
"false",
"==",
"file",
".",
"exists",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"file",
"... | 判断文件是否被改动<br>
如果文件对象为 null 或者文件不存在,被视为改动
@param file 文件对象
@param lastModifyTime 上次的改动时间
@return 是否被改动 | [
"判断文件是否被改动<br",
">",
"如果文件对象为",
"null",
"或者文件不存在,被视为改动"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1487-L1492 |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisUtil.java | CmsCmisUtil.addPropertyBigInteger | public static void addPropertyBigInteger(
CmsCmisTypeManager typeManager,
PropertiesImpl props,
String typeId,
Set<String> filter,
String id,
BigInteger value) {
if (!checkAddProperty(typeManager, props, typeId, filter, id)) {
return;
}
props.addProperty(new PropertyIntegerImpl(id, value));
} | java | public static void addPropertyBigInteger(
CmsCmisTypeManager typeManager,
PropertiesImpl props,
String typeId,
Set<String> filter,
String id,
BigInteger value) {
if (!checkAddProperty(typeManager, props, typeId, filter, id)) {
return;
}
props.addProperty(new PropertyIntegerImpl(id, value));
} | [
"public",
"static",
"void",
"addPropertyBigInteger",
"(",
"CmsCmisTypeManager",
"typeManager",
",",
"PropertiesImpl",
"props",
",",
"String",
"typeId",
",",
"Set",
"<",
"String",
">",
"filter",
",",
"String",
"id",
",",
"BigInteger",
"value",
")",
"{",
"if",
"... | Adds bigint property to a PropertiesImpl.<p>
@param typeManager the type manager
@param props the properties
@param typeId the type id
@param filter the property filter string
@param id the property id
@param value the property value | [
"Adds",
"bigint",
"property",
"to",
"a",
"PropertiesImpl",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisUtil.java#L142-L155 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java | BeansToExcelOnTemplate.emptyCells | private void emptyCells(Row tmplRow, int rowOffset, Row row, int colStart, int colEnd) {
for (int i = colStart; i <= colEnd; ++i) {
newCell(tmplRow, i, rowOffset, row, "", 0);
}
} | java | private void emptyCells(Row tmplRow, int rowOffset, Row row, int colStart, int colEnd) {
for (int i = colStart; i <= colEnd; ++i) {
newCell(tmplRow, i, rowOffset, row, "", 0);
}
} | [
"private",
"void",
"emptyCells",
"(",
"Row",
"tmplRow",
",",
"int",
"rowOffset",
",",
"Row",
"row",
",",
"int",
"colStart",
",",
"int",
"colEnd",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"colStart",
";",
"i",
"<=",
"colEnd",
";",
"++",
"i",
")",
"{",... | 置空非JavaBean属性字段关联的单元格。
@param tmplRow 模板行。
@param rowOffset 写入行偏移号。
@param row 需要创建新单元格所在的行。
@param colStart 开始列索引。
@param colEnd 结束列索引。 | [
"置空非JavaBean属性字段关联的单元格。"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L283-L287 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.addOutgoingFor | public void addOutgoingFor(SDVariable[] variables, DifferentialFunction function) {
String[] varNames = new String[variables.length];
for (int i = 0; i < varNames.length; i++) {
varNames[i] = variables[i].getVarName();
}
addOutgoingFor(varNames, function);
} | java | public void addOutgoingFor(SDVariable[] variables, DifferentialFunction function) {
String[] varNames = new String[variables.length];
for (int i = 0; i < varNames.length; i++) {
varNames[i] = variables[i].getVarName();
}
addOutgoingFor(varNames, function);
} | [
"public",
"void",
"addOutgoingFor",
"(",
"SDVariable",
"[",
"]",
"variables",
",",
"DifferentialFunction",
"function",
")",
"{",
"String",
"[",
"]",
"varNames",
"=",
"new",
"String",
"[",
"variables",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
... | Adds outgoing arguments to the graph for the specified DifferentialFunction
Also checks for input arguments and updates the graph adding an appropriate edge when the full graph is declared.
@param variables Variables - arguments for the specified differential function
@param function Differential function | [
"Adds",
"outgoing",
"arguments",
"to",
"the",
"graph",
"for",
"the",
"specified",
"DifferentialFunction",
"Also",
"checks",
"for",
"input",
"arguments",
"and",
"updates",
"the",
"graph",
"adding",
"an",
"appropriate",
"edge",
"when",
"the",
"full",
"graph",
"is"... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1106-L1113 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.rollbackBean | public void rollbackBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atRollback(tx, bean);
} | java | public void rollbackBean(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atRollback(tx, bean);
} | [
"public",
"void",
"rollbackBean",
"(",
"ContainerTx",
"tx",
",",
"BeanO",
"bean",
")",
"{",
"bean",
".",
"getActivationStrategy",
"(",
")",
".",
"atRollback",
"(",
"tx",
",",
"bean",
")",
";",
"}"
] | Perform rollback-time processing for the specified transaction and
bean. This method should be called for each bean which was
participating in a transaction which was rolled back.
Removes the transaction-local instance from the cache.
@param tx The transaction which was just rolled back
@param bean The bean for rollback processing | [
"Perform",
"rollback",
"-",
"time",
"processing",
"for",
"the",
"specified",
"transaction",
"and",
"bean",
".",
"This",
"method",
"should",
"be",
"called",
"for",
"each",
"bean",
"which",
"was",
"participating",
"in",
"a",
"transaction",
"which",
"was",
"rolle... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L419-L422 |
neo4j-contrib/neo4j-apoc-procedures | src/main/java/apoc/schema/Schemas.java | Schemas.indexExists | private Boolean indexExists(String labelName, List<String> propertyNames) {
Schema schema = db.schema();
for (IndexDefinition indexDefinition : Iterables.asList(schema.getIndexes(Label.label(labelName)))) {
List<String> properties = Iterables.asList(indexDefinition.getPropertyKeys());
if (properties.equals(propertyNames)) {
return true;
}
}
return false;
} | java | private Boolean indexExists(String labelName, List<String> propertyNames) {
Schema schema = db.schema();
for (IndexDefinition indexDefinition : Iterables.asList(schema.getIndexes(Label.label(labelName)))) {
List<String> properties = Iterables.asList(indexDefinition.getPropertyKeys());
if (properties.equals(propertyNames)) {
return true;
}
}
return false;
} | [
"private",
"Boolean",
"indexExists",
"(",
"String",
"labelName",
",",
"List",
"<",
"String",
">",
"propertyNames",
")",
"{",
"Schema",
"schema",
"=",
"db",
".",
"schema",
"(",
")",
";",
"for",
"(",
"IndexDefinition",
"indexDefinition",
":",
"Iterables",
".",... | Checks if an index exists for a given label and a list of properties
This method checks for index on nodes
@param labelName
@param propertyNames
@return true if the index exists otherwise it returns false | [
"Checks",
"if",
"an",
"index",
"exists",
"for",
"a",
"given",
"label",
"and",
"a",
"list",
"of",
"properties",
"This",
"method",
"checks",
"for",
"index",
"on",
"nodes"
] | train | https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/schema/Schemas.java#L210-L222 |
sksamuel/scrimage | scrimage-core/src/main/java/com/sksamuel/scrimage/DimensionTools.java | DimensionTools.dimensionsToFit | public static Dimension dimensionsToFit(Dimension target, Dimension source) {
// if target width/height is zero then we have no preference for that, so set it to the original value,
// since it cannot be any larger
int maxWidth;
if (target.getX() == 0) {
maxWidth = source.getX();
} else {
maxWidth = target.getX();
}
int maxHeight;
if (target.getY() == 0) {
maxHeight = source.getY();
} else {
maxHeight = target.getY();
}
double wscale = maxWidth / (double) source.getX();
double hscale = maxHeight / (double) source.getY();
if (wscale < hscale)
return new Dimension((int) (source.getX() * wscale), (int) (source.getY() * wscale));
else
return new Dimension((int) (source.getX() * hscale), (int) (source.getY() * hscale));
} | java | public static Dimension dimensionsToFit(Dimension target, Dimension source) {
// if target width/height is zero then we have no preference for that, so set it to the original value,
// since it cannot be any larger
int maxWidth;
if (target.getX() == 0) {
maxWidth = source.getX();
} else {
maxWidth = target.getX();
}
int maxHeight;
if (target.getY() == 0) {
maxHeight = source.getY();
} else {
maxHeight = target.getY();
}
double wscale = maxWidth / (double) source.getX();
double hscale = maxHeight / (double) source.getY();
if (wscale < hscale)
return new Dimension((int) (source.getX() * wscale), (int) (source.getY() * wscale));
else
return new Dimension((int) (source.getX() * hscale), (int) (source.getY() * hscale));
} | [
"public",
"static",
"Dimension",
"dimensionsToFit",
"(",
"Dimension",
"target",
",",
"Dimension",
"source",
")",
"{",
"// if target width/height is zero then we have no preference for that, so set it to the original value,",
"// since it cannot be any larger",
"int",
"maxWidth",
";",... | Returns width and height that allow the given source width, height to fit inside the target width, height
without losing aspect ratio | [
"Returns",
"width",
"and",
"height",
"that",
"allow",
"the",
"given",
"source",
"width",
"height",
"to",
"fit",
"inside",
"the",
"target",
"width",
"height",
"without",
"losing",
"aspect",
"ratio"
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/DimensionTools.java#L42-L67 |
sundrio/sundrio | annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java | ToPojo.readArrayValue | private static String readArrayValue(String ref, TypeDef source, Property property) {
TypeRef typeRef = property.getTypeRef();
if (typeRef instanceof ClassRef) {
//TODO: This needs further breakdown, to cover edge cases.
return readObjectArrayValue(ref, source, property);
}
if (typeRef instanceof PrimitiveRef) {
return readPrimitiveArrayValue(ref, source, property);
}
throw new IllegalStateException("Property should be either an object or a primitive.");
} | java | private static String readArrayValue(String ref, TypeDef source, Property property) {
TypeRef typeRef = property.getTypeRef();
if (typeRef instanceof ClassRef) {
//TODO: This needs further breakdown, to cover edge cases.
return readObjectArrayValue(ref, source, property);
}
if (typeRef instanceof PrimitiveRef) {
return readPrimitiveArrayValue(ref, source, property);
}
throw new IllegalStateException("Property should be either an object or a primitive.");
} | [
"private",
"static",
"String",
"readArrayValue",
"(",
"String",
"ref",
",",
"TypeDef",
"source",
",",
"Property",
"property",
")",
"{",
"TypeRef",
"typeRef",
"=",
"property",
".",
"getTypeRef",
"(",
")",
";",
"if",
"(",
"typeRef",
"instanceof",
"ClassRef",
"... | Returns the string representation of the code that reads an array property.
@param ref The reference.
@param source The type of the reference.
@param property The property to read.
@return The code. | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"code",
"that",
"reads",
"an",
"array",
"property",
"."
] | train | https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L768-L779 |
xcesco/kripton | kripton-arch-integration/src/main/java/android/arch/paging/PagedList.java | PagedList.addWeakCallback | @SuppressWarnings("WeakerAccess")
public void addWeakCallback(@Nullable List<T> previousSnapshot, @NonNull Callback callback) {
if (previousSnapshot != null && previousSnapshot != this) {
if (previousSnapshot.isEmpty()) {
if (!mStorage.isEmpty()) {
// If snapshot is empty, diff is trivial - just notify number new items.
// Note: occurs in async init, when snapshot taken before init page arrives
callback.onInserted(0, mStorage.size());
}
} else {
PagedList<T> storageSnapshot = (PagedList<T>) previousSnapshot;
//noinspection unchecked
dispatchUpdatesSinceSnapshot(storageSnapshot, callback);
}
}
// first, clean up any empty weak refs
for (int i = mCallbacks.size() - 1; i >= 0; i--) {
Callback currentCallback = mCallbacks.get(i).get();
if (currentCallback == null) {
mCallbacks.remove(i);
}
}
// then add the new one
mCallbacks.add(new WeakReference<>(callback));
} | java | @SuppressWarnings("WeakerAccess")
public void addWeakCallback(@Nullable List<T> previousSnapshot, @NonNull Callback callback) {
if (previousSnapshot != null && previousSnapshot != this) {
if (previousSnapshot.isEmpty()) {
if (!mStorage.isEmpty()) {
// If snapshot is empty, diff is trivial - just notify number new items.
// Note: occurs in async init, when snapshot taken before init page arrives
callback.onInserted(0, mStorage.size());
}
} else {
PagedList<T> storageSnapshot = (PagedList<T>) previousSnapshot;
//noinspection unchecked
dispatchUpdatesSinceSnapshot(storageSnapshot, callback);
}
}
// first, clean up any empty weak refs
for (int i = mCallbacks.size() - 1; i >= 0; i--) {
Callback currentCallback = mCallbacks.get(i).get();
if (currentCallback == null) {
mCallbacks.remove(i);
}
}
// then add the new one
mCallbacks.add(new WeakReference<>(callback));
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"void",
"addWeakCallback",
"(",
"@",
"Nullable",
"List",
"<",
"T",
">",
"previousSnapshot",
",",
"@",
"NonNull",
"Callback",
"callback",
")",
"{",
"if",
"(",
"previousSnapshot",
"!=",
"null",
"&&... | Adds a callback, and issues updates since the previousSnapshot was created.
<p>
If previousSnapshot is passed, the callback will also immediately be dispatched any
differences between the previous snapshot, and the current state. For example, if the
previousSnapshot was of 5 nulls, 10 items, 5 nulls, and the current state was 5 nulls,
12 items, 3 nulls, the callback would immediately receive a call of
<code>onChanged(14, 2)</code>.
<p>
This allows an observer that's currently presenting a snapshot to catch up to the most recent
version, including any changes that may have been made.
<p>
The callback is internally held as weak reference, so PagedList doesn't hold a strong
reference to its observer, such as a {@link PagedListAdapter}. If an adapter were held with a
strong reference, it would be necessary to clear its PagedList observer before it could be
GC'd.
@param previousSnapshot Snapshot previously captured from this List, or null.
@param callback Callback to dispatch to.
@see #removeWeakCallback(Callback) | [
"Adds",
"a",
"callback",
"and",
"issues",
"updates",
"since",
"the",
"previousSnapshot",
"was",
"created",
".",
"<p",
">",
"If",
"previousSnapshot",
"is",
"passed",
"the",
"callback",
"will",
"also",
"immediately",
"be",
"dispatched",
"any",
"differences",
"betw... | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-arch-integration/src/main/java/android/arch/paging/PagedList.java#L645-L673 |
Chorus-bdd/Chorus | interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/ConfigReader.java | ConfigReader.mergeProperties | private void mergeProperties(Map<ExecutionConfigSource, Map<ExecutionProperty, List<String>>> sourceToPropertiesMap) {
for ( ExecutionConfigSource s : propertySources) {
Map<ExecutionProperty, List<String>> properties = sourceToPropertiesMap.get(s);
for ( ExecutionProperty p : properties.keySet()) {
List<String> valuesFromSource = properties.get(p);
if ( valuesFromSource != null && !valuesFromSource.isEmpty()) {
List<String> vals = getOrCreatePropertyValues(p);
mergeValues(valuesFromSource, p, vals);
}
}
}
} | java | private void mergeProperties(Map<ExecutionConfigSource, Map<ExecutionProperty, List<String>>> sourceToPropertiesMap) {
for ( ExecutionConfigSource s : propertySources) {
Map<ExecutionProperty, List<String>> properties = sourceToPropertiesMap.get(s);
for ( ExecutionProperty p : properties.keySet()) {
List<String> valuesFromSource = properties.get(p);
if ( valuesFromSource != null && !valuesFromSource.isEmpty()) {
List<String> vals = getOrCreatePropertyValues(p);
mergeValues(valuesFromSource, p, vals);
}
}
}
} | [
"private",
"void",
"mergeProperties",
"(",
"Map",
"<",
"ExecutionConfigSource",
",",
"Map",
"<",
"ExecutionProperty",
",",
"List",
"<",
"String",
">",
">",
">",
"sourceToPropertiesMap",
")",
"{",
"for",
"(",
"ExecutionConfigSource",
"s",
":",
"propertySources",
... | deermine the final set of properties according to PropertySourceMode for each property | [
"deermine",
"the",
"final",
"set",
"of",
"properties",
"according",
"to",
"PropertySourceMode",
"for",
"each",
"property"
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/ConfigReader.java#L104-L115 |
apache/groovy | src/main/groovy/groovy/lang/MetaClassImpl.java | MetaClassImpl.addMetaMethod | public void addMetaMethod(MetaMethod method) {
if (isInitialized()) {
throw new RuntimeException("Already initialized, cannot add new method: " + method);
}
final CachedClass declaringClass = method.getDeclaringClass();
addMetaMethodToIndex(method, metaMethodIndex.getHeader(declaringClass.getTheClass()));
} | java | public void addMetaMethod(MetaMethod method) {
if (isInitialized()) {
throw new RuntimeException("Already initialized, cannot add new method: " + method);
}
final CachedClass declaringClass = method.getDeclaringClass();
addMetaMethodToIndex(method, metaMethodIndex.getHeader(declaringClass.getTheClass()));
} | [
"public",
"void",
"addMetaMethod",
"(",
"MetaMethod",
"method",
")",
"{",
"if",
"(",
"isInitialized",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Already initialized, cannot add new method: \"",
"+",
"method",
")",
";",
"}",
"final",
"CachedCla... | adds a MetaMethod to this class. WARNING: this method will not
do the neccessary steps for multimethod logic and using this
method doesn't mean, that a method added here is replacing another
method from a parent class completely. These steps are usually done
by initialize, which means if you need these steps, you have to add
the method before running initialize the first time.
@param method the MetaMethod
@see #initialize() | [
"adds",
"a",
"MetaMethod",
"to",
"this",
"class",
".",
"WARNING",
":",
"this",
"method",
"will",
"not",
"do",
"the",
"neccessary",
"steps",
"for",
"multimethod",
"logic",
"and",
"using",
"this",
"method",
"doesn",
"t",
"mean",
"that",
"a",
"method",
"added... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaClassImpl.java#L3051-L3058 |
googleapis/google-api-java-client | google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java | GoogleAccountCredential.usingAudience | public static GoogleAccountCredential usingAudience(Context context, String audience) {
Preconditions.checkArgument(audience.length() != 0);
return new GoogleAccountCredential(context, "audience:" + audience);
} | java | public static GoogleAccountCredential usingAudience(Context context, String audience) {
Preconditions.checkArgument(audience.length() != 0);
return new GoogleAccountCredential(context, "audience:" + audience);
} | [
"public",
"static",
"GoogleAccountCredential",
"usingAudience",
"(",
"Context",
"context",
",",
"String",
"audience",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"audience",
".",
"length",
"(",
")",
"!=",
"0",
")",
";",
"return",
"new",
"GoogleAccountC... | Sets the audience scope to use with Google Cloud Endpoints.
@param context context
@param audience audience
@return new instance | [
"Sets",
"the",
"audience",
"scope",
"to",
"use",
"with",
"Google",
"Cloud",
"Endpoints",
"."
] | train | https://github.com/googleapis/google-api-java-client/blob/88decfd14fc40cae6eb6729a45c7d56a1132e450/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java#L125-L128 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java | RoutesInner.createOrUpdate | public RouteInner createOrUpdate(String resourceGroupName, String routeTableName, String routeName, RouteInner routeParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, routeName, routeParameters).toBlocking().last().body();
} | java | public RouteInner createOrUpdate(String resourceGroupName, String routeTableName, String routeName, RouteInner routeParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, routeName, routeParameters).toBlocking().last().body();
} | [
"public",
"RouteInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeTableName",
",",
"String",
"routeName",
",",
"RouteInner",
"routeParameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"r... | Creates or updates a route in the specified route table.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@param routeName The name of the route.
@param routeParameters Parameters supplied to the create or update route operation.
@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 RouteInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"route",
"in",
"the",
"specified",
"route",
"table",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java#L362-L364 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/component/basic/AbstractComponent.java | AbstractComponent.createWave | private Wave createWave(final WaveGroup waveGroup, final WaveType waveType, final Class<?> componentClass, final WaveData<?>... waveData) {
final Wave wave = wave()
.waveGroup(waveGroup)
.waveType(waveType)
.fromClass(this.getClass())
.componentClass(componentClass)
.addDatas(waveData);
// Track wave creation
localFacade().globalFacade().trackEvent(JRebirthEventType.CREATE_WAVE, this.getClass(), wave.getClass());
return wave;
} | java | private Wave createWave(final WaveGroup waveGroup, final WaveType waveType, final Class<?> componentClass, final WaveData<?>... waveData) {
final Wave wave = wave()
.waveGroup(waveGroup)
.waveType(waveType)
.fromClass(this.getClass())
.componentClass(componentClass)
.addDatas(waveData);
// Track wave creation
localFacade().globalFacade().trackEvent(JRebirthEventType.CREATE_WAVE, this.getClass(), wave.getClass());
return wave;
} | [
"private",
"Wave",
"createWave",
"(",
"final",
"WaveGroup",
"waveGroup",
",",
"final",
"WaveType",
"waveType",
",",
"final",
"Class",
"<",
"?",
">",
"componentClass",
",",
"final",
"WaveData",
"<",
"?",
">",
"...",
"waveData",
")",
"{",
"final",
"Wave",
"w... | Build a wave object.
@param waveGroup the group of the wave
@param waveType the type of the wave
@param componentClass the component class if any
@param waveData wave data to use
@return the wave built | [
"Build",
"a",
"wave",
"object",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/component/basic/AbstractComponent.java#L311-L324 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java | FastDatePrinter.selectNumberRule | protected NumberRule selectNumberRule(final int field, final int padding) {
switch (padding) {
case 1:
return new UnpaddedNumberField(field);
case 2:
return new TwoDigitNumberField(field);
default:
return new PaddedNumberField(field, padding);
}
} | java | protected NumberRule selectNumberRule(final int field, final int padding) {
switch (padding) {
case 1:
return new UnpaddedNumberField(field);
case 2:
return new TwoDigitNumberField(field);
default:
return new PaddedNumberField(field, padding);
}
} | [
"protected",
"NumberRule",
"selectNumberRule",
"(",
"final",
"int",
"field",
",",
"final",
"int",
"padding",
")",
"{",
"switch",
"(",
"padding",
")",
"{",
"case",
"1",
":",
"return",
"new",
"UnpaddedNumberField",
"(",
"field",
")",
";",
"case",
"2",
":",
... | <p>
Gets an appropriate rule for the padding required.
</p>
@param field the field to get a rule for
@param padding the padding required
@return a new rule with the correct padding | [
"<p",
">",
"Gets",
"an",
"appropriate",
"rule",
"for",
"the",
"padding",
"required",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java#L275-L284 |
ykrasik/jaci | jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/hierarchy/CliSystemCommandFactory.java | CliSystemCommandFactory.from | public static CliDirectory from(CliCommandHierarchy hierarchy) {
final Identifier identifier = new Identifier("system", "System commands");
final CliSystemCommandFactory factory = new CliSystemCommandFactory(hierarchy);
return CliDirectory.from(
identifier,
factory.createChangeDirectoryCommand(),
factory.createListDirectoryCommand(),
factory.createDescribeCommandCommand()
);
} | java | public static CliDirectory from(CliCommandHierarchy hierarchy) {
final Identifier identifier = new Identifier("system", "System commands");
final CliSystemCommandFactory factory = new CliSystemCommandFactory(hierarchy);
return CliDirectory.from(
identifier,
factory.createChangeDirectoryCommand(),
factory.createListDirectoryCommand(),
factory.createDescribeCommandCommand()
);
} | [
"public",
"static",
"CliDirectory",
"from",
"(",
"CliCommandHierarchy",
"hierarchy",
")",
"{",
"final",
"Identifier",
"identifier",
"=",
"new",
"Identifier",
"(",
"\"system\"",
",",
"\"System commands\"",
")",
";",
"final",
"CliSystemCommandFactory",
"factory",
"=",
... | Create a directory containing all system commands. It is convenient to store all system commands in a directory.
Most system commands require an already built {@link CliCommandHierarchy}, but system commands are also a part
of the CliCommandHierarchy, creating a circular dependency. This is resolved in the CliCommandHierarchy itself
by offering a 'promise' object which will eventually delegate to the real implementation.
@param hierarchy Hierarchy on which the system commands will operate.
@return A {@link CliDirectory} containing all system commands. | [
"Create",
"a",
"directory",
"containing",
"all",
"system",
"commands",
".",
"It",
"is",
"convenient",
"to",
"store",
"all",
"system",
"commands",
"in",
"a",
"directory",
".",
"Most",
"system",
"commands",
"require",
"an",
"already",
"built",
"{",
"@link",
"C... | train | https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/hierarchy/CliSystemCommandFactory.java#L125-L134 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/KnowledgeSwitchYardScanner.java | KnowledgeSwitchYardScanner.toPropertiesModel | protected PropertiesModel toPropertiesModel(Property[] propertyAnnotations, KnowledgeNamespace knowledgeNamespace) {
if (propertyAnnotations == null || propertyAnnotations.length == 0) {
return null;
}
PropertiesModel propertiesModel = new V1PropertiesModel(knowledgeNamespace.uri());
for (Property propertyAnnotation : propertyAnnotations) {
PropertyModel propertyModel = new V1PropertyModel(knowledgeNamespace.uri());
String name = propertyAnnotation.name();
if (!UNDEFINED.equals(name)) {
propertyModel.setName(name);
}
String value = propertyAnnotation.value();
if (!UNDEFINED.equals(value)) {
propertyModel.setValue(value);
}
propertiesModel.addProperty(propertyModel);
}
return propertiesModel;
} | java | protected PropertiesModel toPropertiesModel(Property[] propertyAnnotations, KnowledgeNamespace knowledgeNamespace) {
if (propertyAnnotations == null || propertyAnnotations.length == 0) {
return null;
}
PropertiesModel propertiesModel = new V1PropertiesModel(knowledgeNamespace.uri());
for (Property propertyAnnotation : propertyAnnotations) {
PropertyModel propertyModel = new V1PropertyModel(knowledgeNamespace.uri());
String name = propertyAnnotation.name();
if (!UNDEFINED.equals(name)) {
propertyModel.setName(name);
}
String value = propertyAnnotation.value();
if (!UNDEFINED.equals(value)) {
propertyModel.setValue(value);
}
propertiesModel.addProperty(propertyModel);
}
return propertiesModel;
} | [
"protected",
"PropertiesModel",
"toPropertiesModel",
"(",
"Property",
"[",
"]",
"propertyAnnotations",
",",
"KnowledgeNamespace",
"knowledgeNamespace",
")",
"{",
"if",
"(",
"propertyAnnotations",
"==",
"null",
"||",
"propertyAnnotations",
".",
"length",
"==",
"0",
")"... | Converts property annotations to properties model.
@param propertyAnnotations propertyAnnotations
@param knowledgeNamespace knowledgeNamespace
@return model | [
"Converts",
"property",
"annotations",
"to",
"properties",
"model",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/KnowledgeSwitchYardScanner.java#L345-L363 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.lockRandomAccessFile | public static FileLock lockRandomAccessFile(final RandomAccessFile file, final int tryLockMax, final long tryWaitMillis)
throws LockingFailedException {
checkNotNull("file", file);
final FileChannel channel = file.getChannel();
int tryCount = 0;
while (tryCount < tryLockMax) {
tryCount++;
try {
final FileLock lock = channel.tryLock();
if (lock != null) {
return lock;
}
} catch (final IOException ex) {
throw new LockingFailedException("Unexpected I/O-Exception!", ex);
} catch (final OverlappingFileLockException ex) {
ignore();
}
try {
Thread.sleep(tryWaitMillis);
} catch (final InterruptedException ex) { // NOSONAR
throw new LockingFailedException("Unexpected interrupt!", ex);
}
}
throw new LockingFailedException("Number of max tries (" + tryLockMax + ") exceeded!");
} | java | public static FileLock lockRandomAccessFile(final RandomAccessFile file, final int tryLockMax, final long tryWaitMillis)
throws LockingFailedException {
checkNotNull("file", file);
final FileChannel channel = file.getChannel();
int tryCount = 0;
while (tryCount < tryLockMax) {
tryCount++;
try {
final FileLock lock = channel.tryLock();
if (lock != null) {
return lock;
}
} catch (final IOException ex) {
throw new LockingFailedException("Unexpected I/O-Exception!", ex);
} catch (final OverlappingFileLockException ex) {
ignore();
}
try {
Thread.sleep(tryWaitMillis);
} catch (final InterruptedException ex) { // NOSONAR
throw new LockingFailedException("Unexpected interrupt!", ex);
}
}
throw new LockingFailedException("Number of max tries (" + tryLockMax + ") exceeded!");
} | [
"public",
"static",
"FileLock",
"lockRandomAccessFile",
"(",
"final",
"RandomAccessFile",
"file",
",",
"final",
"int",
"tryLockMax",
",",
"final",
"long",
"tryWaitMillis",
")",
"throws",
"LockingFailedException",
"{",
"checkNotNull",
"(",
"\"file\"",
",",
"file",
")... | Lock the file.
@param file
File to lock - Cannot be <code>null</code>.
@param tryLockMax
Number of tries to lock before throwing an exception.
@param tryWaitMillis
Milliseconds to sleep between retries.
@return FileLock.
@throws LockingFailedException
Locking the file failed. | [
"Lock",
"the",
"file",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1250-L1278 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsElementView.java | CmsElementView.getTitle | public String getTitle(CmsObject cms, Locale locale) {
if (m_titleKey == null) {
return m_title;
} else {
return OpenCms.getWorkplaceManager().getMessages(locale).key(m_titleKey);
}
} | java | public String getTitle(CmsObject cms, Locale locale) {
if (m_titleKey == null) {
return m_title;
} else {
return OpenCms.getWorkplaceManager().getMessages(locale).key(m_titleKey);
}
} | [
"public",
"String",
"getTitle",
"(",
"CmsObject",
"cms",
",",
"Locale",
"locale",
")",
"{",
"if",
"(",
"m_titleKey",
"==",
"null",
")",
"{",
"return",
"m_title",
";",
"}",
"else",
"{",
"return",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getM... | Returns the element view title.<p>
@param cms the cms context
@param locale the locale
@return the title | [
"Returns",
"the",
"element",
"view",
"title",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsElementView.java#L247-L254 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java | AbstractConnectionManager.setDriverClassName | public void setDriverClassName(String driver)
{
try
{
this.driver = (Driver) Class.forName(driver).newInstance();
}
catch (Exception e)
{
throw new RuntimeException("Unable to load driver: " + driver, e);
}
} | java | public void setDriverClassName(String driver)
{
try
{
this.driver = (Driver) Class.forName(driver).newInstance();
}
catch (Exception e)
{
throw new RuntimeException("Unable to load driver: " + driver, e);
}
} | [
"public",
"void",
"setDriverClassName",
"(",
"String",
"driver",
")",
"{",
"try",
"{",
"this",
".",
"driver",
"=",
"(",
"Driver",
")",
"Class",
".",
"forName",
"(",
"driver",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
... | sets the driver class name. This is used in conjunction with the JDBC connection string
@param driver the driver class name, for example "com.sybase.jdbc4.jdbc.SybDriver" | [
"sets",
"the",
"driver",
"class",
"name",
".",
"This",
"is",
"used",
"in",
"conjunction",
"with",
"the",
"JDBC",
"connection",
"string"
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java#L434-L444 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/VoiceApi.java | VoiceApi.initiateConference | public ApiSuccessResponse initiateConference(String id, InitiateConferenceData initiateConferenceData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = initiateConferenceWithHttpInfo(id, initiateConferenceData);
return resp.getData();
} | java | public ApiSuccessResponse initiateConference(String id, InitiateConferenceData initiateConferenceData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = initiateConferenceWithHttpInfo(id, initiateConferenceData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"initiateConference",
"(",
"String",
"id",
",",
"InitiateConferenceData",
"initiateConferenceData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"initiateConferenceWithHttpInfo",
"(",
"id",
... | Initiate a conference
Initiate a two-step conference to the specified destination. This places the existing call on hold and creates a new call in the dialing state (step 1). After initiating the conference you can use [/voice/calls/{id}/complete-conference](/reference/workspace/Voice/index.html#completeConference) to complete the conference and bring all parties into the same call (step 2).
@param id The connection ID of the call to start the conference from. This call will be placed on hold. (required)
@param initiateConferenceData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Initiate",
"a",
"conference",
"Initiate",
"a",
"two",
"-",
"step",
"conference",
"to",
"the",
"specified",
"destination",
".",
"This",
"places",
"the",
"existing",
"call",
"on",
"hold",
"and",
"creates",
"a",
"new",
"call",
"in",
"the",
"dialing",
"state",
... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L1837-L1840 |
kaichunlin/android-transition | core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java | AbstractTransitionBuilder.delayAlpha | public T delayAlpha(@FloatRange(from = 0.0, to = 1.0) float end) {
getDelayedProcessor().addProcess(ALPHA, end);
return self();
} | java | public T delayAlpha(@FloatRange(from = 0.0, to = 1.0) float end) {
getDelayedProcessor().addProcess(ALPHA, end);
return self();
} | [
"public",
"T",
"delayAlpha",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"0.0",
",",
"to",
"=",
"1.0",
")",
"float",
"end",
")",
"{",
"getDelayedProcessor",
"(",
")",
".",
"addProcess",
"(",
"ALPHA",
",",
"end",
")",
";",
"return",
"self",
"(",
")",
... | Similar to alpha(float), but wait until the transition is about to start to perform the evaluation.
@param end
@return self | [
"Similar",
"to",
"alpha",
"(",
"float",
")",
"but",
"wait",
"until",
"the",
"transition",
"is",
"about",
"to",
"start",
"to",
"perform",
"the",
"evaluation",
"."
] | train | https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java#L195-L198 |
OpenLiberty/open-liberty | dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/ws/crypto/util/custom/CustomManifest.java | CustomManifest.getLocalizedString | protected String getLocalizedString(File featureManifest, String value) {
if (value != null && value.startsWith("%")) {
ResourceBundle res = CustomUtils.getResourceBundle(new File(featureManifest.getParentFile(), "l10n"), featureSymbolicName, Locale.getDefault());
if (res != null) {
String loc = res.getString(value.substring(1));
if (loc != null) {
value = loc;
}
}
}
return value;
} | java | protected String getLocalizedString(File featureManifest, String value) {
if (value != null && value.startsWith("%")) {
ResourceBundle res = CustomUtils.getResourceBundle(new File(featureManifest.getParentFile(), "l10n"), featureSymbolicName, Locale.getDefault());
if (res != null) {
String loc = res.getString(value.substring(1));
if (loc != null) {
value = loc;
}
}
}
return value;
} | [
"protected",
"String",
"getLocalizedString",
"(",
"File",
"featureManifest",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"value",
".",
"startsWith",
"(",
"\"%\"",
")",
")",
"{",
"ResourceBundle",
"res",
"=",
"CustomUtils",
".",
... | returns the localized string of specified value.
the localization file supposes to be located the l10n directory of the location
where the feature manifest file exists, and the name of the resource file is
feature symbolic name + _ + locale + .properties.
prior to call this method, featureSymbolicName field needs to be set. | [
"returns",
"the",
"localized",
"string",
"of",
"specified",
"value",
".",
"the",
"localization",
"file",
"supposes",
"to",
"be",
"located",
"the",
"l10n",
"directory",
"of",
"the",
"location",
"where",
"the",
"feature",
"manifest",
"file",
"exists",
"and",
"th... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/ws/crypto/util/custom/CustomManifest.java#L385-L396 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterChain.java | FilterChain.buildProviderChain | public static FilterChain buildProviderChain(ProviderConfig<?> providerConfig, FilterInvoker lastFilter) {
return new FilterChain(selectActualFilters(providerConfig, PROVIDER_AUTO_ACTIVES), lastFilter, providerConfig);
} | java | public static FilterChain buildProviderChain(ProviderConfig<?> providerConfig, FilterInvoker lastFilter) {
return new FilterChain(selectActualFilters(providerConfig, PROVIDER_AUTO_ACTIVES), lastFilter, providerConfig);
} | [
"public",
"static",
"FilterChain",
"buildProviderChain",
"(",
"ProviderConfig",
"<",
"?",
">",
"providerConfig",
",",
"FilterInvoker",
"lastFilter",
")",
"{",
"return",
"new",
"FilterChain",
"(",
"selectActualFilters",
"(",
"providerConfig",
",",
"PROVIDER_AUTO_ACTIVES"... | 构造服务端的执行链
@param providerConfig provider配置
@param lastFilter 最后一个filter
@return filter执行链 | [
"构造服务端的执行链"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterChain.java#L145-L147 |
phax/ph-web | ph-smtp/src/main/java/com/helger/smtp/scope/ScopedMailAPI.java | ScopedMailAPI.queueMail | @Nonnull
public ESuccess queueMail (@Nonnull final ISMTPSettings aSMTPSettings, @Nonnull final IMutableEmailData aMailData)
{
return MailAPI.queueMail (aSMTPSettings, aMailData);
} | java | @Nonnull
public ESuccess queueMail (@Nonnull final ISMTPSettings aSMTPSettings, @Nonnull final IMutableEmailData aMailData)
{
return MailAPI.queueMail (aSMTPSettings, aMailData);
} | [
"@",
"Nonnull",
"public",
"ESuccess",
"queueMail",
"(",
"@",
"Nonnull",
"final",
"ISMTPSettings",
"aSMTPSettings",
",",
"@",
"Nonnull",
"final",
"IMutableEmailData",
"aMailData",
")",
"{",
"return",
"MailAPI",
".",
"queueMail",
"(",
"aSMTPSettings",
",",
"aMailDat... | Unconditionally queue a mail
@param aSMTPSettings
The SMTP settings to use. May not be <code>null</code>.
@param aMailData
The data of the email to be send. May not be <code>null</code>.
@return {@link ESuccess} | [
"Unconditionally",
"queue",
"a",
"mail"
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/scope/ScopedMailAPI.java#L88-L92 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapEntryLite.java | MapEntryLite.writeTo | static <K, V> void writeTo(CodedOutputStream output, Metadata<K, V> metadata, K key, V value) throws IOException {
CodedConstant.writeElement(output, metadata.keyType, KEY_FIELD_NUMBER, key);
CodedConstant.writeElement(output, metadata.valueType, VALUE_FIELD_NUMBER, value);
} | java | static <K, V> void writeTo(CodedOutputStream output, Metadata<K, V> metadata, K key, V value) throws IOException {
CodedConstant.writeElement(output, metadata.keyType, KEY_FIELD_NUMBER, key);
CodedConstant.writeElement(output, metadata.valueType, VALUE_FIELD_NUMBER, value);
} | [
"static",
"<",
"K",
",",
"V",
">",
"void",
"writeTo",
"(",
"CodedOutputStream",
"output",
",",
"Metadata",
"<",
"K",
",",
"V",
">",
"metadata",
",",
"K",
"key",
",",
"V",
"value",
")",
"throws",
"IOException",
"{",
"CodedConstant",
".",
"writeElement",
... | Write to.
@param <K> the key type
@param <V> the value type
@param output the output
@param metadata the metadata
@param key the key
@param value the value
@throws IOException Signals that an I/O exception has occurred. | [
"Write",
"to",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapEntryLite.java#L170-L173 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/MapELResolver.java | MapELResolver.setValue | @Override
@SuppressWarnings("unchecked")
public void setValue(ELContext context, Object base, Object property, Object value) {
if (context == null) {
throw new NullPointerException("context is null");
}
if (isResolvable(base)) {
if (readOnly) {
throw new PropertyNotWritableException("resolver is read-only");
}
((Map) base).put(property, value);
context.setPropertyResolved(true);
}
} | java | @Override
@SuppressWarnings("unchecked")
public void setValue(ELContext context, Object base, Object property, Object value) {
if (context == null) {
throw new NullPointerException("context is null");
}
if (isResolvable(base)) {
if (readOnly) {
throw new PropertyNotWritableException("resolver is read-only");
}
((Map) base).put(property, value);
context.setPropertyResolved(true);
}
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"setValue",
"(",
"ELContext",
"context",
",",
"Object",
"base",
",",
"Object",
"property",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{"... | If the base object is a map, attempts to set the value associated with the given key, as
specified by the property argument. If the base is a Map, the propertyResolved property of
the ELContext object must be set to true by this resolver, before returning. If this property
is not true after this method is called, the caller can safely assume no value was set. If
this resolver was constructed in read-only mode, this method will always throw
PropertyNotWritableException. If a Map was created using
java.util.Collections.unmodifiableMap(Map), this method must throw
PropertyNotWritableException. Unfortunately, there is no Collections API method to detect
this. However, an implementation can create a prototype unmodifiable Map and query its
runtime type to see if it matches the runtime type of the base object as a workaround.
@param context
The context of this evaluation.
@param base
The map to analyze. Only bases of type Map are handled by this resolver.
@param property
The key to return the acceptable type for. Ignored by this resolver.
@param value
The value to be associated with the specified key.
@throws ClassCastException
if the class of the specified key or value prevents it from being stored in this
map.
@throws NullPointerException
if context is null, or if this map does not permit null keys or values, and the
specified key or value is null.
@throws IllegalArgumentException
if some aspect of this key or value prevents it from being stored in this map.
@throws PropertyNotWritableException
if this resolver was constructed in read-only mode, or if the put operation is
not supported by the underlying map.
@throws ELException
if an exception was thrown while performing the property or variable resolution.
The thrown exception must be included as the cause property of this exception, if
available. | [
"If",
"the",
"base",
"object",
"is",
"a",
"map",
"attempts",
"to",
"set",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"specified",
"by",
"the",
"property",
"argument",
".",
"If",
"the",
"base",
"is",
"a",
"Map",
"the",
"propertyRes... | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/MapELResolver.java#L276-L289 |
knowm/XChange | xchange-anx/src/main/java/org/knowm/xchange/anx/v2/ANXAdapters.java | ANXAdapters.adaptWallet | public static Wallet adaptWallet(Map<String, ANXWallet> anxWallets) {
List<Balance> balances = new ArrayList<>();
for (ANXWallet anxWallet : anxWallets.values()) {
Balance balance = adaptBalance(anxWallet);
if (balance != null) {
balances.add(balance);
}
}
return new Wallet(balances);
} | java | public static Wallet adaptWallet(Map<String, ANXWallet> anxWallets) {
List<Balance> balances = new ArrayList<>();
for (ANXWallet anxWallet : anxWallets.values()) {
Balance balance = adaptBalance(anxWallet);
if (balance != null) {
balances.add(balance);
}
}
return new Wallet(balances);
} | [
"public",
"static",
"Wallet",
"adaptWallet",
"(",
"Map",
"<",
"String",
",",
"ANXWallet",
">",
"anxWallets",
")",
"{",
"List",
"<",
"Balance",
">",
"balances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"ANXWallet",
"anxWallet",
":",
"anxW... | Adapts a List of ANX Wallets to an XChange Wallet
@param anxWallets
@return | [
"Adapts",
"a",
"List",
"of",
"ANX",
"Wallets",
"to",
"an",
"XChange",
"Wallet"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-anx/src/main/java/org/knowm/xchange/anx/v2/ANXAdapters.java#L165-L176 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java | ContainerKeyCache.updateSegmentIndexOffsetIfMissing | void updateSegmentIndexOffsetIfMissing(long segmentId, Supplier<Long> indexOffsetGetter) {
SegmentKeyCache cache = null;
int generation;
synchronized (this.segmentCaches) {
generation = this.currentCacheGeneration;
if (!this.segmentCaches.containsKey(segmentId)) {
cache = new SegmentKeyCache(segmentId, this.cache);
}
}
if (cache != null) {
cache.setLastIndexedOffset(indexOffsetGetter.get(), generation);
}
} | java | void updateSegmentIndexOffsetIfMissing(long segmentId, Supplier<Long> indexOffsetGetter) {
SegmentKeyCache cache = null;
int generation;
synchronized (this.segmentCaches) {
generation = this.currentCacheGeneration;
if (!this.segmentCaches.containsKey(segmentId)) {
cache = new SegmentKeyCache(segmentId, this.cache);
}
}
if (cache != null) {
cache.setLastIndexedOffset(indexOffsetGetter.get(), generation);
}
} | [
"void",
"updateSegmentIndexOffsetIfMissing",
"(",
"long",
"segmentId",
",",
"Supplier",
"<",
"Long",
">",
"indexOffsetGetter",
")",
"{",
"SegmentKeyCache",
"cache",
"=",
"null",
";",
"int",
"generation",
";",
"synchronized",
"(",
"this",
".",
"segmentCaches",
")",... | Updates the Last Indexed Offset for a given Segment, but only if there currently isn't any information about that.
See {@link #updateSegmentIndexOffset(long, long)} for more details.
@param segmentId The Id of the Segment to update the Last Indexed Offset for.
@param indexOffsetGetter A Supplier that is only invoked if there is no information about the current segment. This
Supplier should return the current value of the Segment's Last Indexed Offset. | [
"Updates",
"the",
"Last",
"Indexed",
"Offset",
"for",
"a",
"given",
"Segment",
"but",
"only",
"if",
"there",
"currently",
"isn",
"t",
"any",
"information",
"about",
"that",
".",
"See",
"{",
"@link",
"#updateSegmentIndexOffset",
"(",
"long",
"long",
")",
"}",... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/ContainerKeyCache.java#L222-L235 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/chart/Scatter.java | Scatter.addSeries | public void addSeries( String seriesName, double[] x, double[] y ) {
XYSeries series = new XYSeries(seriesName);
for( int i = 0; i < x.length; i++ ) {
series.add(x[i], y[i]);
}
dataset.addSeries(series);
} | java | public void addSeries( String seriesName, double[] x, double[] y ) {
XYSeries series = new XYSeries(seriesName);
for( int i = 0; i < x.length; i++ ) {
series.add(x[i], y[i]);
}
dataset.addSeries(series);
} | [
"public",
"void",
"addSeries",
"(",
"String",
"seriesName",
",",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"XYSeries",
"series",
"=",
"new",
"XYSeries",
"(",
"seriesName",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",... | Add a new series by name and data.
@param seriesName the name.
@param x the x data array.
@param y the y data array. | [
"Add",
"a",
"new",
"series",
"by",
"name",
"and",
"data",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/chart/Scatter.java#L80-L86 |
brettwooldridge/NuProcess | src/main/java/com/zaxxer/nuprocess/codec/NuCharsetDecoder.java | NuCharsetDecoder.onOutput | public void onOutput(ByteBuffer buffer, boolean closed)
{
CoderResult coderResult = decoder.decode(buffer, charBuffer, /* endOfInput */ closed);
charBuffer.flip();
this.handler.onDecode(charBuffer, closed, coderResult);
charBuffer.compact();
} | java | public void onOutput(ByteBuffer buffer, boolean closed)
{
CoderResult coderResult = decoder.decode(buffer, charBuffer, /* endOfInput */ closed);
charBuffer.flip();
this.handler.onDecode(charBuffer, closed, coderResult);
charBuffer.compact();
} | [
"public",
"void",
"onOutput",
"(",
"ByteBuffer",
"buffer",
",",
"boolean",
"closed",
")",
"{",
"CoderResult",
"coderResult",
"=",
"decoder",
".",
"decode",
"(",
"buffer",
",",
"charBuffer",
",",
"/* endOfInput */",
"closed",
")",
";",
"charBuffer",
".",
"flip"... | Implementation of {@link NuProcessHandler#onStdout(ByteBuffer, boolean)}
or {@link NuProcessHandler#onStderr(ByteBuffer, boolean)} which decodes
output data and forwards it to {@code handler}.
@param buffer {@link ByteBuffer} which received bytes from stdout or
stderr
@param closed true if stdout or stderr was closed, false otherwise | [
"Implementation",
"of",
"{",
"@link",
"NuProcessHandler#onStdout",
"(",
"ByteBuffer",
"boolean",
")",
"}",
"or",
"{",
"@link",
"NuProcessHandler#onStderr",
"(",
"ByteBuffer",
"boolean",
")",
"}",
"which",
"decodes",
"output",
"data",
"and",
"forwards",
"it",
"to",... | train | https://github.com/brettwooldridge/NuProcess/blob/d4abdd195367fce7375a0b45cb2f5eeff1c74d03/src/main/java/com/zaxxer/nuprocess/codec/NuCharsetDecoder.java#L84-L90 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java | JMElasticsearchIndex.upsertData | public UpdateResponse upsertData(Map<String, ?> source, String index,
String type, String id) {
return upsertQuery(buildPrepareUpsert(index, type, id, source));
} | java | public UpdateResponse upsertData(Map<String, ?> source, String index,
String type, String id) {
return upsertQuery(buildPrepareUpsert(index, type, id, source));
} | [
"public",
"UpdateResponse",
"upsertData",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"source",
",",
"String",
"index",
",",
"String",
"type",
",",
"String",
"id",
")",
"{",
"return",
"upsertQuery",
"(",
"buildPrepareUpsert",
"(",
"index",
",",
"type",
",",
... | Upsert data update response.
@param source the source
@param index the index
@param type the type
@param id the id
@return the update response | [
"Upsert",
"data",
"update",
"response",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L118-L121 |
casmi/casmi | src/main/java/casmi/graphics/element/Polygon.java | Polygon.vertex | public void vertex(double x, double y, double z) {
MODE = LINES_3D;
this.cornerX.add(x);
this.cornerY.add(y);
this.cornerZ.add(z);
setNumberOfCorner(this.cornerX.size());
calcG();
} | java | public void vertex(double x, double y, double z) {
MODE = LINES_3D;
this.cornerX.add(x);
this.cornerY.add(y);
this.cornerZ.add(z);
setNumberOfCorner(this.cornerX.size());
calcG();
} | [
"public",
"void",
"vertex",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"MODE",
"=",
"LINES_3D",
";",
"this",
".",
"cornerX",
".",
"add",
"(",
"x",
")",
";",
"this",
".",
"cornerY",
".",
"add",
"(",
"y",
")",
";",
"thi... | Adds the corner of Polygon.
@param x The x-coordinate of a new added corner.
@param y The y-coordinate of a new added corner.
@param z The z-coordinate of a new added corner. | [
"Adds",
"the",
"corner",
"of",
"Polygon",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Polygon.java#L87-L94 |
UrielCh/ovh-java-sdk | ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java | ApiOvhPrice.hosting_web_ssl_sslName_GET | public OvhPrice hosting_web_ssl_sslName_GET(net.minidev.ovh.api.price.hosting.web.OvhSslEnum sslName) throws IOException {
String qPath = "/price/hosting/web/ssl/{sslName}";
StringBuilder sb = path(qPath, sslName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | java | public OvhPrice hosting_web_ssl_sslName_GET(net.minidev.ovh.api.price.hosting.web.OvhSslEnum sslName) throws IOException {
String qPath = "/price/hosting/web/ssl/{sslName}";
StringBuilder sb = path(qPath, sslName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | [
"public",
"OvhPrice",
"hosting_web_ssl_sslName_GET",
"(",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"price",
".",
"hosting",
".",
"web",
".",
"OvhSslEnum",
"sslName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/price/hosting/web/ssl/... | Get the price for hosted ssl option
REST: GET /price/hosting/web/ssl/{sslName}
@param sslName [required] Ssl | [
"Get",
"the",
"price",
"for",
"hosted",
"ssl",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L245-L250 |
akarnokd/ixjava | src/main/java/ix/Ix.java | Ix.orderedMerge | public static <T extends Comparable<? super T>> Ix<T> orderedMerge(Iterable<? extends Iterable<? extends T>> sources) {
return orderedMerge(sources, SelfComparator.INSTANCE);
} | java | public static <T extends Comparable<? super T>> Ix<T> orderedMerge(Iterable<? extends Iterable<? extends T>> sources) {
return orderedMerge(sources, SelfComparator.INSTANCE);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"Ix",
"<",
"T",
">",
"orderedMerge",
"(",
"Iterable",
"<",
"?",
"extends",
"Iterable",
"<",
"?",
"extends",
"T",
">",
">",
"sources",
")",
"{",
"return",
"ordere... | Merges self-comparable items from an Iterable sequence of Iterable sequences, picking
the smallest item from all those inner Iterables until all sources complete.
@param <T> the value type
@param sources the Iterable sequence of Iterables of self-comparable items
@return the new Ix instance
@since 1.0 | [
"Merges",
"self",
"-",
"comparable",
"items",
"from",
"an",
"Iterable",
"sequence",
"of",
"Iterable",
"sequences",
"picking",
"the",
"smallest",
"item",
"from",
"all",
"those",
"inner",
"Iterables",
"until",
"all",
"sources",
"complete",
"."
] | train | https://github.com/akarnokd/ixjava/blob/add721bba550c36541faa450e40a975bb65e78d7/src/main/java/ix/Ix.java#L409-L411 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/connectionmanager/ccm/Context.java | Context.registerConnection | void registerConnection(ConnectionManager cm, ConnectionListener cl, Object c)
{
if (cmToCl == null)
cmToCl = new HashMap<ConnectionManager, List<ConnectionListener>>();
List<ConnectionListener> l = cmToCl.get(cm);
if (l == null)
l = new ArrayList<ConnectionListener>(1);
l.add(cl);
cmToCl.put(cm, l);
if (clToC == null)
clToC = new HashMap<ConnectionListener, List<Object>>();
List<Object> connections = clToC.get(cl);
if (connections == null)
connections = new ArrayList<Object>(1);
connections.add(c);
clToC.put(cl, connections);
} | java | void registerConnection(ConnectionManager cm, ConnectionListener cl, Object c)
{
if (cmToCl == null)
cmToCl = new HashMap<ConnectionManager, List<ConnectionListener>>();
List<ConnectionListener> l = cmToCl.get(cm);
if (l == null)
l = new ArrayList<ConnectionListener>(1);
l.add(cl);
cmToCl.put(cm, l);
if (clToC == null)
clToC = new HashMap<ConnectionListener, List<Object>>();
List<Object> connections = clToC.get(cl);
if (connections == null)
connections = new ArrayList<Object>(1);
connections.add(c);
clToC.put(cl, connections);
} | [
"void",
"registerConnection",
"(",
"ConnectionManager",
"cm",
",",
"ConnectionListener",
"cl",
",",
"Object",
"c",
")",
"{",
"if",
"(",
"cmToCl",
"==",
"null",
")",
"cmToCl",
"=",
"new",
"HashMap",
"<",
"ConnectionManager",
",",
"List",
"<",
"ConnectionListene... | Register a connection
@param cm The connection manager
@param cl The connection listener
@param c The connection | [
"Register",
"a",
"connection"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/ccm/Context.java#L68-L91 |
mgm-tp/jfunk | jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java | MathRandom.getDate | public Date getDate(final long min, final long max) {
long millis = getLong(min, max);
return DateUtils.truncate(new Date(millis), Calendar.DATE);
} | java | public Date getDate(final long min, final long max) {
long millis = getLong(min, max);
return DateUtils.truncate(new Date(millis), Calendar.DATE);
} | [
"public",
"Date",
"getDate",
"(",
"final",
"long",
"min",
",",
"final",
"long",
"max",
")",
"{",
"long",
"millis",
"=",
"getLong",
"(",
"min",
",",
"max",
")",
";",
"return",
"DateUtils",
".",
"truncate",
"(",
"new",
"Date",
"(",
"millis",
")",
",",
... | Returns a random date in the range of [min, max].
@param min
minimum value for generated date (in milliseconds)
@param max
maximum value for generated date (in milliseconds) | [
"Returns",
"a",
"random",
"date",
"in",
"the",
"range",
"of",
"[",
"min",
"max",
"]",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java#L165-L168 |
ozimov/cirneco | hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/collect/IsIterableContainingInAnyOrder.java | IsIterableContainingInAnyOrder.containsInAnyOrder | public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(final Iterable<T> items) {
final Collection<Matcher<? super T>> matchers = new ArrayList<>();
for (final T item : items) {
matchers.add(equalTo(item));
}
return new IsIterableContainingInAnyOrder<T>(matchers);
} | java | public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(final Iterable<T> items) {
final Collection<Matcher<? super T>> matchers = new ArrayList<>();
for (final T item : items) {
matchers.add(equalTo(item));
}
return new IsIterableContainingInAnyOrder<T>(matchers);
} | [
"public",
"static",
"<",
"T",
">",
"Matcher",
"<",
"Iterable",
"<",
"?",
"extends",
"T",
">",
">",
"containsInAnyOrder",
"(",
"final",
"Iterable",
"<",
"T",
">",
"items",
")",
"{",
"final",
"Collection",
"<",
"Matcher",
"<",
"?",
"super",
"T",
">",
"... | <p>Creates an order agnostic matcher for {@linkplain Iterable}s that matches when a single pass over the examined
{@linkplain Iterable} yields a series of items, each logically equal to one item anywhere in the specified items.
For a positive match, the examined iterable must be of the same length as the number of specified items.</p>
<p>N.B. each of the specified items will only be used once during a given examination, so be careful when
specifying items that may be equal to more than one entry in an examined iterable. For example:</p>
<br />
<pre>
//Arrange
Iterable<String> actual = Arrays.asList("foo", "bar");
Iterable<String> expected = Arrays.asList("bar", "foo");
//Assert
assertThat(actual, containsInAnyOrder(expected));
</pre>
@param items the items that must equal the items provided by an examined {@linkplain Iterable} in any order | [
"<p",
">",
"Creates",
"an",
"order",
"agnostic",
"matcher",
"for",
"{",
"@linkplain",
"Iterable",
"}",
"s",
"that",
"matches",
"when",
"a",
"single",
"pass",
"over",
"the",
"examined",
"{",
"@linkplain",
"Iterable",
"}",
"yields",
"a",
"series",
"of",
"ite... | train | https://github.com/ozimov/cirneco/blob/78ad782da0a2256634cfbebb2f97ed78c993b999/hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/collect/IsIterableContainingInAnyOrder.java#L38-L45 |
jamesagnew/hapi-fhir | hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/tags/Raw.java | Raw.render | @Override
public Object render(Map<String, Object> context, LNode... nodes) {
return nodes[0].render(context);
} | java | @Override
public Object render(Map<String, Object> context, LNode... nodes) {
return nodes[0].render(context);
} | [
"@",
"Override",
"public",
"Object",
"render",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"context",
",",
"LNode",
"...",
"nodes",
")",
"{",
"return",
"nodes",
"[",
"0",
"]",
".",
"render",
"(",
"context",
")",
";",
"}"
] | /*
temporarily disable tag processing to avoid syntax conflicts. | [
"/",
"*",
"temporarily",
"disable",
"tag",
"processing",
"to",
"avoid",
"syntax",
"conflicts",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/tags/Raw.java#L12-L15 |
jMotif/GI | src/main/java/net/seninp/gi/clusterrule/DistanceComputation.java | DistanceComputation.eculideanDistNormEAbandon | protected double eculideanDistNormEAbandon(double[] ts1, double[] ts2, double bsfDist) {
double dist = 0;
double tsLen = ts1.length;
double bsf = Math.pow(tsLen * bsfDist, 2);
for (int i = 0; i < ts1.length; i++) {
double diff = ts1[i] - ts2[i];
dist += Math.pow(diff, 2);
if (dist > bsf)
return Double.NaN;
}
return Math.sqrt(dist) / tsLen;
} | java | protected double eculideanDistNormEAbandon(double[] ts1, double[] ts2, double bsfDist) {
double dist = 0;
double tsLen = ts1.length;
double bsf = Math.pow(tsLen * bsfDist, 2);
for (int i = 0; i < ts1.length; i++) {
double diff = ts1[i] - ts2[i];
dist += Math.pow(diff, 2);
if (dist > bsf)
return Double.NaN;
}
return Math.sqrt(dist) / tsLen;
} | [
"protected",
"double",
"eculideanDistNormEAbandon",
"(",
"double",
"[",
"]",
"ts1",
",",
"double",
"[",
"]",
"ts2",
",",
"double",
"bsfDist",
")",
"{",
"double",
"dist",
"=",
"0",
";",
"double",
"tsLen",
"=",
"ts1",
".",
"length",
";",
"double",
"bsf",
... | Normalized early abandoned Euclidean distance.
@param ts1 the first series.
@param ts2 the second series.
@param bsfDist the distance value (used for early abandon).
@return the distance value. | [
"Normalized",
"early",
"abandoned",
"Euclidean",
"distance",
"."
] | train | https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/DistanceComputation.java#L52-L67 |
casmi/casmi | src/main/java/casmi/graphics/Graphics.java | Graphics.setLightAttenuation | public void setLightAttenuation(int i, float constant, float liner, float quadratic) {
float c[] = { constant };
float l[] = { liner };
float q[] = { quadratic };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_CONSTANT_ATTENUATION, c, 0);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_LINEAR_ATTENUATION, l, 0);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_QUADRATIC_ATTENUATION, q, 0);
} | java | public void setLightAttenuation(int i, float constant, float liner, float quadratic) {
float c[] = { constant };
float l[] = { liner };
float q[] = { quadratic };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_CONSTANT_ATTENUATION, c, 0);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_LINEAR_ATTENUATION, l, 0);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_QUADRATIC_ATTENUATION, q, 0);
} | [
"public",
"void",
"setLightAttenuation",
"(",
"int",
"i",
",",
"float",
"constant",
",",
"float",
"liner",
",",
"float",
"quadratic",
")",
"{",
"float",
"c",
"[",
"]",
"=",
"{",
"constant",
"}",
";",
"float",
"l",
"[",
"]",
"=",
"{",
"liner",
"}",
... | Set attenuation rates for point lights, spot lights, and ambient lights. | [
"Set",
"attenuation",
"rates",
"for",
"point",
"lights",
"spot",
"lights",
"and",
"ambient",
"lights",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/Graphics.java#L613-L622 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java | RSAUtils.verifySignature | public static boolean verifySignature(RSAPublicKey key, byte[] message, byte[] signature)
throws InvalidKeyException, NoSuchAlgorithmException, SignatureException {
return verifySignature(key, message, signature, DEFAULT_SIGNATURE_ALGORITHM);
} | java | public static boolean verifySignature(RSAPublicKey key, byte[] message, byte[] signature)
throws InvalidKeyException, NoSuchAlgorithmException, SignatureException {
return verifySignature(key, message, signature, DEFAULT_SIGNATURE_ALGORITHM);
} | [
"public",
"static",
"boolean",
"verifySignature",
"(",
"RSAPublicKey",
"key",
",",
"byte",
"[",
"]",
"message",
",",
"byte",
"[",
"]",
"signature",
")",
"throws",
"InvalidKeyException",
",",
"NoSuchAlgorithmException",
",",
"SignatureException",
"{",
"return",
"ve... | Verify a signature with RSA public key, using {@link #DEFAULT_SIGNATURE_ALGORITHM}.
@param key
@param message
@param signature
@return
@throws InvalidKeyException
@throws NoSuchAlgorithmException
@throws SignatureException | [
"Verify",
"a",
"signature",
"with",
"RSA",
"public",
"key",
"using",
"{",
"@link",
"#DEFAULT_SIGNATURE_ALGORITHM",
"}",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java#L309-L312 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java | ChineseCalendar.handleGetMonthLength | protected int handleGetMonthLength(int extendedYear, int month) {
int thisStart = handleComputeMonthStart(extendedYear, month, true) -
EPOCH_JULIAN_DAY + 1; // Julian day -> local days
int nextStart = newMoonNear(thisStart + SYNODIC_GAP, true);
return nextStart - thisStart;
} | java | protected int handleGetMonthLength(int extendedYear, int month) {
int thisStart = handleComputeMonthStart(extendedYear, month, true) -
EPOCH_JULIAN_DAY + 1; // Julian day -> local days
int nextStart = newMoonNear(thisStart + SYNODIC_GAP, true);
return nextStart - thisStart;
} | [
"protected",
"int",
"handleGetMonthLength",
"(",
"int",
"extendedYear",
",",
"int",
"month",
")",
"{",
"int",
"thisStart",
"=",
"handleComputeMonthStart",
"(",
"extendedYear",
",",
"month",
",",
"true",
")",
"-",
"EPOCH_JULIAN_DAY",
"+",
"1",
";",
"// Julian day... | Override Calendar method to return the number of days in the given
extended year and month.
<p>Note: This method also reads the IS_LEAP_MONTH field to determine
whether or not the given month is a leap month. | [
"Override",
"Calendar",
"method",
"to",
"return",
"the",
"number",
"of",
"days",
"in",
"the",
"given",
"extended",
"year",
"and",
"month",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L451-L456 |
Nexmo/nexmo-java | src/main/java/com/nexmo/client/insight/StandardInsightRequest.java | StandardInsightRequest.withNumberAndCountry | public static StandardInsightRequest withNumberAndCountry(String number, String country) {
return new Builder(number).country(country).build();
} | java | public static StandardInsightRequest withNumberAndCountry(String number, String country) {
return new Builder(number).country(country).build();
} | [
"public",
"static",
"StandardInsightRequest",
"withNumberAndCountry",
"(",
"String",
"number",
",",
"String",
"country",
")",
"{",
"return",
"new",
"Builder",
"(",
"number",
")",
".",
"country",
"(",
"country",
")",
".",
"build",
"(",
")",
";",
"}"
] | Construct a StandardInsightRequest with a number and country.
@param number A single phone number that you need insight about in national or international format.
@param country If a number does not have a country code or it is uncertain, set the two-character country code.
@return A new {@link StandardInsightRequest} object. | [
"Construct",
"a",
"StandardInsightRequest",
"with",
"a",
"number",
"and",
"country",
"."
] | train | https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/insight/StandardInsightRequest.java#L58-L60 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java | ClassFileVersion.of | public static ClassFileVersion of(TypeDescription typeDescription, ClassFileLocator classFileLocator) throws IOException {
ClassReader classReader = OpenedClassReader.of(classFileLocator.locate(typeDescription.getName()).resolve());
VersionExtractor versionExtractor = new VersionExtractor();
classReader.accept(versionExtractor, ClassReader.SKIP_CODE);
return ClassFileVersion.ofMinorMajor(versionExtractor.getClassFileVersionNumber());
} | java | public static ClassFileVersion of(TypeDescription typeDescription, ClassFileLocator classFileLocator) throws IOException {
ClassReader classReader = OpenedClassReader.of(classFileLocator.locate(typeDescription.getName()).resolve());
VersionExtractor versionExtractor = new VersionExtractor();
classReader.accept(versionExtractor, ClassReader.SKIP_CODE);
return ClassFileVersion.ofMinorMajor(versionExtractor.getClassFileVersionNumber());
} | [
"public",
"static",
"ClassFileVersion",
"of",
"(",
"TypeDescription",
"typeDescription",
",",
"ClassFileLocator",
"classFileLocator",
")",
"throws",
"IOException",
"{",
"ClassReader",
"classReader",
"=",
"OpenedClassReader",
".",
"of",
"(",
"classFileLocator",
".",
"loc... | Extracts a class' class version.
@param typeDescription The type for which to locate a class file version.
@param classFileLocator The class file locator to query for a class file.
@return The type's class file version.
@throws IOException If an error occurs while reading the class file. | [
"Extracts",
"a",
"class",
"class",
"version",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java#L297-L302 |
lkwg82/enforcer-rules | src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java | EnforcerRuleUtils.getPomModel | private Model getPomModel ( String groupId, String artifactId, String version, File pom )
throws ArtifactResolutionException, ArtifactNotFoundException, IOException, XmlPullParserException
{
Model model = null;
// do we want to look in the reactor like the
// project builder? Would require @aggregator goal
// which causes problems in maven core right now
// because we also need dependency resolution in
// other
// rules. (MNG-2277)
// look in the location specified by pom first.
boolean found = false;
try
{
model = readModel( pom );
// i found a model, lets make sure it's the one
// I want
found = checkIfModelMatches( groupId, artifactId, version, model );
}
catch ( IOException e )
{
// nothing here, but lets look in the repo
// before giving up.
}
catch ( XmlPullParserException e )
{
// nothing here, but lets look in the repo
// before giving up.
}
// i didn't find it in the local file system, go
// look in the repo
if ( !found )
{
Artifact pomArtifact = factory.createArtifact( groupId, artifactId, version, null, "pom" );
resolver.resolve( pomArtifact, remoteRepositories, local );
model = readModel( pomArtifact.getFile() );
}
return model;
} | java | private Model getPomModel ( String groupId, String artifactId, String version, File pom )
throws ArtifactResolutionException, ArtifactNotFoundException, IOException, XmlPullParserException
{
Model model = null;
// do we want to look in the reactor like the
// project builder? Would require @aggregator goal
// which causes problems in maven core right now
// because we also need dependency resolution in
// other
// rules. (MNG-2277)
// look in the location specified by pom first.
boolean found = false;
try
{
model = readModel( pom );
// i found a model, lets make sure it's the one
// I want
found = checkIfModelMatches( groupId, artifactId, version, model );
}
catch ( IOException e )
{
// nothing here, but lets look in the repo
// before giving up.
}
catch ( XmlPullParserException e )
{
// nothing here, but lets look in the repo
// before giving up.
}
// i didn't find it in the local file system, go
// look in the repo
if ( !found )
{
Artifact pomArtifact = factory.createArtifact( groupId, artifactId, version, null, "pom" );
resolver.resolve( pomArtifact, remoteRepositories, local );
model = readModel( pomArtifact.getFile() );
}
return model;
} | [
"private",
"Model",
"getPomModel",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"version",
",",
"File",
"pom",
")",
"throws",
"ArtifactResolutionException",
",",
"ArtifactNotFoundException",
",",
"IOException",
",",
"XmlPullParserException",
"... | This method gets the model for the defined artifact.
Looks first in the filesystem, then tries to get it
from the repo.
@param groupId the group id
@param artifactId the artifact id
@param version the version
@param pom the pom
@return the pom model
@throws ArtifactResolutionException the artifact resolution exception
@throws ArtifactNotFoundException the artifact not found exception
@throws XmlPullParserException the xml pull parser exception
@throws IOException Signals that an I/O exception has occurred. | [
"This",
"method",
"gets",
"the",
"model",
"for",
"the",
"defined",
"artifact",
".",
"Looks",
"first",
"in",
"the",
"filesystem",
"then",
"tries",
"to",
"get",
"it",
"from",
"the",
"repo",
"."
] | train | https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java#L176-L219 |
arquillian/arquillian-cube | kubernetes/istio/istio/src/main/java/org/arquillian/cube/istio/impl/IstioAssistant.java | IstioAssistant.deployIstioResources | public List<IstioResource> deployIstioResources(final Path directory) throws IOException {
final List<IstioResource> istioResources = new ArrayList<>();
if (Files.isDirectory(directory)) {
Files.list(directory)
.filter(ResourceFilter::filterKubernetesResource)
.map(p -> {
try {
return Files.newInputStream(p);
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
})
.forEach(is -> {
try {
istioResources.addAll(deployIstioResources(is));
is.close();
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
});
} else {
throw new IllegalArgumentException(String.format("%s should be a directory", directory));
}
return istioResources;
} | java | public List<IstioResource> deployIstioResources(final Path directory) throws IOException {
final List<IstioResource> istioResources = new ArrayList<>();
if (Files.isDirectory(directory)) {
Files.list(directory)
.filter(ResourceFilter::filterKubernetesResource)
.map(p -> {
try {
return Files.newInputStream(p);
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
})
.forEach(is -> {
try {
istioResources.addAll(deployIstioResources(is));
is.close();
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
});
} else {
throw new IllegalArgumentException(String.format("%s should be a directory", directory));
}
return istioResources;
} | [
"public",
"List",
"<",
"IstioResource",
">",
"deployIstioResources",
"(",
"final",
"Path",
"directory",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"IstioResource",
">",
"istioResources",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
... | Deploys all y(a)ml and json files located at given directory.
@param directory where resources files are stored
@throws IOException | [
"Deploys",
"all",
"y",
"(",
"a",
")",
"ml",
"and",
"json",
"files",
"located",
"at",
"given",
"directory",
"."
] | train | https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/kubernetes/istio/istio/src/main/java/org/arquillian/cube/istio/impl/IstioAssistant.java#L80-L107 |
samskivert/samskivert | src/main/java/com/samskivert/util/DefaultLogProvider.java | DefaultLogProvider.obtainTermSize | protected static void obtainTermSize ()
{
if (_tdimens == null) {
_tdimens = TermUtil.getTerminalSize();
// if we were unable to obtain our dimensions, use defaults
if (_tdimens == null) {
_tdimens = new Dimension(132, 24);
}
}
} | java | protected static void obtainTermSize ()
{
if (_tdimens == null) {
_tdimens = TermUtil.getTerminalSize();
// if we were unable to obtain our dimensions, use defaults
if (_tdimens == null) {
_tdimens = new Dimension(132, 24);
}
}
} | [
"protected",
"static",
"void",
"obtainTermSize",
"(",
")",
"{",
"if",
"(",
"_tdimens",
"==",
"null",
")",
"{",
"_tdimens",
"=",
"TermUtil",
".",
"getTerminalSize",
"(",
")",
";",
"// if we were unable to obtain our dimensions, use defaults",
"if",
"(",
"_tdimens",
... | Attempts to obtain the dimensions of the terminal window in which
we're running. This is extremely platform specific, but feel free
to add code to do the right thing for your platform. | [
"Attempts",
"to",
"obtain",
"the",
"dimensions",
"of",
"the",
"terminal",
"window",
"in",
"which",
"we",
"re",
"running",
".",
"This",
"is",
"extremely",
"platform",
"specific",
"but",
"feel",
"free",
"to",
"add",
"code",
"to",
"do",
"the",
"right",
"thing... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/DefaultLogProvider.java#L167-L177 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/EndPointInfoImpl.java | EndPointInfoImpl.updateHost | public String updateHost(final String newHost) {
validateHostName(newHost);
String oldHost = this.host;
this.host = newHost;
if (!oldHost.equals(newHost)) {
sendNotification(new AttributeChangeNotification(this, sequenceNum.incrementAndGet(), System.currentTimeMillis(), this.toString()
+ " host value changed", "Host", "java.lang.String", oldHost, newHost));
}
return oldHost;
} | java | public String updateHost(final String newHost) {
validateHostName(newHost);
String oldHost = this.host;
this.host = newHost;
if (!oldHost.equals(newHost)) {
sendNotification(new AttributeChangeNotification(this, sequenceNum.incrementAndGet(), System.currentTimeMillis(), this.toString()
+ " host value changed", "Host", "java.lang.String", oldHost, newHost));
}
return oldHost;
} | [
"public",
"String",
"updateHost",
"(",
"final",
"String",
"newHost",
")",
"{",
"validateHostName",
"(",
"newHost",
")",
";",
"String",
"oldHost",
"=",
"this",
".",
"host",
";",
"this",
".",
"host",
"=",
"newHost",
";",
"if",
"(",
"!",
"oldHost",
".",
"... | Update the host value for this end point.
Will emit an AttributeChangeNotification if the value changed.
@param newHost The new (or current) host name value. If no change, no notification is sent.
@return String The previous host value | [
"Update",
"the",
"host",
"value",
"for",
"this",
"end",
"point",
".",
"Will",
"emit",
"an",
"AttributeChangeNotification",
"if",
"the",
"value",
"changed",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/chains/EndPointInfoImpl.java#L114-L126 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java | DefaultMetadataService.addTrait | @Override
public void addTrait(List<String> entityGuids, ITypedStruct traitInstance) throws AtlasException {
Preconditions.checkNotNull(entityGuids, "entityGuids list cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
final String traitName = traitInstance.getTypeName();
// ensure trait type is already registered with the TypeSystem
if (!typeSystem.isRegistered(traitName)) {
String msg = String.format("trait=%s should be defined in type system before it can be added", traitName);
LOG.error(msg);
throw new TypeNotFoundException(msg);
}
//ensure trait is not already registered with any of the given entities
for (String entityGuid : entityGuids) {
Preconditions.checkArgument(!getTraitNames(entityGuid).contains(traitName),
"trait=%s is already defined for entity=%s", traitName, entityGuid);
}
repository.addTrait(entityGuids, traitInstance);
for (String entityGuid : entityGuids) {
onTraitAddedToEntity(repository.getEntityDefinition(entityGuid), traitInstance);
}
} | java | @Override
public void addTrait(List<String> entityGuids, ITypedStruct traitInstance) throws AtlasException {
Preconditions.checkNotNull(entityGuids, "entityGuids list cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
final String traitName = traitInstance.getTypeName();
// ensure trait type is already registered with the TypeSystem
if (!typeSystem.isRegistered(traitName)) {
String msg = String.format("trait=%s should be defined in type system before it can be added", traitName);
LOG.error(msg);
throw new TypeNotFoundException(msg);
}
//ensure trait is not already registered with any of the given entities
for (String entityGuid : entityGuids) {
Preconditions.checkArgument(!getTraitNames(entityGuid).contains(traitName),
"trait=%s is already defined for entity=%s", traitName, entityGuid);
}
repository.addTrait(entityGuids, traitInstance);
for (String entityGuid : entityGuids) {
onTraitAddedToEntity(repository.getEntityDefinition(entityGuid), traitInstance);
}
} | [
"@",
"Override",
"public",
"void",
"addTrait",
"(",
"List",
"<",
"String",
">",
"entityGuids",
",",
"ITypedStruct",
"traitInstance",
")",
"throws",
"AtlasException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"entityGuids",
",",
"\"entityGuids list cannot be null... | Adds a new trait to the list of existing entities represented by their respective guids
@param entityGuids list of guids of entities
@param traitInstance trait instance json that needs to be added to entities
@throws AtlasException | [
"Adds",
"a",
"new",
"trait",
"to",
"the",
"list",
"of",
"existing",
"entities",
"represented",
"by",
"their",
"respective",
"guids"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java#L566-L591 |
bullhorn/sdk-rest | src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java | StandardBullhornData.handleQueryForEntities | protected <L extends ListWrapper<T>, T extends QueryEntity> L handleQueryForEntities(Class<T> type, String where, Set<String> fieldSet, QueryParams params) {
if(where.length() < MAX_URL_LENGTH) {
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForQuery(BullhornEntityInfo.getTypesRestEntityName(type),
where, fieldSet, params);
String url = restUrlFactory.assembleQueryUrl(params);
return (L) this.performGetRequest(url, BullhornEntityInfo.getTypesListWrapperType(type), uriVariables);
}
return handleQueryForEntitiesWithPost(type,where,fieldSet,params);
} | java | protected <L extends ListWrapper<T>, T extends QueryEntity> L handleQueryForEntities(Class<T> type, String where, Set<String> fieldSet, QueryParams params) {
if(where.length() < MAX_URL_LENGTH) {
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForQuery(BullhornEntityInfo.getTypesRestEntityName(type),
where, fieldSet, params);
String url = restUrlFactory.assembleQueryUrl(params);
return (L) this.performGetRequest(url, BullhornEntityInfo.getTypesListWrapperType(type), uriVariables);
}
return handleQueryForEntitiesWithPost(type,where,fieldSet,params);
} | [
"protected",
"<",
"L",
"extends",
"ListWrapper",
"<",
"T",
">",
",",
"T",
"extends",
"QueryEntity",
">",
"L",
"handleQueryForEntities",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"where",
",",
"Set",
"<",
"String",
">",
"fieldSet",
",",
"QueryPa... | Makes the "query" api call
<p>
<p>
HTTP Method: GET
@param type the BullhornEntity type
@param where a SQL type where clause
@param fieldSet the fields to return, if null or emtpy will default to "*" all
@param params optional QueryParams.
@return a LinsWrapper containing the records plus some additional information | [
"Makes",
"the",
"query",
"api",
"call",
"<p",
">",
"<p",
">",
"HTTP",
"Method",
":",
"GET"
] | train | https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L938-L949 |
geomajas/geomajas-project-client-gwt | plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/feature/FeatureSearchServiceImpl.java | FeatureSearchServiceImpl.searchInBounds | public void searchInBounds(final FeaturesSupported layer, Bbox bbox, final FeatureArrayCallback callback) {
MapModel mapModel = map.getMapWidget().getMapModel();
Layer<?> gwtLayer = mapModel.getLayer(layer.getId());
if (gwtLayer != null && gwtLayer instanceof VectorLayer) {
final VectorLayer vLayer = (VectorLayer) gwtLayer;
SearchByLocationRequest request = new SearchByLocationRequest();
request.addLayerWithFilter(vLayer.getId(), vLayer.getServerLayerId(), layer.getFilter());
GeometryFactory factory = new GeometryFactory(mapModel.getSrid(), GeometryFactory.PARAM_DEFAULT_PRECISION);
org.geomajas.gwt.client.spatial.Bbox box = new org.geomajas.gwt.client.spatial.Bbox(bbox.getX(),
bbox.getY(), bbox.getWidth(), bbox.getHeight());
request.setLocation(GeometryConverter.toDto(factory.createPolygon(box)));
request.setCrs(mapModel.getCrs());
request.setSearchType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL);
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse response) {
Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap();
List<org.geomajas.layer.feature.Feature> dtos = featureMap.get(vLayer.getId());
Feature[] features = new Feature[dtos.size()];
for (int i = 0; i < dtos.size(); i++) {
features[i] = new FeatureImpl(dtos.get(i), layer);
}
callback.execute(new FeatureArrayHolder(features));
}
});
}
} | java | public void searchInBounds(final FeaturesSupported layer, Bbox bbox, final FeatureArrayCallback callback) {
MapModel mapModel = map.getMapWidget().getMapModel();
Layer<?> gwtLayer = mapModel.getLayer(layer.getId());
if (gwtLayer != null && gwtLayer instanceof VectorLayer) {
final VectorLayer vLayer = (VectorLayer) gwtLayer;
SearchByLocationRequest request = new SearchByLocationRequest();
request.addLayerWithFilter(vLayer.getId(), vLayer.getServerLayerId(), layer.getFilter());
GeometryFactory factory = new GeometryFactory(mapModel.getSrid(), GeometryFactory.PARAM_DEFAULT_PRECISION);
org.geomajas.gwt.client.spatial.Bbox box = new org.geomajas.gwt.client.spatial.Bbox(bbox.getX(),
bbox.getY(), bbox.getWidth(), bbox.getHeight());
request.setLocation(GeometryConverter.toDto(factory.createPolygon(box)));
request.setCrs(mapModel.getCrs());
request.setSearchType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL);
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse response) {
Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap();
List<org.geomajas.layer.feature.Feature> dtos = featureMap.get(vLayer.getId());
Feature[] features = new Feature[dtos.size()];
for (int i = 0; i < dtos.size(); i++) {
features[i] = new FeatureImpl(dtos.get(i), layer);
}
callback.execute(new FeatureArrayHolder(features));
}
});
}
} | [
"public",
"void",
"searchInBounds",
"(",
"final",
"FeaturesSupported",
"layer",
",",
"Bbox",
"bbox",
",",
"final",
"FeatureArrayCallback",
"callback",
")",
"{",
"MapModel",
"mapModel",
"=",
"map",
".",
"getMapWidget",
"(",
")",
".",
"getMapModel",
"(",
")",
";... | Search all features within a certain layer that intersect a certain bounding box.
@param layer
The features supported layer wherein to search.
@param bbox
The bounding box wherein to search.
@param callback
Call-back method executed on return (when features have been found). | [
"Search",
"all",
"features",
"within",
"a",
"certain",
"layer",
"that",
"intersect",
"a",
"certain",
"bounding",
"box",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/feature/FeatureSearchServiceImpl.java#L116-L151 |
tzaeschke/zoodb | src/org/zoodb/tools/ZooXmlImport.java | ZooXmlImport.readln1 | private boolean readln1(String strExpected, String strAlternative) {
String sX = scanner.next();
if (sX.equals(strExpected)) {
return true;
}
if (sX.equals(strAlternative)) {
return false;
}
throw new IllegalStateException("Expected: " + strAlternative + " but got: " + sX);
} | java | private boolean readln1(String strExpected, String strAlternative) {
String sX = scanner.next();
if (sX.equals(strExpected)) {
return true;
}
if (sX.equals(strAlternative)) {
return false;
}
throw new IllegalStateException("Expected: " + strAlternative + " but got: " + sX);
} | [
"private",
"boolean",
"readln1",
"(",
"String",
"strExpected",
",",
"String",
"strAlternative",
")",
"{",
"String",
"sX",
"=",
"scanner",
".",
"next",
"(",
")",
";",
"if",
"(",
"sX",
".",
"equals",
"(",
"strExpected",
")",
")",
"{",
"return",
"true",
"... | Reads '1' token.
@param strExpected
@param strAlternative
@return true if 1st string matches, or false if second matches
@throws IllegalStateException if neither String matches | [
"Reads",
"1",
"token",
"."
] | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/tools/ZooXmlImport.java#L349-L358 |
OpenBEL/openbel-framework | org.openbel.framework.api/src/main/java/org/openbel/framework/api/Namespaces.java | Namespaces.matchesSpecies | private boolean matchesSpecies(final NamespaceHeader hdr, int species) {
final String speciesHdr = hdr.getNamespaceBlock().getSpeciesString();
// empty header, no match
if (noLength(speciesHdr)) {
return false;
}
// non-numeric, no match
if (!isNumeric(speciesHdr)) {
return false;
}
// convert and match
int v = Integer.parseInt(speciesHdr);
return v == species;
} | java | private boolean matchesSpecies(final NamespaceHeader hdr, int species) {
final String speciesHdr = hdr.getNamespaceBlock().getSpeciesString();
// empty header, no match
if (noLength(speciesHdr)) {
return false;
}
// non-numeric, no match
if (!isNumeric(speciesHdr)) {
return false;
}
// convert and match
int v = Integer.parseInt(speciesHdr);
return v == species;
} | [
"private",
"boolean",
"matchesSpecies",
"(",
"final",
"NamespaceHeader",
"hdr",
",",
"int",
"species",
")",
"{",
"final",
"String",
"speciesHdr",
"=",
"hdr",
".",
"getNamespaceBlock",
"(",
")",
".",
"getSpeciesString",
"(",
")",
";",
"// empty header, no match",
... | Match a {@link NamespaceHeader namespace header} to a species taxonomy
id.
@param hdr {@link NamespaceHeader}
@param species {@code int} species
@return {@code true} if the namespace data is specific to
{@code species}, {@code false} otherwise | [
"Match",
"a",
"{",
"@link",
"NamespaceHeader",
"namespace",
"header",
"}",
"to",
"a",
"species",
"taxonomy",
"id",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.api/src/main/java/org/openbel/framework/api/Namespaces.java#L213-L229 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/BBR.java | BBR.tenativeUpdate | private double tenativeUpdate(final Vec[] columnMajor, final int j, final double w_j, final double[] y, final double[] r, final double lambda, final double s, final double[] delta)
{
double numer = 0, denom = 0;
if (columnMajor != null)
{
Vec col_j = columnMajor[j];
if (col_j.nnz() == 0)
return 0;
for (IndexValue iv : col_j)
{
final double x_ij = iv.getValue();
final int i = iv.getIndex();
numer += x_ij * y[i] / (1 + exp(r[i]));
denom += x_ij * x_ij * F(r[i], delta[j] * abs(x_ij));
if (prior == Prior.LAPLACE)
numer -= lambda * s;
else
{
numer -= w_j / lambda;
denom += 1 / lambda;
}
}
}
else//bias term, all x_ij = 1
for (int i = 0; i < y.length; i++)
{
numer += y[i] / (1 + exp(r[i])) - lambda * s;
denom += F(r[i], delta[j]);
}
return numer / denom;
} | java | private double tenativeUpdate(final Vec[] columnMajor, final int j, final double w_j, final double[] y, final double[] r, final double lambda, final double s, final double[] delta)
{
double numer = 0, denom = 0;
if (columnMajor != null)
{
Vec col_j = columnMajor[j];
if (col_j.nnz() == 0)
return 0;
for (IndexValue iv : col_j)
{
final double x_ij = iv.getValue();
final int i = iv.getIndex();
numer += x_ij * y[i] / (1 + exp(r[i]));
denom += x_ij * x_ij * F(r[i], delta[j] * abs(x_ij));
if (prior == Prior.LAPLACE)
numer -= lambda * s;
else
{
numer -= w_j / lambda;
denom += 1 / lambda;
}
}
}
else//bias term, all x_ij = 1
for (int i = 0; i < y.length; i++)
{
numer += y[i] / (1 + exp(r[i])) - lambda * s;
denom += F(r[i], delta[j]);
}
return numer / denom;
} | [
"private",
"double",
"tenativeUpdate",
"(",
"final",
"Vec",
"[",
"]",
"columnMajor",
",",
"final",
"int",
"j",
",",
"final",
"double",
"w_j",
",",
"final",
"double",
"[",
"]",
"y",
",",
"final",
"double",
"[",
"]",
"r",
",",
"final",
"double",
"lambda"... | Gets the tentative update δ<sub>vj</sub>
@param columnMajor the column major vector array. May be null if using
the implicit bias term
@param j the column to work on
@param w_j the value of the coefficient, used only under Gaussian prior
@param y the array of label values
@param r the array of r values
@param lambda the regularization value to apply
@param s the update direction (should be +1 or -1). Used only under
Laplace prior
@param delta the array of delta values
@return the tentative update value | [
"Gets",
"the",
"tentative",
"update",
"&delta",
";",
"<sub",
">",
"vj<",
"/",
"sub",
">"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/BBR.java#L515-L546 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java | NetworkAddressUtils.isValidAddress | private static boolean isValidAddress(InetAddress address, int timeoutMs) throws IOException {
return !address.isAnyLocalAddress() && !address.isLinkLocalAddress()
&& !address.isLoopbackAddress() && address.isReachable(timeoutMs)
&& (address instanceof Inet4Address);
} | java | private static boolean isValidAddress(InetAddress address, int timeoutMs) throws IOException {
return !address.isAnyLocalAddress() && !address.isLinkLocalAddress()
&& !address.isLoopbackAddress() && address.isReachable(timeoutMs)
&& (address instanceof Inet4Address);
} | [
"private",
"static",
"boolean",
"isValidAddress",
"(",
"InetAddress",
"address",
",",
"int",
"timeoutMs",
")",
"throws",
"IOException",
"{",
"return",
"!",
"address",
".",
"isAnyLocalAddress",
"(",
")",
"&&",
"!",
"address",
".",
"isLinkLocalAddress",
"(",
")",
... | Tests if the address is externally resolvable. Address must not be wildcard, link local,
loopback address, non-IPv4, or other unreachable addresses.
@param address The testing address
@param timeoutMs Timeout in milliseconds to use for checking that a possible local IP is
reachable
@return a {@code boolean} indicating if the given address is externally resolvable address | [
"Tests",
"if",
"the",
"address",
"is",
"externally",
"resolvable",
".",
"Address",
"must",
"not",
"be",
"wildcard",
"link",
"local",
"loopback",
"address",
"non",
"-",
"IPv4",
"or",
"other",
"unreachable",
"addresses",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java#L525-L529 |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.extractPropertyNameFromMethodName | public static String extractPropertyNameFromMethodName(String prefix, String methodName) {
if (prefix==null || methodName==null) return null;
if (methodName.startsWith(prefix) && prefix.length()<methodName.length()) {
String result = methodName.substring(prefix.length());
String propertyName = java.beans.Introspector.decapitalize(result);
if (result.equals(MetaClassHelper.capitalize(propertyName))) return propertyName;
}
return null;
} | java | public static String extractPropertyNameFromMethodName(String prefix, String methodName) {
if (prefix==null || methodName==null) return null;
if (methodName.startsWith(prefix) && prefix.length()<methodName.length()) {
String result = methodName.substring(prefix.length());
String propertyName = java.beans.Introspector.decapitalize(result);
if (result.equals(MetaClassHelper.capitalize(propertyName))) return propertyName;
}
return null;
} | [
"public",
"static",
"String",
"extractPropertyNameFromMethodName",
"(",
"String",
"prefix",
",",
"String",
"methodName",
")",
"{",
"if",
"(",
"prefix",
"==",
"null",
"||",
"methodName",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"methodName",
".",
... | Given a method name and a prefix, returns the name of the property that should be looked up,
following the java beans rules. For example, "getName" would return "name", while
"getFullName" would return "fullName".
If the prefix is not found, returns null.
@param prefix the method name prefix ("get", "is", "set", ...)
@param methodName the method name
@return a property name if the prefix is found and the method matches the java beans rules, null otherwise | [
"Given",
"a",
"method",
"name",
"and",
"a",
"prefix",
"returns",
"the",
"name",
"of",
"the",
"property",
"that",
"should",
"be",
"looked",
"up",
"following",
"the",
"java",
"beans",
"rules",
".",
"For",
"example",
"getName",
"would",
"return",
"name",
"whi... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L3862-L3870 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java | TypeConversion.bytesToInt | public static int bytesToInt(byte[] bytes, int offset) {
return ((bytes[offset + 3] & 0xFF) << 0) + ((bytes[offset + 2] & 0xFF) << 8)
+ ((bytes[offset + 1] & 0xFF) << 16) + ((bytes[offset + 0] & 0xFF) << 24);
} | java | public static int bytesToInt(byte[] bytes, int offset) {
return ((bytes[offset + 3] & 0xFF) << 0) + ((bytes[offset + 2] & 0xFF) << 8)
+ ((bytes[offset + 1] & 0xFF) << 16) + ((bytes[offset + 0] & 0xFF) << 24);
} | [
"public",
"static",
"int",
"bytesToInt",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"(",
"bytes",
"[",
"offset",
"+",
"3",
"]",
"&",
"0xFF",
")",
"<<",
"0",
")",
"+",
"(",
"(",
"bytes",
"[",
"offset",
"+",
"2... | A utility method to convert the int from the byte array to an int.
@param bytes
The byte array containing the int.
@param offset
The index at which the int is located.
@return The int value. | [
"A",
"utility",
"method",
"to",
"convert",
"the",
"int",
"from",
"the",
"byte",
"array",
"to",
"an",
"int",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L33-L36 |
elki-project/elki | elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/progress/AbstractProgress.java | AbstractProgress.setProcessed | public void setProcessed(int processed, Logging logger) throws IllegalArgumentException {
setProcessed(processed);
if(testLoggingRate(processed)) {
logger.progress(this);
}
} | java | public void setProcessed(int processed, Logging logger) throws IllegalArgumentException {
setProcessed(processed);
if(testLoggingRate(processed)) {
logger.progress(this);
}
} | [
"public",
"void",
"setProcessed",
"(",
"int",
"processed",
",",
"Logging",
"logger",
")",
"throws",
"IllegalArgumentException",
"{",
"setProcessed",
"(",
"processed",
")",
";",
"if",
"(",
"testLoggingRate",
"(",
"processed",
")",
")",
"{",
"logger",
".",
"prog... | Sets the number of items already processed at a time being.
@param processed the number of items already processed at a time being
@param logger Logger to report to
@throws IllegalArgumentException if an invalid value was passed. | [
"Sets",
"the",
"number",
"of",
"items",
"already",
"processed",
"at",
"a",
"time",
"being",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/progress/AbstractProgress.java#L97-L102 |
graphql-java/graphql-java | src/main/java/graphql/analysis/QueryTraversal.java | QueryTraversal.reducePreOrder | @SuppressWarnings("unchecked")
public <T> T reducePreOrder(QueryReducer<T> queryReducer, T initialValue) {
// compiler hack to make acc final and mutable :-)
final Object[] acc = {initialValue};
visitPreOrder(new QueryVisitorStub() {
@Override
public void visitField(QueryVisitorFieldEnvironment env) {
acc[0] = queryReducer.reduceField(env, (T) acc[0]);
}
});
return (T) acc[0];
} | java | @SuppressWarnings("unchecked")
public <T> T reducePreOrder(QueryReducer<T> queryReducer, T initialValue) {
// compiler hack to make acc final and mutable :-)
final Object[] acc = {initialValue};
visitPreOrder(new QueryVisitorStub() {
@Override
public void visitField(QueryVisitorFieldEnvironment env) {
acc[0] = queryReducer.reduceField(env, (T) acc[0]);
}
});
return (T) acc[0];
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"reducePreOrder",
"(",
"QueryReducer",
"<",
"T",
">",
"queryReducer",
",",
"T",
"initialValue",
")",
"{",
"// compiler hack to make acc final and mutable :-)",
"final",
"Object",
"[",
... | Reduces the fields of a Document (or parts of it) to a single value. The fields are visited in pre-order.
@param queryReducer the query reducer
@param initialValue the initial value to pass to the reducer
@param <T> the type of reduced value
@return the calucalated overall value | [
"Reduces",
"the",
"fields",
"of",
"a",
"Document",
"(",
"or",
"parts",
"of",
"it",
")",
"to",
"a",
"single",
"value",
".",
"The",
"fields",
"are",
"visited",
"in",
"pre",
"-",
"order",
"."
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/analysis/QueryTraversal.java#L127-L138 |
Netflix/spectator | spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java | HttpRequestBuilder.addHeader | public HttpRequestBuilder addHeader(String name, String value) {
reqHeaders.put(name, value);
entry.withRequestHeader(name, value);
return this;
} | java | public HttpRequestBuilder addHeader(String name, String value) {
reqHeaders.put(name, value);
entry.withRequestHeader(name, value);
return this;
} | [
"public",
"HttpRequestBuilder",
"addHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"reqHeaders",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"entry",
".",
"withRequestHeader",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
... | Add a header to the request. Note the content type will be set automatically
when providing the content payload and should not be set here. | [
"Add",
"a",
"header",
"to",
"the",
"request",
".",
"Note",
"the",
"content",
"type",
"will",
"be",
"set",
"automatically",
"when",
"providing",
"the",
"content",
"payload",
"and",
"should",
"not",
"be",
"set",
"here",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java#L81-L85 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java | LabAccountsInner.getRegionalAvailabilityAsync | public Observable<GetRegionalAvailabilityResponseInner> getRegionalAvailabilityAsync(String resourceGroupName, String labAccountName) {
return getRegionalAvailabilityWithServiceResponseAsync(resourceGroupName, labAccountName).map(new Func1<ServiceResponse<GetRegionalAvailabilityResponseInner>, GetRegionalAvailabilityResponseInner>() {
@Override
public GetRegionalAvailabilityResponseInner call(ServiceResponse<GetRegionalAvailabilityResponseInner> response) {
return response.body();
}
});
} | java | public Observable<GetRegionalAvailabilityResponseInner> getRegionalAvailabilityAsync(String resourceGroupName, String labAccountName) {
return getRegionalAvailabilityWithServiceResponseAsync(resourceGroupName, labAccountName).map(new Func1<ServiceResponse<GetRegionalAvailabilityResponseInner>, GetRegionalAvailabilityResponseInner>() {
@Override
public GetRegionalAvailabilityResponseInner call(ServiceResponse<GetRegionalAvailabilityResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"GetRegionalAvailabilityResponseInner",
">",
"getRegionalAvailabilityAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
")",
"{",
"return",
"getRegionalAvailabilityWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"... | Get regional availability information for each size category configured under a lab account.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the GetRegionalAvailabilityResponseInner object | [
"Get",
"regional",
"availability",
"information",
"for",
"each",
"size",
"category",
"configured",
"under",
"a",
"lab",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java#L1236-L1243 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/io/random/RandomAccessReader.java | RandomAccessReader.getIndexFile | public static File getIndexFile(String filename) {
String tmpDir = System.getProperty("java.io.tmpdir");
File f = new File(filename);
File indexFile = new File(tmpDir, f.getName() + "_cdk.index");
f = null;
return indexFile;
} | java | public static File getIndexFile(String filename) {
String tmpDir = System.getProperty("java.io.tmpdir");
File f = new File(filename);
File indexFile = new File(tmpDir, f.getName() + "_cdk.index");
f = null;
return indexFile;
} | [
"public",
"static",
"File",
"getIndexFile",
"(",
"String",
"filename",
")",
"{",
"String",
"tmpDir",
"=",
"System",
".",
"getProperty",
"(",
"\"java.io.tmpdir\"",
")",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"filename",
")",
";",
"File",
"indexFile",
"=... | Opens the file index file <code>_cdk.index</code> in a temporary folder, as specified by "java.io.tmpdir" property.
@param filename the name of the file for which the index was generated
@return a file object representing the index file | [
"Opens",
"the",
"file",
"index",
"file",
"<code",
">",
"_cdk",
".",
"index<",
"/",
"code",
">",
"in",
"a",
"temporary",
"folder",
"as",
"specified",
"by",
"java",
".",
"io",
".",
"tmpdir",
"property",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/io/random/RandomAccessReader.java#L347-L353 |
lamydev/Android-Notification | core/src/zemin/notification/NotificationEntry.java | NotificationEntry.setProgress | public void setProgress(int max, int progress, boolean indeterminate) {
this.progressMax = max;
this.progress = progress;
this.progressIndeterminate = indeterminate;
} | java | public void setProgress(int max, int progress, boolean indeterminate) {
this.progressMax = max;
this.progress = progress;
this.progressIndeterminate = indeterminate;
} | [
"public",
"void",
"setProgress",
"(",
"int",
"max",
",",
"int",
"progress",
",",
"boolean",
"indeterminate",
")",
"{",
"this",
".",
"progressMax",
"=",
"max",
";",
"this",
".",
"progress",
"=",
"progress",
";",
"this",
".",
"progressIndeterminate",
"=",
"i... | Set the progress this notification represents.
@see android.app.Notification#setProgress(int, int, boolean)
@param max
@param progress
@param indeterminate | [
"Set",
"the",
"progress",
"this",
"notification",
"represents",
"."
] | train | https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationEntry.java#L387-L391 |
phax/ph-web | ph-servlet/src/main/java/com/helger/servlet/mock/MockHttpServletRequest.java | MockHttpServletRequest.setParameter | @Nonnull
public MockHttpServletRequest setParameter (@Nonnull final String sName, @Nullable final String [] aValues)
{
m_aParameters.remove (sName);
m_aParameters.addAll (sName, aValues);
return this;
} | java | @Nonnull
public MockHttpServletRequest setParameter (@Nonnull final String sName, @Nullable final String [] aValues)
{
m_aParameters.remove (sName);
m_aParameters.addAll (sName, aValues);
return this;
} | [
"@",
"Nonnull",
"public",
"MockHttpServletRequest",
"setParameter",
"(",
"@",
"Nonnull",
"final",
"String",
"sName",
",",
"@",
"Nullable",
"final",
"String",
"[",
"]",
"aValues",
")",
"{",
"m_aParameters",
".",
"remove",
"(",
"sName",
")",
";",
"m_aParameters"... | Set an array of values for the specified HTTP parameter.
<p>
If there are already one or more values registered for the given parameter
name, they will be replaced.
@param sName
Parameter name
@param aValues
Parameter values
@return this | [
"Set",
"an",
"array",
"of",
"values",
"for",
"the",
"specified",
"HTTP",
"parameter",
".",
"<p",
">",
"If",
"there",
"are",
"already",
"one",
"or",
"more",
"values",
"registered",
"for",
"the",
"given",
"parameter",
"name",
"they",
"will",
"be",
"replaced"... | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/mock/MockHttpServletRequest.java#L418-L424 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsClient.java | ContextsClient.createContext | public final Context createContext(SessionName parent, Context context) {
CreateContextRequest request =
CreateContextRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setContext(context)
.build();
return createContext(request);
} | java | public final Context createContext(SessionName parent, Context context) {
CreateContextRequest request =
CreateContextRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setContext(context)
.build();
return createContext(request);
} | [
"public",
"final",
"Context",
"createContext",
"(",
"SessionName",
"parent",
",",
"Context",
"context",
")",
"{",
"CreateContextRequest",
"request",
"=",
"CreateContextRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==",
"null",
"?",
"nu... | Creates a context.
<p>If the specified context already exists, overrides the context.
<p>Sample code:
<pre><code>
try (ContextsClient contextsClient = ContextsClient.create()) {
SessionName parent = SessionName.of("[PROJECT]", "[SESSION]");
Context context = Context.newBuilder().build();
Context response = contextsClient.createContext(parent, context);
}
</code></pre>
@param parent Required. The session to create a context for. Format: `projects/<Project
ID>/agent/sessions/<Session ID>` or `projects/<Project
ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session
ID>`. If `Environment ID` is not specified, we assume default 'draft' environment. If
`User ID` is not specified, we assume default '-' user.
@param context Required. The context to create.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"context",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/ContextsClient.java#L431-L439 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/CheckBoxMenuItemPainter.java | CheckBoxMenuItemPainter.paintCheckIconDisabledAndSelected | private void paintCheckIconDisabledAndSelected(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createCheckMark(0, 0, width, height);
g.setPaint(iconDisabledSelected);
g.fill(s);
} | java | private void paintCheckIconDisabledAndSelected(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createCheckMark(0, 0, width, height);
g.setPaint(iconDisabledSelected);
g.fill(s);
} | [
"private",
"void",
"paintCheckIconDisabledAndSelected",
"(",
"Graphics2D",
"g",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Shape",
"s",
"=",
"shapeGenerator",
".",
"createCheckMark",
"(",
"0",
",",
"0",
",",
"width",
",",
"height",
")",
";",
"g"... | Paint the check mark in disabled state.
@param g the Graphics2D context to paint with.
@param width the width.
@param height the height. | [
"Paint",
"the",
"check",
"mark",
"in",
"disabled",
"state",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/CheckBoxMenuItemPainter.java#L132-L138 |
census-instrumentation/opencensus-java | impl_core/src/main/java/io/opencensus/implcore/internal/VarInt.java | VarInt.putVarInt | public static void putVarInt(int v, ByteBuffer sink) {
while (true) {
int bits = v & 0x7f;
v >>>= 7;
if (v == 0) {
sink.put((byte) bits);
return;
}
sink.put((byte) (bits | 0x80));
}
} | java | public static void putVarInt(int v, ByteBuffer sink) {
while (true) {
int bits = v & 0x7f;
v >>>= 7;
if (v == 0) {
sink.put((byte) bits);
return;
}
sink.put((byte) (bits | 0x80));
}
} | [
"public",
"static",
"void",
"putVarInt",
"(",
"int",
"v",
",",
"ByteBuffer",
"sink",
")",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"bits",
"=",
"v",
"&",
"0x7f",
";",
"v",
">>>=",
"7",
";",
"if",
"(",
"v",
"==",
"0",
")",
"{",
"sink",
".",
... | Encodes an integer in a variable-length encoding, 7 bits per byte, to a ByteBuffer sink.
@param v the value to encode
@param sink the ByteBuffer to add the encoded value | [
"Encodes",
"an",
"integer",
"in",
"a",
"variable",
"-",
"length",
"encoding",
"7",
"bits",
"per",
"byte",
"to",
"a",
"ByteBuffer",
"sink",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/impl_core/src/main/java/io/opencensus/implcore/internal/VarInt.java#L145-L155 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java | ProcessGroovyMethods.consumeProcessOutputStream | public static Thread consumeProcessOutputStream(Process self, Appendable output) {
Thread thread = new Thread(new TextDumper(self.getInputStream(), output));
thread.start();
return thread;
} | java | public static Thread consumeProcessOutputStream(Process self, Appendable output) {
Thread thread = new Thread(new TextDumper(self.getInputStream(), output));
thread.start();
return thread;
} | [
"public",
"static",
"Thread",
"consumeProcessOutputStream",
"(",
"Process",
"self",
",",
"Appendable",
"output",
")",
"{",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"new",
"TextDumper",
"(",
"self",
".",
"getInputStream",
"(",
")",
",",
"output",
")",
"... | Gets the output stream from a process and reads it
to keep the process from blocking due to a full output buffer.
The processed stream data is appended to the supplied Appendable.
A new Thread is started, so this method will return immediately.
@param self a Process
@param output an Appendable to capture the process stdout
@return the Thread
@since 1.7.5 | [
"Gets",
"the",
"output",
"stream",
"from",
"a",
"process",
"and",
"reads",
"it",
"to",
"keep",
"the",
"process",
"from",
"blocking",
"due",
"to",
"a",
"full",
"output",
"buffer",
".",
"The",
"processed",
"stream",
"data",
"is",
"appended",
"to",
"the",
"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L317-L321 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java | FloatingPointLoops.sawOpcode | @Override
public void sawOpcode(int seen) {
if (!forLoops.isEmpty()) {
Iterator<FloatForLoop> ffl = forLoops.iterator();
while (ffl.hasNext()) {
if (!ffl.next().sawOpcode(seen)) {
ffl.remove();
}
}
}
if (OpcodeUtils.isFLoad(seen) || OpcodeUtils.isDLoad(seen)) {
forLoops.add(new FloatForLoop(RegisterUtils.getLoadReg(this, seen), getPC()));
}
} | java | @Override
public void sawOpcode(int seen) {
if (!forLoops.isEmpty()) {
Iterator<FloatForLoop> ffl = forLoops.iterator();
while (ffl.hasNext()) {
if (!ffl.next().sawOpcode(seen)) {
ffl.remove();
}
}
}
if (OpcodeUtils.isFLoad(seen) || OpcodeUtils.isDLoad(seen)) {
forLoops.add(new FloatForLoop(RegisterUtils.getLoadReg(this, seen), getPC()));
}
} | [
"@",
"Override",
"public",
"void",
"sawOpcode",
"(",
"int",
"seen",
")",
"{",
"if",
"(",
"!",
"forLoops",
".",
"isEmpty",
"(",
")",
")",
"{",
"Iterator",
"<",
"FloatForLoop",
">",
"ffl",
"=",
"forLoops",
".",
"iterator",
"(",
")",
";",
"while",
"(",
... | implements the visitor to find for loops using floating point indexes
@param seen
the opcode of the currently parsed instruction | [
"implements",
"the",
"visitor",
"to",
"find",
"for",
"loops",
"using",
"floating",
"point",
"indexes"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java#L78-L92 |
wigforss/Ka-Commons-Reflection | src/main/java/org/kasource/commons/reflection/util/MethodUtils.java | MethodUtils.getDeclaredMethod | public static Method getDeclaredMethod(Class<?> clazz, String name, Class<?>... params) {
try {
return clazz.getDeclaredMethod(name, params);
} catch (Exception e) {
throw new IllegalArgumentException("Could not access method: " + name + " on " + clazz, e);
}
} | java | public static Method getDeclaredMethod(Class<?> clazz, String name, Class<?>... params) {
try {
return clazz.getDeclaredMethod(name, params);
} catch (Exception e) {
throw new IllegalArgumentException("Could not access method: " + name + " on " + clazz, e);
}
} | [
"public",
"static",
"Method",
"getDeclaredMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"...",
"params",
")",
"{",
"try",
"{",
"return",
"clazz",
".",
"getDeclaredMethod",
"(",
"name",
",",
"params",
... | Returns the named method from class <i>clazz</i>, does not throw checked exceptions.
@param clazz
The class to inspect
@param name
The name of the method to get
@param params
Parameter types for the method
@return Returns the named method from class <i>clazz</i>.
@throws IllegalArgumentException if method could not be found or security
issues occurred, when trying to retrieve the method. | [
"Returns",
"the",
"named",
"method",
"from",
"class",
"<i",
">",
"clazz<",
"/",
"i",
">",
"does",
"not",
"throw",
"checked",
"exceptions",
"."
] | train | https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/MethodUtils.java#L42-L48 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConfigs.java | RpcConfigs.changed | protected static boolean changed(Object oldObj, Object newObj) {
return oldObj == null ?
newObj != null :
!oldObj.equals(newObj);
} | java | protected static boolean changed(Object oldObj, Object newObj) {
return oldObj == null ?
newObj != null :
!oldObj.equals(newObj);
} | [
"protected",
"static",
"boolean",
"changed",
"(",
"Object",
"oldObj",
",",
"Object",
"newObj",
")",
"{",
"return",
"oldObj",
"==",
"null",
"?",
"newObj",
"!=",
"null",
":",
"!",
"oldObj",
".",
"equals",
"(",
"newObj",
")",
";",
"}"
] | 值是否发生变化
@param oldObj 旧值
@param newObj 新值
@return 是否变化 boolean | [
"值是否发生变化"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/common/RpcConfigs.java#L349-L353 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/archivers/Bzip2Archiver.java | Bzip2Archiver.getDecompressionStream | public InputStreamReader getDecompressionStream(String path, String encoding)
throws IOException
{
File fileToUncompress = new File(path);
BufferedInputStream fileStream = new BufferedInputStream(new FileInputStream(fileToUncompress));
// read bzip2 prefix: BZ
fileStream.read();
fileStream.read();
BufferedInputStream bufferedStream = new BufferedInputStream(fileStream);
CBZip2InputStream input = new CBZip2InputStream(bufferedStream);
return new InputStreamReader(input, encoding);
} | java | public InputStreamReader getDecompressionStream(String path, String encoding)
throws IOException
{
File fileToUncompress = new File(path);
BufferedInputStream fileStream = new BufferedInputStream(new FileInputStream(fileToUncompress));
// read bzip2 prefix: BZ
fileStream.read();
fileStream.read();
BufferedInputStream bufferedStream = new BufferedInputStream(fileStream);
CBZip2InputStream input = new CBZip2InputStream(bufferedStream);
return new InputStreamReader(input, encoding);
} | [
"public",
"InputStreamReader",
"getDecompressionStream",
"(",
"String",
"path",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"File",
"fileToUncompress",
"=",
"new",
"File",
"(",
"path",
")",
";",
"BufferedInputStream",
"fileStream",
"=",
"new",
"B... | Creates Stream for decompression
@param path
path to file to uncompress
@param encoding
ecoding to use
@return decompression stream
@throws IOException | [
"Creates",
"Stream",
"for",
"decompression"
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/archivers/Bzip2Archiver.java#L128-L145 |
real-logic/simple-binary-encoding | sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java | XmlSchemaParser.findTypes | public static Map<String, Type> findTypes(final Document document, final XPath xPath) throws Exception
{
final Map<String, Type> typeByNameMap = new HashMap<>();
typeByNameMap.put("char", new EncodedDataType("char", REQUIRED, null, null, CHAR, 1, false));
typeByNameMap.put("int8", new EncodedDataType("int8", REQUIRED, null, null, INT8, 1, false));
typeByNameMap.put("int16", new EncodedDataType("int16", REQUIRED, null, null, INT16, 1, false));
typeByNameMap.put("int32", new EncodedDataType("int32", REQUIRED, null, null, INT32, 1, false));
typeByNameMap.put("int64", new EncodedDataType("int64", REQUIRED, null, null, INT64, 1, false));
typeByNameMap.put("uint8", new EncodedDataType("uint8", REQUIRED, null, null, UINT8, 1, false));
typeByNameMap.put("uint16", new EncodedDataType("uint16", REQUIRED, null, null, UINT16, 1, false));
typeByNameMap.put("uint32", new EncodedDataType("uint32", REQUIRED, null, null, UINT32, 1, false));
typeByNameMap.put("uint64", new EncodedDataType("uint64", REQUIRED, null, null, UINT64, 1, false));
typeByNameMap.put("float", new EncodedDataType("float", REQUIRED, null, null, FLOAT, 1, false));
typeByNameMap.put("double", new EncodedDataType("double", REQUIRED, null, null, DOUBLE, 1, false));
forEach((NodeList)xPath.compile(TYPE_XPATH_EXPR).evaluate(document, XPathConstants.NODESET),
(node) -> addTypeWithNameCheck(typeByNameMap, new EncodedDataType(node), node));
forEach((NodeList)xPath.compile(COMPOSITE_XPATH_EXPR).evaluate(document, XPathConstants.NODESET),
(node) -> addTypeWithNameCheck(typeByNameMap, new CompositeType(node), node));
forEach((NodeList)xPath.compile(ENUM_XPATH_EXPR).evaluate(document, XPathConstants.NODESET),
(node) -> addTypeWithNameCheck(typeByNameMap, new EnumType(node), node));
forEach((NodeList)xPath.compile(SET_XPATH_EXPR).evaluate(document, XPathConstants.NODESET),
(node) -> addTypeWithNameCheck(typeByNameMap, new SetType(node), node));
return typeByNameMap;
} | java | public static Map<String, Type> findTypes(final Document document, final XPath xPath) throws Exception
{
final Map<String, Type> typeByNameMap = new HashMap<>();
typeByNameMap.put("char", new EncodedDataType("char", REQUIRED, null, null, CHAR, 1, false));
typeByNameMap.put("int8", new EncodedDataType("int8", REQUIRED, null, null, INT8, 1, false));
typeByNameMap.put("int16", new EncodedDataType("int16", REQUIRED, null, null, INT16, 1, false));
typeByNameMap.put("int32", new EncodedDataType("int32", REQUIRED, null, null, INT32, 1, false));
typeByNameMap.put("int64", new EncodedDataType("int64", REQUIRED, null, null, INT64, 1, false));
typeByNameMap.put("uint8", new EncodedDataType("uint8", REQUIRED, null, null, UINT8, 1, false));
typeByNameMap.put("uint16", new EncodedDataType("uint16", REQUIRED, null, null, UINT16, 1, false));
typeByNameMap.put("uint32", new EncodedDataType("uint32", REQUIRED, null, null, UINT32, 1, false));
typeByNameMap.put("uint64", new EncodedDataType("uint64", REQUIRED, null, null, UINT64, 1, false));
typeByNameMap.put("float", new EncodedDataType("float", REQUIRED, null, null, FLOAT, 1, false));
typeByNameMap.put("double", new EncodedDataType("double", REQUIRED, null, null, DOUBLE, 1, false));
forEach((NodeList)xPath.compile(TYPE_XPATH_EXPR).evaluate(document, XPathConstants.NODESET),
(node) -> addTypeWithNameCheck(typeByNameMap, new EncodedDataType(node), node));
forEach((NodeList)xPath.compile(COMPOSITE_XPATH_EXPR).evaluate(document, XPathConstants.NODESET),
(node) -> addTypeWithNameCheck(typeByNameMap, new CompositeType(node), node));
forEach((NodeList)xPath.compile(ENUM_XPATH_EXPR).evaluate(document, XPathConstants.NODESET),
(node) -> addTypeWithNameCheck(typeByNameMap, new EnumType(node), node));
forEach((NodeList)xPath.compile(SET_XPATH_EXPR).evaluate(document, XPathConstants.NODESET),
(node) -> addTypeWithNameCheck(typeByNameMap, new SetType(node), node));
return typeByNameMap;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Type",
">",
"findTypes",
"(",
"final",
"Document",
"document",
",",
"final",
"XPath",
"xPath",
")",
"throws",
"Exception",
"{",
"final",
"Map",
"<",
"String",
",",
"Type",
">",
"typeByNameMap",
"=",
"new",
... | Scan XML for all types (encodedDataType, compositeType, enumType, and setType) and save in map
@param document for the XML parsing
@param xPath for XPath expression reuse
@return {@link java.util.Map} of name {@link java.lang.String} to Type
@throws Exception on parsing error. | [
"Scan",
"XML",
"for",
"all",
"types",
"(",
"encodedDataType",
"compositeType",
"enumType",
"and",
"setType",
")",
"and",
"save",
"in",
"map"
] | train | https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L180-L209 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java | CommonOps_DDF3.fill | public static void fill( DMatrix3 a , double v ) {
a.a1 = v;
a.a2 = v;
a.a3 = v;
} | java | public static void fill( DMatrix3 a , double v ) {
a.a1 = v;
a.a2 = v;
a.a3 = v;
} | [
"public",
"static",
"void",
"fill",
"(",
"DMatrix3",
"a",
",",
"double",
"v",
")",
"{",
"a",
".",
"a1",
"=",
"v",
";",
"a",
".",
"a2",
"=",
"v",
";",
"a",
".",
"a3",
"=",
"v",
";",
"}"
] | <p>
Sets every element in the vector to the specified value.<br>
<br>
a<sub>i</sub> = value
<p>
@param a A vector whose elements are about to be set. Modified.
@param v The value each element will have. | [
"<p",
">",
"Sets",
"every",
"element",
"in",
"the",
"vector",
"to",
"the",
"specified",
"value",
".",
"<br",
">",
"<br",
">",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"value",
"<p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java#L1337-L1341 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsLinkManager.java | CmsLinkManager.getServerLink | public String getServerLink(CmsObject cms, String resourceName, boolean forceSecure) {
String result = substituteLinkForUnknownTarget(cms, resourceName, forceSecure);
return appendServerPrefix(cms, result, resourceName, false);
} | java | public String getServerLink(CmsObject cms, String resourceName, boolean forceSecure) {
String result = substituteLinkForUnknownTarget(cms, resourceName, forceSecure);
return appendServerPrefix(cms, result, resourceName, false);
} | [
"public",
"String",
"getServerLink",
"(",
"CmsObject",
"cms",
",",
"String",
"resourceName",
",",
"boolean",
"forceSecure",
")",
"{",
"String",
"result",
"=",
"substituteLinkForUnknownTarget",
"(",
"cms",
",",
"resourceName",
",",
"forceSecure",
")",
";",
"return"... | Returns the link for the given resource in the current project, with full server prefix.<p>
Like <code>http://site.enterprise.com:8080/index.html</code>.<p>
In case the resource name is a full root path, the site from the root path will be used.
Otherwise the resource is assumed to be in the current site set be the OpenCms user context.<p>
@param cms the current OpenCms user context
@param resourceName the resource to generate the online link for
@param forceSecure forces the secure server prefix
@return the link for the given resource in the current project, with full server prefix
@see #getOnlineLink(CmsObject, String) | [
"Returns",
"the",
"link",
"for",
"the",
"given",
"resource",
"in",
"the",
"current",
"project",
"with",
"full",
"server",
"prefix",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L582-L586 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java | ExpandedNameTable.initExtendedTypes | private void initExtendedTypes()
{
m_extendedTypes = new ExtendedType[m_initialSize];
for (int i = 0; i < DTM.NTYPES; i++) {
m_extendedTypes[i] = m_defaultExtendedTypes[i];
m_table[i] = new HashEntry(m_defaultExtendedTypes[i], i, i, null);
}
m_nextType = DTM.NTYPES;
} | java | private void initExtendedTypes()
{
m_extendedTypes = new ExtendedType[m_initialSize];
for (int i = 0; i < DTM.NTYPES; i++) {
m_extendedTypes[i] = m_defaultExtendedTypes[i];
m_table[i] = new HashEntry(m_defaultExtendedTypes[i], i, i, null);
}
m_nextType = DTM.NTYPES;
} | [
"private",
"void",
"initExtendedTypes",
"(",
")",
"{",
"m_extendedTypes",
"=",
"new",
"ExtendedType",
"[",
"m_initialSize",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"DTM",
".",
"NTYPES",
";",
"i",
"++",
")",
"{",
"m_extendedTypes",
"[... | Initialize the vector of extended types with the
basic DOM node types. | [
"Initialize",
"the",
"vector",
"of",
"extended",
"types",
"with",
"the",
"basic",
"DOM",
"node",
"types",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java#L133-L142 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.deleteSecretAsync | public ServiceFuture<DeletedSecretBundle> deleteSecretAsync(String vaultBaseUrl, String secretName, final ServiceCallback<DeletedSecretBundle> serviceCallback) {
return ServiceFuture.fromResponse(deleteSecretWithServiceResponseAsync(vaultBaseUrl, secretName), serviceCallback);
} | java | public ServiceFuture<DeletedSecretBundle> deleteSecretAsync(String vaultBaseUrl, String secretName, final ServiceCallback<DeletedSecretBundle> serviceCallback) {
return ServiceFuture.fromResponse(deleteSecretWithServiceResponseAsync(vaultBaseUrl, secretName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"DeletedSecretBundle",
">",
"deleteSecretAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"secretName",
",",
"final",
"ServiceCallback",
"<",
"DeletedSecretBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
... | Deletes a secret from a specified key vault.
The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied to an individual version of a secret. This operation requires the secrets/delete permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Deletes",
"a",
"secret",
"from",
"a",
"specified",
"key",
"vault",
".",
"The",
"DELETE",
"operation",
"applies",
"to",
"any",
"secret",
"stored",
"in",
"Azure",
"Key",
"Vault",
".",
"DELETE",
"cannot",
"be",
"applied",
"to",
"an",
"individual",
"version",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3545-L3547 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java | ApplicationGatewaysInner.beginCreateOrUpdateAsync | public Observable<ApplicationGatewayInner> beginCreateOrUpdateAsync(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() {
@Override
public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationGatewayInner> beginCreateOrUpdateAsync(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() {
@Override
public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationGatewayInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"applicationGatewayName",
",",
"ApplicationGatewayInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
... | Creates or updates the specified application gateway.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@param parameters Parameters supplied to the create or update application gateway operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationGatewayInner object | [
"Creates",
"or",
"updates",
"the",
"specified",
"application",
"gateway",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L508-L515 |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.asModFunction | public static MatrixFunction asModFunction(final double arg) {
return new MatrixFunction() {
@Override
public double evaluate(int i, int j, double value) {
return value % arg;
}
};
} | java | public static MatrixFunction asModFunction(final double arg) {
return new MatrixFunction() {
@Override
public double evaluate(int i, int j, double value) {
return value % arg;
}
};
} | [
"public",
"static",
"MatrixFunction",
"asModFunction",
"(",
"final",
"double",
"arg",
")",
"{",
"return",
"new",
"MatrixFunction",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"evaluate",
"(",
"int",
"i",
",",
"int",
"j",
",",
"double",
"value",
")"... | Creates a mod function that calculates the modulus of it's argument and given {@code value}.
@param arg a divisor value
@return a closure that does {@code _ % _} | [
"Creates",
"a",
"mod",
"function",
"that",
"calculates",
"the",
"modulus",
"of",
"it",
"s",
"argument",
"and",
"given",
"{",
"@code",
"value",
"}",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L503-L510 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java | HttpChannelConfig.parseServerHeader | private void parseServerHeader(Map<Object, Object> props) {
// @PK15848
String value = getProp(props, HttpConfigConstants.PROPNAME_SERVER_HEADER_VALUE);
if (null == value || "".equals(value)) {
// due to security change, do not default value in Server header. // PM87013 Start
} else {
if ("DefaultServerVersion".equalsIgnoreCase(value)) {
value = "WebSphere Application Server";
}
this.baServerHeaderValue = GenericUtils.getEnglishBytes(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: server header value [" + value + "]");
}
}
// PM87013 (PM75371) End
Object ov = props.get(HttpConfigConstants.PROPNAME_REMOVE_SERVER_HEADER);
if (null != ov) {
this.bRemoveServerHeader = convertBoolean(ov);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: remove server header is " + removeServerHeader());
}
}
} | java | private void parseServerHeader(Map<Object, Object> props) {
// @PK15848
String value = getProp(props, HttpConfigConstants.PROPNAME_SERVER_HEADER_VALUE);
if (null == value || "".equals(value)) {
// due to security change, do not default value in Server header. // PM87013 Start
} else {
if ("DefaultServerVersion".equalsIgnoreCase(value)) {
value = "WebSphere Application Server";
}
this.baServerHeaderValue = GenericUtils.getEnglishBytes(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: server header value [" + value + "]");
}
}
// PM87013 (PM75371) End
Object ov = props.get(HttpConfigConstants.PROPNAME_REMOVE_SERVER_HEADER);
if (null != ov) {
this.bRemoveServerHeader = convertBoolean(ov);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: remove server header is " + removeServerHeader());
}
}
} | [
"private",
"void",
"parseServerHeader",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"props",
")",
"{",
"// @PK15848",
"String",
"value",
"=",
"getProp",
"(",
"props",
",",
"HttpConfigConstants",
".",
"PROPNAME_SERVER_HEADER_VALUE",
")",
";",
"if",
"(",
"nul... | Check the input configuration map for the parameters that control the
Server header value.
@param props | [
"Check",
"the",
"input",
"configuration",
"map",
"for",
"the",
"parameters",
"that",
"control",
"the",
"Server",
"header",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1061-L1084 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java | PhotosetsInterface.getPhotos | public PhotoList<Photo> getPhotos(String photosetId, int perPage, int page) throws FlickrException {
return getPhotos(photosetId, Extras.MIN_EXTRAS, Flickr.PRIVACY_LEVEL_NO_FILTER, perPage, page);
} | java | public PhotoList<Photo> getPhotos(String photosetId, int perPage, int page) throws FlickrException {
return getPhotos(photosetId, Extras.MIN_EXTRAS, Flickr.PRIVACY_LEVEL_NO_FILTER, perPage, page);
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getPhotos",
"(",
"String",
"photosetId",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"return",
"getPhotos",
"(",
"photosetId",
",",
"Extras",
".",
"MIN_EXTRAS",
",",
"Flickr",
"... | Convenience method.
Calls getPhotos() with Extras.MIN_EXTRAS and Flickr.PRIVACY_LEVEL_NO_FILTER.
This method does not require authentication.
@see com.flickr4java.flickr.photos.Extras
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_NO_FILTER
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PUBLIC
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS_FAMILY
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FAMILY
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS
@param photosetId
The photoset ID
@param perPage
The number of photos per page
@param page
The page offset
@return PhotoList The Collection of Photo objects
@throws FlickrException | [
"Convenience",
"method",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L552-L554 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/BundleUtil.java | BundleUtil.resolveBundleDependencies | public static IBundleDependencies resolveBundleDependencies(Bundle bundle, String... directDependencies) {
return resolveBundleDependencies(bundle, (BundleURLMappings) null, directDependencies);
} | java | public static IBundleDependencies resolveBundleDependencies(Bundle bundle, String... directDependencies) {
return resolveBundleDependencies(bundle, (BundleURLMappings) null, directDependencies);
} | [
"public",
"static",
"IBundleDependencies",
"resolveBundleDependencies",
"(",
"Bundle",
"bundle",
",",
"String",
"...",
"directDependencies",
")",
"{",
"return",
"resolveBundleDependencies",
"(",
"bundle",
",",
"(",
"BundleURLMappings",
")",
"null",
",",
"directDependenc... | Replies the dependencies for the given bundle.
@param bundle the bundle.
@param directDependencies the list of the bundle symbolic names that are the direct dependencies of the bundle to
be considered. If the given bundle has other dependencies in its Manifest, they will be ignored if they
are not in this parameter.
@return the bundle dependencies. | [
"Replies",
"the",
"dependencies",
"for",
"the",
"given",
"bundle",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/BundleUtil.java#L242-L244 |
rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.generateNullCheck | public static JCStatement generateNullCheck(JavacTreeMaker maker, JavacNode variable, JavacNode source) {
return generateNullCheck(maker, variable, (JCVariableDecl) variable.get(), source);
} | java | public static JCStatement generateNullCheck(JavacTreeMaker maker, JavacNode variable, JavacNode source) {
return generateNullCheck(maker, variable, (JCVariableDecl) variable.get(), source);
} | [
"public",
"static",
"JCStatement",
"generateNullCheck",
"(",
"JavacTreeMaker",
"maker",
",",
"JavacNode",
"variable",
",",
"JavacNode",
"source",
")",
"{",
"return",
"generateNullCheck",
"(",
"maker",
",",
"variable",
",",
"(",
"JCVariableDecl",
")",
"variable",
"... | Generates a new statement that checks if the given variable is null, and if so, throws a configured exception with the
variable name as message. | [
"Generates",
"a",
"new",
"statement",
"that",
"checks",
"if",
"the",
"given",
"variable",
"is",
"null",
"and",
"if",
"so",
"throws",
"a",
"configured",
"exception",
"with",
"the",
"variable",
"name",
"as",
"message",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1471-L1473 |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/protocol/ChunkFetchSuccess.java | ChunkFetchSuccess.decode | public static ChunkFetchSuccess decode(ByteBuf buf) {
StreamChunkId streamChunkId = StreamChunkId.decode(buf);
buf.retain();
NettyManagedBuffer managedBuf = new NettyManagedBuffer(buf.duplicate());
return new ChunkFetchSuccess(streamChunkId, managedBuf);
} | java | public static ChunkFetchSuccess decode(ByteBuf buf) {
StreamChunkId streamChunkId = StreamChunkId.decode(buf);
buf.retain();
NettyManagedBuffer managedBuf = new NettyManagedBuffer(buf.duplicate());
return new ChunkFetchSuccess(streamChunkId, managedBuf);
} | [
"public",
"static",
"ChunkFetchSuccess",
"decode",
"(",
"ByteBuf",
"buf",
")",
"{",
"StreamChunkId",
"streamChunkId",
"=",
"StreamChunkId",
".",
"decode",
"(",
"buf",
")",
";",
"buf",
".",
"retain",
"(",
")",
";",
"NettyManagedBuffer",
"managedBuf",
"=",
"new"... | Decoding uses the given ByteBuf as our data, and will retain() it. | [
"Decoding",
"uses",
"the",
"given",
"ByteBuf",
"as",
"our",
"data",
"and",
"will",
"retain",
"()",
"it",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/protocol/ChunkFetchSuccess.java#L61-L66 |
infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/impl/MultiSubCommandInvoker.java | MultiSubCommandInvoker.invokeEach | public static Object invokeEach(InvocationContext ctx, Iterator<VisitableCommand> subCommands,
BaseAsyncInterceptor interceptor, Object finalReturnValue) {
if (!subCommands.hasNext())
return finalReturnValue;
MultiSubCommandInvoker invoker = new MultiSubCommandInvoker(interceptor, finalReturnValue, subCommands);
VisitableCommand newCommand = subCommands.next();
return interceptor.invokeNextThenApply(ctx, newCommand, invoker);
} | java | public static Object invokeEach(InvocationContext ctx, Iterator<VisitableCommand> subCommands,
BaseAsyncInterceptor interceptor, Object finalReturnValue) {
if (!subCommands.hasNext())
return finalReturnValue;
MultiSubCommandInvoker invoker = new MultiSubCommandInvoker(interceptor, finalReturnValue, subCommands);
VisitableCommand newCommand = subCommands.next();
return interceptor.invokeNextThenApply(ctx, newCommand, invoker);
} | [
"public",
"static",
"Object",
"invokeEach",
"(",
"InvocationContext",
"ctx",
",",
"Iterator",
"<",
"VisitableCommand",
">",
"subCommands",
",",
"BaseAsyncInterceptor",
"interceptor",
",",
"Object",
"finalReturnValue",
")",
"{",
"if",
"(",
"!",
"subCommands",
".",
... | Call {@link BaseAsyncInterceptor#invokeNext(InvocationContext, VisitableCommand)} on a sequence of sub-commands.
<p>
Stop when one of the sub-commands throws an exception, and return an invocation stage with that exception. If all
the sub-commands are successful, return the {@code finalStage}. If {@code finalStage} has and exception, skip all
the sub-commands and just return the {@code finalStage}. | [
"Call",
"{"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/impl/MultiSubCommandInvoker.java#L35-L43 |
checkstyle-addons/checkstyle-addons | src/main/java/com/thomasjensen/checkstyle/addons/util/Util.java | Util.findLeftMostTokenInLine | @Nonnull
public static DetailAST findLeftMostTokenInLine(@Nonnull final DetailAST pAst)
{
return findLeftMostTokenInLineInternal(pAst, pAst.getLineNo(), pAst.getColumnNo());
} | java | @Nonnull
public static DetailAST findLeftMostTokenInLine(@Nonnull final DetailAST pAst)
{
return findLeftMostTokenInLineInternal(pAst, pAst.getLineNo(), pAst.getColumnNo());
} | [
"@",
"Nonnull",
"public",
"static",
"DetailAST",
"findLeftMostTokenInLine",
"(",
"@",
"Nonnull",
"final",
"DetailAST",
"pAst",
")",
"{",
"return",
"findLeftMostTokenInLineInternal",
"(",
"pAst",
",",
"pAst",
".",
"getLineNo",
"(",
")",
",",
"pAst",
".",
"getColu... | Find the left-most token in the given AST. The left-most token is the token with the smallest column number. Only
tokens which are located on the same line as the given AST are considered.
@param pAst the root of a subtree. This token is also considered for the result.
@return the left-most token | [
"Find",
"the",
"left",
"-",
"most",
"token",
"in",
"the",
"given",
"AST",
".",
"The",
"left",
"-",
"most",
"token",
"is",
"the",
"token",
"with",
"the",
"smallest",
"column",
"number",
".",
"Only",
"tokens",
"which",
"are",
"located",
"on",
"the",
"sam... | train | https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/src/main/java/com/thomasjensen/checkstyle/addons/util/Util.java#L317-L321 |
JoeKerouac/utils | src/main/java/com/joe/utils/common/IOUtils.java | IOUtils.read | public static String read(InputStream in, String charset) throws IOException {
log.debug("开始从流中读取内容");
charset = charset == null ? "UTF8" : charset;
int bufSize = 256;
log.debug("文本编码为:{},缓冲区大小为{}byte", charset, bufSize);
return new String(read(in, bufSize), charset);
} | java | public static String read(InputStream in, String charset) throws IOException {
log.debug("开始从流中读取内容");
charset = charset == null ? "UTF8" : charset;
int bufSize = 256;
log.debug("文本编码为:{},缓冲区大小为{}byte", charset, bufSize);
return new String(read(in, bufSize), charset);
} | [
"public",
"static",
"String",
"read",
"(",
"InputStream",
"in",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"log",
".",
"debug",
"(",
"\"开始从流中读取内容\");",
"",
"",
"charset",
"=",
"charset",
"==",
"null",
"?",
"\"UTF8\"",
":",
"charset",
";",... | 将流中的数据读取为字符串(缓冲区大小为256byte)
@param in 输入流
@param charset 字符串编码
@return 流中的数据
@throws IOException IO异常 | [
"将流中的数据读取为字符串(缓冲区大小为256byte)"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/IOUtils.java#L24-L30 |
fcrepo3/fcrepo | fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/objecteditor/Util.java | Util.getObjectFields | public static ObjectFields getObjectFields(String pid, String[] fields)
throws IOException {
FieldSearchQuery query = new FieldSearchQuery();
Condition condition = new Condition();
condition.setProperty("pid");
condition.setOperator(ComparisonOperator.fromValue("eq"));
condition.setValue(pid);
FieldSearchQuery.Conditions conds = new FieldSearchQuery.Conditions();
conds.getCondition().add(condition);
ObjectFactory factory = new ObjectFactory();
query.setConditions(factory.createFieldSearchQueryConditions(conds));
FieldSearchResult result =
Administrator.APIA
.findObjects(TypeUtility.convertStringtoAOS(fields),
new BigInteger("1"),
query);
ResultList resultList = result.getResultList();
if (resultList == null || resultList.getObjectFields() == null
&& resultList.getObjectFields().size() == 0) {
throw new IOException("Object not found in repository");
}
return resultList.getObjectFields().get(0);
} | java | public static ObjectFields getObjectFields(String pid, String[] fields)
throws IOException {
FieldSearchQuery query = new FieldSearchQuery();
Condition condition = new Condition();
condition.setProperty("pid");
condition.setOperator(ComparisonOperator.fromValue("eq"));
condition.setValue(pid);
FieldSearchQuery.Conditions conds = new FieldSearchQuery.Conditions();
conds.getCondition().add(condition);
ObjectFactory factory = new ObjectFactory();
query.setConditions(factory.createFieldSearchQueryConditions(conds));
FieldSearchResult result =
Administrator.APIA
.findObjects(TypeUtility.convertStringtoAOS(fields),
new BigInteger("1"),
query);
ResultList resultList = result.getResultList();
if (resultList == null || resultList.getObjectFields() == null
&& resultList.getObjectFields().size() == 0) {
throw new IOException("Object not found in repository");
}
return resultList.getObjectFields().get(0);
} | [
"public",
"static",
"ObjectFields",
"getObjectFields",
"(",
"String",
"pid",
",",
"String",
"[",
"]",
"fields",
")",
"throws",
"IOException",
"{",
"FieldSearchQuery",
"query",
"=",
"new",
"FieldSearchQuery",
"(",
")",
";",
"Condition",
"condition",
"=",
"new",
... | Get the indicated fields of the indicated object from the repository. | [
"Get",
"the",
"indicated",
"fields",
"of",
"the",
"indicated",
"object",
"from",
"the",
"repository",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/objecteditor/Util.java#L93-L115 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java | ControlContainerContext.removeResourceContext | protected synchronized void removeResourceContext(ResourceContext resourceContext, ControlBean bean)
{
//
// Ignore removal requests received within the context of global cleanup. The
// stack is already being popped, so these are just requests for resources that
// already have in-flight removal taking place.
//
if (!_releasingAll && resourceContext.hasResources())
_resourceContexts.remove(resourceContext);
} | java | protected synchronized void removeResourceContext(ResourceContext resourceContext, ControlBean bean)
{
//
// Ignore removal requests received within the context of global cleanup. The
// stack is already being popped, so these are just requests for resources that
// already have in-flight removal taking place.
//
if (!_releasingAll && resourceContext.hasResources())
_resourceContexts.remove(resourceContext);
} | [
"protected",
"synchronized",
"void",
"removeResourceContext",
"(",
"ResourceContext",
"resourceContext",
",",
"ControlBean",
"bean",
")",
"{",
"//",
"// Ignore removal requests received within the context of global cleanup. The",
"// stack is already being popped, so these are just requ... | Removes a managed ResourceContext from the ControlContainerContext. This method
is used to unregister a resource context that has already acquired resources
@param resourceContext the ResourceContext service to be removed
@param bean the acquiring ControlBean. Unused by the base implementation, but
available so subclassed containers can have access to the bean. | [
"Removes",
"a",
"managed",
"ResourceContext",
"from",
"the",
"ControlContainerContext",
".",
"This",
"method",
"is",
"used",
"to",
"unregister",
"a",
"resource",
"context",
"that",
"has",
"already",
"acquired",
"resources"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L112-L121 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/Widgets.java | Widgets.newScrollPanelX | public static ScrollPanel newScrollPanelX (Widget contents, int maxWidth)
{
ScrollPanel panel = new ScrollPanel(contents);
DOM.setStyleAttribute(panel.getElement(), "maxWidth", maxWidth + "px");
return panel;
} | java | public static ScrollPanel newScrollPanelX (Widget contents, int maxWidth)
{
ScrollPanel panel = new ScrollPanel(contents);
DOM.setStyleAttribute(panel.getElement(), "maxWidth", maxWidth + "px");
return panel;
} | [
"public",
"static",
"ScrollPanel",
"newScrollPanelX",
"(",
"Widget",
"contents",
",",
"int",
"maxWidth",
")",
"{",
"ScrollPanel",
"panel",
"=",
"new",
"ScrollPanel",
"(",
"contents",
")",
";",
"DOM",
".",
"setStyleAttribute",
"(",
"panel",
".",
"getElement",
"... | Wraps the supplied contents in a scroll panel with the specified maximum width. | [
"Wraps",
"the",
"supplied",
"contents",
"in",
"a",
"scroll",
"panel",
"with",
"the",
"specified",
"maximum",
"width",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L119-L124 |
osglworks/java-mvc | src/main/java/org/osgl/mvc/result/RequestTimeout.java | RequestTimeout.of | public static RequestTimeout of(Throwable cause) {
if (_localizedErrorMsg()) {
return of(cause, defaultMessage(REQUEST_TIMEOUT));
} else {
touchPayload().cause(cause);
return _INSTANCE;
}
} | java | public static RequestTimeout of(Throwable cause) {
if (_localizedErrorMsg()) {
return of(cause, defaultMessage(REQUEST_TIMEOUT));
} else {
touchPayload().cause(cause);
return _INSTANCE;
}
} | [
"public",
"static",
"RequestTimeout",
"of",
"(",
"Throwable",
"cause",
")",
"{",
"if",
"(",
"_localizedErrorMsg",
"(",
")",
")",
"{",
"return",
"of",
"(",
"cause",
",",
"defaultMessage",
"(",
"REQUEST_TIMEOUT",
")",
")",
";",
"}",
"else",
"{",
"touchPayloa... | Returns a static RequestTimeout instance and set the {@link #payload} thread local
with cause specified.
When calling the instance on {@link #getMessage()} method, it will return whatever
stored in the {@link #payload} thread local
@param cause the cause
@return a static RequestTimeout instance as described above | [
"Returns",
"a",
"static",
"RequestTimeout",
"instance",
"and",
"set",
"the",
"{",
"@link",
"#payload",
"}",
"thread",
"local",
"with",
"cause",
"specified",
"."
] | train | https://github.com/osglworks/java-mvc/blob/4d2b2ec40498ac6ee7040c0424377cbeacab124b/src/main/java/org/osgl/mvc/result/RequestTimeout.java#L120-L127 |
real-logic/agrona | agrona/src/main/java/org/agrona/Verify.java | Verify.present | public static void present(final Map<?, ?> map, final Object key, final String name)
{
if (null == map.get(key))
{
throw new IllegalStateException(name + " not found in map for key: " + key);
}
} | java | public static void present(final Map<?, ?> map, final Object key, final String name)
{
if (null == map.get(key))
{
throw new IllegalStateException(name + " not found in map for key: " + key);
}
} | [
"public",
"static",
"void",
"present",
"(",
"final",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"final",
"Object",
"key",
",",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"null",
"==",
"map",
".",
"get",
"(",
"key",
")",
")",
"{",
"throw",
... | Verify that a map contains an entry for a given key.
@param map to be checked.
@param key to get by.
@param name of entry.
@throws NullPointerException if map or key is null
@throws IllegalStateException if the entry does not exist. | [
"Verify",
"that",
"a",
"map",
"contains",
"an",
"entry",
"for",
"a",
"given",
"key",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/Verify.java#L62-L68 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/result/impl/DefaultAsyncSearchQueryResult.java | DefaultAsyncSearchQueryResult.fromIndexNotFound | @Deprecated
public static AsyncSearchQueryResult fromIndexNotFound(final String indexName) {
//dummy default values
SearchStatus status = new DefaultSearchStatus(1L, 1L, 0L);
SearchMetrics metrics = new DefaultSearchMetrics(0L, 0L, 0d);
return new DefaultAsyncSearchQueryResult(
status,
Observable.<SearchQueryRow>error(new IndexDoesNotExistException("Search Index \"" + indexName
+ "\" Not Found")),
Observable.<FacetResult>empty(),
Observable.just(metrics)
);
} | java | @Deprecated
public static AsyncSearchQueryResult fromIndexNotFound(final String indexName) {
//dummy default values
SearchStatus status = new DefaultSearchStatus(1L, 1L, 0L);
SearchMetrics metrics = new DefaultSearchMetrics(0L, 0L, 0d);
return new DefaultAsyncSearchQueryResult(
status,
Observable.<SearchQueryRow>error(new IndexDoesNotExistException("Search Index \"" + indexName
+ "\" Not Found")),
Observable.<FacetResult>empty(),
Observable.just(metrics)
);
} | [
"@",
"Deprecated",
"public",
"static",
"AsyncSearchQueryResult",
"fromIndexNotFound",
"(",
"final",
"String",
"indexName",
")",
"{",
"//dummy default values",
"SearchStatus",
"status",
"=",
"new",
"DefaultSearchStatus",
"(",
"1L",
",",
"1L",
",",
"0L",
")",
";",
"... | A utility method to return a result when the index is not found.
@return an {@link AsyncSearchQueryResult} that will emit a {@link IndexDoesNotExistException} when calling
its {@link AsyncSearchQueryResult#hits() hits()} method.
@deprecated FTS is still in BETA so the response format is likely to change in a future version, and be
unified with the HTTP 200 response format. | [
"A",
"utility",
"method",
"to",
"return",
"a",
"result",
"when",
"the",
"index",
"is",
"not",
"found",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/result/impl/DefaultAsyncSearchQueryResult.java#L325-L339 |
Falydoor/limesurvey-rc | src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java | LimesurveyRC.completeResponse | public boolean completeResponse(int surveyId, int responseId, LocalDateTime date) throws LimesurveyRCException {
Map<String, String> responseData = new HashMap<>();
responseData.put("submitdate", date.format(DateTimeFormatter.ISO_LOCAL_DATE) + " " + date.format(DateTimeFormatter.ISO_LOCAL_TIME));
JsonElement result = updateResponse(surveyId, responseId, responseData);
if (!result.getAsBoolean()) {
throw new LimesurveyRCException(result.getAsString());
}
return true;
} | java | public boolean completeResponse(int surveyId, int responseId, LocalDateTime date) throws LimesurveyRCException {
Map<String, String> responseData = new HashMap<>();
responseData.put("submitdate", date.format(DateTimeFormatter.ISO_LOCAL_DATE) + " " + date.format(DateTimeFormatter.ISO_LOCAL_TIME));
JsonElement result = updateResponse(surveyId, responseId, responseData);
if (!result.getAsBoolean()) {
throw new LimesurveyRCException(result.getAsString());
}
return true;
} | [
"public",
"boolean",
"completeResponse",
"(",
"int",
"surveyId",
",",
"int",
"responseId",
",",
"LocalDateTime",
"date",
")",
"throws",
"LimesurveyRCException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"responseData",
"=",
"new",
"HashMap",
"<>",
"(",
")... | Complete a response.
@param surveyId the survey id of the survey you want to complete the response
@param responseId the response id of the response you want to complete
@param date the date where the response will be completed (submitdate)
@return true if the response was successfuly completed
@throws LimesurveyRCException the limesurvey rc exception | [
"Complete",
"a",
"response",
"."
] | train | https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L167-L177 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.timestampFormat | protected static void timestampFormat(DateFormat format, String... attributeNames) {
ModelDelegate.timestampFormat(modelClass(), format, attributeNames);
} | java | protected static void timestampFormat(DateFormat format, String... attributeNames) {
ModelDelegate.timestampFormat(modelClass(), format, attributeNames);
} | [
"protected",
"static",
"void",
"timestampFormat",
"(",
"DateFormat",
"format",
",",
"String",
"...",
"attributeNames",
")",
"{",
"ModelDelegate",
".",
"timestampFormat",
"(",
"modelClass",
"(",
")",
",",
"format",
",",
"attributeNames",
")",
";",
"}"
] | Registers date format for specified attributes. This format will be used to convert between
Date -> String -> java.sql.Timestamp when using the appropriate getters and setters.
<p>See example in {@link #timestampFormat(String, String...)}.
@param format format to use for conversion
@param attributeNames attribute names | [
"Registers",
"date",
"format",
"for",
"specified",
"attributes",
".",
"This",
"format",
"will",
"be",
"used",
"to",
"convert",
"between",
"Date",
"-",
">",
"String",
"-",
">",
"java",
".",
"sql",
".",
"Timestamp",
"when",
"using",
"the",
"appropriate",
"ge... | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L2183-L2185 |
lets-blade/blade | src/main/java/com/blade/Environment.java | Environment.of | public static Environment of(@NonNull Map<String, String> map) {
var environment = new Environment();
map.forEach((key, value) -> environment.props.setProperty(key, value));
return environment;
} | java | public static Environment of(@NonNull Map<String, String> map) {
var environment = new Environment();
map.forEach((key, value) -> environment.props.setProperty(key, value));
return environment;
} | [
"public",
"static",
"Environment",
"of",
"(",
"@",
"NonNull",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"var",
"environment",
"=",
"new",
"Environment",
"(",
")",
";",
"map",
".",
"forEach",
"(",
"(",
"key",
",",
"value",
")",
"->",
... | Map to Environment
@param map config map
@return return Environment instance | [
"Map",
"to",
"Environment"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Environment.java#L86-L90 |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/utils/PropertyUtils.java | PropertyUtils.getPropertyType | public static Type getPropertyType(Class<?> beanClass, String field) {
try {
return INSTANCE.findPropertyType(beanClass, field);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw handleReflectionException(beanClass, field, e);
}
} | java | public static Type getPropertyType(Class<?> beanClass, String field) {
try {
return INSTANCE.findPropertyType(beanClass, field);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw handleReflectionException(beanClass, field, e);
}
} | [
"public",
"static",
"Type",
"getPropertyType",
"(",
"Class",
"<",
"?",
">",
"beanClass",
",",
"String",
"field",
")",
"{",
"try",
"{",
"return",
"INSTANCE",
".",
"findPropertyType",
"(",
"beanClass",
",",
"field",
")",
";",
"}",
"catch",
"(",
"NoSuchMethod... | Similar to {@link PropertyUtils#getPropertyClass(Class,List)} but returns the property class.
@param beanClass bean to be accessed
@param field bean's fieldName
@return bean's property class | [
"Similar",
"to",
"{",
"@link",
"PropertyUtils#getPropertyClass",
"(",
"Class",
"List",
")",
"}",
"but",
"returns",
"the",
"property",
"class",
"."
] | train | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/PropertyUtils.java#L78-L84 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java | LinearLayout.setDividerPadding | public void setDividerPadding(float padding, final Axis axis) {
if (axis == getOrientationAxis()) {
super.setDividerPadding(padding, axis);
} else {
Log.w(TAG, "Cannot apply divider padding for wrong axis [%s], orientation = %s",
axis, getOrientation());
}
} | java | public void setDividerPadding(float padding, final Axis axis) {
if (axis == getOrientationAxis()) {
super.setDividerPadding(padding, axis);
} else {
Log.w(TAG, "Cannot apply divider padding for wrong axis [%s], orientation = %s",
axis, getOrientation());
}
} | [
"public",
"void",
"setDividerPadding",
"(",
"float",
"padding",
",",
"final",
"Axis",
"axis",
")",
"{",
"if",
"(",
"axis",
"==",
"getOrientationAxis",
"(",
")",
")",
"{",
"super",
".",
"setDividerPadding",
"(",
"padding",
",",
"axis",
")",
";",
"}",
"els... | Sets divider padding for axis. If axis does not match the orientation, it has no effect.
@param padding
@param axis {@link Axis} | [
"Sets",
"divider",
"padding",
"for",
"axis",
".",
"If",
"axis",
"does",
"not",
"match",
"the",
"orientation",
"it",
"has",
"no",
"effect",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L137-L144 |
DavidPizarro/PinView | library/src/main/java/com/dpizarro/pinview/library/PinView.java | PinView.setPin | public void setPin(int numberPinBoxes, int inputType) {
if(numberPinBoxes<=0) {
numberPinBoxes = mNumberPinBoxes;
}
mLinearLayoutPinBoxes.removeAllViews();
setNumberPinBoxes(numberPinBoxes);
pinBoxesIds = new int[numberPinBoxes];
pinSplitsIds = new int[numberPinBoxes-1];
int index = 0;
for (int i = 0; i < numberPinBoxes; i++) {
mLinearLayoutPinBoxes.addView(generatePinBox(i, inputType), index);
if (mSplit != null && !mSplit.isEmpty() && i < numberPinBoxes - 1) {
mLinearLayoutPinBoxes.addView(generateSplit(i), index + 1);
mLinearLayoutPinBoxes.setGravity(Gravity.CENTER_VERTICAL);
index += 2;
} else {
index++;
}
}
} | java | public void setPin(int numberPinBoxes, int inputType) {
if(numberPinBoxes<=0) {
numberPinBoxes = mNumberPinBoxes;
}
mLinearLayoutPinBoxes.removeAllViews();
setNumberPinBoxes(numberPinBoxes);
pinBoxesIds = new int[numberPinBoxes];
pinSplitsIds = new int[numberPinBoxes-1];
int index = 0;
for (int i = 0; i < numberPinBoxes; i++) {
mLinearLayoutPinBoxes.addView(generatePinBox(i, inputType), index);
if (mSplit != null && !mSplit.isEmpty() && i < numberPinBoxes - 1) {
mLinearLayoutPinBoxes.addView(generateSplit(i), index + 1);
mLinearLayoutPinBoxes.setGravity(Gravity.CENTER_VERTICAL);
index += 2;
} else {
index++;
}
}
} | [
"public",
"void",
"setPin",
"(",
"int",
"numberPinBoxes",
",",
"int",
"inputType",
")",
"{",
"if",
"(",
"numberPinBoxes",
"<=",
"0",
")",
"{",
"numberPinBoxes",
"=",
"mNumberPinBoxes",
";",
"}",
"mLinearLayoutPinBoxes",
".",
"removeAllViews",
"(",
")",
";",
... | Set PinBoxes (see {@link EditText}) number to add to {@link PinView}, with all attributes, including splits.
@param numberPinBoxes number of PinBoxes
@param inputType input type of each PinBox (see {@link InputType}) | [
"Set",
"PinBoxes",
"(",
"see",
"{",
"@link",
"EditText",
"}",
")",
"number",
"to",
"add",
"to",
"{",
"@link",
"PinView",
"}",
"with",
"all",
"attributes",
"including",
"splits",
"."
] | train | https://github.com/DavidPizarro/PinView/blob/b171a89694921475b5442585810b8475ef1cfe35/library/src/main/java/com/dpizarro/pinview/library/PinView.java#L94-L115 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.