| 4 | import java.util.HashSet; |
| 5 | |
| 6 | public abstract class ArraySetting<T> extends Setting<String> |
| 7 | { |
| 8 | protected ConfigBase config; |
| 9 | protected String value; |
| 10 | |
| 11 | public ArraySetting(String path, String def, String description, ConfigBase config) |
| 12 | { |
| 13 | super(path, def, description); |
| 14 | this.value = def; |
| 15 | this.config = config; |
| 16 | this.initArr(def); |
| 17 | } |
| 18 | |
| 19 | protected HashSet<T> value_set; |
| 20 | protected ArrayList<T> value_array; |
| 21 | |
| 22 | @Override |
| 23 | public final String getValue() |
| 24 | { |
| 25 | return this.value; |
| 26 | } |
| 27 | |
| 28 | @Override |
| 29 | public final void setValue(String value) |
| 30 | { |
| 31 | this.config.set(path, this.value = value); |
| 32 | this.value_set.clear(); |
| 33 | this.value_array.clear(); |
| 34 | this.initArr(value); |
| 35 | } |
| 36 | |
| 37 | |
| 38 | public boolean contains(T t) |
| 39 | { |
| 40 | return this.value_set.contains(t); |
| 41 | } |
| 42 | |
| 43 | public T get(int i) |
| 44 | { |
| 45 | if(i < 0 || i > this.value_array.size() - 1) { |
| 46 | return null; |
| 47 | } |
| 48 | |
| 49 | return this.value_array.get(i); |
| 50 | |
| 51 | } |
| 52 | |
| 53 | public abstract void initArr(String array); |
| 54 | |
| 55 | } |
nothing calls this directly
no outgoing calls
no test coverage detected