Implementing the Key Data Structures of The Leola Programming Language in Java Class Libraries
public class Variable {
private Object value;
public Variable(Object value) {
this.value = value;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
}
import java.util.ArrayList;
import java.util.List;
public class LeolaList {
private List<Variable> list;
public LeolaList() {
list = new ArrayList<>();
}
public void add(Variable element) {
list.add(element);
}
public Variable get(int index) {
return list.get(index);
}
public int size() {
return list.size();
}
}
import java.util.HashMap;
import java.util.Map;
public class LeolaMap {
private Map<String, Variable> map;
public LeolaMap() {
map = new HashMap<>();
}
public void put(String key, Variable value) {
map.put(key, value);
}
public Variable get(String key) {
return map.get(key);
}
public int size() {
return map.size();
}
}