repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Double> getAt(double[] array, Range range) {
return primitiveArrayGet(array, range);
} | java | @SuppressWarnings("unchecked")
public static List<Double> getAt(double[] array, Range range) {
return primitiveArrayGet(array, range);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Double",
">",
"getAt",
"(",
"double",
"[",
"]",
"array",
",",
"Range",
"range",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"range",
")",
";",
"}"
] | Support the subscript operator with a range for a double array
@param array a double array
@param range a range indicating the indices for the items to retrieve
@return list of the retrieved doubles
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"range",
"for",
"a",
"double",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13688-L13691 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java | MapFixture.sizeOfIn | public int sizeOfIn(String expr, Map<String, Object> map) {
return getMapHelper().sizeOfIn(expr, map);
} | java | public int sizeOfIn(String expr, Map<String, Object> map) {
return getMapHelper().sizeOfIn(expr, map);
} | [
"public",
"int",
"sizeOfIn",
"(",
"String",
"expr",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"return",
"getMapHelper",
"(",
")",
".",
"sizeOfIn",
"(",
"expr",
",",
"map",
")",
";",
"}"
] | Determines size of either (Map or Collection) value in the map.
@param expr expression indicating which (possibly nested) value in the map to determine size of.
@param map map to find value in.
@return size of value.
@throws SlimFixtureException if the value found is not a Map or Collection. | [
"Determines",
"size",
"of",
"either",
"(",
"Map",
"or",
"Collection",
")",
"value",
"in",
"the",
"map",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java#L158-L160 |
facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.zoomToPoint | public void zoomToPoint(float scale, PointF imagePoint, PointF viewPoint) {
FLog.v(TAG, "zoomToPoint");
calculateZoomToPointTransform(mActiveTransform, scale, imagePoint, viewPoint, LIMIT_ALL);
onTransformChanged();
} | java | public void zoomToPoint(float scale, PointF imagePoint, PointF viewPoint) {
FLog.v(TAG, "zoomToPoint");
calculateZoomToPointTransform(mActiveTransform, scale, imagePoint, viewPoint, LIMIT_ALL);
onTransformChanged();
} | [
"public",
"void",
"zoomToPoint",
"(",
"float",
"scale",
",",
"PointF",
"imagePoint",
",",
"PointF",
"viewPoint",
")",
"{",
"FLog",
".",
"v",
"(",
"TAG",
",",
"\"zoomToPoint\"",
")",
";",
"calculateZoomToPointTransform",
"(",
"mActiveTransform",
",",
"scale",
"... | Zooms to the desired scale and positions the image so that the given image point corresponds
to the given view point.
@param scale desired scale, will be limited to {min, max} scale factor
@param imagePoint 2D point in image's relative coordinate system (i.e. 0 <= x, y <= 1)
@param viewPoint 2D point in view's absolute coordinate system | [
"Zooms",
"to",
"the",
"desired",
"scale",
"and",
"positions",
"the",
"image",
"so",
"that",
"the",
"given",
"image",
"point",
"corresponds",
"to",
"the",
"given",
"view",
"point",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L347-L351 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.doLike | private ZealotKhala doLike(String prefix, String field, Object value, boolean match, boolean positive) {
if (match) {
String suffix = positive ? ZealotConst.LIKE_KEY : ZealotConst.NOT_LIKE_KEY;
SqlInfoBuilder.newInstace(this.source.setPrefix(prefix).setSuffix(suffix)).buildLikeSql(field, value);
this.source.resetPrefix();
}
return this;
} | java | private ZealotKhala doLike(String prefix, String field, Object value, boolean match, boolean positive) {
if (match) {
String suffix = positive ? ZealotConst.LIKE_KEY : ZealotConst.NOT_LIKE_KEY;
SqlInfoBuilder.newInstace(this.source.setPrefix(prefix).setSuffix(suffix)).buildLikeSql(field, value);
this.source.resetPrefix();
}
return this;
} | [
"private",
"ZealotKhala",
"doLike",
"(",
"String",
"prefix",
",",
"String",
"field",
",",
"Object",
"value",
",",
"boolean",
"match",
",",
"boolean",
"positive",
")",
"{",
"if",
"(",
"match",
")",
"{",
"String",
"suffix",
"=",
"positive",
"?",
"ZealotConst... | 执行生成like模糊查询SQL片段的方法.
@param prefix 前缀
@param field 数据库字段
@param value 值
@param match 是否匹配
@param positive true则表示是like,否则是not like
@return ZealotKhala实例的当前实例 | [
"执行生成like模糊查询SQL片段的方法",
"."
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L392-L399 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/serializer/ParameterSerializer.java | ParameterSerializer.parseArrayCollection | @SuppressWarnings("rawtypes")
protected ISFSArray parseArrayCollection(GetterMethodCover method,
Collection collection) {
ISFSArray result = new SFSArray();
SFSDataType dataType = ParamTypeParser
.getParamType(method.getGenericType());
Class<?> type = method.getGenericType().getComponentType();
for(Object obj : collection) {
Object value = obj;
if(isPrimitiveChar(type)) {
value = charArrayToByteArray((char[])value);
}
else if(isWrapperByte(type)) {
value = toPrimitiveByteArray((Byte[])value);
}
else if(isWrapperChar(type)) {
value = charWrapperArrayToPrimitiveByteArray((Character[])value);
}
else {
value = arrayToList(value);
}
result.add(new SFSDataWrapper(dataType, value));
}
return result;
} | java | @SuppressWarnings("rawtypes")
protected ISFSArray parseArrayCollection(GetterMethodCover method,
Collection collection) {
ISFSArray result = new SFSArray();
SFSDataType dataType = ParamTypeParser
.getParamType(method.getGenericType());
Class<?> type = method.getGenericType().getComponentType();
for(Object obj : collection) {
Object value = obj;
if(isPrimitiveChar(type)) {
value = charArrayToByteArray((char[])value);
}
else if(isWrapperByte(type)) {
value = toPrimitiveByteArray((Byte[])value);
}
else if(isWrapperChar(type)) {
value = charWrapperArrayToPrimitiveByteArray((Character[])value);
}
else {
value = arrayToList(value);
}
result.add(new SFSDataWrapper(dataType, value));
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"protected",
"ISFSArray",
"parseArrayCollection",
"(",
"GetterMethodCover",
"method",
",",
"Collection",
"collection",
")",
"{",
"ISFSArray",
"result",
"=",
"new",
"SFSArray",
"(",
")",
";",
"SFSDataType",
"dataType... | Serialize collection of array to a SFSArray
@param method structure of getter method
@param collection collection of objects
@return the SFSArray | [
"Serialize",
"collection",
"of",
"array",
"to",
"a",
"SFSArray"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serializer/ParameterSerializer.java#L368-L392 |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.getDoubleWithDefault | @Override
public Double getDoubleWithDefault(final String key, Double defaultValue) {
return retrieve(new Callable<Double>() {
@Override
public Double call() throws Exception {
return configuration.getDouble(key);
}
}, defaultValue);
} | java | @Override
public Double getDoubleWithDefault(final String key, Double defaultValue) {
return retrieve(new Callable<Double>() {
@Override
public Double call() throws Exception {
return configuration.getDouble(key);
}
}, defaultValue);
} | [
"@",
"Override",
"public",
"Double",
"getDoubleWithDefault",
"(",
"final",
"String",
"key",
",",
"Double",
"defaultValue",
")",
"{",
"return",
"retrieve",
"(",
"new",
"Callable",
"<",
"Double",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Double",
"call",... | Get a Double property or a default value when property cannot be found
in any configuration file.
@param key the key used in the configuration file.
@param defaultValue Default value returned, when value cannot be found in
configuration.
@return the value of the key or the default value. | [
"Get",
"a",
"Double",
"property",
"or",
"a",
"default",
"value",
"when",
"property",
"cannot",
"be",
"found",
"in",
"any",
"configuration",
"file",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L193-L201 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java | SyncMembersInner.beginRefreshMemberSchemaAsync | public Observable<Void> beginRefreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) {
return beginRefreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginRefreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) {
return beginRefreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginRefreshMemberSchemaAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"syncGroupName",
",",
"String",
"syncMemberName",
")",
"{",
"return",
"beginRefres... | Refreshes a sync member database schema.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database on which the sync group is hosted.
@param syncGroupName The name of the sync group on which the sync member is hosted.
@param syncMemberName The name of the sync member.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Refreshes",
"a",
"sync",
"member",
"database",
"schema",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L1271-L1278 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/topology/BaseTridentTopology.java | BaseTridentTopology.submitTopology | public void submitTopology(StormTopology topology, boolean isLocal) throws Exception
{
if (isLocal)
{
// ローカル環境で実行
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(this.topologyName, this.config, topology);
}
else
{
// 分散環境で実行
try
{
StormSubmitter.submitTopology(this.topologyName, this.config, topology);
}
catch (Exception ex)
{
String logFormat = "Occur exception at Topology Submit. Skip Topology Submit. : TopologyName={0}";
logger.error(MessageFormat.format(logFormat, this.topologyName), ex);
}
}
} | java | public void submitTopology(StormTopology topology, boolean isLocal) throws Exception
{
if (isLocal)
{
// ローカル環境で実行
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(this.topologyName, this.config, topology);
}
else
{
// 分散環境で実行
try
{
StormSubmitter.submitTopology(this.topologyName, this.config, topology);
}
catch (Exception ex)
{
String logFormat = "Occur exception at Topology Submit. Skip Topology Submit. : TopologyName={0}";
logger.error(MessageFormat.format(logFormat, this.topologyName), ex);
}
}
} | [
"public",
"void",
"submitTopology",
"(",
"StormTopology",
"topology",
",",
"boolean",
"isLocal",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isLocal",
")",
"{",
"// ローカル環境で実行",
"LocalCluster",
"cluster",
"=",
"new",
"LocalCluster",
"(",
")",
";",
"cluster",
"... | Topologyを実行する。
@param topology StormTopology
@param isLocal true:ローカルモード、false:分散モード
@throws Exception Topology実行失敗時 | [
"Topologyを実行する。"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/topology/BaseTridentTopology.java#L66-L87 |
bazaarvoice/emodb | common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/StandardStashReader.java | StandardStashReader.getLockedView | public StashReader getLockedView() {
return new FixedStashReader(URI.create(String.format("s3://%s/%s", _bucket, getRootPath())), _s3);
} | java | public StashReader getLockedView() {
return new FixedStashReader(URI.create(String.format("s3://%s/%s", _bucket, getRootPath())), _s3);
} | [
"public",
"StashReader",
"getLockedView",
"(",
")",
"{",
"return",
"new",
"FixedStashReader",
"(",
"URI",
".",
"create",
"(",
"String",
".",
"format",
"(",
"\"s3://%s/%s\"",
",",
"_bucket",
",",
"getRootPath",
"(",
")",
")",
")",
",",
"_s3",
")",
";",
"}... | Returns a new StashReader that is locked to the same stash time the instance is currently using. Future calls to
lock or unlock the stash time on this instance will not affect the returned instance. | [
"Returns",
"a",
"new",
"StashReader",
"that",
"is",
"locked",
"to",
"the",
"same",
"stash",
"time",
"the",
"instance",
"is",
"currently",
"using",
".",
"Future",
"calls",
"to",
"lock",
"or",
"unlock",
"the",
"stash",
"time",
"on",
"this",
"instance",
"will... | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/StandardStashReader.java#L194-L196 |
google/gson | proto/src/main/java/com/google/gson/protobuf/ProtoTypeAdapter.java | ProtoTypeAdapter.getCustSerializedName | private String getCustSerializedName(FieldOptions options, String defaultName) {
for (Extension<FieldOptions, String> extension : serializedNameExtensions) {
if (options.hasExtension(extension)) {
return options.getExtension(extension);
}
}
return protoFormat.to(jsonFormat, defaultName);
} | java | private String getCustSerializedName(FieldOptions options, String defaultName) {
for (Extension<FieldOptions, String> extension : serializedNameExtensions) {
if (options.hasExtension(extension)) {
return options.getExtension(extension);
}
}
return protoFormat.to(jsonFormat, defaultName);
} | [
"private",
"String",
"getCustSerializedName",
"(",
"FieldOptions",
"options",
",",
"String",
"defaultName",
")",
"{",
"for",
"(",
"Extension",
"<",
"FieldOptions",
",",
"String",
">",
"extension",
":",
"serializedNameExtensions",
")",
"{",
"if",
"(",
"options",
... | Retrieves the custom field name from the given options, and if not found, returns the specified
default name. | [
"Retrieves",
"the",
"custom",
"field",
"name",
"from",
"the",
"given",
"options",
"and",
"if",
"not",
"found",
"returns",
"the",
"specified",
"default",
"name",
"."
] | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/proto/src/main/java/com/google/gson/protobuf/ProtoTypeAdapter.java#L333-L340 |
apiman/apiman | gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/ApiRequestExecutorImpl.java | ApiRequestExecutorImpl.createRequestChain | private Chain<ApiRequest> createRequestChain(IAsyncHandler<ApiRequest> requestHandler) {
RequestChain chain = new RequestChain(policyImpls, context);
chain.headHandler(requestHandler);
chain.policyFailureHandler(failure -> {
// Jump straight to the response leg.
// It will likely not have been initialised, so create one.
if (responseChain == null) {
// Its response will not be used as we take the failure path only, so we just use an empty lambda.
responseChain = createResponseChain((ignored) -> {});
}
responseChain.doFailure(failure);
});
chain.policyErrorHandler(policyErrorHandler);
return chain;
} | java | private Chain<ApiRequest> createRequestChain(IAsyncHandler<ApiRequest> requestHandler) {
RequestChain chain = new RequestChain(policyImpls, context);
chain.headHandler(requestHandler);
chain.policyFailureHandler(failure -> {
// Jump straight to the response leg.
// It will likely not have been initialised, so create one.
if (responseChain == null) {
// Its response will not be used as we take the failure path only, so we just use an empty lambda.
responseChain = createResponseChain((ignored) -> {});
}
responseChain.doFailure(failure);
});
chain.policyErrorHandler(policyErrorHandler);
return chain;
} | [
"private",
"Chain",
"<",
"ApiRequest",
">",
"createRequestChain",
"(",
"IAsyncHandler",
"<",
"ApiRequest",
">",
"requestHandler",
")",
"{",
"RequestChain",
"chain",
"=",
"new",
"RequestChain",
"(",
"policyImpls",
",",
"context",
")",
";",
"chain",
".",
"headHand... | Creates the chain used to apply policies in order to the api request. | [
"Creates",
"the",
"chain",
"used",
"to",
"apply",
"policies",
"in",
"order",
"to",
"the",
"api",
"request",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/ApiRequestExecutorImpl.java#L805-L819 |
xwiki/xwiki-rendering | xwiki-rendering-syntaxes/xwiki-rendering-syntax-xwiki20/src/main/java/org/xwiki/rendering/internal/renderer/xwiki20/AbstractStackingInlineContentChainingListener.java | AbstractStackingInlineContentChainingListener.stopStacking | protected void stopStacking()
{
if (this.isStacking) {
// Stop stacking in this listener
setLookaheadDepth(0);
this.isStacking = false;
// Flush all stacked events BUT flush them in the Lookahead Listener at the beginning of the stack, in order
// to replay them and thus not break the ordering of them since there are begin/end methods in
// XWikiSyntaxChainingRenderer that will check for the next event (e.g. onNewLine()).
LookaheadChainingListener listener =
(LookaheadChainingListener) getListenerChain().getListener(LookaheadChainingListener.class);
QueueListener previousEvents = getPreviousEvents();
if (shouldInsertGroupBlock()) {
previousEvents.offerFirst(previousEvents.new Event(EventType.BEGIN_GROUP,
Collections.emptyMap()));
// Note: we need to insert before the last element since that one is the element closing the stacking
// (e.g. end item list for a list item) and it's already on the stack.
previousEvents.add(previousEvents.size() - 1,
previousEvents.new Event(EventType.END_GROUP, Collections.emptyMap()));
}
listener.transferStart(previousEvents);
}
} | java | protected void stopStacking()
{
if (this.isStacking) {
// Stop stacking in this listener
setLookaheadDepth(0);
this.isStacking = false;
// Flush all stacked events BUT flush them in the Lookahead Listener at the beginning of the stack, in order
// to replay them and thus not break the ordering of them since there are begin/end methods in
// XWikiSyntaxChainingRenderer that will check for the next event (e.g. onNewLine()).
LookaheadChainingListener listener =
(LookaheadChainingListener) getListenerChain().getListener(LookaheadChainingListener.class);
QueueListener previousEvents = getPreviousEvents();
if (shouldInsertGroupBlock()) {
previousEvents.offerFirst(previousEvents.new Event(EventType.BEGIN_GROUP,
Collections.emptyMap()));
// Note: we need to insert before the last element since that one is the element closing the stacking
// (e.g. end item list for a list item) and it's already on the stack.
previousEvents.add(previousEvents.size() - 1,
previousEvents.new Event(EventType.END_GROUP, Collections.emptyMap()));
}
listener.transferStart(previousEvents);
}
} | [
"protected",
"void",
"stopStacking",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isStacking",
")",
"{",
"// Stop stacking in this listener",
"setLookaheadDepth",
"(",
"0",
")",
";",
"this",
".",
"isStacking",
"=",
"false",
";",
"// Flush all stacked events BUT flush the... | Stop stacking events and move them back to the {@link LookaheadChainingListener} to replay them. | [
"Stop",
"stacking",
"events",
"and",
"move",
"them",
"back",
"to",
"the",
"{"
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-syntaxes/xwiki-rendering-syntax-xwiki20/src/main/java/org/xwiki/rendering/internal/renderer/xwiki20/AbstractStackingInlineContentChainingListener.java#L176-L199 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/DBObject.java | DBObject.removeFieldValues | public void removeFieldValues(String fieldName, Collection<String> values) {
Utils.require(!Utils.isEmpty(fieldName), "fieldName");
if (values != null && values.size() > 0) {
List<String> valueSet = m_valueRemoveMap.get(fieldName);
if (valueSet == null) {
valueSet = new ArrayList<String>();
m_valueRemoveMap.put(fieldName, valueSet);
}
valueSet.addAll(values);
}
} | java | public void removeFieldValues(String fieldName, Collection<String> values) {
Utils.require(!Utils.isEmpty(fieldName), "fieldName");
if (values != null && values.size() > 0) {
List<String> valueSet = m_valueRemoveMap.get(fieldName);
if (valueSet == null) {
valueSet = new ArrayList<String>();
m_valueRemoveMap.put(fieldName, valueSet);
}
valueSet.addAll(values);
}
} | [
"public",
"void",
"removeFieldValues",
"(",
"String",
"fieldName",
",",
"Collection",
"<",
"String",
">",
"values",
")",
"{",
"Utils",
".",
"require",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"fieldName",
")",
",",
"\"fieldName\"",
")",
";",
"if",
"(",
"v... | Add "remove" values for the given field. This method should only be called for MV
scalar and link fields. When the updates in this DBObject are applied to the
database, the given set of values are removed for the object. An exception is
thrown if the field is not MV. If the given set of values is null or empty, this
method is a no-op.
@param fieldName Name of an MV field to remove" values for.
@param values Collection values to remove for the field. | [
"Add",
"remove",
"values",
"for",
"the",
"given",
"field",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"for",
"MV",
"scalar",
"and",
"link",
"fields",
".",
"When",
"the",
"updates",
"in",
"this",
"DBObject",
"are",
"applied",
"to",
"the",
"d... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/DBObject.java#L459-L469 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxWebHook.java | BoxWebHook.validateTrigger | private static void validateTrigger(String targetType, BoxWebHook.Trigger trigger) {
for (String type : trigger.getTypes()) {
if (targetType.equals(type)) {
return;
}
}
throw new IllegalArgumentException(String.format(
"Provided trigger '%s' is not supported on provided target '%s'.", trigger.name(), targetType));
} | java | private static void validateTrigger(String targetType, BoxWebHook.Trigger trigger) {
for (String type : trigger.getTypes()) {
if (targetType.equals(type)) {
return;
}
}
throw new IllegalArgumentException(String.format(
"Provided trigger '%s' is not supported on provided target '%s'.", trigger.name(), targetType));
} | [
"private",
"static",
"void",
"validateTrigger",
"(",
"String",
"targetType",
",",
"BoxWebHook",
".",
"Trigger",
"trigger",
")",
"{",
"for",
"(",
"String",
"type",
":",
"trigger",
".",
"getTypes",
"(",
")",
")",
"{",
"if",
"(",
"targetType",
".",
"equals",
... | Validates that provided {@link BoxWebHook.Trigger} can be applied on the provided {@link BoxResourceType}.
@param targetType
on which targets the trigger should be applied to
@param trigger
for check
@see #validateTriggers(String, Collection) | [
"Validates",
"that",
"provided",
"{",
"@link",
"BoxWebHook",
".",
"Trigger",
"}",
"can",
"be",
"applied",
"on",
"the",
"provided",
"{",
"@link",
"BoxResourceType",
"}",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxWebHook.java#L250-L258 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java | CommerceWarehouseItemPersistenceImpl.findByCPI_CPIU | @Override
public List<CommerceWarehouseItem> findByCPI_CPIU(long CProductId,
String CPInstanceUuid, int start, int end) {
return findByCPI_CPIU(CProductId, CPInstanceUuid, start, end, null);
} | java | @Override
public List<CommerceWarehouseItem> findByCPI_CPIU(long CProductId,
String CPInstanceUuid, int start, int end) {
return findByCPI_CPIU(CProductId, CPInstanceUuid, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceWarehouseItem",
">",
"findByCPI_CPIU",
"(",
"long",
"CProductId",
",",
"String",
"CPInstanceUuid",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCPI_CPIU",
"(",
"CProductId",
",",
"CPInstanceU... | Returns a range of all the commerce warehouse items where CProductId = ? and CPInstanceUuid = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWarehouseItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param CProductId the c product ID
@param CPInstanceUuid the cp instance uuid
@param start the lower bound of the range of commerce warehouse items
@param end the upper bound of the range of commerce warehouse items (not inclusive)
@return the range of matching commerce warehouse items | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"warehouse",
"items",
"where",
"CProductId",
"=",
"?",
";",
"and",
"CPInstanceUuid",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java#L924-L928 |
michael-rapp/AndroidMaterialPreferences | example/src/main/java/de/mrapp/android/preference/example/PreferenceFragment.java | PreferenceFragment.createDialogPreferenceClickListener | private OnClickListener createDialogPreferenceClickListener() {
return new OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
String button = getString(
which == DialogInterface.BUTTON_POSITIVE ? android.R.string.ok :
android.R.string.cancel);
String text = String.format(getString(R.string.dialog_dismissed_toast), button);
Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
}
};
} | java | private OnClickListener createDialogPreferenceClickListener() {
return new OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
String button = getString(
which == DialogInterface.BUTTON_POSITIVE ? android.R.string.ok :
android.R.string.cancel);
String text = String.format(getString(R.string.dialog_dismissed_toast), button);
Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
}
};
} | [
"private",
"OnClickListener",
"createDialogPreferenceClickListener",
"(",
")",
"{",
"return",
"new",
"OnClickListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onClick",
"(",
"final",
"DialogInterface",
"dialog",
",",
"final",
"int",
"which",
")",
"{",
... | Creates and returns a listener, which allows to show a toast, when a button of the {@link
DialogPreference}'s dialog has been clicked.
@return The listener, which has been created, as an instance of the type {@link
OnClickListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"show",
"a",
"toast",
"when",
"a",
"button",
"of",
"the",
"{",
"@link",
"DialogPreference",
"}",
"s",
"dialog",
"has",
"been",
"clicked",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/example/src/main/java/de/mrapp/android/preference/example/PreferenceFragment.java#L233-L246 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java | ByteArrayUtil.writeString | public static void writeString(ByteBuffer buffer, String s) throws IOException {
if(s == null) {
s = ""; // Which will be written as Varint 0 = single byte 0.
}
ByteArrayUtil.STRING_SERIALIZER.toByteBuffer(buffer, s);
} | java | public static void writeString(ByteBuffer buffer, String s) throws IOException {
if(s == null) {
s = ""; // Which will be written as Varint 0 = single byte 0.
}
ByteArrayUtil.STRING_SERIALIZER.toByteBuffer(buffer, s);
} | [
"public",
"static",
"void",
"writeString",
"(",
"ByteBuffer",
"buffer",
",",
"String",
"s",
")",
"throws",
"IOException",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"s",
"=",
"\"\"",
";",
"// Which will be written as Varint 0 = single byte 0.",
"}",
"ByteArray... | Write a string to the buffer.
See {@link StringSerializer} for details.
@param buffer Buffer to write to
@param s String to write | [
"Write",
"a",
"string",
"to",
"the",
"buffer",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java#L687-L692 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/SmartTable.java | SmartTable.setColumnCellStyles | public void setColumnCellStyles (int column, String... styles)
{
int rowCount = getRowCount();
for (int row = 0; row < rowCount; ++row) {
setStyleNames(row, column, styles);
}
} | java | public void setColumnCellStyles (int column, String... styles)
{
int rowCount = getRowCount();
for (int row = 0; row < rowCount; ++row) {
setStyleNames(row, column, styles);
}
} | [
"public",
"void",
"setColumnCellStyles",
"(",
"int",
"column",
",",
"String",
"...",
"styles",
")",
"{",
"int",
"rowCount",
"=",
"getRowCount",
"(",
")",
";",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"rowCount",
";",
"++",
"row",
")",
"{"... | Sets the style of all cells in the given column to the given values. The first style is set
as the primary style and additional styles are added onto that. | [
"Sets",
"the",
"style",
"of",
"all",
"cells",
"in",
"the",
"given",
"column",
"to",
"the",
"given",
"values",
".",
"The",
"first",
"style",
"is",
"set",
"as",
"the",
"primary",
"style",
"and",
"additional",
"styles",
"are",
"added",
"onto",
"that",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/SmartTable.java#L351-L357 |
alkacon/opencms-core | src/org/opencms/ade/contenteditor/shared/CmsContentDefinition.java | CmsContentDefinition.uuidToEntityId | public static String uuidToEntityId(CmsUUID uuid, String locale) {
return ENTITY_ID_PREFIX + locale + "/" + uuid.toString();
} | java | public static String uuidToEntityId(CmsUUID uuid, String locale) {
return ENTITY_ID_PREFIX + locale + "/" + uuid.toString();
} | [
"public",
"static",
"String",
"uuidToEntityId",
"(",
"CmsUUID",
"uuid",
",",
"String",
"locale",
")",
"{",
"return",
"ENTITY_ID_PREFIX",
"+",
"locale",
"+",
"\"/\"",
"+",
"uuid",
".",
"toString",
"(",
")",
";",
"}"
] | Returns the entity id according to the given UUID.<p>
@param uuid the UUID
@param locale the content locale
@return the entity id | [
"Returns",
"the",
"entity",
"id",
"according",
"to",
"the",
"given",
"UUID",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/shared/CmsContentDefinition.java#L376-L379 |
kaazing/gateway | service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/ConflictResolverUtils.java | ConflictResolverUtils.resolveValueConflicts | private static void resolveValueConflicts(Directive directive, String generalValue, PatternCacheControl specificPattern) {
long generalPatternValue = Long.parseLong(generalValue);
if (specificPattern.hasDirective(directive)) {
long specificPatternValue = Long.parseLong(specificPattern.getDirectiveValue(directive));
if (specificPatternValue > generalPatternValue) {
specificPattern.setDirective(directive, generalValue);
}
return;
}
specificPattern.setDirective(directive, generalValue);
} | java | private static void resolveValueConflicts(Directive directive, String generalValue, PatternCacheControl specificPattern) {
long generalPatternValue = Long.parseLong(generalValue);
if (specificPattern.hasDirective(directive)) {
long specificPatternValue = Long.parseLong(specificPattern.getDirectiveValue(directive));
if (specificPatternValue > generalPatternValue) {
specificPattern.setDirective(directive, generalValue);
}
return;
}
specificPattern.setDirective(directive, generalValue);
} | [
"private",
"static",
"void",
"resolveValueConflicts",
"(",
"Directive",
"directive",
",",
"String",
"generalValue",
",",
"PatternCacheControl",
"specificPattern",
")",
"{",
"long",
"generalPatternValue",
"=",
"Long",
".",
"parseLong",
"(",
"generalValue",
")",
";",
... | Resolves the conflicts for a given directive between the general pattern and the specific PatternCacheControl
@param directive
@param generalValue
@param specificPattern | [
"Resolves",
"the",
"conflicts",
"for",
"a",
"given",
"directive",
"between",
"the",
"general",
"pattern",
"and",
"the",
"specific",
"PatternCacheControl"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/ConflictResolverUtils.java#L70-L80 |
alkacon/opencms-core | src/org/opencms/workplace/explorer/CmsExplorerTypeAccess.java | CmsExplorerTypeAccess.getPermissionsCacheKey | private String getPermissionsCacheKey(CmsObject cms, CmsResource resource) {
try {
String userName = cms.getRequestContext().getCurrentUser().getName();
StringBuffer key = new StringBuffer(256);
key.append(resource.getRootPath()).append("_");
Iterator<?> itGroups = cms.getGroupsOfUser(userName, true).iterator();
while (itGroups.hasNext()) {
CmsGroup group = (CmsGroup)itGroups.next();
key.append(group.getName()).append("_");
}
Iterator<?> itRoles = OpenCms.getRoleManager().getRolesOfUser(
cms,
userName,
"",
true,
true,
false).iterator();
while (itRoles.hasNext()) {
CmsRole role = (CmsRole)itRoles.next();
key.append(role.getGroupName()).append("_");
}
return key.toString();
} catch (CmsException e) {
return null;
}
} | java | private String getPermissionsCacheKey(CmsObject cms, CmsResource resource) {
try {
String userName = cms.getRequestContext().getCurrentUser().getName();
StringBuffer key = new StringBuffer(256);
key.append(resource.getRootPath()).append("_");
Iterator<?> itGroups = cms.getGroupsOfUser(userName, true).iterator();
while (itGroups.hasNext()) {
CmsGroup group = (CmsGroup)itGroups.next();
key.append(group.getName()).append("_");
}
Iterator<?> itRoles = OpenCms.getRoleManager().getRolesOfUser(
cms,
userName,
"",
true,
true,
false).iterator();
while (itRoles.hasNext()) {
CmsRole role = (CmsRole)itRoles.next();
key.append(role.getGroupName()).append("_");
}
return key.toString();
} catch (CmsException e) {
return null;
}
} | [
"private",
"String",
"getPermissionsCacheKey",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"{",
"try",
"{",
"String",
"userName",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentUser",
"(",
")",
".",
"getName",
"(",
")",
";"... | Returns the cache key for the roles and groups of the current user and the given resource.<p>
In this way, it does not matter if the resource and/or user permissions changes, so we never need to clean the cache.<p>
And since the cache is a LRU map, old trash entries will be automatically removed.<p>
@param cms the current cms context
@param resource the resource
@return the cache key | [
"Returns",
"the",
"cache",
"key",
"for",
"the",
"roles",
"and",
"groups",
"of",
"the",
"current",
"user",
"and",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/explorer/CmsExplorerTypeAccess.java#L318-L344 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java | ORBConfigAdapter.createClientORB | @Override
public ORB createClientORB(Map<String, Object> clientProps, Collection<SubsystemFactory> subsystemFactories) throws ConfigException {
return createORB(translateToClientArgs(clientProps, subsystemFactories), translateToClientProps(clientProps, subsystemFactories));
} | java | @Override
public ORB createClientORB(Map<String, Object> clientProps, Collection<SubsystemFactory> subsystemFactories) throws ConfigException {
return createORB(translateToClientArgs(clientProps, subsystemFactories), translateToClientProps(clientProps, subsystemFactories));
} | [
"@",
"Override",
"public",
"ORB",
"createClientORB",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"clientProps",
",",
"Collection",
"<",
"SubsystemFactory",
">",
"subsystemFactories",
")",
"throws",
"ConfigException",
"{",
"return",
"createORB",
"(",
"translateT... | Create an ORB for a CSSBean client context.
@return An ORB instance configured for this client access.
@exception ConfigException | [
"Create",
"an",
"ORB",
"for",
"a",
"CSSBean",
"client",
"context",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java#L63-L66 |
openbase/jul | storage/src/main/java/org/openbase/jul/storage/registry/FileSynchronizedRegistryImpl.java | FileSynchronizedRegistryImpl.activateVersionControl | public void activateVersionControl(final String entryType, final Package converterPackage) throws CouldNotPerformException {
if (!isEmpty()) {
throw new CouldNotPerformException("Could not activate version control because registry already loaded! Please activate version control before loading the registry.");
}
versionControl = new DBVersionControl(entryType, fileProvider, converterPackage, databaseDirectory, this);
} | java | public void activateVersionControl(final String entryType, final Package converterPackage) throws CouldNotPerformException {
if (!isEmpty()) {
throw new CouldNotPerformException("Could not activate version control because registry already loaded! Please activate version control before loading the registry.");
}
versionControl = new DBVersionControl(entryType, fileProvider, converterPackage, databaseDirectory, this);
} | [
"public",
"void",
"activateVersionControl",
"(",
"final",
"String",
"entryType",
",",
"final",
"Package",
"converterPackage",
")",
"throws",
"CouldNotPerformException",
"{",
"if",
"(",
"!",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"CouldNotPerformException",
... | This method activates the version control unit of the underlying registry
db. The version check and db upgrade is automatically performed during
the registry db loading phrase. The db will be upgraded to the latest db
format provided by the given converter package. The converter package
should contain only classes implementing the DBVersionConverter
interface. To fully support outdated db upgrade make sure that the
converter pipeline covers the whole version range!
<p>
Activate version control before loading the registry. Please provide
within the converter package only converter with the naming structure
[$(EntryType)_$(VersionN)_To_$(VersionN+1)_DBConverter].
<p>
Example:
<p>
converter package myproject.db.converter containing the converter
pipeline
<p>
myproject.db.converter.DeviceConfig_0_To_1_DBConverter.class
myproject.db.converter.DeviceConfig_1_To_2_DBConverter.class
myproject.db.converter.DeviceConfig_2_To_3_DBConverter.class
<p>
Would support the db upgrade from version 0 till the latest db version 3.
@param entryType
@param converterPackage the package containing all converter which
provides db entry updates from the first to the latest db version.
@throws CouldNotPerformException in case of an invalid converter pipeline
or initialization issues. | [
"This",
"method",
"activates",
"the",
"version",
"control",
"unit",
"of",
"the",
"underlying",
"registry",
"db",
".",
"The",
"version",
"check",
"and",
"db",
"upgrade",
"is",
"automatically",
"performed",
"during",
"the",
"registry",
"db",
"loading",
"phrase",
... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/storage/src/main/java/org/openbase/jul/storage/registry/FileSynchronizedRegistryImpl.java#L147-L152 |
VoltDB/voltdb | src/frontend/org/voltdb/iv2/SpScheduler.java | SpScheduler.doLocalInitiateOffer | private void doLocalInitiateOffer(Iv2InitiateTaskMessage msg)
{
final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.SPI);
if (traceLog != null) {
final String threadName = Thread.currentThread().getName(); // Thread name has to be materialized here
traceLog.add(() -> VoltTrace.meta("process_name", "name", CoreUtils.getHostnameOrAddress()))
.add(() -> VoltTrace.meta("thread_name", "name", threadName))
.add(() -> VoltTrace.meta("thread_sort_index", "sort_index", Integer.toString(10000)))
.add(() -> VoltTrace.beginAsync("initsp",
MiscUtils.hsIdPairTxnIdToString(m_mailbox.getHSId(), m_mailbox.getHSId(), msg.getSpHandle(), msg.getClientInterfaceHandle()),
"ciHandle", msg.getClientInterfaceHandle(),
"txnId", TxnEgo.txnIdToString(msg.getTxnId()),
"partition", m_partitionId,
"read", msg.isReadOnly(),
"name", msg.getStoredProcedureName(),
"hsId", CoreUtils.hsIdToString(m_mailbox.getHSId())));
}
final String procedureName = msg.getStoredProcedureName();
final SpProcedureTask task =
new SpProcedureTask(m_mailbox, procedureName, m_pendingTasks, msg);
ListenableFuture<Object> durabilityBackpressureFuture =
m_cl.log(msg, msg.getSpHandle(), null, m_durabilityListener, task);
if (traceLog != null && durabilityBackpressureFuture != null) {
traceLog.add(() -> VoltTrace.beginAsync("durability",
MiscUtils.hsIdTxnIdToString(m_mailbox.getHSId(), msg.getSpHandle()),
"txnId", TxnEgo.txnIdToString(msg.getTxnId()),
"partition", Integer.toString(m_partitionId)));
}
//Durability future is always null for sync command logging
//the transaction will be delivered again by the CL for execution once durable
//Async command logging has to offer the task immediately with a Future for backpressure
if (m_cl.canOfferTask()) {
m_pendingTasks.offer(task.setDurabilityBackpressureFuture(durabilityBackpressureFuture));
}
} | java | private void doLocalInitiateOffer(Iv2InitiateTaskMessage msg)
{
final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.SPI);
if (traceLog != null) {
final String threadName = Thread.currentThread().getName(); // Thread name has to be materialized here
traceLog.add(() -> VoltTrace.meta("process_name", "name", CoreUtils.getHostnameOrAddress()))
.add(() -> VoltTrace.meta("thread_name", "name", threadName))
.add(() -> VoltTrace.meta("thread_sort_index", "sort_index", Integer.toString(10000)))
.add(() -> VoltTrace.beginAsync("initsp",
MiscUtils.hsIdPairTxnIdToString(m_mailbox.getHSId(), m_mailbox.getHSId(), msg.getSpHandle(), msg.getClientInterfaceHandle()),
"ciHandle", msg.getClientInterfaceHandle(),
"txnId", TxnEgo.txnIdToString(msg.getTxnId()),
"partition", m_partitionId,
"read", msg.isReadOnly(),
"name", msg.getStoredProcedureName(),
"hsId", CoreUtils.hsIdToString(m_mailbox.getHSId())));
}
final String procedureName = msg.getStoredProcedureName();
final SpProcedureTask task =
new SpProcedureTask(m_mailbox, procedureName, m_pendingTasks, msg);
ListenableFuture<Object> durabilityBackpressureFuture =
m_cl.log(msg, msg.getSpHandle(), null, m_durabilityListener, task);
if (traceLog != null && durabilityBackpressureFuture != null) {
traceLog.add(() -> VoltTrace.beginAsync("durability",
MiscUtils.hsIdTxnIdToString(m_mailbox.getHSId(), msg.getSpHandle()),
"txnId", TxnEgo.txnIdToString(msg.getTxnId()),
"partition", Integer.toString(m_partitionId)));
}
//Durability future is always null for sync command logging
//the transaction will be delivered again by the CL for execution once durable
//Async command logging has to offer the task immediately with a Future for backpressure
if (m_cl.canOfferTask()) {
m_pendingTasks.offer(task.setDurabilityBackpressureFuture(durabilityBackpressureFuture));
}
} | [
"private",
"void",
"doLocalInitiateOffer",
"(",
"Iv2InitiateTaskMessage",
"msg",
")",
"{",
"final",
"VoltTrace",
".",
"TraceEventBatch",
"traceLog",
"=",
"VoltTrace",
".",
"log",
"(",
"VoltTrace",
".",
"Category",
".",
"SPI",
")",
";",
"if",
"(",
"traceLog",
"... | Do the work necessary to turn the Iv2InitiateTaskMessage into a
TransactionTask which can be queued to the TransactionTaskQueue.
This is reused by both the normal message handling path and the repair
path, and assumes that the caller has dealt with or ensured that the
necessary ID, SpHandles, and replication issues are resolved. | [
"Do",
"the",
"work",
"necessary",
"to",
"turn",
"the",
"Iv2InitiateTaskMessage",
"into",
"a",
"TransactionTask",
"which",
"can",
"be",
"queued",
"to",
"the",
"TransactionTaskQueue",
".",
"This",
"is",
"reused",
"by",
"both",
"the",
"normal",
"message",
"handling... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/SpScheduler.java#L650-L688 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java | MapComposedElement.containsPoint | @Pure
public boolean containsPoint(Point2D<?, ?> point) {
if (point == null) {
return false;
}
for (int i = 0; i < getPointCount(); ++i) {
final Point2d cur = getPointAt(i);
if (cur.epsilonEquals(point, MapElementConstants.POINT_FUSION_DISTANCE)) {
return true;
}
}
return false;
} | java | @Pure
public boolean containsPoint(Point2D<?, ?> point) {
if (point == null) {
return false;
}
for (int i = 0; i < getPointCount(); ++i) {
final Point2d cur = getPointAt(i);
if (cur.epsilonEquals(point, MapElementConstants.POINT_FUSION_DISTANCE)) {
return true;
}
}
return false;
} | [
"@",
"Pure",
"public",
"boolean",
"containsPoint",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
")",
"{",
"if",
"(",
"point",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getPointCoun... | Check if point p is contained in this coordinates collections.
@param point the point to compare with this coordinates
@return true if p is already part of coordinates | [
"Check",
"if",
"point",
"p",
"is",
"contained",
"in",
"this",
"coordinates",
"collections",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L275-L287 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosetsApi.java | PhotosetsApi.editMeta | public Response editMeta(String photosetId, String title, String description) throws JinxException {
JinxUtils.validateParams(photosetId, title);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photosets.editMeta");
params.put("photoset_id", photosetId);
params.put("title", title);
if (description != null) {
params.put("description", description);
}
return jinx.flickrPost(params, Response.class);
} | java | public Response editMeta(String photosetId, String title, String description) throws JinxException {
JinxUtils.validateParams(photosetId, title);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photosets.editMeta");
params.put("photoset_id", photosetId);
params.put("title", title);
if (description != null) {
params.put("description", description);
}
return jinx.flickrPost(params, Response.class);
} | [
"public",
"Response",
"editMeta",
"(",
"String",
"photosetId",
",",
"String",
"title",
",",
"String",
"description",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photosetId",
",",
"title",
")",
";",
"Map",
"<",
"String",
",",
... | Modify the meta-data for a photoset.
<br>
This method requires authentication with 'write' permission.
<br>
This method has no specific response - It returns an empty success response if it completes without error.
@param photosetId id of the photoset to modify. Required.
@param title new title for the photoset. Required.
@param description description of the photoset. May contain limited html.
@return success response if it completes without error.
@throws JinxException if required parameters are null, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photosets.editMeta.html">flickr.photosets.editMeta</a> | [
"Modify",
"the",
"meta",
"-",
"data",
"for",
"a",
"photoset",
".",
"<br",
">",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
".",
"<br",
">",
"This",
"method",
"has",
"no",
"specific",
"response",
"-",
"It",
"returns",
"an"... | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosetsApi.java#L136-L146 |
alkacon/opencms-core | src/org/opencms/flex/CmsFlexResponse.java | CmsFlexResponse.initStream | private void initStream() throws IOException {
if (m_out == null) {
if (!m_writeOnlyToBuffer) {
// we can use the parents output stream
if (m_cachingRequired || (m_controller.getResponseStackSize() > 1)) {
// we are allowed to cache our results (probably to construct a new cache entry)
m_out = new CmsFlexResponse.CmsServletOutputStream(m_res.getOutputStream());
} else {
// we are not allowed to cache so we just use the parents output stream
m_out = (CmsFlexResponse.CmsServletOutputStream)m_res.getOutputStream();
}
} else {
// construct a "buffer only" output stream
m_out = new CmsFlexResponse.CmsServletOutputStream();
}
}
if (m_writer == null) {
// create a PrintWriter that uses the encoding required for the request context
m_writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(m_out, m_encoding)), false);
}
} | java | private void initStream() throws IOException {
if (m_out == null) {
if (!m_writeOnlyToBuffer) {
// we can use the parents output stream
if (m_cachingRequired || (m_controller.getResponseStackSize() > 1)) {
// we are allowed to cache our results (probably to construct a new cache entry)
m_out = new CmsFlexResponse.CmsServletOutputStream(m_res.getOutputStream());
} else {
// we are not allowed to cache so we just use the parents output stream
m_out = (CmsFlexResponse.CmsServletOutputStream)m_res.getOutputStream();
}
} else {
// construct a "buffer only" output stream
m_out = new CmsFlexResponse.CmsServletOutputStream();
}
}
if (m_writer == null) {
// create a PrintWriter that uses the encoding required for the request context
m_writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(m_out, m_encoding)), false);
}
} | [
"private",
"void",
"initStream",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"m_out",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"m_writeOnlyToBuffer",
")",
"{",
"// we can use the parents output stream",
"if",
"(",
"m_cachingRequired",
"||",
"(",
"m_control... | Initializes the current responses output stream
and the corresponding print writer.<p>
@throws IOException in case something goes wrong while initializing | [
"Initializes",
"the",
"current",
"responses",
"output",
"stream",
"and",
"the",
"corresponding",
"print",
"writer",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexResponse.java#L1083-L1104 |
code4everything/util | src/main/java/com/zhazhapan/util/BeanUtils.java | BeanUtils.jsonPutIn | public static void jsonPutIn(JSONObject jsonObject, Object object) throws IllegalAccessException {
Field[] fields = object.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
field.set(object, TypeUtils.castToJavaBean(jsonObject.get(field.getName()), field.getType()));
}
} | java | public static void jsonPutIn(JSONObject jsonObject, Object object) throws IllegalAccessException {
Field[] fields = object.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
field.set(object, TypeUtils.castToJavaBean(jsonObject.get(field.getName()), field.getType()));
}
} | [
"public",
"static",
"void",
"jsonPutIn",
"(",
"JSONObject",
"jsonObject",
",",
"Object",
"object",
")",
"throws",
"IllegalAccessException",
"{",
"Field",
"[",
"]",
"fields",
"=",
"object",
".",
"getClass",
"(",
")",
".",
"getDeclaredFields",
"(",
")",
";",
"... | 将JOSNObject转换为Bean
@param jsonObject {@link JSONObject}
@param object {@link Object}
@throws IllegalAccessException 异常
@deprecated 请使用 {@link JSONObject#toJavaObject(JSON, Class)} | [
"将JOSNObject转换为Bean"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/BeanUtils.java#L228-L234 |
mojohaus/webstart | webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java | AbstractBaseJnlpMojo.removeExistingSignatures | private int removeExistingSignatures( File workDirectory )
throws MojoExecutionException
{
getLog().info( "-- Remove existing signatures" );
// cleanup tempDir if exists
File tempDir = new File( workDirectory, "temp_extracted_jars" );
ioUtil.removeDirectory( tempDir );
// recreate temp dir
ioUtil.makeDirectoryIfNecessary( tempDir );
// process jars
File[] jarFiles = workDirectory.listFiles( unprocessedJarFileFilter );
for ( File jarFile : jarFiles )
{
if ( isJarSigned( jarFile ) )
{
if ( !canUnsign )
{
throw new MojoExecutionException(
"neverUnsignAlreadySignedJar is set to true and a jar file [" + jarFile +
" was asked to be unsign,\n please prefer use in this case an extension for " +
"signed jars or not set to true the neverUnsignAlreadySignedJar parameter, Make " +
"your choice:)" );
}
verboseLog( "Remove signature " + toProcessFile( jarFile ).getName() );
signTool.unsign( jarFile, isVerbose() );
}
else
{
verboseLog( "Skip not signed " + toProcessFile( jarFile ).getName() );
}
}
// cleanup tempDir
ioUtil.removeDirectory( tempDir );
return jarFiles.length; // FIXME this is wrong. Not all jars are signed.
} | java | private int removeExistingSignatures( File workDirectory )
throws MojoExecutionException
{
getLog().info( "-- Remove existing signatures" );
// cleanup tempDir if exists
File tempDir = new File( workDirectory, "temp_extracted_jars" );
ioUtil.removeDirectory( tempDir );
// recreate temp dir
ioUtil.makeDirectoryIfNecessary( tempDir );
// process jars
File[] jarFiles = workDirectory.listFiles( unprocessedJarFileFilter );
for ( File jarFile : jarFiles )
{
if ( isJarSigned( jarFile ) )
{
if ( !canUnsign )
{
throw new MojoExecutionException(
"neverUnsignAlreadySignedJar is set to true and a jar file [" + jarFile +
" was asked to be unsign,\n please prefer use in this case an extension for " +
"signed jars or not set to true the neverUnsignAlreadySignedJar parameter, Make " +
"your choice:)" );
}
verboseLog( "Remove signature " + toProcessFile( jarFile ).getName() );
signTool.unsign( jarFile, isVerbose() );
}
else
{
verboseLog( "Skip not signed " + toProcessFile( jarFile ).getName() );
}
}
// cleanup tempDir
ioUtil.removeDirectory( tempDir );
return jarFiles.length; // FIXME this is wrong. Not all jars are signed.
} | [
"private",
"int",
"removeExistingSignatures",
"(",
"File",
"workDirectory",
")",
"throws",
"MojoExecutionException",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"-- Remove existing signatures\"",
")",
";",
"// cleanup tempDir if exists",
"File",
"tempDir",
"=",
"new",
... | Removes the signature of the files in the specified directory which satisfy the
specified filter.
@param workDirectory working directory used to unsign jars
@return the number of unsigned jars
@throws MojoExecutionException if could not remove signatures | [
"Removes",
"the",
"signature",
"of",
"the",
"files",
"in",
"the",
"specified",
"directory",
"which",
"satisfy",
"the",
"specified",
"filter",
"."
] | train | https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java#L982-L1023 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/data/caching/support/CachingTemplate.java | CachingTemplate.withCacheEvict | @SuppressWarnings("unchecked")
public <T extends VALUE> T withCacheEvict(KEY key, Supplier<VALUE> cacheableOperation) {
Assert.notNull(cacheableOperation, "Supplier is required");
VALUE result = cacheableOperation.get();
evict(getLock(), key);
return (T) result;
} | java | @SuppressWarnings("unchecked")
public <T extends VALUE> T withCacheEvict(KEY key, Supplier<VALUE> cacheableOperation) {
Assert.notNull(cacheableOperation, "Supplier is required");
VALUE result = cacheableOperation.get();
evict(getLock(), key);
return (T) result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"VALUE",
">",
"T",
"withCacheEvict",
"(",
"KEY",
"key",
",",
"Supplier",
"<",
"VALUE",
">",
"cacheableOperation",
")",
"{",
"Assert",
".",
"notNull",
"(",
"cacheableOperation",
... | This caching data access operation invokes the supplied {@link Supplier cacheable operation} and then evicts
the entry in the {@link Cache} identified with the given {@link KEY key} if present, but only if
the {@link Supplier cacheable operation} completes successfully.
@param <T> {@link Class type} of the return {@link VALUE value}.
@param key {@link KEY key} identifying the entry in the {@link Cache} to evict.
@param cacheableOperation {@link Supplier} used to compute or load a {@link VALUE value}.
@return the {@link VALUE result} of the {@link Supplier cacheable operation}.
@throws IllegalArgumentException if the {@link Supplier} is {@literal null}.
@see java.util.function.Supplier
@see #getCache()
@see #getLock() | [
"This",
"caching",
"data",
"access",
"operation",
"invokes",
"the",
"supplied",
"{",
"@link",
"Supplier",
"cacheable",
"operation",
"}",
"and",
"then",
"evicts",
"the",
"entry",
"in",
"the",
"{",
"@link",
"Cache",
"}",
"identified",
"with",
"the",
"given",
"... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/caching/support/CachingTemplate.java#L318-L328 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java | ClasspathUrlFinder.findClassPaths | public static URL[] findClassPaths()
{
List<URL> list = new ArrayList<URL>();
String classpath = System.getProperty("java.class.path");
StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator);
while (tokenizer.hasMoreTokens())
{
String path = tokenizer.nextToken();
File fp = new File(path);
if (!fp.exists()) {
throw new RuntimeException("File in java.class.path does not exist: " + fp);
}
try
{
list.add(fp.toURL());
}
catch (MalformedURLException e)
{
throw new RuntimeException(e);
}
}
return list.toArray(new URL[list.size()]);
} | java | public static URL[] findClassPaths()
{
List<URL> list = new ArrayList<URL>();
String classpath = System.getProperty("java.class.path");
StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator);
while (tokenizer.hasMoreTokens())
{
String path = tokenizer.nextToken();
File fp = new File(path);
if (!fp.exists()) {
throw new RuntimeException("File in java.class.path does not exist: " + fp);
}
try
{
list.add(fp.toURL());
}
catch (MalformedURLException e)
{
throw new RuntimeException(e);
}
}
return list.toArray(new URL[list.size()]);
} | [
"public",
"static",
"URL",
"[",
"]",
"findClassPaths",
"(",
")",
"{",
"List",
"<",
"URL",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"URL",
">",
"(",
")",
";",
"String",
"classpath",
"=",
"System",
".",
"getProperty",
"(",
"\"java.class.path\"",
")",
"... | Uses the java.class.path system property to obtain a list of URLs that represent the CLASSPATH
@return | [
"Uses",
"the",
"java",
".",
"class",
".",
"path",
"system",
"property",
"to",
"obtain",
"a",
"list",
"of",
"URLs",
"that",
"represent",
"the",
"CLASSPATH"
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java#L126-L149 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/liveweb/ARCCacheDirectory.java | ARCCacheDirectory.getResource | public Resource getResource(String path, long offset) throws IOException {
File arc = new File(path);
if(!arc.exists()) {
String base = arc.getName();
arc = new File(arcDir,base);
if(!arc.exists()) {
if(base.endsWith(ArchiveFileConstants.OCCUPIED_SUFFIX)) {
String newBase = base.substring(0,base.length() -
ArchiveFileConstants.OCCUPIED_SUFFIX.length());
arc = new File(arcDir,newBase);
}
}
}
LOGGER.info("Retrieving record at " + offset + " in " +
arc.getAbsolutePath());
try {
return ResourceFactory.getResource(arc, offset);
} catch (ResourceNotAvailableException e1) {
throw new IOException(e1.getMessage());
}
} | java | public Resource getResource(String path, long offset) throws IOException {
File arc = new File(path);
if(!arc.exists()) {
String base = arc.getName();
arc = new File(arcDir,base);
if(!arc.exists()) {
if(base.endsWith(ArchiveFileConstants.OCCUPIED_SUFFIX)) {
String newBase = base.substring(0,base.length() -
ArchiveFileConstants.OCCUPIED_SUFFIX.length());
arc = new File(arcDir,newBase);
}
}
}
LOGGER.info("Retrieving record at " + offset + " in " +
arc.getAbsolutePath());
try {
return ResourceFactory.getResource(arc, offset);
} catch (ResourceNotAvailableException e1) {
throw new IOException(e1.getMessage());
}
} | [
"public",
"Resource",
"getResource",
"(",
"String",
"path",
",",
"long",
"offset",
")",
"throws",
"IOException",
"{",
"File",
"arc",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"!",
"arc",
".",
"exists",
"(",
")",
")",
"{",
"String",
"base"... | transform an ARCLocation into a Resource. Be sure to call close() on it
when processing is finished.
@param path to ARC file
@param offset within file where record begins
@return the Resource for the location
@throws IOException for usual reasons | [
"transform",
"an",
"ARCLocation",
"into",
"a",
"Resource",
".",
"Be",
"sure",
"to",
"call",
"close",
"()",
"on",
"it",
"when",
"processing",
"is",
"finished",
"."
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/liveweb/ARCCacheDirectory.java#L111-L131 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java | LocaleData.getExemplarSet | public static UnicodeSet getExemplarSet(ULocale locale, int options, int extype) {
return LocaleData.getInstance(locale).getExemplarSet(options, extype);
} | java | public static UnicodeSet getExemplarSet(ULocale locale, int options, int extype) {
return LocaleData.getInstance(locale).getExemplarSet(options, extype);
} | [
"public",
"static",
"UnicodeSet",
"getExemplarSet",
"(",
"ULocale",
"locale",
",",
"int",
"options",
",",
"int",
"extype",
")",
"{",
"return",
"LocaleData",
".",
"getInstance",
"(",
"locale",
")",
".",
"getExemplarSet",
"(",
"options",
",",
"extype",
")",
";... | Returns the set of exemplar characters for a locale.
Equivalent to calling new LocaleData(locale).{@link #getExemplarSet(int, int)}.
@param locale Locale for which the exemplar character set
is to be retrieved.
@param options Bitmask for options to apply to the exemplar pattern.
Specify zero to retrieve the exemplar set as it is
defined in the locale data. Specify
UnicodeSet.CASE to retrieve a case-folded exemplar
set. See {@link UnicodeSet#applyPattern(String,
int)} for a complete list of valid options. The
IGNORE_SPACE bit is always set, regardless of the
value of 'options'.
@param extype The type of exemplar character set to retrieve.
@return The set of exemplar characters for the given locale. | [
"Returns",
"the",
"set",
"of",
"exemplar",
"characters",
"for",
"a",
"locale",
".",
"Equivalent",
"to",
"calling",
"new",
"LocaleData",
"(",
"locale",
")",
".",
"{",
"@link",
"#getExemplarSet",
"(",
"int",
"int",
")",
"}",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L155-L157 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java | MPD9AbstractReader.getNullOnValue | private Integer getNullOnValue(Integer value, int nullValue)
{
return (NumberHelper.getInt(value) == nullValue ? null : value);
} | java | private Integer getNullOnValue(Integer value, int nullValue)
{
return (NumberHelper.getInt(value) == nullValue ? null : value);
} | [
"private",
"Integer",
"getNullOnValue",
"(",
"Integer",
"value",
",",
"int",
"nullValue",
")",
"{",
"return",
"(",
"NumberHelper",
".",
"getInt",
"(",
"value",
")",
"==",
"nullValue",
"?",
"null",
":",
"value",
")",
";",
"}"
] | This method returns the value it is passed, or null if the value
matches the nullValue argument.
@param value value under test
@param nullValue return null if value under test matches this value
@return value or null | [
"This",
"method",
"returns",
"the",
"value",
"it",
"is",
"passed",
"or",
"null",
"if",
"the",
"value",
"matches",
"the",
"nullValue",
"argument",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L1283-L1286 |
thinkaurelius/titan | titan-cassandra/src/main/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/thriftpool/CTConnectionFactory.java | CTConnectionFactory.makeRawConnection | public CTConnection makeRawConnection() throws TTransportException {
final Config cfg = cfgRef.get();
String hostname = cfg.getRandomHost();
log.debug("Creating TSocket({}, {}, {}, {}, {})", hostname, cfg.port, cfg.username, cfg.password, cfg.timeoutMS);
TSocket socket;
if (null != cfg.sslTruststoreLocation && !cfg.sslTruststoreLocation.isEmpty()) {
TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters() {{
setTrustStore(cfg.sslTruststoreLocation, cfg.sslTruststorePassword);
}};
socket = TSSLTransportFactory.getClientSocket(hostname, cfg.port, cfg.timeoutMS, params);
} else {
socket = new TSocket(hostname, cfg.port, cfg.timeoutMS);
}
TTransport transport = new TFramedTransport(socket, cfg.frameSize);
log.trace("Created transport {}", transport);
TBinaryProtocol protocol = new TBinaryProtocol(transport);
Cassandra.Client client = new Cassandra.Client(protocol);
if (!transport.isOpen()) {
transport.open();
}
if (cfg.username != null) {
Map<String, String> credentials = new HashMap<String, String>() {{
put(IAuthenticator.USERNAME_KEY, cfg.username);
put(IAuthenticator.PASSWORD_KEY, cfg.password);
}};
try {
client.login(new AuthenticationRequest(credentials));
} catch (Exception e) { // TTransportException will propagate authentication/authorization failure
throw new TTransportException(e);
}
}
return new CTConnection(transport, client, cfg);
} | java | public CTConnection makeRawConnection() throws TTransportException {
final Config cfg = cfgRef.get();
String hostname = cfg.getRandomHost();
log.debug("Creating TSocket({}, {}, {}, {}, {})", hostname, cfg.port, cfg.username, cfg.password, cfg.timeoutMS);
TSocket socket;
if (null != cfg.sslTruststoreLocation && !cfg.sslTruststoreLocation.isEmpty()) {
TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters() {{
setTrustStore(cfg.sslTruststoreLocation, cfg.sslTruststorePassword);
}};
socket = TSSLTransportFactory.getClientSocket(hostname, cfg.port, cfg.timeoutMS, params);
} else {
socket = new TSocket(hostname, cfg.port, cfg.timeoutMS);
}
TTransport transport = new TFramedTransport(socket, cfg.frameSize);
log.trace("Created transport {}", transport);
TBinaryProtocol protocol = new TBinaryProtocol(transport);
Cassandra.Client client = new Cassandra.Client(protocol);
if (!transport.isOpen()) {
transport.open();
}
if (cfg.username != null) {
Map<String, String> credentials = new HashMap<String, String>() {{
put(IAuthenticator.USERNAME_KEY, cfg.username);
put(IAuthenticator.PASSWORD_KEY, cfg.password);
}};
try {
client.login(new AuthenticationRequest(credentials));
} catch (Exception e) { // TTransportException will propagate authentication/authorization failure
throw new TTransportException(e);
}
}
return new CTConnection(transport, client, cfg);
} | [
"public",
"CTConnection",
"makeRawConnection",
"(",
")",
"throws",
"TTransportException",
"{",
"final",
"Config",
"cfg",
"=",
"cfgRef",
".",
"get",
"(",
")",
";",
"String",
"hostname",
"=",
"cfg",
".",
"getRandomHost",
"(",
")",
";",
"log",
".",
"debug",
"... | Create a Cassandra-Thrift connection, but do not attempt to
set a keyspace on the connection.
@return A CTConnection ready to talk to a Cassandra cluster
@throws TTransportException on any Thrift transport failure | [
"Create",
"a",
"Cassandra",
"-",
"Thrift",
"connection",
"but",
"do",
"not",
"attempt",
"to",
"set",
"a",
"keyspace",
"on",
"the",
"connection",
"."
] | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-cassandra/src/main/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/thriftpool/CTConnectionFactory.java#L66-L104 |
deeplearning4j/deeplearning4j | datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java | ArrowConverter.toArrowColumnsStringTimeSeries | public static List<FieldVector> toArrowColumnsStringTimeSeries(final BufferAllocator bufferAllocator,
final Schema schema,
List<List<List<String>>> dataVecRecord) {
return toArrowColumnsTimeSeriesHelper(bufferAllocator,schema,dataVecRecord);
} | java | public static List<FieldVector> toArrowColumnsStringTimeSeries(final BufferAllocator bufferAllocator,
final Schema schema,
List<List<List<String>>> dataVecRecord) {
return toArrowColumnsTimeSeriesHelper(bufferAllocator,schema,dataVecRecord);
} | [
"public",
"static",
"List",
"<",
"FieldVector",
">",
"toArrowColumnsStringTimeSeries",
"(",
"final",
"BufferAllocator",
"bufferAllocator",
",",
"final",
"Schema",
"schema",
",",
"List",
"<",
"List",
"<",
"List",
"<",
"String",
">",
">",
">",
"dataVecRecord",
")"... | Convert a set of input strings to arrow columns
for a time series.
@param bufferAllocator the buffer allocator to use
@param schema the schema to use
@param dataVecRecord the collection of input strings to process
@return the created vectors | [
"Convert",
"a",
"set",
"of",
"input",
"strings",
"to",
"arrow",
"columns",
"for",
"a",
"time",
"series",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java#L677-L682 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WLabel.java | WLabel.setText | public void setText(final String text, final Serializable... args) {
Serializable currText = getComponentModel().text;
Serializable textToBeSet = I18nUtilities.asMessage(text, args);
if (!Objects.equals(textToBeSet, currText)) {
getOrCreateComponentModel().text = textToBeSet;
}
} | java | public void setText(final String text, final Serializable... args) {
Serializable currText = getComponentModel().text;
Serializable textToBeSet = I18nUtilities.asMessage(text, args);
if (!Objects.equals(textToBeSet, currText)) {
getOrCreateComponentModel().text = textToBeSet;
}
} | [
"public",
"void",
"setText",
"(",
"final",
"String",
"text",
",",
"final",
"Serializable",
"...",
"args",
")",
"{",
"Serializable",
"currText",
"=",
"getComponentModel",
"(",
")",
".",
"text",
";",
"Serializable",
"textToBeSet",
"=",
"I18nUtilities",
".",
"asM... | Sets the label's text.
@param text the label text, using {@link MessageFormat} syntax.
@param args optional arguments for the message format string. | [
"Sets",
"the",
"label",
"s",
"text",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WLabel.java#L113-L120 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java | MappedParametrizedObjectEntry.getParameterInteger | public Integer getParameterInteger(String name, Integer defaultValue)
{
String value = getParameterValue(name, null);
if (value != null)
{
try
{
return StringNumberParser.parseInt(value);
}
catch (NumberFormatException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
}
return defaultValue;
} | java | public Integer getParameterInteger(String name, Integer defaultValue)
{
String value = getParameterValue(name, null);
if (value != null)
{
try
{
return StringNumberParser.parseInt(value);
}
catch (NumberFormatException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
}
return defaultValue;
} | [
"public",
"Integer",
"getParameterInteger",
"(",
"String",
"name",
",",
"Integer",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getParameterValue",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
... | Parse named parameter as Integer.
@param name
parameter name
@param defaultValue
default Integer value
@return Integer value | [
"Parse",
"named",
"parameter",
"as",
"Integer",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java#L135-L155 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java | AbstractBuilder.buildChildren | protected void buildChildren(XMLNode node, Content contentTree) throws DocletException {
for (XMLNode child : node.children)
build(child, contentTree);
} | java | protected void buildChildren(XMLNode node, Content contentTree) throws DocletException {
for (XMLNode child : node.children)
build(child, contentTree);
} | [
"protected",
"void",
"buildChildren",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"throws",
"DocletException",
"{",
"for",
"(",
"XMLNode",
"child",
":",
"node",
".",
"children",
")",
"build",
"(",
"child",
",",
"contentTree",
")",
";",
"}"
] | Build the documentation, as specified by the children of the given XML element.
@param node the XML element that specifies which components to document.
@param contentTree content tree to which the documentation will be added
@throws DocletException if there is a problem while building the children | [
"Build",
"the",
"documentation",
"as",
"specified",
"by",
"the",
"children",
"of",
"the",
"given",
"XML",
"element",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java#L198-L201 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/values/SubString.java | SubString.subLength | public JcString subLength(int len) {
JcNumber sub = new JcNumber(len, this.getPredecessor(), OPERATOR.Common.COMMA_SEPARATOR);
JcString ret = new JcString(null, sub,
new FunctionInstance(FUNCTION.String.SUBSTRING, 3));
QueryRecorder.recordInvocationConditional(this, "subLength", ret, QueryRecorder.literal(len));
return ret;
} | java | public JcString subLength(int len) {
JcNumber sub = new JcNumber(len, this.getPredecessor(), OPERATOR.Common.COMMA_SEPARATOR);
JcString ret = new JcString(null, sub,
new FunctionInstance(FUNCTION.String.SUBSTRING, 3));
QueryRecorder.recordInvocationConditional(this, "subLength", ret, QueryRecorder.literal(len));
return ret;
} | [
"public",
"JcString",
"subLength",
"(",
"int",
"len",
")",
"{",
"JcNumber",
"sub",
"=",
"new",
"JcNumber",
"(",
"len",
",",
"this",
".",
"getPredecessor",
"(",
")",
",",
"OPERATOR",
".",
"Common",
".",
"COMMA_SEPARATOR",
")",
";",
"JcString",
"ret",
"=",... | <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>specify the length of a substring to be extracted</i></div>
<br/> | [
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"24px",
";",
"color",
":",
"red",
">",
"<b",
">",
"<i",
">",
"<u",
">",
"JCYPHER<",
"/",
"u",
">",
"<",
"/",
"i",
">",
"<",
"/",
"b",
">",
"<",
"/",
"div",
">",
"<div",
... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/SubString.java#L38-L44 |
JakeWharton/butterknife | butterknife-reflect/src/main/java/butterknife/ButterKnife.java | ButterKnife.validateReturnType | private static boolean validateReturnType(Method method, Class<?> expected) {
Class<?> returnType = method.getReturnType();
if (returnType == void.class) {
return false;
}
if (returnType != expected) {
String expectedType = "'" + expected.getName() + "'";
if (expected != void.class) {
expectedType = "'void' or " + expectedType;
}
throw new IllegalStateException(method.getDeclaringClass().getName()
+ "."
+ method.getName()
+ " must have return type of "
+ expectedType);
}
return true;
} | java | private static boolean validateReturnType(Method method, Class<?> expected) {
Class<?> returnType = method.getReturnType();
if (returnType == void.class) {
return false;
}
if (returnType != expected) {
String expectedType = "'" + expected.getName() + "'";
if (expected != void.class) {
expectedType = "'void' or " + expectedType;
}
throw new IllegalStateException(method.getDeclaringClass().getName()
+ "."
+ method.getName()
+ " must have return type of "
+ expectedType);
}
return true;
} | [
"private",
"static",
"boolean",
"validateReturnType",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"expected",
")",
"{",
"Class",
"<",
"?",
">",
"returnType",
"=",
"method",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"returnType",
"==",
"vo... | Returns true when the return value should be propagated. Use a default otherwise. | [
"Returns",
"true",
"when",
"the",
"return",
"value",
"should",
"be",
"propagated",
".",
"Use",
"a",
"default",
"otherwise",
"."
] | train | https://github.com/JakeWharton/butterknife/blob/0ead8a7b21620effcf78c728089fc16ae9d664c0/butterknife-reflect/src/main/java/butterknife/ButterKnife.java#L993-L1010 |
thinkaurelius/titan | titan-es/src/main/java/com/thinkaurelius/titan/diskstorage/es/ElasticSearchIndex.java | ElasticSearchIndex.checkForOrCreateIndex | private void checkForOrCreateIndex(Configuration config) {
Preconditions.checkState(null != client);
//Create index if it does not already exist
IndicesExistsResponse response = client.admin().indices().exists(new IndicesExistsRequest(indexName)).actionGet();
if (!response.isExists()) {
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
ElasticSearchSetup.applySettingsFromTitanConf(settings, config, ES_CREATE_EXTRAS_NS);
CreateIndexResponse create = client.admin().indices().prepareCreate(indexName)
.setSettings(settings.build()).execute().actionGet();
try {
final long sleep = config.get(CREATE_SLEEP);
log.debug("Sleeping {} ms after {} index creation returned from actionGet()", sleep, indexName);
Thread.sleep(sleep);
} catch (InterruptedException e) {
throw new TitanException("Interrupted while waiting for index to settle in", e);
}
if (!create.isAcknowledged()) throw new IllegalArgumentException("Could not create index: " + indexName);
}
} | java | private void checkForOrCreateIndex(Configuration config) {
Preconditions.checkState(null != client);
//Create index if it does not already exist
IndicesExistsResponse response = client.admin().indices().exists(new IndicesExistsRequest(indexName)).actionGet();
if (!response.isExists()) {
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
ElasticSearchSetup.applySettingsFromTitanConf(settings, config, ES_CREATE_EXTRAS_NS);
CreateIndexResponse create = client.admin().indices().prepareCreate(indexName)
.setSettings(settings.build()).execute().actionGet();
try {
final long sleep = config.get(CREATE_SLEEP);
log.debug("Sleeping {} ms after {} index creation returned from actionGet()", sleep, indexName);
Thread.sleep(sleep);
} catch (InterruptedException e) {
throw new TitanException("Interrupted while waiting for index to settle in", e);
}
if (!create.isAcknowledged()) throw new IllegalArgumentException("Could not create index: " + indexName);
}
} | [
"private",
"void",
"checkForOrCreateIndex",
"(",
"Configuration",
"config",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"null",
"!=",
"client",
")",
";",
"//Create index if it does not already exist",
"IndicesExistsResponse",
"response",
"=",
"client",
".",
"admi... | If ES already contains this instance's target index, then do nothing.
Otherwise, create the index, then wait {@link #CREATE_SLEEP}.
<p>
The {@code client} field must point to a live, connected client.
The {@code indexName} field must be non-null and point to the name
of the index to check for existence or create.
@param config the config for this ElasticSearchIndex
@throws java.lang.IllegalArgumentException if the index could not be created | [
"If",
"ES",
"already",
"contains",
"this",
"instance",
"s",
"target",
"index",
"then",
"do",
"nothing",
".",
"Otherwise",
"create",
"the",
"index",
"then",
"wait",
"{",
"@link",
"#CREATE_SLEEP",
"}",
".",
"<p",
">",
"The",
"{",
"@code",
"client",
"}",
"f... | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-es/src/main/java/com/thinkaurelius/titan/diskstorage/es/ElasticSearchIndex.java#L217-L239 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/records/converter/RecordReaderConverter.java | RecordReaderConverter.convert | public static void convert(SequenceRecordReader reader, SequenceRecordWriter writer) throws IOException {
convert(reader, writer, true);
} | java | public static void convert(SequenceRecordReader reader, SequenceRecordWriter writer) throws IOException {
convert(reader, writer, true);
} | [
"public",
"static",
"void",
"convert",
"(",
"SequenceRecordReader",
"reader",
",",
"SequenceRecordWriter",
"writer",
")",
"throws",
"IOException",
"{",
"convert",
"(",
"reader",
",",
"writer",
",",
"true",
")",
";",
"}"
] | Write all sequences from the specified sequence record reader to the specified sequence record writer.
Closes the sequence record writer on completion.
@param reader Sequence record reader (source of data)
@param writer Sequence record writer (location to write data)
@throws IOException If underlying reader/writer throws an exception | [
"Write",
"all",
"sequences",
"from",
"the",
"specified",
"sequence",
"record",
"reader",
"to",
"the",
"specified",
"sequence",
"record",
"writer",
".",
"Closes",
"the",
"sequence",
"record",
"writer",
"on",
"completion",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/records/converter/RecordReaderConverter.java#L80-L82 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GeneralPurposeFFT_F32_1D.java | GeneralPurposeFFT_F32_1D.realForwardFull | public void realForwardFull(final float[] a, final int offa) {
final int twon = 2 * n;
switch (plan) {
case SPLIT_RADIX:{
realForward(a, offa);
int idx1, idx2;
for (int k = 0; k < n / 2; k++) {
idx1 = 2 * k;
idx2 = offa + ((twon - idx1) % twon);
a[idx2] = a[offa + idx1];
a[idx2 + 1] = -a[offa + idx1 + 1];
}
a[offa + n] = -a[offa + 1];
a[offa + 1] = 0;
}break;
case MIXED_RADIX:{
rfftf(a, offa);
int m;
if (n % 2 == 0) {
m = n / 2;
} else {
m = (n + 1) / 2;
}
for (int k = 1; k < m; k++) {
int idx1 = offa + twon - 2 * k;
int idx2 = offa + 2 * k;
a[idx1 + 1] = -a[idx2];
a[idx1] = a[idx2 - 1];
}
for (int k = 1; k < n; k++) {
int idx = offa + n - k;
float tmp = a[idx + 1];
a[idx + 1] = a[idx];
a[idx] = tmp;
}
a[offa + 1] = 0;
}break;
case BLUESTEIN:
bluestein_real_full(a, offa, -1);
break;
}
} | java | public void realForwardFull(final float[] a, final int offa) {
final int twon = 2 * n;
switch (plan) {
case SPLIT_RADIX:{
realForward(a, offa);
int idx1, idx2;
for (int k = 0; k < n / 2; k++) {
idx1 = 2 * k;
idx2 = offa + ((twon - idx1) % twon);
a[idx2] = a[offa + idx1];
a[idx2 + 1] = -a[offa + idx1 + 1];
}
a[offa + n] = -a[offa + 1];
a[offa + 1] = 0;
}break;
case MIXED_RADIX:{
rfftf(a, offa);
int m;
if (n % 2 == 0) {
m = n / 2;
} else {
m = (n + 1) / 2;
}
for (int k = 1; k < m; k++) {
int idx1 = offa + twon - 2 * k;
int idx2 = offa + 2 * k;
a[idx1 + 1] = -a[idx2];
a[idx1] = a[idx2 - 1];
}
for (int k = 1; k < n; k++) {
int idx = offa + n - k;
float tmp = a[idx + 1];
a[idx + 1] = a[idx];
a[idx] = tmp;
}
a[offa + 1] = 0;
}break;
case BLUESTEIN:
bluestein_real_full(a, offa, -1);
break;
}
} | [
"public",
"void",
"realForwardFull",
"(",
"final",
"float",
"[",
"]",
"a",
",",
"final",
"int",
"offa",
")",
"{",
"final",
"int",
"twon",
"=",
"2",
"*",
"n",
";",
"switch",
"(",
"plan",
")",
"{",
"case",
"SPLIT_RADIX",
":",
"{",
"realForward",
"(",
... | Computes 1D forward DFT of real data leaving the result in <code>a</code>
. This method computes the full real forward transform, i.e. you will get
the same result as from <code>complexForward</code> called with all
imaginary part equal 0. Because the result is stored in <code>a</code>,
the size of the input array must greater or equal 2*n, with only the
first n elements filled with real data. To get back the original data,
use <code>complexInverse</code> on the output of this method.
@param a
data to transform
@param offa
index of the first element in array <code>a</code> | [
"Computes",
"1D",
"forward",
"DFT",
"of",
"real",
"data",
"leaving",
"the",
"result",
"in",
"<code",
">",
"a<",
"/",
"code",
">",
".",
"This",
"method",
"computes",
"the",
"full",
"real",
"forward",
"transform",
"i",
".",
"e",
".",
"you",
"will",
"get"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GeneralPurposeFFT_F32_1D.java#L383-L426 |
deeplearning4j/deeplearning4j | datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java | ArrowConverter.toArrowWritablesTimeSeries | public static List<List<List<Writable>>> toArrowWritablesTimeSeries(List<FieldVector> fieldVectors,Schema schema,int timeSeriesLength) {
ArrowWritableRecordTimeSeriesBatch arrowWritableRecordBatch = new ArrowWritableRecordTimeSeriesBatch(fieldVectors,schema,timeSeriesLength);
return arrowWritableRecordBatch;
} | java | public static List<List<List<Writable>>> toArrowWritablesTimeSeries(List<FieldVector> fieldVectors,Schema schema,int timeSeriesLength) {
ArrowWritableRecordTimeSeriesBatch arrowWritableRecordBatch = new ArrowWritableRecordTimeSeriesBatch(fieldVectors,schema,timeSeriesLength);
return arrowWritableRecordBatch;
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
">",
"toArrowWritablesTimeSeries",
"(",
"List",
"<",
"FieldVector",
">",
"fieldVectors",
",",
"Schema",
"schema",
",",
"int",
"timeSeriesLength",
")",
"{",
"ArrowWritableRecordTimeS... | Convert the input field vectors (the input data) and
the given schema to a proper list of writables.
@param fieldVectors the field vectors to use
@param schema the schema to use
@param timeSeriesLength the length of the time series
@return the equivalent datavec batch given the input data | [
"Convert",
"the",
"input",
"field",
"vectors",
"(",
"the",
"input",
"data",
")",
"and",
"the",
"given",
"schema",
"to",
"a",
"proper",
"list",
"of",
"writables",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java#L324-L327 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getAllEmblemIDs | public void getAllEmblemIDs(Emblem.Type type, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllEmblemIDs(type.name()).enqueue(callback);
} | java | public void getAllEmblemIDs(Emblem.Type type, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllEmblemIDs(type.name()).enqueue(callback);
} | [
"public",
"void",
"getAllEmblemIDs",
"(",
"Emblem",
".",
"Type",
"type",
",",
"Callback",
"<",
"List",
"<",
"Integer",
">",
">",
"callback",
")",
"throws",
"NullPointerException",
"{",
"gw2API",
".",
"getAllEmblemIDs",
"(",
"type",
".",
"name",
"(",
")",
"... | For more info on emblem API go <a href="https://wiki.guildwars2.com/wiki/API:2/emblem">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param type foregrounds/backgrounds
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see Emblem Emblem info | [
"For",
"more",
"info",
"on",
"emblem",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"emblem",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
"t... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1315-L1317 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Matth.java | Matth.addExact | public static long addExact(long a, long b) {
long result = a + b;
checkNoOverflow((a ^ b) < 0 | (a ^ result) >= 0);
return result;
} | java | public static long addExact(long a, long b) {
long result = a + b;
checkNoOverflow((a ^ b) < 0 | (a ^ result) >= 0);
return result;
} | [
"public",
"static",
"long",
"addExact",
"(",
"long",
"a",
",",
"long",
"b",
")",
"{",
"long",
"result",
"=",
"a",
"+",
"b",
";",
"checkNoOverflow",
"(",
"(",
"a",
"^",
"b",
")",
"<",
"0",
"|",
"(",
"a",
"^",
"result",
")",
">=",
"0",
")",
";"... | Returns the sum of {@code a} and {@code b}, provided it does not overflow.
@throws ArithmeticException if {@code a + b} overflows in signed {@code long} arithmetic | [
"Returns",
"the",
"sum",
"of",
"{",
"@code",
"a",
"}",
"and",
"{",
"@code",
"b",
"}",
"provided",
"it",
"does",
"not",
"overflow",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1382-L1386 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.listFromJobScheduleNextAsync | public ServiceFuture<List<CloudJob>> listFromJobScheduleNextAsync(final String nextPageLink, final ServiceFuture<List<CloudJob>> serviceFuture, final ListOperationCallback<CloudJob> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listFromJobScheduleNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> call(String nextPageLink) {
return listFromJobScheduleNextSinglePageAsync(nextPageLink, null);
}
},
serviceCallback);
} | java | public ServiceFuture<List<CloudJob>> listFromJobScheduleNextAsync(final String nextPageLink, final ServiceFuture<List<CloudJob>> serviceFuture, final ListOperationCallback<CloudJob> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listFromJobScheduleNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> call(String nextPageLink) {
return listFromJobScheduleNextSinglePageAsync(nextPageLink, null);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"CloudJob",
">",
">",
"listFromJobScheduleNextAsync",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"ServiceFuture",
"<",
"List",
"<",
"CloudJob",
">",
">",
"serviceFuture",
",",
"final",
"ListOperationCallback",
... | Lists the jobs that have been created under the specified job schedule.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param serviceFuture the ServiceFuture object tracking the Retrofit calls
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"the",
"jobs",
"that",
"have",
"been",
"created",
"under",
"the",
"specified",
"job",
"schedule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3578-L3588 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F3.applyOrElse | public R applyOrElse(P1 p1, P2 p2, P3 p3, F3<? super P1, ? super P2, ? super P3, ? extends R> fallback) {
try {
return apply(p1, p2, p3);
} catch (RuntimeException e) {
return fallback.apply(p1, p2, p3);
}
} | java | public R applyOrElse(P1 p1, P2 p2, P3 p3, F3<? super P1, ? super P2, ? super P3, ? extends R> fallback) {
try {
return apply(p1, p2, p3);
} catch (RuntimeException e) {
return fallback.apply(p1, p2, p3);
}
} | [
"public",
"R",
"applyOrElse",
"(",
"P1",
"p1",
",",
"P2",
"p2",
",",
"P3",
"p3",
",",
"F3",
"<",
"?",
"super",
"P1",
",",
"?",
"super",
"P2",
",",
"?",
"super",
"P3",
",",
"?",
"extends",
"R",
">",
"fallback",
")",
"{",
"try",
"{",
"return",
... | Applies this partial function to the given argument when it is contained in the function domain.
Applies fallback function where this partial function is not defined.
@param p1
the first argument
@param p2
the second argument
@param p3
the third argument
@param fallback
the function to be called of application of this function failed with any runtime exception
@return the result of this function or the fallback function application | [
"Applies",
"this",
"partial",
"function",
"to",
"the",
"given",
"argument",
"when",
"it",
"is",
"contained",
"in",
"the",
"function",
"domain",
".",
"Applies",
"fallback",
"function",
"where",
"this",
"partial",
"function",
"is",
"not",
"defined",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1202-L1208 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java | FieldDescriptorConstraints.checkSequenceName | private void checkSequenceName(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
String autoIncr = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_AUTOINCREMENT);
String seqName = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_SEQUENCE_NAME);
if ((seqName != null) && (seqName.length() > 0))
{
if (!"ojb".equals(autoIncr) && !"database".equals(autoIncr))
{
throw new ConstraintException("The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" has sequence-name set though it's autoincrement value is not set to 'ojb'");
}
}
} | java | private void checkSequenceName(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
String autoIncr = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_AUTOINCREMENT);
String seqName = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_SEQUENCE_NAME);
if ((seqName != null) && (seqName.length() > 0))
{
if (!"ojb".equals(autoIncr) && !"database".equals(autoIncr))
{
throw new ConstraintException("The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" has sequence-name set though it's autoincrement value is not set to 'ojb'");
}
}
} | [
"private",
"void",
"checkSequenceName",
"(",
"FieldDescriptorDef",
"fieldDef",
",",
"String",
"checkLevel",
")",
"throws",
"ConstraintException",
"{",
"if",
"(",
"CHECKLEVEL_NONE",
".",
"equals",
"(",
"checkLevel",
")",
")",
"{",
"return",
";",
"}",
"String",
"a... | Checks that sequence-name is only used with autoincrement='ojb'
@param fieldDef The field descriptor
@param checkLevel The current check level (this constraint is checked in basic and strict)
@exception ConstraintException If the constraint has been violated | [
"Checks",
"that",
"sequence",
"-",
"name",
"is",
"only",
"used",
"with",
"autoincrement",
"=",
"ojb"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java#L339-L356 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Matth.java | Matth.log2 | @SuppressWarnings("fallthrough")
// TODO(kevinb): remove after this warning is disabled globally
public static int log2(BigInteger x, RoundingMode mode) {
checkPositive("x", N.checkArgNotNull(x));
int logFloor = x.bitLength() - 1;
switch (mode) {
case UNNECESSARY:
checkRoundingUnnecessary(isPowerOfTwo(x)); // fall through
case DOWN:
case FLOOR:
return logFloor;
case UP:
case CEILING:
return isPowerOfTwo(x) ? logFloor : logFloor + 1;
case HALF_DOWN:
case HALF_UP:
case HALF_EVEN:
if (logFloor < SQRT2_PRECOMPUTE_THRESHOLD) {
BigInteger halfPower = SQRT2_PRECOMPUTED_BITS.shiftRight(SQRT2_PRECOMPUTE_THRESHOLD - logFloor);
if (x.compareTo(halfPower) <= 0) {
return logFloor;
} else {
return logFloor + 1;
}
}
// Since sqrt(2) is irrational, log2(x) - logFloor cannot be exactly 0.5
//
// To determine which side of logFloor.5 the logarithm is,
// we compare x^2 to 2^(2 * logFloor + 1).
BigInteger x2 = x.pow(2);
int logX2Floor = x2.bitLength() - 1;
return (logX2Floor < 2 * logFloor + 1) ? logFloor : logFloor + 1;
default:
throw new AssertionError();
}
} | java | @SuppressWarnings("fallthrough")
// TODO(kevinb): remove after this warning is disabled globally
public static int log2(BigInteger x, RoundingMode mode) {
checkPositive("x", N.checkArgNotNull(x));
int logFloor = x.bitLength() - 1;
switch (mode) {
case UNNECESSARY:
checkRoundingUnnecessary(isPowerOfTwo(x)); // fall through
case DOWN:
case FLOOR:
return logFloor;
case UP:
case CEILING:
return isPowerOfTwo(x) ? logFloor : logFloor + 1;
case HALF_DOWN:
case HALF_UP:
case HALF_EVEN:
if (logFloor < SQRT2_PRECOMPUTE_THRESHOLD) {
BigInteger halfPower = SQRT2_PRECOMPUTED_BITS.shiftRight(SQRT2_PRECOMPUTE_THRESHOLD - logFloor);
if (x.compareTo(halfPower) <= 0) {
return logFloor;
} else {
return logFloor + 1;
}
}
// Since sqrt(2) is irrational, log2(x) - logFloor cannot be exactly 0.5
//
// To determine which side of logFloor.5 the logarithm is,
// we compare x^2 to 2^(2 * logFloor + 1).
BigInteger x2 = x.pow(2);
int logX2Floor = x2.bitLength() - 1;
return (logX2Floor < 2 * logFloor + 1) ? logFloor : logFloor + 1;
default:
throw new AssertionError();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"fallthrough\"",
")",
"// TODO(kevinb): remove after this warning is disabled globally\r",
"public",
"static",
"int",
"log2",
"(",
"BigInteger",
"x",
",",
"RoundingMode",
"mode",
")",
"{",
"checkPositive",
"(",
"\"x\"",
",",
"N",
".",
"... | Returns the base-2 logarithm of {@code x}, rounded according to the specified rounding mode.
@throws IllegalArgumentException if {@code x <= 0}
@throws ArithmeticException if {@code mode} is {@link RoundingMode#UNNECESSARY} and {@code x}
is not a power of two | [
"Returns",
"the",
"base",
"-",
"2",
"logarithm",
"of",
"{",
"@code",
"x",
"}",
"rounded",
"according",
"to",
"the",
"specified",
"rounding",
"mode",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L474-L512 |
mapbox/mapbox-events-android | liblocation/src/main/java/com/mapbox/android/core/location/LocationEngineProvider.java | LocationEngineProvider.getBestLocationEngine | @NonNull
public static LocationEngine getBestLocationEngine(@NonNull Context context) {
checkNotNull(context, "context == null");
boolean hasGoogleLocationServices = isOnClasspath(GOOGLE_LOCATION_SERVICES);
if (isOnClasspath(GOOGLE_API_AVAILABILITY)) {
// Check Google Play services APK is available and up-to-date on this device
hasGoogleLocationServices &= GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)
== ConnectionResult.SUCCESS;
}
return getLocationEngine(context, hasGoogleLocationServices);
} | java | @NonNull
public static LocationEngine getBestLocationEngine(@NonNull Context context) {
checkNotNull(context, "context == null");
boolean hasGoogleLocationServices = isOnClasspath(GOOGLE_LOCATION_SERVICES);
if (isOnClasspath(GOOGLE_API_AVAILABILITY)) {
// Check Google Play services APK is available and up-to-date on this device
hasGoogleLocationServices &= GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)
== ConnectionResult.SUCCESS;
}
return getLocationEngine(context, hasGoogleLocationServices);
} | [
"@",
"NonNull",
"public",
"static",
"LocationEngine",
"getBestLocationEngine",
"(",
"@",
"NonNull",
"Context",
"context",
")",
"{",
"checkNotNull",
"(",
"context",
",",
"\"context == null\"",
")",
";",
"boolean",
"hasGoogleLocationServices",
"=",
"isOnClasspath",
"(",... | Returns instance to the best location engine, given the included libraries.
@param context {@link Context}.
@return a unique instance of {@link LocationEngine} every time method is called.
@since 1.1.0 | [
"Returns",
"instance",
"to",
"the",
"best",
"location",
"engine",
"given",
"the",
"included",
"libraries",
"."
] | train | https://github.com/mapbox/mapbox-events-android/blob/5b5ca7e04cb8fab31a8dc040b6e7521f930a58a4/liblocation/src/main/java/com/mapbox/android/core/location/LocationEngineProvider.java#L43-L54 |
j256/simplecsv | src/main/java/com/j256/simplecsv/processor/CsvProcessor.java | CsvProcessor.writeRow | public void writeRow(BufferedWriter bufferedWriter, T entity, boolean appendLineTermination) throws IOException {
checkEntityConfig();
String line = buildLine(entity, appendLineTermination);
bufferedWriter.write(line);
} | java | public void writeRow(BufferedWriter bufferedWriter, T entity, boolean appendLineTermination) throws IOException {
checkEntityConfig();
String line = buildLine(entity, appendLineTermination);
bufferedWriter.write(line);
} | [
"public",
"void",
"writeRow",
"(",
"BufferedWriter",
"bufferedWriter",
",",
"T",
"entity",
",",
"boolean",
"appendLineTermination",
")",
"throws",
"IOException",
"{",
"checkEntityConfig",
"(",
")",
";",
"String",
"line",
"=",
"buildLine",
"(",
"entity",
",",
"ap... | Write an entity row to the writer.
@param bufferedWriter
Where to write our header information.
@param entity
The entity we are writing to the buffered writer.
@param appendLineTermination
Set to true to add the newline to the end of the line.
@throws IOException
If there are any IO exceptions thrown when writing. | [
"Write",
"an",
"entity",
"row",
"to",
"the",
"writer",
"."
] | train | https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L468-L472 |
ggrandes/packer | src/main/java/org/javastack/packer/Packer.java | Packer.useAES | public Packer useAES(final String passphrase, final String sharedIV) throws NoSuchAlgorithmException,
NoSuchPaddingException {
initCipher();
initCipherIV(generateMdfromString(sharedIV, aesCipherLen), AESTYPEIV.SHARED_IV);
initCipherKey(passphrase);
return this;
} | java | public Packer useAES(final String passphrase, final String sharedIV) throws NoSuchAlgorithmException,
NoSuchPaddingException {
initCipher();
initCipherIV(generateMdfromString(sharedIV, aesCipherLen), AESTYPEIV.SHARED_IV);
initCipherKey(passphrase);
return this;
} | [
"public",
"Packer",
"useAES",
"(",
"final",
"String",
"passphrase",
",",
"final",
"String",
"sharedIV",
")",
"throws",
"NoSuchAlgorithmException",
",",
"NoSuchPaddingException",
"{",
"initCipher",
"(",
")",
";",
"initCipherIV",
"(",
"generateMdfromString",
"(",
"sha... | Sets he usage of "AES/CBC/PKCS5Padding" with pre-shared IV for encryption (default no)
@param passphrase shared secret
@param sharedIV shared Initialization Vector
@return
@throws NoSuchAlgorithmException
@throws NoSuchPaddingException | [
"Sets",
"he",
"usage",
"of",
"AES",
"/",
"CBC",
"/",
"PKCS5Padding",
"with",
"pre",
"-",
"shared",
"IV",
"for",
"encryption",
"(",
"default",
"no",
")"
] | train | https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L329-L335 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/TokenCachingStrategy.java | TokenCachingStrategy.getExpirationDate | public static Date getExpirationDate(Bundle bundle) {
Validate.notNull(bundle, "bundle");
return getDate(bundle, EXPIRATION_DATE_KEY);
} | java | public static Date getExpirationDate(Bundle bundle) {
Validate.notNull(bundle, "bundle");
return getDate(bundle, EXPIRATION_DATE_KEY);
} | [
"public",
"static",
"Date",
"getExpirationDate",
"(",
"Bundle",
"bundle",
")",
"{",
"Validate",
".",
"notNull",
"(",
"bundle",
",",
"\"bundle\"",
")",
";",
"return",
"getDate",
"(",
"bundle",
",",
"EXPIRATION_DATE_KEY",
")",
";",
"}"
] | Gets the cached expiration date from a Bundle.
@param bundle
A Bundle in which the expiration date was stored.
@return the cached expiration date, or null.
@throws NullPointerException if the passed in Bundle is null | [
"Gets",
"the",
"cached",
"expiration",
"date",
"from",
"a",
"Bundle",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/TokenCachingStrategy.java#L185-L188 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java | AppServiceCertificateOrdersInner.retrieveCertificateEmailHistoryAsync | public Observable<List<CertificateEmailInner>> retrieveCertificateEmailHistoryAsync(String resourceGroupName, String name) {
return retrieveCertificateEmailHistoryWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<CertificateEmailInner>>, List<CertificateEmailInner>>() {
@Override
public List<CertificateEmailInner> call(ServiceResponse<List<CertificateEmailInner>> response) {
return response.body();
}
});
} | java | public Observable<List<CertificateEmailInner>> retrieveCertificateEmailHistoryAsync(String resourceGroupName, String name) {
return retrieveCertificateEmailHistoryWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<CertificateEmailInner>>, List<CertificateEmailInner>>() {
@Override
public List<CertificateEmailInner> call(ServiceResponse<List<CertificateEmailInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"CertificateEmailInner",
">",
">",
"retrieveCertificateEmailHistoryAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"retrieveCertificateEmailHistoryWithServiceResponseAsync",
"(",
"resourceGroupNa... | Retrieve email history.
Retrieve email history.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the certificate order.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<CertificateEmailInner> object | [
"Retrieve",
"email",
"history",
".",
"Retrieve",
"email",
"history",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L2351-L2358 |
aws/aws-sdk-java | aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/UpdateBranchRequest.java | UpdateBranchRequest.withEnvironmentVariables | public UpdateBranchRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
setEnvironmentVariables(environmentVariables);
return this;
} | java | public UpdateBranchRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
setEnvironmentVariables(environmentVariables);
return this;
} | [
"public",
"UpdateBranchRequest",
"withEnvironmentVariables",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"environmentVariables",
")",
"{",
"setEnvironmentVariables",
"(",
"environmentVariables",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Environment Variables for the branch.
</p>
@param environmentVariables
Environment Variables for the branch.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Environment",
"Variables",
"for",
"the",
"branch",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/UpdateBranchRequest.java#L462-L465 |
qiniu/android-sdk | library/src/main/java/com/qiniu/android/utils/Crc32.java | Crc32.bytes | public static long bytes(byte[] data, int offset, int length) {
CRC32 crc32 = new CRC32();
crc32.update(data, offset, length);
return crc32.getValue();
} | java | public static long bytes(byte[] data, int offset, int length) {
CRC32 crc32 = new CRC32();
crc32.update(data, offset, length);
return crc32.getValue();
} | [
"public",
"static",
"long",
"bytes",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"CRC32",
"crc32",
"=",
"new",
"CRC32",
"(",
")",
";",
"crc32",
".",
"update",
"(",
"data",
",",
"offset",
",",
"length",
")",
... | 计算二进制字节校验码
@param data 二进制数据
@param offset 起始字节索引
@param length 校验字节长度
@return 校验码 | [
"计算二进制字节校验码"
] | train | https://github.com/qiniu/android-sdk/blob/dbd2a01fb3bff7a5e75e8934bbf81713124d8466/library/src/main/java/com/qiniu/android/utils/Crc32.java#L21-L25 |
JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/CurrencyUnitBuilder.java | CurrencyUnitBuilder.of | public static CurrencyUnitBuilder of(String currencyCode, String providerName) {
return new CurrencyUnitBuilder(currencyCode, CurrencyContextBuilder.of(providerName).build());
} | java | public static CurrencyUnitBuilder of(String currencyCode, String providerName) {
return new CurrencyUnitBuilder(currencyCode, CurrencyContextBuilder.of(providerName).build());
} | [
"public",
"static",
"CurrencyUnitBuilder",
"of",
"(",
"String",
"currencyCode",
",",
"String",
"providerName",
")",
"{",
"return",
"new",
"CurrencyUnitBuilder",
"(",
"currencyCode",
",",
"CurrencyContextBuilder",
".",
"of",
"(",
"providerName",
")",
".",
"build",
... | Creates a new CurrencyUnitBuilder, creates a simple CurrencyContext using the given provider name.
@param currencyCode the (unique) and identifying currency code, not null.
@param providerName the currency provider, not null. | [
"Creates",
"a",
"new",
"CurrencyUnitBuilder",
"creates",
"a",
"simple",
"CurrencyContext",
"using",
"the",
"given",
"provider",
"name",
"."
] | train | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/CurrencyUnitBuilder.java#L70-L72 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java | DatabasesInner.beginUpdate | public DatabaseInner beginUpdate(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).toBlocking().single().body();
} | java | public DatabaseInner beginUpdate(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).toBlocking().single().body();
} | [
"public",
"DatabaseInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"databaseName",
",",
"DatabaseUpdate",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clust... | Updates a database.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param databaseName The name of the database in the Kusto cluster.
@param parameters The database parameters supplied to the Update 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 DatabaseInner object if successful. | [
"Updates",
"a",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L676-L678 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.java | MMCIFFileTools.toLoopMmCifHeaderString | public static String toLoopMmCifHeaderString(String categoryName, String className) throws ClassNotFoundException {
StringBuilder str = new StringBuilder();
str.append(SimpleMMcifParser.LOOP_START+newline);
Class<?> c = Class.forName(className);
for (Field f : getFields(c)) {
str.append(categoryName+"."+f.getName()+newline);
}
return str.toString();
} | java | public static String toLoopMmCifHeaderString(String categoryName, String className) throws ClassNotFoundException {
StringBuilder str = new StringBuilder();
str.append(SimpleMMcifParser.LOOP_START+newline);
Class<?> c = Class.forName(className);
for (Field f : getFields(c)) {
str.append(categoryName+"."+f.getName()+newline);
}
return str.toString();
} | [
"public",
"static",
"String",
"toLoopMmCifHeaderString",
"(",
"String",
"categoryName",
",",
"String",
"className",
")",
"throws",
"ClassNotFoundException",
"{",
"StringBuilder",
"str",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"str",
".",
"append",
"(",
"Simple... | Produces a mmCIF loop header string for the given categoryName and className.
className must be one of the beans in the {@link org.biojava.nbio.structure.io.mmcif.model} package
@param categoryName
@param className
@return
@throws ClassNotFoundException if the given className can not be found | [
"Produces",
"a",
"mmCIF",
"loop",
"header",
"string",
"for",
"the",
"given",
"categoryName",
"and",
"className",
".",
"className",
"must",
"be",
"one",
"of",
"the",
"beans",
"in",
"the",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.java#L87-L99 |
kiswanij/jk-util | src/main/java/com/jk/util/validation/builtin/ValidationBundle.java | ValidationBundle.getMessage | public static String getMessage(final Class class1, final String string, final String compName) {
return JKMessage.get(string, compName);
} | java | public static String getMessage(final Class class1, final String string, final String compName) {
return JKMessage.get(string, compName);
} | [
"public",
"static",
"String",
"getMessage",
"(",
"final",
"Class",
"class1",
",",
"final",
"String",
"string",
",",
"final",
"String",
"compName",
")",
"{",
"return",
"JKMessage",
".",
"get",
"(",
"string",
",",
"compName",
")",
";",
"}"
] | Gets the message.
@param class1 the class 1
@param string the string
@param compName the comp name
@return the message | [
"Gets",
"the",
"message",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/validation/builtin/ValidationBundle.java#L61-L63 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spy3rd | public static <T1, T2, T3, R> TriFunction<T1, T2, T3, R> spy3rd(TriFunction<T1, T2, T3, R> function, Box<T3> param3) {
return spy(function, Box.<R>empty(), Box.<T1>empty(), Box.<T2>empty(), param3);
} | java | public static <T1, T2, T3, R> TriFunction<T1, T2, T3, R> spy3rd(TriFunction<T1, T2, T3, R> function, Box<T3> param3) {
return spy(function, Box.<R>empty(), Box.<T1>empty(), Box.<T2>empty(), param3);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"TriFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"spy3rd",
"(",
"TriFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"function",
",",
"Box",
"<",
"T3"... | Proxies a ternary function spying for third parameter.
@param <R> the function result type
@param <T1> the function first parameter type
@param <T2> the function second parameter type
@param <T3> the function third parameter type
@param function the function that will be spied
@param param3 a box that will be containing the third spied parameter
@return the proxied function | [
"Proxies",
"a",
"ternary",
"function",
"spying",
"for",
"third",
"parameter",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L239-L241 |
fabric8io/kubernetes-client | kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/Utils.java | Utils.replaceAllWithoutRegex | public static String replaceAllWithoutRegex(String text, String from, String to) {
if (text == null) {
return null;
}
int idx = 0;
while (true) {
idx = text.indexOf(from, idx);
if (idx >= 0) {
text = text.substring(0, idx) + to + text.substring(idx + from.length());
// lets start searching after the end of the `to` to avoid possible infinite recursion
idx += to.length();
} else {
break;
}
}
return text;
} | java | public static String replaceAllWithoutRegex(String text, String from, String to) {
if (text == null) {
return null;
}
int idx = 0;
while (true) {
idx = text.indexOf(from, idx);
if (idx >= 0) {
text = text.substring(0, idx) + to + text.substring(idx + from.length());
// lets start searching after the end of the `to` to avoid possible infinite recursion
idx += to.length();
} else {
break;
}
}
return text;
} | [
"public",
"static",
"String",
"replaceAllWithoutRegex",
"(",
"String",
"text",
",",
"String",
"from",
",",
"String",
"to",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"idx",
"=",
"0",
";",
"while",
"(",
"tr... | Replaces all occurrences of the from text with to text without any regular expressions
@param text text string
@param from from string
@param to to string
@return returns processed string | [
"Replaces",
"all",
"occurrences",
"of",
"the",
"from",
"text",
"with",
"to",
"text",
"without",
"any",
"regular",
"expressions"
] | train | https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/Utils.java#L260-L277 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.changeEmail_POST | public OvhTask changeEmail_POST(String newEmail) throws IOException {
String qPath = "/me/changeEmail";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "newEmail", newEmail);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask changeEmail_POST(String newEmail) throws IOException {
String qPath = "/me/changeEmail";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "newEmail", newEmail);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"changeEmail_POST",
"(",
"String",
"newEmail",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/changeEmail\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",... | Initiate an email change procedure
REST: POST /me/changeEmail
@param newEmail [required] New email to associate to your account | [
"Initiate",
"an",
"email",
"change",
"procedure"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2674-L2681 |
jroyalty/jglm | src/main/java/com/hackoeur/jglm/support/Precision.java | Precision.equalsIncludingNaN | public static boolean equalsIncludingNaN(float x, float y) {
return (Float.isNaN(x) && Float.isNaN(y)) || equals(x, y, 1);
} | java | public static boolean equalsIncludingNaN(float x, float y) {
return (Float.isNaN(x) && Float.isNaN(y)) || equals(x, y, 1);
} | [
"public",
"static",
"boolean",
"equalsIncludingNaN",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"return",
"(",
"Float",
".",
"isNaN",
"(",
"x",
")",
"&&",
"Float",
".",
"isNaN",
"(",
"y",
")",
")",
"||",
"equals",
"(",
"x",
",",
"y",
",",
"1... | Returns true if both arguments are NaN or neither is NaN and they are
equal as defined by {@link #equals(float,float) equals(x, y, 1)}.
@param x first value
@param y second value
@return {@code true} if the values are equal or both are NaN.
@since 2.2 | [
"Returns",
"true",
"if",
"both",
"arguments",
"are",
"NaN",
"or",
"neither",
"is",
"NaN",
"and",
"they",
"are",
"equal",
"as",
"defined",
"by",
"{",
"@link",
"#equals",
"(",
"float",
"float",
")",
"equals",
"(",
"x",
"y",
"1",
")",
"}",
"."
] | train | https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/Precision.java#L147-L149 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java | ElementBase.addChild | protected void addChild(ElementBase child, boolean doEvent) {
if (!child.canAcceptParent(this)) {
CWFException.raise(child.rejectReason);
}
if (!canAcceptChild(child)) {
CWFException.raise(rejectReason);
}
if (doEvent) {
beforeAddChild(child);
}
if (child.getParent() != null) {
child.getParent().removeChild(child, false);
}
children.add(child);
child.updateParent(this);
if (doEvent) {
afterAddChild(child);
}
} | java | protected void addChild(ElementBase child, boolean doEvent) {
if (!child.canAcceptParent(this)) {
CWFException.raise(child.rejectReason);
}
if (!canAcceptChild(child)) {
CWFException.raise(rejectReason);
}
if (doEvent) {
beforeAddChild(child);
}
if (child.getParent() != null) {
child.getParent().removeChild(child, false);
}
children.add(child);
child.updateParent(this);
if (doEvent) {
afterAddChild(child);
}
} | [
"protected",
"void",
"addChild",
"(",
"ElementBase",
"child",
",",
"boolean",
"doEvent",
")",
"{",
"if",
"(",
"!",
"child",
".",
"canAcceptParent",
"(",
"this",
")",
")",
"{",
"CWFException",
".",
"raise",
"(",
"child",
".",
"rejectReason",
")",
";",
"}"... | Adds the specified child element. The validity of the operation is first tested and an
exception thrown if the element is not a valid child for this parent.
@param child Element to add as a child.
@param doEvent Fires the add child events if true. | [
"Adds",
"the",
"specified",
"child",
"element",
".",
"The",
"validity",
"of",
"the",
"operation",
"is",
"first",
"tested",
"and",
"an",
"exception",
"thrown",
"if",
"the",
"element",
"is",
"not",
"a",
"valid",
"child",
"for",
"this",
"parent",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L155-L178 |
Netflix/astyanax | astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftKeyspaceImpl.java | ThriftKeyspaceImpl.toThriftKeyspaceDefinition | private ThriftKeyspaceDefinitionImpl toThriftKeyspaceDefinition(final Map<String, Object> options) {
ThriftKeyspaceDefinitionImpl def = new ThriftKeyspaceDefinitionImpl();
Map<String, Object> internalOptions = Maps.newHashMap();
if (options != null)
internalOptions.putAll(options);
if (internalOptions.containsKey("name") && !internalOptions.get("name").equals(getKeyspaceName())) {
throw new RuntimeException(
String.format("'name' attribute must match keyspace name. Expected '%s' but got '%s'",
getKeyspaceName(), internalOptions.get("name")));
}
else {
internalOptions.put("name", getKeyspaceName());
}
def.setFields(internalOptions);
return def;
} | java | private ThriftKeyspaceDefinitionImpl toThriftKeyspaceDefinition(final Map<String, Object> options) {
ThriftKeyspaceDefinitionImpl def = new ThriftKeyspaceDefinitionImpl();
Map<String, Object> internalOptions = Maps.newHashMap();
if (options != null)
internalOptions.putAll(options);
if (internalOptions.containsKey("name") && !internalOptions.get("name").equals(getKeyspaceName())) {
throw new RuntimeException(
String.format("'name' attribute must match keyspace name. Expected '%s' but got '%s'",
getKeyspaceName(), internalOptions.get("name")));
}
else {
internalOptions.put("name", getKeyspaceName());
}
def.setFields(internalOptions);
return def;
} | [
"private",
"ThriftKeyspaceDefinitionImpl",
"toThriftKeyspaceDefinition",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
")",
"{",
"ThriftKeyspaceDefinitionImpl",
"def",
"=",
"new",
"ThriftKeyspaceDefinitionImpl",
"(",
")",
";",
"Map",
"<",
"String"... | Convert a Map of options to an internal thrift keyspace definition
@param options | [
"Convert",
"a",
"Map",
"of",
"options",
"to",
"an",
"internal",
"thrift",
"keyspace",
"definition"
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftKeyspaceImpl.java#L800-L819 |
telly/groundy | library/src/main/java/com/telly/groundy/TaskResult.java | TaskResult.add | public TaskResult add(String key, ArrayList<CharSequence> value) {
mBundle.putCharSequenceArrayList(key, value);
return this;
} | java | public TaskResult add(String key, ArrayList<CharSequence> value) {
mBundle.putCharSequenceArrayList(key, value);
return this;
} | [
"public",
"TaskResult",
"add",
"(",
"String",
"key",
",",
"ArrayList",
"<",
"CharSequence",
">",
"value",
")",
"{",
"mBundle",
".",
"putCharSequenceArrayList",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts an ArrayList<CharSequence> value into the mapping of this Bundle, replacing any
existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value an ArrayList<CharSequence> object, or null | [
"Inserts",
"an",
"ArrayList<CharSequence",
">",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/TaskResult.java#L251-L254 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SearchResourcesImpl.java | SearchResourcesImpl.searchSheet | public SearchResult searchSheet(long sheetId, String query) throws SmartsheetException {
Util.throwIfNull(query);
Util.throwIfEmpty(query);
try {
return this.getResource("search/sheets/" + sheetId + "?query=" + URLEncoder.encode(query,
"utf-8"), SearchResult.class);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} | java | public SearchResult searchSheet(long sheetId, String query) throws SmartsheetException {
Util.throwIfNull(query);
Util.throwIfEmpty(query);
try {
return this.getResource("search/sheets/" + sheetId + "?query=" + URLEncoder.encode(query,
"utf-8"), SearchResult.class);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} | [
"public",
"SearchResult",
"searchSheet",
"(",
"long",
"sheetId",
",",
"String",
"query",
")",
"throws",
"SmartsheetException",
"{",
"Util",
".",
"throwIfNull",
"(",
"query",
")",
";",
"Util",
".",
"throwIfEmpty",
"(",
"query",
")",
";",
"try",
"{",
"return",... | Performs a search within a sheet.
It mirrors to the following Smartsheet REST API method: GET /search/sheet/{sheetId}
Exceptions:
IllegalArgumentException : if query is null/empty string
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFoundException : if the resource can not be found
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param sheetId the sheet id
@param query the query
@return the search result (note that if there is no such resource, this method will throw
ResourceNotFoundException rather than returning null).
@throws UnsupportedEncodingException the unsupported encoding exception
@throws SmartsheetException the smartsheet exception | [
"Performs",
"a",
"search",
"within",
"a",
"sheet",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SearchResourcesImpl.java#L146-L155 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/SimpleAttributeDefinition.java | SimpleAttributeDefinition.marshallAsAttribute | public void marshallAsAttribute(final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException {
getMarshaller().marshallAsAttribute(this, resourceModel, marshallDefault, writer);
} | java | public void marshallAsAttribute(final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException {
getMarshaller().marshallAsAttribute(this, resourceModel, marshallDefault, writer);
} | [
"public",
"void",
"marshallAsAttribute",
"(",
"final",
"ModelNode",
"resourceModel",
",",
"final",
"boolean",
"marshallDefault",
",",
"final",
"XMLStreamWriter",
"writer",
")",
"throws",
"XMLStreamException",
"{",
"getMarshaller",
"(",
")",
".",
"marshallAsAttribute",
... | Marshalls the value from the given {@code resourceModel} as an xml attribute, if it
{@link #isMarshallable(org.jboss.dmr.ModelNode, boolean) is marshallable}.
@param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}.
@param marshallDefault {@code true} if the value should be marshalled even if it matches the default value
@param writer stream writer to use for writing the attribute
@throws javax.xml.stream.XMLStreamException if {@code writer} throws an exception | [
"Marshalls",
"the",
"value",
"from",
"the",
"given",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/SimpleAttributeDefinition.java#L144-L146 |
crowmagnumb/s6-util | src/main/java/net/crowmagnumb/util/string/AlphanumComparator.java | AlphanumComparator.getChunk | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker);
if (!isDigit(c))
break;
chunk.append(c);
marker++;
}
} else
{
while (marker < slength)
{
c = s.charAt(marker);
if (isDigit(c))
break;
chunk.append(c);
marker++;
}
}
return chunk.toString();
} | java | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker);
if (!isDigit(c))
break;
chunk.append(c);
marker++;
}
} else
{
while (marker < slength)
{
c = s.charAt(marker);
if (isDigit(c))
break;
chunk.append(c);
marker++;
}
}
return chunk.toString();
} | [
"private",
"final",
"String",
"getChunk",
"(",
"String",
"s",
",",
"int",
"slength",
",",
"int",
"marker",
")",
"{",
"StringBuilder",
"chunk",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"c",
"=",
"s",
".",
"charAt",
"(",
"marker",
")",
";",
... | Length of string is passed in for improved efficiency (only need to calculate it once) * | [
"Length",
"of",
"string",
"is",
"passed",
"in",
"for",
"improved",
"efficiency",
"(",
"only",
"need",
"to",
"calculate",
"it",
"once",
")",
"*"
] | train | https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/string/AlphanumComparator.java#L90-L118 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/config/Template.java | Template.setAttributes | public final void setAttributes(final Map<String, Attribute> attributes) {
for (Map.Entry<String, Attribute> entry: attributes.entrySet()) {
Object attribute = entry.getValue();
if (!(attribute instanceof Attribute)) {
final String msg =
"Attribute: '" + entry.getKey() + "' is not an attribute. It is a: " + attribute;
LOGGER.error("Error setting the Attributes: {}", msg);
throw new IllegalArgumentException(msg);
} else {
((Attribute) attribute).setConfigName(entry.getKey());
}
}
this.attributes = attributes;
} | java | public final void setAttributes(final Map<String, Attribute> attributes) {
for (Map.Entry<String, Attribute> entry: attributes.entrySet()) {
Object attribute = entry.getValue();
if (!(attribute instanceof Attribute)) {
final String msg =
"Attribute: '" + entry.getKey() + "' is not an attribute. It is a: " + attribute;
LOGGER.error("Error setting the Attributes: {}", msg);
throw new IllegalArgumentException(msg);
} else {
((Attribute) attribute).setConfigName(entry.getKey());
}
}
this.attributes = attributes;
} | [
"public",
"final",
"void",
"setAttributes",
"(",
"final",
"Map",
"<",
"String",
",",
"Attribute",
">",
"attributes",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Attribute",
">",
"entry",
":",
"attributes",
".",
"entrySet",
"(",
")",
... | Set the attributes for this template.
@param attributes the attribute map | [
"Set",
"the",
"attributes",
"for",
"this",
"template",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/config/Template.java#L138-L151 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/MessageRouterImpl.java | MessageRouterImpl.addMsgToLogHandler | protected void addMsgToLogHandler(String msgId, String handlerId) {
Set<String> logHandlerIdSet = getOrCreateLogHandlerIdSet(msgId);
logHandlerIdSet.add(handlerId);
} | java | protected void addMsgToLogHandler(String msgId, String handlerId) {
Set<String> logHandlerIdSet = getOrCreateLogHandlerIdSet(msgId);
logHandlerIdSet.add(handlerId);
} | [
"protected",
"void",
"addMsgToLogHandler",
"(",
"String",
"msgId",
",",
"String",
"handlerId",
")",
"{",
"Set",
"<",
"String",
">",
"logHandlerIdSet",
"=",
"getOrCreateLogHandlerIdSet",
"(",
"msgId",
")",
";",
"logHandlerIdSet",
".",
"add",
"(",
"handlerId",
")"... | Add the specified log handler to the message ID's routing list. | [
"Add",
"the",
"specified",
"log",
"handler",
"to",
"the",
"message",
"ID",
"s",
"routing",
"list",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/MessageRouterImpl.java#L170-L173 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.millisToStr | public static Expression millisToStr(Expression expression, String format) {
if (format == null || format.isEmpty()) {
return x("MILLIS_TO_STR(" + expression.toString() + ")");
}
return x("MILLIS_TO_STR(" + expression.toString() + ", \"" + format + "\")");
} | java | public static Expression millisToStr(Expression expression, String format) {
if (format == null || format.isEmpty()) {
return x("MILLIS_TO_STR(" + expression.toString() + ")");
}
return x("MILLIS_TO_STR(" + expression.toString() + ", \"" + format + "\")");
} | [
"public",
"static",
"Expression",
"millisToStr",
"(",
"Expression",
"expression",
",",
"String",
"format",
")",
"{",
"if",
"(",
"format",
"==",
"null",
"||",
"format",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"x",
"(",
"\"MILLIS_TO_STR(\"",
"+",
"expr... | Returned expression results in the string in the supported format to which
the UNIX milliseconds has been converted. | [
"Returned",
"expression",
"results",
"in",
"the",
"string",
"in",
"the",
"supported",
"format",
"to",
"which",
"the",
"UNIX",
"milliseconds",
"has",
"been",
"converted",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L232-L237 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java | LongExtensions.operator_greaterEqualsThan | @Pure
@Inline(value="($1 >= $2)", constantExpression=true)
public static boolean operator_greaterEqualsThan(long a, double b) {
return a >= b;
} | java | @Pure
@Inline(value="($1 >= $2)", constantExpression=true)
public static boolean operator_greaterEqualsThan(long a, double b) {
return a >= b;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"($1 >= $2)\"",
",",
"constantExpression",
"=",
"true",
")",
"public",
"static",
"boolean",
"operator_greaterEqualsThan",
"(",
"long",
"a",
",",
"double",
"b",
")",
"{",
"return",
"a",
">=",
"b",
";",
"}"
] | The binary <code>greaterEqualsThan</code> operator. This is the equivalent to the Java <code>>=</code> operator.
@param a a long.
@param b a double.
@return <code>a>=b</code>
@since 2.3 | [
"The",
"binary",
"<code",
">",
"greaterEqualsThan<",
"/",
"code",
">",
"operator",
".",
"This",
"is",
"the",
"equivalent",
"to",
"the",
"Java",
"<code",
">",
">",
";",
"=",
"<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java#L362-L366 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java | BasicBondGenerator.generateBondElement | public IRenderingElement generateBondElement(IBond bond, RendererModel model) {
return generateBondElement(bond, bond.getOrder(), model);
} | java | public IRenderingElement generateBondElement(IBond bond, RendererModel model) {
return generateBondElement(bond, bond.getOrder(), model);
} | [
"public",
"IRenderingElement",
"generateBondElement",
"(",
"IBond",
"bond",
",",
"RendererModel",
"model",
")",
"{",
"return",
"generateBondElement",
"(",
"bond",
",",
"bond",
".",
"getOrder",
"(",
")",
",",
"model",
")",
";",
"}"
] | Generate rendering elements for a bond, without ring elements but
considering the type of the bond (single, double, triple).
@param bond the bond to use when generating elements
@param model the renderer model
@return one or more rendering elements | [
"Generate",
"rendering",
"elements",
"for",
"a",
"bond",
"without",
"ring",
"elements",
"but",
"considering",
"the",
"type",
"of",
"the",
"bond",
"(",
"single",
"double",
"triple",
")",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java#L295-L297 |
recruit-mp/android-RMP-Appirater | library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java | RmpAppirater.setFirstLaunchDate | public static void setFirstLaunchDate(Context context, long firstLaunchDate) {
SharedPreferences prefs = getSharedPreferences(context);
SharedPreferences.Editor prefsEditor = prefs.edit();
prefsEditor.putLong(PREF_KEY_APP_FIRST_LAUNCHED_DATE, firstLaunchDate);
prefsEditor.commit();
} | java | public static void setFirstLaunchDate(Context context, long firstLaunchDate) {
SharedPreferences prefs = getSharedPreferences(context);
SharedPreferences.Editor prefsEditor = prefs.edit();
prefsEditor.putLong(PREF_KEY_APP_FIRST_LAUNCHED_DATE, firstLaunchDate);
prefsEditor.commit();
} | [
"public",
"static",
"void",
"setFirstLaunchDate",
"(",
"Context",
"context",
",",
"long",
"firstLaunchDate",
")",
"{",
"SharedPreferences",
"prefs",
"=",
"getSharedPreferences",
"(",
"context",
")",
";",
"SharedPreferences",
".",
"Editor",
"prefsEditor",
"=",
"prefs... | Modify internal value.
<p/>
If you use this method, you might need to have a good understanding of this class code.
@param context Context
@param firstLaunchDate First launch date. | [
"Modify",
"internal",
"value",
".",
"<p",
"/",
">",
"If",
"you",
"use",
"this",
"method",
"you",
"might",
"need",
"to",
"have",
"a",
"good",
"understanding",
"of",
"this",
"class",
"code",
"."
] | train | https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L341-L348 |
softindex/datakernel | cloud-dataflow/src/main/java/io/datakernel/dataflow/server/DatagraphEnvironment.java | DatagraphEnvironment.setInstance | @SuppressWarnings("unchecked")
public <T> DatagraphEnvironment setInstance(Class<T> type, T value) {
((Map<Class<T>, T>) instances).put(type, value);
return this;
} | java | @SuppressWarnings("unchecked")
public <T> DatagraphEnvironment setInstance(Class<T> type, T value) {
((Map<Class<T>, T>) instances).put(type, value);
return this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"DatagraphEnvironment",
"setInstance",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"value",
")",
"{",
"(",
"(",
"Map",
"<",
"Class",
"<",
"T",
">",
",",
"T",
">",
")",
... | Sets the specified instance for the given key (instance type).
@param type instance type
@param value instance
@param <T> type of the instance
@return this environment | [
"Sets",
"the",
"specified",
"instance",
"for",
"the",
"given",
"key",
"(",
"instance",
"type",
")",
"."
] | train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/cloud-dataflow/src/main/java/io/datakernel/dataflow/server/DatagraphEnvironment.java#L80-L84 |
lukas-krecan/JsonUnit | json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java | JsonAssert.assertJsonStructureEquals | @Deprecated
public static void assertJsonStructureEquals(Object expected, Object actual) {
Diff diff = create(expected, actual, ACTUAL, ROOT, configuration.withOptions(COMPARING_ONLY_STRUCTURE));
diff.failIfDifferent();
} | java | @Deprecated
public static void assertJsonStructureEquals(Object expected, Object actual) {
Diff diff = create(expected, actual, ACTUAL, ROOT, configuration.withOptions(COMPARING_ONLY_STRUCTURE));
diff.failIfDifferent();
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"assertJsonStructureEquals",
"(",
"Object",
"expected",
",",
"Object",
"actual",
")",
"{",
"Diff",
"diff",
"=",
"create",
"(",
"expected",
",",
"actual",
",",
"ACTUAL",
",",
"ROOT",
",",
"configuration",
".",
"w... | Compares structures of two JSON documents. Is too lenient, ignores types, prefer IGNORING_VALUES option instead.
Throws {@link AssertionError} if they are different.
@deprecated Use IGNORING_VALUES option instead | [
"Compares",
"structures",
"of",
"two",
"JSON",
"documents",
".",
"Is",
"too",
"lenient",
"ignores",
"types",
"prefer",
"IGNORING_VALUES",
"option",
"instead",
".",
"Throws",
"{",
"@link",
"AssertionError",
"}",
"if",
"they",
"are",
"different",
"."
] | train | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L128-L132 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.appendTimeZoneOffset | public DateTimeFormatterBuilder appendTimeZoneOffset(
String zeroOffsetPrintText, String zeroOffsetParseText, boolean showSeparators,
int minFields, int maxFields) {
return append0(new TimeZoneOffset
(zeroOffsetPrintText, zeroOffsetParseText, showSeparators, minFields, maxFields));
} | java | public DateTimeFormatterBuilder appendTimeZoneOffset(
String zeroOffsetPrintText, String zeroOffsetParseText, boolean showSeparators,
int minFields, int maxFields) {
return append0(new TimeZoneOffset
(zeroOffsetPrintText, zeroOffsetParseText, showSeparators, minFields, maxFields));
} | [
"public",
"DateTimeFormatterBuilder",
"appendTimeZoneOffset",
"(",
"String",
"zeroOffsetPrintText",
",",
"String",
"zeroOffsetParseText",
",",
"boolean",
"showSeparators",
",",
"int",
"minFields",
",",
"int",
"maxFields",
")",
"{",
"return",
"append0",
"(",
"new",
"Ti... | Instructs the printer to emit text and numbers to display time zone
offset from UTC. A parser will use the parsed time zone offset to adjust
the datetime.
<p>
If zero offset print text is supplied, then it will be printed when the zone is zero.
If zero offset parse text is supplied, then either it or the offset will be parsed.
@param zeroOffsetPrintText the text to print if time zone offset is zero. If
null, offset is always shown.
@param zeroOffsetParseText the text to optionally parse to indicate that the time
zone offset is zero. If null, then always use the offset.
@param showSeparators if true, prints ':' separator before minute and
second field and prints '.' separator before fraction field.
@param minFields minimum number of fields to print, stopping when no
more precision is required. 1=hours, 2=minutes, 3=seconds, 4=fraction
@param maxFields maximum number of fields to print
@return this DateTimeFormatterBuilder, for chaining
@since 2.0 | [
"Instructs",
"the",
"printer",
"to",
"emit",
"text",
"and",
"numbers",
"to",
"display",
"time",
"zone",
"offset",
"from",
"UTC",
".",
"A",
"parser",
"will",
"use",
"the",
"parsed",
"time",
"zone",
"offset",
"to",
"adjust",
"the",
"datetime",
".",
"<p",
"... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L1116-L1121 |
stapler/stapler | core/src/main/java/org/kohsuke/stapler/Stapler.java | Stapler.setClassLoader | public static void setClassLoader( ServletContext context, ClassLoader classLoader ) {
WebApp.get(context).setClassLoader(classLoader);
} | java | public static void setClassLoader( ServletContext context, ClassLoader classLoader ) {
WebApp.get(context).setClassLoader(classLoader);
} | [
"public",
"static",
"void",
"setClassLoader",
"(",
"ServletContext",
"context",
",",
"ClassLoader",
"classLoader",
")",
"{",
"WebApp",
".",
"get",
"(",
"context",
")",
".",
"setClassLoader",
"(",
"classLoader",
")",
";",
"}"
] | Sets the classloader used by {@link StaplerRequest#bindJSON(Class, JSONObject)} and its sibling methods.
@deprecated
Use {@link WebApp#setClassLoader(ClassLoader)} | [
"Sets",
"the",
"classloader",
"used",
"by",
"{",
"@link",
"StaplerRequest#bindJSON",
"(",
"Class",
"JSONObject",
")",
"}",
"and",
"its",
"sibling",
"methods",
"."
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/Stapler.java#L956-L958 |
Sciss/abc4j | abc/src/main/java/abc/ui/swing/JTune.java | JTune.getNoteGlyphesBetween | private Collection getNoteGlyphesBetween(NoteAbstract start, NoteAbstract end) {
Collection jnotes = new Vector();
try {
Collection notes = m_music.getVoice(start.getReference().getVoice()).getNotesBetween(start, end);
for (Object note : notes) {
NoteAbstract n = (NoteAbstract) note;
jnotes.add(getRenditionObjectFor(n));
}
} catch (Exception e) {
// TODO: handle exception, shouldn't happen
}
return jnotes;
} | java | private Collection getNoteGlyphesBetween(NoteAbstract start, NoteAbstract end) {
Collection jnotes = new Vector();
try {
Collection notes = m_music.getVoice(start.getReference().getVoice()).getNotesBetween(start, end);
for (Object note : notes) {
NoteAbstract n = (NoteAbstract) note;
jnotes.add(getRenditionObjectFor(n));
}
} catch (Exception e) {
// TODO: handle exception, shouldn't happen
}
return jnotes;
} | [
"private",
"Collection",
"getNoteGlyphesBetween",
"(",
"NoteAbstract",
"start",
",",
"NoteAbstract",
"end",
")",
"{",
"Collection",
"jnotes",
"=",
"new",
"Vector",
"(",
")",
";",
"try",
"{",
"Collection",
"notes",
"=",
"m_music",
".",
"getVoice",
"(",
"start",... | Returns a Collection of JNote representing the note glyphes
between start and end NoteAbstract. | [
"Returns",
"a",
"Collection",
"of",
"JNote",
"representing",
"the",
"note",
"glyphes",
"between",
"start",
"and",
"end",
"NoteAbstract",
"."
] | train | https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JTune.java#L1514-L1526 |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.rs.client.3.2/src/com/ibm/ws/jaxrs21/clientconfig/JAXRSClientConfigHolder.java | JAXRSClientConfigHolder.addConfig | public static synchronized void addConfig(String id, String uri, Map<String, String> params) {
uriMap.put(id, uri);
configInfo.put(uri, params);
resolvedConfigInfo.clear();
if (uri.endsWith("*")) {
wildcardsPresentInConfigInfo = true;
}
} | java | public static synchronized void addConfig(String id, String uri, Map<String, String> params) {
uriMap.put(id, uri);
configInfo.put(uri, params);
resolvedConfigInfo.clear();
if (uri.endsWith("*")) {
wildcardsPresentInConfigInfo = true;
}
} | [
"public",
"static",
"synchronized",
"void",
"addConfig",
"(",
"String",
"id",
",",
"String",
"uri",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"uriMap",
".",
"put",
"(",
"id",
",",
"uri",
")",
";",
"configInfo",
".",
"put",
"(... | add a configuration for a URL
We'd like a set of hashmaps keyed by URL, however when osgi calls
deactivate, we have no arguments, so we have to associate a url with
the object id of the service. That allows us to remove the right one.
@param id - the object id of the service instance that added this.
@param url - the uri of the record being added. Might end with *
@param params - the properties applicable to this url. | [
"add",
"a",
"configuration",
"for",
"a",
"URL",
"We",
"d",
"like",
"a",
"set",
"of",
"hashmaps",
"keyed",
"by",
"URL",
"however",
"when",
"osgi",
"calls",
"deactivate",
"we",
"have",
"no",
"arguments",
"so",
"we",
"have",
"to",
"associate",
"a",
"url",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.rs.client.3.2/src/com/ibm/ws/jaxrs21/clientconfig/JAXRSClientConfigHolder.java#L54-L61 |
lessthanoptimal/ddogleg | src/org/ddogleg/sorting/ApproximateSort_F64.java | ApproximateSort_F64.setRange | public void setRange( double minValue , double maxValue ) {
this.maxValue = maxValue;
this.minValue = minValue;
divisor = 1.00001*(maxValue-minValue)/numBins;
histIndexes.resize(numBins);
if( histObjs.length < numBins ) {
histObjs = new FastQueue[ numBins ];
for (int i = 0; i < numBins; i++) {
histObjs[i] = new FastQueue<SortableParameter_F64>(SortableParameter_F64.class,true);
}
}
} | java | public void setRange( double minValue , double maxValue ) {
this.maxValue = maxValue;
this.minValue = minValue;
divisor = 1.00001*(maxValue-minValue)/numBins;
histIndexes.resize(numBins);
if( histObjs.length < numBins ) {
histObjs = new FastQueue[ numBins ];
for (int i = 0; i < numBins; i++) {
histObjs[i] = new FastQueue<SortableParameter_F64>(SortableParameter_F64.class,true);
}
}
} | [
"public",
"void",
"setRange",
"(",
"double",
"minValue",
",",
"double",
"maxValue",
")",
"{",
"this",
".",
"maxValue",
"=",
"maxValue",
";",
"this",
".",
"minValue",
"=",
"minValue",
";",
"divisor",
"=",
"1.00001",
"*",
"(",
"maxValue",
"-",
"minValue",
... | Specify the data range
@param minValue Minimum allowed value. (inclusive)
@param maxValue Maximum allowed value. (inclusive) | [
"Specify",
"the",
"data",
"range"
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/sorting/ApproximateSort_F64.java#L53-L67 |
hibernate/hibernate-ogm | mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/query/parsing/impl/AggregationRenderer.java | AggregationRenderer.getDistinctCountGroup | private List<Document> getDistinctCountGroup() {
// propertyPath is null when the query is a select on an entity
// In this case we can make the distinct on the id of the document
Object groupColumn = propertyPath == null ? "$_id" : propertyPath;
Document group = new Document();
group.append( "$group", new Document( "_id", groupColumn ) );
Document groupSum = new Document();
groupSum.append( "$group", new Document()
.append( "_id", propertyPath )
.append( PROJECTION_FIELD, new Document( "$sum", 1 ) ) );
return Arrays.asList( group, groupSum );
} | java | private List<Document> getDistinctCountGroup() {
// propertyPath is null when the query is a select on an entity
// In this case we can make the distinct on the id of the document
Object groupColumn = propertyPath == null ? "$_id" : propertyPath;
Document group = new Document();
group.append( "$group", new Document( "_id", groupColumn ) );
Document groupSum = new Document();
groupSum.append( "$group", new Document()
.append( "_id", propertyPath )
.append( PROJECTION_FIELD, new Document( "$sum", 1 ) ) );
return Arrays.asList( group, groupSum );
} | [
"private",
"List",
"<",
"Document",
">",
"getDistinctCountGroup",
"(",
")",
"{",
"// propertyPath is null when the query is a select on an entity",
"// In this case we can make the distinct on the id of the document",
"Object",
"groupColumn",
"=",
"propertyPath",
"==",
"null",
"?",... | /*
A distinct query on the id looks something like:
db.Author.aggregate([{ $group : { _id: "$_id" }}, {$group : {_id:null, n: {$sum: 1}}}, {$project: {n: 1, _id:0}}])
This method returns the "groups" part. | [
"/",
"*",
"A",
"distinct",
"query",
"on",
"the",
"id",
"looks",
"something",
"like",
":"
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/query/parsing/impl/AggregationRenderer.java#L83-L95 |
vincentk/joptimizer | src/main/java/com/joptimizer/functions/SDPLogarithmicBarrier.java | SDPLogarithmicBarrier.createPhase1BarrierFunction | @Override
public BarrierFunction createPhase1BarrierFunction(){
List<double[][]> FiPh1MatrixList = new ArrayList<double[][]>();
for(int i=0; i<this.Fi.length; i++){
FiPh1MatrixList.add(FiPh1MatrixList.size(), this.Fi[i].getData());
}
FiPh1MatrixList.add(FiPh1MatrixList.size(), MatrixUtils.createRealIdentityMatrix(p).scalarMultiply(-1).getData());
return new SDPLogarithmicBarrier(FiPh1MatrixList, this.G.getData());
} | java | @Override
public BarrierFunction createPhase1BarrierFunction(){
List<double[][]> FiPh1MatrixList = new ArrayList<double[][]>();
for(int i=0; i<this.Fi.length; i++){
FiPh1MatrixList.add(FiPh1MatrixList.size(), this.Fi[i].getData());
}
FiPh1MatrixList.add(FiPh1MatrixList.size(), MatrixUtils.createRealIdentityMatrix(p).scalarMultiply(-1).getData());
return new SDPLogarithmicBarrier(FiPh1MatrixList, this.G.getData());
} | [
"@",
"Override",
"public",
"BarrierFunction",
"createPhase1BarrierFunction",
"(",
")",
"{",
"List",
"<",
"double",
"[",
"]",
"[",
"]",
">",
"FiPh1MatrixList",
"=",
"new",
"ArrayList",
"<",
"double",
"[",
"]",
"[",
"]",
">",
"(",
")",
";",
"for",
"(",
"... | Create the barrier function for the Phase I.
It is an instance of this class for the constraint:
<br>G + Sum[x_i * F_i(x),i] < t * I
@see "S.Boyd and L.Vandenberghe, Convex Optimization, 11.6.2" | [
"Create",
"the",
"barrier",
"function",
"for",
"the",
"Phase",
"I",
".",
"It",
"is",
"an",
"instance",
"of",
"this",
"class",
"for",
"the",
"constraint",
":",
"<br",
">",
"G",
"+",
"Sum",
"[",
"x_i",
"*",
"F_i",
"(",
"x",
")",
"i",
"]",
"<",
"t",... | train | https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/functions/SDPLogarithmicBarrier.java#L129-L137 |
phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JTB.java | JTB.getEffectiveVisitorDirectory | private File getEffectiveVisitorDirectory ()
{
if (this.visitorDirectory != null)
return this.visitorDirectory;
if (this.outputDirectory != null)
return new File (this.outputDirectory, getLastPackageName (getEffectiveVisitorPackageName ()));
return null;
} | java | private File getEffectiveVisitorDirectory ()
{
if (this.visitorDirectory != null)
return this.visitorDirectory;
if (this.outputDirectory != null)
return new File (this.outputDirectory, getLastPackageName (getEffectiveVisitorPackageName ()));
return null;
} | [
"private",
"File",
"getEffectiveVisitorDirectory",
"(",
")",
"{",
"if",
"(",
"this",
".",
"visitorDirectory",
"!=",
"null",
")",
"return",
"this",
".",
"visitorDirectory",
";",
"if",
"(",
"this",
".",
"outputDirectory",
"!=",
"null",
")",
"return",
"new",
"F... | Gets the absolute path to the output directory for the visitor files.
@return The absolute path to the output directory for the visitor, only
<code>null</code> if neither {@link #outputDirectory} nor
{@link #visitorDirectory} have been set. | [
"Gets",
"the",
"absolute",
"path",
"to",
"the",
"output",
"directory",
"for",
"the",
"visitor",
"files",
"."
] | train | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JTB.java#L248-L255 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java | WebDriverTool.getCssValue | public String getCssValue(final By by, final String propertyName) {
WebElement element = findElement(by);
return element.getCssValue(propertyName);
} | java | public String getCssValue(final By by, final String propertyName) {
WebElement element = findElement(by);
return element.getCssValue(propertyName);
} | [
"public",
"String",
"getCssValue",
"(",
"final",
"By",
"by",
",",
"final",
"String",
"propertyName",
")",
"{",
"WebElement",
"element",
"=",
"findElement",
"(",
"by",
")",
";",
"return",
"element",
".",
"getCssValue",
"(",
"propertyName",
")",
";",
"}"
] | Delegates to {@link #findElement(By)} and then calls
{@link WebElement#getCssValue(String) getAttribute(String)} on the returned element.
@param by
the {@link By} used to locate the element
@param propertyName
the name of the CSS property
@return The current, computed value of the property. | [
"Delegates",
"to",
"{",
"@link",
"#findElement",
"(",
"By",
")",
"}",
"and",
"then",
"calls",
"{",
"@link",
"WebElement#getCssValue",
"(",
"String",
")",
"getAttribute",
"(",
"String",
")",
"}",
"on",
"the",
"returned",
"element",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L543-L546 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferPoolManagerImpl.java | WsByteBufferPoolManagerImpl.setLeakDetectionSettings | public void setLeakDetectionSettings(int interval, String output) throws IOException {
this.leakDetectionInterval = interval;
this.leakDetectionOutput = TrConfigurator.getLogLocation() + File.separator + output;
if ((interval > -1) && (output != null)) {
// clear file
FileWriter outFile = new FileWriter(this.leakDetectionOutput, false);
outFile.close();
}
} | java | public void setLeakDetectionSettings(int interval, String output) throws IOException {
this.leakDetectionInterval = interval;
this.leakDetectionOutput = TrConfigurator.getLogLocation() + File.separator + output;
if ((interval > -1) && (output != null)) {
// clear file
FileWriter outFile = new FileWriter(this.leakDetectionOutput, false);
outFile.close();
}
} | [
"public",
"void",
"setLeakDetectionSettings",
"(",
"int",
"interval",
",",
"String",
"output",
")",
"throws",
"IOException",
"{",
"this",
".",
"leakDetectionInterval",
"=",
"interval",
";",
"this",
".",
"leakDetectionOutput",
"=",
"TrConfigurator",
".",
"getLogLocat... | Set the memory leak detection parameters. If the interval is 0 or
greater, then the detection code will enabled.
@param interval the minimum amount of time between leak detection code
will be ran. Also the minimum amount of time that a buffer can go without
being accessed before it will be flagged as a possible memory leak.
@param output The name of the output file where the memory leak information
will be written.
@throws IOException | [
"Set",
"the",
"memory",
"leak",
"detection",
"parameters",
".",
"If",
"the",
"interval",
"is",
"0",
"or",
"greater",
"then",
"the",
"detection",
"code",
"will",
"enabled",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferPoolManagerImpl.java#L329-L338 |
jeffreyning/nh-micro | nh-micro-template/src/main/java/com/nh/micro/template/MicroServiceTemplateSupport.java | MicroServiceTemplateSupport.getSeqByMysql | public Integer getSeqByMysql(String seqKey){
PlatformTransactionManager transactionManager=MicroTranManagerHolder.getTransactionManager(dbName);
DefaultTransactionDefinition def =new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
TransactionStatus status=transactionManager.getTransaction(def);
try
{
String sql="select get_micro_seq('"+seqKey+"') as seq";
List retList=getInnerDao().queryObjJoinByCondition(sql);
if(retList==null){
transactionManager.commit(status);
return null;
}
Map retMap=(Map) retList.get(0);
Integer seq=(Integer) retMap.get("seq");
transactionManager.commit(status);
return seq;
}
catch(Exception ex)
{
transactionManager.rollback(status);
throw new RuntimeException("getseq error",ex);
}
} | java | public Integer getSeqByMysql(String seqKey){
PlatformTransactionManager transactionManager=MicroTranManagerHolder.getTransactionManager(dbName);
DefaultTransactionDefinition def =new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
TransactionStatus status=transactionManager.getTransaction(def);
try
{
String sql="select get_micro_seq('"+seqKey+"') as seq";
List retList=getInnerDao().queryObjJoinByCondition(sql);
if(retList==null){
transactionManager.commit(status);
return null;
}
Map retMap=(Map) retList.get(0);
Integer seq=(Integer) retMap.get("seq");
transactionManager.commit(status);
return seq;
}
catch(Exception ex)
{
transactionManager.rollback(status);
throw new RuntimeException("getseq error",ex);
}
} | [
"public",
"Integer",
"getSeqByMysql",
"(",
"String",
"seqKey",
")",
"{",
"PlatformTransactionManager",
"transactionManager",
"=",
"MicroTranManagerHolder",
".",
"getTransactionManager",
"(",
"dbName",
")",
";",
"DefaultTransactionDefinition",
"def",
"=",
"new",
"DefaultTr... | /* public void dbTranNestRollbackAndReStart() throws Exception{
PlatformTransactionManager transactionManager=MicroTranManagerHolder.getTransactionManager(dbName);
DefaultTransactionDefinition def =new DefaultTransactionDefinition();
def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_COMMITTED);
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status=transactionManager.getTransaction(def);
transactionManager.rollback(status);
((AbstractPlatformTransactionManager) transactionManager).setFailEarlyOnGlobalRollbackOnly(false);
} | [
"/",
"*",
"public",
"void",
"dbTranNestRollbackAndReStart",
"()",
"throws",
"Exception",
"{",
"PlatformTransactionManager",
"transactionManager",
"=",
"MicroTranManagerHolder",
".",
"getTransactionManager",
"(",
"dbName",
")",
";",
"DefaultTransactionDefinition",
"def",
"="... | train | https://github.com/jeffreyning/nh-micro/blob/f1cb420a092f8ba94317519ede739974decb5617/nh-micro-template/src/main/java/com/nh/micro/template/MicroServiceTemplateSupport.java#L2323-L2349 |
samskivert/samskivert | src/main/java/com/samskivert/util/Folds.java | Folds.foldLeft | public static <A, B> B foldLeft (F<B,A> func, B zero, Iterable<? extends A> values)
{
for (A value : values) {
zero = func.apply(zero, value);
}
return zero;
} | java | public static <A, B> B foldLeft (F<B,A> func, B zero, Iterable<? extends A> values)
{
for (A value : values) {
zero = func.apply(zero, value);
}
return zero;
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"B",
"foldLeft",
"(",
"F",
"<",
"B",
",",
"A",
">",
"func",
",",
"B",
"zero",
",",
"Iterable",
"<",
"?",
"extends",
"A",
">",
"values",
")",
"{",
"for",
"(",
"A",
"value",
":",
"values",
")",
"{",
... | Left folds the supplied function over the supplied values using the supplied starting value. | [
"Left",
"folds",
"the",
"supplied",
"function",
"over",
"the",
"supplied",
"values",
"using",
"the",
"supplied",
"starting",
"value",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Folds.java#L30-L36 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java | MatchState.setToken | public final void setToken(AnalyzedTokenReadings[] tokens, int index, int next) {
int idx = index;
if (index >= tokens.length) {
// TODO: hacky workaround, find a proper solution. See EnglishPatternRuleTest.testBug()
idx = tokens.length - 1;
}
setToken(tokens[idx]);
IncludeRange includeSkipped = match.getIncludeSkipped();
if (next > 1 && includeSkipped != IncludeRange.NONE) {
StringBuilder sb = new StringBuilder();
if (includeSkipped == IncludeRange.FOLLOWING) {
formattedToken = null;
}
for (int k = index + 1; k < index + next; k++) {
if (tokens[k].isWhitespaceBefore()
&& !(k == index + 1 && includeSkipped == IncludeRange.FOLLOWING)) {
sb.append(' ');
}
sb.append(tokens[k].getToken());
}
skippedTokens = sb.toString();
} else {
skippedTokens = "";
}
} | java | public final void setToken(AnalyzedTokenReadings[] tokens, int index, int next) {
int idx = index;
if (index >= tokens.length) {
// TODO: hacky workaround, find a proper solution. See EnglishPatternRuleTest.testBug()
idx = tokens.length - 1;
}
setToken(tokens[idx]);
IncludeRange includeSkipped = match.getIncludeSkipped();
if (next > 1 && includeSkipped != IncludeRange.NONE) {
StringBuilder sb = new StringBuilder();
if (includeSkipped == IncludeRange.FOLLOWING) {
formattedToken = null;
}
for (int k = index + 1; k < index + next; k++) {
if (tokens[k].isWhitespaceBefore()
&& !(k == index + 1 && includeSkipped == IncludeRange.FOLLOWING)) {
sb.append(' ');
}
sb.append(tokens[k].getToken());
}
skippedTokens = sb.toString();
} else {
skippedTokens = "";
}
} | [
"public",
"final",
"void",
"setToken",
"(",
"AnalyzedTokenReadings",
"[",
"]",
"tokens",
",",
"int",
"index",
",",
"int",
"next",
")",
"{",
"int",
"idx",
"=",
"index",
";",
"if",
"(",
"index",
">=",
"tokens",
".",
"length",
")",
"{",
"// TODO: hacky work... | Sets the token to be formatted etc. and includes the support for
including the skipped tokens.
@param tokens Array of tokens
@param index Index of the token to be formatted
@param next Position of the next token (the skipped tokens are the ones between the tokens[index] and tokens[next] | [
"Sets",
"the",
"token",
"to",
"be",
"formatted",
"etc",
".",
"and",
"includes",
"the",
"support",
"for",
"including",
"the",
"skipped",
"tokens",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java#L81-L105 |
magik6k/JWWF | src/main/java/net/magik6k/jwwf/core/User.java | User.sendGlobal | public final void sendGlobal(String handler, String data) {
try {
connection.sendMessage("{\"id\":-1,\"type\":\"global\",\"handler\":"
+ Json.escapeString(handler) + ",\"data\":" + data + "}");
} catch (IOException e) {
e.printStackTrace();
}
} | java | public final void sendGlobal(String handler, String data) {
try {
connection.sendMessage("{\"id\":-1,\"type\":\"global\",\"handler\":"
+ Json.escapeString(handler) + ",\"data\":" + data + "}");
} catch (IOException e) {
e.printStackTrace();
}
} | [
"public",
"final",
"void",
"sendGlobal",
"(",
"String",
"handler",
",",
"String",
"data",
")",
"{",
"try",
"{",
"connection",
".",
"sendMessage",
"(",
"\"{\\\"id\\\":-1,\\\"type\\\":\\\"global\\\",\\\"handler\\\":\"",
"+",
"Json",
".",
"escapeString",
"(",
"handler",
... | This function is mainly made for plug-in use, it sends
data to global user handler for example to perform some tasks
that aren't related directly to widgets. Global handler is a javascript
function in array named 'global', under key that is passed to this function as
handler parameter. As first argument the javascript function is given
data object that is passed as JSON here
@param handler Name of client-side handler, generally syntax
should be [PluginName]-[HandlerName], like JWWF-UserData
@param data Data to send, JSON-formatted | [
"This",
"function",
"is",
"mainly",
"made",
"for",
"plug",
"-",
"in",
"use",
"it",
"sends",
"data",
"to",
"global",
"user",
"handler",
"for",
"example",
"to",
"perform",
"some",
"tasks",
"that",
"aren",
"t",
"related",
"directly",
"to",
"widgets",
".",
"... | train | https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/core/User.java#L58-L65 |
GoSimpleLLC/nbvcxz | src/main/java/me/gosimple/nbvcxz/matching/DateMatcher.java | DateMatcher.isDateValid | private static ValidDateSplit isDateValid(String day, String month, String year)
{
try
{
int dayInt = Integer.parseInt(day);
int monthInt = Integer.parseInt(month);
int yearInt = Integer.parseInt(year);
if (
dayInt <= 0 || dayInt > 31 ||
monthInt <= 0 || monthInt > 12 ||
yearInt <= 0 || (yearInt >= 100 && (yearInt < 1900 || yearInt > 2019))
)
{
return null;
}
return new ValidDateSplit(dayInt, monthInt, yearInt);
}
catch (NumberFormatException e)
{
return null;
}
} | java | private static ValidDateSplit isDateValid(String day, String month, String year)
{
try
{
int dayInt = Integer.parseInt(day);
int monthInt = Integer.parseInt(month);
int yearInt = Integer.parseInt(year);
if (
dayInt <= 0 || dayInt > 31 ||
monthInt <= 0 || monthInt > 12 ||
yearInt <= 0 || (yearInt >= 100 && (yearInt < 1900 || yearInt > 2019))
)
{
return null;
}
return new ValidDateSplit(dayInt, monthInt, yearInt);
}
catch (NumberFormatException e)
{
return null;
}
} | [
"private",
"static",
"ValidDateSplit",
"isDateValid",
"(",
"String",
"day",
",",
"String",
"month",
",",
"String",
"year",
")",
"{",
"try",
"{",
"int",
"dayInt",
"=",
"Integer",
".",
"parseInt",
"(",
"day",
")",
";",
"int",
"monthInt",
"=",
"Integer",
".... | Verify that a date is valid. Year must be
two digit or four digit and between 1900 and 2029.
@param day the day of the date
@param month the moth of the date
@param year the year of the date
@return a valid date split object containing the date information if the
date is valid and {@code null} if the date is not valid. | [
"Verify",
"that",
"a",
"date",
"is",
"valid",
".",
"Year",
"must",
"be",
"two",
"digit",
"or",
"four",
"digit",
"and",
"between",
"1900",
"and",
"2029",
"."
] | train | https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/matching/DateMatcher.java#L206-L227 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java | ChemModelManipulator.getRelevantAtomContainer | public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IBond bond) {
IAtomContainer result = null;
if (chemModel.getMoleculeSet() != null) {
IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, bond);
if (result != null) {
return result;
}
}
if (chemModel.getReactionSet() != null) {
IReactionSet reactionSet = chemModel.getReactionSet();
return ReactionSetManipulator.getRelevantAtomContainer(reactionSet, bond);
}
// This should never happen.
return null;
} | java | public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IBond bond) {
IAtomContainer result = null;
if (chemModel.getMoleculeSet() != null) {
IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, bond);
if (result != null) {
return result;
}
}
if (chemModel.getReactionSet() != null) {
IReactionSet reactionSet = chemModel.getReactionSet();
return ReactionSetManipulator.getRelevantAtomContainer(reactionSet, bond);
}
// This should never happen.
return null;
} | [
"public",
"static",
"IAtomContainer",
"getRelevantAtomContainer",
"(",
"IChemModel",
"chemModel",
",",
"IBond",
"bond",
")",
"{",
"IAtomContainer",
"result",
"=",
"null",
";",
"if",
"(",
"chemModel",
".",
"getMoleculeSet",
"(",
")",
"!=",
"null",
")",
"{",
"IA... | Retrieves the first IAtomContainer containing a given IBond from an
IChemModel.
@param chemModel The IChemModel object.
@param bond The IBond object to search.
@return The IAtomContainer object found, null if none is found. | [
"Retrieves",
"the",
"first",
"IAtomContainer",
"containing",
"a",
"given",
"IBond",
"from",
"an",
"IChemModel",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java#L230-L245 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/proxy/AbstractProxyFactory.java | AbstractProxyFactory.createIndirectionHandler | public IndirectionHandler createIndirectionHandler(PBKey brokerKey, Identity id)
{
Object args[] = {brokerKey, id};
try
{
return (IndirectionHandler) getIndirectionHandlerConstructor().newInstance(args);
}
catch(InvocationTargetException ex)
{
throw new PersistenceBrokerException("Exception while creating a new indirection handler instance", ex);
}
catch(InstantiationException ex)
{
throw new PersistenceBrokerException("Exception while creating a new indirection handler instance", ex);
}
catch(IllegalAccessException ex)
{
throw new PersistenceBrokerException("Exception while creating a new indirection handler instance", ex);
}
} | java | public IndirectionHandler createIndirectionHandler(PBKey brokerKey, Identity id)
{
Object args[] = {brokerKey, id};
try
{
return (IndirectionHandler) getIndirectionHandlerConstructor().newInstance(args);
}
catch(InvocationTargetException ex)
{
throw new PersistenceBrokerException("Exception while creating a new indirection handler instance", ex);
}
catch(InstantiationException ex)
{
throw new PersistenceBrokerException("Exception while creating a new indirection handler instance", ex);
}
catch(IllegalAccessException ex)
{
throw new PersistenceBrokerException("Exception while creating a new indirection handler instance", ex);
}
} | [
"public",
"IndirectionHandler",
"createIndirectionHandler",
"(",
"PBKey",
"brokerKey",
",",
"Identity",
"id",
")",
"{",
"Object",
"args",
"[",
"]",
"=",
"{",
"brokerKey",
",",
"id",
"}",
";",
"try",
"{",
"return",
"(",
"IndirectionHandler",
")",
"getIndirectio... | Creates a new indirection handler instance.
@param brokerKey The associated {@link PBKey}.
@param id The subject's ids
@return The new instance | [
"Creates",
"a",
"new",
"indirection",
"handler",
"instance",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/proxy/AbstractProxyFactory.java#L149-L169 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/application/PropertyNotSetException.java | PropertyNotSetException.throwIfNull | public static void throwIfNull(Object propertyValue, String propertyName, Class beanClass) {
if (propertyValue == null) {
throw new PropertyNotSetException(beanClass, propertyName);
}
} | java | public static void throwIfNull(Object propertyValue, String propertyName, Class beanClass) {
if (propertyValue == null) {
throw new PropertyNotSetException(beanClass, propertyName);
}
} | [
"public",
"static",
"void",
"throwIfNull",
"(",
"Object",
"propertyValue",
",",
"String",
"propertyName",
",",
"Class",
"beanClass",
")",
"{",
"if",
"(",
"propertyValue",
"==",
"null",
")",
"{",
"throw",
"new",
"PropertyNotSetException",
"(",
"beanClass",
",",
... | Throws an instance of this exception if the given {@code propertyValue}
is null.
@param propertyValue The value of the property.
@param propertyName The name of the property.
@param beanClass The class on which the property is supposed to be set.
@throws PropertyNotSetException if {@code propertyValue} is null. | [
"Throws",
"an",
"instance",
"of",
"this",
"exception",
"if",
"the",
"given",
"{",
"@code",
"propertyValue",
"}",
"is",
"null",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/PropertyNotSetException.java#L40-L46 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPreferences.java | CmsPreferences.buildSelectExplorerButtonStyle | public String buildSelectExplorerButtonStyle(String htmlAttributes) {
int selectedIndex = Integer.parseInt(getParamTabExButtonStyle());
return buildSelectButtonStyle(htmlAttributes, selectedIndex);
} | java | public String buildSelectExplorerButtonStyle(String htmlAttributes) {
int selectedIndex = Integer.parseInt(getParamTabExButtonStyle());
return buildSelectButtonStyle(htmlAttributes, selectedIndex);
} | [
"public",
"String",
"buildSelectExplorerButtonStyle",
"(",
"String",
"htmlAttributes",
")",
"{",
"int",
"selectedIndex",
"=",
"Integer",
".",
"parseInt",
"(",
"getParamTabExButtonStyle",
"(",
")",
")",
";",
"return",
"buildSelectButtonStyle",
"(",
"htmlAttributes",
",... | Builds the html for the explorer button style select box.<p>
@param htmlAttributes optional html attributes for the &lgt;select> tag
@return the html for the explorer button style select box | [
"Builds",
"the",
"html",
"for",
"the",
"explorer",
"button",
"style",
"select",
"box",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L669-L673 |
inaiat/jqplot4java | src/main/java/br/com/digilabs/jqplot/JqPlotUtils.java | JqPlotUtils.jqPlotToJson | public static String jqPlotToJson(ChartConfiguration<?> jqPlot) {
XStream xstream = new XStream(new JsonHierarchicalStreamDriver() {
@Override
public HierarchicalStreamWriter createWriter(Writer writer) {
return new JqPlotJsonMapHierarchicalWriter(writer, JsonWriter.DROP_ROOT_MODE) {
@Override
public void addAttribute(String name, String value) {
if (!name.contains("class")) {
super.addAttribute(name, value);
}
}
};
}
}) {
};
EnumConverter converter = new EnumConverter() {
@Override
public void marshal(Object source, HierarchicalStreamWriter writer,
MarshallingContext context) {
if(source instanceof JqPlotResources) {
JqPlotResources plugin = (JqPlotResources) source;
writer.setValue(plugin.getClassName());
} else {
super.marshal(source, writer, context);
}
}
};
converter.canConvert(JqPlotResources.class);
xstream.registerConverter(converter);
return xstream.toXML(jqPlot);
} | java | public static String jqPlotToJson(ChartConfiguration<?> jqPlot) {
XStream xstream = new XStream(new JsonHierarchicalStreamDriver() {
@Override
public HierarchicalStreamWriter createWriter(Writer writer) {
return new JqPlotJsonMapHierarchicalWriter(writer, JsonWriter.DROP_ROOT_MODE) {
@Override
public void addAttribute(String name, String value) {
if (!name.contains("class")) {
super.addAttribute(name, value);
}
}
};
}
}) {
};
EnumConverter converter = new EnumConverter() {
@Override
public void marshal(Object source, HierarchicalStreamWriter writer,
MarshallingContext context) {
if(source instanceof JqPlotResources) {
JqPlotResources plugin = (JqPlotResources) source;
writer.setValue(plugin.getClassName());
} else {
super.marshal(source, writer, context);
}
}
};
converter.canConvert(JqPlotResources.class);
xstream.registerConverter(converter);
return xstream.toXML(jqPlot);
} | [
"public",
"static",
"String",
"jqPlotToJson",
"(",
"ChartConfiguration",
"<",
"?",
">",
"jqPlot",
")",
"{",
"XStream",
"xstream",
"=",
"new",
"XStream",
"(",
"new",
"JsonHierarchicalStreamDriver",
"(",
")",
"{",
"@",
"Override",
"public",
"HierarchicalStreamWriter... | Retorna o um json a partir de uma configuração jqplot
@param jqPlot ChartConfiguration
@return String of JSON content | [
"Retorna",
"o",
"um",
"json",
"a",
"partir",
"de",
"uma",
"configuração",
"jqplot"
] | train | https://github.com/inaiat/jqplot4java/blob/35bcd17749442e88695df0438c8330a65a3977cc/src/main/java/br/com/digilabs/jqplot/JqPlotUtils.java#L101-L140 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.