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

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.srsoftware</groupId> <groupId>de.srsoftware</groupId>
<artifactId>web4rail</artifactId> <artifactId>web4rail</artifactId>
<version>0.10.8s</version> <version>0.10.9</version>
<name>Web4Rail</name> <name>Web4Rail</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<description>Java Model Railway Control</description> <description>Java Model Railway Control</description>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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