repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java | H2GISFunctions.unRegisterFunction | public static void unRegisterFunction(Statement st, Function function) throws SQLException {
String functionAlias = getStringProperty(function, Function.PROP_NAME);
if(functionAlias.isEmpty()) {
functionAlias = function.getClass().getSimpleName();
}
st.execute("DROP ALIAS IF ... | java | public static void unRegisterFunction(Statement st, Function function) throws SQLException {
String functionAlias = getStringProperty(function, Function.PROP_NAME);
if(functionAlias.isEmpty()) {
functionAlias = function.getClass().getSimpleName();
}
st.execute("DROP ALIAS IF ... | [
"public",
"static",
"void",
"unRegisterFunction",
"(",
"Statement",
"st",
",",
"Function",
"function",
")",
"throws",
"SQLException",
"{",
"String",
"functionAlias",
"=",
"getStringProperty",
"(",
"function",
",",
"Function",
".",
"PROP_NAME",
")",
";",
"if",
"(... | Remove the specified function from the provided DataBase connection
@param st Active statement
@param function function to remove
@throws SQLException | [
"Remove",
"the",
"specified",
"function",
"from",
"the",
"provided",
"DataBase",
"connection"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java#L518-L524 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java | H2GISFunctions.registerH2GISFunctions | private static void registerH2GISFunctions(Connection connection, String packagePrepend) throws SQLException {
Statement st = connection.createStatement();
for (Function function : getBuiltInsFunctions()) {
try {
registerFunction(st, function, packagePrepend);
} c... | java | private static void registerH2GISFunctions(Connection connection, String packagePrepend) throws SQLException {
Statement st = connection.createStatement();
for (Function function : getBuiltInsFunctions()) {
try {
registerFunction(st, function, packagePrepend);
} c... | [
"private",
"static",
"void",
"registerH2GISFunctions",
"(",
"Connection",
"connection",
",",
"String",
"packagePrepend",
")",
"throws",
"SQLException",
"{",
"Statement",
"st",
"=",
"connection",
".",
"createStatement",
"(",
")",
";",
"for",
"(",
"Function",
"funct... | Register all H2GIS functions
@param connection JDBC Connection
@param packagePrepend For OSGi environment only, use
Bundle-SymbolicName:Bundle-Version:
@throws SQLException | [
"Register",
"all",
"H2GIS",
"functions"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java#L535-L545 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java | H2GISFunctions.unRegisterH2GISFunctions | public static void unRegisterH2GISFunctions(Connection connection) throws SQLException {
Statement st = connection.createStatement();
for (Function function : getBuiltInsFunctions()) {
unRegisterFunction(st, function);
}
unRegisterGeometryType(connection);
} | java | public static void unRegisterH2GISFunctions(Connection connection) throws SQLException {
Statement st = connection.createStatement();
for (Function function : getBuiltInsFunctions()) {
unRegisterFunction(st, function);
}
unRegisterGeometryType(connection);
} | [
"public",
"static",
"void",
"unRegisterH2GISFunctions",
"(",
"Connection",
"connection",
")",
"throws",
"SQLException",
"{",
"Statement",
"st",
"=",
"connection",
".",
"createStatement",
"(",
")",
";",
"for",
"(",
"Function",
"function",
":",
"getBuiltInsFunctions",... | Unregister spatial type and H2GIS functions from the current connection.
@param connection Active H2 connection with DROP ALIAS rights
@throws java.sql.SQLException | [
"Unregister",
"spatial",
"type",
"and",
"H2GIS",
"functions",
"from",
"the",
"current",
"connection",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISFunctions.java#L553-L559 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_IsValidReason.java | ST_IsValidReason.isValidReason | public static String isValidReason(Geometry geometry, int flag) {
if (geometry != null) {
if (flag == 0) {
return validReason(geometry, false);
} else if (flag == 1) {
return validReason(geometry, true);
} else {
throw new Illeg... | java | public static String isValidReason(Geometry geometry, int flag) {
if (geometry != null) {
if (flag == 0) {
return validReason(geometry, false);
} else if (flag == 1) {
return validReason(geometry, true);
} else {
throw new Illeg... | [
"public",
"static",
"String",
"isValidReason",
"(",
"Geometry",
"geometry",
",",
"int",
"flag",
")",
"{",
"if",
"(",
"geometry",
"!=",
"null",
")",
"{",
"if",
"(",
"flag",
"==",
"0",
")",
"{",
"return",
"validReason",
"(",
"geometry",
",",
"false",
")"... | Returns text stating whether a geometry is valid.
If not, returns a reason why.
@param geometry
@param flag
@return | [
"Returns",
"text",
"stating",
"whether",
"a",
"geometry",
"is",
"valid",
".",
"If",
"not",
"returns",
"a",
"reason",
"why",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_IsValidReason.java#L67-L78 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Polygonize.java | ST_Polygonize.polygonize | public static Geometry polygonize(Geometry geometry) {
if(geometry == null){
return null;
}
Polygonizer polygonizer = new Polygonizer();
polygonizer.add(geometry);
Collection pols = polygonizer.getPolygons();
if(pols.isEmpty()){
return null;
... | java | public static Geometry polygonize(Geometry geometry) {
if(geometry == null){
return null;
}
Polygonizer polygonizer = new Polygonizer();
polygonizer.add(geometry);
Collection pols = polygonizer.getPolygons();
if(pols.isEmpty()){
return null;
... | [
"public",
"static",
"Geometry",
"polygonize",
"(",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Polygonizer",
"polygonizer",
"=",
"new",
"Polygonizer",
"(",
")",
";",
"polygonizer",
".",
"add... | Creates a GeometryCollection containing possible polygons formed
from the constituent linework of a set of geometries.
@param geometry
@return | [
"Creates",
"a",
"GeometryCollection",
"containing",
"possible",
"polygons",
"formed",
"from",
"the",
"constituent",
"linework",
"of",
"a",
"set",
"of",
"geometries",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Polygonize.java#L55-L66 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/MaxDistanceOp.java | MaxDistanceOp.computeMaxDistance | private void computeMaxDistance() {
HashSet<Coordinate> coordinatesA = new HashSet<Coordinate>(Arrays.asList(geomA.convexHull().getCoordinates()));
Geometry fullHull = geomA.getFactory().createGeometryCollection(new Geometry[]{geomA, geomB}).convexHull();
maxDistanceFilter = new MaxDistanceFilte... | java | private void computeMaxDistance() {
HashSet<Coordinate> coordinatesA = new HashSet<Coordinate>(Arrays.asList(geomA.convexHull().getCoordinates()));
Geometry fullHull = geomA.getFactory().createGeometryCollection(new Geometry[]{geomA, geomB}).convexHull();
maxDistanceFilter = new MaxDistanceFilte... | [
"private",
"void",
"computeMaxDistance",
"(",
")",
"{",
"HashSet",
"<",
"Coordinate",
">",
"coordinatesA",
"=",
"new",
"HashSet",
"<",
"Coordinate",
">",
"(",
"Arrays",
".",
"asList",
"(",
"geomA",
".",
"convexHull",
"(",
")",
".",
"getCoordinates",
"(",
"... | Compute the max distance | [
"Compute",
"the",
"max",
"distance"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/MaxDistanceOp.java#L52-L57 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/MaxDistanceOp.java | MaxDistanceOp.getDistance | public Double getDistance() {
if (geomA == null || geomB == null) {
return null;
}
if (geomA.isEmpty() || geomB.isEmpty()) {
return 0.0;
}
if (geomA.equals(geomB)) {
sameGeom = true;
}
if (maxDistanceFilter == null) {
... | java | public Double getDistance() {
if (geomA == null || geomB == null) {
return null;
}
if (geomA.isEmpty() || geomB.isEmpty()) {
return 0.0;
}
if (geomA.equals(geomB)) {
sameGeom = true;
}
if (maxDistanceFilter == null) {
... | [
"public",
"Double",
"getDistance",
"(",
")",
"{",
"if",
"(",
"geomA",
"==",
"null",
"||",
"geomB",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"geomA",
".",
"isEmpty",
"(",
")",
"||",
"geomB",
".",
"isEmpty",
"(",
")",
")",
"{"... | Return the max distance
@return | [
"Return",
"the",
"max",
"distance"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/MaxDistanceOp.java#L64-L79 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/MaxDistanceOp.java | MaxDistanceOp.getCoordinatesDistance | public Coordinate[] getCoordinatesDistance() {
if (geomA == null || geomB == null) {
return null;
}
if (geomA.isEmpty() || geomB.isEmpty()) {
return null;
}
if (geomA.equals(geomB)) {
sameGeom = true;
}
if (maxDistan... | java | public Coordinate[] getCoordinatesDistance() {
if (geomA == null || geomB == null) {
return null;
}
if (geomA.isEmpty() || geomB.isEmpty()) {
return null;
}
if (geomA.equals(geomB)) {
sameGeom = true;
}
if (maxDistan... | [
"public",
"Coordinate",
"[",
"]",
"getCoordinatesDistance",
"(",
")",
"{",
"if",
"(",
"geomA",
"==",
"null",
"||",
"geomB",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"geomA",
".",
"isEmpty",
"(",
")",
"||",
"geomB",
".",
"isEmpty... | Return the two coordinates to build the max distance line
@return | [
"Return",
"the",
"two",
"coordinates",
"to",
"build",
"the",
"max",
"distance",
"line"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/MaxDistanceOp.java#L86-L102 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_GeomFromGML.java | ST_GeomFromGML.toGeometry | public static Geometry toGeometry(String gmlFile, int srid) throws SAXException, IOException, ParserConfigurationException {
if (gmlFile == null) {
return null;
}
if (gf == null) {
gf = new GeometryFactory(new PrecisionModel(), srid);
}
GMLReader gMLReader... | java | public static Geometry toGeometry(String gmlFile, int srid) throws SAXException, IOException, ParserConfigurationException {
if (gmlFile == null) {
return null;
}
if (gf == null) {
gf = new GeometryFactory(new PrecisionModel(), srid);
}
GMLReader gMLReader... | [
"public",
"static",
"Geometry",
"toGeometry",
"(",
"String",
"gmlFile",
",",
"int",
"srid",
")",
"throws",
"SAXException",
",",
"IOException",
",",
"ParserConfigurationException",
"{",
"if",
"(",
"gmlFile",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
... | Read the GML representation with a specified SRID
@param gmlFile
@param srid
@return
@throws org.xml.sax.SAXException
@throws java.io.IOException
@throws javax.xml.parsers.ParserConfigurationException | [
"Read",
"the",
"GML",
"representation",
"with",
"a",
"specified",
"SRID"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_GeomFromGML.java#L74-L83 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.write | public void write(ProgressVisitor progress, ResultSet rs, File fileName, String encoding) throws SQLException, IOException {
if (FileUtil.isExtensionWellFormated(fileName, "geojson")) {
FileOutputStream fos = null;
JsonEncoding jsonEncoding = JsonEncoding.UTF8;
if (encoding !... | java | public void write(ProgressVisitor progress, ResultSet rs, File fileName, String encoding) throws SQLException, IOException {
if (FileUtil.isExtensionWellFormated(fileName, "geojson")) {
FileOutputStream fos = null;
JsonEncoding jsonEncoding = JsonEncoding.UTF8;
if (encoding !... | [
"public",
"void",
"write",
"(",
"ProgressVisitor",
"progress",
",",
"ResultSet",
"rs",
",",
"File",
"fileName",
",",
"String",
"encoding",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"if",
"(",
"FileUtil",
".",
"isExtensionWellFormated",
"(",
"fileNa... | Write a resulset to a geojson file
@param progress
@param rs input resulset
@param fileName the output file
@param encoding
@throws SQLException
@throws java.io.IOException | [
"Write",
"a",
"resulset",
"to",
"a",
"geojson",
"file"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L99-L166 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.writeFeature | private void writeFeature(JsonGenerator jsonGenerator, ResultSet rs, int geoFieldIndex) throws IOException, SQLException {
// feature header
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("type", "Feature");
//Write the first geometry
writeGeometry((Geometry) rs... | java | private void writeFeature(JsonGenerator jsonGenerator, ResultSet rs, int geoFieldIndex) throws IOException, SQLException {
// feature header
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("type", "Feature");
//Write the first geometry
writeGeometry((Geometry) rs... | [
"private",
"void",
"writeFeature",
"(",
"JsonGenerator",
"jsonGenerator",
",",
"ResultSet",
"rs",
",",
"int",
"geoFieldIndex",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"// feature header",
"jsonGenerator",
".",
"writeStartObject",
"(",
")",
";",
"json... | Write a GeoJSON feature.
Features in GeoJSON contain a geometry object and additional properties,
and a feature collection represents a list of features.
A complete GeoJSON data structure is always an object (in JSON terms). In
GeoJSON, an object consists of a collection of name/value pairs -- also
called members. Fo... | [
"Write",
"a",
"GeoJSON",
"feature",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L288-L298 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.cacheMetadata | private void cacheMetadata(ResultSetMetaData resultSetMetaData) throws SQLException {
cachedColumnNames = new LinkedHashMap<String, Integer>();
for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
final String fieldTypeName = resultSetMetaData.getColumnTypeName(i);
if ... | java | private void cacheMetadata(ResultSetMetaData resultSetMetaData) throws SQLException {
cachedColumnNames = new LinkedHashMap<String, Integer>();
for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
final String fieldTypeName = resultSetMetaData.getColumnTypeName(i);
if ... | [
"private",
"void",
"cacheMetadata",
"(",
"ResultSetMetaData",
"resultSetMetaData",
")",
"throws",
"SQLException",
"{",
"cachedColumnNames",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
... | Cache the column name and its index.
@param resultSetMetaData
@throws SQLException | [
"Cache",
"the",
"column",
"name",
"and",
"its",
"index",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L306-L316 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.writeGeometry | private void writeGeometry(Geometry geom, JsonGenerator gen) throws IOException {
if (geom != null) {
gen.writeObjectFieldStart("geometry");
if (geom instanceof Point) {
write((Point) geom, gen);
} else if (geom instanceof MultiPoint) {
... | java | private void writeGeometry(Geometry geom, JsonGenerator gen) throws IOException {
if (geom != null) {
gen.writeObjectFieldStart("geometry");
if (geom instanceof Point) {
write((Point) geom, gen);
} else if (geom instanceof MultiPoint) {
... | [
"private",
"void",
"writeGeometry",
"(",
"Geometry",
"geom",
",",
"JsonGenerator",
"gen",
")",
"throws",
"IOException",
"{",
"if",
"(",
"geom",
"!=",
"null",
")",
"{",
"gen",
".",
"writeObjectFieldStart",
"(",
"\"geometry\"",
")",
";",
"if",
"(",
"geom",
"... | Write a JTS geometry to its GeoJSON geometry representation.
Syntax:
"geometry":{"type": "Point", "coordinates": [102.0, 0.5]}
@param jsonGenerator
@param geometry | [
"Write",
"a",
"JTS",
"geometry",
"to",
"its",
"GeoJSON",
"geometry",
"representation",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L328-L353 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.writeProperties | private void writeProperties(JsonGenerator jsonGenerator, ResultSet rs) throws IOException, SQLException {
if (columnCountProperties != -1) {
jsonGenerator.writeObjectFieldStart("properties");
for (Map.Entry<String, Integer> entry : cachedColumnNames.entrySet()) {
String ... | java | private void writeProperties(JsonGenerator jsonGenerator, ResultSet rs) throws IOException, SQLException {
if (columnCountProperties != -1) {
jsonGenerator.writeObjectFieldStart("properties");
for (Map.Entry<String, Integer> entry : cachedColumnNames.entrySet()) {
String ... | [
"private",
"void",
"writeProperties",
"(",
"JsonGenerator",
"jsonGenerator",
",",
"ResultSet",
"rs",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"if",
"(",
"columnCountProperties",
"!=",
"-",
"1",
")",
"{",
"jsonGenerator",
".",
"writeObjectFieldStart",
... | Write the GeoJSON properties.
@param jsonGenerator
@param rs
@throws IOException | [
"Write",
"the",
"GeoJSON",
"properties",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L564-L588 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.isSupportedPropertyType | public boolean isSupportedPropertyType(int sqlTypeId, String sqlTypeName) throws SQLException {
switch (sqlTypeId) {
case Types.BOOLEAN:
case Types.DOUBLE:
case Types.FLOAT:
case Types.INTEGER:
case Types.BIGINT:
case Types.SMALLINT:
... | java | public boolean isSupportedPropertyType(int sqlTypeId, String sqlTypeName) throws SQLException {
switch (sqlTypeId) {
case Types.BOOLEAN:
case Types.DOUBLE:
case Types.FLOAT:
case Types.INTEGER:
case Types.BIGINT:
case Types.SMALLINT:
... | [
"public",
"boolean",
"isSupportedPropertyType",
"(",
"int",
"sqlTypeId",
",",
"String",
"sqlTypeName",
")",
"throws",
"SQLException",
"{",
"switch",
"(",
"sqlTypeId",
")",
"{",
"case",
"Types",
".",
"BOOLEAN",
":",
"case",
"Types",
".",
"DOUBLE",
":",
"case",
... | Return true is the SQL type is supported by the GeoJSON driver.
@param sqlTypeId
@param sqlTypeName
@return
@throws SQLException | [
"Return",
"true",
"is",
"the",
"SQL",
"type",
"is",
"supported",
"by",
"the",
"GeoJSON",
"driver",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L598-L621 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.writeCRS | private void writeCRS(JsonGenerator jsonGenerator, String[] authorityAndSRID) throws IOException {
if (authorityAndSRID[1] != null) {
jsonGenerator.writeObjectFieldStart("crs");
jsonGenerator.writeStringField("type", "name");
jsonGenerator.writeObjectFieldStart("properties");... | java | private void writeCRS(JsonGenerator jsonGenerator, String[] authorityAndSRID) throws IOException {
if (authorityAndSRID[1] != null) {
jsonGenerator.writeObjectFieldStart("crs");
jsonGenerator.writeStringField("type", "name");
jsonGenerator.writeObjectFieldStart("properties");... | [
"private",
"void",
"writeCRS",
"(",
"JsonGenerator",
"jsonGenerator",
",",
"String",
"[",
"]",
"authorityAndSRID",
")",
"throws",
"IOException",
"{",
"if",
"(",
"authorityAndSRID",
"[",
"1",
"]",
"!=",
"null",
")",
"{",
"jsonGenerator",
".",
"writeObjectFieldSta... | Write the CRS in the geojson
@param jsonGenerator
@param authorityAndSRID
@throws IOException | [
"Write",
"the",
"CRS",
"in",
"the",
"geojson"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L630-L641 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java | GeoJsonWriteDriver.writeArray | private void writeArray(JsonGenerator jsonGenerator, Object[] array, boolean firstInHierarchy) throws IOException, SQLException {
if(!firstInHierarchy) {
jsonGenerator.writeStartArray();
}
for(int i = 0; i < array.length; i++) {
if (array[i] instanceof Integer) {
... | java | private void writeArray(JsonGenerator jsonGenerator, Object[] array, boolean firstInHierarchy) throws IOException, SQLException {
if(!firstInHierarchy) {
jsonGenerator.writeStartArray();
}
for(int i = 0; i < array.length; i++) {
if (array[i] instanceof Integer) {
... | [
"private",
"void",
"writeArray",
"(",
"JsonGenerator",
"jsonGenerator",
",",
"Object",
"[",
"]",
"array",
",",
"boolean",
"firstInHierarchy",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"if",
"(",
"!",
"firstInHierarchy",
")",
"{",
"jsonGenerator",
"... | Write the array in the geojson
@param jsonGenerator
@param array
@throw IOException | [
"Write",
"the",
"array",
"in",
"the",
"geojson"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonWriteDriver.java#L650-L675 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_SideBuffer.java | ST_SideBuffer.singleSideBuffer | public static Geometry singleSideBuffer(Geometry geometry, double distance){
if(geometry==null){
return null;
}
return computeSingleSideBuffer(geometry, distance, new BufferParameters());
} | java | public static Geometry singleSideBuffer(Geometry geometry, double distance){
if(geometry==null){
return null;
}
return computeSingleSideBuffer(geometry, distance, new BufferParameters());
} | [
"public",
"static",
"Geometry",
"singleSideBuffer",
"(",
"Geometry",
"geometry",
",",
"double",
"distance",
")",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"computeSingleSideBuffer",
"(",
"geometry",
",",
"distanc... | Compute a single side buffer with default parameters
@param geometry
@param distance
@return | [
"Compute",
"a",
"single",
"side",
"buffer",
"with",
"default",
"parameters"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_SideBuffer.java#L58-L63 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_SideBuffer.java | ST_SideBuffer.computeSingleSideBuffer | private static Geometry computeSingleSideBuffer(Geometry geometry, double distance, BufferParameters bufferParameters){
bufferParameters.setSingleSided(true);
return BufferOp.bufferOp(geometry, distance, bufferParameters);
} | java | private static Geometry computeSingleSideBuffer(Geometry geometry, double distance, BufferParameters bufferParameters){
bufferParameters.setSingleSided(true);
return BufferOp.bufferOp(geometry, distance, bufferParameters);
} | [
"private",
"static",
"Geometry",
"computeSingleSideBuffer",
"(",
"Geometry",
"geometry",
",",
"double",
"distance",
",",
"BufferParameters",
"bufferParameters",
")",
"{",
"bufferParameters",
".",
"setSingleSided",
"(",
"true",
")",
";",
"return",
"BufferOp",
".",
"b... | Compute the buffer
@param geometry
@param distance
@param bufferParameters
@return | [
"Compute",
"the",
"buffer"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_SideBuffer.java#L111-L114 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_Equals.java | ST_Equals.geomEquals | public static Boolean geomEquals(Geometry a, Geometry b) {
if(a==null || b==null) {
return null;
}
return a.equals(b);
} | java | public static Boolean geomEquals(Geometry a, Geometry b) {
if(a==null || b==null) {
return null;
}
return a.equals(b);
} | [
"public",
"static",
"Boolean",
"geomEquals",
"(",
"Geometry",
"a",
",",
"Geometry",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"null",
"||",
"b",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"a",
".",
"equals",
"(",
"b",
")",
";",
"}"
... | Return true if Geometry A is equal to Geometry B
@param a Geometry Geometry.
@param b Geometry instance
@return true if Geometry A is equal to Geometry B | [
"Return",
"true",
"if",
"Geometry",
"A",
"is",
"equal",
"to",
"Geometry",
"B"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_Equals.java#L51-L56 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/aggregate/ST_Accum.java | ST_Accum.addGeometry | private void addGeometry(Geometry geom) {
if (geom != null) {
if (geom instanceof GeometryCollection) {
List<Geometry> toUnitTmp = new ArrayList<Geometry>(geom.getNumGeometries());
for (int i = 0; i < geom.getNumGeometries(); i++) {
toUnitTmp.add(g... | java | private void addGeometry(Geometry geom) {
if (geom != null) {
if (geom instanceof GeometryCollection) {
List<Geometry> toUnitTmp = new ArrayList<Geometry>(geom.getNumGeometries());
for (int i = 0; i < geom.getNumGeometries(); i++) {
toUnitTmp.add(g... | [
"private",
"void",
"addGeometry",
"(",
"Geometry",
"geom",
")",
"{",
"if",
"(",
"geom",
"!=",
"null",
")",
"{",
"if",
"(",
"geom",
"instanceof",
"GeometryCollection",
")",
"{",
"List",
"<",
"Geometry",
">",
"toUnitTmp",
"=",
"new",
"ArrayList",
"<",
"Geo... | Add geometry into an array to accumulate
@param geom | [
"Add",
"geometry",
"into",
"an",
"array",
"to",
"accumulate"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/aggregate/ST_Accum.java#L76-L90 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonDriverFunction.java | GeoJsonDriverFunction.exportTable | @Override
public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String encoding) throws SQLException, IOException{
GeoJsonWriteDriver geoJsonDriver = new GeoJsonWriteDriver(connection);
geoJsonDriver.write(progress,tableReference, fileName, en... | java | @Override
public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String encoding) throws SQLException, IOException{
GeoJsonWriteDriver geoJsonDriver = new GeoJsonWriteDriver(connection);
geoJsonDriver.write(progress,tableReference, fileName, en... | [
"@",
"Override",
"public",
"void",
"exportTable",
"(",
"Connection",
"connection",
",",
"String",
"tableReference",
",",
"File",
"fileName",
",",
"ProgressVisitor",
"progress",
",",
"String",
"encoding",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"Geo... | Export a table or a query to a geojson file
@param connection
@param tableReference
@param fileName
@param progress
@param encoding
@throws SQLException
@throws IOException | [
"Export",
"a",
"table",
"or",
"a",
"query",
"to",
"a",
"geojson",
"file"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonDriverFunction.java#L88-L92 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMPreParser.java | OSMPreParser.startElement | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (localName.compareToIgnoreCase("osm") == 0) {
version = attributes.getValue(GPXTags.VERSION);
} else if (localName.compareToIgnoreCase("node") == 0) {
... | java | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (localName.compareToIgnoreCase("osm") == 0) {
version = attributes.getValue(GPXTags.VERSION);
} else if (localName.compareToIgnoreCase("node") == 0) {
... | [
"@",
"Override",
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"attributes",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"localName",
".",
"compareToIgnoreCase",
"(",
"\"osm\"",
... | Fires whenever an XML start markup is encountered. It indicates which
version of osm file is to be parsed.
@param uri URI of the local element
@param localName Name of the local element (without prefix)
@param qName qName of the local element (with prefix)
@param attributes Attributes of the local element (contained i... | [
"Fires",
"whenever",
"an",
"XML",
"start",
"markup",
"is",
"encountered",
".",
"It",
"indicates",
"which",
"version",
"of",
"osm",
"file",
"is",
"to",
"be",
"parsed",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMPreParser.java#L92-L103 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java | ST_AddPoint.addPoint | public static Geometry addPoint(Geometry geometry, Point point) throws SQLException {
return addPoint(geometry, point, PRECISION);
} | java | public static Geometry addPoint(Geometry geometry, Point point) throws SQLException {
return addPoint(geometry, point, PRECISION);
} | [
"public",
"static",
"Geometry",
"addPoint",
"(",
"Geometry",
"geometry",
",",
"Point",
"point",
")",
"throws",
"SQLException",
"{",
"return",
"addPoint",
"(",
"geometry",
",",
"point",
",",
"PRECISION",
")",
";",
"}"
] | Returns a new geometry based on an existing one, with a specific point as
a new vertex. A default distance 10E-6 is used to snap the input point.
@param geometry
@param point
@return
@throws SQLException | [
"Returns",
"a",
"new",
"geometry",
"based",
"on",
"an",
"existing",
"one",
"with",
"a",
"specific",
"point",
"as",
"a",
"new",
"vertex",
".",
"A",
"default",
"distance",
"10E",
"-",
"6",
"is",
"used",
"to",
"snap",
"the",
"input",
"point",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java#L60-L62 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java | ST_AddPoint.addPoint | public static Geometry addPoint(Geometry geometry, Point point, double tolerance) throws SQLException {
if(geometry == null || point == null){
return null;
}
if (geometry instanceof MultiPoint) {
return insertVertexInMultipoint(geometry, point);
} else if (geometr... | java | public static Geometry addPoint(Geometry geometry, Point point, double tolerance) throws SQLException {
if(geometry == null || point == null){
return null;
}
if (geometry instanceof MultiPoint) {
return insertVertexInMultipoint(geometry, point);
} else if (geometr... | [
"public",
"static",
"Geometry",
"addPoint",
"(",
"Geometry",
"geometry",
",",
"Point",
"point",
",",
"double",
"tolerance",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometry",
"==",
"null",
"||",
"point",
"==",
"null",
")",
"{",
"return",
"null",
";... | Returns a new geometry based on an existing one, with a specific point as
a new vertex.
@param geometry
@param point
@param tolerance
@return Null if the vertex cannot be inserted
@throws SQLException If the vertex can be inserted but it makes the
geometry to be in an invalid shape | [
"Returns",
"a",
"new",
"geometry",
"based",
"on",
"an",
"existing",
"one",
"with",
"a",
"specific",
"point",
"as",
"a",
"new",
"vertex",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java#L75-L126 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java | ST_AddPoint.insertVertexInMultipoint | private static Geometry insertVertexInMultipoint(Geometry g, Point vertexPoint) {
ArrayList<Point> geoms = new ArrayList<Point>();
for (int i = 0; i < g.getNumGeometries(); i++) {
Point geom = (Point) g.getGeometryN(i);
geoms.add(geom);
}
geoms.add(FACTORY.createP... | java | private static Geometry insertVertexInMultipoint(Geometry g, Point vertexPoint) {
ArrayList<Point> geoms = new ArrayList<Point>();
for (int i = 0; i < g.getNumGeometries(); i++) {
Point geom = (Point) g.getGeometryN(i);
geoms.add(geom);
}
geoms.add(FACTORY.createP... | [
"private",
"static",
"Geometry",
"insertVertexInMultipoint",
"(",
"Geometry",
"g",
",",
"Point",
"vertexPoint",
")",
"{",
"ArrayList",
"<",
"Point",
">",
"geoms",
"=",
"new",
"ArrayList",
"<",
"Point",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0"... | Adds a Point into a MultiPoint geometry.
@param g
@param vertexPoint
@return | [
"Adds",
"a",
"Point",
"into",
"a",
"MultiPoint",
"geometry",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java#L135-L143 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java | ST_AddPoint.insertVertexInPolygon | private static Polygon insertVertexInPolygon(Polygon polygon,
Point vertexPoint, double tolerance) throws SQLException {
Polygon geom =polygon;
LineString linearRing = polygon.getExteriorRing();
int index = -1;
for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
... | java | private static Polygon insertVertexInPolygon(Polygon polygon,
Point vertexPoint, double tolerance) throws SQLException {
Polygon geom =polygon;
LineString linearRing = polygon.getExteriorRing();
int index = -1;
for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
... | [
"private",
"static",
"Polygon",
"insertVertexInPolygon",
"(",
"Polygon",
"polygon",
",",
"Point",
"vertexPoint",
",",
"double",
"tolerance",
")",
"throws",
"SQLException",
"{",
"Polygon",
"geom",
"=",
"polygon",
";",
"LineString",
"linearRing",
"=",
"polygon",
"."... | Adds a vertex into a Polygon with a given tolerance.
@param polygon
@param vertexPoint
@param tolerance
@return
@throws SQLException | [
"Adds",
"a",
"vertex",
"into",
"a",
"Polygon",
"with",
"a",
"given",
"tolerance",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java#L184-L224 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java | ST_AddPoint.computeDistance | private static double computeDistance(Geometry geometry, Point vertexPoint, double tolerance) {
DistanceOp distanceOp = new DistanceOp(geometry, vertexPoint, tolerance);
return distanceOp.distance();
} | java | private static double computeDistance(Geometry geometry, Point vertexPoint, double tolerance) {
DistanceOp distanceOp = new DistanceOp(geometry, vertexPoint, tolerance);
return distanceOp.distance();
} | [
"private",
"static",
"double",
"computeDistance",
"(",
"Geometry",
"geometry",
",",
"Point",
"vertexPoint",
",",
"double",
"tolerance",
")",
"{",
"DistanceOp",
"distanceOp",
"=",
"new",
"DistanceOp",
"(",
"geometry",
",",
"vertexPoint",
",",
"tolerance",
")",
";... | Return minimum distance between a geometry and a point.
@param geometry
@param vertexPoint
@param tolerance
@return | [
"Return",
"minimum",
"distance",
"between",
"a",
"geometry",
"and",
"a",
"point",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java#L234-L237 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java | ST_AddPoint.insertVertexInLinearRing | private static LinearRing insertVertexInLinearRing(LineString lineString,
Point vertexPoint, double tolerance) {
GeometryLocation geomLocation = EditUtilities.getVertexToSnap(lineString, vertexPoint, tolerance);
if (geomLocation != null) {
Coordinate[] coords = lineString.getCoor... | java | private static LinearRing insertVertexInLinearRing(LineString lineString,
Point vertexPoint, double tolerance) {
GeometryLocation geomLocation = EditUtilities.getVertexToSnap(lineString, vertexPoint, tolerance);
if (geomLocation != null) {
Coordinate[] coords = lineString.getCoor... | [
"private",
"static",
"LinearRing",
"insertVertexInLinearRing",
"(",
"LineString",
"lineString",
",",
"Point",
"vertexPoint",
",",
"double",
"tolerance",
")",
"{",
"GeometryLocation",
"geomLocation",
"=",
"EditUtilities",
".",
"getVertexToSnap",
"(",
"lineString",
",",
... | Adds a vertex into a LinearRing with a given tolerance.
@param lineString
@param vertexPoint
@param tolerance
@return | [
"Adds",
"a",
"vertex",
"into",
"a",
"LinearRing",
"with",
"a",
"given",
"tolerance",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddPoint.java#L247-L266 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/DriverManager.java | DriverManager.openFile | public static void openFile(Connection connection, String fileName, String tableName) throws SQLException {
String ext = fileName.substring(fileName.lastIndexOf('.') + 1,fileName.length());
final boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData());
for(DriverDef driverDef : DRIVE... | java | public static void openFile(Connection connection, String fileName, String tableName) throws SQLException {
String ext = fileName.substring(fileName.lastIndexOf('.') + 1,fileName.length());
final boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData());
for(DriverDef driverDef : DRIVE... | [
"public",
"static",
"void",
"openFile",
"(",
"Connection",
"connection",
",",
"String",
"fileName",
",",
"String",
"tableName",
")",
"throws",
"SQLException",
"{",
"String",
"ext",
"=",
"fileName",
".",
"substring",
"(",
"fileName",
".",
"lastIndexOf",
"(",
"'... | Create a new table
@param connection Active connection, do not close this connection.
@param fileName File path to write, if exists it may be replaced
@param tableName [[catalog.]schema.]table reference | [
"Create",
"a",
"new",
"table"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/DriverManager.java#L89-L103 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/shp/SHPWrite.java | SHPWrite.exportTable | public static void exportTable(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException {
SHPDriverFunction shpDriverFunction = new SHPDriverFunction();
shpDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName)... | java | public static void exportTable(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException {
SHPDriverFunction shpDriverFunction = new SHPDriverFunction();
shpDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName)... | [
"public",
"static",
"void",
"exportTable",
"(",
"Connection",
"connection",
",",
"String",
"fileName",
",",
"String",
"tableReference",
",",
"String",
"encoding",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"SHPDriverFunction",
"shpDriverFunction",
"=",
... | Read a table and write it into a shape file.
@param connection Active connection
@param fileName Shape file name or URI
@param tableReference Table name or select query
Note : The select query must be enclosed in parenthesis
@param encoding File encoding
@throws IOException
@throws SQLException | [
"Read",
"a",
"table",
"and",
"write",
"it",
"into",
"a",
"shape",
"file",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/shp/SHPWrite.java#L69-L72 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java | GeometryCoordinateDimension.force | public static Geometry force(Geometry geom, int dimension) {
if (geom instanceof Point) {
return gf.createPoint(convertSequence(geom.getCoordinates(),dimension));
} else if (geom instanceof LineString) {
return gf.createLineString(convertSequence(geom.getCoordinates(),dimension))... | java | public static Geometry force(Geometry geom, int dimension) {
if (geom instanceof Point) {
return gf.createPoint(convertSequence(geom.getCoordinates(),dimension));
} else if (geom instanceof LineString) {
return gf.createLineString(convertSequence(geom.getCoordinates(),dimension))... | [
"public",
"static",
"Geometry",
"force",
"(",
"Geometry",
"geom",
",",
"int",
"dimension",
")",
"{",
"if",
"(",
"geom",
"instanceof",
"Point",
")",
"{",
"return",
"gf",
".",
"createPoint",
"(",
"convertSequence",
"(",
"geom",
".",
"getCoordinates",
"(",
")... | Force the dimension of the geometry and update correctly the coordinate
dimension
@param geom the input geometry
@param dimension supported dimension is 2, 3
if the dimension is set to 3 the z measure are set to 0
@return | [
"Force",
"the",
"dimension",
"of",
"the",
"geometry",
"and",
"update",
"correctly",
"the",
"coordinate",
"dimension"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L52-L69 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java | GeometryCoordinateDimension.convert | public static GeometryCollection convert(GeometryCollection gc, int dimension) {
int nb = gc.getNumGeometries();
final Geometry[] geometries = new Geometry[nb];
for (int i = 0; i < nb; i++) {
geometries[i]=force(gc.getGeometryN(i),dimension);
}
ret... | java | public static GeometryCollection convert(GeometryCollection gc, int dimension) {
int nb = gc.getNumGeometries();
final Geometry[] geometries = new Geometry[nb];
for (int i = 0; i < nb; i++) {
geometries[i]=force(gc.getGeometryN(i),dimension);
}
ret... | [
"public",
"static",
"GeometryCollection",
"convert",
"(",
"GeometryCollection",
"gc",
",",
"int",
"dimension",
")",
"{",
"int",
"nb",
"=",
"gc",
".",
"getNumGeometries",
"(",
")",
";",
"final",
"Geometry",
"[",
"]",
"geometries",
"=",
"new",
"Geometry",
"[",... | Force the dimension of the GeometryCollection and update correctly the coordinate
dimension
@param gc
@param dimension
@return | [
"Force",
"the",
"dimension",
"of",
"the",
"GeometryCollection",
"and",
"update",
"correctly",
"the",
"coordinate",
"dimension"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L78-L85 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java | GeometryCoordinateDimension.convert | public static MultiPolygon convert(MultiPolygon multiPolygon,int dimension) {
int nb = multiPolygon.getNumGeometries();
final Polygon[] pl = new Polygon[nb];
for (int i = 0; i < nb; i++) {
pl[i] = GeometryCoordinateDimension.convert((Polygon) multiPolygon.getGeometryN(i),dimension);
... | java | public static MultiPolygon convert(MultiPolygon multiPolygon,int dimension) {
int nb = multiPolygon.getNumGeometries();
final Polygon[] pl = new Polygon[nb];
for (int i = 0; i < nb; i++) {
pl[i] = GeometryCoordinateDimension.convert((Polygon) multiPolygon.getGeometryN(i),dimension);
... | [
"public",
"static",
"MultiPolygon",
"convert",
"(",
"MultiPolygon",
"multiPolygon",
",",
"int",
"dimension",
")",
"{",
"int",
"nb",
"=",
"multiPolygon",
".",
"getNumGeometries",
"(",
")",
";",
"final",
"Polygon",
"[",
"]",
"pl",
"=",
"new",
"Polygon",
"[",
... | Force the dimension of the MultiPolygon and update correctly the coordinate
dimension
@param multiPolygon
@param dimension
@return | [
"Force",
"the",
"dimension",
"of",
"the",
"MultiPolygon",
"and",
"update",
"correctly",
"the",
"coordinate",
"dimension"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L94-L101 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java | GeometryCoordinateDimension.convert | public static MultiLineString convert(MultiLineString multiLineString, int dimension) {
int nb = multiLineString.getNumGeometries();
final LineString[] ls = new LineString[nb];
for (int i = 0; i < nb; i++) {
ls[i] = GeometryCoordinateDimension.convert((LineString) multiLineString.get... | java | public static MultiLineString convert(MultiLineString multiLineString, int dimension) {
int nb = multiLineString.getNumGeometries();
final LineString[] ls = new LineString[nb];
for (int i = 0; i < nb; i++) {
ls[i] = GeometryCoordinateDimension.convert((LineString) multiLineString.get... | [
"public",
"static",
"MultiLineString",
"convert",
"(",
"MultiLineString",
"multiLineString",
",",
"int",
"dimension",
")",
"{",
"int",
"nb",
"=",
"multiLineString",
".",
"getNumGeometries",
"(",
")",
";",
"final",
"LineString",
"[",
"]",
"ls",
"=",
"new",
"Lin... | Force the dimension of the MultiLineString and update correctly the coordinate
dimension
@param multiLineString
@param dimension
@return | [
"Force",
"the",
"dimension",
"of",
"the",
"MultiLineString",
"and",
"update",
"correctly",
"the",
"coordinate",
"dimension"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L110-L117 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java | GeometryCoordinateDimension.convert | public static Polygon convert(Polygon polygon, int dimension) {
LinearRing shell = GeometryCoordinateDimension.convert(polygon.getExteriorRing(),dimension);
int nbOfHoles = polygon.getNumInteriorRing();
final LinearRing[] holes = new LinearRing[nbOfHoles];
for (int i = 0; i < nbOfHoles; ... | java | public static Polygon convert(Polygon polygon, int dimension) {
LinearRing shell = GeometryCoordinateDimension.convert(polygon.getExteriorRing(),dimension);
int nbOfHoles = polygon.getNumInteriorRing();
final LinearRing[] holes = new LinearRing[nbOfHoles];
for (int i = 0; i < nbOfHoles; ... | [
"public",
"static",
"Polygon",
"convert",
"(",
"Polygon",
"polygon",
",",
"int",
"dimension",
")",
"{",
"LinearRing",
"shell",
"=",
"GeometryCoordinateDimension",
".",
"convert",
"(",
"polygon",
".",
"getExteriorRing",
"(",
")",
",",
"dimension",
")",
";",
"in... | Force the dimension of the Polygon and update correctly the coordinate
dimension
@param polygon
@param dimension
@return | [
"Force",
"the",
"dimension",
"of",
"the",
"Polygon",
"and",
"update",
"correctly",
"the",
"coordinate",
"dimension"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L126-L134 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java | GeometryCoordinateDimension.convert | public static LinearRing convert(LineString lineString,int dimension) {
return gf.createLinearRing(convertSequence(lineString.getCoordinates(),dimension));
} | java | public static LinearRing convert(LineString lineString,int dimension) {
return gf.createLinearRing(convertSequence(lineString.getCoordinates(),dimension));
} | [
"public",
"static",
"LinearRing",
"convert",
"(",
"LineString",
"lineString",
",",
"int",
"dimension",
")",
"{",
"return",
"gf",
".",
"createLinearRing",
"(",
"convertSequence",
"(",
"lineString",
".",
"getCoordinates",
"(",
")",
",",
"dimension",
")",
")",
";... | Force the dimension of the LineString and update correctly the coordinate
dimension
@param lineString
@param dimension
@return | [
"Force",
"the",
"dimension",
"of",
"the",
"LineString",
"and",
"update",
"correctly",
"the",
"coordinate",
"dimension"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L143-L145 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java | GeometryCoordinateDimension.convert | public static LinearRing convert(LinearRing linearRing,int dimension) {
return gf.createLinearRing(convertSequence(linearRing.getCoordinates(),dimension));
} | java | public static LinearRing convert(LinearRing linearRing,int dimension) {
return gf.createLinearRing(convertSequence(linearRing.getCoordinates(),dimension));
} | [
"public",
"static",
"LinearRing",
"convert",
"(",
"LinearRing",
"linearRing",
",",
"int",
"dimension",
")",
"{",
"return",
"gf",
".",
"createLinearRing",
"(",
"convertSequence",
"(",
"linearRing",
".",
"getCoordinates",
"(",
")",
",",
"dimension",
")",
")",
";... | Force the dimension of the LinearRing and update correctly the coordinate
dimension
@param linearRing
@param dimension
@return | [
"Force",
"the",
"dimension",
"of",
"the",
"LinearRing",
"and",
"update",
"correctly",
"the",
"coordinate",
"dimension"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L154-L156 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java | GeometryCoordinateDimension.convertSequence | private static CoordinateArraySequence convertSequence(Coordinate[] cs,int dimension) {
for (int i = 0; i < cs.length; i++) {
Coordinate coord = cs[i];
switch (dimension) {
case 2:
coord.z = Double.NaN;
cs[i]=coord;
... | java | private static CoordinateArraySequence convertSequence(Coordinate[] cs,int dimension) {
for (int i = 0; i < cs.length; i++) {
Coordinate coord = cs[i];
switch (dimension) {
case 2:
coord.z = Double.NaN;
cs[i]=coord;
... | [
"private",
"static",
"CoordinateArraySequence",
"convertSequence",
"(",
"Coordinate",
"[",
"]",
"cs",
",",
"int",
"dimension",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cs",
".",
"length",
";",
"i",
"++",
")",
"{",
"Coordinate",
"coor... | Create a new CoordinateArraySequence and update its dimension
@param cs a coordinate array
@return a new CoordinateArraySequence | [
"Create",
"a",
"new",
"CoordinateArraySequence",
"and",
"update",
"its",
"dimension"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L164-L185 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_CompactnessRatio.java | ST_CompactnessRatio.computeCompacity | public static Double computeCompacity(Geometry geom) {
if(geom == null){
return null;
}
if (geom instanceof Polygon) {
final double circleRadius = Math.sqrt(geom.getArea() / Math.PI);
final double circleCurcumference = 2 * Math.PI * circleRadius;
r... | java | public static Double computeCompacity(Geometry geom) {
if(geom == null){
return null;
}
if (geom instanceof Polygon) {
final double circleRadius = Math.sqrt(geom.getArea() / Math.PI);
final double circleCurcumference = 2 * Math.PI * circleRadius;
r... | [
"public",
"static",
"Double",
"computeCompacity",
"(",
"Geometry",
"geom",
")",
"{",
"if",
"(",
"geom",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"geom",
"instanceof",
"Polygon",
")",
"{",
"final",
"double",
"circleRadius",
"=",
"Mat... | Returns the compactness ratio of the given polygon
@param geom Geometry
@return The compactness ratio of the given polygon | [
"Returns",
"the",
"compactness",
"ratio",
"of",
"the",
"given",
"polygon"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_CompactnessRatio.java#L60-L70 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_3DArea.java | ST_3DArea.st3darea | public static Double st3darea(Geometry geometry) {
if (geometry == null) {
return null;
}
double area = 0;
for (int idPoly = 0; idPoly < geometry.getNumGeometries(); idPoly++) {
Geometry subGeom = geometry.getGeometryN(idPoly);
if (subGeom instanceof P... | java | public static Double st3darea(Geometry geometry) {
if (geometry == null) {
return null;
}
double area = 0;
for (int idPoly = 0; idPoly < geometry.getNumGeometries(); idPoly++) {
Geometry subGeom = geometry.getGeometryN(idPoly);
if (subGeom instanceof P... | [
"public",
"static",
"Double",
"st3darea",
"(",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"double",
"area",
"=",
"0",
";",
"for",
"(",
"int",
"idPoly",
"=",
"0",
";",
"idPoly",
"<",
... | Compute the 3D area of a polygon a geometrycollection that contains
polygons
@param geometry
@return | [
"Compute",
"the",
"3D",
"area",
"of",
"a",
"polygon",
"a",
"geometrycollection",
"that",
"contains",
"polygons"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_3DArea.java#L52-L64 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_3DArea.java | ST_3DArea.compute3DArea | private static Double compute3DArea(Polygon geometry) {
DelaunayData delaunayData = new DelaunayData();
delaunayData.put(geometry, DelaunayData.MODE.TESSELLATION);
// Do triangulation
delaunayData.triangulate();
return delaunayData.get3DArea();
} | java | private static Double compute3DArea(Polygon geometry) {
DelaunayData delaunayData = new DelaunayData();
delaunayData.put(geometry, DelaunayData.MODE.TESSELLATION);
// Do triangulation
delaunayData.triangulate();
return delaunayData.get3DArea();
} | [
"private",
"static",
"Double",
"compute3DArea",
"(",
"Polygon",
"geometry",
")",
"{",
"DelaunayData",
"delaunayData",
"=",
"new",
"DelaunayData",
"(",
")",
";",
"delaunayData",
".",
"put",
"(",
"geometry",
",",
"DelaunayData",
".",
"MODE",
".",
"TESSELLATION",
... | Compute the 3D area of a polygon
@param geometry
@return | [
"Compute",
"the",
"3D",
"area",
"of",
"a",
"polygon"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_3DArea.java#L72-L78 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/crs/ST_SetSRID.java | ST_SetSRID.setSRID | public static Geometry setSRID(Geometry geometry, Integer srid) throws IllegalArgumentException {
if (geometry == null) {
return null;
}
if (srid == null) {
throw new IllegalArgumentException("The SRID code cannot be null.");
}
Geometry geom = geometry.cop... | java | public static Geometry setSRID(Geometry geometry, Integer srid) throws IllegalArgumentException {
if (geometry == null) {
return null;
}
if (srid == null) {
throw new IllegalArgumentException("The SRID code cannot be null.");
}
Geometry geom = geometry.cop... | [
"public",
"static",
"Geometry",
"setSRID",
"(",
"Geometry",
"geometry",
",",
"Integer",
"srid",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"srid",
"==",
"null",
")",... | Set a new SRID to the geometry
@param geometry
@param srid
@return
@throws IllegalArgumentException | [
"Set",
"a",
"new",
"SRID",
"to",
"the",
"geometry"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/crs/ST_SetSRID.java#L51-L61 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/json/JsonWrite.java | JsonWrite.writeGeoJson | public static void writeGeoJson(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException {
JsonDriverFunction jsonDriver = new JsonDriverFunction();
jsonDriver.exportTable(connection,tableReference, URIUtilities.fileFromString(fileName), ne... | java | public static void writeGeoJson(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException {
JsonDriverFunction jsonDriver = new JsonDriverFunction();
jsonDriver.exportTable(connection,tableReference, URIUtilities.fileFromString(fileName), ne... | [
"public",
"static",
"void",
"writeGeoJson",
"(",
"Connection",
"connection",
",",
"String",
"fileName",
",",
"String",
"tableReference",
",",
"String",
"encoding",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"JsonDriverFunction",
"jsonDriver",
"=",
"new"... | Write the JSON file.
@param connection
@param fileName
@param tableReference
@param encoding
@throws IOException
@throws SQLException | [
"Write",
"the",
"JSON",
"file",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/json/JsonWrite.java#L57-L60 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/type/GeometryTypeFromConstraint.java | GeometryTypeFromConstraint.geometryTypeFromConstraint | public static int geometryTypeFromConstraint(String constraint, int numericPrecision) {
if(constraint.isEmpty() && numericPrecision > GeometryTypeCodes.GEOMETRYZM) {
return GeometryTypeCodes.GEOMETRY;
}
// Use Domain given parameters
if(numericPrecision <= GeometryTypeCodes.G... | java | public static int geometryTypeFromConstraint(String constraint, int numericPrecision) {
if(constraint.isEmpty() && numericPrecision > GeometryTypeCodes.GEOMETRYZM) {
return GeometryTypeCodes.GEOMETRY;
}
// Use Domain given parameters
if(numericPrecision <= GeometryTypeCodes.G... | [
"public",
"static",
"int",
"geometryTypeFromConstraint",
"(",
"String",
"constraint",
",",
"int",
"numericPrecision",
")",
"{",
"if",
"(",
"constraint",
".",
"isEmpty",
"(",
")",
"&&",
"numericPrecision",
">",
"GeometryTypeCodes",
".",
"GEOMETRYZM",
")",
"{",
"r... | Convert H2 constraint string into a OGC geometry type index.
@param constraint SQL Constraint ex: ST_GeometryTypeCode(the_geom) = 5
@param numericPrecision This parameter is available if the user give domain
@return Geometry type code {@link org.h2gis.utilities.GeometryTypeCodes} | [
"Convert",
"H2",
"constraint",
"string",
"into",
"a",
"OGC",
"geometry",
"type",
"index",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/type/GeometryTypeFromConstraint.java#L57-L72 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java | DBFDriverFunction.getQuestionMark | public static String getQuestionMark(int count) {
StringBuilder qMark = new StringBuilder();
for (int i = 0; i < count; i++) {
if(i > 0) {
qMark.append(", ");
}
qMark.append("?");
}
return qMark.toString();
} | java | public static String getQuestionMark(int count) {
StringBuilder qMark = new StringBuilder();
for (int i = 0; i < count; i++) {
if(i > 0) {
qMark.append(", ");
}
qMark.append("?");
}
return qMark.toString();
} | [
"public",
"static",
"String",
"getQuestionMark",
"(",
"int",
"count",
")",
"{",
"StringBuilder",
"qMark",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i"... | Generate the concatenation of ? characters. Used by PreparedStatement.
@param count Number of ? character to generation
@return Value ex: "?, ?, ?" | [
"Generate",
"the",
"concatenation",
"of",
"?",
"characters",
".",
"Used",
"by",
"PreparedStatement",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java#L286-L295 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java | DBFDriverFunction.getSQLColumnTypes | public static String getSQLColumnTypes(DbaseFileHeader header, boolean isH2Database) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
for(int idColumn = 0; idColumn < header.getNumFields(); idColumn++) {
if(idColumn > 0) {
stringBuilder.append(", ");
... | java | public static String getSQLColumnTypes(DbaseFileHeader header, boolean isH2Database) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
for(int idColumn = 0; idColumn < header.getNumFields(); idColumn++) {
if(idColumn > 0) {
stringBuilder.append(", ");
... | [
"public",
"static",
"String",
"getSQLColumnTypes",
"(",
"DbaseFileHeader",
"header",
",",
"boolean",
"isH2Database",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"idColumn",
"="... | Return SQL Columns declaration
@param header DBAse file header
@param isH2Database true if H2 database
@return Array of columns ex: ["id INTEGER", "len DOUBLE"]
@throws IOException | [
"Return",
"SQL",
"Columns",
"declaration"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java#L304-L358 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java | DBFDriverFunction.dBaseHeaderFromMetaData | public static DbaseFileHeader dBaseHeaderFromMetaData(ResultSetMetaData metaData, List<Integer> retainedColumns) throws SQLException {
DbaseFileHeader dbaseFileHeader = new DbaseFileHeader();
for(int fieldId= 1; fieldId <= metaData.getColumnCount(); fieldId++) {
final String fieldTypeName = ... | java | public static DbaseFileHeader dBaseHeaderFromMetaData(ResultSetMetaData metaData, List<Integer> retainedColumns) throws SQLException {
DbaseFileHeader dbaseFileHeader = new DbaseFileHeader();
for(int fieldId= 1; fieldId <= metaData.getColumnCount(); fieldId++) {
final String fieldTypeName = ... | [
"public",
"static",
"DbaseFileHeader",
"dBaseHeaderFromMetaData",
"(",
"ResultSetMetaData",
"metaData",
",",
"List",
"<",
"Integer",
">",
"retainedColumns",
")",
"throws",
"SQLException",
"{",
"DbaseFileHeader",
"dbaseFileHeader",
"=",
"new",
"DbaseFileHeader",
"(",
")"... | Create a DBF header from the columns specified in parameter.
@param metaData SQL ResultSetMetadata
@param retainedColumns list of column indexes
@return DbfaseFileHeader instance.
@throws SQLException If one or more type are not supported by DBF | [
"Create",
"a",
"DBF",
"header",
"from",
"the",
"columns",
"specified",
"in",
"parameter",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java#L367-L383 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemovePoints.java | ST_RemovePoints.removePoint | public static Geometry removePoint(Geometry geometry, Polygon polygon) throws SQLException {
if(geometry == null){
return null;
}
GeometryEditor localGeometryEditor = new GeometryEditor();
PolygonDeleteVertexOperation localBoxDeleteVertexOperation = new PolygonDeleteVertexOpe... | java | public static Geometry removePoint(Geometry geometry, Polygon polygon) throws SQLException {
if(geometry == null){
return null;
}
GeometryEditor localGeometryEditor = new GeometryEditor();
PolygonDeleteVertexOperation localBoxDeleteVertexOperation = new PolygonDeleteVertexOpe... | [
"public",
"static",
"Geometry",
"removePoint",
"(",
"Geometry",
"geometry",
",",
"Polygon",
"polygon",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"GeometryEditor",
"localGeometryEditor",
"=",
... | Remove all vertices that are located within a polygon
@param geometry
@param polygon
@return
@throws SQLException | [
"Remove",
"all",
"vertices",
"that",
"are",
"located",
"within",
"a",
"polygon"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemovePoints.java#L54-L65 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/URIUtilities.java | URIUtilities.getQueryKeyValuePairs | public static Map<String,String> getQueryKeyValuePairs(URI uri) throws UnsupportedEncodingException {
Map<String,String> queryParameters = new HashMap<String, String>();
String query = uri.getRawQuery();
if(query == null) {
// Maybe invalid URI
try {
uri =... | java | public static Map<String,String> getQueryKeyValuePairs(URI uri) throws UnsupportedEncodingException {
Map<String,String> queryParameters = new HashMap<String, String>();
String query = uri.getRawQuery();
if(query == null) {
// Maybe invalid URI
try {
uri =... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getQueryKeyValuePairs",
"(",
"URI",
"uri",
")",
"throws",
"UnsupportedEncodingException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"queryParameters",
"=",
"new",
"HashMap",
"<",
"String",
","... | Read the Query part of an URI.
@param uri URI to split
@return Key/Value pairs of query, the key is lowercase and value may be null
@throws java.io.UnsupportedEncodingException | [
"Read",
"the",
"Query",
"part",
"of",
"an",
"URI",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/URIUtilities.java#L50-L83 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/URIUtilities.java | URIUtilities.getConcatenatedParameters | public static String getConcatenatedParameters(Map<String, String> parameters, String... keys) {
StringBuilder keyValues = new StringBuilder();
for(String key : keys) {
String value = parameters.get(key.toLowerCase().trim());
if(value!=null) {
if(keyValues.length(... | java | public static String getConcatenatedParameters(Map<String, String> parameters, String... keys) {
StringBuilder keyValues = new StringBuilder();
for(String key : keys) {
String value = parameters.get(key.toLowerCase().trim());
if(value!=null) {
if(keyValues.length(... | [
"public",
"static",
"String",
"getConcatenatedParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"String",
"...",
"keys",
")",
"{",
"StringBuilder",
"keyValues",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"k... | Create the Query part of an URI
@param parameters Parameters to read
@param keys map property to read
@return Query part of an URI | [
"Create",
"the",
"Query",
"part",
"of",
"an",
"URI"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/URIUtilities.java#L93-L107 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/URIUtilities.java | URIUtilities.relativize | public static URI relativize(URI base,URI target) {
if(!base.getScheme().equals(target.getScheme())) {
return target;
}
StringBuilder rel = new StringBuilder();
String path = base.getPath();
String separator = "/";
StringTokenizer tokenizer = new StringTokeniz... | java | public static URI relativize(URI base,URI target) {
if(!base.getScheme().equals(target.getScheme())) {
return target;
}
StringBuilder rel = new StringBuilder();
String path = base.getPath();
String separator = "/";
StringTokenizer tokenizer = new StringTokeniz... | [
"public",
"static",
"URI",
"relativize",
"(",
"URI",
"base",
",",
"URI",
"target",
")",
"{",
"if",
"(",
"!",
"base",
".",
"getScheme",
"(",
")",
".",
"equals",
"(",
"target",
".",
"getScheme",
"(",
")",
")",
")",
"{",
"return",
"target",
";",
"}",
... | Enhanced version of URI.relativize, the target can now be in parent folder of base URI.
@param base Base uri, location from where to relativize.
@param target Target uri, final destination of returned URI.
@return Non-absolute URI, or target if target scheme is different than base scheme. | [
"Enhanced",
"version",
"of",
"URI",
".",
"relativize",
"the",
"target",
"can",
"now",
"be",
"in",
"parent",
"folder",
"of",
"base",
"URI",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/URIUtilities.java#L117-L160 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/URIUtilities.java | URIUtilities.fileFromString | public static File fileFromString(String fileName) {
try {
return new File(new URI(fileName).getPath());
} catch (URISyntaxException ex ) {
// Not a valid uri
return new File(fileName);
}
} | java | public static File fileFromString(String fileName) {
try {
return new File(new URI(fileName).getPath());
} catch (URISyntaxException ex ) {
// Not a valid uri
return new File(fileName);
}
} | [
"public",
"static",
"File",
"fileFromString",
"(",
"String",
"fileName",
")",
"{",
"try",
"{",
"return",
"new",
"File",
"(",
"new",
"URI",
"(",
"fileName",
")",
".",
"getPath",
"(",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"ex",
")",
"{"... | Get a File from the specified file name.
@param fileName File name using Path or URI
@return File path | [
"Get",
"a",
"File",
"from",
"the",
"specified",
"file",
"name",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/URIUtilities.java#L169-L176 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java | ST_GeometryShadow.shadowLine | private static Geometry shadowLine(LineString lineString, double[] shadowOffset, GeometryFactory factory, boolean doUnion) {
Coordinate[] coords = lineString.getCoordinates();
Collection<Polygon> shadows = new ArrayList<Polygon>();
createShadowPolygons(shadows, coords, shadowOffset, factory);
... | java | private static Geometry shadowLine(LineString lineString, double[] shadowOffset, GeometryFactory factory, boolean doUnion) {
Coordinate[] coords = lineString.getCoordinates();
Collection<Polygon> shadows = new ArrayList<Polygon>();
createShadowPolygons(shadows, coords, shadowOffset, factory);
... | [
"private",
"static",
"Geometry",
"shadowLine",
"(",
"LineString",
"lineString",
",",
"double",
"[",
"]",
"shadowOffset",
",",
"GeometryFactory",
"factory",
",",
"boolean",
"doUnion",
")",
"{",
"Coordinate",
"[",
"]",
"coords",
"=",
"lineString",
".",
"getCoordin... | Compute the shadow for a linestring
@param lineString the input linestring
@param shadowOffset computed according the sun position and the height of
the geometry
@return | [
"Compute",
"the",
"shadow",
"for",
"a",
"linestring"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L133-L148 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java | ST_GeometryShadow.shadowPolygon | private static Geometry shadowPolygon(Polygon polygon, double[] shadowOffset, GeometryFactory factory, boolean doUnion) {
Coordinate[] shellCoords = polygon.getExteriorRing().getCoordinates();
Collection<Polygon> shadows = new ArrayList<Polygon>();
createShadowPolygons(shadows, shellCoords, shad... | java | private static Geometry shadowPolygon(Polygon polygon, double[] shadowOffset, GeometryFactory factory, boolean doUnion) {
Coordinate[] shellCoords = polygon.getExteriorRing().getCoordinates();
Collection<Polygon> shadows = new ArrayList<Polygon>();
createShadowPolygons(shadows, shellCoords, shad... | [
"private",
"static",
"Geometry",
"shadowPolygon",
"(",
"Polygon",
"polygon",
",",
"double",
"[",
"]",
"shadowOffset",
",",
"GeometryFactory",
"factory",
",",
"boolean",
"doUnion",
")",
"{",
"Coordinate",
"[",
"]",
"shellCoords",
"=",
"polygon",
".",
"getExterior... | Compute the shadow for a polygon
@param polygon the input polygon
@param shadowOffset computed according the sun position and the height of
the geometry
@return | [
"Compute",
"the",
"shadow",
"for",
"a",
"polygon"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L158-L182 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java | ST_GeometryShadow.shadowPoint | private static Geometry shadowPoint(Point point, double[] shadowOffset, GeometryFactory factory) {
Coordinate startCoord = point.getCoordinate();
Coordinate offset = moveCoordinate(startCoord, shadowOffset);
if (offset.distance(point.getCoordinate()) < 10E-3) {
return point;
... | java | private static Geometry shadowPoint(Point point, double[] shadowOffset, GeometryFactory factory) {
Coordinate startCoord = point.getCoordinate();
Coordinate offset = moveCoordinate(startCoord, shadowOffset);
if (offset.distance(point.getCoordinate()) < 10E-3) {
return point;
... | [
"private",
"static",
"Geometry",
"shadowPoint",
"(",
"Point",
"point",
",",
"double",
"[",
"]",
"shadowOffset",
",",
"GeometryFactory",
"factory",
")",
"{",
"Coordinate",
"startCoord",
"=",
"point",
".",
"getCoordinate",
"(",
")",
";",
"Coordinate",
"offset",
... | Compute the shadow for a point
@param point the input point
@param shadowOffset computed according the sun position and the height of
the geometry
@return | [
"Compute",
"the",
"shadow",
"for",
"a",
"point"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L192-L201 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java | ST_GeometryShadow.shadowOffset | public static double[] shadowOffset(double azimuth, double altitude, double height) {
double spread = 1 / Math.tan(altitude);
return new double[]{-height * spread * Math.sin(azimuth), -height * spread * Math.cos(azimuth)};
} | java | public static double[] shadowOffset(double azimuth, double altitude, double height) {
double spread = 1 / Math.tan(altitude);
return new double[]{-height * spread * Math.sin(azimuth), -height * spread * Math.cos(azimuth)};
} | [
"public",
"static",
"double",
"[",
"]",
"shadowOffset",
"(",
"double",
"azimuth",
",",
"double",
"altitude",
",",
"double",
"height",
")",
"{",
"double",
"spread",
"=",
"1",
"/",
"Math",
".",
"tan",
"(",
"altitude",
")",
";",
"return",
"new",
"double",
... | Return the shadow offset in X and Y directions
@param azimuth in radians from north.
@param altitude in radians from east.
@param height of the geometry
@return | [
"Return",
"the",
"shadow",
"offset",
"in",
"X",
"and",
"Y",
"directions"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L211-L214 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java | ST_GeometryShadow.moveCoordinate | private static Coordinate moveCoordinate(Coordinate inputCoordinate, double[] shadowOffset) {
return new Coordinate(inputCoordinate.x + shadowOffset[0], inputCoordinate.y + shadowOffset[1], 0);
} | java | private static Coordinate moveCoordinate(Coordinate inputCoordinate, double[] shadowOffset) {
return new Coordinate(inputCoordinate.x + shadowOffset[0], inputCoordinate.y + shadowOffset[1], 0);
} | [
"private",
"static",
"Coordinate",
"moveCoordinate",
"(",
"Coordinate",
"inputCoordinate",
",",
"double",
"[",
"]",
"shadowOffset",
")",
"{",
"return",
"new",
"Coordinate",
"(",
"inputCoordinate",
".",
"x",
"+",
"shadowOffset",
"[",
"0",
"]",
",",
"inputCoordina... | Move the input coordinate according X and Y offset
@param inputCoordinate
@param shadowOffset
@return | [
"Move",
"the",
"input",
"coordinate",
"according",
"X",
"and",
"Y",
"offset"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L223-L225 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java | ST_GeometryShadow.createShadowPolygons | private static void createShadowPolygons(Collection<Polygon> shadows, Coordinate[] coordinates, double[] shadow, GeometryFactory factory) {
for (int i = 1; i < coordinates.length; i++) {
Coordinate startCoord = coordinates[i - 1];
Coordinate endCoord = coordinates[i];
Coordin... | java | private static void createShadowPolygons(Collection<Polygon> shadows, Coordinate[] coordinates, double[] shadow, GeometryFactory factory) {
for (int i = 1; i < coordinates.length; i++) {
Coordinate startCoord = coordinates[i - 1];
Coordinate endCoord = coordinates[i];
Coordin... | [
"private",
"static",
"void",
"createShadowPolygons",
"(",
"Collection",
"<",
"Polygon",
">",
"shadows",
",",
"Coordinate",
"[",
"]",
"coordinates",
",",
"double",
"[",
"]",
"shadow",
",",
"GeometryFactory",
"factory",
")",
"{",
"for",
"(",
"int",
"i",
"=",
... | Create and collect shadow polygons.
@param shadows
@param coordinates
@param shadow
@param factory | [
"Create",
"and",
"collect",
"shadow",
"polygons",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L235-L248 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/csv/CSVDriverFunction.java | CSVDriverFunction.exportTable | public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String csvOptions) throws SQLException, IOException {
String regex = ".*(?i)\\b(select|from)\\b.*";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(tableRefe... | java | public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String csvOptions) throws SQLException, IOException {
String regex = ".*(?i)\\b(select|from)\\b.*";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(tableRefe... | [
"public",
"void",
"exportTable",
"(",
"Connection",
"connection",
",",
"String",
"tableReference",
",",
"File",
"fileName",
",",
"ProgressVisitor",
"progress",
",",
"String",
"csvOptions",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"String",
"regex",
... | Export a table or a query to a CSV file
@param connection Active connection, do not close this connection.
@param tableReference [[catalog.]schema.]table reference
@param fileName File path to read
@param progress
@param csvOptions the CSV options ie "charset=UTF-8 fieldSeparator=| fieldDelimiter=,"
@throws SQLExcept... | [
"Export",
"a",
"table",
"or",
"a",
"query",
"to",
"a",
"CSV",
"file"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/csv/CSVDriverFunction.java#L94-L128 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/ST_Delaunay.java | ST_Delaunay.createDT | public static GeometryCollection createDT(Geometry geometry, int flag) throws SQLException {
if (geometry != null) {
DelaunayTriangulationBuilder triangulationBuilder = new DelaunayTriangulationBuilder();
triangulationBuilder.setSites(geometry);
if(flag == 0) {
... | java | public static GeometryCollection createDT(Geometry geometry, int flag) throws SQLException {
if (geometry != null) {
DelaunayTriangulationBuilder triangulationBuilder = new DelaunayTriangulationBuilder();
triangulationBuilder.setSites(geometry);
if(flag == 0) {
... | [
"public",
"static",
"GeometryCollection",
"createDT",
"(",
"Geometry",
"geometry",
",",
"int",
"flag",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometry",
"!=",
"null",
")",
"{",
"DelaunayTriangulationBuilder",
"triangulationBuilder",
"=",
"new",
"DelaunayTri... | Build a delaunay triangulation based on all coordinates of the geometry
@param geometry
@param flag for flag=0 (default flag) or a MULTILINESTRING for flag=1
@return a set of polygons (triangles)
@throws SQLException | [
"Build",
"a",
"delaunay",
"triangulation",
"based",
"on",
"all",
"coordinates",
"of",
"the",
"geometry"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/ST_Delaunay.java#L71-L82 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/kml/ST_AsKml.java | ST_AsKml.toKml | public static String toKml(Geometry geometry) throws SQLException {
StringBuilder sb = new StringBuilder();
KMLGeometry.toKMLGeometry(geometry, sb);
return sb.toString();
} | java | public static String toKml(Geometry geometry) throws SQLException {
StringBuilder sb = new StringBuilder();
KMLGeometry.toKMLGeometry(geometry, sb);
return sb.toString();
} | [
"public",
"static",
"String",
"toKml",
"(",
"Geometry",
"geometry",
")",
"throws",
"SQLException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"KMLGeometry",
".",
"toKMLGeometry",
"(",
"geometry",
",",
"sb",
")",
";",
"return",
"s... | Generate a KML geometry
@param geometry
@return
@throws SQLException | [
"Generate",
"a",
"KML",
"geometry"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/ST_AsKml.java#L57-L61 | train |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/kml/ST_AsKml.java | ST_AsKml.toKml | public static String toKml(Geometry geometry, boolean extrude, int altitudeModeEnum) throws SQLException {
StringBuilder sb = new StringBuilder();
if (extrude) {
KMLGeometry.toKMLGeometry(geometry, ExtrudeMode.TRUE, altitudeModeEnum, sb);
} else {
KMLGeometry.toKMLGeometr... | java | public static String toKml(Geometry geometry, boolean extrude, int altitudeModeEnum) throws SQLException {
StringBuilder sb = new StringBuilder();
if (extrude) {
KMLGeometry.toKMLGeometry(geometry, ExtrudeMode.TRUE, altitudeModeEnum, sb);
} else {
KMLGeometry.toKMLGeometr... | [
"public",
"static",
"String",
"toKml",
"(",
"Geometry",
"geometry",
",",
"boolean",
"extrude",
",",
"int",
"altitudeModeEnum",
")",
"throws",
"SQLException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"extrude",
")",
"... | Generates a KML geometry. Specifies the extrude and altitudeMode.
Available extrude values are true, false or none.
Supported altitude mode :
For KML profil
CLAMPTOGROUND = 1; RELATIVETOGROUND = 2; ABSOLUTE = 4;
For GX profil CLAMPTOSEAFLOOR = 8; RELATIVETOSEAFLOOR = 16;
No altitude : NONE = 0;
@param geometry
@... | [
"Generates",
"a",
"KML",
"geometry",
".",
"Specifies",
"the",
"extrude",
"and",
"altitudeMode",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/ST_AsKml.java#L84-L92 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getGeometryTypeFromGeometry | public static int getGeometryTypeFromGeometry(Geometry geometry) {
Integer sfsGeomCode = GEOM_TYPE_TO_SFS_CODE.get(geometry.getGeometryType().toLowerCase());
if(sfsGeomCode == null) {
return GeometryTypeCodes.GEOMETRY;
} else {
return sfsGeomCode;
}
} | java | public static int getGeometryTypeFromGeometry(Geometry geometry) {
Integer sfsGeomCode = GEOM_TYPE_TO_SFS_CODE.get(geometry.getGeometryType().toLowerCase());
if(sfsGeomCode == null) {
return GeometryTypeCodes.GEOMETRY;
} else {
return sfsGeomCode;
}
} | [
"public",
"static",
"int",
"getGeometryTypeFromGeometry",
"(",
"Geometry",
"geometry",
")",
"{",
"Integer",
"sfsGeomCode",
"=",
"GEOM_TYPE_TO_SFS_CODE",
".",
"get",
"(",
"geometry",
".",
"getGeometryType",
"(",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
... | Return the sfs geometry type identifier of the provided Geometry
@param geometry Geometry instance
@return The sfs geometry type identifier | [
"Return",
"the",
"sfs",
"geometry",
"type",
"identifier",
"of",
"the",
"provided",
"Geometry"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L79-L86 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getGeometryType | public static int getGeometryType(Connection connection,TableLocation location, String fieldName)
throws SQLException {
if(fieldName==null || fieldName.isEmpty()) {
List<String> geometryFields = getGeometryFields(connection, location);
if(geometryFields.isEmpty()) {
... | java | public static int getGeometryType(Connection connection,TableLocation location, String fieldName)
throws SQLException {
if(fieldName==null || fieldName.isEmpty()) {
List<String> geometryFields = getGeometryFields(connection, location);
if(geometryFields.isEmpty()) {
... | [
"public",
"static",
"int",
"getGeometryType",
"(",
"Connection",
"connection",
",",
"TableLocation",
"location",
",",
"String",
"fieldName",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"fieldName",
"==",
"null",
"||",
"fieldName",
".",
"isEmpty",
"(",
")",
... | Return the sfs geometry type identifier of the provided field of the provided table.
@param connection Active connection
@param location Catalog, schema and table name
@param fieldName Geometry field name or empty (take the first one)
@return The sfs geometry type identifier
@see GeometryTypeCodes
@throws SQLExcept... | [
"Return",
"the",
"sfs",
"geometry",
"type",
"identifier",
"of",
"the",
"provided",
"field",
"of",
"the",
"provided",
"table",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L101-L124 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getGeometryTypes | public static Map<String, Integer> getGeometryTypes(Connection connection, TableLocation location)
throws SQLException {
Map<String, Integer> map = new HashMap<>();
ResultSet geomResultSet = getGeometryColumnsView(connection,location.getCatalog(),location.getSchema(),
locatio... | java | public static Map<String, Integer> getGeometryTypes(Connection connection, TableLocation location)
throws SQLException {
Map<String, Integer> map = new HashMap<>();
ResultSet geomResultSet = getGeometryColumnsView(connection,location.getCatalog(),location.getSchema(),
locatio... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Integer",
">",
"getGeometryTypes",
"(",
"Connection",
"connection",
",",
"TableLocation",
"location",
")",
"throws",
"SQLException",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"map",
"=",
"new",
"HashMap",
... | Returns a map containing the field names as key and the SFS geometry type as value from the given table.
@param connection Active connection
@param location Catalog, schema and table name
@return A map containing the geometric fields names as key and the SFS geometry type as value.
@see GeometryTypeCodes
@throws SQ... | [
"Returns",
"a",
"map",
"containing",
"the",
"field",
"names",
"as",
"key",
"and",
"the",
"SFS",
"geometry",
"type",
"as",
"value",
"from",
"the",
"given",
"table",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L138-L155 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getTableEnvelope | public static Envelope getTableEnvelope(Connection connection, TableLocation location, String geometryField)
throws SQLException {
if(geometryField==null || geometryField.isEmpty()) {
List<String> geometryFields = getGeometryFields(connection, location);
if(geometryFields.isE... | java | public static Envelope getTableEnvelope(Connection connection, TableLocation location, String geometryField)
throws SQLException {
if(geometryField==null || geometryField.isEmpty()) {
List<String> geometryFields = getGeometryFields(connection, location);
if(geometryFields.isE... | [
"public",
"static",
"Envelope",
"getTableEnvelope",
"(",
"Connection",
"connection",
",",
"TableLocation",
"location",
",",
"String",
"geometryField",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometryField",
"==",
"null",
"||",
"geometryField",
".",
"isEmpty"... | Merge the bounding box of all geometries inside the provided table.
@param connection Active connection (not closed by this function)
@param location Location of the table
@param geometryField Geometry field or empty string (take the first geometry field)
@return Envelope of the table
@throws SQLException If the tab... | [
"Merge",
"the",
"bounding",
"box",
"of",
"all",
"geometries",
"inside",
"the",
"provided",
"table",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L212-L229 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.prepareInformationSchemaStatement | public static PreparedStatement prepareInformationSchemaStatement(Connection connection,String catalog,
String schema, String table,
String informationSchemaTable,
... | java | public static PreparedStatement prepareInformationSchemaStatement(Connection connection,String catalog,
String schema, String table,
String informationSchemaTable,
... | [
"public",
"static",
"PreparedStatement",
"prepareInformationSchemaStatement",
"(",
"Connection",
"connection",
",",
"String",
"catalog",
",",
"String",
"schema",
",",
"String",
"table",
",",
"String",
"informationSchemaTable",
",",
"String",
"endQuery",
",",
"String",
... | For table containing catalog, schema and table name, this function create a prepared statement with a filter
on this combination.
@param connection Active connection
@param catalog Table catalog, may be empty
@param schema Table schema, may be empty
@param table Table name
@param informationSchemaTable Information tab... | [
"For",
"table",
"containing",
"catalog",
"schema",
"and",
"table",
"name",
"this",
"function",
"create",
"a",
"prepared",
"statement",
"with",
"a",
"filter",
"on",
"this",
"combination",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L263-L300 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.prepareInformationSchemaStatement | public static PreparedStatement prepareInformationSchemaStatement(Connection connection,String catalog,
String schema, String table,
String informationSchemaTable, String endQuery)... | java | public static PreparedStatement prepareInformationSchemaStatement(Connection connection,String catalog,
String schema, String table,
String informationSchemaTable, String endQuery)... | [
"public",
"static",
"PreparedStatement",
"prepareInformationSchemaStatement",
"(",
"Connection",
"connection",
",",
"String",
"catalog",
",",
"String",
"schema",
",",
"String",
"table",
",",
"String",
"informationSchemaTable",
",",
"String",
"endQuery",
")",
"throws",
... | For table containing catalog, schema and table name, this function create a prepared statement with a filter on
this combination. Use "f_table_catalog","f_table_schema","f_table_name" as field names.
@param connection Active connection
@param catalog Table catalog, may be empty
@param schema Table schema, may be empty... | [
"For",
"table",
"containing",
"catalog",
"schema",
"and",
"table",
"name",
"this",
"function",
"create",
"a",
"prepared",
"statement",
"with",
"a",
"filter",
"on",
"this",
"combination",
".",
"Use",
"f_table_catalog",
"f_table_schema",
"f_table_name",
"as",
"field... | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L317-L323 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getGeometryFields | public static List<String> getGeometryFields(ResultSet resultSet) throws SQLException {
List<String> fieldsName = new LinkedList<>();
ResultSetMetaData meta = resultSet.getMetaData();
int columnCount = meta.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
if (meta.g... | java | public static List<String> getGeometryFields(ResultSet resultSet) throws SQLException {
List<String> fieldsName = new LinkedList<>();
ResultSetMetaData meta = resultSet.getMetaData();
int columnCount = meta.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
if (meta.g... | [
"public",
"static",
"List",
"<",
"String",
">",
"getGeometryFields",
"(",
"ResultSet",
"resultSet",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"String",
">",
"fieldsName",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"ResultSetMetaData",
"meta",
"=",
... | Find geometry fields name of a resultSet.
@param resultSet ResultSet to analyse
@return A list of Geometry fields name
@throws SQLException | [
"Find",
"geometry",
"fields",
"name",
"of",
"a",
"resultSet",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L363-L373 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.hasGeometryField | public static boolean hasGeometryField(ResultSet resultSet) throws SQLException {
ResultSetMetaData meta = resultSet.getMetaData();
int columnCount = meta.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
if (meta.getColumnTypeName(i).equalsIgnoreCase("geometry")) {
... | java | public static boolean hasGeometryField(ResultSet resultSet) throws SQLException {
ResultSetMetaData meta = resultSet.getMetaData();
int columnCount = meta.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
if (meta.getColumnTypeName(i).equalsIgnoreCase("geometry")) {
... | [
"public",
"static",
"boolean",
"hasGeometryField",
"(",
"ResultSet",
"resultSet",
")",
"throws",
"SQLException",
"{",
"ResultSetMetaData",
"meta",
"=",
"resultSet",
".",
"getMetaData",
"(",
")",
";",
"int",
"columnCount",
"=",
"meta",
".",
"getColumnCount",
"(",
... | Check if the ResultSet contains a geometry field
@param resultSet ResultSet to analyse
@return True if the ResultSet contains one geometry field
@throws SQLException | [
"Check",
"if",
"the",
"ResultSet",
"contains",
"a",
"geometry",
"field"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L427-L436 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getResultSetEnvelope | public static Envelope getResultSetEnvelope(ResultSet resultSet) throws SQLException {
List<String> geometryFields = getGeometryFields(resultSet);
if (geometryFields.isEmpty()) {
throw new SQLException("This ResultSet doesn't contain any geometry field.");
} else {
return... | java | public static Envelope getResultSetEnvelope(ResultSet resultSet) throws SQLException {
List<String> geometryFields = getGeometryFields(resultSet);
if (geometryFields.isEmpty()) {
throw new SQLException("This ResultSet doesn't contain any geometry field.");
} else {
return... | [
"public",
"static",
"Envelope",
"getResultSetEnvelope",
"(",
"ResultSet",
"resultSet",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"String",
">",
"geometryFields",
"=",
"getGeometryFields",
"(",
"resultSet",
")",
";",
"if",
"(",
"geometryFields",
".",
"isEmpt... | Compute the full extend of a ResultSet using the first geometry field. If
the ResultSet does not contain any geometry field throw an exception
@param resultSet ResultSet to analyse
@return The full envelope of the ResultSet
@throws SQLException | [
"Compute",
"the",
"full",
"extend",
"of",
"a",
"ResultSet",
"using",
"the",
"first",
"geometry",
"field",
".",
"If",
"the",
"ResultSet",
"does",
"not",
"contain",
"any",
"geometry",
"field",
"throw",
"an",
"exception"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L448-L455 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getResultSetEnvelope | public static Envelope getResultSetEnvelope(ResultSet resultSet, String fieldName) throws SQLException {
Envelope aggregatedEnvelope = null;
while (resultSet.next()) {
Geometry geom = (Geometry) resultSet.getObject(fieldName);
if (aggregatedEnvelope != null) {
agg... | java | public static Envelope getResultSetEnvelope(ResultSet resultSet, String fieldName) throws SQLException {
Envelope aggregatedEnvelope = null;
while (resultSet.next()) {
Geometry geom = (Geometry) resultSet.getObject(fieldName);
if (aggregatedEnvelope != null) {
agg... | [
"public",
"static",
"Envelope",
"getResultSetEnvelope",
"(",
"ResultSet",
"resultSet",
",",
"String",
"fieldName",
")",
"throws",
"SQLException",
"{",
"Envelope",
"aggregatedEnvelope",
"=",
"null",
";",
"while",
"(",
"resultSet",
".",
"next",
"(",
")",
")",
"{",... | Compute the full extend of a ResultSet using a specified geometry field.
If the ResultSet does not contain this geometry field throw an exception
@param resultSet ResultSet to analyse
@param fieldName Field to analyse
@return The full extend of the field in the ResultSet
@throws SQLException | [
"Compute",
"the",
"full",
"extend",
"of",
"a",
"ResultSet",
"using",
"a",
"specified",
"geometry",
"field",
".",
"If",
"the",
"ResultSet",
"does",
"not",
"contain",
"this",
"geometry",
"field",
"throw",
"an",
"exception"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L468-L479 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.getSRID | public static int getSRID(Connection connection, TableLocation table) throws SQLException {
ResultSet geomResultSet = getGeometryColumnsView(connection, table.getCatalog(), table.getSchema(),
table.getTable());
int srid = 0;
while (geomResultSet.next()) {
srid = geomR... | java | public static int getSRID(Connection connection, TableLocation table) throws SQLException {
ResultSet geomResultSet = getGeometryColumnsView(connection, table.getCatalog(), table.getSchema(),
table.getTable());
int srid = 0;
while (geomResultSet.next()) {
srid = geomR... | [
"public",
"static",
"int",
"getSRID",
"(",
"Connection",
"connection",
",",
"TableLocation",
"table",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"geomResultSet",
"=",
"getGeometryColumnsView",
"(",
"connection",
",",
"table",
".",
"getCatalog",
"(",
")",
","... | Return the SRID of the first geometry column of the input table
@param connection Active connection
@param table Table name
@return The SRID of the first geometry column
@throws SQLException | [
"Return",
"the",
"SRID",
"of",
"the",
"first",
"geometry",
"column",
"of",
"the",
"input",
"table"
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L491-L501 | train |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java | SFSUtilities.addTableSRIDConstraint | public static void addTableSRIDConstraint(Connection connection, TableLocation tableLocation, int srid)
throws SQLException {
//Alter table to set the SRID constraint
if (srid > 0) {
connection.createStatement().execute(String.format("ALTER TABLE %s ADD CHECK ST_SRID(the_geom)=%d... | java | public static void addTableSRIDConstraint(Connection connection, TableLocation tableLocation, int srid)
throws SQLException {
//Alter table to set the SRID constraint
if (srid > 0) {
connection.createStatement().execute(String.format("ALTER TABLE %s ADD CHECK ST_SRID(the_geom)=%d... | [
"public",
"static",
"void",
"addTableSRIDConstraint",
"(",
"Connection",
"connection",
",",
"TableLocation",
"tableLocation",
",",
"int",
"srid",
")",
"throws",
"SQLException",
"{",
"//Alter table to set the SRID constraint",
"if",
"(",
"srid",
">",
"0",
")",
"{",
"... | Alter a table to add a SRID constraint.
The srid must be greater than zero.
@param connection Active connection
@param tableLocation TableLocation of the table to update
@param srid SRID to set
@throws SQLException | [
"Alter",
"a",
"table",
"to",
"add",
"a",
"SRID",
"constraint",
".",
"The",
"srid",
"must",
"be",
"greater",
"than",
"zero",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L586-L593 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockInternetGatewayController.java | MockInternetGatewayController.createInternetGateway | public MockInternetGateway createInternetGateway() {
MockInternetGateway ret = new MockInternetGateway();
ret.setInternetGatewayId("InternetGateway-"
+ UUID.randomUUID().toString().substring(0, INTERNETGATEWAY_ID_POSTFIX_LENGTH));
allMockInternetGateways.put(ret.getInternetGate... | java | public MockInternetGateway createInternetGateway() {
MockInternetGateway ret = new MockInternetGateway();
ret.setInternetGatewayId("InternetGateway-"
+ UUID.randomUUID().toString().substring(0, INTERNETGATEWAY_ID_POSTFIX_LENGTH));
allMockInternetGateways.put(ret.getInternetGate... | [
"public",
"MockInternetGateway",
"createInternetGateway",
"(",
")",
"{",
"MockInternetGateway",
"ret",
"=",
"new",
"MockInternetGateway",
"(",
")",
";",
"ret",
".",
"setInternetGatewayId",
"(",
"\"InternetGateway-\"",
"+",
"UUID",
".",
"randomUUID",
"(",
")",
".",
... | Create the mock InternetGateway.
@return mock InternetGateway. | [
"Create",
"the",
"mock",
"InternetGateway",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockInternetGatewayController.java#L81-L89 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockInternetGatewayController.java | MockInternetGatewayController.attachInternetGateway | public MockInternetGateway attachInternetGateway(final String internetgatewayId,
final String vpcId) {
if (internetgatewayId == null) {
return null;
}
MockInternetGateway ret = allMockInternetGateways.get(internetgatewayId);
if (ret != null) {
MockInte... | java | public MockInternetGateway attachInternetGateway(final String internetgatewayId,
final String vpcId) {
if (internetgatewayId == null) {
return null;
}
MockInternetGateway ret = allMockInternetGateways.get(internetgatewayId);
if (ret != null) {
MockInte... | [
"public",
"MockInternetGateway",
"attachInternetGateway",
"(",
"final",
"String",
"internetgatewayId",
",",
"final",
"String",
"vpcId",
")",
"{",
"if",
"(",
"internetgatewayId",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"MockInternetGateway",
"ret",
"=",... | Attach the mock InternetGateway.
@param vpcId vpc Id for InternetGateway.
@param internetgatewayId
internetgatewayId to be deleted
@return mock InternetGateway. | [
"Attach",
"the",
"mock",
"InternetGateway",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockInternetGatewayController.java#L98-L116 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockInternetGatewayController.java | MockInternetGatewayController.deleteInternetGateway | public MockInternetGateway deleteInternetGateway(final String internetgatewayId) {
if (internetgatewayId != null && allMockInternetGateways.containsKey(internetgatewayId)) {
return allMockInternetGateways.remove(internetgatewayId);
}
return null;
} | java | public MockInternetGateway deleteInternetGateway(final String internetgatewayId) {
if (internetgatewayId != null && allMockInternetGateways.containsKey(internetgatewayId)) {
return allMockInternetGateways.remove(internetgatewayId);
}
return null;
} | [
"public",
"MockInternetGateway",
"deleteInternetGateway",
"(",
"final",
"String",
"internetgatewayId",
")",
"{",
"if",
"(",
"internetgatewayId",
"!=",
"null",
"&&",
"allMockInternetGateways",
".",
"containsKey",
"(",
"internetgatewayId",
")",
")",
"{",
"return",
"allM... | Delete InternetGateway.
@param internetgatewayId
internetgatewayId to be deleted
@return Mock InternetGateway. | [
"Delete",
"InternetGateway",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockInternetGatewayController.java#L125-L131 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java | AbstractMockEc2Instance.getMsFromProperty | private static long getMsFromProperty(final String propertyName,
final String propertyNameInSeconds) {
String property = PropertiesUtils.getProperty(propertyName);
if (property != null) {
return Long.parseLong(property);
}
return Integer.parseInt(PropertiesUtils.g... | java | private static long getMsFromProperty(final String propertyName,
final String propertyNameInSeconds) {
String property = PropertiesUtils.getProperty(propertyName);
if (property != null) {
return Long.parseLong(property);
}
return Integer.parseInt(PropertiesUtils.g... | [
"private",
"static",
"long",
"getMsFromProperty",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"propertyNameInSeconds",
")",
"{",
"String",
"property",
"=",
"PropertiesUtils",
".",
"getProperty",
"(",
"propertyName",
")",
";",
"if",
"(",
"proper... | Get millisecs from properties.
@param propertyName
the property name
@param propertyNameInSeconds
the property name for seconds
@return millisecs | [
"Get",
"millisecs",
"from",
"properties",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java#L495-L503 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java | AbstractMockEc2Instance.initializeInternalTimer | public final void initializeInternalTimer() {
// if it is the first the instance is started, we initialize the
// internal timer thread
if (!internalTimerInitialized) {
TimerTask internalTimerTask = new TimerTask() {
/**
* this method is triggered e... | java | public final void initializeInternalTimer() {
// if it is the first the instance is started, we initialize the
// internal timer thread
if (!internalTimerInitialized) {
TimerTask internalTimerTask = new TimerTask() {
/**
* this method is triggered e... | [
"public",
"final",
"void",
"initializeInternalTimer",
"(",
")",
"{",
"// if it is the first the instance is started, we initialize the",
"// internal timer thread",
"if",
"(",
"!",
"internalTimerInitialized",
")",
"{",
"TimerTask",
"internalTimerTask",
"=",
"new",
"TimerTask",
... | Start scheduling the internal timer that controls the behaviors and states of this mock ec2 instance. | [
"Start",
"scheduling",
"the",
"internal",
"timer",
"that",
"controls",
"the",
"behaviors",
"and",
"states",
"of",
"this",
"mock",
"ec2",
"instance",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java#L639-L723 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java | AbstractMockEc2Instance.start | public final boolean start() {
if (running || booting || stopping || terminated) {
// do nothing if this instance is not stopped
return false;
} else {
// mark this instance started
booting = true;
running = true;
onStarted();
... | java | public final boolean start() {
if (running || booting || stopping || terminated) {
// do nothing if this instance is not stopped
return false;
} else {
// mark this instance started
booting = true;
running = true;
onStarted();
... | [
"public",
"final",
"boolean",
"start",
"(",
")",
"{",
"if",
"(",
"running",
"||",
"booting",
"||",
"stopping",
"||",
"terminated",
")",
"{",
"// do nothing if this instance is not stopped",
"return",
"false",
";",
"}",
"else",
"{",
"// mark this instance started",
... | Start a stopped mock ec2 instance.
@return true for successfully started and false for nothing changed by this action | [
"Start",
"a",
"stopped",
"mock",
"ec2",
"instance",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java#L739-L753 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java | AbstractMockEc2Instance.stop | public final boolean stop() {
if (booting || running) {
stopping = true;
booting = false;
onStopping();
return true;
} else {
return false;
}
} | java | public final boolean stop() {
if (booting || running) {
stopping = true;
booting = false;
onStopping();
return true;
} else {
return false;
}
} | [
"public",
"final",
"boolean",
"stop",
"(",
")",
"{",
"if",
"(",
"booting",
"||",
"running",
")",
"{",
"stopping",
"=",
"true",
";",
"booting",
"=",
"false",
";",
"onStopping",
"(",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",... | Stop this ec2 instance.
@return true for successfully turned into 'stopping' and false for nothing changed | [
"Stop",
"this",
"ec2",
"instance",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java#L760-L771 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java | AbstractMockEc2Instance.getInstanceState | public final InstanceState getInstanceState() {
return isTerminated() ? InstanceState.TERMINATED
: (isBooting() ? InstanceState.PENDING
: (isStopping() ? InstanceState.STOPPING
: (isRunning() ? InstanceState.RUNNING
... | java | public final InstanceState getInstanceState() {
return isTerminated() ? InstanceState.TERMINATED
: (isBooting() ? InstanceState.PENDING
: (isStopping() ? InstanceState.STOPPING
: (isRunning() ? InstanceState.RUNNING
... | [
"public",
"final",
"InstanceState",
"getInstanceState",
"(",
")",
"{",
"return",
"isTerminated",
"(",
")",
"?",
"InstanceState",
".",
"TERMINATED",
":",
"(",
"isBooting",
"(",
")",
"?",
"InstanceState",
".",
"PENDING",
":",
"(",
"isStopping",
"(",
")",
"?",
... | Get state of this mock ec2 instance.
@return state of this mock ec2 instance, should be one of the instance states defined in {@link InstanceState} | [
"Get",
"state",
"of",
"this",
"mock",
"ec2",
"instance",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/model/AbstractMockEc2Instance.java#L795-L801 | train |
treelogic-swe/aws-mock | example/java/simple/DescribeInstancesExample.java | DescribeInstancesExample.describeAllInstances | public static List<Instance> describeAllInstances() {
// pass any credentials as aws-mock does not authenticate them at all
AWSCredentials credentials = new BasicAWSCredentials("foo", "bar");
AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials);
// the mock endpoint for ec... | java | public static List<Instance> describeAllInstances() {
// pass any credentials as aws-mock does not authenticate them at all
AWSCredentials credentials = new BasicAWSCredentials("foo", "bar");
AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials);
// the mock endpoint for ec... | [
"public",
"static",
"List",
"<",
"Instance",
">",
"describeAllInstances",
"(",
")",
"{",
"// pass any credentials as aws-mock does not authenticate them at all",
"AWSCredentials",
"credentials",
"=",
"new",
"BasicAWSCredentials",
"(",
"\"foo\"",
",",
"\"bar\"",
")",
";",
... | Describe all mock instances within aws-mock.
@return a list of all instances | [
"Describe",
"all",
"mock",
"instances",
"within",
"aws",
"-",
"mock",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/example/java/simple/DescribeInstancesExample.java#L34-L60 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockSubnetController.java | MockSubnetController.createSubnet | public MockSubnet createSubnet(
final String cidrBlock, final String vpcId) {
MockSubnet ret = new MockSubnet();
ret.setCidrBlock(cidrBlock);
ret.setSubnetId(
"subnet-" + UUID.randomUUID().toString().substring(0, SUBNET_ID_POSTFIX_LENGTH));
ret.setVpcId(vpcI... | java | public MockSubnet createSubnet(
final String cidrBlock, final String vpcId) {
MockSubnet ret = new MockSubnet();
ret.setCidrBlock(cidrBlock);
ret.setSubnetId(
"subnet-" + UUID.randomUUID().toString().substring(0, SUBNET_ID_POSTFIX_LENGTH));
ret.setVpcId(vpcI... | [
"public",
"MockSubnet",
"createSubnet",
"(",
"final",
"String",
"cidrBlock",
",",
"final",
"String",
"vpcId",
")",
"{",
"MockSubnet",
"ret",
"=",
"new",
"MockSubnet",
"(",
")",
";",
"ret",
".",
"setCidrBlock",
"(",
"cidrBlock",
")",
";",
"ret",
".",
"setSu... | Create the mock Subnet.
@param cidrBlock VPC cidr block.
@param vpcId vpc Id for subnet.
@return mock Subnet. | [
"Create",
"the",
"mock",
"Subnet",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockSubnetController.java#L80-L92 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockSubnetController.java | MockSubnetController.deleteSubnet | public MockSubnet deleteSubnet(final String subnetId) {
if (subnetId != null && allMockSubnets.containsKey(subnetId)) {
return allMockSubnets.remove(subnetId);
}
return null;
} | java | public MockSubnet deleteSubnet(final String subnetId) {
if (subnetId != null && allMockSubnets.containsKey(subnetId)) {
return allMockSubnets.remove(subnetId);
}
return null;
} | [
"public",
"MockSubnet",
"deleteSubnet",
"(",
"final",
"String",
"subnetId",
")",
"{",
"if",
"(",
"subnetId",
"!=",
"null",
"&&",
"allMockSubnets",
".",
"containsKey",
"(",
"subnetId",
")",
")",
"{",
"return",
"allMockSubnets",
".",
"remove",
"(",
"subnetId",
... | Delete Subnet.
@param subnetId
subnetId to be deleted
@return Mock Subnet. | [
"Delete",
"Subnet",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockSubnetController.java#L101-L108 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.parseInstanceStates | private Set<String> parseInstanceStates(final Map<String, String[]> queryParams) {
Set<String> instanceStates = new TreeSet<String>();
for (String queryKey : queryParams.keySet()) {
// e.g. Filter.1.Value.1: running, Filter.1.Value.2: pending
if (queryKey.startsWith("Filter.1.Va... | java | private Set<String> parseInstanceStates(final Map<String, String[]> queryParams) {
Set<String> instanceStates = new TreeSet<String>();
for (String queryKey : queryParams.keySet()) {
// e.g. Filter.1.Value.1: running, Filter.1.Value.2: pending
if (queryKey.startsWith("Filter.1.Va... | [
"private",
"Set",
"<",
"String",
">",
"parseInstanceStates",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"queryParams",
")",
"{",
"Set",
"<",
"String",
">",
"instanceStates",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
")",
";... | Parse instance states from query parameters.
@param queryParams
map of query parameters in http request
@return a set of instance states in the parameter map | [
"Parse",
"instance",
"states",
"from",
"query",
"parameters",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L944-L956 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.describeAvailabilityZones | private DescribeAvailabilityZonesResponseType describeAvailabilityZones() {
DescribeAvailabilityZonesResponseType ret = new DescribeAvailabilityZonesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
AvailabilityZoneSetType info = new AvailabilityZoneSetType();
Availabilit... | java | private DescribeAvailabilityZonesResponseType describeAvailabilityZones() {
DescribeAvailabilityZonesResponseType ret = new DescribeAvailabilityZonesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
AvailabilityZoneSetType info = new AvailabilityZoneSetType();
Availabilit... | [
"private",
"DescribeAvailabilityZonesResponseType",
"describeAvailabilityZones",
"(",
")",
"{",
"DescribeAvailabilityZonesResponseType",
"ret",
"=",
"new",
"DescribeAvailabilityZonesResponseType",
"(",
")",
";",
"ret",
".",
"setRequestId",
"(",
"UUID",
".",
"randomUUID",
"(... | Handles "describeAvailabilityZones" request, as simple as without any filters to use.
@return a DescribeAvailabilityZonesResponseType with our predefined AMIs
in aws-mock.properties (or if not overridden, as defined in aws-mock-default.properties) | [
"Handles",
"describeAvailabilityZones",
"request",
"as",
"simple",
"as",
"without",
"any",
"filters",
"to",
"use",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L964-L976 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.parseInstanceIDs | private Set<String> parseInstanceIDs(final Map<String, String[]> queryParams) {
Set<String> ret = new TreeSet<String>();
Set<Map.Entry<String, String[]>> entries = queryParams.entrySet();
for (Map.Entry<String, String[]> entry : entries) {
if (null != entry && null != entry.getKey()... | java | private Set<String> parseInstanceIDs(final Map<String, String[]> queryParams) {
Set<String> ret = new TreeSet<String>();
Set<Map.Entry<String, String[]>> entries = queryParams.entrySet();
for (Map.Entry<String, String[]> entry : entries) {
if (null != entry && null != entry.getKey()... | [
"private",
"Set",
"<",
"String",
">",
"parseInstanceIDs",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"queryParams",
")",
"{",
"Set",
"<",
"String",
">",
"ret",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
")",
";",
"Set",
... | Parse instance IDs from query parameters.
@param queryParams
map of query parameters in http request
@return a set of instance IDs in the parameter map | [
"Parse",
"instance",
"IDs",
"from",
"query",
"parameters",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L985-L998 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.generateToken | protected String generateToken() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < TOKEN_MIDDLE_LEN; i++) {
sb.append(TOKEN_DICT.charAt(random.nextInt(TOKEN_DICT.length())));
}
return TOKEN_PREFIX + sb.toString() + TOKEN_SUFFIX;
} | java | protected String generateToken() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < TOKEN_MIDDLE_LEN; i++) {
sb.append(TOKEN_DICT.charAt(random.nextInt(TOKEN_DICT.length())));
}
return TOKEN_PREFIX + sb.toString() + TOKEN_SUFFIX;
} | [
"protected",
"String",
"generateToken",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"TOKEN_MIDDLE_LEN",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"TOKEN_... | Generate a new token used in describeInstanceResponse while paging enabled.
@return a random string as a token | [
"Generate",
"a",
"new",
"token",
"used",
"in",
"describeInstanceResponse",
"while",
"paging",
"enabled",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1174-L1180 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.runInstances | private RunInstancesResponseType runInstances(final String imageId, final String instanceType,
final int minCount, final int maxCount) {
RunInstancesResponseType ret = new RunInstancesResponseType();
RunningInstancesSetType instSet = new RunningInstancesSetType();
Class<? extends ... | java | private RunInstancesResponseType runInstances(final String imageId, final String instanceType,
final int minCount, final int maxCount) {
RunInstancesResponseType ret = new RunInstancesResponseType();
RunningInstancesSetType instSet = new RunningInstancesSetType();
Class<? extends ... | [
"private",
"RunInstancesResponseType",
"runInstances",
"(",
"final",
"String",
"imageId",
",",
"final",
"String",
"instanceType",
",",
"final",
"int",
"minCount",
",",
"final",
"int",
"maxCount",
")",
"{",
"RunInstancesResponseType",
"ret",
"=",
"new",
"RunInstances... | Handles "runInstances" request, with only simplified filters of imageId, instanceType, minCount and maxCount.
@param imageId
AMI of new mock ec2 instance(s)
@param instanceType
type(scale) of new mock ec2 instance(s), refer to {@link AbstractMockEc2Instance#instanceType}
@param minCount
max count of instances to run
@... | [
"Handles",
"runInstances",
"request",
"with",
"only",
"simplified",
"filters",
"of",
"imageId",
"instanceType",
"minCount",
"and",
"maxCount",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1195-L1245 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.startInstances | private StartInstancesResponseType startInstances(final Set<String> instanceIDs) {
StartInstancesResponseType ret = new StartInstancesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
InstanceStateChangeSetType changeSet = new InstanceStateChangeSetType();
changeSet.getItem... | java | private StartInstancesResponseType startInstances(final Set<String> instanceIDs) {
StartInstancesResponseType ret = new StartInstancesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
InstanceStateChangeSetType changeSet = new InstanceStateChangeSetType();
changeSet.getItem... | [
"private",
"StartInstancesResponseType",
"startInstances",
"(",
"final",
"Set",
"<",
"String",
">",
"instanceIDs",
")",
"{",
"StartInstancesResponseType",
"ret",
"=",
"new",
"StartInstancesResponseType",
"(",
")",
";",
"ret",
".",
"setRequestId",
"(",
"UUID",
".",
... | Handles "startInstances" request, with only a simplified filter of instanceIDs.
@param instanceIDs
a filter of specified instance IDs for the target instance to start
@return a StartInstancesResponse with information for all mock ec2 instances to start | [
"Handles",
"startInstances",
"request",
"with",
"only",
"a",
"simplified",
"filter",
"of",
"instanceIDs",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1254-L1262 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.stopInstances | private StopInstancesResponseType stopInstances(final Set<String> instanceIDs) {
StopInstancesResponseType ret = new StopInstancesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
InstanceStateChangeSetType changeSet = new InstanceStateChangeSetType();
changeSet.getItem().a... | java | private StopInstancesResponseType stopInstances(final Set<String> instanceIDs) {
StopInstancesResponseType ret = new StopInstancesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
InstanceStateChangeSetType changeSet = new InstanceStateChangeSetType();
changeSet.getItem().a... | [
"private",
"StopInstancesResponseType",
"stopInstances",
"(",
"final",
"Set",
"<",
"String",
">",
"instanceIDs",
")",
"{",
"StopInstancesResponseType",
"ret",
"=",
"new",
"StopInstancesResponseType",
"(",
")",
";",
"ret",
".",
"setRequestId",
"(",
"UUID",
".",
"ra... | Handles "stopInstances" request, with only a simplified filter of instanceIDs.
@param instanceIDs
a filter of specified instance IDs for the target instance to stop
@return a StopInstancesResponse with information for all mock ec2 instances to stop | [
"Handles",
"stopInstances",
"request",
"with",
"only",
"a",
"simplified",
"filter",
"of",
"instanceIDs",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1271-L1278 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.terminateInstances | private TerminateInstancesResponseType terminateInstances(final Set<String> instanceIDs) {
TerminateInstancesResponseType ret = new TerminateInstancesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
InstanceStateChangeSetType changeSet = new InstanceStateChangeSetType();
c... | java | private TerminateInstancesResponseType terminateInstances(final Set<String> instanceIDs) {
TerminateInstancesResponseType ret = new TerminateInstancesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
InstanceStateChangeSetType changeSet = new InstanceStateChangeSetType();
c... | [
"private",
"TerminateInstancesResponseType",
"terminateInstances",
"(",
"final",
"Set",
"<",
"String",
">",
"instanceIDs",
")",
"{",
"TerminateInstancesResponseType",
"ret",
"=",
"new",
"TerminateInstancesResponseType",
"(",
")",
";",
"ret",
".",
"setRequestId",
"(",
... | Handles "terminateInstances" request, with only a simplified filter of instanceIDs.
@param instanceIDs
a filter of specified instance IDs for the target instance to terminate
@return a StartInstancesResponse with information for all mock ec2 instances to terminate | [
"Handles",
"terminateInstances",
"request",
"with",
"only",
"a",
"simplified",
"filter",
"of",
"instanceIDs",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1287-L1294 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.describeImages | private DescribeImagesResponseType describeImages(final Set<String> imageId) {
DescribeImagesResponseType ret = new DescribeImagesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
DescribeImagesResponseInfoType info = new DescribeImagesResponseInfoType();
for (String ami : ... | java | private DescribeImagesResponseType describeImages(final Set<String> imageId) {
DescribeImagesResponseType ret = new DescribeImagesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
DescribeImagesResponseInfoType info = new DescribeImagesResponseInfoType();
for (String ami : ... | [
"private",
"DescribeImagesResponseType",
"describeImages",
"(",
"final",
"Set",
"<",
"String",
">",
"imageId",
")",
"{",
"DescribeImagesResponseType",
"ret",
"=",
"new",
"DescribeImagesResponseType",
"(",
")",
";",
"ret",
".",
"setRequestId",
"(",
"UUID",
".",
"ra... | Handles "describeImages" request, as simple as without any filters to use.
@param imageId : Set of imgaesId.
@return a DescribeImagesResponse with our predefined AMIs in aws-mock.properties (or if not overridden, as
defined in aws-mock-default.properties) | [
"Handles",
"describeImages",
"request",
"as",
"simple",
"as",
"without",
"any",
"filters",
"to",
"use",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1302-L1364 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.describeRouteTables | private DescribeRouteTablesResponseType describeRouteTables() {
DescribeRouteTablesResponseType ret = new DescribeRouteTablesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
RouteTableSetType routeTableSet = new RouteTableSetType();
for (Iterator<MockRouteTable> mockRoute... | java | private DescribeRouteTablesResponseType describeRouteTables() {
DescribeRouteTablesResponseType ret = new DescribeRouteTablesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
RouteTableSetType routeTableSet = new RouteTableSetType();
for (Iterator<MockRouteTable> mockRoute... | [
"private",
"DescribeRouteTablesResponseType",
"describeRouteTables",
"(",
")",
"{",
"DescribeRouteTablesResponseType",
"ret",
"=",
"new",
"DescribeRouteTablesResponseType",
"(",
")",
";",
"ret",
".",
"setRequestId",
"(",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toSt... | Handles "describeRouteTables" request and returns response with a route table.
@return a DescribeRouteTablesResponseType with our predefined route table in aws-mock.properties (or if not
overridden, as defined in aws-mock-default.properties) | [
"Handles",
"describeRouteTables",
"request",
"and",
"returns",
"response",
"with",
"a",
"route",
"table",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1372-L1402 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.createRouteTable | private CreateRouteTableResponseType createRouteTable(final String vpcId,
final String cidrBlock) {
CreateRouteTableResponseType ret = new CreateRouteTableResponseType();
ret.setRequestId(UUID.randomUUID().toString());
MockRouteTable mockRouteTable = mockRouteTableController.createRo... | java | private CreateRouteTableResponseType createRouteTable(final String vpcId,
final String cidrBlock) {
CreateRouteTableResponseType ret = new CreateRouteTableResponseType();
ret.setRequestId(UUID.randomUUID().toString());
MockRouteTable mockRouteTable = mockRouteTableController.createRo... | [
"private",
"CreateRouteTableResponseType",
"createRouteTable",
"(",
"final",
"String",
"vpcId",
",",
"final",
"String",
"cidrBlock",
")",
"{",
"CreateRouteTableResponseType",
"ret",
"=",
"new",
"CreateRouteTableResponseType",
"(",
")",
";",
"ret",
".",
"setRequestId",
... | Handles "createRouteTable" request to create routetable and returns response with a route table.
@param vpcId vpc Id for Route Table.
@param cidrBlock VPC cidr block.
@return a CreateRouteTableResponseType with our new route table in (or if not
overridden, as defined in aws-mock-default.properties) | [
"Handles",
"createRouteTable",
"request",
"to",
"create",
"routetable",
"and",
"returns",
"response",
"with",
"a",
"route",
"table",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1411-L1423 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.createRoute | private CreateRouteResponseType createRoute(final String destinationCidrBlock,
final String internetGatewayId, final String routeTableId) {
CreateRouteResponseType ret = new CreateRouteResponseType();
ret.setRequestId(UUID.randomUUID().toString());
mockRouteTableController.createRout... | java | private CreateRouteResponseType createRoute(final String destinationCidrBlock,
final String internetGatewayId, final String routeTableId) {
CreateRouteResponseType ret = new CreateRouteResponseType();
ret.setRequestId(UUID.randomUUID().toString());
mockRouteTableController.createRout... | [
"private",
"CreateRouteResponseType",
"createRoute",
"(",
"final",
"String",
"destinationCidrBlock",
",",
"final",
"String",
"internetGatewayId",
",",
"final",
"String",
"routeTableId",
")",
"{",
"CreateRouteResponseType",
"ret",
"=",
"new",
"CreateRouteResponseType",
"("... | Handles "createRoute" request to create route and returns response with a route table.
@param destinationCidrBlock : Route destinationCidrBlock.
@param internetGatewayId : for gateway Id.
@param routeTableId : for Route.
@return a CreateRouteResponseType with our new route. | [
"Handles",
"createRoute",
"request",
"to",
"create",
"route",
"and",
"returns",
"response",
"with",
"a",
"route",
"table",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1432-L1439 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.createVolume | private CreateVolumeResponseType createVolume(final String volumeType, final String size,
final String availabilityZone,
final int iops, final String snapshotId) {
CreateVolumeResponseType ret = new CreateVolumeResponseType();
ret.setRequestId(UUID.randomUUID().toString());
... | java | private CreateVolumeResponseType createVolume(final String volumeType, final String size,
final String availabilityZone,
final int iops, final String snapshotId) {
CreateVolumeResponseType ret = new CreateVolumeResponseType();
ret.setRequestId(UUID.randomUUID().toString());
... | [
"private",
"CreateVolumeResponseType",
"createVolume",
"(",
"final",
"String",
"volumeType",
",",
"final",
"String",
"size",
",",
"final",
"String",
"availabilityZone",
",",
"final",
"int",
"iops",
",",
"final",
"String",
"snapshotId",
")",
"{",
"CreateVolumeRespons... | Handles "createVolume" request to create volume and returns response with a volume.
@param volumeType of Volume.
@param size : Volume size.
@param availabilityZone : Volume availability zone.
@param iops : Volume iops count
@param snapshotId : Volume's SnapshotId.
@return a CreateRouteTableResponseType with our new rou... | [
"Handles",
"createVolume",
"request",
"to",
"create",
"volume",
"and",
"returns",
"response",
"with",
"a",
"volume",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1451-L1466 | train |
treelogic-swe/aws-mock | src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java | MockEC2QueryHandler.createSubnet | private CreateSubnetResponseType createSubnet(final String vpcId, final String cidrBlock) {
CreateSubnetResponseType ret = new CreateSubnetResponseType();
ret.setRequestId(UUID.randomUUID().toString());
MockSubnet mockSubnet = mockSubnetController.createSubnet(cidrBlock, vpcId);
SubnetT... | java | private CreateSubnetResponseType createSubnet(final String vpcId, final String cidrBlock) {
CreateSubnetResponseType ret = new CreateSubnetResponseType();
ret.setRequestId(UUID.randomUUID().toString());
MockSubnet mockSubnet = mockSubnetController.createSubnet(cidrBlock, vpcId);
SubnetT... | [
"private",
"CreateSubnetResponseType",
"createSubnet",
"(",
"final",
"String",
"vpcId",
",",
"final",
"String",
"cidrBlock",
")",
"{",
"CreateSubnetResponseType",
"ret",
"=",
"new",
"CreateSubnetResponseType",
"(",
")",
";",
"ret",
".",
"setRequestId",
"(",
"UUID",
... | Handles "createSubnet" request to create Subnet and returns response with a subnet.
@param vpcId vpc Id for subnet.
@param cidrBlock VPC cidr block.
@return a CreateSubnetResponseType with our new Subnet | [
"Handles",
"createSubnet",
"request",
"to",
"create",
"Subnet",
"and",
"returns",
"response",
"with",
"a",
"subnet",
"."
] | 1d1058c0ebbd0615efa28695481e36ae3ffc58a0 | https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1474-L1485 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.