repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/Dater.java | Dater.of | public static Dater of(Date date, DateStyle dateStyle) {
return of(date).with(dateStyle);
} | java | public static Dater of(Date date, DateStyle dateStyle) {
return of(date).with(dateStyle);
} | [
"public",
"static",
"Dater",
"of",
"(",
"Date",
"date",
",",
"DateStyle",
"dateStyle",
")",
"{",
"return",
"of",
"(",
"date",
")",
".",
"with",
"(",
"dateStyle",
")",
";",
"}"
] | Returns a new Dater instance with the given date and date style
@param date
@return | [
"Returns",
"a",
"new",
"Dater",
"instance",
"with",
"the",
"given",
"date",
"and",
"date",
"style"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Dater.java#L224-L226 |
hector-client/hector | object-mapper/src/main/java/me/prettyprint/hom/CFMappingDef.java | CFMappingDef.setDefaults | @SuppressWarnings("unchecked")
public void setDefaults(Class<T> realClass) {
this.realClass = realClass;
this.keyDef = new KeyDefinition();
// find the "effective" class - skipping up the hierarchy over inner classes
effectiveClass = realClass;
boolean entityFound;
while (!(entityFound = (null != effectiveClass.getAnnotation(Entity.class)))) {
// TODO:BTB this might should be isSynthetic
if (!effectiveClass.isAnonymousClass()) {
break;
} else {
effectiveClass = (Class<T>) effectiveClass.getSuperclass();
}
}
// if class is missing @Entity, then proceed no further
if (!entityFound) {
throw new HomMissingEntityAnnotationException("class, " + realClass.getName()
+ ", not annotated with @" + Entity.class.getSimpleName());
}
} | java | @SuppressWarnings("unchecked")
public void setDefaults(Class<T> realClass) {
this.realClass = realClass;
this.keyDef = new KeyDefinition();
// find the "effective" class - skipping up the hierarchy over inner classes
effectiveClass = realClass;
boolean entityFound;
while (!(entityFound = (null != effectiveClass.getAnnotation(Entity.class)))) {
// TODO:BTB this might should be isSynthetic
if (!effectiveClass.isAnonymousClass()) {
break;
} else {
effectiveClass = (Class<T>) effectiveClass.getSuperclass();
}
}
// if class is missing @Entity, then proceed no further
if (!entityFound) {
throw new HomMissingEntityAnnotationException("class, " + realClass.getName()
+ ", not annotated with @" + Entity.class.getSimpleName());
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"setDefaults",
"(",
"Class",
"<",
"T",
">",
"realClass",
")",
"{",
"this",
".",
"realClass",
"=",
"realClass",
";",
"this",
".",
"keyDef",
"=",
"new",
"KeyDefinition",
"(",
")",
";",
"... | Setup mapping with defaults for the given class. Does not parse all
annotations.
@param realClass | [
"Setup",
"mapping",
"with",
"defaults",
"for",
"the",
"given",
"class",
".",
"Does",
"not",
"parse",
"all",
"annotations",
"."
] | train | https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/object-mapper/src/main/java/me/prettyprint/hom/CFMappingDef.java#L67-L89 |
opendigitaleducation/web-utils | src/main/java/org/vertx/java/core/http/RouteMatcher.java | RouteMatcher.getWithRegEx | public RouteMatcher getWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, getBindings);
return this;
} | java | public RouteMatcher getWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, getBindings);
return this;
} | [
"public",
"RouteMatcher",
"getWithRegEx",
"(",
"String",
"regex",
",",
"Handler",
"<",
"HttpServerRequest",
">",
"handler",
")",
"{",
"addRegEx",
"(",
"regex",
",",
"handler",
",",
"getBindings",
")",
";",
"return",
"this",
";",
"}"
] | Specify a handler that will be called for a matching HTTP GET
@param regex A regular expression
@param handler The handler to call | [
"Specify",
"a",
"handler",
"that",
"will",
"be",
"called",
"for",
"a",
"matching",
"HTTP",
"GET"
] | train | https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L209-L212 |
h2oai/h2o-3 | h2o-algos/src/main/java/hex/deepwater/DeepWaterTask2.java | DeepWaterTask2.setupLocal | @Override
public void setupLocal() {
super.setupLocal();
_res = new DeepWaterTask(_sharedmodel, _sync_fraction, (Job)_jobKey.get());
addToPendingCount(1);
_res.dfork(null, _fr, true /*run_local*/);
} | java | @Override
public void setupLocal() {
super.setupLocal();
_res = new DeepWaterTask(_sharedmodel, _sync_fraction, (Job)_jobKey.get());
addToPendingCount(1);
_res.dfork(null, _fr, true /*run_local*/);
} | [
"@",
"Override",
"public",
"void",
"setupLocal",
"(",
")",
"{",
"super",
".",
"setupLocal",
"(",
")",
";",
"_res",
"=",
"new",
"DeepWaterTask",
"(",
"_sharedmodel",
",",
"_sync_fraction",
",",
"(",
"Job",
")",
"_jobKey",
".",
"get",
"(",
")",
")",
";",... | Do the local computation: Perform one DeepWaterTask (with run_local=true) iteration.
Pass over all the data (will be replicated in dfork() here), and use _sync_fraction random rows.
This calls DeepWaterTask's reduce() between worker threads that update the same local model_info via Hogwild!
Once the computation is done, reduce() will be called | [
"Do",
"the",
"local",
"computation",
":",
"Perform",
"one",
"DeepWaterTask",
"(",
"with",
"run_local",
"=",
"true",
")",
"iteration",
".",
"Pass",
"over",
"all",
"the",
"data",
"(",
"will",
"be",
"replicated",
"in",
"dfork",
"()",
"here",
")",
"and",
"us... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/deepwater/DeepWaterTask2.java#L46-L52 |
lessthanoptimal/BoofCV | integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java | VisualizeCamera2Activity.selectResolution | @Override
protected int selectResolution( int widthTexture, int heightTexture, Size[] resolutions ) {
// just wanted to make sure this has been cleaned up
timeOfLastUpdated = 0;
// select the resolution here
int bestIndex = -1;
double bestAspect = Double.MAX_VALUE;
double bestArea = 0;
for( int i = 0; i < resolutions.length; i++ ) {
Size s = resolutions[i];
int width = s.getWidth();
int height = s.getHeight();
double aspectScore = Math.abs(width*height-targetResolution);
if( aspectScore < bestAspect ) {
bestIndex = i;
bestAspect = aspectScore;
bestArea = width*height;
} else if( Math.abs(aspectScore-bestArea) <= 1e-8 ) {
bestIndex = i;
double area = width*height;
if( area > bestArea ) {
bestArea = area;
}
}
}
return bestIndex;
} | java | @Override
protected int selectResolution( int widthTexture, int heightTexture, Size[] resolutions ) {
// just wanted to make sure this has been cleaned up
timeOfLastUpdated = 0;
// select the resolution here
int bestIndex = -1;
double bestAspect = Double.MAX_VALUE;
double bestArea = 0;
for( int i = 0; i < resolutions.length; i++ ) {
Size s = resolutions[i];
int width = s.getWidth();
int height = s.getHeight();
double aspectScore = Math.abs(width*height-targetResolution);
if( aspectScore < bestAspect ) {
bestIndex = i;
bestAspect = aspectScore;
bestArea = width*height;
} else if( Math.abs(aspectScore-bestArea) <= 1e-8 ) {
bestIndex = i;
double area = width*height;
if( area > bestArea ) {
bestArea = area;
}
}
}
return bestIndex;
} | [
"@",
"Override",
"protected",
"int",
"selectResolution",
"(",
"int",
"widthTexture",
",",
"int",
"heightTexture",
",",
"Size",
"[",
"]",
"resolutions",
")",
"{",
"// just wanted to make sure this has been cleaned up",
"timeOfLastUpdated",
"=",
"0",
";",
"// select the r... | Selects a resolution which has the number of pixels closest to the requested value | [
"Selects",
"a",
"resolution",
"which",
"has",
"the",
"number",
"of",
"pixels",
"closest",
"to",
"the",
"requested",
"value"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java#L209-L240 |
lamydev/Android-Notification | core/src/zemin/notification/NotificationBoard.java | NotificationBoard.setFooterMargin | public void setFooterMargin(int l, int t, int r, int b) {
mFooter.setMargin(l, t, r, b);
} | java | public void setFooterMargin(int l, int t, int r, int b) {
mFooter.setMargin(l, t, r, b);
} | [
"public",
"void",
"setFooterMargin",
"(",
"int",
"l",
",",
"int",
"t",
",",
"int",
"r",
",",
"int",
"b",
")",
"{",
"mFooter",
".",
"setMargin",
"(",
"l",
",",
"t",
",",
"r",
",",
"b",
")",
";",
"}"
] | Set the margin of the footer.
@param l
@param t
@param r
@param b | [
"Set",
"the",
"margin",
"of",
"the",
"footer",
"."
] | train | https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationBoard.java#L568-L570 |
duracloud/duracloud | stitch/src/main/java/org/duracloud/stitch/FileStitcherDriver.java | FileStitcherDriver.stitch | public void stitch(String spaceId, String manifestId, File toDir)
throws Exception {
verifyDir(toDir);
Content content = stitcher.getContentFromManifest(spaceId, manifestId);
writeContentToDir(content, toDir);
} | java | public void stitch(String spaceId, String manifestId, File toDir)
throws Exception {
verifyDir(toDir);
Content content = stitcher.getContentFromManifest(spaceId, manifestId);
writeContentToDir(content, toDir);
} | [
"public",
"void",
"stitch",
"(",
"String",
"spaceId",
",",
"String",
"manifestId",
",",
"File",
"toDir",
")",
"throws",
"Exception",
"{",
"verifyDir",
"(",
"toDir",
")",
";",
"Content",
"content",
"=",
"stitcher",
".",
"getContentFromManifest",
"(",
"spaceId",... | This method retrieves the chunks manifest specified by the arg space-id
and manifest-id (content-id), then reconstitues the chunks defined in
the manifest into the original file at the arg to-directory.
@param spaceId containing chunks manifest
@param manifestId of the manifest (content-id)
@param toDir destination of reconstituted original content item
@throws Exception on error | [
"This",
"method",
"retrieves",
"the",
"chunks",
"manifest",
"specified",
"by",
"the",
"arg",
"space",
"-",
"id",
"and",
"manifest",
"-",
"id",
"(",
"content",
"-",
"id",
")",
"then",
"reconstitues",
"the",
"chunks",
"defined",
"in",
"the",
"manifest",
"int... | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/stitch/src/main/java/org/duracloud/stitch/FileStitcherDriver.java#L65-L71 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.enableCheckpointing | public StreamExecutionEnvironment enableCheckpointing(long interval, CheckpointingMode mode) {
checkpointCfg.setCheckpointingMode(mode);
checkpointCfg.setCheckpointInterval(interval);
return this;
} | java | public StreamExecutionEnvironment enableCheckpointing(long interval, CheckpointingMode mode) {
checkpointCfg.setCheckpointingMode(mode);
checkpointCfg.setCheckpointInterval(interval);
return this;
} | [
"public",
"StreamExecutionEnvironment",
"enableCheckpointing",
"(",
"long",
"interval",
",",
"CheckpointingMode",
"mode",
")",
"{",
"checkpointCfg",
".",
"setCheckpointingMode",
"(",
"mode",
")",
";",
"checkpointCfg",
".",
"setCheckpointInterval",
"(",
"interval",
")",
... | Enables checkpointing for the streaming job. The distributed state of the streaming
dataflow will be periodically snapshotted. In case of a failure, the streaming
dataflow will be restarted from the latest completed checkpoint.
<p>The job draws checkpoints periodically, in the given interval. The system uses the
given {@link CheckpointingMode} for the checkpointing ("exactly once" vs "at least once").
The state will be stored in the configured state backend.
<p>NOTE: Checkpointing iterative streaming dataflows in not properly supported at
the moment. For that reason, iterative jobs will not be started if used
with enabled checkpointing. To override this mechanism, use the
{@link #enableCheckpointing(long, CheckpointingMode, boolean)} method.
@param interval
Time interval between state checkpoints in milliseconds.
@param mode
The checkpointing mode, selecting between "exactly once" and "at least once" guaranteed. | [
"Enables",
"checkpointing",
"for",
"the",
"streaming",
"job",
".",
"The",
"distributed",
"state",
"of",
"the",
"streaming",
"dataflow",
"will",
"be",
"periodically",
"snapshotted",
".",
"In",
"case",
"of",
"a",
"failure",
"the",
"streaming",
"dataflow",
"will",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L338-L342 |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/AppContext.java | AppContext.get | public <T> T get(String name, Class<T> type){
Object o = context.get(name);
return o == null? null : (T) o;
} | java | public <T> T get(String name, Class<T> type){
Object o = context.get(name);
return o == null? null : (T) o;
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"name",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"Object",
"o",
"=",
"context",
".",
"get",
"(",
"name",
")",
";",
"return",
"o",
"==",
"null",
"?",
"null",
":",
"(",
"T",
")",
"o",
... | Retrieves object by name. Convenience generic method.
@param name name of object
@param type type requested.
@return object by name | [
"Retrieves",
"object",
"by",
"name",
".",
"Convenience",
"generic",
"method",
"."
] | train | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/AppContext.java#L49-L52 |
windup/windup | graph/api/src/main/java/org/jboss/windup/graph/service/LinkService.java | LinkService.getOrCreate | public LinkModel getOrCreate(String description, String href)
{
Iterable<Vertex> results = (List<Vertex>)getQuery().traverse(g -> g.has(LinkModel.PROPERTY_DESCRIPTION, description).has(LinkModel.PROPERTY_LINK, href)).getRawTraversal().toList();
if (!results.iterator().hasNext())
{
LinkModel model = create();
model.setDescription(description);
model.setLink(href);
return model;
}
return frame(results.iterator().next());
} | java | public LinkModel getOrCreate(String description, String href)
{
Iterable<Vertex> results = (List<Vertex>)getQuery().traverse(g -> g.has(LinkModel.PROPERTY_DESCRIPTION, description).has(LinkModel.PROPERTY_LINK, href)).getRawTraversal().toList();
if (!results.iterator().hasNext())
{
LinkModel model = create();
model.setDescription(description);
model.setLink(href);
return model;
}
return frame(results.iterator().next());
} | [
"public",
"LinkModel",
"getOrCreate",
"(",
"String",
"description",
",",
"String",
"href",
")",
"{",
"Iterable",
"<",
"Vertex",
">",
"results",
"=",
"(",
"List",
"<",
"Vertex",
">",
")",
"getQuery",
"(",
")",
".",
"traverse",
"(",
"g",
"->",
"g",
".",
... | Tries to find a link with the specified description and href. If it cannot, then it will return a new one. | [
"Tries",
"to",
"find",
"a",
"link",
"with",
"the",
"specified",
"description",
"and",
"href",
".",
"If",
"it",
"cannot",
"then",
"it",
"will",
"return",
"a",
"new",
"one",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/graph/api/src/main/java/org/jboss/windup/graph/service/LinkService.java#L28-L39 |
keenon/loglinear | src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java | GraphicalModel.addStaticFactor | public StaticFactor addStaticFactor(int[] neighborIndices, int[] neighborDimensions, Function<int[], Double> assignmentFeaturizer) {
NDArrayDoubles doubleArray = new NDArrayDoubles(neighborDimensions);
for (int[] assignment : doubleArray) {
doubleArray.setAssignmentValue(assignment, assignmentFeaturizer.apply(assignment));
}
return addStaticFactor(doubleArray, neighborIndices);
} | java | public StaticFactor addStaticFactor(int[] neighborIndices, int[] neighborDimensions, Function<int[], Double> assignmentFeaturizer) {
NDArrayDoubles doubleArray = new NDArrayDoubles(neighborDimensions);
for (int[] assignment : doubleArray) {
doubleArray.setAssignmentValue(assignment, assignmentFeaturizer.apply(assignment));
}
return addStaticFactor(doubleArray, neighborIndices);
} | [
"public",
"StaticFactor",
"addStaticFactor",
"(",
"int",
"[",
"]",
"neighborIndices",
",",
"int",
"[",
"]",
"neighborDimensions",
",",
"Function",
"<",
"int",
"[",
"]",
",",
"Double",
">",
"assignmentFeaturizer",
")",
"{",
"NDArrayDoubles",
"doubleArray",
"=",
... | This adds a static factor to the model, which will always produce the same value regardless of the assignment of
weights during inference.
@param neighborIndices the names of the variables, as indices
@param assignmentFeaturizer a function that maps from an assignment to the variables, represented as an array of
assignments in the same order as presented in neighborIndices, to a constant value.
@return a reference to the created factor. This can be safely ignored, as the factor is already saved in the model | [
"This",
"adds",
"a",
"static",
"factor",
"to",
"the",
"model",
"which",
"will",
"always",
"produce",
"the",
"same",
"value",
"regardless",
"of",
"the",
"assignment",
"of",
"weights",
"during",
"inference",
"."
] | train | https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java#L317-L323 |
alibaba/jstorm | jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/HdfsSpout.java | HdfsSpout.createFileReader | private FileReader createFileReader(Path file)
throws IOException {
if(readerType.equalsIgnoreCase(Configs.SEQ)) {
return new SequenceFileReader(this.hdfs, file, conf);
}
if(readerType.equalsIgnoreCase(Configs.TEXT)) {
return new TextFileReader(this.hdfs, file, conf);
}
try {
Class<?> clsType = Class.forName(readerType);
Constructor<?> constructor = clsType.getConstructor(FileSystem.class, Path.class, Map.class);
return (FileReader) constructor.newInstance(this.hdfs, file, conf);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new RuntimeException("Unable to instantiate " + readerType + " reader", e);
}
} | java | private FileReader createFileReader(Path file)
throws IOException {
if(readerType.equalsIgnoreCase(Configs.SEQ)) {
return new SequenceFileReader(this.hdfs, file, conf);
}
if(readerType.equalsIgnoreCase(Configs.TEXT)) {
return new TextFileReader(this.hdfs, file, conf);
}
try {
Class<?> clsType = Class.forName(readerType);
Constructor<?> constructor = clsType.getConstructor(FileSystem.class, Path.class, Map.class);
return (FileReader) constructor.newInstance(this.hdfs, file, conf);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new RuntimeException("Unable to instantiate " + readerType + " reader", e);
}
} | [
"private",
"FileReader",
"createFileReader",
"(",
"Path",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"readerType",
".",
"equalsIgnoreCase",
"(",
"Configs",
".",
"SEQ",
")",
")",
"{",
"return",
"new",
"SequenceFileReader",
"(",
"this",
".",
"hdfs",
... | Creates a reader that reads from beginning of file
@param file file to read
@return
@throws IOException | [
"Creates",
"a",
"reader",
"that",
"reads",
"from",
"beginning",
"of",
"file"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/HdfsSpout.java#L597-L613 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java | AbstractJsonDeserializer.getIntParam | protected Integer getIntParam(String paramName, String errorMessage, Map<String, Object> mapToUse) throws IOException {
Object o = mapToUse.get(paramName);
if (o != null) {
try {
return Integer.parseInt(o.toString());
} catch (NumberFormatException ignored) {
}
}
return getTypedParam(paramName, errorMessage, Integer.class, mapToUse);
} | java | protected Integer getIntParam(String paramName, String errorMessage, Map<String, Object> mapToUse) throws IOException {
Object o = mapToUse.get(paramName);
if (o != null) {
try {
return Integer.parseInt(o.toString());
} catch (NumberFormatException ignored) {
}
}
return getTypedParam(paramName, errorMessage, Integer.class, mapToUse);
} | [
"protected",
"Integer",
"getIntParam",
"(",
"String",
"paramName",
",",
"String",
"errorMessage",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"mapToUse",
")",
"throws",
"IOException",
"{",
"Object",
"o",
"=",
"mapToUse",
".",
"get",
"(",
"paramName",
")",... | Convenience method for subclasses.
@param paramName the name of the parameter
@param errorMessage the errormessage to add to the exception if the param does not exist.
@param mapToUse the map to use as inputsource for parameters. Should not be null!
@return a stringparameter with given name. If it does not exist and the errormessage is provided,
an IOException is thrown with that message. if the errormessage is not provided, null is returned.
@throws IOException Exception if the paramname does not exist and an errormessage is provided. | [
"Convenience",
"method",
"for",
"subclasses",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L204-L213 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/DcosSpec.java | DcosSpec.setMarathonProperty | @Then("^I modify marathon environment variable '(.+?)' with value '(.+?)' for service '(.+?)'?$")
public void setMarathonProperty(String key, String value, String service) throws Exception {
commonspec.runCommandAndGetResult("touch " + service + "-env.json && dcos marathon app show " + service + " > /dcos/" + service + "-env.json");
commonspec.runCommandAndGetResult("cat /dcos/" + service + "-env.json");
String configFile = commonspec.getRemoteSSHConnection().getResult();
String myJson1 = commonspec.replaceJSONPathElement(configFile, key, value);
String myJson4 = commonspec.updateMarathonJson(myJson1);
String myJson = myJson4.replaceAll("\"uris\"", "\"none\"");
commonspec.runCommandAndGetResult("echo '" + myJson + "' > /dcos/final" + service + "-env.json");
commonspec.runCommandAndGetResult("dcos marathon app update " + service + " < /dcos/final" + service + "-env.json");
commonspec.setCommandExitStatus(commonspec.getRemoteSSHConnection().getExitStatus());
} | java | @Then("^I modify marathon environment variable '(.+?)' with value '(.+?)' for service '(.+?)'?$")
public void setMarathonProperty(String key, String value, String service) throws Exception {
commonspec.runCommandAndGetResult("touch " + service + "-env.json && dcos marathon app show " + service + " > /dcos/" + service + "-env.json");
commonspec.runCommandAndGetResult("cat /dcos/" + service + "-env.json");
String configFile = commonspec.getRemoteSSHConnection().getResult();
String myJson1 = commonspec.replaceJSONPathElement(configFile, key, value);
String myJson4 = commonspec.updateMarathonJson(myJson1);
String myJson = myJson4.replaceAll("\"uris\"", "\"none\"");
commonspec.runCommandAndGetResult("echo '" + myJson + "' > /dcos/final" + service + "-env.json");
commonspec.runCommandAndGetResult("dcos marathon app update " + service + " < /dcos/final" + service + "-env.json");
commonspec.setCommandExitStatus(commonspec.getRemoteSSHConnection().getExitStatus());
} | [
"@",
"Then",
"(",
"\"^I modify marathon environment variable '(.+?)' with value '(.+?)' for service '(.+?)'?$\"",
")",
"public",
"void",
"setMarathonProperty",
"(",
"String",
"key",
",",
"String",
"value",
",",
"String",
"service",
")",
"throws",
"Exception",
"{",
"commonsp... | Set a environment variable in marathon and deploy again.
@param key
@param value
@param service
@throws Exception | [
"Set",
"a",
"environment",
"variable",
"in",
"marathon",
"and",
"deploy",
"again",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DcosSpec.java#L436-L449 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/LevenbergMarquardt.java | LevenbergMarquardt.configure | protected void configure( DenseMatrix64F initParam , DenseMatrix64F X , DenseMatrix64F Y )
{
if( Y.getNumRows() != X.getNumRows() ) {
throw new IllegalArgumentException("Different vector lengths");
} else if( Y.getNumCols() != 1 /*|| X.getNumCols() != 1*/ ) {
throw new IllegalArgumentException("Inputs must be a column vector");
}
int numParam = initParam.getNumElements();
int numPoints = Y.getNumRows();
if( param.getNumElements() != initParam.getNumElements() ) {
// reshaping a matrix means that new memory is only declared when needed
this.param.reshape(numParam,1, false);
this.d.reshape(numParam,1, false);
this.H.reshape(numParam,numParam, false);
this.negDelta.reshape(numParam,1, false);
this.tempParam.reshape(numParam,1, false);
this.A.reshape(numParam,numParam, false);
}
param.set(initParam);
// reshaping a matrix means that new memory is only declared when needed
temp0.reshape(numPoints,1, false);
temp1.reshape(numPoints,1, false);
tempDH.reshape(numPoints,1, false);
jacobian.reshape(numParam,numPoints, false);
} | java | protected void configure( DenseMatrix64F initParam , DenseMatrix64F X , DenseMatrix64F Y )
{
if( Y.getNumRows() != X.getNumRows() ) {
throw new IllegalArgumentException("Different vector lengths");
} else if( Y.getNumCols() != 1 /*|| X.getNumCols() != 1*/ ) {
throw new IllegalArgumentException("Inputs must be a column vector");
}
int numParam = initParam.getNumElements();
int numPoints = Y.getNumRows();
if( param.getNumElements() != initParam.getNumElements() ) {
// reshaping a matrix means that new memory is only declared when needed
this.param.reshape(numParam,1, false);
this.d.reshape(numParam,1, false);
this.H.reshape(numParam,numParam, false);
this.negDelta.reshape(numParam,1, false);
this.tempParam.reshape(numParam,1, false);
this.A.reshape(numParam,numParam, false);
}
param.set(initParam);
// reshaping a matrix means that new memory is only declared when needed
temp0.reshape(numPoints,1, false);
temp1.reshape(numPoints,1, false);
tempDH.reshape(numPoints,1, false);
jacobian.reshape(numParam,numPoints, false);
} | [
"protected",
"void",
"configure",
"(",
"DenseMatrix64F",
"initParam",
",",
"DenseMatrix64F",
"X",
",",
"DenseMatrix64F",
"Y",
")",
"{",
"if",
"(",
"Y",
".",
"getNumRows",
"(",
")",
"!=",
"X",
".",
"getNumRows",
"(",
")",
")",
"{",
"throw",
"new",
"Illega... | Performs sanity checks on the input data and reshapes internal matrices. By reshaping
a matrix it will only declare new memory when needed. | [
"Performs",
"sanity",
"checks",
"on",
"the",
"input",
"data",
"and",
"reshapes",
"internal",
"matrices",
".",
"By",
"reshaping",
"a",
"matrix",
"it",
"will",
"only",
"declare",
"new",
"memory",
"when",
"needed",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/LevenbergMarquardt.java#L206-L236 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java | ZoneRules.readExternal | static ZoneRules readExternal(DataInput in) throws IOException, ClassNotFoundException {
int stdSize = in.readInt();
long[] stdTrans = (stdSize == 0) ? EMPTY_LONG_ARRAY
: new long[stdSize];
for (int i = 0; i < stdSize; i++) {
stdTrans[i] = Ser.readEpochSec(in);
}
ZoneOffset[] stdOffsets = new ZoneOffset[stdSize + 1];
for (int i = 0; i < stdOffsets.length; i++) {
stdOffsets[i] = Ser.readOffset(in);
}
int savSize = in.readInt();
long[] savTrans = (savSize == 0) ? EMPTY_LONG_ARRAY
: new long[savSize];
for (int i = 0; i < savSize; i++) {
savTrans[i] = Ser.readEpochSec(in);
}
ZoneOffset[] savOffsets = new ZoneOffset[savSize + 1];
for (int i = 0; i < savOffsets.length; i++) {
savOffsets[i] = Ser.readOffset(in);
}
int ruleSize = in.readByte();
ZoneOffsetTransitionRule[] rules = (ruleSize == 0) ?
EMPTY_LASTRULES : new ZoneOffsetTransitionRule[ruleSize];
for (int i = 0; i < ruleSize; i++) {
rules[i] = ZoneOffsetTransitionRule.readExternal(in);
}
return new ZoneRules(stdTrans, stdOffsets, savTrans, savOffsets, rules);
} | java | static ZoneRules readExternal(DataInput in) throws IOException, ClassNotFoundException {
int stdSize = in.readInt();
long[] stdTrans = (stdSize == 0) ? EMPTY_LONG_ARRAY
: new long[stdSize];
for (int i = 0; i < stdSize; i++) {
stdTrans[i] = Ser.readEpochSec(in);
}
ZoneOffset[] stdOffsets = new ZoneOffset[stdSize + 1];
for (int i = 0; i < stdOffsets.length; i++) {
stdOffsets[i] = Ser.readOffset(in);
}
int savSize = in.readInt();
long[] savTrans = (savSize == 0) ? EMPTY_LONG_ARRAY
: new long[savSize];
for (int i = 0; i < savSize; i++) {
savTrans[i] = Ser.readEpochSec(in);
}
ZoneOffset[] savOffsets = new ZoneOffset[savSize + 1];
for (int i = 0; i < savOffsets.length; i++) {
savOffsets[i] = Ser.readOffset(in);
}
int ruleSize = in.readByte();
ZoneOffsetTransitionRule[] rules = (ruleSize == 0) ?
EMPTY_LASTRULES : new ZoneOffsetTransitionRule[ruleSize];
for (int i = 0; i < ruleSize; i++) {
rules[i] = ZoneOffsetTransitionRule.readExternal(in);
}
return new ZoneRules(stdTrans, stdOffsets, savTrans, savOffsets, rules);
} | [
"static",
"ZoneRules",
"readExternal",
"(",
"DataInput",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"int",
"stdSize",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"long",
"[",
"]",
"stdTrans",
"=",
"(",
"stdSize",
"==",
"0",
")",
... | Reads the state from the stream.
@param in the input stream, not null
@return the created object, not null
@throws IOException if an error occurs | [
"Reads",
"the",
"state",
"from",
"the",
"stream",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java#L429-L457 |
apache/incubator-atlas | webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java | EntityREST.deleteClassification | @DELETE
@Path("/guid/{guid}/classification/{classificationName}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public void deleteClassification(@PathParam("guid") String guid,
@PathParam("classificationName") final String classificationName) throws AtlasBaseException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.deleteClassification(" + guid + "," + classificationName + ")");
}
if (StringUtils.isEmpty(guid)) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
}
ensureClassificationType(classificationName);
entitiesStore.deleteClassifications(guid, new ArrayList<String>() {{ add(classificationName);}} );
} finally {
AtlasPerfTracer.log(perf);
}
} | java | @DELETE
@Path("/guid/{guid}/classification/{classificationName}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public void deleteClassification(@PathParam("guid") String guid,
@PathParam("classificationName") final String classificationName) throws AtlasBaseException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.deleteClassification(" + guid + "," + classificationName + ")");
}
if (StringUtils.isEmpty(guid)) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
}
ensureClassificationType(classificationName);
entitiesStore.deleteClassifications(guid, new ArrayList<String>() {{ add(classificationName);}} );
} finally {
AtlasPerfTracer.log(perf);
}
} | [
"@",
"DELETE",
"@",
"Path",
"(",
"\"/guid/{guid}/classification/{classificationName}\"",
")",
"@",
"Produces",
"(",
"Servlets",
".",
"JSON_MEDIA_TYPE",
")",
"public",
"void",
"deleteClassification",
"(",
"@",
"PathParam",
"(",
"\"guid\"",
")",
"String",
"guid",
",",... | Deletes a given classification from an existing entity represented by a guid.
@param guid globally unique identifier for the entity
@param classificationName name of the classifcation | [
"Deletes",
"a",
"given",
"classification",
"from",
"an",
"existing",
"entity",
"represented",
"by",
"a",
"guid",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java#L382-L404 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java | StylesheetHandler.resolveEntity | public InputSource resolveEntity(String publicId, String systemId)
throws org.xml.sax.SAXException
{
return getCurrentProcessor().resolveEntity(this, publicId, systemId);
} | java | public InputSource resolveEntity(String publicId, String systemId)
throws org.xml.sax.SAXException
{
return getCurrentProcessor().resolveEntity(this, publicId, systemId);
} | [
"public",
"InputSource",
"resolveEntity",
"(",
"String",
"publicId",
",",
"String",
"systemId",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"return",
"getCurrentProcessor",
"(",
")",
".",
"resolveEntity",
"(",
"this",
",",
"publicId... | Resolve an external entity.
@param publicId The public identifer, or null if none is
available.
@param systemId The system identifier provided in the XML
document.
@return The new input source, or null to require the
default behaviour.
@throws org.xml.sax.SAXException if the entity can not be resolved. | [
"Resolve",
"an",
"external",
"entity",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L307-L311 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/TrueTypeFont.java | TrueTypeFont.getKerning | public int getKerning(int char1, int char2) {
int metrics[] = getMetricsTT(char1);
if (metrics == null)
return 0;
int c1 = metrics[0];
metrics = getMetricsTT(char2);
if (metrics == null)
return 0;
int c2 = metrics[0];
return kerning.get((c1 << 16) + c2);
} | java | public int getKerning(int char1, int char2) {
int metrics[] = getMetricsTT(char1);
if (metrics == null)
return 0;
int c1 = metrics[0];
metrics = getMetricsTT(char2);
if (metrics == null)
return 0;
int c2 = metrics[0];
return kerning.get((c1 << 16) + c2);
} | [
"public",
"int",
"getKerning",
"(",
"int",
"char1",
",",
"int",
"char2",
")",
"{",
"int",
"metrics",
"[",
"]",
"=",
"getMetricsTT",
"(",
"char1",
")",
";",
"if",
"(",
"metrics",
"==",
"null",
")",
"return",
"0",
";",
"int",
"c1",
"=",
"metrics",
"[... | Gets the kerning between two Unicode chars.
@param char1 the first char
@param char2 the second char
@return the kerning to be applied | [
"Gets",
"the",
"kerning",
"between",
"two",
"Unicode",
"chars",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TrueTypeFont.java#L1023-L1033 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java | Strs.indexAny | public static int indexAny(String target, Integer fromIndex, String... indexWith) {
return indexAny(target, fromIndex, Arrays.asList(indexWith));
} | java | public static int indexAny(String target, Integer fromIndex, String... indexWith) {
return indexAny(target, fromIndex, Arrays.asList(indexWith));
} | [
"public",
"static",
"int",
"indexAny",
"(",
"String",
"target",
",",
"Integer",
"fromIndex",
",",
"String",
"...",
"indexWith",
")",
"{",
"return",
"indexAny",
"(",
"target",
",",
"fromIndex",
",",
"Arrays",
".",
"asList",
"(",
"indexWith",
")",
")",
";",
... | Search target string to find the first index of any string in the given string array, starting at the specified index
@param target
@param fromIndex
@param indexWith
@return | [
"Search",
"target",
"string",
"to",
"find",
"the",
"first",
"index",
"of",
"any",
"string",
"in",
"the",
"given",
"string",
"array",
"starting",
"at",
"the",
"specified",
"index"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L276-L278 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolFactory.java | PoolFactory.createPool | public static Pool createPool(String type, ConnectionManager cm, PoolConfiguration pc)
{
if (type == null || type.equals(""))
return new DefaultPool(cm, pc);
type = type.toLowerCase(Locale.US);
switch (type)
{
case "default":
return new DefaultPool(cm, pc);
case "stable":
return new StablePool(cm, pc);
default:
{
Class<? extends Pool> clz = customPoolTypes.get(type);
if (clz == null)
throw new RuntimeException(type + " can not be found");
try
{
Constructor constructor = clz.getConstructor(ConnectionManager.class, PoolConfiguration.class);
return (Pool)constructor.newInstance(cm, pc);
}
catch (Exception e)
{
throw new RuntimeException(type + " can not be created", e);
}
}
}
} | java | public static Pool createPool(String type, ConnectionManager cm, PoolConfiguration pc)
{
if (type == null || type.equals(""))
return new DefaultPool(cm, pc);
type = type.toLowerCase(Locale.US);
switch (type)
{
case "default":
return new DefaultPool(cm, pc);
case "stable":
return new StablePool(cm, pc);
default:
{
Class<? extends Pool> clz = customPoolTypes.get(type);
if (clz == null)
throw new RuntimeException(type + " can not be found");
try
{
Constructor constructor = clz.getConstructor(ConnectionManager.class, PoolConfiguration.class);
return (Pool)constructor.newInstance(cm, pc);
}
catch (Exception e)
{
throw new RuntimeException(type + " can not be created", e);
}
}
}
} | [
"public",
"static",
"Pool",
"createPool",
"(",
"String",
"type",
",",
"ConnectionManager",
"cm",
",",
"PoolConfiguration",
"pc",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"equals",
"(",
"\"\"",
")",
")",
"return",
"new",
"DefaultPool",
... | Create a pool
@param type The type
@param cm The connection manager
@param pc The pool configuration
@return The pool | [
"Create",
"a",
"pool"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolFactory.java#L74-L105 |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/config/xml/SendSoapFaultActionParser.java | SendSoapFaultActionParser.parseFaultDetail | private void parseFaultDetail(BeanDefinitionBuilder builder, Element faultElement) {
List<Element> faultDetailElements = DomUtils.getChildElementsByTagName(faultElement, "fault-detail");
List<String> faultDetails = new ArrayList<String>();
List<String> faultDetailResourcePaths = new ArrayList<String>();
for (Element faultDetailElement : faultDetailElements) {
if (faultDetailElement.hasAttribute("file")) {
if (StringUtils.hasText(DomUtils.getTextValue(faultDetailElement).trim())) {
throw new BeanCreationException("You tried to set fault-detail by file resource attribute and inline text value at the same time! " +
"Please choose one of them.");
}
String charset = faultDetailElement.getAttribute("charset");
String filePath = faultDetailElement.getAttribute("file");
faultDetailResourcePaths.add(filePath + (StringUtils.hasText(charset) ? FileUtils.FILE_PATH_CHARSET_PARAMETER + charset : ""));
} else {
String faultDetailData = DomUtils.getTextValue(faultDetailElement).trim();
if (StringUtils.hasText(faultDetailData)) {
faultDetails.add(faultDetailData);
} else {
throw new BeanCreationException("Not content for fault-detail is set! Either use file attribute or inline text value for fault-detail element.");
}
}
}
builder.addPropertyValue("faultDetails", faultDetails);
builder.addPropertyValue("faultDetailResourcePaths", faultDetailResourcePaths);
} | java | private void parseFaultDetail(BeanDefinitionBuilder builder, Element faultElement) {
List<Element> faultDetailElements = DomUtils.getChildElementsByTagName(faultElement, "fault-detail");
List<String> faultDetails = new ArrayList<String>();
List<String> faultDetailResourcePaths = new ArrayList<String>();
for (Element faultDetailElement : faultDetailElements) {
if (faultDetailElement.hasAttribute("file")) {
if (StringUtils.hasText(DomUtils.getTextValue(faultDetailElement).trim())) {
throw new BeanCreationException("You tried to set fault-detail by file resource attribute and inline text value at the same time! " +
"Please choose one of them.");
}
String charset = faultDetailElement.getAttribute("charset");
String filePath = faultDetailElement.getAttribute("file");
faultDetailResourcePaths.add(filePath + (StringUtils.hasText(charset) ? FileUtils.FILE_PATH_CHARSET_PARAMETER + charset : ""));
} else {
String faultDetailData = DomUtils.getTextValue(faultDetailElement).trim();
if (StringUtils.hasText(faultDetailData)) {
faultDetails.add(faultDetailData);
} else {
throw new BeanCreationException("Not content for fault-detail is set! Either use file attribute or inline text value for fault-detail element.");
}
}
}
builder.addPropertyValue("faultDetails", faultDetails);
builder.addPropertyValue("faultDetailResourcePaths", faultDetailResourcePaths);
} | [
"private",
"void",
"parseFaultDetail",
"(",
"BeanDefinitionBuilder",
"builder",
",",
"Element",
"faultElement",
")",
"{",
"List",
"<",
"Element",
">",
"faultDetailElements",
"=",
"DomUtils",
".",
"getChildElementsByTagName",
"(",
"faultElement",
",",
"\"fault-detail\"",... | Parses the fault detail element.
@param builder
@param faultElement the fault DOM element. | [
"Parses",
"the",
"fault",
"detail",
"element",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/config/xml/SendSoapFaultActionParser.java#L79-L107 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java | JdbcCpoAdapter.updateObject | @Override
public <T> long updateObject(String name, T obj, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException {
return processUpdateGroup(obj, JdbcCpoAdapter.UPDATE_GROUP, name, wheres, orderBy, nativeExpressions);
} | java | @Override
public <T> long updateObject(String name, T obj, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException {
return processUpdateGroup(obj, JdbcCpoAdapter.UPDATE_GROUP, name, wheres, orderBy, nativeExpressions);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"long",
"updateObject",
"(",
"String",
"name",
",",
"T",
"obj",
",",
"Collection",
"<",
"CpoWhere",
">",
"wheres",
",",
"Collection",
"<",
"CpoOrderBy",
">",
"orderBy",
",",
"Collection",
"<",
"CpoNativeFunction",
... | Update the Object in the datasource. The CpoAdapter will check to see if the object exists in the datasource. If it
exists then the object will be updated. If it does not exist, an exception will be thrown
<p/>
<pre>Example:
<code>
<p/>
class SomeObject so = new SomeObject();
class CpoAdapter cpo = null;
<p/>
try {
cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
<p/>
if (cpo!=null) {
so.setId(1);
so.setName("SomeName");
try{
cpo.updateObject("updateSomeObject",so);
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The String name of the UPDATE Function Group that will be used to create the object in the datasource.
null signifies that the default rules will be used.
@param obj This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown.
@param wheres A collection of CpoWhere objects to be used by the function
@param orderBy A collection of CpoOrderBy objects to be used by the function
@param nativeExpressions A collection of CpoNativeFunction objects to be used by the function
@return The number of objects updated in the datasource
@throws CpoException Thrown if there are errors accessing the datasource | [
"Update",
"the",
"Object",
"in",
"the",
"datasource",
".",
"The",
"CpoAdapter",
"will",
"check",
"to",
"see",
"if",
"the",
"object",
"exists",
"in",
"the",
"datasource",
".",
"If",
"it",
"exists",
"then",
"the",
"object",
"will",
"be",
"updated",
".",
"I... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L1832-L1835 |
barend/java-iban | src/main/java/nl/garvelink/iban/Modulo97.java | Modulo97.calculateCheckDigits | public static int calculateCheckDigits(CharSequence input) {
if (input == null || input.length() < 5 || input.charAt(2) != '0' || input.charAt(3) != '0') {
throw new IllegalArgumentException("The input must be non-null, have a minimum length of five characters, and the characters at indices 2 and 3 must be '0'.");
}
return 98 - checksum(input);
} | java | public static int calculateCheckDigits(CharSequence input) {
if (input == null || input.length() < 5 || input.charAt(2) != '0' || input.charAt(3) != '0') {
throw new IllegalArgumentException("The input must be non-null, have a minimum length of five characters, and the characters at indices 2 and 3 must be '0'.");
}
return 98 - checksum(input);
} | [
"public",
"static",
"int",
"calculateCheckDigits",
"(",
"CharSequence",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
".",
"length",
"(",
")",
"<",
"5",
"||",
"input",
".",
"charAt",
"(",
"2",
")",
"!=",
"'",
"'",
"||",
"input",... | Calculates the check digits to be used in a MOD97 checked string.
@param input the input; the characters at indices 2 and 3 <strong>must</strong> be {@code '0'}. The input must
also satisfy the criteria defined in {@link #checksum(CharSequence)}.
@return the check digits to be used at indices 2 and 3 to make the input MOD97 verifiable.
@throws IllegalArgumentException if the input is in some way invalid. | [
"Calculates",
"the",
"check",
"digits",
"to",
"be",
"used",
"in",
"a",
"MOD97",
"checked",
"string",
"."
] | train | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/Modulo97.java#L70-L75 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/EntityLockService.java | EntityLockService.newReadLock | public IEntityLock newReadLock(EntityIdentifier entityID, String owner)
throws LockingException {
return lockService.newLock(
entityID.getType(), entityID.getKey(), IEntityLockService.READ_LOCK, owner);
} | java | public IEntityLock newReadLock(EntityIdentifier entityID, String owner)
throws LockingException {
return lockService.newLock(
entityID.getType(), entityID.getKey(), IEntityLockService.READ_LOCK, owner);
} | [
"public",
"IEntityLock",
"newReadLock",
"(",
"EntityIdentifier",
"entityID",
",",
"String",
"owner",
")",
"throws",
"LockingException",
"{",
"return",
"lockService",
".",
"newLock",
"(",
"entityID",
".",
"getType",
"(",
")",
",",
"entityID",
".",
"getKey",
"(",
... | Returns a read lock for the <code>IBasicEntity</code> and owner.
@return org.apereo.portal.concurrency.locking.IEntityLock
@param entityID EntityIdentifier
@param owner String
@exception LockingException | [
"Returns",
"a",
"read",
"lock",
"for",
"the",
"<code",
">",
"IBasicEntity<",
"/",
"code",
">",
"and",
"owner",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/EntityLockService.java#L145-L149 |
protostuff/protostuff | protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java | XmlIOUtil.writeListTo | public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema)
throws IOException
{
writeListTo(out, messages, schema, DEFAULT_OUTPUT_FACTORY);
} | java | public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema)
throws IOException
{
writeListTo(out, messages, schema, DEFAULT_OUTPUT_FACTORY);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"writeListTo",
"(",
"OutputStream",
"out",
",",
"List",
"<",
"T",
">",
"messages",
",",
"Schema",
"<",
"T",
">",
"schema",
")",
"throws",
"IOException",
"{",
"writeListTo",
"(",
"out",
",",
"messages",
",",
"s... | Serializes the {@code messages} into the {@link OutputStream} using the given schema. | [
"Serializes",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L458-L462 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/CFFFontSubset.java | CFFFontSubset.BuildIndexHeader | protected void BuildIndexHeader(int Count,int Offsize,int First)
{
// Add the count field
OutputList.addLast(new UInt16Item((char)Count)); // count
// Add the offsize field
OutputList.addLast(new UInt8Item((char)Offsize)); // offSize
// Add the first offset according to the offsize
switch(Offsize){
case 1:
OutputList.addLast(new UInt8Item((char)First)); // first offset
break;
case 2:
OutputList.addLast(new UInt16Item((char)First)); // first offset
break;
case 3:
OutputList.addLast(new UInt24Item((char)First)); // first offset
break;
case 4:
OutputList.addLast(new UInt32Item((char)First)); // first offset
break;
default:
break;
}
} | java | protected void BuildIndexHeader(int Count,int Offsize,int First)
{
// Add the count field
OutputList.addLast(new UInt16Item((char)Count)); // count
// Add the offsize field
OutputList.addLast(new UInt8Item((char)Offsize)); // offSize
// Add the first offset according to the offsize
switch(Offsize){
case 1:
OutputList.addLast(new UInt8Item((char)First)); // first offset
break;
case 2:
OutputList.addLast(new UInt16Item((char)First)); // first offset
break;
case 3:
OutputList.addLast(new UInt24Item((char)First)); // first offset
break;
case 4:
OutputList.addLast(new UInt32Item((char)First)); // first offset
break;
default:
break;
}
} | [
"protected",
"void",
"BuildIndexHeader",
"(",
"int",
"Count",
",",
"int",
"Offsize",
",",
"int",
"First",
")",
"{",
"// Add the count field",
"OutputList",
".",
"addLast",
"(",
"new",
"UInt16Item",
"(",
"(",
"char",
")",
"Count",
")",
")",
";",
"// count",
... | Function Build the header of an index
@param Count the count field of the index
@param Offsize the offsize field of the index
@param First the first offset of the index | [
"Function",
"Build",
"the",
"header",
"of",
"an",
"index"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/CFFFontSubset.java#L1244-L1267 |
oasp/oasp4j | modules/basic/src/main/java/io/oasp/module/basic/common/api/config/SimpleConfigProperties.java | SimpleConfigProperties.getChild | protected ConfigProperties getChild(String key, boolean create) {
if ((key == null) || (key.isEmpty())) {
return this;
}
if (key.indexOf(KEY_SEPARATOR) > 0) {
String[] segments = key.split("\\.");
return getChild(create, segments);
}
SimpleConfigProperties result = this.childMap.get(key);
if (result == null) {
result = createChild(key, create);
if (result == null) {
return EMPTY;
} else {
this.childMap.put(key, result);
this.nodeModifications++;
}
}
return result;
} | java | protected ConfigProperties getChild(String key, boolean create) {
if ((key == null) || (key.isEmpty())) {
return this;
}
if (key.indexOf(KEY_SEPARATOR) > 0) {
String[] segments = key.split("\\.");
return getChild(create, segments);
}
SimpleConfigProperties result = this.childMap.get(key);
if (result == null) {
result = createChild(key, create);
if (result == null) {
return EMPTY;
} else {
this.childMap.put(key, result);
this.nodeModifications++;
}
}
return result;
} | [
"protected",
"ConfigProperties",
"getChild",
"(",
"String",
"key",
",",
"boolean",
"create",
")",
"{",
"if",
"(",
"(",
"key",
"==",
"null",
")",
"||",
"(",
"key",
".",
"isEmpty",
"(",
")",
")",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"key"... | @see #getChild(String)
@param key the key of the requested child.
@param create - {@code true} to create if not exits, {@code false} otherwise.
@return the requested child. | [
"@see",
"#getChild",
"(",
"String",
")"
] | train | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/basic/src/main/java/io/oasp/module/basic/common/api/config/SimpleConfigProperties.java#L90-L110 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java | SwingGroovyMethods.leftShift | public static JPopupMenu leftShift(JPopupMenu self, GString gstr) {
self.add(gstr.toString());
return self;
} | java | public static JPopupMenu leftShift(JPopupMenu self, GString gstr) {
self.add(gstr.toString());
return self;
} | [
"public",
"static",
"JPopupMenu",
"leftShift",
"(",
"JPopupMenu",
"self",
",",
"GString",
"gstr",
")",
"{",
"self",
".",
"add",
"(",
"gstr",
".",
"toString",
"(",
")",
")",
";",
"return",
"self",
";",
"}"
] | Overloads the left shift operator to provide an easy way to add
components to a popupMenu.<p>
@param self a JPopupMenu
@param gstr a GString to be added to the popupMenu.
@return same popupMenu, after the value was added to it.
@since 1.6.4 | [
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"easy",
"way",
"to",
"add",
"components",
"to",
"a",
"popupMenu",
".",
"<p",
">"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L952-L955 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSetManipulator.java | ReactionSetManipulator.getRelevantReactionsAsReactant | public static IReactionSet getRelevantReactionsAsReactant(IReactionSet reactSet, IAtomContainer molecule) {
IReactionSet newReactSet = reactSet.getBuilder().newInstance(IReactionSet.class);
for (IReaction reaction : reactSet.reactions()) {
for (IAtomContainer atomContainer : reaction.getReactants().atomContainers())
if (atomContainer.equals(molecule)) newReactSet.addReaction(reaction);
}
return newReactSet;
} | java | public static IReactionSet getRelevantReactionsAsReactant(IReactionSet reactSet, IAtomContainer molecule) {
IReactionSet newReactSet = reactSet.getBuilder().newInstance(IReactionSet.class);
for (IReaction reaction : reactSet.reactions()) {
for (IAtomContainer atomContainer : reaction.getReactants().atomContainers())
if (atomContainer.equals(molecule)) newReactSet.addReaction(reaction);
}
return newReactSet;
} | [
"public",
"static",
"IReactionSet",
"getRelevantReactionsAsReactant",
"(",
"IReactionSet",
"reactSet",
",",
"IAtomContainer",
"molecule",
")",
"{",
"IReactionSet",
"newReactSet",
"=",
"reactSet",
".",
"getBuilder",
"(",
")",
".",
"newInstance",
"(",
"IReactionSet",
".... | Get all Reactions object containing a Molecule as a Reactant from a set
of Reactions.
@param reactSet The set of reaction to inspect
@param molecule The molecule to find as a reactant
@return The IReactionSet | [
"Get",
"all",
"Reactions",
"object",
"containing",
"a",
"Molecule",
"as",
"a",
"Reactant",
"from",
"a",
"set",
"of",
"Reactions",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSetManipulator.java#L163-L170 |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeFilterVar | protected void encodeFilterVar(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, false);
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
if (column.getValueExpression("filterBy") == null) {
vb.appendArrayValue("false", true);
continue;
}
final Collection<SelectItem> options = column.getFilterOptions();
if (options == null) {
vb.appendArrayValue("true", true);
}
else {
final JavascriptVarBuilder vbOptions = new JavascriptVarBuilder(null, false);
for (final SelectItem item : options) {
vbOptions.appendArrayValue(
"{ label: \"" + item.getLabel() + "\", value: \"" + item.getValue() + "\"}", false);
}
vb.appendArrayValue(vbOptions.closeVar().toString(), false);
}
}
wb.nativeAttr("filters", vb.closeVar().toString());
} | java | protected void encodeFilterVar(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
throws IOException {
final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, false);
for (final SheetColumn column : sheet.getColumns()) {
if (!column.isRendered()) {
continue;
}
if (column.getValueExpression("filterBy") == null) {
vb.appendArrayValue("false", true);
continue;
}
final Collection<SelectItem> options = column.getFilterOptions();
if (options == null) {
vb.appendArrayValue("true", true);
}
else {
final JavascriptVarBuilder vbOptions = new JavascriptVarBuilder(null, false);
for (final SelectItem item : options) {
vbOptions.appendArrayValue(
"{ label: \"" + item.getLabel() + "\", value: \"" + item.getValue() + "\"}", false);
}
vb.appendArrayValue(vbOptions.closeVar().toString(), false);
}
}
wb.nativeAttr("filters", vb.closeVar().toString());
} | [
"protected",
"void",
"encodeFilterVar",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"Sheet",
"sheet",
",",
"final",
"WidgetBuilder",
"wb",
")",
"throws",
"IOException",
"{",
"final",
"JavascriptVarBuilder",
"vb",
"=",
"new",
"JavascriptVarBuilder",
"(",
... | Encodes a javascript filter var that informs the col header event of the column's filtering options. The var is an array in the form:
<pre>
["false","true",["option 1", "option 2"]]
</pre>
False indicates no filtering for the column. True indicates simple input text filter. Array of values indicates a drop down filter with the listed
options.
@param context
@param sheet
@param wb
@throws IOException | [
"Encodes",
"a",
"javascript",
"filter",
"var",
"that",
"informs",
"the",
"col",
"header",
"event",
"of",
"the",
"column",
"s",
"filtering",
"options",
".",
"The",
"var",
"is",
"an",
"array",
"in",
"the",
"form",
":"
] | train | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L740-L769 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/masterslave/MasterSlave.java | MasterSlave.connectAsync | public static <K, V> CompletableFuture<StatefulRedisMasterSlaveConnection<K, V>> connectAsync(RedisClient redisClient,
RedisCodec<K, V> codec, Iterable<RedisURI> redisURIs) {
return transformAsyncConnectionException(connectAsyncSentinelOrStaticSetup(redisClient, codec, redisURIs), redisURIs);
} | java | public static <K, V> CompletableFuture<StatefulRedisMasterSlaveConnection<K, V>> connectAsync(RedisClient redisClient,
RedisCodec<K, V> codec, Iterable<RedisURI> redisURIs) {
return transformAsyncConnectionException(connectAsyncSentinelOrStaticSetup(redisClient, codec, redisURIs), redisURIs);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"CompletableFuture",
"<",
"StatefulRedisMasterSlaveConnection",
"<",
"K",
",",
"V",
">",
">",
"connectAsync",
"(",
"RedisClient",
"redisClient",
",",
"RedisCodec",
"<",
"K",
",",
"V",
">",
"codec",
",",
"Iterable"... | Open asynchronously a new connection to a Redis Master-Slave server/servers using the supplied {@link RedisURI} and the
supplied {@link RedisCodec codec} to encode/decode keys.
<p>
This {@link MasterSlave} performs auto-discovery of nodes if the URI is a Redis Sentinel URI. Master/Slave URIs will be
treated as static topology and no additional hosts are discovered in such case. Redis Standalone Master/Slave will
discover the roles of the supplied {@link RedisURI URIs} and issue commands to the appropriate node.
</p>
@param redisClient the Redis client.
@param codec Use this codec to encode/decode keys and values, must not be {@literal null}.
@param redisURIs the Redis server to connect to, must not be {@literal null}.
@param <K> Key type.
@param <V> Value type.
@return {@link CompletableFuture} that is notified once the connect is finished. | [
"Open",
"asynchronously",
"a",
"new",
"connection",
"to",
"a",
"Redis",
"Master",
"-",
"Slave",
"server",
"/",
"servers",
"using",
"the",
"supplied",
"{",
"@link",
"RedisURI",
"}",
"and",
"the",
"supplied",
"{",
"@link",
"RedisCodec",
"codec",
"}",
"to",
"... | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/masterslave/MasterSlave.java#L194-L197 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java | AbstractRadial.create_KNOB_Image | private BufferedImage create_KNOB_Image(final int WIDTH, final KnobType KNOB_TYPE, final KnobStyle KNOB_STYLE) {
return KNOB_FACTORY.create_KNOB_Image(WIDTH, KNOB_TYPE, KNOB_STYLE);
} | java | private BufferedImage create_KNOB_Image(final int WIDTH, final KnobType KNOB_TYPE, final KnobStyle KNOB_STYLE) {
return KNOB_FACTORY.create_KNOB_Image(WIDTH, KNOB_TYPE, KNOB_STYLE);
} | [
"private",
"BufferedImage",
"create_KNOB_Image",
"(",
"final",
"int",
"WIDTH",
",",
"final",
"KnobType",
"KNOB_TYPE",
",",
"final",
"KnobStyle",
"KNOB_STYLE",
")",
"{",
"return",
"KNOB_FACTORY",
".",
"create_KNOB_Image",
"(",
"WIDTH",
",",
"KNOB_TYPE",
",",
"KNOB_... | Creates a single alignment post image that could be placed on all the positions where it is needed
@param WIDTH
@param KNOB_TYPE
@return a buffered image that contains a single alignment post of the given type | [
"Creates",
"a",
"single",
"alignment",
"post",
"image",
"that",
"could",
"be",
"placed",
"on",
"all",
"the",
"positions",
"where",
"it",
"is",
"needed"
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L2822-L2824 |
tweea/matrixjavalib-main-common | src/main/java/net/matrix/security/Cryptos.java | Cryptos.hmacSha1 | public static byte[] hmacSha1(final byte[] input, final byte[] key)
throws GeneralSecurityException {
try {
SecretKey secretKey = new SecretKeySpec(key, HMACSHA1_NAME);
Mac mac = Mac.getInstance(HMACSHA1_NAME);
mac.init(secretKey);
return mac.doFinal(input);
} catch (NoSuchAlgorithmException e) {
throw new ImpossibleException(e);
}
} | java | public static byte[] hmacSha1(final byte[] input, final byte[] key)
throws GeneralSecurityException {
try {
SecretKey secretKey = new SecretKeySpec(key, HMACSHA1_NAME);
Mac mac = Mac.getInstance(HMACSHA1_NAME);
mac.init(secretKey);
return mac.doFinal(input);
} catch (NoSuchAlgorithmException e) {
throw new ImpossibleException(e);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"hmacSha1",
"(",
"final",
"byte",
"[",
"]",
"input",
",",
"final",
"byte",
"[",
"]",
"key",
")",
"throws",
"GeneralSecurityException",
"{",
"try",
"{",
"SecretKey",
"secretKey",
"=",
"new",
"SecretKeySpec",
"(",
"key",... | 使用 HMAC-SHA1 进行消息签名,返回字节数组,长度为 20 字节。
@param input
原始输入字符数组
@param key
HMAC-SHA1 密钥
@return 签名
@throws GeneralSecurityException
签名失败 | [
"使用",
"HMAC",
"-",
"SHA1",
"进行消息签名,返回字节数组",
"长度为",
"20",
"字节。"
] | train | https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/security/Cryptos.java#L80-L90 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java | KeyMap.get | public V get(K key) {
final int hash = hash(key);
final int slot = indexOf(hash);
// search the chain from the slot
for (Entry<K, V> entry = table[slot]; entry != null; entry = entry.next) {
if (entry.hashCode == hash && entry.key.equals(key)) {
return entry.value;
}
}
// not found
return null;
} | java | public V get(K key) {
final int hash = hash(key);
final int slot = indexOf(hash);
// search the chain from the slot
for (Entry<K, V> entry = table[slot]; entry != null; entry = entry.next) {
if (entry.hashCode == hash && entry.key.equals(key)) {
return entry.value;
}
}
// not found
return null;
} | [
"public",
"V",
"get",
"(",
"K",
"key",
")",
"{",
"final",
"int",
"hash",
"=",
"hash",
"(",
"key",
")",
";",
"final",
"int",
"slot",
"=",
"indexOf",
"(",
"hash",
")",
";",
"// search the chain from the slot",
"for",
"(",
"Entry",
"<",
"K",
",",
"V",
... | Looks up the value mapped under the given key. Returns null if no value is mapped under this key.
@param key The key to look up.
@return The value associated with the key, or null, if no value is found for the key.
@throws java.lang.NullPointerException Thrown, if the key is null. | [
"Looks",
"up",
"the",
"value",
"mapped",
"under",
"the",
"given",
"key",
".",
"Returns",
"null",
"if",
"no",
"value",
"is",
"mapped",
"under",
"this",
"key",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java#L219-L232 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_associatedObject_GET | public OvhAssociatedObject order_orderId_associatedObject_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/associatedObject";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAssociatedObject.class);
} | java | public OvhAssociatedObject order_orderId_associatedObject_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/associatedObject";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAssociatedObject.class);
} | [
"public",
"OvhAssociatedObject",
"order_orderId_associatedObject_GET",
"(",
"Long",
"orderId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/associatedObject\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"orderId",
"... | Return main data about the object the processing of the order generated
REST: GET /me/order/{orderId}/associatedObject
@param orderId [required] | [
"Return",
"main",
"data",
"about",
"the",
"object",
"the",
"processing",
"of",
"the",
"order",
"generated"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1871-L1876 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java | ConfigValidator.checkLocalUpdatePolicy | private static void checkLocalUpdatePolicy(String mapName, LocalUpdatePolicy localUpdatePolicy) {
if (localUpdatePolicy != INVALIDATE) {
throw new IllegalArgumentException(format("Wrong `local-update-policy` option is selected for `%s` map Near Cache."
+ " Only `%s` option is supported but found `%s`", mapName, INVALIDATE, localUpdatePolicy));
}
} | java | private static void checkLocalUpdatePolicy(String mapName, LocalUpdatePolicy localUpdatePolicy) {
if (localUpdatePolicy != INVALIDATE) {
throw new IllegalArgumentException(format("Wrong `local-update-policy` option is selected for `%s` map Near Cache."
+ " Only `%s` option is supported but found `%s`", mapName, INVALIDATE, localUpdatePolicy));
}
} | [
"private",
"static",
"void",
"checkLocalUpdatePolicy",
"(",
"String",
"mapName",
",",
"LocalUpdatePolicy",
"localUpdatePolicy",
")",
"{",
"if",
"(",
"localUpdatePolicy",
"!=",
"INVALIDATE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"\... | Checks IMap's supported Near Cache local update policy configuration.
@param mapName name of the map that Near Cache will be created for
@param localUpdatePolicy local update policy | [
"Checks",
"IMap",
"s",
"supported",
"Near",
"Cache",
"local",
"update",
"policy",
"configuration",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java#L218-L223 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Waiter.java | Waiter.getSupportFragment | private Fragment getSupportFragment(String tag, int id){
FragmentActivity fragmentActivity = null;
try{
fragmentActivity = (FragmentActivity) activityUtils.getCurrentActivity(false);
}catch (Throwable ignored) {}
if(fragmentActivity != null){
try{
if(tag == null)
return fragmentActivity.getSupportFragmentManager().findFragmentById(id);
else
return fragmentActivity.getSupportFragmentManager().findFragmentByTag(tag);
}catch (NoSuchMethodError ignored) {}
}
return null;
} | java | private Fragment getSupportFragment(String tag, int id){
FragmentActivity fragmentActivity = null;
try{
fragmentActivity = (FragmentActivity) activityUtils.getCurrentActivity(false);
}catch (Throwable ignored) {}
if(fragmentActivity != null){
try{
if(tag == null)
return fragmentActivity.getSupportFragmentManager().findFragmentById(id);
else
return fragmentActivity.getSupportFragmentManager().findFragmentByTag(tag);
}catch (NoSuchMethodError ignored) {}
}
return null;
} | [
"private",
"Fragment",
"getSupportFragment",
"(",
"String",
"tag",
",",
"int",
"id",
")",
"{",
"FragmentActivity",
"fragmentActivity",
"=",
"null",
";",
"try",
"{",
"fragmentActivity",
"=",
"(",
"FragmentActivity",
")",
"activityUtils",
".",
"getCurrentActivity",
... | Returns a SupportFragment with a given tag or id.
@param tag the tag of the SupportFragment or null if no tag
@param id the id of the SupportFragment
@return a SupportFragment with a given tag or id | [
"Returns",
"a",
"SupportFragment",
"with",
"a",
"given",
"tag",
"or",
"id",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L703-L719 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InterceptorProxy.java | InterceptorProxy.invokeInterceptor | public final Object invokeInterceptor(Object bean, InvocationContext inv, Object[] interceptors) throws Exception {
// Interceptor instance is the bean instance itself if the
// interceptor index is < 0.
Object interceptorInstance = (ivBeanInterceptor) ? bean : interceptors[ivInterceptorIndex];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d367572.7
{
Tr.debug(tc, "invoking " + this);
Tr.debug(tc, "interceptor instance = " + interceptorInstance);
}
// Does interceptor method require InvocationContext as an argument?
if (ivRequiresInvocationContext) {
try {
// Yes it does, so pass it as an argument.
Object[] args = new Object[] { inv }; // d404122
return ivInterceptorMethod.invoke(interceptorInstance, args); // d404122
} catch (IllegalArgumentException ie) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ivInterceptorMethod: " + ivInterceptorMethod.toString() + " class: " + ivInterceptorMethod.getClass() + " declaring class: "
+ ivInterceptorMethod.getDeclaringClass());
Tr.debug(tc, "interceptorInstance: " + interceptorInstance.toString() + " class: " + interceptorInstance.getClass());
}
throw ie;
}
} else {
// Nope, interceptor method takes no arguments.
return ivInterceptorMethod.invoke(interceptorInstance, NO_ARGS);
}
} | java | public final Object invokeInterceptor(Object bean, InvocationContext inv, Object[] interceptors) throws Exception {
// Interceptor instance is the bean instance itself if the
// interceptor index is < 0.
Object interceptorInstance = (ivBeanInterceptor) ? bean : interceptors[ivInterceptorIndex];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d367572.7
{
Tr.debug(tc, "invoking " + this);
Tr.debug(tc, "interceptor instance = " + interceptorInstance);
}
// Does interceptor method require InvocationContext as an argument?
if (ivRequiresInvocationContext) {
try {
// Yes it does, so pass it as an argument.
Object[] args = new Object[] { inv }; // d404122
return ivInterceptorMethod.invoke(interceptorInstance, args); // d404122
} catch (IllegalArgumentException ie) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ivInterceptorMethod: " + ivInterceptorMethod.toString() + " class: " + ivInterceptorMethod.getClass() + " declaring class: "
+ ivInterceptorMethod.getDeclaringClass());
Tr.debug(tc, "interceptorInstance: " + interceptorInstance.toString() + " class: " + interceptorInstance.getClass());
}
throw ie;
}
} else {
// Nope, interceptor method takes no arguments.
return ivInterceptorMethod.invoke(interceptorInstance, NO_ARGS);
}
} | [
"public",
"final",
"Object",
"invokeInterceptor",
"(",
"Object",
"bean",
",",
"InvocationContext",
"inv",
",",
"Object",
"[",
"]",
"interceptors",
")",
"throws",
"Exception",
"{",
"// Interceptor instance is the bean instance itself if the",
"// interceptor index is < 0.",
... | Invoke the interceptor method associated with the interceptor index
that was passed as the "interceptorIndex" parameter of the
constructor method of this class.
@param bean is the EJB instance that is the target of this invocation.
@param inv is the InvocationContext to pass as an argument to the
interceptor method if the interceptor method requires it.
@param interceptors is the array of interceptor instances created for a
particular EJB instance. The array must be ordered so that the
"interceptorIndex" parameter passed to the constructor method
of this class can be used as an index into this array to
select the correct interceptor instance to invoke.
@return Object returned by interceptor instance.
@throws Exception | [
"Invoke",
"the",
"interceptor",
"method",
"associated",
"with",
"the",
"interceptor",
"index",
"that",
"was",
"passed",
"as",
"the",
"interceptorIndex",
"parameter",
"of",
"the",
"constructor",
"method",
"of",
"this",
"class",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/interceptors/InterceptorProxy.java#L173-L202 |
threerings/narya | core/src/main/java/com/threerings/crowd/chat/server/SpeakUtil.java | SpeakUtil.sendSpeak | public static void sendSpeak (DObject speakObj, Name speaker, String bundle, String message)
{
sendSpeak(speakObj, speaker, bundle, message, ChatCodes.DEFAULT_MODE);
} | java | public static void sendSpeak (DObject speakObj, Name speaker, String bundle, String message)
{
sendSpeak(speakObj, speaker, bundle, message, ChatCodes.DEFAULT_MODE);
} | [
"public",
"static",
"void",
"sendSpeak",
"(",
"DObject",
"speakObj",
",",
"Name",
"speaker",
",",
"String",
"bundle",
",",
"String",
"message",
")",
"{",
"sendSpeak",
"(",
"speakObj",
",",
"speaker",
",",
"bundle",
",",
"message",
",",
"ChatCodes",
".",
"D... | Sends a speak notification to the specified place object originating with the specified
speaker (the speaker optionally being a server entity that wishes to fake a "speak" message)
and with the supplied message content.
@param speakObj the object on which to generate the speak message.
@param speaker the username of the user that generated the message (or some special speaker
name for server messages).
@param bundle null when the message originates from a real human, the bundle identifier that
will be used by the client to translate the message text when the message originates from a
server entity "faking" a chat message.
@param message the text of the speak message. | [
"Sends",
"a",
"speak",
"notification",
"to",
"the",
"specified",
"place",
"object",
"originating",
"with",
"the",
"specified",
"speaker",
"(",
"the",
"speaker",
"optionally",
"being",
"a",
"server",
"entity",
"that",
"wishes",
"to",
"fake",
"a",
"speak",
"mess... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/server/SpeakUtil.java#L87-L90 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/ConstructorRef.java | ConstructorRef.create | public static ConstructorRef create(TypeInfo type, Iterable<Type> argTypes) {
return create(
type, new Method("<init>", Type.VOID_TYPE, Iterables.toArray(argTypes, Type.class)));
} | java | public static ConstructorRef create(TypeInfo type, Iterable<Type> argTypes) {
return create(
type, new Method("<init>", Type.VOID_TYPE, Iterables.toArray(argTypes, Type.class)));
} | [
"public",
"static",
"ConstructorRef",
"create",
"(",
"TypeInfo",
"type",
",",
"Iterable",
"<",
"Type",
">",
"argTypes",
")",
"{",
"return",
"create",
"(",
"type",
",",
"new",
"Method",
"(",
"\"<init>\"",
",",
"Type",
".",
"VOID_TYPE",
",",
"Iterables",
"."... | Returns a new {@link ConstructorRef} that refers to a constructor on the given type with the
given parameter types. | [
"Returns",
"a",
"new",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/ConstructorRef.java#L57-L60 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java | UScriptRun.sameScript | private static boolean sameScript(int scriptOne, int scriptTwo)
{
return scriptOne <= UScript.INHERITED || scriptTwo <= UScript.INHERITED || scriptOne == scriptTwo;
} | java | private static boolean sameScript(int scriptOne, int scriptTwo)
{
return scriptOne <= UScript.INHERITED || scriptTwo <= UScript.INHERITED || scriptOne == scriptTwo;
} | [
"private",
"static",
"boolean",
"sameScript",
"(",
"int",
"scriptOne",
",",
"int",
"scriptTwo",
")",
"{",
"return",
"scriptOne",
"<=",
"UScript",
".",
"INHERITED",
"||",
"scriptTwo",
"<=",
"UScript",
".",
"INHERITED",
"||",
"scriptOne",
"==",
"scriptTwo",
";",... | Compare two script codes to see if they are in the same script. If one script is
a strong script, and the other is INHERITED or COMMON, it will compare equal.
@param scriptOne one of the script codes.
@param scriptTwo the other script code.
@return <code>true</code> if the two scripts are the same.
@see android.icu.lang.UScript | [
"Compare",
"two",
"script",
"codes",
"to",
"see",
"if",
"they",
"are",
"in",
"the",
"same",
"script",
".",
"If",
"one",
"script",
"is",
"a",
"strong",
"script",
"and",
"the",
"other",
"is",
"INHERITED",
"or",
"COMMON",
"it",
"will",
"compare",
"equal",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java#L418-L421 |
alkacon/opencms-core | src/org/opencms/main/OpenCmsCore.java | OpenCmsCore.initCmsObjectFromSession | protected CmsObject initCmsObjectFromSession(HttpServletRequest req) throws CmsException {
String url = req.getRequestURL().toString();
String p = "[ " + url + " ] ";
if (LOG.isDebugEnabled()) {
LOG.debug(p + "Trying to init cms object from session for request \"" + req.toString() + "\".");
}
// try to get an OpenCms user session info object for this request
CmsSessionInfo sessionInfo = m_sessionManager.getSessionInfo(req);
if (sessionInfo == null) {
if (LOG.isDebugEnabled()) {
LOG.debug(p + "No session info found.");
}
return null;
}
// initialize the requested site root
CmsSite site = getSiteManager().matchRequest(req);
// a user name is found in the session manager, reuse this user information
CmsUUID project = sessionInfo.getProject();
// initialize site root from request
String siteroot = sessionInfo.getSiteRoot();
if (siteroot == null) {
// not sure if this can actually happen?
LOG.debug(p + "site root from session info was null, determining site root from current request's host");
siteroot = site.getSiteRoot();
}
// initialize user from request
CmsUser user = m_securityManager.readUser(null, sessionInfo.getUserId());
if (LOG.isDebugEnabled()) {
LOG.debug(p + "Initializing cms object with user \"" + user.getName() + "\".");
LOG.debug(p + "siteRoot = " + siteroot);
}
return initCmsObject(req, user, siteroot, project, sessionInfo.getOrganizationalUnitFqn());
} | java | protected CmsObject initCmsObjectFromSession(HttpServletRequest req) throws CmsException {
String url = req.getRequestURL().toString();
String p = "[ " + url + " ] ";
if (LOG.isDebugEnabled()) {
LOG.debug(p + "Trying to init cms object from session for request \"" + req.toString() + "\".");
}
// try to get an OpenCms user session info object for this request
CmsSessionInfo sessionInfo = m_sessionManager.getSessionInfo(req);
if (sessionInfo == null) {
if (LOG.isDebugEnabled()) {
LOG.debug(p + "No session info found.");
}
return null;
}
// initialize the requested site root
CmsSite site = getSiteManager().matchRequest(req);
// a user name is found in the session manager, reuse this user information
CmsUUID project = sessionInfo.getProject();
// initialize site root from request
String siteroot = sessionInfo.getSiteRoot();
if (siteroot == null) {
// not sure if this can actually happen?
LOG.debug(p + "site root from session info was null, determining site root from current request's host");
siteroot = site.getSiteRoot();
}
// initialize user from request
CmsUser user = m_securityManager.readUser(null, sessionInfo.getUserId());
if (LOG.isDebugEnabled()) {
LOG.debug(p + "Initializing cms object with user \"" + user.getName() + "\".");
LOG.debug(p + "siteRoot = " + siteroot);
}
return initCmsObject(req, user, siteroot, project, sessionInfo.getOrganizationalUnitFqn());
} | [
"protected",
"CmsObject",
"initCmsObjectFromSession",
"(",
"HttpServletRequest",
"req",
")",
"throws",
"CmsException",
"{",
"String",
"url",
"=",
"req",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"p",
"=",
"\"[ \"",
"+",
"url",
... | Initializes a new cms object from the session data of the request.<p>
If no session data is found, <code>null</code> is returned.<p>
@param req the request
@return the new initialized cms object
@throws CmsException if something goes wrong | [
"Initializes",
"a",
"new",
"cms",
"object",
"from",
"the",
"session",
"data",
"of",
"the",
"request",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsCore.java#L1217-L1255 |
brianwhu/xillium | base/src/main/java/org/xillium/base/beans/Strings.java | Strings.substringAfter | public static String substringAfter(String text, char match) {
return text.substring(text.indexOf(match)+1);
} | java | public static String substringAfter(String text, char match) {
return text.substring(text.indexOf(match)+1);
} | [
"public",
"static",
"String",
"substringAfter",
"(",
"String",
"text",
",",
"char",
"match",
")",
"{",
"return",
"text",
".",
"substring",
"(",
"text",
".",
"indexOf",
"(",
"match",
")",
"+",
"1",
")",
";",
"}"
] | Returns the substring following a given character, or the original if the character is not found.
@param text - a text string
@param match - a match character
@return the substring | [
"Returns",
"the",
"substring",
"following",
"a",
"given",
"character",
"or",
"the",
"original",
"if",
"the",
"character",
"is",
"not",
"found",
"."
] | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/beans/Strings.java#L205-L207 |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/config/liberty/CDI12ContainerConfig.java | CDI12ContainerConfig.updateConfiguration | protected void updateConfiguration(Map<String, Object> properties) {
if (properties != null) {
this.properties.clear();
this.properties.putAll(properties);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Current Properties: " + this.properties);
}
} | java | protected void updateConfiguration(Map<String, Object> properties) {
if (properties != null) {
this.properties.clear();
this.properties.putAll(properties);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Current Properties: " + this.properties);
}
} | [
"protected",
"void",
"updateConfiguration",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"this",
".",
"properties",
".",
"clear",
"(",
")",
";",
"this",
".",
"properties",
".",
... | Updates the current configuration properties
@param properties the updated configuration properties | [
"Updates",
"the",
"current",
"configuration",
"properties"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/config/liberty/CDI12ContainerConfig.java#L126-L134 |
Stratio/cassandra-lucene-index | plugin/src/main/java/com/stratio/cassandra/lucene/schema/mapping/DateRangeMapper.java | DateRangeMapper.makeShape | public NRShape makeShape(Date from, Date to) {
UnitNRShape fromShape = tree.toUnitShape(from);
UnitNRShape toShape = tree.toUnitShape(to);
return tree.toRangeShape(fromShape, toShape);
} | java | public NRShape makeShape(Date from, Date to) {
UnitNRShape fromShape = tree.toUnitShape(from);
UnitNRShape toShape = tree.toUnitShape(to);
return tree.toRangeShape(fromShape, toShape);
} | [
"public",
"NRShape",
"makeShape",
"(",
"Date",
"from",
",",
"Date",
"to",
")",
"{",
"UnitNRShape",
"fromShape",
"=",
"tree",
".",
"toUnitShape",
"(",
"from",
")",
";",
"UnitNRShape",
"toShape",
"=",
"tree",
".",
"toUnitShape",
"(",
"to",
")",
";",
"retur... | Makes an spatial shape representing the time range defined by the two specified dates.
@param from the start {@link Date}
@param to the end {@link Date}
@return a shape | [
"Makes",
"an",
"spatial",
"shape",
"representing",
"the",
"time",
"range",
"defined",
"by",
"the",
"two",
"specified",
"dates",
"."
] | train | https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/schema/mapping/DateRangeMapper.java#L123-L127 |
watson-developer-cloud/java-sdk | discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java | AggregationDeserializer.parseNext | private void parseNext(JsonReader in, HashMap<String, Object> objMap) throws IOException {
JsonToken token = in.peek();
String lastName = "";
if (token == JsonToken.NAME) {
lastName = in.nextName();
token = in.peek();
}
switch (token) {
case BEGIN_ARRAY:
parseArray(in, objMap, lastName);
break;
case BEGIN_OBJECT:
parseObject(in, objMap, lastName);
break;
case STRING:
objMap.put(lastName, in.nextString());
break;
case NUMBER:
objMap.put(lastName, in.nextDouble());
break;
case BOOLEAN:
objMap.put(lastName, in.nextBoolean());
break;
default:
throw new IOException("Unexpected JSON token encountered");
}
collapseMap(objMap);
} | java | private void parseNext(JsonReader in, HashMap<String, Object> objMap) throws IOException {
JsonToken token = in.peek();
String lastName = "";
if (token == JsonToken.NAME) {
lastName = in.nextName();
token = in.peek();
}
switch (token) {
case BEGIN_ARRAY:
parseArray(in, objMap, lastName);
break;
case BEGIN_OBJECT:
parseObject(in, objMap, lastName);
break;
case STRING:
objMap.put(lastName, in.nextString());
break;
case NUMBER:
objMap.put(lastName, in.nextDouble());
break;
case BOOLEAN:
objMap.put(lastName, in.nextBoolean());
break;
default:
throw new IOException("Unexpected JSON token encountered");
}
collapseMap(objMap);
} | [
"private",
"void",
"parseNext",
"(",
"JsonReader",
"in",
",",
"HashMap",
"<",
"String",
",",
"Object",
">",
"objMap",
")",
"throws",
"IOException",
"{",
"JsonToken",
"token",
"=",
"in",
".",
"peek",
"(",
")",
";",
"String",
"lastName",
"=",
"\"\"",
";",
... | Checks the next {@link JsonToken} to decide the next appropriate parsing method.
@param in {@link JsonReader} object used for parsing
@param objMap Map used to build the structure for the resulting {@link QueryAggregation} object
@throws IOException signals that there has been an IO exception | [
"Checks",
"the",
"next",
"{",
"@link",
"JsonToken",
"}",
"to",
"decide",
"the",
"next",
"appropriate",
"parsing",
"method",
"."
] | train | https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/discovery/src/main/java/com/ibm/watson/discovery/v1/query/AggregationDeserializer.java#L117-L147 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/Utils.java | Utils.indexOf | public static int indexOf(byte[] buffer, char ch) {
if (buffer == null) {
return -1;
}
for (int index = 0; index < buffer.length; index++) {
if (buffer[index] == ch) {
return index;
}
}
return -1;
} | java | public static int indexOf(byte[] buffer, char ch) {
if (buffer == null) {
return -1;
}
for (int index = 0; index < buffer.length; index++) {
if (buffer[index] == ch) {
return index;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"byte",
"[",
"]",
"buffer",
",",
"char",
"ch",
")",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"buffer",
".... | Return the first index where the given character occurs in the given buffer or -1
if is not found. This is like String.indexOf() but it works on byte[] arrays. If
the given buffer is null or empty, -1 is returned.
@param buffer byte[] to search.
@param ch Character to find.
@return Zero-relative index where character was first found or -1 if the
character does not occur or is not found. | [
"Return",
"the",
"first",
"index",
"where",
"the",
"given",
"character",
"occurs",
"in",
"the",
"given",
"buffer",
"or",
"-",
"1",
"if",
"is",
"not",
"found",
".",
"This",
"is",
"like",
"String",
".",
"indexOf",
"()",
"but",
"it",
"works",
"on",
"byte"... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L1072-L1082 |
zandero/http | src/main/java/com/zandero/http/logging/LoggingUtils.java | LoggingUtils.prepareForLogging | public static void prepareForLogging(String path, String query) {
MDC.put("request_id", UUID.randomUUID().toString()); // generate unique request id ...
try {
URI uri = new URI(path);
MDC.put("host", uri.getHost());
MDC.put("scheme", uri.getScheme());
MDC.put("domain", UrlUtils.resolveDomain(uri.getPath()));
MDC.put("port", uri.getPort() + "");
MDC.put("path", uri.getPath());
}
catch (URISyntaxException e) {
// fall back
MDC.put("path", path);
}
MDC.put("timestamp", System.currentTimeMillis() + "");
if (!StringUtils.isNullOrEmptyTrimmed(query)) {
MDC.put("query", query);
}
} | java | public static void prepareForLogging(String path, String query) {
MDC.put("request_id", UUID.randomUUID().toString()); // generate unique request id ...
try {
URI uri = new URI(path);
MDC.put("host", uri.getHost());
MDC.put("scheme", uri.getScheme());
MDC.put("domain", UrlUtils.resolveDomain(uri.getPath()));
MDC.put("port", uri.getPort() + "");
MDC.put("path", uri.getPath());
}
catch (URISyntaxException e) {
// fall back
MDC.put("path", path);
}
MDC.put("timestamp", System.currentTimeMillis() + "");
if (!StringUtils.isNullOrEmptyTrimmed(query)) {
MDC.put("query", query);
}
} | [
"public",
"static",
"void",
"prepareForLogging",
"(",
"String",
"path",
",",
"String",
"query",
")",
"{",
"MDC",
".",
"put",
"(",
"\"request_id\"",
",",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"// generate unique request id ... | Common purpose logging
@param path of request
@param query optional query of request | [
"Common",
"purpose",
"logging"
] | train | https://github.com/zandero/http/blob/909eb879f1193adf24545360c3b76bd813865f65/src/main/java/com/zandero/http/logging/LoggingUtils.java#L60-L83 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java | InodeLockManager.lockEdge | public LockResource lockEdge(Edge edge, LockMode mode) {
return mEdgeLocks.get(edge, mode);
} | java | public LockResource lockEdge(Edge edge, LockMode mode) {
return mEdgeLocks.get(edge, mode);
} | [
"public",
"LockResource",
"lockEdge",
"(",
"Edge",
"edge",
",",
"LockMode",
"mode",
")",
"{",
"return",
"mEdgeLocks",
".",
"get",
"(",
"edge",
",",
"mode",
")",
";",
"}"
] | Acquires an edge lock.
@param edge the edge to lock
@param mode the mode to lock in
@return a lock resource which must be closed to release the lock | [
"Acquires",
"an",
"edge",
"lock",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockManager.java#L143-L145 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/Interval.java | Interval.evensFromTo | public static Interval evensFromTo(int from, int to)
{
if (from % 2 != 0)
{
if (from < to)
{
from++;
}
else
{
from--;
}
}
if (to % 2 != 0)
{
if (to > from)
{
to--;
}
else
{
to++;
}
}
return Interval.fromToBy(from, to, to > from ? 2 : -2);
} | java | public static Interval evensFromTo(int from, int to)
{
if (from % 2 != 0)
{
if (from < to)
{
from++;
}
else
{
from--;
}
}
if (to % 2 != 0)
{
if (to > from)
{
to--;
}
else
{
to++;
}
}
return Interval.fromToBy(from, to, to > from ? 2 : -2);
} | [
"public",
"static",
"Interval",
"evensFromTo",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"from",
"%",
"2",
"!=",
"0",
")",
"{",
"if",
"(",
"from",
"<",
"to",
")",
"{",
"from",
"++",
";",
"}",
"else",
"{",
"from",
"--",
";",
"... | Returns an Interval representing the even values from the value from to the value to. | [
"Returns",
"an",
"Interval",
"representing",
"the",
"even",
"values",
"from",
"the",
"value",
"from",
"to",
"the",
"value",
"to",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L188-L213 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/MapHelper.java | MapHelper.sizeOfIn | public int sizeOfIn(String expr, Map<String, Object> map) {
int result;
Object val = getValue(map, expr);
if (val instanceof Map) {
result = ((Map) val).size();
} else if (val instanceof Collection) {
result = ((Collection) val).size();
} else {
throw new SlimFixtureException(false, expr + " is not a collection");
}
return result;
} | java | public int sizeOfIn(String expr, Map<String, Object> map) {
int result;
Object val = getValue(map, expr);
if (val instanceof Map) {
result = ((Map) val).size();
} else if (val instanceof Collection) {
result = ((Collection) val).size();
} else {
throw new SlimFixtureException(false, expr + " is not a collection");
}
return result;
} | [
"public",
"int",
"sizeOfIn",
"(",
"String",
"expr",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"int",
"result",
";",
"Object",
"val",
"=",
"getValue",
"(",
"map",
",",
"expr",
")",
";",
"if",
"(",
"val",
"instanceof",
"Map",
")... | Determines size of either (Map or Collection) value in the map.
@param expr expression indicating which (possibly nested) value in the map to determine size of.
@param map map to find value in.
@return size of value.
@throws SlimFixtureException if the value found is not a Map or Collection. | [
"Determines",
"size",
"of",
"either",
"(",
"Map",
"or",
"Collection",
")",
"value",
"in",
"the",
"map",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/MapHelper.java#L166-L177 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/LinearClassifier.java | LinearClassifier.scoresOf | public Counter<L> scoresOf(Datum<L, F> example) {
if(example instanceof RVFDatum<?, ?>)return scoresOfRVFDatum((RVFDatum<L,F>)example);
Collection<F> feats = example.asFeatures();
int[] features = new int[feats.size()];
int i = 0;
for (F f : feats) {
int index = featureIndex.indexOf(f);
if (index >= 0) {
features[i++] = index;
} else {
//System.err.println("FEATURE LESS THAN ZERO: " + f);
}
}
int[] activeFeatures = new int[i];
System.arraycopy(features, 0, activeFeatures, 0, i);
Counter<L> scores = new ClassicCounter<L>();
for (L lab : labels()) {
scores.setCount(lab, scoreOf(activeFeatures, lab));
}
return scores;
} | java | public Counter<L> scoresOf(Datum<L, F> example) {
if(example instanceof RVFDatum<?, ?>)return scoresOfRVFDatum((RVFDatum<L,F>)example);
Collection<F> feats = example.asFeatures();
int[] features = new int[feats.size()];
int i = 0;
for (F f : feats) {
int index = featureIndex.indexOf(f);
if (index >= 0) {
features[i++] = index;
} else {
//System.err.println("FEATURE LESS THAN ZERO: " + f);
}
}
int[] activeFeatures = new int[i];
System.arraycopy(features, 0, activeFeatures, 0, i);
Counter<L> scores = new ClassicCounter<L>();
for (L lab : labels()) {
scores.setCount(lab, scoreOf(activeFeatures, lab));
}
return scores;
} | [
"public",
"Counter",
"<",
"L",
">",
"scoresOf",
"(",
"Datum",
"<",
"L",
",",
"F",
">",
"example",
")",
"{",
"if",
"(",
"example",
"instanceof",
"RVFDatum",
"<",
"?",
",",
"?",
">",
")",
"return",
"scoresOfRVFDatum",
"(",
"(",
"RVFDatum",
"<",
"L",
... | Construct a counter with keys the labels of the classifier and
values the score (unnormalized log probability) of each class. | [
"Construct",
"a",
"counter",
"with",
"keys",
"the",
"labels",
"of",
"the",
"classifier",
"and",
"values",
"the",
"score",
"(",
"unnormalized",
"log",
"probability",
")",
"of",
"each",
"class",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L129-L149 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.setBaselineDuration | public void setBaselineDuration(int baselineNumber, Duration value)
{
set(selectField(TaskFieldLists.BASELINE_DURATIONS, baselineNumber), value);
} | java | public void setBaselineDuration(int baselineNumber, Duration value)
{
set(selectField(TaskFieldLists.BASELINE_DURATIONS, baselineNumber), value);
} | [
"public",
"void",
"setBaselineDuration",
"(",
"int",
"baselineNumber",
",",
"Duration",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"TaskFieldLists",
".",
"BASELINE_DURATIONS",
",",
"baselineNumber",
")",
",",
"value",
")",
";",
"}"
] | Set a baseline value.
@param baselineNumber baseline index (1-10)
@param value baseline value | [
"Set",
"a",
"baseline",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L3991-L3994 |
apache/incubator-heron | heron/common/src/java/org/apache/heron/common/network/HeronServer.java | HeronServer.handlePacket | private void handlePacket(SelectableChannel channel, IncomingPacket incomingPacket) {
String typeName = incomingPacket.unpackString();
REQID rid = incomingPacket.unpackREQID();
Message.Builder bldr = requestMap.get(typeName);
boolean isRequest = false;
if (bldr != null) {
// This is a request
isRequest = true;
} else {
bldr = messageMap.get(typeName);
}
if (bldr != null) {
// Clear the earlier state of Message.Builder
// Otherwise it would merge new Message with old state
bldr.clear();
incomingPacket.unpackMessage(bldr);
if (bldr.isInitialized()) {
Message msg = bldr.build();
if (isRequest) {
onRequest(rid, (SocketChannel) channel, msg);
} else {
onMessage((SocketChannel) channel, msg);
}
} else {
// Message failed to be deser
LOG.severe("Could not deserialize protobuf of type " + typeName);
handleError(channel);
}
return;
} else {
LOG.severe("Unexpected protobuf type received " + typeName);
handleError(channel);
}
} | java | private void handlePacket(SelectableChannel channel, IncomingPacket incomingPacket) {
String typeName = incomingPacket.unpackString();
REQID rid = incomingPacket.unpackREQID();
Message.Builder bldr = requestMap.get(typeName);
boolean isRequest = false;
if (bldr != null) {
// This is a request
isRequest = true;
} else {
bldr = messageMap.get(typeName);
}
if (bldr != null) {
// Clear the earlier state of Message.Builder
// Otherwise it would merge new Message with old state
bldr.clear();
incomingPacket.unpackMessage(bldr);
if (bldr.isInitialized()) {
Message msg = bldr.build();
if (isRequest) {
onRequest(rid, (SocketChannel) channel, msg);
} else {
onMessage((SocketChannel) channel, msg);
}
} else {
// Message failed to be deser
LOG.severe("Could not deserialize protobuf of type " + typeName);
handleError(channel);
}
return;
} else {
LOG.severe("Unexpected protobuf type received " + typeName);
handleError(channel);
}
} | [
"private",
"void",
"handlePacket",
"(",
"SelectableChannel",
"channel",
",",
"IncomingPacket",
"incomingPacket",
")",
"{",
"String",
"typeName",
"=",
"incomingPacket",
".",
"unpackString",
"(",
")",
";",
"REQID",
"rid",
"=",
"incomingPacket",
".",
"unpackREQID",
"... | Handle an incomingPacket and invoke either onRequest or
onMessage() to handle it | [
"Handle",
"an",
"incomingPacket",
"and",
"invoke",
"either",
"onRequest",
"or",
"onMessage",
"()",
"to",
"handle",
"it"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/network/HeronServer.java#L192-L226 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/Strings.java | Strings.commonPrefix | public static int commonPrefix(String text1, String text2) {
// Performance analysis: http://neil.fraser.name/news/2007/10/09/
int n = Math.min(text1.length(), text2.length());
for (int i = 0; i < n; i++) {
if (text1.charAt(i) != text2.charAt(i)) {
return i;
}
}
return n;
} | java | public static int commonPrefix(String text1, String text2) {
// Performance analysis: http://neil.fraser.name/news/2007/10/09/
int n = Math.min(text1.length(), text2.length());
for (int i = 0; i < n; i++) {
if (text1.charAt(i) != text2.charAt(i)) {
return i;
}
}
return n;
} | [
"public",
"static",
"int",
"commonPrefix",
"(",
"String",
"text1",
",",
"String",
"text2",
")",
"{",
"// Performance analysis: http://neil.fraser.name/news/2007/10/09/",
"int",
"n",
"=",
"Math",
".",
"min",
"(",
"text1",
".",
"length",
"(",
")",
",",
"text2",
".... | Determine the common prefix of two strings
@param text1 First string.
@param text2 Second string.
@return The number of characters common to the start of each string. | [
"Determine",
"the",
"common",
"prefix",
"of",
"two",
"strings"
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/Strings.java#L680-L689 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java | ConfigValidator.checkMapConfig | public static void checkMapConfig(MapConfig mapConfig, MergePolicyProvider mergePolicyProvider) {
checkNotNativeWhenOpenSource(mapConfig.getInMemoryFormat());
checkMapMergePolicy(mapConfig, mergePolicyProvider);
logIgnoredConfig(mapConfig);
} | java | public static void checkMapConfig(MapConfig mapConfig, MergePolicyProvider mergePolicyProvider) {
checkNotNativeWhenOpenSource(mapConfig.getInMemoryFormat());
checkMapMergePolicy(mapConfig, mergePolicyProvider);
logIgnoredConfig(mapConfig);
} | [
"public",
"static",
"void",
"checkMapConfig",
"(",
"MapConfig",
"mapConfig",
",",
"MergePolicyProvider",
"mergePolicyProvider",
")",
"{",
"checkNotNativeWhenOpenSource",
"(",
"mapConfig",
".",
"getInMemoryFormat",
"(",
")",
")",
";",
"checkMapMergePolicy",
"(",
"mapConf... | Validates the given {@link MapConfig}.
@param mapConfig the {@link MapConfig}
@param mergePolicyProvider the {@link MergePolicyProvider} to resolve merge policy classes | [
"Validates",
"the",
"given",
"{",
"@link",
"MapConfig",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java#L105-L109 |
syphr42/prom | src/main/java/org/syphr/prom/PropertiesManager.java | PropertiesManager.referenceAt | public Reference referenceAt(T property, int position)
{
return getEvaluator().referenceAt(getRawProperty(property), position, getRetriever());
} | java | public Reference referenceAt(T property, int position)
{
return getEvaluator().referenceAt(getRawProperty(property), position, getRetriever());
} | [
"public",
"Reference",
"referenceAt",
"(",
"T",
"property",
",",
"int",
"position",
")",
"{",
"return",
"getEvaluator",
"(",
")",
".",
"referenceAt",
"(",
"getRawProperty",
"(",
"property",
")",
",",
"position",
",",
"getRetriever",
"(",
")",
")",
";",
"}"... | Retrieve the reference to another property from within the value of the
given property at the given position. If such a reference does not exist,
the result of this method will be <code>null</code>.
@param property
the property to search for the requested reference
@param position
the position to check for a reference
@return the appropriate reference if one exists; <code>null</code>
otherwise | [
"Retrieve",
"the",
"reference",
"to",
"another",
"property",
"from",
"within",
"the",
"value",
"of",
"the",
"given",
"property",
"at",
"the",
"given",
"position",
".",
"If",
"such",
"a",
"reference",
"does",
"not",
"exist",
"the",
"result",
"of",
"this",
"... | train | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManager.java#L728-L731 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/AbstractDMultiMapView.java | AbstractDMultiMapView.wrapValues | Collection<V> wrapValues(K key, Collection<V> values) {
final Object backEnd = DataViewDelegate.undelegate(values);
if (backEnd instanceof List<?>) {
return new SingleKeyValueListView(key, (List<V>) values);
}
if (backEnd instanceof Set<?>) {
return new SingleKeyValueSetView(key, (Set<V>) values);
}
throw new IllegalStateException("Unsupported type of the backend multimap: " + values.getClass()); //$NON-NLS-1$
} | java | Collection<V> wrapValues(K key, Collection<V> values) {
final Object backEnd = DataViewDelegate.undelegate(values);
if (backEnd instanceof List<?>) {
return new SingleKeyValueListView(key, (List<V>) values);
}
if (backEnd instanceof Set<?>) {
return new SingleKeyValueSetView(key, (Set<V>) values);
}
throw new IllegalStateException("Unsupported type of the backend multimap: " + values.getClass()); //$NON-NLS-1$
} | [
"Collection",
"<",
"V",
">",
"wrapValues",
"(",
"K",
"key",
",",
"Collection",
"<",
"V",
">",
"values",
")",
"{",
"final",
"Object",
"backEnd",
"=",
"DataViewDelegate",
".",
"undelegate",
"(",
"values",
")",
";",
"if",
"(",
"backEnd",
"instanceof",
"List... | Wrap the given values into a dedicated view.
<p>The replies view may be a {@link SingleKeyValueListView} or a {@link SingleKeyValueSetView} according to the type of the
given values' collection.
@param key the key of the values.
@param values the values.
@return the wrapper. | [
"Wrap",
"the",
"given",
"values",
"into",
"a",
"dedicated",
"view",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/AbstractDMultiMapView.java#L90-L99 |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.createDefinitionReference | public Reference createDefinitionReference(String bindingName, String type, Map<String, Object> properties) throws InjectionException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Map<String, Object> traceProps = properties;
if (traceProps.containsKey("password")) {
traceProps = new HashMap<String, Object>(properties);
traceProps.put("password", "********");
}
Tr.entry(tc, "createDefinitionReference: bindingName=" + bindingName + ", type=" + type, traceProps);
}
Reference ref;
try {
InternalInjectionEngine injectionEngine = (InternalInjectionEngine) InjectionEngineAccessor.getInstance();
ref = injectionEngine.createDefinitionReference(ivNameSpaceConfig, ivInjectionScope, getJndiName(), bindingName, type, properties);
} catch (Exception ex) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createDefinitionReference", ex);
throw new InjectionException(ex);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createDefinitionReference", ref);
return ref;
} | java | public Reference createDefinitionReference(String bindingName, String type, Map<String, Object> properties) throws InjectionException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Map<String, Object> traceProps = properties;
if (traceProps.containsKey("password")) {
traceProps = new HashMap<String, Object>(properties);
traceProps.put("password", "********");
}
Tr.entry(tc, "createDefinitionReference: bindingName=" + bindingName + ", type=" + type, traceProps);
}
Reference ref;
try {
InternalInjectionEngine injectionEngine = (InternalInjectionEngine) InjectionEngineAccessor.getInstance();
ref = injectionEngine.createDefinitionReference(ivNameSpaceConfig, ivInjectionScope, getJndiName(), bindingName, type, properties);
} catch (Exception ex) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createDefinitionReference", ex);
throw new InjectionException(ex);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "createDefinitionReference", ref);
return ref;
} | [
"public",
"Reference",
"createDefinitionReference",
"(",
"String",
"bindingName",
",",
"String",
"type",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"InjectionException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
... | Create a Reference to a resource definition.
@param bindingName the binding name, or null if none
@param type the resource type
@param properties the resource-specific properties
@return the resource definition Reference | [
"Create",
"a",
"Reference",
"to",
"a",
"resource",
"definition",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1222-L1247 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/operator/scalar/MapToMapCast.java | MapToMapCast.buildProcessor | private MethodHandle buildProcessor(FunctionManager functionManager, Type fromType, Type toType, boolean isKey)
{
MethodHandle getter = nativeValueGetter(fromType);
// Adapt cast that takes ([ConnectorSession,] ?) to one that takes (?, ConnectorSession), where ? is the return type of getter.
ScalarFunctionImplementation castImplementation = functionManager.getScalarFunctionImplementation(functionManager.lookupCast(CastType.CAST, fromType.getTypeSignature(), toType.getTypeSignature()));
MethodHandle cast = castImplementation.getMethodHandle();
if (cast.type().parameterArray()[0] != ConnectorSession.class) {
cast = MethodHandles.dropArguments(cast, 0, ConnectorSession.class);
}
cast = permuteArguments(cast, methodType(cast.type().returnType(), cast.type().parameterArray()[1], cast.type().parameterArray()[0]), 1, 0);
MethodHandle target = compose(cast, getter);
// If the key cast function is nullable, check the result is not null.
if (isKey && castImplementation.isNullable()) {
target = compose(nullChecker(target.type().returnType()), target);
}
MethodHandle writer = nativeValueWriter(toType);
writer = permuteArguments(writer, methodType(void.class, writer.type().parameterArray()[1], writer.type().parameterArray()[0]), 1, 0);
return compose(writer, target.asType(methodType(unwrap(target.type().returnType()), target.type().parameterArray())));
} | java | private MethodHandle buildProcessor(FunctionManager functionManager, Type fromType, Type toType, boolean isKey)
{
MethodHandle getter = nativeValueGetter(fromType);
// Adapt cast that takes ([ConnectorSession,] ?) to one that takes (?, ConnectorSession), where ? is the return type of getter.
ScalarFunctionImplementation castImplementation = functionManager.getScalarFunctionImplementation(functionManager.lookupCast(CastType.CAST, fromType.getTypeSignature(), toType.getTypeSignature()));
MethodHandle cast = castImplementation.getMethodHandle();
if (cast.type().parameterArray()[0] != ConnectorSession.class) {
cast = MethodHandles.dropArguments(cast, 0, ConnectorSession.class);
}
cast = permuteArguments(cast, methodType(cast.type().returnType(), cast.type().parameterArray()[1], cast.type().parameterArray()[0]), 1, 0);
MethodHandle target = compose(cast, getter);
// If the key cast function is nullable, check the result is not null.
if (isKey && castImplementation.isNullable()) {
target = compose(nullChecker(target.type().returnType()), target);
}
MethodHandle writer = nativeValueWriter(toType);
writer = permuteArguments(writer, methodType(void.class, writer.type().parameterArray()[1], writer.type().parameterArray()[0]), 1, 0);
return compose(writer, target.asType(methodType(unwrap(target.type().returnType()), target.type().parameterArray())));
} | [
"private",
"MethodHandle",
"buildProcessor",
"(",
"FunctionManager",
"functionManager",
",",
"Type",
"fromType",
",",
"Type",
"toType",
",",
"boolean",
"isKey",
")",
"{",
"MethodHandle",
"getter",
"=",
"nativeValueGetter",
"(",
"fromType",
")",
";",
"// Adapt cast t... | The signature of the returned MethodHandle is (Block fromMap, int position, ConnectorSession session, BlockBuilder mapBlockBuilder)void.
The processor will get the value from fromMap, cast it and write to toBlock. | [
"The",
"signature",
"of",
"the",
"returned",
"MethodHandle",
"is",
"(",
"Block",
"fromMap",
"int",
"position",
"ConnectorSession",
"session",
"BlockBuilder",
"mapBlockBuilder",
")",
"void",
".",
"The",
"processor",
"will",
"get",
"the",
"value",
"from",
"fromMap",... | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/scalar/MapToMapCast.java#L105-L127 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTileTransitionModel.java | MapTileTransitionModel.getTransition | private static TransitionType getTransition(TransitionType a, TransitionType b, int ox, int oy)
{
final TransitionType type = getTransitionHorizontalVertical(a, b, ox, oy);
if (type != null)
{
return type;
}
return getTransitionDiagonals(a, b, ox, oy);
} | java | private static TransitionType getTransition(TransitionType a, TransitionType b, int ox, int oy)
{
final TransitionType type = getTransitionHorizontalVertical(a, b, ox, oy);
if (type != null)
{
return type;
}
return getTransitionDiagonals(a, b, ox, oy);
} | [
"private",
"static",
"TransitionType",
"getTransition",
"(",
"TransitionType",
"a",
",",
"TransitionType",
"b",
",",
"int",
"ox",
",",
"int",
"oy",
")",
"{",
"final",
"TransitionType",
"type",
"=",
"getTransitionHorizontalVertical",
"(",
"a",
",",
"b",
",",
"o... | Get the new transition type from two transitions.
@param a The inner transition.
@param b The outer transition.
@param ox The horizontal offset to update.
@param oy The vertical offset to update.
@return The new transition type, <code>null</code> if none. | [
"Get",
"the",
"new",
"transition",
"type",
"from",
"two",
"transitions",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTileTransitionModel.java#L51-L59 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java | AbstractExtraLanguageGenerator.doGenerate | @Override
public void doGenerate(EObject object, ExtraLanguageAppendable appendable, IExtraLanguageGeneratorContext context) {
try {
before(object, context);
generate(object, appendable, context);
} finally {
after(object, context);
}
} | java | @Override
public void doGenerate(EObject object, ExtraLanguageAppendable appendable, IExtraLanguageGeneratorContext context) {
try {
before(object, context);
generate(object, appendable, context);
} finally {
after(object, context);
}
} | [
"@",
"Override",
"public",
"void",
"doGenerate",
"(",
"EObject",
"object",
",",
"ExtraLanguageAppendable",
"appendable",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"try",
"{",
"before",
"(",
"object",
",",
"context",
")",
";",
"generate",
"(",
"... | Generate the given object.
<p>This function calls the {@link #before(EObject, IExtraLanguageGeneratorContext)},
{@link #generate(EObject, ExtraLanguageAppendable, IExtraLanguageGeneratorContext)}, and
{@link #after(EObject, IExtraLanguageGeneratorContext)} functions.
@param object the object.
@param appendable the target for the generated content.
@param context the context. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java#L560-L568 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleUtility.java | LocaleUtility.getLocaleFromName | public static Locale getLocaleFromName(String name) {
String language = "";
String country = "";
String variant = "";
int i1 = name.indexOf('_');
if (i1 < 0) {
language = name;
} else {
language = name.substring(0, i1);
++i1;
int i2 = name.indexOf('_', i1);
if (i2 < 0) {
country = name.substring(i1);
} else {
country = name.substring(i1, i2);
variant = name.substring(i2+1);
}
}
return new Locale(language, country, variant);
} | java | public static Locale getLocaleFromName(String name) {
String language = "";
String country = "";
String variant = "";
int i1 = name.indexOf('_');
if (i1 < 0) {
language = name;
} else {
language = name.substring(0, i1);
++i1;
int i2 = name.indexOf('_', i1);
if (i2 < 0) {
country = name.substring(i1);
} else {
country = name.substring(i1, i2);
variant = name.substring(i2+1);
}
}
return new Locale(language, country, variant);
} | [
"public",
"static",
"Locale",
"getLocaleFromName",
"(",
"String",
"name",
")",
"{",
"String",
"language",
"=",
"\"\"",
";",
"String",
"country",
"=",
"\"\"",
";",
"String",
"variant",
"=",
"\"\"",
";",
"int",
"i1",
"=",
"name",
".",
"indexOf",
"(",
"'",
... | A helper function to convert a string of the form
aa_BB_CC to a locale object. Why isn't this in Locale? | [
"A",
"helper",
"function",
"to",
"convert",
"a",
"string",
"of",
"the",
"form",
"aa_BB_CC",
"to",
"a",
"locale",
"object",
".",
"Why",
"isn",
"t",
"this",
"in",
"Locale?"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleUtility.java#L27-L48 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.listEventHubConsumerGroupsWithServiceResponseAsync | public Observable<ServiceResponse<Page<EventHubConsumerGroupInfoInner>>> listEventHubConsumerGroupsWithServiceResponseAsync(final String resourceGroupName, final String resourceName, final String eventHubEndpointName) {
return listEventHubConsumerGroupsSinglePageAsync(resourceGroupName, resourceName, eventHubEndpointName)
.concatMap(new Func1<ServiceResponse<Page<EventHubConsumerGroupInfoInner>>, Observable<ServiceResponse<Page<EventHubConsumerGroupInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EventHubConsumerGroupInfoInner>>> call(ServiceResponse<Page<EventHubConsumerGroupInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listEventHubConsumerGroupsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<EventHubConsumerGroupInfoInner>>> listEventHubConsumerGroupsWithServiceResponseAsync(final String resourceGroupName, final String resourceName, final String eventHubEndpointName) {
return listEventHubConsumerGroupsSinglePageAsync(resourceGroupName, resourceName, eventHubEndpointName)
.concatMap(new Func1<ServiceResponse<Page<EventHubConsumerGroupInfoInner>>, Observable<ServiceResponse<Page<EventHubConsumerGroupInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EventHubConsumerGroupInfoInner>>> call(ServiceResponse<Page<EventHubConsumerGroupInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listEventHubConsumerGroupsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"EventHubConsumerGroupInfoInner",
">",
">",
">",
"listEventHubConsumerGroupsWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"resourceName",
",",
"final",
"Str... | Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub.
Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param eventHubEndpointName The name of the Event Hub-compatible endpoint.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<EventHubConsumerGroupInfoInner> object | [
"Get",
"a",
"list",
"of",
"the",
"consumer",
"groups",
"in",
"the",
"Event",
"Hub",
"-",
"compatible",
"device",
"-",
"to",
"-",
"cloud",
"endpoint",
"in",
"an",
"IoT",
"hub",
".",
"Get",
"a",
"list",
"of",
"the",
"consumer",
"groups",
"in",
"the",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L1696-L1708 |
ModeShape/modeshape | modeshape-jdbc/src/main/java/org/modeshape/jdbc/rest/ModeShapeRestClient.java | ModeShapeRestClient.queryPlan | public String queryPlan( String query,
String queryLanguage ) {
String url = jsonRestClient.appendToURL(QUERY_PLAN_METHOD);
String contentType = contentTypeForQueryLanguage(queryLanguage);
JSONRestClient.Response response = jsonRestClient.postStreamTextPlain(new ByteArrayInputStream(query.getBytes()), url,
contentType);
if (!response.isOK()) {
throw new RuntimeException(JdbcI18n.invalidServerResponse.text(url, response.asString()));
}
return response.asString();
} | java | public String queryPlan( String query,
String queryLanguage ) {
String url = jsonRestClient.appendToURL(QUERY_PLAN_METHOD);
String contentType = contentTypeForQueryLanguage(queryLanguage);
JSONRestClient.Response response = jsonRestClient.postStreamTextPlain(new ByteArrayInputStream(query.getBytes()), url,
contentType);
if (!response.isOK()) {
throw new RuntimeException(JdbcI18n.invalidServerResponse.text(url, response.asString()));
}
return response.asString();
} | [
"public",
"String",
"queryPlan",
"(",
"String",
"query",
",",
"String",
"queryLanguage",
")",
"{",
"String",
"url",
"=",
"jsonRestClient",
".",
"appendToURL",
"(",
"QUERY_PLAN_METHOD",
")",
";",
"String",
"contentType",
"=",
"contentTypeForQueryLanguage",
"(",
"qu... | Returns a string representation of a query plan in a given language.
@param query a {@code String}, never {@code null}
@param queryLanguage the language of the query, never {@code null}
@return a {@code String} description of the plan, never {@code null} | [
"Returns",
"a",
"string",
"representation",
"of",
"a",
"query",
"plan",
"in",
"a",
"given",
"language",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jdbc/src/main/java/org/modeshape/jdbc/rest/ModeShapeRestClient.java#L145-L155 |
js-lib-com/commons | src/main/java/js/io/FilesOutputStream.java | FilesOutputStream.addFileEntry | private void addFileEntry(String entryName, InputStream inputStream) throws IOException {
// write lazily the manifest before adding the first file
if (manifest != null) {
addManifestEntry();
}
ZipEntry entry = new ZipEntry(entryName);
filesArchive.putNextEntry(entry);
inputStream = new BufferedInputStream(inputStream);
try {
byte[] buffer = new byte[BUFFER_SIZE];
for (;;) {
int bytesRead = inputStream.read(buffer);
if (bytesRead <= 0) {
break;
}
write(buffer, 0, bytesRead);
}
} finally {
Files.close(inputStream);
filesArchive.closeEntry();
}
} | java | private void addFileEntry(String entryName, InputStream inputStream) throws IOException {
// write lazily the manifest before adding the first file
if (manifest != null) {
addManifestEntry();
}
ZipEntry entry = new ZipEntry(entryName);
filesArchive.putNextEntry(entry);
inputStream = new BufferedInputStream(inputStream);
try {
byte[] buffer = new byte[BUFFER_SIZE];
for (;;) {
int bytesRead = inputStream.read(buffer);
if (bytesRead <= 0) {
break;
}
write(buffer, 0, bytesRead);
}
} finally {
Files.close(inputStream);
filesArchive.closeEntry();
}
} | [
"private",
"void",
"addFileEntry",
"(",
"String",
"entryName",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"// write lazily the manifest before adding the first file\r",
"if",
"(",
"manifest",
"!=",
"null",
")",
"{",
"addManifestEntry",
"(",
")... | Add file entry to this files archive. This method takes care to lazily write manifest just before first file entry.
@param entryName entry name,
@param inputStream file content.
@throws IOException if file entry write fails. | [
"Add",
"file",
"entry",
"to",
"this",
"files",
"archive",
".",
"This",
"method",
"takes",
"care",
"to",
"lazily",
"write",
"manifest",
"just",
"before",
"first",
"file",
"entry",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesOutputStream.java#L191-L214 |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java | Validate.configurationDirectoryExists | public static void configurationDirectoryExists(final String string, final String message)
throws ConfigurationException {
if (string == null || string.length() == 0 || new File(string).isDirectory() == false) {
throw new ConfigurationException(message);
}
} | java | public static void configurationDirectoryExists(final String string, final String message)
throws ConfigurationException {
if (string == null || string.length() == 0 || new File(string).isDirectory() == false) {
throw new ConfigurationException(message);
}
} | [
"public",
"static",
"void",
"configurationDirectoryExists",
"(",
"final",
"String",
"string",
",",
"final",
"String",
"message",
")",
"throws",
"ConfigurationException",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"string",
".",
"length",
"(",
")",
"==",
"0"... | Checks that string is not null and not empty and it represents a path to a valid directory
@param string
The path to check
@param message
The exception message
@throws ConfigurationException
Thrown if string is empty, null or it does not represent a path the a valid directory | [
"Checks",
"that",
"string",
"is",
"not",
"null",
"and",
"not",
"empty",
"and",
"it",
"represents",
"a",
"path",
"to",
"a",
"valid",
"directory"
] | train | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java#L137-L142 |
alkacon/opencms-core | src/org/opencms/ui/apps/CmsFileExplorer.java | CmsFileExplorer.initToolbarButtons | private void initToolbarButtons(I_CmsAppUIContext context) {
m_publishButton = context.addPublishButton(new I_CmsUpdateListener<String>() {
public void onUpdate(List<String> updatedItems) {
updateAll(false);
}
});
m_newButton = CmsToolBar.createButton(
FontOpenCms.WAND,
CmsVaadinUtils.getMessageText(Messages.GUI_NEW_RESOURCE_TITLE_0));
if (CmsAppWorkplaceUi.isOnlineProject()) {
m_newButton.setEnabled(false);
m_newButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0));
}
m_newButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
onClickNew();
}
});
context.addToolbarButton(m_newButton);
m_uploadButton = new CmsUploadButton(FontOpenCms.UPLOAD, "/");
m_uploadButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
m_uploadButton.addStyleName(OpenCmsTheme.TOOLBAR_BUTTON);
if (CmsAppWorkplaceUi.isOnlineProject()) {
m_uploadButton.setEnabled(false);
m_uploadButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0));
} else {
m_uploadButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_UPLOAD_BUTTON_TITLE_0));
}
m_uploadButton.addUploadListener(new I_UploadListener() {
public void onUploadFinished(List<String> uploadedFiles) {
updateAll(true);
}
});
context.addToolbarButton(m_uploadButton);
} | java | private void initToolbarButtons(I_CmsAppUIContext context) {
m_publishButton = context.addPublishButton(new I_CmsUpdateListener<String>() {
public void onUpdate(List<String> updatedItems) {
updateAll(false);
}
});
m_newButton = CmsToolBar.createButton(
FontOpenCms.WAND,
CmsVaadinUtils.getMessageText(Messages.GUI_NEW_RESOURCE_TITLE_0));
if (CmsAppWorkplaceUi.isOnlineProject()) {
m_newButton.setEnabled(false);
m_newButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0));
}
m_newButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
onClickNew();
}
});
context.addToolbarButton(m_newButton);
m_uploadButton = new CmsUploadButton(FontOpenCms.UPLOAD, "/");
m_uploadButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
m_uploadButton.addStyleName(OpenCmsTheme.TOOLBAR_BUTTON);
if (CmsAppWorkplaceUi.isOnlineProject()) {
m_uploadButton.setEnabled(false);
m_uploadButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0));
} else {
m_uploadButton.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_UPLOAD_BUTTON_TITLE_0));
}
m_uploadButton.addUploadListener(new I_UploadListener() {
public void onUploadFinished(List<String> uploadedFiles) {
updateAll(true);
}
});
context.addToolbarButton(m_uploadButton);
} | [
"private",
"void",
"initToolbarButtons",
"(",
"I_CmsAppUIContext",
"context",
")",
"{",
"m_publishButton",
"=",
"context",
".",
"addPublishButton",
"(",
"new",
"I_CmsUpdateListener",
"<",
"String",
">",
"(",
")",
"{",
"public",
"void",
"onUpdate",
"(",
"List",
"... | Initializes the app specific toolbar buttons.<p>
@param context the UI context | [
"Initializes",
"the",
"app",
"specific",
"toolbar",
"buttons",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsFileExplorer.java#L1840-L1889 |
azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java | QuartzScheduler.unscheduleJob | public synchronized boolean unscheduleJob(final String jobName, final String groupName) throws
SchedulerException {
return this.scheduler.deleteJob(new JobKey(jobName, groupName));
} | java | public synchronized boolean unscheduleJob(final String jobName, final String groupName) throws
SchedulerException {
return this.scheduler.deleteJob(new JobKey(jobName, groupName));
} | [
"public",
"synchronized",
"boolean",
"unscheduleJob",
"(",
"final",
"String",
"jobName",
",",
"final",
"String",
"groupName",
")",
"throws",
"SchedulerException",
"{",
"return",
"this",
".",
"scheduler",
".",
"deleteJob",
"(",
"new",
"JobKey",
"(",
"jobName",
",... | Unschedule a job.
@param jobName
@param groupName
@return true if job is found and unscheduled.
@throws SchedulerException | [
"Unschedule",
"a",
"job",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java#L152-L155 |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionsUtilImpl.java | SipSessionsUtilImpl.addCorrespondingSipApplicationSession | public void addCorrespondingSipApplicationSession(MobicentsSipApplicationSessionKey newApplicationSession, MobicentsSipApplicationSessionKey correspondingSipApplicationSession, String headerName) {
if(headerName.equalsIgnoreCase(JoinHeader.NAME)) {
joinApplicationSession.putIfAbsent(newApplicationSession, correspondingSipApplicationSession);
} else if (headerName.equalsIgnoreCase(ReplacesHeader.NAME)) {
replacesApplicationSession.putIfAbsent(newApplicationSession, correspondingSipApplicationSession);
} else {
throw new IllegalArgumentException("headerName argument should either be one of Join or Replaces");
}
} | java | public void addCorrespondingSipApplicationSession(MobicentsSipApplicationSessionKey newApplicationSession, MobicentsSipApplicationSessionKey correspondingSipApplicationSession, String headerName) {
if(headerName.equalsIgnoreCase(JoinHeader.NAME)) {
joinApplicationSession.putIfAbsent(newApplicationSession, correspondingSipApplicationSession);
} else if (headerName.equalsIgnoreCase(ReplacesHeader.NAME)) {
replacesApplicationSession.putIfAbsent(newApplicationSession, correspondingSipApplicationSession);
} else {
throw new IllegalArgumentException("headerName argument should either be one of Join or Replaces");
}
} | [
"public",
"void",
"addCorrespondingSipApplicationSession",
"(",
"MobicentsSipApplicationSessionKey",
"newApplicationSession",
",",
"MobicentsSipApplicationSessionKey",
"correspondingSipApplicationSession",
",",
"String",
"headerName",
")",
"{",
"if",
"(",
"headerName",
".",
"equa... | Add a mapping between a new session and a corresponding sipSession related to a headerName. See Also getCorrespondingSipSession method.
@param newSession the new session
@param correspondingSipSession the corresponding sip session to add
@param headerName the header name | [
"Add",
"a",
"mapping",
"between",
"a",
"new",
"session",
"and",
"a",
"corresponding",
"sipSession",
"related",
"to",
"a",
"headerName",
".",
"See",
"Also",
"getCorrespondingSipSession",
"method",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionsUtilImpl.java#L201-L209 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.executeQuery | private static <T> T executeQuery(PreparedStatement ps, RsHandler<T> rsh) throws SQLException {
ResultSet rs = null;
try {
rs = ps.executeQuery();
return rsh.handle(rs);
} finally {
DbUtil.close(rs);
}
} | java | private static <T> T executeQuery(PreparedStatement ps, RsHandler<T> rsh) throws SQLException {
ResultSet rs = null;
try {
rs = ps.executeQuery();
return rsh.handle(rs);
} finally {
DbUtil.close(rs);
}
} | [
"private",
"static",
"<",
"T",
">",
"T",
"executeQuery",
"(",
"PreparedStatement",
"ps",
",",
"RsHandler",
"<",
"T",
">",
"rsh",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"rs",
"=",
"null",
";",
"try",
"{",
"rs",
"=",
"ps",
".",
"executeQuery",
... | 执行查询
@param ps {@link PreparedStatement}
@param rsh 结果集处理对象
@return 结果对象
@throws SQLException SQL执行异常
@since 4.1.13 | [
"执行查询"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L345-L353 |
RestComm/media-core | spi/src/main/java/org/restcomm/media/core/spi/utils/Text.java | Text.compareChars | private boolean compareChars(byte[] chars, int pos) {
for (int i = 0; i < len; i++) {
if (differentChars((char) this.chars[i + this.pos], (char) chars[i + pos])) return false;
}
return true;
} | java | private boolean compareChars(byte[] chars, int pos) {
for (int i = 0; i < len; i++) {
if (differentChars((char) this.chars[i + this.pos], (char) chars[i + pos])) return false;
}
return true;
} | [
"private",
"boolean",
"compareChars",
"(",
"byte",
"[",
"]",
"chars",
",",
"int",
"pos",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"differentChars",
"(",
"(",
"char",
")",
"this",
"."... | Compares specified character string with current string.
The upper and lower case characters are considered as equals.
@param chars the string to be compared
@return true if specified string equals to current | [
"Compares",
"specified",
"character",
"string",
"with",
"current",
"string",
".",
"The",
"upper",
"and",
"lower",
"case",
"characters",
"are",
"considered",
"as",
"equals",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/spi/src/main/java/org/restcomm/media/core/spi/utils/Text.java#L453-L458 |
r0adkll/PostOffice | library/src/main/java/com/r0adkll/postoffice/PostOffice.java | PostOffice.newAlertMail | public static Delivery newAlertMail(@NotNull Context ctx, @NotNull CharSequence title, @NotNull CharSequence message,
@NotNull final AlertHandler handler){
// Compose the delivery
Delivery.Builder builder = newMail(ctx)
.setTitle(title)
.setMessage(message)
.setButton(Dialog.BUTTON_POSITIVE, "Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
handler.onAccept();
}
})
.setButton(Dialog.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
handler.onDecline();
}
});
// Build the delivery
return builder.build();
} | java | public static Delivery newAlertMail(@NotNull Context ctx, @NotNull CharSequence title, @NotNull CharSequence message,
@NotNull final AlertHandler handler){
// Compose the delivery
Delivery.Builder builder = newMail(ctx)
.setTitle(title)
.setMessage(message)
.setButton(Dialog.BUTTON_POSITIVE, "Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
handler.onAccept();
}
})
.setButton(Dialog.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
handler.onDecline();
}
});
// Build the delivery
return builder.build();
} | [
"public",
"static",
"Delivery",
"newAlertMail",
"(",
"@",
"NotNull",
"Context",
"ctx",
",",
"@",
"NotNull",
"CharSequence",
"title",
",",
"@",
"NotNull",
"CharSequence",
"message",
",",
"@",
"NotNull",
"final",
"AlertHandler",
"handler",
")",
"{",
"// Compose th... | Create an alert dialog 'Mail' delivery that provides the user with a 'Yes' or 'No' choice to
@param ctx the application context
@param title the dialog title
@param message the dialog message
@param handler the choice handler
@return the alert choice handler | [
"Create",
"an",
"alert",
"dialog",
"Mail",
"delivery",
"that",
"provides",
"the",
"user",
"with",
"a",
"Yes",
"or",
"No",
"choice",
"to"
] | train | https://github.com/r0adkll/PostOffice/blob/f98e365fd66c004ccce64ee87d9f471b97e4e3c2/library/src/main/java/com/r0adkll/postoffice/PostOffice.java#L174-L198 |
grpc/grpc-java | okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OptionalMethod.java | OptionalMethod.invokeWithoutCheckedException | public Object invokeWithoutCheckedException(T target, Object... args) {
try {
return invoke(target, args);
} catch (InvocationTargetException e) {
Throwable targetException = e.getTargetException();
if (targetException instanceof RuntimeException) {
throw (RuntimeException) targetException;
}
AssertionError error = new AssertionError("Unexpected exception");
error.initCause(targetException);
throw error;
}
} | java | public Object invokeWithoutCheckedException(T target, Object... args) {
try {
return invoke(target, args);
} catch (InvocationTargetException e) {
Throwable targetException = e.getTargetException();
if (targetException instanceof RuntimeException) {
throw (RuntimeException) targetException;
}
AssertionError error = new AssertionError("Unexpected exception");
error.initCause(targetException);
throw error;
}
} | [
"public",
"Object",
"invokeWithoutCheckedException",
"(",
"T",
"target",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"return",
"invoke",
"(",
"target",
",",
"args",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"Throwable",... | Invokes the method on {@code target}. Throws an error if the method is not supported. Any
RuntimeException thrown by the method is thrown, checked exceptions are wrapped in
an {@link AssertionError}.
@throws IllegalArgumentException if the arguments are invalid | [
"Invokes",
"the",
"method",
"on",
"{",
"@code",
"target",
"}",
".",
"Throws",
"an",
"error",
"if",
"the",
"method",
"is",
"not",
"supported",
".",
"Any",
"RuntimeException",
"thrown",
"by",
"the",
"method",
"is",
"thrown",
"checked",
"exceptions",
"are",
"... | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OptionalMethod.java#L133-L145 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java | MavenModelScannerPlugin.addPluginExecutions | private void addPluginExecutions(MavenPluginDescriptor mavenPluginDescriptor, Plugin plugin, Store store) {
List<PluginExecution> executions = plugin.getExecutions();
for (PluginExecution pluginExecution : executions) {
MavenPluginExecutionDescriptor executionDescriptor = store.create(MavenPluginExecutionDescriptor.class);
executionDescriptor.setId(pluginExecution.getId());
executionDescriptor.setPhase(pluginExecution.getPhase());
executionDescriptor.setInherited(pluginExecution.isInherited());
mavenPluginDescriptor.getExecutions().add(executionDescriptor);
addExecutionGoals(executionDescriptor, pluginExecution, store);
addConfiguration(executionDescriptor, (Xpp3Dom) pluginExecution.getConfiguration(), store);
}
} | java | private void addPluginExecutions(MavenPluginDescriptor mavenPluginDescriptor, Plugin plugin, Store store) {
List<PluginExecution> executions = plugin.getExecutions();
for (PluginExecution pluginExecution : executions) {
MavenPluginExecutionDescriptor executionDescriptor = store.create(MavenPluginExecutionDescriptor.class);
executionDescriptor.setId(pluginExecution.getId());
executionDescriptor.setPhase(pluginExecution.getPhase());
executionDescriptor.setInherited(pluginExecution.isInherited());
mavenPluginDescriptor.getExecutions().add(executionDescriptor);
addExecutionGoals(executionDescriptor, pluginExecution, store);
addConfiguration(executionDescriptor, (Xpp3Dom) pluginExecution.getConfiguration(), store);
}
} | [
"private",
"void",
"addPluginExecutions",
"(",
"MavenPluginDescriptor",
"mavenPluginDescriptor",
",",
"Plugin",
"plugin",
",",
"Store",
"store",
")",
"{",
"List",
"<",
"PluginExecution",
">",
"executions",
"=",
"plugin",
".",
"getExecutions",
"(",
")",
";",
"for",... | Adds information about plugin executions.
@param mavenPluginDescriptor
The descriptor for the plugin.
@param plugin
The Plugin.
@param store
The database. | [
"Adds",
"information",
"about",
"plugin",
"executions",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L500-L512 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkbooksInner.java | WorkbooksInner.createOrUpdateAsync | public Observable<WorkbookInner> createOrUpdateAsync(String resourceGroupName, String resourceName, WorkbookInner workbookProperties) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, workbookProperties).map(new Func1<ServiceResponse<WorkbookInner>, WorkbookInner>() {
@Override
public WorkbookInner call(ServiceResponse<WorkbookInner> response) {
return response.body();
}
});
} | java | public Observable<WorkbookInner> createOrUpdateAsync(String resourceGroupName, String resourceName, WorkbookInner workbookProperties) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, workbookProperties).map(new Func1<ServiceResponse<WorkbookInner>, WorkbookInner>() {
@Override
public WorkbookInner call(ServiceResponse<WorkbookInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkbookInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"WorkbookInner",
"workbookProperties",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
"... | Create a new workbook.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param workbookProperties Properties that need to be specified to create a new workbook.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkbookInner object | [
"Create",
"a",
"new",
"workbook",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkbooksInner.java#L483-L490 |
kiswanij/jk-util | src/main/java/com/jk/util/JKIOUtil.java | JKIOUtil.getExtension | public static String getExtension(final String fileName, final boolean withPoint) {
final int lastIndexOf = fileName.lastIndexOf(".");
if (!withPoint) {
return fileName.substring(lastIndexOf + 1);
}
return fileName.substring(lastIndexOf);
} | java | public static String getExtension(final String fileName, final boolean withPoint) {
final int lastIndexOf = fileName.lastIndexOf(".");
if (!withPoint) {
return fileName.substring(lastIndexOf + 1);
}
return fileName.substring(lastIndexOf);
} | [
"public",
"static",
"String",
"getExtension",
"(",
"final",
"String",
"fileName",
",",
"final",
"boolean",
"withPoint",
")",
"{",
"final",
"int",
"lastIndexOf",
"=",
"fileName",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"if",
"(",
"!",
"withPoint",
")",
... | Gets the extension.
@param fileName the file name
@param withPoint the with point
@return the extension | [
"Gets",
"the",
"extension",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L297-L303 |
demidenko05/beigesoft-orm | src/main/java/org/beigesoft/orm/service/ASrvOrm.java | ASrvOrm.evalRowCount | @Override
public final <T> Integer evalRowCount(
final Map<String, Object> pAddParam,
final Class<T> pEntityClass) throws Exception {
String query = "select count(*) as TOTALROWS from " + pEntityClass
.getSimpleName().toUpperCase() + ";";
return evalRowCountByQuery(pAddParam, pEntityClass, query);
} | java | @Override
public final <T> Integer evalRowCount(
final Map<String, Object> pAddParam,
final Class<T> pEntityClass) throws Exception {
String query = "select count(*) as TOTALROWS from " + pEntityClass
.getSimpleName().toUpperCase() + ";";
return evalRowCountByQuery(pAddParam, pEntityClass, query);
} | [
"@",
"Override",
"public",
"final",
"<",
"T",
">",
"Integer",
"evalRowCount",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"pAddParam",
",",
"final",
"Class",
"<",
"T",
">",
"pEntityClass",
")",
"throws",
"Exception",
"{",
"String",
"query",
"... | <p>Calculate total rows for pagination.</p>
@param <T> - type of business object,
@param pAddParam additional param
@param pEntityClass entity class
@return Integer row count
@throws Exception - an exception | [
"<p",
">",
"Calculate",
"total",
"rows",
"for",
"pagination",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-orm/blob/f1b2c70701a111741a436911ca24ef9d38eba0b9/src/main/java/org/beigesoft/orm/service/ASrvOrm.java#L519-L526 |
OpenTSDB/opentsdb | src/tools/CliOptions.java | CliOptions.getConfig | static final Config getConfig(final ArgP argp) throws IOException {
// load configuration
final Config config;
final String config_file = argp.get("--config", "");
if (!config_file.isEmpty())
config = new Config(config_file);
else
config = new Config(true);
// load CLI overloads
overloadConfig(argp, config);
// the auto metric is recorded to a class boolean flag since it's used so
// often. We have to set it manually after overriding.
config.setAutoMetric(config.getBoolean("tsd.core.auto_create_metrics"));
return config;
} | java | static final Config getConfig(final ArgP argp) throws IOException {
// load configuration
final Config config;
final String config_file = argp.get("--config", "");
if (!config_file.isEmpty())
config = new Config(config_file);
else
config = new Config(true);
// load CLI overloads
overloadConfig(argp, config);
// the auto metric is recorded to a class boolean flag since it's used so
// often. We have to set it manually after overriding.
config.setAutoMetric(config.getBoolean("tsd.core.auto_create_metrics"));
return config;
} | [
"static",
"final",
"Config",
"getConfig",
"(",
"final",
"ArgP",
"argp",
")",
"throws",
"IOException",
"{",
"// load configuration",
"final",
"Config",
"config",
";",
"final",
"String",
"config_file",
"=",
"argp",
".",
"get",
"(",
"\"--config\"",
",",
"\"\"",
"... | Attempts to load a configuration given a file or default files
and overrides with command line arguments
@return A config object with user settings or defaults
@throws IOException If there was an error opening any of the config files
@throws FileNotFoundException If the user provided config file was not found
@since 2.0 | [
"Attempts",
"to",
"load",
"a",
"configuration",
"given",
"a",
"file",
"or",
"default",
"files",
"and",
"overrides",
"with",
"command",
"line",
"arguments"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/CliOptions.java#L94-L109 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-api/src/main/java/org/xwiki/component/util/ReflectionUtils.java | ReflectionUtils.resolveType | private static Type resolveType(Class<?> rootClass, Type[] parameters, Class<?> targetClass)
{
// Look at super interfaces
for (Type interfaceType : rootClass.getGenericInterfaces()) {
Type type = resolveType(interfaceType, rootClass, parameters, targetClass);
if (type != null) {
return type;
}
}
Type superType = rootClass.getGenericSuperclass();
if (superType != null) {
return resolveType(superType, rootClass, parameters, targetClass);
}
return null;
} | java | private static Type resolveType(Class<?> rootClass, Type[] parameters, Class<?> targetClass)
{
// Look at super interfaces
for (Type interfaceType : rootClass.getGenericInterfaces()) {
Type type = resolveType(interfaceType, rootClass, parameters, targetClass);
if (type != null) {
return type;
}
}
Type superType = rootClass.getGenericSuperclass();
if (superType != null) {
return resolveType(superType, rootClass, parameters, targetClass);
}
return null;
} | [
"private",
"static",
"Type",
"resolveType",
"(",
"Class",
"<",
"?",
">",
"rootClass",
",",
"Type",
"[",
"]",
"parameters",
",",
"Class",
"<",
"?",
">",
"targetClass",
")",
"{",
"// Look at super interfaces",
"for",
"(",
"Type",
"interfaceType",
":",
"rootCla... | Find the real generic parameters of the passed target class from the extending/implementing root class and create
a Type from it.
@param rootClass the root class from which to start searching
@param parameters the parameters of the root class
@param targetClass the class from which to resolve the generic parameters
@return a {@link ParameterizedType} version of the passed target class with resolved parameters | [
"Find",
"the",
"real",
"generic",
"parameters",
"of",
"the",
"passed",
"target",
"class",
"from",
"the",
"extending",
"/",
"implementing",
"root",
"class",
"and",
"create",
"a",
"Type",
"from",
"it",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-api/src/main/java/org/xwiki/component/util/ReflectionUtils.java#L425-L441 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/dependency/Evidence.java | Evidence.compareTo | @SuppressWarnings("deprecation")
@Override
public int compareTo(Evidence o) {
if (o == null) {
throw new IllegalArgumentException("Unable to compare null evidence");
}
if (StringUtils.equalsIgnoreCase(source, o.source)) {
if (StringUtils.equalsIgnoreCase(name, o.name)) {
if (StringUtils.equalsIgnoreCase(value, o.value)) {
//TODO the call to ObjectUtils.equals needs to be replaced when we
//stop supporting Jenkins 1.6 requirement.
if (ObjectUtils.equals(confidence, o.confidence)) {
return 0; //they are equal
} else {
return ObjectUtils.compare(confidence, o.confidence);
}
} else {
return compareToIgnoreCaseWithNullCheck(value, o.value);
}
} else {
return compareToIgnoreCaseWithNullCheck(name, o.name);
}
} else {
return compareToIgnoreCaseWithNullCheck(source, o.source);
}
} | java | @SuppressWarnings("deprecation")
@Override
public int compareTo(Evidence o) {
if (o == null) {
throw new IllegalArgumentException("Unable to compare null evidence");
}
if (StringUtils.equalsIgnoreCase(source, o.source)) {
if (StringUtils.equalsIgnoreCase(name, o.name)) {
if (StringUtils.equalsIgnoreCase(value, o.value)) {
//TODO the call to ObjectUtils.equals needs to be replaced when we
//stop supporting Jenkins 1.6 requirement.
if (ObjectUtils.equals(confidence, o.confidence)) {
return 0; //they are equal
} else {
return ObjectUtils.compare(confidence, o.confidence);
}
} else {
return compareToIgnoreCaseWithNullCheck(value, o.value);
}
} else {
return compareToIgnoreCaseWithNullCheck(name, o.name);
}
} else {
return compareToIgnoreCaseWithNullCheck(source, o.source);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"Evidence",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unable to compare null evidence\"",
"... | Implementation of the comparable interface.
@param o the evidence being compared
@return an integer indicating the ordering of the two objects | [
"Implementation",
"of",
"the",
"comparable",
"interface",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/Evidence.java#L207-L232 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsXmlContainerPageFactory.java | CmsXmlContainerPageFactory.createDocument | public static CmsXmlContainerPage createDocument(CmsObject cms, Locale locale, String modelUri)
throws CmsException {
// create the XML content
CmsXmlContainerPage content = new CmsXmlContainerPage(cms, locale, modelUri);
// call prepare for use content handler and return the result
return (CmsXmlContainerPage)content.getHandler().prepareForUse(cms, content);
} | java | public static CmsXmlContainerPage createDocument(CmsObject cms, Locale locale, String modelUri)
throws CmsException {
// create the XML content
CmsXmlContainerPage content = new CmsXmlContainerPage(cms, locale, modelUri);
// call prepare for use content handler and return the result
return (CmsXmlContainerPage)content.getHandler().prepareForUse(cms, content);
} | [
"public",
"static",
"CmsXmlContainerPage",
"createDocument",
"(",
"CmsObject",
"cms",
",",
"Locale",
"locale",
",",
"String",
"modelUri",
")",
"throws",
"CmsException",
"{",
"// create the XML content",
"CmsXmlContainerPage",
"content",
"=",
"new",
"CmsXmlContainerPage",
... | Create a new instance of an container page based on the given default content,
that will have all language nodes of the default content and ensures the presence of the given locale.<p>
The given encoding is used when marshalling the XML again later.<p>
@param cms the current users OpenCms content
@param locale the locale to generate the default content for
@param modelUri the absolute path to the container page file acting as model
@throws CmsException in case the model file is not found or not valid
@return the created container page | [
"Create",
"a",
"new",
"instance",
"of",
"an",
"container",
"page",
"based",
"on",
"the",
"given",
"default",
"content",
"that",
"will",
"have",
"all",
"language",
"nodes",
"of",
"the",
"default",
"content",
"and",
"ensures",
"the",
"presence",
"of",
"the",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlContainerPageFactory.java#L84-L91 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java | Identifiers.createIdentity | public static Identity createIdentity(IdentityType type, String name, String admDom,
String otherTypeDef) {
return new Identity(type, name, admDom, otherTypeDef);
} | java | public static Identity createIdentity(IdentityType type, String name, String admDom,
String otherTypeDef) {
return new Identity(type, name, admDom, otherTypeDef);
} | [
"public",
"static",
"Identity",
"createIdentity",
"(",
"IdentityType",
"type",
",",
"String",
"name",
",",
"String",
"admDom",
",",
"String",
"otherTypeDef",
")",
"{",
"return",
"new",
"Identity",
"(",
"type",
",",
"name",
",",
"admDom",
",",
"otherTypeDef",
... | Create an identity identifier.
<br/><br/>
<b>Note: otherTypeDef != null should imply type {@link IdentityType#other}.</b>
@param type the type of the identity identifier
@param name the name of the identity identifier
@param admDom the administrative-domain of the identity identifier
@param otherTypeDef vendor specific {@link String}
@return the new {@link Identity} instance | [
"Create",
"an",
"identity",
"identifier",
".",
"<br",
"/",
">",
"<br",
"/",
">",
"<b",
">",
"Note",
":",
"otherTypeDef",
"!",
"=",
"null",
"should",
"imply",
"type",
"{",
"@link",
"IdentityType#other",
"}",
".",
"<",
"/",
"b",
">"
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java#L541-L544 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java | JobsInner.resumeAsync | public Observable<Void> resumeAsync(String resourceGroupName, String automationAccountName, UUID jobId) {
return resumeWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> resumeAsync(String resourceGroupName, String automationAccountName, UUID jobId) {
return resumeWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"resumeAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"UUID",
"jobId",
")",
"{",
"return",
"resumeWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
... | Resume the job identified by jobId.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Resume",
"the",
"job",
"identified",
"by",
"jobId",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java#L938-L945 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java | NetUtil.getUsableLocalPort | public static int getUsableLocalPort(int minPort, int maxPort) {
for (int i = minPort; i <= maxPort; i++) {
if (isUsableLocalPort(RandomUtil.randomInt(minPort, maxPort + 1))) {
return i;
}
}
throw new UtilException("Could not find an available port in the range [{}, {}] after {} attempts", minPort, maxPort, maxPort - minPort);
} | java | public static int getUsableLocalPort(int minPort, int maxPort) {
for (int i = minPort; i <= maxPort; i++) {
if (isUsableLocalPort(RandomUtil.randomInt(minPort, maxPort + 1))) {
return i;
}
}
throw new UtilException("Could not find an available port in the range [{}, {}] after {} attempts", minPort, maxPort, maxPort - minPort);
} | [
"public",
"static",
"int",
"getUsableLocalPort",
"(",
"int",
"minPort",
",",
"int",
"maxPort",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"minPort",
";",
"i",
"<=",
"maxPort",
";",
"i",
"++",
")",
"{",
"if",
"(",
"isUsableLocalPort",
"(",
"RandomUtil",
"."... | 查找指定范围内的可用端口<br>
此方法只检测给定范围内的随机一个端口,检测maxPort-minPort次<br>
来自org.springframework.util.SocketUtils
@param minPort 端口最小值(包含)
@param maxPort 端口最大值(包含)
@return 可用的端口
@since 4.5.4 | [
"查找指定范围内的可用端口<br",
">",
"此方法只检测给定范围内的随机一个端口,检测maxPort",
"-",
"minPort次<br",
">",
"来自org",
".",
"springframework",
".",
"util",
".",
"SocketUtils"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L157-L165 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java | Scheduler.durationMinutes | public static double durationMinutes(LocalDateTime start, LocalDateTime end)
{
return Duration.between(start, end).toMinutes();
} | java | public static double durationMinutes(LocalDateTime start, LocalDateTime end)
{
return Duration.between(start, end).toMinutes();
} | [
"public",
"static",
"double",
"durationMinutes",
"(",
"LocalDateTime",
"start",
",",
"LocalDateTime",
"end",
")",
"{",
"return",
"Duration",
".",
"between",
"(",
"start",
",",
"end",
")",
".",
"toMinutes",
"(",
")",
";",
"}"
] | 1 seconds = 1/60 minutes
@param start between time
@param end finish time
@return duration in minutes | [
"1",
"seconds",
"=",
"1",
"/",
"60",
"minutes"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L110-L114 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java | ClassPath.newInstance | public static <T> T newInstance(Class<?> aClass, Object... initargs)
throws SetupException
{
Class<?>[] parameterTypes = null;
if(initargs != null && initargs.length > 0)
{
parameterTypes = new Class<?>[initargs.length];
for (int i = 0; i < initargs.length; i++)
{
if(initargs[i] == null)
continue; //skip
parameterTypes[i] = initargs[i].getClass();
}
}
return newInstance(aClass,parameterTypes,initargs);
} | java | public static <T> T newInstance(Class<?> aClass, Object... initargs)
throws SetupException
{
Class<?>[] parameterTypes = null;
if(initargs != null && initargs.length > 0)
{
parameterTypes = new Class<?>[initargs.length];
for (int i = 0; i < initargs.length; i++)
{
if(initargs[i] == null)
continue; //skip
parameterTypes[i] = initargs[i].getClass();
}
}
return newInstance(aClass,parameterTypes,initargs);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"Object",
"...",
"initargs",
")",
"throws",
"SetupException",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
"=",
"null",
";",
"if",
"(",
"in... | Create a new instance of a given object
@param aClass the class the create
@param initargs the initial constructor arguments
@param <T> the type class
@return the create instance
@throws SetupException when an initialize issue occurs | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"given",
"object"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java#L194-L213 |
buschmais/jqa-javaee6-plugin | src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java | WebXmlScannerPlugin.createSessionConfig | private SessionConfigDescriptor createSessionConfig(SessionConfigType sessionConfigType, Store store) {
SessionConfigDescriptor sessionConfigDescriptor = store.create(SessionConfigDescriptor.class);
XsdIntegerType sessionTimeout = sessionConfigType.getSessionTimeout();
if (sessionTimeout != null) {
sessionConfigDescriptor.setSessionTimeout(sessionTimeout.getValue().intValue());
}
return sessionConfigDescriptor;
} | java | private SessionConfigDescriptor createSessionConfig(SessionConfigType sessionConfigType, Store store) {
SessionConfigDescriptor sessionConfigDescriptor = store.create(SessionConfigDescriptor.class);
XsdIntegerType sessionTimeout = sessionConfigType.getSessionTimeout();
if (sessionTimeout != null) {
sessionConfigDescriptor.setSessionTimeout(sessionTimeout.getValue().intValue());
}
return sessionConfigDescriptor;
} | [
"private",
"SessionConfigDescriptor",
"createSessionConfig",
"(",
"SessionConfigType",
"sessionConfigType",
",",
"Store",
"store",
")",
"{",
"SessionConfigDescriptor",
"sessionConfigDescriptor",
"=",
"store",
".",
"create",
"(",
"SessionConfigDescriptor",
".",
"class",
")",... | Create a session config descriptor.
@param sessionConfigType
The XML session config type.
@param store
The store.
@return The session config descriptor. | [
"Create",
"a",
"session",
"config",
"descriptor",
"."
] | train | https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java#L516-L523 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java | CPDefinitionLinkPersistenceImpl.countByC_C_T | @Override
public int countByC_C_T(long CPDefinitionId, long CProductId, String type) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C_T;
Object[] finderArgs = new Object[] { CPDefinitionId, CProductId, type };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_COUNT_CPDEFINITIONLINK_WHERE);
query.append(_FINDER_COLUMN_C_C_T_CPDEFINITIONID_2);
query.append(_FINDER_COLUMN_C_C_T_CPRODUCTID_2);
boolean bindType = false;
if (type == null) {
query.append(_FINDER_COLUMN_C_C_T_TYPE_1);
}
else if (type.equals("")) {
query.append(_FINDER_COLUMN_C_C_T_TYPE_3);
}
else {
bindType = true;
query.append(_FINDER_COLUMN_C_C_T_TYPE_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CPDefinitionId);
qPos.add(CProductId);
if (bindType) {
qPos.add(type);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByC_C_T(long CPDefinitionId, long CProductId, String type) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C_T;
Object[] finderArgs = new Object[] { CPDefinitionId, CProductId, type };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_COUNT_CPDEFINITIONLINK_WHERE);
query.append(_FINDER_COLUMN_C_C_T_CPDEFINITIONID_2);
query.append(_FINDER_COLUMN_C_C_T_CPRODUCTID_2);
boolean bindType = false;
if (type == null) {
query.append(_FINDER_COLUMN_C_C_T_TYPE_1);
}
else if (type.equals("")) {
query.append(_FINDER_COLUMN_C_C_T_TYPE_3);
}
else {
bindType = true;
query.append(_FINDER_COLUMN_C_C_T_TYPE_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CPDefinitionId);
qPos.add(CProductId);
if (bindType) {
qPos.add(type);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByC_C_T",
"(",
"long",
"CPDefinitionId",
",",
"long",
"CProductId",
",",
"String",
"type",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_COUNT_BY_C_C_T",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object... | Returns the number of cp definition links where CPDefinitionId = ? and CProductId = ? and type = ?.
@param CPDefinitionId the cp definition ID
@param CProductId the c product ID
@param type the type
@return the number of matching cp definition links | [
"Returns",
"the",
"number",
"of",
"cp",
"definition",
"links",
"where",
"CPDefinitionId",
"=",
"?",
";",
"and",
"CProductId",
"=",
"?",
";",
"and",
"type",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L3898-L3963 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAnimator.java | GVRAnimator.setDuration | public void setDuration(float start, float end)
{
for (GVRAnimation anim : mAnimations)
{
anim.setDuration(start,end);
}
} | java | public void setDuration(float start, float end)
{
for (GVRAnimation anim : mAnimations)
{
anim.setDuration(start,end);
}
} | [
"public",
"void",
"setDuration",
"(",
"float",
"start",
",",
"float",
"end",
")",
"{",
"for",
"(",
"GVRAnimation",
"anim",
":",
"mAnimations",
")",
"{",
"anim",
".",
"setDuration",
"(",
"start",
",",
"end",
")",
";",
"}",
"}"
] | Sets the duration for the animations in this animator.
@param start the animation will start playing from the specified time
@param end the animation will stop playing at the specified time
@see GVRAnimation#setDuration(float, float) | [
"Sets",
"the",
"duration",
"for",
"the",
"animations",
"in",
"this",
"animator",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRAnimator.java#L258-L264 |
rometools/rome | rome-modules/src/main/java/com/rometools/modules/georss/geometries/PositionList.java | PositionList.insert | public void insert(final int pos, final double latitude, final double longitude) {
ensureCapacity(size + 1);
System.arraycopy(this.longitude, pos, this.longitude, pos + 1, size - pos);
System.arraycopy(this.latitude, pos, this.latitude, pos + 1, size - pos);
this.longitude[pos] = longitude;
this.latitude[pos] = latitude;
++size;
} | java | public void insert(final int pos, final double latitude, final double longitude) {
ensureCapacity(size + 1);
System.arraycopy(this.longitude, pos, this.longitude, pos + 1, size - pos);
System.arraycopy(this.latitude, pos, this.latitude, pos + 1, size - pos);
this.longitude[pos] = longitude;
this.latitude[pos] = latitude;
++size;
} | [
"public",
"void",
"insert",
"(",
"final",
"int",
"pos",
",",
"final",
"double",
"latitude",
",",
"final",
"double",
"longitude",
")",
"{",
"ensureCapacity",
"(",
"size",
"+",
"1",
")",
";",
"System",
".",
"arraycopy",
"(",
"this",
".",
"longitude",
",",
... | Add a position at a given index in the list. The rest of the list is shifted one place to the
"right"
@param pos position index | [
"Add",
"a",
"position",
"at",
"a",
"given",
"index",
"in",
"the",
"list",
".",
"The",
"rest",
"of",
"the",
"list",
"is",
"shifted",
"one",
"place",
"to",
"the",
"right"
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/georss/geometries/PositionList.java#L129-L136 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/BaseDao.java | BaseDao.getFromCache | @SuppressWarnings("unchecked")
protected <T> T getFromCache(String cacheName, String key, Class<T> clazz) {
Object obj = getFromCache(cacheName, key);
if (obj == null) {
return null;
}
if (clazz.isAssignableFrom(obj.getClass())) {
return (T) obj;
}
return null;
} | java | @SuppressWarnings("unchecked")
protected <T> T getFromCache(String cacheName, String key, Class<T> clazz) {
Object obj = getFromCache(cacheName, key);
if (obj == null) {
return null;
}
if (clazz.isAssignableFrom(obj.getClass())) {
return (T) obj;
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"T",
">",
"T",
"getFromCache",
"(",
"String",
"cacheName",
",",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Object",
"obj",
"=",
"getFromCache",
"(",
"cacheName",
... | Gets an entry from cache.
<p>
Note: if the object from cache is not assignable to clazz,
<code>null</code> is returned.
</p>
@param cacheName
@param key
@param clazz
@return | [
"Gets",
"an",
"entry",
"from",
"cache",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseDao.java#L233-L243 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/httpclient/GsonMessageBodyHandler.java | GsonMessageBodyHandler.getAppropriateType | private Type getAppropriateType(Class<?> type, Type genericType)
{
return type.equals(genericType) ? type : genericType;
} | java | private Type getAppropriateType(Class<?> type, Type genericType)
{
return type.equals(genericType) ? type : genericType;
} | [
"private",
"Type",
"getAppropriateType",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Type",
"genericType",
")",
"{",
"return",
"type",
".",
"equals",
"(",
"genericType",
")",
"?",
"type",
":",
"genericType",
";",
"}"
] | Returns the type of the given class.
@param type The class to get the type for
@param genericType The type to use if the input class is a generic type
@return The type of the given class | [
"Returns",
"the",
"type",
"of",
"the",
"given",
"class",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/httpclient/GsonMessageBodyHandler.java#L395-L398 |
remkop/picocli | src/main/java/picocli/CommandLine.java | CommandLine.printVersionHelp | public void printVersionHelp(PrintStream out, Help.Ansi ansi) {
for (String versionInfo : getCommandSpec().version()) {
out.println(ansi.new Text(versionInfo));
}
out.flush();
} | java | public void printVersionHelp(PrintStream out, Help.Ansi ansi) {
for (String versionInfo : getCommandSpec().version()) {
out.println(ansi.new Text(versionInfo));
}
out.flush();
} | [
"public",
"void",
"printVersionHelp",
"(",
"PrintStream",
"out",
",",
"Help",
".",
"Ansi",
"ansi",
")",
"{",
"for",
"(",
"String",
"versionInfo",
":",
"getCommandSpec",
"(",
")",
".",
"version",
"(",
")",
")",
"{",
"out",
".",
"println",
"(",
"ansi",
"... | Prints version information from the {@link Command#version()} annotation to the specified {@code PrintStream}.
Each element of the array of version strings is printed on a separate line. Version strings may contain
<a href="http://picocli.info/#_usage_help_with_styles_and_colors">markup for colors and style</a>.
@param out the printStream to print to
@param ansi whether the usage message should include ANSI escape codes or not
@see Command#version()
@see Option#versionHelp()
@see #isVersionHelpRequested()
@since 0.9.8 | [
"Prints",
"version",
"information",
"from",
"the",
"{"
] | train | https://github.com/remkop/picocli/blob/3c5384f0d12817401d1921c3013c1282e2edcab2/src/main/java/picocli/CommandLine.java#L2209-L2214 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listCompositeEntities | public List<CompositeEntityExtractor> listCompositeEntities(UUID appId, String versionId, ListCompositeEntitiesOptionalParameter listCompositeEntitiesOptionalParameter) {
return listCompositeEntitiesWithServiceResponseAsync(appId, versionId, listCompositeEntitiesOptionalParameter).toBlocking().single().body();
} | java | public List<CompositeEntityExtractor> listCompositeEntities(UUID appId, String versionId, ListCompositeEntitiesOptionalParameter listCompositeEntitiesOptionalParameter) {
return listCompositeEntitiesWithServiceResponseAsync(appId, versionId, listCompositeEntitiesOptionalParameter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"CompositeEntityExtractor",
">",
"listCompositeEntities",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListCompositeEntitiesOptionalParameter",
"listCompositeEntitiesOptionalParameter",
")",
"{",
"return",
"listCompositeEntitiesWithServiceRespons... | Gets information about the composite entity models.
@param appId The application ID.
@param versionId The version ID.
@param listCompositeEntitiesOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<CompositeEntityExtractor> object if successful. | [
"Gets",
"information",
"about",
"the",
"composite",
"entity",
"models",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1643-L1645 |
kiegroup/droolsjbpm-integration | kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java | KieServerHttpRequest.appendQueryParameters | static String appendQueryParameters( final CharSequence url, final Map<?, ?> params ) {
final String baseUrl = url.toString();
if( params == null || params.isEmpty() )
return baseUrl;
final StringBuilder result = new StringBuilder(baseUrl);
addPathSeparator(baseUrl, result);
addParamPrefix(baseUrl, result);
Entry<?, ?> entry;
Object value;
Iterator<?> iterator = params.entrySet().iterator();
entry = (Entry<?, ?>) iterator.next();
result.append(entry.getKey().toString());
result.append('=');
value = entry.getValue();
if( value != null )
result.append(value);
while( iterator.hasNext() ) {
result.append('&');
entry = (Entry<?, ?>) iterator.next();
result.append(entry.getKey().toString());
result.append('=');
value = entry.getValue();
if( value != null )
result.append(value);
}
return result.toString();
} | java | static String appendQueryParameters( final CharSequence url, final Map<?, ?> params ) {
final String baseUrl = url.toString();
if( params == null || params.isEmpty() )
return baseUrl;
final StringBuilder result = new StringBuilder(baseUrl);
addPathSeparator(baseUrl, result);
addParamPrefix(baseUrl, result);
Entry<?, ?> entry;
Object value;
Iterator<?> iterator = params.entrySet().iterator();
entry = (Entry<?, ?>) iterator.next();
result.append(entry.getKey().toString());
result.append('=');
value = entry.getValue();
if( value != null )
result.append(value);
while( iterator.hasNext() ) {
result.append('&');
entry = (Entry<?, ?>) iterator.next();
result.append(entry.getKey().toString());
result.append('=');
value = entry.getValue();
if( value != null )
result.append(value);
}
return result.toString();
} | [
"static",
"String",
"appendQueryParameters",
"(",
"final",
"CharSequence",
"url",
",",
"final",
"Map",
"<",
"?",
",",
"?",
">",
"params",
")",
"{",
"final",
"String",
"baseUrl",
"=",
"url",
".",
"toString",
"(",
")",
";",
"if",
"(",
"params",
"==",
"nu... | Append given map as query parameters to the base URL
<p>
Each map entry's key will be a parameter name and the value's {@link Object#toString()} will be the parameter value.
@param url
@param params
@return URL with appended query params | [
"Append",
"given",
"map",
"as",
"query",
"parameters",
"to",
"the",
"base",
"URL",
"<p",
">",
"Each",
"map",
"entry",
"s",
"key",
"will",
"be",
"a",
"parameter",
"name",
"and",
"the",
"value",
"s",
"{",
"@link",
"Object#toString",
"()",
"}",
"will",
"b... | train | https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java#L505-L536 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/searchindex/CmsDeleteIndexSourceDialog.java | CmsDeleteIndexSourceDialog.createDialogHtml | @Override
protected String createDialogHtml(String dialog) {
StringBuffer result = new StringBuffer(512);
result.append(createWidgetTableStart());
// show error header once if there were validation errors
result.append(createWidgetErrorHeader());
if (dialog.equals(PAGES[0])) {
// create the widgets for the first dialog page
result.append(dialogBlockStart(key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_NAME_0)));
result.append(createWidgetTableStart());
result.append(
key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_CONF_1, new Object[] {m_indexsource.getName()}));
result.append(createWidgetTableEnd());
result.append(dialogBlockEnd());
}
result.append(createWidgetTableEnd());
// See CmsWidgetDialog.dialogButtonsCustom(): if no widgets are defined that are non-display-only widgets,
// no dialog buttons (Ok, Cancel) will be visible....
result.append(dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2]));
return result.toString();
} | java | @Override
protected String createDialogHtml(String dialog) {
StringBuffer result = new StringBuffer(512);
result.append(createWidgetTableStart());
// show error header once if there were validation errors
result.append(createWidgetErrorHeader());
if (dialog.equals(PAGES[0])) {
// create the widgets for the first dialog page
result.append(dialogBlockStart(key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_NAME_0)));
result.append(createWidgetTableStart());
result.append(
key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_CONF_1, new Object[] {m_indexsource.getName()}));
result.append(createWidgetTableEnd());
result.append(dialogBlockEnd());
}
result.append(createWidgetTableEnd());
// See CmsWidgetDialog.dialogButtonsCustom(): if no widgets are defined that are non-display-only widgets,
// no dialog buttons (Ok, Cancel) will be visible....
result.append(dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2]));
return result.toString();
} | [
"@",
"Override",
"protected",
"String",
"createDialogHtml",
"(",
"String",
"dialog",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"result",
".",
"append",
"(",
"createWidgetTableStart",
"(",
")",
")",
";",
"// show erro... | Creates the dialog HTML for all defined widgets of the named dialog (page).<p>
This overwrites the method from the super class to create a layout variation for the widgets.<p>
@param dialog the dialog (page) to get the HTML for
@return the dialog HTML for all defined widgets of the named dialog (page) | [
"Creates",
"the",
"dialog",
"HTML",
"for",
"all",
"defined",
"widgets",
"of",
"the",
"named",
"dialog",
"(",
"page",
")",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsDeleteIndexSourceDialog.java#L110-L135 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateSecretAsync | public Observable<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion) {
return updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion).map(new Func1<ServiceResponse<SecretBundle>, SecretBundle>() {
@Override
public SecretBundle call(ServiceResponse<SecretBundle> response) {
return response.body();
}
});
} | java | public Observable<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion) {
return updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion).map(new Func1<ServiceResponse<SecretBundle>, SecretBundle>() {
@Override
public SecretBundle call(ServiceResponse<SecretBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SecretBundle",
">",
"updateSecretAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"secretName",
",",
"String",
"secretVersion",
")",
"{",
"return",
"updateSecretWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"secretName",
",",
... | Updates the attributes associated with a specified secret in a given key vault.
The UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation requires the secrets/set permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@param secretVersion The version of the secret.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SecretBundle object | [
"Updates",
"the",
"attributes",
"associated",
"with",
"a",
"specified",
"secret",
"in",
"a",
"given",
"key",
"vault",
".",
"The",
"UPDATE",
"operation",
"changes",
"specified",
"attributes",
"of",
"an",
"existing",
"stored",
"secret",
".",
"Attributes",
"that",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3649-L3656 |
Netflix/karyon | karyon2-governator/src/main/java/netflix/karyon/Karyon.java | Karyon.forTcpConnectionHandler | public static KaryonServer forTcpConnectionHandler(int port, ConnectionHandler<ByteBuf, ByteBuf> handler,
Module... modules) {
return forTcpConnectionHandler(port, handler, toBootstrapModule(modules));
} | java | public static KaryonServer forTcpConnectionHandler(int port, ConnectionHandler<ByteBuf, ByteBuf> handler,
Module... modules) {
return forTcpConnectionHandler(port, handler, toBootstrapModule(modules));
} | [
"public",
"static",
"KaryonServer",
"forTcpConnectionHandler",
"(",
"int",
"port",
",",
"ConnectionHandler",
"<",
"ByteBuf",
",",
"ByteBuf",
">",
"handler",
",",
"Module",
"...",
"modules",
")",
"{",
"return",
"forTcpConnectionHandler",
"(",
"port",
",",
"handler"... | Creates a new {@link KaryonServer} that has a single TCP server instance which delegates all connection
handling to {@link ConnectionHandler}.
The {@link RxServer} is created using {@link RxNetty#newTcpServerBuilder(int, ConnectionHandler)}
@param port Port for the server.
@param handler Connection Handler
@param modules Additional modules if any.
@return {@link KaryonServer} which is to be used to start the created server. | [
"Creates",
"a",
"new",
"{",
"@link",
"KaryonServer",
"}",
"that",
"has",
"a",
"single",
"TCP",
"server",
"instance",
"which",
"delegates",
"all",
"connection",
"handling",
"to",
"{",
"@link",
"ConnectionHandler",
"}",
".",
"The",
"{",
"@link",
"RxServer",
"}... | train | https://github.com/Netflix/karyon/blob/d50bc0ff37693ef3fbda373e90a109d1f92e0b9a/karyon2-governator/src/main/java/netflix/karyon/Karyon.java#L87-L90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.