repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.attributeInexistent | public static void attributeInexistent(String attributeName, Class<?> aClass) {
"""
Thrown if attributes isn't present in the xml file.
@param attributeName attribute name
@param aClass class analyzed
"""
throw new IllegalArgumentException(MSG.INSTANCE.message(malformedBeanException2,attributeName,aClass.getSimpleName()));
} | java | public static void attributeInexistent(String attributeName, Class<?> aClass){
throw new IllegalArgumentException(MSG.INSTANCE.message(malformedBeanException2,attributeName,aClass.getSimpleName()));
} | [
"public",
"static",
"void",
"attributeInexistent",
"(",
"String",
"attributeName",
",",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"malformedBeanException2",
",",
"attributeName",
",",
"aClass",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"}"
] | Thrown if attributes isn't present in the xml file.
@param attributeName attribute name
@param aClass class analyzed | [
"Thrown",
"if",
"attributes",
"isn",
"t",
"present",
"in",
"the",
"xml",
"file",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L278-L280 |
hibernate/hibernate-metamodelgen | src/main/java/org/hibernate/jpamodelgen/util/TypeUtils.java | TypeUtils.getAnnotationMirror | public static AnnotationMirror getAnnotationMirror(Element element, String fqcn) {
"""
Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param fqcn the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the {@code Element} or {@code null} in case
the {@code TypeElement} does not host the specified annotation.
"""
assert element != null;
assert fqcn != null;
AnnotationMirror mirror = null;
for ( AnnotationMirror am : element.getAnnotationMirrors() ) {
if ( isAnnotationMirrorOfType( am, fqcn ) ) {
mirror = am;
break;
}
}
return mirror;
} | java | public static AnnotationMirror getAnnotationMirror(Element element, String fqcn) {
assert element != null;
assert fqcn != null;
AnnotationMirror mirror = null;
for ( AnnotationMirror am : element.getAnnotationMirrors() ) {
if ( isAnnotationMirrorOfType( am, fqcn ) ) {
mirror = am;
break;
}
}
return mirror;
} | [
"public",
"static",
"AnnotationMirror",
"getAnnotationMirror",
"(",
"Element",
"element",
",",
"String",
"fqcn",
")",
"{",
"assert",
"element",
"!=",
"null",
";",
"assert",
"fqcn",
"!=",
"null",
";",
"AnnotationMirror",
"mirror",
"=",
"null",
";",
"for",
"(",
"AnnotationMirror",
"am",
":",
"element",
".",
"getAnnotationMirrors",
"(",
")",
")",
"{",
"if",
"(",
"isAnnotationMirrorOfType",
"(",
"am",
",",
"fqcn",
")",
")",
"{",
"mirror",
"=",
"am",
";",
"break",
";",
"}",
"}",
"return",
"mirror",
";",
"}"
] | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param fqcn the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the {@code Element} or {@code null} in case
the {@code TypeElement} does not host the specified annotation. | [
"Checks",
"whether",
"the",
"{",
"@code",
"Element",
"}",
"hosts",
"the",
"annotation",
"with",
"the",
"given",
"fully",
"qualified",
"class",
"name",
"."
] | train | https://github.com/hibernate/hibernate-metamodelgen/blob/2c87b262bc03b1a5a541789fc00c54e0531a36b2/src/main/java/org/hibernate/jpamodelgen/util/TypeUtils.java#L145-L157 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/component/UIComponentBase.java | UIComponentBase.setValueBinding | public void setValueBinding(String name, ValueBinding binding) {
"""
{@inheritDoc}
@throws IllegalArgumentException {@inheritDoc}
@throws NullPointerException {@inheritDoc}
@deprecated This has been replaced by {@link #setValueExpression}.
"""
if (name == null) {
throw new NullPointerException();
}
if (binding != null) {
ValueExpressionValueBindingAdapter adapter =
new ValueExpressionValueBindingAdapter(binding);
setValueExpression(name, adapter);
} else {
setValueExpression(name, null);
}
} | java | public void setValueBinding(String name, ValueBinding binding) {
if (name == null) {
throw new NullPointerException();
}
if (binding != null) {
ValueExpressionValueBindingAdapter adapter =
new ValueExpressionValueBindingAdapter(binding);
setValueExpression(name, adapter);
} else {
setValueExpression(name, null);
}
} | [
"public",
"void",
"setValueBinding",
"(",
"String",
"name",
",",
"ValueBinding",
"binding",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"if",
"(",
"binding",
"!=",
"null",
")",
"{",
"ValueExpressionValueBindingAdapter",
"adapter",
"=",
"new",
"ValueExpressionValueBindingAdapter",
"(",
"binding",
")",
";",
"setValueExpression",
"(",
"name",
",",
"adapter",
")",
";",
"}",
"else",
"{",
"setValueExpression",
"(",
"name",
",",
"null",
")",
";",
"}",
"}"
] | {@inheritDoc}
@throws IllegalArgumentException {@inheritDoc}
@throws NullPointerException {@inheritDoc}
@deprecated This has been replaced by {@link #setValueExpression}. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIComponentBase.java#L300-L312 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.pipe | public static <E> void pipe(Iterator<E> iterator, OutputIterator<E> outputIterator) {
"""
Consumes the input iterator to the output iterator.
@param <E> the iterator element type
@param iterator the iterator that will be consumed
@param outputIterator the iterator that will be filled
"""
new ConsumeIntoOutputIterator<>(outputIterator).apply(iterator);
} | java | public static <E> void pipe(Iterator<E> iterator, OutputIterator<E> outputIterator) {
new ConsumeIntoOutputIterator<>(outputIterator).apply(iterator);
} | [
"public",
"static",
"<",
"E",
">",
"void",
"pipe",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
",",
"OutputIterator",
"<",
"E",
">",
"outputIterator",
")",
"{",
"new",
"ConsumeIntoOutputIterator",
"<>",
"(",
"outputIterator",
")",
".",
"apply",
"(",
"iterator",
")",
";",
"}"
] | Consumes the input iterator to the output iterator.
@param <E> the iterator element type
@param iterator the iterator that will be consumed
@param outputIterator the iterator that will be filled | [
"Consumes",
"the",
"input",
"iterator",
"to",
"the",
"output",
"iterator",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L311-L313 |
Erudika/para | para-core/src/main/java/com/erudika/para/utils/Config.java | Config.getConfigDouble | public static double getConfigDouble(String key, double defaultValue) {
"""
Returns the double value of a configuration parameter.
@param key the param key
@param defaultValue the default param value
@return the value of a param
"""
return NumberUtils.toDouble(getConfigParam(key, Double.toString(defaultValue)));
} | java | public static double getConfigDouble(String key, double defaultValue) {
return NumberUtils.toDouble(getConfigParam(key, Double.toString(defaultValue)));
} | [
"public",
"static",
"double",
"getConfigDouble",
"(",
"String",
"key",
",",
"double",
"defaultValue",
")",
"{",
"return",
"NumberUtils",
".",
"toDouble",
"(",
"getConfigParam",
"(",
"key",
",",
"Double",
".",
"toString",
"(",
"defaultValue",
")",
")",
")",
";",
"}"
] | Returns the double value of a configuration parameter.
@param key the param key
@param defaultValue the default param value
@return the value of a param | [
"Returns",
"the",
"double",
"value",
"of",
"a",
"configuration",
"parameter",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Config.java#L344-L346 |
geomajas/geomajas-project-client-gwt2 | plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java | WmsServerExtension.createLayer | public FeatureInfoSupportedWmsServerLayer createLayer(String title, String crs, TileConfiguration tileConfig,
WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo) {
"""
Create a new WMS layer. This layer extends the default {@link org.geomajas.gwt2.plugin.wms.client.layer.WmsLayer}
by supporting GetFeatureInfo calls.
@param title The layer title.
@param crs The CRS for this layer.
@param tileConfig The tile configuration object.
@param layerConfig The layer configuration object.
@param layerInfo The layer info object. Acquired from a WMS GetCapabilities. This is optional.
@return A new WMS layer.
"""
return new FeatureInfoSupportedWmsServerLayer(title, crs, layerConfig, tileConfig, layerInfo);
} | java | public FeatureInfoSupportedWmsServerLayer createLayer(String title, String crs, TileConfiguration tileConfig,
WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo) {
return new FeatureInfoSupportedWmsServerLayer(title, crs, layerConfig, tileConfig, layerInfo);
} | [
"public",
"FeatureInfoSupportedWmsServerLayer",
"createLayer",
"(",
"String",
"title",
",",
"String",
"crs",
",",
"TileConfiguration",
"tileConfig",
",",
"WmsLayerConfiguration",
"layerConfig",
",",
"WmsLayerInfo",
"layerInfo",
")",
"{",
"return",
"new",
"FeatureInfoSupportedWmsServerLayer",
"(",
"title",
",",
"crs",
",",
"layerConfig",
",",
"tileConfig",
",",
"layerInfo",
")",
";",
"}"
] | Create a new WMS layer. This layer extends the default {@link org.geomajas.gwt2.plugin.wms.client.layer.WmsLayer}
by supporting GetFeatureInfo calls.
@param title The layer title.
@param crs The CRS for this layer.
@param tileConfig The tile configuration object.
@param layerConfig The layer configuration object.
@param layerInfo The layer info object. Acquired from a WMS GetCapabilities. This is optional.
@return A new WMS layer. | [
"Create",
"a",
"new",
"WMS",
"layer",
".",
"This",
"layer",
"extends",
"the",
"default",
"{",
"@link",
"org",
".",
"geomajas",
".",
"gwt2",
".",
"plugin",
".",
"wms",
".",
"client",
".",
"layer",
".",
"WmsLayer",
"}",
"by",
"supporting",
"GetFeatureInfo",
"calls",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java#L156-L159 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/routes/RouteTrie.java | RouteTrie.findExact | public final Route findExact(final char[] arr, HttpMethod method) {
"""
/*public final Route findExact(final char[] arr) {
TrieNode current = root;
for(char c : arr) {
if(current.nodes[c] == null)
return null;
else
current = current.nodes[c];
}
return routes.get(current.routeIndex);//current.route != null;
}
"""
TrieNode current = root;
//for(char c : arr) {
for (int i = 0; i < arr.length; i++) {
char c = arr[i];
if(current.nodes[c] == null)
return null;
else
current = current.nodes[c];
}
// return routes.get(current.routeIndex);//current.route != null;
//return enumRoutes.get(current.routeIndex).get(method);
return current.routes[method.ordinal()];
} | java | public final Route findExact(final char[] arr, HttpMethod method) {
TrieNode current = root;
//for(char c : arr) {
for (int i = 0; i < arr.length; i++) {
char c = arr[i];
if(current.nodes[c] == null)
return null;
else
current = current.nodes[c];
}
// return routes.get(current.routeIndex);//current.route != null;
//return enumRoutes.get(current.routeIndex).get(method);
return current.routes[method.ordinal()];
} | [
"public",
"final",
"Route",
"findExact",
"(",
"final",
"char",
"[",
"]",
"arr",
",",
"HttpMethod",
"method",
")",
"{",
"TrieNode",
"current",
"=",
"root",
";",
"//for(char c : arr) {",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"arr",
"[",
"i",
"]",
";",
"if",
"(",
"current",
".",
"nodes",
"[",
"c",
"]",
"==",
"null",
")",
"return",
"null",
";",
"else",
"current",
"=",
"current",
".",
"nodes",
"[",
"c",
"]",
";",
"}",
"// return routes.get(current.routeIndex);//current.route != null;",
"//return enumRoutes.get(current.routeIndex).get(method);",
"return",
"current",
".",
"routes",
"[",
"method",
".",
"ordinal",
"(",
")",
"]",
";",
"}"
] | /*public final Route findExact(final char[] arr) {
TrieNode current = root;
for(char c : arr) {
if(current.nodes[c] == null)
return null;
else
current = current.nodes[c];
}
return routes.get(current.routeIndex);//current.route != null;
} | [
"/",
"*",
"public",
"final",
"Route",
"findExact",
"(",
"final",
"char",
"[]",
"arr",
")",
"{",
"TrieNode",
"current",
"=",
"root",
";",
"for",
"(",
"char",
"c",
":",
"arr",
")",
"{",
"if",
"(",
"current",
".",
"nodes",
"[",
"c",
"]",
"==",
"null",
")",
"return",
"null",
";",
"else",
"current",
"=",
"current",
".",
"nodes",
"[",
"c",
"]",
";",
"}",
"return",
"routes",
".",
"get",
"(",
"current",
".",
"routeIndex",
")",
";",
"//",
"current",
".",
"route",
"!",
"=",
"null",
";",
"}"
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/routes/RouteTrie.java#L113-L126 |
jbundle/jbundle | base/model/src/main/java/org/jbundle/base/model/Utility.java | Utility.getServletPath | public static String getServletPath(Task task, String strServletParam) {
"""
Get the path to the target servlet.
@param strServletParam The servlet type (html or xml)
@return the servlet path.
"""
String strServletName = null;
if (strServletParam == null)
strServletParam = Params.SERVLET;
if (task != null)
strServletName = task.getProperty(strServletParam);
if ((strServletName == null) || (strServletName.length() == 0))
{
strServletName = Constants.DEFAULT_SERVLET;
//? if (this.getTask() instanceof RemoteRecordOwner)
//? strServletName = strServletName + "xsl"; // Special case - if task is a session, servlet should be appxsl
if (Params.XHTMLSERVLET.equalsIgnoreCase(strServletParam))
strServletName = Constants.DEFAULT_XHTML_SERVLET;
}
return strServletName;
} | java | public static String getServletPath(Task task, String strServletParam)
{
String strServletName = null;
if (strServletParam == null)
strServletParam = Params.SERVLET;
if (task != null)
strServletName = task.getProperty(strServletParam);
if ((strServletName == null) || (strServletName.length() == 0))
{
strServletName = Constants.DEFAULT_SERVLET;
//? if (this.getTask() instanceof RemoteRecordOwner)
//? strServletName = strServletName + "xsl"; // Special case - if task is a session, servlet should be appxsl
if (Params.XHTMLSERVLET.equalsIgnoreCase(strServletParam))
strServletName = Constants.DEFAULT_XHTML_SERVLET;
}
return strServletName;
} | [
"public",
"static",
"String",
"getServletPath",
"(",
"Task",
"task",
",",
"String",
"strServletParam",
")",
"{",
"String",
"strServletName",
"=",
"null",
";",
"if",
"(",
"strServletParam",
"==",
"null",
")",
"strServletParam",
"=",
"Params",
".",
"SERVLET",
";",
"if",
"(",
"task",
"!=",
"null",
")",
"strServletName",
"=",
"task",
".",
"getProperty",
"(",
"strServletParam",
")",
";",
"if",
"(",
"(",
"strServletName",
"==",
"null",
")",
"||",
"(",
"strServletName",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"strServletName",
"=",
"Constants",
".",
"DEFAULT_SERVLET",
";",
"//? if (this.getTask() instanceof RemoteRecordOwner)",
"//? strServletName = strServletName + \"xsl\"; // Special case - if task is a session, servlet should be appxsl",
"if",
"(",
"Params",
".",
"XHTMLSERVLET",
".",
"equalsIgnoreCase",
"(",
"strServletParam",
")",
")",
"strServletName",
"=",
"Constants",
".",
"DEFAULT_XHTML_SERVLET",
";",
"}",
"return",
"strServletName",
";",
"}"
] | Get the path to the target servlet.
@param strServletParam The servlet type (html or xml)
@return the servlet path. | [
"Get",
"the",
"path",
"to",
"the",
"target",
"servlet",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L846-L862 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java | OSMTablesFactory.createNodeTable | public static PreparedStatement createNodeTable(Connection connection, String nodeTableName, boolean isH2) throws SQLException {
"""
Create the nodes table that will be used to import OSM nodes
Example :
<node id="298884269" lat="54.0901746" lon="12.2482632" user="SvenHRO"
uid="46882" visible="true" version="1" changeset="676636"
timestamp="2008-09-21T21:37:45Z"/>
@param connection
@param nodeTableName
@param isH2
@return
@throws SQLException
"""
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(nodeTableName);
sb.append("(ID_NODE BIGINT PRIMARY KEY, THE_GEOM ");
if(isH2) {
sb.append("POINT CHECK ST_SRID(THE_GEOM)=4326");
} else {
sb.append("GEOMETRY(POINT, 4326)");
}
sb.append(",ELE DOUBLE PRECISION,"
+ "USER_NAME VARCHAR,"
+ "UID BIGINT,"
+ "VISIBLE BOOLEAN,"
+ "VERSION INTEGER,"
+ "CHANGESET INTEGER,"
+ "LAST_UPDATE TIMESTAMP,"
+ "NAME VARCHAR);");
stmt.execute(sb.toString());
}
return connection.prepareStatement("INSERT INTO " + nodeTableName + " VALUES (?,?,?,?,?,?,?,?,?,?);");
} | java | public static PreparedStatement createNodeTable(Connection connection, String nodeTableName, boolean isH2) throws SQLException {
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(nodeTableName);
sb.append("(ID_NODE BIGINT PRIMARY KEY, THE_GEOM ");
if(isH2) {
sb.append("POINT CHECK ST_SRID(THE_GEOM)=4326");
} else {
sb.append("GEOMETRY(POINT, 4326)");
}
sb.append(",ELE DOUBLE PRECISION,"
+ "USER_NAME VARCHAR,"
+ "UID BIGINT,"
+ "VISIBLE BOOLEAN,"
+ "VERSION INTEGER,"
+ "CHANGESET INTEGER,"
+ "LAST_UPDATE TIMESTAMP,"
+ "NAME VARCHAR);");
stmt.execute(sb.toString());
}
return connection.prepareStatement("INSERT INTO " + nodeTableName + " VALUES (?,?,?,?,?,?,?,?,?,?);");
} | [
"public",
"static",
"PreparedStatement",
"createNodeTable",
"(",
"Connection",
"connection",
",",
"String",
"nodeTableName",
",",
"boolean",
"isH2",
")",
"throws",
"SQLException",
"{",
"try",
"(",
"Statement",
"stmt",
"=",
"connection",
".",
"createStatement",
"(",
")",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"CREATE TABLE \"",
")",
";",
"sb",
".",
"append",
"(",
"nodeTableName",
")",
";",
"sb",
".",
"append",
"(",
"\"(ID_NODE BIGINT PRIMARY KEY, THE_GEOM \"",
")",
";",
"if",
"(",
"isH2",
")",
"{",
"sb",
".",
"append",
"(",
"\"POINT CHECK ST_SRID(THE_GEOM)=4326\"",
")",
";",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"\"GEOMETRY(POINT, 4326)\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\",ELE DOUBLE PRECISION,\"",
"+",
"\"USER_NAME VARCHAR,\"",
"+",
"\"UID BIGINT,\"",
"+",
"\"VISIBLE BOOLEAN,\"",
"+",
"\"VERSION INTEGER,\"",
"+",
"\"CHANGESET INTEGER,\"",
"+",
"\"LAST_UPDATE TIMESTAMP,\"",
"+",
"\"NAME VARCHAR);\"",
")",
";",
"stmt",
".",
"execute",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"connection",
".",
"prepareStatement",
"(",
"\"INSERT INTO \"",
"+",
"nodeTableName",
"+",
"\" VALUES (?,?,?,?,?,?,?,?,?,?);\"",
")",
";",
"}"
] | Create the nodes table that will be used to import OSM nodes
Example :
<node id="298884269" lat="54.0901746" lon="12.2482632" user="SvenHRO"
uid="46882" visible="true" version="1" changeset="676636"
timestamp="2008-09-21T21:37:45Z"/>
@param connection
@param nodeTableName
@param isH2
@return
@throws SQLException | [
"Create",
"the",
"nodes",
"table",
"that",
"will",
"be",
"used",
"to",
"import",
"OSM",
"nodes",
"Example",
":",
"<node",
"id",
"=",
"298884269",
"lat",
"=",
"54",
".",
"0901746",
"lon",
"=",
"12",
".",
"2482632",
"user",
"=",
"SvenHRO",
"uid",
"=",
"46882",
"visible",
"=",
"true",
"version",
"=",
"1",
"changeset",
"=",
"676636",
"timestamp",
"=",
"2008",
"-",
"09",
"-",
"21T21",
":",
"37",
":",
"45Z",
"/",
">"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java#L102-L123 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.createImageTagsAsync | public Observable<ImageTagCreateSummary> createImageTagsAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) {
"""
Associate a set of images with a set of tags.
@param projectId The project id
@param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageTagCreateSummary object
"""
return createImageTagsWithServiceResponseAsync(projectId, createImageTagsOptionalParameter).map(new Func1<ServiceResponse<ImageTagCreateSummary>, ImageTagCreateSummary>() {
@Override
public ImageTagCreateSummary call(ServiceResponse<ImageTagCreateSummary> response) {
return response.body();
}
});
} | java | public Observable<ImageTagCreateSummary> createImageTagsAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) {
return createImageTagsWithServiceResponseAsync(projectId, createImageTagsOptionalParameter).map(new Func1<ServiceResponse<ImageTagCreateSummary>, ImageTagCreateSummary>() {
@Override
public ImageTagCreateSummary call(ServiceResponse<ImageTagCreateSummary> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImageTagCreateSummary",
">",
"createImageTagsAsync",
"(",
"UUID",
"projectId",
",",
"CreateImageTagsOptionalParameter",
"createImageTagsOptionalParameter",
")",
"{",
"return",
"createImageTagsWithServiceResponseAsync",
"(",
"projectId",
",",
"createImageTagsOptionalParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ImageTagCreateSummary",
">",
",",
"ImageTagCreateSummary",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ImageTagCreateSummary",
"call",
"(",
"ServiceResponse",
"<",
"ImageTagCreateSummary",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Associate a set of images with a set of tags.
@param projectId The project id
@param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageTagCreateSummary object | [
"Associate",
"a",
"set",
"of",
"images",
"with",
"a",
"set",
"of",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3624-L3631 |
lucee/Lucee | core/src/main/java/lucee/runtime/jsr223/AbstractScriptEngine.java | AbstractScriptEngine.setBindings | public void setBindings(Bindings bindings, int scope) {
"""
Sets the <code>Bindings</code> with the corresponding scope value in the <code>context</code>
field.
@param bindings The specified <code>Bindings</code>.
@param scope The specified scope.
@throws IllegalArgumentException if the value of scope is invalid for the type the
<code>context</code> field.
@throws NullPointerException if the bindings is null and the scope is
<code>ScriptContext.ENGINE_SCOPE</code>
"""
if (scope == ScriptContext.GLOBAL_SCOPE) {
context.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
;
}
else if (scope == ScriptContext.ENGINE_SCOPE) {
context.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
;
}
else {
throw new IllegalArgumentException("Invalid scope value.");
}
} | java | public void setBindings(Bindings bindings, int scope) {
if (scope == ScriptContext.GLOBAL_SCOPE) {
context.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
;
}
else if (scope == ScriptContext.ENGINE_SCOPE) {
context.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
;
}
else {
throw new IllegalArgumentException("Invalid scope value.");
}
} | [
"public",
"void",
"setBindings",
"(",
"Bindings",
"bindings",
",",
"int",
"scope",
")",
"{",
"if",
"(",
"scope",
"==",
"ScriptContext",
".",
"GLOBAL_SCOPE",
")",
"{",
"context",
".",
"setBindings",
"(",
"bindings",
",",
"ScriptContext",
".",
"GLOBAL_SCOPE",
")",
";",
";",
"}",
"else",
"if",
"(",
"scope",
"==",
"ScriptContext",
".",
"ENGINE_SCOPE",
")",
"{",
"context",
".",
"setBindings",
"(",
"bindings",
",",
"ScriptContext",
".",
"ENGINE_SCOPE",
")",
";",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid scope value.\"",
")",
";",
"}",
"}"
] | Sets the <code>Bindings</code> with the corresponding scope value in the <code>context</code>
field.
@param bindings The specified <code>Bindings</code>.
@param scope The specified scope.
@throws IllegalArgumentException if the value of scope is invalid for the type the
<code>context</code> field.
@throws NullPointerException if the bindings is null and the scope is
<code>ScriptContext.ENGINE_SCOPE</code> | [
"Sets",
"the",
"<code",
">",
"Bindings<",
"/",
"code",
">",
"with",
"the",
"corresponding",
"scope",
"value",
"in",
"the",
"<code",
">",
"context<",
"/",
"code",
">",
"field",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/jsr223/AbstractScriptEngine.java#L114-L127 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java | ApiOvhDedicatednas.serviceName_partition_partitionName_quota_POST | public OvhTask serviceName_partition_partitionName_quota_POST(String serviceName, String partitionName, Long size, Long uid) throws IOException {
"""
Set a new quota
REST: POST /dedicated/nas/{serviceName}/partition/{partitionName}/quota
@param uid [required] the uid to set quota on
@param size [required] the size to set in MB
@param serviceName [required] The internal name of your storage
@param partitionName [required] the given name of partition
"""
String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}/quota";
StringBuilder sb = path(qPath, serviceName, partitionName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "size", size);
addBody(o, "uid", uid);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_partition_partitionName_quota_POST(String serviceName, String partitionName, Long size, Long uid) throws IOException {
String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}/quota";
StringBuilder sb = path(qPath, serviceName, partitionName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "size", size);
addBody(o, "uid", uid);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_partition_partitionName_quota_POST",
"(",
"String",
"serviceName",
",",
"String",
"partitionName",
",",
"Long",
"size",
",",
"Long",
"uid",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/nas/{serviceName}/partition/{partitionName}/quota\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"partitionName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"size\"",
",",
"size",
")",
";",
"addBody",
"(",
"o",
",",
"\"uid\"",
",",
"uid",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Set a new quota
REST: POST /dedicated/nas/{serviceName}/partition/{partitionName}/quota
@param uid [required] the uid to set quota on
@param size [required] the size to set in MB
@param serviceName [required] The internal name of your storage
@param partitionName [required] the given name of partition | [
"Set",
"a",
"new",
"quota"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java#L282-L290 |
mguymon/model-citizen | core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java | ModelFactory.createModel | public <T> T createModel(Class<T> clazz) throws CreateModelException {
"""
Create a Model for a registered Blueprint
@param <T> model Class
@param clazz Model class
@return Model
@throws CreateModelException model failed to create
"""
return createModel(clazz, true);
} | java | public <T> T createModel(Class<T> clazz) throws CreateModelException {
return createModel(clazz, true);
} | [
"public",
"<",
"T",
">",
"T",
"createModel",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"CreateModelException",
"{",
"return",
"createModel",
"(",
"clazz",
",",
"true",
")",
";",
"}"
] | Create a Model for a registered Blueprint
@param <T> model Class
@param clazz Model class
@return Model
@throws CreateModelException model failed to create | [
"Create",
"a",
"Model",
"for",
"a",
"registered",
"Blueprint"
] | train | https://github.com/mguymon/model-citizen/blob/9078ab4121897a21e598dd4f0efa6996b46e4dea/core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java#L451-L453 |
beangle/beangle3 | ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java | BeanDefinitionParser.parsePropertySubElement | public Object parsePropertySubElement(Element ele, BeanDefinition bd) {
"""
<p>
parsePropertySubElement.
</p>
@param ele a {@link org.w3c.dom.Element} object.
@param bd a {@link org.springframework.beans.factory.config.BeanDefinition} object.
@return a {@link java.lang.Object} object.
"""
return parsePropertySubElement(ele, bd, null);
} | java | public Object parsePropertySubElement(Element ele, BeanDefinition bd) {
return parsePropertySubElement(ele, bd, null);
} | [
"public",
"Object",
"parsePropertySubElement",
"(",
"Element",
"ele",
",",
"BeanDefinition",
"bd",
")",
"{",
"return",
"parsePropertySubElement",
"(",
"ele",
",",
"bd",
",",
"null",
")",
";",
"}"
] | <p>
parsePropertySubElement.
</p>
@param ele a {@link org.w3c.dom.Element} object.
@param bd a {@link org.springframework.beans.factory.config.BeanDefinition} object.
@return a {@link java.lang.Object} object. | [
"<p",
">",
"parsePropertySubElement",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L650-L652 |
grpc/grpc-java | okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OptionalMethod.java | OptionalMethod.invokeOptionalWithoutCheckedException | public Object invokeOptionalWithoutCheckedException(T target, Object... args) {
"""
Invokes the method on {@code target}. If the method does not exist or is not
public then {@code null} is returned. Any RuntimeException thrown by the method is thrown,
checked exceptions are wrapped in an {@link AssertionError}.
@throws IllegalArgumentException if the arguments are invalid
"""
try {
return invokeOptional(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 invokeOptionalWithoutCheckedException(T target, Object... args) {
try {
return invokeOptional(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",
"invokeOptionalWithoutCheckedException",
"(",
"T",
"target",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"return",
"invokeOptional",
"(",
"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",
";",
"}",
"}"
] | Invokes the method on {@code target}. If the method does not exist or is not
public then {@code null} is returned. 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",
"}",
".",
"If",
"the",
"method",
"does",
"not",
"exist",
"or",
"is",
"not",
"public",
"then",
"{",
"@code",
"null",
"}",
"is",
"returned",
".",
"Any",
"RuntimeException",
"thrown",
"by",
"the",
"method",
"is",
"thrown",
"checked",
"exceptions",
"are",
"wrapped",
"in",
"an",
"{",
"@link",
"AssertionError",
"}",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OptionalMethod.java#L90-L102 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.removeParticipants | public void removeParticipants(@NonNull final String conversationId, @NonNull final List<String> ids, @Nullable Callback<ComapiResult<Void>> callback) {
"""
Returns observable to remove list of participants from a conversation.
@param conversationId ID of a conversation to delete.
@param ids List of participant ids to be removed.
@param callback Callback to deliver new session instance.
"""
adapter.adapt(removeParticipants(conversationId, ids), callback);
} | java | public void removeParticipants(@NonNull final String conversationId, @NonNull final List<String> ids, @Nullable Callback<ComapiResult<Void>> callback) {
adapter.adapt(removeParticipants(conversationId, ids), callback);
} | [
"public",
"void",
"removeParticipants",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
",",
"@",
"NonNull",
"final",
"List",
"<",
"String",
">",
"ids",
",",
"@",
"Nullable",
"Callback",
"<",
"ComapiResult",
"<",
"Void",
">",
">",
"callback",
")",
"{",
"adapter",
".",
"adapt",
"(",
"removeParticipants",
"(",
"conversationId",
",",
"ids",
")",
",",
"callback",
")",
";",
"}"
] | Returns observable to remove list of participants from a conversation.
@param conversationId ID of a conversation to delete.
@param ids List of participant ids to be removed.
@param callback Callback to deliver new session instance. | [
"Returns",
"observable",
"to",
"remove",
"list",
"of",
"participants",
"from",
"a",
"conversation",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L626-L628 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java | BeanO.setState | protected final synchronized void setState(int oldState, int newState)
throws InvalidBeanOStateException, BeanNotReentrantException // LIDB2775-23.7 {
"""
Set the current state of this <code>BeanO</code>. <p>
The current state of this <code>BeanO</code> must be old state,
else this method fails. <p>
@param oldState the old state <p>
@param newState the new state <p>
"""
//------------------------------------------------------------------------
// Inlined assertState(oldState); for performance. d154342.6
//------------------------------------------------------------------------
if (state != oldState) {
throw new InvalidBeanOStateException(getStateName(state),
getStateName(oldState));
}
if (TraceComponent.isAnyTracingEnabled() && // d527372
TEBeanLifeCycleInfo.isTraceEnabled())
TEBeanLifeCycleInfo.traceBeanState(state, getStateName(state), newState,
getStateName(newState)); // d167264
//------------------------------------------------------------------------
// Inlined setState(newState); for performance. d154342.6
//------------------------------------------------------------------------
state = newState;
} | java | protected final synchronized void setState(int oldState, int newState)
throws InvalidBeanOStateException, BeanNotReentrantException // LIDB2775-23.7
{
//------------------------------------------------------------------------
// Inlined assertState(oldState); for performance. d154342.6
//------------------------------------------------------------------------
if (state != oldState) {
throw new InvalidBeanOStateException(getStateName(state),
getStateName(oldState));
}
if (TraceComponent.isAnyTracingEnabled() && // d527372
TEBeanLifeCycleInfo.isTraceEnabled())
TEBeanLifeCycleInfo.traceBeanState(state, getStateName(state), newState,
getStateName(newState)); // d167264
//------------------------------------------------------------------------
// Inlined setState(newState); for performance. d154342.6
//------------------------------------------------------------------------
state = newState;
} | [
"protected",
"final",
"synchronized",
"void",
"setState",
"(",
"int",
"oldState",
",",
"int",
"newState",
")",
"throws",
"InvalidBeanOStateException",
",",
"BeanNotReentrantException",
"// LIDB2775-23.7",
"{",
"//------------------------------------------------------------------------",
"// Inlined assertState(oldState); for performance. d154342.6",
"//------------------------------------------------------------------------",
"if",
"(",
"state",
"!=",
"oldState",
")",
"{",
"throw",
"new",
"InvalidBeanOStateException",
"(",
"getStateName",
"(",
"state",
")",
",",
"getStateName",
"(",
"oldState",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"// d527372",
"TEBeanLifeCycleInfo",
".",
"isTraceEnabled",
"(",
")",
")",
"TEBeanLifeCycleInfo",
".",
"traceBeanState",
"(",
"state",
",",
"getStateName",
"(",
"state",
")",
",",
"newState",
",",
"getStateName",
"(",
"newState",
")",
")",
";",
"// d167264",
"//------------------------------------------------------------------------",
"// Inlined setState(newState); for performance. d154342.6",
"//------------------------------------------------------------------------",
"state",
"=",
"newState",
";",
"}"
] | Set the current state of this <code>BeanO</code>. <p>
The current state of this <code>BeanO</code> must be old state,
else this method fails. <p>
@param oldState the old state <p>
@param newState the new state <p> | [
"Set",
"the",
"current",
"state",
"of",
"this",
"<code",
">",
"BeanO<",
"/",
"code",
">",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java#L254-L274 |
aol/cyclops | cyclops/src/main/java/com/oath/cyclops/internal/stream/publisher/PublisherIterable.java | PublisherIterable.subscribe | static <T> void subscribe(Subscriber<? super T> s, Iterator<? extends T> it) {
"""
Common method to take an Iterator as a source of values.
@param s
@param it
"""
if (it == null) {
error(s, new NullPointerException("The iterator is null"));
return;
}
boolean b;
try {
b = it.hasNext();
} catch (Throwable e) {
error(s, e);
return;
}
if (!b) {
complete(s);
return;
}
s.onSubscribe(new IterableSubscription<T>(s, it));
} | java | static <T> void subscribe(Subscriber<? super T> s, Iterator<? extends T> it) {
if (it == null) {
error(s, new NullPointerException("The iterator is null"));
return;
}
boolean b;
try {
b = it.hasNext();
} catch (Throwable e) {
error(s, e);
return;
}
if (!b) {
complete(s);
return;
}
s.onSubscribe(new IterableSubscription<T>(s, it));
} | [
"static",
"<",
"T",
">",
"void",
"subscribe",
"(",
"Subscriber",
"<",
"?",
"super",
"T",
">",
"s",
",",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"it",
")",
"{",
"if",
"(",
"it",
"==",
"null",
")",
"{",
"error",
"(",
"s",
",",
"new",
"NullPointerException",
"(",
"\"The iterator is null\"",
")",
")",
";",
"return",
";",
"}",
"boolean",
"b",
";",
"try",
"{",
"b",
"=",
"it",
".",
"hasNext",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"error",
"(",
"s",
",",
"e",
")",
";",
"return",
";",
"}",
"if",
"(",
"!",
"b",
")",
"{",
"complete",
"(",
"s",
")",
";",
"return",
";",
"}",
"s",
".",
"onSubscribe",
"(",
"new",
"IterableSubscription",
"<",
"T",
">",
"(",
"s",
",",
"it",
")",
")",
";",
"}"
] | Common method to take an Iterator as a source of values.
@param s
@param it | [
"Common",
"method",
"to",
"take",
"an",
"Iterator",
"as",
"a",
"source",
"of",
"values",
"."
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/internal/stream/publisher/PublisherIterable.java#L123-L145 |
Bandwidth/java-bandwidth | src/main/java/com/bandwidth/sdk/BandwidthClient.java | BandwidthClient.postJson | public RestResponse postJson(final String uri, final String params)
throws IOException, AppPlatformException {
"""
This method implements an HTTP POST. Use this method to create a new resource.
@param uri the URI.
@param params the parameters.
@return the post response.
@throws IOException unexpected exception.
@throws AppPlatformException unexpected exception.
"""
return requestJson(getPath(uri), HttpPost.METHOD_NAME, params);
} | java | public RestResponse postJson(final String uri, final String params)
throws IOException, AppPlatformException {
return requestJson(getPath(uri), HttpPost.METHOD_NAME, params);
} | [
"public",
"RestResponse",
"postJson",
"(",
"final",
"String",
"uri",
",",
"final",
"String",
"params",
")",
"throws",
"IOException",
",",
"AppPlatformException",
"{",
"return",
"requestJson",
"(",
"getPath",
"(",
"uri",
")",
",",
"HttpPost",
".",
"METHOD_NAME",
",",
"params",
")",
";",
"}"
] | This method implements an HTTP POST. Use this method to create a new resource.
@param uri the URI.
@param params the parameters.
@return the post response.
@throws IOException unexpected exception.
@throws AppPlatformException unexpected exception. | [
"This",
"method",
"implements",
"an",
"HTTP",
"POST",
".",
"Use",
"this",
"method",
"to",
"create",
"a",
"new",
"resource",
"."
] | train | https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L354-L357 |
google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.getChars | public void getChars(int start, int end, char[] dest, int destoff) {
"""
Copy the specified range of chars from this buffer into the
specified array, beginning at the specified offset.
"""
checkRange("getChars", start, end);
if (end <= mGapStart) {
System.arraycopy(mText, start, dest, destoff, end - start);
} else if (start >= mGapStart) {
System.arraycopy(mText, start + mGapLength, dest, destoff, end - start);
} else {
System.arraycopy(mText, start, dest, destoff, mGapStart - start);
System.arraycopy(mText, mGapStart + mGapLength,
dest, destoff + (mGapStart - start),
end - mGapStart);
}
} | java | public void getChars(int start, int end, char[] dest, int destoff) {
checkRange("getChars", start, end);
if (end <= mGapStart) {
System.arraycopy(mText, start, dest, destoff, end - start);
} else if (start >= mGapStart) {
System.arraycopy(mText, start + mGapLength, dest, destoff, end - start);
} else {
System.arraycopy(mText, start, dest, destoff, mGapStart - start);
System.arraycopy(mText, mGapStart + mGapLength,
dest, destoff + (mGapStart - start),
end - mGapStart);
}
} | [
"public",
"void",
"getChars",
"(",
"int",
"start",
",",
"int",
"end",
",",
"char",
"[",
"]",
"dest",
",",
"int",
"destoff",
")",
"{",
"checkRange",
"(",
"\"getChars\"",
",",
"start",
",",
"end",
")",
";",
"if",
"(",
"end",
"<=",
"mGapStart",
")",
"{",
"System",
".",
"arraycopy",
"(",
"mText",
",",
"start",
",",
"dest",
",",
"destoff",
",",
"end",
"-",
"start",
")",
";",
"}",
"else",
"if",
"(",
"start",
">=",
"mGapStart",
")",
"{",
"System",
".",
"arraycopy",
"(",
"mText",
",",
"start",
"+",
"mGapLength",
",",
"dest",
",",
"destoff",
",",
"end",
"-",
"start",
")",
";",
"}",
"else",
"{",
"System",
".",
"arraycopy",
"(",
"mText",
",",
"start",
",",
"dest",
",",
"destoff",
",",
"mGapStart",
"-",
"start",
")",
";",
"System",
".",
"arraycopy",
"(",
"mText",
",",
"mGapStart",
"+",
"mGapLength",
",",
"dest",
",",
"destoff",
"+",
"(",
"mGapStart",
"-",
"start",
")",
",",
"end",
"-",
"mGapStart",
")",
";",
"}",
"}"
] | Copy the specified range of chars from this buffer into the
specified array, beginning at the specified offset. | [
"Copy",
"the",
"specified",
"range",
"of",
"chars",
"from",
"this",
"buffer",
"into",
"the",
"specified",
"array",
"beginning",
"at",
"the",
"specified",
"offset",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L910-L923 |
facebookarchive/hive-dwrf | hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java | Slice.setBytes | public void setBytes(int index, Slice source, int sourceIndex, int length) {
"""
Transfers data from the specified slice into this buffer starting at
the specified absolute {@code index}.
@param sourceIndex the first index of the source
@param length the number of bytes to transfer
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0},
if the specified {@code sourceIndex} is less than {@code 0},
if {@code index + length} is greater than
{@code this.length()}, or
if {@code sourceIndex + length} is greater than
{@code source.length()}
"""
checkIndexLength(index, length);
checkPositionIndexes(sourceIndex, sourceIndex + length, source.length());
copyMemory(source.base, source.address + sourceIndex, base, address + index, length);
} | java | public void setBytes(int index, Slice source, int sourceIndex, int length)
{
checkIndexLength(index, length);
checkPositionIndexes(sourceIndex, sourceIndex + length, source.length());
copyMemory(source.base, source.address + sourceIndex, base, address + index, length);
} | [
"public",
"void",
"setBytes",
"(",
"int",
"index",
",",
"Slice",
"source",
",",
"int",
"sourceIndex",
",",
"int",
"length",
")",
"{",
"checkIndexLength",
"(",
"index",
",",
"length",
")",
";",
"checkPositionIndexes",
"(",
"sourceIndex",
",",
"sourceIndex",
"+",
"length",
",",
"source",
".",
"length",
"(",
")",
")",
";",
"copyMemory",
"(",
"source",
".",
"base",
",",
"source",
".",
"address",
"+",
"sourceIndex",
",",
"base",
",",
"address",
"+",
"index",
",",
"length",
")",
";",
"}"
] | Transfers data from the specified slice into this buffer starting at
the specified absolute {@code index}.
@param sourceIndex the first index of the source
@param length the number of bytes to transfer
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0},
if the specified {@code sourceIndex} is less than {@code 0},
if {@code index + length} is greater than
{@code this.length()}, or
if {@code sourceIndex + length} is greater than
{@code source.length()} | [
"Transfers",
"data",
"from",
"the",
"specified",
"slice",
"into",
"this",
"buffer",
"starting",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"."
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L503-L509 |
strator-dev/greenpepper | greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java | ReflectionUtils.getDeclaredFieldValue | public static Object getDeclaredFieldValue(Object object, String declaredFieldName)
throws Exception {
"""
<p>getDeclaredFieldValue.</p>
@param object a {@link java.lang.Object} object.
@param declaredFieldName a {@link java.lang.String} object.
@return a {@link java.lang.Object} object.
@throws java.lang.Exception if any.
"""
Field field = object.getClass().getDeclaredField(declaredFieldName);
field.setAccessible(true);
return field.get(object);
} | java | public static Object getDeclaredFieldValue(Object object, String declaredFieldName)
throws Exception
{
Field field = object.getClass().getDeclaredField(declaredFieldName);
field.setAccessible(true);
return field.get(object);
} | [
"public",
"static",
"Object",
"getDeclaredFieldValue",
"(",
"Object",
"object",
",",
"String",
"declaredFieldName",
")",
"throws",
"Exception",
"{",
"Field",
"field",
"=",
"object",
".",
"getClass",
"(",
")",
".",
"getDeclaredField",
"(",
"declaredFieldName",
")",
";",
"field",
".",
"setAccessible",
"(",
"true",
")",
";",
"return",
"field",
".",
"get",
"(",
"object",
")",
";",
"}"
] | <p>getDeclaredFieldValue.</p>
@param object a {@link java.lang.Object} object.
@param declaredFieldName a {@link java.lang.String} object.
@return a {@link java.lang.Object} object.
@throws java.lang.Exception if any. | [
"<p",
">",
"getDeclaredFieldValue",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java#L41-L49 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/message/record/RecordMessage.java | RecordMessage.convertToThinMessage | public BaseMessage convertToThinMessage() {
"""
If you are sending a thick message to a thin client, convert it first.
Since BaseMessage is already, so conversion is necessary... return this message.
@return this message.
"""
int iChangeType = ((RecordMessageHeader)this.getMessageHeader()).getRecordMessageType();
// See if this record is currently displayed or buffered, if so, refresh and display.
Object data = this.getData();
BaseMessage messageTableUpdate = null;
// NOTE: The only way I will send this message to the client is if the ModelMessageHandler.START_INDEX_PARAM has been added to this message by the TableSession
// if (properties.get(ModelMessageHandler.START_INDEX_PARAM) != null)
{
BaseMessageHeader messageHeader = new SessionMessageHeader(this.getMessageHeader().getQueueName(), this.getMessageHeader().getQueueType(), null, this);
messageTableUpdate = new MapMessage(messageHeader, data);
messageTableUpdate.put(MessageConstants.MESSAGE_TYPE_PARAM, Integer.toString(iChangeType));
}
return messageTableUpdate;
} | java | public BaseMessage convertToThinMessage()
{
int iChangeType = ((RecordMessageHeader)this.getMessageHeader()).getRecordMessageType();
// See if this record is currently displayed or buffered, if so, refresh and display.
Object data = this.getData();
BaseMessage messageTableUpdate = null;
// NOTE: The only way I will send this message to the client is if the ModelMessageHandler.START_INDEX_PARAM has been added to this message by the TableSession
// if (properties.get(ModelMessageHandler.START_INDEX_PARAM) != null)
{
BaseMessageHeader messageHeader = new SessionMessageHeader(this.getMessageHeader().getQueueName(), this.getMessageHeader().getQueueType(), null, this);
messageTableUpdate = new MapMessage(messageHeader, data);
messageTableUpdate.put(MessageConstants.MESSAGE_TYPE_PARAM, Integer.toString(iChangeType));
}
return messageTableUpdate;
} | [
"public",
"BaseMessage",
"convertToThinMessage",
"(",
")",
"{",
"int",
"iChangeType",
"=",
"(",
"(",
"RecordMessageHeader",
")",
"this",
".",
"getMessageHeader",
"(",
")",
")",
".",
"getRecordMessageType",
"(",
")",
";",
"// See if this record is currently displayed or buffered, if so, refresh and display.",
"Object",
"data",
"=",
"this",
".",
"getData",
"(",
")",
";",
"BaseMessage",
"messageTableUpdate",
"=",
"null",
";",
"// NOTE: The only way I will send this message to the client is if the ModelMessageHandler.START_INDEX_PARAM has been added to this message by the TableSession",
"// if (properties.get(ModelMessageHandler.START_INDEX_PARAM) != null)",
"{",
"BaseMessageHeader",
"messageHeader",
"=",
"new",
"SessionMessageHeader",
"(",
"this",
".",
"getMessageHeader",
"(",
")",
".",
"getQueueName",
"(",
")",
",",
"this",
".",
"getMessageHeader",
"(",
")",
".",
"getQueueType",
"(",
")",
",",
"null",
",",
"this",
")",
";",
"messageTableUpdate",
"=",
"new",
"MapMessage",
"(",
"messageHeader",
",",
"data",
")",
";",
"messageTableUpdate",
".",
"put",
"(",
"MessageConstants",
".",
"MESSAGE_TYPE_PARAM",
",",
"Integer",
".",
"toString",
"(",
"iChangeType",
")",
")",
";",
"}",
"return",
"messageTableUpdate",
";",
"}"
] | If you are sending a thick message to a thin client, convert it first.
Since BaseMessage is already, so conversion is necessary... return this message.
@return this message. | [
"If",
"you",
"are",
"sending",
"a",
"thick",
"message",
"to",
"a",
"thin",
"client",
"convert",
"it",
"first",
".",
"Since",
"BaseMessage",
"is",
"already",
"so",
"conversion",
"is",
"necessary",
"...",
"return",
"this",
"message",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/RecordMessage.java#L80-L95 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/script/ExtensionScript.java | ExtensionScript.handleScriptException | public void handleScriptException(ScriptWrapper script, Exception exception) {
"""
Handles exceptions thrown by scripts.
<p>
The given {@code exception} (if of type {@code ScriptException} the cause will be used instead) will be written to the
the writer(s) associated with the given {@code script}, moreover it will be disabled and flagged that has an error.
@param script the script that resulted in an exception, must not be {@code null}
@param exception the exception thrown , must not be {@code null}
@since 2.5.0
@see #setEnabled(ScriptWrapper, boolean)
@see #setError(ScriptWrapper, Exception)
@see #handleFailedScriptInterface(ScriptWrapper, String)
@see ScriptException
"""
handleScriptException(script, getWriters(script), exception);
} | java | public void handleScriptException(ScriptWrapper script, Exception exception) {
handleScriptException(script, getWriters(script), exception);
} | [
"public",
"void",
"handleScriptException",
"(",
"ScriptWrapper",
"script",
",",
"Exception",
"exception",
")",
"{",
"handleScriptException",
"(",
"script",
",",
"getWriters",
"(",
"script",
")",
",",
"exception",
")",
";",
"}"
] | Handles exceptions thrown by scripts.
<p>
The given {@code exception} (if of type {@code ScriptException} the cause will be used instead) will be written to the
the writer(s) associated with the given {@code script}, moreover it will be disabled and flagged that has an error.
@param script the script that resulted in an exception, must not be {@code null}
@param exception the exception thrown , must not be {@code null}
@since 2.5.0
@see #setEnabled(ScriptWrapper, boolean)
@see #setError(ScriptWrapper, Exception)
@see #handleFailedScriptInterface(ScriptWrapper, String)
@see ScriptException | [
"Handles",
"exceptions",
"thrown",
"by",
"scripts",
".",
"<p",
">",
"The",
"given",
"{",
"@code",
"exception",
"}",
"(",
"if",
"of",
"type",
"{",
"@code",
"ScriptException",
"}",
"the",
"cause",
"will",
"be",
"used",
"instead",
")",
"will",
"be",
"written",
"to",
"the",
"the",
"writer",
"(",
"s",
")",
"associated",
"with",
"the",
"given",
"{",
"@code",
"script",
"}",
"moreover",
"it",
"will",
"be",
"disabled",
"and",
"flagged",
"that",
"has",
"an",
"error",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ExtensionScript.java#L1346-L1348 |
qubole/qds-sdk-java | src/main/java/com/qubole/qds/sdk/java/client/ResultLatch.java | ResultLatch.setPollSleep | public void setPollSleep(long time, TimeUnit unit) {
"""
Change the time that the query status is polled. The default
is {@link #DEFAULT_POLL_MS}.
@param time polling time
@param unit time unit
"""
if (unit.toMillis(time) < MIN_POLL_MS)
{
LOG.warning(String.format("Poll interval cannot be less than %d seconds. Setting it to %d seconds.", TimeUnit.MILLISECONDS.toSeconds(MIN_POLL_MS), TimeUnit.MILLISECONDS.toSeconds(MIN_POLL_MS)));
pollMs.set(MIN_POLL_MS);
}
else
{
pollMs.set(unit.toMillis(time));
}
} | java | public void setPollSleep(long time, TimeUnit unit)
{
if (unit.toMillis(time) < MIN_POLL_MS)
{
LOG.warning(String.format("Poll interval cannot be less than %d seconds. Setting it to %d seconds.", TimeUnit.MILLISECONDS.toSeconds(MIN_POLL_MS), TimeUnit.MILLISECONDS.toSeconds(MIN_POLL_MS)));
pollMs.set(MIN_POLL_MS);
}
else
{
pollMs.set(unit.toMillis(time));
}
} | [
"public",
"void",
"setPollSleep",
"(",
"long",
"time",
",",
"TimeUnit",
"unit",
")",
"{",
"if",
"(",
"unit",
".",
"toMillis",
"(",
"time",
")",
"<",
"MIN_POLL_MS",
")",
"{",
"LOG",
".",
"warning",
"(",
"String",
".",
"format",
"(",
"\"Poll interval cannot be less than %d seconds. Setting it to %d seconds.\"",
",",
"TimeUnit",
".",
"MILLISECONDS",
".",
"toSeconds",
"(",
"MIN_POLL_MS",
")",
",",
"TimeUnit",
".",
"MILLISECONDS",
".",
"toSeconds",
"(",
"MIN_POLL_MS",
")",
")",
")",
";",
"pollMs",
".",
"set",
"(",
"MIN_POLL_MS",
")",
";",
"}",
"else",
"{",
"pollMs",
".",
"set",
"(",
"unit",
".",
"toMillis",
"(",
"time",
")",
")",
";",
"}",
"}"
] | Change the time that the query status is polled. The default
is {@link #DEFAULT_POLL_MS}.
@param time polling time
@param unit time unit | [
"Change",
"the",
"time",
"that",
"the",
"query",
"status",
"is",
"polled",
".",
"The",
"default",
"is",
"{",
"@link",
"#DEFAULT_POLL_MS",
"}",
"."
] | train | https://github.com/qubole/qds-sdk-java/blob/c652374075c7b72071f73db960f5f3a43f922afd/src/main/java/com/qubole/qds/sdk/java/client/ResultLatch.java#L75-L86 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/AtomSymbol.java | AtomSymbol.addAnnotation | AtomSymbol addAnnotation(TextOutline annotation) {
"""
Include a new annotation adjunct in the atom symbol.
@param annotation the new annotation adjunct
@return a new AtomSymbol instance including the annotation adjunct
"""
List<TextOutline> newAnnotations = new ArrayList<TextOutline>(annotationAdjuncts);
newAnnotations.add(annotation);
return new AtomSymbol(element, adjuncts, newAnnotations, alignment, hull);
} | java | AtomSymbol addAnnotation(TextOutline annotation) {
List<TextOutline> newAnnotations = new ArrayList<TextOutline>(annotationAdjuncts);
newAnnotations.add(annotation);
return new AtomSymbol(element, adjuncts, newAnnotations, alignment, hull);
} | [
"AtomSymbol",
"addAnnotation",
"(",
"TextOutline",
"annotation",
")",
"{",
"List",
"<",
"TextOutline",
">",
"newAnnotations",
"=",
"new",
"ArrayList",
"<",
"TextOutline",
">",
"(",
"annotationAdjuncts",
")",
";",
"newAnnotations",
".",
"add",
"(",
"annotation",
")",
";",
"return",
"new",
"AtomSymbol",
"(",
"element",
",",
"adjuncts",
",",
"newAnnotations",
",",
"alignment",
",",
"hull",
")",
";",
"}"
] | Include a new annotation adjunct in the atom symbol.
@param annotation the new annotation adjunct
@return a new AtomSymbol instance including the annotation adjunct | [
"Include",
"a",
"new",
"annotation",
"adjunct",
"in",
"the",
"atom",
"symbol",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/AtomSymbol.java#L127-L131 |
agaricusb/SpecialSourceMP | src/main/java/net/md_5/specialsource/mavenplugin/InstallRemappedFileMojo.java | InstallRemappedFileMojo.installChecksums | protected void installChecksums( Artifact artifact, Collection metadataFiles )
throws MojoExecutionException {
"""
Installs the checksums for the specified artifact if this has been enabled in the plugin configuration. This
method creates checksums for files that have already been installed to the local repo to account for on-the-fly
generated/updated files. For example, in Maven 2.0.4- the <code>ProjectArtifactMetadata</code> did not install
the original POM file (cf. MNG-2820). While the plugin currently requires Maven 2.0.6, we continue to hash the
installed POM for robustness with regard to future changes like re-introducing some kind of POM filtering.
@param artifact The artifact for which to create checksums, must not be <code>null</code>.
@param metadataFiles The set where additional metadata files will be registered for later checksum installation,
must not be <code>null</code>.
@throws MojoExecutionException If the checksums could not be installed.
"""
if ( !createChecksum )
{
return;
}
File artifactFile = getLocalRepoFile( artifact );
installChecksums( artifactFile );
Collection metadatas = artifact.getMetadataList();
if ( metadatas != null )
{
for ( Iterator it = metadatas.iterator(); it.hasNext(); )
{
ArtifactMetadata metadata = (ArtifactMetadata) it.next();
File metadataFile = getLocalRepoFile( metadata );
metadataFiles.add( metadataFile );
}
}
} | java | protected void installChecksums( Artifact artifact, Collection metadataFiles )
throws MojoExecutionException
{
if ( !createChecksum )
{
return;
}
File artifactFile = getLocalRepoFile( artifact );
installChecksums( artifactFile );
Collection metadatas = artifact.getMetadataList();
if ( metadatas != null )
{
for ( Iterator it = metadatas.iterator(); it.hasNext(); )
{
ArtifactMetadata metadata = (ArtifactMetadata) it.next();
File metadataFile = getLocalRepoFile( metadata );
metadataFiles.add( metadataFile );
}
}
} | [
"protected",
"void",
"installChecksums",
"(",
"Artifact",
"artifact",
",",
"Collection",
"metadataFiles",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"!",
"createChecksum",
")",
"{",
"return",
";",
"}",
"File",
"artifactFile",
"=",
"getLocalRepoFile",
"(",
"artifact",
")",
";",
"installChecksums",
"(",
"artifactFile",
")",
";",
"Collection",
"metadatas",
"=",
"artifact",
".",
"getMetadataList",
"(",
")",
";",
"if",
"(",
"metadatas",
"!=",
"null",
")",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"metadatas",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"ArtifactMetadata",
"metadata",
"=",
"(",
"ArtifactMetadata",
")",
"it",
".",
"next",
"(",
")",
";",
"File",
"metadataFile",
"=",
"getLocalRepoFile",
"(",
"metadata",
")",
";",
"metadataFiles",
".",
"add",
"(",
"metadataFile",
")",
";",
"}",
"}",
"}"
] | Installs the checksums for the specified artifact if this has been enabled in the plugin configuration. This
method creates checksums for files that have already been installed to the local repo to account for on-the-fly
generated/updated files. For example, in Maven 2.0.4- the <code>ProjectArtifactMetadata</code> did not install
the original POM file (cf. MNG-2820). While the plugin currently requires Maven 2.0.6, we continue to hash the
installed POM for robustness with regard to future changes like re-introducing some kind of POM filtering.
@param artifact The artifact for which to create checksums, must not be <code>null</code>.
@param metadataFiles The set where additional metadata files will be registered for later checksum installation,
must not be <code>null</code>.
@throws MojoExecutionException If the checksums could not be installed. | [
"Installs",
"the",
"checksums",
"for",
"the",
"specified",
"artifact",
"if",
"this",
"has",
"been",
"enabled",
"in",
"the",
"plugin",
"configuration",
".",
"This",
"method",
"creates",
"checksums",
"for",
"files",
"that",
"have",
"already",
"been",
"installed",
"to",
"the",
"local",
"repo",
"to",
"account",
"for",
"on",
"-",
"the",
"-",
"fly",
"generated",
"/",
"updated",
"files",
".",
"For",
"example",
"in",
"Maven",
"2",
".",
"0",
".",
"4",
"-",
"the",
"<code",
">",
"ProjectArtifactMetadata<",
"/",
"code",
">",
"did",
"not",
"install",
"the",
"original",
"POM",
"file",
"(",
"cf",
".",
"MNG",
"-",
"2820",
")",
".",
"While",
"the",
"plugin",
"currently",
"requires",
"Maven",
"2",
".",
"0",
".",
"6",
"we",
"continue",
"to",
"hash",
"the",
"installed",
"POM",
"for",
"robustness",
"with",
"regard",
"to",
"future",
"changes",
"like",
"re",
"-",
"introducing",
"some",
"kind",
"of",
"POM",
"filtering",
"."
] | train | https://github.com/agaricusb/SpecialSourceMP/blob/350daa04831fb93a51a57a30009c572ade0a88bf/src/main/java/net/md_5/specialsource/mavenplugin/InstallRemappedFileMojo.java#L510-L531 |
nwillc/almost-functional | src/main/java/almost/functional/utils/Compose.java | Compose.andThen | public static <F, S, R, V> BiFunction<F, S, V> andThen(final BiFunction<F, S, R> first, final Function<? super R, ? extends V> second) {
"""
Compose a BiFunction which applies a Function to the result of another BiFunction.
@param first a Bifunction
@param second a Function
@param <F> first argument of BiFunction
@param <S> second argument to Bifunction
@param <R> result type of first BiFunction
@param <V> result type of resultant BiFunction
@return A new BiFunction
"""
return new BiFunction<F, S, V>() {
@Override
public V apply(F f, S s) {
return second.apply(first.apply(f, s));
}
};
} | java | public static <F, S, R, V> BiFunction<F, S, V> andThen(final BiFunction<F, S, R> first, final Function<? super R, ? extends V> second) {
return new BiFunction<F, S, V>() {
@Override
public V apply(F f, S s) {
return second.apply(first.apply(f, s));
}
};
} | [
"public",
"static",
"<",
"F",
",",
"S",
",",
"R",
",",
"V",
">",
"BiFunction",
"<",
"F",
",",
"S",
",",
"V",
">",
"andThen",
"(",
"final",
"BiFunction",
"<",
"F",
",",
"S",
",",
"R",
">",
"first",
",",
"final",
"Function",
"<",
"?",
"super",
"R",
",",
"?",
"extends",
"V",
">",
"second",
")",
"{",
"return",
"new",
"BiFunction",
"<",
"F",
",",
"S",
",",
"V",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"V",
"apply",
"(",
"F",
"f",
",",
"S",
"s",
")",
"{",
"return",
"second",
".",
"apply",
"(",
"first",
".",
"apply",
"(",
"f",
",",
"s",
")",
")",
";",
"}",
"}",
";",
"}"
] | Compose a BiFunction which applies a Function to the result of another BiFunction.
@param first a Bifunction
@param second a Function
@param <F> first argument of BiFunction
@param <S> second argument to Bifunction
@param <R> result type of first BiFunction
@param <V> result type of resultant BiFunction
@return A new BiFunction | [
"Compose",
"a",
"BiFunction",
"which",
"applies",
"a",
"Function",
"to",
"the",
"result",
"of",
"another",
"BiFunction",
"."
] | train | https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Compose.java#L46-L53 |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/SFRotation.java | SFRotation.setValue | public void setValue(float angle, float x, float y, float z) {
"""
x, y, z should be a unit value such that
x*x + y*y + z*z = 1;
angle is in radians
@param angle
@param x
@param y
@param z
"""
set(angle, x, y, z);
} | java | public void setValue(float angle, float x, float y, float z) {
set(angle, x, y, z);
} | [
"public",
"void",
"setValue",
"(",
"float",
"angle",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"set",
"(",
"angle",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"}"
] | x, y, z should be a unit value such that
x*x + y*y + z*z = 1;
angle is in radians
@param angle
@param x
@param y
@param z | [
"x",
"y",
"z",
"should",
"be",
"a",
"unit",
"value",
"such",
"that",
"x",
"*",
"x",
"+",
"y",
"*",
"y",
"+",
"z",
"*",
"z",
"=",
"1",
";",
"angle",
"is",
"in",
"radians"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/SFRotation.java#L80-L82 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/errors/RoboconfErrorHelpers.java | RoboconfErrorHelpers.filterErrors | public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) {
"""
Filters errors by removing those associated with specific error codes.
@param errors a non-null list of errors
@param errorCodes error codes
"""
// No error code to filter? => errorCodes is an empty array (not null)
List<ErrorCode> codesToSkip = new ArrayList<> ();
codesToSkip.addAll( Arrays.asList( errorCodes ));
Collection<RoboconfError> toRemove = new ArrayList<> ();
for( RoboconfError error : errors ) {
if( codesToSkip.contains( error.getErrorCode()))
toRemove.add( error );
}
errors.removeAll( toRemove );
} | java | public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) {
// No error code to filter? => errorCodes is an empty array (not null)
List<ErrorCode> codesToSkip = new ArrayList<> ();
codesToSkip.addAll( Arrays.asList( errorCodes ));
Collection<RoboconfError> toRemove = new ArrayList<> ();
for( RoboconfError error : errors ) {
if( codesToSkip.contains( error.getErrorCode()))
toRemove.add( error );
}
errors.removeAll( toRemove );
} | [
"public",
"static",
"void",
"filterErrors",
"(",
"Collection",
"<",
"?",
"extends",
"RoboconfError",
">",
"errors",
",",
"ErrorCode",
"...",
"errorCodes",
")",
"{",
"// No error code to filter? => errorCodes is an empty array (not null)",
"List",
"<",
"ErrorCode",
">",
"codesToSkip",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"codesToSkip",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"errorCodes",
")",
")",
";",
"Collection",
"<",
"RoboconfError",
">",
"toRemove",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"RoboconfError",
"error",
":",
"errors",
")",
"{",
"if",
"(",
"codesToSkip",
".",
"contains",
"(",
"error",
".",
"getErrorCode",
"(",
")",
")",
")",
"toRemove",
".",
"add",
"(",
"error",
")",
";",
"}",
"errors",
".",
"removeAll",
"(",
"toRemove",
")",
";",
"}"
] | Filters errors by removing those associated with specific error codes.
@param errors a non-null list of errors
@param errorCodes error codes | [
"Filters",
"errors",
"by",
"removing",
"those",
"associated",
"with",
"specific",
"error",
"codes",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/errors/RoboconfErrorHelpers.java#L171-L184 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/Ser.java | Ser.writeEpochSec | static void writeEpochSec(long epochSec, DataOutput out) throws IOException {
"""
Writes the state to the stream.
@param epochSec the epoch seconds, not null
@param out the output stream, not null
@throws IOException if an error occurs
"""
if (epochSec >= -4575744000L && epochSec < 10413792000L && epochSec % 900 == 0) { // quarter hours between 1825 and 2300
int store = (int) ((epochSec + 4575744000L) / 900);
out.writeByte((store >>> 16) & 255);
out.writeByte((store >>> 8) & 255);
out.writeByte(store & 255);
} else {
out.writeByte(255);
out.writeLong(epochSec);
}
} | java | static void writeEpochSec(long epochSec, DataOutput out) throws IOException {
if (epochSec >= -4575744000L && epochSec < 10413792000L && epochSec % 900 == 0) { // quarter hours between 1825 and 2300
int store = (int) ((epochSec + 4575744000L) / 900);
out.writeByte((store >>> 16) & 255);
out.writeByte((store >>> 8) & 255);
out.writeByte(store & 255);
} else {
out.writeByte(255);
out.writeLong(epochSec);
}
} | [
"static",
"void",
"writeEpochSec",
"(",
"long",
"epochSec",
",",
"DataOutput",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"epochSec",
">=",
"-",
"4575744000L",
"&&",
"epochSec",
"<",
"10413792000L",
"&&",
"epochSec",
"%",
"900",
"==",
"0",
")",
"{",
"// quarter hours between 1825 and 2300",
"int",
"store",
"=",
"(",
"int",
")",
"(",
"(",
"epochSec",
"+",
"4575744000L",
")",
"/",
"900",
")",
";",
"out",
".",
"writeByte",
"(",
"(",
"store",
">>>",
"16",
")",
"&",
"255",
")",
";",
"out",
".",
"writeByte",
"(",
"(",
"store",
">>>",
"8",
")",
"&",
"255",
")",
";",
"out",
".",
"writeByte",
"(",
"store",
"&",
"255",
")",
";",
"}",
"else",
"{",
"out",
".",
"writeByte",
"(",
"255",
")",
";",
"out",
".",
"writeLong",
"(",
"epochSec",
")",
";",
"}",
"}"
] | Writes the state to the stream.
@param epochSec the epoch seconds, not null
@param out the output stream, not null
@throws IOException if an error occurs | [
"Writes",
"the",
"state",
"to",
"the",
"stream",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/Ser.java#L250-L260 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java | HexUtil.appendHexString | static public void appendHexString(StringBuilder buffer, short value) {
"""
Appends 4 characters to a StringBuilder with the short in a "Big Endian"
hexidecimal format. For example, a short 0x1234 will be appended as a
String in format "1234". A short of value 0 will be appended as "0000".
@param buffer The StringBuilder the short value in hexidecimal format
will be appended to. If the buffer is null, this method will throw
a NullPointerException.
@param value The short value that will be converted to a hexidecimal String.
"""
assertNotNull(buffer);
int nibble = (value & 0xF000) >>> 12;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0F00) >>> 8;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x00F0) >>> 4;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x000F);
buffer.append(HEX_TABLE[nibble]);
} | java | static public void appendHexString(StringBuilder buffer, short value) {
assertNotNull(buffer);
int nibble = (value & 0xF000) >>> 12;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x0F00) >>> 8;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x00F0) >>> 4;
buffer.append(HEX_TABLE[nibble]);
nibble = (value & 0x000F);
buffer.append(HEX_TABLE[nibble]);
} | [
"static",
"public",
"void",
"appendHexString",
"(",
"StringBuilder",
"buffer",
",",
"short",
"value",
")",
"{",
"assertNotNull",
"(",
"buffer",
")",
";",
"int",
"nibble",
"=",
"(",
"value",
"&",
"0xF000",
")",
">>>",
"12",
";",
"buffer",
".",
"append",
"(",
"HEX_TABLE",
"[",
"nibble",
"]",
")",
";",
"nibble",
"=",
"(",
"value",
"&",
"0x0F00",
")",
">>>",
"8",
";",
"buffer",
".",
"append",
"(",
"HEX_TABLE",
"[",
"nibble",
"]",
")",
";",
"nibble",
"=",
"(",
"value",
"&",
"0x00F0",
")",
">>>",
"4",
";",
"buffer",
".",
"append",
"(",
"HEX_TABLE",
"[",
"nibble",
"]",
")",
";",
"nibble",
"=",
"(",
"value",
"&",
"0x000F",
")",
";",
"buffer",
".",
"append",
"(",
"HEX_TABLE",
"[",
"nibble",
"]",
")",
";",
"}"
] | Appends 4 characters to a StringBuilder with the short in a "Big Endian"
hexidecimal format. For example, a short 0x1234 will be appended as a
String in format "1234". A short of value 0 will be appended as "0000".
@param buffer The StringBuilder the short value in hexidecimal format
will be appended to. If the buffer is null, this method will throw
a NullPointerException.
@param value The short value that will be converted to a hexidecimal String. | [
"Appends",
"4",
"characters",
"to",
"a",
"StringBuilder",
"with",
"the",
"short",
"in",
"a",
"Big",
"Endian",
"hexidecimal",
"format",
".",
"For",
"example",
"a",
"short",
"0x1234",
"will",
"be",
"appended",
"as",
"a",
"String",
"in",
"format",
"1234",
".",
"A",
"short",
"of",
"value",
"0",
"will",
"be",
"appended",
"as",
"0000",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L173-L183 |
shinesolutions/swagger-aem | java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CustomApi.java | CustomApi.postConfigAemHealthCheckServletAsync | public com.squareup.okhttp.Call postConfigAemHealthCheckServletAsync(String runmode, List<String> bundlesIgnored, String bundlesIgnoredTypeHint, final ApiCallback<Void> callback) throws ApiException {
"""
(asynchronously)
@param runmode (required)
@param bundlesIgnored (optional)
@param bundlesIgnoredTypeHint (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object
"""
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = postConfigAemHealthCheckServletValidateBeforeCall(runmode, bundlesIgnored, bundlesIgnoredTypeHint, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
} | java | public com.squareup.okhttp.Call postConfigAemHealthCheckServletAsync(String runmode, List<String> bundlesIgnored, String bundlesIgnoredTypeHint, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = postConfigAemHealthCheckServletValidateBeforeCall(runmode, bundlesIgnored, bundlesIgnoredTypeHint, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"postConfigAemHealthCheckServletAsync",
"(",
"String",
"runmode",
",",
"List",
"<",
"String",
">",
"bundlesIgnored",
",",
"String",
"bundlesIgnoredTypeHint",
",",
"final",
"ApiCallback",
"<",
"Void",
">",
"callback",
")",
"throws",
"ApiException",
"{",
"ProgressResponseBody",
".",
"ProgressListener",
"progressListener",
"=",
"null",
";",
"ProgressRequestBody",
".",
"ProgressRequestListener",
"progressRequestListener",
"=",
"null",
";",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"progressListener",
"=",
"new",
"ProgressResponseBody",
".",
"ProgressListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"update",
"(",
"long",
"bytesRead",
",",
"long",
"contentLength",
",",
"boolean",
"done",
")",
"{",
"callback",
".",
"onDownloadProgress",
"(",
"bytesRead",
",",
"contentLength",
",",
"done",
")",
";",
"}",
"}",
";",
"progressRequestListener",
"=",
"new",
"ProgressRequestBody",
".",
"ProgressRequestListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onRequestProgress",
"(",
"long",
"bytesWritten",
",",
"long",
"contentLength",
",",
"boolean",
"done",
")",
"{",
"callback",
".",
"onUploadProgress",
"(",
"bytesWritten",
",",
"contentLength",
",",
"done",
")",
";",
"}",
"}",
";",
"}",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"postConfigAemHealthCheckServletValidateBeforeCall",
"(",
"runmode",
",",
"bundlesIgnored",
",",
"bundlesIgnoredTypeHint",
",",
"progressListener",
",",
"progressRequestListener",
")",
";",
"apiClient",
".",
"executeAsync",
"(",
"call",
",",
"callback",
")",
";",
"return",
"call",
";",
"}"
] | (asynchronously)
@param runmode (required)
@param bundlesIgnored (optional)
@param bundlesIgnoredTypeHint (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"(",
"asynchronously",
")"
] | train | https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CustomApi.java#L295-L319 |
gwtplus/google-gin | src/main/java/com/google/gwt/inject/rebind/reflect/ReflectUtil.java | ReflectUtil.getClassPackageNames | private static void getClassPackageNames(Class<?> clazz, Map<String, Class<?>> packageNames) {
"""
Visits classes to collect package names.
@see {@link #getTypePackageNames}.
"""
if (isPrivate(clazz)) {
throw new IllegalArgumentException(PrettyPrinter.format(
"Unable to inject an instance of %s because it is a private class.", clazz));
} else if (!isPublic(clazz)) {
packageNames.put(clazz.getPackage().getName(), clazz);
}
Class<?> enclosingClass = clazz.getEnclosingClass();
if (enclosingClass != null) {
getClassPackageNames(enclosingClass, packageNames);
}
} | java | private static void getClassPackageNames(Class<?> clazz, Map<String, Class<?>> packageNames) {
if (isPrivate(clazz)) {
throw new IllegalArgumentException(PrettyPrinter.format(
"Unable to inject an instance of %s because it is a private class.", clazz));
} else if (!isPublic(clazz)) {
packageNames.put(clazz.getPackage().getName(), clazz);
}
Class<?> enclosingClass = clazz.getEnclosingClass();
if (enclosingClass != null) {
getClassPackageNames(enclosingClass, packageNames);
}
} | [
"private",
"static",
"void",
"getClassPackageNames",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"packageNames",
")",
"{",
"if",
"(",
"isPrivate",
"(",
"clazz",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"PrettyPrinter",
".",
"format",
"(",
"\"Unable to inject an instance of %s because it is a private class.\"",
",",
"clazz",
")",
")",
";",
"}",
"else",
"if",
"(",
"!",
"isPublic",
"(",
"clazz",
")",
")",
"{",
"packageNames",
".",
"put",
"(",
"clazz",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
",",
"clazz",
")",
";",
"}",
"Class",
"<",
"?",
">",
"enclosingClass",
"=",
"clazz",
".",
"getEnclosingClass",
"(",
")",
";",
"if",
"(",
"enclosingClass",
"!=",
"null",
")",
"{",
"getClassPackageNames",
"(",
"enclosingClass",
",",
"packageNames",
")",
";",
"}",
"}"
] | Visits classes to collect package names.
@see {@link #getTypePackageNames}. | [
"Visits",
"classes",
"to",
"collect",
"package",
"names",
"."
] | train | https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/reflect/ReflectUtil.java#L235-L247 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.getConversation | public Observable<ComapiResult<ConversationDetails>> getConversation(@NonNull final String conversationId) {
"""
Returns observable to create a conversation.
@param conversationId ID of a conversation to obtain.
@return Observable to to create a conversation.
"""
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueGetConversation(conversationId);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doGetConversation(token, conversationId);
}
} | java | public Observable<ComapiResult<ConversationDetails>> getConversation(@NonNull final String conversationId) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueGetConversation(conversationId);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doGetConversation(token, conversationId);
}
} | [
"public",
"Observable",
"<",
"ComapiResult",
"<",
"ConversationDetails",
">",
">",
"getConversation",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
")",
"{",
"final",
"String",
"token",
"=",
"getToken",
"(",
")",
";",
"if",
"(",
"sessionController",
".",
"isCreatingSession",
"(",
")",
")",
"{",
"return",
"getTaskQueue",
"(",
")",
".",
"queueGetConversation",
"(",
"conversationId",
")",
";",
"}",
"else",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"token",
")",
")",
"{",
"return",
"Observable",
".",
"error",
"(",
"getSessionStateErrorDescription",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"doGetConversation",
"(",
"token",
",",
"conversationId",
")",
";",
"}",
"}"
] | Returns observable to create a conversation.
@param conversationId ID of a conversation to obtain.
@return Observable to to create a conversation. | [
"Returns",
"observable",
"to",
"create",
"a",
"conversation",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L474-L485 |
alkacon/opencms-core | src/org/opencms/i18n/CmsVfsBundleManager.java | CmsVfsBundleManager.logError | protected void logError(Exception e, boolean logToErrorChannel) {
"""
Logs an exception that occurred.<p>
@param e the exception to log
@param logToErrorChannel if true erros should be written to the error channel instead of the info channel
"""
if (logToErrorChannel) {
LOG.error(e.getLocalizedMessage(), e);
} else {
LOG.info(e.getLocalizedMessage(), e);
}
// if an error was logged make sure that the flag to schedule a reload is reset
setReloadScheduled(false);
} | java | protected void logError(Exception e, boolean logToErrorChannel) {
if (logToErrorChannel) {
LOG.error(e.getLocalizedMessage(), e);
} else {
LOG.info(e.getLocalizedMessage(), e);
}
// if an error was logged make sure that the flag to schedule a reload is reset
setReloadScheduled(false);
} | [
"protected",
"void",
"logError",
"(",
"Exception",
"e",
",",
"boolean",
"logToErrorChannel",
")",
"{",
"if",
"(",
"logToErrorChannel",
")",
"{",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"else",
"{",
"LOG",
".",
"info",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"// if an error was logged make sure that the flag to schedule a reload is reset\r",
"setReloadScheduled",
"(",
"false",
")",
";",
"}"
] | Logs an exception that occurred.<p>
@param e the exception to log
@param logToErrorChannel if true erros should be written to the error channel instead of the info channel | [
"Logs",
"an",
"exception",
"that",
"occurred",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsVfsBundleManager.java#L257-L266 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java | BigtableDataClient.readRowAsync | public ApiFuture<Row> readRowAsync(String tableId, String rowKey) {
"""
Convenience method for asynchronously reading a single row. If the row does not exist, the
future's value will be null.
<p>Sample code:
<pre>{@code
try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
String tableId = "[TABLE]";
ApiFuture<Row> futureResult = bigtableDataClient.readRowAsync(tableId, "key");
ApiFutures.addCallback(futureResult, new ApiFutureCallback<Row>() {
public void onFailure(Throwable t) {
if (t instanceof NotFoundException) {
System.out.println("Tried to read a non-existent table");
} else {
t.printStackTrace();
}
}
public void onSuccess(Row result) {
if (result != null) {
System.out.println("Got row: " + result);
}
}
}, MoreExecutors.directExecutor());
}
}</pre>
"""
return readRowAsync(tableId, ByteString.copyFromUtf8(rowKey), null);
} | java | public ApiFuture<Row> readRowAsync(String tableId, String rowKey) {
return readRowAsync(tableId, ByteString.copyFromUtf8(rowKey), null);
} | [
"public",
"ApiFuture",
"<",
"Row",
">",
"readRowAsync",
"(",
"String",
"tableId",
",",
"String",
"rowKey",
")",
"{",
"return",
"readRowAsync",
"(",
"tableId",
",",
"ByteString",
".",
"copyFromUtf8",
"(",
"rowKey",
")",
",",
"null",
")",
";",
"}"
] | Convenience method for asynchronously reading a single row. If the row does not exist, the
future's value will be null.
<p>Sample code:
<pre>{@code
try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
String tableId = "[TABLE]";
ApiFuture<Row> futureResult = bigtableDataClient.readRowAsync(tableId, "key");
ApiFutures.addCallback(futureResult, new ApiFutureCallback<Row>() {
public void onFailure(Throwable t) {
if (t instanceof NotFoundException) {
System.out.println("Tried to read a non-existent table");
} else {
t.printStackTrace();
}
}
public void onSuccess(Row result) {
if (result != null) {
System.out.println("Got row: " + result);
}
}
}, MoreExecutors.directExecutor());
}
}</pre> | [
"Convenience",
"method",
"for",
"asynchronously",
"reading",
"a",
"single",
"row",
".",
"If",
"the",
"row",
"does",
"not",
"exist",
"the",
"future",
"s",
"value",
"will",
"be",
"null",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L304-L306 |
sendgrid/sendgrid-java | src/main/java/com/sendgrid/helpers/mail/Mail.java | Mail.addHeader | public void addHeader(String key, String value) {
"""
Add a header to the email.
@param key the header's key.
@param value the header's value.
"""
this.headers = addToMap(key, value, this.headers);
} | java | public void addHeader(String key, String value) {
this.headers = addToMap(key, value, this.headers);
} | [
"public",
"void",
"addHeader",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"headers",
"=",
"addToMap",
"(",
"key",
",",
"value",
",",
"this",
".",
"headers",
")",
";",
"}"
] | Add a header to the email.
@param key the header's key.
@param value the header's value. | [
"Add",
"a",
"header",
"to",
"the",
"email",
"."
] | train | https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/helpers/mail/Mail.java#L319-L321 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.toStr | public static String toStr(Document doc, boolean isPretty) {
"""
将XML文档转换为String<br>
字符编码使用XML文档中的编码,获取不到则使用UTF-8
@param doc XML文档
@param isPretty 是否格式化输出
@return XML字符串
@since 3.0.9
"""
return toStr(doc, CharsetUtil.UTF_8, isPretty);
} | java | public static String toStr(Document doc, boolean isPretty) {
return toStr(doc, CharsetUtil.UTF_8, isPretty);
} | [
"public",
"static",
"String",
"toStr",
"(",
"Document",
"doc",
",",
"boolean",
"isPretty",
")",
"{",
"return",
"toStr",
"(",
"doc",
",",
"CharsetUtil",
".",
"UTF_8",
",",
"isPretty",
")",
";",
"}"
] | 将XML文档转换为String<br>
字符编码使用XML文档中的编码,获取不到则使用UTF-8
@param doc XML文档
@param isPretty 是否格式化输出
@return XML字符串
@since 3.0.9 | [
"将XML文档转换为String<br",
">",
"字符编码使用XML文档中的编码,获取不到则使用UTF",
"-",
"8"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L234-L236 |
profesorfalken/jPowerShell | src/main/java/com/profesorfalken/jpowershell/PowerShell.java | PowerShell.executeScript | @SuppressWarnings("WeakerAccess")
public PowerShellResponse executeScript(String scriptPath, String params) {
"""
Executed the provided PowerShell script in PowerShell console and gets
result.
@param scriptPath the full path of the script
@param params the parameters of the script
@return response with the output of the command
"""
BufferedReader srcReader;
try {
srcReader = new BufferedReader(new FileReader(new File(scriptPath)));
} catch (FileNotFoundException fnfex) {
logger.log(Level.SEVERE,
"Unexpected error when processing PowerShell script: file not found", fnfex);
return new PowerShellResponse(true, "Wrong script path: " + scriptPath, false);
}
return executeScript(srcReader, params);
} | java | @SuppressWarnings("WeakerAccess")
public PowerShellResponse executeScript(String scriptPath, String params) {
BufferedReader srcReader;
try {
srcReader = new BufferedReader(new FileReader(new File(scriptPath)));
} catch (FileNotFoundException fnfex) {
logger.log(Level.SEVERE,
"Unexpected error when processing PowerShell script: file not found", fnfex);
return new PowerShellResponse(true, "Wrong script path: " + scriptPath, false);
}
return executeScript(srcReader, params);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"PowerShellResponse",
"executeScript",
"(",
"String",
"scriptPath",
",",
"String",
"params",
")",
"{",
"BufferedReader",
"srcReader",
";",
"try",
"{",
"srcReader",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"new",
"File",
"(",
"scriptPath",
")",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"fnfex",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Unexpected error when processing PowerShell script: file not found\"",
",",
"fnfex",
")",
";",
"return",
"new",
"PowerShellResponse",
"(",
"true",
",",
"\"Wrong script path: \"",
"+",
"scriptPath",
",",
"false",
")",
";",
"}",
"return",
"executeScript",
"(",
"srcReader",
",",
"params",
")",
";",
"}"
] | Executed the provided PowerShell script in PowerShell console and gets
result.
@param scriptPath the full path of the script
@param params the parameters of the script
@return response with the output of the command | [
"Executed",
"the",
"provided",
"PowerShell",
"script",
"in",
"PowerShell",
"console",
"and",
"gets",
"result",
"."
] | train | https://github.com/profesorfalken/jPowerShell/blob/a0fb9d3b9db12dd5635de810e6366e17b932ee10/src/main/java/com/profesorfalken/jpowershell/PowerShell.java#L298-L311 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java | DPTXlatorDateTime.setDateTimeFlag | public final void setDateTimeFlag(int field, boolean value) {
"""
Sets date/time information for the given field of the first date/time item.
<p>
Allowed fields are {@link #CLOCK_FAULT}, {@link #CLOCK_SYNC}, {@link #WORKDAY}
and {@link #DAYLIGHT}.<br>
This method does not reset other item data or discard other translation items.
@param field field number
@param value <code>true</code> to set the information flag, <code>false</code>
to clear
"""
if (field == CLOCK_SYNC) {
setBitEx(0, QUALITY, value);
return;
}
final int f = field - WORKDAY;
if (f < 0 || f >= FLAG_MASKS.length)
throw new KNXIllegalArgumentException("illegal field");
setBit(0, FLAG_MASKS[f], value);
} | java | public final void setDateTimeFlag(int field, boolean value)
{
if (field == CLOCK_SYNC) {
setBitEx(0, QUALITY, value);
return;
}
final int f = field - WORKDAY;
if (f < 0 || f >= FLAG_MASKS.length)
throw new KNXIllegalArgumentException("illegal field");
setBit(0, FLAG_MASKS[f], value);
} | [
"public",
"final",
"void",
"setDateTimeFlag",
"(",
"int",
"field",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"field",
"==",
"CLOCK_SYNC",
")",
"{",
"setBitEx",
"(",
"0",
",",
"QUALITY",
",",
"value",
")",
";",
"return",
";",
"}",
"final",
"int",
"f",
"=",
"field",
"-",
"WORKDAY",
";",
"if",
"(",
"f",
"<",
"0",
"||",
"f",
">=",
"FLAG_MASKS",
".",
"length",
")",
"throw",
"new",
"KNXIllegalArgumentException",
"(",
"\"illegal field\"",
")",
";",
"setBit",
"(",
"0",
",",
"FLAG_MASKS",
"[",
"f",
"]",
",",
"value",
")",
";",
"}"
] | Sets date/time information for the given field of the first date/time item.
<p>
Allowed fields are {@link #CLOCK_FAULT}, {@link #CLOCK_SYNC}, {@link #WORKDAY}
and {@link #DAYLIGHT}.<br>
This method does not reset other item data or discard other translation items.
@param field field number
@param value <code>true</code> to set the information flag, <code>false</code>
to clear | [
"Sets",
"date",
"/",
"time",
"information",
"for",
"the",
"given",
"field",
"of",
"the",
"first",
"date",
"/",
"time",
"item",
".",
"<p",
">",
"Allowed",
"fields",
"are",
"{",
"@link",
"#CLOCK_FAULT",
"}",
"{",
"@link",
"#CLOCK_SYNC",
"}",
"{",
"@link",
"#WORKDAY",
"}",
"and",
"{",
"@link",
"#DAYLIGHT",
"}",
".",
"<br",
">",
"This",
"method",
"does",
"not",
"reset",
"other",
"item",
"data",
"or",
"discard",
"other",
"translation",
"items",
"."
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java#L489-L499 |
demidenko05/beige-uml | beige-uml-swing/src/main/java/org/beigesoft/uml/ui/swing/PaneDiagramSwing.java | PaneDiagramSwing.setDiagramControllerAndPalettes | public void setDiagramControllerAndPalettes(IControllerDiagramUml<?, ?> controllerDiagramUml, Component palletteDiagram, Component palletteZoom) {
"""
Set current diagram maker
e.g. ClassDiagramMaker or ActivityDiagramMaker
@param controllerDiagramUml
@param palletteDiagram
"""
this.activeControllerDiagramUml = controllerDiagramUml;
if(currentPaletteDiagram != null) {
this.actionPropertiesPane.remove(currentPaletteDiagram);
}
this.actionPropertiesPane.add(palletteDiagram, BorderLayout.CENTER);
currentPaletteDiagram = palletteDiagram;
if(!isZoomPalletteAdded) {
this.actionPropertiesPane.add(palletteZoom, BorderLayout.SOUTH);
isZoomPalletteAdded = true;
}
} | java | public void setDiagramControllerAndPalettes(IControllerDiagramUml<?, ?> controllerDiagramUml, Component palletteDiagram, Component palletteZoom) {
this.activeControllerDiagramUml = controllerDiagramUml;
if(currentPaletteDiagram != null) {
this.actionPropertiesPane.remove(currentPaletteDiagram);
}
this.actionPropertiesPane.add(palletteDiagram, BorderLayout.CENTER);
currentPaletteDiagram = palletteDiagram;
if(!isZoomPalletteAdded) {
this.actionPropertiesPane.add(palletteZoom, BorderLayout.SOUTH);
isZoomPalletteAdded = true;
}
} | [
"public",
"void",
"setDiagramControllerAndPalettes",
"(",
"IControllerDiagramUml",
"<",
"?",
",",
"?",
">",
"controllerDiagramUml",
",",
"Component",
"palletteDiagram",
",",
"Component",
"palletteZoom",
")",
"{",
"this",
".",
"activeControllerDiagramUml",
"=",
"controllerDiagramUml",
";",
"if",
"(",
"currentPaletteDiagram",
"!=",
"null",
")",
"{",
"this",
".",
"actionPropertiesPane",
".",
"remove",
"(",
"currentPaletteDiagram",
")",
";",
"}",
"this",
".",
"actionPropertiesPane",
".",
"add",
"(",
"palletteDiagram",
",",
"BorderLayout",
".",
"CENTER",
")",
";",
"currentPaletteDiagram",
"=",
"palletteDiagram",
";",
"if",
"(",
"!",
"isZoomPalletteAdded",
")",
"{",
"this",
".",
"actionPropertiesPane",
".",
"add",
"(",
"palletteZoom",
",",
"BorderLayout",
".",
"SOUTH",
")",
";",
"isZoomPalletteAdded",
"=",
"true",
";",
"}",
"}"
] | Set current diagram maker
e.g. ClassDiagramMaker or ActivityDiagramMaker
@param controllerDiagramUml
@param palletteDiagram | [
"Set",
"current",
"diagram",
"maker",
"e",
".",
"g",
".",
"ClassDiagramMaker",
"or",
"ActivityDiagramMaker"
] | train | https://github.com/demidenko05/beige-uml/blob/65f6024fa944e10875d9a3be3e4a586bede39683/beige-uml-swing/src/main/java/org/beigesoft/uml/ui/swing/PaneDiagramSwing.java#L58-L69 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.sendDTMF | public void sendDTMF(
String connId,
String digits,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
"""
Send DTMF digits to the specified call. You can send DTMF digits individually with multiple requests or together with multiple digits in one request.
@param connId The connection ID of the call.
@param digits The DTMF digits to send to the call.
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
"""
try {
VoicecallsidsenddtmfData dtmfData = new VoicecallsidsenddtmfData();
dtmfData.setDtmfDigits(digits);
dtmfData.setReasons(Util.toKVList(reasons));
dtmfData.setExtensions(Util.toKVList(extensions));
SendDTMFData data = new SendDTMFData();
data.data(dtmfData);
ApiSuccessResponse response = this.voiceApi.sendDTMF(connId, data);
throwIfNotOk("sendDTMF", response);
} catch (ApiException e) {
throw new WorkspaceApiException("sendDTMF failed", e);
}
} | java | public void sendDTMF(
String connId,
String digits,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidsenddtmfData dtmfData = new VoicecallsidsenddtmfData();
dtmfData.setDtmfDigits(digits);
dtmfData.setReasons(Util.toKVList(reasons));
dtmfData.setExtensions(Util.toKVList(extensions));
SendDTMFData data = new SendDTMFData();
data.data(dtmfData);
ApiSuccessResponse response = this.voiceApi.sendDTMF(connId, data);
throwIfNotOk("sendDTMF", response);
} catch (ApiException e) {
throw new WorkspaceApiException("sendDTMF failed", e);
}
} | [
"public",
"void",
"sendDTMF",
"(",
"String",
"connId",
",",
"String",
"digits",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsidsenddtmfData",
"dtmfData",
"=",
"new",
"VoicecallsidsenddtmfData",
"(",
")",
";",
"dtmfData",
".",
"setDtmfDigits",
"(",
"digits",
")",
";",
"dtmfData",
".",
"setReasons",
"(",
"Util",
".",
"toKVList",
"(",
"reasons",
")",
")",
";",
"dtmfData",
".",
"setExtensions",
"(",
"Util",
".",
"toKVList",
"(",
"extensions",
")",
")",
";",
"SendDTMFData",
"data",
"=",
"new",
"SendDTMFData",
"(",
")",
";",
"data",
".",
"data",
"(",
"dtmfData",
")",
";",
"ApiSuccessResponse",
"response",
"=",
"this",
".",
"voiceApi",
".",
"sendDTMF",
"(",
"connId",
",",
"data",
")",
";",
"throwIfNotOk",
"(",
"\"sendDTMF\"",
",",
"response",
")",
";",
"}",
"catch",
"(",
"ApiException",
"e",
")",
"{",
"throw",
"new",
"WorkspaceApiException",
"(",
"\"sendDTMF failed\"",
",",
"e",
")",
";",
"}",
"}"
] | Send DTMF digits to the specified call. You can send DTMF digits individually with multiple requests or together with multiple digits in one request.
@param connId The connection ID of the call.
@param digits The DTMF digits to send to the call.
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Send",
"DTMF",
"digits",
"to",
"the",
"specified",
"call",
".",
"You",
"can",
"send",
"DTMF",
"digits",
"individually",
"with",
"multiple",
"requests",
"or",
"together",
"with",
"multiple",
"digits",
"in",
"one",
"request",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1135-L1154 |
cattaka/CatHandsGendroid | cathandsgendroid-apt/src/main/java/net/cattaka/util/cathandsgendroid/apt/Bug300408.java | Bug300408.getEnclosedElementsDeclarationOrder | public static List<? extends Element> getEnclosedElementsDeclarationOrder(TypeElement type) {
"""
If given TypeElement is SourceTypeBinding, the order of results are corrected.
@param type target
@return the enclosed elements, or an empty list if none
"""
List<? extends Element> result = null;
try {
Object binding = field(type, "_binding");
Class<?> sourceTypeBinding = null;
{
Class<?> c = binding.getClass();
do {
if (c.getCanonicalName().equals(
"org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding")) {
sourceTypeBinding = c;
break;
}
} while ((c = c.getSuperclass()) != null);
}
final List<Object> declarationOrder;
if (sourceTypeBinding != null) {
declarationOrder = findSourceOrder(binding);
List<Element> enclosedElements = new ArrayList<Element>(type.getEnclosedElements());
Collections.sort(enclosedElements, new Comparator<Element>() {
public int compare(Element o1, Element o2) {
try {
Object o1Binding = field(o1, "_binding");
Object o2Binding = field(o2, "_binding");
int i1 = declarationOrder.indexOf(o1Binding);
int i2 = declarationOrder.indexOf(o2Binding);
return i1 - i2;
} catch (Exception e) {
return 0;
}
}
});
result = enclosedElements;
}
} catch (Exception e) {
// ignore
}
return (result != null) ? result : type.getEnclosedElements();
} | java | public static List<? extends Element> getEnclosedElementsDeclarationOrder(TypeElement type) {
List<? extends Element> result = null;
try {
Object binding = field(type, "_binding");
Class<?> sourceTypeBinding = null;
{
Class<?> c = binding.getClass();
do {
if (c.getCanonicalName().equals(
"org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding")) {
sourceTypeBinding = c;
break;
}
} while ((c = c.getSuperclass()) != null);
}
final List<Object> declarationOrder;
if (sourceTypeBinding != null) {
declarationOrder = findSourceOrder(binding);
List<Element> enclosedElements = new ArrayList<Element>(type.getEnclosedElements());
Collections.sort(enclosedElements, new Comparator<Element>() {
public int compare(Element o1, Element o2) {
try {
Object o1Binding = field(o1, "_binding");
Object o2Binding = field(o2, "_binding");
int i1 = declarationOrder.indexOf(o1Binding);
int i2 = declarationOrder.indexOf(o2Binding);
return i1 - i2;
} catch (Exception e) {
return 0;
}
}
});
result = enclosedElements;
}
} catch (Exception e) {
// ignore
}
return (result != null) ? result : type.getEnclosedElements();
} | [
"public",
"static",
"List",
"<",
"?",
"extends",
"Element",
">",
"getEnclosedElementsDeclarationOrder",
"(",
"TypeElement",
"type",
")",
"{",
"List",
"<",
"?",
"extends",
"Element",
">",
"result",
"=",
"null",
";",
"try",
"{",
"Object",
"binding",
"=",
"field",
"(",
"type",
",",
"\"_binding\"",
")",
";",
"Class",
"<",
"?",
">",
"sourceTypeBinding",
"=",
"null",
";",
"{",
"Class",
"<",
"?",
">",
"c",
"=",
"binding",
".",
"getClass",
"(",
")",
";",
"do",
"{",
"if",
"(",
"c",
".",
"getCanonicalName",
"(",
")",
".",
"equals",
"(",
"\"org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding\"",
")",
")",
"{",
"sourceTypeBinding",
"=",
"c",
";",
"break",
";",
"}",
"}",
"while",
"(",
"(",
"c",
"=",
"c",
".",
"getSuperclass",
"(",
")",
")",
"!=",
"null",
")",
";",
"}",
"final",
"List",
"<",
"Object",
">",
"declarationOrder",
";",
"if",
"(",
"sourceTypeBinding",
"!=",
"null",
")",
"{",
"declarationOrder",
"=",
"findSourceOrder",
"(",
"binding",
")",
";",
"List",
"<",
"Element",
">",
"enclosedElements",
"=",
"new",
"ArrayList",
"<",
"Element",
">",
"(",
"type",
".",
"getEnclosedElements",
"(",
")",
")",
";",
"Collections",
".",
"sort",
"(",
"enclosedElements",
",",
"new",
"Comparator",
"<",
"Element",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"Element",
"o1",
",",
"Element",
"o2",
")",
"{",
"try",
"{",
"Object",
"o1Binding",
"=",
"field",
"(",
"o1",
",",
"\"_binding\"",
")",
";",
"Object",
"o2Binding",
"=",
"field",
"(",
"o2",
",",
"\"_binding\"",
")",
";",
"int",
"i1",
"=",
"declarationOrder",
".",
"indexOf",
"(",
"o1Binding",
")",
";",
"int",
"i2",
"=",
"declarationOrder",
".",
"indexOf",
"(",
"o2Binding",
")",
";",
"return",
"i1",
"-",
"i2",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"0",
";",
"}",
"}",
"}",
")",
";",
"result",
"=",
"enclosedElements",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// ignore",
"}",
"return",
"(",
"result",
"!=",
"null",
")",
"?",
"result",
":",
"type",
".",
"getEnclosedElements",
"(",
")",
";",
"}"
] | If given TypeElement is SourceTypeBinding, the order of results are corrected.
@param type target
@return the enclosed elements, or an empty list if none | [
"If",
"given",
"TypeElement",
"is",
"SourceTypeBinding",
"the",
"order",
"of",
"results",
"are",
"corrected",
"."
] | train | https://github.com/cattaka/CatHandsGendroid/blob/6e496cc5901e0e1be2142c69cab898f61974db4d/cathandsgendroid-apt/src/main/java/net/cattaka/util/cathandsgendroid/apt/Bug300408.java#L28-L73 |
groovy/groovy-core | subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java | Groovy.runStatements | protected void runStatements(Reader reader, PrintStream out)
throws IOException {
"""
Read in lines and execute them.
@param reader the reader from which to get the groovy source to exec
@param out the outputstream to use
@throws java.io.IOException if something goes wrong
"""
log.debug("runStatements()");
StringBuilder txt = new StringBuilder();
String line = "";
BufferedReader in = new BufferedReader(reader);
while ((line = in.readLine()) != null) {
line = getProject().replaceProperties(line);
if (line.indexOf("--") >= 0) {
txt.append("\n");
}
}
// Catch any statements not followed by ;
if (!txt.toString().equals("")) {
execGroovy(txt.toString(), out);
}
} | java | protected void runStatements(Reader reader, PrintStream out)
throws IOException {
log.debug("runStatements()");
StringBuilder txt = new StringBuilder();
String line = "";
BufferedReader in = new BufferedReader(reader);
while ((line = in.readLine()) != null) {
line = getProject().replaceProperties(line);
if (line.indexOf("--") >= 0) {
txt.append("\n");
}
}
// Catch any statements not followed by ;
if (!txt.toString().equals("")) {
execGroovy(txt.toString(), out);
}
} | [
"protected",
"void",
"runStatements",
"(",
"Reader",
"reader",
",",
"PrintStream",
"out",
")",
"throws",
"IOException",
"{",
"log",
".",
"debug",
"(",
"\"runStatements()\"",
")",
";",
"StringBuilder",
"txt",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"line",
"=",
"\"\"",
";",
"BufferedReader",
"in",
"=",
"new",
"BufferedReader",
"(",
"reader",
")",
";",
"while",
"(",
"(",
"line",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"line",
"=",
"getProject",
"(",
")",
".",
"replaceProperties",
"(",
"line",
")",
";",
"if",
"(",
"line",
".",
"indexOf",
"(",
"\"--\"",
")",
">=",
"0",
")",
"{",
"txt",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
"}",
"// Catch any statements not followed by ;",
"if",
"(",
"!",
"txt",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"execGroovy",
"(",
"txt",
".",
"toString",
"(",
")",
",",
"out",
")",
";",
"}",
"}"
] | Read in lines and execute them.
@param reader the reader from which to get the groovy source to exec
@param out the outputstream to use
@throws java.io.IOException if something goes wrong | [
"Read",
"in",
"lines",
"and",
"execute",
"them",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java#L354-L371 |
cloudfoundry/uaa | server/src/main/java/org/cloudfoundry/identity/uaa/oauth/UaaAuthorizationRequestManager.java | UaaAuthorizationRequestManager.validateParameters | public void validateParameters(Map<String, String> parameters, ClientDetails clientDetails) {
"""
Apply UAA rules to validate the requested scopes scope. For client credentials
grants the valid requested scopes are actually in
the authorities of the client.
"""
if (parameters.containsKey("scope")) {
Set<String> validScope = clientDetails.getScope();
if (GRANT_TYPE_CLIENT_CREDENTIALS.equals(parameters.get("grant_type"))) {
validScope = AuthorityUtils.authorityListToSet(clientDetails.getAuthorities());
}
Set<Pattern> validWildcards = constructWildcards(validScope);
Set<String> scopes = OAuth2Utils.parseParameterList(parameters.get("scope"));
for (String scope : scopes) {
if (!matches(validWildcards, scope)) {
throw new InvalidScopeException(scope + " is invalid. Please use a valid scope name in the request");
}
}
}
} | java | public void validateParameters(Map<String, String> parameters, ClientDetails clientDetails) {
if (parameters.containsKey("scope")) {
Set<String> validScope = clientDetails.getScope();
if (GRANT_TYPE_CLIENT_CREDENTIALS.equals(parameters.get("grant_type"))) {
validScope = AuthorityUtils.authorityListToSet(clientDetails.getAuthorities());
}
Set<Pattern> validWildcards = constructWildcards(validScope);
Set<String> scopes = OAuth2Utils.parseParameterList(parameters.get("scope"));
for (String scope : scopes) {
if (!matches(validWildcards, scope)) {
throw new InvalidScopeException(scope + " is invalid. Please use a valid scope name in the request");
}
}
}
} | [
"public",
"void",
"validateParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"ClientDetails",
"clientDetails",
")",
"{",
"if",
"(",
"parameters",
".",
"containsKey",
"(",
"\"scope\"",
")",
")",
"{",
"Set",
"<",
"String",
">",
"validScope",
"=",
"clientDetails",
".",
"getScope",
"(",
")",
";",
"if",
"(",
"GRANT_TYPE_CLIENT_CREDENTIALS",
".",
"equals",
"(",
"parameters",
".",
"get",
"(",
"\"grant_type\"",
")",
")",
")",
"{",
"validScope",
"=",
"AuthorityUtils",
".",
"authorityListToSet",
"(",
"clientDetails",
".",
"getAuthorities",
"(",
")",
")",
";",
"}",
"Set",
"<",
"Pattern",
">",
"validWildcards",
"=",
"constructWildcards",
"(",
"validScope",
")",
";",
"Set",
"<",
"String",
">",
"scopes",
"=",
"OAuth2Utils",
".",
"parseParameterList",
"(",
"parameters",
".",
"get",
"(",
"\"scope\"",
")",
")",
";",
"for",
"(",
"String",
"scope",
":",
"scopes",
")",
"{",
"if",
"(",
"!",
"matches",
"(",
"validWildcards",
",",
"scope",
")",
")",
"{",
"throw",
"new",
"InvalidScopeException",
"(",
"scope",
"+",
"\" is invalid. Please use a valid scope name in the request\"",
")",
";",
"}",
"}",
"}",
"}"
] | Apply UAA rules to validate the requested scopes scope. For client credentials
grants the valid requested scopes are actually in
the authorities of the client. | [
"Apply",
"UAA",
"rules",
"to",
"validate",
"the",
"requested",
"scopes",
"scope",
".",
"For",
"client",
"credentials",
"grants",
"the",
"valid",
"requested",
"scopes",
"are",
"actually",
"in",
"the",
"authorities",
"of",
"the",
"client",
"."
] | train | https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/oauth/UaaAuthorizationRequestManager.java#L205-L219 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxTrash.java | BoxTrash.deleteFile | public void deleteFile(String fileID) {
"""
Permanently deletes a trashed file.
@param fileID the ID of the trashed folder to permanently delete.
"""
URL url = FILE_INFO_URL_TEMPLATE.build(this.api.getBaseURL(), fileID);
BoxAPIRequest request = new BoxAPIRequest(this.api, url, "DELETE");
BoxAPIResponse response = request.send();
response.disconnect();
} | java | public void deleteFile(String fileID) {
URL url = FILE_INFO_URL_TEMPLATE.build(this.api.getBaseURL(), fileID);
BoxAPIRequest request = new BoxAPIRequest(this.api, url, "DELETE");
BoxAPIResponse response = request.send();
response.disconnect();
} | [
"public",
"void",
"deleteFile",
"(",
"String",
"fileID",
")",
"{",
"URL",
"url",
"=",
"FILE_INFO_URL_TEMPLATE",
".",
"build",
"(",
"this",
".",
"api",
".",
"getBaseURL",
"(",
")",
",",
"fileID",
")",
";",
"BoxAPIRequest",
"request",
"=",
"new",
"BoxAPIRequest",
"(",
"this",
".",
"api",
",",
"url",
",",
"\"DELETE\"",
")",
";",
"BoxAPIResponse",
"response",
"=",
"request",
".",
"send",
"(",
")",
";",
"response",
".",
"disconnect",
"(",
")",
";",
"}"
] | Permanently deletes a trashed file.
@param fileID the ID of the trashed folder to permanently delete. | [
"Permanently",
"deletes",
"a",
"trashed",
"file",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxTrash.java#L145-L150 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java | HBasePanel.writeHtmlString | public void writeHtmlString(String strHTML, PrintWriter out) {
"""
Parse the HTML for variables and print it.
@param strHTML the html string to output.
@param out The html out stream.
"""
int iIndex;
if (strHTML == null)
return;
while ((iIndex = strHTML.indexOf(HtmlConstants.TITLE_TAG)) != -1)
{ // ** FIX THIS to look for a <xxx/> and look up the token **
strHTML = strHTML.substring(0, iIndex) + ((BasePanel)this.getScreenField()).getTitle() + strHTML.substring(iIndex + HtmlConstants.TITLE_TAG.length());
}
out.println(strHTML);
} | java | public void writeHtmlString(String strHTML, PrintWriter out)
{
int iIndex;
if (strHTML == null)
return;
while ((iIndex = strHTML.indexOf(HtmlConstants.TITLE_TAG)) != -1)
{ // ** FIX THIS to look for a <xxx/> and look up the token **
strHTML = strHTML.substring(0, iIndex) + ((BasePanel)this.getScreenField()).getTitle() + strHTML.substring(iIndex + HtmlConstants.TITLE_TAG.length());
}
out.println(strHTML);
} | [
"public",
"void",
"writeHtmlString",
"(",
"String",
"strHTML",
",",
"PrintWriter",
"out",
")",
"{",
"int",
"iIndex",
";",
"if",
"(",
"strHTML",
"==",
"null",
")",
"return",
";",
"while",
"(",
"(",
"iIndex",
"=",
"strHTML",
".",
"indexOf",
"(",
"HtmlConstants",
".",
"TITLE_TAG",
")",
")",
"!=",
"-",
"1",
")",
"{",
"// ** FIX THIS to look for a <xxx/> and look up the token **",
"strHTML",
"=",
"strHTML",
".",
"substring",
"(",
"0",
",",
"iIndex",
")",
"+",
"(",
"(",
"BasePanel",
")",
"this",
".",
"getScreenField",
"(",
")",
")",
".",
"getTitle",
"(",
")",
"+",
"strHTML",
".",
"substring",
"(",
"iIndex",
"+",
"HtmlConstants",
".",
"TITLE_TAG",
".",
"length",
"(",
")",
")",
";",
"}",
"out",
".",
"println",
"(",
"strHTML",
")",
";",
"}"
] | Parse the HTML for variables and print it.
@param strHTML the html string to output.
@param out The html out stream. | [
"Parse",
"the",
"HTML",
"for",
"variables",
"and",
"print",
"it",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L610-L620 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/SparseMatrix.java | SparseMatrix.eachNonZeroInColumn | public void eachNonZeroInColumn(int j, VectorProcedure procedure) {
"""
Applies the given {@code procedure} to each non-zero element of the specified column of this matrix.
@param j the column index.
@param procedure the {@link VectorProcedure}.
"""
VectorIterator it = nonZeroIteratorOfColumn(j);
while (it.hasNext()) {
double x = it.next();
int i = it.index();
procedure.apply(i, x);
}
} | java | public void eachNonZeroInColumn(int j, VectorProcedure procedure) {
VectorIterator it = nonZeroIteratorOfColumn(j);
while (it.hasNext()) {
double x = it.next();
int i = it.index();
procedure.apply(i, x);
}
} | [
"public",
"void",
"eachNonZeroInColumn",
"(",
"int",
"j",
",",
"VectorProcedure",
"procedure",
")",
"{",
"VectorIterator",
"it",
"=",
"nonZeroIteratorOfColumn",
"(",
"j",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"double",
"x",
"=",
"it",
".",
"next",
"(",
")",
";",
"int",
"i",
"=",
"it",
".",
"index",
"(",
")",
";",
"procedure",
".",
"apply",
"(",
"i",
",",
"x",
")",
";",
"}",
"}"
] | Applies the given {@code procedure} to each non-zero element of the specified column of this matrix.
@param j the column index.
@param procedure the {@link VectorProcedure}. | [
"Applies",
"the",
"given",
"{",
"@code",
"procedure",
"}",
"to",
"each",
"non",
"-",
"zero",
"element",
"of",
"the",
"specified",
"column",
"of",
"this",
"matrix",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/SparseMatrix.java#L323-L331 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/util/PathTokenizer.java | PathTokenizer.getRemainingPath | public static String getRemainingPath(List<String> tokens, int i) {
"""
Get the remaining path from some tokens
@param tokens the tokens
@param i the current location
@return the remaining path
@throws IllegalArgumentException for null tokens or i is out of range
"""
if (tokens == null) {
throw MESSAGES.nullArgument("tokens");
}
return getRemainingPath(tokens, i, tokens.size());
} | java | public static String getRemainingPath(List<String> tokens, int i) {
if (tokens == null) {
throw MESSAGES.nullArgument("tokens");
}
return getRemainingPath(tokens, i, tokens.size());
} | [
"public",
"static",
"String",
"getRemainingPath",
"(",
"List",
"<",
"String",
">",
"tokens",
",",
"int",
"i",
")",
"{",
"if",
"(",
"tokens",
"==",
"null",
")",
"{",
"throw",
"MESSAGES",
".",
"nullArgument",
"(",
"\"tokens\"",
")",
";",
"}",
"return",
"getRemainingPath",
"(",
"tokens",
",",
"i",
",",
"tokens",
".",
"size",
"(",
")",
")",
";",
"}"
] | Get the remaining path from some tokens
@param tokens the tokens
@param i the current location
@return the remaining path
@throws IllegalArgumentException for null tokens or i is out of range | [
"Get",
"the",
"remaining",
"path",
"from",
"some",
"tokens"
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/PathTokenizer.java#L209-L214 |
apache/groovy | subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java | XmlUtil.newSAXParser | public static SAXParser newSAXParser(String schemaLanguage, File schema) throws SAXException, ParserConfigurationException {
"""
Factory method to create a SAXParser configured to validate according to a particular schema language and
a File containing the schema to validate against.
The created SAXParser will be namespace-aware and not validate against DTDs.
@param schemaLanguage the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)
@param schema a file containing the schema to validate against
@return the created SAXParser
@throws SAXException
@throws ParserConfigurationException
@see #newSAXParser(String, boolean, boolean, File)
@since 1.8.7
"""
return newSAXParser(schemaLanguage, true, false, schema);
} | java | public static SAXParser newSAXParser(String schemaLanguage, File schema) throws SAXException, ParserConfigurationException {
return newSAXParser(schemaLanguage, true, false, schema);
} | [
"public",
"static",
"SAXParser",
"newSAXParser",
"(",
"String",
"schemaLanguage",
",",
"File",
"schema",
")",
"throws",
"SAXException",
",",
"ParserConfigurationException",
"{",
"return",
"newSAXParser",
"(",
"schemaLanguage",
",",
"true",
",",
"false",
",",
"schema",
")",
";",
"}"
] | Factory method to create a SAXParser configured to validate according to a particular schema language and
a File containing the schema to validate against.
The created SAXParser will be namespace-aware and not validate against DTDs.
@param schemaLanguage the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)
@param schema a file containing the schema to validate against
@return the created SAXParser
@throws SAXException
@throws ParserConfigurationException
@see #newSAXParser(String, boolean, boolean, File)
@since 1.8.7 | [
"Factory",
"method",
"to",
"create",
"a",
"SAXParser",
"configured",
"to",
"validate",
"according",
"to",
"a",
"particular",
"schema",
"language",
"and",
"a",
"File",
"containing",
"the",
"schema",
"to",
"validate",
"against",
".",
"The",
"created",
"SAXParser",
"will",
"be",
"namespace",
"-",
"aware",
"and",
"not",
"validate",
"against",
"DTDs",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java#L274-L276 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/parser/EmvTemplate.java | EmvTemplate.parseFCIProprietaryTemplate | protected List<Application> parseFCIProprietaryTemplate(final byte[] pData) throws CommunicationException {
"""
Method used to parse FCI Proprietary Template
@param pData
data to parse
@return the list of EMV application in the card
@throws CommunicationException communication error
"""
List<Application> ret = new ArrayList<Application>();
// Get SFI
byte[] data = TlvUtil.getValue(pData, EmvTags.SFI);
// Check SFI
if (data != null) {
int sfi = BytesUtils.byteArrayToInt(data);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("SFI found:" + sfi);
}
// For each records
for (int rec = 0; rec < MAX_RECORD_SFI; rec++) {
data = provider.transceive(new CommandApdu(CommandEnum.READ_RECORD, rec, sfi << 3 | 4, 0).toBytes());
// Check response
if (ResponseUtils.isSucceed(data)) {
// Get applications Tags
ret.addAll(getApplicationTemplate(data));
} else {
// No more records
break;
}
}
} else {
// Read Application template
ret.addAll(getApplicationTemplate(pData));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("(FCI) Issuer Discretionary Data is already present");
}
}
return ret;
} | java | protected List<Application> parseFCIProprietaryTemplate(final byte[] pData) throws CommunicationException {
List<Application> ret = new ArrayList<Application>();
// Get SFI
byte[] data = TlvUtil.getValue(pData, EmvTags.SFI);
// Check SFI
if (data != null) {
int sfi = BytesUtils.byteArrayToInt(data);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("SFI found:" + sfi);
}
// For each records
for (int rec = 0; rec < MAX_RECORD_SFI; rec++) {
data = provider.transceive(new CommandApdu(CommandEnum.READ_RECORD, rec, sfi << 3 | 4, 0).toBytes());
// Check response
if (ResponseUtils.isSucceed(data)) {
// Get applications Tags
ret.addAll(getApplicationTemplate(data));
} else {
// No more records
break;
}
}
} else {
// Read Application template
ret.addAll(getApplicationTemplate(pData));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("(FCI) Issuer Discretionary Data is already present");
}
}
return ret;
} | [
"protected",
"List",
"<",
"Application",
">",
"parseFCIProprietaryTemplate",
"(",
"final",
"byte",
"[",
"]",
"pData",
")",
"throws",
"CommunicationException",
"{",
"List",
"<",
"Application",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"Application",
">",
"(",
")",
";",
"// Get SFI",
"byte",
"[",
"]",
"data",
"=",
"TlvUtil",
".",
"getValue",
"(",
"pData",
",",
"EmvTags",
".",
"SFI",
")",
";",
"// Check SFI",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"int",
"sfi",
"=",
"BytesUtils",
".",
"byteArrayToInt",
"(",
"data",
")",
";",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"SFI found:\"",
"+",
"sfi",
")",
";",
"}",
"// For each records",
"for",
"(",
"int",
"rec",
"=",
"0",
";",
"rec",
"<",
"MAX_RECORD_SFI",
";",
"rec",
"++",
")",
"{",
"data",
"=",
"provider",
".",
"transceive",
"(",
"new",
"CommandApdu",
"(",
"CommandEnum",
".",
"READ_RECORD",
",",
"rec",
",",
"sfi",
"<<",
"3",
"|",
"4",
",",
"0",
")",
".",
"toBytes",
"(",
")",
")",
";",
"// Check response",
"if",
"(",
"ResponseUtils",
".",
"isSucceed",
"(",
"data",
")",
")",
"{",
"// Get applications Tags",
"ret",
".",
"addAll",
"(",
"getApplicationTemplate",
"(",
"data",
")",
")",
";",
"}",
"else",
"{",
"// No more records",
"break",
";",
"}",
"}",
"}",
"else",
"{",
"// Read Application template",
"ret",
".",
"addAll",
"(",
"getApplicationTemplate",
"(",
"pData",
")",
")",
";",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"(FCI) Issuer Discretionary Data is already present\"",
")",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] | Method used to parse FCI Proprietary Template
@param pData
data to parse
@return the list of EMV application in the card
@throws CommunicationException communication error | [
"Method",
"used",
"to",
"parse",
"FCI",
"Proprietary",
"Template"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/EmvTemplate.java#L435-L466 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.containsValueForField | @Internal
@UsedByGeneratedCode
protected final boolean containsValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) {
"""
Obtains a value for the given field argument.
@param resolutionContext The resolution context
@param context The bean context
@param fieldIndex The field index
@return True if it does
"""
if (context instanceof ApplicationContext) {
FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex);
final AnnotationMetadata annotationMetadata = injectionPoint.getAnnotationMetadata();
String valueAnnVal = annotationMetadata.getValue(Value.class, String.class).orElse(null);
String valString = resolvePropertyValueName(resolutionContext, injectionPoint, valueAnnVal, annotationMetadata);
ApplicationContext applicationContext = (ApplicationContext) context;
Class fieldType = injectionPoint.getType();
boolean isConfigProps = fieldType.isAnnotationPresent(ConfigurationProperties.class);
boolean result = isConfigProps || Map.class.isAssignableFrom(fieldType) ? applicationContext.containsProperties(valString) : applicationContext.containsProperty(valString);
if (!result && isConfigurationProperties()) {
String cliOption = resolveCliOption(injectionPoint.getName());
if (cliOption != null) {
return applicationContext.containsProperty(cliOption);
}
}
return result;
}
return false;
} | java | @Internal
@UsedByGeneratedCode
protected final boolean containsValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) {
if (context instanceof ApplicationContext) {
FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex);
final AnnotationMetadata annotationMetadata = injectionPoint.getAnnotationMetadata();
String valueAnnVal = annotationMetadata.getValue(Value.class, String.class).orElse(null);
String valString = resolvePropertyValueName(resolutionContext, injectionPoint, valueAnnVal, annotationMetadata);
ApplicationContext applicationContext = (ApplicationContext) context;
Class fieldType = injectionPoint.getType();
boolean isConfigProps = fieldType.isAnnotationPresent(ConfigurationProperties.class);
boolean result = isConfigProps || Map.class.isAssignableFrom(fieldType) ? applicationContext.containsProperties(valString) : applicationContext.containsProperty(valString);
if (!result && isConfigurationProperties()) {
String cliOption = resolveCliOption(injectionPoint.getName());
if (cliOption != null) {
return applicationContext.containsProperty(cliOption);
}
}
return result;
}
return false;
} | [
"@",
"Internal",
"@",
"UsedByGeneratedCode",
"protected",
"final",
"boolean",
"containsValueForField",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"BeanContext",
"context",
",",
"int",
"fieldIndex",
")",
"{",
"if",
"(",
"context",
"instanceof",
"ApplicationContext",
")",
"{",
"FieldInjectionPoint",
"injectionPoint",
"=",
"fieldInjectionPoints",
".",
"get",
"(",
"fieldIndex",
")",
";",
"final",
"AnnotationMetadata",
"annotationMetadata",
"=",
"injectionPoint",
".",
"getAnnotationMetadata",
"(",
")",
";",
"String",
"valueAnnVal",
"=",
"annotationMetadata",
".",
"getValue",
"(",
"Value",
".",
"class",
",",
"String",
".",
"class",
")",
".",
"orElse",
"(",
"null",
")",
";",
"String",
"valString",
"=",
"resolvePropertyValueName",
"(",
"resolutionContext",
",",
"injectionPoint",
",",
"valueAnnVal",
",",
"annotationMetadata",
")",
";",
"ApplicationContext",
"applicationContext",
"=",
"(",
"ApplicationContext",
")",
"context",
";",
"Class",
"fieldType",
"=",
"injectionPoint",
".",
"getType",
"(",
")",
";",
"boolean",
"isConfigProps",
"=",
"fieldType",
".",
"isAnnotationPresent",
"(",
"ConfigurationProperties",
".",
"class",
")",
";",
"boolean",
"result",
"=",
"isConfigProps",
"||",
"Map",
".",
"class",
".",
"isAssignableFrom",
"(",
"fieldType",
")",
"?",
"applicationContext",
".",
"containsProperties",
"(",
"valString",
")",
":",
"applicationContext",
".",
"containsProperty",
"(",
"valString",
")",
";",
"if",
"(",
"!",
"result",
"&&",
"isConfigurationProperties",
"(",
")",
")",
"{",
"String",
"cliOption",
"=",
"resolveCliOption",
"(",
"injectionPoint",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"cliOption",
"!=",
"null",
")",
"{",
"return",
"applicationContext",
".",
"containsProperty",
"(",
"cliOption",
")",
";",
"}",
"}",
"return",
"result",
";",
"}",
"return",
"false",
";",
"}"
] | Obtains a value for the given field argument.
@param resolutionContext The resolution context
@param context The bean context
@param fieldIndex The field index
@return True if it does | [
"Obtains",
"a",
"value",
"for",
"the",
"given",
"field",
"argument",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L1239-L1260 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BloomFilter.java | BloomFilter.estimateFalsePositiveProbability | public static double estimateFalsePositiveProbability(long inputEntries, int bitSize) {
"""
Compute the false positive probability based on given input entries and bits size.
Note: this is just the math expected value, you should not expect the fpp in real case would under the return value for certain.
@param inputEntries
@param bitSize
@return
"""
int numFunction = optimalNumOfHashFunctions(inputEntries, bitSize);
double p = Math.pow(Math.E, -(double) numFunction * inputEntries / bitSize);
double estimatedFPP = Math.pow(1 - p, numFunction);
return estimatedFPP;
} | java | public static double estimateFalsePositiveProbability(long inputEntries, int bitSize) {
int numFunction = optimalNumOfHashFunctions(inputEntries, bitSize);
double p = Math.pow(Math.E, -(double) numFunction * inputEntries / bitSize);
double estimatedFPP = Math.pow(1 - p, numFunction);
return estimatedFPP;
} | [
"public",
"static",
"double",
"estimateFalsePositiveProbability",
"(",
"long",
"inputEntries",
",",
"int",
"bitSize",
")",
"{",
"int",
"numFunction",
"=",
"optimalNumOfHashFunctions",
"(",
"inputEntries",
",",
"bitSize",
")",
";",
"double",
"p",
"=",
"Math",
".",
"pow",
"(",
"Math",
".",
"E",
",",
"-",
"(",
"double",
")",
"numFunction",
"*",
"inputEntries",
"/",
"bitSize",
")",
";",
"double",
"estimatedFPP",
"=",
"Math",
".",
"pow",
"(",
"1",
"-",
"p",
",",
"numFunction",
")",
";",
"return",
"estimatedFPP",
";",
"}"
] | Compute the false positive probability based on given input entries and bits size.
Note: this is just the math expected value, you should not expect the fpp in real case would under the return value for certain.
@param inputEntries
@param bitSize
@return | [
"Compute",
"the",
"false",
"positive",
"probability",
"based",
"on",
"given",
"input",
"entries",
"and",
"bits",
"size",
".",
"Note",
":",
"this",
"is",
"just",
"the",
"math",
"expected",
"value",
"you",
"should",
"not",
"expect",
"the",
"fpp",
"in",
"real",
"case",
"would",
"under",
"the",
"return",
"value",
"for",
"certain",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BloomFilter.java#L82-L87 |
apache/groovy | src/main/java/org/codehaus/groovy/vmplugin/v7/TypeTransformers.java | TypeTransformers.applyUnsharpFilter | public static MethodHandle applyUnsharpFilter(MethodHandle handle, int pos, MethodHandle transformer) {
"""
Apply a transformer as filter.
The filter may not match exactly in the types. In this case needed
additional type transformations are done by {@link MethodHandle#asType(MethodType)}
"""
MethodType type = transformer.type();
Class given = handle.type().parameterType(pos);
if (type.returnType() != given || type.parameterType(0) != given) {
transformer = transformer.asType(MethodType.methodType(given, type.parameterType(0)));
}
return MethodHandles.filterArguments(handle, pos, transformer);
} | java | public static MethodHandle applyUnsharpFilter(MethodHandle handle, int pos, MethodHandle transformer) {
MethodType type = transformer.type();
Class given = handle.type().parameterType(pos);
if (type.returnType() != given || type.parameterType(0) != given) {
transformer = transformer.asType(MethodType.methodType(given, type.parameterType(0)));
}
return MethodHandles.filterArguments(handle, pos, transformer);
} | [
"public",
"static",
"MethodHandle",
"applyUnsharpFilter",
"(",
"MethodHandle",
"handle",
",",
"int",
"pos",
",",
"MethodHandle",
"transformer",
")",
"{",
"MethodType",
"type",
"=",
"transformer",
".",
"type",
"(",
")",
";",
"Class",
"given",
"=",
"handle",
".",
"type",
"(",
")",
".",
"parameterType",
"(",
"pos",
")",
";",
"if",
"(",
"type",
".",
"returnType",
"(",
")",
"!=",
"given",
"||",
"type",
".",
"parameterType",
"(",
"0",
")",
"!=",
"given",
")",
"{",
"transformer",
"=",
"transformer",
".",
"asType",
"(",
"MethodType",
".",
"methodType",
"(",
"given",
",",
"type",
".",
"parameterType",
"(",
"0",
")",
")",
")",
";",
"}",
"return",
"MethodHandles",
".",
"filterArguments",
"(",
"handle",
",",
"pos",
",",
"transformer",
")",
";",
"}"
] | Apply a transformer as filter.
The filter may not match exactly in the types. In this case needed
additional type transformations are done by {@link MethodHandle#asType(MethodType)} | [
"Apply",
"a",
"transformer",
"as",
"filter",
".",
"The",
"filter",
"may",
"not",
"match",
"exactly",
"in",
"the",
"types",
".",
"In",
"this",
"case",
"needed",
"additional",
"type",
"transformations",
"are",
"done",
"by",
"{"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v7/TypeTransformers.java#L198-L205 |
beangle/beangle3 | orm/hibernate/src/main/java/org/beangle/orm/hibernate/id/TableSeqGenerator.java | TableSeqGenerator.configure | public void configure(Type type, Properties params, Dialect dialect) {
"""
If the parameters do not contain a {@link SequenceGenerator#SEQUENCE} name, we assign one
based on the table name.
"""
if (Strings.isEmpty(params.getProperty(SEQUENCE_PARAM))) {
String tableName = params.getProperty(PersistentIdentifierGenerator.TABLE);
String pk = params.getProperty(PersistentIdentifierGenerator.PK);
if (null != tableName) {
String seqName = Strings.replace(sequencePattern, "{table}", tableName);
seqName = Strings.replace(seqName, "{pk}", pk);
if (seqName.length() > MaxLength) {
logger.warn("{}'s length >=30, wouldn't be supported in some db!", seqName);
}
String entityName = params.getProperty(IdentifierGenerator.ENTITY_NAME);
if (null != entityName && null != namingStrategy) {
String schema = namingStrategy.getSchema(entityName);
if (null != schema) seqName = schema + "." + seqName;
}
params.setProperty(SEQUENCE_PARAM, seqName);
}
}
super.configure(type, params, dialect);
} | java | public void configure(Type type, Properties params, Dialect dialect) {
if (Strings.isEmpty(params.getProperty(SEQUENCE_PARAM))) {
String tableName = params.getProperty(PersistentIdentifierGenerator.TABLE);
String pk = params.getProperty(PersistentIdentifierGenerator.PK);
if (null != tableName) {
String seqName = Strings.replace(sequencePattern, "{table}", tableName);
seqName = Strings.replace(seqName, "{pk}", pk);
if (seqName.length() > MaxLength) {
logger.warn("{}'s length >=30, wouldn't be supported in some db!", seqName);
}
String entityName = params.getProperty(IdentifierGenerator.ENTITY_NAME);
if (null != entityName && null != namingStrategy) {
String schema = namingStrategy.getSchema(entityName);
if (null != schema) seqName = schema + "." + seqName;
}
params.setProperty(SEQUENCE_PARAM, seqName);
}
}
super.configure(type, params, dialect);
} | [
"public",
"void",
"configure",
"(",
"Type",
"type",
",",
"Properties",
"params",
",",
"Dialect",
"dialect",
")",
"{",
"if",
"(",
"Strings",
".",
"isEmpty",
"(",
"params",
".",
"getProperty",
"(",
"SEQUENCE_PARAM",
")",
")",
")",
"{",
"String",
"tableName",
"=",
"params",
".",
"getProperty",
"(",
"PersistentIdentifierGenerator",
".",
"TABLE",
")",
";",
"String",
"pk",
"=",
"params",
".",
"getProperty",
"(",
"PersistentIdentifierGenerator",
".",
"PK",
")",
";",
"if",
"(",
"null",
"!=",
"tableName",
")",
"{",
"String",
"seqName",
"=",
"Strings",
".",
"replace",
"(",
"sequencePattern",
",",
"\"{table}\"",
",",
"tableName",
")",
";",
"seqName",
"=",
"Strings",
".",
"replace",
"(",
"seqName",
",",
"\"{pk}\"",
",",
"pk",
")",
";",
"if",
"(",
"seqName",
".",
"length",
"(",
")",
">",
"MaxLength",
")",
"{",
"logger",
".",
"warn",
"(",
"\"{}'s length >=30, wouldn't be supported in some db!\"",
",",
"seqName",
")",
";",
"}",
"String",
"entityName",
"=",
"params",
".",
"getProperty",
"(",
"IdentifierGenerator",
".",
"ENTITY_NAME",
")",
";",
"if",
"(",
"null",
"!=",
"entityName",
"&&",
"null",
"!=",
"namingStrategy",
")",
"{",
"String",
"schema",
"=",
"namingStrategy",
".",
"getSchema",
"(",
"entityName",
")",
";",
"if",
"(",
"null",
"!=",
"schema",
")",
"seqName",
"=",
"schema",
"+",
"\".\"",
"+",
"seqName",
";",
"}",
"params",
".",
"setProperty",
"(",
"SEQUENCE_PARAM",
",",
"seqName",
")",
";",
"}",
"}",
"super",
".",
"configure",
"(",
"type",
",",
"params",
",",
"dialect",
")",
";",
"}"
] | If the parameters do not contain a {@link SequenceGenerator#SEQUENCE} name, we assign one
based on the table name. | [
"If",
"the",
"parameters",
"do",
"not",
"contain",
"a",
"{"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/orm/hibernate/src/main/java/org/beangle/orm/hibernate/id/TableSeqGenerator.java#L62-L81 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.deleteItem | public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Delete the items with the specified id's from the node.
@param itemIds The list of id's of items to delete
@throws XMPPErrorException
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException
"""
List<Item> items = new ArrayList<>(itemIds.size());
for (String id : itemIds) {
items.add(new Item(id));
}
PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
} | java | public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<Item> items = new ArrayList<>(itemIds.size());
for (String id : itemIds) {
items.add(new Item(id));
}
PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
} | [
"public",
"void",
"deleteItem",
"(",
"Collection",
"<",
"String",
">",
"itemIds",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"List",
"<",
"Item",
">",
"items",
"=",
"new",
"ArrayList",
"<>",
"(",
"itemIds",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"String",
"id",
":",
"itemIds",
")",
"{",
"items",
".",
"add",
"(",
"new",
"Item",
"(",
"id",
")",
")",
";",
"}",
"PubSub",
"request",
"=",
"createPubsubPacket",
"(",
"Type",
".",
"set",
",",
"new",
"ItemsExtension",
"(",
"ItemsExtension",
".",
"ItemsElementType",
".",
"retract",
",",
"getId",
"(",
")",
",",
"items",
")",
")",
";",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"createStanzaCollectorAndSend",
"(",
"request",
")",
".",
"nextResultOrThrow",
"(",
")",
";",
"}"
] | Delete the items with the specified id's from the node.
@param itemIds The list of id's of items to delete
@throws XMPPErrorException
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Delete",
"the",
"items",
"with",
"the",
"specified",
"id",
"s",
"from",
"the",
"node",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L373-L381 |
headius/invokebinder | src/main/java/com/headius/invokebinder/SmartBinder.java | SmartBinder.castReturn | public SmartBinder castReturn(Class<?> type) {
"""
Cast the return value to the given type.
Example: Our current signature is (String)String but the method this
handle will eventually call returns CharSequence.
<code>binder = binder.castReturn(CharSequence.class);</code>
Our handle will now successfully find and call the target method and
propagate the returned CharSequence as a String.
@param type the new type for the return value
@return a new SmartBinder
"""
return new SmartBinder(this, signature().changeReturn(type), binder.cast(type, binder.type().parameterArray()));
} | java | public SmartBinder castReturn(Class<?> type) {
return new SmartBinder(this, signature().changeReturn(type), binder.cast(type, binder.type().parameterArray()));
} | [
"public",
"SmartBinder",
"castReturn",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"new",
"SmartBinder",
"(",
"this",
",",
"signature",
"(",
")",
".",
"changeReturn",
"(",
"type",
")",
",",
"binder",
".",
"cast",
"(",
"type",
",",
"binder",
".",
"type",
"(",
")",
".",
"parameterArray",
"(",
")",
")",
")",
";",
"}"
] | Cast the return value to the given type.
Example: Our current signature is (String)String but the method this
handle will eventually call returns CharSequence.
<code>binder = binder.castReturn(CharSequence.class);</code>
Our handle will now successfully find and call the target method and
propagate the returned CharSequence as a String.
@param type the new type for the return value
@return a new SmartBinder | [
"Cast",
"the",
"return",
"value",
"to",
"the",
"given",
"type",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L925-L927 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java | SVGUtil.addCSSClass | public static void addCSSClass(Element e, String cssclass) {
"""
Add a CSS class to an Element.
@param e Element
@param cssclass class to add.
"""
String oldval = e.getAttribute(SVGConstants.SVG_CLASS_ATTRIBUTE);
if(oldval == null || oldval.length() == 0) {
setAtt(e, SVGConstants.SVG_CLASS_ATTRIBUTE, cssclass);
return;
}
String[] classes = oldval.split(" ");
for(String c : classes) {
if(c.equals(cssclass)) {
return;
}
}
setAtt(e, SVGConstants.SVG_CLASS_ATTRIBUTE, oldval + " " + cssclass);
} | java | public static void addCSSClass(Element e, String cssclass) {
String oldval = e.getAttribute(SVGConstants.SVG_CLASS_ATTRIBUTE);
if(oldval == null || oldval.length() == 0) {
setAtt(e, SVGConstants.SVG_CLASS_ATTRIBUTE, cssclass);
return;
}
String[] classes = oldval.split(" ");
for(String c : classes) {
if(c.equals(cssclass)) {
return;
}
}
setAtt(e, SVGConstants.SVG_CLASS_ATTRIBUTE, oldval + " " + cssclass);
} | [
"public",
"static",
"void",
"addCSSClass",
"(",
"Element",
"e",
",",
"String",
"cssclass",
")",
"{",
"String",
"oldval",
"=",
"e",
".",
"getAttribute",
"(",
"SVGConstants",
".",
"SVG_CLASS_ATTRIBUTE",
")",
";",
"if",
"(",
"oldval",
"==",
"null",
"||",
"oldval",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"setAtt",
"(",
"e",
",",
"SVGConstants",
".",
"SVG_CLASS_ATTRIBUTE",
",",
"cssclass",
")",
";",
"return",
";",
"}",
"String",
"[",
"]",
"classes",
"=",
"oldval",
".",
"split",
"(",
"\" \"",
")",
";",
"for",
"(",
"String",
"c",
":",
"classes",
")",
"{",
"if",
"(",
"c",
".",
"equals",
"(",
"cssclass",
")",
")",
"{",
"return",
";",
"}",
"}",
"setAtt",
"(",
"e",
",",
"SVGConstants",
".",
"SVG_CLASS_ATTRIBUTE",
",",
"oldval",
"+",
"\" \"",
"+",
"cssclass",
")",
";",
"}"
] | Add a CSS class to an Element.
@param e Element
@param cssclass class to add. | [
"Add",
"a",
"CSS",
"class",
"to",
"an",
"Element",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L347-L360 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/evaluation/DefaultXPathEvaluator.java | DefaultXPathEvaluator.asString | @Override
public String asString() {
"""
Evaluates the XPath as a String value. This method is just a shortcut for as(String.class);
@return String value of evaluation result.
"""
final Class<?> callerClass = ReflectionHelper.getDirectCallerClass();
return evaluateSingeValue(String.class, callerClass);
} | java | @Override
public String asString() {
final Class<?> callerClass = ReflectionHelper.getDirectCallerClass();
return evaluateSingeValue(String.class, callerClass);
} | [
"@",
"Override",
"public",
"String",
"asString",
"(",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"callerClass",
"=",
"ReflectionHelper",
".",
"getDirectCallerClass",
"(",
")",
";",
"return",
"evaluateSingeValue",
"(",
"String",
".",
"class",
",",
"callerClass",
")",
";",
"}"
] | Evaluates the XPath as a String value. This method is just a shortcut for as(String.class);
@return String value of evaluation result. | [
"Evaluates",
"the",
"XPath",
"as",
"a",
"String",
"value",
".",
"This",
"method",
"is",
"just",
"a",
"shortcut",
"for",
"as",
"(",
"String",
".",
"class",
")",
";"
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/evaluation/DefaultXPathEvaluator.java#L102-L106 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java | UsersInner.update | public UserInner update(String resourceGroupName, String labAccountName, String labName, String userName, UserFragment user) {
"""
Modify properties of users.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param userName The name of the user.
@param user The User registered to a lab
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UserInner object if successful.
"""
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).toBlocking().single().body();
} | java | public UserInner update(String resourceGroupName, String labAccountName, String labName, String userName, UserFragment user) {
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).toBlocking().single().body();
} | [
"public",
"UserInner",
"update",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"userName",
",",
"UserFragment",
"user",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
",",
"labName",
",",
"userName",
",",
"user",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Modify properties of users.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param userName The name of the user.
@param user The User registered to a lab
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UserInner object if successful. | [
"Modify",
"properties",
"of",
"users",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java#L877-L879 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java | GeoPackageCoreConnection.querySingleTypedResult | public <T> T querySingleTypedResult(String sql, String[] args) {
"""
Query the SQL for a single result typed object in the first column
@param <T>
result value type
@param sql
sql statement
@param args
sql arguments
@return single result object
@since 3.1.0
"""
@SuppressWarnings("unchecked")
T result = (T) querySingleResult(sql, args);
return result;
} | java | public <T> T querySingleTypedResult(String sql, String[] args) {
@SuppressWarnings("unchecked")
T result = (T) querySingleResult(sql, args);
return result;
} | [
"public",
"<",
"T",
">",
"T",
"querySingleTypedResult",
"(",
"String",
"sql",
",",
"String",
"[",
"]",
"args",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"T",
"result",
"=",
"(",
"T",
")",
"querySingleResult",
"(",
"sql",
",",
"args",
")",
";",
"return",
"result",
";",
"}"
] | Query the SQL for a single result typed object in the first column
@param <T>
result value type
@param sql
sql statement
@param args
sql arguments
@return single result object
@since 3.1.0 | [
"Query",
"the",
"SQL",
"for",
"a",
"single",
"result",
"typed",
"object",
"in",
"the",
"first",
"column"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java#L190-L194 |
MenoData/Time4J | base/src/main/java/net/time4j/range/Months.java | Months.between | public static <T extends TimePoint<? super CalendarUnit, T>> Months between(T t1, T t2) {
"""
/*[deutsch]
<p>Bestimmt die gregorianische Monatsdifferenz zwischen den angegebenen Zeitpunkten. </p>
@param <T> generic type of time-points
@param t1 first time-point
@param t2 second time-point
@return result of month difference
@see net.time4j.PlainDate
@see net.time4j.PlainTimestamp
"""
long delta = CalendarUnit.MONTHS.between(t1, t2);
return Months.of(MathUtils.safeCast(delta));
} | java | public static <T extends TimePoint<? super CalendarUnit, T>> Months between(T t1, T t2) {
long delta = CalendarUnit.MONTHS.between(t1, t2);
return Months.of(MathUtils.safeCast(delta));
} | [
"public",
"static",
"<",
"T",
"extends",
"TimePoint",
"<",
"?",
"super",
"CalendarUnit",
",",
"T",
">",
">",
"Months",
"between",
"(",
"T",
"t1",
",",
"T",
"t2",
")",
"{",
"long",
"delta",
"=",
"CalendarUnit",
".",
"MONTHS",
".",
"between",
"(",
"t1",
",",
"t2",
")",
";",
"return",
"Months",
".",
"of",
"(",
"MathUtils",
".",
"safeCast",
"(",
"delta",
")",
")",
";",
"}"
] | /*[deutsch]
<p>Bestimmt die gregorianische Monatsdifferenz zwischen den angegebenen Zeitpunkten. </p>
@param <T> generic type of time-points
@param t1 first time-point
@param t2 second time-point
@return result of month difference
@see net.time4j.PlainDate
@see net.time4j.PlainTimestamp | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Bestimmt",
"die",
"gregorianische",
"Monatsdifferenz",
"zwischen",
"den",
"angegebenen",
"Zeitpunkten",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/Months.java#L118-L123 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/ui/CmsToolbarGalleryMenu.java | CmsToolbarGalleryMenu.updateGalleryData | public void updateGalleryData(CmsContainerPageGalleryData galleryData, boolean viewChanged) {
"""
Updates the gallery data.<p>
@param galleryData the gallery data
@param viewChanged <code>true</code> in case the element view changed
"""
if (m_dialog != null) {
if (viewChanged) {
m_dialog.removeFromParent();
m_dialog = null;
} else {
m_dialog.updateGalleryData(galleryData.getGalleryData());
}
}
m_galleryData = galleryData.getGalleryData();
m_search = galleryData.getGallerySearch();
} | java | public void updateGalleryData(CmsContainerPageGalleryData galleryData, boolean viewChanged) {
if (m_dialog != null) {
if (viewChanged) {
m_dialog.removeFromParent();
m_dialog = null;
} else {
m_dialog.updateGalleryData(galleryData.getGalleryData());
}
}
m_galleryData = galleryData.getGalleryData();
m_search = galleryData.getGallerySearch();
} | [
"public",
"void",
"updateGalleryData",
"(",
"CmsContainerPageGalleryData",
"galleryData",
",",
"boolean",
"viewChanged",
")",
"{",
"if",
"(",
"m_dialog",
"!=",
"null",
")",
"{",
"if",
"(",
"viewChanged",
")",
"{",
"m_dialog",
".",
"removeFromParent",
"(",
")",
";",
"m_dialog",
"=",
"null",
";",
"}",
"else",
"{",
"m_dialog",
".",
"updateGalleryData",
"(",
"galleryData",
".",
"getGalleryData",
"(",
")",
")",
";",
"}",
"}",
"m_galleryData",
"=",
"galleryData",
".",
"getGalleryData",
"(",
")",
";",
"m_search",
"=",
"galleryData",
".",
"getGallerySearch",
"(",
")",
";",
"}"
] | Updates the gallery data.<p>
@param galleryData the gallery data
@param viewChanged <code>true</code> in case the element view changed | [
"Updates",
"the",
"gallery",
"data",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/CmsToolbarGalleryMenu.java#L214-L226 |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyArray.java | LazyArray.getBoolean | public boolean getBoolean(int index) {
"""
Returns the boolean value stored at the given index.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean
@throws LazyException if the index is out of bounds
"""
LazyNode token=getValueToken(index);
if(token.type==LazyNode.VALUE_TRUE)return true;
if(token.type==LazyNode.VALUE_FALSE)return false;
throw new LazyException("Requested value is not a boolean",token);
} | java | public boolean getBoolean(int index){
LazyNode token=getValueToken(index);
if(token.type==LazyNode.VALUE_TRUE)return true;
if(token.type==LazyNode.VALUE_FALSE)return false;
throw new LazyException("Requested value is not a boolean",token);
} | [
"public",
"boolean",
"getBoolean",
"(",
"int",
"index",
")",
"{",
"LazyNode",
"token",
"=",
"getValueToken",
"(",
"index",
")",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
"VALUE_TRUE",
")",
"return",
"true",
";",
"if",
"(",
"token",
".",
"type",
"==",
"LazyNode",
".",
"VALUE_FALSE",
")",
"return",
"false",
";",
"throw",
"new",
"LazyException",
"(",
"\"Requested value is not a boolean\"",
",",
"token",
")",
";",
"}"
] | Returns the boolean value stored at the given index.
@param index the location of the value in this array
@return the value if it could be parsed as a boolean
@throws LazyException if the index is out of bounds | [
"Returns",
"the",
"boolean",
"value",
"stored",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyArray.java#L500-L505 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java | DefaultPriorityProvider.evaluateValueProvider | protected Long evaluateValueProvider(ParameterValueProvider valueProvider, ExecutionEntity execution, String errorMessageHeading) {
"""
Evaluates a given value provider with the given execution entity to determine
the correct value. The error message heading is used for the error message
if the validation fails because the value is no valid priority.
@param valueProvider the provider which contains the value
@param execution the execution entity
@param errorMessageHeading the heading which is used for the error message
@return the valid priority value
"""
Object value;
try {
value = valueProvider.getValue(execution);
} catch (ProcessEngineException e) {
if (Context.getProcessEngineConfiguration().isEnableGracefulDegradationOnContextSwitchFailure()
&& isSymptomOfContextSwitchFailure(e, execution)) {
value = getDefaultPriorityOnResolutionFailure();
logNotDeterminingPriority(execution, value, e);
}
else {
throw e;
}
}
if (!(value instanceof Number)) {
throw new ProcessEngineException(errorMessageHeading + ": Priority value is not an Integer");
}
else {
Number numberValue = (Number) value;
if (isValidLongValue(numberValue)) {
return numberValue.longValue();
}
else {
throw new ProcessEngineException(errorMessageHeading + ": Priority value must be either Short, Integer, or Long");
}
}
} | java | protected Long evaluateValueProvider(ParameterValueProvider valueProvider, ExecutionEntity execution, String errorMessageHeading) {
Object value;
try {
value = valueProvider.getValue(execution);
} catch (ProcessEngineException e) {
if (Context.getProcessEngineConfiguration().isEnableGracefulDegradationOnContextSwitchFailure()
&& isSymptomOfContextSwitchFailure(e, execution)) {
value = getDefaultPriorityOnResolutionFailure();
logNotDeterminingPriority(execution, value, e);
}
else {
throw e;
}
}
if (!(value instanceof Number)) {
throw new ProcessEngineException(errorMessageHeading + ": Priority value is not an Integer");
}
else {
Number numberValue = (Number) value;
if (isValidLongValue(numberValue)) {
return numberValue.longValue();
}
else {
throw new ProcessEngineException(errorMessageHeading + ": Priority value must be either Short, Integer, or Long");
}
}
} | [
"protected",
"Long",
"evaluateValueProvider",
"(",
"ParameterValueProvider",
"valueProvider",
",",
"ExecutionEntity",
"execution",
",",
"String",
"errorMessageHeading",
")",
"{",
"Object",
"value",
";",
"try",
"{",
"value",
"=",
"valueProvider",
".",
"getValue",
"(",
"execution",
")",
";",
"}",
"catch",
"(",
"ProcessEngineException",
"e",
")",
"{",
"if",
"(",
"Context",
".",
"getProcessEngineConfiguration",
"(",
")",
".",
"isEnableGracefulDegradationOnContextSwitchFailure",
"(",
")",
"&&",
"isSymptomOfContextSwitchFailure",
"(",
"e",
",",
"execution",
")",
")",
"{",
"value",
"=",
"getDefaultPriorityOnResolutionFailure",
"(",
")",
";",
"logNotDeterminingPriority",
"(",
"execution",
",",
"value",
",",
"e",
")",
";",
"}",
"else",
"{",
"throw",
"e",
";",
"}",
"}",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"Number",
")",
")",
"{",
"throw",
"new",
"ProcessEngineException",
"(",
"errorMessageHeading",
"+",
"\": Priority value is not an Integer\"",
")",
";",
"}",
"else",
"{",
"Number",
"numberValue",
"=",
"(",
"Number",
")",
"value",
";",
"if",
"(",
"isValidLongValue",
"(",
"numberValue",
")",
")",
"{",
"return",
"numberValue",
".",
"longValue",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"ProcessEngineException",
"(",
"errorMessageHeading",
"+",
"\": Priority value must be either Short, Integer, or Long\"",
")",
";",
"}",
"}",
"}"
] | Evaluates a given value provider with the given execution entity to determine
the correct value. The error message heading is used for the error message
if the validation fails because the value is no valid priority.
@param valueProvider the provider which contains the value
@param execution the execution entity
@param errorMessageHeading the heading which is used for the error message
@return the valid priority value | [
"Evaluates",
"a",
"given",
"value",
"provider",
"with",
"the",
"given",
"execution",
"entity",
"to",
"determine",
"the",
"correct",
"value",
".",
"The",
"error",
"message",
"heading",
"is",
"used",
"for",
"the",
"error",
"message",
"if",
"the",
"validation",
"fails",
"because",
"the",
"value",
"is",
"no",
"valid",
"priority",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java#L73-L103 |
roboconf/roboconf-platform | core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java | RabbitMqUtils.declareGlobalExchanges | public static void declareGlobalExchanges( String domain, Channel channel )
throws IOException {
"""
Declares the global exchanges (those that do not depend on an application).
<p>
It includes the DM exchange and the one for inter-application exchanges.
</p>
@param channel the RabbitMQ channel
@throws IOException if an error occurs
"""
// "topic" is a keyword for RabbitMQ.
channel.exchangeDeclare( buildExchangeNameForTheDm( domain ), "topic" );
channel.exchangeDeclare( buildExchangeNameForInterApp( domain ), "topic" );
} | java | public static void declareGlobalExchanges( String domain, Channel channel )
throws IOException {
// "topic" is a keyword for RabbitMQ.
channel.exchangeDeclare( buildExchangeNameForTheDm( domain ), "topic" );
channel.exchangeDeclare( buildExchangeNameForInterApp( domain ), "topic" );
} | [
"public",
"static",
"void",
"declareGlobalExchanges",
"(",
"String",
"domain",
",",
"Channel",
"channel",
")",
"throws",
"IOException",
"{",
"// \"topic\" is a keyword for RabbitMQ.",
"channel",
".",
"exchangeDeclare",
"(",
"buildExchangeNameForTheDm",
"(",
"domain",
")",
",",
"\"topic\"",
")",
";",
"channel",
".",
"exchangeDeclare",
"(",
"buildExchangeNameForInterApp",
"(",
"domain",
")",
",",
"\"topic\"",
")",
";",
"}"
] | Declares the global exchanges (those that do not depend on an application).
<p>
It includes the DM exchange and the one for inter-application exchanges.
</p>
@param channel the RabbitMQ channel
@throws IOException if an error occurs | [
"Declares",
"the",
"global",
"exchanges",
"(",
"those",
"that",
"do",
"not",
"depend",
"on",
"an",
"application",
")",
".",
"<p",
">",
"It",
"includes",
"the",
"DM",
"exchange",
"and",
"the",
"one",
"for",
"inter",
"-",
"application",
"exchanges",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java#L201-L207 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java | BlockDrawingHelper.DrawPrimitive | private void DrawPrimitive( DrawItem i, World w ) throws Exception {
"""
Spawn a single item at the specified position.
@param i Contains information about the item to be spawned.
@param w The world in which to spawn.
@throws Exception Throws an exception if the item type is not recognised.
"""
ItemStack item = MinecraftTypeHelper.getItemStackFromDrawItem(i);
if (item == null)
throw new Exception("Unrecognised item type: "+i.getType());
BlockPos pos = new BlockPos( i.getX(), i.getY(), i.getZ() );
placeItem(item, pos, w, true);
} | java | private void DrawPrimitive( DrawItem i, World w ) throws Exception
{
ItemStack item = MinecraftTypeHelper.getItemStackFromDrawItem(i);
if (item == null)
throw new Exception("Unrecognised item type: "+i.getType());
BlockPos pos = new BlockPos( i.getX(), i.getY(), i.getZ() );
placeItem(item, pos, w, true);
} | [
"private",
"void",
"DrawPrimitive",
"(",
"DrawItem",
"i",
",",
"World",
"w",
")",
"throws",
"Exception",
"{",
"ItemStack",
"item",
"=",
"MinecraftTypeHelper",
".",
"getItemStackFromDrawItem",
"(",
"i",
")",
";",
"if",
"(",
"item",
"==",
"null",
")",
"throw",
"new",
"Exception",
"(",
"\"Unrecognised item type: \"",
"+",
"i",
".",
"getType",
"(",
")",
")",
";",
"BlockPos",
"pos",
"=",
"new",
"BlockPos",
"(",
"i",
".",
"getX",
"(",
")",
",",
"i",
".",
"getY",
"(",
")",
",",
"i",
".",
"getZ",
"(",
")",
")",
";",
"placeItem",
"(",
"item",
",",
"pos",
",",
"w",
",",
"true",
")",
";",
"}"
] | Spawn a single item at the specified position.
@param i Contains information about the item to be spawned.
@param w The world in which to spawn.
@throws Exception Throws an exception if the item type is not recognised. | [
"Spawn",
"a",
"single",
"item",
"at",
"the",
"specified",
"position",
"."
] | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java#L346-L353 |
jeremylong/DependencyCheck | maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java | BaseDependencyCheckMojo.addSnapshotReactorDependency | private boolean addSnapshotReactorDependency(Engine engine, Artifact artifact) {
"""
Checks if the current artifact is actually in the reactor projects. If
true a virtual dependency is created based on the evidence in the
project.
@param engine a reference to the engine being used to scan
@param artifact the artifact being analyzed in the mojo
@return <code>true</code> if the artifact is a snapshot artifact in the
reactor; otherwise <code>false</code>
"""
if (!artifact.isSnapshot()) {
return false;
}
return addVirtualDependencyFromReactor(engine, artifact, "Found snapshot reactor project in aggregate for %s - "
+ "creating a virtual dependency as the snapshot found in the repository may contain outdated dependencies.");
} | java | private boolean addSnapshotReactorDependency(Engine engine, Artifact artifact) {
if (!artifact.isSnapshot()) {
return false;
}
return addVirtualDependencyFromReactor(engine, artifact, "Found snapshot reactor project in aggregate for %s - "
+ "creating a virtual dependency as the snapshot found in the repository may contain outdated dependencies.");
} | [
"private",
"boolean",
"addSnapshotReactorDependency",
"(",
"Engine",
"engine",
",",
"Artifact",
"artifact",
")",
"{",
"if",
"(",
"!",
"artifact",
".",
"isSnapshot",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"addVirtualDependencyFromReactor",
"(",
"engine",
",",
"artifact",
",",
"\"Found snapshot reactor project in aggregate for %s - \"",
"+",
"\"creating a virtual dependency as the snapshot found in the repository may contain outdated dependencies.\"",
")",
";",
"}"
] | Checks if the current artifact is actually in the reactor projects. If
true a virtual dependency is created based on the evidence in the
project.
@param engine a reference to the engine being used to scan
@param artifact the artifact being analyzed in the mojo
@return <code>true</code> if the artifact is a snapshot artifact in the
reactor; otherwise <code>false</code> | [
"Checks",
"if",
"the",
"current",
"artifact",
"is",
"actually",
"in",
"the",
"reactor",
"projects",
".",
"If",
"true",
"a",
"virtual",
"dependency",
"is",
"created",
"based",
"on",
"the",
"evidence",
"in",
"the",
"project",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java#L1284-L1290 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.hasArguments | public static MultiMatcher<MethodInvocationTree, ExpressionTree> hasArguments(
MatchType matchType, Matcher<ExpressionTree> argumentMatcher) {
"""
Matches if the given matcher matches all of/any of the arguments to this method invocation.
"""
return new HasArguments(matchType, argumentMatcher);
} | java | public static MultiMatcher<MethodInvocationTree, ExpressionTree> hasArguments(
MatchType matchType, Matcher<ExpressionTree> argumentMatcher) {
return new HasArguments(matchType, argumentMatcher);
} | [
"public",
"static",
"MultiMatcher",
"<",
"MethodInvocationTree",
",",
"ExpressionTree",
">",
"hasArguments",
"(",
"MatchType",
"matchType",
",",
"Matcher",
"<",
"ExpressionTree",
">",
"argumentMatcher",
")",
"{",
"return",
"new",
"HasArguments",
"(",
"matchType",
",",
"argumentMatcher",
")",
";",
"}"
] | Matches if the given matcher matches all of/any of the arguments to this method invocation. | [
"Matches",
"if",
"the",
"given",
"matcher",
"matches",
"all",
"of",
"/",
"any",
"of",
"the",
"arguments",
"to",
"this",
"method",
"invocation",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L351-L354 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfAction.java | PdfAction.gotoLocalPage | public static PdfAction gotoLocalPage(int page, PdfDestination dest, PdfWriter writer) {
"""
Creates a GoTo action to an internal page.
@param page the page to go. First page is 1
@param dest the destination for the page
@param writer the writer for this action
@return a GoTo action
"""
PdfIndirectReference ref = writer.getPageReference(page);
dest.addPage(ref);
PdfAction action = new PdfAction();
action.put(PdfName.S, PdfName.GOTO);
action.put(PdfName.D, dest);
return action;
} | java | public static PdfAction gotoLocalPage(int page, PdfDestination dest, PdfWriter writer) {
PdfIndirectReference ref = writer.getPageReference(page);
dest.addPage(ref);
PdfAction action = new PdfAction();
action.put(PdfName.S, PdfName.GOTO);
action.put(PdfName.D, dest);
return action;
} | [
"public",
"static",
"PdfAction",
"gotoLocalPage",
"(",
"int",
"page",
",",
"PdfDestination",
"dest",
",",
"PdfWriter",
"writer",
")",
"{",
"PdfIndirectReference",
"ref",
"=",
"writer",
".",
"getPageReference",
"(",
"page",
")",
";",
"dest",
".",
"addPage",
"(",
"ref",
")",
";",
"PdfAction",
"action",
"=",
"new",
"PdfAction",
"(",
")",
";",
"action",
".",
"put",
"(",
"PdfName",
".",
"S",
",",
"PdfName",
".",
"GOTO",
")",
";",
"action",
".",
"put",
"(",
"PdfName",
".",
"D",
",",
"dest",
")",
";",
"return",
"action",
";",
"}"
] | Creates a GoTo action to an internal page.
@param page the page to go. First page is 1
@param dest the destination for the page
@param writer the writer for this action
@return a GoTo action | [
"Creates",
"a",
"GoTo",
"action",
"to",
"an",
"internal",
"page",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAction.java#L455-L462 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/providers/PersonEvaluatorFactory.java | PersonEvaluatorFactory.getAttributeEvaluator | public Evaluator getAttributeEvaluator(String name, String mode, String value)
throws Exception {
"""
returns an Evaluator unique to the type of attribute being evaluated. subclasses can override
this method to return the Evaluator that's appropriate to their implementation.
@param name the attribute's name.
@param mode the attribute's mode. (i.e. 'equals')
@param value the attribute's value.
@return an Evaluator for evaluating attributes
"""
return new AttributeEvaluator(name, mode, value);
} | java | public Evaluator getAttributeEvaluator(String name, String mode, String value)
throws Exception {
return new AttributeEvaluator(name, mode, value);
} | [
"public",
"Evaluator",
"getAttributeEvaluator",
"(",
"String",
"name",
",",
"String",
"mode",
",",
"String",
"value",
")",
"throws",
"Exception",
"{",
"return",
"new",
"AttributeEvaluator",
"(",
"name",
",",
"mode",
",",
"value",
")",
";",
"}"
] | returns an Evaluator unique to the type of attribute being evaluated. subclasses can override
this method to return the Evaluator that's appropriate to their implementation.
@param name the attribute's name.
@param mode the attribute's mode. (i.e. 'equals')
@param value the attribute's value.
@return an Evaluator for evaluating attributes | [
"returns",
"an",
"Evaluator",
"unique",
"to",
"the",
"type",
"of",
"attribute",
"being",
"evaluated",
".",
"subclasses",
"can",
"override",
"this",
"method",
"to",
"return",
"the",
"Evaluator",
"that",
"s",
"appropriate",
"to",
"their",
"implementation",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/providers/PersonEvaluatorFactory.java#L155-L158 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/Instant.java | Instant.ofEpochMilli | public static Instant ofEpochMilli(long epochMilli) {
"""
Obtains an instance of {@code Instant} using milliseconds from the
epoch of 1970-01-01T00:00:00Z.
<p>
The seconds and nanoseconds are extracted from the specified milliseconds.
@param epochMilli the number of milliseconds from 1970-01-01T00:00:00Z
@return an instant, not null
@throws DateTimeException if the instant exceeds the maximum or minimum instant
"""
long secs = Jdk8Methods.floorDiv(epochMilli, 1000);
int mos = Jdk8Methods.floorMod(epochMilli, 1000);
return create(secs, mos * NANOS_PER_MILLI);
} | java | public static Instant ofEpochMilli(long epochMilli) {
long secs = Jdk8Methods.floorDiv(epochMilli, 1000);
int mos = Jdk8Methods.floorMod(epochMilli, 1000);
return create(secs, mos * NANOS_PER_MILLI);
} | [
"public",
"static",
"Instant",
"ofEpochMilli",
"(",
"long",
"epochMilli",
")",
"{",
"long",
"secs",
"=",
"Jdk8Methods",
".",
"floorDiv",
"(",
"epochMilli",
",",
"1000",
")",
";",
"int",
"mos",
"=",
"Jdk8Methods",
".",
"floorMod",
"(",
"epochMilli",
",",
"1000",
")",
";",
"return",
"create",
"(",
"secs",
",",
"mos",
"*",
"NANOS_PER_MILLI",
")",
";",
"}"
] | Obtains an instance of {@code Instant} using milliseconds from the
epoch of 1970-01-01T00:00:00Z.
<p>
The seconds and nanoseconds are extracted from the specified milliseconds.
@param epochMilli the number of milliseconds from 1970-01-01T00:00:00Z
@return an instant, not null
@throws DateTimeException if the instant exceeds the maximum or minimum instant | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"Instant",
"}",
"using",
"milliseconds",
"from",
"the",
"epoch",
"of",
"1970",
"-",
"01",
"-",
"01T00",
":",
"00",
":",
"00Z",
".",
"<p",
">",
"The",
"seconds",
"and",
"nanoseconds",
"are",
"extracted",
"from",
"the",
"specified",
"milliseconds",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/Instant.java#L315-L319 |
apache/incubator-gobblin | gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryValueInspector.java | InMemoryValueInspector.getResolvedConfig | @Override
public Config getResolvedConfig(final ConfigKeyPath configKey) {
"""
{@inheritDoc}.
<p>
If present in the cache, return the cached {@link com.typesafe.config.Config} for given input
Otherwise, simply delegate the functionality to the internal {ConfigStoreValueInspector} and store the value into cache
</p>
"""
return getResolvedConfig(configKey, Optional.<Config>absent());
} | java | @Override
public Config getResolvedConfig(final ConfigKeyPath configKey) {
return getResolvedConfig(configKey, Optional.<Config>absent());
} | [
"@",
"Override",
"public",
"Config",
"getResolvedConfig",
"(",
"final",
"ConfigKeyPath",
"configKey",
")",
"{",
"return",
"getResolvedConfig",
"(",
"configKey",
",",
"Optional",
".",
"<",
"Config",
">",
"absent",
"(",
")",
")",
";",
"}"
] | {@inheritDoc}.
<p>
If present in the cache, return the cached {@link com.typesafe.config.Config} for given input
Otherwise, simply delegate the functionality to the internal {ConfigStoreValueInspector} and store the value into cache
</p> | [
"{",
"@inheritDoc",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryValueInspector.java#L96-L99 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.checkClassTypeSignature | private static int checkClassTypeSignature(final String signature, int pos) {
"""
Checks a class type signature.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first character after the checked part.
"""
// ClassTypeSignature:
// L Identifier ( / Identifier )* TypeArguments? ( . Identifier
// TypeArguments? )* ;
pos = checkChar('L', signature, pos);
pos = checkIdentifier(signature, pos);
while (getChar(signature, pos) == '/') {
pos = checkIdentifier(signature, pos + 1);
}
if (getChar(signature, pos) == '<') {
pos = checkTypeArguments(signature, pos);
}
while (getChar(signature, pos) == '.') {
pos = checkIdentifier(signature, pos + 1);
if (getChar(signature, pos) == '<') {
pos = checkTypeArguments(signature, pos);
}
}
return checkChar(';', signature, pos);
} | java | private static int checkClassTypeSignature(final String signature, int pos) {
// ClassTypeSignature:
// L Identifier ( / Identifier )* TypeArguments? ( . Identifier
// TypeArguments? )* ;
pos = checkChar('L', signature, pos);
pos = checkIdentifier(signature, pos);
while (getChar(signature, pos) == '/') {
pos = checkIdentifier(signature, pos + 1);
}
if (getChar(signature, pos) == '<') {
pos = checkTypeArguments(signature, pos);
}
while (getChar(signature, pos) == '.') {
pos = checkIdentifier(signature, pos + 1);
if (getChar(signature, pos) == '<') {
pos = checkTypeArguments(signature, pos);
}
}
return checkChar(';', signature, pos);
} | [
"private",
"static",
"int",
"checkClassTypeSignature",
"(",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"// ClassTypeSignature:",
"// L Identifier ( / Identifier )* TypeArguments? ( . Identifier",
"// TypeArguments? )* ;",
"pos",
"=",
"checkChar",
"(",
"'",
"'",
",",
"signature",
",",
"pos",
")",
";",
"pos",
"=",
"checkIdentifier",
"(",
"signature",
",",
"pos",
")",
";",
"while",
"(",
"getChar",
"(",
"signature",
",",
"pos",
")",
"==",
"'",
"'",
")",
"{",
"pos",
"=",
"checkIdentifier",
"(",
"signature",
",",
"pos",
"+",
"1",
")",
";",
"}",
"if",
"(",
"getChar",
"(",
"signature",
",",
"pos",
")",
"==",
"'",
"'",
")",
"{",
"pos",
"=",
"checkTypeArguments",
"(",
"signature",
",",
"pos",
")",
";",
"}",
"while",
"(",
"getChar",
"(",
"signature",
",",
"pos",
")",
"==",
"'",
"'",
")",
"{",
"pos",
"=",
"checkIdentifier",
"(",
"signature",
",",
"pos",
"+",
"1",
")",
";",
"if",
"(",
"getChar",
"(",
"signature",
",",
"pos",
")",
"==",
"'",
"'",
")",
"{",
"pos",
"=",
"checkTypeArguments",
"(",
"signature",
",",
"pos",
")",
";",
"}",
"}",
"return",
"checkChar",
"(",
"'",
"'",
",",
"signature",
",",
"pos",
")",
";",
"}"
] | Checks a class type signature.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first character after the checked part. | [
"Checks",
"a",
"class",
"type",
"signature",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L846-L866 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Maybe.java | Maybe.flattenAsObservable | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final <U> Observable<U> flattenAsObservable(final Function<? super T, ? extends Iterable<? extends U>> mapper) {
"""
Returns an Observable that maps a success value into an Iterable and emits its items.
<p>
<img width="640" height="373" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flattenAsObservable.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code flattenAsObservable} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param <U>
the type of item emitted by the resulting Iterable
@param mapper
a function that returns an Iterable sequence of values for when given an item emitted by the
source Maybe
@return the new Observable instance
@see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a>
"""
ObjectHelper.requireNonNull(mapper, "mapper is null");
return RxJavaPlugins.onAssembly(new MaybeFlatMapIterableObservable<T, U>(this, mapper));
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final <U> Observable<U> flattenAsObservable(final Function<? super T, ? extends Iterable<? extends U>> mapper) {
ObjectHelper.requireNonNull(mapper, "mapper is null");
return RxJavaPlugins.onAssembly(new MaybeFlatMapIterableObservable<T, U>(this, mapper));
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"<",
"U",
">",
"Observable",
"<",
"U",
">",
"flattenAsObservable",
"(",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"Iterable",
"<",
"?",
"extends",
"U",
">",
">",
"mapper",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"mapper",
",",
"\"mapper is null\"",
")",
";",
"return",
"RxJavaPlugins",
".",
"onAssembly",
"(",
"new",
"MaybeFlatMapIterableObservable",
"<",
"T",
",",
"U",
">",
"(",
"this",
",",
"mapper",
")",
")",
";",
"}"
] | Returns an Observable that maps a success value into an Iterable and emits its items.
<p>
<img width="640" height="373" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/flattenAsObservable.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code flattenAsObservable} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param <U>
the type of item emitted by the resulting Iterable
@param mapper
a function that returns an Iterable sequence of values for when given an item emitted by the
source Maybe
@return the new Observable instance
@see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a> | [
"Returns",
"an",
"Observable",
"that",
"maps",
"a",
"success",
"value",
"into",
"an",
"Iterable",
"and",
"emits",
"its",
"items",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"373",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"flattenAsObservable",
".",
"png",
"alt",
"=",
">",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Scheduler",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"{",
"@code",
"flattenAsObservable",
"}",
"does",
"not",
"operate",
"by",
"default",
"on",
"a",
"particular",
"{",
"@link",
"Scheduler",
"}",
".",
"<",
"/",
"dd",
">",
"<",
"/",
"dl",
">"
] | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Maybe.java#L3016-L3021 |
liferay/com-liferay-commerce | commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java | CommerceWishListPersistenceImpl.findByUUID_G | @Override
public CommerceWishList findByUUID_G(String uuid, long groupId)
throws NoSuchWishListException {
"""
Returns the commerce wish list where uuid = ? and groupId = ? or throws a {@link NoSuchWishListException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce wish list
@throws NoSuchWishListException if a matching commerce wish list could not be found
"""
CommerceWishList commerceWishList = fetchByUUID_G(uuid, groupId);
if (commerceWishList == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchWishListException(msg.toString());
}
return commerceWishList;
} | java | @Override
public CommerceWishList findByUUID_G(String uuid, long groupId)
throws NoSuchWishListException {
CommerceWishList commerceWishList = fetchByUUID_G(uuid, groupId);
if (commerceWishList == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchWishListException(msg.toString());
}
return commerceWishList;
} | [
"@",
"Override",
"public",
"CommerceWishList",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchWishListException",
"{",
"CommerceWishList",
"commerceWishList",
"=",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"if",
"(",
"commerceWishList",
"==",
"null",
")",
"{",
"StringBundler",
"msg",
"=",
"new",
"StringBundler",
"(",
"6",
")",
";",
"msg",
".",
"append",
"(",
"_NO_SUCH_ENTITY_WITH_KEY",
")",
";",
"msg",
".",
"append",
"(",
"\"uuid=\"",
")",
";",
"msg",
".",
"append",
"(",
"uuid",
")",
";",
"msg",
".",
"append",
"(",
"\", groupId=\"",
")",
";",
"msg",
".",
"append",
"(",
"groupId",
")",
";",
"msg",
".",
"append",
"(",
"\"}\"",
")",
";",
"if",
"(",
"_log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"_log",
".",
"debug",
"(",
"msg",
".",
"toString",
"(",
")",
")",
";",
"}",
"throw",
"new",
"NoSuchWishListException",
"(",
"msg",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"commerceWishList",
";",
"}"
] | Returns the commerce wish list where uuid = ? and groupId = ? or throws a {@link NoSuchWishListException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce wish list
@throws NoSuchWishListException if a matching commerce wish list could not be found | [
"Returns",
"the",
"commerce",
"wish",
"list",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchWishListException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java#L668-L694 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_screenListConditions_conditions_POST | public OvhEasyHuntingScreenListsConditions billingAccount_easyHunting_serviceName_screenListConditions_conditions_POST(String billingAccount, String serviceName, String callerIdNumber, String destinationNumber, OvhOvhPabxDialplanExtensionConditionScreenListTypeEnum screenListType) throws IOException {
"""
Create a new screenlist condition for an extension
REST: POST /telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions
@param destinationNumber [required] Add a screenlist based on the destination number
@param screenListType [required] Type of screenlist
@param callerIdNumber [required] Add a screenlist based on the presented caller number
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
"""
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "callerIdNumber", callerIdNumber);
addBody(o, "destinationNumber", destinationNumber);
addBody(o, "screenListType", screenListType);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhEasyHuntingScreenListsConditions.class);
} | java | public OvhEasyHuntingScreenListsConditions billingAccount_easyHunting_serviceName_screenListConditions_conditions_POST(String billingAccount, String serviceName, String callerIdNumber, String destinationNumber, OvhOvhPabxDialplanExtensionConditionScreenListTypeEnum screenListType) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "callerIdNumber", callerIdNumber);
addBody(o, "destinationNumber", destinationNumber);
addBody(o, "screenListType", screenListType);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhEasyHuntingScreenListsConditions.class);
} | [
"public",
"OvhEasyHuntingScreenListsConditions",
"billingAccount_easyHunting_serviceName_screenListConditions_conditions_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"callerIdNumber",
",",
"String",
"destinationNumber",
",",
"OvhOvhPabxDialplanExtensionConditionScreenListTypeEnum",
"screenListType",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"billingAccount",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"callerIdNumber\"",
",",
"callerIdNumber",
")",
";",
"addBody",
"(",
"o",
",",
"\"destinationNumber\"",
",",
"destinationNumber",
")",
";",
"addBody",
"(",
"o",
",",
"\"screenListType\"",
",",
"screenListType",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhEasyHuntingScreenListsConditions",
".",
"class",
")",
";",
"}"
] | Create a new screenlist condition for an extension
REST: POST /telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions
@param destinationNumber [required] Add a screenlist based on the destination number
@param screenListType [required] Type of screenlist
@param callerIdNumber [required] Add a screenlist based on the presented caller number
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Create",
"a",
"new",
"screenlist",
"condition",
"for",
"an",
"extension"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3234-L3243 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dimensionalityreduction/PCA.java | PCA.pca2 | public static INDArray pca2(INDArray in, double variance) {
"""
This method performs a dimensionality reduction, including principal components
that cover a fraction of the total variance of the system. It does all calculations
about the mean.
@param in A matrix of datapoints as rows, where column are features with fixed number N
@param variance The desired fraction of the total variance required
@return The reduced basis set
"""
// let's calculate the covariance and the mean
INDArray[] covmean = covarianceMatrix(in);
// use the covariance matrix (inverse) to find "force constants" and then break into orthonormal
// unit vector components
INDArray[] pce = principalComponents(covmean[0]);
// calculate the variance of each component
INDArray vars = Transforms.pow(pce[1], -0.5, true);
double res = vars.sumNumber().doubleValue();
double total = 0.0;
int ndims = 0;
for (int i = 0; i < vars.columns(); i++) {
ndims++;
total += vars.getDouble(i);
if (total / res > variance)
break;
}
INDArray result = Nd4j.create(in.columns(), ndims);
for (int i = 0; i < ndims; i++)
result.putColumn(i, pce[0].getColumn(i));
return result;
} | java | public static INDArray pca2(INDArray in, double variance) {
// let's calculate the covariance and the mean
INDArray[] covmean = covarianceMatrix(in);
// use the covariance matrix (inverse) to find "force constants" and then break into orthonormal
// unit vector components
INDArray[] pce = principalComponents(covmean[0]);
// calculate the variance of each component
INDArray vars = Transforms.pow(pce[1], -0.5, true);
double res = vars.sumNumber().doubleValue();
double total = 0.0;
int ndims = 0;
for (int i = 0; i < vars.columns(); i++) {
ndims++;
total += vars.getDouble(i);
if (total / res > variance)
break;
}
INDArray result = Nd4j.create(in.columns(), ndims);
for (int i = 0; i < ndims; i++)
result.putColumn(i, pce[0].getColumn(i));
return result;
} | [
"public",
"static",
"INDArray",
"pca2",
"(",
"INDArray",
"in",
",",
"double",
"variance",
")",
"{",
"// let's calculate the covariance and the mean",
"INDArray",
"[",
"]",
"covmean",
"=",
"covarianceMatrix",
"(",
"in",
")",
";",
"// use the covariance matrix (inverse) to find \"force constants\" and then break into orthonormal",
"// unit vector components",
"INDArray",
"[",
"]",
"pce",
"=",
"principalComponents",
"(",
"covmean",
"[",
"0",
"]",
")",
";",
"// calculate the variance of each component",
"INDArray",
"vars",
"=",
"Transforms",
".",
"pow",
"(",
"pce",
"[",
"1",
"]",
",",
"-",
"0.5",
",",
"true",
")",
";",
"double",
"res",
"=",
"vars",
".",
"sumNumber",
"(",
")",
".",
"doubleValue",
"(",
")",
";",
"double",
"total",
"=",
"0.0",
";",
"int",
"ndims",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vars",
".",
"columns",
"(",
")",
";",
"i",
"++",
")",
"{",
"ndims",
"++",
";",
"total",
"+=",
"vars",
".",
"getDouble",
"(",
"i",
")",
";",
"if",
"(",
"total",
"/",
"res",
">",
"variance",
")",
"break",
";",
"}",
"INDArray",
"result",
"=",
"Nd4j",
".",
"create",
"(",
"in",
".",
"columns",
"(",
")",
",",
"ndims",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ndims",
";",
"i",
"++",
")",
"result",
".",
"putColumn",
"(",
"i",
",",
"pce",
"[",
"0",
"]",
".",
"getColumn",
"(",
"i",
")",
")",
";",
"return",
"result",
";",
"}"
] | This method performs a dimensionality reduction, including principal components
that cover a fraction of the total variance of the system. It does all calculations
about the mean.
@param in A matrix of datapoints as rows, where column are features with fixed number N
@param variance The desired fraction of the total variance required
@return The reduced basis set | [
"This",
"method",
"performs",
"a",
"dimensionality",
"reduction",
"including",
"principal",
"components",
"that",
"cover",
"a",
"fraction",
"of",
"the",
"total",
"variance",
"of",
"the",
"system",
".",
"It",
"does",
"all",
"calculations",
"about",
"the",
"mean",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dimensionalityreduction/PCA.java#L298-L319 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/NativeAppCallContentProvider.java | NativeAppCallContentProvider.getAttachmentUrl | public static String getAttachmentUrl(String applicationId, UUID callId, String attachmentName) {
"""
Returns the name of the content provider formatted correctly for constructing URLs.
@param applicationId the Facebook application ID of the application
@return the String to use as the authority portion of a content URI.
"""
return String.format("%s%s/%s/%s", ATTACHMENT_URL_BASE, applicationId, callId.toString(), attachmentName);
} | java | public static String getAttachmentUrl(String applicationId, UUID callId, String attachmentName) {
return String.format("%s%s/%s/%s", ATTACHMENT_URL_BASE, applicationId, callId.toString(), attachmentName);
} | [
"public",
"static",
"String",
"getAttachmentUrl",
"(",
"String",
"applicationId",
",",
"UUID",
"callId",
",",
"String",
"attachmentName",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s%s/%s/%s\"",
",",
"ATTACHMENT_URL_BASE",
",",
"applicationId",
",",
"callId",
".",
"toString",
"(",
")",
",",
"attachmentName",
")",
";",
"}"
] | Returns the name of the content provider formatted correctly for constructing URLs.
@param applicationId the Facebook application ID of the application
@return the String to use as the authority portion of a content URI. | [
"Returns",
"the",
"name",
"of",
"the",
"content",
"provider",
"formatted",
"correctly",
"for",
"constructing",
"URLs",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/NativeAppCallContentProvider.java#L70-L72 |
mangstadt/biweekly | src/main/java/biweekly/io/TimezoneInfo.java | TimezoneInfo.removeIdentity | private static <T> void removeIdentity(List<T> list, T object) {
"""
Removes an object from a list using reference equality.
@param list the list
@param object the object to remove
"""
Iterator<T> it = list.iterator();
while (it.hasNext()) {
if (object == it.next()) {
it.remove();
}
}
} | java | private static <T> void removeIdentity(List<T> list, T object) {
Iterator<T> it = list.iterator();
while (it.hasNext()) {
if (object == it.next()) {
it.remove();
}
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"removeIdentity",
"(",
"List",
"<",
"T",
">",
"list",
",",
"T",
"object",
")",
"{",
"Iterator",
"<",
"T",
">",
"it",
"=",
"list",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"object",
"==",
"it",
".",
"next",
"(",
")",
")",
"{",
"it",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}"
] | Removes an object from a list using reference equality.
@param list the list
@param object the object to remove | [
"Removes",
"an",
"object",
"from",
"a",
"list",
"using",
"reference",
"equality",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/TimezoneInfo.java#L282-L289 |
yasserg/crawler4j | crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java | CrawlController.addSeenUrl | public void addSeenUrl(String url, int docId) throws UnsupportedEncodingException {
"""
This function can called to assign a specific document id to a url. This
feature is useful when you have had a previous crawl and have stored the
Urls and their associated document ids and want to have a new crawl which
is aware of the previously seen Urls and won't re-crawl them.
Note that if you add three seen Urls with document ids 1,2, and 7. Then
the next URL that is found during the crawl will get a doc id of 8. Also
you need to ensure to add seen Urls in increasing order of document ids.
@param url
the URL of the page
@param docId
the document id that you want to be assigned to this URL.
@throws UnsupportedEncodingException
"""
String canonicalUrl = URLCanonicalizer.getCanonicalURL(url);
if (canonicalUrl == null) {
logger.error("Invalid Url: {} (can't cannonicalize it!)", url);
} else {
try {
docIdServer.addUrlAndDocId(canonicalUrl, docId);
} catch (RuntimeException e) {
if (config.isHaltOnError()) {
throw e;
} else {
logger.error("Could not add seen url: {}", e.getMessage());
}
}
}
} | java | public void addSeenUrl(String url, int docId) throws UnsupportedEncodingException {
String canonicalUrl = URLCanonicalizer.getCanonicalURL(url);
if (canonicalUrl == null) {
logger.error("Invalid Url: {} (can't cannonicalize it!)", url);
} else {
try {
docIdServer.addUrlAndDocId(canonicalUrl, docId);
} catch (RuntimeException e) {
if (config.isHaltOnError()) {
throw e;
} else {
logger.error("Could not add seen url: {}", e.getMessage());
}
}
}
} | [
"public",
"void",
"addSeenUrl",
"(",
"String",
"url",
",",
"int",
"docId",
")",
"throws",
"UnsupportedEncodingException",
"{",
"String",
"canonicalUrl",
"=",
"URLCanonicalizer",
".",
"getCanonicalURL",
"(",
"url",
")",
";",
"if",
"(",
"canonicalUrl",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"Invalid Url: {} (can't cannonicalize it!)\"",
",",
"url",
")",
";",
"}",
"else",
"{",
"try",
"{",
"docIdServer",
".",
"addUrlAndDocId",
"(",
"canonicalUrl",
",",
"docId",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"if",
"(",
"config",
".",
"isHaltOnError",
"(",
")",
")",
"{",
"throw",
"e",
";",
"}",
"else",
"{",
"logger",
".",
"error",
"(",
"\"Could not add seen url: {}\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
] | This function can called to assign a specific document id to a url. This
feature is useful when you have had a previous crawl and have stored the
Urls and their associated document ids and want to have a new crawl which
is aware of the previously seen Urls and won't re-crawl them.
Note that if you add three seen Urls with document ids 1,2, and 7. Then
the next URL that is found during the crawl will get a doc id of 8. Also
you need to ensure to add seen Urls in increasing order of document ids.
@param url
the URL of the page
@param docId
the document id that you want to be assigned to this URL.
@throws UnsupportedEncodingException | [
"This",
"function",
"can",
"called",
"to",
"assign",
"a",
"specific",
"document",
"id",
"to",
"a",
"url",
".",
"This",
"feature",
"is",
"useful",
"when",
"you",
"have",
"had",
"a",
"previous",
"crawl",
"and",
"have",
"stored",
"the",
"Urls",
"and",
"their",
"associated",
"document",
"ids",
"and",
"want",
"to",
"have",
"a",
"new",
"crawl",
"which",
"is",
"aware",
"of",
"the",
"previously",
"seen",
"Urls",
"and",
"won",
"t",
"re",
"-",
"crawl",
"them",
"."
] | train | https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java#L568-L583 |
mongodb/stitch-android-sdk | server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java | RemoteMongoCollectionImpl.findOneAndReplace | public DocumentT findOneAndReplace(final Bson filter, final Bson replacement) {
"""
Finds a document in the collection and replaces it with the given document
@param filter the query filter
@param replacement the document to replace the matched document with
@return the resulting document
"""
return proxy.findOneAndReplace(filter, replacement);
} | java | public DocumentT findOneAndReplace(final Bson filter, final Bson replacement) {
return proxy.findOneAndReplace(filter, replacement);
} | [
"public",
"DocumentT",
"findOneAndReplace",
"(",
"final",
"Bson",
"filter",
",",
"final",
"Bson",
"replacement",
")",
"{",
"return",
"proxy",
".",
"findOneAndReplace",
"(",
"filter",
",",
"replacement",
")",
";",
"}"
] | Finds a document in the collection and replaces it with the given document
@param filter the query filter
@param replacement the document to replace the matched document with
@return the resulting document | [
"Finds",
"a",
"document",
"in",
"the",
"collection",
"and",
"replaces",
"it",
"with",
"the",
"given",
"document"
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java#L425-L427 |
landawn/AbacusUtil | src/com/landawn/abacus/util/URLEncodedUtil.java | URLEncodedUtil.encodeFormFields | private static void encodeFormFields(final StringBuilder sb, final String content, final Charset charset) {
"""
Encode/escape www-url-form-encoded content.
<p>
Uses the {@link #URLENCODER} set of characters, rather than the {@link #UNRSERVED} set; this is for compatibilty
with previous releases, URLEncoder.encode() and most browsers.
@param content
the content to encode, will convert space to '+'
@param charset
the charset to use
@return encoded string
"""
urlEncode(sb, content, (charset != null) ? charset : Charsets.UTF_8, URLENCODER, true);
} | java | private static void encodeFormFields(final StringBuilder sb, final String content, final Charset charset) {
urlEncode(sb, content, (charset != null) ? charset : Charsets.UTF_8, URLENCODER, true);
} | [
"private",
"static",
"void",
"encodeFormFields",
"(",
"final",
"StringBuilder",
"sb",
",",
"final",
"String",
"content",
",",
"final",
"Charset",
"charset",
")",
"{",
"urlEncode",
"(",
"sb",
",",
"content",
",",
"(",
"charset",
"!=",
"null",
")",
"?",
"charset",
":",
"Charsets",
".",
"UTF_8",
",",
"URLENCODER",
",",
"true",
")",
";",
"}"
] | Encode/escape www-url-form-encoded content.
<p>
Uses the {@link #URLENCODER} set of characters, rather than the {@link #UNRSERVED} set; this is for compatibilty
with previous releases, URLEncoder.encode() and most browsers.
@param content
the content to encode, will convert space to '+'
@param charset
the charset to use
@return encoded string | [
"Encode",
"/",
"escape",
"www",
"-",
"url",
"-",
"form",
"-",
"encoded",
"content",
".",
"<p",
">",
"Uses",
"the",
"{",
"@link",
"#URLENCODER",
"}",
"set",
"of",
"characters",
"rather",
"than",
"the",
"{",
"@link",
"#UNRSERVED",
"}",
"set",
";",
"this",
"is",
"for",
"compatibilty",
"with",
"previous",
"releases",
"URLEncoder",
".",
"encode",
"()",
"and",
"most",
"browsers",
".",
"@param",
"content",
"the",
"content",
"to",
"encode",
"will",
"convert",
"space",
"to",
"+",
"@param",
"charset",
"the",
"charset",
"to",
"use"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/URLEncodedUtil.java#L472-L474 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/DataCubeAPI.java | DataCubeAPI.getCardMemberCardInfo | public static MemberCardInfoResult getCardMemberCardInfo(String access_token, MemberCardInfo memberCardCube) {
"""
拉取会员卡数据<br>
1. 查询时间区间需<=62天,否则报错;<br>
2. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;<br>
3. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。<br>
@param access_token access_token
@param memberCardCube memberCardCube
@return result
"""
return getCardMemberCardInfo(access_token, JsonUtil.toJSONString(memberCardCube));
} | java | public static MemberCardInfoResult getCardMemberCardInfo(String access_token, MemberCardInfo memberCardCube) {
return getCardMemberCardInfo(access_token, JsonUtil.toJSONString(memberCardCube));
} | [
"public",
"static",
"MemberCardInfoResult",
"getCardMemberCardInfo",
"(",
"String",
"access_token",
",",
"MemberCardInfo",
"memberCardCube",
")",
"{",
"return",
"getCardMemberCardInfo",
"(",
"access_token",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"memberCardCube",
")",
")",
";",
"}"
] | 拉取会员卡数据<br>
1. 查询时间区间需<=62天,否则报错;<br>
2. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;<br>
3. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。<br>
@param access_token access_token
@param memberCardCube memberCardCube
@return result | [
"拉取会员卡数据<br",
">",
"1",
".",
"查询时间区间需<",
";",
"=",
"62天,否则报错;<br",
">",
"2",
".",
"传入时间格式需严格参照示例填写如”2015",
"-",
"06",
"-",
"15”,否则报错;<br",
">",
"3",
".",
"该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。<br",
">"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/DataCubeAPI.java#L114-L116 |
casmi/casmi | src/main/java/casmi/graphics/Graphics.java | Graphics.setBackground | public void setBackground(float x, float y, float z, float a) {
"""
Sets the background to a RGB and alpha value.
@param x
The R value of the background.
@param y
The G value of the background.
@param z
The B value of the background.
@param a
The alpha opacity of the background.
"""
gl.glClearColor(x / 255, y / 255, z / 255, a / 255);
} | java | public void setBackground(float x, float y, float z, float a) {
gl.glClearColor(x / 255, y / 255, z / 255, a / 255);
} | [
"public",
"void",
"setBackground",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
",",
"float",
"a",
")",
"{",
"gl",
".",
"glClearColor",
"(",
"x",
"/",
"255",
",",
"y",
"/",
"255",
",",
"z",
"/",
"255",
",",
"a",
"/",
"255",
")",
";",
"}"
] | Sets the background to a RGB and alpha value.
@param x
The R value of the background.
@param y
The G value of the background.
@param z
The B value of the background.
@param a
The alpha opacity of the background. | [
"Sets",
"the",
"background",
"to",
"a",
"RGB",
"and",
"alpha",
"value",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/Graphics.java#L174-L176 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapCircle.java | MapCircle.intersects | @Override
@Pure
public boolean intersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
"""
Replies if this element has an intersection
with the specified rectangle.
@return <code>true</code> if this MapElement is intersecting the specified area,
otherwise <code>false</code>
"""
if (boundsIntersects(rectangle)) {
final double x = getX();
final double y = getY();
final Rectangle2afp<?, ?, ?, ?, ?, ?> box = rectangle.toBoundingBox();
final double minx = box.getMinX();
final double miny = box.getMinY();
final double maxx = box.getMaxX();
final double maxy = box.getMaxY();
return MathUtil.min(
Segment2afp.calculatesDistanceSegmentPoint(minx, miny, maxx, miny, x, y),
Segment2afp.calculatesDistanceSegmentPoint(minx, miny, minx, maxy, x, y),
Segment2afp.calculatesDistanceSegmentPoint(maxx, miny, maxx, maxy, x, y),
Segment2afp.calculatesDistanceSegmentPoint(minx, maxy, maxx, maxy, x, y)) <= this.radius;
}
return false;
} | java | @Override
@Pure
public boolean intersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
if (boundsIntersects(rectangle)) {
final double x = getX();
final double y = getY();
final Rectangle2afp<?, ?, ?, ?, ?, ?> box = rectangle.toBoundingBox();
final double minx = box.getMinX();
final double miny = box.getMinY();
final double maxx = box.getMaxX();
final double maxy = box.getMaxY();
return MathUtil.min(
Segment2afp.calculatesDistanceSegmentPoint(minx, miny, maxx, miny, x, y),
Segment2afp.calculatesDistanceSegmentPoint(minx, miny, minx, maxy, x, y),
Segment2afp.calculatesDistanceSegmentPoint(maxx, miny, maxx, maxy, x, y),
Segment2afp.calculatesDistanceSegmentPoint(minx, maxy, maxx, maxy, x, y)) <= this.radius;
}
return false;
} | [
"@",
"Override",
"@",
"Pure",
"public",
"boolean",
"intersects",
"(",
"Shape2D",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
"extends",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
">",
"rectangle",
")",
"{",
"if",
"(",
"boundsIntersects",
"(",
"rectangle",
")",
")",
"{",
"final",
"double",
"x",
"=",
"getX",
"(",
")",
";",
"final",
"double",
"y",
"=",
"getY",
"(",
")",
";",
"final",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"box",
"=",
"rectangle",
".",
"toBoundingBox",
"(",
")",
";",
"final",
"double",
"minx",
"=",
"box",
".",
"getMinX",
"(",
")",
";",
"final",
"double",
"miny",
"=",
"box",
".",
"getMinY",
"(",
")",
";",
"final",
"double",
"maxx",
"=",
"box",
".",
"getMaxX",
"(",
")",
";",
"final",
"double",
"maxy",
"=",
"box",
".",
"getMaxY",
"(",
")",
";",
"return",
"MathUtil",
".",
"min",
"(",
"Segment2afp",
".",
"calculatesDistanceSegmentPoint",
"(",
"minx",
",",
"miny",
",",
"maxx",
",",
"miny",
",",
"x",
",",
"y",
")",
",",
"Segment2afp",
".",
"calculatesDistanceSegmentPoint",
"(",
"minx",
",",
"miny",
",",
"minx",
",",
"maxy",
",",
"x",
",",
"y",
")",
",",
"Segment2afp",
".",
"calculatesDistanceSegmentPoint",
"(",
"maxx",
",",
"miny",
",",
"maxx",
",",
"maxy",
",",
"x",
",",
"y",
")",
",",
"Segment2afp",
".",
"calculatesDistanceSegmentPoint",
"(",
"minx",
",",
"maxy",
",",
"maxx",
",",
"maxy",
",",
"x",
",",
"y",
")",
")",
"<=",
"this",
".",
"radius",
";",
"}",
"return",
"false",
";",
"}"
] | Replies if this element has an intersection
with the specified rectangle.
@return <code>true</code> if this MapElement is intersecting the specified area,
otherwise <code>false</code> | [
"Replies",
"if",
"this",
"element",
"has",
"an",
"intersection",
"with",
"the",
"specified",
"rectangle",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapCircle.java#L324-L343 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/CopyStringHandler.java | CopyStringHandler.init | public void init(BaseField field, BaseField fldDest, String stringValue, Converter convCheckMark) {
"""
Constructor.
@param field The basefield owner of this listener (usually null and set on setOwner()).
@param fldDest The destination field.
@param stringValue The string to set the destination field to.
@param convconvCheckMark If this evaluates to false, don't do the move.
"""
super.init(field, fldDest, stringValue, convCheckMark);
} | java | public void init(BaseField field, BaseField fldDest, String stringValue, Converter convCheckMark)
{
super.init(field, fldDest, stringValue, convCheckMark);
} | [
"public",
"void",
"init",
"(",
"BaseField",
"field",
",",
"BaseField",
"fldDest",
",",
"String",
"stringValue",
",",
"Converter",
"convCheckMark",
")",
"{",
"super",
".",
"init",
"(",
"field",
",",
"fldDest",
",",
"stringValue",
",",
"convCheckMark",
")",
";",
"}"
] | Constructor.
@param field The basefield owner of this listener (usually null and set on setOwner()).
@param fldDest The destination field.
@param stringValue The string to set the destination field to.
@param convconvCheckMark If this evaluates to false, don't do the move. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CopyStringHandler.java#L51-L54 |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java | SharedBuffer.upsertEntry | void upsertEntry(NodeId nodeId, Lockable<SharedBufferNode> entry) {
"""
Inserts or updates a shareBufferNode in cache.
@param nodeId id of the event
@param entry SharedBufferNode
"""
this.entryCache.put(nodeId, entry);
} | java | void upsertEntry(NodeId nodeId, Lockable<SharedBufferNode> entry) {
this.entryCache.put(nodeId, entry);
} | [
"void",
"upsertEntry",
"(",
"NodeId",
"nodeId",
",",
"Lockable",
"<",
"SharedBufferNode",
">",
"entry",
")",
"{",
"this",
".",
"entryCache",
".",
"put",
"(",
"nodeId",
",",
"entry",
")",
";",
"}"
] | Inserts or updates a shareBufferNode in cache.
@param nodeId id of the event
@param entry SharedBufferNode | [
"Inserts",
"or",
"updates",
"a",
"shareBufferNode",
"in",
"cache",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java#L172-L174 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper._hasSideEffects | protected Boolean _hasSideEffects(XForLoopExpression expression, ISideEffectContext context) {
"""
Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects.
"""
context.open();
if (hasSideEffects(expression.getForExpression(), context)) {
return true;
}
context.close();
return hasSideEffects(expression.getEachExpression(), context.branch());
} | java | protected Boolean _hasSideEffects(XForLoopExpression expression, ISideEffectContext context) {
context.open();
if (hasSideEffects(expression.getForExpression(), context)) {
return true;
}
context.close();
return hasSideEffects(expression.getEachExpression(), context.branch());
} | [
"protected",
"Boolean",
"_hasSideEffects",
"(",
"XForLoopExpression",
"expression",
",",
"ISideEffectContext",
"context",
")",
"{",
"context",
".",
"open",
"(",
")",
";",
"if",
"(",
"hasSideEffects",
"(",
"expression",
".",
"getForExpression",
"(",
")",
",",
"context",
")",
")",
"{",
"return",
"true",
";",
"}",
"context",
".",
"close",
"(",
")",
";",
"return",
"hasSideEffects",
"(",
"expression",
".",
"getEachExpression",
"(",
")",
",",
"context",
".",
"branch",
"(",
")",
")",
";",
"}"
] | Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects. | [
"Test",
"if",
"the",
"given",
"expression",
"has",
"side",
"effects",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L302-L309 |
groupon/odo | common/src/main/java/com/groupon/odo/common/Common.java | Common.set_json_value | @ResponseOverride(
description = "Set a JSON value.",
parameters = {
"""
Set a JSON value. You can access array elements by including regex index in the path. Ex: root.objectArray[0] or root.objectArray[\d]
@param args
@param name
@param value
@param path
@throws Exception
""""name", "value", "path"}
)
public static void set_json_value(PluginArguments args, String name, String value, String path) throws Exception {
HttpServletResponse response = args.getResponse();
String content = PluginHelper.readResponseContent(response);
JSONObject jsonContent = new JSONObject(content);
process_json_value(jsonContent, name, value, path, true);
PluginHelper.writeResponseContent(response, jsonContent.toString());
} | java | @ResponseOverride(
description = "Set a JSON value.",
parameters = {"name", "value", "path"}
)
public static void set_json_value(PluginArguments args, String name, String value, String path) throws Exception {
HttpServletResponse response = args.getResponse();
String content = PluginHelper.readResponseContent(response);
JSONObject jsonContent = new JSONObject(content);
process_json_value(jsonContent, name, value, path, true);
PluginHelper.writeResponseContent(response, jsonContent.toString());
} | [
"@",
"ResponseOverride",
"(",
"description",
"=",
"\"Set a JSON value.\"",
",",
"parameters",
"=",
"{",
"\"name\"",
",",
"\"value\"",
",",
"\"path\"",
"}",
")",
"public",
"static",
"void",
"set_json_value",
"(",
"PluginArguments",
"args",
",",
"String",
"name",
",",
"String",
"value",
",",
"String",
"path",
")",
"throws",
"Exception",
"{",
"HttpServletResponse",
"response",
"=",
"args",
".",
"getResponse",
"(",
")",
";",
"String",
"content",
"=",
"PluginHelper",
".",
"readResponseContent",
"(",
"response",
")",
";",
"JSONObject",
"jsonContent",
"=",
"new",
"JSONObject",
"(",
"content",
")",
";",
"process_json_value",
"(",
"jsonContent",
",",
"name",
",",
"value",
",",
"path",
",",
"true",
")",
";",
"PluginHelper",
".",
"writeResponseContent",
"(",
"response",
",",
"jsonContent",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Set a JSON value. You can access array elements by including regex index in the path. Ex: root.objectArray[0] or root.objectArray[\d]
@param args
@param name
@param value
@param path
@throws Exception | [
"Set",
"a",
"JSON",
"value",
".",
"You",
"can",
"access",
"array",
"elements",
"by",
"including",
"regex",
"index",
"in",
"the",
"path",
".",
"Ex",
":",
"root",
".",
"objectArray",
"[",
"0",
"]",
"or",
"root",
".",
"objectArray",
"[",
"\\",
"d",
"]"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/common/src/main/java/com/groupon/odo/common/Common.java#L176-L187 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java | BitsUtil.hammingDistance | public static int hammingDistance(long[] x, long[] y) {
"""
Compute the Hamming distance (Size of symmetric difference), i.e.
{@code cardinality(a ^ b)}.
@param x First vector
@param y Second vector
@return Cardinality of symmetric difference
"""
final int lx = x.length, ly = y.length;
final int min = (lx < ly) ? lx : ly;
int i = 0, h = 0;
for(; i < min; i++) {
h += Long.bitCount(x[i] ^ y[i]);
}
for(; i < lx; i++) {
h += Long.bitCount(x[i]);
}
for(; i < ly; i++) {
h += Long.bitCount(y[i]);
}
return h;
} | java | public static int hammingDistance(long[] x, long[] y) {
final int lx = x.length, ly = y.length;
final int min = (lx < ly) ? lx : ly;
int i = 0, h = 0;
for(; i < min; i++) {
h += Long.bitCount(x[i] ^ y[i]);
}
for(; i < lx; i++) {
h += Long.bitCount(x[i]);
}
for(; i < ly; i++) {
h += Long.bitCount(y[i]);
}
return h;
} | [
"public",
"static",
"int",
"hammingDistance",
"(",
"long",
"[",
"]",
"x",
",",
"long",
"[",
"]",
"y",
")",
"{",
"final",
"int",
"lx",
"=",
"x",
".",
"length",
",",
"ly",
"=",
"y",
".",
"length",
";",
"final",
"int",
"min",
"=",
"(",
"lx",
"<",
"ly",
")",
"?",
"lx",
":",
"ly",
";",
"int",
"i",
"=",
"0",
",",
"h",
"=",
"0",
";",
"for",
"(",
";",
"i",
"<",
"min",
";",
"i",
"++",
")",
"{",
"h",
"+=",
"Long",
".",
"bitCount",
"(",
"x",
"[",
"i",
"]",
"^",
"y",
"[",
"i",
"]",
")",
";",
"}",
"for",
"(",
";",
"i",
"<",
"lx",
";",
"i",
"++",
")",
"{",
"h",
"+=",
"Long",
".",
"bitCount",
"(",
"x",
"[",
"i",
"]",
")",
";",
"}",
"for",
"(",
";",
"i",
"<",
"ly",
";",
"i",
"++",
")",
"{",
"h",
"+=",
"Long",
".",
"bitCount",
"(",
"y",
"[",
"i",
"]",
")",
";",
"}",
"return",
"h",
";",
"}"
] | Compute the Hamming distance (Size of symmetric difference), i.e.
{@code cardinality(a ^ b)}.
@param x First vector
@param y Second vector
@return Cardinality of symmetric difference | [
"Compute",
"the",
"Hamming",
"distance",
"(",
"Size",
"of",
"symmetric",
"difference",
")",
"i",
".",
"e",
".",
"{",
"@code",
"cardinality",
"(",
"a",
"^",
"b",
")",
"}",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java#L1526-L1540 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/SavedRevision.java | SavedRevision.createRevision | @InterfaceAudience.Public
public SavedRevision createRevision(Map<String, Object> properties) throws CouchbaseLiteException {
"""
Creates and saves a new revision with the given properties.
This will fail with a 412 error if the receiver is not the current revision of the document.
"""
boolean allowConflict = false;
return document.putProperties(properties, revisionInternal.getRevID(), allowConflict);
} | java | @InterfaceAudience.Public
public SavedRevision createRevision(Map<String, Object> properties) throws CouchbaseLiteException {
boolean allowConflict = false;
return document.putProperties(properties, revisionInternal.getRevID(), allowConflict);
} | [
"@",
"InterfaceAudience",
".",
"Public",
"public",
"SavedRevision",
"createRevision",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"CouchbaseLiteException",
"{",
"boolean",
"allowConflict",
"=",
"false",
";",
"return",
"document",
".",
"putProperties",
"(",
"properties",
",",
"revisionInternal",
".",
"getRevID",
"(",
")",
",",
"allowConflict",
")",
";",
"}"
] | Creates and saves a new revision with the given properties.
This will fail with a 412 error if the receiver is not the current revision of the document. | [
"Creates",
"and",
"saves",
"a",
"new",
"revision",
"with",
"the",
"given",
"properties",
".",
"This",
"will",
"fail",
"with",
"a",
"412",
"error",
"if",
"the",
"receiver",
"is",
"not",
"the",
"current",
"revision",
"of",
"the",
"document",
"."
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/SavedRevision.java#L121-L125 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java | MultiUserChat.changeAffiliationByAdmin | private void changeAffiliationByAdmin(Jid jid, MUCAffiliation affiliation)
throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException {
"""
Tries to change the affiliation with an 'muc#admin' namespace
@param jid
@param affiliation
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
"""
changeAffiliationByAdmin(jid, affiliation, null);
} | java | private void changeAffiliationByAdmin(Jid jid, MUCAffiliation affiliation)
throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, affiliation, null);
} | [
"private",
"void",
"changeAffiliationByAdmin",
"(",
"Jid",
"jid",
",",
"MUCAffiliation",
"affiliation",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"changeAffiliationByAdmin",
"(",
"jid",
",",
"affiliation",
",",
"null",
")",
";",
"}"
] | Tries to change the affiliation with an 'muc#admin' namespace
@param jid
@param affiliation
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Tries",
"to",
"change",
"the",
"affiliation",
"with",
"an",
"muc#admin",
"namespace"
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java#L1597-L1601 |
alipay/sofa-rpc | extension-impl/remoting-resteasy/src/main/java/com/alipay/sofa/rpc/server/rest/SofaNettyJaxrsServer.java | SofaNettyJaxrsServer.setChildChannelOptions | public void setChildChannelOptions(final Map<ChannelOption, Object> channelOptions) {
"""
Add child options to the {@link io.netty.bootstrap.ServerBootstrap}.
@param channelOptions the additional child {@link io.netty.channel.ChannelOption}s.
@see io.netty.bootstrap.ServerBootstrap#childOption(io.netty.channel.ChannelOption, Object)
"""
this.childChannelOptions = channelOptions == null ? Collections.<ChannelOption, Object> emptyMap()
: channelOptions;
} | java | public void setChildChannelOptions(final Map<ChannelOption, Object> channelOptions) {
this.childChannelOptions = channelOptions == null ? Collections.<ChannelOption, Object> emptyMap()
: channelOptions;
} | [
"public",
"void",
"setChildChannelOptions",
"(",
"final",
"Map",
"<",
"ChannelOption",
",",
"Object",
">",
"channelOptions",
")",
"{",
"this",
".",
"childChannelOptions",
"=",
"channelOptions",
"==",
"null",
"?",
"Collections",
".",
"<",
"ChannelOption",
",",
"Object",
">",
"emptyMap",
"(",
")",
":",
"channelOptions",
";",
"}"
] | Add child options to the {@link io.netty.bootstrap.ServerBootstrap}.
@param channelOptions the additional child {@link io.netty.channel.ChannelOption}s.
@see io.netty.bootstrap.ServerBootstrap#childOption(io.netty.channel.ChannelOption, Object) | [
"Add",
"child",
"options",
"to",
"the",
"{",
"@link",
"io",
".",
"netty",
".",
"bootstrap",
".",
"ServerBootstrap",
"}",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-resteasy/src/main/java/com/alipay/sofa/rpc/server/rest/SofaNettyJaxrsServer.java#L186-L189 |
threerings/nenya | core/src/main/java/com/threerings/miso/client/MisoScenePanel.java | MisoScenePanel.paintTiles | protected void paintTiles (Graphics2D gfx, Rectangle clip) {
"""
Renders the base and fringe layer tiles that intersect the
specified clipping rectangle.
"""
// go through rendering our tiles
_paintOp.setGraphics(gfx);
_applicator.applyToTiles(clip, _paintOp);
_paintOp.setGraphics(null);
} | java | protected void paintTiles (Graphics2D gfx, Rectangle clip)
{
// go through rendering our tiles
_paintOp.setGraphics(gfx);
_applicator.applyToTiles(clip, _paintOp);
_paintOp.setGraphics(null);
} | [
"protected",
"void",
"paintTiles",
"(",
"Graphics2D",
"gfx",
",",
"Rectangle",
"clip",
")",
"{",
"// go through rendering our tiles",
"_paintOp",
".",
"setGraphics",
"(",
"gfx",
")",
";",
"_applicator",
".",
"applyToTiles",
"(",
"clip",
",",
"_paintOp",
")",
";",
"_paintOp",
".",
"setGraphics",
"(",
"null",
")",
";",
"}"
] | Renders the base and fringe layer tiles that intersect the
specified clipping rectangle. | [
"Renders",
"the",
"base",
"and",
"fringe",
"layer",
"tiles",
"that",
"intersect",
"the",
"specified",
"clipping",
"rectangle",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1361-L1367 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jspeex/SpeexMediaManager.java | SpeexMediaManager.createMediaSession | @Override
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
"""
Returns a new jingleMediaSession.
@param payloadType payloadType
@param remote remote Candidate
@param local local Candidate
@return JingleMediaSession
"""
return new AudioMediaSession(payloadType, remote, local, null,null);
} | java | @Override
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
return new AudioMediaSession(payloadType, remote, local, null,null);
} | [
"@",
"Override",
"public",
"JingleMediaSession",
"createMediaSession",
"(",
"PayloadType",
"payloadType",
",",
"final",
"TransportCandidate",
"remote",
",",
"final",
"TransportCandidate",
"local",
",",
"final",
"JingleSession",
"jingleSession",
")",
"{",
"return",
"new",
"AudioMediaSession",
"(",
"payloadType",
",",
"remote",
",",
"local",
",",
"null",
",",
"null",
")",
";",
"}"
] | Returns a new jingleMediaSession.
@param payloadType payloadType
@param remote remote Candidate
@param local local Candidate
@return JingleMediaSession | [
"Returns",
"a",
"new",
"jingleMediaSession",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jspeex/SpeexMediaManager.java#L63-L66 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.importData | @SuppressWarnings("rawtypes")
public static int importData(final DataSet dataset, final int offset, final int count, final PreparedStatement stmt, final int batchSize,
final int batchInterval, final Map<String, ? extends Type> columnTypeMap) throws UncheckedSQLException {
"""
Imports the data from <code>DataSet</code> to database.
@param dataset
@param offset
@param count
@param stmt the column order in the sql must be consistent with the column order in the DataSet.
@param columnTypeMap
@param filter
@return
@throws UncheckedSQLException
"""
return importData(dataset, offset, count, Fn.alwaysTrue(), stmt, batchSize, batchInterval, columnTypeMap);
} | java | @SuppressWarnings("rawtypes")
public static int importData(final DataSet dataset, final int offset, final int count, final PreparedStatement stmt, final int batchSize,
final int batchInterval, final Map<String, ? extends Type> columnTypeMap) throws UncheckedSQLException {
return importData(dataset, offset, count, Fn.alwaysTrue(), stmt, batchSize, batchInterval, columnTypeMap);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"int",
"importData",
"(",
"final",
"DataSet",
"dataset",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"count",
",",
"final",
"PreparedStatement",
"stmt",
",",
"final",
"int",
"batchSize",
",",
"final",
"int",
"batchInterval",
",",
"final",
"Map",
"<",
"String",
",",
"?",
"extends",
"Type",
">",
"columnTypeMap",
")",
"throws",
"UncheckedSQLException",
"{",
"return",
"importData",
"(",
"dataset",
",",
"offset",
",",
"count",
",",
"Fn",
".",
"alwaysTrue",
"(",
")",
",",
"stmt",
",",
"batchSize",
",",
"batchInterval",
",",
"columnTypeMap",
")",
";",
"}"
] | Imports the data from <code>DataSet</code> to database.
@param dataset
@param offset
@param count
@param stmt the column order in the sql must be consistent with the column order in the DataSet.
@param columnTypeMap
@param filter
@return
@throws UncheckedSQLException | [
"Imports",
"the",
"data",
"from",
"<code",
">",
"DataSet<",
"/",
"code",
">",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2295-L2299 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/ner/CMMClassifier.java | CMMClassifier.getDataset | public Dataset<String, String> getDataset(ObjectBank<List<IN>> data, Dataset<String, String> origDataset) {
"""
Build a Dataset from some data. Used for training a classifier.
By passing in an extra origDataset, you can get a Dataset based on featureIndex and
classIndex in an existing origDataset.
@param data This variable is a list of lists of CoreLabel. That is,
it is a collection of documents, each of which is represented
as a sequence of CoreLabel objects.
@param origDataset if you want to get a Dataset based on featureIndex and
classIndex in an existing origDataset
@return The Dataset which is an efficient encoding of the information
in a List of Datums
"""
if(origDataset == null) {
return getDataset(data);
}
return getDataset(data, origDataset.featureIndex, origDataset.labelIndex);
} | java | public Dataset<String, String> getDataset(ObjectBank<List<IN>> data, Dataset<String, String> origDataset) {
if(origDataset == null) {
return getDataset(data);
}
return getDataset(data, origDataset.featureIndex, origDataset.labelIndex);
} | [
"public",
"Dataset",
"<",
"String",
",",
"String",
">",
"getDataset",
"(",
"ObjectBank",
"<",
"List",
"<",
"IN",
">",
">",
"data",
",",
"Dataset",
"<",
"String",
",",
"String",
">",
"origDataset",
")",
"{",
"if",
"(",
"origDataset",
"==",
"null",
")",
"{",
"return",
"getDataset",
"(",
"data",
")",
";",
"}",
"return",
"getDataset",
"(",
"data",
",",
"origDataset",
".",
"featureIndex",
",",
"origDataset",
".",
"labelIndex",
")",
";",
"}"
] | Build a Dataset from some data. Used for training a classifier.
By passing in an extra origDataset, you can get a Dataset based on featureIndex and
classIndex in an existing origDataset.
@param data This variable is a list of lists of CoreLabel. That is,
it is a collection of documents, each of which is represented
as a sequence of CoreLabel objects.
@param origDataset if you want to get a Dataset based on featureIndex and
classIndex in an existing origDataset
@return The Dataset which is an efficient encoding of the information
in a List of Datums | [
"Build",
"a",
"Dataset",
"from",
"some",
"data",
".",
"Used",
"for",
"training",
"a",
"classifier",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/ner/CMMClassifier.java#L774-L779 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/DateUtils.java | DateUtils.subMonths | public static long subMonths(final Date date1, final Date date2) {
"""
Get how many months between two date.
@param date1 date to be tested.
@param date2 date to be tested.
@return how many months between two date.
"""
Calendar calendar1 = buildCalendar(date1);
int monthOfDate1 = calendar1.get(Calendar.MONTH);
int yearOfDate1 = calendar1.get(Calendar.YEAR);
Calendar calendar2 = buildCalendar(date2);
int monthOfDate2 = calendar2.get(Calendar.MONTH);
int yearOfDate2 = calendar2.get(Calendar.YEAR);
int subMonth = Math.abs(monthOfDate1 - monthOfDate2);
int subYear = Math.abs(yearOfDate1 - yearOfDate2);
return subYear * 12 + subMonth;
} | java | public static long subMonths(final Date date1, final Date date2) {
Calendar calendar1 = buildCalendar(date1);
int monthOfDate1 = calendar1.get(Calendar.MONTH);
int yearOfDate1 = calendar1.get(Calendar.YEAR);
Calendar calendar2 = buildCalendar(date2);
int monthOfDate2 = calendar2.get(Calendar.MONTH);
int yearOfDate2 = calendar2.get(Calendar.YEAR);
int subMonth = Math.abs(monthOfDate1 - monthOfDate2);
int subYear = Math.abs(yearOfDate1 - yearOfDate2);
return subYear * 12 + subMonth;
} | [
"public",
"static",
"long",
"subMonths",
"(",
"final",
"Date",
"date1",
",",
"final",
"Date",
"date2",
")",
"{",
"Calendar",
"calendar1",
"=",
"buildCalendar",
"(",
"date1",
")",
";",
"int",
"monthOfDate1",
"=",
"calendar1",
".",
"get",
"(",
"Calendar",
".",
"MONTH",
")",
";",
"int",
"yearOfDate1",
"=",
"calendar1",
".",
"get",
"(",
"Calendar",
".",
"YEAR",
")",
";",
"Calendar",
"calendar2",
"=",
"buildCalendar",
"(",
"date2",
")",
";",
"int",
"monthOfDate2",
"=",
"calendar2",
".",
"get",
"(",
"Calendar",
".",
"MONTH",
")",
";",
"int",
"yearOfDate2",
"=",
"calendar2",
".",
"get",
"(",
"Calendar",
".",
"YEAR",
")",
";",
"int",
"subMonth",
"=",
"Math",
".",
"abs",
"(",
"monthOfDate1",
"-",
"monthOfDate2",
")",
";",
"int",
"subYear",
"=",
"Math",
".",
"abs",
"(",
"yearOfDate1",
"-",
"yearOfDate2",
")",
";",
"return",
"subYear",
"*",
"12",
"+",
"subMonth",
";",
"}"
] | Get how many months between two date.
@param date1 date to be tested.
@param date2 date to be tested.
@return how many months between two date. | [
"Get",
"how",
"many",
"months",
"between",
"two",
"date",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L489-L500 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.