Skip to content

Commit

Permalink
renamed interfaces to start with I
Browse files Browse the repository at this point in the history
  • Loading branch information
adufilie committed Jul 11, 2013
1 parent 3bbf3f3 commit 5e36d9a
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Intended for use with ObjectPool
* @author adufilie
*/
public class CombinedPoint implements StreamObject
public class CombinedPoint implements IStreamObject
{
private final LinkedList<VertexIdentifier> vertexIdentifiers = new LinkedList<VertexIdentifier>();
public final Bounds2D queryBounds = new Bounds2D();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* @author adufilie
*/
public class GeometryMetadata implements StreamObject
public class GeometryMetadata implements IStreamObject
{
public GeometryMetadata(int shapeID, String shapeKey, int shapeType, String projectionWKT)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class GeometryStreamConverter
public static boolean debugTime = true;
public static boolean debugCounts = false;

public GeometryStreamConverter(GeometryStreamDestination destination)
public GeometryStreamConverter(IGeometryStreamDestination destination)
{
this.destination = destination;
}
Expand All @@ -58,10 +58,10 @@ public GeometryStreamConverter(GeometryStreamDestination destination)
public double totalVertexArea = 0;
public double totalQueryArea = 0;

protected final GeometryStreamDestination destination;
protected final IGeometryStreamDestination destination;
protected final SerialIDGenerator shapeIDGenerator = new SerialIDGenerator();
protected int metadataStreamSize = 0;
protected final LinkedList<StreamObject> metadataList = new LinkedList<StreamObject>();
protected final LinkedList<IStreamObject> metadataList = new LinkedList<IStreamObject>();
protected final VertexMap vertexMap = new VertexMap();
protected final Bounds2D partBounds = new Bounds2D();

Expand All @@ -77,7 +77,7 @@ public GeometryStreamConverter(GeometryStreamDestination destination)
* @param projectionWKT Projection info in Well-Known-Text format
* @throws Exception
*/
public void convertFeature(FeatureGeometryStream geomStream, int shapeType, String shapeKey, String projectionWKT) throws Exception
public void convertFeature(IFeatureGeometryStream geomStream, int shapeType, String shapeKey, String projectionWKT) throws Exception
{
// save shape metadata for feature
GeometryMetadata geometryMetadata = new GeometryMetadata(shapeIDGenerator.getNext(), shapeKey, shapeType, projectionWKT);
Expand All @@ -89,7 +89,7 @@ public void convertFeature(FeatureGeometryStream geomStream, int shapeType, Stri
int firstVertexID = 0;
while (geomStream.hasNext())
{
GeometryVertexStream vertexStream = geomStream.getNext();
IGeometryVertexStream vertexStream = geomStream.getNext();
while (vertexStream.hasNext())
{
// copy vertices for this geometry part
Expand Down Expand Up @@ -320,7 +320,7 @@ public void flushGeometryTiles() throws Exception
{
long startTime = System.currentTimeMillis();

LinkedList<StreamObject> streamObjects = vertexMap.getStreamObjects();
LinkedList<IStreamObject> streamObjects = vertexMap.getStreamObjects();
List<StreamTile> tiles = GeometryStreamUtils.groupStreamObjectsIntoTiles(streamObjects, tileSize);

for (StreamTile tile : tiles)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ public static int getShapeTypeFromGeometryType(String geometryType)
* @param tileSize The desired approximate tile size, in bytes.
* @return A list of StreamTile objects which contain the items originally in streamObjectsList.
*/
public static List<StreamTile> groupStreamObjectsIntoTiles(LinkedList<StreamObject> streamObjectsList, int tileSize)
public static List<StreamTile> groupStreamObjectsIntoTiles(LinkedList<IStreamObject> streamObjectsList, int tileSize)
{
// remove stream objects with undefined queryBounds
Iterator<StreamObject> iter = streamObjectsList.iterator();
Iterator<IStreamObject> iter = streamObjectsList.iterator();
while (iter.hasNext())
if (iter.next().getQueryBounds().isUndefined())
iter.remove();

StreamObject[] streamObjects = new StreamObject[streamObjectsList.size()];
IStreamObject[] streamObjects = new IStreamObject[streamObjectsList.size()];
streamObjectsList.toArray(streamObjects);
LinkedList<StreamTile> tiles = new LinkedList<StreamTile>();

Expand All @@ -70,7 +70,7 @@ public static List<StreamTile> groupStreamObjectsIntoTiles(LinkedList<StreamObje
return tiles;

// sort StreamObjects descending by importance
Arrays.sort(streamObjects, 0, streamObjects.length, StreamObject.sortByImportance);
Arrays.sort(streamObjects, 0, streamObjects.length, IStreamObject.sortByImportance);
// iterate over StreamObjects and generate tiles
int thisLevelStartIndex = 0;
int thisLevelEndIndex = 0;
Expand All @@ -96,7 +96,7 @@ public static List<StreamTile> groupStreamObjectsIntoTiles(LinkedList<StreamObje
return tiles;
}

private static void splitStreamObjectsIntoTiles(List<StreamTile> outputTileList, StreamObject[] streamObjects, int startIndex, int endIndex, int tileCount, int totalStreamSize)
private static void splitStreamObjectsIntoTiles(List<StreamTile> outputTileList, IStreamObject[] streamObjects, int startIndex, int endIndex, int tileCount, int totalStreamSize)
{
// do nothing if range is empty
if (startIndex == endIndex)
Expand All @@ -106,7 +106,7 @@ private static void splitStreamObjectsIntoTiles(List<StreamTile> outputTileList,
if (tileCount == 1)
{
// if the stream objects in these tiles are Shape objects, include the shape type in the stream.
StreamObject firstStreamObject = streamObjects[startIndex];
IStreamObject firstStreamObject = streamObjects[startIndex];
if (firstStreamObject instanceof GeometryMetadata)
((GeometryMetadata) firstStreamObject).includeGeometryCollectionMetadataInStream = true;

Expand All @@ -115,7 +115,7 @@ private static void splitStreamObjectsIntoTiles(List<StreamTile> outputTileList,
}

// sort entire range by X
Arrays.sort(streamObjects, startIndex, endIndex, StreamObject.sortByX);
Arrays.sort(streamObjects, startIndex, endIndex, IStreamObject.sortByX);

// find midpoint based on stream size
int middleIndex = startIndex;
Expand All @@ -125,8 +125,8 @@ private static void splitStreamObjectsIntoTiles(List<StreamTile> outputTileList,
int secondHalfStreamSize = totalStreamSize - firstHalfStreamSize;

// sort each half individually by Y
Arrays.sort(streamObjects, startIndex, middleIndex, StreamObject.sortByY);
Arrays.sort(streamObjects, middleIndex, endIndex, StreamObject.sortByY);
Arrays.sort(streamObjects, startIndex, middleIndex, IStreamObject.sortByY);
Arrays.sort(streamObjects, middleIndex, endIndex, IStreamObject.sortByY);

// find firstQuarterIndex based on stream size
int firstQuarterIndex = startIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @author adufilie
*/
public interface FeatureGeometryStream
public interface IFeatureGeometryStream
{
/**
* This function checks whether getNext() will return a GeometryVertexStream or not.
Expand All @@ -36,5 +36,5 @@ public interface FeatureGeometryStream
* This function will get the next GeometryVertexStream.
* @return The next GeometryVertexStream, or null if there are no more.
*/
public GeometryVertexStream getNext();
public IGeometryVertexStream getNext();
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* @author adufilie
*/
public interface GeometryStreamDestination
public interface IGeometryStreamDestination
{
void writeMetadataTiles(List<StreamTile> tiles) throws Exception;
void writeGeometryTiles(List<StreamTile> tiles) throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @author adufilie
*/
public interface GeometryVertexStream
public interface IGeometryVertexStream
{
/**
* This checks if there is a vertex available from the stream without advancing the pointer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* A StreamObject is something that can be sorted in three dimensions (x, y, importance).
* @author adufilie
*/
public interface StreamObject
public interface IStreamObject
{
// write the stream object to a DataOutputStream
public void writeStream(DataOutputStream stream) throws IOException;
Expand All @@ -50,29 +50,29 @@ public interface StreamObject
public double getImportance();

// sort by importance, descending
public static final Comparator<StreamObject> sortByImportance = new Comparator<StreamObject>()
public static final Comparator<IStreamObject> sortByImportance = new Comparator<IStreamObject>()
{
public int compare(StreamObject o1, StreamObject o2)
public int compare(IStreamObject o1, IStreamObject o2)
{
// descending
return - Double.compare(o1.getImportance(), o2.getImportance());
}
};

// sort by x, ascending
public static final Comparator<StreamObject> sortByX = new Comparator<StreamObject>()
public static final Comparator<IStreamObject> sortByX = new Comparator<IStreamObject>()
{
public int compare(StreamObject o1, StreamObject o2)
public int compare(IStreamObject o1, IStreamObject o2)
{
// ascending
return Double.compare(o1.getX(), o2.getX());
}
};

// sort by y, ascending
public static final Comparator<StreamObject> sortByY = new Comparator<StreamObject>()
public static final Comparator<IStreamObject> sortByY = new Comparator<IStreamObject>()
{
public int compare(StreamObject o1, StreamObject o2)
public int compare(IStreamObject o1, IStreamObject o2)
{
// ascending
return Double.compare(o1.getY(), o2.getY());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* @author adufilie
*/
public class PartMarker implements StreamObject
public class PartMarker implements IStreamObject
{
public PartMarker(int shapeID, int firstVertexID, int chainLength, Bounds2D queryBounds)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ public class StreamTile
* @param startIndex The index of the first StreamObject to be included in this tile.
* @param endIndex The index after the last StreamObject to be included in this tile.
*/
public StreamTile(StreamObject[] streamObjects, int startIndex, int endIndex)
public StreamTile(IStreamObject[] streamObjects, int startIndex, int endIndex)
{
this.streamObjects = streamObjects;
this.startIndex = startIndex;
this.endIndex = endIndex;

// sort specified points by importance
Arrays.sort(streamObjects, startIndex, endIndex, StreamObject.sortByImportance);
Arrays.sort(streamObjects, startIndex, endIndex, IStreamObject.sortByImportance);
// save min,max importance values
if (startIndex < endIndex)
{
maxImportance = streamObjects[startIndex].getImportance();
minImportance = streamObjects[endIndex - 1].getImportance();
}
// update both bounds objects to include all the specified CombinedPoints.
StreamObject obj;
IStreamObject obj;
for (int i = startIndex; i < endIndex; i++)
{
obj = streamObjects[i];
Expand All @@ -78,7 +78,7 @@ public String toString() // for debugging
return String.format("ShapeStreamTile(%s StreamObjects, %s bytes, %s, %s)", endIndex - startIndex, bytes, pointBounds, queryBounds);
}

private StreamObject[] streamObjects;
private IStreamObject[] streamObjects;
private int startIndex, endIndex;

public double minImportance = 0, maxImportance = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public void addPoint(int shapeID, VertexChainLink point, double maxImportance, B
* This function retrieves all the CombinedPoint objects that have been generated by calls to addPoint().
* @return A Vector of CombinedPoint objects.
*/
public LinkedList<StreamObject> getStreamObjects()
public LinkedList<IStreamObject> getStreamObjects()
{
LinkedList<StreamObject> result = new LinkedList<StreamObject>(map.values());
LinkedList<IStreamObject> result = new LinkedList<IStreamObject>(map.values());
result.addAll(partMarkers);
return result;
}
Expand Down
Binary file modified WeaveServices/lib/GeometryStreamConverter.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author adufilie
*/
public class JTSFeatureGeometryStream implements FeatureGeometryStream
public class JTSFeatureGeometryStream implements IFeatureGeometryStream
{
public JTSFeatureGeometryStream(Geometry featureGeom)
{
Expand All @@ -52,7 +52,7 @@ public boolean hasNext()
* This function will get the next GeometryVertexStream.
* @return The next GeometryVertexStream, or null if there are no more.
*/
public GeometryVertexStream getNext()
public IGeometryVertexStream getNext()
{
return new JTSGeometryVertexStream(featureGeom.getGeometryN(index++));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* @author adufilie
*/
public class JTSGeometryVertexStream implements GeometryVertexStream
public class JTSGeometryVertexStream implements IGeometryVertexStream
{
public JTSGeometryVertexStream(Geometry geom)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private static void convertFeature(GeometryStreamConverter converter, SimpleFeat
Object attributeObject = feature.getAttribute(keyAttributes.get(attrIndex));
shapeKey += ShapefileUtilities.forAttribute(attributeObject, String.class);
}
FeatureGeometryStream geomStream = new JTSFeatureGeometryStream((Geometry)feature.getDefaultGeometry());
IFeatureGeometryStream geomStream = new JTSFeatureGeometryStream((Geometry)feature.getDefaultGeometry());
converter.convertFeature(geomStream, shapeType, shapeKey, projectionWKT);

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* @author adufilie
*/
public class SQLGeometryStreamDestination implements GeometryStreamDestination
public class SQLGeometryStreamDestination implements IGeometryStreamDestination
{
/**
* @param conn The SQL connection to use to create tables.
Expand Down

0 comments on commit 5e36d9a

Please sign in to comment.