Package squidpony.squidgrid
Class Adjacency.BasicAdjacency
java.lang.Object
squidpony.squidgrid.Adjacency
squidpony.squidgrid.Adjacency.BasicAdjacency
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Adjacency.ThinWallAdjacency
- Enclosing class:
- Adjacency
public static class Adjacency.BasicAdjacency extends Adjacency implements Serializable
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class squidpony.squidgrid.Adjacency
Adjacency.BasicAdjacency, Adjacency.RotationAdjacency, Adjacency.ThinWallAdjacency
-
Field Summary
Fields inherited from class squidpony.squidgrid.Adjacency
blockingRule, costRules, depths, directions, height, invertAdjacent, maxAdjacent, measurement, rotations, standardCost, twoStepRule, width
-
Constructor Summary
Constructors Constructor Description BasicAdjacency(int width, int height, Measurement metric)
-
Method Summary
Modifier and Type Method Description IntDoubleOrderedMap
addCostRule(char tile, double cost, boolean isRotation)
int
composite(int x, int y, int r, int n)
Encodes up to four components used by this Adjacency, putting them into one int.int
extractN(int data)
int
extractR(int data)
int
extractX(int data)
int
extractY(int data)
boolean
isBlocked(int start, int direction, int[][][] neighbors, double[] map, double wall)
int
move(int start, int x, int y)
int[][][]
neighborMaps()
void
portal(int[][][] neighbors, int inputPortal, int outputPortal, boolean twoWay)
IntDoubleOrderedMap
putAllVariants(IntDoubleOrderedMap map, int key, double value, int size)
void
putAllVariants(IntVLA list, double[] map, int key, double value, int size)
void
resetAllVariants(double[] map, int[] keys, int usable, double[] values, int size)
boolean
validate(int data)
Methods inherited from class squidpony.squidgrid.Adjacency
addCostRule, extractCoord, hasStandardCost, move, putAllVariants, putAllVariants, resetAllVariants, resetAllVariants, show, showMap
-
Constructor Details
-
Method Details
-
extractX
-
extractY
-
extractR
-
extractN
-
composite
Description copied from class:Adjacency
Encodes up to four components used by this Adjacency, putting them into one int. Returns -1 if the encoded position is out of bounds or otherwise invalid, otherwise any int is possible. You can get the individual values withAdjacency.extractX(int)
,Adjacency.extractY(int)
,Adjacency.extractR(int)
, andAdjacency.extractN(int)
, though not all implementations use R and N.- Specified by:
composite
in classAdjacency
- Parameters:
x
- the x component to encodey
- the y component to encoder
- the rotation component to encode; not all implementations use rotation and the max value variesn
- the bonus component to encode; this can be used for height or other extra data in some implementations- Returns:
- the encoded position as an int; -1 if invalid, non-negative for valid positions
-
move
-
validate
-
neighborMaps
- Specified by:
neighborMaps
in classAdjacency
-
isBlocked
-
portal
-
addCostRule
- Specified by:
addCostRule
in classAdjacency
-
putAllVariants
public IntDoubleOrderedMap putAllVariants(IntDoubleOrderedMap map, int key, double value, int size)- Specified by:
putAllVariants
in classAdjacency
-
putAllVariants
- Specified by:
putAllVariants
in classAdjacency
-
resetAllVariants
- Specified by:
resetAllVariants
in classAdjacency
-