Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Boolean fields to provide standard isXXX getter #46

Merged
merged 1 commit into from
Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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