diff --git a/src/main/java/util/dimensiontree/DimensionTreeError.java b/src/main/java/gov/hhs/aspr/ms/util/dimensiontree/DimensionTreeError.java similarity index 81% rename from src/main/java/util/dimensiontree/DimensionTreeError.java rename to src/main/java/gov/hhs/aspr/ms/util/dimensiontree/DimensionTreeError.java index 0563f00..1827780 100644 --- a/src/main/java/util/dimensiontree/DimensionTreeError.java +++ b/src/main/java/gov/hhs/aspr/ms/util/dimensiontree/DimensionTreeError.java @@ -1,7 +1,7 @@ -package util.dimensiontree; +package gov.hhs.aspr.ms.util.dimensiontree; -import util.errors.ContractError; -import util.errors.ContractException; +import gov.hhs.aspr.ms.util.errors.ContractError; +import gov.hhs.aspr.ms.util.errors.ContractException; /** * An enumeration supporting {@link ContractException} that acts as a general diff --git a/src/main/java/util/dimensiontree/VolumetricDimensionTree.java b/src/main/java/gov/hhs/aspr/ms/util/dimensiontree/VolumetricDimensionTree.java similarity index 99% rename from src/main/java/util/dimensiontree/VolumetricDimensionTree.java rename to src/main/java/gov/hhs/aspr/ms/util/dimensiontree/VolumetricDimensionTree.java index 9b23706..333b8e6 100644 --- a/src/main/java/util/dimensiontree/VolumetricDimensionTree.java +++ b/src/main/java/gov/hhs/aspr/ms/util/dimensiontree/VolumetricDimensionTree.java @@ -1,4 +1,4 @@ -package util.dimensiontree; +package gov.hhs.aspr.ms.util.dimensiontree; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/util/earth/Earth.java b/src/main/java/gov/hhs/aspr/ms/util/earth/Earth.java similarity index 98% rename from src/main/java/util/earth/Earth.java rename to src/main/java/gov/hhs/aspr/ms/util/earth/Earth.java index 5f5fc43..72ed877 100644 --- a/src/main/java/util/earth/Earth.java +++ b/src/main/java/gov/hhs/aspr/ms/util/earth/Earth.java @@ -1,8 +1,8 @@ -package util.earth; +package gov.hhs.aspr.ms.util.earth; import org.apache.commons.math3.util.FastMath; -import util.vector.Vector3D; +import gov.hhs.aspr.ms.util.vector.Vector3D; /** * A spherical geo-model for converting various coordinate representations and diff --git a/src/main/java/util/earth/EarthGrid.java b/src/main/java/gov/hhs/aspr/ms/util/earth/EarthGrid.java similarity index 93% rename from src/main/java/util/earth/EarthGrid.java rename to src/main/java/gov/hhs/aspr/ms/util/earth/EarthGrid.java index d6b60c5..16fdef7 100644 --- a/src/main/java/util/earth/EarthGrid.java +++ b/src/main/java/gov/hhs/aspr/ms/util/earth/EarthGrid.java @@ -1,10 +1,10 @@ -package util.earth; +package gov.hhs.aspr.ms.util.earth; import org.apache.commons.math3.util.FastMath; -import util.vector.MutableVector3D; -import util.vector.Vector2D; -import util.vector.Vector3D; +import gov.hhs.aspr.ms.util.vector.MutableVector3D; +import gov.hhs.aspr.ms.util.vector.Vector2D; +import gov.hhs.aspr.ms.util.vector.Vector3D; /** * A utility class for converting (x,y) two dimensional grid coordinates to and diff --git a/src/main/java/util/earth/LatLon.java b/src/main/java/gov/hhs/aspr/ms/util/earth/LatLon.java similarity index 98% rename from src/main/java/util/earth/LatLon.java rename to src/main/java/gov/hhs/aspr/ms/util/earth/LatLon.java index f010123..8a921f1 100644 --- a/src/main/java/util/earth/LatLon.java +++ b/src/main/java/gov/hhs/aspr/ms/util/earth/LatLon.java @@ -1,4 +1,4 @@ -package util.earth; +package gov.hhs.aspr.ms.util.earth; import net.jcip.annotations.Immutable; diff --git a/src/main/java/util/earth/LatLonAlt.java b/src/main/java/gov/hhs/aspr/ms/util/earth/LatLonAlt.java similarity index 98% rename from src/main/java/util/earth/LatLonAlt.java rename to src/main/java/gov/hhs/aspr/ms/util/earth/LatLonAlt.java index 13243ce..8b30cc5 100644 --- a/src/main/java/util/earth/LatLonAlt.java +++ b/src/main/java/gov/hhs/aspr/ms/util/earth/LatLonAlt.java @@ -1,6 +1,6 @@ -package util.earth; +package gov.hhs.aspr.ms.util.earth; -import util.vector.Vector3D; +import gov.hhs.aspr.ms.util.vector.Vector3D; public class LatLonAlt { diff --git a/src/main/java/util/errors/ContractError.java b/src/main/java/gov/hhs/aspr/ms/util/errors/ContractError.java similarity index 86% rename from src/main/java/util/errors/ContractError.java rename to src/main/java/gov/hhs/aspr/ms/util/errors/ContractError.java index 9a3f81d..e9a773e 100644 --- a/src/main/java/util/errors/ContractError.java +++ b/src/main/java/gov/hhs/aspr/ms/util/errors/ContractError.java @@ -1,5 +1,5 @@ -package util.errors; +package gov.hhs.aspr.ms.util.errors; /** * Marker interface for the descriptions of runtime exceptions where the source diff --git a/src/main/java/util/errors/ContractException.java b/src/main/java/gov/hhs/aspr/ms/util/errors/ContractException.java similarity index 97% rename from src/main/java/util/errors/ContractException.java rename to src/main/java/gov/hhs/aspr/ms/util/errors/ContractException.java index fa98fd3..f93a3e9 100644 --- a/src/main/java/util/errors/ContractException.java +++ b/src/main/java/gov/hhs/aspr/ms/util/errors/ContractException.java @@ -1,4 +1,4 @@ -package util.errors; +package gov.hhs.aspr.ms.util.errors; /** * A {@link RuntimeException} that indicates that the cause of the error as a diff --git a/src/main/java/util/geolocator/GeoLocator.java b/src/main/java/gov/hhs/aspr/ms/util/geolocator/GeoLocator.java similarity index 96% rename from src/main/java/util/geolocator/GeoLocator.java rename to src/main/java/gov/hhs/aspr/ms/util/geolocator/GeoLocator.java index 5768131..8f74c72 100644 --- a/src/main/java/util/geolocator/GeoLocator.java +++ b/src/main/java/gov/hhs/aspr/ms/util/geolocator/GeoLocator.java @@ -1,4 +1,4 @@ -package util.geolocator; +package gov.hhs.aspr.ms.util.geolocator; import java.util.ArrayList; import java.util.Comparator; @@ -9,11 +9,11 @@ import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.Pair; -import util.dimensiontree.DimensionTree; -import util.earth.Earth; -import util.earth.LatLonAlt; -import util.vector.Vector2D; -import util.vector.Vector3D; +import gov.hhs.aspr.ms.util.dimensiontree.DimensionTree; +import gov.hhs.aspr.ms.util.earth.Earth; +import gov.hhs.aspr.ms.util.earth.LatLonAlt; +import gov.hhs.aspr.ms.util.vector.Vector2D; +import gov.hhs.aspr.ms.util.vector.Vector3D; /** * A generics-based utility class for managing point locations on a spherical diff --git a/src/main/java/util/graph/Graph.java b/src/main/java/gov/hhs/aspr/ms/util/graph/Graph.java similarity index 99% rename from src/main/java/util/graph/Graph.java rename to src/main/java/gov/hhs/aspr/ms/util/graph/Graph.java index d05daa7..edc59d9 100644 --- a/src/main/java/util/graph/Graph.java +++ b/src/main/java/gov/hhs/aspr/ms/util/graph/Graph.java @@ -1,4 +1,4 @@ -package util.graph; +package gov.hhs.aspr.ms.util.graph; import java.util.List; diff --git a/src/main/java/util/graph/GraphDepthEvaluator.java b/src/main/java/gov/hhs/aspr/ms/util/graph/GraphDepthEvaluator.java similarity index 98% rename from src/main/java/util/graph/GraphDepthEvaluator.java rename to src/main/java/gov/hhs/aspr/ms/util/graph/GraphDepthEvaluator.java index 58cd4fd..292e56c 100644 --- a/src/main/java/util/graph/GraphDepthEvaluator.java +++ b/src/main/java/gov/hhs/aspr/ms/util/graph/GraphDepthEvaluator.java @@ -1,4 +1,4 @@ -package util.graph; +package gov.hhs.aspr.ms.util.graph; import java.util.ArrayList; import java.util.LinkedHashMap; diff --git a/src/main/java/util/graph/Graphs.java b/src/main/java/gov/hhs/aspr/ms/util/graph/Graphs.java similarity index 98% rename from src/main/java/util/graph/Graphs.java rename to src/main/java/gov/hhs/aspr/ms/util/graph/Graphs.java index fa98005..f495e59 100644 --- a/src/main/java/util/graph/Graphs.java +++ b/src/main/java/gov/hhs/aspr/ms/util/graph/Graphs.java @@ -1,4 +1,4 @@ -package util.graph; +package gov.hhs.aspr.ms.util.graph; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -9,8 +9,8 @@ import java.util.Optional; import java.util.Set; -import util.path.Path; -import util.path.Paths; +import gov.hhs.aspr.ms.util.path.Path; +import gov.hhs.aspr.ms.util.path.Paths; public final class Graphs { diff --git a/src/main/java/util/graph/MutableGraph.java b/src/main/java/gov/hhs/aspr/ms/util/graph/MutableGraph.java similarity index 99% rename from src/main/java/util/graph/MutableGraph.java rename to src/main/java/gov/hhs/aspr/ms/util/graph/MutableGraph.java index 2210d0e..62d9090 100644 --- a/src/main/java/util/graph/MutableGraph.java +++ b/src/main/java/gov/hhs/aspr/ms/util/graph/MutableGraph.java @@ -1,4 +1,4 @@ -package util.graph; +package gov.hhs.aspr.ms.util.graph; import java.util.ArrayList; import java.util.LinkedHashMap; diff --git a/src/main/java/gov/hhs/aspr/ms/util/indexer/Indexer2.java b/src/main/java/gov/hhs/aspr/ms/util/indexer/Indexer2.java new file mode 100644 index 0000000..f286f07 --- /dev/null +++ b/src/main/java/gov/hhs/aspr/ms/util/indexer/Indexer2.java @@ -0,0 +1,63 @@ +package gov.hhs.aspr.ms.util.indexer; + +import gov.hhs.aspr.ms.util.errors.ContractException; +import net.jcip.annotations.ThreadSafe; + +/** + * A thread safe, immutable index converter that supports treating a 2D array as + * a 1D array. + */ + +@ThreadSafe +public final class Indexer2 { + + private final int size; + + private final int p1; + + /** + * Constructs an 2D indexer from the given dimension sizes + * + * @throws ContractException + *