added push-pull train condition
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.srsoftware</groupId>
|
||||
<artifactId>web4rail</artifactId>
|
||||
<version>0.9.14</version>
|
||||
<version>0.9.15</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -13,6 +13,7 @@ Apply : Übernehmen
|
||||
Cars\: : Waggons:
|
||||
ConditionalAction : bedingte Aktion
|
||||
Conditions : Bedingungen
|
||||
Condition type\: : Bedingungs-Typ:
|
||||
Control unit : Zentrale
|
||||
Current location\: : Aktueller Ort:
|
||||
Actions and contacts : Aktionen und Kontakte
|
||||
@@ -46,6 +47,7 @@ PowerOff : Strom abschalten
|
||||
Properties : Eigenschaften
|
||||
Properties of {} : Eigenschaften von {}
|
||||
Properties of {} @ ({},{}) : Eigenschaften von {} @ ({},{})
|
||||
PushPullTrain : Wendezug
|
||||
Push-pull train : Wendezug
|
||||
Reduce speed to {} km/h : Geschwindigkeit auf {} km/h reduzieren
|
||||
Report Issue : Problem melden
|
||||
@@ -66,7 +68,9 @@ Toggle power : Stom an/ausschalten
|
||||
Train\: : Zug:
|
||||
train does not have tag "{}" : Zug hat keine Markierung „{}“
|
||||
train has tag "{}" : Zug hat Markierung „{}“
|
||||
train is a push-pull train : Zug ist ein Wendezug
|
||||
train is longer than {} : Zug ist länger als {}
|
||||
train is not a push-pull train : Zug ist kein Wendezug
|
||||
train is shorter than {} : Zug ist kürzer als {}
|
||||
Trains : Züge
|
||||
Trains\: : Züge:
|
||||
|
||||
@@ -92,7 +92,11 @@ public abstract class Condition implements Constants {
|
||||
}
|
||||
|
||||
private static List<Class<? extends Condition>> list() {
|
||||
return List.of(TrainHasTag.class,TrainSelect.class,TrainLength.class);
|
||||
return List.of(
|
||||
PushPullTrain.class,
|
||||
TrainHasTag.class,
|
||||
TrainSelect.class,
|
||||
TrainLength.class);
|
||||
}
|
||||
|
||||
public Tag propForm(HashMap<String, String> params) {
|
||||
@@ -122,7 +126,7 @@ public abstract class Condition implements Constants {
|
||||
}
|
||||
|
||||
for (Entry<String, String> entry : names.entrySet()) select.addOption(entry.getValue(), entry.getKey());
|
||||
return select.addTo(new Label(t("Action type:")+NBSP));
|
||||
return select.addTo(new Label(t("Condition type:")+NBSP));
|
||||
}
|
||||
|
||||
public static String t(String text, Object...fills) {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package de.srsoftware.web4rail.conditions;
|
||||
|
||||
import de.srsoftware.web4rail.actions.Action.Context;
|
||||
|
||||
public class PushPullTrain extends Condition {
|
||||
|
||||
@Override
|
||||
public boolean fulfilledBy(Context context) {
|
||||
return context.train.pushPull != inverted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return t(inverted ? "train is not a push-pull train":"train is a push-pull train") ;
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class Train implements Comparable<Train>,Constants {
|
||||
private Direction direction;
|
||||
|
||||
private static final String PUSH_PULL = "pushPull";
|
||||
private boolean pushPull = false;
|
||||
public boolean pushPull = false;
|
||||
|
||||
private static final String CARS = "cars";
|
||||
private Vector<Car> cars = new Vector<Car>();
|
||||
|
||||
Reference in New Issue
Block a user