You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
898 B
41 lines
898 B
package de.srsoftware.web4rail.tiles; |
|
|
|
import java.io.IOException; |
|
import java.util.Map; |
|
import java.util.Vector; |
|
|
|
import de.srsoftware.tools.Tag; |
|
import de.srsoftware.web4rail.Plan.Direction; |
|
|
|
public abstract class Signal extends Tile{ |
|
|
|
public static final String STOP = "stop"; |
|
public static final String GO = "go"; |
|
private String state = STOP; |
|
|
|
public Signal() { |
|
super(); |
|
} |
|
|
|
@Override |
|
protected Vector<String> classes() { |
|
Vector<String> classes = super.classes(); |
|
classes.add("signal"); |
|
return classes; |
|
} |
|
|
|
public abstract boolean isAffectedFrom(Direction dir); |
|
|
|
public boolean state(String state) throws IOException { |
|
this.state = state; |
|
plan.stream("place "+tag(null)); |
|
return true; |
|
} |
|
|
|
@Override |
|
public Tag tag(Map<String, Object> replacements) throws IOException { |
|
Tag tag = super.tag(replacements); |
|
tag.clazz(tag.get("class")+" "+state); |
|
return tag; |
|
} |
|
}
|
|
|