Skip to content

Commit

Permalink
Merge pull request #46 from drekbour/boolean_getters
Browse files Browse the repository at this point in the history
Rename Boolean fields to provide standard isXXX getter
  • Loading branch information
adam-arold authored Nov 22, 2019
2 parents e13eb70 + 3494dfd commit 67dc7e8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface SatelliteData {
*
* @param passable passable?
*/
var passable: Boolean
var isPassable: Boolean

/**
* @return true if the [Hexagon] can bee seen through, false otherwise.
Expand All @@ -27,7 +27,7 @@ interface SatelliteData {
*
* @param opaque is opaque?
*/
var opaque: Boolean
var isOpaque: Boolean

/**
* Returns the movement cost when moving over the Hexagon.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import org.hexworks.mixite.core.api.contract.SatelliteData
* Convenience class implementing SatelliteData.
*/
open class DefaultSatelliteData(
override var passable: Boolean = false,
override var opaque: Boolean = false,
override var isPassable: Boolean = false,
override var isOpaque: Boolean = false,
override var movementCost: Double = 0.toDouble()) : SatelliteData
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class HexagonalGridCalculatorImpl<T : SatelliteData>(private val hexagonalGrid:
if (pathHexagon.equals(from) || pathHexagon.equals(to)) {
continue
}
if (pathHexagon.satelliteData.isPresent && pathHexagon.satelliteData.get().opaque) {
if (pathHexagon.satelliteData.isPresent && pathHexagon.satelliteData.get().isOpaque) {
return false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ class DefaultSatelliteDataTest {

@Test
fun shouldProperlySetAndGetIsPassable() {
target.passable = EXPECTED_IS_PASSABLE
assertEquals(EXPECTED_IS_PASSABLE, target.passable)
target.isPassable = EXPECTED_IS_PASSABLE
assertEquals(EXPECTED_IS_PASSABLE, target.isPassable)
}

@Test
fun shouldProperlySetAndGetIsBlocksView() {
target.opaque = EXPECTED_IS_BLOCKS_VIEW
assertEquals(EXPECTED_IS_BLOCKS_VIEW, target.opaque)
target.isOpaque = EXPECTED_IS_BLOCKS_VIEW
assertEquals(EXPECTED_IS_BLOCKS_VIEW, target.isOpaque)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class HexagonalGridCalculatorImplTest {

val hexagon = grid.getByCubeCoordinate(fromCoordinates(2, 5))
val data = DefaultSatelliteData()
data.opaque = true
data.isOpaque = true
hexagon.get().setSatelliteData(data)

assertFalse {
Expand Down

0 comments on commit 67dc7e8

Please sign in to comment.