lphystudio.app.cmd.Arguments 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.cmd;
import lphy.core.model.Value;
import java.util.Map;
/**
* Created by Alexei Drummond on 10/03/20.
*/
public class Arguments {
Map> arguments;
public Arguments(Map> arguments) {
this.arguments = arguments;
}
public boolean getBoolean(String name, Object defaultValue) {
Value> val = arguments.get(name);
if (val == null) return (Boolean)defaultValue;
return (Boolean)val.value();
}
public int getInteger(String name, Object defaultValue) {
Value> val = arguments.get(name);
if (val == null) return (Integer)defaultValue;
return (Integer) val.value();
}
public double getDouble(String name, Object defaultValue) {
Value> val = arguments.get(name);
if (val == null) return (Double)defaultValue;
return (Double) val.value();
}
public String getString(String name, Object defaultValue) {
Value> val = arguments.get(name);
if (val == null) return defaultValue.toString();
return (String) val.value();
}
}