[New] Added new IntegerListTimedState and co.
This commit is contained in:
parent
ee2c756dbf
commit
e9e6c0b22a
|
@ -82,6 +82,9 @@ public class ModelGenerator {
|
|||
public static final String STATE_FLOAT_LIST_ID = "@state5";
|
||||
public static final String STATE_FLOAT_LIST_NAME = "Float List State";
|
||||
|
||||
public static final String STATE_INTEGER_LIST_ID = "@state6";
|
||||
public static final String STATE_INTEGER_LIST_NAME = "Integer List State";
|
||||
|
||||
public static final String STATE_INTEGER_ID = "@state2";
|
||||
public static final String STATE_INTEGER_NAME = "Integer State";
|
||||
|
||||
|
@ -172,6 +175,15 @@ public class ModelGenerator {
|
|||
floatListTimedState.applyChange(new ValueChange<>(STATE_TIME_30, floatListValueChange), true);
|
||||
resource.addTimedState(floatListTimedState);
|
||||
|
||||
// integer list state
|
||||
IntegerListTimedState intListTimedState = new IntegerListTimedState(STATE_INTEGER_LIST_ID,
|
||||
STATE_INTEGER_LIST_NAME);
|
||||
intListTimedState.applyChange(new ValueChange<>(STATE_TIME_0, new IntegerListValue(STATE_INTEGER_TIME_0)),
|
||||
true);
|
||||
IntegerListValue intListValueChange = new IntegerListValue(STATE_INTEGER_TIME_10, STATE_INTEGER_TIME_20);
|
||||
intListTimedState.applyChange(new ValueChange<>(STATE_TIME_30, intListValueChange), true);
|
||||
resource.addTimedState(intListTimedState);
|
||||
|
||||
// integer state
|
||||
IntegerTimedState integerTimedState = new IntegerTimedState(STATE_INTEGER_ID, STATE_INTEGER_NAME);
|
||||
integerTimedState.applyChange(new ValueChange<>(STATE_TIME_0, new IntegerValue(STATE_INTEGER_TIME_0)), true);
|
||||
|
@ -444,8 +456,6 @@ public class ModelGenerator {
|
|||
* <li>DateParameter - 1354295525628L</li>
|
||||
* <li>StringListParameter - Hello, World</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param bag
|
||||
*/
|
||||
public static void addAllParameters(ParameterBag bag) {
|
||||
|
||||
|
|
|
@ -416,14 +416,12 @@ public enum StrolchValueType {
|
|||
|
||||
@Override
|
||||
public StrolchTimedState<? extends IValue<?>> timedStateInstance() {
|
||||
throw new UnsupportedOperationException(
|
||||
MessageFormat.format("TimeStates of type {0} are not supported!", getType())); //$NON-NLS-1$
|
||||
return new IntegerListTimedState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IValue<?> valueInstance(String valueAsString) {
|
||||
throw new UnsupportedOperationException(
|
||||
MessageFormat.format("Parameters of type {0} are not supported!", getType())); //$NON-NLS-1$
|
||||
return new IntegerListValue(valueAsString);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -54,6 +54,12 @@ public class ResourceBuilder extends RootElementBuilder<ResourceBuilder> {
|
|||
return builder;
|
||||
}
|
||||
|
||||
public IntegerListStateBuilder integerListState(String id, String name) {
|
||||
IntegerListStateBuilder builder = new IntegerListStateBuilder(this, id, name);
|
||||
this.timedStates.add(builder);
|
||||
return builder;
|
||||
}
|
||||
|
||||
public StringSetStateBuilder stringSetState(String id, String name) {
|
||||
StringSetStateBuilder builder = new StringSetStateBuilder(this, id, name);
|
||||
this.timedStates.add(builder);
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package li.strolch.model.builder.states;
|
||||
|
||||
import li.strolch.model.builder.ResourceBuilder;
|
||||
import li.strolch.model.timedstate.IntegerListTimedState;
|
||||
import li.strolch.model.timevalue.impl.IntegerListValue;
|
||||
|
||||
public class IntegerListStateBuilder extends TimedStateBuilder<IntegerListTimedState> {
|
||||
|
||||
public IntegerListStateBuilder(ResourceBuilder builder, String id, String name) {
|
||||
super(builder, id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegerListTimedState build() {
|
||||
IntegerListTimedState state = new IntegerListTimedState();
|
||||
build(state);
|
||||
state.getTimeEvolution().setValueAt(0L, new IntegerListValue());
|
||||
return state;
|
||||
}
|
||||
}
|
|
@ -355,6 +355,13 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
return stateToJsonFull(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement visitIntegerListState(IntegerListTimedState state) {
|
||||
if (isFlat())
|
||||
return stateToJsonFlat(state);
|
||||
return stateToJsonFull(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement visitIntegerState(IntegerTimedState state) {
|
||||
if (isFlat())
|
||||
|
|
|
@ -68,11 +68,11 @@ public interface ITimedState<T extends IValue> {
|
|||
*
|
||||
* @return true if this element is read only
|
||||
*/
|
||||
public boolean isReadonly();
|
||||
boolean isReadonly();
|
||||
|
||||
/**
|
||||
* Sets this element to readOnly, so that it may not be modified. To modify it, call <code>getClone()</code> on the
|
||||
* parent
|
||||
*/
|
||||
public void setReadonly();
|
||||
void setReadonly();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.model.timedstate;
|
||||
|
||||
import li.strolch.model.StrolchValueType;
|
||||
import li.strolch.model.timevalue.impl.IntegerListValue;
|
||||
import li.strolch.model.visitor.StrolchElementVisitor;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
public class IntegerListTimedState extends AbstractStrolchTimedState<IntegerListValue> {
|
||||
|
||||
public IntegerListTimedState() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IntegerListTimedState(String id, String name) {
|
||||
super(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStateFromStringAt(Long time, String value) {
|
||||
assertNotReadonly();
|
||||
getTimeEvolution().setValueAt(time, new IntegerListValue(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return StrolchValueType.INTEGER_LIST.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrolchValueType getValueType() {
|
||||
return StrolchValueType.INTEGER_LIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <U> U accept(StrolchElementVisitor<U> visitor) {
|
||||
return visitor.visitIntegerListState(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegerListTimedState getClone() {
|
||||
IntegerListTimedState clone = new IntegerListTimedState();
|
||||
fillClone(clone);
|
||||
return clone;
|
||||
}
|
||||
}
|
|
@ -15,9 +15,6 @@
|
|||
*/
|
||||
package li.strolch.model.timedstate;
|
||||
|
||||
import static java.util.Spliterators.spliteratorUnknownSize;
|
||||
import static java.util.stream.StreamSupport.stream;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.NavigableSet;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class FloatListValue implements IValue<List<Double>>, Serializable {
|
|||
|
||||
public static final FloatListValue NEUTRAL = new FloatListValue(0.0d);
|
||||
|
||||
private List<Double> value;
|
||||
private final List<Double> value;
|
||||
|
||||
public FloatListValue(Double value) {
|
||||
this.value = Collections.singletonList(value);
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
/*
|
||||
* Copyright 2022 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.model.timevalue.impl;
|
||||
|
||||
import static li.strolch.model.parameter.ListParameter.VALUE_SEPARATOR2;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import li.strolch.model.StrolchValueType;
|
||||
import li.strolch.model.timevalue.ITimeValue;
|
||||
import li.strolch.model.timevalue.IValue;
|
||||
import li.strolch.utils.helper.StringHelper;
|
||||
|
||||
/**
|
||||
* {@link IValue} implementation to work with Integer valued {@link ITimeValue} objects
|
||||
*
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
public class IntegerListValue implements IValue<List<Integer>>, Serializable {
|
||||
|
||||
public static final IntegerListValue NEUTRAL = new IntegerListValue(0);
|
||||
|
||||
private final List<Integer> value;
|
||||
|
||||
public IntegerListValue(Integer value) {
|
||||
this.value = Collections.singletonList(value);
|
||||
}
|
||||
|
||||
public IntegerListValue(int... values) {
|
||||
List<Integer> value = new ArrayList<>();
|
||||
for (Integer aInteger : values) {
|
||||
value.add(aInteger);
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public IntegerListValue(List<Integer> values) {
|
||||
this.value = new ArrayList<>(values);
|
||||
}
|
||||
|
||||
public IntegerListValue(String valueAsString) throws NumberFormatException {
|
||||
List<Integer> value = new ArrayList<>();
|
||||
String[] values = valueAsString.split(",");
|
||||
for (String s : values) {
|
||||
value.add(Integer.parseInt(s.trim()));
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return StrolchValueType.INTEGER_LIST.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegerListValue add(List<Integer> o) {
|
||||
this.value.addAll(o);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueAsString() {
|
||||
if (this.value.isEmpty()) {
|
||||
return StringHelper.EMPTY;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Iterator<Integer> iter = this.value.iterator();
|
||||
while (iter.hasNext()) {
|
||||
|
||||
sb.append(iter.next());
|
||||
|
||||
if (iter.hasNext()) {
|
||||
sb.append(VALUE_SEPARATOR2);
|
||||
sb.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("IntegerListValue [value=");
|
||||
sb.append(this.value);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(IValue<List<Integer>> other) {
|
||||
return this.value.equals(other.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegerListValue getInverse() {
|
||||
return new IntegerListValue(this.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegerListValue getCopy() {
|
||||
return new IntegerListValue(this.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.value == null) ? 0 : this.value.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
IntegerListValue other = (IntegerListValue) obj;
|
||||
if (this.value == null) {
|
||||
if (other.value != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.value.equals(other.value)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(IValue<List<Integer>> o) {
|
||||
List<Integer> otherValues = o.getValue();
|
||||
if (this.value.equals(otherValues))
|
||||
return 0;
|
||||
return Integer.compare(this.value.size(), otherValues.size());
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ import li.strolch.utils.helper.StringHelper;
|
|||
*/
|
||||
public class StringSetValue implements IValue<Set<AString>>, Serializable {
|
||||
|
||||
private static Set<AString> neu = Collections.emptySet();
|
||||
private final static Set<AString> neu = Collections.emptySet();
|
||||
public static final IValue<Set<AString>> NEUTRAL = new StringSetValue(neu);
|
||||
|
||||
private Set<AString> aStrings = new HashSet<>();
|
||||
|
|
|
@ -17,15 +17,8 @@ package li.strolch.model.visitor;
|
|||
|
||||
import li.strolch.model.Order;
|
||||
import li.strolch.model.Resource;
|
||||
import li.strolch.model.parameter.*;
|
||||
import li.strolch.model.timedstate.FloatListTimedState;
|
||||
import li.strolch.model.timedstate.FloatTimedState;
|
||||
import li.strolch.model.timedstate.IntegerTimedState;
|
||||
import li.strolch.model.timedstate.StringSetTimedState;
|
||||
|
||||
/**
|
||||
* @param <U>
|
||||
*
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
public interface ActivityVisitor<U> extends StrolchRootElementVisitor<U> {
|
||||
|
@ -39,79 +32,4 @@ public interface ActivityVisitor<U> extends StrolchRootElementVisitor<U> {
|
|||
default U visitResource(Resource resource) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + resource.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitBooleanParam(BooleanParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitDateParam(DateParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitDurationParam(DurationParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitFloatParam(FloatParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitIntegerParam(IntegerParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitLongParam(LongParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitStringParam(StringParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitStringListParam(StringListParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitIntegerListParam(IntegerListParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitFloatListParam(FloatListParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitLongListParam(LongListParameter param) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + param.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitFloatState(FloatTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitFloatListState(FloatListTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitIntegerState(IntegerTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitStringState(StringSetTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,11 @@ public interface IActivityElementVisitor<U> extends StrolchElementVisitor<U> {
|
|||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitIntegerListState(IntegerListTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitIntegerState(IntegerTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
|
|
|
@ -62,6 +62,11 @@ public interface ParameterVisitor<U> extends StrolchElementVisitor<U> {
|
|||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitIntegerListState(IntegerListTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitIntegerState(IntegerTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
|
|
|
@ -58,6 +58,13 @@ public class SetStateValueVisitor implements TimedStateVisitor<Void> {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Void visitIntegerListState(IntegerListTimedState state) {
|
||||
state.getTimeEvolution().setValueAt(this.time, new IntegerListValue((List<Integer>) value));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitIntegerState(IntegerTimedState state) {
|
||||
state.getTimeEvolution().setValueAt(this.time, new IntegerValue((Integer) value));
|
||||
|
|
|
@ -344,161 +344,168 @@ public class StrolchElementDeepEqualsVisitor implements StrolchElementVisitor<Li
|
|||
|
||||
@Override
|
||||
public List<Locator> visitOrder(Order order) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), order.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), order.getClass());
|
||||
deepEquals((Order) this.srcElement, order);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitResource(Resource resource) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), resource.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), resource.getClass());
|
||||
deepEquals((Resource) this.srcElement, resource);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitActivity(Activity activity) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), activity.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), activity.getClass());
|
||||
deepEquals((Activity) this.srcElement, activity);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitAction(Action action) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), action.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), action.getClass());
|
||||
deepEquals((Action) this.srcElement, action);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitBooleanParam(BooleanParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitDateParam(DateParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitDurationParam(DurationParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitFloatParam(FloatParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitIntegerParam(IntegerParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitLongParam(LongParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitStringParam(StringParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitTextParam(TextParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitStringListParam(StringListParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitIntegerListParam(IntegerListParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitFloatListParam(FloatListParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitLongListParam(LongListParameter param) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), param.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), param.getClass());
|
||||
deepEquals((Parameter<?>) this.srcElement, param);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitBooleanState(BooleanTimedState state) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), state.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), state.getClass());
|
||||
deepEquals((StrolchTimedState<?>) this.srcElement, state);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitFloatState(FloatTimedState state) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), state.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), state.getClass());
|
||||
deepEquals((StrolchTimedState<?>) this.srcElement, state);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitFloatListState(FloatListTimedState state) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), state.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), state.getClass());
|
||||
deepEquals((StrolchTimedState<?>) this.srcElement, state);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitIntegerListState(IntegerListTimedState state) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), state.getClass());
|
||||
deepEquals((StrolchTimedState<?>) this.srcElement, state);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitIntegerState(IntegerTimedState state) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), state.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), state.getClass());
|
||||
deepEquals((StrolchTimedState<?>) this.srcElement, state);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitLongState(LongTimedState state) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), state.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), state.getClass());
|
||||
deepEquals((StrolchTimedState<?>) this.srcElement, state);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitStringState(StringSetTimedState state) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), state.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), state.getClass());
|
||||
deepEquals((StrolchTimedState<?>) this.srcElement, state);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locator> visitParameterBag(ParameterBag bag) {
|
||||
DBC.PRE.assertEquals("Can't compare apples with pairs =)", this.srcElement.getClass(), bag.getClass());
|
||||
DBC.PRE.assertEquals("Can't compare apples with pears =)", this.srcElement.getClass(), bag.getClass());
|
||||
deepEquals((ParameterBag) this.srcElement, bag);
|
||||
return getMismatchedLocators();
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ public interface StrolchElementVisitor<U> extends StrolchVisitor {
|
|||
|
||||
U visitFloatListState(FloatListTimedState state);
|
||||
|
||||
U visitIntegerListState(IntegerListTimedState state);
|
||||
|
||||
U visitIntegerState(IntegerTimedState state);
|
||||
|
||||
U visitStringState(StringSetTimedState state);
|
||||
|
|
|
@ -105,6 +105,11 @@ public interface StrolchRootElementVisitor<U> extends StrolchElementVisitor<U> {
|
|||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitIntegerListState(IntegerListTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
default U visitIntegerState(IntegerTimedState state) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " can not handle " + state.getClass());
|
||||
|
|
|
@ -506,6 +506,14 @@ public class ModelTest {
|
|||
assertEquals(asList(STATE_FLOAT_TIME_0, STATE_FLOAT_TIME_10, STATE_FLOAT_TIME_20),
|
||||
floatListState.getStateAt(STATE_TIME_30).getValue().getValue());
|
||||
|
||||
IntegerListTimedState intListState = resource.getTimedState(STATE_INTEGER_LIST_ID);
|
||||
assertNotNull("Integer List State missing with id " + STATE_INTEGER_ID, intListState);
|
||||
assertEquals(singletonList(STATE_INTEGER_TIME_0), intListState.getStateAt(STATE_TIME_0).getValue().getValue());
|
||||
assertEquals(singletonList(STATE_INTEGER_TIME_0), intListState.getStateAt(STATE_TIME_10).getValue().getValue());
|
||||
assertEquals(singletonList(STATE_INTEGER_TIME_0), intListState.getStateAt(STATE_TIME_20).getValue().getValue());
|
||||
assertEquals(asList(STATE_INTEGER_TIME_0, STATE_INTEGER_TIME_10, STATE_INTEGER_TIME_20),
|
||||
intListState.getStateAt(STATE_TIME_30).getValue().getValue());
|
||||
|
||||
IntegerTimedState integerState = resource.getTimedState(STATE_INTEGER_ID);
|
||||
assertNotNull("Integer State missing with id " + STATE_INTEGER_ID, integerState);
|
||||
assertEquals(STATE_INTEGER_TIME_0, integerState.getStateAt(STATE_TIME_0).getValue().getValue(), 0.0);
|
||||
|
|
Loading…
Reference in New Issue