id
int32
0
165k
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
137,600
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/ENU.java
ENU.convertEnvelopeFromWgsToEnu
public Envelope convertEnvelopeFromWgsToEnu( Envelope envelopeWgs ) { Polygon polygonEnu = GeometryUtilities.createPolygonFromEnvelope(envelopeWgs); convertGeometryFromWgsToEnu(polygonEnu); Envelope envelopeEnu = polygonEnu.getEnvelopeInternal(); return envelopeEnu; }
java
public Envelope convertEnvelopeFromWgsToEnu( Envelope envelopeWgs ) { Polygon polygonEnu = GeometryUtilities.createPolygonFromEnvelope(envelopeWgs); convertGeometryFromWgsToEnu(polygonEnu); Envelope envelopeEnu = polygonEnu.getEnvelopeInternal(); return envelopeEnu; }
[ "public", "Envelope", "convertEnvelopeFromWgsToEnu", "(", "Envelope", "envelopeWgs", ")", "{", "Polygon", "polygonEnu", "=", "GeometryUtilities", ".", "createPolygonFromEnvelope", "(", "envelopeWgs", ")", ";", "convertGeometryFromWgsToEnu", "(", "polygonEnu", ")", ";", "Envelope", "envelopeEnu", "=", "polygonEnu", ".", "getEnvelopeInternal", "(", ")", ";", "return", "envelopeEnu", ";", "}" ]
Converts an envelope from WGS to ENU. @param envelopeWgs @return the converted envelope.
[ "Converts", "an", "envelope", "from", "WGS", "to", "ENU", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/ENU.java#L265-L270
137,601
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java
NwwPanel.goTo
public synchronized Position goTo( Double lon, Double lat, Double elev, Double azimuth, boolean animate ) { View view = getWwd().getView(); view.stopAnimations(); view.stopMovement(); Position eyePosition; if (lon == null || lat == null) { Position currentEyePosition = wwd.getView().getCurrentEyePosition(); if (currentEyePosition != null) { lat = currentEyePosition.latitude.degrees; lon = currentEyePosition.longitude.degrees; } else { return null; } } if (elev == null) { // use the current elev = wwd.getView().getCurrentEyePosition().getAltitude(); } if (Double.isNaN(elev)) { if (!Double.isNaN(lastElevation)) { elev = lastElevation; } else { elev = NwwUtilities.DEFAULT_ELEV; } } eyePosition = NwwUtilities.toPosition(lat, lon, elev); if (animate) { view.goTo(eyePosition, elev); } else { view.setEyePosition(eyePosition); } if (azimuth != null) { Angle heading = Angle.fromDegrees(azimuth); view.setHeading(heading); } lastElevation = elev; return eyePosition; }
java
public synchronized Position goTo( Double lon, Double lat, Double elev, Double azimuth, boolean animate ) { View view = getWwd().getView(); view.stopAnimations(); view.stopMovement(); Position eyePosition; if (lon == null || lat == null) { Position currentEyePosition = wwd.getView().getCurrentEyePosition(); if (currentEyePosition != null) { lat = currentEyePosition.latitude.degrees; lon = currentEyePosition.longitude.degrees; } else { return null; } } if (elev == null) { // use the current elev = wwd.getView().getCurrentEyePosition().getAltitude(); } if (Double.isNaN(elev)) { if (!Double.isNaN(lastElevation)) { elev = lastElevation; } else { elev = NwwUtilities.DEFAULT_ELEV; } } eyePosition = NwwUtilities.toPosition(lat, lon, elev); if (animate) { view.goTo(eyePosition, elev); } else { view.setEyePosition(eyePosition); } if (azimuth != null) { Angle heading = Angle.fromDegrees(azimuth); view.setHeading(heading); } lastElevation = elev; return eyePosition; }
[ "public", "synchronized", "Position", "goTo", "(", "Double", "lon", ",", "Double", "lat", ",", "Double", "elev", ",", "Double", "azimuth", ",", "boolean", "animate", ")", "{", "View", "view", "=", "getWwd", "(", ")", ".", "getView", "(", ")", ";", "view", ".", "stopAnimations", "(", ")", ";", "view", ".", "stopMovement", "(", ")", ";", "Position", "eyePosition", ";", "if", "(", "lon", "==", "null", "||", "lat", "==", "null", ")", "{", "Position", "currentEyePosition", "=", "wwd", ".", "getView", "(", ")", ".", "getCurrentEyePosition", "(", ")", ";", "if", "(", "currentEyePosition", "!=", "null", ")", "{", "lat", "=", "currentEyePosition", ".", "latitude", ".", "degrees", ";", "lon", "=", "currentEyePosition", ".", "longitude", ".", "degrees", ";", "}", "else", "{", "return", "null", ";", "}", "}", "if", "(", "elev", "==", "null", ")", "{", "// use the current", "elev", "=", "wwd", ".", "getView", "(", ")", ".", "getCurrentEyePosition", "(", ")", ".", "getAltitude", "(", ")", ";", "}", "if", "(", "Double", ".", "isNaN", "(", "elev", ")", ")", "{", "if", "(", "!", "Double", ".", "isNaN", "(", "lastElevation", ")", ")", "{", "elev", "=", "lastElevation", ";", "}", "else", "{", "elev", "=", "NwwUtilities", ".", "DEFAULT_ELEV", ";", "}", "}", "eyePosition", "=", "NwwUtilities", ".", "toPosition", "(", "lat", ",", "lon", ",", "elev", ")", ";", "if", "(", "animate", ")", "{", "view", ".", "goTo", "(", "eyePosition", ",", "elev", ")", ";", "}", "else", "{", "view", ".", "setEyePosition", "(", "eyePosition", ")", ";", "}", "if", "(", "azimuth", "!=", "null", ")", "{", "Angle", "heading", "=", "Angle", ".", "fromDegrees", "(", "azimuth", ")", ";", "view", ".", "setHeading", "(", "heading", ")", ";", "}", "lastElevation", "=", "elev", ";", "return", "eyePosition", ";", "}" ]
Move to a given location. @param lon the longitude. @param lat the latitude. @param elev the eye elevation. @param azimuth if supplied, the map is rotated to follow that angle. @param animate if <code>true</code>, it animates to the position.
[ "Move", "to", "a", "given", "location", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java#L208-L247
137,602
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java
NwwPanel.goTo
public void goTo( Sector sector, boolean animate ) { View view = getWwd().getView(); view.stopAnimations(); view.stopMovement(); if (sector == null) { return; } // Create a bounding box for the specified sector in order to estimate // its size in model coordinates. Box extent = Sector.computeBoundingBox(getWwd().getModel().getGlobe(), getWwd().getSceneController().getVerticalExaggeration(), sector); // Estimate the distance between the center position and the eye // position that is necessary to cause the sector to // fill a viewport with the specified field of view. Note that we change // the distance between the center and eye // position here, and leave the field of view constant. Angle fov = view.getFieldOfView(); double zoom = extent.getRadius() / fov.cosHalfAngle() / fov.tanHalfAngle(); // Configure OrbitView to look at the center of the sector from our // estimated distance. This causes OrbitView to // animate to the specified position over several seconds. To affect // this change immediately use the following: if (animate) { view.goTo(new Position(sector.getCentroid(), 0d), zoom); } else { ((OrbitView) wwd.getView()).setCenterPosition(new Position(sector.getCentroid(), 0d)); ((OrbitView) wwd.getView()).setZoom(zoom); } }
java
public void goTo( Sector sector, boolean animate ) { View view = getWwd().getView(); view.stopAnimations(); view.stopMovement(); if (sector == null) { return; } // Create a bounding box for the specified sector in order to estimate // its size in model coordinates. Box extent = Sector.computeBoundingBox(getWwd().getModel().getGlobe(), getWwd().getSceneController().getVerticalExaggeration(), sector); // Estimate the distance between the center position and the eye // position that is necessary to cause the sector to // fill a viewport with the specified field of view. Note that we change // the distance between the center and eye // position here, and leave the field of view constant. Angle fov = view.getFieldOfView(); double zoom = extent.getRadius() / fov.cosHalfAngle() / fov.tanHalfAngle(); // Configure OrbitView to look at the center of the sector from our // estimated distance. This causes OrbitView to // animate to the specified position over several seconds. To affect // this change immediately use the following: if (animate) { view.goTo(new Position(sector.getCentroid(), 0d), zoom); } else { ((OrbitView) wwd.getView()).setCenterPosition(new Position(sector.getCentroid(), 0d)); ((OrbitView) wwd.getView()).setZoom(zoom); } }
[ "public", "void", "goTo", "(", "Sector", "sector", ",", "boolean", "animate", ")", "{", "View", "view", "=", "getWwd", "(", ")", ".", "getView", "(", ")", ";", "view", ".", "stopAnimations", "(", ")", ";", "view", ".", "stopMovement", "(", ")", ";", "if", "(", "sector", "==", "null", ")", "{", "return", ";", "}", "// Create a bounding box for the specified sector in order to estimate", "// its size in model coordinates.", "Box", "extent", "=", "Sector", ".", "computeBoundingBox", "(", "getWwd", "(", ")", ".", "getModel", "(", ")", ".", "getGlobe", "(", ")", ",", "getWwd", "(", ")", ".", "getSceneController", "(", ")", ".", "getVerticalExaggeration", "(", ")", ",", "sector", ")", ";", "// Estimate the distance between the center position and the eye", "// position that is necessary to cause the sector to", "// fill a viewport with the specified field of view. Note that we change", "// the distance between the center and eye", "// position here, and leave the field of view constant.", "Angle", "fov", "=", "view", ".", "getFieldOfView", "(", ")", ";", "double", "zoom", "=", "extent", ".", "getRadius", "(", ")", "/", "fov", ".", "cosHalfAngle", "(", ")", "/", "fov", ".", "tanHalfAngle", "(", ")", ";", "// Configure OrbitView to look at the center of the sector from our", "// estimated distance. This causes OrbitView to", "// animate to the specified position over several seconds. To affect", "// this change immediately use the following:", "if", "(", "animate", ")", "{", "view", ".", "goTo", "(", "new", "Position", "(", "sector", ".", "getCentroid", "(", ")", ",", "0d", ")", ",", "zoom", ")", ";", "}", "else", "{", "(", "(", "OrbitView", ")", "wwd", ".", "getView", "(", ")", ")", ".", "setCenterPosition", "(", "new", "Position", "(", "sector", ".", "getCentroid", "(", ")", ",", "0d", ")", ")", ";", "(", "(", "OrbitView", ")", "wwd", ".", "getView", "(", ")", ")", ".", "setZoom", "(", "zoom", ")", ";", "}", "}" ]
Move to see a given sector. @param sector the sector to go to. @param animate if <code>true</code>, it animates to the position.
[ "Move", "to", "see", "a", "given", "sector", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java#L257-L288
137,603
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java
NwwPanel.setFlatGlobe
public void setFlatGlobe( boolean doMercator ) { EarthFlat globe = new EarthFlat(); globe.setElevationModel(new ZeroElevationModel()); wwd.getModel().setGlobe(globe); wwd.getView().stopMovement(); GeographicProjection projection; if (doMercator) { projection = new ProjectionMercator(); } else { projection = new ProjectionEquirectangular(); } globe.setProjection(projection); wwd.redraw(); }
java
public void setFlatGlobe( boolean doMercator ) { EarthFlat globe = new EarthFlat(); globe.setElevationModel(new ZeroElevationModel()); wwd.getModel().setGlobe(globe); wwd.getView().stopMovement(); GeographicProjection projection; if (doMercator) { projection = new ProjectionMercator(); } else { projection = new ProjectionEquirectangular(); } globe.setProjection(projection); wwd.redraw(); }
[ "public", "void", "setFlatGlobe", "(", "boolean", "doMercator", ")", "{", "EarthFlat", "globe", "=", "new", "EarthFlat", "(", ")", ";", "globe", ".", "setElevationModel", "(", "new", "ZeroElevationModel", "(", ")", ")", ";", "wwd", ".", "getModel", "(", ")", ".", "setGlobe", "(", "globe", ")", ";", "wwd", ".", "getView", "(", ")", ".", "stopMovement", "(", ")", ";", "GeographicProjection", "projection", ";", "if", "(", "doMercator", ")", "{", "projection", "=", "new", "ProjectionMercator", "(", ")", ";", "}", "else", "{", "projection", "=", "new", "ProjectionEquirectangular", "(", ")", ";", "}", "globe", ".", "setProjection", "(", "projection", ")", ";", "wwd", ".", "redraw", "(", ")", ";", "}" ]
Set the globe as flat. @param doMercator if <code>true</code>, mercator is used as opposed to lat/long.
[ "Set", "the", "globe", "as", "flat", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java#L296-L309
137,604
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java
NwwPanel.setSphereGlobe
public void setSphereGlobe() { Earth globe = new Earth(); wwd.getModel().setGlobe(globe); wwd.getView().stopMovement(); wwd.redraw(); }
java
public void setSphereGlobe() { Earth globe = new Earth(); wwd.getModel().setGlobe(globe); wwd.getView().stopMovement(); wwd.redraw(); }
[ "public", "void", "setSphereGlobe", "(", ")", "{", "Earth", "globe", "=", "new", "Earth", "(", ")", ";", "wwd", ".", "getModel", "(", ")", ".", "setGlobe", "(", "globe", ")", ";", "wwd", ".", "getView", "(", ")", ".", "stopMovement", "(", ")", ";", "wwd", ".", "redraw", "(", ")", ";", "}" ]
Set the globe as sphere.
[ "Set", "the", "globe", "as", "sphere", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java#L314-L319
137,605
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java
NwwPanel.setFlatSphereGlobe
public void setFlatSphereGlobe() { Earth globe = new Earth(); globe.setElevationModel(new ZeroElevationModel()); wwd.getModel().setGlobe(globe); wwd.getView().stopMovement(); wwd.redraw(); }
java
public void setFlatSphereGlobe() { Earth globe = new Earth(); globe.setElevationModel(new ZeroElevationModel()); wwd.getModel().setGlobe(globe); wwd.getView().stopMovement(); wwd.redraw(); }
[ "public", "void", "setFlatSphereGlobe", "(", ")", "{", "Earth", "globe", "=", "new", "Earth", "(", ")", ";", "globe", ".", "setElevationModel", "(", "new", "ZeroElevationModel", "(", ")", ")", ";", "wwd", ".", "getModel", "(", ")", ".", "setGlobe", "(", "globe", ")", ";", "wwd", ".", "getView", "(", ")", ".", "stopMovement", "(", ")", ";", "wwd", ".", "redraw", "(", ")", ";", "}" ]
Set the globe as flat sphere.
[ "Set", "the", "globe", "as", "flat", "sphere", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java#L324-L330
137,606
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/log/LogDb.java
LogDb.getFilteredList
public List<Message> getFilteredList( EMessageType messageType, Long fromTsMillis, Long toTsMillis, long limit ) throws Exception { String tableName = TABLE_MESSAGES; String sql = "select " + getQueryFieldsString() + " from " + tableName; List<String> wheresList = new ArrayList<>(); if (messageType != null && messageType != EMessageType.ALL) { String where = type_NAME + "=" + messageType.getCode(); wheresList.add(where); } if (fromTsMillis != null) { String where = TimeStamp_NAME + ">" + fromTsMillis; wheresList.add(where); } if (toTsMillis != null) { String where = TimeStamp_NAME + "<" + toTsMillis; wheresList.add(where); } if (wheresList.size() > 0) { sql += " WHERE "; for( int i = 0; i < wheresList.size(); i++ ) { if (i > 0) { sql += " AND "; } sql += wheresList.get(i); } } sql += " order by " + ID_NAME + " desc"; if (limit > 0) { sql += " limit " + limit; } String _sql = sql; List<Message> messages = new ArrayList<Message>(); logDb.execOnConnection(connection -> { try (IHMStatement stmt = connection.createStatement(); IHMResultSet rs = stmt.executeQuery(_sql);) { while( rs.next() ) { Message event = resultSetToItem(rs); messages.add(event); } } return null; }); return messages; }
java
public List<Message> getFilteredList( EMessageType messageType, Long fromTsMillis, Long toTsMillis, long limit ) throws Exception { String tableName = TABLE_MESSAGES; String sql = "select " + getQueryFieldsString() + " from " + tableName; List<String> wheresList = new ArrayList<>(); if (messageType != null && messageType != EMessageType.ALL) { String where = type_NAME + "=" + messageType.getCode(); wheresList.add(where); } if (fromTsMillis != null) { String where = TimeStamp_NAME + ">" + fromTsMillis; wheresList.add(where); } if (toTsMillis != null) { String where = TimeStamp_NAME + "<" + toTsMillis; wheresList.add(where); } if (wheresList.size() > 0) { sql += " WHERE "; for( int i = 0; i < wheresList.size(); i++ ) { if (i > 0) { sql += " AND "; } sql += wheresList.get(i); } } sql += " order by " + ID_NAME + " desc"; if (limit > 0) { sql += " limit " + limit; } String _sql = sql; List<Message> messages = new ArrayList<Message>(); logDb.execOnConnection(connection -> { try (IHMStatement stmt = connection.createStatement(); IHMResultSet rs = stmt.executeQuery(_sql);) { while( rs.next() ) { Message event = resultSetToItem(rs); messages.add(event); } } return null; }); return messages; }
[ "public", "List", "<", "Message", ">", "getFilteredList", "(", "EMessageType", "messageType", ",", "Long", "fromTsMillis", ",", "Long", "toTsMillis", ",", "long", "limit", ")", "throws", "Exception", "{", "String", "tableName", "=", "TABLE_MESSAGES", ";", "String", "sql", "=", "\"select \"", "+", "getQueryFieldsString", "(", ")", "+", "\" from \"", "+", "tableName", ";", "List", "<", "String", ">", "wheresList", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "messageType", "!=", "null", "&&", "messageType", "!=", "EMessageType", ".", "ALL", ")", "{", "String", "where", "=", "type_NAME", "+", "\"=\"", "+", "messageType", ".", "getCode", "(", ")", ";", "wheresList", ".", "add", "(", "where", ")", ";", "}", "if", "(", "fromTsMillis", "!=", "null", ")", "{", "String", "where", "=", "TimeStamp_NAME", "+", "\">\"", "+", "fromTsMillis", ";", "wheresList", ".", "add", "(", "where", ")", ";", "}", "if", "(", "toTsMillis", "!=", "null", ")", "{", "String", "where", "=", "TimeStamp_NAME", "+", "\"<\"", "+", "toTsMillis", ";", "wheresList", ".", "add", "(", "where", ")", ";", "}", "if", "(", "wheresList", ".", "size", "(", ")", ">", "0", ")", "{", "sql", "+=", "\" WHERE \"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "wheresList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "sql", "+=", "\" AND \"", ";", "}", "sql", "+=", "wheresList", ".", "get", "(", "i", ")", ";", "}", "}", "sql", "+=", "\" order by \"", "+", "ID_NAME", "+", "\" desc\"", ";", "if", "(", "limit", ">", "0", ")", "{", "sql", "+=", "\" limit \"", "+", "limit", ";", "}", "String", "_sql", "=", "sql", ";", "List", "<", "Message", ">", "messages", "=", "new", "ArrayList", "<", "Message", ">", "(", ")", ";", "logDb", ".", "execOnConnection", "(", "connection", "->", "{", "try", "(", "IHMStatement", "stmt", "=", "connection", ".", "createStatement", "(", ")", ";", "IHMResultSet", "rs", "=", "stmt", ".", "executeQuery", "(", "_sql", ")", ";", ")", "{", "while", "(", "rs", ".", "next", "(", ")", ")", "{", "Message", "event", "=", "resultSetToItem", "(", "rs", ")", ";", "messages", ".", "add", "(", "event", ")", ";", "}", "}", "return", "null", ";", "}", ")", ";", "return", "messages", ";", "}" ]
Get the list of messages, filtered. @param messageType the type to filter. @param fromTsMillis the start time in millis. @param toTsMillis the end time in millis. @param limit the max number of messages. @return the list of messages. @throws Exception
[ "Get", "the", "list", "of", "messages", "filtered", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/log/LogDb.java#L249-L295
137,607
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/ngmf/util/WildcardFileFilter.java
WildcardFileFilter.accept
@Override public boolean accept(File file) { String name = file.getName(); if (FilenameUtils.wildcardMatch(name, wildcards, caseSensitivity)) { return true; } return false; }
java
@Override public boolean accept(File file) { String name = file.getName(); if (FilenameUtils.wildcardMatch(name, wildcards, caseSensitivity)) { return true; } return false; }
[ "@", "Override", "public", "boolean", "accept", "(", "File", "file", ")", "{", "String", "name", "=", "file", ".", "getName", "(", ")", ";", "if", "(", "FilenameUtils", ".", "wildcardMatch", "(", "name", ",", "wildcards", ",", "caseSensitivity", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Checks to see if the filename matches one of the wildcards. @param file the file to check @return true if the filename matches one of the wildcards
[ "Checks", "to", "see", "if", "the", "filename", "matches", "one", "of", "the", "wildcards", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/WildcardFileFilter.java#L63-L70
137,608
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java
GeometryTranslator.convertDwgAttribute
public SimpleFeature convertDwgAttribute( String typeName, String layerName, DwgAttrib attribute, int id ) { Point2D pto = attribute.getInsertionPoint(); Coordinate coord = new Coordinate(pto.getX(), pto.getY(), attribute.getElevation()); String textString = attribute.getText(); return createPointTextFeature(typeName, layerName, id, coord, textString); }
java
public SimpleFeature convertDwgAttribute( String typeName, String layerName, DwgAttrib attribute, int id ) { Point2D pto = attribute.getInsertionPoint(); Coordinate coord = new Coordinate(pto.getX(), pto.getY(), attribute.getElevation()); String textString = attribute.getText(); return createPointTextFeature(typeName, layerName, id, coord, textString); }
[ "public", "SimpleFeature", "convertDwgAttribute", "(", "String", "typeName", ",", "String", "layerName", ",", "DwgAttrib", "attribute", ",", "int", "id", ")", "{", "Point2D", "pto", "=", "attribute", ".", "getInsertionPoint", "(", ")", ";", "Coordinate", "coord", "=", "new", "Coordinate", "(", "pto", ".", "getX", "(", ")", ",", "pto", ".", "getY", "(", ")", ",", "attribute", ".", "getElevation", "(", ")", ")", ";", "String", "textString", "=", "attribute", ".", "getText", "(", ")", ";", "return", "createPointTextFeature", "(", "typeName", ",", "layerName", ",", "id", ",", "coord", ",", "textString", ")", ";", "}" ]
Builds a point feature from a dwg attribute.
[ "Builds", "a", "point", "feature", "from", "a", "dwg", "attribute", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java#L87-L95
137,609
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java
GeometryTranslator.convertDwgPolyline2D
public SimpleFeature convertDwgPolyline2D( String typeName, String layerName, DwgPolyline2D polyline2d, int id ) { Point2D[] ptos = polyline2d.getPts(); CoordinateList coordList = new CoordinateList(); if (ptos != null) { for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY(), 0.0); coordList.add(coord); } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, LineString.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry lineString = gF.createLineString(coordList.toCoordinateArray()); Object[] values = new Object[]{lineString, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); } return null; }
java
public SimpleFeature convertDwgPolyline2D( String typeName, String layerName, DwgPolyline2D polyline2d, int id ) { Point2D[] ptos = polyline2d.getPts(); CoordinateList coordList = new CoordinateList(); if (ptos != null) { for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY(), 0.0); coordList.add(coord); } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, LineString.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry lineString = gF.createLineString(coordList.toCoordinateArray()); Object[] values = new Object[]{lineString, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); } return null; }
[ "public", "SimpleFeature", "convertDwgPolyline2D", "(", "String", "typeName", ",", "String", "layerName", ",", "DwgPolyline2D", "polyline2d", ",", "int", "id", ")", "{", "Point2D", "[", "]", "ptos", "=", "polyline2d", ".", "getPts", "(", ")", ";", "CoordinateList", "coordList", "=", "new", "CoordinateList", "(", ")", ";", "if", "(", "ptos", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "ptos", ".", "length", ";", "j", "++", ")", "{", "Coordinate", "coord", "=", "new", "Coordinate", "(", "ptos", "[", "j", "]", ".", "getX", "(", ")", ",", "ptos", "[", "j", "]", ".", "getY", "(", ")", ",", "0.0", ")", ";", "coordList", ".", "add", "(", "coord", ")", ";", "}", "SimpleFeatureTypeBuilder", "b", "=", "new", "SimpleFeatureTypeBuilder", "(", ")", ";", "b", ".", "setName", "(", "typeName", ")", ";", "b", ".", "setCRS", "(", "crs", ")", ";", "b", ".", "add", "(", "THE_GEOM", ",", "LineString", ".", "class", ")", ";", "b", ".", "add", "(", "LAYER", ",", "String", ".", "class", ")", ";", "SimpleFeatureType", "type", "=", "b", ".", "buildFeatureType", "(", ")", ";", "SimpleFeatureBuilder", "builder", "=", "new", "SimpleFeatureBuilder", "(", "type", ")", ";", "Geometry", "lineString", "=", "gF", ".", "createLineString", "(", "coordList", ".", "toCoordinateArray", "(", ")", ")", ";", "Object", "[", "]", "values", "=", "new", "Object", "[", "]", "{", "lineString", ",", "layerName", "}", ";", "builder", ".", "addAll", "(", "values", ")", ";", "return", "builder", ".", "buildFeature", "(", "typeName", "+", "\".\"", "+", "id", ")", ";", "}", "return", "null", ";", "}" ]
Builds a line feature from a dwg polyline 2D.
[ "Builds", "a", "line", "feature", "from", "a", "dwg", "polyline", "2D", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java#L148-L171
137,610
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java
GeometryTranslator.convertDwgPoint
public SimpleFeature convertDwgPoint( String typeName, String layerName, DwgPoint point, int id ) { double[] p = point.getPoint(); Point2D pto = new Point2D.Double(p[0], p[1]); CoordinateList coordList = new CoordinateList(); Coordinate coord = new Coordinate(pto.getX(), pto.getY(), 0.0); coordList.add(coord); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, MultiPoint.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry points = gF.createMultiPoint(coordList.toCoordinateArray()); Object[] values = new Object[]{points, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
java
public SimpleFeature convertDwgPoint( String typeName, String layerName, DwgPoint point, int id ) { double[] p = point.getPoint(); Point2D pto = new Point2D.Double(p[0], p[1]); CoordinateList coordList = new CoordinateList(); Coordinate coord = new Coordinate(pto.getX(), pto.getY(), 0.0); coordList.add(coord); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, MultiPoint.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry points = gF.createMultiPoint(coordList.toCoordinateArray()); Object[] values = new Object[]{points, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
[ "public", "SimpleFeature", "convertDwgPoint", "(", "String", "typeName", ",", "String", "layerName", ",", "DwgPoint", "point", ",", "int", "id", ")", "{", "double", "[", "]", "p", "=", "point", ".", "getPoint", "(", ")", ";", "Point2D", "pto", "=", "new", "Point2D", ".", "Double", "(", "p", "[", "0", "]", ",", "p", "[", "1", "]", ")", ";", "CoordinateList", "coordList", "=", "new", "CoordinateList", "(", ")", ";", "Coordinate", "coord", "=", "new", "Coordinate", "(", "pto", ".", "getX", "(", ")", ",", "pto", ".", "getY", "(", ")", ",", "0.0", ")", ";", "coordList", ".", "add", "(", "coord", ")", ";", "SimpleFeatureTypeBuilder", "b", "=", "new", "SimpleFeatureTypeBuilder", "(", ")", ";", "b", ".", "setName", "(", "typeName", ")", ";", "b", ".", "setCRS", "(", "crs", ")", ";", "b", ".", "add", "(", "THE_GEOM", ",", "MultiPoint", ".", "class", ")", ";", "b", ".", "add", "(", "LAYER", ",", "String", ".", "class", ")", ";", "SimpleFeatureType", "type", "=", "b", ".", "buildFeatureType", "(", ")", ";", "SimpleFeatureBuilder", "builder", "=", "new", "SimpleFeatureBuilder", "(", "type", ")", ";", "Geometry", "points", "=", "gF", ".", "createMultiPoint", "(", "coordList", ".", "toCoordinateArray", "(", ")", ")", ";", "Object", "[", "]", "values", "=", "new", "Object", "[", "]", "{", "points", ",", "layerName", "}", ";", "builder", ".", "addAll", "(", "values", ")", ";", "return", "builder", ".", "buildFeature", "(", "typeName", "+", "\".\"", "+", "id", ")", ";", "}" ]
Builds a point feature from a dwg point.
[ "Builds", "a", "point", "feature", "from", "a", "dwg", "point", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java#L205-L224
137,611
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java
GeometryTranslator.convertDwgLine
public SimpleFeature convertDwgLine( String typeName, String layerName, DwgLine line, int id ) { double[] p1 = line.getP1(); double[] p2 = line.getP2(); Point2D[] ptos = new Point2D[]{new Point2D.Double(p1[0], p1[1]), new Point2D.Double(p2[0], p2[1])}; CoordinateList coordList = new CoordinateList(); for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY(), 0.0); coordList.add(coord); } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, LineString.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry lineString = gF.createLineString(coordList.toCoordinateArray()); Object[] values = new Object[]{lineString, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
java
public SimpleFeature convertDwgLine( String typeName, String layerName, DwgLine line, int id ) { double[] p1 = line.getP1(); double[] p2 = line.getP2(); Point2D[] ptos = new Point2D[]{new Point2D.Double(p1[0], p1[1]), new Point2D.Double(p2[0], p2[1])}; CoordinateList coordList = new CoordinateList(); for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY(), 0.0); coordList.add(coord); } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, LineString.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry lineString = gF.createLineString(coordList.toCoordinateArray()); Object[] values = new Object[]{lineString, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
[ "public", "SimpleFeature", "convertDwgLine", "(", "String", "typeName", ",", "String", "layerName", ",", "DwgLine", "line", ",", "int", "id", ")", "{", "double", "[", "]", "p1", "=", "line", ".", "getP1", "(", ")", ";", "double", "[", "]", "p2", "=", "line", ".", "getP2", "(", ")", ";", "Point2D", "[", "]", "ptos", "=", "new", "Point2D", "[", "]", "{", "new", "Point2D", ".", "Double", "(", "p1", "[", "0", "]", ",", "p1", "[", "1", "]", ")", ",", "new", "Point2D", ".", "Double", "(", "p2", "[", "0", "]", ",", "p2", "[", "1", "]", ")", "}", ";", "CoordinateList", "coordList", "=", "new", "CoordinateList", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "ptos", ".", "length", ";", "j", "++", ")", "{", "Coordinate", "coord", "=", "new", "Coordinate", "(", "ptos", "[", "j", "]", ".", "getX", "(", ")", ",", "ptos", "[", "j", "]", ".", "getY", "(", ")", ",", "0.0", ")", ";", "coordList", ".", "add", "(", "coord", ")", ";", "}", "SimpleFeatureTypeBuilder", "b", "=", "new", "SimpleFeatureTypeBuilder", "(", ")", ";", "b", ".", "setName", "(", "typeName", ")", ";", "b", ".", "setCRS", "(", "crs", ")", ";", "b", ".", "add", "(", "THE_GEOM", ",", "LineString", ".", "class", ")", ";", "b", ".", "add", "(", "LAYER", ",", "String", ".", "class", ")", ";", "SimpleFeatureType", "type", "=", "b", ".", "buildFeatureType", "(", ")", ";", "SimpleFeatureBuilder", "builder", "=", "new", "SimpleFeatureBuilder", "(", "type", ")", ";", "Geometry", "lineString", "=", "gF", ".", "createLineString", "(", "coordList", ".", "toCoordinateArray", "(", ")", ")", ";", "Object", "[", "]", "values", "=", "new", "Object", "[", "]", "{", "lineString", ",", "layerName", "}", ";", "builder", ".", "addAll", "(", "values", ")", ";", "return", "builder", ".", "buildFeature", "(", "typeName", "+", "\".\"", "+", "id", ")", ";", "}" ]
Builds a line feature from a dwg line.
[ "Builds", "a", "line", "feature", "from", "a", "dwg", "line", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java#L230-L252
137,612
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java
GeometryTranslator.convertDwgCircle
public SimpleFeature convertDwgCircle( String typeName, String layerName, DwgCircle circle, int id ) { double[] center = circle.getCenter(); double radius = circle.getRadius(); Point2D[] ptos = GisModelCurveCalculator.calculateGisModelCircle(new Point2D.Double( center[0], center[1]), radius); CoordinateList coordList = new CoordinateList(); for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY(), 0.0); coordList.add(coord); } // close to create a polygon if ((ptos[ptos.length - 1].getX() != ptos[0].getX()) || (ptos[ptos.length - 1].getY() != ptos[0].getY())) { Coordinate coord = new Coordinate(ptos[0].getX(), ptos[0].getY(), 0.0); coordList.add(coord); } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, Polygon.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); LinearRing linearRing = gF.createLinearRing(coordList.toCoordinateArray()); Geometry polygon = gF.createPolygon(linearRing, null); Object[] values = new Object[]{polygon, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
java
public SimpleFeature convertDwgCircle( String typeName, String layerName, DwgCircle circle, int id ) { double[] center = circle.getCenter(); double radius = circle.getRadius(); Point2D[] ptos = GisModelCurveCalculator.calculateGisModelCircle(new Point2D.Double( center[0], center[1]), radius); CoordinateList coordList = new CoordinateList(); for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY(), 0.0); coordList.add(coord); } // close to create a polygon if ((ptos[ptos.length - 1].getX() != ptos[0].getX()) || (ptos[ptos.length - 1].getY() != ptos[0].getY())) { Coordinate coord = new Coordinate(ptos[0].getX(), ptos[0].getY(), 0.0); coordList.add(coord); } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, Polygon.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); LinearRing linearRing = gF.createLinearRing(coordList.toCoordinateArray()); Geometry polygon = gF.createPolygon(linearRing, null); Object[] values = new Object[]{polygon, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
[ "public", "SimpleFeature", "convertDwgCircle", "(", "String", "typeName", ",", "String", "layerName", ",", "DwgCircle", "circle", ",", "int", "id", ")", "{", "double", "[", "]", "center", "=", "circle", ".", "getCenter", "(", ")", ";", "double", "radius", "=", "circle", ".", "getRadius", "(", ")", ";", "Point2D", "[", "]", "ptos", "=", "GisModelCurveCalculator", ".", "calculateGisModelCircle", "(", "new", "Point2D", ".", "Double", "(", "center", "[", "0", "]", ",", "center", "[", "1", "]", ")", ",", "radius", ")", ";", "CoordinateList", "coordList", "=", "new", "CoordinateList", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "ptos", ".", "length", ";", "j", "++", ")", "{", "Coordinate", "coord", "=", "new", "Coordinate", "(", "ptos", "[", "j", "]", ".", "getX", "(", ")", ",", "ptos", "[", "j", "]", ".", "getY", "(", ")", ",", "0.0", ")", ";", "coordList", ".", "add", "(", "coord", ")", ";", "}", "// close to create a polygon", "if", "(", "(", "ptos", "[", "ptos", ".", "length", "-", "1", "]", ".", "getX", "(", ")", "!=", "ptos", "[", "0", "]", ".", "getX", "(", ")", ")", "||", "(", "ptos", "[", "ptos", ".", "length", "-", "1", "]", ".", "getY", "(", ")", "!=", "ptos", "[", "0", "]", ".", "getY", "(", ")", ")", ")", "{", "Coordinate", "coord", "=", "new", "Coordinate", "(", "ptos", "[", "0", "]", ".", "getX", "(", ")", ",", "ptos", "[", "0", "]", ".", "getY", "(", ")", ",", "0.0", ")", ";", "coordList", ".", "add", "(", "coord", ")", ";", "}", "SimpleFeatureTypeBuilder", "b", "=", "new", "SimpleFeatureTypeBuilder", "(", ")", ";", "b", ".", "setName", "(", "typeName", ")", ";", "b", ".", "setCRS", "(", "crs", ")", ";", "b", ".", "add", "(", "THE_GEOM", ",", "Polygon", ".", "class", ")", ";", "b", ".", "add", "(", "LAYER", ",", "String", ".", "class", ")", ";", "SimpleFeatureType", "type", "=", "b", ".", "buildFeatureType", "(", ")", ";", "SimpleFeatureBuilder", "builder", "=", "new", "SimpleFeatureBuilder", "(", "type", ")", ";", "LinearRing", "linearRing", "=", "gF", ".", "createLinearRing", "(", "coordList", ".", "toCoordinateArray", "(", ")", ")", ";", "Geometry", "polygon", "=", "gF", ".", "createPolygon", "(", "linearRing", ",", "null", ")", ";", "Object", "[", "]", "values", "=", "new", "Object", "[", "]", "{", "polygon", ",", "layerName", "}", ";", "builder", ".", "addAll", "(", "values", ")", ";", "return", "builder", ".", "buildFeature", "(", "typeName", "+", "\".\"", "+", "id", ")", ";", "}" ]
Builds a polygon feature from a dwg circle.
[ "Builds", "a", "polygon", "feature", "from", "a", "dwg", "circle", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java#L258-L288
137,613
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java
GeometryTranslator.convertDwgSolid
public SimpleFeature convertDwgSolid( String typeName, String layerName, DwgSolid solid, int id ) { double[] p1 = solid.getCorner1(); double[] p2 = solid.getCorner2(); double[] p3 = solid.getCorner3(); double[] p4 = solid.getCorner4(); Point2D[] ptos = new Point2D[]{new Point2D.Double(p1[0], p1[1]), new Point2D.Double(p2[0], p2[1]), new Point2D.Double(p3[0], p3[1]), new Point2D.Double(p4[0], p4[1])}; CoordinateList coordList = new CoordinateList(); for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY()); coordList.add(coord); } coordList.closeRing(); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, Polygon.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); LinearRing linearRing = gF.createLinearRing(coordList.toCoordinateArray()); Geometry polygon = gF.createPolygon(linearRing, null); Object[] values = new Object[]{polygon, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
java
public SimpleFeature convertDwgSolid( String typeName, String layerName, DwgSolid solid, int id ) { double[] p1 = solid.getCorner1(); double[] p2 = solid.getCorner2(); double[] p3 = solid.getCorner3(); double[] p4 = solid.getCorner4(); Point2D[] ptos = new Point2D[]{new Point2D.Double(p1[0], p1[1]), new Point2D.Double(p2[0], p2[1]), new Point2D.Double(p3[0], p3[1]), new Point2D.Double(p4[0], p4[1])}; CoordinateList coordList = new CoordinateList(); for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY()); coordList.add(coord); } coordList.closeRing(); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, Polygon.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); LinearRing linearRing = gF.createLinearRing(coordList.toCoordinateArray()); Geometry polygon = gF.createPolygon(linearRing, null); Object[] values = new Object[]{polygon, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
[ "public", "SimpleFeature", "convertDwgSolid", "(", "String", "typeName", ",", "String", "layerName", ",", "DwgSolid", "solid", ",", "int", "id", ")", "{", "double", "[", "]", "p1", "=", "solid", ".", "getCorner1", "(", ")", ";", "double", "[", "]", "p2", "=", "solid", ".", "getCorner2", "(", ")", ";", "double", "[", "]", "p3", "=", "solid", ".", "getCorner3", "(", ")", ";", "double", "[", "]", "p4", "=", "solid", ".", "getCorner4", "(", ")", ";", "Point2D", "[", "]", "ptos", "=", "new", "Point2D", "[", "]", "{", "new", "Point2D", ".", "Double", "(", "p1", "[", "0", "]", ",", "p1", "[", "1", "]", ")", ",", "new", "Point2D", ".", "Double", "(", "p2", "[", "0", "]", ",", "p2", "[", "1", "]", ")", ",", "new", "Point2D", ".", "Double", "(", "p3", "[", "0", "]", ",", "p3", "[", "1", "]", ")", ",", "new", "Point2D", ".", "Double", "(", "p4", "[", "0", "]", ",", "p4", "[", "1", "]", ")", "}", ";", "CoordinateList", "coordList", "=", "new", "CoordinateList", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "ptos", ".", "length", ";", "j", "++", ")", "{", "Coordinate", "coord", "=", "new", "Coordinate", "(", "ptos", "[", "j", "]", ".", "getX", "(", ")", ",", "ptos", "[", "j", "]", ".", "getY", "(", ")", ")", ";", "coordList", ".", "add", "(", "coord", ")", ";", "}", "coordList", ".", "closeRing", "(", ")", ";", "SimpleFeatureTypeBuilder", "b", "=", "new", "SimpleFeatureTypeBuilder", "(", ")", ";", "b", ".", "setName", "(", "typeName", ")", ";", "b", ".", "setCRS", "(", "crs", ")", ";", "b", ".", "add", "(", "THE_GEOM", ",", "Polygon", ".", "class", ")", ";", "b", ".", "add", "(", "LAYER", ",", "String", ".", "class", ")", ";", "SimpleFeatureType", "type", "=", "b", ".", "buildFeatureType", "(", ")", ";", "SimpleFeatureBuilder", "builder", "=", "new", "SimpleFeatureBuilder", "(", "type", ")", ";", "LinearRing", "linearRing", "=", "gF", ".", "createLinearRing", "(", "coordList", ".", "toCoordinateArray", "(", ")", ")", ";", "Geometry", "polygon", "=", "gF", ".", "createPolygon", "(", "linearRing", ",", "null", ")", ";", "Object", "[", "]", "values", "=", "new", "Object", "[", "]", "{", "polygon", ",", "layerName", "}", ";", "builder", ".", "addAll", "(", "values", ")", ";", "return", "builder", ".", "buildFeature", "(", "typeName", "+", "\".\"", "+", "id", ")", ";", "}" ]
Builds a polygon feature from a dwg solid.
[ "Builds", "a", "polygon", "feature", "from", "a", "dwg", "solid", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java#L294-L321
137,614
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java
GeometryTranslator.convertDwgArc
public SimpleFeature convertDwgArc( String typeName, String layerName, DwgArc arc, int id ) { double[] c = arc.getCenter(); Point2D center = new Point2D.Double(c[0], c[1]); double radius = (arc).getRadius(); double initAngle = Math.toDegrees((arc).getInitAngle()); double endAngle = Math.toDegrees((arc).getEndAngle()); Point2D[] ptos = GisModelCurveCalculator.calculateGisModelArc(center, radius, initAngle, endAngle); CoordinateList coordList = new CoordinateList(); for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY(), 0.0); coordList.add(coord); } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, LineString.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry lineString = gF.createLineString(coordList.toCoordinateArray()); Object[] values = new Object[]{lineString, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
java
public SimpleFeature convertDwgArc( String typeName, String layerName, DwgArc arc, int id ) { double[] c = arc.getCenter(); Point2D center = new Point2D.Double(c[0], c[1]); double radius = (arc).getRadius(); double initAngle = Math.toDegrees((arc).getInitAngle()); double endAngle = Math.toDegrees((arc).getEndAngle()); Point2D[] ptos = GisModelCurveCalculator.calculateGisModelArc(center, radius, initAngle, endAngle); CoordinateList coordList = new CoordinateList(); for( int j = 0; j < ptos.length; j++ ) { Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY(), 0.0); coordList.add(coord); } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(typeName); b.setCRS(crs); b.add(THE_GEOM, LineString.class); b.add(LAYER, String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Geometry lineString = gF.createLineString(coordList.toCoordinateArray()); Object[] values = new Object[]{lineString, layerName}; builder.addAll(values); return builder.buildFeature(typeName + "." + id); }
[ "public", "SimpleFeature", "convertDwgArc", "(", "String", "typeName", ",", "String", "layerName", ",", "DwgArc", "arc", ",", "int", "id", ")", "{", "double", "[", "]", "c", "=", "arc", ".", "getCenter", "(", ")", ";", "Point2D", "center", "=", "new", "Point2D", ".", "Double", "(", "c", "[", "0", "]", ",", "c", "[", "1", "]", ")", ";", "double", "radius", "=", "(", "arc", ")", ".", "getRadius", "(", ")", ";", "double", "initAngle", "=", "Math", ".", "toDegrees", "(", "(", "arc", ")", ".", "getInitAngle", "(", ")", ")", ";", "double", "endAngle", "=", "Math", ".", "toDegrees", "(", "(", "arc", ")", ".", "getEndAngle", "(", ")", ")", ";", "Point2D", "[", "]", "ptos", "=", "GisModelCurveCalculator", ".", "calculateGisModelArc", "(", "center", ",", "radius", ",", "initAngle", ",", "endAngle", ")", ";", "CoordinateList", "coordList", "=", "new", "CoordinateList", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "ptos", ".", "length", ";", "j", "++", ")", "{", "Coordinate", "coord", "=", "new", "Coordinate", "(", "ptos", "[", "j", "]", ".", "getX", "(", ")", ",", "ptos", "[", "j", "]", ".", "getY", "(", ")", ",", "0.0", ")", ";", "coordList", ".", "add", "(", "coord", ")", ";", "}", "SimpleFeatureTypeBuilder", "b", "=", "new", "SimpleFeatureTypeBuilder", "(", ")", ";", "b", ".", "setName", "(", "typeName", ")", ";", "b", ".", "setCRS", "(", "crs", ")", ";", "b", ".", "add", "(", "THE_GEOM", ",", "LineString", ".", "class", ")", ";", "b", ".", "add", "(", "LAYER", ",", "String", ".", "class", ")", ";", "SimpleFeatureType", "type", "=", "b", ".", "buildFeatureType", "(", ")", ";", "SimpleFeatureBuilder", "builder", "=", "new", "SimpleFeatureBuilder", "(", "type", ")", ";", "Geometry", "lineString", "=", "gF", ".", "createLineString", "(", "coordList", ".", "toCoordinateArray", "(", ")", ")", ";", "Object", "[", "]", "values", "=", "new", "Object", "[", "]", "{", "lineString", ",", "layerName", "}", ";", "builder", ".", "addAll", "(", "values", ")", ";", "return", "builder", ".", "buildFeature", "(", "typeName", "+", "\".\"", "+", "id", ")", ";", "}" ]
Builds a line feature from a dwg arc.
[ "Builds", "a", "line", "feature", "from", "a", "dwg", "arc", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/GeometryTranslator.java#L326-L351
137,615
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/util/Stats.java
Stats.norm_vec
public static double norm_vec(double x, double y, double z) { return Math.sqrt(x * x + y * y + z * z); }
java
public static double norm_vec(double x, double y, double z) { return Math.sqrt(x * x + y * y + z * z); }
[ "public", "static", "double", "norm_vec", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "return", "Math", ".", "sqrt", "(", "x", "*", "x", "+", "y", "*", "y", "+", "z", "*", "z", ")", ";", "}" ]
Normalized Vector.
[ "Normalized", "Vector", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Stats.java#L25-L27
137,616
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/util/Stats.java
Stats.lag1
public static double lag1(double[] vals) { double mean = mean(vals); int size = vals.length; double r1; double q = 0; double v = (vals[0] - mean) * (vals[0] - mean); for (int i = 1; i < size; i++) { double delta0 = (vals[i - 1] - mean); double delta1 = (vals[i] - mean); q += (delta0 * delta1 - q) / (i + 1); v += (delta1 * delta1 - v) / (i + 1); } r1 = q / v; return r1; }
java
public static double lag1(double[] vals) { double mean = mean(vals); int size = vals.length; double r1; double q = 0; double v = (vals[0] - mean) * (vals[0] - mean); for (int i = 1; i < size; i++) { double delta0 = (vals[i - 1] - mean); double delta1 = (vals[i] - mean); q += (delta0 * delta1 - q) / (i + 1); v += (delta1 * delta1 - v) / (i + 1); } r1 = q / v; return r1; }
[ "public", "static", "double", "lag1", "(", "double", "[", "]", "vals", ")", "{", "double", "mean", "=", "mean", "(", "vals", ")", ";", "int", "size", "=", "vals", ".", "length", ";", "double", "r1", ";", "double", "q", "=", "0", ";", "double", "v", "=", "(", "vals", "[", "0", "]", "-", "mean", ")", "*", "(", "vals", "[", "0", "]", "-", "mean", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "size", ";", "i", "++", ")", "{", "double", "delta0", "=", "(", "vals", "[", "i", "-", "1", "]", "-", "mean", ")", ";", "double", "delta1", "=", "(", "vals", "[", "i", "]", "-", "mean", ")", ";", "q", "+=", "(", "delta0", "*", "delta1", "-", "q", ")", "/", "(", "i", "+", "1", ")", ";", "v", "+=", "(", "delta1", "*", "delta1", "-", "v", ")", "/", "(", "i", "+", "1", ")", ";", "}", "r1", "=", "q", "/", "v", ";", "return", "r1", ";", "}" ]
Returns the lag-1 autocorrelation of a dataset;
[ "Returns", "the", "lag", "-", "1", "autocorrelation", "of", "a", "dataset", ";" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Stats.java#L143-L157
137,617
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/util/Stats.java
Stats.round
public static double round(double val, int places) { long factor = (long) Math.pow(10, places); // Shift the decimal the correct number of places // to the right. val = val * factor; // Round to the nearest integer. long tmp = Math.round(val); // Shift the decimal the correct number of places // back to the left. return (double) tmp / factor; }
java
public static double round(double val, int places) { long factor = (long) Math.pow(10, places); // Shift the decimal the correct number of places // to the right. val = val * factor; // Round to the nearest integer. long tmp = Math.round(val); // Shift the decimal the correct number of places // back to the left. return (double) tmp / factor; }
[ "public", "static", "double", "round", "(", "double", "val", ",", "int", "places", ")", "{", "long", "factor", "=", "(", "long", ")", "Math", ".", "pow", "(", "10", ",", "places", ")", ";", "// Shift the decimal the correct number of places", "// to the right.", "val", "=", "val", "*", "factor", ";", "// Round to the nearest integer.", "long", "tmp", "=", "Math", ".", "round", "(", "val", ")", ";", "// Shift the decimal the correct number of places", "// back to the left.", "return", "(", "double", ")", "tmp", "/", "factor", ";", "}" ]
Round a double value to a specified number of decimal places. @param val the value to be rounded. @param places the number of decimal places to round to. @return val rounded to places decimal places.
[ "Round", "a", "double", "value", "to", "a", "specified", "number", "of", "decimal", "places", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Stats.java#L413-L426
137,618
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/util/Stats.java
Stats.random
public static double random(double min, double max) { assert max > min; return min + Math.random() * (max - min); }
java
public static double random(double min, double max) { assert max > min; return min + Math.random() * (max - min); }
[ "public", "static", "double", "random", "(", "double", "min", ",", "double", "max", ")", "{", "assert", "max", ">", "min", ";", "return", "min", "+", "Math", ".", "random", "(", ")", "*", "(", "max", "-", "min", ")", ";", "}" ]
Generate a random number in a range. @param min @param max @return the random value in the min/max range
[ "Generate", "a", "random", "number", "in", "a", "range", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Stats.java#L447-L450
137,619
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterWriter.java
GrassRasterWriter.checkStructure
private boolean checkStructure() { File ds; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CATS + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL_MISC + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL_MISC + File.separator + name); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.FCELL + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELLHD + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.COLR + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.HIST + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; return true; }
java
private boolean checkStructure() { File ds; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CATS + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL_MISC + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELL_MISC + File.separator + name); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.FCELL + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELLHD + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.COLR + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; ds = new File(mapsetPath + File.separator + GrassLegacyConstans.HIST + File.separator); if (!ds.exists()) if (!ds.mkdir()) return false; return true; }
[ "private", "boolean", "checkStructure", "(", ")", "{", "File", "ds", ";", "ds", "=", "new", "File", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "CATS", "+", "File", ".", "separator", ")", ";", "if", "(", "!", "ds", ".", "exists", "(", ")", ")", "if", "(", "!", "ds", ".", "mkdir", "(", ")", ")", "return", "false", ";", "ds", "=", "new", "File", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "CELL", "+", "File", ".", "separator", ")", ";", "if", "(", "!", "ds", ".", "exists", "(", ")", ")", "if", "(", "!", "ds", ".", "mkdir", "(", ")", ")", "return", "false", ";", "ds", "=", "new", "File", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "CELL_MISC", "+", "File", ".", "separator", ")", ";", "if", "(", "!", "ds", ".", "exists", "(", ")", ")", "if", "(", "!", "ds", ".", "mkdir", "(", ")", ")", "return", "false", ";", "ds", "=", "new", "File", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "CELL_MISC", "+", "File", ".", "separator", "+", "name", ")", ";", "if", "(", "!", "ds", ".", "exists", "(", ")", ")", "if", "(", "!", "ds", ".", "mkdir", "(", ")", ")", "return", "false", ";", "ds", "=", "new", "File", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "FCELL", "+", "File", ".", "separator", ")", ";", "if", "(", "!", "ds", ".", "exists", "(", ")", ")", "if", "(", "!", "ds", ".", "mkdir", "(", ")", ")", "return", "false", ";", "ds", "=", "new", "File", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "CELLHD", "+", "File", ".", "separator", ")", ";", "if", "(", "!", "ds", ".", "exists", "(", ")", ")", "if", "(", "!", "ds", ".", "mkdir", "(", ")", ")", "return", "false", ";", "ds", "=", "new", "File", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "COLR", "+", "File", ".", "separator", ")", ";", "if", "(", "!", "ds", ".", "exists", "(", ")", ")", "if", "(", "!", "ds", ".", "mkdir", "(", ")", ")", "return", "false", ";", "ds", "=", "new", "File", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "HIST", "+", "File", ".", "separator", ")", ";", "if", "(", "!", "ds", ".", "exists", "(", ")", ")", "if", "(", "!", "ds", ".", "mkdir", "(", ")", ")", "return", "false", ";", "return", "true", ";", "}" ]
check if the needed folders are there (they could be missing if the mapset has just been created and this is the first file that gets into it @return
[ "check", "if", "the", "needed", "folders", "are", "there", "(", "they", "could", "be", "missing", "if", "the", "mapset", "has", "just", "been", "created", "and", "this", "is", "the", "first", "file", "that", "gets", "into", "it" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterWriter.java#L142-L178
137,620
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterWriter.java
GrassRasterWriter.createEmptyHeader
private boolean createEmptyHeader( String filePath, int rows ) { try { RandomAccessFile theCreatedFile = new RandomAccessFile(filePath, "rw"); rowaddresses = new long[rows + 1]; // the size of a long theCreatedFile.write(4); // write the addresses of the row begins. Since we don't know how // much // they will be compressed, they will be filled after the // compression for( int i = 0; i < rows + 1; i++ ) { theCreatedFile.writeInt(0); } pointerInFilePosition = theCreatedFile.getFilePointer(); rowaddresses[0] = pointerInFilePosition; theCreatedFile.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
java
private boolean createEmptyHeader( String filePath, int rows ) { try { RandomAccessFile theCreatedFile = new RandomAccessFile(filePath, "rw"); rowaddresses = new long[rows + 1]; // the size of a long theCreatedFile.write(4); // write the addresses of the row begins. Since we don't know how // much // they will be compressed, they will be filled after the // compression for( int i = 0; i < rows + 1; i++ ) { theCreatedFile.writeInt(0); } pointerInFilePosition = theCreatedFile.getFilePointer(); rowaddresses[0] = pointerInFilePosition; theCreatedFile.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
[ "private", "boolean", "createEmptyHeader", "(", "String", "filePath", ",", "int", "rows", ")", "{", "try", "{", "RandomAccessFile", "theCreatedFile", "=", "new", "RandomAccessFile", "(", "filePath", ",", "\"rw\"", ")", ";", "rowaddresses", "=", "new", "long", "[", "rows", "+", "1", "]", ";", "// the size of a long", "theCreatedFile", ".", "write", "(", "4", ")", ";", "// write the addresses of the row begins. Since we don't know how", "// much", "// they will be compressed, they will be filled after the", "// compression", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rows", "+", "1", ";", "i", "++", ")", "{", "theCreatedFile", ".", "writeInt", "(", "0", ")", ";", "}", "pointerInFilePosition", "=", "theCreatedFile", ".", "getFilePointer", "(", ")", ";", "rowaddresses", "[", "0", "]", "=", "pointerInFilePosition", ";", "theCreatedFile", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
creates the space for the header of the rasterfile, filling the spaces with zeroes. After the compression the values will be rewritten @param filePath @param rows @return
[ "creates", "the", "space", "for", "the", "header", "of", "the", "rasterfile", "filling", "the", "spaces", "with", "zeroes", ".", "After", "the", "compression", "the", "values", "will", "be", "rewritten" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterWriter.java#L188-L213
137,621
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterWriter.java
GrassRasterWriter.createCellhd
private void createCellhd( int chproj, int chzone, double chn, double chs, double che, double chw, int chcols, int chrows, double chnsres, double chewres, int chformat, int chcompressed ) throws Exception { StringBuffer data = new StringBuffer(512); data.append("proj: " + chproj + "\n").append("zone: " + chzone + "\n").append("north: " + chn + "\n") .append("south: " + chs + "\n").append("east: " + che + "\n").append("west: " + chw + "\n") .append("cols: " + chcols + "\n").append("rows: " + chrows + "\n").append("n-s resol: " + chnsres + "\n") .append("e-w resol: " + chewres + "\n").append("format: " + chformat + "\n") .append("compressed: " + chcompressed); File ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELLHD + File.separator + name); OutputStreamWriter windFile = new OutputStreamWriter(new FileOutputStream(ds)); windFile.write(data.toString()); windFile.close(); }
java
private void createCellhd( int chproj, int chzone, double chn, double chs, double che, double chw, int chcols, int chrows, double chnsres, double chewres, int chformat, int chcompressed ) throws Exception { StringBuffer data = new StringBuffer(512); data.append("proj: " + chproj + "\n").append("zone: " + chzone + "\n").append("north: " + chn + "\n") .append("south: " + chs + "\n").append("east: " + che + "\n").append("west: " + chw + "\n") .append("cols: " + chcols + "\n").append("rows: " + chrows + "\n").append("n-s resol: " + chnsres + "\n") .append("e-w resol: " + chewres + "\n").append("format: " + chformat + "\n") .append("compressed: " + chcompressed); File ds = new File(mapsetPath + File.separator + GrassLegacyConstans.CELLHD + File.separator + name); OutputStreamWriter windFile = new OutputStreamWriter(new FileOutputStream(ds)); windFile.write(data.toString()); windFile.close(); }
[ "private", "void", "createCellhd", "(", "int", "chproj", ",", "int", "chzone", ",", "double", "chn", ",", "double", "chs", ",", "double", "che", ",", "double", "chw", ",", "int", "chcols", ",", "int", "chrows", ",", "double", "chnsres", ",", "double", "chewres", ",", "int", "chformat", ",", "int", "chcompressed", ")", "throws", "Exception", "{", "StringBuffer", "data", "=", "new", "StringBuffer", "(", "512", ")", ";", "data", ".", "append", "(", "\"proj: \"", "+", "chproj", "+", "\"\\n\"", ")", ".", "append", "(", "\"zone: \"", "+", "chzone", "+", "\"\\n\"", ")", ".", "append", "(", "\"north: \"", "+", "chn", "+", "\"\\n\"", ")", ".", "append", "(", "\"south: \"", "+", "chs", "+", "\"\\n\"", ")", ".", "append", "(", "\"east: \"", "+", "che", "+", "\"\\n\"", ")", ".", "append", "(", "\"west: \"", "+", "chw", "+", "\"\\n\"", ")", ".", "append", "(", "\"cols: \"", "+", "chcols", "+", "\"\\n\"", ")", ".", "append", "(", "\"rows: \"", "+", "chrows", "+", "\"\\n\"", ")", ".", "append", "(", "\"n-s resol: \"", "+", "chnsres", "+", "\"\\n\"", ")", ".", "append", "(", "\"e-w resol: \"", "+", "chewres", "+", "\"\\n\"", ")", ".", "append", "(", "\"format: \"", "+", "chformat", "+", "\"\\n\"", ")", ".", "append", "(", "\"compressed: \"", "+", "chcompressed", ")", ";", "File", "ds", "=", "new", "File", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "CELLHD", "+", "File", ".", "separator", "+", "name", ")", ";", "OutputStreamWriter", "windFile", "=", "new", "OutputStreamWriter", "(", "new", "FileOutputStream", "(", "ds", ")", ")", ";", "windFile", ".", "write", "(", "data", ".", "toString", "(", ")", ")", ";", "windFile", ".", "close", "(", ")", ";", "}" ]
changes the cellhd file inserting the new values obtained from the environment
[ "changes", "the", "cellhd", "file", "inserting", "the", "new", "values", "obtained", "from", "the", "environment" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterWriter.java#L310-L322
137,622
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/CompressesRasterWriter.java
CompressesRasterWriter.compressAndWriteObj
public boolean compressAndWriteObj( RandomAccessFile theCreatedFile, RandomAccessFile theCreatedNullFile, Object dataObject ) throws RasterWritingFailureException { if (dataObject instanceof double[][]) { compressAndWrite(theCreatedFile, theCreatedNullFile, (double[][]) dataObject); } else { throw new RasterWritingFailureException("Raster type not supported."); }
java
public boolean compressAndWriteObj( RandomAccessFile theCreatedFile, RandomAccessFile theCreatedNullFile, Object dataObject ) throws RasterWritingFailureException { if (dataObject instanceof double[][]) { compressAndWrite(theCreatedFile, theCreatedNullFile, (double[][]) dataObject); } else { throw new RasterWritingFailureException("Raster type not supported."); }
[ "public", "boolean", "compressAndWriteObj", "(", "RandomAccessFile", "theCreatedFile", ",", "RandomAccessFile", "theCreatedNullFile", ",", "Object", "dataObject", ")", "throws", "RasterWritingFailureException", "{", "if", "(", "dataObject", "instanceof", "double", "[", "]", "[", "]", ")", "{", "compressAndWrite", "(", "theCreatedFile", ",", "theCreatedNullFile", ",", "(", "double", "[", "]", "[", "]", ")", "dataObject", ")", ";", "}", "else", "{", "throw", "new", "RasterWritingFailureException", "(", "\"Raster type not supported.\"", ")", ";", "}" ]
Passing the object after defining the type of data that will be written @param theCreatedFile @param theCreatedNullFile @param dataObject @return @throws RasterWritingFailureException
[ "Passing", "the", "object", "after", "defining", "the", "type", "of", "data", "that", "will", "be", "written" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/CompressesRasterWriter.java#L81-L87
137,623
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/style/sld/StyleHandler.java
StyleHandler.getStyle
public String getStyle(StyleType type, Color color, String colorName, String layerName) { throw new UnsupportedOperationException(); }
java
public String getStyle(StyleType type, Color color, String colorName, String layerName) { throw new UnsupportedOperationException(); }
[ "public", "String", "getStyle", "(", "StyleType", "type", ",", "Color", "color", ",", "String", "colorName", ",", "String", "layerName", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}" ]
Generates a style from a template using the provided substitutions. @param type the template type, see {@link org.geoserver.catalog.StyleType}. @param color java.aw.Color to use during substitution @param colorName Human readable color name, for use generating comments @param layerName Layer name, for use generating comments @return The text content of the style template after performing substitutions
[ "Generates", "a", "style", "from", "a", "template", "using", "the", "provided", "substitutions", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/style/sld/StyleHandler.java#L98-L100
137,624
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/style/sld/StyleHandler.java
StyleHandler.toReader
protected Reader toReader(Object input) throws IOException { if (input instanceof Reader) { return (Reader) input; } if (input instanceof InputStream) { return new InputStreamReader((InputStream) input); } if (input instanceof String) { return new StringReader((String) input); } if (input instanceof URL) { return new InputStreamReader(((URL) input).openStream()); } if (input instanceof File) { return new FileReader((File) input); } throw new IllegalArgumentException("Unable to turn " + input + " into reader"); }
java
protected Reader toReader(Object input) throws IOException { if (input instanceof Reader) { return (Reader) input; } if (input instanceof InputStream) { return new InputStreamReader((InputStream) input); } if (input instanceof String) { return new StringReader((String) input); } if (input instanceof URL) { return new InputStreamReader(((URL) input).openStream()); } if (input instanceof File) { return new FileReader((File) input); } throw new IllegalArgumentException("Unable to turn " + input + " into reader"); }
[ "protected", "Reader", "toReader", "(", "Object", "input", ")", "throws", "IOException", "{", "if", "(", "input", "instanceof", "Reader", ")", "{", "return", "(", "Reader", ")", "input", ";", "}", "if", "(", "input", "instanceof", "InputStream", ")", "{", "return", "new", "InputStreamReader", "(", "(", "InputStream", ")", "input", ")", ";", "}", "if", "(", "input", "instanceof", "String", ")", "{", "return", "new", "StringReader", "(", "(", "String", ")", "input", ")", ";", "}", "if", "(", "input", "instanceof", "URL", ")", "{", "return", "new", "InputStreamReader", "(", "(", "(", "URL", ")", "input", ")", ".", "openStream", "(", ")", ")", ";", "}", "if", "(", "input", "instanceof", "File", ")", "{", "return", "new", "FileReader", "(", "(", "File", ")", "input", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Unable to turn \"", "+", "input", "+", "\" into reader\"", ")", ";", "}" ]
Turns input into a Reader. @param input A {@link Reader}, {@link java.io.InputStream}, {@link File}, or {@link Resource}.
[ "Turns", "input", "into", "a", "Reader", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/style/sld/StyleHandler.java#L181-L203
137,625
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java
Las.supportsNative
public static boolean supportsNative() { if (!testedLibLoading) { LiblasJNALibrary wrapper = LiblasWrapper.getWrapper(); if (wrapper != null) { isNativeLibAvailable = true; } testedLibLoading = true; } return isNativeLibAvailable; }
java
public static boolean supportsNative() { if (!testedLibLoading) { LiblasJNALibrary wrapper = LiblasWrapper.getWrapper(); if (wrapper != null) { isNativeLibAvailable = true; } testedLibLoading = true; } return isNativeLibAvailable; }
[ "public", "static", "boolean", "supportsNative", "(", ")", "{", "if", "(", "!", "testedLibLoading", ")", "{", "LiblasJNALibrary", "wrapper", "=", "LiblasWrapper", ".", "getWrapper", "(", ")", ";", "if", "(", "wrapper", "!=", "null", ")", "{", "isNativeLibAvailable", "=", "true", ";", "}", "testedLibLoading", "=", "true", ";", "}", "return", "isNativeLibAvailable", ";", "}" ]
Checks of nativ libs are available. @return <code>true</code>, if native liblas connection is available.
[ "Checks", "of", "nativ", "libs", "are", "available", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java#L47-L56
137,626
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java
Las.getReader
public static ALasReader getReader( File lasFile, CoordinateReferenceSystem crs ) throws Exception { if (supportsNative()) { return new LiblasReader(lasFile, crs); } else { return new LasReaderBuffered(lasFile, crs); } }
java
public static ALasReader getReader( File lasFile, CoordinateReferenceSystem crs ) throws Exception { if (supportsNative()) { return new LiblasReader(lasFile, crs); } else { return new LasReaderBuffered(lasFile, crs); } }
[ "public", "static", "ALasReader", "getReader", "(", "File", "lasFile", ",", "CoordinateReferenceSystem", "crs", ")", "throws", "Exception", "{", "if", "(", "supportsNative", "(", ")", ")", "{", "return", "new", "LiblasReader", "(", "lasFile", ",", "crs", ")", ";", "}", "else", "{", "return", "new", "LasReaderBuffered", "(", "lasFile", ",", "crs", ")", ";", "}", "}" ]
Get a las reader. <p>If available, a native reader is created. @param lasFile the file to read. @param crs the {@link CoordinateReferenceSystem} or <code>null</code> if the file has one. @return the las reader. @throws Exception if something goes wrong.
[ "Get", "a", "las", "reader", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java#L84-L90
137,627
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java
Las.getWriter
public static ALasWriter getWriter( File lasFile, CoordinateReferenceSystem crs ) throws Exception { if (supportsNative()) { return new LiblasWriter(lasFile, crs); } else { return new LasWriterBuffered(lasFile, crs); } }
java
public static ALasWriter getWriter( File lasFile, CoordinateReferenceSystem crs ) throws Exception { if (supportsNative()) { return new LiblasWriter(lasFile, crs); } else { return new LasWriterBuffered(lasFile, crs); } }
[ "public", "static", "ALasWriter", "getWriter", "(", "File", "lasFile", ",", "CoordinateReferenceSystem", "crs", ")", "throws", "Exception", "{", "if", "(", "supportsNative", "(", ")", ")", "{", "return", "new", "LiblasWriter", "(", "lasFile", ",", "crs", ")", ";", "}", "else", "{", "return", "new", "LasWriterBuffered", "(", "lasFile", ",", "crs", ")", ";", "}", "}" ]
Get a las writer. <p>If available, a native writer is created. @param lasFile the file to write. @param crs the {@link CoordinateReferenceSystem} to be written in the prj. @return the las writer. @throws Exception if something goes wrong.
[ "Get", "a", "las", "writer", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java#L102-L108
137,628
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/database/tree/DatabaseTreeModel.java
DatabaseTreeModel.setRoot
public void setRoot( DbLevel v ) { DbLevel oldRoot = v; root = v; fireTreeStructureChanged(oldRoot); }
java
public void setRoot( DbLevel v ) { DbLevel oldRoot = v; root = v; fireTreeStructureChanged(oldRoot); }
[ "public", "void", "setRoot", "(", "DbLevel", "v", ")", "{", "DbLevel", "oldRoot", "=", "v", ";", "root", "=", "v", ";", "fireTreeStructureChanged", "(", "oldRoot", ")", ";", "}" ]
Sets the root to a given variable. @param v the variable that is being described by this tree
[ "Sets", "the", "root", "to", "a", "given", "variable", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/database/tree/DatabaseTreeModel.java#L55-L59
137,629
TheHortonMachine/hortonmachine
gui/src/main/java/org/hortonmachine/gui/utils/monitor/ActionWithProgress.java
ActionWithProgress.onError
public void onError( Exception e ) { e.printStackTrace(); String localizedMessage = e.getLocalizedMessage(); if (localizedMessage == null) { localizedMessage = e.getMessage(); } if (localizedMessage == null || localizedMessage.trim().length() == 0) { localizedMessage = "An undefined error was thrown. Please send the below trace to your technical contact:\n"; localizedMessage += ExceptionUtils.getStackTrace(e); } String _localizedMessage = localizedMessage; SwingUtilities.invokeLater(new Runnable(){ public void run() { JOptionPane.showMessageDialog(parent, _localizedMessage, "ERROR", JOptionPane.ERROR_MESSAGE); } }); }
java
public void onError( Exception e ) { e.printStackTrace(); String localizedMessage = e.getLocalizedMessage(); if (localizedMessage == null) { localizedMessage = e.getMessage(); } if (localizedMessage == null || localizedMessage.trim().length() == 0) { localizedMessage = "An undefined error was thrown. Please send the below trace to your technical contact:\n"; localizedMessage += ExceptionUtils.getStackTrace(e); } String _localizedMessage = localizedMessage; SwingUtilities.invokeLater(new Runnable(){ public void run() { JOptionPane.showMessageDialog(parent, _localizedMessage, "ERROR", JOptionPane.ERROR_MESSAGE); } }); }
[ "public", "void", "onError", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "String", "localizedMessage", "=", "e", ".", "getLocalizedMessage", "(", ")", ";", "if", "(", "localizedMessage", "==", "null", ")", "{", "localizedMessage", "=", "e", ".", "getMessage", "(", ")", ";", "}", "if", "(", "localizedMessage", "==", "null", "||", "localizedMessage", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "localizedMessage", "=", "\"An undefined error was thrown. Please send the below trace to your technical contact:\\n\"", ";", "localizedMessage", "+=", "ExceptionUtils", ".", "getStackTrace", "(", "e", ")", ";", "}", "String", "_localizedMessage", "=", "localizedMessage", ";", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "parent", ",", "_localizedMessage", ",", "\"ERROR\"", ",", "JOptionPane", ".", "ERROR_MESSAGE", ")", ";", "}", "}", ")", ";", "}" ]
Called if an error occurrs. Can be overridden. SHows dialog by default. @param e the exception thrown.
[ "Called", "if", "an", "error", "occurrs", ".", "Can", "be", "overridden", ".", "SHows", "dialog", "by", "default", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gui/src/main/java/org/hortonmachine/gui/utils/monitor/ActionWithProgress.java#L120-L137
137,630
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/network/hacklength/OmsHackLength.java
OmsHackLength.tcaMax
public static boolean tcaMax( FlowNode flowNode, RandomIter tcaIter, RandomIter hacklengthIter, double maxTca, double maxDistance ) { List<FlowNode> enteringNodes = flowNode.getEnteringNodes(); for( Node node : enteringNodes ) { double tca = node.getValueFromMap(tcaIter); if (tca >= maxTca) { if (NumericsUtilities.dEq(tca, maxTca)) { if (node.getValueFromMap(hacklengthIter) > maxDistance) return false; } else return false; } } return true; }
java
public static boolean tcaMax( FlowNode flowNode, RandomIter tcaIter, RandomIter hacklengthIter, double maxTca, double maxDistance ) { List<FlowNode> enteringNodes = flowNode.getEnteringNodes(); for( Node node : enteringNodes ) { double tca = node.getValueFromMap(tcaIter); if (tca >= maxTca) { if (NumericsUtilities.dEq(tca, maxTca)) { if (node.getValueFromMap(hacklengthIter) > maxDistance) return false; } else return false; } } return true; }
[ "public", "static", "boolean", "tcaMax", "(", "FlowNode", "flowNode", ",", "RandomIter", "tcaIter", ",", "RandomIter", "hacklengthIter", ",", "double", "maxTca", ",", "double", "maxDistance", ")", "{", "List", "<", "FlowNode", ">", "enteringNodes", "=", "flowNode", ".", "getEnteringNodes", "(", ")", ";", "for", "(", "Node", "node", ":", "enteringNodes", ")", "{", "double", "tca", "=", "node", ".", "getValueFromMap", "(", "tcaIter", ")", ";", "if", "(", "tca", ">=", "maxTca", ")", "{", "if", "(", "NumericsUtilities", ".", "dEq", "(", "tca", ",", "maxTca", ")", ")", "{", "if", "(", "node", ".", "getValueFromMap", "(", "hacklengthIter", ")", ">", "maxDistance", ")", "return", "false", ";", "}", "else", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Compare two value of tca and distance. <p> It's used to evaluate some special distance (as hacklength). In these case, the value of the distance is a property of the path, and so when two pixel drain in a same pixel the actual value is calculate from the pixel that have the maximum value. So this method evaluate if the distance is already evaluate, throghout another path, and if the value of the old path is greater than the next path. </p>
[ "Compare", "two", "value", "of", "tca", "and", "distance", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/network/hacklength/OmsHackLength.java#L217-L233
137,631
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/validation/SequenceEntryUtils.java
SequenceEntryUtils.isCircularBoundary
public static boolean isCircularBoundary( CompoundLocation<Location> location, long sequenceLength) { if (location.getLocations().size() == 1) { return false;// cant be if there is only 1 location element } boolean lastLocation = false; List<Location> locationList = location.getLocations(); for (int i = 0; i < locationList.size(); i++) { if (i == locationList.size() - 1) { lastLocation = true; } Long position = location.getLocations().get(i).getEndPosition(); if (position == sequenceLength && !lastLocation) { return true; } } return false; }
java
public static boolean isCircularBoundary( CompoundLocation<Location> location, long sequenceLength) { if (location.getLocations().size() == 1) { return false;// cant be if there is only 1 location element } boolean lastLocation = false; List<Location> locationList = location.getLocations(); for (int i = 0; i < locationList.size(); i++) { if (i == locationList.size() - 1) { lastLocation = true; } Long position = location.getLocations().get(i).getEndPosition(); if (position == sequenceLength && !lastLocation) { return true; } } return false; }
[ "public", "static", "boolean", "isCircularBoundary", "(", "CompoundLocation", "<", "Location", ">", "location", ",", "long", "sequenceLength", ")", "{", "if", "(", "location", ".", "getLocations", "(", ")", ".", "size", "(", ")", "==", "1", ")", "{", "return", "false", ";", "// cant be if there is only 1 location element", "}", "boolean", "lastLocation", "=", "false", ";", "List", "<", "Location", ">", "locationList", "=", "location", ".", "getLocations", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "locationList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "i", "==", "locationList", ".", "size", "(", ")", "-", "1", ")", "{", "lastLocation", "=", "true", ";", "}", "Long", "position", "=", "location", ".", "getLocations", "(", ")", ".", "get", "(", "i", ")", ".", "getEndPosition", "(", ")", ";", "if", "(", "position", "==", "sequenceLength", "&&", "!", "lastLocation", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks to see if a feature's location spans a circular boundary - assumes the genome the feature is coming from is circular. @param location @param sequenceLength @return
[ "Checks", "to", "see", "if", "a", "feature", "s", "location", "spans", "a", "circular", "boundary", "-", "assumes", "the", "genome", "the", "feature", "is", "coming", "from", "is", "circular", "." ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/SequenceEntryUtils.java#L590-L609
137,632
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/validation/SequenceEntryUtils.java
SequenceEntryUtils.deleteDeletedValueQualifiers
public static boolean deleteDeletedValueQualifiers(Feature feature, ArrayList<Qualifier> deleteQualifierList) { boolean deleted = false; for (Qualifier qual : deleteQualifierList) { feature.removeQualifier(qual); deleted = true; } return deleted; }
java
public static boolean deleteDeletedValueQualifiers(Feature feature, ArrayList<Qualifier> deleteQualifierList) { boolean deleted = false; for (Qualifier qual : deleteQualifierList) { feature.removeQualifier(qual); deleted = true; } return deleted; }
[ "public", "static", "boolean", "deleteDeletedValueQualifiers", "(", "Feature", "feature", ",", "ArrayList", "<", "Qualifier", ">", "deleteQualifierList", ")", "{", "boolean", "deleted", "=", "false", ";", "for", "(", "Qualifier", "qual", ":", "deleteQualifierList", ")", "{", "feature", ".", "removeQualifier", "(", "qual", ")", ";", "deleted", "=", "true", ";", "}", "return", "deleted", ";", "}" ]
deletes the qualifiers which have 'DELETED' value @param feature
[ "deletes", "the", "qualifiers", "which", "have", "DELETED", "value" ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/SequenceEntryUtils.java#L617-L627
137,633
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/validation/SequenceEntryUtils.java
SequenceEntryUtils.deleteDuplicatedQualfiier
public static boolean deleteDuplicatedQualfiier(Feature feature, String qualifierName) { ArrayList<Qualifier> qualifiers = (ArrayList<Qualifier>) feature.getQualifiers(qualifierName); Set<String> qualifierValueSet = new HashSet<String>(); for (Qualifier qual : qualifiers) { if (qual.getValue() != null) { if (!qualifierValueSet.add(qual.getValue())) { feature.removeQualifier(qual); return true; } } } return false; }
java
public static boolean deleteDuplicatedQualfiier(Feature feature, String qualifierName) { ArrayList<Qualifier> qualifiers = (ArrayList<Qualifier>) feature.getQualifiers(qualifierName); Set<String> qualifierValueSet = new HashSet<String>(); for (Qualifier qual : qualifiers) { if (qual.getValue() != null) { if (!qualifierValueSet.add(qual.getValue())) { feature.removeQualifier(qual); return true; } } } return false; }
[ "public", "static", "boolean", "deleteDuplicatedQualfiier", "(", "Feature", "feature", ",", "String", "qualifierName", ")", "{", "ArrayList", "<", "Qualifier", ">", "qualifiers", "=", "(", "ArrayList", "<", "Qualifier", ">", ")", "feature", ".", "getQualifiers", "(", "qualifierName", ")", ";", "Set", "<", "String", ">", "qualifierValueSet", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "Qualifier", "qual", ":", "qualifiers", ")", "{", "if", "(", "qual", ".", "getValue", "(", ")", "!=", "null", ")", "{", "if", "(", "!", "qualifierValueSet", ".", "add", "(", "qual", ".", "getValue", "(", ")", ")", ")", "{", "feature", ".", "removeQualifier", "(", "qual", ")", ";", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Delete duplicated qualfiier. @param feature the feature @param qualifierName the qualifier name
[ "Delete", "duplicated", "qualfiier", "." ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/SequenceEntryUtils.java#L637-L656
137,634
TheHortonMachine/hortonmachine
gui/src/main/java/org/hortonmachine/gui/utils/ImageCache.java
ImageCache.getImage
public ImageIcon getImage( String key ) { ImageIcon image = imageMap.get(key); if (image == null) { image = createImage(key); imageMap.put(key, image); } return image; }
java
public ImageIcon getImage( String key ) { ImageIcon image = imageMap.get(key); if (image == null) { image = createImage(key); imageMap.put(key, image); } return image; }
[ "public", "ImageIcon", "getImage", "(", "String", "key", ")", "{", "ImageIcon", "image", "=", "imageMap", ".", "get", "(", "key", ")", ";", "if", "(", "image", "==", "null", ")", "{", "image", "=", "createImage", "(", "key", ")", ";", "imageMap", ".", "put", "(", "key", ",", "image", ")", ";", "}", "return", "image", ";", "}" ]
Get an image for a certain key. <p> <b>The only keys to be used are the static strings in this class!!</b> </p> @param key a file key, as for example {@link ImageCache#DATABASE_VIEW}. @return the image.
[ "Get", "an", "image", "for", "a", "certain", "key", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gui/src/main/java/org/hortonmachine/gui/utils/ImageCache.java#L151-L158
137,635
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java
SldUtilities.getStyleFromFile
public static Style getStyleFromFile( File file ) { Style style = null; try { String name = file.getName(); if (!name.endsWith("sld")) { String nameWithoutExtention = FileUtilities.getNameWithoutExtention(file); File sldFile = new File(file.getParentFile(), nameWithoutExtention + ".sld"); if (sldFile.exists()) { file = sldFile; } else { // no style file here return null; } } SLDHandler h = new SLDHandler(); StyledLayerDescriptor sld = h.parse(file, null, null, null); // SLDParser stylereader = new SLDParser(sf, file); // StyledLayerDescriptor sld = stylereader.parseSLD(); style = getDefaultStyle(sld); return style; } catch (Exception e) { e.printStackTrace(); return null; } }
java
public static Style getStyleFromFile( File file ) { Style style = null; try { String name = file.getName(); if (!name.endsWith("sld")) { String nameWithoutExtention = FileUtilities.getNameWithoutExtention(file); File sldFile = new File(file.getParentFile(), nameWithoutExtention + ".sld"); if (sldFile.exists()) { file = sldFile; } else { // no style file here return null; } } SLDHandler h = new SLDHandler(); StyledLayerDescriptor sld = h.parse(file, null, null, null); // SLDParser stylereader = new SLDParser(sf, file); // StyledLayerDescriptor sld = stylereader.parseSLD(); style = getDefaultStyle(sld); return style; } catch (Exception e) { e.printStackTrace(); return null; } }
[ "public", "static", "Style", "getStyleFromFile", "(", "File", "file", ")", "{", "Style", "style", "=", "null", ";", "try", "{", "String", "name", "=", "file", ".", "getName", "(", ")", ";", "if", "(", "!", "name", ".", "endsWith", "(", "\"sld\"", ")", ")", "{", "String", "nameWithoutExtention", "=", "FileUtilities", ".", "getNameWithoutExtention", "(", "file", ")", ";", "File", "sldFile", "=", "new", "File", "(", "file", ".", "getParentFile", "(", ")", ",", "nameWithoutExtention", "+", "\".sld\"", ")", ";", "if", "(", "sldFile", ".", "exists", "(", ")", ")", "{", "file", "=", "sldFile", ";", "}", "else", "{", "// no style file here", "return", "null", ";", "}", "}", "SLDHandler", "h", "=", "new", "SLDHandler", "(", ")", ";", "StyledLayerDescriptor", "sld", "=", "h", ".", "parse", "(", "file", ",", "null", ",", "null", ",", "null", ")", ";", "// SLDParser stylereader = new SLDParser(sf, file);", "// StyledLayerDescriptor sld = stylereader.parseSLD();", "style", "=", "getDefaultStyle", "(", "sld", ")", ";", "return", "style", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "null", ";", "}", "}" ]
Get the style from an sld file. @param file the SLD file or a companion file. @return the {@link Style} object. @throws IOException
[ "Get", "the", "style", "from", "an", "sld", "file", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java#L86-L111
137,636
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java
SldUtilities.genericizeftStyles
private static void genericizeftStyles( List<FeatureTypeStyle> ftStyles ) { for( FeatureTypeStyle featureTypeStyle : ftStyles ) { featureTypeStyle.featureTypeNames().clear(); featureTypeStyle.featureTypeNames().add(new NameImpl(GENERIC_FEATURE_TYPENAME)); } }
java
private static void genericizeftStyles( List<FeatureTypeStyle> ftStyles ) { for( FeatureTypeStyle featureTypeStyle : ftStyles ) { featureTypeStyle.featureTypeNames().clear(); featureTypeStyle.featureTypeNames().add(new NameImpl(GENERIC_FEATURE_TYPENAME)); } }
[ "private", "static", "void", "genericizeftStyles", "(", "List", "<", "FeatureTypeStyle", ">", "ftStyles", ")", "{", "for", "(", "FeatureTypeStyle", "featureTypeStyle", ":", "ftStyles", ")", "{", "featureTypeStyle", ".", "featureTypeNames", "(", ")", ".", "clear", "(", ")", ";", "featureTypeStyle", ".", "featureTypeNames", "(", ")", ".", "add", "(", "new", "NameImpl", "(", "GENERIC_FEATURE_TYPENAME", ")", ")", ";", "}", "}" ]
Converts the type name of all FeatureTypeStyles to Feature so that the all apply to any feature type. This is admittedly dangerous but is extremely useful because it means that the style can be used with any feature type. @param ftStyles
[ "Converts", "the", "type", "name", "of", "all", "FeatureTypeStyles", "to", "Feature", "so", "that", "the", "all", "apply", "to", "any", "feature", "type", ".", "This", "is", "admittedly", "dangerous", "but", "is", "extremely", "useful", "because", "it", "means", "that", "the", "style", "can", "be", "used", "with", "any", "feature", "type", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java#L266-L271
137,637
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java
SldUtilities.colorWithoutAlpha
public static Color colorWithoutAlpha( Color color ) { return new Color(color.getRed(), color.getGreen(), color.getBlue()); }
java
public static Color colorWithoutAlpha( Color color ) { return new Color(color.getRed(), color.getGreen(), color.getBlue()); }
[ "public", "static", "Color", "colorWithoutAlpha", "(", "Color", "color", ")", "{", "return", "new", "Color", "(", "color", ".", "getRed", "(", ")", ",", "color", ".", "getGreen", "(", ")", ",", "color", ".", "getBlue", "(", ")", ")", ";", "}" ]
REmoves the alpha channel from a color. @param color the color. @return the color without alpha.
[ "REmoves", "the", "alpha", "channel", "from", "a", "color", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java#L279-L281
137,638
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java
SldUtilities.colorWithAlpha
public static Color colorWithAlpha( Color color, int alpha ) { return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); }
java
public static Color colorWithAlpha( Color color, int alpha ) { return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); }
[ "public", "static", "Color", "colorWithAlpha", "(", "Color", "color", ",", "int", "alpha", ")", "{", "return", "new", "Color", "(", "color", ".", "getRed", "(", ")", ",", "color", ".", "getGreen", "(", ")", ",", "color", ".", "getBlue", "(", ")", ",", "alpha", ")", ";", "}" ]
Creates a color with the given alpha. @param color the color to use. @param alpha an alpha value between 0 and 255. @return the color with alpha.
[ "Creates", "a", "color", "with", "the", "given", "alpha", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java#L290-L292
137,639
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/template/TemplateInfo.java
TemplateInfo.getTokensAsMap
public Map<String, TemplateTokenInfo> getTokensAsMap() { HashMap<String, TemplateTokenInfo> tokens = new HashMap<String, TemplateTokenInfo>(); for (TemplateTokenInfo tokenInfo : tokenInfos) tokens.put(tokenInfo.getName(), tokenInfo); return Collections.unmodifiableMap(tokens); }
java
public Map<String, TemplateTokenInfo> getTokensAsMap() { HashMap<String, TemplateTokenInfo> tokens = new HashMap<String, TemplateTokenInfo>(); for (TemplateTokenInfo tokenInfo : tokenInfos) tokens.put(tokenInfo.getName(), tokenInfo); return Collections.unmodifiableMap(tokens); }
[ "public", "Map", "<", "String", ",", "TemplateTokenInfo", ">", "getTokensAsMap", "(", ")", "{", "HashMap", "<", "String", ",", "TemplateTokenInfo", ">", "tokens", "=", "new", "HashMap", "<", "String", ",", "TemplateTokenInfo", ">", "(", ")", ";", "for", "(", "TemplateTokenInfo", "tokenInfo", ":", "tokenInfos", ")", "tokens", ".", "put", "(", "tokenInfo", ".", "getName", "(", ")", ",", "tokenInfo", ")", ";", "return", "Collections", ".", "unmodifiableMap", "(", "tokens", ")", ";", "}" ]
returns a map keyed with the token name @return
[ "returns", "a", "map", "keyed", "with", "the", "token", "name" ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/template/TemplateInfo.java#L154-L159
137,640
TheHortonMachine/hortonmachine
extras/sideprojects/gpextras/src/main/java/org/hortonmachine/gpextras/tiles/MapsforgeTilesGenerator.java
MapsforgeTilesGenerator.getTile4TileCoordinate
public <T> T getTile4TileCoordinate( final int tx, final int ty, int zoom, Class<T> adaptee ) throws IOException { //System.out.println("https://tile.openstreetmap.org/" + zoom + "/" + tx + "/" + ty + ".png"); Tile tile = new Tile(tx, ty, (byte) zoom, tileSize); RendererJob mapGeneratorJob = new RendererJob(tile, mapDataStore, renderTheme, displayModel, scaleFactor, false, false); TileBitmap tb = renderer.executeJob(mapGeneratorJob); if (!(tileCache instanceof InMemoryTileCache)) { tileCache.put(mapGeneratorJob, tb); } if (tb instanceof AwtTileBitmap) { AwtTileBitmap bmp = (AwtTileBitmap) tb; if (bmp != null) { BufferedImage bitmap = AwtGraphicFactory.getBitmap(bmp); if (adaptee.isAssignableFrom(BufferedImage.class)) { return adaptee.cast(bitmap); } else if (adaptee.isAssignableFrom(byte[].class)) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(bitmap, "png", baos); baos.flush(); byte[] imageInByte = baos.toByteArray(); baos.close(); return adaptee.cast(imageInByte); } } } throw new RuntimeException("Can't handle tilebitmap of type -> " + tb.getClass()); }
java
public <T> T getTile4TileCoordinate( final int tx, final int ty, int zoom, Class<T> adaptee ) throws IOException { //System.out.println("https://tile.openstreetmap.org/" + zoom + "/" + tx + "/" + ty + ".png"); Tile tile = new Tile(tx, ty, (byte) zoom, tileSize); RendererJob mapGeneratorJob = new RendererJob(tile, mapDataStore, renderTheme, displayModel, scaleFactor, false, false); TileBitmap tb = renderer.executeJob(mapGeneratorJob); if (!(tileCache instanceof InMemoryTileCache)) { tileCache.put(mapGeneratorJob, tb); } if (tb instanceof AwtTileBitmap) { AwtTileBitmap bmp = (AwtTileBitmap) tb; if (bmp != null) { BufferedImage bitmap = AwtGraphicFactory.getBitmap(bmp); if (adaptee.isAssignableFrom(BufferedImage.class)) { return adaptee.cast(bitmap); } else if (adaptee.isAssignableFrom(byte[].class)) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(bitmap, "png", baos); baos.flush(); byte[] imageInByte = baos.toByteArray(); baos.close(); return adaptee.cast(imageInByte); } } } throw new RuntimeException("Can't handle tilebitmap of type -> " + tb.getClass()); }
[ "public", "<", "T", ">", "T", "getTile4TileCoordinate", "(", "final", "int", "tx", ",", "final", "int", "ty", ",", "int", "zoom", ",", "Class", "<", "T", ">", "adaptee", ")", "throws", "IOException", "{", "//System.out.println(\"https://tile.openstreetmap.org/\" + zoom + \"/\" + tx + \"/\" + ty + \".png\");", "Tile", "tile", "=", "new", "Tile", "(", "tx", ",", "ty", ",", "(", "byte", ")", "zoom", ",", "tileSize", ")", ";", "RendererJob", "mapGeneratorJob", "=", "new", "RendererJob", "(", "tile", ",", "mapDataStore", ",", "renderTheme", ",", "displayModel", ",", "scaleFactor", ",", "false", ",", "false", ")", ";", "TileBitmap", "tb", "=", "renderer", ".", "executeJob", "(", "mapGeneratorJob", ")", ";", "if", "(", "!", "(", "tileCache", "instanceof", "InMemoryTileCache", ")", ")", "{", "tileCache", ".", "put", "(", "mapGeneratorJob", ",", "tb", ")", ";", "}", "if", "(", "tb", "instanceof", "AwtTileBitmap", ")", "{", "AwtTileBitmap", "bmp", "=", "(", "AwtTileBitmap", ")", "tb", ";", "if", "(", "bmp", "!=", "null", ")", "{", "BufferedImage", "bitmap", "=", "AwtGraphicFactory", ".", "getBitmap", "(", "bmp", ")", ";", "if", "(", "adaptee", ".", "isAssignableFrom", "(", "BufferedImage", ".", "class", ")", ")", "{", "return", "adaptee", ".", "cast", "(", "bitmap", ")", ";", "}", "else", "if", "(", "adaptee", ".", "isAssignableFrom", "(", "byte", "[", "]", ".", "class", ")", ")", "{", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ImageIO", ".", "write", "(", "bitmap", ",", "\"png\"", ",", "baos", ")", ";", "baos", ".", "flush", "(", ")", ";", "byte", "[", "]", "imageInByte", "=", "baos", ".", "toByteArray", "(", ")", ";", "baos", ".", "close", "(", ")", ";", "return", "adaptee", ".", "cast", "(", "imageInByte", ")", ";", "}", "}", "}", "throw", "new", "RuntimeException", "(", "\"Can't handle tilebitmap of type -> \"", "+", "tb", ".", "getClass", "(", ")", ")", ";", "}" ]
Get tile data for a given tile schema coordinate. @param tx the x tile index. @param ty the y tile index. @param zoom the zoomlevel @param adaptee the class to adapt to. @return the generated data. @throws IOException
[ "Get", "tile", "data", "for", "a", "given", "tile", "schema", "coordinate", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/extras/sideprojects/gpextras/src/main/java/org/hortonmachine/gpextras/tiles/MapsforgeTilesGenerator.java#L169-L196
137,641
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENopen
public void ENopen( String input, String report, String outputBin ) throws EpanetException { int errcode = epanet.ENopen(input, report, outputBin); checkError(errcode); }
java
public void ENopen( String input, String report, String outputBin ) throws EpanetException { int errcode = epanet.ENopen(input, report, outputBin); checkError(errcode); }
[ "public", "void", "ENopen", "(", "String", "input", ",", "String", "report", ",", "String", "outputBin", ")", "throws", "EpanetException", "{", "int", "errcode", "=", "epanet", ".", "ENopen", "(", "input", ",", "report", ",", "outputBin", ")", ";", "checkError", "(", "errcode", ")", ";", "}" ]
Opens the Toolkit to analyze a particular distribution system. @param input name of an EPANET Input file. @param report name of an output Report file. @param outputBin name of an optional binary Output file. @throws IOException
[ "Opens", "the", "Toolkit", "to", "analyze", "a", "particular", "distribution", "system", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L82-L85
137,642
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENsaveinpfile
public void ENsaveinpfile( String fileName ) throws EpanetException { int err = epanet.ENsaveinpfile(fileName); checkError(err); }
java
public void ENsaveinpfile( String fileName ) throws EpanetException { int err = epanet.ENsaveinpfile(fileName); checkError(err); }
[ "public", "void", "ENsaveinpfile", "(", "String", "fileName", ")", "throws", "EpanetException", "{", "int", "err", "=", "epanet", ".", "ENsaveinpfile", "(", "fileName", ")", ";", "checkError", "(", "err", ")", ";", "}" ]
Writes all current network input data to a file using the format of an EPANET input file. @param fileName name of the file where data is saved. @throws EpanetException
[ "Writes", "all", "current", "network", "input", "data", "to", "a", "file", "using", "the", "format", "of", "an", "EPANET", "input", "file", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L106-L109
137,643
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENsavehydfile
public void ENsavehydfile( String filePath ) throws EpanetException { int err = epanet.ENsavehydfile(filePath); checkError(err); }
java
public void ENsavehydfile( String filePath ) throws EpanetException { int err = epanet.ENsavehydfile(filePath); checkError(err); }
[ "public", "void", "ENsavehydfile", "(", "String", "filePath", ")", "throws", "EpanetException", "{", "int", "err", "=", "epanet", ".", "ENsavehydfile", "(", "filePath", ")", ";", "checkError", "(", "err", ")", ";", "}" ]
Saves the current contents of the binary hydraulics file to a file. @param filePath name of the file where the hydraulics results should be saved. @throws EpanetException
[ "Saves", "the", "current", "contents", "of", "the", "binary", "hydraulics", "file", "to", "a", "file", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L218-L221
137,644
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetcount
public int ENgetcount( Components countcode ) throws EpanetException { int[] count = new int[1]; int error = epanet.ENgetcount(countcode.getCode(), count); checkError(error); return count[0]; }
java
public int ENgetcount( Components countcode ) throws EpanetException { int[] count = new int[1]; int error = epanet.ENgetcount(countcode.getCode(), count); checkError(error); return count[0]; }
[ "public", "int", "ENgetcount", "(", "Components", "countcode", ")", "throws", "EpanetException", "{", "int", "[", "]", "count", "=", "new", "int", "[", "1", "]", ";", "int", "error", "=", "epanet", ".", "ENgetcount", "(", "countcode", ".", "getCode", "(", ")", ",", "count", ")", ";", "checkError", "(", "error", ")", ";", "return", "count", "[", "0", "]", ";", "}" ]
Retrieves the number of network components of a specified type. @param countcode {@link Components} code . @return number of countcode components in the network. @throws EpanetException
[ "Retrieves", "the", "number", "of", "network", "components", "of", "a", "specified", "type", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L331-L336
137,645
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetoption
public float ENgetoption( OptionParameterCodes optionCode ) throws EpanetException { float[] optionValue = new float[1]; int error = epanet.ENgetoption(optionCode.getCode(), optionValue); checkError(error); return optionValue[0]; }
java
public float ENgetoption( OptionParameterCodes optionCode ) throws EpanetException { float[] optionValue = new float[1]; int error = epanet.ENgetoption(optionCode.getCode(), optionValue); checkError(error); return optionValue[0]; }
[ "public", "float", "ENgetoption", "(", "OptionParameterCodes", "optionCode", ")", "throws", "EpanetException", "{", "float", "[", "]", "optionValue", "=", "new", "float", "[", "1", "]", ";", "int", "error", "=", "epanet", ".", "ENgetoption", "(", "optionCode", ".", "getCode", "(", ")", ",", "optionValue", ")", ";", "checkError", "(", "error", ")", ";", "return", "optionValue", "[", "0", "]", ";", "}" ]
Retrieves the value of a particular analysis option. @param optionCode The {@link OptionParameterCodes}. @throws EpanetException
[ "Retrieves", "the", "value", "of", "a", "particular", "analysis", "option", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L344-L349
137,646
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgettimeparam
public long ENgettimeparam( TimeParameterCodes timeParameterCode ) throws EpanetException { long[] timeValue = new long[1]; int error = epanet.ENgettimeparam(timeParameterCode.getCode(), timeValue); checkError(error); return timeValue[0]; }
java
public long ENgettimeparam( TimeParameterCodes timeParameterCode ) throws EpanetException { long[] timeValue = new long[1]; int error = epanet.ENgettimeparam(timeParameterCode.getCode(), timeValue); checkError(error); return timeValue[0]; }
[ "public", "long", "ENgettimeparam", "(", "TimeParameterCodes", "timeParameterCode", ")", "throws", "EpanetException", "{", "long", "[", "]", "timeValue", "=", "new", "long", "[", "1", "]", ";", "int", "error", "=", "epanet", ".", "ENgettimeparam", "(", "timeParameterCode", ".", "getCode", "(", ")", ",", "timeValue", ")", ";", "checkError", "(", "error", ")", ";", "return", "timeValue", "[", "0", "]", ";", "}" ]
Retrieves the value of a specific analysis time parameter. @param timeParameterCode time parameter code. @return value of time parameter in seconds. @throws EpanetException
[ "Retrieves", "the", "value", "of", "a", "specific", "analysis", "time", "parameter", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L358-L363
137,647
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetpatternindex
public int ENgetpatternindex( String id ) throws EpanetException { int[] index = new int[1]; int error = epanet.ENgetpatternindex(id, index); checkError(error); return index[0]; }
java
public int ENgetpatternindex( String id ) throws EpanetException { int[] index = new int[1]; int error = epanet.ENgetpatternindex(id, index); checkError(error); return index[0]; }
[ "public", "int", "ENgetpatternindex", "(", "String", "id", ")", "throws", "EpanetException", "{", "int", "[", "]", "index", "=", "new", "int", "[", "1", "]", ";", "int", "error", "=", "epanet", ".", "ENgetpatternindex", "(", "id", ",", "index", ")", ";", "checkError", "(", "error", ")", ";", "return", "index", "[", "0", "]", ";", "}" ]
Retrieves the index of a particular time pattern. @param id pattern ID label. @return the pattern index. @throws EpanetException
[ "Retrieves", "the", "index", "of", "a", "particular", "time", "pattern", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L378-L383
137,648
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetpatternvalue
public float ENgetpatternvalue( int index, int period ) throws EpanetException { float[] value = new float[1]; int errcode = epanet.ENgetpatternvalue(index, period, value); checkError(errcode); return value[0]; }
java
public float ENgetpatternvalue( int index, int period ) throws EpanetException { float[] value = new float[1]; int errcode = epanet.ENgetpatternvalue(index, period, value); checkError(errcode); return value[0]; }
[ "public", "float", "ENgetpatternvalue", "(", "int", "index", ",", "int", "period", ")", "throws", "EpanetException", "{", "float", "[", "]", "value", "=", "new", "float", "[", "1", "]", ";", "int", "errcode", "=", "epanet", ".", "ENgetpatternvalue", "(", "index", ",", "period", ",", "value", ")", ";", "checkError", "(", "errcode", ")", ";", "return", "value", "[", "0", "]", ";", "}" ]
Retrieves the multiplier factor for a specific time period in a time pattern. @param index time pattern index. @param period period within time pattern. @return multiplier factor for the period. @throws EpanetException
[ "Retrieves", "the", "multiplier", "factor", "for", "a", "specific", "time", "period", "in", "a", "time", "pattern", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L416-L422
137,649
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetnodeindex
public int ENgetnodeindex( String id ) throws EpanetException { int[] index = new int[1]; int error = epanet.ENgetnodeindex(id, index); checkError(error); return index[0]; }
java
public int ENgetnodeindex( String id ) throws EpanetException { int[] index = new int[1]; int error = epanet.ENgetnodeindex(id, index); checkError(error); return index[0]; }
[ "public", "int", "ENgetnodeindex", "(", "String", "id", ")", "throws", "EpanetException", "{", "int", "[", "]", "index", "=", "new", "int", "[", "1", "]", ";", "int", "error", "=", "epanet", ".", "ENgetnodeindex", "(", "id", ",", "index", ")", ";", "checkError", "(", "error", ")", ";", "return", "index", "[", "0", "]", ";", "}" ]
Retrieves the index of a node with a specified ID. @param id the node id. @return the node index. @throws EpanetException
[ "Retrieves", "the", "index", "of", "a", "node", "with", "a", "specified", "ID", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L443-L448
137,650
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetnodetype
public NodeTypes ENgetnodetype( int index ) throws EpanetException { int[] typecode = new int[1]; int error = epanet.ENgetnodetype(index, typecode); checkError(error); NodeTypes type = NodeTypes.forCode(typecode[0]); return type; }
java
public NodeTypes ENgetnodetype( int index ) throws EpanetException { int[] typecode = new int[1]; int error = epanet.ENgetnodetype(index, typecode); checkError(error); NodeTypes type = NodeTypes.forCode(typecode[0]); return type; }
[ "public", "NodeTypes", "ENgetnodetype", "(", "int", "index", ")", "throws", "EpanetException", "{", "int", "[", "]", "typecode", "=", "new", "int", "[", "1", "]", ";", "int", "error", "=", "epanet", ".", "ENgetnodetype", "(", "index", ",", "typecode", ")", ";", "checkError", "(", "error", ")", ";", "NodeTypes", "type", "=", "NodeTypes", ".", "forCode", "(", "typecode", "[", "0", "]", ")", ";", "return", "type", ";", "}" ]
Retrieves the node-type code for a specific node. @param index the node index. @return the {@link NodeTypes}; @throws EpanetException
[ "Retrieves", "the", "node", "-", "type", "code", "for", "a", "specific", "node", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L474-L481
137,651
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetlinkindex
public int ENgetlinkindex( String id ) throws EpanetException { int[] index = new int[1]; int error = epanet.ENgetlinkindex(id, index); checkError(error); return index[0]; }
java
public int ENgetlinkindex( String id ) throws EpanetException { int[] index = new int[1]; int error = epanet.ENgetlinkindex(id, index); checkError(error); return index[0]; }
[ "public", "int", "ENgetlinkindex", "(", "String", "id", ")", "throws", "EpanetException", "{", "int", "[", "]", "index", "=", "new", "int", "[", "1", "]", ";", "int", "error", "=", "epanet", ".", "ENgetlinkindex", "(", "id", ",", "index", ")", ";", "checkError", "(", "error", ")", ";", "return", "index", "[", "0", "]", ";", "}" ]
Retrieves the index of a link with a specified ID. <p>Link indexes are consecutive integers starting from 1. @param id link ID label. @return the link index. @throws EpanetException
[ "Retrieves", "the", "index", "of", "a", "link", "with", "a", "specified", "ID", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L507-L512
137,652
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetlinkid
public String ENgetlinkid( int index ) throws EpanetException { ByteBuffer bb = ByteBuffer.allocate(64); int errcode = epanet.ENgetlinkid(index, bb); checkError(errcode); String label; label = byteBuffer2String(bb); return label; }
java
public String ENgetlinkid( int index ) throws EpanetException { ByteBuffer bb = ByteBuffer.allocate(64); int errcode = epanet.ENgetlinkid(index, bb); checkError(errcode); String label; label = byteBuffer2String(bb); return label; }
[ "public", "String", "ENgetlinkid", "(", "int", "index", ")", "throws", "EpanetException", "{", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "allocate", "(", "64", ")", ";", "int", "errcode", "=", "epanet", ".", "ENgetlinkid", "(", "index", ",", "bb", ")", ";", "checkError", "(", "errcode", ")", ";", "String", "label", ";", "label", "=", "byteBuffer2String", "(", "bb", ")", ";", "return", "label", ";", "}" ]
Retrieves the ID label of a link with a specified index. @param index link index. @return the link label. @throws EpanetException
[ "Retrieves", "the", "ID", "label", "of", "a", "link", "with", "a", "specified", "index", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L521-L529
137,653
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetlinktype
public LinkTypes ENgetlinktype( int index ) throws EpanetException { int[] typecode = new int[1]; int error = epanet.ENgetlinktype(index, typecode); checkError(error); LinkTypes type = LinkTypes.forCode(typecode[0]); return type; }
java
public LinkTypes ENgetlinktype( int index ) throws EpanetException { int[] typecode = new int[1]; int error = epanet.ENgetlinktype(index, typecode); checkError(error); LinkTypes type = LinkTypes.forCode(typecode[0]); return type; }
[ "public", "LinkTypes", "ENgetlinktype", "(", "int", "index", ")", "throws", "EpanetException", "{", "int", "[", "]", "typecode", "=", "new", "int", "[", "1", "]", ";", "int", "error", "=", "epanet", ".", "ENgetlinktype", "(", "index", ",", "typecode", ")", ";", "checkError", "(", "error", ")", ";", "LinkTypes", "type", "=", "LinkTypes", ".", "forCode", "(", "typecode", "[", "0", "]", ")", ";", "return", "type", ";", "}" ]
Retrieves the link-type code for a specific link. @param index link index. @return the {@link LinkTypes}. @throws EpanetException
[ "Retrieves", "the", "link", "-", "type", "code", "for", "a", "specific", "link", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L538-L545
137,654
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetlinknodes
public int[] ENgetlinknodes( int index ) throws EpanetException { int[] from = new int[1]; int[] to = new int[1]; int error = epanet.ENgetlinknodes(index, from, to); checkError(error); return new int[]{from[0], to[0]}; }
java
public int[] ENgetlinknodes( int index ) throws EpanetException { int[] from = new int[1]; int[] to = new int[1]; int error = epanet.ENgetlinknodes(index, from, to); checkError(error); return new int[]{from[0], to[0]}; }
[ "public", "int", "[", "]", "ENgetlinknodes", "(", "int", "index", ")", "throws", "EpanetException", "{", "int", "[", "]", "from", "=", "new", "int", "[", "1", "]", ";", "int", "[", "]", "to", "=", "new", "int", "[", "1", "]", ";", "int", "error", "=", "epanet", ".", "ENgetlinknodes", "(", "index", ",", "from", ",", "to", ")", ";", "checkError", "(", "error", ")", ";", "return", "new", "int", "[", "]", "{", "from", "[", "0", "]", ",", "to", "[", "0", "]", "}", ";", "}" ]
Retrieves the indexes of the end nodes of a specified link. <p> Node and link indexes are consecutive integers starting from 1. <p>The From and To nodes are as defined for the link in the EPANET input file. The actual direction of flow in the link is not considered. @param index the link index. @return the from and to node indexes as a two items array. @throws EpanetException
[ "Retrieves", "the", "indexes", "of", "the", "end", "nodes", "of", "a", "specified", "link", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L560-L566
137,655
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetlinkvalue
public float[] ENgetlinkvalue( int index, LinkParameters param ) throws EpanetException { float[] value = new float[2]; int errcode = epanet.ENgetlinkvalue(index, param.getCode(), value); checkError(errcode); return value; }
java
public float[] ENgetlinkvalue( int index, LinkParameters param ) throws EpanetException { float[] value = new float[2]; int errcode = epanet.ENgetlinkvalue(index, param.getCode(), value); checkError(errcode); return value; }
[ "public", "float", "[", "]", "ENgetlinkvalue", "(", "int", "index", ",", "LinkParameters", "param", ")", "throws", "EpanetException", "{", "float", "[", "]", "value", "=", "new", "float", "[", "2", "]", ";", "int", "errcode", "=", "epanet", ".", "ENgetlinkvalue", "(", "index", ",", "param", ".", "getCode", "(", ")", ",", "value", ")", ";", "checkError", "(", "errcode", ")", ";", "return", "value", ";", "}" ]
Retrieves the value of a specific link parameter. @param index link index. @param param {@link LinkParameters}. @return the value. @throws EpanetException
[ "Retrieves", "the", "value", "of", "a", "specific", "link", "parameter", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L576-L582
137,656
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENgetversion
public int ENgetversion() throws EpanetException { int[] version = new int[0]; int errcode = epanet.ENgetversion(version); checkError(errcode); return version[0]; }
java
public int ENgetversion() throws EpanetException { int[] version = new int[0]; int errcode = epanet.ENgetversion(version); checkError(errcode); return version[0]; }
[ "public", "int", "ENgetversion", "(", ")", "throws", "EpanetException", "{", "int", "[", "]", "version", "=", "new", "int", "[", "0", "]", ";", "int", "errcode", "=", "epanet", ".", "ENgetversion", "(", "version", ")", ";", "checkError", "(", "errcode", ")", ";", "return", "version", "[", "0", "]", ";", "}" ]
Get the version of OmsEpanet. @return the version of epanet. @throws EpanetException
[ "Get", "the", "version", "of", "OmsEpanet", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L590-L595
137,657
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENsetnodevalue
public void ENsetnodevalue( int index, NodeParameters nodeParameter, float value ) throws EpanetException { int errcode = epanet.ENsetnodevalue(index, nodeParameter.getCode(), value); checkError(errcode); }
java
public void ENsetnodevalue( int index, NodeParameters nodeParameter, float value ) throws EpanetException { int errcode = epanet.ENsetnodevalue(index, nodeParameter.getCode(), value); checkError(errcode); }
[ "public", "void", "ENsetnodevalue", "(", "int", "index", ",", "NodeParameters", "nodeParameter", ",", "float", "value", ")", "throws", "EpanetException", "{", "int", "errcode", "=", "epanet", ".", "ENsetnodevalue", "(", "index", ",", "nodeParameter", ".", "getCode", "(", ")", ",", "value", ")", ";", "checkError", "(", "errcode", ")", ";", "}" ]
Sets the value of a parameter for a specific node. @param index node index. @param paramcode parameter code. @param value parameter value. @throws EpanetException
[ "Sets", "the", "value", "of", "a", "parameter", "for", "a", "specific", "node", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L610-L613
137,658
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENsetlinkvalue
public void ENsetlinkvalue( int index, LinkParameters linkParameter, float value ) throws EpanetException { int errcode = epanet.ENsetnodevalue(index, linkParameter.getCode(), value); checkError(errcode); }
java
public void ENsetlinkvalue( int index, LinkParameters linkParameter, float value ) throws EpanetException { int errcode = epanet.ENsetnodevalue(index, linkParameter.getCode(), value); checkError(errcode); }
[ "public", "void", "ENsetlinkvalue", "(", "int", "index", ",", "LinkParameters", "linkParameter", ",", "float", "value", ")", "throws", "EpanetException", "{", "int", "errcode", "=", "epanet", ".", "ENsetnodevalue", "(", "index", ",", "linkParameter", ".", "getCode", "(", ")", ",", "value", ")", ";", "checkError", "(", "errcode", ")", ";", "}" ]
Sets the value of a parameter for a specific link. @param index node index. @param paramcode parameter code. @param value parameter value. @throws EpanetException
[ "Sets", "the", "value", "of", "a", "parameter", "for", "a", "specific", "link", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L622-L625
137,659
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENaddpattern
public void ENaddpattern( String id ) throws EpanetException { int errcode = epanet.ENaddpattern(id); checkError(errcode); }
java
public void ENaddpattern( String id ) throws EpanetException { int errcode = epanet.ENaddpattern(id); checkError(errcode); }
[ "public", "void", "ENaddpattern", "(", "String", "id", ")", "throws", "EpanetException", "{", "int", "errcode", "=", "epanet", ".", "ENaddpattern", "(", "id", ")", ";", "checkError", "(", "errcode", ")", ";", "}" ]
Adds a new time pattern to the network. @param id ID label of pattern. @throws EpanetException
[ "Adds", "a", "new", "time", "pattern", "to", "the", "network", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L633-L636
137,660
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENsettimeparam
public void ENsettimeparam( TimeParameterCodes code, Long timevalue ) throws EpanetException { int errcode = epanet.ENsettimeparam(code.getCode(), timevalue); checkError(errcode); }
java
public void ENsettimeparam( TimeParameterCodes code, Long timevalue ) throws EpanetException { int errcode = epanet.ENsettimeparam(code.getCode(), timevalue); checkError(errcode); }
[ "public", "void", "ENsettimeparam", "(", "TimeParameterCodes", "code", ",", "Long", "timevalue", ")", "throws", "EpanetException", "{", "int", "errcode", "=", "epanet", ".", "ENsettimeparam", "(", "code", ".", "getCode", "(", ")", ",", "timevalue", ")", ";", "checkError", "(", "errcode", ")", ";", "}" ]
Sets the value of a time parameter. @param paramcode the {@link TimeParameterCodes}. @param timevalue value of time parameter in seconds. @throws EpanetException
[ "Sets", "the", "value", "of", "a", "time", "parameter", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L657-L660
137,661
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java
EpanetWrapper.ENsetoption
public void ENsetoption( OptionParameterCodes optionCode, float value ) throws EpanetException { int errcode = epanet.ENsetoption(optionCode.getCode(), value); checkError(errcode); }
java
public void ENsetoption( OptionParameterCodes optionCode, float value ) throws EpanetException { int errcode = epanet.ENsetoption(optionCode.getCode(), value); checkError(errcode); }
[ "public", "void", "ENsetoption", "(", "OptionParameterCodes", "optionCode", ",", "float", "value", ")", "throws", "EpanetException", "{", "int", "errcode", "=", "epanet", ".", "ENsetoption", "(", "optionCode", ".", "getCode", "(", ")", ",", "value", ")", ";", "checkError", "(", "errcode", ")", ";", "}" ]
Sets the value of a particular analysis option. @param optionCode the {@link OptionParameterCodes}. @param value the option value. @throws EpanetException
[ "Sets", "the", "value", "of", "a", "particular", "analysis", "option", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/core/EpanetWrapper.java#L669-L672
137,662
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/validation/ValidationException.java
ValidationException.error
public static ValidationException error(String messageKey, Object... params) { return new ValidationException( ValidationMessage.error(messageKey, params)); }
java
public static ValidationException error(String messageKey, Object... params) { return new ValidationException( ValidationMessage.error(messageKey, params)); }
[ "public", "static", "ValidationException", "error", "(", "String", "messageKey", ",", "Object", "...", "params", ")", "{", "return", "new", "ValidationException", "(", "ValidationMessage", ".", "error", "(", "messageKey", ",", "params", ")", ")", ";", "}" ]
Creates a ValidationException which contains a ValidationMessage error. @param messageKey a message key @param params message parameters @return a validation exception with a ValidationMessage error
[ "Creates", "a", "ValidationException", "which", "contains", "a", "ValidationMessage", "error", "." ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/ValidationException.java#L50-L54
137,663
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/validation/ValidationException.java
ValidationException.warning
public static ValidationException warning(String messageKey, Object... params) { return new ValidationException( ValidationMessage.warning(messageKey, params)); }
java
public static ValidationException warning(String messageKey, Object... params) { return new ValidationException( ValidationMessage.warning(messageKey, params)); }
[ "public", "static", "ValidationException", "warning", "(", "String", "messageKey", ",", "Object", "...", "params", ")", "{", "return", "new", "ValidationException", "(", "ValidationMessage", ".", "warning", "(", "messageKey", ",", "params", ")", ")", ";", "}" ]
Creates a ValidationException which contains a ValidationMessage warning. @param messageKey a message key @param params message parameters @return a validation exception with a ValidationMessage warning
[ "Creates", "a", "ValidationException", "which", "contains", "a", "ValidationMessage", "warning", "." ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/ValidationException.java#L63-L67
137,664
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/validation/ValidationException.java
ValidationException.info
public static ValidationException info(String messageKey, Object... params) { return new ValidationException( ValidationMessage.info(messageKey, params)); }
java
public static ValidationException info(String messageKey, Object... params) { return new ValidationException( ValidationMessage.info(messageKey, params)); }
[ "public", "static", "ValidationException", "info", "(", "String", "messageKey", ",", "Object", "...", "params", ")", "{", "return", "new", "ValidationException", "(", "ValidationMessage", ".", "info", "(", "messageKey", ",", "params", ")", ")", ";", "}" ]
Creates a ValidationException which contains a ValidationMessage info. @param messageKey a message key @param params message parameters @return a validation exception with a ValidationMessage info
[ "Creates", "a", "ValidationException", "which", "contains", "a", "ValidationMessage", "info", "." ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/ValidationException.java#L76-L80
137,665
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/flatfile/writer/FeatureWriter.java
FeatureWriter.writeFeatureLocation
protected void writeFeatureLocation(Writer writer) throws IOException { new FeatureLocationWriter(entry, feature, wrapType, featureHeader, qualifierHeader).write(writer); }
java
protected void writeFeatureLocation(Writer writer) throws IOException { new FeatureLocationWriter(entry, feature, wrapType, featureHeader, qualifierHeader).write(writer); }
[ "protected", "void", "writeFeatureLocation", "(", "Writer", "writer", ")", "throws", "IOException", "{", "new", "FeatureLocationWriter", "(", "entry", ",", "feature", ",", "wrapType", ",", "featureHeader", ",", "qualifierHeader", ")", ".", "write", "(", "writer", ")", ";", "}" ]
overridden in HTMLFeatureWriter @param writer @throws IOException
[ "overridden", "in", "HTMLFeatureWriter" ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/writer/FeatureWriter.java#L64-L67
137,666
enasequence/sequencetools
src/main/java/uk/ac/ebi/ena/xml/SimpleXmlWriter.java
SimpleXmlWriter.beginElement
public void beginElement(String elementName) throws IOException { addElementName(elementName); indent(); writer.write("<"); writer.write(elementName); }
java
public void beginElement(String elementName) throws IOException { addElementName(elementName); indent(); writer.write("<"); writer.write(elementName); }
[ "public", "void", "beginElement", "(", "String", "elementName", ")", "throws", "IOException", "{", "addElementName", "(", "elementName", ")", ";", "indent", "(", ")", ";", "writer", ".", "write", "(", "\"<\"", ")", ";", "writer", ".", "write", "(", "elementName", ")", ";", "}" ]
Writes '<elementName'.
[ "Writes", "<elementName", "." ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/ena/xml/SimpleXmlWriter.java#L198-L203
137,667
enasequence/sequencetools
src/main/java/uk/ac/ebi/ena/xml/SimpleXmlWriter.java
SimpleXmlWriter.openElement
public void openElement(String elementName) throws IOException { assert(elementNames.size() > 0); assert(elementNames.get(elementNames.size() - 1).equals(elementName)); writer.write(">"); if(indent || noTextElement) { writer.write("\n"); } }
java
public void openElement(String elementName) throws IOException { assert(elementNames.size() > 0); assert(elementNames.get(elementNames.size() - 1).equals(elementName)); writer.write(">"); if(indent || noTextElement) { writer.write("\n"); } }
[ "public", "void", "openElement", "(", "String", "elementName", ")", "throws", "IOException", "{", "assert", "(", "elementNames", ".", "size", "(", ")", ">", "0", ")", ";", "assert", "(", "elementNames", ".", "get", "(", "elementNames", ".", "size", "(", ")", "-", "1", ")", ".", "equals", "(", "elementName", ")", ")", ";", "writer", ".", "write", "(", "\">\"", ")", ";", "if", "(", "indent", "||", "noTextElement", ")", "{", "writer", ".", "write", "(", "\"\\n\"", ")", ";", "}", "}" ]
Writes '>\n'.
[ "Writes", ">", "\\", "n", "." ]
4127f5e1a17540239f5810136153fbd6737fa262
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/ena/xml/SimpleXmlWriter.java#L208-L215
137,668
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/FieldAccess.java
FieldAccess.setData
@Override public void setData(FieldContent data) { // allow setting in field once only. // cannot have multiple sources for one @In ! if (this.data != null) { throw new ComponentException("Attempt to set @In field twice: " + comp + "." + field.getName()); } this.data = data; }
java
@Override public void setData(FieldContent data) { // allow setting in field once only. // cannot have multiple sources for one @In ! if (this.data != null) { throw new ComponentException("Attempt to set @In field twice: " + comp + "." + field.getName()); } this.data = data; }
[ "@", "Override", "public", "void", "setData", "(", "FieldContent", "data", ")", "{", "// allow setting in field once only.", "// cannot have multiple sources for one @In !", "if", "(", "this", ".", "data", "!=", "null", ")", "{", "throw", "new", "ComponentException", "(", "\"Attempt to set @In field twice: \"", "+", "comp", "+", "\".\"", "+", "field", ".", "getName", "(", ")", ")", ";", "}", "this", ".", "data", "=", "data", ";", "}" ]
called in 'in' access
[ "called", "in", "in", "access" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/FieldAccess.java#L42-L50
137,669
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/ngmf/util/cosu/MH.java
Transition.qobs
double qobs(int dummy, double[] xt) { int x = (int) (xt[0]); double p = Math.random(); double[] distr = accumP[x]; int i, left = 0, right = distr.length - 1; // Find and return least i s.t. p <= distr[i] while (left <= right) { // Here distr[left-1] <= p <= distr[right+1] i = (left + right) / 2; if (p < distr[i]) { right = i - 1; } else if (distr[i] < p) { left = i + 1; } else { return i; } } // Now p <= distr[left] return left; }
java
double qobs(int dummy, double[] xt) { int x = (int) (xt[0]); double p = Math.random(); double[] distr = accumP[x]; int i, left = 0, right = distr.length - 1; // Find and return least i s.t. p <= distr[i] while (left <= right) { // Here distr[left-1] <= p <= distr[right+1] i = (left + right) / 2; if (p < distr[i]) { right = i - 1; } else if (distr[i] < p) { left = i + 1; } else { return i; } } // Now p <= distr[left] return left; }
[ "double", "qobs", "(", "int", "dummy", ",", "double", "[", "]", "xt", ")", "{", "int", "x", "=", "(", "int", ")", "(", "xt", "[", "0", "]", ")", ";", "double", "p", "=", "Math", ".", "random", "(", ")", ";", "double", "[", "]", "distr", "=", "accumP", "[", "x", "]", ";", "int", "i", ",", "left", "=", "0", ",", "right", "=", "distr", ".", "length", "-", "1", ";", "// Find and return least i s.t. p <= distr[i]", "while", "(", "left", "<=", "right", ")", "{", "// Here distr[left-1] <= p <= distr[right+1]", "i", "=", "(", "left", "+", "right", ")", "/", "2", ";", "if", "(", "p", "<", "distr", "[", "i", "]", ")", "{", "right", "=", "i", "-", "1", ";", "}", "else", "if", "(", "distr", "[", "i", "]", "<", "p", ")", "{", "left", "=", "i", "+", "1", ";", "}", "else", "{", "return", "i", ";", "}", "}", "// Now p <= distr[left]", "return", "left", ";", "}" ]
An efficient version of qobs, using binary search in accumP
[ "An", "efficient", "version", "of", "qobs", "using", "binary", "search", "in", "accumP" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/cosu/MH.java#L426-L445
137,670
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/spatialite/SpatialiteWKBReader.java
SpatialiteWKBReader.hexToBytes
public static byte[] hexToBytes( String hex ) { int byteLen = hex.length() / 2; byte[] bytes = new byte[byteLen]; for( int i = 0; i < hex.length() / 2; i++ ) { int i2 = 2 * i; if (i2 + 1 > hex.length()) throw new IllegalArgumentException("Hex string has odd length"); int nib1 = hexToInt(hex.charAt(i2)); int nib0 = hexToInt(hex.charAt(i2 + 1)); byte b = (byte) ((nib1 << 4) + (byte) nib0); bytes[i] = b; } return bytes; }
java
public static byte[] hexToBytes( String hex ) { int byteLen = hex.length() / 2; byte[] bytes = new byte[byteLen]; for( int i = 0; i < hex.length() / 2; i++ ) { int i2 = 2 * i; if (i2 + 1 > hex.length()) throw new IllegalArgumentException("Hex string has odd length"); int nib1 = hexToInt(hex.charAt(i2)); int nib0 = hexToInt(hex.charAt(i2 + 1)); byte b = (byte) ((nib1 << 4) + (byte) nib0); bytes[i] = b; } return bytes; }
[ "public", "static", "byte", "[", "]", "hexToBytes", "(", "String", "hex", ")", "{", "int", "byteLen", "=", "hex", ".", "length", "(", ")", "/", "2", ";", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "byteLen", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "hex", ".", "length", "(", ")", "/", "2", ";", "i", "++", ")", "{", "int", "i2", "=", "2", "*", "i", ";", "if", "(", "i2", "+", "1", ">", "hex", ".", "length", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Hex string has odd length\"", ")", ";", "int", "nib1", "=", "hexToInt", "(", "hex", ".", "charAt", "(", "i2", ")", ")", ";", "int", "nib0", "=", "hexToInt", "(", "hex", ".", "charAt", "(", "i2", "+", "1", ")", ")", ";", "byte", "b", "=", "(", "byte", ")", "(", "(", "nib1", "<<", "4", ")", "+", "(", "byte", ")", "nib0", ")", ";", "bytes", "[", "i", "]", "=", "b", ";", "}", "return", "bytes", ";", "}" ]
Converts a hexadecimal string to a byte array. The hexadecimal digit symbols are case-insensitive. @param hex a string containing hex digits @return an array of bytes with the value of the hex string
[ "Converts", "a", "hexadecimal", "string", "to", "a", "byte", "array", ".", "The", "hexadecimal", "digit", "symbols", "are", "case", "-", "insensitive", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/spatialite/SpatialiteWKBReader.java#L76-L91
137,671
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/spatialite/SpatialiteWKBReader.java
SpatialiteWKBReader.setSRID
private Geometry setSRID( Geometry g, int SRID ) { if (SRID != 0) g.setSRID(SRID); return g; }
java
private Geometry setSRID( Geometry g, int SRID ) { if (SRID != 0) g.setSRID(SRID); return g; }
[ "private", "Geometry", "setSRID", "(", "Geometry", "g", ",", "int", "SRID", ")", "{", "if", "(", "SRID", "!=", "0", ")", "g", ".", "setSRID", "(", "SRID", ")", ";", "return", "g", ";", "}" ]
Sets the SRID, if it was specified in the WKB @param g the geometry to update @return the geometry with an updated SRID value, if required
[ "Sets", "the", "SRID", "if", "it", "was", "specified", "in", "the", "WKB" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/spatialite/SpatialiteWKBReader.java#L298-L302
137,672
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/spatialite/SpatialiteWKBReader.java
SpatialiteWKBReader.readCoordinate
private void readCoordinate() throws IOException { for( int i = 0; i < inputDimension; i++ ) { if (i <= 1) { ordValues[i] = precisionModel.makePrecise(dis.readDouble()); } else { ordValues[i] = dis.readDouble(); } } }
java
private void readCoordinate() throws IOException { for( int i = 0; i < inputDimension; i++ ) { if (i <= 1) { ordValues[i] = precisionModel.makePrecise(dis.readDouble()); } else { ordValues[i] = dis.readDouble(); } } }
[ "private", "void", "readCoordinate", "(", ")", "throws", "IOException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputDimension", ";", "i", "++", ")", "{", "if", "(", "i", "<=", "1", ")", "{", "ordValues", "[", "i", "]", "=", "precisionModel", ".", "makePrecise", "(", "dis", ".", "readDouble", "(", ")", ")", ";", "}", "else", "{", "ordValues", "[", "i", "]", "=", "dis", ".", "readDouble", "(", ")", ";", "}", "}", "}" ]
Reads a coordinate value with the specified dimensionality. Makes the X and Y ordinates precise according to the precision model in use.
[ "Reads", "a", "coordinate", "value", "with", "the", "specified", "dimensionality", ".", "Makes", "the", "X", "and", "Y", "ordinates", "precise", "according", "to", "the", "precision", "model", "in", "use", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/spatialite/SpatialiteWKBReader.java#L416-L425
137,673
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/adige/core/HillSlope.java
HillSlope.connectElements
public static void connectElements( List<IHillSlope> elements ) { Collections.sort(elements, elements.get(0)); for( int i = 0; i < elements.size(); i++ ) { IHillSlope elem = elements.get(i); for( int j = i + 1; j < elements.size(); j++ ) { IHillSlope tmp = elements.get(j); elem.addConnectedDownstreamElementWithCheck(tmp); } } }
java
public static void connectElements( List<IHillSlope> elements ) { Collections.sort(elements, elements.get(0)); for( int i = 0; i < elements.size(); i++ ) { IHillSlope elem = elements.get(i); for( int j = i + 1; j < elements.size(); j++ ) { IHillSlope tmp = elements.get(j); elem.addConnectedDownstreamElementWithCheck(tmp); } } }
[ "public", "static", "void", "connectElements", "(", "List", "<", "IHillSlope", ">", "elements", ")", "{", "Collections", ".", "sort", "(", "elements", ",", "elements", ".", "get", "(", "0", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elements", ".", "size", "(", ")", ";", "i", "++", ")", "{", "IHillSlope", "elem", "=", "elements", ".", "get", "(", "i", ")", ";", "for", "(", "int", "j", "=", "i", "+", "1", ";", "j", "<", "elements", ".", "size", "(", ")", ";", "j", "++", ")", "{", "IHillSlope", "tmp", "=", "elements", ".", "get", "(", "j", ")", ";", "elem", ".", "addConnectedDownstreamElementWithCheck", "(", "tmp", ")", ";", "}", "}", "}" ]
Connect the various elements in a chain of tributary basins and nets @param elements
[ "Connect", "the", "various", "elements", "in", "a", "chain", "of", "tributary", "basins", "and", "nets" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/adige/core/HillSlope.java#L374-L384
137,674
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/HexUtil.java
HexUtil.bytesToHex
public static final String bytesToHex(byte[] bs, int off, int length) { StringBuffer sb = new StringBuffer(length * 2); bytesToHexAppend(bs, off, length, sb); return sb.toString(); }
java
public static final String bytesToHex(byte[] bs, int off, int length) { StringBuffer sb = new StringBuffer(length * 2); bytesToHexAppend(bs, off, length, sb); return sb.toString(); }
[ "public", "static", "final", "String", "bytesToHex", "(", "byte", "[", "]", "bs", ",", "int", "off", ",", "int", "length", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "length", "*", "2", ")", ";", "bytesToHexAppend", "(", "bs", ",", "off", ",", "length", ",", "sb", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Converts a byte array into a string of upper case hex chars. @param bs A byte array @param off The index of the first byte to read @param length The number of bytes to read. @return the string of hex chars.
[ "Converts", "a", "byte", "array", "into", "a", "string", "of", "upper", "case", "hex", "chars", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/HexUtil.java#L47-L51
137,675
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ArcFromBulgeCalculator.java
ArcFromBulgeCalculator.getPoints
public Vector getPoints(double inc) { Vector arc = new Vector(); double angulo; int iempieza = (int) empieza + 1; int iacaba = (int) acaba; if (empieza <= acaba) { addNode(arc, empieza); for (angulo = iempieza; angulo <= iacaba; angulo += inc) { addNode(arc, angulo); } addNode(arc, acaba); } else { addNode(arc, empieza); for (angulo = iempieza ; angulo <= 360; angulo += inc) { addNode(arc, angulo); } for (angulo = 1; angulo <= iacaba; angulo += inc) { addNode(arc, angulo); } addNode(arc, angulo); } Point2D aux = (Point2D)arc.get(arc.size()-1); double aux1 = Math.abs(aux.getX()-coord2.getX()); double aux2 = Math.abs(aux.getY()-coord2.getY()); return arc; }
java
public Vector getPoints(double inc) { Vector arc = new Vector(); double angulo; int iempieza = (int) empieza + 1; int iacaba = (int) acaba; if (empieza <= acaba) { addNode(arc, empieza); for (angulo = iempieza; angulo <= iacaba; angulo += inc) { addNode(arc, angulo); } addNode(arc, acaba); } else { addNode(arc, empieza); for (angulo = iempieza ; angulo <= 360; angulo += inc) { addNode(arc, angulo); } for (angulo = 1; angulo <= iacaba; angulo += inc) { addNode(arc, angulo); } addNode(arc, angulo); } Point2D aux = (Point2D)arc.get(arc.size()-1); double aux1 = Math.abs(aux.getX()-coord2.getX()); double aux2 = Math.abs(aux.getY()-coord2.getY()); return arc; }
[ "public", "Vector", "getPoints", "(", "double", "inc", ")", "{", "Vector", "arc", "=", "new", "Vector", "(", ")", ";", "double", "angulo", ";", "int", "iempieza", "=", "(", "int", ")", "empieza", "+", "1", ";", "int", "iacaba", "=", "(", "int", ")", "acaba", ";", "if", "(", "empieza", "<=", "acaba", ")", "{", "addNode", "(", "arc", ",", "empieza", ")", ";", "for", "(", "angulo", "=", "iempieza", ";", "angulo", "<=", "iacaba", ";", "angulo", "+=", "inc", ")", "{", "addNode", "(", "arc", ",", "angulo", ")", ";", "}", "addNode", "(", "arc", ",", "acaba", ")", ";", "}", "else", "{", "addNode", "(", "arc", ",", "empieza", ")", ";", "for", "(", "angulo", "=", "iempieza", ";", "angulo", "<=", "360", ";", "angulo", "+=", "inc", ")", "{", "addNode", "(", "arc", ",", "angulo", ")", ";", "}", "for", "(", "angulo", "=", "1", ";", "angulo", "<=", "iacaba", ";", "angulo", "+=", "inc", ")", "{", "addNode", "(", "arc", ",", "angulo", ")", ";", "}", "addNode", "(", "arc", ",", "angulo", ")", ";", "}", "Point2D", "aux", "=", "(", "Point2D", ")", "arc", ".", "get", "(", "arc", ".", "size", "(", ")", "-", "1", ")", ";", "double", "aux1", "=", "Math", ".", "abs", "(", "aux", ".", "getX", "(", ")", "-", "coord2", ".", "getX", "(", ")", ")", ";", "double", "aux2", "=", "Math", ".", "abs", "(", "aux", ".", "getY", "(", ")", "-", "coord2", ".", "getY", "(", ")", ")", ";", "return", "arc", ";", "}" ]
This method calculates an arc in a Gis geometry model. This arc is represented in this model by a Vector of Point2D. The distance between points in the arc is given as an argument @param inc Distance between points in the arc @return Vector Vector with the set of Point2D that represents the arc
[ "This", "method", "calculates", "an", "arc", "in", "a", "Gis", "geometry", "model", ".", "This", "arc", "is", "represented", "in", "this", "model", "by", "a", "Vector", "of", "Point2D", ".", "The", "distance", "between", "points", "in", "the", "arc", "is", "given", "as", "an", "argument" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ArcFromBulgeCalculator.java#L90-L115
137,676
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ArcFromBulgeCalculator.java
ArcFromBulgeCalculator.getCentralPoint
public Vector getCentralPoint() { Vector arc = new Vector(); if (empieza <= acaba) { addNode(arc, (empieza+acaba)/2.0); } else { addNode(arc, empieza); double alfa = 360-empieza; double beta = acaba; double an = alfa + beta; double mid = an/2.0; if (mid<=alfa) { addNode(arc, empieza+mid); } else { addNode(arc, mid-alfa); } } return arc; }
java
public Vector getCentralPoint() { Vector arc = new Vector(); if (empieza <= acaba) { addNode(arc, (empieza+acaba)/2.0); } else { addNode(arc, empieza); double alfa = 360-empieza; double beta = acaba; double an = alfa + beta; double mid = an/2.0; if (mid<=alfa) { addNode(arc, empieza+mid); } else { addNode(arc, mid-alfa); } } return arc; }
[ "public", "Vector", "getCentralPoint", "(", ")", "{", "Vector", "arc", "=", "new", "Vector", "(", ")", ";", "if", "(", "empieza", "<=", "acaba", ")", "{", "addNode", "(", "arc", ",", "(", "empieza", "+", "acaba", ")", "/", "2.0", ")", ";", "}", "else", "{", "addNode", "(", "arc", ",", "empieza", ")", ";", "double", "alfa", "=", "360", "-", "empieza", ";", "double", "beta", "=", "acaba", ";", "double", "an", "=", "alfa", "+", "beta", ";", "double", "mid", "=", "an", "/", "2.0", ";", "if", "(", "mid", "<=", "alfa", ")", "{", "addNode", "(", "arc", ",", "empieza", "+", "mid", ")", ";", "}", "else", "{", "addNode", "(", "arc", ",", "mid", "-", "alfa", ")", ";", "}", "}", "return", "arc", ";", "}" ]
Method that allows to obtain a set of points located in the central zone of this arc object
[ "Method", "that", "allows", "to", "obtain", "a", "set", "of", "points", "located", "in", "the", "central", "zone", "of", "this", "arc", "object" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ArcFromBulgeCalculator.java#L121-L138
137,677
TheHortonMachine/hortonmachine
apps/src/main/java/gov/nasa/worldwindx/hm/FileStoreDataSet.java
FileStoreDataSet.getDataSets
public static List<FileStoreDataSet> getDataSets(File cacheRoot) { if (cacheRoot == null) { String message = Logging.getMessage("nullValue.FileStorePathIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } ArrayList<FileStoreDataSet> datasets = new ArrayList<FileStoreDataSet>(); File[] cacheDirs = FileStoreDataSet.listDirs(cacheRoot); for (File cacheDir : cacheDirs) { if (cacheDir.getName().equals("license")) continue; File[] subDirs = FileStoreDataSet.listDirs(cacheDir); if (subDirs.length == 0) { datasets.add(new FileStoreDataSet(cacheDir, cacheRoot.getPath())); } else { // If the directory should be treated as a single dataset, add just one entry to the list. if (isSingleDataSet(subDirs)) { datasets.add(new FileStoreDataSet(cacheDir, cacheRoot.getPath())); } // Otherwise add each subdirectory as a separate data set. else { for (File sd : subDirs) { FileStoreDataSet ds = new FileStoreDataSet(sd, cacheRoot.getPath()); datasets.add(ds); } } } } return datasets; }
java
public static List<FileStoreDataSet> getDataSets(File cacheRoot) { if (cacheRoot == null) { String message = Logging.getMessage("nullValue.FileStorePathIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } ArrayList<FileStoreDataSet> datasets = new ArrayList<FileStoreDataSet>(); File[] cacheDirs = FileStoreDataSet.listDirs(cacheRoot); for (File cacheDir : cacheDirs) { if (cacheDir.getName().equals("license")) continue; File[] subDirs = FileStoreDataSet.listDirs(cacheDir); if (subDirs.length == 0) { datasets.add(new FileStoreDataSet(cacheDir, cacheRoot.getPath())); } else { // If the directory should be treated as a single dataset, add just one entry to the list. if (isSingleDataSet(subDirs)) { datasets.add(new FileStoreDataSet(cacheDir, cacheRoot.getPath())); } // Otherwise add each subdirectory as a separate data set. else { for (File sd : subDirs) { FileStoreDataSet ds = new FileStoreDataSet(sd, cacheRoot.getPath()); datasets.add(ds); } } } } return datasets; }
[ "public", "static", "List", "<", "FileStoreDataSet", ">", "getDataSets", "(", "File", "cacheRoot", ")", "{", "if", "(", "cacheRoot", "==", "null", ")", "{", "String", "message", "=", "Logging", ".", "getMessage", "(", "\"nullValue.FileStorePathIsNull\"", ")", ";", "Logging", ".", "logger", "(", ")", ".", "severe", "(", "message", ")", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "ArrayList", "<", "FileStoreDataSet", ">", "datasets", "=", "new", "ArrayList", "<", "FileStoreDataSet", ">", "(", ")", ";", "File", "[", "]", "cacheDirs", "=", "FileStoreDataSet", ".", "listDirs", "(", "cacheRoot", ")", ";", "for", "(", "File", "cacheDir", ":", "cacheDirs", ")", "{", "if", "(", "cacheDir", ".", "getName", "(", ")", ".", "equals", "(", "\"license\"", ")", ")", "continue", ";", "File", "[", "]", "subDirs", "=", "FileStoreDataSet", ".", "listDirs", "(", "cacheDir", ")", ";", "if", "(", "subDirs", ".", "length", "==", "0", ")", "{", "datasets", ".", "add", "(", "new", "FileStoreDataSet", "(", "cacheDir", ",", "cacheRoot", ".", "getPath", "(", ")", ")", ")", ";", "}", "else", "{", "// If the directory should be treated as a single dataset, add just one entry to the list.", "if", "(", "isSingleDataSet", "(", "subDirs", ")", ")", "{", "datasets", ".", "add", "(", "new", "FileStoreDataSet", "(", "cacheDir", ",", "cacheRoot", ".", "getPath", "(", ")", ")", ")", ";", "}", "// Otherwise add each subdirectory as a separate data set.", "else", "{", "for", "(", "File", "sd", ":", "subDirs", ")", "{", "FileStoreDataSet", "ds", "=", "new", "FileStoreDataSet", "(", "sd", ",", "cacheRoot", ".", "getPath", "(", ")", ")", ";", "datasets", ".", "add", "(", "ds", ")", ";", "}", "}", "}", "}", "return", "datasets", ";", "}" ]
Find all of the data set directories in a cache root. @param cacheRoot Cache root to search. @return List of data sets in the specified cache.
[ "Find", "all", "of", "the", "data", "set", "directories", "in", "a", "cache", "root", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/gov/nasa/worldwindx/hm/FileStoreDataSet.java#L310-L352
137,678
TheHortonMachine/hortonmachine
apps/src/main/java/gov/nasa/worldwindx/hm/FileStoreDataSet.java
FileStoreDataSet.listDirs
protected static File[] listDirs(File parent) { return parent.listFiles(new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } }); }
java
protected static File[] listDirs(File parent) { return parent.listFiles(new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } }); }
[ "protected", "static", "File", "[", "]", "listDirs", "(", "File", "parent", ")", "{", "return", "parent", ".", "listFiles", "(", "new", "FileFilter", "(", ")", "{", "public", "boolean", "accept", "(", "File", "file", ")", "{", "return", "file", ".", "isDirectory", "(", ")", ";", "}", "}", ")", ";", "}" ]
List all of the sub-directories in a parent directory. @param parent Parent directory to search. @return All sub-directories under {@code parent}.
[ "List", "all", "of", "the", "sub", "-", "directories", "in", "a", "parent", "directory", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/gov/nasa/worldwindx/hm/FileStoreDataSet.java#L361-L370
137,679
TheHortonMachine/hortonmachine
apps/src/main/java/gov/nasa/worldwindx/hm/FileStoreDataSet.java
FileStoreDataSet.isNumeric
protected static boolean isNumeric(String s) { for (char c : s.toCharArray()) { if (!Character.isDigit(c)) return false; } return true; }
java
protected static boolean isNumeric(String s) { for (char c : s.toCharArray()) { if (!Character.isDigit(c)) return false; } return true; }
[ "protected", "static", "boolean", "isNumeric", "(", "String", "s", ")", "{", "for", "(", "char", "c", ":", "s", ".", "toCharArray", "(", ")", ")", "{", "if", "(", "!", "Character", ".", "isDigit", "(", "c", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}" ]
Determines if a string contains only digits. @param s String to test. @return {@code true} if {@code s} contains only digits.
[ "Determines", "if", "a", "string", "contains", "only", "digits", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/gov/nasa/worldwindx/hm/FileStoreDataSet.java#L402-L410
137,680
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/utils/WikiPageModulesOverviewCreator.java
WikiPageModulesOverviewCreator.createModulesOverview
public static void createModulesOverview() { Map<String, List<ClassField>> hmModules = HortonMachine.getInstance().moduleName2Fields; Map<String, List<ClassField>> jggModules = JGrassGears.getInstance().moduleName2Fields; Map<String, Class< ? >> hmModulesClasses = HortonMachine.getInstance().moduleName2Class; Map<String, Class< ? >> jggModulesClasses = JGrassGears.getInstance().moduleName2Class; Set<String> hmNames = hmModules.keySet(); String[] hmNamesArray = (String[]) hmNames.toArray(new String[hmNames.size()]); Set<String> jggNames = jggModules.keySet(); String[] jggNamesArray = (String[]) jggNames.toArray(new String[jggNames.size()]); Arrays.sort(hmNamesArray); Arrays.sort(jggNamesArray); StringBuilder sb = new StringBuilder(); sb.append("#summary An overview of the modules implemented in the HortonMachine\n\n"); sb.append("<wiki:toc max_depth=\"4\" />\n\n"); sb.append("= HortonMachine Modules Overview =\n"); sb.append("== !HortonMachine Modules ==\n"); String status = "CERTIFIED"; sb.append("=== Release ready ==\n"); dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status); status = "TESTED"; sb.append("=== Tested but not for upcoming release ==\n"); dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status); status = "DRAFT"; sb.append("=== Module that are not passing the QA rules yet ==\n"); dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status); sb.append("\n<BR/><BR/><BR/>\n\n"); sb.append("== Gears Modules ==\n"); status = "CERTIFIED"; sb.append("=== Release ready ==\n"); dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status); status = "TESTED"; sb.append("=== Tested but not for upcoming release ==\n"); dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status); status = "DRAFT"; sb.append("=== Module that are not passing the QA rules yet ==\n"); dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status); System.out.println(sb.toString()); }
java
public static void createModulesOverview() { Map<String, List<ClassField>> hmModules = HortonMachine.getInstance().moduleName2Fields; Map<String, List<ClassField>> jggModules = JGrassGears.getInstance().moduleName2Fields; Map<String, Class< ? >> hmModulesClasses = HortonMachine.getInstance().moduleName2Class; Map<String, Class< ? >> jggModulesClasses = JGrassGears.getInstance().moduleName2Class; Set<String> hmNames = hmModules.keySet(); String[] hmNamesArray = (String[]) hmNames.toArray(new String[hmNames.size()]); Set<String> jggNames = jggModules.keySet(); String[] jggNamesArray = (String[]) jggNames.toArray(new String[jggNames.size()]); Arrays.sort(hmNamesArray); Arrays.sort(jggNamesArray); StringBuilder sb = new StringBuilder(); sb.append("#summary An overview of the modules implemented in the HortonMachine\n\n"); sb.append("<wiki:toc max_depth=\"4\" />\n\n"); sb.append("= HortonMachine Modules Overview =\n"); sb.append("== !HortonMachine Modules ==\n"); String status = "CERTIFIED"; sb.append("=== Release ready ==\n"); dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status); status = "TESTED"; sb.append("=== Tested but not for upcoming release ==\n"); dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status); status = "DRAFT"; sb.append("=== Module that are not passing the QA rules yet ==\n"); dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status); sb.append("\n<BR/><BR/><BR/>\n\n"); sb.append("== Gears Modules ==\n"); status = "CERTIFIED"; sb.append("=== Release ready ==\n"); dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status); status = "TESTED"; sb.append("=== Tested but not for upcoming release ==\n"); dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status); status = "DRAFT"; sb.append("=== Module that are not passing the QA rules yet ==\n"); dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status); System.out.println(sb.toString()); }
[ "public", "static", "void", "createModulesOverview", "(", ")", "{", "Map", "<", "String", ",", "List", "<", "ClassField", ">", ">", "hmModules", "=", "HortonMachine", ".", "getInstance", "(", ")", ".", "moduleName2Fields", ";", "Map", "<", "String", ",", "List", "<", "ClassField", ">", ">", "jggModules", "=", "JGrassGears", ".", "getInstance", "(", ")", ".", "moduleName2Fields", ";", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "hmModulesClasses", "=", "HortonMachine", ".", "getInstance", "(", ")", ".", "moduleName2Class", ";", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "jggModulesClasses", "=", "JGrassGears", ".", "getInstance", "(", ")", ".", "moduleName2Class", ";", "Set", "<", "String", ">", "hmNames", "=", "hmModules", ".", "keySet", "(", ")", ";", "String", "[", "]", "hmNamesArray", "=", "(", "String", "[", "]", ")", "hmNames", ".", "toArray", "(", "new", "String", "[", "hmNames", ".", "size", "(", ")", "]", ")", ";", "Set", "<", "String", ">", "jggNames", "=", "jggModules", ".", "keySet", "(", ")", ";", "String", "[", "]", "jggNamesArray", "=", "(", "String", "[", "]", ")", "jggNames", ".", "toArray", "(", "new", "String", "[", "jggNames", ".", "size", "(", ")", "]", ")", ";", "Arrays", ".", "sort", "(", "hmNamesArray", ")", ";", "Arrays", ".", "sort", "(", "jggNamesArray", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"#summary An overview of the modules implemented in the HortonMachine\\n\\n\"", ")", ";", "sb", ".", "append", "(", "\"<wiki:toc max_depth=\\\"4\\\" />\\n\\n\"", ")", ";", "sb", ".", "append", "(", "\"= HortonMachine Modules Overview =\\n\"", ")", ";", "sb", ".", "append", "(", "\"== !HortonMachine Modules ==\\n\"", ")", ";", "String", "status", "=", "\"CERTIFIED\"", ";", "sb", ".", "append", "(", "\"=== Release ready ==\\n\"", ")", ";", "dumpModules", "(", "hmModules", ",", "hmModulesClasses", ",", "hmNamesArray", ",", "sb", ",", "status", ")", ";", "status", "=", "\"TESTED\"", ";", "sb", ".", "append", "(", "\"=== Tested but not for upcoming release ==\\n\"", ")", ";", "dumpModules", "(", "hmModules", ",", "hmModulesClasses", ",", "hmNamesArray", ",", "sb", ",", "status", ")", ";", "status", "=", "\"DRAFT\"", ";", "sb", ".", "append", "(", "\"=== Module that are not passing the QA rules yet ==\\n\"", ")", ";", "dumpModules", "(", "hmModules", ",", "hmModulesClasses", ",", "hmNamesArray", ",", "sb", ",", "status", ")", ";", "sb", ".", "append", "(", "\"\\n<BR/><BR/><BR/>\\n\\n\"", ")", ";", "sb", ".", "append", "(", "\"== Gears Modules ==\\n\"", ")", ";", "status", "=", "\"CERTIFIED\"", ";", "sb", ".", "append", "(", "\"=== Release ready ==\\n\"", ")", ";", "dumpModules", "(", "jggModules", ",", "jggModulesClasses", ",", "jggNamesArray", ",", "sb", ",", "status", ")", ";", "status", "=", "\"TESTED\"", ";", "sb", ".", "append", "(", "\"=== Tested but not for upcoming release ==\\n\"", ")", ";", "dumpModules", "(", "jggModules", ",", "jggModulesClasses", ",", "jggNamesArray", ",", "sb", ",", "status", ")", ";", "status", "=", "\"DRAFT\"", ";", "sb", ".", "append", "(", "\"=== Module that are not passing the QA rules yet ==\\n\"", ")", ";", "dumpModules", "(", "jggModules", ",", "jggModulesClasses", ",", "jggNamesArray", ",", "sb", ",", "status", ")", ";", "System", ".", "out", ".", "println", "(", "sb", ".", "toString", "(", ")", ")", ";", "}" ]
Creates an overview of all the OMS modules for the wiki site.
[ "Creates", "an", "overview", "of", "all", "the", "OMS", "modules", "for", "the", "wiki", "site", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/utils/WikiPageModulesOverviewCreator.java#L41-L87
137,681
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/h2gis/H2GisServer.java
H2GisServer.startTcpServerMode
public static Server startTcpServerMode( String port, boolean doSSL, String tcpPassword, boolean ifExists, String baseDir ) throws SQLException { List<String> params = new ArrayList<>(); params.add("-tcpAllowOthers"); params.add("-tcpPort"); if (port == null) { port = "9123"; } params.add(port); if (doSSL) { params.add("-tcpSSL"); } if (tcpPassword != null) { params.add("-tcpPassword"); params.add(tcpPassword); } if (ifExists) { params.add("-ifExists"); } if (baseDir != null) { params.add("-baseDir"); params.add(baseDir); } Server server = Server.createTcpServer(params.toArray(new String[0])).start(); return server; }
java
public static Server startTcpServerMode( String port, boolean doSSL, String tcpPassword, boolean ifExists, String baseDir ) throws SQLException { List<String> params = new ArrayList<>(); params.add("-tcpAllowOthers"); params.add("-tcpPort"); if (port == null) { port = "9123"; } params.add(port); if (doSSL) { params.add("-tcpSSL"); } if (tcpPassword != null) { params.add("-tcpPassword"); params.add(tcpPassword); } if (ifExists) { params.add("-ifExists"); } if (baseDir != null) { params.add("-baseDir"); params.add(baseDir); } Server server = Server.createTcpServer(params.toArray(new String[0])).start(); return server; }
[ "public", "static", "Server", "startTcpServerMode", "(", "String", "port", ",", "boolean", "doSSL", ",", "String", "tcpPassword", ",", "boolean", "ifExists", ",", "String", "baseDir", ")", "throws", "SQLException", "{", "List", "<", "String", ">", "params", "=", "new", "ArrayList", "<>", "(", ")", ";", "params", ".", "add", "(", "\"-tcpAllowOthers\"", ")", ";", "params", ".", "add", "(", "\"-tcpPort\"", ")", ";", "if", "(", "port", "==", "null", ")", "{", "port", "=", "\"9123\"", ";", "}", "params", ".", "add", "(", "port", ")", ";", "if", "(", "doSSL", ")", "{", "params", ".", "add", "(", "\"-tcpSSL\"", ")", ";", "}", "if", "(", "tcpPassword", "!=", "null", ")", "{", "params", ".", "add", "(", "\"-tcpPassword\"", ")", ";", "params", ".", "add", "(", "tcpPassword", ")", ";", "}", "if", "(", "ifExists", ")", "{", "params", ".", "add", "(", "\"-ifExists\"", ")", ";", "}", "if", "(", "baseDir", "!=", "null", ")", "{", "params", ".", "add", "(", "\"-baseDir\"", ")", ";", "params", ".", "add", "(", "baseDir", ")", ";", "}", "Server", "server", "=", "Server", ".", "createTcpServer", "(", "params", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ")", ".", "start", "(", ")", ";", "return", "server", ";", "}" ]
Start the server mode. <p>This calls: <pre> Server server = Server.createTcpServer( "-tcpPort", "9123", "-tcpAllowOthers").start(); </pre> Supported options are: -tcpPort, -tcpSSL, -tcpPassword, -tcpAllowOthers, -tcpDaemon, -trace, -ifExists, -baseDir, -key. See the main method for details. <p> @param port the optional port to use. @param doSSL if <code>true</code>, ssl is used. @param tcpPassword an optional tcp passowrd to use. @param ifExists is <code>true</code>, the database to connect to has to exist. @param baseDir an optional basedir into which it is allowed to connect. @return @throws SQLException
[ "Start", "the", "server", "mode", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/h2gis/H2GisServer.java#L58-L87
137,682
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/h2gis/H2GisServer.java
H2GisServer.startWebServerMode
public static Server startWebServerMode( String port, boolean doSSL, boolean ifExists, String baseDir ) throws SQLException { List<String> params = new ArrayList<>(); params.add("-webAllowOthers"); if (port != null) { params.add("-webPort"); params.add(port); } if (doSSL) { params.add("-webSSL"); } if (ifExists) { params.add("-ifExists"); } if (baseDir != null) { params.add("-baseDir"); params.add(baseDir); } Server server = Server.createWebServer(params.toArray(new String[0])).start(); return server; }
java
public static Server startWebServerMode( String port, boolean doSSL, boolean ifExists, String baseDir ) throws SQLException { List<String> params = new ArrayList<>(); params.add("-webAllowOthers"); if (port != null) { params.add("-webPort"); params.add(port); } if (doSSL) { params.add("-webSSL"); } if (ifExists) { params.add("-ifExists"); } if (baseDir != null) { params.add("-baseDir"); params.add(baseDir); } Server server = Server.createWebServer(params.toArray(new String[0])).start(); return server; }
[ "public", "static", "Server", "startWebServerMode", "(", "String", "port", ",", "boolean", "doSSL", ",", "boolean", "ifExists", ",", "String", "baseDir", ")", "throws", "SQLException", "{", "List", "<", "String", ">", "params", "=", "new", "ArrayList", "<>", "(", ")", ";", "params", ".", "add", "(", "\"-webAllowOthers\"", ")", ";", "if", "(", "port", "!=", "null", ")", "{", "params", ".", "add", "(", "\"-webPort\"", ")", ";", "params", ".", "add", "(", "port", ")", ";", "}", "if", "(", "doSSL", ")", "{", "params", ".", "add", "(", "\"-webSSL\"", ")", ";", "}", "if", "(", "ifExists", ")", "{", "params", ".", "add", "(", "\"-ifExists\"", ")", ";", "}", "if", "(", "baseDir", "!=", "null", ")", "{", "params", ".", "add", "(", "\"-baseDir\"", ")", ";", "params", ".", "add", "(", "baseDir", ")", ";", "}", "Server", "server", "=", "Server", ".", "createWebServer", "(", "params", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ")", ".", "start", "(", ")", ";", "return", "server", ";", "}" ]
Start the web server mode. @param port the optional port to use. @param doSSL if <code>true</code>, ssl is used. @param ifExists is <code>true</code>, the database to connect to has to exist. @param baseDir an optional basedir into which it is allowed to connect. @return @throws SQLException
[ "Start", "the", "web", "server", "mode", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/h2gis/H2GisServer.java#L99-L122
137,683
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java
SpatialDbsImportUtils.createTableFromShp
public static String createTableFromShp( ASpatialDb db, File shapeFile, String newTableName, boolean avoidSpatialIndex ) throws Exception { FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile); SimpleFeatureSource featureSource = store.getFeatureSource(); SimpleFeatureType schema = featureSource.getSchema(); if (newTableName == null) { newTableName = FileUtilities.getNameWithoutExtention(shapeFile); } return createTableFromSchema(db, schema, newTableName, avoidSpatialIndex); }
java
public static String createTableFromShp( ASpatialDb db, File shapeFile, String newTableName, boolean avoidSpatialIndex ) throws Exception { FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile); SimpleFeatureSource featureSource = store.getFeatureSource(); SimpleFeatureType schema = featureSource.getSchema(); if (newTableName == null) { newTableName = FileUtilities.getNameWithoutExtention(shapeFile); } return createTableFromSchema(db, schema, newTableName, avoidSpatialIndex); }
[ "public", "static", "String", "createTableFromShp", "(", "ASpatialDb", "db", ",", "File", "shapeFile", ",", "String", "newTableName", ",", "boolean", "avoidSpatialIndex", ")", "throws", "Exception", "{", "FileDataStore", "store", "=", "FileDataStoreFinder", ".", "getDataStore", "(", "shapeFile", ")", ";", "SimpleFeatureSource", "featureSource", "=", "store", ".", "getFeatureSource", "(", ")", ";", "SimpleFeatureType", "schema", "=", "featureSource", ".", "getSchema", "(", ")", ";", "if", "(", "newTableName", "==", "null", ")", "{", "newTableName", "=", "FileUtilities", ".", "getNameWithoutExtention", "(", "shapeFile", ")", ";", "}", "return", "createTableFromSchema", "(", "db", ",", "schema", ",", "newTableName", ",", "avoidSpatialIndex", ")", ";", "}" ]
Create a spatial table using a shapefile as schema. @param db the database to use. @param shapeFile the shapefile to use. @param newTableName the new name of the table. If null, the shp name is used. @return the name of the created table. @param avoidSpatialIndex if <code>true</code>, no spatial index will be created. This is useful if many records have to be inserted and the index will be created later manually. @return the name of the created table. @throws Exception
[ "Create", "a", "spatial", "table", "using", "a", "shapefile", "as", "schema", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java#L88-L97
137,684
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java
SpatialDbsImportUtils.importShapefile
public static boolean importShapefile( ASpatialDb db, File shapeFile, String tableName, int limit, IHMProgressMonitor pm ) throws Exception { FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile); SimpleFeatureSource featureSource = store.getFeatureSource(); SimpleFeatureCollection features = featureSource.getFeatures(); return importFeatureCollection(db, features, tableName, limit, pm); }
java
public static boolean importShapefile( ASpatialDb db, File shapeFile, String tableName, int limit, IHMProgressMonitor pm ) throws Exception { FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile); SimpleFeatureSource featureSource = store.getFeatureSource(); SimpleFeatureCollection features = featureSource.getFeatures(); return importFeatureCollection(db, features, tableName, limit, pm); }
[ "public", "static", "boolean", "importShapefile", "(", "ASpatialDb", "db", ",", "File", "shapeFile", ",", "String", "tableName", ",", "int", "limit", ",", "IHMProgressMonitor", "pm", ")", "throws", "Exception", "{", "FileDataStore", "store", "=", "FileDataStoreFinder", ".", "getDataStore", "(", "shapeFile", ")", ";", "SimpleFeatureSource", "featureSource", "=", "store", ".", "getFeatureSource", "(", ")", ";", "SimpleFeatureCollection", "features", "=", "featureSource", ".", "getFeatures", "(", ")", ";", "return", "importFeatureCollection", "(", "db", ",", "features", ",", "tableName", ",", "limit", ",", "pm", ")", ";", "}" ]
Import a shapefile into a table. @param db the database to use. @param shapeFile the shapefile to import. @param tableName the name of the table to import to. @param limit if > 0, a limit to the imported features is applied. @param pm the progress monitor. @return <code>false</code>, is an error occurred. @throws Exception
[ "Import", "a", "shapefile", "into", "a", "table", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java#L199-L207
137,685
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java
ExifGpsWriter.writeExif
private void writeExif() throws IOException { IIOMetadata metadata = jpegReader.getImageMetadata(0); // names says which exif tree to get - 0 for jpeg 1 for the default String[] names = metadata.getMetadataFormatNames(); IIOMetadataNode root = (IIOMetadataNode) metadata.getAsTree(names[0]); // exif is on the app1 node called unknown NodeList nList = root.getElementsByTagName("unknown"); IIOMetadataNode app1EXIFNode = (IIOMetadataNode) nList.item(0); ArrayList<IIOMetadata> md = readExif(app1EXIFNode); IIOMetadata exifMetadata = md.get(0); // insert the gps data into the exif exifMetadata = insertGPSCoords(exifMetadata); // create a new exif node IIOMetadataNode app1NodeNew = createNewExifNode(exifMetadata, null, null); // copy the user data accross app1EXIFNode.setUserObject(app1NodeNew.getUserObject()); // write to a new image file FileImageOutputStream out1 = new FileImageOutputStream(new File("GPS_" + imageFile.getName())); jpegWriter.setOutput(out1); metadata.setFromTree(names[0], root); IIOImage image = new IIOImage(jpegReader.readAsRenderedImage(0, jpegReader.getDefaultReadParam()), null, metadata); // write out the new image jpegWriter.write(jpegReader.getStreamMetadata(), image, jpegWriter.getDefaultWriteParam()); }
java
private void writeExif() throws IOException { IIOMetadata metadata = jpegReader.getImageMetadata(0); // names says which exif tree to get - 0 for jpeg 1 for the default String[] names = metadata.getMetadataFormatNames(); IIOMetadataNode root = (IIOMetadataNode) metadata.getAsTree(names[0]); // exif is on the app1 node called unknown NodeList nList = root.getElementsByTagName("unknown"); IIOMetadataNode app1EXIFNode = (IIOMetadataNode) nList.item(0); ArrayList<IIOMetadata> md = readExif(app1EXIFNode); IIOMetadata exifMetadata = md.get(0); // insert the gps data into the exif exifMetadata = insertGPSCoords(exifMetadata); // create a new exif node IIOMetadataNode app1NodeNew = createNewExifNode(exifMetadata, null, null); // copy the user data accross app1EXIFNode.setUserObject(app1NodeNew.getUserObject()); // write to a new image file FileImageOutputStream out1 = new FileImageOutputStream(new File("GPS_" + imageFile.getName())); jpegWriter.setOutput(out1); metadata.setFromTree(names[0], root); IIOImage image = new IIOImage(jpegReader.readAsRenderedImage(0, jpegReader.getDefaultReadParam()), null, metadata); // write out the new image jpegWriter.write(jpegReader.getStreamMetadata(), image, jpegWriter.getDefaultWriteParam()); }
[ "private", "void", "writeExif", "(", ")", "throws", "IOException", "{", "IIOMetadata", "metadata", "=", "jpegReader", ".", "getImageMetadata", "(", "0", ")", ";", "// names says which exif tree to get - 0 for jpeg 1 for the default", "String", "[", "]", "names", "=", "metadata", ".", "getMetadataFormatNames", "(", ")", ";", "IIOMetadataNode", "root", "=", "(", "IIOMetadataNode", ")", "metadata", ".", "getAsTree", "(", "names", "[", "0", "]", ")", ";", "// exif is on the app1 node called unknown", "NodeList", "nList", "=", "root", ".", "getElementsByTagName", "(", "\"unknown\"", ")", ";", "IIOMetadataNode", "app1EXIFNode", "=", "(", "IIOMetadataNode", ")", "nList", ".", "item", "(", "0", ")", ";", "ArrayList", "<", "IIOMetadata", ">", "md", "=", "readExif", "(", "app1EXIFNode", ")", ";", "IIOMetadata", "exifMetadata", "=", "md", ".", "get", "(", "0", ")", ";", "// insert the gps data into the exif", "exifMetadata", "=", "insertGPSCoords", "(", "exifMetadata", ")", ";", "// create a new exif node", "IIOMetadataNode", "app1NodeNew", "=", "createNewExifNode", "(", "exifMetadata", ",", "null", ",", "null", ")", ";", "// copy the user data accross", "app1EXIFNode", ".", "setUserObject", "(", "app1NodeNew", ".", "getUserObject", "(", ")", ")", ";", "// write to a new image file", "FileImageOutputStream", "out1", "=", "new", "FileImageOutputStream", "(", "new", "File", "(", "\"GPS_\"", "+", "imageFile", ".", "getName", "(", ")", ")", ")", ";", "jpegWriter", ".", "setOutput", "(", "out1", ")", ";", "metadata", ".", "setFromTree", "(", "names", "[", "0", "]", ",", "root", ")", ";", "IIOImage", "image", "=", "new", "IIOImage", "(", "jpegReader", ".", "readAsRenderedImage", "(", "0", ",", "jpegReader", ".", "getDefaultReadParam", "(", ")", ")", ",", "null", ",", "metadata", ")", ";", "// write out the new image", "jpegWriter", ".", "write", "(", "jpegReader", ".", "getStreamMetadata", "(", ")", ",", "image", ",", "jpegWriter", ".", "getDefaultWriteParam", "(", ")", ")", ";", "}" ]
Main method to write the gps data to the exif @param gps - gps position to be added @throws IOException
[ "Main", "method", "to", "write", "the", "gps", "data", "to", "the", "exif" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java#L199-L232
137,686
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java
ExifGpsWriter.readExif
private ArrayList<IIOMetadata> readExif( IIOMetadataNode app1EXIFNode ) { // Set up input skipping EXIF ID 6-byte sequence. byte[] app1Params = (byte[]) app1EXIFNode.getUserObject(); MemoryCacheImageInputStream app1EXIFInput = new MemoryCacheImageInputStream(new ByteArrayInputStream(app1Params, 6, app1Params.length - 6)); // only the tiff reader knows how to interpret the exif metadata ImageReader tiffReader = null; Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("tiff"); while( readers.hasNext() ) { tiffReader = (ImageReader) readers.next(); if (tiffReader.getClass().getName().startsWith("com.sun.media")) { // Break on finding the core provider. break; } } if (tiffReader == null) { throw new RuntimeException("Cannot find core TIFF reader!"); } ArrayList<IIOMetadata> out = new ArrayList<IIOMetadata>(1); tiffReader.setInput(app1EXIFInput); IIOMetadata tiffMetadata = null; try { tiffMetadata = tiffReader.getImageMetadata(0); // IIOMetadata meta = tiffReader.getImageMetadata(0); TIFFImageReadParam rParam = (TIFFImageReadParam) tiffReader.getDefaultReadParam(); rParam.setTIFFDecompressor(null); } catch (IOException e) { e.printStackTrace(); }; tiffReader.dispose(); out.add(0, tiffMetadata); return out; }
java
private ArrayList<IIOMetadata> readExif( IIOMetadataNode app1EXIFNode ) { // Set up input skipping EXIF ID 6-byte sequence. byte[] app1Params = (byte[]) app1EXIFNode.getUserObject(); MemoryCacheImageInputStream app1EXIFInput = new MemoryCacheImageInputStream(new ByteArrayInputStream(app1Params, 6, app1Params.length - 6)); // only the tiff reader knows how to interpret the exif metadata ImageReader tiffReader = null; Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("tiff"); while( readers.hasNext() ) { tiffReader = (ImageReader) readers.next(); if (tiffReader.getClass().getName().startsWith("com.sun.media")) { // Break on finding the core provider. break; } } if (tiffReader == null) { throw new RuntimeException("Cannot find core TIFF reader!"); } ArrayList<IIOMetadata> out = new ArrayList<IIOMetadata>(1); tiffReader.setInput(app1EXIFInput); IIOMetadata tiffMetadata = null; try { tiffMetadata = tiffReader.getImageMetadata(0); // IIOMetadata meta = tiffReader.getImageMetadata(0); TIFFImageReadParam rParam = (TIFFImageReadParam) tiffReader.getDefaultReadParam(); rParam.setTIFFDecompressor(null); } catch (IOException e) { e.printStackTrace(); }; tiffReader.dispose(); out.add(0, tiffMetadata); return out; }
[ "private", "ArrayList", "<", "IIOMetadata", ">", "readExif", "(", "IIOMetadataNode", "app1EXIFNode", ")", "{", "// Set up input skipping EXIF ID 6-byte sequence.", "byte", "[", "]", "app1Params", "=", "(", "byte", "[", "]", ")", "app1EXIFNode", ".", "getUserObject", "(", ")", ";", "MemoryCacheImageInputStream", "app1EXIFInput", "=", "new", "MemoryCacheImageInputStream", "(", "new", "ByteArrayInputStream", "(", "app1Params", ",", "6", ",", "app1Params", ".", "length", "-", "6", ")", ")", ";", "// only the tiff reader knows how to interpret the exif metadata", "ImageReader", "tiffReader", "=", "null", ";", "Iterator", "<", "ImageReader", ">", "readers", "=", "ImageIO", ".", "getImageReadersByFormatName", "(", "\"tiff\"", ")", ";", "while", "(", "readers", ".", "hasNext", "(", ")", ")", "{", "tiffReader", "=", "(", "ImageReader", ")", "readers", ".", "next", "(", ")", ";", "if", "(", "tiffReader", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "startsWith", "(", "\"com.sun.media\"", ")", ")", "{", "// Break on finding the core provider.", "break", ";", "}", "}", "if", "(", "tiffReader", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"Cannot find core TIFF reader!\"", ")", ";", "}", "ArrayList", "<", "IIOMetadata", ">", "out", "=", "new", "ArrayList", "<", "IIOMetadata", ">", "(", "1", ")", ";", "tiffReader", ".", "setInput", "(", "app1EXIFInput", ")", ";", "IIOMetadata", "tiffMetadata", "=", "null", ";", "try", "{", "tiffMetadata", "=", "tiffReader", ".", "getImageMetadata", "(", "0", ")", ";", "// IIOMetadata meta = tiffReader.getImageMetadata(0);", "TIFFImageReadParam", "rParam", "=", "(", "TIFFImageReadParam", ")", "tiffReader", ".", "getDefaultReadParam", "(", ")", ";", "rParam", ".", "setTIFFDecompressor", "(", "null", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", ";", "tiffReader", ".", "dispose", "(", ")", ";", "out", ".", "add", "(", "0", ",", "tiffMetadata", ")", ";", "return", "out", ";", "}" ]
Private method - Reads the exif metadata for an image @param app1EXIFNode app1 Node of the image (where the exif data is stored) @return the exif metadata
[ "Private", "method", "-", "Reads", "the", "exif", "metadata", "for", "an", "image" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java#L239-L281
137,687
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java
ExifGpsWriter.createNewExifNode
private IIOMetadataNode createNewExifNode( IIOMetadata tiffMetadata, IIOMetadata thumbMeta, BufferedImage thumbnail ) { IIOMetadataNode app1Node = null; ImageWriter tiffWriter = null; try { Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("tiff"); while( writers.hasNext() ) { tiffWriter = writers.next(); if (tiffWriter.getClass().getName().startsWith("com.sun.media")) { // Break on finding the core provider. break; } } if (tiffWriter == null) { System.out.println("Cannot find core TIFF writer!"); System.exit(0); } ImageWriteParam writeParam = tiffWriter.getDefaultWriteParam(); writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); writeParam.setCompressionType("EXIF JPEG"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); MemoryCacheImageOutputStream app1EXIFOutput = new MemoryCacheImageOutputStream(baos); tiffWriter.setOutput(app1EXIFOutput); // escribir tiffWriter.prepareWriteEmpty(jpegReader.getStreamMetadata(), new ImageTypeSpecifier(image), image.getWidth(), image.getHeight(), tiffMetadata, null, writeParam); tiffWriter.endWriteEmpty(); // Flush data into byte stream. app1EXIFOutput.flush(); // Create APP1 parameter array. byte[] app1Parameters = new byte[6 + baos.size()]; // Add EXIF APP1 ID bytes. app1Parameters[0] = (byte) 'E'; app1Parameters[1] = (byte) 'x'; app1Parameters[2] = (byte) 'i'; app1Parameters[3] = (byte) 'f'; app1Parameters[4] = app1Parameters[5] = (byte) 0; // Append TIFF stream to APP1 parameters. System.arraycopy(baos.toByteArray(), 0, app1Parameters, 6, baos.size()); // Create the APP1 EXIF node to be added to native JPEG image metadata. app1Node = new IIOMetadataNode("unknown"); app1Node.setAttribute("MarkerTag", (new Integer(0xE1)).toString()); app1Node.setUserObject(app1Parameters); } catch (IOException e) { e.printStackTrace(); } finally { if (tiffWriter != null) tiffWriter.dispose(); } return app1Node; }
java
private IIOMetadataNode createNewExifNode( IIOMetadata tiffMetadata, IIOMetadata thumbMeta, BufferedImage thumbnail ) { IIOMetadataNode app1Node = null; ImageWriter tiffWriter = null; try { Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("tiff"); while( writers.hasNext() ) { tiffWriter = writers.next(); if (tiffWriter.getClass().getName().startsWith("com.sun.media")) { // Break on finding the core provider. break; } } if (tiffWriter == null) { System.out.println("Cannot find core TIFF writer!"); System.exit(0); } ImageWriteParam writeParam = tiffWriter.getDefaultWriteParam(); writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); writeParam.setCompressionType("EXIF JPEG"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); MemoryCacheImageOutputStream app1EXIFOutput = new MemoryCacheImageOutputStream(baos); tiffWriter.setOutput(app1EXIFOutput); // escribir tiffWriter.prepareWriteEmpty(jpegReader.getStreamMetadata(), new ImageTypeSpecifier(image), image.getWidth(), image.getHeight(), tiffMetadata, null, writeParam); tiffWriter.endWriteEmpty(); // Flush data into byte stream. app1EXIFOutput.flush(); // Create APP1 parameter array. byte[] app1Parameters = new byte[6 + baos.size()]; // Add EXIF APP1 ID bytes. app1Parameters[0] = (byte) 'E'; app1Parameters[1] = (byte) 'x'; app1Parameters[2] = (byte) 'i'; app1Parameters[3] = (byte) 'f'; app1Parameters[4] = app1Parameters[5] = (byte) 0; // Append TIFF stream to APP1 parameters. System.arraycopy(baos.toByteArray(), 0, app1Parameters, 6, baos.size()); // Create the APP1 EXIF node to be added to native JPEG image metadata. app1Node = new IIOMetadataNode("unknown"); app1Node.setAttribute("MarkerTag", (new Integer(0xE1)).toString()); app1Node.setUserObject(app1Parameters); } catch (IOException e) { e.printStackTrace(); } finally { if (tiffWriter != null) tiffWriter.dispose(); } return app1Node; }
[ "private", "IIOMetadataNode", "createNewExifNode", "(", "IIOMetadata", "tiffMetadata", ",", "IIOMetadata", "thumbMeta", ",", "BufferedImage", "thumbnail", ")", "{", "IIOMetadataNode", "app1Node", "=", "null", ";", "ImageWriter", "tiffWriter", "=", "null", ";", "try", "{", "Iterator", "<", "ImageWriter", ">", "writers", "=", "ImageIO", ".", "getImageWritersByFormatName", "(", "\"tiff\"", ")", ";", "while", "(", "writers", ".", "hasNext", "(", ")", ")", "{", "tiffWriter", "=", "writers", ".", "next", "(", ")", ";", "if", "(", "tiffWriter", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "startsWith", "(", "\"com.sun.media\"", ")", ")", "{", "// Break on finding the core provider.", "break", ";", "}", "}", "if", "(", "tiffWriter", "==", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"Cannot find core TIFF writer!\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "ImageWriteParam", "writeParam", "=", "tiffWriter", ".", "getDefaultWriteParam", "(", ")", ";", "writeParam", ".", "setCompressionMode", "(", "ImageWriteParam", ".", "MODE_EXPLICIT", ")", ";", "writeParam", ".", "setCompressionType", "(", "\"EXIF JPEG\"", ")", ";", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "MemoryCacheImageOutputStream", "app1EXIFOutput", "=", "new", "MemoryCacheImageOutputStream", "(", "baos", ")", ";", "tiffWriter", ".", "setOutput", "(", "app1EXIFOutput", ")", ";", "// escribir", "tiffWriter", ".", "prepareWriteEmpty", "(", "jpegReader", ".", "getStreamMetadata", "(", ")", ",", "new", "ImageTypeSpecifier", "(", "image", ")", ",", "image", ".", "getWidth", "(", ")", ",", "image", ".", "getHeight", "(", ")", ",", "tiffMetadata", ",", "null", ",", "writeParam", ")", ";", "tiffWriter", ".", "endWriteEmpty", "(", ")", ";", "// Flush data into byte stream.", "app1EXIFOutput", ".", "flush", "(", ")", ";", "// Create APP1 parameter array.", "byte", "[", "]", "app1Parameters", "=", "new", "byte", "[", "6", "+", "baos", ".", "size", "(", ")", "]", ";", "// Add EXIF APP1 ID bytes.", "app1Parameters", "[", "0", "]", "=", "(", "byte", ")", "'", "'", ";", "app1Parameters", "[", "1", "]", "=", "(", "byte", ")", "'", "'", ";", "app1Parameters", "[", "2", "]", "=", "(", "byte", ")", "'", "'", ";", "app1Parameters", "[", "3", "]", "=", "(", "byte", ")", "'", "'", ";", "app1Parameters", "[", "4", "]", "=", "app1Parameters", "[", "5", "]", "=", "(", "byte", ")", "0", ";", "// Append TIFF stream to APP1 parameters.", "System", ".", "arraycopy", "(", "baos", ".", "toByteArray", "(", ")", ",", "0", ",", "app1Parameters", ",", "6", ",", "baos", ".", "size", "(", ")", ")", ";", "// Create the APP1 EXIF node to be added to native JPEG image metadata.", "app1Node", "=", "new", "IIOMetadataNode", "(", "\"unknown\"", ")", ";", "app1Node", ".", "setAttribute", "(", "\"MarkerTag\"", ",", "(", "new", "Integer", "(", "0xE1", ")", ")", ".", "toString", "(", ")", ")", ";", "app1Node", ".", "setUserObject", "(", "app1Parameters", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "if", "(", "tiffWriter", "!=", "null", ")", "tiffWriter", ".", "dispose", "(", ")", ";", "}", "return", "app1Node", ";", "}" ]
Private method - creates a copy of the metadata that can be written to @param tiffMetadata - in metadata @return new metadata node that can be written to
[ "Private", "method", "-", "creates", "a", "copy", "of", "the", "metadata", "that", "can", "be", "written", "to" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java#L288-L349
137,688
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java
ExifGpsWriter.getLatitude
private long[][] getLatitude( String lat ) { float secs = Float.parseFloat("0" + lat.substring(4)) * 60.f; long nom = (long) (secs * 1000); long[][] latl = new long[][]{{Long.parseLong(lat.substring(0, 2)), 1}, {Long.parseLong(lat.substring(2, 4)), 1}, {nom, 1000}}; return latl; }
java
private long[][] getLatitude( String lat ) { float secs = Float.parseFloat("0" + lat.substring(4)) * 60.f; long nom = (long) (secs * 1000); long[][] latl = new long[][]{{Long.parseLong(lat.substring(0, 2)), 1}, {Long.parseLong(lat.substring(2, 4)), 1}, {nom, 1000}}; return latl; }
[ "private", "long", "[", "]", "[", "]", "getLatitude", "(", "String", "lat", ")", "{", "float", "secs", "=", "Float", ".", "parseFloat", "(", "\"0\"", "+", "lat", ".", "substring", "(", "4", ")", ")", "*", "60.f", ";", "long", "nom", "=", "(", "long", ")", "(", "secs", "*", "1000", ")", ";", "long", "[", "]", "[", "]", "latl", "=", "new", "long", "[", "]", "[", "]", "{", "{", "Long", ".", "parseLong", "(", "lat", ".", "substring", "(", "0", ",", "2", ")", ")", ",", "1", "}", ",", "{", "Long", ".", "parseLong", "(", "lat", ".", "substring", "(", "2", ",", "4", ")", ")", ",", "1", "}", ",", "{", "nom", ",", "1000", "}", "}", ";", "return", "latl", ";", "}" ]
assumes the the format is HHMM.MMMM
[ "assumes", "the", "the", "format", "is", "HHMM", ".", "MMMM" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java#L452-L461
137,689
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java
ExifGpsWriter.getLongitude
private long[][] getLongitude( String longi ) { float secs = Float.parseFloat("0" + longi.substring(5)) * 60.f; long nom = (long) (secs * 1000); long[][] longl = new long[][]{{Long.parseLong(longi.substring(0, 3)), 1}, {Long.parseLong(longi.substring(3, 5)), 1}, {nom, 1000}}; return longl; }
java
private long[][] getLongitude( String longi ) { float secs = Float.parseFloat("0" + longi.substring(5)) * 60.f; long nom = (long) (secs * 1000); long[][] longl = new long[][]{{Long.parseLong(longi.substring(0, 3)), 1}, {Long.parseLong(longi.substring(3, 5)), 1}, {nom, 1000}}; return longl; }
[ "private", "long", "[", "]", "[", "]", "getLongitude", "(", "String", "longi", ")", "{", "float", "secs", "=", "Float", ".", "parseFloat", "(", "\"0\"", "+", "longi", ".", "substring", "(", "5", ")", ")", "*", "60.f", ";", "long", "nom", "=", "(", "long", ")", "(", "secs", "*", "1000", ")", ";", "long", "[", "]", "[", "]", "longl", "=", "new", "long", "[", "]", "[", "]", "{", "{", "Long", ".", "parseLong", "(", "longi", ".", "substring", "(", "0", ",", "3", ")", ")", ",", "1", "}", ",", "{", "Long", ".", "parseLong", "(", "longi", ".", "substring", "(", "3", ",", "5", ")", ")", ",", "1", "}", ",", "{", "nom", ",", "1000", "}", "}", ";", "return", "longl", ";", "}" ]
assumes the the format is HHHMM.MMMM
[ "assumes", "the", "the", "format", "is", "HHHMM", ".", "MMMM" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java#L464-L473
137,690
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java
ExifGpsWriter.getTime
private long[][] getTime( String time ) { long[][] timel = new long[][]{{Long.parseLong(time.substring(0, 2)), 1}, {Long.parseLong(time.substring(2, 4)), 1}, {Long.parseLong(time.substring(4)), 1}}; return timel; }
java
private long[][] getTime( String time ) { long[][] timel = new long[][]{{Long.parseLong(time.substring(0, 2)), 1}, {Long.parseLong(time.substring(2, 4)), 1}, {Long.parseLong(time.substring(4)), 1}}; return timel; }
[ "private", "long", "[", "]", "[", "]", "getTime", "(", "String", "time", ")", "{", "long", "[", "]", "[", "]", "timel", "=", "new", "long", "[", "]", "[", "]", "{", "{", "Long", ".", "parseLong", "(", "time", ".", "substring", "(", "0", ",", "2", ")", ")", ",", "1", "}", ",", "{", "Long", ".", "parseLong", "(", "time", ".", "substring", "(", "2", ",", "4", ")", ")", ",", "1", "}", ",", "{", "Long", ".", "parseLong", "(", "time", ".", "substring", "(", "4", ")", ")", ",", "1", "}", "}", ";", "return", "timel", ";", "}" ]
Convert a time to exif format. @param time the time in format HHMMSS. @return the exif time object.
[ "Convert", "a", "time", "to", "exif", "format", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java#L481-L485
137,691
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java
ExifGpsWriter.getDate
private String[] getDate( String date ) { String dateStr = "20" + date.substring(4) + ":" + date.substring(2, 4) + ":" + date.substring(0, 2); String[] dateArray = new String[11]; for( int i = 0; i < dateStr.length(); i++ ) dateArray[i] = dateStr.substring(i, i + 1); dateArray[10] = ""; return dateArray; }
java
private String[] getDate( String date ) { String dateStr = "20" + date.substring(4) + ":" + date.substring(2, 4) + ":" + date.substring(0, 2); String[] dateArray = new String[11]; for( int i = 0; i < dateStr.length(); i++ ) dateArray[i] = dateStr.substring(i, i + 1); dateArray[10] = ""; return dateArray; }
[ "private", "String", "[", "]", "getDate", "(", "String", "date", ")", "{", "String", "dateStr", "=", "\"20\"", "+", "date", ".", "substring", "(", "4", ")", "+", "\":\"", "+", "date", ".", "substring", "(", "2", ",", "4", ")", "+", "\":\"", "+", "date", ".", "substring", "(", "0", ",", "2", ")", ";", "String", "[", "]", "dateArray", "=", "new", "String", "[", "11", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dateStr", ".", "length", "(", ")", ";", "i", "++", ")", "dateArray", "[", "i", "]", "=", "dateStr", ".", "substring", "(", "i", ",", "i", "+", "1", ")", ";", "dateArray", "[", "10", "]", "=", "\"\"", ";", "return", "dateArray", ";", "}" ]
Convert a date to exif date. @param date the date in format YYYY:MM:DD @return the exif date object.
[ "Convert", "a", "date", "to", "exif", "date", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java#L493-L504
137,692
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java
GvmCluster.clear
void clear() { count = 0; m0 = 0.0; clusters.space.setToOrigin(m1); clusters.space.setToOrigin(m2); var = 0.0; key = null; }
java
void clear() { count = 0; m0 = 0.0; clusters.space.setToOrigin(m1); clusters.space.setToOrigin(m2); var = 0.0; key = null; }
[ "void", "clear", "(", ")", "{", "count", "=", "0", ";", "m0", "=", "0.0", ";", "clusters", ".", "space", ".", "setToOrigin", "(", "m1", ")", ";", "clusters", ".", "space", ".", "setToOrigin", "(", "m2", ")", ";", "var", "=", "0.0", ";", "key", "=", "null", ";", "}" ]
Completely clears this cluster. All points and their associated mass is removed along with any key that was assigned to the cluster,
[ "Completely", "clears", "this", "cluster", ".", "All", "points", "and", "their", "associated", "mass", "is", "removed", "along", "with", "any", "key", "that", "was", "assigned", "to", "the", "cluster" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java#L138-L145
137,693
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java
GvmCluster.set
void set(final double m, final Object pt) { if (m == 0.0) { if (count != 0) { clusters.space.setToOrigin(m1); clusters.space.setToOrigin(m2); } } else { clusters.space.setToScaled(m1, m, pt); clusters.space.setToScaledSqr(m2, m, pt); } count = 1; m0 = m; var = 0.0; }
java
void set(final double m, final Object pt) { if (m == 0.0) { if (count != 0) { clusters.space.setToOrigin(m1); clusters.space.setToOrigin(m2); } } else { clusters.space.setToScaled(m1, m, pt); clusters.space.setToScaledSqr(m2, m, pt); } count = 1; m0 = m; var = 0.0; }
[ "void", "set", "(", "final", "double", "m", ",", "final", "Object", "pt", ")", "{", "if", "(", "m", "==", "0.0", ")", "{", "if", "(", "count", "!=", "0", ")", "{", "clusters", ".", "space", ".", "setToOrigin", "(", "m1", ")", ";", "clusters", ".", "space", ".", "setToOrigin", "(", "m2", ")", ";", "}", "}", "else", "{", "clusters", ".", "space", ".", "setToScaled", "(", "m1", ",", "m", ",", "pt", ")", ";", "clusters", ".", "space", ".", "setToScaledSqr", "(", "m2", ",", "m", ",", "pt", ")", ";", "}", "count", "=", "1", ";", "m0", "=", "m", ";", "var", "=", "0.0", ";", "}" ]
Sets this cluster equal to a single point. @param m the mass of the point @param pt the coordinates of the point
[ "Sets", "this", "cluster", "equal", "to", "a", "single", "point", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java#L156-L169
137,694
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java
GvmCluster.add
void add(final double m, final Object pt) { if (count == 0) { set(m, pt); } else { count += 1; if (m != 0.0) { m0 += m; clusters.space.addScaled(m1, m, pt); clusters.space.addScaledSqr(m2, m, pt); update(); } } }
java
void add(final double m, final Object pt) { if (count == 0) { set(m, pt); } else { count += 1; if (m != 0.0) { m0 += m; clusters.space.addScaled(m1, m, pt); clusters.space.addScaledSqr(m2, m, pt); update(); } } }
[ "void", "add", "(", "final", "double", "m", ",", "final", "Object", "pt", ")", "{", "if", "(", "count", "==", "0", ")", "{", "set", "(", "m", ",", "pt", ")", ";", "}", "else", "{", "count", "+=", "1", ";", "if", "(", "m", "!=", "0.0", ")", "{", "m0", "+=", "m", ";", "clusters", ".", "space", ".", "addScaled", "(", "m1", ",", "m", ",", "pt", ")", ";", "clusters", ".", "space", ".", "addScaledSqr", "(", "m2", ",", "m", ",", "pt", ")", ";", "update", "(", ")", ";", "}", "}", "}" ]
Adds a point to the cluster. @param m the mass of the point @param pt the coordinates of the point
[ "Adds", "a", "point", "to", "the", "cluster", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java#L180-L193
137,695
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java
GvmCluster.set
void set(GvmCluster<S,K> cluster) { if (cluster == this) throw new IllegalArgumentException("cannot set cluster to itself"); m0 = cluster.m0; clusters.space.setTo(m1, cluster.m1); clusters.space.setTo(m2, cluster.m2); var = cluster.var; }
java
void set(GvmCluster<S,K> cluster) { if (cluster == this) throw new IllegalArgumentException("cannot set cluster to itself"); m0 = cluster.m0; clusters.space.setTo(m1, cluster.m1); clusters.space.setTo(m2, cluster.m2); var = cluster.var; }
[ "void", "set", "(", "GvmCluster", "<", "S", ",", "K", ">", "cluster", ")", "{", "if", "(", "cluster", "==", "this", ")", "throw", "new", "IllegalArgumentException", "(", "\"cannot set cluster to itself\"", ")", ";", "m0", "=", "cluster", ".", "m0", ";", "clusters", ".", "space", ".", "setTo", "(", "m1", ",", "cluster", ".", "m1", ")", ";", "clusters", ".", "space", ".", "setTo", "(", "m2", ",", "cluster", ".", "m2", ")", ";", "var", "=", "cluster", ".", "var", ";", "}" ]
Sets this cluster equal to the specified cluster @param cluster a cluster, not this or null
[ "Sets", "this", "cluster", "equal", "to", "the", "specified", "cluster" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java#L201-L208
137,696
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java
GvmCluster.add
void add(GvmCluster<S,K> cluster) { if (cluster == this) throw new IllegalArgumentException(); if (cluster.count == 0) return; //nothing to do if (count == 0) { set(cluster); } else { count += cluster.count; //TODO accelerate add m0 += cluster.m0; clusters.space.add(m1, cluster.m1); clusters.space.add(m2, cluster.m2); update(); } }
java
void add(GvmCluster<S,K> cluster) { if (cluster == this) throw new IllegalArgumentException(); if (cluster.count == 0) return; //nothing to do if (count == 0) { set(cluster); } else { count += cluster.count; //TODO accelerate add m0 += cluster.m0; clusters.space.add(m1, cluster.m1); clusters.space.add(m2, cluster.m2); update(); } }
[ "void", "add", "(", "GvmCluster", "<", "S", ",", "K", ">", "cluster", ")", "{", "if", "(", "cluster", "==", "this", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "if", "(", "cluster", ".", "count", "==", "0", ")", "return", ";", "//nothing to do", "if", "(", "count", "==", "0", ")", "{", "set", "(", "cluster", ")", ";", "}", "else", "{", "count", "+=", "cluster", ".", "count", ";", "//TODO accelerate add", "m0", "+=", "cluster", ".", "m0", ";", "clusters", ".", "space", ".", "add", "(", "m1", ",", "cluster", ".", "m1", ")", ";", "clusters", ".", "space", ".", "add", "(", "m2", ",", "cluster", ".", "m2", ")", ";", "update", "(", ")", ";", "}", "}" ]
Adds the specified cluster to this cluster. @param cluster the cluster to be added
[ "Adds", "the", "specified", "cluster", "to", "this", "cluster", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/clustering/GvmCluster.java#L216-L230
137,697
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/Unicode.java
Unicode.char2DOS437
public static synchronized String char2DOS437( StringBuffer stringbuffer, int i, char c ) { if (unicode2DOS437 == null) { unicode2DOS437 = new char[0x10000]; for( int j = 0; j < 256; j++ ) { char c1; if ((c1 = unicode[2][j]) != '\uFFFF') unicode2DOS437[c1] = (char) j; } } if (i != 2) { StringBuffer stringbuffer1 = new StringBuffer(stringbuffer.length()); for( int k = 0; k < stringbuffer.length(); k++ ) { char c2 = unicode2DOS437[stringbuffer.charAt(k)]; stringbuffer1.append(c2 == 0 ? c : c2); } return new String(stringbuffer1); } else { return new String(stringbuffer); } }
java
public static synchronized String char2DOS437( StringBuffer stringbuffer, int i, char c ) { if (unicode2DOS437 == null) { unicode2DOS437 = new char[0x10000]; for( int j = 0; j < 256; j++ ) { char c1; if ((c1 = unicode[2][j]) != '\uFFFF') unicode2DOS437[c1] = (char) j; } } if (i != 2) { StringBuffer stringbuffer1 = new StringBuffer(stringbuffer.length()); for( int k = 0; k < stringbuffer.length(); k++ ) { char c2 = unicode2DOS437[stringbuffer.charAt(k)]; stringbuffer1.append(c2 == 0 ? c : c2); } return new String(stringbuffer1); } else { return new String(stringbuffer); } }
[ "public", "static", "synchronized", "String", "char2DOS437", "(", "StringBuffer", "stringbuffer", ",", "int", "i", ",", "char", "c", ")", "{", "if", "(", "unicode2DOS437", "==", "null", ")", "{", "unicode2DOS437", "=", "new", "char", "[", "0x10000", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "256", ";", "j", "++", ")", "{", "char", "c1", ";", "if", "(", "(", "c1", "=", "unicode", "[", "2", "]", "[", "j", "]", ")", "!=", "'", "'", ")", "unicode2DOS437", "[", "c1", "]", "=", "(", "char", ")", "j", ";", "}", "}", "if", "(", "i", "!=", "2", ")", "{", "StringBuffer", "stringbuffer1", "=", "new", "StringBuffer", "(", "stringbuffer", ".", "length", "(", ")", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "stringbuffer", ".", "length", "(", ")", ";", "k", "++", ")", "{", "char", "c2", "=", "unicode2DOS437", "[", "stringbuffer", ".", "charAt", "(", "k", ")", "]", ";", "stringbuffer1", ".", "append", "(", "c2", "==", "0", "?", "c", ":", "c2", ")", ";", "}", "return", "new", "String", "(", "stringbuffer1", ")", ";", "}", "else", "{", "return", "new", "String", "(", "stringbuffer", ")", ";", "}", "}" ]
Char to DOS437 converter @param stringbuffer @param i @param c @return String
[ "Char", "to", "DOS437", "converter" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/Unicode.java#L293-L313
137,698
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/ComponentAccess.java
ComponentAccess.callAnnotated
public static void callAnnotated(Object o, Class<? extends Annotation> ann, boolean lazy) { try { getMethodOfInterest(o, ann).invoke(o); } catch (IllegalAccessException ex) { throw new RuntimeException(ex); } catch (InvocationTargetException ex) { throw new RuntimeException(ex.getCause()); } catch (IllegalArgumentException ex) { if (!lazy) { throw new RuntimeException(ex.getMessage()); } } }
java
public static void callAnnotated(Object o, Class<? extends Annotation> ann, boolean lazy) { try { getMethodOfInterest(o, ann).invoke(o); } catch (IllegalAccessException ex) { throw new RuntimeException(ex); } catch (InvocationTargetException ex) { throw new RuntimeException(ex.getCause()); } catch (IllegalArgumentException ex) { if (!lazy) { throw new RuntimeException(ex.getMessage()); } } }
[ "public", "static", "void", "callAnnotated", "(", "Object", "o", ",", "Class", "<", "?", "extends", "Annotation", ">", "ann", ",", "boolean", "lazy", ")", "{", "try", "{", "getMethodOfInterest", "(", "o", ",", "ann", ")", ".", "invoke", "(", "o", ")", ";", "}", "catch", "(", "IllegalAccessException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ")", ";", "}", "catch", "(", "InvocationTargetException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ".", "getCause", "(", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "ex", ")", "{", "if", "(", "!", "lazy", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Call an method by Annotation. @param o the object to call. @param ann the annotation @param lazy if true, the a missing annotation is OK. if false the annotation has to be present or a Runtime exception is thrown.
[ "Call", "an", "method", "by", "Annotation", "." ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ComponentAccess.java#L255-L267
137,699
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/ComponentAccess.java
ComponentAccess.infoClass
public static Class infoClass(Class cmp) { Class info = null; try { info = Class.forName(cmp.getName() + "CompInfo"); } catch (ClassNotFoundException E) { // there is no info class, info = cmp; } return info; }
java
public static Class infoClass(Class cmp) { Class info = null; try { info = Class.forName(cmp.getName() + "CompInfo"); } catch (ClassNotFoundException E) { // there is no info class, info = cmp; } return info; }
[ "public", "static", "Class", "infoClass", "(", "Class", "cmp", ")", "{", "Class", "info", "=", "null", ";", "try", "{", "info", "=", "Class", ".", "forName", "(", "cmp", ".", "getName", "(", ")", "+", "\"CompInfo\"", ")", ";", "}", "catch", "(", "ClassNotFoundException", "E", ")", "{", "// there is no info class,", "info", "=", "cmp", ";", "}", "return", "info", ";", "}" ]
Get the info class for a component object @param cmp @return the class that contains the annotations.
[ "Get", "the", "info", "class", "for", "a", "component", "object" ]
d2b436bbdf951dc1fda56096a42dbc0eae4d35a5
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ComponentAccess.java#L275-L283