lphystudio.app.graphicalmodelpanel.GraphicalModelParserDictionary Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lphy-studio Show documentation
Show all versions of lphy-studio Show documentation
The GUI for LPhy language.
The newest version!
package lphystudio.app.graphicalmodelpanel;
import lphy.core.exception.SimulatorParsingException;
import lphy.core.parser.REPL;
import lphy.core.parser.graphicalmodel.GraphicalModelChangeListener;
import java.util.ArrayList;
import java.util.List;
/**
* Extend {@link REPL} with adding {@link GraphicalModelChangeListener}.
* @author Alexei Drummond
*/
public class GraphicalModelParserDictionary extends REPL {
List listeners = new ArrayList<>();
@Override
public void parse(String code) throws SimulatorParsingException,IllegalArgumentException {
super.parse(code);
notifyListeners();
}
@Override
public void clear() {
super.clear();
notifyListeners();
}
public void addGraphicalModelChangeListener(GraphicalModelChangeListener listener) {
listeners.add(listener);
}
public void notifyListeners() {
for (GraphicalModelChangeListener listener : listeners) {
listener.modelChanged();
}
}
}