This commit is contained in:
Stephan Richter
2020-11-06 11:32:31 +01:00
parent 5e088deda2
commit 2f9a9d74be
25 changed files with 27 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ public class BlockH extends Block{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from)) return new HashMap<Connector, Turnout.State>();
switch (from) {
case WEST:
return Map.of(new Connector(x+width(),y,Direction.WEST),State.UNDEF);

View File

@@ -13,6 +13,7 @@ public class BlockV extends Block{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from)) return new HashMap<Connector, Turnout.State>();
switch (from) {
case NORTH:
return Map.of(new Connector(x,y+height(),Direction.NORTH),State.UNDEF);

View File

@@ -11,7 +11,7 @@ import de.srsoftware.web4rail.tiles.Turnout.State;
public class ContactH extends Contact {
@Override
public Map<Connector, State> connections(Direction from) {
if (oneWay == from) return new HashMap<>();
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case WEST:
return Map.of(new Connector(x+1,y,from),State.UNDEF);

View File

@@ -12,7 +12,7 @@ public class ContactV extends Contact {
@Override
public Map<Connector, State> connections(Direction from) {
if (oneWay == from) return new HashMap<>();
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x,y+1,from),State.UNDEF);

View File

@@ -13,6 +13,7 @@ public class CrossH extends Cross{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from)) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x+1,y+1,Direction.NORTH),State.UNDEF);
@@ -30,6 +31,7 @@ public class CrossH extends Cross{
@Override
public Map<Connector,State> offsetConnections(Direction from) {
if (isNull(from)) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x,y+1,Direction.NORTH),State.UNDEF);

View File

@@ -11,6 +11,7 @@ public class DiagES extends Tile{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from)) return new HashMap<>();
switch (from) {
case SOUTH:
return Map.of(new Connector(x+1,y,Direction.WEST),State.UNDEF);

View File

@@ -11,6 +11,7 @@ public class DiagNE extends Tile{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from)) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x+1,y,Direction.WEST),State.UNDEF);

View File

@@ -10,6 +10,7 @@ import de.srsoftware.web4rail.tiles.Turnout.State;
public class DiagSW extends Tile{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from)) return new HashMap<>();
switch (from) {
case SOUTH:
return Map.of(new Connector(x-1,y,Direction.EAST),State.UNDEF);

View File

@@ -11,6 +11,8 @@ public class DiagWN extends Tile{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from)) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x-1,y,Direction.EAST),State.UNDEF);

View File

@@ -11,7 +11,7 @@ import de.srsoftware.web4rail.tiles.Turnout.State;
public class SignalE extends Signal{
@Override
public Map<Connector, State> connections(Direction from) {
if (oneWay == from) return new HashMap<>();
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case WEST:
return Map.of(new Connector(x+1,y,Direction.WEST),State.UNDEF);

View File

@@ -12,7 +12,7 @@ public class SignalN extends Signal {
@Override
public Map<Connector, State> connections(Direction from) {
if (oneWay == from) return new HashMap<>();
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x,y+1,Direction.NORTH),State.UNDEF);

View File

@@ -12,7 +12,7 @@ public class SignalS extends Signal{
@Override
public Map<Connector, State> connections(Direction from) {
if (oneWay == from) return new HashMap<>();
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x,y+1,Direction.NORTH),State.UNDEF);

View File

@@ -11,7 +11,7 @@ import de.srsoftware.web4rail.tiles.Turnout.State;
public class SignalW extends Signal{
@Override
public Map<Connector, State> connections(Direction from) {
if (oneWay == from) return new HashMap<>();
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case WEST:
return Map.of(new Connector(x+1,y,Direction.WEST),State.UNDEF);

View File

@@ -12,7 +12,7 @@ public class StraightH extends StretchableTile{
@Override
public Map<Connector, State> connections(Direction from) {
if (oneWay == from) return new HashMap<>();
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case WEST:
return Map.of(new Connector(x+width(),y,Direction.WEST),State.UNDEF);

View File

@@ -12,7 +12,7 @@ public class StraightV extends StretchableTile{
@Override
public Map<Connector, State> connections(Direction from) {
if (oneWay == from) return new HashMap<>();
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x,y+height(),Direction.NORTH),State.UNDEF);

View File

@@ -16,6 +16,7 @@ public class Turnout3E extends Turnout{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case EAST:
return Map.of(

View File

@@ -10,6 +10,7 @@ public class TurnoutLE extends TurnoutL{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case EAST:
return Map.of(new Connector(x,y+1,Direction.NORTH),State.LEFT,new Connector(x-1, y, Direction.EAST),State.STRAIGHT);

View File

@@ -10,6 +10,7 @@ public class TurnoutLN extends TurnoutL{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x,y+1,Direction.NORTH),State.STRAIGHT,new Connector(x+1, y, Direction.WEST),State.LEFT);

View File

@@ -10,6 +10,7 @@ public class TurnoutLS extends TurnoutL{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case SOUTH:
return Map.of(new Connector(x-1,y,Direction.EAST),State.LEFT,new Connector(x, y-1, Direction.SOUTH),State.STRAIGHT);

View File

@@ -10,6 +10,7 @@ public class TurnoutLW extends TurnoutL{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case WEST:
return Map.of(new Connector(x+1,y,Direction.WEST),State.STRAIGHT,new Connector(x, y-1, Direction.SOUTH),State.LEFT);

View File

@@ -10,6 +10,7 @@ public class TurnoutRE extends TurnoutR{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case EAST:
return Map.of(new Connector(x,y-1,Direction.SOUTH),State.RIGHT,new Connector(x-1, y, Direction.EAST),State.STRAIGHT);

View File

@@ -10,6 +10,7 @@ public class TurnoutRN extends TurnoutR{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case NORTH:
return Map.of(new Connector(x-1,y,Direction.EAST),State.RIGHT,new Connector(x, y+1, Direction.NORTH),State.STRAIGHT);

View File

@@ -10,6 +10,7 @@ public class TurnoutRS extends TurnoutR{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case SOUTH:
return Map.of(new Connector(x+1,y,Direction.WEST),State.RIGHT,new Connector(x, y-1, Direction.SOUTH),State.STRAIGHT);

View File

@@ -10,6 +10,7 @@ public class TurnoutRW extends TurnoutR{
@Override
public Map<Connector, State> connections(Direction from) {
if (isNull(from) || oneWay == from) return new HashMap<>();
switch (from) {
case WEST:
return Map.of(new Connector(x+1,y,Direction.WEST),State.STRAIGHT,new Connector(x, y+1, Direction.NORTH),State.RIGHT);