repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Point.java | Point.fromLngLat | public static Point fromLngLat(
@FloatRange(from = MIN_LONGITUDE, to = MAX_LONGITUDE) double longitude,
@FloatRange(from = MIN_LATITUDE, to = MAX_LATITUDE) double latitude) {
"""
Create a new instance of this class defining a longitude and latitude value in that respective
order. Longitude values are limited to a -180 to 180 range and latitude's limited to -90 to 90
as the spec defines. While no limit is placed on decimal precision, for performance reasons
when serializing and deserializing it is suggested to limit decimal precision to within 6
decimal places.
@param longitude a double value between -180 to 180 representing the x position of this point
@param latitude a double value between -90 to 90 representing the y position of this point
@return a new instance of this class defined by the values passed inside this static factory
method
@since 3.0.0
"""
List<Double> coordinates =
CoordinateShifterManager.getCoordinateShifter().shiftLonLat(longitude, latitude);
return new Point(TYPE, null, coordinates);
} | java | public static Point fromLngLat(
@FloatRange(from = MIN_LONGITUDE, to = MAX_LONGITUDE) double longitude,
@FloatRange(from = MIN_LATITUDE, to = MAX_LATITUDE) double latitude) {
List<Double> coordinates =
CoordinateShifterManager.getCoordinateShifter().shiftLonLat(longitude, latitude);
return new Point(TYPE, null, coordinates);
} | [
"public",
"static",
"Point",
"fromLngLat",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_LONGITUDE",
",",
"to",
"=",
"MAX_LONGITUDE",
")",
"double",
"longitude",
",",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_LATITUDE",
",",
"to",
"=",
"MAX_LATITUDE",
")",
"double",
"latitude",
")",
"{",
"List",
"<",
"Double",
">",
"coordinates",
"=",
"CoordinateShifterManager",
".",
"getCoordinateShifter",
"(",
")",
".",
"shiftLonLat",
"(",
"longitude",
",",
"latitude",
")",
";",
"return",
"new",
"Point",
"(",
"TYPE",
",",
"null",
",",
"coordinates",
")",
";",
"}"
] | Create a new instance of this class defining a longitude and latitude value in that respective
order. Longitude values are limited to a -180 to 180 range and latitude's limited to -90 to 90
as the spec defines. While no limit is placed on decimal precision, for performance reasons
when serializing and deserializing it is suggested to limit decimal precision to within 6
decimal places.
@param longitude a double value between -180 to 180 representing the x position of this point
@param latitude a double value between -90 to 90 representing the y position of this point
@return a new instance of this class defined by the values passed inside this static factory
method
@since 3.0.0 | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"defining",
"a",
"longitude",
"and",
"latitude",
"value",
"in",
"that",
"respective",
"order",
".",
"Longitude",
"values",
"are",
"limited",
"to",
"a",
"-",
"180",
"to",
"180",
"range",
"and",
"latitude",
"s",
"limited",
"to",
"-",
"90",
"to",
"90",
"as",
"the",
"spec",
"defines",
".",
"While",
"no",
"limit",
"is",
"placed",
"on",
"decimal",
"precision",
"for",
"performance",
"reasons",
"when",
"serializing",
"and",
"deserializing",
"it",
"is",
"suggested",
"to",
"limit",
"decimal",
"precision",
"to",
"within",
"6",
"decimal",
"places",
"."
] | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Point.java#L101-L108 |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/EventMessenger.java | EventMessenger.sendToDirect | public void sendToDirect(String topicURI, Object event, String webSocketSessionId) {
"""
Send an EventMessage directly to the client specified with the webSocketSessionId
parameter.
<p>
In contrast to {@link #sendTo(String, Object, String)} this method does not check
if the receiver is subscribed to the destination. The
{@link SimpleBrokerMessageHandler} is not involved in sending this message.
@param topicURI the name of the topic
@param event the payload of the {@link EventMessage}
@param webSocketSessionId receiver of the EVENT message
"""
Assert.notNull(webSocketSessionId, "WebSocket session id must not be null");
sendToDirect(topicURI, event, Collections.singleton(webSocketSessionId));
} | java | public void sendToDirect(String topicURI, Object event, String webSocketSessionId) {
Assert.notNull(webSocketSessionId, "WebSocket session id must not be null");
sendToDirect(topicURI, event, Collections.singleton(webSocketSessionId));
} | [
"public",
"void",
"sendToDirect",
"(",
"String",
"topicURI",
",",
"Object",
"event",
",",
"String",
"webSocketSessionId",
")",
"{",
"Assert",
".",
"notNull",
"(",
"webSocketSessionId",
",",
"\"WebSocket session id must not be null\"",
")",
";",
"sendToDirect",
"(",
"topicURI",
",",
"event",
",",
"Collections",
".",
"singleton",
"(",
"webSocketSessionId",
")",
")",
";",
"}"
] | Send an EventMessage directly to the client specified with the webSocketSessionId
parameter.
<p>
In contrast to {@link #sendTo(String, Object, String)} this method does not check
if the receiver is subscribed to the destination. The
{@link SimpleBrokerMessageHandler} is not involved in sending this message.
@param topicURI the name of the topic
@param event the payload of the {@link EventMessage}
@param webSocketSessionId receiver of the EVENT message | [
"Send",
"an",
"EventMessage",
"directly",
"to",
"the",
"client",
"specified",
"with",
"the",
"webSocketSessionId",
"parameter",
".",
"<p",
">",
"In",
"contrast",
"to",
"{",
"@link",
"#sendTo",
"(",
"String",
"Object",
"String",
")",
"}",
"this",
"method",
"does",
"not",
"check",
"if",
"the",
"receiver",
"is",
"subscribed",
"to",
"the",
"destination",
".",
"The",
"{",
"@link",
"SimpleBrokerMessageHandler",
"}",
"is",
"not",
"involved",
"in",
"sending",
"this",
"message",
"."
] | train | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/EventMessenger.java#L172-L176 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/stats/ViewData.java | ViewData.createInternal | private static ViewData createInternal(
View view,
Map<List</*@Nullable*/ TagValue>, AggregationData> aggregationMap,
AggregationWindowData window,
Timestamp start,
Timestamp end) {
"""
constructor does not have the @Nullable annotation on TagValue.
"""
@SuppressWarnings("nullness")
Map<List<TagValue>, AggregationData> map = aggregationMap;
return new AutoValue_ViewData(view, map, window, start, end);
} | java | private static ViewData createInternal(
View view,
Map<List</*@Nullable*/ TagValue>, AggregationData> aggregationMap,
AggregationWindowData window,
Timestamp start,
Timestamp end) {
@SuppressWarnings("nullness")
Map<List<TagValue>, AggregationData> map = aggregationMap;
return new AutoValue_ViewData(view, map, window, start, end);
} | [
"private",
"static",
"ViewData",
"createInternal",
"(",
"View",
"view",
",",
"Map",
"<",
"List",
"<",
"/*@Nullable*/",
"TagValue",
">",
",",
"AggregationData",
">",
"aggregationMap",
",",
"AggregationWindowData",
"window",
",",
"Timestamp",
"start",
",",
"Timestamp",
"end",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"nullness\"",
")",
"Map",
"<",
"List",
"<",
"TagValue",
">",
",",
"AggregationData",
">",
"map",
"=",
"aggregationMap",
";",
"return",
"new",
"AutoValue_ViewData",
"(",
"view",
",",
"map",
",",
"window",
",",
"start",
",",
"end",
")",
";",
"}"
] | constructor does not have the @Nullable annotation on TagValue. | [
"constructor",
"does",
"not",
"have",
"the"
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/stats/ViewData.java#L195-L204 |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/injector/lookup/InjectorLookup.java | InjectorLookup.registerInjector | public static Managed registerInjector(final Application application, final Injector injector) {
"""
Used internally to register application specific injector.
@param application application instance
@param injector injector instance
@return managed object, which must be registered to remove injector on application stop
"""
Preconditions.checkNotNull(application, "Application instance required");
Preconditions.checkArgument(!INJECTORS.containsKey(application),
"Injector already registered for application %s", application.getClass().getName());
INJECTORS.put(application, injector);
return new Managed() {
@Override
public void start() throws Exception {
// not used
}
@Override
public void stop() throws Exception {
INJECTORS.remove(application);
}
};
} | java | public static Managed registerInjector(final Application application, final Injector injector) {
Preconditions.checkNotNull(application, "Application instance required");
Preconditions.checkArgument(!INJECTORS.containsKey(application),
"Injector already registered for application %s", application.getClass().getName());
INJECTORS.put(application, injector);
return new Managed() {
@Override
public void start() throws Exception {
// not used
}
@Override
public void stop() throws Exception {
INJECTORS.remove(application);
}
};
} | [
"public",
"static",
"Managed",
"registerInjector",
"(",
"final",
"Application",
"application",
",",
"final",
"Injector",
"injector",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"application",
",",
"\"Application instance required\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"!",
"INJECTORS",
".",
"containsKey",
"(",
"application",
")",
",",
"\"Injector already registered for application %s\"",
",",
"application",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"INJECTORS",
".",
"put",
"(",
"application",
",",
"injector",
")",
";",
"return",
"new",
"Managed",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"throws",
"Exception",
"{",
"// not used",
"}",
"@",
"Override",
"public",
"void",
"stop",
"(",
")",
"throws",
"Exception",
"{",
"INJECTORS",
".",
"remove",
"(",
"application",
")",
";",
"}",
"}",
";",
"}"
] | Used internally to register application specific injector.
@param application application instance
@param injector injector instance
@return managed object, which must be registered to remove injector on application stop | [
"Used",
"internally",
"to",
"register",
"application",
"specific",
"injector",
"."
] | train | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/injector/lookup/InjectorLookup.java#L32-L48 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/workflow/OutputStep.java | OutputStep.runResultHandlers | public void runResultHandlers(ResultHierarchy hier, Database db) {
"""
Run the result handlers.
@param hier Result to run on
@param db Database
"""
// Run result handlers
for(ResultHandler resulthandler : resulthandlers) {
Thread.currentThread().setName(resulthandler.toString());
resulthandler.processNewResult(hier, db);
}
} | java | public void runResultHandlers(ResultHierarchy hier, Database db) {
// Run result handlers
for(ResultHandler resulthandler : resulthandlers) {
Thread.currentThread().setName(resulthandler.toString());
resulthandler.processNewResult(hier, db);
}
} | [
"public",
"void",
"runResultHandlers",
"(",
"ResultHierarchy",
"hier",
",",
"Database",
"db",
")",
"{",
"// Run result handlers",
"for",
"(",
"ResultHandler",
"resulthandler",
":",
"resulthandlers",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"setName",
"(",
"resulthandler",
".",
"toString",
"(",
")",
")",
";",
"resulthandler",
".",
"processNewResult",
"(",
"hier",
",",
"db",
")",
";",
"}",
"}"
] | Run the result handlers.
@param hier Result to run on
@param db Database | [
"Run",
"the",
"result",
"handlers",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/workflow/OutputStep.java#L66-L72 |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/resource/Import.java | Import.addDataPoint | public void addDataPoint(String series, DataPoint dataPoint) {
"""
Adds a new data point to a particular series.
@param series The series this data point should be added to. If it doesn't exist, it will
be created.
@param dataPoint Data to be added.
"""
DataSet set = store.get(series);
if (set == null) {
set = new DataSet();
store.put(series, set);
}
set.add(dataPoint);
} | java | public void addDataPoint(String series, DataPoint dataPoint) {
DataSet set = store.get(series);
if (set == null) {
set = new DataSet();
store.put(series, set);
}
set.add(dataPoint);
} | [
"public",
"void",
"addDataPoint",
"(",
"String",
"series",
",",
"DataPoint",
"dataPoint",
")",
"{",
"DataSet",
"set",
"=",
"store",
".",
"get",
"(",
"series",
")",
";",
"if",
"(",
"set",
"==",
"null",
")",
"{",
"set",
"=",
"new",
"DataSet",
"(",
")",
";",
"store",
".",
"put",
"(",
"series",
",",
"set",
")",
";",
"}",
"set",
".",
"add",
"(",
"dataPoint",
")",
";",
"}"
] | Adds a new data point to a particular series.
@param series The series this data point should be added to. If it doesn't exist, it will
be created.
@param dataPoint Data to be added. | [
"Adds",
"a",
"new",
"data",
"point",
"to",
"a",
"particular",
"series",
"."
] | train | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/Import.java#L119-L126 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/EmailApi.java | EmailApi.sendEmail | public ApiSuccessResponse sendEmail(String id, SendData sendData) throws ApiException {
"""
Send email
Send email interaction specified in the id path parameter
@param id id of interaction to send (required)
@param sendData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<ApiSuccessResponse> resp = sendEmailWithHttpInfo(id, sendData);
return resp.getData();
} | java | public ApiSuccessResponse sendEmail(String id, SendData sendData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = sendEmailWithHttpInfo(id, sendData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"sendEmail",
"(",
"String",
"id",
",",
"SendData",
"sendData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"sendEmailWithHttpInfo",
"(",
"id",
",",
"sendData",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
] | Send email
Send email interaction specified in the id path parameter
@param id id of interaction to send (required)
@param sendData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Send",
"email",
"Send",
"email",
"interaction",
"specified",
"in",
"the",
"id",
"path",
"parameter"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/EmailApi.java#L890-L893 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | Bindable.setOf | public static <E> Bindable<Set<E>> setOf(Class<E> elementType) {
"""
Create a new {@link Bindable} {@link Set} of the specified element type.
@param <E> the element type
@param elementType the set element type
@return a {@link Bindable} instance
"""
return of(ResolvableType.forClassWithGenerics(Set.class, elementType));
} | java | public static <E> Bindable<Set<E>> setOf(Class<E> elementType) {
return of(ResolvableType.forClassWithGenerics(Set.class, elementType));
} | [
"public",
"static",
"<",
"E",
">",
"Bindable",
"<",
"Set",
"<",
"E",
">",
">",
"setOf",
"(",
"Class",
"<",
"E",
">",
"elementType",
")",
"{",
"return",
"of",
"(",
"ResolvableType",
".",
"forClassWithGenerics",
"(",
"Set",
".",
"class",
",",
"elementType",
")",
")",
";",
"}"
] | Create a new {@link Bindable} {@link Set} of the specified element type.
@param <E> the element type
@param elementType the set element type
@return a {@link Bindable} instance | [
"Create",
"a",
"new",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L223-L225 |
JakeWharton/NineOldAndroids | library/src/com/nineoldandroids/animation/ObjectAnimator.java | ObjectAnimator.ofInt | public static ObjectAnimator ofInt(Object target, String propertyName, int... values) {
"""
Constructs and returns an ObjectAnimator that animates between int values. A single
value implies that that value is the one being animated to. Two values imply a starting
and ending values. More than two values imply a starting value, values to animate through
along the way, and an ending value (these values will be distributed evenly across
the duration of the animation).
@param target The object whose property is to be animated. This object should
have a public method on it called <code>setName()</code>, where <code>name</code> is
the value of the <code>propertyName</code> parameter.
@param propertyName The name of the property being animated.
@param values A set of values that the animation will animate between over time.
@return An ObjectAnimator object that is set up to animate between the given values.
"""
ObjectAnimator anim = new ObjectAnimator(target, propertyName);
anim.setIntValues(values);
return anim;
} | java | public static ObjectAnimator ofInt(Object target, String propertyName, int... values) {
ObjectAnimator anim = new ObjectAnimator(target, propertyName);
anim.setIntValues(values);
return anim;
} | [
"public",
"static",
"ObjectAnimator",
"ofInt",
"(",
"Object",
"target",
",",
"String",
"propertyName",
",",
"int",
"...",
"values",
")",
"{",
"ObjectAnimator",
"anim",
"=",
"new",
"ObjectAnimator",
"(",
"target",
",",
"propertyName",
")",
";",
"anim",
".",
"setIntValues",
"(",
"values",
")",
";",
"return",
"anim",
";",
"}"
] | Constructs and returns an ObjectAnimator that animates between int values. A single
value implies that that value is the one being animated to. Two values imply a starting
and ending values. More than two values imply a starting value, values to animate through
along the way, and an ending value (these values will be distributed evenly across
the duration of the animation).
@param target The object whose property is to be animated. This object should
have a public method on it called <code>setName()</code>, where <code>name</code> is
the value of the <code>propertyName</code> parameter.
@param propertyName The name of the property being animated.
@param values A set of values that the animation will animate between over time.
@return An ObjectAnimator object that is set up to animate between the given values. | [
"Constructs",
"and",
"returns",
"an",
"ObjectAnimator",
"that",
"animates",
"between",
"int",
"values",
".",
"A",
"single",
"value",
"implies",
"that",
"that",
"value",
"is",
"the",
"one",
"being",
"animated",
"to",
".",
"Two",
"values",
"imply",
"a",
"starting",
"and",
"ending",
"values",
".",
"More",
"than",
"two",
"values",
"imply",
"a",
"starting",
"value",
"values",
"to",
"animate",
"through",
"along",
"the",
"way",
"and",
"an",
"ending",
"value",
"(",
"these",
"values",
"will",
"be",
"distributed",
"evenly",
"across",
"the",
"duration",
"of",
"the",
"animation",
")",
"."
] | train | https://github.com/JakeWharton/NineOldAndroids/blob/d582f0ec8e79013e9fa96c07986160b52e662e63/library/src/com/nineoldandroids/animation/ObjectAnimator.java#L192-L196 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.stridedSlice | public SDVariable stridedSlice(String name, SDVariable input, long[] begin, long[] end, long[] strides) {
"""
Get a subset of the specified input, by specifying the first element, last element, and the strides.<br>
For example, if input is:<br>
[a, b, c]<br>
[d, e, f]<br>
[g, h, i]<br>
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1]) will return:<br>
[b, c]<br>
[h, i]<br>
<br>
@param name Output variable name
@param input Variable to get subset of
@param begin Beginning index. Must be same length as rank of input array
@param end End index. Must be same length as the rank of the array
@param strides Stride ("step size") for each dimension. Must be same length as the rank of the array. For example,
stride of 2 means take every second element.
@return Subset of the input
"""
return stridedSlice(name, input, begin, end, strides, 0, 0, 0, 0, 0);
} | java | public SDVariable stridedSlice(String name, SDVariable input, long[] begin, long[] end, long[] strides) {
return stridedSlice(name, input, begin, end, strides, 0, 0, 0, 0, 0);
} | [
"public",
"SDVariable",
"stridedSlice",
"(",
"String",
"name",
",",
"SDVariable",
"input",
",",
"long",
"[",
"]",
"begin",
",",
"long",
"[",
"]",
"end",
",",
"long",
"[",
"]",
"strides",
")",
"{",
"return",
"stridedSlice",
"(",
"name",
",",
"input",
",",
"begin",
",",
"end",
",",
"strides",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"}"
] | Get a subset of the specified input, by specifying the first element, last element, and the strides.<br>
For example, if input is:<br>
[a, b, c]<br>
[d, e, f]<br>
[g, h, i]<br>
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1]) will return:<br>
[b, c]<br>
[h, i]<br>
<br>
@param name Output variable name
@param input Variable to get subset of
@param begin Beginning index. Must be same length as rank of input array
@param end End index. Must be same length as the rank of the array
@param strides Stride ("step size") for each dimension. Must be same length as the rank of the array. For example,
stride of 2 means take every second element.
@return Subset of the input | [
"Get",
"a",
"subset",
"of",
"the",
"specified",
"input",
"by",
"specifying",
"the",
"first",
"element",
"last",
"element",
"and",
"the",
"strides",
".",
"<br",
">",
"For",
"example",
"if",
"input",
"is",
":",
"<br",
">",
"[",
"a",
"b",
"c",
"]",
"<br",
">",
"[",
"d",
"e",
"f",
"]",
"<br",
">",
"[",
"g",
"h",
"i",
"]",
"<br",
">",
"then",
"stridedSlice",
"(",
"input",
"begin",
"=",
"[",
"0",
"1",
"]",
"end",
"=",
"[",
"2",
"2",
"]",
"strides",
"=",
"[",
"2",
"1",
"]",
")",
"will",
"return",
":",
"<br",
">",
"[",
"b",
"c",
"]",
"<br",
">",
"[",
"h",
"i",
"]",
"<br",
">",
"<br",
">"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2655-L2657 |
xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.rawCompress | public static int rawCompress(Object input, int inputOffset, int inputLength, byte[] output, int outputOffset)
throws IOException {
"""
Compress the input buffer [offset,... ,offset+length) contents, then
write the compressed data to the output buffer[offset, ...)
@param input input array. This MUST be a primitive array type
@param inputOffset byte offset at the output array
@param inputLength byte length of the input data
@param output output array. This MUST be a primitive array type
@param outputOffset byte offset at the output array
@return byte size of the compressed data
@throws IOException
"""
if (input == null || output == null) {
throw new NullPointerException("input or output is null");
}
int compressedSize = impl
.rawCompress(input, inputOffset, inputLength, output, outputOffset);
return compressedSize;
} | java | public static int rawCompress(Object input, int inputOffset, int inputLength, byte[] output, int outputOffset)
throws IOException
{
if (input == null || output == null) {
throw new NullPointerException("input or output is null");
}
int compressedSize = impl
.rawCompress(input, inputOffset, inputLength, output, outputOffset);
return compressedSize;
} | [
"public",
"static",
"int",
"rawCompress",
"(",
"Object",
"input",
",",
"int",
"inputOffset",
",",
"int",
"inputLength",
",",
"byte",
"[",
"]",
"output",
",",
"int",
"outputOffset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"output",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"input or output is null\"",
")",
";",
"}",
"int",
"compressedSize",
"=",
"impl",
".",
"rawCompress",
"(",
"input",
",",
"inputOffset",
",",
"inputLength",
",",
"output",
",",
"outputOffset",
")",
";",
"return",
"compressedSize",
";",
"}"
] | Compress the input buffer [offset,... ,offset+length) contents, then
write the compressed data to the output buffer[offset, ...)
@param input input array. This MUST be a primitive array type
@param inputOffset byte offset at the output array
@param inputLength byte length of the input data
@param output output array. This MUST be a primitive array type
@param outputOffset byte offset at the output array
@return byte size of the compressed data
@throws IOException | [
"Compress",
"the",
"input",
"buffer",
"[",
"offset",
"...",
"offset",
"+",
"length",
")",
"contents",
"then",
"write",
"the",
"compressed",
"data",
"to",
"the",
"output",
"buffer",
"[",
"offset",
"...",
")"
] | train | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L438-L448 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ListFormatter.java | ListFormatter.getInstance | @Deprecated
public static ListFormatter getInstance(ULocale locale, Style style) {
"""
Create a list formatter that is appropriate for a locale and style.
@param locale the locale in question.
@param style the style
@return ListFormatter
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android
"""
return cache.get(locale, style.getName());
} | java | @Deprecated
public static ListFormatter getInstance(ULocale locale, Style style) {
return cache.get(locale, style.getName());
} | [
"@",
"Deprecated",
"public",
"static",
"ListFormatter",
"getInstance",
"(",
"ULocale",
"locale",
",",
"Style",
"style",
")",
"{",
"return",
"cache",
".",
"get",
"(",
"locale",
",",
"style",
".",
"getName",
"(",
")",
")",
";",
"}"
] | Create a list formatter that is appropriate for a locale and style.
@param locale the locale in question.
@param style the style
@return ListFormatter
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Create",
"a",
"list",
"formatter",
"that",
"is",
"appropriate",
"for",
"a",
"locale",
"and",
"style",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ListFormatter.java#L164-L167 |
windup/windup | rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/EjbRemoteServiceModelService.java | EjbRemoteServiceModelService.getOrCreate | public EjbRemoteServiceModel getOrCreate(Iterable<ProjectModel> applications, JavaClassModel remoteInterface, JavaClassModel implementationClass) {
"""
Either creates a new {@link EjbRemoteServiceModel} or returns an existing one if one already exists.
"""
GraphTraversal<Vertex, Vertex> pipeline = new GraphTraversalSource(getGraphContext().getGraph()).V();
pipeline.has(WindupVertexFrame.TYPE_PROP, EjbRemoteServiceModel.TYPE);
if (remoteInterface != null)
pipeline.as("remoteInterface").out(EjbRemoteServiceModel.EJB_INTERFACE)
.filter(vertexTraverser -> vertexTraverser.get().equals(remoteInterface.getElement()))
.select("remoteInterface");
if (implementationClass != null)
pipeline.as("implementationClass").out(EjbRemoteServiceModel.EJB_IMPLEMENTATION_CLASS)
.filter(vertexTraverser -> vertexTraverser.get().equals(implementationClass.getElement()))
.select("implementationClass");
if (pipeline.hasNext())
{
EjbRemoteServiceModel result = frame(pipeline.next());
for (ProjectModel application : applications)
{
if (!Iterables.contains(result.getApplications(), application))
result.addApplication(application);
}
return result;
}
else
{
EjbRemoteServiceModel model = create();
model.setApplications(applications);
model.setInterface(remoteInterface);
model.setImplementationClass(implementationClass);
return model;
}
} | java | public EjbRemoteServiceModel getOrCreate(Iterable<ProjectModel> applications, JavaClassModel remoteInterface, JavaClassModel implementationClass)
{
GraphTraversal<Vertex, Vertex> pipeline = new GraphTraversalSource(getGraphContext().getGraph()).V();
pipeline.has(WindupVertexFrame.TYPE_PROP, EjbRemoteServiceModel.TYPE);
if (remoteInterface != null)
pipeline.as("remoteInterface").out(EjbRemoteServiceModel.EJB_INTERFACE)
.filter(vertexTraverser -> vertexTraverser.get().equals(remoteInterface.getElement()))
.select("remoteInterface");
if (implementationClass != null)
pipeline.as("implementationClass").out(EjbRemoteServiceModel.EJB_IMPLEMENTATION_CLASS)
.filter(vertexTraverser -> vertexTraverser.get().equals(implementationClass.getElement()))
.select("implementationClass");
if (pipeline.hasNext())
{
EjbRemoteServiceModel result = frame(pipeline.next());
for (ProjectModel application : applications)
{
if (!Iterables.contains(result.getApplications(), application))
result.addApplication(application);
}
return result;
}
else
{
EjbRemoteServiceModel model = create();
model.setApplications(applications);
model.setInterface(remoteInterface);
model.setImplementationClass(implementationClass);
return model;
}
} | [
"public",
"EjbRemoteServiceModel",
"getOrCreate",
"(",
"Iterable",
"<",
"ProjectModel",
">",
"applications",
",",
"JavaClassModel",
"remoteInterface",
",",
"JavaClassModel",
"implementationClass",
")",
"{",
"GraphTraversal",
"<",
"Vertex",
",",
"Vertex",
">",
"pipeline",
"=",
"new",
"GraphTraversalSource",
"(",
"getGraphContext",
"(",
")",
".",
"getGraph",
"(",
")",
")",
".",
"V",
"(",
")",
";",
"pipeline",
".",
"has",
"(",
"WindupVertexFrame",
".",
"TYPE_PROP",
",",
"EjbRemoteServiceModel",
".",
"TYPE",
")",
";",
"if",
"(",
"remoteInterface",
"!=",
"null",
")",
"pipeline",
".",
"as",
"(",
"\"remoteInterface\"",
")",
".",
"out",
"(",
"EjbRemoteServiceModel",
".",
"EJB_INTERFACE",
")",
".",
"filter",
"(",
"vertexTraverser",
"->",
"vertexTraverser",
".",
"get",
"(",
")",
".",
"equals",
"(",
"remoteInterface",
".",
"getElement",
"(",
")",
")",
")",
".",
"select",
"(",
"\"remoteInterface\"",
")",
";",
"if",
"(",
"implementationClass",
"!=",
"null",
")",
"pipeline",
".",
"as",
"(",
"\"implementationClass\"",
")",
".",
"out",
"(",
"EjbRemoteServiceModel",
".",
"EJB_IMPLEMENTATION_CLASS",
")",
".",
"filter",
"(",
"vertexTraverser",
"->",
"vertexTraverser",
".",
"get",
"(",
")",
".",
"equals",
"(",
"implementationClass",
".",
"getElement",
"(",
")",
")",
")",
".",
"select",
"(",
"\"implementationClass\"",
")",
";",
"if",
"(",
"pipeline",
".",
"hasNext",
"(",
")",
")",
"{",
"EjbRemoteServiceModel",
"result",
"=",
"frame",
"(",
"pipeline",
".",
"next",
"(",
")",
")",
";",
"for",
"(",
"ProjectModel",
"application",
":",
"applications",
")",
"{",
"if",
"(",
"!",
"Iterables",
".",
"contains",
"(",
"result",
".",
"getApplications",
"(",
")",
",",
"application",
")",
")",
"result",
".",
"addApplication",
"(",
"application",
")",
";",
"}",
"return",
"result",
";",
"}",
"else",
"{",
"EjbRemoteServiceModel",
"model",
"=",
"create",
"(",
")",
";",
"model",
".",
"setApplications",
"(",
"applications",
")",
";",
"model",
".",
"setInterface",
"(",
"remoteInterface",
")",
";",
"model",
".",
"setImplementationClass",
"(",
"implementationClass",
")",
";",
"return",
"model",
";",
"}",
"}"
] | Either creates a new {@link EjbRemoteServiceModel} or returns an existing one if one already exists. | [
"Either",
"creates",
"a",
"new",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/service/EjbRemoteServiceModelService.java#L30-L62 |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeInvalidData | protected void encodeInvalidData(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
"""
Encodes the necessary JS to render invalid data.
@throws IOException
"""
wb.attr("errors", sheet.getInvalidDataValue());
} | java | protected void encodeInvalidData(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
wb.attr("errors", sheet.getInvalidDataValue());
} | [
"protected",
"void",
"encodeInvalidData",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"WidgetBuilder",
"wb",
")",
"throws",
"IOException",
"{",
"wb",
".",
"attr",
"(",
"\"errors\"",
",",
"sheet",
".",
"getInvalidDataValue",
"(",
")",
")",
";",
"}"
] | Encodes the necessary JS to render invalid data.
@throws IOException | [
"Encodes",
"the",
"necessary",
"JS",
"to",
"render",
"invalid",
"data",
"."
] | train | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L248-L251 |
jhunters/jprotobuf | jprotobuf-precompile-plugin/src/main/java/com/baidu/jprotobuf/mojo/JprotobufPreCompileMain.java | JprotobufPreCompileMain.isStartWith | private static boolean isStartWith(String testString, String[] targetStrings) {
"""
Checks if is start with.
@param testString the test string
@param targetStrings the target strings
@return true, if is start with
"""
for (String s : targetStrings) {
if (testString.startsWith(s)) {
return true;
}
}
return false;
} | java | private static boolean isStartWith(String testString, String[] targetStrings) {
for (String s : targetStrings) {
if (testString.startsWith(s)) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"isStartWith",
"(",
"String",
"testString",
",",
"String",
"[",
"]",
"targetStrings",
")",
"{",
"for",
"(",
"String",
"s",
":",
"targetStrings",
")",
"{",
"if",
"(",
"testString",
".",
"startsWith",
"(",
"s",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Checks if is start with.
@param testString the test string
@param targetStrings the target strings
@return true, if is start with | [
"Checks",
"if",
"is",
"start",
"with",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/jprotobuf-precompile-plugin/src/main/java/com/baidu/jprotobuf/mojo/JprotobufPreCompileMain.java#L112-L120 |
cloudfoundry/uaa | server/src/main/java/org/cloudfoundry/identity/uaa/oauth/UaaAuthorizationRequestManager.java | UaaAuthorizationRequestManager.setScopesToResources | public void setScopesToResources(Map<String, String> scopeToResource) {
"""
A map from scope name to resource id, for cases (like openid) that cannot
be extracted from the scope name.
@param scopeToResource the map to use
"""
this.scopeToResource = new HashMap<String, String>(scopeToResource);
} | java | public void setScopesToResources(Map<String, String> scopeToResource) {
this.scopeToResource = new HashMap<String, String>(scopeToResource);
} | [
"public",
"void",
"setScopesToResources",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"scopeToResource",
")",
"{",
"this",
".",
"scopeToResource",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
"scopeToResource",
")",
";",
"}"
] | A map from scope name to resource id, for cases (like openid) that cannot
be extracted from the scope name.
@param scopeToResource the map to use | [
"A",
"map",
"from",
"scope",
"name",
"to",
"resource",
"id",
"for",
"cases",
"(",
"like",
"openid",
")",
"that",
"cannot",
"be",
"extracted",
"from",
"the",
"scope",
"name",
"."
] | train | https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/oauth/UaaAuthorizationRequestManager.java#L118-L120 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java | ADictionary.loadDirectory | public void loadDirectory( String lexDir ) throws IOException {
"""
load the all the words from all the files under a specified lexicon directory
@param lexDir
@throws IOException
"""
File path = new File(lexDir);
if ( ! path.exists() ) {
throw new IOException("Lexicon directory ["+lexDir+"] does'n exists.");
}
/*
* load all the lexicon file under the lexicon path
* that start with "lex-" and end with ".lex".
*/
File[] files = path.listFiles(new FilenameFilter(){
@Override
public boolean accept(File dir, String name) {
return (name.startsWith("lex-") && name.endsWith(".lex"));
}
});
for ( File file : files ) {
load(file);
}
} | java | public void loadDirectory( String lexDir ) throws IOException
{
File path = new File(lexDir);
if ( ! path.exists() ) {
throw new IOException("Lexicon directory ["+lexDir+"] does'n exists.");
}
/*
* load all the lexicon file under the lexicon path
* that start with "lex-" and end with ".lex".
*/
File[] files = path.listFiles(new FilenameFilter(){
@Override
public boolean accept(File dir, String name) {
return (name.startsWith("lex-") && name.endsWith(".lex"));
}
});
for ( File file : files ) {
load(file);
}
} | [
"public",
"void",
"loadDirectory",
"(",
"String",
"lexDir",
")",
"throws",
"IOException",
"{",
"File",
"path",
"=",
"new",
"File",
"(",
"lexDir",
")",
";",
"if",
"(",
"!",
"path",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Lexicon directory [\"",
"+",
"lexDir",
"+",
"\"] does'n exists.\"",
")",
";",
"}",
"/*\n * load all the lexicon file under the lexicon path \n * that start with \"lex-\" and end with \".lex\".\n */",
"File",
"[",
"]",
"files",
"=",
"path",
".",
"listFiles",
"(",
"new",
"FilenameFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"dir",
",",
"String",
"name",
")",
"{",
"return",
"(",
"name",
".",
"startsWith",
"(",
"\"lex-\"",
")",
"&&",
"name",
".",
"endsWith",
"(",
"\".lex\"",
")",
")",
";",
"}",
"}",
")",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"load",
"(",
"file",
")",
";",
"}",
"}"
] | load the all the words from all the files under a specified lexicon directory
@param lexDir
@throws IOException | [
"load",
"the",
"all",
"the",
"words",
"from",
"all",
"the",
"files",
"under",
"a",
"specified",
"lexicon",
"directory"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/ADictionary.java#L111-L132 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlSelectBuilder.java | SqlSelectBuilder.generateSQL | static SplittedSql generateSQL(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder, final boolean replaceProjectedColumns) {
"""
Generate SQL.
@param method
the method
@param methodBuilder
the method builder
@param replaceProjectedColumns
the replace projected columns
@return the splitted sql
"""
JQLChecker jqlChecker = JQLChecker.getInstance();
final SplittedSql splittedSql = new SplittedSql();
String sql = convertJQL2SQL(method, false);
// parameters extracted from JQL converted in SQL
splittedSql.sqlBasic = jqlChecker.replaceVariableStatements(method, sql, new JQLReplaceVariableStatementListenerImpl() {
@Override
public String onWhere(String statement) {
splittedSql.sqlWhereStatement = statement;
return "";
}
@Override
public String onOrderBy(String statement) {
splittedSql.sqlOrderByStatement = statement;
return "";
}
@Override
public String onOffset(String statement) {
splittedSql.sqlOffsetStatement = statement;
return "";
}
@Override
public String onLimit(String statement) {
splittedSql.sqlLimitStatement = statement;
return "";
}
@Override
public String onHaving(String statement) {
splittedSql.sqlHavingStatement = statement;
return "";
}
@Override
public String onGroup(String statement) {
splittedSql.sqlGroupStatement = statement;
return "";
}
@Override
public String onProjectedColumns(String statement) {
if (replaceProjectedColumns)
return "%s";
else
return null;
}
});
return splittedSql;
} | java | static SplittedSql generateSQL(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder, final boolean replaceProjectedColumns) {
JQLChecker jqlChecker = JQLChecker.getInstance();
final SplittedSql splittedSql = new SplittedSql();
String sql = convertJQL2SQL(method, false);
// parameters extracted from JQL converted in SQL
splittedSql.sqlBasic = jqlChecker.replaceVariableStatements(method, sql, new JQLReplaceVariableStatementListenerImpl() {
@Override
public String onWhere(String statement) {
splittedSql.sqlWhereStatement = statement;
return "";
}
@Override
public String onOrderBy(String statement) {
splittedSql.sqlOrderByStatement = statement;
return "";
}
@Override
public String onOffset(String statement) {
splittedSql.sqlOffsetStatement = statement;
return "";
}
@Override
public String onLimit(String statement) {
splittedSql.sqlLimitStatement = statement;
return "";
}
@Override
public String onHaving(String statement) {
splittedSql.sqlHavingStatement = statement;
return "";
}
@Override
public String onGroup(String statement) {
splittedSql.sqlGroupStatement = statement;
return "";
}
@Override
public String onProjectedColumns(String statement) {
if (replaceProjectedColumns)
return "%s";
else
return null;
}
});
return splittedSql;
} | [
"static",
"SplittedSql",
"generateSQL",
"(",
"final",
"SQLiteModelMethod",
"method",
",",
"MethodSpec",
".",
"Builder",
"methodBuilder",
",",
"final",
"boolean",
"replaceProjectedColumns",
")",
"{",
"JQLChecker",
"jqlChecker",
"=",
"JQLChecker",
".",
"getInstance",
"(",
")",
";",
"final",
"SplittedSql",
"splittedSql",
"=",
"new",
"SplittedSql",
"(",
")",
";",
"String",
"sql",
"=",
"convertJQL2SQL",
"(",
"method",
",",
"false",
")",
";",
"// parameters extracted from JQL converted in SQL",
"splittedSql",
".",
"sqlBasic",
"=",
"jqlChecker",
".",
"replaceVariableStatements",
"(",
"method",
",",
"sql",
",",
"new",
"JQLReplaceVariableStatementListenerImpl",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"onWhere",
"(",
"String",
"statement",
")",
"{",
"splittedSql",
".",
"sqlWhereStatement",
"=",
"statement",
";",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"public",
"String",
"onOrderBy",
"(",
"String",
"statement",
")",
"{",
"splittedSql",
".",
"sqlOrderByStatement",
"=",
"statement",
";",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"public",
"String",
"onOffset",
"(",
"String",
"statement",
")",
"{",
"splittedSql",
".",
"sqlOffsetStatement",
"=",
"statement",
";",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"public",
"String",
"onLimit",
"(",
"String",
"statement",
")",
"{",
"splittedSql",
".",
"sqlLimitStatement",
"=",
"statement",
";",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"public",
"String",
"onHaving",
"(",
"String",
"statement",
")",
"{",
"splittedSql",
".",
"sqlHavingStatement",
"=",
"statement",
";",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"public",
"String",
"onGroup",
"(",
"String",
"statement",
")",
"{",
"splittedSql",
".",
"sqlGroupStatement",
"=",
"statement",
";",
"return",
"\"\"",
";",
"}",
"@",
"Override",
"public",
"String",
"onProjectedColumns",
"(",
"String",
"statement",
")",
"{",
"if",
"(",
"replaceProjectedColumns",
")",
"return",
"\"%s\"",
";",
"else",
"return",
"null",
";",
"}",
"}",
")",
";",
"return",
"splittedSql",
";",
"}"
] | Generate SQL.
@param method
the method
@param methodBuilder
the method builder
@param replaceProjectedColumns
the replace projected columns
@return the splitted sql | [
"Generate",
"SQL",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlSelectBuilder.java#L371-L427 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/client/gui/element/position/Positions.java | Positions.topAligned | public static IntSupplier topAligned(IChild<?> owner, int spacing) {
"""
Positions the owner to the top inside its parent.<br>
Respects the parent padding.
@param spacing the spacing
@return the int supplier
"""
return () -> {
return Padding.of(owner.getParent()).top() + spacing;
};
} | java | public static IntSupplier topAligned(IChild<?> owner, int spacing)
{
return () -> {
return Padding.of(owner.getParent()).top() + spacing;
};
} | [
"public",
"static",
"IntSupplier",
"topAligned",
"(",
"IChild",
"<",
"?",
">",
"owner",
",",
"int",
"spacing",
")",
"{",
"return",
"(",
")",
"->",
"{",
"return",
"Padding",
".",
"of",
"(",
"owner",
".",
"getParent",
"(",
")",
")",
".",
"top",
"(",
")",
"+",
"spacing",
";",
"}",
";",
"}"
] | Positions the owner to the top inside its parent.<br>
Respects the parent padding.
@param spacing the spacing
@return the int supplier | [
"Positions",
"the",
"owner",
"to",
"the",
"top",
"inside",
"its",
"parent",
".",
"<br",
">",
"Respects",
"the",
"parent",
"padding",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L106-L111 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.moveTextWithLeading | public void moveTextWithLeading(float x, float y) {
"""
Moves to the start of the next line, offset from the start of the current line.
<P>
As a side effect, this sets the leading parameter in the text state.</P>
@param x offset of the new current point
@param y y-coordinate of the new current point
"""
state.xTLM += x;
state.yTLM += y;
state.leading = -y;
content.append(x).append(' ').append(y).append(" TD").append_i(separator);
} | java | public void moveTextWithLeading(float x, float y) {
state.xTLM += x;
state.yTLM += y;
state.leading = -y;
content.append(x).append(' ').append(y).append(" TD").append_i(separator);
} | [
"public",
"void",
"moveTextWithLeading",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"state",
".",
"xTLM",
"+=",
"x",
";",
"state",
".",
"yTLM",
"+=",
"y",
";",
"state",
".",
"leading",
"=",
"-",
"y",
";",
"content",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"y",
")",
".",
"append",
"(",
"\" TD\"",
")",
".",
"append_i",
"(",
"separator",
")",
";",
"}"
] | Moves to the start of the next line, offset from the start of the current line.
<P>
As a side effect, this sets the leading parameter in the text state.</P>
@param x offset of the new current point
@param y y-coordinate of the new current point | [
"Moves",
"to",
"the",
"start",
"of",
"the",
"next",
"line",
"offset",
"from",
"the",
"start",
"of",
"the",
"current",
"line",
".",
"<P",
">",
"As",
"a",
"side",
"effect",
"this",
"sets",
"the",
"leading",
"parameter",
"in",
"the",
"text",
"state",
".",
"<",
"/",
"P",
">"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1572-L1577 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.beginStartEnvironment | public void beginStartEnvironment(String userName, String environmentId) {
"""
Starts an environment by starting all resources inside the environment. This operation can take a while to complete.
@param userName The name of the user.
@param environmentId The resourceId of the environment
@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
"""
beginStartEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().single().body();
} | java | public void beginStartEnvironment(String userName, String environmentId) {
beginStartEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().single().body();
} | [
"public",
"void",
"beginStartEnvironment",
"(",
"String",
"userName",
",",
"String",
"environmentId",
")",
"{",
"beginStartEnvironmentWithServiceResponseAsync",
"(",
"userName",
",",
"environmentId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Starts an environment by starting all resources inside the environment. This operation can take a while to complete.
@param userName The name of the user.
@param environmentId The resourceId of the environment
@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 | [
"Starts",
"an",
"environment",
"by",
"starting",
"all",
"resources",
"inside",
"the",
"environment",
".",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L1149-L1151 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java | AssetsInner.listStreamingLocatorsAsync | public Observable<ListStreamingLocatorsResponseInner> listStreamingLocatorsAsync(String resourceGroupName, String accountName, String assetName) {
"""
List Streaming Locators.
Lists Streaming Locators which are associated with this asset.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param assetName The Asset name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ListStreamingLocatorsResponseInner object
"""
return listStreamingLocatorsWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<ListStreamingLocatorsResponseInner>, ListStreamingLocatorsResponseInner>() {
@Override
public ListStreamingLocatorsResponseInner call(ServiceResponse<ListStreamingLocatorsResponseInner> response) {
return response.body();
}
});
} | java | public Observable<ListStreamingLocatorsResponseInner> listStreamingLocatorsAsync(String resourceGroupName, String accountName, String assetName) {
return listStreamingLocatorsWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<ListStreamingLocatorsResponseInner>, ListStreamingLocatorsResponseInner>() {
@Override
public ListStreamingLocatorsResponseInner call(ServiceResponse<ListStreamingLocatorsResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ListStreamingLocatorsResponseInner",
">",
"listStreamingLocatorsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"assetName",
")",
"{",
"return",
"listStreamingLocatorsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"assetName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ListStreamingLocatorsResponseInner",
">",
",",
"ListStreamingLocatorsResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ListStreamingLocatorsResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"ListStreamingLocatorsResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | List Streaming Locators.
Lists Streaming Locators which are associated with this asset.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param assetName The Asset name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ListStreamingLocatorsResponseInner object | [
"List",
"Streaming",
"Locators",
".",
"Lists",
"Streaming",
"Locators",
"which",
"are",
"associated",
"with",
"this",
"asset",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java#L1021-L1028 |
jenkinsci/jenkins | core/src/main/java/hudson/scm/SCM.java | SCM.postCheckout | public void postCheckout(@Nonnull Run<?,?> build, @Nonnull Launcher launcher, @Nonnull FilePath workspace, @Nonnull TaskListener listener) throws IOException, InterruptedException {
"""
Get a chance to do operations after the workspace i checked out and the changelog is written.
@since 1.568
"""
if (build instanceof AbstractBuild && listener instanceof BuildListener) {
postCheckout((AbstractBuild) build, launcher, workspace, (BuildListener) listener);
}
} | java | public void postCheckout(@Nonnull Run<?,?> build, @Nonnull Launcher launcher, @Nonnull FilePath workspace, @Nonnull TaskListener listener) throws IOException, InterruptedException {
if (build instanceof AbstractBuild && listener instanceof BuildListener) {
postCheckout((AbstractBuild) build, launcher, workspace, (BuildListener) listener);
}
} | [
"public",
"void",
"postCheckout",
"(",
"@",
"Nonnull",
"Run",
"<",
"?",
",",
"?",
">",
"build",
",",
"@",
"Nonnull",
"Launcher",
"launcher",
",",
"@",
"Nonnull",
"FilePath",
"workspace",
",",
"@",
"Nonnull",
"TaskListener",
"listener",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"build",
"instanceof",
"AbstractBuild",
"&&",
"listener",
"instanceof",
"BuildListener",
")",
"{",
"postCheckout",
"(",
"(",
"AbstractBuild",
")",
"build",
",",
"launcher",
",",
"workspace",
",",
"(",
"BuildListener",
")",
"listener",
")",
";",
"}",
"}"
] | Get a chance to do operations after the workspace i checked out and the changelog is written.
@since 1.568 | [
"Get",
"a",
"chance",
"to",
"do",
"operations",
"after",
"the",
"workspace",
"i",
"checked",
"out",
"and",
"the",
"changelog",
"is",
"written",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/scm/SCM.java#L512-L516 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/ProcessedInput.java | ProcessedInput.addParameter | public void addParameter(String parameterName, int parameterStart, int parameterEnd) {
"""
Adds parameter into list of input SQL parameters
@param parameterName Parameter name
@param parameterStart Character position at which parameter starts
@param parameterEnd Character position at which parameter ends
"""
addParameter(parameterName, parameterStart, parameterEnd, null, null);
} | java | public void addParameter(String parameterName, int parameterStart, int parameterEnd) {
addParameter(parameterName, parameterStart, parameterEnd, null, null);
} | [
"public",
"void",
"addParameter",
"(",
"String",
"parameterName",
",",
"int",
"parameterStart",
",",
"int",
"parameterEnd",
")",
"{",
"addParameter",
"(",
"parameterName",
",",
"parameterStart",
",",
"parameterEnd",
",",
"null",
",",
"null",
")",
";",
"}"
] | Adds parameter into list of input SQL parameters
@param parameterName Parameter name
@param parameterStart Character position at which parameter starts
@param parameterEnd Character position at which parameter ends | [
"Adds",
"parameter",
"into",
"list",
"of",
"input",
"SQL",
"parameters"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/ProcessedInput.java#L163-L165 |
Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java | AzureClient.updateStateFromGetResourceOperationAsync | private <T> Observable<PollingState<T>> updateStateFromGetResourceOperationAsync(final PollingState<T> pollingState, String url) {
"""
Polls from the provided URL and updates the polling state with the
polling response.
@param pollingState the polling state for the current operation.
@param url the url to poll from
@param <T> the return type of the caller.
"""
return pollAsync(url, pollingState.loggingContext())
.flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(Response<ResponseBody> response) {
try {
pollingState.updateFromResponseOnPutPatch(response);
return Observable.just(pollingState);
} catch (CloudException | IOException e) {
return Observable.error(e);
}
}
});
} | java | private <T> Observable<PollingState<T>> updateStateFromGetResourceOperationAsync(final PollingState<T> pollingState, String url) {
return pollAsync(url, pollingState.loggingContext())
.flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(Response<ResponseBody> response) {
try {
pollingState.updateFromResponseOnPutPatch(response);
return Observable.just(pollingState);
} catch (CloudException | IOException e) {
return Observable.error(e);
}
}
});
} | [
"private",
"<",
"T",
">",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
"updateStateFromGetResourceOperationAsync",
"(",
"final",
"PollingState",
"<",
"T",
">",
"pollingState",
",",
"String",
"url",
")",
"{",
"return",
"pollAsync",
"(",
"url",
",",
"pollingState",
".",
"loggingContext",
"(",
")",
")",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"Response",
"<",
"ResponseBody",
">",
",",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"PollingState",
"<",
"T",
">",
">",
"call",
"(",
"Response",
"<",
"ResponseBody",
">",
"response",
")",
"{",
"try",
"{",
"pollingState",
".",
"updateFromResponseOnPutPatch",
"(",
"response",
")",
";",
"return",
"Observable",
".",
"just",
"(",
"pollingState",
")",
";",
"}",
"catch",
"(",
"CloudException",
"|",
"IOException",
"e",
")",
"{",
"return",
"Observable",
".",
"error",
"(",
"e",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Polls from the provided URL and updates the polling state with the
polling response.
@param pollingState the polling state for the current operation.
@param url the url to poll from
@param <T> the return type of the caller. | [
"Polls",
"from",
"the",
"provided",
"URL",
"and",
"updates",
"the",
"polling",
"state",
"with",
"the",
"polling",
"response",
"."
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L621-L634 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java | BaseRecordOwner.setProperties | public void setProperties(Map<String, Object> properties) {
"""
Set the properties.
@param strProperties The properties to set.
Override this to do something.
"""
if (this.getParentRecordOwner() != null)
this.getParentRecordOwner().setProperties(properties);
} | java | public void setProperties(Map<String, Object> properties)
{
if (this.getParentRecordOwner() != null)
this.getParentRecordOwner().setProperties(properties);
} | [
"public",
"void",
"setProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"this",
".",
"getParentRecordOwner",
"(",
")",
"!=",
"null",
")",
"this",
".",
"getParentRecordOwner",
"(",
")",
".",
"setProperties",
"(",
"properties",
")",
";",
"}"
] | Set the properties.
@param strProperties The properties to set.
Override this to do something. | [
"Set",
"the",
"properties",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java#L363-L367 |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/utils/ClientUtils.java | ClientUtils.parameterizedType | public static ParameterizedType parameterizedType(Type ownerType, Type rawType,
Type... typeArguments) {
"""
Helper for constructing parameterized types.
@param ownerType the owner type
@param rawType the raw type
@param typeArguments the type arguments
@return the parameterized type object
@see com.google.gson.internal.$Gson$Types#newParameterizedTypeWithOwner
"""
return newParameterizedTypeWithOwner(ownerType, rawType, typeArguments);
} | java | public static ParameterizedType parameterizedType(Type ownerType, Type rawType,
Type... typeArguments) {
return newParameterizedTypeWithOwner(ownerType, rawType, typeArguments);
} | [
"public",
"static",
"ParameterizedType",
"parameterizedType",
"(",
"Type",
"ownerType",
",",
"Type",
"rawType",
",",
"Type",
"...",
"typeArguments",
")",
"{",
"return",
"newParameterizedTypeWithOwner",
"(",
"ownerType",
",",
"rawType",
",",
"typeArguments",
")",
";",
"}"
] | Helper for constructing parameterized types.
@param ownerType the owner type
@param rawType the raw type
@param typeArguments the type arguments
@return the parameterized type object
@see com.google.gson.internal.$Gson$Types#newParameterizedTypeWithOwner | [
"Helper",
"for",
"constructing",
"parameterized",
"types",
"."
] | train | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/utils/ClientUtils.java#L66-L69 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/LocalVariableTypeTable.java | LocalVariableTypeTable.addLocalTypeVariable | public void addLocalTypeVariable(VariableElement ve, String signature, int index) {
"""
Adds a entry into LocalTypeVariableTable if variable is of generic type
@param ve
@param index
"""
localTypeVariables.add(new LocalTypeVariable(ve, signature, index));
} | java | public void addLocalTypeVariable(VariableElement ve, String signature, int index)
{
localTypeVariables.add(new LocalTypeVariable(ve, signature, index));
} | [
"public",
"void",
"addLocalTypeVariable",
"(",
"VariableElement",
"ve",
",",
"String",
"signature",
",",
"int",
"index",
")",
"{",
"localTypeVariables",
".",
"add",
"(",
"new",
"LocalTypeVariable",
"(",
"ve",
",",
"signature",
",",
"index",
")",
")",
";",
"}"
] | Adds a entry into LocalTypeVariableTable if variable is of generic type
@param ve
@param index | [
"Adds",
"a",
"entry",
"into",
"LocalTypeVariableTable",
"if",
"variable",
"is",
"of",
"generic",
"type"
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/LocalVariableTypeTable.java#L61-L64 |
alkacon/opencms-core | src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java | CmsJSONSearchConfigurationParser.parseSortOption | protected I_CmsSearchConfigurationSortOption parseSortOption(JSONObject json) {
"""
Returns a single sort option configuration as configured via the methods parameter, or null if the parameter does not specify a sort option.
@param json The JSON sort option configuration.
@return The sort option configuration, or null if the JSON could not be read.
"""
try {
String solrValue = json.getString(JSON_KEY_SORTOPTION_SOLRVALUE);
String paramValue = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_PARAMVALUE);
paramValue = (paramValue == null) ? solrValue : paramValue;
String label = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_LABEL);
label = (label == null) ? paramValue : label;
return new CmsSearchConfigurationSortOption(label, paramValue, solrValue);
} catch (JSONException e) {
LOG.error(
Messages.get().getBundle().key(Messages.ERR_SORT_OPTION_NOT_PARSABLE_1, JSON_KEY_SORTOPTION_SOLRVALUE),
e);
return null;
}
} | java | protected I_CmsSearchConfigurationSortOption parseSortOption(JSONObject json) {
try {
String solrValue = json.getString(JSON_KEY_SORTOPTION_SOLRVALUE);
String paramValue = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_PARAMVALUE);
paramValue = (paramValue == null) ? solrValue : paramValue;
String label = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_LABEL);
label = (label == null) ? paramValue : label;
return new CmsSearchConfigurationSortOption(label, paramValue, solrValue);
} catch (JSONException e) {
LOG.error(
Messages.get().getBundle().key(Messages.ERR_SORT_OPTION_NOT_PARSABLE_1, JSON_KEY_SORTOPTION_SOLRVALUE),
e);
return null;
}
} | [
"protected",
"I_CmsSearchConfigurationSortOption",
"parseSortOption",
"(",
"JSONObject",
"json",
")",
"{",
"try",
"{",
"String",
"solrValue",
"=",
"json",
".",
"getString",
"(",
"JSON_KEY_SORTOPTION_SOLRVALUE",
")",
";",
"String",
"paramValue",
"=",
"parseOptionalStringValue",
"(",
"json",
",",
"JSON_KEY_SORTOPTION_PARAMVALUE",
")",
";",
"paramValue",
"=",
"(",
"paramValue",
"==",
"null",
")",
"?",
"solrValue",
":",
"paramValue",
";",
"String",
"label",
"=",
"parseOptionalStringValue",
"(",
"json",
",",
"JSON_KEY_SORTOPTION_LABEL",
")",
";",
"label",
"=",
"(",
"label",
"==",
"null",
")",
"?",
"paramValue",
":",
"label",
";",
"return",
"new",
"CmsSearchConfigurationSortOption",
"(",
"label",
",",
"paramValue",
",",
"solrValue",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"ERR_SORT_OPTION_NOT_PARSABLE_1",
",",
"JSON_KEY_SORTOPTION_SOLRVALUE",
")",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"}"
] | Returns a single sort option configuration as configured via the methods parameter, or null if the parameter does not specify a sort option.
@param json The JSON sort option configuration.
@return The sort option configuration, or null if the JSON could not be read. | [
"Returns",
"a",
"single",
"sort",
"option",
"configuration",
"as",
"configured",
"via",
"the",
"methods",
"parameter",
"or",
"null",
"if",
"the",
"parameter",
"does",
"not",
"specify",
"a",
"sort",
"option",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L974-L989 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/Entity.java | Entity.parseBean | @Override
public <T> Entity parseBean(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) {
"""
将值对象转换为Entity<br>
类名会被当作表名,小写第一个字母
@param <T> Bean对象类型
@param bean Bean对象
@param isToUnderlineCase 是否转换为下划线模式
@param ignoreNullValue 是否忽略值为空的字段
@return 自己
"""
if (StrUtil.isBlank(this.tableName)) {
String simpleName = bean.getClass().getSimpleName();
this.setTableName(isToUnderlineCase ? StrUtil.toUnderlineCase(simpleName) : StrUtil.lowerFirst(simpleName));
}
return (Entity) super.parseBean(bean, isToUnderlineCase, ignoreNullValue);
} | java | @Override
public <T> Entity parseBean(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) {
if (StrUtil.isBlank(this.tableName)) {
String simpleName = bean.getClass().getSimpleName();
this.setTableName(isToUnderlineCase ? StrUtil.toUnderlineCase(simpleName) : StrUtil.lowerFirst(simpleName));
}
return (Entity) super.parseBean(bean, isToUnderlineCase, ignoreNullValue);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"Entity",
"parseBean",
"(",
"T",
"bean",
",",
"boolean",
"isToUnderlineCase",
",",
"boolean",
"ignoreNullValue",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"this",
".",
"tableName",
")",
")",
"{",
"String",
"simpleName",
"=",
"bean",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
";",
"this",
".",
"setTableName",
"(",
"isToUnderlineCase",
"?",
"StrUtil",
".",
"toUnderlineCase",
"(",
"simpleName",
")",
":",
"StrUtil",
".",
"lowerFirst",
"(",
"simpleName",
")",
")",
";",
"}",
"return",
"(",
"Entity",
")",
"super",
".",
"parseBean",
"(",
"bean",
",",
"isToUnderlineCase",
",",
"ignoreNullValue",
")",
";",
"}"
] | 将值对象转换为Entity<br>
类名会被当作表名,小写第一个字母
@param <T> Bean对象类型
@param bean Bean对象
@param isToUnderlineCase 是否转换为下划线模式
@param ignoreNullValue 是否忽略值为空的字段
@return 自己 | [
"将值对象转换为Entity<br",
">",
"类名会被当作表名,小写第一个字母"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Entity.java#L211-L218 |
jnr/jnr-x86asm | src/main/java/jnr/x86asm/Asm.java | Asm.tword_ptr | public static final Mem tword_ptr(Register base, Register index, int shift, long disp) {
"""
Create tword (10 Bytes) pointer operand (used for 80 bit floating points).
"""
return _ptr_build(base, index, shift, disp, SIZE_TWORD);
} | java | public static final Mem tword_ptr(Register base, Register index, int shift, long disp) {
return _ptr_build(base, index, shift, disp, SIZE_TWORD);
} | [
"public",
"static",
"final",
"Mem",
"tword_ptr",
"(",
"Register",
"base",
",",
"Register",
"index",
",",
"int",
"shift",
",",
"long",
"disp",
")",
"{",
"return",
"_ptr_build",
"(",
"base",
",",
"index",
",",
"shift",
",",
"disp",
",",
"SIZE_TWORD",
")",
";",
"}"
] | Create tword (10 Bytes) pointer operand (used for 80 bit floating points). | [
"Create",
"tword",
"(",
"10",
"Bytes",
")",
"pointer",
"operand",
"(",
"used",
"for",
"80",
"bit",
"floating",
"points",
")",
"."
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/Asm.java#L575-L577 |
mgormley/prim | src/main/java_generated/edu/jhu/prim/vector/IntFloatDenseVector.java | IntFloatDenseVector.add | public void add(IntFloatVector other) {
"""
Updates this vector to be the entrywise sum of this vector with the other.
"""
if (other instanceof IntFloatUnsortedVector) {
IntFloatUnsortedVector vec = (IntFloatUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntFloatDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.FloatAdd()));
}
} | java | public void add(IntFloatVector other) {
if (other instanceof IntFloatUnsortedVector) {
IntFloatUnsortedVector vec = (IntFloatUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntFloatDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.FloatAdd()));
}
} | [
"public",
"void",
"add",
"(",
"IntFloatVector",
"other",
")",
"{",
"if",
"(",
"other",
"instanceof",
"IntFloatUnsortedVector",
")",
"{",
"IntFloatUnsortedVector",
"vec",
"=",
"(",
"IntFloatUnsortedVector",
")",
"other",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vec",
".",
"top",
";",
"i",
"++",
")",
"{",
"this",
".",
"add",
"(",
"vec",
".",
"idx",
"[",
"i",
"]",
",",
"vec",
".",
"vals",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"{",
"// TODO: Add special case for IntFloatDenseVector.",
"other",
".",
"iterate",
"(",
"new",
"SparseBinaryOpApplier",
"(",
"this",
",",
"new",
"Lambda",
".",
"FloatAdd",
"(",
")",
")",
")",
";",
"}",
"}"
] | Updates this vector to be the entrywise sum of this vector with the other. | [
"Updates",
"this",
"vector",
"to",
"be",
"the",
"entrywise",
"sum",
"of",
"this",
"vector",
"with",
"the",
"other",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/vector/IntFloatDenseVector.java#L143-L153 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.email_domain_new_duration_POST | public OvhOrder email_domain_new_duration_POST(String duration, String domain, OvhOfferEnum offer) throws IOException {
"""
Create order
REST: POST /order/email/domain/new/{duration}
@param domain [required] Domain name which will be linked to this mx account
@param offer [required] Offer for your new mx account
@param duration [required] Duration
@deprecated
"""
String qPath = "/order/email/domain/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "offer", offer);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder email_domain_new_duration_POST(String duration, String domain, OvhOfferEnum offer) throws IOException {
String qPath = "/order/email/domain/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "offer", offer);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"email_domain_new_duration_POST",
"(",
"String",
"duration",
",",
"String",
"domain",
",",
"OvhOfferEnum",
"offer",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/email/domain/new/{duration}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"duration",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"domain\"",
",",
"domain",
")",
";",
"addBody",
"(",
"o",
",",
"\"offer\"",
",",
"offer",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOrder",
".",
"class",
")",
";",
"}"
] | Create order
REST: POST /order/email/domain/new/{duration}
@param domain [required] Domain name which will be linked to this mx account
@param offer [required] Offer for your new mx account
@param duration [required] Duration
@deprecated | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4125-L4133 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/util/measure/impl/SimpleMeasureManager.java | SimpleMeasureManager.setMeasure | public void setMeasure(Object key, Measure<?> measure) {
"""
This method call {@link #setPullMeasure(Object, PullMeasure)} or
{@link #setPushMeasure(Object, PushMeasure)} depending on the interfaces
implemented by the {@link Measure} given in argument. If both interfaces
are implemented, both methods are called, allowing to register all the
aspects of the {@link Measure} in one call.
@param key
the key of the {@link Measure}
@param measure
the {@link Measure} to register
"""
if (measure instanceof PullMeasure) {
setPullMeasure(key, (PullMeasure<?>) measure);
}
if (measure instanceof PushMeasure) {
setPushMeasure(key, (PushMeasure<?>) measure);
}
} | java | public void setMeasure(Object key, Measure<?> measure) {
if (measure instanceof PullMeasure) {
setPullMeasure(key, (PullMeasure<?>) measure);
}
if (measure instanceof PushMeasure) {
setPushMeasure(key, (PushMeasure<?>) measure);
}
} | [
"public",
"void",
"setMeasure",
"(",
"Object",
"key",
",",
"Measure",
"<",
"?",
">",
"measure",
")",
"{",
"if",
"(",
"measure",
"instanceof",
"PullMeasure",
")",
"{",
"setPullMeasure",
"(",
"key",
",",
"(",
"PullMeasure",
"<",
"?",
">",
")",
"measure",
")",
";",
"}",
"if",
"(",
"measure",
"instanceof",
"PushMeasure",
")",
"{",
"setPushMeasure",
"(",
"key",
",",
"(",
"PushMeasure",
"<",
"?",
">",
")",
"measure",
")",
";",
"}",
"}"
] | This method call {@link #setPullMeasure(Object, PullMeasure)} or
{@link #setPushMeasure(Object, PushMeasure)} depending on the interfaces
implemented by the {@link Measure} given in argument. If both interfaces
are implemented, both methods are called, allowing to register all the
aspects of the {@link Measure} in one call.
@param key
the key of the {@link Measure}
@param measure
the {@link Measure} to register | [
"This",
"method",
"call",
"{",
"@link",
"#setPullMeasure",
"(",
"Object",
"PullMeasure",
")",
"}",
"or",
"{",
"@link",
"#setPushMeasure",
"(",
"Object",
"PushMeasure",
")",
"}",
"depending",
"on",
"the",
"interfaces",
"implemented",
"by",
"the",
"{",
"@link",
"Measure",
"}",
"given",
"in",
"argument",
".",
"If",
"both",
"interfaces",
"are",
"implemented",
"both",
"methods",
"are",
"called",
"allowing",
"to",
"register",
"all",
"the",
"aspects",
"of",
"the",
"{",
"@link",
"Measure",
"}",
"in",
"one",
"call",
"."
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/measure/impl/SimpleMeasureManager.java#L126-L133 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java | DBTransaction.addColumn | public void addColumn(String storeName, String rowKey, String columnName, String columnValue) {
"""
Add or set a column with the given string value. The column value is converted to
binary form using UTF-8.
@param storeName Name of store that owns row.
@param rowKey Key of row that owns column.
@param columnName Name of column.
@param columnValue Column value as a string.
"""
addColumn(storeName, rowKey, columnName, Utils.toBytes(columnValue));
} | java | public void addColumn(String storeName, String rowKey, String columnName, String columnValue) {
addColumn(storeName, rowKey, columnName, Utils.toBytes(columnValue));
} | [
"public",
"void",
"addColumn",
"(",
"String",
"storeName",
",",
"String",
"rowKey",
",",
"String",
"columnName",
",",
"String",
"columnValue",
")",
"{",
"addColumn",
"(",
"storeName",
",",
"rowKey",
",",
"columnName",
",",
"Utils",
".",
"toBytes",
"(",
"columnValue",
")",
")",
";",
"}"
] | Add or set a column with the given string value. The column value is converted to
binary form using UTF-8.
@param storeName Name of store that owns row.
@param rowKey Key of row that owns column.
@param columnName Name of column.
@param columnValue Column value as a string. | [
"Add",
"or",
"set",
"a",
"column",
"with",
"the",
"given",
"string",
"value",
".",
"The",
"column",
"value",
"is",
"converted",
"to",
"binary",
"form",
"using",
"UTF",
"-",
"8",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java#L206-L208 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java | RolloutStatusCache.putRolloutStatus | public void putRolloutStatus(final Long rolloutId, final List<TotalTargetCountActionStatus> status) {
"""
Put {@link TotalTargetCountActionStatus} for one {@link Rollout}s into
cache.
@param rolloutId
the cache entries belong to
@param status
list to cache
"""
final Cache cache = cacheManager.getCache(CACHE_RO_NAME);
putIntoCache(rolloutId, status, cache);
} | java | public void putRolloutStatus(final Long rolloutId, final List<TotalTargetCountActionStatus> status) {
final Cache cache = cacheManager.getCache(CACHE_RO_NAME);
putIntoCache(rolloutId, status, cache);
} | [
"public",
"void",
"putRolloutStatus",
"(",
"final",
"Long",
"rolloutId",
",",
"final",
"List",
"<",
"TotalTargetCountActionStatus",
">",
"status",
")",
"{",
"final",
"Cache",
"cache",
"=",
"cacheManager",
".",
"getCache",
"(",
"CACHE_RO_NAME",
")",
";",
"putIntoCache",
"(",
"rolloutId",
",",
"status",
",",
"cache",
")",
";",
"}"
] | Put {@link TotalTargetCountActionStatus} for one {@link Rollout}s into
cache.
@param rolloutId
the cache entries belong to
@param status
list to cache | [
"Put",
"{",
"@link",
"TotalTargetCountActionStatus",
"}",
"for",
"one",
"{",
"@link",
"Rollout",
"}",
"s",
"into",
"cache",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java#L145-L148 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/deregistration/DeregistrationPanel.java | DeregistrationPanel.newContentPanel | protected Component newContentPanel(final String id) {
"""
Factory method for creating the new {@link Component} of the content. This method is invoked
in the constructor from the derived classes and can be overridden so users can provide their
own version of a new {@link Component} of the content.
@param id
the id
@return the new {@link Component} of the content
"""
final ContentPanel contentPanel = new ContentPanel("contentPanel",
Model
.of(ContentModelBean.builder()
.headerResourceKey(ResourceBundleKey.builder()
.key("sem.main.info.frame.deregistration.user.label")
.parameters(ListExtensions.toObjectArray(getDomainName())).build())
.contentResourceKey(ResourceBundleKey.builder()
.key("sem.main.info.frame.deregistration.user.label")
.parameters(ListExtensions.toObjectArray(getDomainName())).build())
.build()));
contentPanel.getHeader().add(new JQueryJsAppenderBehavior("wrap", "<h1></h1>"));
contentPanel.getContent()
.add(new JQueryJsAppenderBehavior("wrap", "<p class=\"lead\"></p>"));
return contentPanel;
} | java | protected Component newContentPanel(final String id)
{
final ContentPanel contentPanel = new ContentPanel("contentPanel",
Model
.of(ContentModelBean.builder()
.headerResourceKey(ResourceBundleKey.builder()
.key("sem.main.info.frame.deregistration.user.label")
.parameters(ListExtensions.toObjectArray(getDomainName())).build())
.contentResourceKey(ResourceBundleKey.builder()
.key("sem.main.info.frame.deregistration.user.label")
.parameters(ListExtensions.toObjectArray(getDomainName())).build())
.build()));
contentPanel.getHeader().add(new JQueryJsAppenderBehavior("wrap", "<h1></h1>"));
contentPanel.getContent()
.add(new JQueryJsAppenderBehavior("wrap", "<p class=\"lead\"></p>"));
return contentPanel;
} | [
"protected",
"Component",
"newContentPanel",
"(",
"final",
"String",
"id",
")",
"{",
"final",
"ContentPanel",
"contentPanel",
"=",
"new",
"ContentPanel",
"(",
"\"contentPanel\"",
",",
"Model",
".",
"of",
"(",
"ContentModelBean",
".",
"builder",
"(",
")",
".",
"headerResourceKey",
"(",
"ResourceBundleKey",
".",
"builder",
"(",
")",
".",
"key",
"(",
"\"sem.main.info.frame.deregistration.user.label\"",
")",
".",
"parameters",
"(",
"ListExtensions",
".",
"toObjectArray",
"(",
"getDomainName",
"(",
")",
")",
")",
".",
"build",
"(",
")",
")",
".",
"contentResourceKey",
"(",
"ResourceBundleKey",
".",
"builder",
"(",
")",
".",
"key",
"(",
"\"sem.main.info.frame.deregistration.user.label\"",
")",
".",
"parameters",
"(",
"ListExtensions",
".",
"toObjectArray",
"(",
"getDomainName",
"(",
")",
")",
")",
".",
"build",
"(",
")",
")",
".",
"build",
"(",
")",
")",
")",
";",
"contentPanel",
".",
"getHeader",
"(",
")",
".",
"add",
"(",
"new",
"JQueryJsAppenderBehavior",
"(",
"\"wrap\"",
",",
"\"<h1></h1>\"",
")",
")",
";",
"contentPanel",
".",
"getContent",
"(",
")",
".",
"add",
"(",
"new",
"JQueryJsAppenderBehavior",
"(",
"\"wrap\"",
",",
"\"<p class=\\\"lead\\\"></p>\"",
")",
")",
";",
"return",
"contentPanel",
";",
"}"
] | Factory method for creating the new {@link Component} of the content. This method is invoked
in the constructor from the derived classes and can be overridden so users can provide their
own version of a new {@link Component} of the content.
@param id
the id
@return the new {@link Component} of the content | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"Component",
"}",
"of",
"the",
"content",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"new",
"{",
"@link",
"Component",
"}",
"of",
"the",
"content",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/deregistration/DeregistrationPanel.java#L142-L159 |
apache/flink | flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/util/SetCache.java | SetCache.getDataSet | @SuppressWarnings("unchecked")
public <T> DataSet<T> getDataSet(int id) {
"""
Returns the cached {@link DataSet} for the given ID.
@param id Set ID
@param <T> DataSet type
@return Cached DataSet
@throws IllegalStateException if the cached set is not a DataSet
"""
return verifyType(id, dataSets.get(id), SetType.DATA_SET);
} | java | @SuppressWarnings("unchecked")
public <T> DataSet<T> getDataSet(int id) {
return verifyType(id, dataSets.get(id), SetType.DATA_SET);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"DataSet",
"<",
"T",
">",
"getDataSet",
"(",
"int",
"id",
")",
"{",
"return",
"verifyType",
"(",
"id",
",",
"dataSets",
".",
"get",
"(",
"id",
")",
",",
"SetType",
".",
"DATA_SET",
")",
";",
"}"
] | Returns the cached {@link DataSet} for the given ID.
@param id Set ID
@param <T> DataSet type
@return Cached DataSet
@throws IllegalStateException if the cached set is not a DataSet | [
"Returns",
"the",
"cached",
"{",
"@link",
"DataSet",
"}",
"for",
"the",
"given",
"ID",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/util/SetCache.java#L156-L159 |
tvesalainen/util | util/src/main/java/org/vesalainen/lang/Primitives.java | Primitives.parseInt | public static final int parseInt(CharSequence cs) {
"""
Equal to calling parseInt(cs, 10).
@param cs
@return
@throws java.lang.NumberFormatException if input cannot be parsed to proper
int.
@see java.lang.Integer#parseInt(java.lang.String)
@see java.lang.Character#digit(int, int)
"""
if (CharSequences.startsWith(cs, "0b"))
{
return parseInt(cs, 2, 2, cs.length());
}
if (CharSequences.startsWith(cs, "0x"))
{
return parseInt(cs, 16, 2, cs.length());
}
return parseInt(cs, 10);
} | java | public static final int parseInt(CharSequence cs)
{
if (CharSequences.startsWith(cs, "0b"))
{
return parseInt(cs, 2, 2, cs.length());
}
if (CharSequences.startsWith(cs, "0x"))
{
return parseInt(cs, 16, 2, cs.length());
}
return parseInt(cs, 10);
} | [
"public",
"static",
"final",
"int",
"parseInt",
"(",
"CharSequence",
"cs",
")",
"{",
"if",
"(",
"CharSequences",
".",
"startsWith",
"(",
"cs",
",",
"\"0b\"",
")",
")",
"{",
"return",
"parseInt",
"(",
"cs",
",",
"2",
",",
"2",
",",
"cs",
".",
"length",
"(",
")",
")",
";",
"}",
"if",
"(",
"CharSequences",
".",
"startsWith",
"(",
"cs",
",",
"\"0x\"",
")",
")",
"{",
"return",
"parseInt",
"(",
"cs",
",",
"16",
",",
"2",
",",
"cs",
".",
"length",
"(",
")",
")",
";",
"}",
"return",
"parseInt",
"(",
"cs",
",",
"10",
")",
";",
"}"
] | Equal to calling parseInt(cs, 10).
@param cs
@return
@throws java.lang.NumberFormatException if input cannot be parsed to proper
int.
@see java.lang.Integer#parseInt(java.lang.String)
@see java.lang.Character#digit(int, int) | [
"Equal",
"to",
"calling",
"parseInt",
"(",
"cs",
"10",
")",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L875-L886 |
JOML-CI/JOML | src/org/joml/Quaterniond.java | Quaterniond.fromAxisAngleRad | public Quaterniond fromAxisAngleRad(double axisX, double axisY, double axisZ, double angle) {
"""
Set this quaternion to be a representation of the supplied axis and
angle (in radians).
@param axisX
the x component of the rotation axis
@param axisY
the y component of the rotation axis
@param axisZ
the z component of the rotation axis
@param angle
the angle in radians
@return this
"""
double hangle = angle / 2.0;
double sinAngle = Math.sin(hangle);
double vLength = Math.sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ);
x = axisX / vLength * sinAngle;
y = axisY / vLength * sinAngle;
z = axisZ / vLength * sinAngle;
w = Math.cosFromSin(sinAngle, hangle);
return this;
} | java | public Quaterniond fromAxisAngleRad(double axisX, double axisY, double axisZ, double angle) {
double hangle = angle / 2.0;
double sinAngle = Math.sin(hangle);
double vLength = Math.sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ);
x = axisX / vLength * sinAngle;
y = axisY / vLength * sinAngle;
z = axisZ / vLength * sinAngle;
w = Math.cosFromSin(sinAngle, hangle);
return this;
} | [
"public",
"Quaterniond",
"fromAxisAngleRad",
"(",
"double",
"axisX",
",",
"double",
"axisY",
",",
"double",
"axisZ",
",",
"double",
"angle",
")",
"{",
"double",
"hangle",
"=",
"angle",
"/",
"2.0",
";",
"double",
"sinAngle",
"=",
"Math",
".",
"sin",
"(",
"hangle",
")",
";",
"double",
"vLength",
"=",
"Math",
".",
"sqrt",
"(",
"axisX",
"*",
"axisX",
"+",
"axisY",
"*",
"axisY",
"+",
"axisZ",
"*",
"axisZ",
")",
";",
"x",
"=",
"axisX",
"/",
"vLength",
"*",
"sinAngle",
";",
"y",
"=",
"axisY",
"/",
"vLength",
"*",
"sinAngle",
";",
"z",
"=",
"axisZ",
"/",
"vLength",
"*",
"sinAngle",
";",
"w",
"=",
"Math",
".",
"cosFromSin",
"(",
"sinAngle",
",",
"hangle",
")",
";",
"return",
"this",
";",
"}"
] | Set this quaternion to be a representation of the supplied axis and
angle (in radians).
@param axisX
the x component of the rotation axis
@param axisY
the y component of the rotation axis
@param axisZ
the z component of the rotation axis
@param angle
the angle in radians
@return this | [
"Set",
"this",
"quaternion",
"to",
"be",
"a",
"representation",
"of",
"the",
"supplied",
"axis",
"and",
"angle",
"(",
"in",
"radians",
")",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L665-L674 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/shipping/admin/profiles/ShippingInclusionRuleUrl.java | ShippingInclusionRuleUrl.deleteShippingInclusionRuleUrl | public static MozuUrl deleteShippingInclusionRuleUrl(String id, String profilecode) {
"""
Get Resource Url for DeleteShippingInclusionRule
@param id Unique identifier of the customer segment to retrieve.
@param profilecode The unique, user-defined code of the profile with which the shipping inclusion rule is associated.
@return String Resource Url
"""
UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/profiles/{profilecode}/rules/shippinginclusions/{id}");
formatter.formatUrl("id", id);
formatter.formatUrl("profilecode", profilecode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteShippingInclusionRuleUrl(String id, String profilecode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/profiles/{profilecode}/rules/shippinginclusions/{id}");
formatter.formatUrl("id", id);
formatter.formatUrl("profilecode", profilecode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteShippingInclusionRuleUrl",
"(",
"String",
"id",
",",
"String",
"profilecode",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/shipping/admin/profiles/{profilecode}/rules/shippinginclusions/{id}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"id\"",
",",
"id",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"profilecode\"",
",",
"profilecode",
")",
";",
"return",
"new",
"MozuUrl",
"(",
"formatter",
".",
"getResourceUrl",
"(",
")",
",",
"MozuUrl",
".",
"UrlLocation",
".",
"TENANT_POD",
")",
";",
"}"
] | Get Resource Url for DeleteShippingInclusionRule
@param id Unique identifier of the customer segment to retrieve.
@param profilecode The unique, user-defined code of the profile with which the shipping inclusion rule is associated.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteShippingInclusionRule"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/shipping/admin/profiles/ShippingInclusionRuleUrl.java#L82-L88 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getCharacterBackStory | public void getCharacterBackStory(String API, String name, Callback<CharacterBackStory> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on character back story API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Backstory">here</a><br/>
@param API API key
@param name name of character
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key | empty character name
@throws NullPointerException if given {@link Callback} is empty
@see CharacterBackStory back store answer info
"""
isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name));
gw2API.getCharacterBackStory(name, API).enqueue(callback);
} | java | public void getCharacterBackStory(String API, String name, Callback<CharacterBackStory> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name));
gw2API.getCharacterBackStory(name, API).enqueue(callback);
} | [
"public",
"void",
"getCharacterBackStory",
"(",
"String",
"API",
",",
"String",
"name",
",",
"Callback",
"<",
"CharacterBackStory",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ParamType",
".",
"API",
",",
"API",
")",
",",
"new",
"ParamChecker",
"(",
"ParamType",
".",
"CHAR",
",",
"name",
")",
")",
";",
"gw2API",
".",
"getCharacterBackStory",
"(",
"name",
",",
"API",
")",
".",
"enqueue",
"(",
"callback",
")",
";",
"}"
] | For more info on character back story API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Backstory">here</a><br/>
@param API API key
@param name name of character
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key | empty character name
@throws NullPointerException if given {@link Callback} is empty
@see CharacterBackStory back store answer info | [
"For",
"more",
"info",
"on",
"character",
"back",
"story",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"characters#Backstory",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">"
] | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L705-L708 |
gocd/gocd | common/src/main/java/com/thoughtworks/go/util/URLService.java | URLService.getRestfulArtifactUrl | public String getRestfulArtifactUrl(JobIdentifier jobIdentifier, String filePath) {
"""
/*
Server will use this method, the base url is in the request.
"""
return format("/%s/%s", "files", jobIdentifier.artifactLocator(filePath));
} | java | public String getRestfulArtifactUrl(JobIdentifier jobIdentifier, String filePath) {
return format("/%s/%s", "files", jobIdentifier.artifactLocator(filePath));
} | [
"public",
"String",
"getRestfulArtifactUrl",
"(",
"JobIdentifier",
"jobIdentifier",
",",
"String",
"filePath",
")",
"{",
"return",
"format",
"(",
"\"/%s/%s\"",
",",
"\"files\"",
",",
"jobIdentifier",
".",
"artifactLocator",
"(",
"filePath",
")",
")",
";",
"}"
] | /*
Server will use this method, the base url is in the request. | [
"/",
"*",
"Server",
"will",
"use",
"this",
"method",
"the",
"base",
"url",
"is",
"in",
"the",
"request",
"."
] | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/common/src/main/java/com/thoughtworks/go/util/URLService.java#L77-L79 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java | Signature.initSign | public final void initSign(PrivateKey privateKey, SecureRandom random)
throws InvalidKeyException {
"""
Initialize this object for signing. If this method is called
again with a different argument, it negates the effect
of this call.
@param privateKey the private key of the identity whose signature
is going to be generated.
@param random the source of randomness for this signature.
@exception InvalidKeyException if the key is invalid.
"""
engineInitSign(privateKey, random);
state = SIGN;
// BEGIN Android-removed: this debugging mechanism is not supported in Android.
/*
if (!skipDebug && pdebug != null) {
pdebug.println("Signature." + algorithm +
" signing algorithm from: " + this.provider.getName());
}
*/
// END Android-removed: this debugging mechanism is not supported in Android.
} | java | public final void initSign(PrivateKey privateKey, SecureRandom random)
throws InvalidKeyException {
engineInitSign(privateKey, random);
state = SIGN;
// BEGIN Android-removed: this debugging mechanism is not supported in Android.
/*
if (!skipDebug && pdebug != null) {
pdebug.println("Signature." + algorithm +
" signing algorithm from: " + this.provider.getName());
}
*/
// END Android-removed: this debugging mechanism is not supported in Android.
} | [
"public",
"final",
"void",
"initSign",
"(",
"PrivateKey",
"privateKey",
",",
"SecureRandom",
"random",
")",
"throws",
"InvalidKeyException",
"{",
"engineInitSign",
"(",
"privateKey",
",",
"random",
")",
";",
"state",
"=",
"SIGN",
";",
"// BEGIN Android-removed: this debugging mechanism is not supported in Android.",
"/*\n if (!skipDebug && pdebug != null) {\n pdebug.println(\"Signature.\" + algorithm +\n \" signing algorithm from: \" + this.provider.getName());\n }\n */",
"// END Android-removed: this debugging mechanism is not supported in Android.",
"}"
] | Initialize this object for signing. If this method is called
again with a different argument, it negates the effect
of this call.
@param privateKey the private key of the identity whose signature
is going to be generated.
@param random the source of randomness for this signature.
@exception InvalidKeyException if the key is invalid. | [
"Initialize",
"this",
"object",
"for",
"signing",
".",
"If",
"this",
"method",
"is",
"called",
"again",
"with",
"a",
"different",
"argument",
"it",
"negates",
"the",
"effect",
"of",
"this",
"call",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L699-L712 |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/net/URLConnection.java | URLConnection.getHeaderFieldLong | public long getHeaderFieldLong(final String name, final long pdefault) {
"""
Returns the value of the named field parsed as a number.
<p>
This form of {@code getHeaderField} exists because some connection types (e.g., {@code http-ng}
) have pre-parsed headers. Classes for that connection type can override this method and
short-circuit the parsing.
</p>
@param name the name of the header field.
@param pdefault the default value.
@return the value of the named field, parsed as a long. The {@code Default} value is returned
if the field is missing or malformed.
@since 7.0
"""
final String value = this.getHeaderField(name);
try {
return Long.parseLong(value);
} catch (final Exception e) { // NOPMD
}
return pdefault;
} | java | public long getHeaderFieldLong(final String name, final long pdefault) {
final String value = this.getHeaderField(name);
try {
return Long.parseLong(value);
} catch (final Exception e) { // NOPMD
}
return pdefault;
} | [
"public",
"long",
"getHeaderFieldLong",
"(",
"final",
"String",
"name",
",",
"final",
"long",
"pdefault",
")",
"{",
"final",
"String",
"value",
"=",
"this",
".",
"getHeaderField",
"(",
"name",
")",
";",
"try",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"// NOPMD",
"}",
"return",
"pdefault",
";",
"}"
] | Returns the value of the named field parsed as a number.
<p>
This form of {@code getHeaderField} exists because some connection types (e.g., {@code http-ng}
) have pre-parsed headers. Classes for that connection type can override this method and
short-circuit the parsing.
</p>
@param name the name of the header field.
@param pdefault the default value.
@return the value of the named field, parsed as a long. The {@code Default} value is returned
if the field is missing or malformed.
@since 7.0 | [
"Returns",
"the",
"value",
"of",
"the",
"named",
"field",
"parsed",
"as",
"a",
"number",
".",
"<p",
">",
"This",
"form",
"of",
"{",
"@code",
"getHeaderField",
"}",
"exists",
"because",
"some",
"connection",
"types",
"(",
"e",
".",
"g",
".",
"{",
"@code",
"http",
"-",
"ng",
"}",
")",
"have",
"pre",
"-",
"parsed",
"headers",
".",
"Classes",
"for",
"that",
"connection",
"type",
"can",
"override",
"this",
"method",
"and",
"short",
"-",
"circuit",
"the",
"parsing",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/net/URLConnection.java#L471-L478 |
apache/groovy | subprojects/groovy-servlet/src/main/java/groovy/servlet/TemplateServlet.java | TemplateServlet.createAndStoreTemplate | private Template createAndStoreTemplate(String key, InputStream inputStream, File file) throws Exception {
"""
Compile the template and store it in the cache.
@param key a unique key for the template, such as a file's absolutePath or a URL.
@param inputStream an InputStream for the template's source.
@param file a file to be used to determine if the cached template is stale. May be null.
@return the created template.
@throws Exception Any exception when creating the template.
"""
if (verbose) {
log("Creating new template from " + key + "...");
}
Reader reader = null;
try {
String fileEncoding = (fileEncodingParamVal != null) ? fileEncodingParamVal :
System.getProperty(GROOVY_SOURCE_ENCODING);
reader = fileEncoding == null ? new InputStreamReader(inputStream) : new InputStreamReader(inputStream, fileEncoding);
Template template = engine.createTemplate(reader);
cache.put(key, new TemplateCacheEntry(file, template, verbose));
if (verbose) {
log("Created and added template to cache. [key=" + key + "] " + cache.get(key));
}
//
// Last sanity check.
//
if (template == null) {
throw new ServletException("Template is null? Should not happen here!");
}
return template;
} finally {
if (reader != null) {
reader.close();
} else if (inputStream != null) {
inputStream.close();
}
}
} | java | private Template createAndStoreTemplate(String key, InputStream inputStream, File file) throws Exception {
if (verbose) {
log("Creating new template from " + key + "...");
}
Reader reader = null;
try {
String fileEncoding = (fileEncodingParamVal != null) ? fileEncodingParamVal :
System.getProperty(GROOVY_SOURCE_ENCODING);
reader = fileEncoding == null ? new InputStreamReader(inputStream) : new InputStreamReader(inputStream, fileEncoding);
Template template = engine.createTemplate(reader);
cache.put(key, new TemplateCacheEntry(file, template, verbose));
if (verbose) {
log("Created and added template to cache. [key=" + key + "] " + cache.get(key));
}
//
// Last sanity check.
//
if (template == null) {
throw new ServletException("Template is null? Should not happen here!");
}
return template;
} finally {
if (reader != null) {
reader.close();
} else if (inputStream != null) {
inputStream.close();
}
}
} | [
"private",
"Template",
"createAndStoreTemplate",
"(",
"String",
"key",
",",
"InputStream",
"inputStream",
",",
"File",
"file",
")",
"throws",
"Exception",
"{",
"if",
"(",
"verbose",
")",
"{",
"log",
"(",
"\"Creating new template from \"",
"+",
"key",
"+",
"\"...\"",
")",
";",
"}",
"Reader",
"reader",
"=",
"null",
";",
"try",
"{",
"String",
"fileEncoding",
"=",
"(",
"fileEncodingParamVal",
"!=",
"null",
")",
"?",
"fileEncodingParamVal",
":",
"System",
".",
"getProperty",
"(",
"GROOVY_SOURCE_ENCODING",
")",
";",
"reader",
"=",
"fileEncoding",
"==",
"null",
"?",
"new",
"InputStreamReader",
"(",
"inputStream",
")",
":",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"fileEncoding",
")",
";",
"Template",
"template",
"=",
"engine",
".",
"createTemplate",
"(",
"reader",
")",
";",
"cache",
".",
"put",
"(",
"key",
",",
"new",
"TemplateCacheEntry",
"(",
"file",
",",
"template",
",",
"verbose",
")",
")",
";",
"if",
"(",
"verbose",
")",
"{",
"log",
"(",
"\"Created and added template to cache. [key=\"",
"+",
"key",
"+",
"\"] \"",
"+",
"cache",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"//",
"// Last sanity check.",
"//",
"if",
"(",
"template",
"==",
"null",
")",
"{",
"throw",
"new",
"ServletException",
"(",
"\"Template is null? Should not happen here!\"",
")",
";",
"}",
"return",
"template",
";",
"}",
"finally",
"{",
"if",
"(",
"reader",
"!=",
"null",
")",
"{",
"reader",
".",
"close",
"(",
")",
";",
"}",
"else",
"if",
"(",
"inputStream",
"!=",
"null",
")",
"{",
"inputStream",
".",
"close",
"(",
")",
";",
"}",
"}",
"}"
] | Compile the template and store it in the cache.
@param key a unique key for the template, such as a file's absolutePath or a URL.
@param inputStream an InputStream for the template's source.
@param file a file to be used to determine if the cached template is stale. May be null.
@return the created template.
@throws Exception Any exception when creating the template. | [
"Compile",
"the",
"template",
"and",
"store",
"it",
"in",
"the",
"cache",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/TemplateServlet.java#L241-L276 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java | AbstractCodeGen.importLogging | protected void importLogging(Definition def, Writer out) throws IOException {
"""
import logging
@param def definition
@param out Writer
@throws IOException ioException
"""
if (def.isSupportJbossLogging())
{
out.write("import org.jboss.logging.Logger;");
writeEol(out);
writeEol(out);
}
else
{
out.write("import java.util.logging.Logger;");
writeEol(out);
writeEol(out);
}
} | java | protected void importLogging(Definition def, Writer out) throws IOException
{
if (def.isSupportJbossLogging())
{
out.write("import org.jboss.logging.Logger;");
writeEol(out);
writeEol(out);
}
else
{
out.write("import java.util.logging.Logger;");
writeEol(out);
writeEol(out);
}
} | [
"protected",
"void",
"importLogging",
"(",
"Definition",
"def",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"def",
".",
"isSupportJbossLogging",
"(",
")",
")",
"{",
"out",
".",
"write",
"(",
"\"import org.jboss.logging.Logger;\"",
")",
";",
"writeEol",
"(",
"out",
")",
";",
"writeEol",
"(",
"out",
")",
";",
"}",
"else",
"{",
"out",
".",
"write",
"(",
"\"import java.util.logging.Logger;\"",
")",
";",
"writeEol",
"(",
"out",
")",
";",
"writeEol",
"(",
"out",
")",
";",
"}",
"}"
] | import logging
@param def definition
@param out Writer
@throws IOException ioException | [
"import",
"logging"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java#L333-L347 |
apruve/apruve-java | src/main/java/com/apruve/models/SubscriptionAdjustment.java | SubscriptionAdjustment.getAllAdjustments | public static ApruveResponse<List<SubscriptionAdjustment>> getAllAdjustments(
String subscriptionId) {
"""
Get all SubscriptionAdjustments for the specified Subscription.
@param subscriptionId
The ID of the {@link Subscription} that owns the
SubscriptionAdjustment
@see <a
href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a>
@return List of SubscriptionAdjustment
"""
return ApruveClient.getInstance().index(
getSubscriptionAdjustmentsPath(subscriptionId),
new GenericType<List<SubscriptionAdjustment>>() {
});
} | java | public static ApruveResponse<List<SubscriptionAdjustment>> getAllAdjustments(
String subscriptionId) {
return ApruveClient.getInstance().index(
getSubscriptionAdjustmentsPath(subscriptionId),
new GenericType<List<SubscriptionAdjustment>>() {
});
} | [
"public",
"static",
"ApruveResponse",
"<",
"List",
"<",
"SubscriptionAdjustment",
">",
">",
"getAllAdjustments",
"(",
"String",
"subscriptionId",
")",
"{",
"return",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"index",
"(",
"getSubscriptionAdjustmentsPath",
"(",
"subscriptionId",
")",
",",
"new",
"GenericType",
"<",
"List",
"<",
"SubscriptionAdjustment",
">",
">",
"(",
")",
"{",
"}",
")",
";",
"}"
] | Get all SubscriptionAdjustments for the specified Subscription.
@param subscriptionId
The ID of the {@link Subscription} that owns the
SubscriptionAdjustment
@see <a
href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a>
@return List of SubscriptionAdjustment | [
"Get",
"all",
"SubscriptionAdjustments",
"for",
"the",
"specified",
"Subscription",
"."
] | train | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/SubscriptionAdjustment.java#L106-L112 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java | AbstractEventSerializer.parseResource | private Resource parseResource() throws IOException {
"""
Parses a single Resource.
@return a single resource
@throws IOException
"""
//current token is ready consumed by parseResources
if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
throw new JsonParseException("Not a Resource object", jsonParser.getCurrentLocation());
}
Resource resource = new Resource();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
String key = jsonParser.getCurrentName();
switch (key) {
default:
resource.add(key, parseDefaultValue(key));
break;
}
}
return resource;
} | java | private Resource parseResource() throws IOException {
//current token is ready consumed by parseResources
if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
throw new JsonParseException("Not a Resource object", jsonParser.getCurrentLocation());
}
Resource resource = new Resource();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
String key = jsonParser.getCurrentName();
switch (key) {
default:
resource.add(key, parseDefaultValue(key));
break;
}
}
return resource;
} | [
"private",
"Resource",
"parseResource",
"(",
")",
"throws",
"IOException",
"{",
"//current token is ready consumed by parseResources",
"if",
"(",
"jsonParser",
".",
"getCurrentToken",
"(",
")",
"!=",
"JsonToken",
".",
"START_OBJECT",
")",
"{",
"throw",
"new",
"JsonParseException",
"(",
"\"Not a Resource object\"",
",",
"jsonParser",
".",
"getCurrentLocation",
"(",
")",
")",
";",
"}",
"Resource",
"resource",
"=",
"new",
"Resource",
"(",
")",
";",
"while",
"(",
"jsonParser",
".",
"nextToken",
"(",
")",
"!=",
"JsonToken",
".",
"END_OBJECT",
")",
"{",
"String",
"key",
"=",
"jsonParser",
".",
"getCurrentName",
"(",
")",
";",
"switch",
"(",
"key",
")",
"{",
"default",
":",
"resource",
".",
"add",
"(",
"key",
",",
"parseDefaultValue",
"(",
"key",
")",
")",
";",
"break",
";",
"}",
"}",
"return",
"resource",
";",
"}"
] | Parses a single Resource.
@return a single resource
@throws IOException | [
"Parses",
"a",
"single",
"Resource",
"."
] | train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java#L445-L464 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java | DatabasesInner.beginPauseAsync | public Observable<Void> beginPauseAsync(String resourceGroupName, String serverName, String databaseName) {
"""
Pauses a data warehouse.
@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 data warehouse to pause.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginPauseAsync(String resourceGroupName, String serverName, String databaseName) {
return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginPauseAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"beginPauseWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Pauses a data warehouse.
@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 data warehouse to pause.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Pauses",
"a",
"data",
"warehouse",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L271-L278 |
csc19601128/Phynixx | phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/RestartCondition.java | RestartCondition.checkCondition | public boolean checkCondition() {
"""
Not synchronized as to be meant for the watch dog exclusively
Do not call it not synchronized
"""
// assure that the checkinterval is elapsed .....
if (super.checkCondition()) {
return true;
}
if (this.watchdogReference.isStale()) {
return false;
}
Watchdog wd = this.watchdogReference.getWatchdog();
//log.info("Checking "+this+"\n watched WD is alive="+watchedWatchdog.isAlive()+" is killed="+watchedWatchdog.isKilled()+" WD-Thead="+this.watchedWatchdog.getThreadHandle());
if (!wd.isAlive()) {
if (log.isInfoEnabled()) {
String logString = "RestartCondition :: Watchdog " + wd.getThreadHandle() + " is not alive ";
log.info(new CheckConditionFailedLog(this, logString).toString());
}
return false;
}
return true;
} | java | public boolean checkCondition() {
// assure that the checkinterval is elapsed .....
if (super.checkCondition()) {
return true;
}
if (this.watchdogReference.isStale()) {
return false;
}
Watchdog wd = this.watchdogReference.getWatchdog();
//log.info("Checking "+this+"\n watched WD is alive="+watchedWatchdog.isAlive()+" is killed="+watchedWatchdog.isKilled()+" WD-Thead="+this.watchedWatchdog.getThreadHandle());
if (!wd.isAlive()) {
if (log.isInfoEnabled()) {
String logString = "RestartCondition :: Watchdog " + wd.getThreadHandle() + " is not alive ";
log.info(new CheckConditionFailedLog(this, logString).toString());
}
return false;
}
return true;
} | [
"public",
"boolean",
"checkCondition",
"(",
")",
"{",
"// assure that the checkinterval is elapsed .....",
"if",
"(",
"super",
".",
"checkCondition",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"this",
".",
"watchdogReference",
".",
"isStale",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Watchdog",
"wd",
"=",
"this",
".",
"watchdogReference",
".",
"getWatchdog",
"(",
")",
";",
"//log.info(\"Checking \"+this+\"\\n watched WD is alive=\"+watchedWatchdog.isAlive()+\" is killed=\"+watchedWatchdog.isKilled()+\" WD-Thead=\"+this.watchedWatchdog.getThreadHandle());",
"if",
"(",
"!",
"wd",
".",
"isAlive",
"(",
")",
")",
"{",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"String",
"logString",
"=",
"\"RestartCondition :: Watchdog \"",
"+",
"wd",
".",
"getThreadHandle",
"(",
")",
"+",
"\" is not alive \"",
";",
"log",
".",
"info",
"(",
"new",
"CheckConditionFailedLog",
"(",
"this",
",",
"logString",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Not synchronized as to be meant for the watch dog exclusively
Do not call it not synchronized | [
"Not",
"synchronized",
"as",
"to",
"be",
"meant",
"for",
"the",
"watch",
"dog",
"exclusively"
] | train | https://github.com/csc19601128/Phynixx/blob/a26c03bc229a8882c647799834115bec6bdc0ac8/phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/RestartCondition.java#L50-L72 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClient.java | ThriftClient.indexNode | @Override
protected void indexNode(Node node, EntityMetadata entityMetadata) {
"""
Indexes a {@link Node} to database.
@param node
the node
@param entityMetadata
the entity metadata
"""
super.indexNode(node, entityMetadata);
// Write to inverted index table if applicable
invertedIndexHandler.write(node, entityMetadata, getPersistenceUnit(), getConsistencyLevel(), dataHandler);
} | java | @Override
protected void indexNode(Node node, EntityMetadata entityMetadata)
{
super.indexNode(node, entityMetadata);
// Write to inverted index table if applicable
invertedIndexHandler.write(node, entityMetadata, getPersistenceUnit(), getConsistencyLevel(), dataHandler);
} | [
"@",
"Override",
"protected",
"void",
"indexNode",
"(",
"Node",
"node",
",",
"EntityMetadata",
"entityMetadata",
")",
"{",
"super",
".",
"indexNode",
"(",
"node",
",",
"entityMetadata",
")",
";",
"// Write to inverted index table if applicable",
"invertedIndexHandler",
".",
"write",
"(",
"node",
",",
"entityMetadata",
",",
"getPersistenceUnit",
"(",
")",
",",
"getConsistencyLevel",
"(",
")",
",",
"dataHandler",
")",
";",
"}"
] | Indexes a {@link Node} to database.
@param node
the node
@param entityMetadata
the entity metadata | [
"Indexes",
"a",
"{",
"@link",
"Node",
"}",
"to",
"database",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClient.java#L329-L336 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | HadoopUtils.renamePath | public static void renamePath(FileSystem fs, Path oldName, Path newName, boolean overwrite) throws IOException {
"""
A wrapper around {@link FileSystem#rename(Path, Path)} which throws {@link IOException} if
{@link FileSystem#rename(Path, Path)} returns False.
"""
if (!fs.exists(oldName)) {
throw new FileNotFoundException(String.format("Failed to rename %s to %s: src not found", oldName, newName));
}
if (fs.exists(newName)) {
if (overwrite) {
HadoopUtils.moveToTrash(fs, newName);
} else {
throw new FileAlreadyExistsException(
String.format("Failed to rename %s to %s: dst already exists", oldName, newName));
}
}
if (!fs.rename(oldName, newName)) {
throw new IOException(String.format("Failed to rename %s to %s", oldName, newName));
}
} | java | public static void renamePath(FileSystem fs, Path oldName, Path newName, boolean overwrite) throws IOException {
if (!fs.exists(oldName)) {
throw new FileNotFoundException(String.format("Failed to rename %s to %s: src not found", oldName, newName));
}
if (fs.exists(newName)) {
if (overwrite) {
HadoopUtils.moveToTrash(fs, newName);
} else {
throw new FileAlreadyExistsException(
String.format("Failed to rename %s to %s: dst already exists", oldName, newName));
}
}
if (!fs.rename(oldName, newName)) {
throw new IOException(String.format("Failed to rename %s to %s", oldName, newName));
}
} | [
"public",
"static",
"void",
"renamePath",
"(",
"FileSystem",
"fs",
",",
"Path",
"oldName",
",",
"Path",
"newName",
",",
"boolean",
"overwrite",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"fs",
".",
"exists",
"(",
"oldName",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"String",
".",
"format",
"(",
"\"Failed to rename %s to %s: src not found\"",
",",
"oldName",
",",
"newName",
")",
")",
";",
"}",
"if",
"(",
"fs",
".",
"exists",
"(",
"newName",
")",
")",
"{",
"if",
"(",
"overwrite",
")",
"{",
"HadoopUtils",
".",
"moveToTrash",
"(",
"fs",
",",
"newName",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"FileAlreadyExistsException",
"(",
"String",
".",
"format",
"(",
"\"Failed to rename %s to %s: dst already exists\"",
",",
"oldName",
",",
"newName",
")",
")",
";",
"}",
"}",
"if",
"(",
"!",
"fs",
".",
"rename",
"(",
"oldName",
",",
"newName",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"String",
".",
"format",
"(",
"\"Failed to rename %s to %s\"",
",",
"oldName",
",",
"newName",
")",
")",
";",
"}",
"}"
] | A wrapper around {@link FileSystem#rename(Path, Path)} which throws {@link IOException} if
{@link FileSystem#rename(Path, Path)} returns False. | [
"A",
"wrapper",
"around",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L268-L283 |
thinkaurelius/titan | titan-core/src/main/java/com/thinkaurelius/titan/graphdb/database/management/RelationIndexStatusWatcher.java | RelationIndexStatusWatcher.call | @Override
public RelationIndexStatusReport call() throws InterruptedException {
"""
Poll a relation index until it has a certain {@link SchemaStatus},
or until a configurable timeout is exceeded.
@return a report with information about schema state, execution duration, and the index
"""
Preconditions.checkNotNull(g, "Graph instance must not be null");
Preconditions.checkNotNull(relationIndexName, "Index name must not be null");
Preconditions.checkNotNull(status, "Target status must not be null");
RelationTypeIndex idx;
Timer t = new Timer(TimestampProviders.MILLI).start();
boolean timedOut;
while (true) {
SchemaStatus actualStatus = null;
TitanManagement mgmt = null;
try {
mgmt = g.openManagement();
idx = mgmt.getRelationIndex(mgmt.getRelationType(relationTypeName), relationIndexName);
actualStatus = idx.getIndexStatus();
LOGGER.info("Index {} (relation type {}) has status {}", relationIndexName, relationTypeName, actualStatus);
if (status.equals(actualStatus)) {
return new RelationIndexStatusReport(true, relationIndexName, relationTypeName, actualStatus, status, t.elapsed());
}
} finally {
if (null != mgmt)
mgmt.rollback(); // Let an exception here propagate up the stack
}
timedOut = null != timeout && 0 < t.elapsed().compareTo(timeout);
if (timedOut) {
LOGGER.info("Timed out ({}) while waiting for index {} (relation type {}) to reach status {}",
timeout, relationIndexName, relationTypeName, status);
return new RelationIndexStatusReport(false, relationIndexName, relationTypeName, actualStatus, status, t.elapsed());
}
Thread.sleep(poll.toMillis());
}
} | java | @Override
public RelationIndexStatusReport call() throws InterruptedException {
Preconditions.checkNotNull(g, "Graph instance must not be null");
Preconditions.checkNotNull(relationIndexName, "Index name must not be null");
Preconditions.checkNotNull(status, "Target status must not be null");
RelationTypeIndex idx;
Timer t = new Timer(TimestampProviders.MILLI).start();
boolean timedOut;
while (true) {
SchemaStatus actualStatus = null;
TitanManagement mgmt = null;
try {
mgmt = g.openManagement();
idx = mgmt.getRelationIndex(mgmt.getRelationType(relationTypeName), relationIndexName);
actualStatus = idx.getIndexStatus();
LOGGER.info("Index {} (relation type {}) has status {}", relationIndexName, relationTypeName, actualStatus);
if (status.equals(actualStatus)) {
return new RelationIndexStatusReport(true, relationIndexName, relationTypeName, actualStatus, status, t.elapsed());
}
} finally {
if (null != mgmt)
mgmt.rollback(); // Let an exception here propagate up the stack
}
timedOut = null != timeout && 0 < t.elapsed().compareTo(timeout);
if (timedOut) {
LOGGER.info("Timed out ({}) while waiting for index {} (relation type {}) to reach status {}",
timeout, relationIndexName, relationTypeName, status);
return new RelationIndexStatusReport(false, relationIndexName, relationTypeName, actualStatus, status, t.elapsed());
}
Thread.sleep(poll.toMillis());
}
} | [
"@",
"Override",
"public",
"RelationIndexStatusReport",
"call",
"(",
")",
"throws",
"InterruptedException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"g",
",",
"\"Graph instance must not be null\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"relationIndexName",
",",
"\"Index name must not be null\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"status",
",",
"\"Target status must not be null\"",
")",
";",
"RelationTypeIndex",
"idx",
";",
"Timer",
"t",
"=",
"new",
"Timer",
"(",
"TimestampProviders",
".",
"MILLI",
")",
".",
"start",
"(",
")",
";",
"boolean",
"timedOut",
";",
"while",
"(",
"true",
")",
"{",
"SchemaStatus",
"actualStatus",
"=",
"null",
";",
"TitanManagement",
"mgmt",
"=",
"null",
";",
"try",
"{",
"mgmt",
"=",
"g",
".",
"openManagement",
"(",
")",
";",
"idx",
"=",
"mgmt",
".",
"getRelationIndex",
"(",
"mgmt",
".",
"getRelationType",
"(",
"relationTypeName",
")",
",",
"relationIndexName",
")",
";",
"actualStatus",
"=",
"idx",
".",
"getIndexStatus",
"(",
")",
";",
"LOGGER",
".",
"info",
"(",
"\"Index {} (relation type {}) has status {}\"",
",",
"relationIndexName",
",",
"relationTypeName",
",",
"actualStatus",
")",
";",
"if",
"(",
"status",
".",
"equals",
"(",
"actualStatus",
")",
")",
"{",
"return",
"new",
"RelationIndexStatusReport",
"(",
"true",
",",
"relationIndexName",
",",
"relationTypeName",
",",
"actualStatus",
",",
"status",
",",
"t",
".",
"elapsed",
"(",
")",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"null",
"!=",
"mgmt",
")",
"mgmt",
".",
"rollback",
"(",
")",
";",
"// Let an exception here propagate up the stack",
"}",
"timedOut",
"=",
"null",
"!=",
"timeout",
"&&",
"0",
"<",
"t",
".",
"elapsed",
"(",
")",
".",
"compareTo",
"(",
"timeout",
")",
";",
"if",
"(",
"timedOut",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Timed out ({}) while waiting for index {} (relation type {}) to reach status {}\"",
",",
"timeout",
",",
"relationIndexName",
",",
"relationTypeName",
",",
"status",
")",
";",
"return",
"new",
"RelationIndexStatusReport",
"(",
"false",
",",
"relationIndexName",
",",
"relationTypeName",
",",
"actualStatus",
",",
"status",
",",
"t",
".",
"elapsed",
"(",
")",
")",
";",
"}",
"Thread",
".",
"sleep",
"(",
"poll",
".",
"toMillis",
"(",
")",
")",
";",
"}",
"}"
] | Poll a relation index until it has a certain {@link SchemaStatus},
or until a configurable timeout is exceeded.
@return a report with information about schema state, execution duration, and the index | [
"Poll",
"a",
"relation",
"index",
"until",
"it",
"has",
"a",
"certain",
"{",
"@link",
"SchemaStatus",
"}",
"or",
"until",
"a",
"configurable",
"timeout",
"is",
"exceeded",
"."
] | train | https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/graphdb/database/management/RelationIndexStatusWatcher.java#L38-L74 |
samskivert/samskivert | src/main/java/com/samskivert/util/ConfigUtil.java | ConfigUtil.getStream | public static InputStream getStream (String path, ClassLoader loader) {
"""
Returns an input stream referencing a file that exists somewhere in the classpath.
<p> The supplied classloader is searched first, followed by the system classloader.
@param path The path to the file, relative to the root of the classpath directory from which
it will be loaded (e.g. <code>com/foo/bar/foo.gif</code>).
"""
// first try the supplied class loader
InputStream in = getResourceAsStream(path, loader);
if (in != null) {
return in;
}
// if that didn't work, try the system class loader (but only if it's different from the
// class loader we just tried)
try {
ClassLoader sysloader = ClassLoader.getSystemClassLoader();
if (sysloader != loader) {
return getResourceAsStream(path, loader);
}
} catch (AccessControlException ace) {
// can't get the system loader, no problem!
}
return null;
} | java | public static InputStream getStream (String path, ClassLoader loader)
{
// first try the supplied class loader
InputStream in = getResourceAsStream(path, loader);
if (in != null) {
return in;
}
// if that didn't work, try the system class loader (but only if it's different from the
// class loader we just tried)
try {
ClassLoader sysloader = ClassLoader.getSystemClassLoader();
if (sysloader != loader) {
return getResourceAsStream(path, loader);
}
} catch (AccessControlException ace) {
// can't get the system loader, no problem!
}
return null;
} | [
"public",
"static",
"InputStream",
"getStream",
"(",
"String",
"path",
",",
"ClassLoader",
"loader",
")",
"{",
"// first try the supplied class loader",
"InputStream",
"in",
"=",
"getResourceAsStream",
"(",
"path",
",",
"loader",
")",
";",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"return",
"in",
";",
"}",
"// if that didn't work, try the system class loader (but only if it's different from the",
"// class loader we just tried)",
"try",
"{",
"ClassLoader",
"sysloader",
"=",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
";",
"if",
"(",
"sysloader",
"!=",
"loader",
")",
"{",
"return",
"getResourceAsStream",
"(",
"path",
",",
"loader",
")",
";",
"}",
"}",
"catch",
"(",
"AccessControlException",
"ace",
")",
"{",
"// can't get the system loader, no problem!",
"}",
"return",
"null",
";",
"}"
] | Returns an input stream referencing a file that exists somewhere in the classpath.
<p> The supplied classloader is searched first, followed by the system classloader.
@param path The path to the file, relative to the root of the classpath directory from which
it will be loaded (e.g. <code>com/foo/bar/foo.gif</code>). | [
"Returns",
"an",
"input",
"stream",
"referencing",
"a",
"file",
"that",
"exists",
"somewhere",
"in",
"the",
"classpath",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ConfigUtil.java#L484-L503 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java | PtoPInputHandler.reportRepeatedMessages | @Override
public void reportRepeatedMessages(String sourceMEUuid, int percent) {
"""
Report a high proportion of repeated messages being sent from a remote ME (510343)
@param sourceMEUUID
@param percent
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reportRepeatedMessages", new Object[] { sourceMEUuid, new Integer(percent) });
if (_isLink)
{
// "{0} percent repeated messages received from bus {1} on link {2} on messaging engine {3}"
SibTr.info(tc, "REPEATED_MESSAGE_THRESHOLD_REACHED_ON_LINK_CWSIP0794",
new Object[] { new Integer(percent),
((LinkHandler) _destination).getBusName(),
_destination.getName(),
_messageProcessor.getMessagingEngineName() });
}
else
{
// "{0} percent repeated messages received from messaging engine {1} on messaging engine {2} for destination {3}"
SibTr.info(tc, "REPEATED_MESSAGE_THRESHOLD_REACHED_ON_DESTINATION_CWSIP0795",
new Object[] { new Integer(percent),
SIMPUtils.getMENameFromUuid(sourceMEUuid),
_messageProcessor.getMessagingEngineName(),
_destination.getName() });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reportRepeatedMessages");
} | java | @Override
public void reportRepeatedMessages(String sourceMEUuid, int percent)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reportRepeatedMessages", new Object[] { sourceMEUuid, new Integer(percent) });
if (_isLink)
{
// "{0} percent repeated messages received from bus {1} on link {2} on messaging engine {3}"
SibTr.info(tc, "REPEATED_MESSAGE_THRESHOLD_REACHED_ON_LINK_CWSIP0794",
new Object[] { new Integer(percent),
((LinkHandler) _destination).getBusName(),
_destination.getName(),
_messageProcessor.getMessagingEngineName() });
}
else
{
// "{0} percent repeated messages received from messaging engine {1} on messaging engine {2} for destination {3}"
SibTr.info(tc, "REPEATED_MESSAGE_THRESHOLD_REACHED_ON_DESTINATION_CWSIP0795",
new Object[] { new Integer(percent),
SIMPUtils.getMENameFromUuid(sourceMEUuid),
_messageProcessor.getMessagingEngineName(),
_destination.getName() });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reportRepeatedMessages");
} | [
"@",
"Override",
"public",
"void",
"reportRepeatedMessages",
"(",
"String",
"sourceMEUuid",
",",
"int",
"percent",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"reportRepeatedMessages\"",
",",
"new",
"Object",
"[",
"]",
"{",
"sourceMEUuid",
",",
"new",
"Integer",
"(",
"percent",
")",
"}",
")",
";",
"if",
"(",
"_isLink",
")",
"{",
"// \"{0} percent repeated messages received from bus {1} on link {2} on messaging engine {3}\"",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"REPEATED_MESSAGE_THRESHOLD_REACHED_ON_LINK_CWSIP0794\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"percent",
")",
",",
"(",
"(",
"LinkHandler",
")",
"_destination",
")",
".",
"getBusName",
"(",
")",
",",
"_destination",
".",
"getName",
"(",
")",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
")",
";",
"}",
"else",
"{",
"// \"{0} percent repeated messages received from messaging engine {1} on messaging engine {2} for destination {3}\"",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"REPEATED_MESSAGE_THRESHOLD_REACHED_ON_DESTINATION_CWSIP0795\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Integer",
"(",
"percent",
")",
",",
"SIMPUtils",
".",
"getMENameFromUuid",
"(",
"sourceMEUuid",
")",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
",",
"_destination",
".",
"getName",
"(",
")",
"}",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"reportRepeatedMessages\"",
")",
";",
"}"
] | Report a high proportion of repeated messages being sent from a remote ME (510343)
@param sourceMEUUID
@param percent | [
"Report",
"a",
"high",
"proportion",
"of",
"repeated",
"messages",
"being",
"sent",
"from",
"a",
"remote",
"ME",
"(",
"510343",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java#L3573-L3600 |
lessthanoptimal/ejml | examples/src/org/ejml/example/LevenbergMarquardt.java | LevenbergMarquardt.setConvergence | public void setConvergence( int maxIterations , double ftol , double gtol ) {
"""
Specifies convergence criteria
@param maxIterations Maximum number of iterations
@param ftol convergence based on change in function value. try 1e-12
@param gtol convergence based on residual magnitude. Try 1e-12
"""
this.maxIterations = maxIterations;
this.ftol = ftol;
this.gtol = gtol;
} | java | public void setConvergence( int maxIterations , double ftol , double gtol ) {
this.maxIterations = maxIterations;
this.ftol = ftol;
this.gtol = gtol;
} | [
"public",
"void",
"setConvergence",
"(",
"int",
"maxIterations",
",",
"double",
"ftol",
",",
"double",
"gtol",
")",
"{",
"this",
".",
"maxIterations",
"=",
"maxIterations",
";",
"this",
".",
"ftol",
"=",
"ftol",
";",
"this",
".",
"gtol",
"=",
"gtol",
";",
"}"
] | Specifies convergence criteria
@param maxIterations Maximum number of iterations
@param ftol convergence based on change in function value. try 1e-12
@param gtol convergence based on residual magnitude. Try 1e-12 | [
"Specifies",
"convergence",
"criteria"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/LevenbergMarquardt.java#L107-L111 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java | FileDataServlet.doGet | public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException {
"""
Service a GET request as described below.
Request:
{@code
GET http://<nn>:<port>/data[/<path>] HTTP/1.1
}
"""
NameNode.getNameNodeMetrics().numFileDataServletDoGet.inc();
final UnixUserGroupInformation ugi = getUGI(request);
final ClientProtocol nnproxy = createNameNodeProxy(ugi);
try {
final String path = request.getPathInfo() != null
? request.getPathInfo() : "/";
FileStatus info = nnproxy.getFileInfo(path);
if ((info != null) && !info.isDir()) {
response.sendRedirect(createUri(info, ugi, nnproxy,
request).toURL().toString());
} else if (info == null){
response.sendError(400, "cat: File not found " + path);
} else {
response.sendError(400, "cat: " + path + ": is a directory");
}
} catch (URISyntaxException e) {
response.getWriter().println(e.toString());
} catch (IOException e) {
response.sendError(400, e.getMessage());
}
} | java | public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException {
NameNode.getNameNodeMetrics().numFileDataServletDoGet.inc();
final UnixUserGroupInformation ugi = getUGI(request);
final ClientProtocol nnproxy = createNameNodeProxy(ugi);
try {
final String path = request.getPathInfo() != null
? request.getPathInfo() : "/";
FileStatus info = nnproxy.getFileInfo(path);
if ((info != null) && !info.isDir()) {
response.sendRedirect(createUri(info, ugi, nnproxy,
request).toURL().toString());
} else if (info == null){
response.sendError(400, "cat: File not found " + path);
} else {
response.sendError(400, "cat: " + path + ": is a directory");
}
} catch (URISyntaxException e) {
response.getWriter().println(e.toString());
} catch (IOException e) {
response.sendError(400, e.getMessage());
}
} | [
"public",
"void",
"doGet",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"NameNode",
".",
"getNameNodeMetrics",
"(",
")",
".",
"numFileDataServletDoGet",
".",
"inc",
"(",
")",
";",
"final",
"UnixUserGroupInformation",
"ugi",
"=",
"getUGI",
"(",
"request",
")",
";",
"final",
"ClientProtocol",
"nnproxy",
"=",
"createNameNodeProxy",
"(",
"ugi",
")",
";",
"try",
"{",
"final",
"String",
"path",
"=",
"request",
".",
"getPathInfo",
"(",
")",
"!=",
"null",
"?",
"request",
".",
"getPathInfo",
"(",
")",
":",
"\"/\"",
";",
"FileStatus",
"info",
"=",
"nnproxy",
".",
"getFileInfo",
"(",
"path",
")",
";",
"if",
"(",
"(",
"info",
"!=",
"null",
")",
"&&",
"!",
"info",
".",
"isDir",
"(",
")",
")",
"{",
"response",
".",
"sendRedirect",
"(",
"createUri",
"(",
"info",
",",
"ugi",
",",
"nnproxy",
",",
"request",
")",
".",
"toURL",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"response",
".",
"sendError",
"(",
"400",
",",
"\"cat: File not found \"",
"+",
"path",
")",
";",
"}",
"else",
"{",
"response",
".",
"sendError",
"(",
"400",
",",
"\"cat: \"",
"+",
"path",
"+",
"\": is a directory\"",
")",
";",
"}",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"response",
".",
"getWriter",
"(",
")",
".",
"println",
"(",
"e",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"response",
".",
"sendError",
"(",
"400",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Service a GET request as described below.
Request:
{@code
GET http://<nn>:<port>/data[/<path>] HTTP/1.1
} | [
"Service",
"a",
"GET",
"request",
"as",
"described",
"below",
".",
"Request",
":",
"{"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FileDataServlet.java#L77-L100 |
Coveros/selenified | src/main/java/com/coveros/selenified/application/WaitFor.java | WaitFor.titleMatches | public void titleMatches(double seconds, String expectedTitle) {
"""
Waits up to the default wait time (5 seconds unless changed) for the provided title matches the actual title of the current page
the application is on. This information will be logged and recorded, with
a screenshot for traceability and added debugging support.
@param seconds the number of seconds to wait
@param expectedTitle - the title to wait for
"""
double end = System.currentTimeMillis() + (seconds * 1000);
while (!app.get().title().matches(expectedTitle) && System.currentTimeMillis() < end) ;
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkTitleMatches(expectedTitle, seconds, timeTook);
} | java | public void titleMatches(double seconds, String expectedTitle) {
double end = System.currentTimeMillis() + (seconds * 1000);
while (!app.get().title().matches(expectedTitle) && System.currentTimeMillis() < end) ;
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkTitleMatches(expectedTitle, seconds, timeTook);
} | [
"public",
"void",
"titleMatches",
"(",
"double",
"seconds",
",",
"String",
"expectedTitle",
")",
"{",
"double",
"end",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"(",
"seconds",
"*",
"1000",
")",
";",
"while",
"(",
"!",
"app",
".",
"get",
"(",
")",
".",
"title",
"(",
")",
".",
"matches",
"(",
"expectedTitle",
")",
"&&",
"System",
".",
"currentTimeMillis",
"(",
")",
"<",
"end",
")",
";",
"double",
"timeTook",
"=",
"Math",
".",
"min",
"(",
"(",
"seconds",
"*",
"1000",
")",
"-",
"(",
"end",
"-",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
",",
"seconds",
"*",
"1000",
")",
"/",
"1000",
";",
"checkTitleMatches",
"(",
"expectedTitle",
",",
"seconds",
",",
"timeTook",
")",
";",
"}"
] | Waits up to the default wait time (5 seconds unless changed) for the provided title matches the actual title of the current page
the application is on. This information will be logged and recorded, with
a screenshot for traceability and added debugging support.
@param seconds the number of seconds to wait
@param expectedTitle - the title to wait for | [
"Waits",
"up",
"to",
"the",
"default",
"wait",
"time",
"(",
"5",
"seconds",
"unless",
"changed",
")",
"for",
"the",
"provided",
"title",
"matches",
"the",
"actual",
"title",
"of",
"the",
"current",
"page",
"the",
"application",
"is",
"on",
".",
"This",
"information",
"will",
"be",
"logged",
"and",
"recorded",
"with",
"a",
"screenshot",
"for",
"traceability",
"and",
"added",
"debugging",
"support",
"."
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L388-L393 |
PureSolTechnologies/graphs | trees/src/main/java/com/puresoltechnologies/graphs/trees/RedBlackTree.java | RedBlackTree.size | public int size(Key low, Key high) {
"""
Returns the number of keys in the symbol table in the given range.
@param low
is the lower border.
@param high
is the upper border.
@return the number of keys in the symbol table between <code>low</code>
(inclusive) and <code>high</code> (exclusive)
"""
if (low.compareTo(high) > 0)
return 0;
if (contains(high))
return rank(high) - rank(low) + 1;
else
return rank(high) - rank(low);
} | java | public int size(Key low, Key high) {
if (low.compareTo(high) > 0)
return 0;
if (contains(high))
return rank(high) - rank(low) + 1;
else
return rank(high) - rank(low);
} | [
"public",
"int",
"size",
"(",
"Key",
"low",
",",
"Key",
"high",
")",
"{",
"if",
"(",
"low",
".",
"compareTo",
"(",
"high",
")",
">",
"0",
")",
"return",
"0",
";",
"if",
"(",
"contains",
"(",
"high",
")",
")",
"return",
"rank",
"(",
"high",
")",
"-",
"rank",
"(",
"low",
")",
"+",
"1",
";",
"else",
"return",
"rank",
"(",
"high",
")",
"-",
"rank",
"(",
"low",
")",
";",
"}"
] | Returns the number of keys in the symbol table in the given range.
@param low
is the lower border.
@param high
is the upper border.
@return the number of keys in the symbol table between <code>low</code>
(inclusive) and <code>high</code> (exclusive) | [
"Returns",
"the",
"number",
"of",
"keys",
"in",
"the",
"symbol",
"table",
"in",
"the",
"given",
"range",
"."
] | train | https://github.com/PureSolTechnologies/graphs/blob/35dbbd11ccaacbbc6321dcdcd4d31e9a1090d6f1/trees/src/main/java/com/puresoltechnologies/graphs/trees/RedBlackTree.java#L632-L639 |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/utils/ByteHelper.java | ByteHelper.readUnsignedIntLittleEndian | public static long readUnsignedIntLittleEndian(byte[] data, int index) {
"""
Read 4 bytes in Little-endian byte order.
@param data, the original byte array
@param index, start to read from.
@return
"""
long result = (long) (data[index] & 0xFF) | (long) ((data[index + 1] & 0xFF) << 8)
| (long) ((data[index + 2] & 0xFF) << 16) | (long) ((data[index + 3] & 0xFF) << 24);
return result;
} | java | public static long readUnsignedIntLittleEndian(byte[] data, int index) {
long result = (long) (data[index] & 0xFF) | (long) ((data[index + 1] & 0xFF) << 8)
| (long) ((data[index + 2] & 0xFF) << 16) | (long) ((data[index + 3] & 0xFF) << 24);
return result;
} | [
"public",
"static",
"long",
"readUnsignedIntLittleEndian",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"index",
")",
"{",
"long",
"result",
"=",
"(",
"long",
")",
"(",
"data",
"[",
"index",
"]",
"&",
"0xFF",
")",
"|",
"(",
"long",
")",
"(",
"(",
"data",
"[",
"index",
"+",
"1",
"]",
"&",
"0xFF",
")",
"<<",
"8",
")",
"|",
"(",
"long",
")",
"(",
"(",
"data",
"[",
"index",
"+",
"2",
"]",
"&",
"0xFF",
")",
"<<",
"16",
")",
"|",
"(",
"long",
")",
"(",
"(",
"data",
"[",
"index",
"+",
"3",
"]",
"&",
"0xFF",
")",
"<<",
"24",
")",
";",
"return",
"result",
";",
"}"
] | Read 4 bytes in Little-endian byte order.
@param data, the original byte array
@param index, start to read from.
@return | [
"Read",
"4",
"bytes",
"in",
"Little",
"-",
"endian",
"byte",
"order",
"."
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/utils/ByteHelper.java#L45-L49 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java | NodeSetDTM.setItem | public void setItem(int node, int index) {
"""
Same as setElementAt.
@param node The node to be set.
@param index The index of the node to be replaced.
@throws RuntimeException thrown if this NodeSetDTM is not of
a mutable type.
"""
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");
super.setElementAt(node, index);
} | java | public void setItem(int node, int index)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");
super.setElementAt(node, index);
} | [
"public",
"void",
"setItem",
"(",
"int",
"node",
",",
"int",
"index",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESETDTM_NOT_MUTABLE",
",",
"null",
")",
")",
";",
"//\"This NodeSetDTM is not mutable!\");",
"super",
".",
"setElementAt",
"(",
"node",
",",
"index",
")",
";",
"}"
] | Same as setElementAt.
@param node The node to be set.
@param index The index of the node to be replaced.
@throws RuntimeException thrown if this NodeSetDTM is not of
a mutable type. | [
"Same",
"as",
"setElementAt",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L1025-L1032 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/slave/ModbusSlaveFactory.java | ModbusSlaveFactory.createUDPSlave | public static synchronized ModbusSlave createUDPSlave(InetAddress address, int port) throws ModbusException {
"""
Creates a UDP modbus slave or returns the one already allocated to this port
@param address IP address to listen on
@param port Port to listen on
@return new or existing UDP modbus slave associated with the port
@throws ModbusException If a problem occurs e.g. port already in use
"""
String key = ModbusSlaveType.UDP.getKey(port);
if (slaves.containsKey(key)) {
return slaves.get(key);
}
else {
ModbusSlave slave = new ModbusSlave(address, port, false);
slaves.put(key, slave);
return slave;
}
} | java | public static synchronized ModbusSlave createUDPSlave(InetAddress address, int port) throws ModbusException {
String key = ModbusSlaveType.UDP.getKey(port);
if (slaves.containsKey(key)) {
return slaves.get(key);
}
else {
ModbusSlave slave = new ModbusSlave(address, port, false);
slaves.put(key, slave);
return slave;
}
} | [
"public",
"static",
"synchronized",
"ModbusSlave",
"createUDPSlave",
"(",
"InetAddress",
"address",
",",
"int",
"port",
")",
"throws",
"ModbusException",
"{",
"String",
"key",
"=",
"ModbusSlaveType",
".",
"UDP",
".",
"getKey",
"(",
"port",
")",
";",
"if",
"(",
"slaves",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
"slaves",
".",
"get",
"(",
"key",
")",
";",
"}",
"else",
"{",
"ModbusSlave",
"slave",
"=",
"new",
"ModbusSlave",
"(",
"address",
",",
"port",
",",
"false",
")",
";",
"slaves",
".",
"put",
"(",
"key",
",",
"slave",
")",
";",
"return",
"slave",
";",
"}",
"}"
] | Creates a UDP modbus slave or returns the one already allocated to this port
@param address IP address to listen on
@param port Port to listen on
@return new or existing UDP modbus slave associated with the port
@throws ModbusException If a problem occurs e.g. port already in use | [
"Creates",
"a",
"UDP",
"modbus",
"slave",
"or",
"returns",
"the",
"one",
"already",
"allocated",
"to",
"this",
"port"
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/slave/ModbusSlaveFactory.java#L114-L124 |
likethecolor/Alchemy-API | src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java | AbstractParser.getLong | protected Long getLong(final String key, final JSONObject jsonObject) {
"""
Check to make sure the JSONObject has the specified key and if so return
the value as a long. If no key is found null is returned.
@param key name of the field to fetch from the json object
@param jsonObject object from which to fetch the value
@return long value corresponding to the key or null if key not found
"""
Long value = null;
if(hasKey(key, jsonObject)) {
try {
value = jsonObject.getLong(key);
}
catch(JSONException e) {
LOGGER.error("Could not get Long from JSONObject for key: " + key, e);
}
}
return value;
} | java | protected Long getLong(final String key, final JSONObject jsonObject) {
Long value = null;
if(hasKey(key, jsonObject)) {
try {
value = jsonObject.getLong(key);
}
catch(JSONException e) {
LOGGER.error("Could not get Long from JSONObject for key: " + key, e);
}
}
return value;
} | [
"protected",
"Long",
"getLong",
"(",
"final",
"String",
"key",
",",
"final",
"JSONObject",
"jsonObject",
")",
"{",
"Long",
"value",
"=",
"null",
";",
"if",
"(",
"hasKey",
"(",
"key",
",",
"jsonObject",
")",
")",
"{",
"try",
"{",
"value",
"=",
"jsonObject",
".",
"getLong",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Could not get Long from JSONObject for key: \"",
"+",
"key",
",",
"e",
")",
";",
"}",
"}",
"return",
"value",
";",
"}"
] | Check to make sure the JSONObject has the specified key and if so return
the value as a long. If no key is found null is returned.
@param key name of the field to fetch from the json object
@param jsonObject object from which to fetch the value
@return long value corresponding to the key or null if key not found | [
"Check",
"to",
"make",
"sure",
"the",
"JSONObject",
"has",
"the",
"specified",
"key",
"and",
"if",
"so",
"return",
"the",
"value",
"as",
"a",
"long",
".",
"If",
"no",
"key",
"is",
"found",
"null",
"is",
"returned",
"."
] | train | https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java#L186-L197 |
uber/AutoDispose | android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/AndroidLifecycleScopeProvider.java | AndroidLifecycleScopeProvider.from | public static AndroidLifecycleScopeProvider from(
Lifecycle lifecycle, Lifecycle.Event untilEvent) {
"""
Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles.
@param lifecycle the lifecycle to scope for.
@param untilEvent the event until the scope is valid.
@return a {@link AndroidLifecycleScopeProvider} against this lifecycle.
"""
return from(lifecycle, new UntilEventFunction(untilEvent));
} | java | public static AndroidLifecycleScopeProvider from(
Lifecycle lifecycle, Lifecycle.Event untilEvent) {
return from(lifecycle, new UntilEventFunction(untilEvent));
} | [
"public",
"static",
"AndroidLifecycleScopeProvider",
"from",
"(",
"Lifecycle",
"lifecycle",
",",
"Lifecycle",
".",
"Event",
"untilEvent",
")",
"{",
"return",
"from",
"(",
"lifecycle",
",",
"new",
"UntilEventFunction",
"(",
"untilEvent",
")",
")",
";",
"}"
] | Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles.
@param lifecycle the lifecycle to scope for.
@param untilEvent the event until the scope is valid.
@return a {@link AndroidLifecycleScopeProvider} against this lifecycle. | [
"Creates",
"a",
"{",
"@link",
"AndroidLifecycleScopeProvider",
"}",
"for",
"Android",
"Lifecycles",
"."
] | train | https://github.com/uber/AutoDispose/blob/1115b0274f7960354289bb3ae7ba75b0c5a47457/android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/AndroidLifecycleScopeProvider.java#L100-L103 |
jMotif/SAX | src/main/java/net/seninp/jmotif/sax/SAXProcessor.java | SAXProcessor.ts2saxByChunking | public SAXRecords ts2saxByChunking(double[] ts, int paaSize, double[] cuts, double nThreshold)
throws SAXException {
"""
Converts the input time series into a SAX data structure via chunking and Z normalization.
@param ts the input data.
@param paaSize the PAA size.
@param cuts the Alphabet cuts.
@param nThreshold the normalization threshold value.
@return SAX representation of the time series.
@throws SAXException if error occurs.
"""
SAXRecords saxFrequencyData = new SAXRecords();
// Z normalize it
double[] normalizedTS = tsProcessor.znorm(ts, nThreshold);
// perform PAA conversion if needed
double[] paa = tsProcessor.paa(normalizedTS, paaSize);
// Convert the PAA to a string.
char[] currentString = tsProcessor.ts2String(paa, cuts);
// create the datastructure
for (int i = 0; i < currentString.length; i++) {
char c = currentString[i];
int pos = (int) Math.floor(i * ts.length / currentString.length);
saxFrequencyData.add(String.valueOf(c).toCharArray(), pos);
}
return saxFrequencyData;
} | java | public SAXRecords ts2saxByChunking(double[] ts, int paaSize, double[] cuts, double nThreshold)
throws SAXException {
SAXRecords saxFrequencyData = new SAXRecords();
// Z normalize it
double[] normalizedTS = tsProcessor.znorm(ts, nThreshold);
// perform PAA conversion if needed
double[] paa = tsProcessor.paa(normalizedTS, paaSize);
// Convert the PAA to a string.
char[] currentString = tsProcessor.ts2String(paa, cuts);
// create the datastructure
for (int i = 0; i < currentString.length; i++) {
char c = currentString[i];
int pos = (int) Math.floor(i * ts.length / currentString.length);
saxFrequencyData.add(String.valueOf(c).toCharArray(), pos);
}
return saxFrequencyData;
} | [
"public",
"SAXRecords",
"ts2saxByChunking",
"(",
"double",
"[",
"]",
"ts",
",",
"int",
"paaSize",
",",
"double",
"[",
"]",
"cuts",
",",
"double",
"nThreshold",
")",
"throws",
"SAXException",
"{",
"SAXRecords",
"saxFrequencyData",
"=",
"new",
"SAXRecords",
"(",
")",
";",
"// Z normalize it\r",
"double",
"[",
"]",
"normalizedTS",
"=",
"tsProcessor",
".",
"znorm",
"(",
"ts",
",",
"nThreshold",
")",
";",
"// perform PAA conversion if needed\r",
"double",
"[",
"]",
"paa",
"=",
"tsProcessor",
".",
"paa",
"(",
"normalizedTS",
",",
"paaSize",
")",
";",
"// Convert the PAA to a string.\r",
"char",
"[",
"]",
"currentString",
"=",
"tsProcessor",
".",
"ts2String",
"(",
"paa",
",",
"cuts",
")",
";",
"// create the datastructure\r",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"currentString",
".",
"length",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"currentString",
"[",
"i",
"]",
";",
"int",
"pos",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"i",
"*",
"ts",
".",
"length",
"/",
"currentString",
".",
"length",
")",
";",
"saxFrequencyData",
".",
"add",
"(",
"String",
".",
"valueOf",
"(",
"c",
")",
".",
"toCharArray",
"(",
")",
",",
"pos",
")",
";",
"}",
"return",
"saxFrequencyData",
";",
"}"
] | Converts the input time series into a SAX data structure via chunking and Z normalization.
@param ts the input data.
@param paaSize the PAA size.
@param cuts the Alphabet cuts.
@param nThreshold the normalization threshold value.
@return SAX representation of the time series.
@throws SAXException if error occurs. | [
"Converts",
"the",
"input",
"time",
"series",
"into",
"a",
"SAX",
"data",
"structure",
"via",
"chunking",
"and",
"Z",
"normalization",
"."
] | train | https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/SAXProcessor.java#L73-L96 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/SentryClient.java | SentryClient.setTags | public void setTags(Map<String, String> tags) {
"""
Set the tags that will be sent with all future {@link Event}s.
@param tags Map of tags
"""
if (tags == null) {
this.tags = new HashMap<>();
} else {
this.tags = tags;
}
} | java | public void setTags(Map<String, String> tags) {
if (tags == null) {
this.tags = new HashMap<>();
} else {
this.tags = tags;
}
} | [
"public",
"void",
"setTags",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"if",
"(",
"tags",
"==",
"null",
")",
"{",
"this",
".",
"tags",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"tags",
"=",
"tags",
";",
"}",
"}"
] | Set the tags that will be sent with all future {@link Event}s.
@param tags Map of tags | [
"Set",
"the",
"tags",
"that",
"will",
"be",
"sent",
"with",
"all",
"future",
"{",
"@link",
"Event",
"}",
"s",
"."
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/SentryClient.java#L315-L321 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java | DatabasesInner.listMetrics | public List<MetricInner> listMetrics(String resourceGroupName, String serverName, String databaseName, String filter) {
"""
Returns database metrics.
@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.
@param filter An OData filter expression that describes a subset of metrics to return.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<MetricInner> object if successful.
"""
return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter).toBlocking().single().body();
} | java | public List<MetricInner> listMetrics(String resourceGroupName, String serverName, String databaseName, String filter) {
return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"MetricInner",
">",
"listMetrics",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"filter",
")",
"{",
"return",
"listMetricsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseName",
",",
"filter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Returns database metrics.
@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.
@param filter An OData filter expression that describes a subset of metrics to return.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<MetricInner> object if successful. | [
"Returns",
"database",
"metrics",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L2284-L2286 |
cloudfoundry-community/cf-java-component | cf-spring/src/main/java/cf/spring/servicebroker/AccessorUtils.java | AccessorUtils.findMethodWithAnnotation | public static <T extends Annotation> Method findMethodWithAnnotation(Class<?> clazz, Class<T> annotationType) {
"""
Finds a method annotated with the specified annotation. This method can
be defined in the specified class, or one of its parents.
@return the matching method, or <tt>null</tt> if any
"""
Method annotatedMethod = null;
for (Method method : clazz.getDeclaredMethods()) {
T annotation = AnnotationUtils.findAnnotation(method, annotationType);
if (annotation != null) {
if (annotatedMethod != null) {
throw new BeanCreationException("Only ONE method with @" + annotationType.getName()
+ " is allowed on " + clazz.getName() + ".");
}
annotatedMethod = method;
}
}
if((annotatedMethod != null) || clazz.equals(Object.class)){
return annotatedMethod;
} else {
return findMethodWithAnnotation(clazz.getSuperclass(), annotationType);
}
} | java | public static <T extends Annotation> Method findMethodWithAnnotation(Class<?> clazz, Class<T> annotationType) {
Method annotatedMethod = null;
for (Method method : clazz.getDeclaredMethods()) {
T annotation = AnnotationUtils.findAnnotation(method, annotationType);
if (annotation != null) {
if (annotatedMethod != null) {
throw new BeanCreationException("Only ONE method with @" + annotationType.getName()
+ " is allowed on " + clazz.getName() + ".");
}
annotatedMethod = method;
}
}
if((annotatedMethod != null) || clazz.equals(Object.class)){
return annotatedMethod;
} else {
return findMethodWithAnnotation(clazz.getSuperclass(), annotationType);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"Method",
"findMethodWithAnnotation",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"T",
">",
"annotationType",
")",
"{",
"Method",
"annotatedMethod",
"=",
"null",
";",
"for",
"(",
"Method",
"method",
":",
"clazz",
".",
"getDeclaredMethods",
"(",
")",
")",
"{",
"T",
"annotation",
"=",
"AnnotationUtils",
".",
"findAnnotation",
"(",
"method",
",",
"annotationType",
")",
";",
"if",
"(",
"annotation",
"!=",
"null",
")",
"{",
"if",
"(",
"annotatedMethod",
"!=",
"null",
")",
"{",
"throw",
"new",
"BeanCreationException",
"(",
"\"Only ONE method with @\"",
"+",
"annotationType",
".",
"getName",
"(",
")",
"+",
"\" is allowed on \"",
"+",
"clazz",
".",
"getName",
"(",
")",
"+",
"\".\"",
")",
";",
"}",
"annotatedMethod",
"=",
"method",
";",
"}",
"}",
"if",
"(",
"(",
"annotatedMethod",
"!=",
"null",
")",
"||",
"clazz",
".",
"equals",
"(",
"Object",
".",
"class",
")",
")",
"{",
"return",
"annotatedMethod",
";",
"}",
"else",
"{",
"return",
"findMethodWithAnnotation",
"(",
"clazz",
".",
"getSuperclass",
"(",
")",
",",
"annotationType",
")",
";",
"}",
"}"
] | Finds a method annotated with the specified annotation. This method can
be defined in the specified class, or one of its parents.
@return the matching method, or <tt>null</tt> if any | [
"Finds",
"a",
"method",
"annotated",
"with",
"the",
"specified",
"annotation",
".",
"This",
"method",
"can",
"be",
"defined",
"in",
"the",
"specified",
"class",
"or",
"one",
"of",
"its",
"parents",
"."
] | train | https://github.com/cloudfoundry-community/cf-java-component/blob/9d7d54f2b599f3e4f4706bc0c471e144065671fa/cf-spring/src/main/java/cf/spring/servicebroker/AccessorUtils.java#L43-L61 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/Neighbour.java | Neighbour.getSubscription | protected MESubscription getSubscription(SIBUuid12 topicSpace, String topic) {
"""
Gets the MESubscription represented from this topicSpace and topic
@param topicSpace
@param topic
@return MESubscription representing this topicSpace/topic
"""
return (MESubscription)iProxies.get(BusGroup.subscriptionKey(topicSpace, topic));
} | java | protected MESubscription getSubscription(SIBUuid12 topicSpace, String topic)
{
return (MESubscription)iProxies.get(BusGroup.subscriptionKey(topicSpace, topic));
} | [
"protected",
"MESubscription",
"getSubscription",
"(",
"SIBUuid12",
"topicSpace",
",",
"String",
"topic",
")",
"{",
"return",
"(",
"MESubscription",
")",
"iProxies",
".",
"get",
"(",
"BusGroup",
".",
"subscriptionKey",
"(",
"topicSpace",
",",
"topic",
")",
")",
";",
"}"
] | Gets the MESubscription represented from this topicSpace and topic
@param topicSpace
@param topic
@return MESubscription representing this topicSpace/topic | [
"Gets",
"the",
"MESubscription",
"represented",
"from",
"this",
"topicSpace",
"and",
"topic"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/Neighbour.java#L699-L702 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.isLessOrEqual | public static boolean isLessOrEqual(BigDecimal bigNum1, BigDecimal bigNum2) {
"""
比较大小,参数1<=参数2 返回true
@param bigNum1 数字1
@param bigNum2 数字2
@return 是否小于等于
@since 3,0.9
"""
Assert.notNull(bigNum1);
Assert.notNull(bigNum2);
return bigNum1.compareTo(bigNum2) <= 0;
} | java | public static boolean isLessOrEqual(BigDecimal bigNum1, BigDecimal bigNum2) {
Assert.notNull(bigNum1);
Assert.notNull(bigNum2);
return bigNum1.compareTo(bigNum2) <= 0;
} | [
"public",
"static",
"boolean",
"isLessOrEqual",
"(",
"BigDecimal",
"bigNum1",
",",
"BigDecimal",
"bigNum2",
")",
"{",
"Assert",
".",
"notNull",
"(",
"bigNum1",
")",
";",
"Assert",
".",
"notNull",
"(",
"bigNum2",
")",
";",
"return",
"bigNum1",
".",
"compareTo",
"(",
"bigNum2",
")",
"<=",
"0",
";",
"}"
] | 比较大小,参数1<=参数2 返回true
@param bigNum1 数字1
@param bigNum2 数字2
@return 是否小于等于
@since 3,0.9 | [
"比较大小,参数1<",
";",
"=",
"参数2",
"返回true"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1664-L1668 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/Step.java | Step.clickOn | protected void clickOn(PageElement toClick, Object... args) throws TechnicalException, FailureException {
"""
Click on html element.
@param toClick
html element
@param args
list of arguments to format the found selector with
@throws TechnicalException
is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK} message (with screenshot, with exception)
@throws FailureException
if the scenario encounters a functional error
"""
displayMessageAtTheBeginningOfMethod("clickOn: %s in %s", toClick.toString(), toClick.getPage().getApplication());
try {
Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(toClick, args))).click();
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK), toClick, toClick.getPage().getApplication()), true,
toClick.getPage().getCallBack());
}
} | java | protected void clickOn(PageElement toClick, Object... args) throws TechnicalException, FailureException {
displayMessageAtTheBeginningOfMethod("clickOn: %s in %s", toClick.toString(), toClick.getPage().getApplication());
try {
Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(toClick, args))).click();
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK), toClick, toClick.getPage().getApplication()), true,
toClick.getPage().getCallBack());
}
} | [
"protected",
"void",
"clickOn",
"(",
"PageElement",
"toClick",
",",
"Object",
"...",
"args",
")",
"throws",
"TechnicalException",
",",
"FailureException",
"{",
"displayMessageAtTheBeginningOfMethod",
"(",
"\"clickOn: %s in %s\"",
",",
"toClick",
".",
"toString",
"(",
")",
",",
"toClick",
".",
"getPage",
"(",
")",
".",
"getApplication",
"(",
")",
")",
";",
"try",
"{",
"Context",
".",
"waitUntil",
"(",
"ExpectedConditions",
".",
"elementToBeClickable",
"(",
"Utilities",
".",
"getLocator",
"(",
"toClick",
",",
"args",
")",
")",
")",
".",
"click",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"new",
"Result",
".",
"Failure",
"<>",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"Messages",
".",
"format",
"(",
"Messages",
".",
"getMessage",
"(",
"Messages",
".",
"FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK",
")",
",",
"toClick",
",",
"toClick",
".",
"getPage",
"(",
")",
".",
"getApplication",
"(",
")",
")",
",",
"true",
",",
"toClick",
".",
"getPage",
"(",
")",
".",
"getCallBack",
"(",
")",
")",
";",
"}",
"}"
] | Click on html element.
@param toClick
html element
@param args
list of arguments to format the found selector with
@throws TechnicalException
is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK} message (with screenshot, with exception)
@throws FailureException
if the scenario encounters a functional error | [
"Click",
"on",
"html",
"element",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L113-L121 |
leancloud/java-sdk-all | android-sdk/storage-android/src/main/java/cn/leancloud/AVManifestUtils.java | AVManifestUtils.checkService | public static boolean checkService(Context context, Class<?> service) {
"""
判断 Mainifest 中是否包含对应到 Service
如有,则返回 true,反之,则返回 false 并输出日志
@param context
@param service
@return
"""
try {
ServiceInfo info = context.getPackageManager().getServiceInfo(
new ComponentName(context, service), 0);
return null != info;
} catch (PackageManager.NameNotFoundException e) {
printErrorLog("service " + service.getName() + " is missing!");
return false;
}
} | java | public static boolean checkService(Context context, Class<?> service) {
try {
ServiceInfo info = context.getPackageManager().getServiceInfo(
new ComponentName(context, service), 0);
return null != info;
} catch (PackageManager.NameNotFoundException e) {
printErrorLog("service " + service.getName() + " is missing!");
return false;
}
} | [
"public",
"static",
"boolean",
"checkService",
"(",
"Context",
"context",
",",
"Class",
"<",
"?",
">",
"service",
")",
"{",
"try",
"{",
"ServiceInfo",
"info",
"=",
"context",
".",
"getPackageManager",
"(",
")",
".",
"getServiceInfo",
"(",
"new",
"ComponentName",
"(",
"context",
",",
"service",
")",
",",
"0",
")",
";",
"return",
"null",
"!=",
"info",
";",
"}",
"catch",
"(",
"PackageManager",
".",
"NameNotFoundException",
"e",
")",
"{",
"printErrorLog",
"(",
"\"service \"",
"+",
"service",
".",
"getName",
"(",
")",
"+",
"\" is missing!\"",
")",
";",
"return",
"false",
";",
"}",
"}"
] | 判断 Mainifest 中是否包含对应到 Service
如有,则返回 true,反之,则返回 false 并输出日志
@param context
@param service
@return | [
"判断",
"Mainifest",
"中是否包含对应到",
"Service",
"如有,则返回",
"true,反之,则返回",
"false",
"并输出日志"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/storage-android/src/main/java/cn/leancloud/AVManifestUtils.java#L45-L54 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/LowerTriangPackMatrix.java | LowerTriangPackMatrix.getIndex | int getIndex(int row, int column) {
"""
Checks the row and column indices, and returns the linear data index
"""
check(row, column);
return row + (2 * n - (column + 1)) * column / 2;
} | java | int getIndex(int row, int column) {
check(row, column);
return row + (2 * n - (column + 1)) * column / 2;
} | [
"int",
"getIndex",
"(",
"int",
"row",
",",
"int",
"column",
")",
"{",
"check",
"(",
"row",
",",
"column",
")",
";",
"return",
"row",
"+",
"(",
"2",
"*",
"n",
"-",
"(",
"column",
"+",
"1",
")",
")",
"*",
"column",
"/",
"2",
";",
"}"
] | Checks the row and column indices, and returns the linear data index | [
"Checks",
"the",
"row",
"and",
"column",
"indices",
"and",
"returns",
"the",
"linear",
"data",
"index"
] | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/LowerTriangPackMatrix.java#L163-L166 |
auth0/Auth0.Android | auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java | AuthenticationAPIClient.createUser | @SuppressWarnings("WeakerAccess")
public DatabaseConnectionRequest<DatabaseUser, AuthenticationException> createUser(@NonNull String email, @NonNull String password, @NonNull String connection) {
"""
Creates a user in a DB connection using <a href="https://auth0.com/docs/api/authentication#signup">'/dbconnections/signup' endpoint</a>
Example usage:
<pre>
{@code
client.createUser("{email}", "{password}", "{database connection name}")
.start(new BaseCallback<DatabaseUser>() {
{@literal}Override
public void onSuccess(DatabaseUser payload) { }
{@literal}@Override
public void onFailure(AuthenticationException error) { }
});
}
</pre>
@param email of the user and must be non null
@param password of the user and must be non null
@param connection of the database to create the user on
@return a request to start
"""
//noinspection ConstantConditions
return createUser(email, password, null, connection);
} | java | @SuppressWarnings("WeakerAccess")
public DatabaseConnectionRequest<DatabaseUser, AuthenticationException> createUser(@NonNull String email, @NonNull String password, @NonNull String connection) {
//noinspection ConstantConditions
return createUser(email, password, null, connection);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"DatabaseConnectionRequest",
"<",
"DatabaseUser",
",",
"AuthenticationException",
">",
"createUser",
"(",
"@",
"NonNull",
"String",
"email",
",",
"@",
"NonNull",
"String",
"password",
",",
"@",
"NonNull",
"String",
"connection",
")",
"{",
"//noinspection ConstantConditions",
"return",
"createUser",
"(",
"email",
",",
"password",
",",
"null",
",",
"connection",
")",
";",
"}"
] | Creates a user in a DB connection using <a href="https://auth0.com/docs/api/authentication#signup">'/dbconnections/signup' endpoint</a>
Example usage:
<pre>
{@code
client.createUser("{email}", "{password}", "{database connection name}")
.start(new BaseCallback<DatabaseUser>() {
{@literal}Override
public void onSuccess(DatabaseUser payload) { }
{@literal}@Override
public void onFailure(AuthenticationException error) { }
});
}
</pre>
@param email of the user and must be non null
@param password of the user and must be non null
@param connection of the database to create the user on
@return a request to start | [
"Creates",
"a",
"user",
"in",
"a",
"DB",
"connection",
"using",
"<a",
"href",
"=",
"https",
":",
"//",
"auth0",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"authentication#signup",
">",
"/",
"dbconnections",
"/",
"signup",
"endpoint<",
"/",
"a",
">",
"Example",
"usage",
":",
"<pre",
">",
"{",
"@code",
"client",
".",
"createUser",
"(",
"{",
"email",
"}",
"{",
"password",
"}",
"{",
"database",
"connection",
"name",
"}",
")",
".",
"start",
"(",
"new",
"BaseCallback<DatabaseUser",
">",
"()",
"{",
"{",
"@literal",
"}",
"Override",
"public",
"void",
"onSuccess",
"(",
"DatabaseUser",
"payload",
")",
"{",
"}"
] | train | https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java#L558-L562 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java | PascalTemplate.mergeCliqueTemplates | public static PascalTemplate mergeCliqueTemplates(DateTemplate dt, String location, InfoTemplate wi) {
"""
Merges partial (clique) templates into a full one.
@param dt date template
@param location location
@param wi workshop/conference info template
@return the {@link PascalTemplate} resulting from this merge.
"""
PascalTemplate pt = new PascalTemplate();
pt.setValue("workshopnotificationofacceptancedate", dt.noadate);
pt.setValue("workshopcamerareadycopydate", dt.crcdate);
pt.setValue("workshopdate", dt.workdate);
pt.setValue("workshoppapersubmissiondate", dt.subdate);
pt.setValue("workshoplocation", location);
pt.setValue("workshopacronym", wi.wacronym);
pt.setValue("workshophomepage", wi.whomepage);
pt.setValue("workshopname", wi.wname);
pt.setValue("conferenceacronym", wi.cacronym);
pt.setValue("conferencehomepage", wi.chomepage);
pt.setValue("conferencename", wi.cname);
return pt;
} | java | public static PascalTemplate mergeCliqueTemplates(DateTemplate dt, String location, InfoTemplate wi) {
PascalTemplate pt = new PascalTemplate();
pt.setValue("workshopnotificationofacceptancedate", dt.noadate);
pt.setValue("workshopcamerareadycopydate", dt.crcdate);
pt.setValue("workshopdate", dt.workdate);
pt.setValue("workshoppapersubmissiondate", dt.subdate);
pt.setValue("workshoplocation", location);
pt.setValue("workshopacronym", wi.wacronym);
pt.setValue("workshophomepage", wi.whomepage);
pt.setValue("workshopname", wi.wname);
pt.setValue("conferenceacronym", wi.cacronym);
pt.setValue("conferencehomepage", wi.chomepage);
pt.setValue("conferencename", wi.cname);
return pt;
} | [
"public",
"static",
"PascalTemplate",
"mergeCliqueTemplates",
"(",
"DateTemplate",
"dt",
",",
"String",
"location",
",",
"InfoTemplate",
"wi",
")",
"{",
"PascalTemplate",
"pt",
"=",
"new",
"PascalTemplate",
"(",
")",
";",
"pt",
".",
"setValue",
"(",
"\"workshopnotificationofacceptancedate\"",
",",
"dt",
".",
"noadate",
")",
";",
"pt",
".",
"setValue",
"(",
"\"workshopcamerareadycopydate\"",
",",
"dt",
".",
"crcdate",
")",
";",
"pt",
".",
"setValue",
"(",
"\"workshopdate\"",
",",
"dt",
".",
"workdate",
")",
";",
"pt",
".",
"setValue",
"(",
"\"workshoppapersubmissiondate\"",
",",
"dt",
".",
"subdate",
")",
";",
"pt",
".",
"setValue",
"(",
"\"workshoplocation\"",
",",
"location",
")",
";",
"pt",
".",
"setValue",
"(",
"\"workshopacronym\"",
",",
"wi",
".",
"wacronym",
")",
";",
"pt",
".",
"setValue",
"(",
"\"workshophomepage\"",
",",
"wi",
".",
"whomepage",
")",
";",
"pt",
".",
"setValue",
"(",
"\"workshopname\"",
",",
"wi",
".",
"wname",
")",
";",
"pt",
".",
"setValue",
"(",
"\"conferenceacronym\"",
",",
"wi",
".",
"cacronym",
")",
";",
"pt",
".",
"setValue",
"(",
"\"conferencehomepage\"",
",",
"wi",
".",
"chomepage",
")",
";",
"pt",
".",
"setValue",
"(",
"\"conferencename\"",
",",
"wi",
".",
"cname",
")",
";",
"return",
"pt",
";",
"}"
] | Merges partial (clique) templates into a full one.
@param dt date template
@param location location
@param wi workshop/conference info template
@return the {@link PascalTemplate} resulting from this merge. | [
"Merges",
"partial",
"(",
"clique",
")",
"templates",
"into",
"a",
"full",
"one",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java#L129-L143 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallContract | public static ContractBean unmarshallContract(Map<String, Object> source) {
"""
Unmarshals the given map source into a bean.
@param source the source
@return the contract
"""
if (source == null) {
return null;
}
ContractBean bean = new ContractBean();
bean.setId(asLong(source.get("id")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
postMarshall(bean);
return bean;
} | java | public static ContractBean unmarshallContract(Map<String, Object> source) {
if (source == null) {
return null;
}
ContractBean bean = new ContractBean();
bean.setId(asLong(source.get("id")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"ContractBean",
"unmarshallContract",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ContractBean",
"bean",
"=",
"new",
"ContractBean",
"(",
")",
";",
"bean",
".",
"setId",
"(",
"asLong",
"(",
"source",
".",
"get",
"(",
"\"id\"",
")",
")",
")",
";",
"bean",
".",
"setCreatedBy",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"createdBy\"",
")",
")",
")",
";",
"bean",
".",
"setCreatedOn",
"(",
"asDate",
"(",
"source",
".",
"get",
"(",
"\"createdOn\"",
")",
")",
")",
";",
"postMarshall",
"(",
"bean",
")",
";",
"return",
"bean",
";",
"}"
] | Unmarshals the given map source into a bean.
@param source the source
@return the contract | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L757-L767 |
cache2k/cache2k | cache2k-api/src/main/java/org/cache2k/Cache2kBuilder.java | Cache2kBuilder.expireAfterWrite | public final Cache2kBuilder<K, V> expireAfterWrite(long v, TimeUnit u) {
"""
Time duration after insert or updated an cache entry expires.
To switch off time based expiry use {@link #eternal(boolean)}.
<p>If an {@link ExpiryPolicy} is specified, the maximum expiry duration
is capped to the value specified here.
<p>A value of {@code 0} means every entry should expire immediately. Low values or
{@code 0} together with read through operation mode with a {@link CacheLoader} should be
avoided in production environments.
@throws IllegalArgumentException if {@link #eternal(boolean)} was set to true
@see <a href="https://cache2k.org/docs/latest/user-guide.html#expiry-and-refresh">cache2k user guide - Expiry and Refresh</a>
"""
config().setExpireAfterWrite(u.toMillis(v));
return this;
} | java | public final Cache2kBuilder<K, V> expireAfterWrite(long v, TimeUnit u) {
config().setExpireAfterWrite(u.toMillis(v));
return this;
} | [
"public",
"final",
"Cache2kBuilder",
"<",
"K",
",",
"V",
">",
"expireAfterWrite",
"(",
"long",
"v",
",",
"TimeUnit",
"u",
")",
"{",
"config",
"(",
")",
".",
"setExpireAfterWrite",
"(",
"u",
".",
"toMillis",
"(",
"v",
")",
")",
";",
"return",
"this",
";",
"}"
] | Time duration after insert or updated an cache entry expires.
To switch off time based expiry use {@link #eternal(boolean)}.
<p>If an {@link ExpiryPolicy} is specified, the maximum expiry duration
is capped to the value specified here.
<p>A value of {@code 0} means every entry should expire immediately. Low values or
{@code 0} together with read through operation mode with a {@link CacheLoader} should be
avoided in production environments.
@throws IllegalArgumentException if {@link #eternal(boolean)} was set to true
@see <a href="https://cache2k.org/docs/latest/user-guide.html#expiry-and-refresh">cache2k user guide - Expiry and Refresh</a> | [
"Time",
"duration",
"after",
"insert",
"or",
"updated",
"an",
"cache",
"entry",
"expires",
".",
"To",
"switch",
"off",
"time",
"based",
"expiry",
"use",
"{",
"@link",
"#eternal",
"(",
"boolean",
")",
"}",
"."
] | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/Cache2kBuilder.java#L409-L412 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java | InodeTreePersistentState.applyAndJournal | public void applyAndJournal(Supplier<JournalContext> context, UpdateInodeFileEntry entry) {
"""
Updates an inode file's state.
@param context journal context supplier
@param entry update inode file entry
"""
try {
applyUpdateInodeFile(entry);
context.get().append(JournalEntry.newBuilder().setUpdateInodeFile(entry).build());
} catch (Throwable t) {
ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry);
throw t; // fatalError will usually system.exit
}
} | java | public void applyAndJournal(Supplier<JournalContext> context, UpdateInodeFileEntry entry) {
try {
applyUpdateInodeFile(entry);
context.get().append(JournalEntry.newBuilder().setUpdateInodeFile(entry).build());
} catch (Throwable t) {
ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry);
throw t; // fatalError will usually system.exit
}
} | [
"public",
"void",
"applyAndJournal",
"(",
"Supplier",
"<",
"JournalContext",
">",
"context",
",",
"UpdateInodeFileEntry",
"entry",
")",
"{",
"try",
"{",
"applyUpdateInodeFile",
"(",
"entry",
")",
";",
"context",
".",
"get",
"(",
")",
".",
"append",
"(",
"JournalEntry",
".",
"newBuilder",
"(",
")",
".",
"setUpdateInodeFile",
"(",
"entry",
")",
".",
"build",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ProcessUtils",
".",
"fatalError",
"(",
"LOG",
",",
"t",
",",
"\"Failed to apply %s\"",
",",
"entry",
")",
";",
"throw",
"t",
";",
"// fatalError will usually system.exit",
"}",
"}"
] | Updates an inode file's state.
@param context journal context supplier
@param entry update inode file entry | [
"Updates",
"an",
"inode",
"file",
"s",
"state",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java#L266-L274 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/executors/ScalingThreadPoolExecutor.java | ScalingThreadPoolExecutor.newScalingThreadPool | public static ScalingThreadPoolExecutor newScalingThreadPool(int min, int max, long keepAliveTime) {
"""
Creates a {@link ScalingThreadPoolExecutor}.
@param min Core thread pool size.
@param max Max number of threads allowed.
@param keepAliveTime Keep alive time for unused threads in milliseconds.
@return A {@link ScalingThreadPoolExecutor}.
"""
return newScalingThreadPool(min, max, keepAliveTime, Executors.defaultThreadFactory());
} | java | public static ScalingThreadPoolExecutor newScalingThreadPool(int min, int max, long keepAliveTime) {
return newScalingThreadPool(min, max, keepAliveTime, Executors.defaultThreadFactory());
} | [
"public",
"static",
"ScalingThreadPoolExecutor",
"newScalingThreadPool",
"(",
"int",
"min",
",",
"int",
"max",
",",
"long",
"keepAliveTime",
")",
"{",
"return",
"newScalingThreadPool",
"(",
"min",
",",
"max",
",",
"keepAliveTime",
",",
"Executors",
".",
"defaultThreadFactory",
"(",
")",
")",
";",
"}"
] | Creates a {@link ScalingThreadPoolExecutor}.
@param min Core thread pool size.
@param max Max number of threads allowed.
@param keepAliveTime Keep alive time for unused threads in milliseconds.
@return A {@link ScalingThreadPoolExecutor}. | [
"Creates",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/executors/ScalingThreadPoolExecutor.java#L40-L42 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/BasePrepareStatement.java | BasePrepareStatement.setClob | public void setClob(final int parameterIndex, final Clob clob) throws SQLException {
"""
Sets the designated parameter to the given <code>java.sql.Clob</code> object. The driver
converts this to an SQL
<code>CLOB</code> value when it sends it to the database.
@param parameterIndex the first parameter is 1, the second is 2, ...
@param clob a <code>Clob</code> object that maps an SQL <code>CLOB</code> value
@throws SQLException if parameterIndex does not correspond to a parameter
marker in the SQL statement; if a database access error
occurs or this method is called on a closed
<code>PreparedStatement</code>
"""
if (clob == null) {
setNull(parameterIndex, ColumnType.BLOB);
return;
}
setParameter(parameterIndex,
new ReaderParameter(clob.getCharacterStream(), clob.length(), noBackslashEscapes));
hasLongData = true;
} | java | public void setClob(final int parameterIndex, final Clob clob) throws SQLException {
if (clob == null) {
setNull(parameterIndex, ColumnType.BLOB);
return;
}
setParameter(parameterIndex,
new ReaderParameter(clob.getCharacterStream(), clob.length(), noBackslashEscapes));
hasLongData = true;
} | [
"public",
"void",
"setClob",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"Clob",
"clob",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"clob",
"==",
"null",
")",
"{",
"setNull",
"(",
"parameterIndex",
",",
"ColumnType",
".",
"BLOB",
")",
";",
"return",
";",
"}",
"setParameter",
"(",
"parameterIndex",
",",
"new",
"ReaderParameter",
"(",
"clob",
".",
"getCharacterStream",
"(",
")",
",",
"clob",
".",
"length",
"(",
")",
",",
"noBackslashEscapes",
")",
")",
";",
"hasLongData",
"=",
"true",
";",
"}"
] | Sets the designated parameter to the given <code>java.sql.Clob</code> object. The driver
converts this to an SQL
<code>CLOB</code> value when it sends it to the database.
@param parameterIndex the first parameter is 1, the second is 2, ...
@param clob a <code>Clob</code> object that maps an SQL <code>CLOB</code> value
@throws SQLException if parameterIndex does not correspond to a parameter
marker in the SQL statement; if a database access error
occurs or this method is called on a closed
<code>PreparedStatement</code> | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"<code",
">",
"java",
".",
"sql",
".",
"Clob<",
"/",
"code",
">",
"object",
".",
"The",
"driver",
"converts",
"this",
"to",
"an",
"SQL",
"<code",
">",
"CLOB<",
"/",
"code",
">",
"value",
"when",
"it",
"sends",
"it",
"to",
"the",
"database",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/BasePrepareStatement.java#L390-L399 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/StringUtils.java | StringUtils.parseLocaleString | public static Locale parseLocaleString(String localeString) {
"""
Parse the given {@code localeString} value into a {@link Locale}.
<p>This is the inverse operation of {@link Locale#toString Locale's toString}.
@param localeString the locale {@code String}, following {@code Locale's}
{@code toString()} format ("en", "en_UK", etc);
also accepts spaces as separators, as an alternative to underscores
@return a corresponding {@code Locale} instance
@throws IllegalArgumentException in case of an invalid locale specification
"""
String[] parts = tokenize(localeString, "_ ", false);
String language = (parts.length > 0 ? parts[0] : EMPTY);
String country = (parts.length > 1 ? parts[1] : EMPTY);
validateLocalePart(language);
validateLocalePart(country);
String variant = EMPTY;
if (parts.length > 2) {
// There is definitely a variant, and it is everything after the country
// code sans the separator between the country code and the variant.
int endIndexOfCountryCode = localeString.indexOf(country, language.length()) + country.length();
// Strip off any leading '_' and whitespace, what's left is the variant.
variant = trimLeadingWhitespace(localeString.substring(endIndexOfCountryCode));
if (variant.startsWith("_")) {
variant = trimLeadingCharacter(variant, '_');
}
}
return (language.length() > 0 ? new Locale(language, country, variant) : null);
} | java | public static Locale parseLocaleString(String localeString) {
String[] parts = tokenize(localeString, "_ ", false);
String language = (parts.length > 0 ? parts[0] : EMPTY);
String country = (parts.length > 1 ? parts[1] : EMPTY);
validateLocalePart(language);
validateLocalePart(country);
String variant = EMPTY;
if (parts.length > 2) {
// There is definitely a variant, and it is everything after the country
// code sans the separator between the country code and the variant.
int endIndexOfCountryCode = localeString.indexOf(country, language.length()) + country.length();
// Strip off any leading '_' and whitespace, what's left is the variant.
variant = trimLeadingWhitespace(localeString.substring(endIndexOfCountryCode));
if (variant.startsWith("_")) {
variant = trimLeadingCharacter(variant, '_');
}
}
return (language.length() > 0 ? new Locale(language, country, variant) : null);
} | [
"public",
"static",
"Locale",
"parseLocaleString",
"(",
"String",
"localeString",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"tokenize",
"(",
"localeString",
",",
"\"_ \"",
",",
"false",
")",
";",
"String",
"language",
"=",
"(",
"parts",
".",
"length",
">",
"0",
"?",
"parts",
"[",
"0",
"]",
":",
"EMPTY",
")",
";",
"String",
"country",
"=",
"(",
"parts",
".",
"length",
">",
"1",
"?",
"parts",
"[",
"1",
"]",
":",
"EMPTY",
")",
";",
"validateLocalePart",
"(",
"language",
")",
";",
"validateLocalePart",
"(",
"country",
")",
";",
"String",
"variant",
"=",
"EMPTY",
";",
"if",
"(",
"parts",
".",
"length",
">",
"2",
")",
"{",
"// There is definitely a variant, and it is everything after the country",
"// code sans the separator between the country code and the variant.",
"int",
"endIndexOfCountryCode",
"=",
"localeString",
".",
"indexOf",
"(",
"country",
",",
"language",
".",
"length",
"(",
")",
")",
"+",
"country",
".",
"length",
"(",
")",
";",
"// Strip off any leading '_' and whitespace, what's left is the variant.",
"variant",
"=",
"trimLeadingWhitespace",
"(",
"localeString",
".",
"substring",
"(",
"endIndexOfCountryCode",
")",
")",
";",
"if",
"(",
"variant",
".",
"startsWith",
"(",
"\"_\"",
")",
")",
"{",
"variant",
"=",
"trimLeadingCharacter",
"(",
"variant",
",",
"'",
"'",
")",
";",
"}",
"}",
"return",
"(",
"language",
".",
"length",
"(",
")",
">",
"0",
"?",
"new",
"Locale",
"(",
"language",
",",
"country",
",",
"variant",
")",
":",
"null",
")",
";",
"}"
] | Parse the given {@code localeString} value into a {@link Locale}.
<p>This is the inverse operation of {@link Locale#toString Locale's toString}.
@param localeString the locale {@code String}, following {@code Locale's}
{@code toString()} format ("en", "en_UK", etc);
also accepts spaces as separators, as an alternative to underscores
@return a corresponding {@code Locale} instance
@throws IllegalArgumentException in case of an invalid locale specification | [
"Parse",
"the",
"given",
"{",
"@code",
"localeString",
"}",
"value",
"into",
"a",
"{",
"@link",
"Locale",
"}",
".",
"<p",
">",
"This",
"is",
"the",
"inverse",
"operation",
"of",
"{",
"@link",
"Locale#toString",
"Locale",
"s",
"toString",
"}",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/StringUtils.java#L747-L765 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_phonebooks_bookKey_DELETE | public void serviceName_phonebooks_bookKey_DELETE(String serviceName, String bookKey) throws IOException {
"""
Delete a phonebook
REST: DELETE /sms/{serviceName}/phonebooks/{bookKey}
@param serviceName [required] The internal name of your SMS offer
@param bookKey [required] Identifier of the phonebook
"""
String qPath = "/sms/{serviceName}/phonebooks/{bookKey}";
StringBuilder sb = path(qPath, serviceName, bookKey);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void serviceName_phonebooks_bookKey_DELETE(String serviceName, String bookKey) throws IOException {
String qPath = "/sms/{serviceName}/phonebooks/{bookKey}";
StringBuilder sb = path(qPath, serviceName, bookKey);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"serviceName_phonebooks_bookKey_DELETE",
"(",
"String",
"serviceName",
",",
"String",
"bookKey",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/phonebooks/{bookKey}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"bookKey",
")",
";",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"}"
] | Delete a phonebook
REST: DELETE /sms/{serviceName}/phonebooks/{bookKey}
@param serviceName [required] The internal name of your SMS offer
@param bookKey [required] Identifier of the phonebook | [
"Delete",
"a",
"phonebook"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1114-L1118 |
Stratio/deep-spark | deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java | Cells.getValue | public <T> T getValue(String nameSpace, String cellName, Class<T> cellClass) {
"""
Returns the casted value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null if
this Cells object contains no cell whose name is cellName.
@param nameSpace the name of the owning table
@param cellName the name of the Cell we want to retrieve from this Cells object.
@param cellClass the class of the cell's value
@param <T> the type of the cell's value
@return the casted value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null if
this Cells object contains no cell whose name is cellName
"""
Cell cell = getCellByName(nameSpace, cellName);
return cell == null ? null : cell.getValue(cellClass);
} | java | public <T> T getValue(String nameSpace, String cellName, Class<T> cellClass) {
Cell cell = getCellByName(nameSpace, cellName);
return cell == null ? null : cell.getValue(cellClass);
} | [
"public",
"<",
"T",
">",
"T",
"getValue",
"(",
"String",
"nameSpace",
",",
"String",
"cellName",
",",
"Class",
"<",
"T",
">",
"cellClass",
")",
"{",
"Cell",
"cell",
"=",
"getCellByName",
"(",
"nameSpace",
",",
"cellName",
")",
";",
"return",
"cell",
"==",
"null",
"?",
"null",
":",
"cell",
".",
"getValue",
"(",
"cellClass",
")",
";",
"}"
] | Returns the casted value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null if
this Cells object contains no cell whose name is cellName.
@param nameSpace the name of the owning table
@param cellName the name of the Cell we want to retrieve from this Cells object.
@param cellClass the class of the cell's value
@param <T> the type of the cell's value
@return the casted value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null if
this Cells object contains no cell whose name is cellName | [
"Returns",
"the",
"casted",
"value",
"of",
"the",
"{",
"@link",
"Cell",
"}",
"(",
"associated",
"to",
"{",
"@code",
"table",
"}",
")",
"whose",
"name",
"is",
"cellName",
"or",
"null",
"if",
"this",
"Cells",
"object",
"contains",
"no",
"cell",
"whose",
"name",
"is",
"cellName",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L621-L624 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/DigitalFloorlet.java | DigitalFloorlet.getValue | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
"""
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
"""
// This is on the Libor discretization
int liborIndex = model.getLiborPeriodIndex(maturity);
double paymentDate = model.getLiborPeriod(liborIndex+1);
double periodLength = paymentDate - maturity;
// Get random variables
RandomVariable libor = model.getLIBOR(maturity, maturity, paymentDate);
// Set up payoff on path
double[] payoff = new double[model.getNumberOfPaths()];
for(int path=0; path<model.getNumberOfPaths(); path++)
{
double liborOnPath = libor.get(path);
if(liborOnPath < strike) {
payoff[path] = periodLength;
}
else {
payoff[path] = 0.0;
}
}
// Get random variables
RandomVariable numeraire = model.getNumeraire(paymentDate);
RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(paymentDate);
RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime);
RandomVariable monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime);
RandomVariable values = new RandomVariableFromDoubleArray(paymentDate, payoff);
values.div(numeraire).mult(monteCarloProbabilities);
values.div(numeraireAtEvaluationTime).mult(monteCarloProbabilitiesAtEvaluationTime);
// Return values
return values;
} | java | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
// This is on the Libor discretization
int liborIndex = model.getLiborPeriodIndex(maturity);
double paymentDate = model.getLiborPeriod(liborIndex+1);
double periodLength = paymentDate - maturity;
// Get random variables
RandomVariable libor = model.getLIBOR(maturity, maturity, paymentDate);
// Set up payoff on path
double[] payoff = new double[model.getNumberOfPaths()];
for(int path=0; path<model.getNumberOfPaths(); path++)
{
double liborOnPath = libor.get(path);
if(liborOnPath < strike) {
payoff[path] = periodLength;
}
else {
payoff[path] = 0.0;
}
}
// Get random variables
RandomVariable numeraire = model.getNumeraire(paymentDate);
RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(paymentDate);
RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime);
RandomVariable monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime);
RandomVariable values = new RandomVariableFromDoubleArray(paymentDate, payoff);
values.div(numeraire).mult(monteCarloProbabilities);
values.div(numeraireAtEvaluationTime).mult(monteCarloProbabilitiesAtEvaluationTime);
// Return values
return values;
} | [
"@",
"Override",
"public",
"RandomVariable",
"getValue",
"(",
"double",
"evaluationTime",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
")",
"throws",
"CalculationException",
"{",
"// This is on the Libor discretization",
"int",
"liborIndex",
"=",
"model",
".",
"getLiborPeriodIndex",
"(",
"maturity",
")",
";",
"double",
"paymentDate",
"=",
"model",
".",
"getLiborPeriod",
"(",
"liborIndex",
"+",
"1",
")",
";",
"double",
"periodLength",
"=",
"paymentDate",
"-",
"maturity",
";",
"// Get random variables",
"RandomVariable",
"libor",
"=",
"model",
".",
"getLIBOR",
"(",
"maturity",
",",
"maturity",
",",
"paymentDate",
")",
";",
"// Set up payoff on path",
"double",
"[",
"]",
"payoff",
"=",
"new",
"double",
"[",
"model",
".",
"getNumberOfPaths",
"(",
")",
"]",
";",
"for",
"(",
"int",
"path",
"=",
"0",
";",
"path",
"<",
"model",
".",
"getNumberOfPaths",
"(",
")",
";",
"path",
"++",
")",
"{",
"double",
"liborOnPath",
"=",
"libor",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"liborOnPath",
"<",
"strike",
")",
"{",
"payoff",
"[",
"path",
"]",
"=",
"periodLength",
";",
"}",
"else",
"{",
"payoff",
"[",
"path",
"]",
"=",
"0.0",
";",
"}",
"}",
"// Get random variables",
"RandomVariable",
"numeraire",
"=",
"model",
".",
"getNumeraire",
"(",
"paymentDate",
")",
";",
"RandomVariable",
"monteCarloProbabilities",
"=",
"model",
".",
"getMonteCarloWeights",
"(",
"paymentDate",
")",
";",
"RandomVariable",
"numeraireAtEvaluationTime",
"=",
"model",
".",
"getNumeraire",
"(",
"evaluationTime",
")",
";",
"RandomVariable",
"monteCarloProbabilitiesAtEvaluationTime",
"=",
"model",
".",
"getMonteCarloWeights",
"(",
"evaluationTime",
")",
";",
"RandomVariable",
"values",
"=",
"new",
"RandomVariableFromDoubleArray",
"(",
"paymentDate",
",",
"payoff",
")",
";",
"values",
".",
"div",
"(",
"numeraire",
")",
".",
"mult",
"(",
"monteCarloProbabilities",
")",
";",
"values",
".",
"div",
"(",
"numeraireAtEvaluationTime",
")",
".",
"mult",
"(",
"monteCarloProbabilitiesAtEvaluationTime",
")",
";",
"// Return values",
"return",
"values",
";",
"}"
] | This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"This",
"method",
"returns",
"the",
"value",
"random",
"variable",
"of",
"the",
"product",
"within",
"the",
"specified",
"model",
"evaluated",
"at",
"a",
"given",
"evalutationTime",
".",
"Note",
":",
"For",
"a",
"lattice",
"this",
"is",
"often",
"the",
"value",
"conditional",
"to",
"evalutationTime",
"for",
"a",
"Monte",
"-",
"Carlo",
"simulation",
"this",
"is",
"the",
"(",
"sum",
"of",
")",
"value",
"discounted",
"to",
"evaluation",
"time",
".",
"Cashflows",
"prior",
"evaluationTime",
"are",
"not",
"considered",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/DigitalFloorlet.java#L43-L81 |
jamesdbloom/mockserver | mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java | HttpRequest.withQueryStringParameter | public HttpRequest withQueryStringParameter(String name, String... values) {
"""
Adds one query string parameter to match which can specified using plain strings or regular expressions
(for more details of the supported regex syntax see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)
@param name the parameter name
@param values the parameter values which can be a varags of strings or regular expressions
"""
this.queryStringParameters.withEntry(name, values);
return this;
} | java | public HttpRequest withQueryStringParameter(String name, String... values) {
this.queryStringParameters.withEntry(name, values);
return this;
} | [
"public",
"HttpRequest",
"withQueryStringParameter",
"(",
"String",
"name",
",",
"String",
"...",
"values",
")",
"{",
"this",
".",
"queryStringParameters",
".",
"withEntry",
"(",
"name",
",",
"values",
")",
";",
"return",
"this",
";",
"}"
] | Adds one query string parameter to match which can specified using plain strings or regular expressions
(for more details of the supported regex syntax see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)
@param name the parameter name
@param values the parameter values which can be a varags of strings or regular expressions | [
"Adds",
"one",
"query",
"string",
"parameter",
"to",
"match",
"which",
"can",
"specified",
"using",
"plain",
"strings",
"or",
"regular",
"expressions",
"(",
"for",
"more",
"details",
"of",
"the",
"supported",
"regex",
"syntax",
"see",
"http",
":",
"//",
"docs",
".",
"oracle",
".",
"com",
"/",
"javase",
"/",
"6",
"/",
"docs",
"/",
"api",
"/",
"java",
"/",
"util",
"/",
"regex",
"/",
"Pattern",
".",
"html",
")"
] | train | https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java#L198-L201 |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/user/UserEventMessenger.java | UserEventMessenger.sendToAllExceptUser | public void sendToAllExceptUser(String topicURI, Object event, String excludeUser) {
"""
Send an {@link EventMessage} to every client that is currently subscribed to the
provided topicURI except the one provided with the excludeUser parameter.
@param topicURI the name of the topic
@param event the payload of the {@link EventMessage}
@param user the user that will be excluded
"""
sendToAllExceptUsers(topicURI, event, Collections.singleton(excludeUser));
} | java | public void sendToAllExceptUser(String topicURI, Object event, String excludeUser) {
sendToAllExceptUsers(topicURI, event, Collections.singleton(excludeUser));
} | [
"public",
"void",
"sendToAllExceptUser",
"(",
"String",
"topicURI",
",",
"Object",
"event",
",",
"String",
"excludeUser",
")",
"{",
"sendToAllExceptUsers",
"(",
"topicURI",
",",
"event",
",",
"Collections",
".",
"singleton",
"(",
"excludeUser",
")",
")",
";",
"}"
] | Send an {@link EventMessage} to every client that is currently subscribed to the
provided topicURI except the one provided with the excludeUser parameter.
@param topicURI the name of the topic
@param event the payload of the {@link EventMessage}
@param user the user that will be excluded | [
"Send",
"an",
"{",
"@link",
"EventMessage",
"}",
"to",
"every",
"client",
"that",
"is",
"currently",
"subscribed",
"to",
"the",
"provided",
"topicURI",
"except",
"the",
"one",
"provided",
"with",
"the",
"excludeUser",
"parameter",
"."
] | train | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/user/UserEventMessenger.java#L104-L106 |
js-lib-com/commons | src/main/java/js/converter/ConverterRegistry.java | ConverterRegistry.registerConverter | public void registerConverter(Class<?> valueType, Class<? extends Converter> converterClass) {
"""
Register user defined converter associated to value type. Converter class should be instantiable, i.e. not
abstract, interface or void, must have no arguments constructor, even if private and its constructor should of
course execute without exception. Otherwise unchecked exception may arise as described on throws section. There are
no other constrains on value type class.
<p>
Note: it is caller responsibility to enforce proper bound, i.e. given converter class to properly handle requested
value type. Otherwise exception may throw when this particular converter is enacted.
@param valueType value type class,
@param converterClass specialized converter class.
@throws BugError if converter class is not instantiable.
@throws NoSuchBeingException if converter class has no default constructor.
@throws InvocationException with target exception if converter class construction fails on its execution.
"""
Converter converter = Classes.newInstance(converterClass);
if(Types.isConcrete(valueType)) {
registerConverterInstance(valueType, converter);
}
else {
if(abstractConverters.put(valueType, converter) == null) {
log.debug("Register abstract converter |%s| for value type |%s|.", converterClass, valueType);
}
else {
log.warn("Override abstract converter |%s| for value type |%s|.", converterClass, valueType);
}
}
} | java | public void registerConverter(Class<?> valueType, Class<? extends Converter> converterClass)
{
Converter converter = Classes.newInstance(converterClass);
if(Types.isConcrete(valueType)) {
registerConverterInstance(valueType, converter);
}
else {
if(abstractConverters.put(valueType, converter) == null) {
log.debug("Register abstract converter |%s| for value type |%s|.", converterClass, valueType);
}
else {
log.warn("Override abstract converter |%s| for value type |%s|.", converterClass, valueType);
}
}
} | [
"public",
"void",
"registerConverter",
"(",
"Class",
"<",
"?",
">",
"valueType",
",",
"Class",
"<",
"?",
"extends",
"Converter",
">",
"converterClass",
")",
"{",
"Converter",
"converter",
"=",
"Classes",
".",
"newInstance",
"(",
"converterClass",
")",
";",
"if",
"(",
"Types",
".",
"isConcrete",
"(",
"valueType",
")",
")",
"{",
"registerConverterInstance",
"(",
"valueType",
",",
"converter",
")",
";",
"}",
"else",
"{",
"if",
"(",
"abstractConverters",
".",
"put",
"(",
"valueType",
",",
"converter",
")",
"==",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"\"Register abstract converter |%s| for value type |%s|.\"",
",",
"converterClass",
",",
"valueType",
")",
";",
"}",
"else",
"{",
"log",
".",
"warn",
"(",
"\"Override abstract converter |%s| for value type |%s|.\"",
",",
"converterClass",
",",
"valueType",
")",
";",
"}",
"}",
"}"
] | Register user defined converter associated to value type. Converter class should be instantiable, i.e. not
abstract, interface or void, must have no arguments constructor, even if private and its constructor should of
course execute without exception. Otherwise unchecked exception may arise as described on throws section. There are
no other constrains on value type class.
<p>
Note: it is caller responsibility to enforce proper bound, i.e. given converter class to properly handle requested
value type. Otherwise exception may throw when this particular converter is enacted.
@param valueType value type class,
@param converterClass specialized converter class.
@throws BugError if converter class is not instantiable.
@throws NoSuchBeingException if converter class has no default constructor.
@throws InvocationException with target exception if converter class construction fails on its execution. | [
"Register",
"user",
"defined",
"converter",
"associated",
"to",
"value",
"type",
".",
"Converter",
"class",
"should",
"be",
"instantiable",
"i",
".",
"e",
".",
"not",
"abstract",
"interface",
"or",
"void",
"must",
"have",
"no",
"arguments",
"constructor",
"even",
"if",
"private",
"and",
"its",
"constructor",
"should",
"of",
"course",
"execute",
"without",
"exception",
".",
"Otherwise",
"unchecked",
"exception",
"may",
"arise",
"as",
"described",
"on",
"throws",
"section",
".",
"There",
"are",
"no",
"other",
"constrains",
"on",
"value",
"type",
"class",
".",
"<p",
">",
"Note",
":",
"it",
"is",
"caller",
"responsibility",
"to",
"enforce",
"proper",
"bound",
"i",
".",
"e",
".",
"given",
"converter",
"class",
"to",
"properly",
"handle",
"requested",
"value",
"type",
".",
"Otherwise",
"exception",
"may",
"throw",
"when",
"this",
"particular",
"converter",
"is",
"enacted",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/ConverterRegistry.java#L237-L251 |
tango-controls/JTango | server/src/main/java/org/tango/server/dynamic/DynamicManager.java | DynamicManager.removeAttribute | public void removeAttribute(final String attributeName, final boolean clearAttributeProperties) throws DevFailed {
"""
remove a dynamic attribute
@param attributeName attribute name
@throws DevFailed
"""
removeAttribute(attributeName);
if (clearAttributeProperties) {
new AttributePropertiesManager(deviceImpl.getName()).removeAttributeProperties(attributeName);
}
} | java | public void removeAttribute(final String attributeName, final boolean clearAttributeProperties) throws DevFailed {
removeAttribute(attributeName);
if (clearAttributeProperties) {
new AttributePropertiesManager(deviceImpl.getName()).removeAttributeProperties(attributeName);
}
} | [
"public",
"void",
"removeAttribute",
"(",
"final",
"String",
"attributeName",
",",
"final",
"boolean",
"clearAttributeProperties",
")",
"throws",
"DevFailed",
"{",
"removeAttribute",
"(",
"attributeName",
")",
";",
"if",
"(",
"clearAttributeProperties",
")",
"{",
"new",
"AttributePropertiesManager",
"(",
"deviceImpl",
".",
"getName",
"(",
")",
")",
".",
"removeAttributeProperties",
"(",
"attributeName",
")",
";",
"}",
"}"
] | remove a dynamic attribute
@param attributeName attribute name
@throws DevFailed | [
"remove",
"a",
"dynamic",
"attribute"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/dynamic/DynamicManager.java#L186-L191 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java | ContainerGroupsInner.beginCreateOrUpdateAsync | public Observable<ContainerGroupInner> beginCreateOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) {
"""
Create or update container groups.
Create or update container groups with specified configurations.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@param containerGroup The properties of the container group to be created or updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ContainerGroupInner object
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() {
@Override
public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) {
return response.body();
}
});
} | java | public Observable<ContainerGroupInner> beginCreateOrUpdateAsync(String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerGroupName, containerGroup).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() {
@Override
public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ContainerGroupInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
",",
"ContainerGroupInner",
"containerGroup",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGroupName",
",",
"containerGroup",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ContainerGroupInner",
">",
",",
"ContainerGroupInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ContainerGroupInner",
"call",
"(",
"ServiceResponse",
"<",
"ContainerGroupInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Create or update container groups.
Create or update container groups with specified configurations.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@param containerGroup The properties of the container group to be created or updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ContainerGroupInner object | [
"Create",
"or",
"update",
"container",
"groups",
".",
"Create",
"or",
"update",
"container",
"groups",
"with",
"specified",
"configurations",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java#L551-L558 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/resilience/AbstractResilienceStrategy.java | AbstractResilienceStrategy.pacedErrorLog | protected void pacedErrorLog(String message, StoreAccessException e) {
"""
Log messages in error at worst every 30 seconds. Log everything at debug level.
@param message message to log
@param e exception to log
"""
pacer.pacedCall(() -> LOGGER.error(message + " - Similar messages will be suppressed for 30 seconds", e), () -> LOGGER.debug(message, e));
} | java | protected void pacedErrorLog(String message, StoreAccessException e) {
pacer.pacedCall(() -> LOGGER.error(message + " - Similar messages will be suppressed for 30 seconds", e), () -> LOGGER.debug(message, e));
} | [
"protected",
"void",
"pacedErrorLog",
"(",
"String",
"message",
",",
"StoreAccessException",
"e",
")",
"{",
"pacer",
".",
"pacedCall",
"(",
"(",
")",
"->",
"LOGGER",
".",
"error",
"(",
"message",
"+",
"\" - Similar messages will be suppressed for 30 seconds\"",
",",
"e",
")",
",",
"(",
")",
"->",
"LOGGER",
".",
"debug",
"(",
"message",
",",
"e",
")",
")",
";",
"}"
] | Log messages in error at worst every 30 seconds. Log everything at debug level.
@param message message to log
@param e exception to log | [
"Log",
"messages",
"in",
"error",
"at",
"worst",
"every",
"30",
"seconds",
".",
"Log",
"everything",
"at",
"debug",
"level",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/AbstractResilienceStrategy.java#L178-L180 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/BinaryEllipseDetector.java | BinaryEllipseDetector.setLensDistortion | public void setLensDistortion(PixelTransform<Point2D_F32> distToUndist , PixelTransform<Point2D_F32> undistToDist ) {
"""
<p>Specifies transforms which can be used to change coordinates from distorted to undistorted.
The undistorted image is never explicitly created.</p>
<p>
WARNING: The undistorted image must have the same bounds as the distorted input image. This is because
several of the bounds checks use the image shape. This are simplified greatly by this assumption.
</p>
@param distToUndist Transform from distorted to undistorted image.
@param undistToDist Transform from undistorted to distorted image.
"""
this.ellipseDetector.setLensDistortion(distToUndist);
if( this.ellipseRefiner != null )
this.ellipseRefiner.setTransform(undistToDist);
this.intensityCheck.setTransform(undistToDist);
} | java | public void setLensDistortion(PixelTransform<Point2D_F32> distToUndist , PixelTransform<Point2D_F32> undistToDist ) {
this.ellipseDetector.setLensDistortion(distToUndist);
if( this.ellipseRefiner != null )
this.ellipseRefiner.setTransform(undistToDist);
this.intensityCheck.setTransform(undistToDist);
} | [
"public",
"void",
"setLensDistortion",
"(",
"PixelTransform",
"<",
"Point2D_F32",
">",
"distToUndist",
",",
"PixelTransform",
"<",
"Point2D_F32",
">",
"undistToDist",
")",
"{",
"this",
".",
"ellipseDetector",
".",
"setLensDistortion",
"(",
"distToUndist",
")",
";",
"if",
"(",
"this",
".",
"ellipseRefiner",
"!=",
"null",
")",
"this",
".",
"ellipseRefiner",
".",
"setTransform",
"(",
"undistToDist",
")",
";",
"this",
".",
"intensityCheck",
".",
"setTransform",
"(",
"undistToDist",
")",
";",
"}"
] | <p>Specifies transforms which can be used to change coordinates from distorted to undistorted.
The undistorted image is never explicitly created.</p>
<p>
WARNING: The undistorted image must have the same bounds as the distorted input image. This is because
several of the bounds checks use the image shape. This are simplified greatly by this assumption.
</p>
@param distToUndist Transform from distorted to undistorted image.
@param undistToDist Transform from undistorted to distorted image. | [
"<p",
">",
"Specifies",
"transforms",
"which",
"can",
"be",
"used",
"to",
"change",
"coordinates",
"from",
"distorted",
"to",
"undistorted",
".",
"The",
"undistorted",
"image",
"is",
"never",
"explicitly",
"created",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/BinaryEllipseDetector.java#L87-L92 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/Fiat.java | Fiat.parseFiat | public static Fiat parseFiat(final String currencyCode, final String str) {
"""
<p>Parses an amount expressed in the way humans are used to.</p>
<p>This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
"1.23E3", "1234.5E-5".</p>
@throws IllegalArgumentException
if you try to specify more than 4 digits after the comma, or a value out of range.
"""
try {
long val = new BigDecimal(str).movePointRight(SMALLEST_UNIT_EXPONENT).longValueExact();
return Fiat.valueOf(currencyCode, val);
} catch (ArithmeticException e) {
throw new IllegalArgumentException(e);
}
} | java | public static Fiat parseFiat(final String currencyCode, final String str) {
try {
long val = new BigDecimal(str).movePointRight(SMALLEST_UNIT_EXPONENT).longValueExact();
return Fiat.valueOf(currencyCode, val);
} catch (ArithmeticException e) {
throw new IllegalArgumentException(e);
}
} | [
"public",
"static",
"Fiat",
"parseFiat",
"(",
"final",
"String",
"currencyCode",
",",
"final",
"String",
"str",
")",
"{",
"try",
"{",
"long",
"val",
"=",
"new",
"BigDecimal",
"(",
"str",
")",
".",
"movePointRight",
"(",
"SMALLEST_UNIT_EXPONENT",
")",
".",
"longValueExact",
"(",
")",
";",
"return",
"Fiat",
".",
"valueOf",
"(",
"currencyCode",
",",
"val",
")",
";",
"}",
"catch",
"(",
"ArithmeticException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"e",
")",
";",
"}",
"}"
] | <p>Parses an amount expressed in the way humans are used to.</p>
<p>This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
"1.23E3", "1234.5E-5".</p>
@throws IllegalArgumentException
if you try to specify more than 4 digits after the comma, or a value out of range. | [
"<p",
">",
"Parses",
"an",
"amount",
"expressed",
"in",
"the",
"way",
"humans",
"are",
"used",
"to",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"takes",
"string",
"in",
"a",
"format",
"understood",
"by",
"{",
"@link",
"BigDecimal#BigDecimal",
"(",
"String",
")",
"}",
"for",
"example",
"0",
"1",
"0",
".",
"10",
"1",
".",
"23E3",
"1234",
".",
"5E",
"-",
"5",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/Fiat.java#L83-L90 |
graknlabs/grakn | server/src/server/session/TransactionOLTP.java | TransactionOLTP.addTypeVertex | protected VertexElement addTypeVertex(LabelId id, Label label, Schema.BaseType baseType) {
"""
Adds a new type vertex which occupies a grakn id. This result in the grakn id count on the meta concept to be
incremented.
@param label The label of the new type vertex
@param baseType The base type of the new type
@return The new type vertex
"""
VertexElement vertexElement = addVertexElement(baseType);
vertexElement.property(Schema.VertexProperty.SCHEMA_LABEL, label.getValue());
vertexElement.property(Schema.VertexProperty.LABEL_ID, id.getValue());
return vertexElement;
} | java | protected VertexElement addTypeVertex(LabelId id, Label label, Schema.BaseType baseType) {
VertexElement vertexElement = addVertexElement(baseType);
vertexElement.property(Schema.VertexProperty.SCHEMA_LABEL, label.getValue());
vertexElement.property(Schema.VertexProperty.LABEL_ID, id.getValue());
return vertexElement;
} | [
"protected",
"VertexElement",
"addTypeVertex",
"(",
"LabelId",
"id",
",",
"Label",
"label",
",",
"Schema",
".",
"BaseType",
"baseType",
")",
"{",
"VertexElement",
"vertexElement",
"=",
"addVertexElement",
"(",
"baseType",
")",
";",
"vertexElement",
".",
"property",
"(",
"Schema",
".",
"VertexProperty",
".",
"SCHEMA_LABEL",
",",
"label",
".",
"getValue",
"(",
")",
")",
";",
"vertexElement",
".",
"property",
"(",
"Schema",
".",
"VertexProperty",
".",
"LABEL_ID",
",",
"id",
".",
"getValue",
"(",
")",
")",
";",
"return",
"vertexElement",
";",
"}"
] | Adds a new type vertex which occupies a grakn id. This result in the grakn id count on the meta concept to be
incremented.
@param label The label of the new type vertex
@param baseType The base type of the new type
@return The new type vertex | [
"Adds",
"a",
"new",
"type",
"vertex",
"which",
"occupies",
"a",
"grakn",
"id",
".",
"This",
"result",
"in",
"the",
"grakn",
"id",
"count",
"on",
"the",
"meta",
"concept",
"to",
"be",
"incremented",
"."
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L463-L468 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cache/CacheUtil.java | CacheUtil.getPrefix | public static String getPrefix(URI uri, ClassLoader classLoader) {
"""
Gets the prefix of cache name without Hazelcast's {@link javax.cache.CacheManager}
specific prefix {@link com.hazelcast.cache.HazelcastCacheManager#CACHE_MANAGER_PREFIX}.
@param uri an implementation specific URI for the
Hazelcast's {@link javax.cache.CacheManager} (null means use
Hazelcast's {@link javax.cache.spi.CachingProvider#getDefaultURI()})
@param classLoader the {@link ClassLoader} to use for the
Hazelcast's {@link javax.cache.CacheManager} (null means use
Hazelcast's {@link javax.cache.spi.CachingProvider#getDefaultClassLoader()})
@return the prefix of cache name without Hazelcast's {@link javax.cache.CacheManager}
specific prefix {@link com.hazelcast.cache.HazelcastCacheManager#CACHE_MANAGER_PREFIX}
"""
if (uri == null && classLoader == null) {
return null;
} else {
StringBuilder sb = new StringBuilder();
if (uri != null) {
sb.append(uri.toASCIIString()).append('/');
}
if (classLoader != null) {
sb.append(classLoader.toString()).append('/');
}
return sb.toString();
}
} | java | public static String getPrefix(URI uri, ClassLoader classLoader) {
if (uri == null && classLoader == null) {
return null;
} else {
StringBuilder sb = new StringBuilder();
if (uri != null) {
sb.append(uri.toASCIIString()).append('/');
}
if (classLoader != null) {
sb.append(classLoader.toString()).append('/');
}
return sb.toString();
}
} | [
"public",
"static",
"String",
"getPrefix",
"(",
"URI",
"uri",
",",
"ClassLoader",
"classLoader",
")",
"{",
"if",
"(",
"uri",
"==",
"null",
"&&",
"classLoader",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"uri",
".",
"toASCIIString",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"if",
"(",
"classLoader",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"classLoader",
".",
"toString",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}"
] | Gets the prefix of cache name without Hazelcast's {@link javax.cache.CacheManager}
specific prefix {@link com.hazelcast.cache.HazelcastCacheManager#CACHE_MANAGER_PREFIX}.
@param uri an implementation specific URI for the
Hazelcast's {@link javax.cache.CacheManager} (null means use
Hazelcast's {@link javax.cache.spi.CachingProvider#getDefaultURI()})
@param classLoader the {@link ClassLoader} to use for the
Hazelcast's {@link javax.cache.CacheManager} (null means use
Hazelcast's {@link javax.cache.spi.CachingProvider#getDefaultClassLoader()})
@return the prefix of cache name without Hazelcast's {@link javax.cache.CacheManager}
specific prefix {@link com.hazelcast.cache.HazelcastCacheManager#CACHE_MANAGER_PREFIX} | [
"Gets",
"the",
"prefix",
"of",
"cache",
"name",
"without",
"Hazelcast",
"s",
"{",
"@link",
"javax",
".",
"cache",
".",
"CacheManager",
"}",
"specific",
"prefix",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"cache",
".",
"HazelcastCacheManager#CACHE_MANAGER_PREFIX",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/CacheUtil.java#L44-L57 |
aboutsip/sipstack | sipstack-example/src/main/java/io/sipstack/example/netty/sip/proxyregistrar/ProxyRegistrarHandler.java | ProxyRegistrarHandler.proxyTo | private void proxyTo(final SipURI destination, final SipRequest msg) {
"""
Whenever we proxy a request we must also add a Via-header, which essentially says that the
request went "via this network address using this protocol". The {@link ViaHeader}s are used
for responses to find their way back the exact same path as the request took.
@param destination
@param msg
"""
final int port = destination.getPort();
final Connection connection = this.stack.connect(destination.getHost(), port == -1 ? 5060 : port);
// SIP is pretty powerful but there are a lot of little details to get things working.
// E.g., this sample application is acting as a stateless proxy and in order to
// correctly relay re-transmissions or e.g. CANCELs we have to make sure to always
// generate the same branch-id of the same request. Since a CANCEL will have the same
// branch-id as the request it cancels, we must ensure we generate the same branch-id as
// we did when we proxied the initial INVITE. If we don't, then the cancel will not be
// matched by the "other" side and their phone wouldn't stop ringing.
// SO, for this example, we'll just grab the previous value and append "-abc" to it so
// now we are relying on the upstream element to do the right thing :-)
//
// See section 16.11 in RFC3263 for more information.
final Buffer otherBranch = msg.getViaHeader().getBranch();
final Buffer myBranch = Buffers.createBuffer(otherBranch.getReadableBytes() + 4);
otherBranch.getBytes(myBranch);
myBranch.write((byte) '-');
myBranch.write((byte) 'a');
myBranch.write((byte) 'b');
myBranch.write((byte) 'c');
final ViaHeader via = ViaHeader.with().host("10.0.1.28").port(5060).transportUDP().branch(myBranch).build();
// This is how you should generate the branch parameter if you are a stateful proxy:
// Note the ViaHeader.generateBranch()...
// ViaHeader.with().host("10.0.1.28").port(5060).transportUDP().branch(ViaHeader.generateBranch()).build();
msg.addHeaderFirst(via);
try {
connection.send(msg);
} catch (final IndexOutOfBoundsException e) {
System.out.println("this is the message:");
System.out.println(msg.getRequestUri());
System.out.println(msg.getMethod());
System.out.println(msg);
e.printStackTrace();
}
} | java | private void proxyTo(final SipURI destination, final SipRequest msg) {
final int port = destination.getPort();
final Connection connection = this.stack.connect(destination.getHost(), port == -1 ? 5060 : port);
// SIP is pretty powerful but there are a lot of little details to get things working.
// E.g., this sample application is acting as a stateless proxy and in order to
// correctly relay re-transmissions or e.g. CANCELs we have to make sure to always
// generate the same branch-id of the same request. Since a CANCEL will have the same
// branch-id as the request it cancels, we must ensure we generate the same branch-id as
// we did when we proxied the initial INVITE. If we don't, then the cancel will not be
// matched by the "other" side and their phone wouldn't stop ringing.
// SO, for this example, we'll just grab the previous value and append "-abc" to it so
// now we are relying on the upstream element to do the right thing :-)
//
// See section 16.11 in RFC3263 for more information.
final Buffer otherBranch = msg.getViaHeader().getBranch();
final Buffer myBranch = Buffers.createBuffer(otherBranch.getReadableBytes() + 4);
otherBranch.getBytes(myBranch);
myBranch.write((byte) '-');
myBranch.write((byte) 'a');
myBranch.write((byte) 'b');
myBranch.write((byte) 'c');
final ViaHeader via = ViaHeader.with().host("10.0.1.28").port(5060).transportUDP().branch(myBranch).build();
// This is how you should generate the branch parameter if you are a stateful proxy:
// Note the ViaHeader.generateBranch()...
// ViaHeader.with().host("10.0.1.28").port(5060).transportUDP().branch(ViaHeader.generateBranch()).build();
msg.addHeaderFirst(via);
try {
connection.send(msg);
} catch (final IndexOutOfBoundsException e) {
System.out.println("this is the message:");
System.out.println(msg.getRequestUri());
System.out.println(msg.getMethod());
System.out.println(msg);
e.printStackTrace();
}
} | [
"private",
"void",
"proxyTo",
"(",
"final",
"SipURI",
"destination",
",",
"final",
"SipRequest",
"msg",
")",
"{",
"final",
"int",
"port",
"=",
"destination",
".",
"getPort",
"(",
")",
";",
"final",
"Connection",
"connection",
"=",
"this",
".",
"stack",
".",
"connect",
"(",
"destination",
".",
"getHost",
"(",
")",
",",
"port",
"==",
"-",
"1",
"?",
"5060",
":",
"port",
")",
";",
"// SIP is pretty powerful but there are a lot of little details to get things working.",
"// E.g., this sample application is acting as a stateless proxy and in order to",
"// correctly relay re-transmissions or e.g. CANCELs we have to make sure to always",
"// generate the same branch-id of the same request. Since a CANCEL will have the same",
"// branch-id as the request it cancels, we must ensure we generate the same branch-id as",
"// we did when we proxied the initial INVITE. If we don't, then the cancel will not be",
"// matched by the \"other\" side and their phone wouldn't stop ringing.",
"// SO, for this example, we'll just grab the previous value and append \"-abc\" to it so",
"// now we are relying on the upstream element to do the right thing :-)",
"//",
"// See section 16.11 in RFC3263 for more information.",
"final",
"Buffer",
"otherBranch",
"=",
"msg",
".",
"getViaHeader",
"(",
")",
".",
"getBranch",
"(",
")",
";",
"final",
"Buffer",
"myBranch",
"=",
"Buffers",
".",
"createBuffer",
"(",
"otherBranch",
".",
"getReadableBytes",
"(",
")",
"+",
"4",
")",
";",
"otherBranch",
".",
"getBytes",
"(",
"myBranch",
")",
";",
"myBranch",
".",
"write",
"(",
"(",
"byte",
")",
"'",
"'",
")",
";",
"myBranch",
".",
"write",
"(",
"(",
"byte",
")",
"'",
"'",
")",
";",
"myBranch",
".",
"write",
"(",
"(",
"byte",
")",
"'",
"'",
")",
";",
"myBranch",
".",
"write",
"(",
"(",
"byte",
")",
"'",
"'",
")",
";",
"final",
"ViaHeader",
"via",
"=",
"ViaHeader",
".",
"with",
"(",
")",
".",
"host",
"(",
"\"10.0.1.28\"",
")",
".",
"port",
"(",
"5060",
")",
".",
"transportUDP",
"(",
")",
".",
"branch",
"(",
"myBranch",
")",
".",
"build",
"(",
")",
";",
"// This is how you should generate the branch parameter if you are a stateful proxy:",
"// Note the ViaHeader.generateBranch()...",
"// ViaHeader.with().host(\"10.0.1.28\").port(5060).transportUDP().branch(ViaHeader.generateBranch()).build();",
"msg",
".",
"addHeaderFirst",
"(",
"via",
")",
";",
"try",
"{",
"connection",
".",
"send",
"(",
"msg",
")",
";",
"}",
"catch",
"(",
"final",
"IndexOutOfBoundsException",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"this is the message:\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"msg",
".",
"getRequestUri",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"msg",
".",
"getMethod",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"msg",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | Whenever we proxy a request we must also add a Via-header, which essentially says that the
request went "via this network address using this protocol". The {@link ViaHeader}s are used
for responses to find their way back the exact same path as the request took.
@param destination
@param msg | [
"Whenever",
"we",
"proxy",
"a",
"request",
"we",
"must",
"also",
"add",
"a",
"Via",
"-",
"header",
"which",
"essentially",
"says",
"that",
"the",
"request",
"went",
"via",
"this",
"network",
"address",
"using",
"this",
"protocol",
".",
"The",
"{",
"@link",
"ViaHeader",
"}",
"s",
"are",
"used",
"for",
"responses",
"to",
"find",
"their",
"way",
"back",
"the",
"exact",
"same",
"path",
"as",
"the",
"request",
"took",
"."
] | train | https://github.com/aboutsip/sipstack/blob/33f2db1d580738f0385687b0429fab0630118f42/sipstack-example/src/main/java/io/sipstack/example/netty/sip/proxyregistrar/ProxyRegistrarHandler.java#L141-L180 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/user/QuickAnalysisStrategy.java | QuickAnalysisStrategy.loadFromUserPreferences | public static QuickAnalysisStrategy loadFromUserPreferences(final UserPreferences userPreferences) {
"""
Loads {@link QuickAnalysisStrategy} from a {@link UserPreferences}
object.
@param userPreferences
@return
"""
final Map<String, String> properties = userPreferences.getAdditionalProperties();
final int columnsPerAnalyzer =
MapUtils.getIntValue(properties, USER_PREFERENCES_NAMESPACE + ".columnsPerAnalyzer", 5);
final boolean includeValueDistribution =
MapUtils.getBooleanValue(properties, USER_PREFERENCES_NAMESPACE + ".includeValueDistribution", false);
final boolean includePatternFinder =
MapUtils.getBooleanValue(properties, USER_PREFERENCES_NAMESPACE + ".includePatternFinder", false);
return new QuickAnalysisStrategy(columnsPerAnalyzer, includeValueDistribution, includePatternFinder);
} | java | public static QuickAnalysisStrategy loadFromUserPreferences(final UserPreferences userPreferences) {
final Map<String, String> properties = userPreferences.getAdditionalProperties();
final int columnsPerAnalyzer =
MapUtils.getIntValue(properties, USER_PREFERENCES_NAMESPACE + ".columnsPerAnalyzer", 5);
final boolean includeValueDistribution =
MapUtils.getBooleanValue(properties, USER_PREFERENCES_NAMESPACE + ".includeValueDistribution", false);
final boolean includePatternFinder =
MapUtils.getBooleanValue(properties, USER_PREFERENCES_NAMESPACE + ".includePatternFinder", false);
return new QuickAnalysisStrategy(columnsPerAnalyzer, includeValueDistribution, includePatternFinder);
} | [
"public",
"static",
"QuickAnalysisStrategy",
"loadFromUserPreferences",
"(",
"final",
"UserPreferences",
"userPreferences",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
"=",
"userPreferences",
".",
"getAdditionalProperties",
"(",
")",
";",
"final",
"int",
"columnsPerAnalyzer",
"=",
"MapUtils",
".",
"getIntValue",
"(",
"properties",
",",
"USER_PREFERENCES_NAMESPACE",
"+",
"\".columnsPerAnalyzer\"",
",",
"5",
")",
";",
"final",
"boolean",
"includeValueDistribution",
"=",
"MapUtils",
".",
"getBooleanValue",
"(",
"properties",
",",
"USER_PREFERENCES_NAMESPACE",
"+",
"\".includeValueDistribution\"",
",",
"false",
")",
";",
"final",
"boolean",
"includePatternFinder",
"=",
"MapUtils",
".",
"getBooleanValue",
"(",
"properties",
",",
"USER_PREFERENCES_NAMESPACE",
"+",
"\".includePatternFinder\"",
",",
"false",
")",
";",
"return",
"new",
"QuickAnalysisStrategy",
"(",
"columnsPerAnalyzer",
",",
"includeValueDistribution",
",",
"includePatternFinder",
")",
";",
"}"
] | Loads {@link QuickAnalysisStrategy} from a {@link UserPreferences}
object.
@param userPreferences
@return | [
"Loads",
"{",
"@link",
"QuickAnalysisStrategy",
"}",
"from",
"a",
"{",
"@link",
"UserPreferences",
"}",
"object",
"."
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/user/QuickAnalysisStrategy.java#L90-L101 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/Keyspace.java | Keyspace.initCf | public void initCf(UUID cfId, String cfName, boolean loadSSTables) {
"""
adds a cf to internal structures, ends up creating disk files).
"""
ColumnFamilyStore cfs = columnFamilyStores.get(cfId);
if (cfs == null)
{
// CFS being created for the first time, either on server startup or new CF being added.
// We don't worry about races here; startup is safe, and adding multiple idential CFs
// simultaneously is a "don't do that" scenario.
ColumnFamilyStore oldCfs = columnFamilyStores.putIfAbsent(cfId, ColumnFamilyStore.createColumnFamilyStore(this, cfName, loadSSTables));
// CFS mbean instantiation will error out before we hit this, but in case that changes...
if (oldCfs != null)
throw new IllegalStateException("added multiple mappings for cf id " + cfId);
}
else
{
// re-initializing an existing CF. This will happen if you cleared the schema
// on this node and it's getting repopulated from the rest of the cluster.
assert cfs.name.equals(cfName);
cfs.metadata.reload();
cfs.reload();
}
} | java | public void initCf(UUID cfId, String cfName, boolean loadSSTables)
{
ColumnFamilyStore cfs = columnFamilyStores.get(cfId);
if (cfs == null)
{
// CFS being created for the first time, either on server startup or new CF being added.
// We don't worry about races here; startup is safe, and adding multiple idential CFs
// simultaneously is a "don't do that" scenario.
ColumnFamilyStore oldCfs = columnFamilyStores.putIfAbsent(cfId, ColumnFamilyStore.createColumnFamilyStore(this, cfName, loadSSTables));
// CFS mbean instantiation will error out before we hit this, but in case that changes...
if (oldCfs != null)
throw new IllegalStateException("added multiple mappings for cf id " + cfId);
}
else
{
// re-initializing an existing CF. This will happen if you cleared the schema
// on this node and it's getting repopulated from the rest of the cluster.
assert cfs.name.equals(cfName);
cfs.metadata.reload();
cfs.reload();
}
} | [
"public",
"void",
"initCf",
"(",
"UUID",
"cfId",
",",
"String",
"cfName",
",",
"boolean",
"loadSSTables",
")",
"{",
"ColumnFamilyStore",
"cfs",
"=",
"columnFamilyStores",
".",
"get",
"(",
"cfId",
")",
";",
"if",
"(",
"cfs",
"==",
"null",
")",
"{",
"// CFS being created for the first time, either on server startup or new CF being added.",
"// We don't worry about races here; startup is safe, and adding multiple idential CFs",
"// simultaneously is a \"don't do that\" scenario.",
"ColumnFamilyStore",
"oldCfs",
"=",
"columnFamilyStores",
".",
"putIfAbsent",
"(",
"cfId",
",",
"ColumnFamilyStore",
".",
"createColumnFamilyStore",
"(",
"this",
",",
"cfName",
",",
"loadSSTables",
")",
")",
";",
"// CFS mbean instantiation will error out before we hit this, but in case that changes...",
"if",
"(",
"oldCfs",
"!=",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"added multiple mappings for cf id \"",
"+",
"cfId",
")",
";",
"}",
"else",
"{",
"// re-initializing an existing CF. This will happen if you cleared the schema",
"// on this node and it's getting repopulated from the rest of the cluster.",
"assert",
"cfs",
".",
"name",
".",
"equals",
"(",
"cfName",
")",
";",
"cfs",
".",
"metadata",
".",
"reload",
"(",
")",
";",
"cfs",
".",
"reload",
"(",
")",
";",
"}",
"}"
] | adds a cf to internal structures, ends up creating disk files). | [
"adds",
"a",
"cf",
"to",
"internal",
"structures",
"ends",
"up",
"creating",
"disk",
"files",
")",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/Keyspace.java#L315-L337 |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryScalar | public static <T> T queryScalar(String sql, Class<T> scalarType, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
"""
Return just one scalar given a an SQL statement using the default connection pool.
@param scalarType The Class of the desired return scalar matching the table
@param params The replacement parameters
@return The scalar Object
@throws SQLStatementNotFoundException if an SQL statement could not be found for the given
sqlKey String
"""
return queryScalar(YankPoolManager.DEFAULT_POOL_NAME, sql, scalarType, params);
} | java | public static <T> T queryScalar(String sql, Class<T> scalarType, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
return queryScalar(YankPoolManager.DEFAULT_POOL_NAME, sql, scalarType, params);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"queryScalar",
"(",
"String",
"sql",
",",
"Class",
"<",
"T",
">",
"scalarType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLStatementNotFoundException",
",",
"YankSQLException",
"{",
"return",
"queryScalar",
"(",
"YankPoolManager",
".",
"DEFAULT_POOL_NAME",
",",
"sql",
",",
"scalarType",
",",
"params",
")",
";",
"}"
] | Return just one scalar given a an SQL statement using the default connection pool.
@param scalarType The Class of the desired return scalar matching the table
@param params The replacement parameters
@return The scalar Object
@throws SQLStatementNotFoundException if an SQL statement could not be found for the given
sqlKey String | [
"Return",
"just",
"one",
"scalar",
"given",
"a",
"an",
"SQL",
"statement",
"using",
"the",
"default",
"connection",
"pool",
"."
] | train | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L274-L278 |
podio/podio-java | src/main/java/com/podio/contact/ContactAPI.java | ContactAPI.addSpaceContact | public int addSpaceContact(int spaceId, ContactCreate create, boolean silent) {
"""
Adds a new contact to the given space.
@param spaceId
The id of the space the contact should be added to
@param create
The data for the new contact
@param silent
True if the create should be silent, false otherwise
@return The id of the newly created contact
"""
return getResourceFactory().getApiResource("/contact/space/" + spaceId + "/")
.queryParam("silent", silent ? "1" : "0")
.entity(create, MediaType.APPLICATION_JSON_TYPE)
.post(ContactCreateResponse.class).getId();
} | java | public int addSpaceContact(int spaceId, ContactCreate create, boolean silent) {
return getResourceFactory().getApiResource("/contact/space/" + spaceId + "/")
.queryParam("silent", silent ? "1" : "0")
.entity(create, MediaType.APPLICATION_JSON_TYPE)
.post(ContactCreateResponse.class).getId();
} | [
"public",
"int",
"addSpaceContact",
"(",
"int",
"spaceId",
",",
"ContactCreate",
"create",
",",
"boolean",
"silent",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/contact/space/\"",
"+",
"spaceId",
"+",
"\"/\"",
")",
".",
"queryParam",
"(",
"\"silent\"",
",",
"silent",
"?",
"\"1\"",
":",
"\"0\"",
")",
".",
"entity",
"(",
"create",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"post",
"(",
"ContactCreateResponse",
".",
"class",
")",
".",
"getId",
"(",
")",
";",
"}"
] | Adds a new contact to the given space.
@param spaceId
The id of the space the contact should be added to
@param create
The data for the new contact
@param silent
True if the create should be silent, false otherwise
@return The id of the newly created contact | [
"Adds",
"a",
"new",
"contact",
"to",
"the",
"given",
"space",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/contact/ContactAPI.java#L40-L45 |
Subsets and Splits