Class MRVMRegionsMap
- java.lang.Object
-
- org.spectrumauctions.sats.core.model.mrvm.MRVMRegionsMap
-
- All Implemented Interfaces:
java.io.Serializable
public class MRVMRegionsMap extends java.lang.Object implements java.io.Serializable- Author:
- Michael Weiss
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMRVMRegionsMap.Region
-
Constructor Summary
Constructors Constructor Description MRVMRegionsMap(MRVMWorldSetup worldStructure, RNGSupplier rngSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<MRVMRegionsMap.Region>adjacentRegions(MRVMRegionsMap.Region region)booleanareAdjacent(MRVMRegionsMap.Region region, MRVMRegionsMap.Region otherRegion)booleanequals(java.lang.Object obj)intgetDistance(MRVMRegionsMap.Region regionOne, MRVMRegionsMap.Region regionTwo)Calculates the distance between two regions in this map.
Distance is defined as the length of the shortest path in a graph representation of this map, where two regions share an edge if and only if they are adjacent.intgetLongestShortestPath(MRVMRegionsMap.Region region)Returns the length of the longest shortest path in the adjacency graph between the specified region and any other region.intgetNumberOfRegions()MRVMRegionsMap.RegiongetRegion(int id)java.util.Set<MRVMRegionsMap.Region>getRegions()inthashCode()
-
-
-
Constructor Detail
-
MRVMRegionsMap
public MRVMRegionsMap(MRVMWorldSetup worldStructure, RNGSupplier rngSupplier)
-
-
Method Detail
-
getLongestShortestPath
public int getLongestShortestPath(MRVMRegionsMap.Region region)
Returns the length of the longest shortest path in the adjacency graph between the specified region and any other region.
-
adjacentRegions
public java.util.Set<MRVMRegionsMap.Region> adjacentRegions(MRVMRegionsMap.Region region)
-
areAdjacent
public boolean areAdjacent(MRVMRegionsMap.Region region, MRVMRegionsMap.Region otherRegion)
- Returns:
- true if two regions is adjacent, i.e., if they share a border.
-
getDistance
public int getDistance(MRVMRegionsMap.Region regionOne, MRVMRegionsMap.Region regionTwo)
Calculates the distance between two regions in this map.
Distance is defined as the length of the shortest path in a graph representation of this map, where two regions share an edge if and only if they are adjacent. All edges have weight / lenght 1.
If no path was found,getNumberOfRegions()-1 is returned.
-
getRegions
public java.util.Set<MRVMRegionsMap.Region> getRegions()
-
getNumberOfRegions
public int getNumberOfRegions()
-
getRegion
public MRVMRegionsMap.Region getRegion(int id)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-